Browse Source

Add some COMDAT sections

When using function/data sections option from
gcc, some additional un-packed sections get created
move these to there correct placement if not already
included

sections seen on x86/x86_64/aarch64:
.gcc_except_table.efi_main
.bss.debugging

.gcc_except_table.* only appears on objcopy archs

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
Callum Farmer 2 years ago
parent
commit
15f10734e7

+ 4 - 6
gnuefi/elf_aarch64_efi.lds

@@ -9,10 +9,9 @@ SECTIONS
   .hash : { *(.hash) }
   .gnu.hash : { *(.gnu.hash) }
   . = ALIGN(4096);
-  .eh_frame : 
-  { 
-    *(.eh_frame)
-  }
+  .eh_frame : { *(.eh_frame) }
+  .gcc_except_table : { *(.gcc_except_table*) }
+  . = ALIGN(4096);
   .text : {
     _text = .;
     *(.text)
@@ -48,7 +47,7 @@ SECTIONS
    *(.sbss)
    *(.scommon)
    *(.dynbss)
-   *(.bss)
+   *(.bss*)
    *(COMMON)
    *(.rel.local)
    . = ALIGN(16);
@@ -77,7 +76,6 @@ SECTIONS
   .ignored.reloc :
   {
     *(.rela.reloc)
-    *(.eh_frame)
     *(.note.GNU-stack)
   }
   .comment 0 : { *(.comment) }

+ 3 - 2
gnuefi/elf_ia32_efi.lds

@@ -8,6 +8,8 @@ SECTIONS
   /* .hash and/or .gnu.hash MUST come first! */
   .hash : { *(.hash) }
   .gnu.hash : { *(.gnu.hash) }
+  .eh_frame : { *(.eh_frame) }
+  .gcc_except_table : { *(.gcc_except_table*) }
   . = ALIGN(4096);
   .text :
   {
@@ -45,7 +47,7 @@ SECTIONS
    *(.sbss)
    *(.scommon)
    *(.dynbss)
-   *(.bss)
+   *(.bss*)
    *(COMMON)
   }
   .note.gnu.build-id : { *(.note.gnu.build-id) }
@@ -82,7 +84,6 @@ SECTIONS
   /DISCARD/ :
   {
     *(.rel.reloc)
-    *(.eh_frame)
     *(.note.GNU-stack)
   }
   .comment 0 : { *(.comment) }

+ 3 - 1
gnuefi/elf_ia64_efi.lds

@@ -8,6 +8,8 @@ SECTIONS
   /* .hash and/or .gnu.hash MUST come first! */
   .hash : { *(.hash) }
   .gnu.hash : { *(.gnu.hash) }
+  .eh_frame : { *(.eh_frame) }
+  .gcc_except_table : { *(.gcc_except_table*) }
   . = ALIGN(4096);
   .text :
   {
@@ -42,7 +44,7 @@ SECTIONS
    /* the EFI loader doesn't seem to like a .bss section, so we stick
       it all into .data: */
    *(.dynbss)
-   *(.bss)
+   *(.bss*)
    *(COMMON)
   }
   .note.gnu.build-id : { *(.note.gnu.build-id) }

+ 1 - 1
gnuefi/elf_mips64el_efi.lds

@@ -35,7 +35,7 @@ SECTIONS
    *(.sbss)
    *(.scommon)
    *(.dynbss)
-   *(.bss)
+   *(.bss*)
    *(COMMON)
    . = ALIGN(16);
    _bss_end = .;

+ 1 - 1
gnuefi/elf_riscv64_efi.lds

@@ -38,7 +38,7 @@ SECTIONS {
 		*(.sbss)
 		*(.scommon)
 		*(.dynbss)
-		*(.bss)
+		*(.bss*)
 		*(COMMON)
 		. = ALIGN(16);
 		_bss_end = .;

+ 3 - 6
gnuefi/elf_x86_64_efi.lds

@@ -10,10 +10,8 @@ SECTIONS
   .hash : { *(.hash) }
   .gnu.hash : { *(.gnu.hash) }
   . = ALIGN(4096);
-  .eh_frame : 
-  { 
-    *(.eh_frame)
-  }
+  .eh_frame : { *(.eh_frame) }
+  .gcc_except_table : { *(.gcc_except_table*) }
   . = ALIGN(4096);
   .text :
   {
@@ -44,7 +42,7 @@ SECTIONS
    *(.sbss)
    *(.scommon)
    *(.dynbss)
-   *(.bss)
+   *(.bss*)
    *(COMMON)
    *(.rel.local)
   }
@@ -72,7 +70,6 @@ SECTIONS
   .ignored.reloc :
   {
     *(.rela.reloc)
-    *(.eh_frame)
     *(.note.GNU-stack)
   }
   .comment 0 : { *(.comment) }