Here are the fix as suggested. For patch 2/4 I chosed to hardcore the value 512 instead of computing the fittest needed value. There are 3 reasons for that. - The header size may not need to be bigger than this in a near future. - There is an test in case increasing the header size would be needed. - It would make the code quite more complex to keep a consistent value for all the fields when the header size is not known from start. Celelibi (4): efi: Fix PE header field rva_and_sizes_nr efi: Location, size and alignment of .text section efi: Useless relocations in PE file efi: PE file size differ from in-memory size efi/i386/syslinux.ld | 4 +- efi/wrapper.c | 210 +++++++++++++++++-------------------------------- efi/wrapper.h | 28 ++++--- efi/x86_64/syslinux.ld | 4 +- 4 files changed, 91 insertions(+), 155 deletions(-) -- 1.8.4.3
H. Peter Anvin
2013-Dec-07 05:44 UTC
[syslinux] [PATCH v2 3/4] efi: Useless relocations in PE file
On 12/01/2013 02:14 PM, Celelibi wrote:> There is no need to have a relocation section that nothing points at. > The image is still seen as relocatable as long as the Characteristics of > the FileHeader do not say otherwise. > > Moreover, the field base_relocation_table wasn't initialized properly > leading to unpredictable bugs. > > Signed-off-by: Celelibi <celelibi at gmail.com>I seem to hear about some UEFI implementations which would fail to boot unless there is a relocation section... I believe we had to add one to the Linux kernel for that reason. Matt, does that match your recollection? -hpa