aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2023-11-24 12:16:49 +0000
committerMichael Brown <mcb30@ipxe.org>2023-11-24 12:16:49 +0000
commit18582a05fc65fc8835220c27528ef8902f5da60e (patch)
tree1cb8afcd1ae4efce2e1c269ae442dfa47a1ac7bc
parent6714b20ea20af5046cdb36b58ab777b55a3c003c (diff)
downloadipxe-18582a05fc65fc8835220c27528ef8902f5da60e.zip
ipxe-18582a05fc65fc8835220c27528ef8902f5da60e.tar.gz
ipxe-18582a05fc65fc8835220c27528ef8902f5da60e.tar.bz2
[efi] Treat 16-bit sections as hidden in hybrid binaries
Hybrid bzImage and UEFI binaries (such as wimboot) may include 16-bit sections such as .bss16 that do not need to consume an entry in the PE section list. Treat any such sections as hidden. Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/util/elf2efi.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/util/elf2efi.c b/src/util/elf2efi.c
index c98c4d4..171e2b5 100644
--- a/src/util/elf2efi.c
+++ b/src/util/elf2efi.c
@@ -653,6 +653,12 @@ static struct pe_section * process_section ( struct elf_file *elf,
}
}
+ /* Treat 16-bit sections as hidden in hybrid binaries */
+ if ( opts->hybrid && ( strlen ( name ) > 2 ) &&
+ ( strcmp ( &name[ strlen ( name ) - 2 ], "16" ) == 0 ) ) {
+ new->hidden = 1;
+ }
+
/* Fill in section characteristics and update RVA limits */
if ( ( shdr->sh_type == SHT_PROGBITS ) &&
( shdr->sh_flags & SHF_WRITE ) ) {