Skip to contentSkip to conversation

perf build: Add rust target flag for loongarch cross compile

PATCH In review Li Fangxu 3 participants 4 messages Aug 21

Subsystems (2)
lore
Share & tools
lore

Li Fangxu

author
#0 lore raw

PATCH 1/1 perf build: Add rust target flag for loongarch cross compile

From: lifangxu <[email protected]>

Based on commit 30f998c992c9 ("tools build: Fix rust cross compilation"), add rust target flags for loongarch cross tool to fix perf compilation error:
*** Unknown rust cross compilation architecture loongarch. Stop.

---
 tools/perf/Makefile.config | 2 ++
 1 file changed, 2 insertions(+)
tools/perf/Makefile.config +2 -0
index 0ba307e78fe1..42c0ef213750 100644
@@ -1149,6 +1149,8 @@ ifndef NO_RUST
     RUST_TARGET_FLAGS_s390	:= s390x-unknown-linux-gnu
     RUST_TARGET_FLAGS_x86	:= x86_64-unknown-linux-gnu
     RUST_TARGET_FLAGS_x86_64	:= x86_64-unknown-linux-gnu
+    RUST_TARGET_FLAGS_loongarch := loongarch64-unknown-linux-gnu
+
 
     ifeq ($(RUST_TARGET_FLAGS_$(ARCH)),)
       $(error Unknown rust cross compilation architecture $(ARCH))
Signature · 1 line
2.43.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Missing RUST_TARGET_FLAGS alias for loongarch64. --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Missing RUST_TARGET_FLAGS alias for loongarch64.
--

--- Patch [1]: [PATCH] perf build: Add rust target flag for loongarch cross compile --- commit b2d0a9ab160e1b008ff911474976ee4d8ac95e11
Author: lifangxu <[email protected]>

perf build: Add rust target flag for loongarch cross compile

This commit adds the loongarch rust target flag to fix perf cross compilation errors for the architecture.

Quoted 4 lines
tools/perf/Makefile.config +0 -0
index 0ba307e78fe1f..42c0ef2137502 100644

[ ... ]

tools/perf/Makefile.config ifndef NO_RUST · line 1153

Quoted 6 lines
tools/perf/Makefile.config +2 -0
@@ -1149,6 +1149,8 @@ ifndef NO_RUST
     RUST_TARGET_FLAGS_s390	:= s390x-unknown-linux-gnu
     RUST_TARGET_FLAGS_x86	:= x86_64-unknown-linux-gnu
     RUST_TARGET_FLAGS_x86_64	:= x86_64-unknown-linux-gnu
+    RUST_TARGET_FLAGS_loongarch := loongarch64-unknown-linux-gnu
+

[Severity: Low]
Should there also be an alias for loongarch64 defined here?

Since tools/scripts/Makefile.arch accepts ARCH=loongarch64 but this makefile config evaluates $(ARCH) directly, a build invoked with ARCH=loongarch64 will evaluate RUST_TARGET_FLAGS_$(ARCH) as RUST_TARGET_FLAGS_loongarch64.

Will this cause the build to fail with the unknown architecture error because that specific alias is missing?

Quoted 3 lines
tools/perf/Makefile.config +0 -0
     ifeq ($(RUST_TARGET_FLAGS_$(ARCH)),)
       $(error Unknown rust cross compilation architecture $(ARCH))
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw
In reply to Li Fangxu

Hi,

Quoted 18 lines · Li Fangxu

From: lifangxu <[email protected]>

Based on commit 30f998c992c9 ("tools build: Fix rust cross compilation"), add rust target flags for loongarch cross tool to fix perf compilation error:
*** Unknown rust cross compilation architecture loongarch. Stop.

---
 tools/perf/Makefile.config | 2 ++
 1 file changed, 2 insertions(+)
tools/perf/Makefile.config +0 -0
index 0ba307e78fe1..42c0ef213750 100644

tools/perf/Makefile.config ifndef NO_RUST · line 1152

Quoted 4 lines
tools/perf/Makefile.config +1 -0
@@ -1149,6 +1149,8 @@ ifndef NO_RUST
     RUST_TARGET_FLAGS_s390     := s390x-unknown-linux-gnu
     RUST_TARGET_FLAGS_x86      := x86_64-unknown-linux-gnu
     RUST_TARGET_FLAGS_x86_64   := x86_64-unknown-linux-gnu
+    RUST_TARGET_FLAGS_loongarch := loongarch64-unknown-linux-gnu

This duplicates the earlier patch, which was already Acked:

https://lore.kernel.org/loongarch/[email protected]/

Best,
Rui

Quoted 8 lines
tools/perf/Makefile.config +1 -1
+
 
     ifeq ($(RUST_TARGET_FLAGS_$(ARCH)),)
       $(error Unknown rust cross compilation architecture $(ARCH))
--

2.43.0

author
#3 lore raw

Thanks for pointing that out, Rui.

Please disregard my submission.

Best,
Fangxu