Skip to content

Commit e297948

Browse files
committed
rust: Add riscv32/riscv64 support
Set the cpu, features, and abi correctly Signed-off-by: Khem Raj <[email protected]>
1 parent a679b6f commit e297948

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

recipes-devtools/rust/rust.inc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ def llvm_features_from_tune(d):
9797
f.append("+a15")
9898
if 'cortexa17' in feat:
9999
f.append("+a17")
100-
100+
if ('riscv64' in feat) or ('riscv32' in feat):
101+
f.append("+a,+c,+d,+f,+m")
101102
return f
102103

103104
# TARGET_CC_ARCH changes from build/cross/target so it'll do the right thing
@@ -291,6 +292,8 @@ def llvm_cpu(d):
291292
trans['powerpc'] = "powerpc"
292293
trans['mips64'] = "mips64"
293294
trans['mips64el'] = "mips64"
295+
trans['riscv64'] = "generic-rv64"
296+
trans['riscv32'] = "generic-rv32"
294297

295298
if target in ["mips", "mipsel"]:
296299
feat = frozenset(d.getVar('TUNE_FEATURES').split())
@@ -337,6 +340,10 @@ def rust_gen_target(d, thing, wd, features, cpu):
337340
tspec['env'] = "musl"
338341
else:
339342
tspec['env'] = "gnu"
343+
if "riscv64" in tspec['llvm-target']:
344+
tspec['llvm-abiname'] = "lp64d"
345+
if "riscv32" in tspec['llvm-target']:
346+
tspec['llvm-abiname'] = "ilp32d"
340347
tspec['vendor'] = "unknown"
341348
tspec['target-family'] = "unix"
342349
tspec['linker'] = "{}{}gcc".format(d.getVar('CCACHE'), prefix)

0 commit comments

Comments
 (0)