Skip to contentSkip to conversation

perf tools riscv: Add support for riscv lookup_binutils_path

PATCH RESEND Superseded Paran Lee 2 participants 2 messages Mar 12, 2023

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Paran Lee

author
#0 lore raw

PATCH RESEND 1/1 perf tools riscv: Add support for riscv lookup_binutils_path

Add to know RISC-V binutils path.

---
 tools/perf/arch/common.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
tools/perf/arch/common.c +18 -0
index 59dd875fd5e4..6ac7a22244c0 100644
@@ -43,6 +43,20 @@ const char *const powerpc_triplets[] = {
 	NULL
 };
 
+const char *const riscv32_triplets[] = {
+	"riscv32-unknown-linux-gnu-",
+	"riscv32-linux-android-",
+	"riscv32-linux-gnu-",
+	NULL
+};
+
+const char *const riscv64_triplets[] = {
+	"riscv64-unknown-linux-gnu-",
+	"riscv64-linux-android-",
+	"riscv64-linux-gnu-",
+	NULL
+};
+
 const char *const s390_triplets[] = {
 	"s390-ibm-linux-",
 	"s390x-linux-gnu-",
@@ -168,6 +182,10 @@ static int perf_env__lookup_binutils_path(struct perf_env *env,
 		path_list = powerpc_triplets;
 	else if (!strcmp(arch, "sh"))
 		path_list = sh_triplets;
+	else if (!strcmp(arch, "riscv32"))
+		path_list = riscv32_triplets;
+	else if (!strcmp(arch, "riscv64"))
+		path_list = riscv64_triplets;
 	else if (!strcmp(arch, "s390"))
 		path_list = s390_triplets;
 	else if (!strcmp(arch, "sparc"))
Signature · 1 line
2.34.1
#1 lore raw
Quoted 16 lines · Paran Lee

Add to know RISC-V binutils path.

---
 tools/perf/arch/common.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
tools/perf/arch/common.c +1 -0
index 59dd875fd5e4..6ac7a22244c0 100644
@@ -43,6 +43,20 @@ const char *const powerpc_triplets[] = {
 	NULL
 };
 
+const char *const riscv32_triplets[] = {

tools/perf/arch/common.c const char *const powerpc_triplets[] = { · line 56

Quoted 10 lines
tools/perf/arch/common.c +10 -0
+	"riscv32-unknown-linux-gnu-",
+	"riscv32-linux-android-",
+	"riscv32-linux-gnu-",
+	NULL
+};
+
+const char *const riscv64_triplets[] = {
+	"riscv64-unknown-linux-gnu-",
+	"riscv64-linux-android-",
+	"riscv64-linux-gnu-",

I don't know anything about perf, so I could be asking a really silly question here, but how come riscvN-linux- has been omitted here? The kernel.org toolchains [1] are prefixed that way, although I noticed in your v1 that you'd seemingly duplicated the arm64 patterns, so I am curious as to whether the omission is intentional.

Cheers,
Conor.

[1] https://mirrors.edge.kernel.org/pub/tools/crosstool/

Quoted 20 lines
tools/perf/arch/common.c +7 -0
+	NULL
+};
+
 const char *const s390_triplets[] = {
 	"s390-ibm-linux-",
 	"s390x-linux-gnu-",
@@ -168,6 +182,10 @@ static int perf_env__lookup_binutils_path(struct perf_env *env,
 		path_list = powerpc_triplets;
 	else if (!strcmp(arch, "sh"))
 		path_list = sh_triplets;
+	else if (!strcmp(arch, "riscv32"))
+		path_list = riscv32_triplets;
+	else if (!strcmp(arch, "riscv64"))
+		path_list = riscv64_triplets;
 	else if (!strcmp(arch, "s390"))
 		path_list = s390_triplets;
 	else if (!strcmp(arch, "sparc"))
Signature · 1 line
2.34.1