aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvain Gault <sylvain.gault@gmail.com>2014-02-03 05:43:06 +0100
committerH. Peter Anvin <hpa@linux.intel.com>2014-02-14 16:31:44 -0800
commit9692baed476a71d5225174f8d7bba31bcc0393d1 (patch)
tree42603d9b7fe8449ed4221febda739146d66b4946
parent9e49e29e08e3263599def58630adac9fb72a737f (diff)
downloadsyslinux-9692baed476a71d5225174f8d7bba31bcc0393d1.tar.gz
syslinux-9692baed476a71d5225174f8d7bba31bcc0393d1.tar.xz
syslinux-9692baed476a71d5225174f8d7bba31bcc0393d1.zip
efi: Useless relocation section in PE file
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. Signed-off-by: Sylvain Gault <sylvain.gault@gmail.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--efi/wrapper.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/efi/wrapper.c b/efi/wrapper.c
index 2b966653..19881248 100644
--- a/efi/wrapper.c
+++ b/efi/wrapper.c
@@ -48,7 +48,7 @@ static void write_header(FILE *f, __uint32_t entry, size_t data_size,
{
struct optional_hdr o_hdr;
struct optional_hdr_pe32p o_hdr_pe32p;
- struct section t_sec, r_sec;
+ struct section t_sec;
struct extra_hdr e_hdr;
struct extra_hdr_pe32p e_hdr_pe32p;
struct coff_hdr c_hdr;
@@ -80,7 +80,7 @@ static void write_header(FILE *f, __uint32_t entry, size_t data_size,
fwrite(&hdr, sizeof(hdr), 1, f);
memset(&c_hdr, 0, sizeof(c_hdr));
- c_hdr.nr_sections = 2;
+ c_hdr.nr_sections = 1;
c_hdr.nr_syms = 1;
if (class == ELFCLASS32) {
c_hdr.arch = IMAGE_FILE_MACHINE_I386;
@@ -142,22 +142,6 @@ static void write_header(FILE *f, __uint32_t entry, size_t data_size,
fwrite(&t_sec, sizeof(t_sec), 1, f);
/*
- * Write our empty reloc section.
- */
- memset(&r_sec, 0, sizeof(r_sec));
- strcpy((char *)r_sec.name, ".reloc");
- r_sec.virtual_sz = 0;
- /* /!\ Attention! Some UEFI implementations require a valid virtual
- * address despite the virtual_sz = 0. */
- r_sec.virtual_address = t_sec.virtual_address;
- r_sec.raw_data_sz = r_sec.virtual_sz;
- r_sec.raw_data = r_sec.virtual_address;
- r_sec.characteristics = IMAGE_SCN_CNT_INITIALIZED_DATA |
- IMAGE_SCN_ALIGN_1BYTES | IMAGE_SCN_MEM_DISCARDABLE |
- IMAGE_SCN_MEM_READ;
- fwrite(&r_sec, sizeof(r_sec), 1, f);
-
- /*
* Add some padding to align the ELF as needed
*/
if (ftell(f) > t_sec.virtual_address) {