Skip to content

Commit d6ee652

Browse files
MaskRaysuryasaimadhu
authored andcommitted
x86/boot: Discard .discard.unreachable for arch/x86/boot/compressed/vmlinux
With commit ce5e3f9 ("efi/printf: Add 64-bit and 8-bit integer support") arch/x86/boot/compressed/vmlinux may have an undesired .discard.unreachable section coming from drivers/firmware/efi/libstub/vsprintf.stub.o. That section gets generated from unreachable() annotations when CONFIG_STACK_VALIDATION is enabled. .discard.unreachable contains an R_X86_64_PC32 relocation which will be warned about by LLD: a non-SHF_ALLOC section (.discard.unreachable) is not part of the memory image, thus conceptually the distance between a non-SHF_ALLOC and a SHF_ALLOC is not a constant which can be resolved at link time: % ld.lld -m elf_x86_64 -T arch/x86/boot/compressed/vmlinux.lds ... -o arch/x86/boot/compressed/vmlinux ld.lld: warning: vsprintf.c:(.discard.unreachable+0x0): has non-ABS relocation R_X86_64_PC32 against symbol '' Reuse the DISCARDS macro which includes .discard.* to drop .discard.unreachable. [ bp: Massage and complete the commit message. ] Reported-by: kbuild test robot <[email protected]> Signed-off-by: Fangrui Song <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Reviewed-by: Kees Cook <[email protected]> Tested-by: Arvind Sankar <[email protected]> Tested-by: Sedat Dilek <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 675a59b commit d6ee652

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arch/x86/boot/compressed/vmlinux.lds.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,6 @@ SECTIONS
7373
#endif
7474
. = ALIGN(PAGE_SIZE); /* keep ZO size page aligned */
7575
_end = .;
76+
77+
DISCARDS
7678
}

0 commit comments

Comments
 (0)