Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Nathan Chancellor <nathan@kernel.org>,
	Nicolas Schier <nsc@kernel.org>,
	 Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	 Nick Desaulniers <nick.desaulniers+lkml@gmail.com>
Cc: linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
	 linux-kbuild@vger.kernel.org, Thomas Gleixner <tglx@kernel.org>,
	 Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	 Dave Hansen <dave.hansen@linux.intel.com>,
	 Peter Zijlstra <peterz@infradead.org>,
	x86@kernel.org,  "H. Peter Anvin" <hpa@zytor.com>,
	Ard Biesheuvel <ardb@kernel.org>
Subject: [PATCH 12/14] x86/module: Revert "Deal with GOT based stack cookie load on Clang < 17"
Date: Tue, 28 Apr 2026 22:59:18 -0400	[thread overview]
Message-ID: <20260428-bump-minimum-supported-llvm-version-to-17-v1-12-81d9b2e8ee75@kernel.org> (raw)
In-Reply-To: <20260428-bump-minimum-supported-llvm-version-to-17-v1-0-81d9b2e8ee75@kernel.org>

Now that the minimum supported version of LLVM for building the kernel
has been raised to 17.0.1, the workaround added by

  78c4374ef8b8 ("x86/module: Deal with GOT based stack cookie load on Clang < 17")

will never be included, as the final clause in the preprocessor
conditional is always false. Revert the change to clean up the dead
code.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
Cc: Thomas Gleixner <tglx@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: x86@kernel.org
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ard Biesheuvel <ardb@kernel.org>
---
 arch/x86/include/asm/elf.h |  5 ++---
 arch/x86/kernel/module.c   | 15 ---------------
 2 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
index c7f98977663c..0de9df759c99 100644
--- a/arch/x86/include/asm/elf.h
+++ b/arch/x86/include/asm/elf.h
@@ -54,9 +54,8 @@ typedef struct user_i387_struct elf_fpregset_t;
 #define R_X86_64_GLOB_DAT	6	/* Create GOT entry */
 #define R_X86_64_JUMP_SLOT	7	/* Create PLT entry */
 #define R_X86_64_RELATIVE	8	/* Adjust by program base */
-#define R_X86_64_GOTPCREL	9	/* 32 bit signed pc relative offset to GOT */
-#define R_X86_64_GOTPCRELX	41
-#define R_X86_64_REX_GOTPCRELX	42
+#define R_X86_64_GOTPCREL	9	/* 32 bit signed pc relative
+					   offset to GOT */
 #define R_X86_64_32		10	/* Direct 32 bit zero extended */
 #define R_X86_64_32S		11	/* Direct 32 bit sign extended */
 #define R_X86_64_16		12	/* Direct 16 bit zero extended */
diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c
index 11c45ce42694..b5b4de4f08e6 100644
--- a/arch/x86/kernel/module.c
+++ b/arch/x86/kernel/module.c
@@ -19,7 +19,6 @@
 #include <linux/jump_label.h>
 #include <linux/random.h>
 #include <linux/memory.h>
-#include <linux/stackprotector.h>
 
 #include <asm/text-patching.h>
 #include <asm/page.h>
@@ -132,20 +131,6 @@ static int __write_relocate_add(Elf64_Shdr *sechdrs,
 				goto overflow;
 			size = 4;
 			break;
-#if defined(CONFIG_STACKPROTECTOR) && \
-    defined(CONFIG_CC_IS_CLANG) && CONFIG_CLANG_VERSION < 170000
-		case R_X86_64_REX_GOTPCRELX: {
-			static unsigned long __percpu *const addr = &__stack_chk_guard;
-
-			if (sym->st_value != (u64)addr) {
-				pr_err("%s: Unsupported GOTPCREL relocation\n", me->name);
-				return -ENOEXEC;
-			}
-
-			val = (u64)&addr + rel[i].r_addend;
-			fallthrough;
-		}
-#endif
 		case R_X86_64_PC32:
 		case R_X86_64_PLT32:
 			val -= (u64)loc;

-- 
2.54.0


  parent reply	other threads:[~2026-04-29  3:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-29  2:59 [PATCH 00/14] Bump minimum version of LLVM for building the kernel to 17.0.1 Nathan Chancellor
2026-04-29  2:59 ` [PATCH 01/14] kbuild: " Nathan Chancellor
2026-05-05 15:27   ` Nicolas Schier
2026-05-05 18:26     ` Daniel Pereira
2026-05-06  6:21       ` Nathan Chancellor
2026-05-06 12:33         ` Daniel Pereira
2026-04-29  2:59 ` [PATCH 02/14] security/Kconfig.hardening: Remove tautological condition from CC_HAS_ZERO_CALL_USED_REGS Nathan Chancellor
2026-05-05 15:28   ` Nicolas Schier
2026-04-29  2:59 ` [PATCH 03/14] security/Kconfig.hardening: Remove tautological condition from FORTIFY_SOURCE Nathan Chancellor
2026-05-05 15:28   ` Nicolas Schier
2026-04-29  2:59 ` [PATCH 04/14] security/Kconfig.hardening: Remove tautological condition from CC_HAS_RANDSTRUCT Nathan Chancellor
2026-05-05 15:28   ` Nicolas Schier
2026-04-29  2:59 ` [PATCH 05/14] arch/Kconfig: Remove tautological conditions from HAS_LTO_CLANG Nathan Chancellor
2026-05-05 15:30   ` Nicolas Schier
2026-04-29  2:59 ` [PATCH 06/14] arch/Kconfig: Remove tautological condition from AUTOFDO_CLANG Nathan Chancellor
2026-04-29 16:43   ` Rong Xu
2026-04-29  2:59 ` [PATCH 07/14] ARM: Drop tautological ld.lld conditions from ARCH_MULTI_V4{,T} Nathan Chancellor
2026-04-29  2:59 ` [PATCH 08/14] riscv: Remove tautological condition from selection of ARCH_SUPPORTS_CFI Nathan Chancellor
2026-04-29  2:59 ` [PATCH 09/14] riscv: Drop tautological condition from TOOLCHAIN_NEEDS_OLD_ISA_SPEC Nathan Chancellor
2026-04-29  2:59 ` [PATCH 10/14] scripts/Makefile.warn: Drop -Wformat handling for clang < 16 Nathan Chancellor
2026-05-05 15:31   ` Nicolas Schier
2026-04-29  2:59 ` [PATCH 11/14] x86/build: Drop unused '-ffreestanding' addition to KBUILD_CFLAGS Nathan Chancellor
2026-04-29 17:24   ` Nathan Chancellor
2026-04-29  2:59 ` Nathan Chancellor [this message]
2026-04-29  7:10   ` [PATCH 12/14] x86/module: Revert "Deal with GOT based stack cookie load on Clang < 17" Ard Biesheuvel
2026-04-29  2:59 ` [PATCH 13/14] x86/entry/vdso32: Remove conditional omission of '.cfi_offset eflags' Nathan Chancellor
2026-04-29  3:15   ` H. Peter Anvin
2026-04-29  2:59 ` [PATCH 14/14] kbuild: Remove check for broken scoping with clang < 17 in CC_HAS_ASM_GOTO_OUTPUT Nathan Chancellor
2026-05-05 15:32   ` Nicolas Schier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260428-bump-minimum-supported-llvm-version-to-17-v1-12-81d9b2e8ee75@kernel.org \
    --to=nathan@kernel.org \
    --cc=ardb@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=justinstitt@google.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mingo@redhat.com \
    --cc=morbo@google.com \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=nsc@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox