From nobody Fri Oct 2 06:59:33 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D90E13D967D; Tue, 4 Aug 2026 10:31:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785839518; cv=none; b=qo9qZqdwaCbp38ERyb77aWUyzUwPd+phRMcm0/Bd0LDMnpyUGg7fswErszPXK38HXR5USV2gz39AH57cmPATZxqQsLxSW9Md/wGgqdZkb5cllF1WTuvoyE8SN0lHK0dKDLgYjXqwKq0Si8C6PVrb/qkJ2g4ciywnBzhvDlkSwAc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785839518; c=relaxed/simple; bh=h6N14Jtg6g08iHb5P2siHujpfx3IvxvZsC16gdYBuE4=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=M/Zh3HGTaPxXxT8nTYwRZ8xPS9uLy22jUmPDu1Dkpzc9xQW8In+c7V8hMUU9vL6J8/TDliacUTRTBur4uw6OfKvMA9yX2mzX+QTiVsiTHSRNK3d0+jULKylsDRIBawVlzw+fvR3q4ztdPy93XZ3QG8Ow9JOGY2CcdVr89goBfhg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=f48n33Cw; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=fycyFwMu; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="f48n33Cw"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="fycyFwMu" Date: Tue, 04 Aug 2026 10:31:53 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1785839515; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hYadtwNQfJMpnTLBxTn4lVXyqm8gqqTgSCdednWm6Yk=; b=f48n33CwIEPFIKodLkJ+I7ZN6yMLNFLkUQkonBPHH6FEiF+wai8d+kFTXvBzZ5/2K0BOZ1 IOM5bQudic48/vIwxZjhgK5mA+IugHCAqOjQDxwvVSp3sU03b13EqJkf6rz6nRTMwpdBER ba5kXPdqXs8yas6q2cAy9yeJLoK0gJ64LBOuK/RQNjLCl0D60WqtEH4PPXfkR2cf9924E/ huPn0QqAT9ERvEFW1aE4Fn2x+twe3hTRxe8AlZKkRFEdqVKwb4nj4KvY+SlDKQnnBxn5qb yEeJPE4H1lBva5XUiahrhxy3+RJgqjBy3KH94jbZlfPsVAJbhnnIBg6d8xvvCw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1785839515; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hYadtwNQfJMpnTLBxTn4lVXyqm8gqqTgSCdednWm6Yk=; b=fycyFwMuGIywWkAOdLNIkoBo/wkm621q+1uQt+smFuFKnthblqZu3TwLfQzDxZ5lI7lvJk J+jdeWW9Rw7UnTAw== From: "tip-bot2 for Fangrui Song" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] riscv/runtime-const: Disable linker relaxation for RUNTIME_MAGIC Cc: Nathan Chancellor , Fangrui Song , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260802174342.597092-1-i@maskray.me> References: <20260802174342.597092-1-i@maskray.me> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178583951365.1210945.17100912147252432315.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the locking/core branch of tip: Commit-ID: 0f289334af68a1331d4a2d2a95799ffa4ff8a046 Gitweb: https://git.kernel.org/tip/0f289334af68a1331d4a2d2a95799ffa4= ff8a046 Author: Fangrui Song AuthorDate: Sun, 02 Aug 2026 10:43:42 -07:00 Committer: Peter Zijlstra CommitterDate: Tue, 04 Aug 2026 12:29:45 +02:00 riscv/runtime-const: Disable linker relaxation for RUNTIME_MAGIC Commit ee10b1028129 ("riscv/runtime-const: Replace open-coded placeholder with RUNTIME_MAGIC") switched the lui + addi[w] placeholder from hand-encoded immediates to %hi()/%lo() of RUNTIME_MAGIC. GNU Assembler folds %hi()/%lo() of an absolute expression at assembly time. LLVM's integrated assembler since 21.1 defers it to the linker instead, which range checks it: on riscv64 R_RISCV_HI20 must fit a signed 20-bit field, and RUNTIME_MAGIC (0x89ABCDEF) is a positive 64-bit value rather than a sign-extended 32-bit one, so it does not: ld.lld: error: relocation R_RISCV_HI20 out of range: 563901 is not in [-524288, 524287] The sequence is patched at runtime and its instruction offsets are recorded via ".long 1b - .", so the linker must not touch it in the first place. Add ".option norelax", as is already done for ALTERNATIVE() and static keys; the integrated assembler then resolves %hi()/%lo() itself and emits no relocation, restoring the exact encoding the open-coded placeholder produced. Fixes: ee10b1028129 ("riscv/runtime-const: Replace open-coded placeholder w= ith RUNTIME_MAGIC") Closes: https://github.com/ClangBuiltLinux/linux/issues/2179 Reported-by: Nathan Chancellor Signed-off-by: Fangrui Song Signed-off-by: Peter Zijlstra (Intel) Link: https://patch.msgid.link/20260802174342.597092-1-i@maskray.me --- arch/riscv/include/asm/runtime-const.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/riscv/include/asm/runtime-const.h b/arch/riscv/include/as= m/runtime-const.h index a472ebb..ce2008b 100644 --- a/arch/riscv/include/asm/runtime-const.h +++ b/arch/riscv/include/asm/runtime-const.h @@ -23,6 +23,7 @@ typeof(sym) __ret; \ asm_inline(".option push\n\t" \ ".option norvc\n\t" \ + ".option norelax\n\t" \ "1:\t" \ "lui %[__ret], %%hi(" RUNTIME_MAGIC ")\n\t" \ "addi %[__ret],%[__ret], %%lo(" RUNTIME_MAGIC ")\n\t" \ @@ -47,6 +48,7 @@ #define RISCV_RUNTIME_CONST_64_PREAMBLE \ ".option push\n\t" \ ".option norvc\n\t" \ + ".option norelax\n\t" \ "1:\t" \ "lui %[__ret], %%hi(" RUNTIME_MAGIC ")\n\t" \ "lui %[__tmp], %%hi(" RUNTIME_MAGIC ")\n\t" \