x86: define _end in the EFI linker scripts
PATCH 1/1 x86: define _end in the EFI linker scripts
common/kallsyms.c uses _end as the fallback symbol end for the last symbol in the kallsyms table, and the X86 architecture selects HAS_KALLSYMS unconditionally. The x86 EFI linker scripts, however, only define __bss_stop and _edata, so any x86_64 build with CONFIG_KALLSYMS enabled fails to link:
ld: common/kallsyms.o: in function `get_symbol_pos':
kallsyms.c:(.text+0x1e6): undefined reference to `_end'
The other architectures all end their linker script with _end, so add it to both the 64-bit and the 32-bit EFI script for consistency.
--- arch/x86/mach-efi/elf_ia32_efi.lds.S | 1 + arch/x86/mach-efi/elf_x86_64_efi.lds.S | 1 + 2 files changed, 2 insertions(+)
arch/x86/mach-efi/elf_ia32_efi.lds.S +1 -0
@@ -88,4 +88,5 @@ SECTIONS } .comment 0 : { *(.comment) } + _end = .; }
arch/x86/mach-efi/elf_x86_64_efi.lds.S +1 -0
@@ -82,4 +82,5 @@ SECTIONS } .comment 0 : { *(.comment) } + _end = .; }
Signature · 1 line
2.54.0
Please drop this one.
вт, 1 дек. 2026 г. в 12:09, Alexander Shiyan <[email protected]>:
Quoted 43 lines
common/kallsyms.cuses_endas the fallback symbol end for the last symbol in the kallsyms table, and the X86 architecture selectsHAS_KALLSYMSunconditionally. The x86 EFI linker scripts, however, only define__bss_stopand_edata, so anyx86_64build withCONFIG_KALLSYMSenabled fails to link:ld:
common/kallsyms.o: in function `get_symbol_pos':
kallsyms.c:(.text+0x1e6): undefined reference to `_end'The other architectures all end their linker script with
_end, so add it to both the 64-bit and the 32-bit EFI script for consistency.Fixes d44fdb7d9b85 ("x86: drop legacy (PC BIOS) boot in favor of EFI")Signed-off-by Alexander Shiyan <[email protected]>--- arch/x86/mach-efi/elf_ia32_efi.lds.S | 1 + arch/x86/mach-efi/elf_x86_64_efi.lds.S | 1 + 2 files changed, 2 insertions(+)arch/x86/mach-efi/elf_ia32_efi.lds.S +1
-0@@ -88,4 +88,5 @@ SECTIONS } .comment 0 : { *(.comment) } + _end = .; }arch/x86/mach-efi/elf_x86_64_efi.lds.S +1
-1@@ -82,4 +82,5 @@ SECTIONS } .comment 0 : { *(.comment) } + _end = .; } --2.54.0