From 18582a05fc65fc8835220c27528ef8902f5da60e Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Fri, 24 Nov 2023 12:16:49 +0000 Subject: [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 --- src/util/elf2efi.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/util') diff --git a/src/util/elf2efi.c b/src/util/elf2efi.c index c98c4d4a..171e2b58 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 ) ) { -- cgit v1.2.3-55-g7522