rust/compiler
Matthias Krüger 023154e2ce
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````
2023-03-17 08:42:38 +01:00
..
rustc fix link 2023-03-11 10:53:47 -06:00
rustc_abi Unify validity checks into a single query 2023-02-23 18:42:36 +00:00
rustc_apfloat compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_arena compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_ast Rollup merge of #108958 - clubby789:unbox-the-hir, r=compiler-errors 2023-03-17 08:42:37 +01:00
rustc_ast_lowering Gate fmt args flattening behind -Zflatten-format-args. 2023-03-16 11:21:50 +01:00
rustc_ast_passes Auto merge of #108471 - clubby789:unbox-the-syntax, r=Nilstrieb,est31 2023-03-13 10:41:50 +00:00
rustc_ast_pretty Remove box_syntax from AST and use in tools 2023-03-12 13:19:46 +00:00
rustc_attr Simplify message paths 2023-03-11 22:51:57 +01:00
rustc_baked_icu_data update ICU4X to 1.1.0 2023-02-04 22:28:59 +01:00
rustc_borrowck Auto merge of #108944 - cjgillot:clear-local-info, r=oli-obk 2023-03-16 19:59:56 +00:00
rustc_builtin_macros Properly allow macro expanded format_args invocations to uses captures 2023-03-14 13:16:52 +00:00
rustc_codegen_cranelift Auto merge of #108282 - cjgillot:mir-checked-sh, r=tmiasko 2023-03-15 21:31:06 +00:00
rustc_codegen_gcc Remove uses of box_syntax in rustc and tools 2023-03-12 13:19:46 +00:00
rustc_codegen_llvm Rollup merge of #108726 - est31:backticks_matchmaking_tidy, r=Nilstrieb 2023-03-12 08:13:25 +01:00
rustc_codegen_ssa Auto merge of #108944 - cjgillot:clear-local-info, r=oli-obk 2023-03-16 19:59:56 +00:00
rustc_const_eval Auto merge of #108944 - cjgillot:clear-local-info, r=oli-obk 2023-03-16 19:59:56 +00:00
rustc_data_structures Rollup merge of #108887 - nnethercote:rename-MapInPlace, r=lqd 2023-03-08 21:24:53 +01:00
rustc_driver Remove unneeded extern crate 2023-02-02 07:47:39 +01:00
rustc_driver_impl Simplify message paths 2023-03-11 22:51:57 +01:00
rustc_error_codes unequal → not equal 2023-03-15 23:55:48 +05:30
rustc_error_messages Simplify message paths 2023-03-11 22:51:57 +01:00
rustc_errors Simplify message paths 2023-03-11 22:51:57 +01:00
rustc_expand unequal → not equal 2023-03-15 23:55:48 +05:30
rustc_feature Remove box_syntax from AST and use in tools 2023-03-12 13:19:46 +00:00
rustc_fs_util Remove useless borrows and derefs 2022-12-01 17:34:43 +00:00
rustc_graphviz Fix uninlined_format_args for some compiler crates 2023-01-05 19:01:12 +01:00
rustc_hir Rollup merge of #108958 - clubby789:unbox-the-hir, r=compiler-errors 2023-03-17 08:42:37 +01:00
rustc_hir_analysis Rollup merge of #109166 - lcnr:define_opaque_types-explicit, r=oli-obk 2023-03-16 08:57:07 +01:00
rustc_hir_pretty Remove box expressions from HIR 2023-03-14 17:18:26 +00:00
rustc_hir_typeck Rollup merge of #108958 - clubby789:unbox-the-hir, r=compiler-errors 2023-03-17 08:42:37 +01:00
rustc_incremental Auto merge of #108794 - nnethercote:avoid-unnecessary-hashing, r=cjgillot 2023-03-12 06:48:30 +00:00
rustc_index Match unmatched backticks in compiler/ that are part of rustdoc 2023-03-03 08:39:00 +01:00
rustc_infer Rollup merge of #109166 - lcnr:define_opaque_types-explicit, r=oli-obk 2023-03-16 08:57:07 +01:00
rustc_interface Gate fmt args flattening behind -Zflatten-format-args. 2023-03-16 11:21:50 +01:00
rustc_lexer fix(lexer): not skipped whitespace warning for '\x0c' 2023-03-09 22:44:58 +08:00
rustc_lint Rollup merge of #109158 - Ezrashaw:expand-sugg-for-unused-lint, r=Nilstrieb 2023-03-16 08:57:07 +01:00
rustc_lint_defs Auto merge of #109035 - scottmcm:ptr-read-should-know-undef, r=WaffleLapkin,JakobDegen 2023-03-15 11:44:12 +00:00
rustc_llvm Remove an extraneous include 2023-03-07 22:46:39 -08:00
rustc_log Rollup merge of #107895 - matthiaskrgr:cl, r=compiler-errors 2023-02-11 17:18:44 +01:00
rustc_macros Allow using bool for optional diagnostics 2023-02-27 12:54:11 +00:00
rustc_metadata Rollup merge of #109109 - compiler-errors:polymorphize-foreign, r=Nilstrieb 2023-03-15 17:51:31 +05:30
rustc_middle Rollup merge of #108958 - clubby789:unbox-the-hir, r=compiler-errors 2023-03-17 08:42:37 +01:00
rustc_mir_build Rollup merge of #108958 - clubby789:unbox-the-hir, r=compiler-errors 2023-03-17 08:42:37 +01:00
rustc_mir_dataflow Simplify message paths 2023-03-11 22:51:57 +01:00
rustc_mir_transform Auto merge of #108944 - cjgillot:clear-local-info, r=oli-obk 2023-03-16 19:59:56 +00:00
rustc_monomorphize Rollup merge of #109109 - compiler-errors:polymorphize-foreign, r=Nilstrieb 2023-03-15 17:51:31 +05:30
rustc_parse Auto merge of #108471 - clubby789:unbox-the-syntax, r=Nilstrieb,est31 2023-03-13 10:41:50 +00:00
rustc_parse_format Improve heuristics for format_args literal being suggestable 2023-03-14 13:20:39 +00:00
rustc_passes Rollup merge of #108958 - clubby789:unbox-the-hir, r=compiler-errors 2023-03-17 08:42:37 +01:00
rustc_plugin_impl Simplify message paths 2023-03-11 22:51:57 +01:00
rustc_privacy Simplify message paths 2023-03-11 22:51:57 +01:00
rustc_query_impl Ensure value is on the on-disk cache before returning. 2023-03-11 22:41:01 +00:00
rustc_query_system Auto merge of #108845 - Zoxc:par-fix-2, r=cjgillot 2023-03-12 17:03:44 +00:00
rustc_resolve error-msg: impl better suggestion for E0532 2023-03-15 22:19:54 +13:00
rustc_serialize Emit the enum discriminant separately for the Encodable macro 2023-02-25 01:04:56 +01:00
rustc_session Gate fmt args flattening behind -Zflatten-format-args. 2023-03-16 11:21:50 +01:00
rustc_smir Change item collection to be on demand 2023-03-07 12:47:25 -08:00
rustc_span Don't allow new const panic through format flattening. 2023-03-16 11:21:50 +01:00
rustc_symbol_mangling Simplify message paths 2023-03-11 22:51:57 +01:00
rustc_target Fix riscv64 fuchsia LLVM target name 2023-03-15 12:55:37 +09:00
rustc_trait_selection Rollup merge of #108958 - clubby789:unbox-the-hir, r=compiler-errors 2023-03-17 08:42:37 +01:00
rustc_traits Add mk_canonical_var_infos_from_iter. 2023-02-24 07:33:02 +11:00
rustc_transmute rustc_middle: Remove trait DefIdTree 2023-03-02 23:46:44 +04:00
rustc_ty_utils Auto merge of #109089 - compiler-errors:opt_rpitit_info-follow-up, r=spastorino 2023-03-15 08:13:23 +00:00
rustc_type_ir Rollup merge of #109047 - tshepang:type, r=lcnr 2023-03-12 20:44:52 +01:00