Skip to contentSkip to conversation

x86: define _end in the EFI linker scripts

PATCH In review Alexander Shiyan 1 participant 2 messages Dec 1 x86

lore
Share & tools
lore
#0 lore raw

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.

Fixes d44fdb7d9b85 ("x86: drop legacy (PC BIOS) boot in favor of EFI")
---
 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
index 0a3b6ef947..6f7dc3f551 100644
@@ -88,4 +88,5 @@ SECTIONS
 	}
 
 	.comment 0 : { *(.comment) }
+	_end = .;
 }
arch/x86/mach-efi/elf_x86_64_efi.lds.S +1 -0
index ed2ddd5248..fde296e571 100644
@@ -82,4 +82,5 @@ SECTIONS
 	}
 
 	.comment 0 : { *(.comment) }
+	_end = .;
 }
Signature · 1 line
2.54.0
#1 lore raw

Please drop this one.

вт, 1 дек. 2026 г. в 12:09, Alexander Shiyan <[email protected]>:

Quoted 43 lines

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.

Fixes d44fdb7d9b85 ("x86: drop legacy (PC BIOS) boot in favor of EFI")
---
 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
index 0a3b6ef947..6f7dc3f551 100644
@@ -88,4 +88,5 @@ SECTIONS
        }
 
        .comment 0 : { *(.comment) }
+       _end = .;
 }
arch/x86/mach-efi/elf_x86_64_efi.lds.S +1 -1
index ed2ddd5248..fde296e571 100644
@@ -82,4 +82,5 @@ SECTIONS
        }
 
        .comment 0 : { *(.comment) }
+       _end = .;
 }
--

2.54.0