From 15f10734e7e8354a6b4477046ea67d495348de0c Mon Sep 17 00:00:00 2001 From: Callum Farmer Date: Fri, 3 Mar 2023 20:30:23 +0000 Subject: 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 --- gnuefi/elf_aarch64_efi.lds | 10 ++++------ gnuefi/elf_ia32_efi.lds | 5 +++-- gnuefi/elf_ia64_efi.lds | 4 +++- gnuefi/elf_mips64el_efi.lds | 2 +- gnuefi/elf_riscv64_efi.lds | 2 +- gnuefi/elf_x86_64_efi.lds | 9 +++------ 6 files changed, 15 insertions(+), 17 deletions(-) (limited to 'gnuefi') diff --git a/gnuefi/elf_aarch64_efi.lds b/gnuefi/elf_aarch64_efi.lds index 8c0fad0..3508ada 100644 --- a/gnuefi/elf_aarch64_efi.lds +++ b/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) } diff --git a/gnuefi/elf_ia32_efi.lds b/gnuefi/elf_ia32_efi.lds index 7c3e59a..ef99087 100644 --- a/gnuefi/elf_ia32_efi.lds +++ b/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) } diff --git a/gnuefi/elf_ia64_efi.lds b/gnuefi/elf_ia64_efi.lds index e76d67d..05b0f36 100644 --- a/gnuefi/elf_ia64_efi.lds +++ b/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) } diff --git a/gnuefi/elf_mips64el_efi.lds b/gnuefi/elf_mips64el_efi.lds index 69cb3a5..e53a16d 100644 --- a/gnuefi/elf_mips64el_efi.lds +++ b/gnuefi/elf_mips64el_efi.lds @@ -35,7 +35,7 @@ SECTIONS *(.sbss) *(.scommon) *(.dynbss) - *(.bss) + *(.bss*) *(COMMON) . = ALIGN(16); _bss_end = .; diff --git a/gnuefi/elf_riscv64_efi.lds b/gnuefi/elf_riscv64_efi.lds index 2f84758..453ef79 100644 --- a/gnuefi/elf_riscv64_efi.lds +++ b/gnuefi/elf_riscv64_efi.lds @@ -38,7 +38,7 @@ SECTIONS { *(.sbss) *(.scommon) *(.dynbss) - *(.bss) + *(.bss*) *(COMMON) . = ALIGN(16); _bss_end = .; diff --git a/gnuefi/elf_x86_64_efi.lds b/gnuefi/elf_x86_64_efi.lds index b1379ee..3a8e140 100644 --- a/gnuefi/elf_x86_64_efi.lds +++ b/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) } -- cgit v1.2.1