From nobody Fri Oct 3 08:52:31 2025 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F6102F28E2; Wed, 3 Sep 2025 09:53:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756893215; cv=none; b=aQtzEyBr5aoIgGA2ecpmy8fU4kKG9QVt8lFWzQtkGwwebk07tTTSD/4eBaIwtgCUF9GZ+KU3bM6o4P6ZMMF6Q3qHNArDXZ5tg9UIvVKpuUiC1HbV5nx2a/ctXUFn90CI02jXB5MadhOe1ouFjJAhoDRD1usatICvHU1cPjaZd8E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756893215; c=relaxed/simple; bh=9pnQtopGV2abpjWDxF1mFfUr6ACXC/Esur84mjvfVmU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MWMIe+Wk51cHKhlAZW9kp8kp5mx9MQW40CP7AjuR3Z/RNQII316IfhkzmhtvMYfs1jyQtYslyF7YWw0B1SbD/5t4HtLakQC/hv58GfgPlx2xgIXihmpBp9R8m/4T/U3dRYhogheBM96Ky8zrFq4xe5My2czM1hYgu1MoTxWXZ4o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8Bx3tITELho7C0GAA--.12923S3; Wed, 03 Sep 2025 17:53:23 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by front1 (Coremail) with SMTP id qMiowJAxfcEMELhom_16AA--.5842S3; Wed, 03 Sep 2025 17:53:20 +0800 (CST) From: Tiezhu Yang To: Huacai Chen , Miguel Ojeda Cc: WANG Rui , rust-for-linux@vger.kernel.org, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [RFC PATCH 1/3] docs: rust: quick-start: Add another way to install Date: Wed, 3 Sep 2025 17:53:13 +0800 Message-ID: <20250903095315.15057-2-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20250903095315.15057-1-yangtiezhu@loongson.cn> References: <20250903095315.15057-1-yangtiezhu@loongson.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: qMiowJAxfcEMELhom_16AA--.5842S3 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj93XoW7AryrKr4fCF1fGFWDJr4UZFc_yoW8Ar43pw 4jkr9xA3sxGr12kryrtayfWrW5CrWSgrWUGFZ7K347CrZ8Arn5trnrt3yYvF1DuFW8AF4Y vF1vyry5ua95A3gCm3ZEXasCq-sJn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUkjb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Cr0_Gr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx1l5I 8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r126r1DMcIj6I8E87Iv67AK xVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64 vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8G jcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2I x0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK 8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I 0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07j83kZUUUUU= Content-Type: text/plain; charset="utf-8" When compiling with LLVM and CONFIG_RUST is set, there is build error on LoongArch: --> rust/kernel/lib.rs:331:13 | 331 | loc.file_with_nul() | ^^^^^^^^^^^^^ method not found in `&'a Location<'a>` error: aborting due to 1 previous error It seems that the latest version of rustc is not compatible, in order to install the workable rustc version for LoongArch, there is another simple and easy way, add it to the Quick Start guide. Suggested-by: WANG Rui Signed-off-by: Tiezhu Yang --- Documentation/rust/quick-start.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Documentation/rust/quick-start.rst b/Documentation/rust/quick-= start.rst index 155f7107329a..fdd9f54f4fe4 100644 --- a/Documentation/rust/quick-start.rst +++ b/Documentation/rust/quick-start.rst @@ -21,6 +21,20 @@ Alternatively, the next two "Requirements" sections expl= ain each component and how to install them through ``rustup``, the standalone installers from Rust and/or building them. =20 +Additionally, if you want to install a specified version, you can remove t= he +exist packages from your Linux distribution first, e.g. for Fedora Linux:: + + dnf remove rust + +and run the following in your terminal:: + + curl --proto '=3Dhttps' --tlsv1.2 -sSf https://sh.rustup.rs | sh + +then follow the onscreen instructions to install from the official release +channels, enabling you to easily switch between stable, beta, and nightly +compilers and keep them updated. Please see https://rustup.rs/ for more +information. + The rest of the document explains other aspects on how to get started. =20 =20 --=20 2.42.0 From nobody Fri Oct 3 08:52:31 2025 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F6D72F28ED; Wed, 3 Sep 2025 09:53:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756893214; cv=none; b=b1G6zrpWyJeSKNbqKIeR258Fs40QTXz1C5qx+iKqG3DUbXnab0Hkvws8djHBIOIvyU1X9EIlJFuU3FIsWfz1EbvM0Qn4sTVGdHJ45TQ3fBAhJ+knybK2w3VZDoVBwTWtsXnZazCOxxoIIgiUdfRifNSdcMVFGUbW4a1TSWrDLPo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756893214; c=relaxed/simple; bh=XDP0wG8oJcBD8iSHmUgaU/ixC9iP7cOFsK+EMA7pI/M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G/qOgjVOXQ6TssWPtnXQLRsIOyy8UTQJzcfmEMDUUqk5OARL7Yssuy5VLWTGxzpCQ5MctW9A4kluSEy520wlMRk+pzIe2XEBoSU1Wig/JbN3p+7MpV8sYjXfWnMEWwBNEZJIDB6BEqnNWYfr5CsxHfWCIqV9KWPvWUe24Ok3oEQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8Cxbb8TELho7y0GAA--.11945S3; Wed, 03 Sep 2025 17:53:23 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by front1 (Coremail) with SMTP id qMiowJAxfcEMELhom_16AA--.5842S4; Wed, 03 Sep 2025 17:53:23 +0800 (CST) From: Tiezhu Yang To: Huacai Chen , Miguel Ojeda Cc: WANG Rui , rust-for-linux@vger.kernel.org, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [RFC PATCH 2/3] LoongArch: Make LTO case independent in Makefile Date: Wed, 3 Sep 2025 17:53:14 +0800 Message-ID: <20250903095315.15057-3-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20250903095315.15057-1-yangtiezhu@loongson.cn> References: <20250903095315.15057-1-yangtiezhu@loongson.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: qMiowJAxfcEMELhom_16AA--.5842S4 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj93XoW7CFyDXrW8ur45AF17Jw4fJFc_yoW8XryDpw sa9rZYqr4rWr4vgr9rJay5WrnxtFZrtr1xWFWxK3W8AF47Xw17Xr48tFyDXFyDJ3s3JrWI qrWfKr9xJF4UC3XCm3ZEXasCq-sJn29KB7ZKAUJUUUU8529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUk0b4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r126r13M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Cr0_Gr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx1l5I 8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1q6rW5McIj6I8E87Iv67AK xVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64 vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8G jcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2I x0cI8IcVAFwI0_JFI_Gr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK 8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I 0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUco7KUUUUU Content-Type: text/plain; charset="utf-8" LTO is not only used for Clang, it maybe used for Rust, make LTO case out of CONFIG_CC_HAS_ANNOTATE_TABLEJUMP in Makefile. This is preparation for later patch, no function changes. Suggested-by: WANG Rui Signed-off-by: Tiezhu Yang --- arch/loongarch/Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile index a3a9759414f4..9d80af7f75c8 100644 --- a/arch/loongarch/Makefile +++ b/arch/loongarch/Makefile @@ -102,16 +102,16 @@ KBUILD_CFLAGS +=3D $(call cc-option,-mthin-add-sub)= $(call cc-option,-Wa$(comma) =20 ifdef CONFIG_OBJTOOL ifdef CONFIG_CC_HAS_ANNOTATE_TABLEJUMP +KBUILD_CFLAGS +=3D -mannotate-tablejump +else +KBUILD_CFLAGS +=3D -fno-jump-tables # keep compatibility with older comp= ilers +endif +ifdef CONFIG_LTO_CLANG # The annotate-tablejump option can not be passed to LLVM backend when LTO= is enabled. # Ensure it is aware of linker with LTO, '--loongarch-annotate-tablejump' = also needs to # be passed via '-mllvm' to ld.lld. -KBUILD_CFLAGS +=3D -mannotate-tablejump -ifdef CONFIG_LTO_CLANG KBUILD_LDFLAGS +=3D -mllvm --loongarch-annotate-tablejump endif -else -KBUILD_CFLAGS +=3D -fno-jump-tables # keep compatibility with older comp= ilers -endif endif =20 KBUILD_RUSTFLAGS +=3D --target=3Dloongarch64-unknown-none-softfloat -Ccod= e-model=3Dsmall --=20 2.42.0 From nobody Fri Oct 3 08:52:31 2025 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E339E2F28F0; Wed, 3 Sep 2025 09:53:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756893214; cv=none; b=SXV+YZsykN2HVa+5gdBbxW1YVwzuaimgBFzbqFl2RIIoy1Dc2m5S7u98guNYYuzvYc9vIMBbqu7t3mChWgdFrJYIR/O/PpASOA6psUC5JDERGVMlT8xchzxD/vdCyQlXvo5JUd+vAkqY+tI12C6rCgp6iiWsj6+TliA9IfrA36g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756893214; c=relaxed/simple; bh=PuAfWmWmu4+nzyctL9OZNVJZoNyu+8EySupeLi2tGKU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L9NuQIHMr0XlxBhkyqUtnoYqOkhx0uLUJPxU/i6/ID6kdQN/Xxp3Qcd6fuobexj3OAqPYEuA9IkagRz0lzi8h6tQeUkJRpHNJLXnD4uLm3CZ0dr0j4UCJDK9671Wq46UM9BVfqfDATa+vcwefMOQtG/m7L+1Dp2dJY/1eGGC0fM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8Bx1tAUELho8i0GAA--.12914S3; Wed, 03 Sep 2025 17:53:24 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by front1 (Coremail) with SMTP id qMiowJAxfcEMELhom_16AA--.5842S5; Wed, 03 Sep 2025 17:53:24 +0800 (CST) From: Tiezhu Yang To: Huacai Chen , Miguel Ojeda Cc: WANG Rui , rust-for-linux@vger.kernel.org, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [RFC PATCH 3/3] LoongArch: Handle table jump option for RUST Date: Wed, 3 Sep 2025 17:53:15 +0800 Message-ID: <20250903095315.15057-4-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20250903095315.15057-1-yangtiezhu@loongson.cn> References: <20250903095315.15057-1-yangtiezhu@loongson.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: qMiowJAxfcEMELhom_16AA--.5842S5 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj93XoWxZF4rtrW5uF4fJrWrZr1DurX_yoW5ZF1xpw nru3s5tr4rGFn7t39xJayUWr4rJrnxtw13XFs7G348Aay7X34UZrs2y3srXFy8AwnxW3yS qryrK3y3KFWDC3XCm3ZEXasCq-sJn29KB7ZKAUJUUUU5529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUk0b4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Cr0_Gr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx1l5I 8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1q6rW5McIj6I8E87Iv67AK xVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64 vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8G jcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2I x0cI8IcVAFwI0_JFI_Gr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK 8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I 0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUcCD7UUUUU Content-Type: text/plain; charset="utf-8" When compiling with LLVM and CONFIG_RUST is set, there exist objtool warnings "sibling call from callable instruction with modified stack frame" in rust/core.o and rust/kernel.o. For this special case, the related object file shows that there is no generated relocation section '.rela.discard.tablejump_annotate' for the table jump instruction jirl, thus objtool can not know that what is the actual destination address. If the rustc has the option "-Cllvm-args=3D--loongarch-annotate-tablejump", pass the option to enable jump table for objtool, otherwise it is better to remain -Zno-jump-tables to keep compatibility with older rustc. How to test: (1) Please install rustc 1.78.0 (without annotate-tablejump option) or 1.87.0 (with annotate-tablejump option), do not use the latest version for now, otherwise there may be build error: --> rust/kernel/lib.rs:331:13 | 331 | loc.file_with_nul() | ^^^^^^^^^^^^^ method not found in `&'a Location<'a>` error: aborting due to 1 previous error (2) Execute the following command: $ rustup component add rust-src $ make LLVM=3D1 rustavailable $ make ARCH=3Dloongarch LLVM=3D1 clean defconfig $ scripts/config -d MODVERSIONS \ -e RUST -e SAMPLES -e SAMPLES_RUST \ -e SAMPLE_RUST_CONFIGFS -e SAMPLE_RUST_MINIMAL \ -e SAMPLE_RUST_MISC_DEVICE -e SAMPLE_RUST_PRINT \ -e SAMPLE_RUST_DMA -e SAMPLE_RUST_DRIVER_PCI \ -e SAMPLE_RUST_DRIVER_PLATFORM -e SAMPLE_RUST_DRIVER_FAUX \ -e SAMPLE_RUST_DRIVER_AUXILIARY -e SAMPLE_RUST_HOSTPROGS $ make ARCH=3Dloongarch LLVM=3D1 olddefconfig all Suggested-by: WANG Rui Signed-off-by: Tiezhu Yang --- arch/loongarch/Kconfig | 4 ++++ arch/loongarch/Makefile | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig index f0abc38c40ac..57933a717e92 100644 --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -298,6 +298,10 @@ config AS_HAS_LVZ_EXTENSION config CC_HAS_ANNOTATE_TABLEJUMP def_bool $(cc-option,-mannotate-tablejump) =20 +config RUSTC_HAS_ANNOTATE_TABLEJUMP + depends on RUST + def_bool $(rustc-option,-Cllvm-args=3D--loongarch-annotate-tablejump) + menu "Kernel type and options" =20 source "kernel/Kconfig.hz" diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile index 9d80af7f75c8..b26d47707031 100644 --- a/arch/loongarch/Makefile +++ b/arch/loongarch/Makefile @@ -106,6 +106,12 @@ KBUILD_CFLAGS +=3D -mannotate-tablejump else KBUILD_CFLAGS +=3D -fno-jump-tables # keep compatibility with older comp= ilers endif +ifdef CONFIG_RUSTC_HAS_ANNOTATE_TABLEJUMP +# Pass '--loongarch-annotate-tablejump' via '-Cllvm-args' to rustc when RU= ST is enabled. +KBUILD_RUSTFLAGS +=3D -Cllvm-args=3D--loongarch-annotate-tablejump +else +KBUILD_RUSTFLAGS +=3D -Zno-jump-tables # keep compatibility with older co= mpilers +endif ifdef CONFIG_LTO_CLANG # The annotate-tablejump option can not be passed to LLVM backend when LTO= is enabled. # Ensure it is aware of linker with LTO, '--loongarch-annotate-tablejump' = also needs to --=20 2.42.0