Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

x86/boot: Check startup code for absence of absolute relocations

Invoke objtool on each startup code object individually to check for the
absence of absolute relocations. This is needed because this code will
be invoked from the 1:1 mapping of memory before those absolute virtual
addresses (which are derived from the kernel virtual base address
provided to the linker and possibly shifted at boot) are mapped.

Only objects built under arch/x86/boot/startup/ have this restriction,
and once they have been incorporated into vmlinux.o, this distinction is
difficult to make. So force the invocation of objtool for each object
file individually, even if objtool is deferred to vmlinux.o for the rest
of the build. In the latter case, only pass --noabs and nothing else;
otherwise, append it to the existing objtool command line.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/20250828102202.1849035-40-ardb+git@google.com

authored by

Ard Biesheuvel and committed by
Borislav Petkov (AMD)
296650c8 0d6e4563

+8
+8
arch/x86/boot/startup/Makefile
··· 19 19 20 20 obj-$(CONFIG_X86_64) += gdt_idt.o map_kernel.o 21 21 obj-$(CONFIG_AMD_MEM_ENCRYPT) += sme.o sev-startup.o 22 + pi-objs := $(patsubst %.o,$(obj)/%.o,$(obj-y)) 22 23 23 24 lib-$(CONFIG_X86_64) += la57toggle.o 24 25 lib-$(CONFIG_EFI_MIXED) += efi-mixed.o ··· 29 28 # to be linked into the decompressor or the EFI stub but not vmlinux 30 29 # 31 30 $(patsubst %.o,$(obj)/%.o,$(lib-y)): OBJECT_FILES_NON_STANDARD := y 31 + 32 + # 33 + # Invoke objtool for each object individually to check for absolute 34 + # relocations, even if other objtool actions are being deferred. 35 + # 36 + $(pi-objs): objtool-enabled = 1 37 + $(pi-objs): objtool-args = $(if $(delay-objtool),,$(objtool-args-y)) --noabs