Rollup merge of #109155 - taiki-e:riscv64-fuchsia-fix-llvm-target, r=tmandry
Fix riscv64 fuchsia LLVM target name Currently, riscv64gc-unknown-fuchsia (added in #108722) sets riscv64*gc*-unknown-fuchsia as the LLVM target.1716932743/compiler/rustc_target/src/spec/riscv64gc_unknown_fuchsia.rs (L5)
However, riscv64*gc*-\* is not a valid LLVM target and causes the following error. ```console $ rustc --print cfg --target riscv64gc-unknown-fuchsia error: could not create LLVM TargetMachine for triple: riscv64gc-unknown-fuchsia: No available targets are compatible with triple "riscv64gc-unknown-fuchsia" ``` As with other RISC-V targets, the LLVM target should use riscv64-\*, not riscv64*gc*-\*.1716932743/compiler/rustc_target/src/spec/riscv64gc_unknown_freebsd.rs (L5)
1716932743/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_gnu.rs (L5)
I confirmed that riscv64-unknown-fuchsia is recognized as a valid LLVM target by using custom targets. ```console # create a custom target with `"llvm-target": "riscv64-unknown-fuchsia" from no-std riscv64gc target. $ rustc --print target-spec-json -Z unstable-options --target riscv64gc-unknown-none-elf | grep -v is-builtin | sed 's/"llvm-target".*/"llvm-target": "riscv64-unknown-fuchsia",/' > riscv64gc-unknown-fuchsia.json $ rustc --print cfg --target riscv64gc-unknown-fuchsia.json debug_assertions panic="abort" target_abi="" target_arch="riscv64" target_endian="little" target_env="" target_feature="a" target_feature="c" target_feature="d" target_feature="f" target_feature="m" ... $ cat riscv64gc-unknown-fuchsia.json { "arch": "riscv64", "code-model": "medium", "cpu": "generic-rv64", "data-layout": "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128", "eh-frame-header": false, "emit-debug-gdb-scripts": false, "features": "+m,+a,+f,+d,+c", "linker": "rust-lld", "linker-flavor": "ld.lld", "llvm-abiname": "lp64d", "llvm-target": "riscv64-unknown-fuchsia", "max-atomic-width": 64, "panic-strategy": "abort", "relocation-model": "static", "supported-sanitizers": [ "kernel-address" ], "target-pointer-width": "64" } # Check the current master's LLVM target name causes an error $ sed -i 's/riscv64-unknown-fuchsia/riscv64gc-unknown-fuchsia/' riscv64gc-unknown-fuchsia.json $ rustc --print cfg --target riscv64gc-unknown-fuchsia.json error: could not create LLVM TargetMachine for triple: riscv64gc-unknown-fuchsia: No available targets are compatible with triple "riscv64gc-unknown-fuchsia" ``` r? ````@tmandry````
This commit is contained in:
commit
023154e2ce
@ -2,7 +2,7 @@
|
||||
|
||||
pub fn target() -> Target {
|
||||
Target {
|
||||
llvm_target: "riscv64gc-unknown-fuchsia".into(),
|
||||
llvm_target: "riscv64-unknown-fuchsia".into(),
|
||||
pointer_width: 64,
|
||||
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
|
||||
arch: "riscv64".into(),
|
||||
|
Loading…
Reference in New Issue
Block a user