File comdat.patch of Package gnu-efi
From 3e0f5cd844e5482939c16147e1d8f4909d8af89a Mon Sep 17 00:00:00 2001
From: Callum Farmer <gmbr3@opensuse.org>
Date: Fri, 3 Mar 2023 20:30:23 +0000
Subject: [PATCH] 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
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
---
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(-)
diff --git a/gnuefi/elf_aarch64_efi.lds b/gnuefi/elf_aarch64_efi.lds
index 8c0fad0..990e647 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..6927e2f 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..7c56e55 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..ac8c971 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) }
--
2.31.1