Skip to content

Commit 13c23cb

Browse files
heiherchenhuacai
authored andcommitted
rust: Fix enabling Rust and building with GCC for LoongArch
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>
1 parent f1e7177 commit 13c23cb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

rust/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \
232232
-mfunction-return=thunk-extern -mrecord-mcount -mabi=lp64 \
233233
-mindirect-branch-cs-prefix -mstack-protector-guard% -mtraceback=no \
234234
-mno-pointers-to-nested-functions -mno-string \
235-
-mno-strict-align -mstrict-align \
235+
-mno-strict-align -mstrict-align -mdirect-extern-access \
236+
-mexplicit-relocs -mno-check-zero-division \
236237
-fconserve-stack -falign-jumps=% -falign-loops=% \
237238
-femit-struct-debug-baseonly -fno-ipa-cp-clone -fno-ipa-sra \
238239
-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=% \
246247
# Derived from `scripts/Makefile.clang`.
247248
BINDGEN_TARGET_x86 := x86_64-linux-gnu
248249
BINDGEN_TARGET_arm64 := aarch64-linux-gnu
250+
BINDGEN_TARGET_loongarch := loongarch64-linux-gnusf
249251
BINDGEN_TARGET := $(BINDGEN_TARGET_$(SRCARCH))
250252

251253
# All warnings are inhibited since GCC builds are very experimental,

0 commit comments

Comments
 (0)