]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
s390: link vmlinux with '-z notext'
authorNathan Chancellor <nathan@kernel.org>
Thu, 8 Feb 2024 00:15:03 +0000 (17:15 -0700)
committerHeiko Carstens <hca@linux.ibm.com>
Wed, 14 Feb 2024 12:50:53 +0000 (13:50 +0100)
ld.bfd defaults to '-z notext' (although it is customizable with the
'--enable-textrel-check' configure option) but ld.lld defaults to '-z
text', which causes issues with building the kernel due to the presence
of dynamic relocations in sections that are not writable.

  ld.lld: error: relocation R_390_64 cannot be used against local symbol; recompile with -fPIC

Add '-z notext' to avoid these errors, as this is expected, which
matches other architectures.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Justin Stitt <justinstitt@google.com>
Reviewed-by: Fangrui Song <maskray@google.com>
Link: https://lore.kernel.org/r/20240207-s390-lld-and-orphan-warn-v1-11-8a665b3346ab@kernel.org
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/Makefile

index 73873e4516866ab16239edc1427f7889d954acff..994f9b3d575ff091f5b3c504efea22117faeb797 100644 (file)
@@ -15,7 +15,7 @@ KBUILD_CFLAGS_MODULE += -fPIC
 KBUILD_AFLAGS  += -m64
 KBUILD_CFLAGS  += -m64
 KBUILD_CFLAGS  += -fPIE
-LDFLAGS_vmlinux        := -pie
+LDFLAGS_vmlinux        := -pie -z notext
 aflags_dwarf   := -Wa,-gdwarf-2
 KBUILD_AFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -D__ASSEMBLY__
 ifndef CONFIG_AS_IS_LLVM