diff options
| author | Mark Hatle <mark.hatle@amd.com> | 2025-06-17 18:39:44 -0500 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-06-20 09:52:28 +0100 |
| commit | d56b141a4eea831eca796ee4f7d9ea5ef92af7dd (patch) | |
| tree | 827b5f05549fdd8b48228d9aa80093bac5c792cf /meta | |
| parent | 3c5c4cfa6bf4aa88bcd69e2688fdceea6a655165 (diff) | |
| download | poky-d56b141a4eea831eca796ee4f7d9ea5ef92af7dd.tar.gz | |
rust-target-config.bbclass: Update for new riscv TUNE_FEATURES
Add the new TUNE_FEATURES to the 'features:' list, based on matching output
with:
rustc --target=riscv32i-unknown-none-elf -Ctarget-feature=help
Use the TUNE_RISCV_ABI instead of guessing for the ABI.
Pass the arch "as-is", since it should now be riscv32 or riscv64.
(From OE-Core rev: 88b59db87d2c65e5be0f3fee1ebf4ee64ef05f18)
Signed-off-by: Mark Hatle <mark.hatle@amd.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/classes-recipe/rust-target-config.bbclass | 65 | ||||
| -rw-r--r-- | meta/lib/oe/rust.py | 2 |
2 files changed, 41 insertions, 26 deletions
diff --git a/meta/classes-recipe/rust-target-config.bbclass b/meta/classes-recipe/rust-target-config.bbclass index c04940ce54..906a5083d7 100644 --- a/meta/classes-recipe/rust-target-config.bbclass +++ b/meta/classes-recipe/rust-target-config.bbclass | |||
| @@ -77,8 +77,33 @@ def llvm_features_from_tune(d): | |||
| 77 | f.append("+a15") | 77 | f.append("+a15") |
| 78 | if 'cortexa17' in feat: | 78 | if 'cortexa17' in feat: |
| 79 | f.append("+a17") | 79 | f.append("+a17") |
| 80 | if ('riscv64' in feat) or ('riscv32' in feat): | 80 | if 'rv' in feat: |
| 81 | f.append("+a,+c,+d,+f,+m") | 81 | if 'm' in feat: |
| 82 | f.append("+m") | ||
| 83 | if 'a' in feat: | ||
| 84 | f.append("+a") | ||
| 85 | if 'f' in feat: | ||
| 86 | f.append("+f") | ||
| 87 | if 'd' in feat: | ||
| 88 | f.append("+d") | ||
| 89 | if 'c' in feat: | ||
| 90 | f.append("+c") | ||
| 91 | if 'v' in feat: | ||
| 92 | f.append("+v") | ||
| 93 | if 'zicbom' in feat: | ||
| 94 | f.append("+zicbom") | ||
| 95 | if 'zicsr' in feat: | ||
| 96 | f.append("+zicsr") | ||
| 97 | if 'zifencei' in feat: | ||
| 98 | f.append("+zifencei") | ||
| 99 | if 'zba' in feat: | ||
| 100 | f.append("+zba") | ||
| 101 | if 'zbb' in feat: | ||
| 102 | f.append("+zbb") | ||
| 103 | if 'zbc' in feat: | ||
| 104 | f.append("+zbc") | ||
| 105 | if 'zbs' in feat: | ||
| 106 | f.append("+zbs") | ||
| 82 | return f | 107 | return f |
| 83 | llvm_features_from_tune[vardepvalue] = "${@llvm_features_from_tune(d)}" | 108 | llvm_features_from_tune[vardepvalue] = "${@llvm_features_from_tune(d)}" |
| 84 | 109 | ||
| @@ -236,19 +261,19 @@ TARGET_POINTER_WIDTH[powerpc64le] = "64" | |||
| 236 | TARGET_C_INT_WIDTH[powerpc64le] = "32" | 261 | TARGET_C_INT_WIDTH[powerpc64le] = "32" |
| 237 | MAX_ATOMIC_WIDTH[powerpc64le] = "64" | 262 | MAX_ATOMIC_WIDTH[powerpc64le] = "64" |
| 238 | 263 | ||
| 239 | ## riscv32gc-unknown-linux-{gnu, musl} | 264 | ## riscv32-unknown-linux-{gnu, musl} |
| 240 | DATA_LAYOUT[riscv32gc] = "e-m:e-p:32:32-i64:64-n32-S128" | 265 | DATA_LAYOUT[riscv32] = "e-m:e-p:32:32-i64:64-n32-S128" |
| 241 | TARGET_ENDIAN[riscv32gc] = "little" | 266 | TARGET_ENDIAN[riscv32] = "little" |
| 242 | TARGET_POINTER_WIDTH[riscv32gc] = "32" | 267 | TARGET_POINTER_WIDTH[riscv32] = "32" |
| 243 | TARGET_C_INT_WIDTH[riscv32gc] = "32" | 268 | TARGET_C_INT_WIDTH[riscv32] = "32" |
| 244 | MAX_ATOMIC_WIDTH[riscv32gc] = "32" | 269 | MAX_ATOMIC_WIDTH[riscv32] = "32" |
| 245 | 270 | ||
| 246 | ## riscv64gc-unknown-linux-{gnu, musl} | 271 | ## riscv64-unknown-linux-{gnu, musl} |
| 247 | DATA_LAYOUT[riscv64gc] = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128" | 272 | DATA_LAYOUT[riscv64] = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128" |
| 248 | TARGET_ENDIAN[riscv64gc] = "little" | 273 | TARGET_ENDIAN[riscv64] = "little" |
| 249 | TARGET_POINTER_WIDTH[riscv64gc] = "64" | 274 | TARGET_POINTER_WIDTH[riscv64] = "64" |
| 250 | TARGET_C_INT_WIDTH[riscv64gc] = "32" | 275 | TARGET_C_INT_WIDTH[riscv64] = "32" |
| 251 | MAX_ATOMIC_WIDTH[riscv64gc] = "64" | 276 | MAX_ATOMIC_WIDTH[riscv64] = "64" |
| 252 | 277 | ||
| 253 | ## loongarch64-unknown-linux-{gnu, musl} | 278 | ## loongarch64-unknown-linux-{gnu, musl} |
| 254 | DATA_LAYOUT[loongarch64] = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128" | 279 | DATA_LAYOUT[loongarch64] = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128" |
| @@ -271,19 +296,11 @@ def arch_to_rust_target_arch(arch): | |||
| 271 | return "arm" | 296 | return "arm" |
| 272 | elif arch == "powerpc64le": | 297 | elif arch == "powerpc64le": |
| 273 | return "powerpc64" | 298 | return "powerpc64" |
| 274 | elif arch == "riscv32gc": | ||
| 275 | return "riscv32" | ||
| 276 | elif arch == "riscv64gc": | ||
| 277 | return "riscv64" | ||
| 278 | else: | 299 | else: |
| 279 | return arch | 300 | return arch |
| 280 | 301 | ||
| 281 | # Convert a rust target string to a llvm-compatible triplet | 302 | # Convert a rust target string to a llvm-compatible triplet |
| 282 | def rust_sys_to_llvm_target(sys): | 303 | def rust_sys_to_llvm_target(sys): |
| 283 | if sys.startswith('riscv32gc-'): | ||
| 284 | return sys.replace('riscv32gc-', 'riscv32-', 1) | ||
| 285 | if sys.startswith('riscv64gc-'): | ||
| 286 | return sys.replace('riscv64gc-', 'riscv64-', 1) | ||
| 287 | return sys | 304 | return sys |
| 288 | 305 | ||
| 289 | # generates our target CPU value | 306 | # generates our target CPU value |
| @@ -380,9 +397,9 @@ def rust_gen_target(d, thing, wd, arch): | |||
| 380 | else: | 397 | else: |
| 381 | tspec['env'] = "gnu" | 398 | tspec['env'] = "gnu" |
| 382 | if "riscv64" in tspec['llvm-target']: | 399 | if "riscv64" in tspec['llvm-target']: |
| 383 | tspec['llvm-abiname'] = "lp64d" | 400 | tspec['llvm-abiname'] = d.getVar('TUNE_RISCV_ABI') |
| 384 | if "riscv32" in tspec['llvm-target']: | 401 | if "riscv32" in tspec['llvm-target']: |
| 385 | tspec['llvm-abiname'] = "ilp32d" | 402 | tspec['llvm-abiname'] = d.getVar('TUNE_RISCV_ABI') |
| 386 | if "loongarch64" in tspec['llvm-target']: | 403 | if "loongarch64" in tspec['llvm-target']: |
| 387 | tspec['llvm-abiname'] = "lp64d" | 404 | tspec['llvm-abiname'] = "lp64d" |
| 388 | tspec['vendor'] = "unknown" | 405 | tspec['vendor'] = "unknown" |
diff --git a/meta/lib/oe/rust.py b/meta/lib/oe/rust.py index 185553eeeb..1dc9cf150d 100644 --- a/meta/lib/oe/rust.py +++ b/meta/lib/oe/rust.py | |||
| @@ -8,6 +8,4 @@ | |||
| 8 | def arch_to_rust_arch(arch): | 8 | def arch_to_rust_arch(arch): |
| 9 | if arch == "ppc64le": | 9 | if arch == "ppc64le": |
| 10 | return "powerpc64le" | 10 | return "powerpc64le" |
| 11 | if arch in ('riscv32', 'riscv64'): | ||
| 12 | return arch + 'gc' | ||
| 13 | return arch | 11 | return arch |
