From bc233a7a4b1eef18e85928117d3851bf4bb94836 Mon Sep 17 00:00:00 2001 From: Callum Farmer Date: Wed, 22 Mar 2023 15:30:04 +0000 Subject: [PATCH] Prevent deletion of .reloc by gc-sections Add keyword KEEP to prevent .reloc being removed when using --gc-sections with GNU ld Signed-off-by: Callum Farmer --- gnuefi/elf_aarch64_efi.lds | 2 +- gnuefi/elf_ia32_efi.lds | 2 +- gnuefi/elf_ia64_efi.lds | 2 +- gnuefi/elf_x86_64_efi.lds | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gnuefi/elf_aarch64_efi.lds b/gnuefi/elf_aarch64_efi.lds index 468afb8..c02ea5c 100644 --- a/gnuefi/elf_aarch64_efi.lds +++ b/gnuefi/elf_aarch64_efi.lds @@ -26,7 +26,7 @@ SECTIONS . = ALIGN(4096); .reloc : { - *(.reloc) + KEEP (*(.reloc)) } . = ALIGN(65536); .dynamic : { *(.dynamic) } diff --git a/gnuefi/elf_ia32_efi.lds b/gnuefi/elf_ia32_efi.lds index 9db9328..98fa6a5 100644 --- a/gnuefi/elf_ia32_efi.lds +++ b/gnuefi/elf_ia32_efi.lds @@ -75,7 +75,7 @@ SECTIONS . = ALIGN(4096); .reloc : /* This is the PECOFF .reloc section! */ { - *(.reloc) + KEEP (*(.reloc)) } . = ALIGN(4096); .dynsym : { *(.dynsym) } diff --git a/gnuefi/elf_ia64_efi.lds b/gnuefi/elf_ia64_efi.lds index 0a217e4..0d6996b 100644 --- a/gnuefi/elf_ia64_efi.lds +++ b/gnuefi/elf_ia64_efi.lds @@ -70,7 +70,7 @@ SECTIONS . = ALIGN(4096); .reloc : /* This is the PECOFF .reloc section! */ { - *(.reloc) + KEEP (*(.reloc)) } . = ALIGN(4096); .dynsym : { *(.dynsym) } diff --git a/gnuefi/elf_x86_64_efi.lds b/gnuefi/elf_x86_64_efi.lds index 2f0ecaa..9ec9cc1 100644 --- a/gnuefi/elf_x86_64_efi.lds +++ b/gnuefi/elf_x86_64_efi.lds @@ -26,7 +26,7 @@ SECTIONS . = ALIGN(4096); .reloc : { - *(.reloc) + KEEP (*(.reloc)) } . = ALIGN(4096); .data :