Commit Graph

1091 Commits

Author SHA1 Message Date
Ryan Levick
f115064631 Add the wasm32-wasi-preview2 target
Signed-off-by: Ryan Levick <me@ryanlevick.com>
2024-02-27 09:58:04 -05:00
bors
53ed660d47 Auto merge of #120411 - erikdesjardins:netbsdcall, r=Nilstrieb
i586_unknown_netbsd: use inline stack probes

This is one of the last two targets still using "call" stack probes.

I don't believe that this target uses call stack probes for any particular reason--inline stack probes are used on [`i686_unknown_netbsd`](b362939be1/compiler/rustc_target/src/spec/targets/i686_unknown_netbsd.rs (L8)), suggesting they work on netbsd; and on [`i586_unknown_linux_gnu`](b362939be1/compiler/rustc_target/src/spec/targets/i586_unknown_linux_gnu.rs (L4)) (via the base [`i686_unknown_linux_gnu`](b362939be1/compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs (L9))), suggesting they work with `cpu = "pentium"`.

...although I don't have a netbsd system to test this on.

(cc `@he32)`
2024-02-27 08:35:56 +00:00
bors
5c786a7fe3 Auto merge of #121516 - RalfJung:platform-intrinsics-begone, r=oli-obk
remove platform-intrinsics ABI; make SIMD intrinsics be regular intrinsics

`@Amanieu` `@workingjubilee` I don't think there is any reason these need to be "special"? The [original RFC](https://rust-lang.github.io/rfcs/1199-simd-infrastructure.html) indicated eventually making them stable, but I think that is no longer the plan, so seems to me like we can clean this up a bit.

Blocked on https://github.com/rust-lang/stdarch/pull/1538, https://github.com/rust-lang/rust/pull/121542.
2024-02-26 22:24:16 +00:00
Matthias Krüger
e13f454874
Rollup merge of #119590 - ChrisDenton:cfg-target-abi, r=Nilstrieb
Stabilize `cfg_target_abi`

This stabilizes the `cfg` option called `target_abi`:

```rust
#[cfg(target_abi = "eabihf")]
```

Tracking issue: #80970

fixes #78791
resolves #80970
2024-02-25 17:05:19 +01:00
Ralf Jung
cc3df0af7b remove platform-intrinsics ABI; make SIMD intrinsics be regular intrinsics 2024-02-25 08:14:52 +01:00
Chris Denton
93ec0e6299
Stabilize cfg_target_abi 2024-02-24 17:52:03 -03:00
Martin Nordholts
ff930d4fed compiler/rustc_target/src/spec/base/apple/tests.rs: Avoid unnecessary large move
Fixes:

    $ MAGIC_EXTRA_RUSTFLAGS=-Zmove-size-limit=4096 ./x test compiler/rustc_target
    error: moving 6216 bytes
      --> compiler/rustc_target/src/spec/base/apple/tests.rs:17:19
       |
    17 |     for target in all_sim_targets {
       |                   ^^^^^^^^^^^^^^^ value moved from here
       |
       = note: The current maximum size is 4096, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
       = note: `-D large-assignments` implied by `-D warnings`
       = help: to override `-D warnings` add `#[allow(large_assignments)]`
2024-02-24 09:46:18 +01:00
Matthias Krüger
26cb6c7287
Rollup merge of #120742 - Nadrieril:use-min_exh_pats, r=compiler-errors
mark `min_exhaustive_patterns` as complete

This is step 1 and 2 of my [proposal](https://github.com/rust-lang/rust/issues/119612#issuecomment-1918097361) to move `min_exhaustive_patterns` forward. The vast majority of in-tree use cases of `exhaustive_patterns` are covered by `min_exhaustive_patterns`. There are a few cases that still require `exhaustive_patterns` in tests and they're all behind references.

r? ``@ghost``
2024-02-23 17:02:03 +01:00
Nilstrieb
5540d817e3
Rollup merge of #121291 - heiher:revert-medium-cmodel, r=Nilstrieb
target: Revert default to the medium code model on LoongArch targets

This reverts commit 35dad14dfb.

Fixes #121289
2024-02-20 15:13:54 +01:00
Mads Marquart
a3cf493642 Lower default Mac Catalyst deployment target to 13.1
Same default as Clang:
d022f32c73/clang/lib/Driver/ToolChains/Darwin.cpp (L2038)
2024-02-19 13:30:53 +01:00
Mads Marquart
cd530fccb3 Merge deployment target variable loading on iOS and Mac Catalyst 2024-02-19 13:23:02 +01:00
Mads Marquart
3cb4e34310 Fix ld platform_version argument on Mac Catalyst 2024-02-19 13:10:07 +01:00
Mads Marquart
92d4b313eb Make LLVM target contain correct deployment target info on Mac Catalyst 2024-02-19 12:57:08 +01:00
Mads Marquart
94ddbb615d Remove MACOSX_DEPLOYMENT_TARGET env var when linking Mac Catalyst
Mac Catalyst uses IPHONEOS_DEPLOYMENT_TARGET to specify the deployment target, so it makes no sense to remove that variable.
2024-02-19 12:34:12 +01:00
WANG Rui
9c32a7d61b target: Revert default to the medium code model on LoongArch targets
This reverts commit 35dad14dfb.

Fixes #121289
2024-02-19 17:43:09 +08:00
Matthias Krüger
a78e4610d0
Rollup merge of #121210 - madsmtm:fix-target-abi-i386-apple-ios, r=workingjubilee
Fix `cfg(target_abi = "sim")` on `i386-apple-ios`

Since https://github.com/rust-lang/rust/issues/80970 is stabilizing, I went and had a look, and found that the result was wrong on `i386-apple-ios`.

r? rust-lang/macos
2024-02-17 18:47:42 +01:00
Mads Marquart
d80198595c Fix comment 2024-02-17 01:17:43 +01:00
Mads Marquart
dae22a598b Fix cfg(target_abi = "sim") on i386-apple-ios
i386-apple-ios is also a simulator target
2024-02-17 01:15:08 +01:00
Adam Gemmell
cc7b4e02be Update aarch64 target feature docs to match LLVM 2024-02-15 14:36:29 +00:00
Nadrieril
9dd6eda778 Prefer min_exhaustive_patterns in compiler 2024-02-13 16:45:53 +01:00
Chris Denton
83a850f2a1
Add lahfsahf and prfchw target feature 2024-02-12 10:31:12 -03:00
Zalathar
a2479a4ae7 Remove unnecessary min_specialization after bootstrap
These crates all needed specialization for `newtype_index!`, which will no
longer be necessary when the current nightly eventually becomes the next
bootstrap compiler.
2024-02-10 18:15:11 +11:00
Matthias Krüger
46a0448405
Rollup merge of #120693 - nnethercote:invert-diagnostic-lints, r=davidtwco
Invert diagnostic lints.

That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has been converted to use translated diagnostics.

This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted.

r? ````@davidtwco````
2024-02-09 14:41:50 +01:00
Guillaume Boisseau
7954c28cf9
Rollup merge of #119162 - heiher:direct-access-external-data, r=petrochenkov
Add unstable `-Z direct-access-external-data` cmdline flag for `rustc`

The new flag has been described in the Major Change Proposal at https://github.com/rust-lang/compiler-team/issues/707

Fixes #118053
2024-02-07 18:24:41 +01:00
Guillaume Boisseau
6931780f40
Rollup merge of #110482 - chrisnc:armv8r-target, r=wesleywiser
Add armv8r-none-eabihf target for the Cortex-R52.
2024-02-07 18:24:41 +01:00
Nicholas Nethercote
0ac1195ee0 Invert diagnostic lints.
That is, change `diagnostic_outside_of_impl` and
`untranslatable_diagnostic` from `allow` to `deny`, because more than
half of the compiler has be converted to use translated diagnostics.

This commit removes more `deny` attributes than it adds `allow`
attributes, which proves that this change is warranted.
2024-02-06 13:12:33 +11:00
Matthias Krüger
dc0b1f961a
Rollup merge of #120661 - xen0n:loong-medium-cmodel, r=heiher,Nilstrieb
target: default to the medium code model on LoongArch targets

The Rust LoongArch targets have been using the default LLVM code model so far, which is "small" in LLVM-speak and "normal" in LoongArch-speak. As [described][1] in the "Code Model" section of LoongArch ELF psABI spec v20231219, one can only make function calls as far as ±128MiB with the "normal" code model; this is insufficient for very large software containing Rust components that needs to be linked into the big text section, such as Chromium.

Because:

* we do not want to ask users to recompile std if they are to build such software,
* objects compiled with larger code models can be linked with those with smaller code models without problems, and
* the "medium" code model is comparable to the "small"/"normal" one performance-wise (same data access pattern; each function call becomes 2-insn long and indirect, but this may be relaxed back into the direct 1-insn form in a future LLVM version), but is able to perform function calls within ±128GiB,

it is better to just switch the targets to the "medium" code model, which is also "medium" in LLVM-speak.

[1]: https://github.com/loongson/la-abi-specs/blob/v2.30/laelf.adoc#code-models
2024-02-05 11:07:28 +01:00
Matthias Krüger
540936ca99
Rollup merge of #120518 - kxxt:riscv-split-debug-info, r=compiler-errors
riscv only supports split_debuginfo=off for now

Disable packed/unpacked options for riscv linux/android. Other riscv targets already only have the off option.

The packed/unpacked options might be supported in the future. See upstream issue for more details:
https://github.com/llvm/llvm-project/issues/56642

Fixes #110224
2024-02-05 11:07:27 +01:00
WANG Xuerui
35dad14dfb
target: default to the medium code model on LoongArch targets
The Rust LoongArch targets have been using the default LLVM code model
so far, which is "small" in LLVM-speak and "normal" in LoongArch-speak.
As described in the "Code Model" section of LoongArch ELF psABI spec
v20231219 [1], one can only make function calls as far as ±128MiB with
the "normal" code model; this is insufficient for very large software
containing Rust components that needs to be linked into the big text
section, such as Chromium.

Because:

* we do not want to ask users to recompile std if they are to build
  such software,
* objects compiled with larger code models can be linked with those
  with smaller code models without problems, and
* the "medium" code model is comparable to the "small"/"normal" one
  performance-wise (same data access pattern; each function call
  becomes 2-insn long and indirect, but this may be relaxed back into
  the direct 1-insn form in a future LLVM version), but is able to
  perform function calls within ±128GiB,

it is better to just switch the targets to the "medium" code model,
which is also "medium" in LLVM-speak.

[1]: https://github.com/loongson/la-abi-specs/blob/v2.30/laelf.adoc#code-models
2024-02-05 13:38:50 +08:00
Chris Copeland
d6221957e0
Add an armv8r-none-eabihf target to support the Cortex-R52. 2024-02-04 16:27:54 -08:00
Matthias Krüger
17670ca5df
Rollup merge of #119543 - usamoi:avx512fp16, r=oli-obk
add avx512fp16 to x86 target features

std_detect avx512fp16: https://github.com/rust-lang/stdarch/pull/1508
2024-02-03 21:29:40 +01:00
Nadrieril
573e7f181d
Rollup merge of #120495 - clubby789:remove-amdgpu-kernel, r=oli-obk
Remove the `abi_amdgpu_kernel` feature

The tracking issue (#51575) has been closed for 3 years, with no activity for 5.
2024-01-31 12:10:53 +01:00
kxxt
471af8c5a3 riscv only supports split_debuginfo=off for now
Disable packed/unpacked options for riscv linux/android.
Other riscv targets already only have the off option.

The packed/unpacked options might be supported in the future.
See upstream issue for more details:
https://github.com/llvm/llvm-project/issues/56642

Fixes #110224
2024-01-31 09:04:06 +08:00
clubby789
f6b21e90d1 Remove the abi_amdgpu_kernel feature 2024-01-30 15:46:40 +00:00
León Orell Valerian Liehr
9199742339
Revert "Add the wasm32-wasi-preview2 target"
This reverts commit 31ecf34125.

Co-authored-by: Ryan Levick <me@ryanlevick.com>
2024-01-28 02:02:50 +01:00
Erik Desjardins
3b73e894eb i586_unknown_netbsd: use inline stack probes
This is one of the last two targets still using "call" stack probes.
2024-01-26 23:22:48 -05:00
clubby789
fd29f74ff8 Remove unused features 2024-01-25 14:01:33 +00:00
Matthias Krüger
565961bbf0
Rollup merge of #120278 - djkoloski:remove_fatal_warnings_wasm, r=oli-obk
Remove --fatal-warnings on wasm targets

These were added with good intentions, but a recent change in LLVM 18 emits a warning while examining .rmeta sections in .rlib files. Since this flag is a nice-to-have and users can update their LLVM linker independently of rustc's LLVM version, we can just omit the flag.

See [this comment on wasm targets' uses of `--fatal-warnings`](https://github.com/llvm/llvm-project/pull/78658#issuecomment-1906651390).
2024-01-25 08:39:43 +01:00
León Orell Valerian Liehr
e0a4f43903
Rollup merge of #119616 - rylev:wasm32-wasi-preview2, r=petrochenkov,m-ou-se
Add a new `wasm32-wasi-preview2` target

This is the initial implementation of the MCP https://github.com/rust-lang/compiler-team/issues/694 creating a new tier 3 target `wasm32-wasi-preview2`. That MCP has been seconded and will most likely be approved in a little over a week from now. For more information on the need for this target, please read the [MCP](https://github.com/rust-lang/compiler-team/issues/694).

There is one aspect of this PR that will become insta-stable once these changes reach a stable compiler:
* A new `target_family` named `wasi` is introduced. This target family incorporates all wasi targets including `wasm32-wasi` and its derivative `wasm32-wasi-preview1-threads`. The difference between `target_family = wasi` and `target_os = wasi` will become much clearer when `wasm32-wasi` is renamed to `wasm32-wasi-preview1` and the `target_os` becomes `wasm32-wasi-preview1`. You can read about this target rename in [this MCP](https://github.com/rust-lang/compiler-team/issues/695) which has also been seconded and will hopefully be officially approved soon.

Additional technical details include:
* Both `std::sys::wasi_preview2` and `std::os::wasi_preview2` have been created and mostly use `#[path]` annotations on their submodules to reach into the existing `wasi` (soon to be `wasi_preview1`) modules. Over time the differences between `wasi_preview1` and `wasi_preview2` will grow and most like all `#[path]` based module aliases will fall away.
* Building `wasi-preview2` relies on a [`wasi-sdk`](https://github.com/WebAssembly/wasi-sdk) in the same way that `wasi-preview1` does (one must include a `wasi-root` path in the `Config.toml` pointing to sysroot included in the wasi-sdk). The target should build against [wasi-sdk v21](https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-21) without modifications. However, the wasi-sdk itself is growing [preview2 support](https://github.com/WebAssembly/wasi-sdk/pull/370) so this might shift rapidly. We will be following along quickly to make sure that building the target remains possible as the wasi-sdk changes.
* This requires a [patch to libc](https://github.com/rylev/rust-libc/tree/wasm32-wasi-preview2) that we'll need to land in conjunction with this change. Until that patch lands the target won't actually build.
2024-01-24 15:43:12 +01:00
León Orell Valerian Liehr
1e5ec4d82a
Rollup merge of #120188 - devnexen:update_bsd_compiler_base_specs, r=wesleywiser
compiler: update freebsd and netbsd base specs.

both support thread local.
2024-01-23 21:19:53 +01:00
David Koloski
849d884141 Remove --fatal-warnings on wasm targets
These were added with good intentions, but a recent change in LLVM 18
emits a warning while examining .rmeta sections in .rlib files. Since
this flag is a nice-to-have and users can update their LLVM linker
independently of rustc's LLVM version, we can just omit the flag.
2024-01-23 19:10:17 +00:00
Ryan Levick
31ecf34125 Add the wasm32-wasi-preview2 target
Signed-off-by: Ryan Levick <me@ryanlevick.com>
2024-01-23 13:26:16 +01:00
Erik Kaneda
966b94e0a2
rustc: implement support for riscv32im_risc0_zkvm_elf
This also adds changes in the rust test suite in order to get a few of them to
pass.

Co-authored-by: Frank Laub <flaub@risc0.com>
Co-authored-by: Urgau <3616612+Urgau@users.noreply.github.com>
2024-01-22 10:07:36 -08:00
David Carlier
dec4740b7c compiler: update freebsd and netbsd base specs.
both support thread local.
2024-01-22 17:09:44 +00:00
Nikita Popov
ec55a05374 Update more data layouts 2024-01-19 11:09:30 +01:00
Matthew Maurer
dbff90c2a7 LLVM 18 x86 data layout update
With https://reviews.llvm.org/D86310 LLVM now has i128 aligned to
16-bytes on x86 based platforms. This will be in LLVM-18. This patch
updates all our spec targets to be 16-byte aligned, and removes the
alignment when speaking to older LLVM.

This results in Rust overaligning things relative to LLVM on older LLVMs.

This alignment change was discussed in rust-lang/compiler-team#683

See #54341 for additional information about why this is happening and
where this will be useful in the future.

This *does not* stabilize `i128`/`u128` for FFI.
2024-01-19 10:52:01 +01:00
Matthias Krüger
c9779afc9c
Rollup merge of #119855 - rellerreller:freebsd-static, r=wesleywiser
Enable Static Builds for FreeBSD

Enable crt-static for FreeBSD to enable statically compiled binaries.
2024-01-17 20:21:19 +01:00
David Wood
12c19a2bb7
target: fix powerpc64-unknown-linux-musl datalayout
In LLVM 17, PowerPC targets started including function pointer alignments
in data layouts, and in Rust's update to that version (#114048), we added
the function pointer alignments. `powerpc64-unknown-linux-musl` had
`Fi64` set but this seems incorrect, and the code in LLVM would always
have computed `Fn32` because it is a MUSL target.

Signed-off-by: David Wood <david@davidtw.co>
2024-01-17 10:38:50 +00:00
David Wood
a87034c297
tests: add sanity-check assembly test for every target
Adds a basic assembly test checking that each target can produce assembly
and update the target tier policy to require this.

Signed-off-by: David Wood <david@davidtw.co>
2024-01-17 09:44:11 +00:00
WANG Rui
06a41687b1 Add unstable -Z direct-access-external-data cmdline flag for rustc
The new flag has been described in the Major Change Proposal at
https://github.com/rust-lang/compiler-team/issues/707
2024-01-16 19:15:06 +08:00