]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
rust: Fix enabling Rust and building with GCC for LoongArch
authorWANG Rui <wangrui@loongson.cn>
Sun, 30 Mar 2025 08:30:20 +0000 (16:30 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Sun, 30 Mar 2025 08:30:20 +0000 (16:30 +0800)
This patch fixes a build issue on LoongArch when Rust is enabled and
compiled with GCC by explicitly setting the bindgen target and skipping
C flags that Clang doesn't support.

Cc: stable@vger.kernel.org
Acked-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: WANG Rui <wangrui@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
rust/Makefile

index ea3849eb78f6585e19d3ae37f3b4535bf329a1d6..2c57c624fe7df01c2d1030fb48d08c0c7781152a 100644 (file)
@@ -232,7 +232,8 @@ bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \
        -mfunction-return=thunk-extern -mrecord-mcount -mabi=lp64 \
        -mindirect-branch-cs-prefix -mstack-protector-guard% -mtraceback=no \
        -mno-pointers-to-nested-functions -mno-string \
-       -mno-strict-align -mstrict-align \
+       -mno-strict-align -mstrict-align -mdirect-extern-access \
+       -mexplicit-relocs -mno-check-zero-division \
        -fconserve-stack -falign-jumps=% -falign-loops=% \
        -femit-struct-debug-baseonly -fno-ipa-cp-clone -fno-ipa-sra \
        -fno-partial-inlining -fplugin-arg-arm_ssp_per_task_plugin-% \
@@ -246,6 +247,7 @@ bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \
 # Derived from `scripts/Makefile.clang`.
 BINDGEN_TARGET_x86     := x86_64-linux-gnu
 BINDGEN_TARGET_arm64   := aarch64-linux-gnu
+BINDGEN_TARGET_loongarch       := loongarch64-linux-gnusf
 BINDGEN_TARGET         := $(BINDGEN_TARGET_$(SRCARCH))
 
 # All warnings are inhibited since GCC builds are very experimental,