From 746a703079f37122453481198d0ee4cc37f98448 Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Fri, 9 Dec 2022 15:46:13 +0000 Subject: [PATCH] zipl/boot: discard `.eh_frame` and `.interp` input sections MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ELF section `.eh_frame` is used for frame unwinding during, for example, exception handling and the section `.interp` is used by the program interpreter. [1] Since no frame unwinding nor a program interpreter is used for the bootloaders we can discard these input section. The content of the (exec|bin) files don't change after this change. [1] https://refspecs.linuxfoundation.org/LSB_1.2.0/gLSB/specialsections.html Reviewed-by: Stefan Haberland Signed-off-by: Marc Hartmayer Signed-off-by: Jan Höppner --- zipl/boot/stage2.lds.S | 7 ++++++- zipl/boot/stage3.lds.S | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/zipl/boot/stage2.lds.S b/zipl/boot/stage2.lds.S index c4c94566..eee1d3c2 100644 --- a/zipl/boot/stage2.lds.S +++ b/zipl/boot/stage2.lds.S @@ -88,6 +88,11 @@ SECTIONS } __stack_end = .; - .eh_frame : { *(.eh_frame) } .note.gnu.build-id : { *(.note.gnu.build-id) } + + /* Sections to be discarded */ + /DISCARD/ : { + *(.eh_frame) + *(.interp) + } } diff --git a/zipl/boot/stage3.lds.S b/zipl/boot/stage3.lds.S index d8305f11..9cea19b8 100644 --- a/zipl/boot/stage3.lds.S +++ b/zipl/boot/stage3.lds.S @@ -39,7 +39,6 @@ SECTIONS __ex_table_start = .; .ex_table : { *(.ex_table) } __ex_table_stop = .; - .eh_frame : { *(.eh_frame) } __bss_start = .; .bss : { *(.bss) } @@ -75,4 +74,10 @@ SECTIONS .notes : { *(.note.*) } + + /* Sections to be discarded */ + /DISCARD/ : { + *(.eh_frame) + *(.interp) + } }