Skip to content

Commit 4497727

Browse files
nickdesaulniersgregkh
authored andcommitted
arm64: link with -z norelro regardless of CONFIG_RELOCATABLE
commit 3b92fa7 upstream. With CONFIG_EXPERT=y, CONFIG_KASAN=y, CONFIG_RANDOMIZE_BASE=n, CONFIG_RELOCATABLE=n, we observe the following failure when trying to link the kernel image with LD=ld.lld: error: section: .exit.data is not contiguous with other relro sections ld.lld defaults to -z relro while ld.bfd defaults to -z norelro. This was previously fixed, but only for CONFIG_RELOCATABLE=y. Fixes: 3bbd3db ("arm64: relocatable: fix inconsistencies in linker script and options") Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20201016175339.2429280-1-ndesaulniers@google.com Signed-off-by: Will Deacon <will@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0c4636d commit 4497727

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

arch/arm64/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
#
1111
# Copyright (C) 1995-2001 by Russell King
1212

13-
LDFLAGS_vmlinux :=--no-undefined -X
13+
LDFLAGS_vmlinux :=--no-undefined -X -z norelro
1414
CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET)
1515

1616
ifeq ($(CONFIG_RELOCATABLE), y)
1717
# Pass --no-apply-dynamic-relocs to restore pre-binutils-2.27 behaviour
1818
# for relative relocs, since this leads to better Image compression
1919
# with the relocation offsets always being zero.
20-
LDFLAGS_vmlinux += -shared -Bsymbolic -z notext -z norelro \
20+
LDFLAGS_vmlinux += -shared -Bsymbolic -z notext \
2121
$(call ld-option, --no-apply-dynamic-relocs)
2222
endif
2323

0 commit comments

Comments
 (0)