x86/build: Keep local relocations with ld.lld
PATCH 1/1 x86/build: Keep local relocations with ld.lld
The LLVM linker (ld.lld) defaults to removing local relocations, which causes KASLR boot failures. ld.bfd and ld.gold already handle this correctly. This adds the explicit instruction "--discard-none" during the link phase. There is no change in output for ld.bfd and ld.gold, but ld.lld now produces an image with all the needed relocations.
--- arch/x86/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/Makefile +1 -1
@@ -47,7 +47,7 @@ export REALMODE_CFLAGS export BITS ifdef CONFIG_X86_NEED_RELOCS - LDFLAGS_vmlinux := --emit-relocs + LDFLAGS_vmlinux := --emit-relocs --discard-none endif #
Signature · 5 lines
2.17.1 -- Kees Cook
tip-bot for Kees Cook
merge botx86/build: Keep local relocations with ld.lld
Commit-ID: 7c21383f3429dd70da39c0c7f1efa12377a47ab6 Gitweb: https://git.kernel.org/tip/7c21383f3429dd70da39c0c7f1efa12377a47ab6 Author: Kees Cook <[email protected]> AuthorDate: Thu, 4 Apr 2019 14:40:27 -0700 Committer: Borislav Petkov <[email protected]> CommitDate: Fri, 5 Apr 2019 12:34:35 +0200
x86/build: Keep local relocations with ld.lld
The LLVM linker (ld.lld) defaults to removing local relocations, which causes KASLR boot failures. ld.bfd and ld.gold already handle this correctly. This adds the explicit instruction "--discard-none" during the link phase. There is no change in output for ld.bfd and ld.gold, but ld.lld now produces an image with all the needed relocations.
--- arch/x86/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/Makefile +1 -1
@@ -47,7 +47,7 @@ export REALMODE_CFLAGS export BITS ifdef CONFIG_X86_NEED_RELOCS - LDFLAGS_vmlinux := --emit-relocs + LDFLAGS_vmlinux := --emit-relocs --discard-none endif #