From nobody Fri Dec 19 20:32:34 2025 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 6D1EB30C371; Tue, 14 Oct 2025 13:05:52 +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=1760447154; cv=none; b=peqrYPMMbaK0/xdkxyvOgES2F5O1j2ukn8Wfcx9dQ1ANbd9PPChZzSboYIigEx0ARQ7lVdEpFf5BM95RRuCvxX0vVXxwRL4tHj/COdUVZZhFoywwRfa1n0JjhSQX98SFjNI3pFwwWE+BswaF94uCbDugsjkqbr5hNMhJJjihfI4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760447154; c=relaxed/simple; bh=IDhCA1BagrOzAKjk7RuNtb+m/Zg87sOWHgJNO4N/lzs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=D14ud+ygD7rgKs412m2klwfGPnxsNKyEjcFQpWcg4sY2s6mEEkCk6lz/1In9Q6zZnLzeeke6X/W1100hDixR/IP/YbKfiDaYBglntAc4EA+iIPFgI3Yof5JXZ/VLZb6A69hvD2maxtHuRp9sYjBXAdys2Vq02XlvoFoKdDF3FIg= 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=L6TpQNh7; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=C8AAY+K/; 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="L6TpQNh7"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="C8AAY+K/" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1760447150; h=from:from: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=rmWsgXe/EUJlh3Oqic3jAEqEyRP4824MK4HzVDJVrYI=; b=L6TpQNh7Vb8hlDonYQwENXkD64j52H59yc/Kb8VjJ6hEGCsGrURA/TSoLYPqPKPy+v7+CF i5QpAoY/QaDuIQtziFgIqe3wuE7blMwjVWQ3xuxQYy9vzsoiT1LWrkdUbSOTZ8sR1FjDtZ fKLXrqO7/b4QvE/vyglIm6iTxIzdRvaA7+7nv32D75VtEcv9SS4GfR8Fw5lhnzsd8BRwuR 7F87BGld5J/KWnpMWzEXYt03tOWSrAxX1xUG9y/pDcBeAlVS9SaqFzm53ra9MB+ObiCjID 9AVH20CII2f5VWgO0tZAZwwbzbhuWa4CIEyVtaoyndKBAsU9wOXROlw3UyK1HA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1760447150; h=from:from: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=rmWsgXe/EUJlh3Oqic3jAEqEyRP4824MK4HzVDJVrYI=; b=C8AAY+K/Vpov18nnCiOgJypH4XE/Z4j8vzRNImlx/xoZGX4JCR77rgTkUawUW8aIh3iarf XBuD81oOW8Hum1DA== Date: Tue, 14 Oct 2025 15:05:16 +0200 Subject: [PATCH v2 01/10] kbuild: don't enable CC_CAN_LINK if the dummy program generates warnings Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251014-kbuild-userprogs-bits-v2-1-faeec46e887a@linutronix.de> References: <20251014-kbuild-userprogs-bits-v2-0-faeec46e887a@linutronix.de> In-Reply-To: <20251014-kbuild-userprogs-bits-v2-0-faeec46e887a@linutronix.de> To: Nathan Chancellor , Nicolas Schier , Nicolas Schier , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Thomas Bogendoerfer , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "David S. Miller" , Andreas Larsson Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Masahiro Yamada , linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mips@vger.kernel.org, sparclinux@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1760447149; l=1486; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=IDhCA1BagrOzAKjk7RuNtb+m/Zg87sOWHgJNO4N/lzs=; b=2GBDxIG9QU3kONJteRcQFaut1ha2ZM7A46rDztSe+RBbZ/fhVoTctHwgcHlR3TApjkzsEu0sX faVc067JB5BDIb+TLHZhVg0TdYAJhlc1qUyldatX+RhG2bGSRhmA55P X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= It is possible that the kernel toolchain generates warnings when used together with the system toolchain. This happens for example when the older kernel toolchain does not handle new versions of sframe debug information. While these warnings where ignored during the evaluation of CC_CAN_LINK, together with CONFIG_WERROR the actual userprog build will later fail. Example warning: .../x86_64-linux/13.2.0/../../../../x86_64-linux/bin/ld: error in /lib/../lib64/crt1.o(.sframe); no .sframe will be created collect2: error: ld returned 1 exit status Make sure that the very simple example program does not generate warnings already to avoid breaking the userprog compilations. Fixes: ec4a3992bc0b ("kbuild: respect CONFIG_WERROR for linker and assemble= r") Fixes: 3f0ff4cc6ffb ("kbuild: respect CONFIG_WERROR for userprogs") Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: Nathan Chancellor Reviewed-by: Nicolas Schier --- scripts/cc-can-link.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/cc-can-link.sh b/scripts/cc-can-link.sh index 6efcead3198989d2ab2ab6772c72d8bb61c89c4e..e67fd8d7b6841e53341045b28dc= 5196cc1327cbe 100755 --- a/scripts/cc-can-link.sh +++ b/scripts/cc-can-link.sh @@ -1,7 +1,7 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 =20 -cat << "END" | $@ -x c - -o /dev/null >/dev/null 2>&1 +cat << "END" | $@ -Werror -Wl,--fatal-warnings -x c - -o /dev/null >/dev/n= ull 2>&1 #include int main(void) { --=20 2.51.0 From nobody Fri Dec 19 20:32:34 2025 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 4A4CB314A67; Tue, 14 Oct 2025 13:05:53 +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=1760447155; cv=none; b=i1M8cvJ0VksCOO3pKboE1TaNwxRKouC2f8/KmyQW4rWX6HiqL9S25spTIRW6b3Cafo8VjpdIyf2V8gH6036HfH1kUgCmNeZiRqyCgXTxnRocyXMxS0n2b3R4gFsD3IrlYXsIp/S5n0TG4Gw2zHvi7oO+9u4jL7/CVk/SHIhfv3o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760447155; c=relaxed/simple; bh=cw6izJuCa9EwT35MsVWlQDliEz9mJYF0jA7XnDSqJhQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KwFb7O3RxsI+5SYKfFR0LcwVU0BSzFlX5BJ/ifftuaTek+k1O7x/bAKmfoSzpGvywmR9Plr2M06XhXVe5VvgXATbwPAYe4DJCN37ifLB0968HGpEH55EsU4N+h/hvJBqxo7tSkEKgsjoBBKAe4TO0DKLA6VUdrY5+2xSdW+n6ao= 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=oiNyH0Pr; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=IoJDo/mz; 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="oiNyH0Pr"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="IoJDo/mz" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1760447151; h=from:from: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=1KptW+UoLghQMXOrNEBqzO3AErvEefbVuNoRlZvx97M=; b=oiNyH0PrK2xokgY/xRhYNh34O73m7EA1Pd8tkaIavxgzOcrBF7zJ4XwQGBgGA5DU2iz/p7 zaGrtCdce56tduJqMybiZ6QG81A0ZQoupCxGlAwsyLQaqgfxVGfsM9/jLWqA5EKNwbRviH ZcWmsSCz6F37BEIeuvksoJuw7QI4dksDTXdACC039A6SeRr9w44U1McKyStTT7JU6BDLT9 fu+6KJ/VYtPYJpN6wgaxmMvup8Sz40YT7m3JkJyhA2oGzQBYdyA04l/0xeG5lNAxGNdfi8 Ol3MFMaZqs2RgzvuGUPde8NSabkiWpQDYKdLZ/OF0rB3VyPDWC6X3folzw0Qtg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1760447151; h=from:from: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=1KptW+UoLghQMXOrNEBqzO3AErvEefbVuNoRlZvx97M=; b=IoJDo/mzsy5EWQOiAfu4TeoGsMkP1SmEZRcdfUfHvULsIDGeDHduiJKKAnuHzb9T9FPVhM 9Bvuta2MxEAH+oDw== Date: Tue, 14 Oct 2025 15:05:17 +0200 Subject: [PATCH v2 02/10] init: deduplicate cc-can-link.sh invocations Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251014-kbuild-userprogs-bits-v2-2-faeec46e887a@linutronix.de> References: <20251014-kbuild-userprogs-bits-v2-0-faeec46e887a@linutronix.de> In-Reply-To: <20251014-kbuild-userprogs-bits-v2-0-faeec46e887a@linutronix.de> To: Nathan Chancellor , Nicolas Schier , Nicolas Schier , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Thomas Bogendoerfer , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "David S. Miller" , Andreas Larsson Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Masahiro Yamada , linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mips@vger.kernel.org, sparclinux@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1760447149; l=1820; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=cw6izJuCa9EwT35MsVWlQDliEz9mJYF0jA7XnDSqJhQ=; b=qMY3Zy0dOvDZ1jAtW9lSVtESua5rKfZ3bqAQERTzgb0DzSXGykCYkjWMB+HI0PnYvxaG/bwqb 20TGDGAlQTbAqfhSInd0ke9McDq+UPb7BHmRRYxbey9/g06LyFjbTwr X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The command to invoke scripts/cc-can-link.sh is very long and new usages are about to be added. Add a helper variable to make the code easier to read and maintain. Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: Nathan Chancellor Reviewed-by: Nicolas Schier --- init/Kconfig | 4 ++-- scripts/Kconfig.include | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/init/Kconfig b/init/Kconfig index cab3ad28ca49e7ac930207c9cde8d431d55dc7af..7b722e714d5c5a0580467914b22= 6dc0700ec0797 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -84,8 +84,8 @@ config RUSTC_LLVM_VERSION =20 config CC_CAN_LINK bool - default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) = $(USERCFLAGS) $(USERLDFLAGS) $(m64-flag)) if 64BIT - default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) = $(USERCFLAGS) $(USERLDFLAGS) $(m32-flag)) + default $(cc_can_link_user,$(m64-flag)) if 64BIT + default $(cc_can_link_user,$(m32-flag)) =20 # Fixed in GCC 14, 13.3, 12.4 and 11.5 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113921 diff --git a/scripts/Kconfig.include b/scripts/Kconfig.include index 33193ca6e8030e659d6b321acaea1acd42c387a4..d42042b6c9e243b46d1626d892c= 0c986621ce462 100644 --- a/scripts/Kconfig.include +++ b/scripts/Kconfig.include @@ -65,6 +65,9 @@ cc-option-bit =3D $(if-success,$(CC) -Werror $(1) -E -x c= /dev/null -o /dev/null,$ m32-flag :=3D $(cc-option-bit,-m32) m64-flag :=3D $(cc-option-bit,-m64) =20 +# Test whether the compiler can link userspace applications +cc_can_link_user =3D $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(C= LANG_FLAGS) $(USERCFLAGS) $(USERLDFLAGS) $(1)) + rustc-version :=3D $(shell,$(srctree)/scripts/rustc-version.sh $(RUSTC)) rustc-llvm-version :=3D $(shell,$(srctree)/scripts/rustc-llvm-version.sh $= (RUSTC)) =20 --=20 2.51.0 From nobody Fri Dec 19 20:32:34 2025 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 94F8B314A7D; Tue, 14 Oct 2025 13:05:53 +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=1760447155; cv=none; b=h2uUnssRGuk0aEW+cF3ANKDI+Iq+QyuEzdZh7Z5FsJ6mIrUU4DuEo9yaNWFe+Zcdztnh9Y9c5wJfjJykHzM6NPs/4DIUjd+tr/afbXWJ7h90/ganxh/E84POektC3GSKwAQhCyj+E+r7+I1ah1Bpu6R8T5F9zGKes1RKaXF+jIM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760447155; c=relaxed/simple; bh=6NbAT/c8dhOFpg7qjR2b49v4+fnBDinUJpp942RcUVs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=B6ei+pHKOzJDJhPRhCHA3h3wtQL/pCz0qgfiNQ9m96v+RUdMwJf6ZBoruIVvYdWzlnJme3Fjtud4D+6Oj2RTJS8ds6nhIBUfJYdofo3CAJP1RRAQ2YZyRqLm/Gfu7PsyyBdrQTraoZbH74fNsbK1F6aUYzDlRwwIILG+a05DTvY= 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=Zv1lZI9b; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=wlzUTHbK; 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="Zv1lZI9b"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="wlzUTHbK" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1760447151; h=from:from: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=n5aEmOCiKWRV28QcYO8TDotRByeakPNFwzaXoHbD41M=; b=Zv1lZI9bfmZPDvEM4JRusAAq2cBllhjidSUvA9XtE2Ueq5UmZZWoyNyW3QP9Qq2LayLz1t EOWUw+ekjm1ZI3ivepNtxpPBhZK8KcSHVObBXN8SFRalX+yoW4vn8kBLzLxHl43jlA5/JR 1cLBjhlv73q773FIXCEdaE0azr9ONjKk13E8obTJ4zcG5LQqWtpuNTp0Zuas7VZs90NPPm 8+v68iVr3yOcA4456vKPsS22IsjrtUPvwZ0j24GKJzyN2MrGZim+zAMuiVw7AO6CNPzuqp pgTkEA//CML0qSQlX0o6HpofqTPJvZXMG2eV2+DEd1WV7uGiKp7N6MaJZTr1mQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1760447151; h=from:from: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=n5aEmOCiKWRV28QcYO8TDotRByeakPNFwzaXoHbD41M=; b=wlzUTHbKokvyVpwrlS1pfBwevlVj/x9vf+ARON0OWsvmjFoXR1E5gzzyiFmLYG7aT3wHf2 LnIQbss7Iiy91mBw== Date: Tue, 14 Oct 2025 15:05:18 +0200 Subject: [PATCH v2 03/10] kbuild: allow architectures to override CC_CAN_LINK Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251014-kbuild-userprogs-bits-v2-3-faeec46e887a@linutronix.de> References: <20251014-kbuild-userprogs-bits-v2-0-faeec46e887a@linutronix.de> In-Reply-To: <20251014-kbuild-userprogs-bits-v2-0-faeec46e887a@linutronix.de> To: Nathan Chancellor , Nicolas Schier , Nicolas Schier , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Thomas Bogendoerfer , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "David S. Miller" , Andreas Larsson Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Masahiro Yamada , linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mips@vger.kernel.org, sparclinux@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1760447149; l=2247; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=6NbAT/c8dhOFpg7qjR2b49v4+fnBDinUJpp942RcUVs=; b=+axK+KClVFQLPqY2xQIV6Z1Guh/4xXDQBrACtf2w9ctXvFPO+pdPmvsWesaDbNln2fhCMBlvB WgGXUgtUQ07ACaBUqVkclPsSnd9imwvXGgtXlpBCgUj8Xxa/luTj8dE X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The generic test for CC_CAN_LINK assumes that all architectures use -m32 and -m64 to switch between 32-bit and 64-bit compilation. This is overly simplistic. Architectures may use other flags (-mabi, -m31, etc.) or may also require byte order handling (-mlittle-endian, -EL). Expressing all of the different possibilities will be very complicated and brittle. Instead allow architectures to supply their own logic which will be easy to understand and evolve. Both the boolean ARCH_HAS_CC_CAN_LINK and the string ARCH_USERFLAGS need to be implemented as kconfig does not allow the reuse of string options. Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: Nathan Chancellor --- Makefile | 13 +++++++++++-- init/Kconfig | 4 ++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 17cfa11ca7163aa3297101ceb3c9e85f4878f12d..26e5bca534e27034c355939bca4= c90db435ecdbd 100644 --- a/Makefile +++ b/Makefile @@ -1134,8 +1134,17 @@ ifneq ($(CONFIG_ARCH_VMLINUX_NEEDS_RELOCS),) LDFLAGS_vmlinux +=3D --emit-relocs --discard-none endif =20 -# Align the bit size of userspace programs with the kernel -USERFLAGS_FROM_KERNEL :=3D -m32 -m64 --target=3D% +# Align the architecture of userspace programs with the kernel +USERFLAGS_FROM_KERNEL :=3D --target=3D% + +ifdef CONFIG_ARCH_USERPROGS_CFLAGS +KBUILD_USERCFLAGS +=3D $(CONFIG_ARCH_USERFLAGS) +KBUILD_USERLDFLAGS +=3D $(CONFIG_ARCH_USERFLAGS) +else +# If not overridden also inherit the bit size +USERFLAGS_FROM_KERNEL +=3D -m32 -m64 +endif + KBUILD_USERCFLAGS +=3D $(filter $(USERFLAGS_FROM_KERNEL), $(KBUILD_CPPFLA= GS) $(KBUILD_CFLAGS)) KBUILD_USERLDFLAGS +=3D $(filter $(USERFLAGS_FROM_KERNEL), $(KBUILD_CPPFLA= GS) $(KBUILD_CFLAGS)) =20 diff --git a/init/Kconfig b/init/Kconfig index 7b722e714d5c5a0580467914b226dc0700ec0797..4a2ae3cfbf26525a60936d9b29a= 74ef4319ba3a5 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -82,8 +82,12 @@ config RUSTC_LLVM_VERSION int default $(rustc-llvm-version) =20 +config ARCH_HAS_CC_CAN_LINK + bool + config CC_CAN_LINK bool + default ARCH_CC_CAN_LINK if ARCH_HAS_CC_CAN_LINK default $(cc_can_link_user,$(m64-flag)) if 64BIT default $(cc_can_link_user,$(m32-flag)) =20 --=20 2.51.0 From nobody Fri Dec 19 20:32:34 2025 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 F1656314A92; Tue, 14 Oct 2025 13:05:53 +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=1760447156; cv=none; b=e6fUZXwEVc+/tVxhIRbVEcGKPIne95RRP5+4hnc11jzcU8YlxVO03oPtqD7lfMJDg/hS8FH/W1gR2PKN/DIovP5sodjwS6U6UAo85ZrHTNpP0D+4V96zsmzZpC7WhXhAS6mqkqT9DLanmB+4/597o5TRbkw5MCy12TtE5aywC3s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760447156; c=relaxed/simple; bh=3lgCYGIMr6BqeDPz9pKFvSa3Tpv/XYmPh2f36Wz3/Vw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eRey6rhZhc3FhwnniWBTiR0FzW4qlUg/3pG+1cNFB6q7pzVeCLoqsre7vQMlI3bsJ8R4cnmh+21uB1miiYCdwwXjLByATIS3PNnDFNk+VJpL6hRU/cq+NLADYtt/aLQrHrmYrJY/iQD0gC5TyXeu74woJ/W18Z+vtpdi6GAwIrM= 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=kDPkhNZF; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=zLHxkSgW; 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="kDPkhNZF"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="zLHxkSgW" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1760447152; h=from:from: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=PtEMzaRgOB8kquDpZ2oJC8rCzxEI2hYSKcXXX4oBQqw=; b=kDPkhNZFnKiPIKn2BfUt5pn59Sg5Gn1PrDHdDcLkuN3BevIr2tumGBieAbhxD2f4hflub8 e8SRmhJs4vtIcfp9qgaSlijd6Ih1iAbrv0BJWxfaa2XZb15CS5jFUHKZ+yrK8Id2JM78x1 95G9tQO2AKOpfPjX/yMBkhWiLEe8Ehyul3lz9yUe15jV/Z/q+EI6Xgu6I5jGxMhWOi5JO+ GYy3ovjSpa7MZ++Prynre1P1J+cvYl12KJGCvDwZx2HN8axJYv6DZPE3VJqP8X0RusNIWY fpQUWrS8hmvkUupggb1ITeEYpa/KHeYd5EqoYqt7zeSKYXCey/nDz2gPSKF7/g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1760447152; h=from:from: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=PtEMzaRgOB8kquDpZ2oJC8rCzxEI2hYSKcXXX4oBQqw=; b=zLHxkSgWSjdbKEzJflQ9dcKDaS7KCBMSUJheUled3tqTF+w6qHzcAxxo3/aGtH3oj+wwIC hNdsXlaXlufgbEBw== Date: Tue, 14 Oct 2025 15:05:19 +0200 Subject: [PATCH v2 04/10] riscv: Implement custom CC_CAN_LINK Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251014-kbuild-userprogs-bits-v2-4-faeec46e887a@linutronix.de> References: <20251014-kbuild-userprogs-bits-v2-0-faeec46e887a@linutronix.de> In-Reply-To: <20251014-kbuild-userprogs-bits-v2-0-faeec46e887a@linutronix.de> To: Nathan Chancellor , Nicolas Schier , Nicolas Schier , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Thomas Bogendoerfer , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "David S. Miller" , Andreas Larsson Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Masahiro Yamada , linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mips@vger.kernel.org, sparclinux@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1760447149; l=1258; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=3lgCYGIMr6BqeDPz9pKFvSa3Tpv/XYmPh2f36Wz3/Vw=; b=ljrpmNZOQUkLMN+En8m+6y2KVlfRnUR20ZZD26p+acX5QP7AVUU4yWipMMpv+SjAnIDnFb0Qx WUXs2N/Eo+MCXvns+nHls5Gg7cVspWXWzbvjHF5Wo72H4v/yRtTle/C X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The generic CC_CAN_LINK detection relies on -m32/-m64 compiler flags. These are not supported by riscv compilers. Use architecture-specific logic using -mabi instead. Signed-off-by: Thomas Wei=C3=9Fschuh --- arch/riscv/Kconfig | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 0c6038dc5dfd529e1fe623f6bc2729a388b33fde..1faf6e6ec87d1417b4e3213ad54= 053439c87e331 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -25,6 +25,7 @@ config RISCV select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2 select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE select ARCH_HAS_BINFMT_FLAT + select ARCH_HAS_CC_CAN_LINK select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VIRTUAL if MMU select ARCH_HAS_DEBUG_VM_PGTABLE @@ -1335,6 +1336,16 @@ config PORTABLE config ARCH_PROC_KCORE_TEXT def_bool y =20 +config ARCH_CC_CAN_LINK + bool + default $(cc_can_link_user,-mabi=3Dlp64d) if 64BIT + default $(cc_can_link_user,-mabi=3Dilp32d) + +config ARCH_USERFLAGS + string + default "-mabi=3Dlp64d" if 64BIT + default "-mabi=3Dilp32d" + menu "Power management options" =20 source "kernel/power/Kconfig" --=20 2.51.0 From nobody Fri Dec 19 20:32:34 2025 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 3D095314B79; Tue, 14 Oct 2025 13:05:55 +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=1760447157; cv=none; b=OQ+98VFXuQelDbIwTpwvTclkVa5gCBOSewtuw2Ldo9IJ0+UVQh0/TF8DyFbttqpeBUrd2oI74TKbvaBhGwMTR49EgSDsfhHxG+L54VrDxGKnYnJkDaJOjIqJsqv7b4VrKJ9xViqcFYuEjNroN6LucUy1ACJ3ijZrNrd+6q/BgTs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760447157; c=relaxed/simple; bh=C5yzpCLqrEUvmfCc9tgMT4vkB0PmGsIVmeRJ/wm+ukg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GwOJoRW+WdxMlCiiotw4/ckW2xeTWxiZA71kWYF6zLC/ep1rP6TEMh5yqRno9HGm+OixPNvRAtNUmLBGyFnbZYGYDZ1b+/e1FbXd/HIGe7kmLvPh7wyznTQq6GjHevZ8XxLcNuhBdhGbhz20Pg4yfc3eQW1SMKgvyPR8sgORYvk= 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=Cdzz+KJz; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=BwzlN2uX; 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="Cdzz+KJz"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="BwzlN2uX" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1760447153; h=from:from: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=0CYU5O26JQub+yqWqbpQg+oK8k+3uTAokj7TeaLTkvI=; b=Cdzz+KJzTSoATXV5Ljvowdfgd+hQ49C2HiCspOUMSbLN4Y/KVwHbpcJlPKJDrYKwBpV1Cl nl8yCfx9g0blauWEMvgfadUL1Xs67s2WkQmzFvJzw9Skl6Se6lLax4sHGzAsfb26klKK4r 1BR7dCS9II5sV9DxZS2LrinYR6AYT+BArKduD/fSTt/Rp2tk85LB4DGeGNLC0+s3ZjHIEu COxW7QHALQxTwh7TIVAWN9EATLtrOBhFbB2fenbToNZVXr9gPZ2uc6XeCAsm5sSbnusf+D IkBXOvaPA9/tEih0RaZgPFGhQsTs/IhEkpHFcxJdnU0UXlm4UHC30/jqEm0elg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1760447153; h=from:from: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=0CYU5O26JQub+yqWqbpQg+oK8k+3uTAokj7TeaLTkvI=; b=BwzlN2uXPCg/X47u0Uh4Y8N28ll/JnhCE8duJmS0jRH2zsnGwBT82W4JCx3IH8lzXaM7kD xkxDEF1BudBfnOCA== Date: Tue, 14 Oct 2025 15:05:20 +0200 Subject: [PATCH v2 05/10] s390: Implement custom CC_CAN_LINK Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251014-kbuild-userprogs-bits-v2-5-faeec46e887a@linutronix.de> References: <20251014-kbuild-userprogs-bits-v2-0-faeec46e887a@linutronix.de> In-Reply-To: <20251014-kbuild-userprogs-bits-v2-0-faeec46e887a@linutronix.de> To: Nathan Chancellor , Nicolas Schier , Nicolas Schier , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Thomas Bogendoerfer , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "David S. Miller" , Andreas Larsson Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Masahiro Yamada , linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mips@vger.kernel.org, sparclinux@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1760447149; l=1192; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=C5yzpCLqrEUvmfCc9tgMT4vkB0PmGsIVmeRJ/wm+ukg=; b=6KMNxZohvV8U55EvTgd5gt+n+aQ06tzHiTyepjAkWCXf3bRHfASgeYcybxotqxOnkE219kD9n 3f3fejzuvHFChDTTBo0UVdS4/IrKpsCny3q6UyLNz4mbPAvOrT8AK4d X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The generic CC_CAN_LINK detection relies on -m32/-m64 compiler flags. s390 uses -m31 instead of -m32. Use architecture-specific logic using -m31/-m64 instead. Signed-off-by: Thomas Wei=C3=9Fschuh --- arch/s390/Kconfig | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index c4145672ca342a656eece10704706d4b12ff9fd6..77ea17537fa2f938aee1fce0053= a48853b1ce638 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -82,6 +82,7 @@ config S390 select ARCH_ENABLE_MEMORY_HOTREMOVE select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2 select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE + select ARCH_HAS_CC_CAN_LINK select ARCH_HAS_CPU_FINALIZE_INIT select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VIRTUAL @@ -290,6 +291,16 @@ config PGTABLE_LEVELS =20 source "kernel/livepatch/Kconfig" =20 +config ARCH_CC_CAN_LINK + bool + default $(cc_can_link_user,-m64) if 64BIT + default $(cc_can_link_user,-m31) + +config ARCH_USERFLAGS + string + default "-m64" if 64BIT + default "-m31" + config ARCH_SUPPORTS_KEXEC def_bool y =20 --=20 2.51.0 From nobody Fri Dec 19 20:32:34 2025 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 3CF9C314B78; Tue, 14 Oct 2025 13:05:55 +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=1760447157; cv=none; b=Y4MbZ777514tP4V6869BOa+HlgzbG2T3xUslkq+M9IM30XzdKZA0uodYqcQT9uPZAaS3B6HjnR7DCitPcX3NFi4SpbQWjvvDVil1YLb2bW25lw7cvsV2Cu37t6LgdGxBOGacXFTfYmBVfY2fes98gjx4S9iwwC50/EKF71clvMI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760447157; c=relaxed/simple; bh=XzQW4/Bu5moeHZMAHvqFvXBlWcd696K9WDlakbG7iS8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=u/LkwrV+Yo5qqf86eJ5hVSk6GMmL6Xw8KOHQw+oQzjJk09iPENHzaDqykj5a4x4QRTDlh/WMdijucLwifr1DUmLlGUcofrJdURPPWRXIh28n0E9lYcUABnFcpNy5WUihQjeGM5KrpEe75y5DRHM1tuYeVUns8ZQI7ftM438jC8s= 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=VKcGupTm; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=BPouXKjv; 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="VKcGupTm"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="BPouXKjv" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1760447153; h=from:from: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=2Jz/fSQ4w2Bn/x6vZR3CdwbYNIGEPKCgvqF2C3xKpfE=; b=VKcGupTmWHcLI7Z0F1GJxSKy3HSwtCoEQeb3y3K5GW3tZ3MbEDvktdbAmdZTn+uH1bg0U2 8h4vhGrWqe38UOZfS2U0a3uu3vCKfGG8Q0PpdxY8IqXdPepPVyHpTeW2ODz2NhN4a47v5H w2HA0YBUpXONsWbx/w0WyVCks2VkXQYUKS0zVJY9j53UV6RtdWVlwjecCk6jlGdvpnPXss Fa7s1H3Kp/Fwosf+mJH1mNTuNYDtbUPvRrFCvp5xDIL6qiKsOdYirrovpEG8frLO3SSDcp aNpv/Ts+hnVhhoqgkUPks10emA9sNZ1crjnWsJb8l+ee7LqwXgW9PEGY31oONg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1760447153; h=from:from: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=2Jz/fSQ4w2Bn/x6vZR3CdwbYNIGEPKCgvqF2C3xKpfE=; b=BPouXKjvuvb+fmaL4NwW0ji9XzPT4qC/zULrhT4erndSmssrS+FBVwoL8r5nMAE7LPOaHo LwxtHqhKCr7Nk2DA== Date: Tue, 14 Oct 2025 15:05:21 +0200 Subject: [PATCH v2 06/10] powerpc: Implement custom CC_CAN_LINK Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251014-kbuild-userprogs-bits-v2-6-faeec46e887a@linutronix.de> References: <20251014-kbuild-userprogs-bits-v2-0-faeec46e887a@linutronix.de> In-Reply-To: <20251014-kbuild-userprogs-bits-v2-0-faeec46e887a@linutronix.de> To: Nathan Chancellor , Nicolas Schier , Nicolas Schier , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Thomas Bogendoerfer , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "David S. Miller" , Andreas Larsson Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Masahiro Yamada , linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mips@vger.kernel.org, sparclinux@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1760447149; l=1653; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=XzQW4/Bu5moeHZMAHvqFvXBlWcd696K9WDlakbG7iS8=; b=iMDR0xOl/X2IGC7IEBYdKs5yuoYP5wjW2LSP8Krtgl2eaP0yhU5aS9qhWhGPYYr0+eb0mEveO gg/4WcsNrUBDV10e4SbmIWsMoaYJ+4oJo37KgaWlBCNQAPq/+4MetS8 X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The generic CC_CAN_LINK detection does not handle different byte orders. This may lead to userprogs which are not actually runnable on the target kernel. Use architecture-specific logic supporting byte orders instead. Signed-off-by: Thomas Wei=C3=9Fschuh --- arch/powerpc/Kconfig | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index e24f4d88885ae52e77fcb523040e8d31f167571f..c6887a2b97530b9c5b8c34dd0ba= a3ef8548cb43d 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -127,6 +127,7 @@ config PPC select ARCH_DMA_DEFAULT_COHERENT if !NOT_COHERENT_CACHE select ARCH_ENABLE_MEMORY_HOTPLUG select ARCH_ENABLE_MEMORY_HOTREMOVE + select ARCH_HAS_CC_CAN_LINK select ARCH_HAS_COPY_MC if PPC64 select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VIRTUAL @@ -1341,6 +1342,20 @@ endif config PPC_LIB_RHEAP bool =20 +config ARCH_CC_CAN_LINK + bool + default $(cc_can_link_user,-m64 -mlittle-endian) if 64BIT && CPU_LITTLE_E= NDIAN + default $(cc_can_link_user,-m64 -mbig-endian) if 64BIT && CPU_BIG_ENDIAN + default $(cc_can_link_user,-m32 -mlittle-endian) if CPU_LITTLE_ENDIAN + default $(cc_can_link_user,-m32 -mbig-endian) if CPU_BIG_ENDIAN + +config ARCH_USERFLAGS + string + default "-m64 -mlittle-endian" if 64BIT && CPU_LITTLE_ENDIAN + default "-m64 -mbig-endian" if 64BIT && CPU_BIG_ENDIAN + default "-m32 -mlittle-endian" if CPU_LITTLE_ENDIAN + default "-m32 -mbig-endian" if CPU_BIG_ENDIAN + source "arch/powerpc/kvm/Kconfig" =20 source "kernel/livepatch/Kconfig" --=20 2.51.0 From nobody Fri Dec 19 20:32:34 2025 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 98F2A314B84; Tue, 14 Oct 2025 13:05:55 +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=1760447157; cv=none; b=rzTG3u9zO9KQ6VW48PcATmTdbdDFiQrxXA0jRDLjkqAEknds+ic54KKEu5mzccYjnqOiNGBjYRF+O2xq+I2YdHNRQnCxjDoIG0UTJr0hO922ydMNXEfRIqhxRptoTPTi1lHZ9SGmEVEQkOLcmIAW+RjEi9W5qKpMjkov1ylY96U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760447157; c=relaxed/simple; bh=N71PVC1EfqSrxafXCVGnmlQykhL538a8yG+n3pVRhVs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IR/Ygx7y7h3X8NEmpd2mwL1MOC5pCZ7UOEE203vfE7NHGME5UjuLqRI8KnrewGenYDg2KZYAZGQverNfJdMtzbmmaaZf6zUJehyact4om4coNPBj0mz/2GWSx/FAuGjA13xYtKonG1Zgrg2O6/7GYBRBBUzVSAtG5o7Z6xR6ZEY= 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=Vzd9X37J; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=TWmuMW95; 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="Vzd9X37J"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="TWmuMW95" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1760447154; h=from:from: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=w4aJGDj19pCqGq6Mwbs9/EzztmQNf0JP3Sfp4xrHRjQ=; b=Vzd9X37JzWVNDax9xF7gUtygBZfPFaA3gsNq68iYTXU84peT0r3N8MbT2m2gSyuEWOp475 oR+vVdCmcqytsiwYiC6b/bE6d/82PiwkIPqrAvPK4pLAOLq5oJluEKE4Ej6AWHFXvKRgRP cuuYJ9oQ/giOO8oM7d9galUCfWv5BUQogZCB3n0avBH2xCchZEYbEG8Y23WkWP8S9lkqBe sXljt99G0QRpZzxPiMEntfQiVi7KL/+ysk3fM+CyHJAHBi3n6B8rskNRKW2kRWW7tRLHFH gM4uGdxfzGFPYPXkvPD4Uuaw7fSqO2n2Cw19SsmwKTwwJi8bz96YTPC8Ibjw8w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1760447154; h=from:from: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=w4aJGDj19pCqGq6Mwbs9/EzztmQNf0JP3Sfp4xrHRjQ=; b=TWmuMW95i4+CfhBBZ5SlvE9frAHrOqOTHwnuv5oXGcDx7/vcAsqhO3HRTC6MIdlDBbjCEx MiSFQwwp28wI7oCQ== Date: Tue, 14 Oct 2025 15:05:22 +0200 Subject: [PATCH v2 07/10] MIPS: Implement custom CC_CAN_LINK Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251014-kbuild-userprogs-bits-v2-7-faeec46e887a@linutronix.de> References: <20251014-kbuild-userprogs-bits-v2-0-faeec46e887a@linutronix.de> In-Reply-To: <20251014-kbuild-userprogs-bits-v2-0-faeec46e887a@linutronix.de> To: Nathan Chancellor , Nicolas Schier , Nicolas Schier , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Thomas Bogendoerfer , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "David S. Miller" , Andreas Larsson Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Masahiro Yamada , linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mips@vger.kernel.org, sparclinux@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1760447149; l=1586; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=N71PVC1EfqSrxafXCVGnmlQykhL538a8yG+n3pVRhVs=; b=Hqg5+Zs1tdClXCVe2TNzjiX+1s7O2uQEAdV1tuC5lSBxirEybZXF94igzHK2M6GzMASu/egXy uBKrmuF+mr3AlBuXbEkMD7e4WRZW54J2F/40AVnKmentil9eMRb4dJa X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The generic CC_CAN_LINK detection does not handle different byte orders. This may lead to userprogs which are not actually runnable on the target kernel. Use architecture-specific logic supporting byte orders instead. Signed-off-by: Thomas Wei=C3=9Fschuh --- arch/mips/Kconfig | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index e8683f58fd3e2a43bf9384e1c3c3e454a8e59861..b4f07558ad395eb9bb626a264a2= e00fdfbdb7f72 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -4,6 +4,7 @@ config MIPS default y select ARCH_32BIT_OFF_T if !64BIT select ARCH_BINFMT_ELF_STATE if MIPS_FP_SUPPORT + select ARCH_HAS_CC_CAN_LINK select ARCH_HAS_CPU_CACHE_ALIASING select ARCH_HAS_CPU_FINALIZE_INIT select ARCH_HAS_CURRENT_STACK_POINTER @@ -3126,6 +3127,20 @@ config CC_HAS_MNO_BRANCH_LIKELY config CC_HAS_BROKEN_INLINE_COMPAT_BRANCH def_bool y if CC_IS_CLANG =20 +config ARCH_CC_CAN_LINK + bool + default $(cc_can_link_user,-m64 -EL) if 64BIT && CPU_LITTLE_ENDIAN + default $(cc_can_link_user,-m64 -EB) if 64BIT && CPU_BIG_ENDIAN + default $(cc_can_link_user,-m32 -EL) if CPU_LITTLE_ENDIAN + default $(cc_can_link_user,-m32 -EB) if CPU_BIG_ENDIAN + +config ARCH_USERFLAGS + string + default "-m64 -EL" if 64BIT && CPU_LITTLE_ENDIAN + default "-m64 -EB" if 64BIT && CPU_BIG_ENDIAN + default "-m32 -EL" if CPU_LITTLE_ENDIAN + default "-m32 -EB" if CPU_BIG_ENDIAN + menu "Power management options" =20 config ARCH_HIBERNATION_POSSIBLE --=20 2.51.0 From nobody Fri Dec 19 20:32:34 2025 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 5EDB2314D14; Tue, 14 Oct 2025 13:05: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=1760447158; cv=none; b=Q3z9tC6GX1+AST3WJItoATuIn0Kyh2uCzH+u+NKaEkZRTWRI4034HDfMmdbIHGacZ4t97c2JSexD7pESPReX/o8XRQkPAnp4kaR31M32WkJw10Y37jZrgZtC/7CyrpMqxIDzVNHqG+jxkYadKWZN388DKdMKOTuPYOebXc5czt4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760447158; c=relaxed/simple; bh=b6y5QGf5n/DoFSSYq7Ft561zy3R7m1YixtDRRPC4Syk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oEwaAUxOqsIKy1Gm+Z0cF0/0RivQqBl9c9ZwhSO2Jdc75QC9mMpMwge0fRDbYOhYO2ZIqlUgFUDlDcdzbUt+kP8pJmxLIaSvkrRun+QQnGmll3rLg7FJAv/ilvrL5JO7KFSkvDgn74CyNQYXLk4pOp5qXu16HDCwKhdYTp5i1VY= 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=toZTeHZe; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=FpLM2FIx; 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="toZTeHZe"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="FpLM2FIx" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1760447154; h=from:from: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=/ZtOYvzpIdd5rLNd2E6ncSSFN/khjvYbV63TeavHrvw=; b=toZTeHZe1uNjGasrKJzCw6aRjpZ0C4FjxOgf9/0KgK/6vuqPpjSuKY8pi+AlgZxcL6swRy gOENcZJv/3PR89wwogqpdZv+lmpci6bHbGRzvHqAR3++S9m2+RTKjniq3b8tO0QKubLcxl tFHW4ODlDTHBdB3n123fRMtazhGmb7f3VwyOsp7lvdlFQzRL2hNN0BTMWOHNAzjKKuI3lV GJWFeiRFUcvqCMGx+IZj2svBi4ifDeN2pd0O9n+JMu2/mJPzso3CCIvMc7dFNGYjR9NNzx hx0ycsNzzhLVpxb5oUuzJZ/hw7Nk5Ubi9y3fDQ2UxfceKUkDgWPT6+kqsIhLfg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1760447154; h=from:from: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=/ZtOYvzpIdd5rLNd2E6ncSSFN/khjvYbV63TeavHrvw=; b=FpLM2FIx9lrBLiAi7rZaKk9FxVWGfANDCuRfpLNEQaxOZ4jrMhHLjZzj7y1UkktQxNo626 7RN/FMNDE+jb/eCA== Date: Tue, 14 Oct 2025 15:05:23 +0200 Subject: [PATCH v2 08/10] x86/Kconfig: Implement custom CC_CAN_LINK Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251014-kbuild-userprogs-bits-v2-8-faeec46e887a@linutronix.de> References: <20251014-kbuild-userprogs-bits-v2-0-faeec46e887a@linutronix.de> In-Reply-To: <20251014-kbuild-userprogs-bits-v2-0-faeec46e887a@linutronix.de> To: Nathan Chancellor , Nicolas Schier , Nicolas Schier , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Thomas Bogendoerfer , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "David S. Miller" , Andreas Larsson Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Masahiro Yamada , linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mips@vger.kernel.org, sparclinux@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1760447149; l=1290; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=b6y5QGf5n/DoFSSYq7Ft561zy3R7m1YixtDRRPC4Syk=; b=+vm1vR0r4FMZsBIpxV3QN+K0oPDB9pgEvBhAhkeTZXmgDTN7eahpL0dYrQ0dL6ILzr02HF2Zf XPjaMmqydtlDwVhKaxupXaW4qFJpS0EQZgzEo/MYf61/Wk9vqQb5nXq X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The generic CC_CAN_LINK detection does not work for all architectures. To make it clearer how the detection works on x86 create an architecture-specific variant. Signed-off-by: Thomas Wei=C3=9Fschuh --- arch/x86/Kconfig | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index fa3b616af03a2d50eaf5f922bc8cd4e08a284045..a98675cd01c0c27e2a5716fb6d0= 51416ddcc956f 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -73,6 +73,7 @@ config X86 select ARCH_ENABLE_SPLIT_PMD_PTLOCK if (PGTABLE_LEVELS > 2) && (X86_64 ||= X86_PAE) select ARCH_ENABLE_THP_MIGRATION if X86_64 && TRANSPARENT_HUGEPAGE select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI + select ARCH_HAS_CC_CAN_LINK select ARCH_HAS_CPU_ATTACK_VECTORS if CPU_MITIGATIONS select ARCH_HAS_CACHE_LINE_SIZE select ARCH_HAS_CPU_CACHE_INVALIDATE_MEMREGION @@ -3171,6 +3172,16 @@ config HAVE_ATOMIC_IOMAP def_bool y depends on X86_32 =20 +config ARCH_CC_CAN_LINK + bool + default $(cc_can_link_user,-m64) if 64BIT + default $(cc_can_link_user,-m32) + +config ARCH_USERFLAGS + string + default "-m64" if 64BIT + default "-m32" + source "arch/x86/kvm/Kconfig" =20 source "arch/x86/Kconfig.cpufeatures" --=20 2.51.0 From nobody Fri Dec 19 20:32:34 2025 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 B9CD5314D24; Tue, 14 Oct 2025 13:05: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=1760447158; cv=none; b=DY4oW0AVJo9w6nMVXZWvstclWdojTN0b52Ss0yedycDHO4rOB/twJVJnGaFqD/L0IbSznolrdWLQ19ee+qhJf2sKesx9BSxuqQ6gNGzesU/DzPgnCEHn8Cp6pvcfnCbZTaCYBxwcnqnucZ+U9aaBBLvyiSlcVSR5Af9QMppXoSQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760447158; c=relaxed/simple; bh=dZCLaMpAGc/1vu8ptZyeXWxEiiNKEOUd3NRQEXSEOPk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Iycyc0az+rF0oDh15+5FOltwfC1v7/sIVeJvBs0j0kmlH5QKeJCOyh2iYZMmfvnXjgYzZ4iiPLfsVb/Yu1wHrUQDrnpSOdMaojciSCl5FMbSW6hDGxBm95semLULRnJPGEyhuGSzVvhnxRuB10dtXoVY+fotdMHeoNwZjEBZG00= 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=JhNZzK88; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=shg+bvHX; 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="JhNZzK88"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="shg+bvHX" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1760447155; h=from:from: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=5DVnR5cKH1ysJgeyzhsfqmBnURn+edrPqy5/eKSQF/k=; b=JhNZzK88e25jp9GotNrIPt/vZZKb0VKNvXHuMydCbEqd1+HpUDRgpkeBu66g8l0nmzb5hj bJq7M5ewwEwCvoaLib81c2KVP2JXH18KAShW7IVI9vzPyYKeLzPHuQcnCLcuJ3JXd78+cb lUY4MTBSosdoQvzUYAb5icb+K1r5HG4pqLz9oI4bzhBVdZOIowUafsrp3TYAiTbpnnpYfU 6qg49Q1Ays+clhKO56SqYcYh+OfTyryQT4RpjMe1QyOMPNBfLHRmczaPjLut258n2GT8QC +N+DKr68mMlHetmPxxPyjf2o5shGkZUkfBqZ9jlR19UUKQxhn11F/G4GGxOBVg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1760447155; h=from:from: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=5DVnR5cKH1ysJgeyzhsfqmBnURn+edrPqy5/eKSQF/k=; b=shg+bvHXD8MmVzyiF3EMIesqOVARExahkoJZzsvujW5lTkfMY5VPtwGaJNav+nBBAaMzPo USexF86fUhIfXgDQ== Date: Tue, 14 Oct 2025 15:05:24 +0200 Subject: [PATCH v2 09/10] sparc: Implement custom CC_CAN_LINK Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251014-kbuild-userprogs-bits-v2-9-faeec46e887a@linutronix.de> References: <20251014-kbuild-userprogs-bits-v2-0-faeec46e887a@linutronix.de> In-Reply-To: <20251014-kbuild-userprogs-bits-v2-0-faeec46e887a@linutronix.de> To: Nathan Chancellor , Nicolas Schier , Nicolas Schier , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Thomas Bogendoerfer , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "David S. Miller" , Andreas Larsson Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Masahiro Yamada , linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mips@vger.kernel.org, sparclinux@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1760447149; l=1096; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=dZCLaMpAGc/1vu8ptZyeXWxEiiNKEOUd3NRQEXSEOPk=; b=a1zArIcpsRzC1FZdasb8JGHUsoGoDAycc57M/S3ZNlxKRnq+Q21DHxSr8+hyt3/JppSgvNfcQ bxfFr7HMBuiCdP85ZG5aIqZqJw+JMdqAIBzuwcyKTmbOBLIvkFoAKI5 X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The generic CC_CAN_LINK detection does not work for all architectures. To make it clearer how the detection works on SPARC create an architecture-specific variant. Signed-off-by: Thomas Wei=C3=9Fschuh --- arch/sparc/Kconfig | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index a630d373e6453c745ab8bf58fc5622cf0edaf4c9..68b553a47d039da4368a2de3016= 8aaf80a941148 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -13,6 +13,7 @@ config 64BIT config SPARC bool default y + select ARCH_HAS_CC_CAN_LINK select ARCH_HAS_CPU_CACHE_ALIASING select ARCH_HAS_DMA_OPS select ARCH_MIGHT_HAVE_PC_PARPORT if SPARC64 && PCI @@ -475,4 +476,14 @@ config COMPAT select ARCH_WANT_OLD_COMPAT_IPC select COMPAT_OLD_SIGACTION =20 +config ARCH_CC_CAN_LINK + bool + default $(cc_can_link_user,-m64) if 64BIT + default $(cc_can_link_user,-m32) + +config ARCH_USERFLAGS + string + default "-m64" if 64BIT + default "-m32" + source "drivers/sbus/char/Kconfig" --=20 2.51.0 From nobody Fri Dec 19 20:32:34 2025 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 0687A314D32; Tue, 14 Oct 2025 13:05:57 +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=1760447158; cv=none; b=MlTSqAJtl27cdACnbFL4KoeBevovZYDWV1WYM3vEcE1yFfpW0fbvK6aizjB9ynGMTkmV+/qgqghw61wu0nuKRrKBonDuA/wRImTtOR0shMWf6xDLSPrL5ehSZzv+sEQVQs/4CFu8LahJobhDwGouoep1iaXmY3x6f7Lt9qcpd+c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760447158; c=relaxed/simple; bh=3tMmqGYPXW1+sizcvYuquIc8pIXvr2WxMOGAl2JNK7w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TxjRxlELFT5sWvqZNXY1/nprE25oR3fC5SLUVlAQ85lNeVMy89EPp9i9OaLgqkX9vO6VkOIUdk2YxTY25LdILoneYKOE5fzRhbERMKoZQ9FTkJK350uzYpnURuozFAC9KW3m162m8mSP2bqgfMc05dIuJksAJMHhfxlsi8yNDR8= 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=zwMEM9rR; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=W4M1n9ep; 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="zwMEM9rR"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="W4M1n9ep" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1760447155; h=from:from: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=P3cczBZg1hsuy3VQFI6BicmC+DtK7KqMRuLTbCsjnP4=; b=zwMEM9rRsQ90GXTSdrweLrU/7N3K+yghbYemcwg2uPHlqNF4j0cCpvgXjHX+0YTJHZKeOJ AV7HOIPkmXmNzu6g0EfsZnhSDogez7ExUFpFIQjBIUmkwgedkM3DGW224OvDuv52AIiZH9 uKRl9o2EZd7M+RCB5zTZ1f+xyZnAR5GiJLRFHzfR4cP0emlAiibCVqzSAHClyND3Pp/2iM yKs65bATUduM7f//XMj8XYH2ahgPRCn5m0VbgHU6FK+5oevGvM7717IdBgoO7SM8ZQYHJC HSnF8eolELUmKlBeYbD2mXYIfape+3JtKdL1CAPjIYMe4jiWJN0qV2kseLuxsg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1760447155; h=from:from: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=P3cczBZg1hsuy3VQFI6BicmC+DtK7KqMRuLTbCsjnP4=; b=W4M1n9ep7+/iLbuSo+Li8obSVodl7csZ5v1BhDxO5sXkVBj5QToSOlVQNP3+geRfZJcBNk 80JSyHmdyZFC2oAA== Date: Tue, 14 Oct 2025 15:05:25 +0200 Subject: [PATCH v2 10/10] kbuild: simplify CC_CAN_LINK Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251014-kbuild-userprogs-bits-v2-10-faeec46e887a@linutronix.de> References: <20251014-kbuild-userprogs-bits-v2-0-faeec46e887a@linutronix.de> In-Reply-To: <20251014-kbuild-userprogs-bits-v2-0-faeec46e887a@linutronix.de> To: Nathan Chancellor , Nicolas Schier , Nicolas Schier , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Thomas Bogendoerfer , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "David S. Miller" , Andreas Larsson Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Masahiro Yamada , linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mips@vger.kernel.org, sparclinux@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1760447149; l=1868; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=3tMmqGYPXW1+sizcvYuquIc8pIXvr2WxMOGAl2JNK7w=; b=NFH6jl0rxMrCvmdRLauKbjBZxs9geVFFRlVKeBozgXilXJgY1Mju4UC/ys+/hGi5CHjYmw4ka Wd0jRrV874oD4xRqVjBpgkRZJoGweQQIsS5fVbRbcN//KQqo62xtX6e X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= All architectures supporting multiple ABIs have been migrated to ARCH_CC_CAN_LINK. The remaining ones do not require any special flag, so simplify the logic. Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: Nicolas Schier --- Makefile | 11 +++-------- init/Kconfig | 3 +-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 26e5bca534e27034c355939bca4c90db435ecdbd..1b7da9f10b88f1a374ae34477e5= 621b4dd27c017 100644 --- a/Makefile +++ b/Makefile @@ -1137,17 +1137,12 @@ endif # Align the architecture of userspace programs with the kernel USERFLAGS_FROM_KERNEL :=3D --target=3D% =20 -ifdef CONFIG_ARCH_USERPROGS_CFLAGS -KBUILD_USERCFLAGS +=3D $(CONFIG_ARCH_USERFLAGS) -KBUILD_USERLDFLAGS +=3D $(CONFIG_ARCH_USERFLAGS) -else -# If not overridden also inherit the bit size -USERFLAGS_FROM_KERNEL +=3D -m32 -m64 -endif - KBUILD_USERCFLAGS +=3D $(filter $(USERFLAGS_FROM_KERNEL), $(KBUILD_CPPFLA= GS) $(KBUILD_CFLAGS)) KBUILD_USERLDFLAGS +=3D $(filter $(USERFLAGS_FROM_KERNEL), $(KBUILD_CPPFLA= GS) $(KBUILD_CFLAGS)) =20 +KBUILD_USERCFLAGS +=3D $(CONFIG_ARCH_USERFLAGS) +KBUILD_USERLDFLAGS +=3D $(CONFIG_ARCH_USERFLAGS) + # userspace programs are linked via the compiler, use the correct linker ifdef CONFIG_CC_IS_CLANG KBUILD_USERLDFLAGS +=3D --ld-path=3D$(LD) diff --git a/init/Kconfig b/init/Kconfig index 4a2ae3cfbf26525a60936d9b29a74ef4319ba3a5..a0127598f2f25ffb55dbb8a0691= b0aa68138fc69 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -88,8 +88,7 @@ config ARCH_HAS_CC_CAN_LINK config CC_CAN_LINK bool default ARCH_CC_CAN_LINK if ARCH_HAS_CC_CAN_LINK - default $(cc_can_link_user,$(m64-flag)) if 64BIT - default $(cc_can_link_user,$(m32-flag)) + default $(cc_can_link_user) =20 # Fixed in GCC 14, 13.3, 12.4 and 11.5 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113921 --=20 2.51.0