Commit Graph

605 Commits

Author SHA1 Message Date
Quinn Painter
e7b62be96b Add {thumb,arm}v5te-none-eabi targets 2022-09-02 14:16:02 +01:00
bors
b32223fec1 Auto merge of #100707 - dzvon:fix-typo, r=davidtwco
Fix a bunch of typo

This PR will fix some typos detected by [typos].

I only picked the ones I was sure were spelling errors to fix, mostly in
the comments.

[typos]: https://github.com/crate-ci/typos
2022-09-01 05:39:58 +00:00
bors
aa857eb953 Auto merge of #100537 - petrochenkov:piccheck, r=oli-obk
rustc_target: Add some more target spec sanity checking
2022-09-01 03:13:46 +00:00
Dezhi Wu
b1430fb7ca Fix a bunch of typo
This PR will fix some typos detected by [typos].

I only picked the ones I was sure were spelling errors to fix, mostly in
the comments.

[typos]: https://github.com/crate-ci/typos
2022-08-31 18:24:55 +08:00
Matthias Krüger
0fee731a95
Rollup merge of #101025 - semarie:openbsd-archs, r=petrochenkov
Add tier-3 support for powerpc64 and riscv64 openbsd

# powerpc64
- MCP for [powerpc64-unknown-openbsd tier-3 support](https://github.com/rust-lang/compiler-team/issues/551)
- only need to add spec definition in rustc_target

# riscv64
- MCP for [riscv64-unknown-openbsd tier-3 support](https://github.com/rust-lang/compiler-team/issues/552)
- add spec definition in rustc_target
- follow freebsd about avoiding linking with `libatomic`
2022-08-31 07:57:58 +02:00
Yuki Okushi
9642e4840b
Rollup merge of #101088 - nicholasbishop:bishop-uefi-pdb, r=davidtwco
Set DebuginfoKind::Pdb in msvc_base

This PDB setting was added to `windows_msvc_base` in
https://github.com/rust-lang/rust/pull/98051. It's also needed for the
UEFI targets, and since `uefi_msvc_base` and `windows_msvc_base` are the
only things that inherit from `msvc_base`, just move the PDB setting up
to `mscv_base` to cover both.

Fixes https://github.com/rust-lang/rust/issues/101071
2022-08-31 08:47:18 +09:00
Sébastien Marie
1de5b22678 add riscv64gc-unknown-openbsd support (target riscv64-unknown-openbsd on OpenBSD)
- add platform-support documentation
- add riscv64gc-unknown-openbsd spec
- do not try to link with -latomic on openbsd
2022-08-28 05:22:21 +00:00
Sébastien Marie
dacb6ee7b0 add powerpc64-unknown-openbsd support 2022-08-28 05:16:02 +00:00
Nicholas Bishop
1dd47b04c0 Set DebuginfoKind::Pdb in msvc_base
This PDB setting was added to `windows_msvc_base` in
https://github.com/rust-lang/rust/pull/98051. It's also needed for the
UEFI targets, and since `uefi_msvc_base` and `windows_msvc_base` are the
only things that inherit from `msvc_base`, just move the PDB setting up
to `mscv_base` to cover both.

Fixes https://github.com/rust-lang/rust/issues/101071
2022-08-27 11:44:35 -04:00
bors
332cc8fb75 Auto merge of #100999 - nnethercote:shrink-FnAbi, r=bjorn3
Shrink `FnAbi`

Because they can take up a lot of memory in debug and release builds.

r? `@bjorn3`
2022-08-27 14:00:53 +00:00
Vadim Petrochenkov
f4b5954764 rustc_target: Use Cow and link args helpers in apple_base 2022-08-27 15:30:05 +03:00
Vadim Petrochenkov
f0d0573db1 rustc_target: Do not specify some target options redundantly
These values are already inherited
2022-08-27 15:30:05 +03:00
Vadim Petrochenkov
2e83c22154 rustc_target: Add some more target spec sanity checking 2022-08-27 15:30:05 +03:00
bors
450e99f937 Auto merge of #98051 - davidtwco:split-dwarf-stabilization, r=wesleywiser
session: stabilize split debuginfo on linux

Stabilize the `-Csplit-debuginfo` flag...

- ...on Linux for all values of the flag. Split DWARF has been implemented for a few months, hasn't had any bug reports and has had some promising benchmarking for incremental debug build performance.
- ..on other platforms for the default value. It doesn't make any sense that `-Csplit-debuginfo=packed` is unstable on Windows MSVC when that's the default behaviour, but keep the other values unstable.
2022-08-26 15:47:26 +00:00
Sébastien Marie
908ac84662 openbsd: rustc_target: reorder spec by name 2022-08-26 06:15:54 +00:00
Nicholas Nethercote
f974617bda Move ArgAbi::pad_i32 into PassMode::Cast.
Because it's only needed for that variant. This shrinks the types and
clarifies the logic.
2022-08-26 11:12:36 +10:00
Nicholas Nethercote
b853e8a619 Turn ArgAbi::pad into a bool.
Because it's only ever set to `None` or `Some(Reg::i32())`.
2022-08-26 10:53:41 +10:00
Nicholas Nethercote
b75b3b3afe Change FnAbi::args to a boxed slice. 2022-08-26 10:30:36 +10:00
Nicholas Nethercote
4df7bffa95 Change FnAbi::fixed_count to a u32. 2022-08-26 10:29:40 +10:00
Nicholas Nethercote
e4bf113027 Box CastTarget within PassMode.
Because `PassMode::Cast` is by far the largest variant, but is
relatively rare.

This requires making `PassMode` not impl `Copy`, and `Clone` is no
longer necessary. This causes lots of sigil adjusting, but nothing very
notable.
2022-08-26 09:35:28 +10:00
Nicholas Nethercote
263c426bfd Add size assertions for FnAbi and ArgAbi. 2022-08-26 09:30:30 +10:00
Matthias Krüger
44aa866488
Rollup merge of #100641 - corwinkuiper:add-armv4t-target, r=oli-obk
Add the armv4t-none-eabi target to the supported_targets

This target was added in #100244 but forgot to add it to the macro in the `mod.rs` file.

``@Lokathor``
2022-08-23 06:55:25 +02:00
Matthias Krüger
e81b994868
Rollup merge of #100636 - cutsoy:revert-77716, r=davidtwco
Revert "Revert "Allow dynamic linking for iOS/tvOS targets.""

This reverts commit 16e10bf81e (PR #77716).

The original original PR enabled `cdylib` builds for iOS. However this caused problems because:

> This new feature in Rust 1.46 added a lot of headache for iOS builds with cdylib targets. cdylib target is near impossible to build if you are using any crate with native dependencies (ex. openssl, libsodium, zmq). You can't just find .so files for all architectures to perform correct linking. Usual workflow is the following:
>
> 1. You build staticlib and rely that native dependencies will be linked as frameworks later
> 2. You setup right cocoapods in ObjectiveC/Swift wrapper.
>
> As cargo doesn't support platform-dependent crate types https://github.com/rust-lang/rust/pull/4881 as a result a lot of projects now broken on Rust 1.46

However, this will be soon a thing of the past since 1.64 brings us the long awaited much anticipated `--crate-type` flag.

> I see that this got merged recently: https://github.com/rust-lang/cargo/issues/10083. The --crate-type flag will get stabilized in 1.64. In 1.64, you could still get a successful iOS staticlib with cargo build --crate-type=statclib even if the crate has cdylib targets too. If I'm not mistaken, this solves the problem too so this PR could be reverted in 1.64 with relatively little headache.

So summing up, I think this PR can be reverted in 1.64. 🤞
2022-08-20 19:45:13 +02:00
5225225
09ea9f0a87 Add diagnostic translation lints to crates that don't emit them 2022-08-18 19:29:02 +01:00
David Wood
cf2c492ef8 session: stabilize split debuginfo on linux
Stabilize the `-Csplit-debuginfo` flag...

- ...on Linux for all values of the flag. Split DWARF has been
  implemented for a few months, hasn't had any bug reports and has had
  some promising benchmarking for incremental debug build performance.
- ..on other platforms for the default value. It doesn't make any sense
  that `-Csplit-debuginfo=packed` is unstable on Windows MSVC when
  that's the default behaviour, but keep the other values unstable.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-08-18 15:19:40 +01:00
Matthias Krüger
64cd65758c
Rollup merge of #100621 - taiki-e:armv4t-atomics-32, r=cuviper
Pass +atomics-32 feature for {arm,thumb}v4t-none-eabi

Similar to 89582e8193, but for ARMv4t.
Pre-v6 ARM target does not have atomic CAS, except for Linux and Android where atomic CAS is provided by compiler-builtins. So, there is a similar issue as thumbv6m.

I have confirmed that enabling the `atomics-32` target feature fixes the problem in the project affected by this issue. (https://github.com/taiki-e/portable-atomic/pull/28#discussion_r946604136)

Closes #100619

r? ``@nikic``
cc ``@Lokathor``
2022-08-17 12:32:55 +02:00
Corwin
ed27a4c516 add the armv4t-none-eabi target 2022-08-16 20:10:31 +01:00
Tim van Elsloo
9233298e71
Revert "Revert "Allow dynamic linking for iOS/tvOS targets.""
This reverts commit 16e10bf81e.

# Conflicts:
#	compiler/rustc_target/src/spec/apple_sdk_base.rs
2022-08-16 17:36:25 +02:00
Taiki Endo
5bb04f30cb Support 128-bit atomics on all aarch64 targets 2022-08-16 19:52:19 +09:00
Taiki Endo
8439080f27 Pass +atomics-32 feature for {arm,thumb}v4t-none-eabi 2022-08-16 19:24:12 +09:00
Vadim Petrochenkov
8fa707ab41 rustc_target: Update some old naming around self contained linking
The "fallback" naming pre-dates introduction of `-Clink-self-contained`
2022-08-12 18:47:13 +03:00
bors
e2b52ff73e Auto merge of #99464 - nikic:llvm-15, r=cuviper
Update to LLVM 15

For preliminary testing. Some LLVM 15 compatibility fixes were applied separately in #99512.

Release timeline:
 * LLVM 15 branched on Jul 26.
 * The final LLVM 15.0.0 release is scheduled for Sep 6.
 * Current nightly (1.65.0) is scheduled for Nov 3.

Changes in this PR (apart from the LLVM update):
 * Pass `--set llvm.allow-old-toolchain` for many Docker images. LLVM 16 will require GCC >= 7.1, while LLVM 15 still allows older compilers with an option. Specify the option for builders still using GCC 5.4. #95026 updated some of the used toolchains, but not all.
 * Use the `+atomics-32` target feature for thumbv6m.
 * Explicitly link libatomic when cross-compiling LLVM to 32-bit target.
 * Explicitly disable zstd support, to avoid libzstd.so dependency.

New LLVM patches ([commits](https://github.com/rust-lang/llvm-project/commits/rustc/15.0-2022-08-09)):
 * [rust-only] Fix ICE with GCC 5.4 (15be58d7f0)
 * [rust-only] Fix build with GCC 5.4 (774edc10fa)
 * ~~[rust-only] Fix build with GCC 5.2 (1a6069a7bb)~~
 * ~~[rust-only] Fix ICE with GCC 5.2 (493081f290)~~
 * ~~[rust-only] Fix build with GCC 5.2 (0fc5979d73)~~
 * [backported] Addition of `+atomics` target feature (57bdd9892d).
 * [backported] Revert compiler-rt change that broke powerpc (9c68b43915)
 * [awaiting backport] Fix RelLookupTableConverter on gnux32 (639388a05f / https://github.com/llvm/llvm-project/issues/57021)

Tested images: dist-x86_64-linux, armhf-gnu, arm-android, dist-s390x-linux, dist-x86_64-illumos, dist-x86_64-freebsd, wasm32, dist-x86_64-musl, dist-various-1, dist-riscv64-linux, dist-mips-linux, dist-mipsel-linux, dist-powerpc-linux, dist-aarch64-linux, dist-x86_64-apple, x86_64-msvc-1, x86_64-msvc-2, dist-various-2, dist-arm-linux
Tested up to the usual ipv6 error: test-various, i686-gnu, x86_64-gnu-nopt

r? `@ghost`
2022-08-12 02:58:51 +00:00
Matthias Krüger
92b32e307c
Rollup merge of #99500 - tmandry:fuchsia-flags, r=petrochenkov
Fix flags when using clang as linker for Fuchsia

Don't add C runtime or set dynamic linker when linking with clang for
Fuchsia. Clang already does this for us.
2022-08-11 22:52:59 +02:00
Matthias Krüger
6737549aaf
Rollup merge of #99421 - Bryanskiy:android-crt-static, r=petrochenkov
add crt-static for android
2022-08-11 22:52:58 +02:00
Tyler Mandry
55d5dcb1aa Fix flags when using clang as linker for Fuchsia
Don't add C runtime or set dynamic linker when linking with clang for
Fuchsia. Clang already does this for us.
2022-08-10 16:35:27 -07:00
Bryanskiy
874ee5bede add crt-static for android 2022-08-10 19:42:24 +03:00
Michael Goulet
eae824d5bb
Rollup merge of #100317 - kjetilkjeka:remove-nvptx32-logic, r=eddyb
Remove logic related to deprecated nvptx-nvidia-cuda (32-bit) target

As described in the MCP https://github.com/rust-lang/compiler-team/issues/496#issuecomment-1196328748

r? ``@eddyb``
2022-08-10 09:28:19 -07:00
Kjetil Kjeka
22930b7b25 Remove logic related to deprecated nvptx-nvidia-cuda (32-bit) target 2022-08-09 13:29:18 +02:00
Nikita Popov
89582e8193 Pass +atomics-32 feature for thumbv6m target
https://reviews.llvm.org/D120026 changed atomics on thumbv6m to
use libatomic, to ensure that atomic load/store are compatible with
atomic RMW/CAS. However, Rust wants to expose only load/store
without libcalls.

https://reviews.llvm.org/D130480 added support for this behind
the +atomics-32 target feature, so enable that feature.
2022-08-09 12:39:59 +02:00
Mary
a725250806 Add support for link-flavor rust-lld for macOS
Also refactor iOS, watchOS and tvOS common code.
2022-08-09 11:04:48 +02:00
Lokathor
a8b4454047
Create armv4t_none_eabi.rs 2022-08-07 12:40:41 -06:00
Matthias Krüger
7b0360e516
Rollup merge of #98771 - Thog:rust-lld-apple-target, r=petrochenkov
Add support for link-flavor rust-lld for iOS, tvOS and watchOS

This adds support for rust-lld for Apple *OS targets.

This was tested against targets ``aarch64-apple-ios`` and ``aarch64-apple-ios-sim`` with [a simple test program](https://github.com/Thog/rust-lld-apple-target_test).

It currently doesn't work with targets ``armv7-apple-ios`` and ``armv7s-apple-ios`` because of ``symbols.o`` not being generated with the correct CPU subtype. This will require changes in the ``object`` crate to expose an API.

As ``ld64.lld`` requires ``-platform_version`` with the minimal version supported and an sdk version, I made ``rustc_target::apple_base`` public to get access to ``*os_deployment_target``  helper functions and also added ``tvos_deployment_target`` as it was missing.
2022-08-03 22:29:25 +02:00
mary
78bbe57c88 Add support for link-flavor rust-lld for iOS, tvOS and watchOS
This adds support for rust-lld for Apple *OS targets.

This was tested against targets "aarch64-apple-ios" and "aarch64-apple-ios-sim".

For targets "armv7-apple-ios" and "armv7s-apple-ios", it doesn't link because of
"symbols.o" not being generated with the correct CPU subtype (changes in
the "object" crate needs to be done to support it).
2022-08-03 15:41:05 +00:00
bors
e4417cf020 Auto merge of #92268 - jswrenn:transmute, r=oli-obk
Initial implementation of transmutability trait.

*T'was the night before Christmas and all through the codebase, not a miri was stirring — no hint of `unsafe`!*

This PR provides an initial, **incomplete** implementation of *[MCP 411: Lang Item for Transmutability](https://github.com/rust-lang/compiler-team/issues/411)*. The `core::mem::BikeshedIntrinsicFrom` trait provided by this PR is implemented on-the-fly by the compiler for types `Src` and `Dst` when the bits of all possible values of type `Src` are safely reinterpretable as a value of type `Dst`.

What this PR provides is:
- [x] [support for transmutations involving primitives](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/primitives)
- [x] [support for transmutations involving arrays](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/arrays)
- [x] [support for transmutations involving structs](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/structs)
- [x] [support for transmutations involving enums](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/enums)
- [x] [support for transmutations involving unions](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/unions)
- [x] [support for weaker validity checks](https://github.com/jswrenn/rust/blob/transmute/src/test/ui/transmutability/unions/should_permit_intersecting_if_validity_is_assumed.rs) (i.e., `Assume::VALIDITY`)
- [x] visibility checking

What isn't yet implemented:
- [ ] transmutability options passed using the `Assume` struct
- [ ] [support for references](https://github.com/jswrenn/rust/blob/transmute/src/test/ui/transmutability/references.rs)
- [ ] smarter error messages

These features will be implemented in future PRs.
2022-08-02 21:17:31 +00:00
bors
fe3342816a Auto merge of #99476 - dpaoliello:rawdylibvectorcall, r=michaelwoerister
Add tests for raw-dylib with vectorcall, and fix vectorcall code generation

* Adds tests for using `raw-dylib` (#58713) with `vectorcall`.
* Fixed code generation for `vectorcall` (parameters have to be marked with `InReg`, just like `fastcall`).
* Enabled running the `raw-dylib` `fastcall` tests when using MSVC (since I had to add support in the test for running MSVC-only tests since GCC doesn't support `vectorcall`).
2022-08-01 18:43:57 +00:00
Ralf Jung
abd80d904b reorder fields in Laout debug output 2022-07-31 08:23:27 -04:00
Yuki Okushi
36ab4ec2dc
Rollup merge of #99227 - Lokathor:fix-thumbv4t-none-eabi-frame-pointer, r=davidtwco
Fix thumbv4t-none-eabi frame pointer setting

The `thumb_base` profile has changed since I last remember seeing it, and now it sets the frame pointer to "always keep", which is not desired for this target. Hooking a debugger to the running program is not really done, it's preferable to have the register available for actual program use, so the default "may omit" is now set.

I thought that the target was already using "may omit" when I checked on it last month, because I forgot that the target was previously based on `thumb_base` rather than `Default::default()`. I only noticed the issue just now when creating the `armv4t-none-eabi` target (https://github.com/rust-lang/rust/pull/99226), though this PR is not in any way conditional on that one.
2022-07-30 07:39:48 +09:00
Lokathor
2eac6f30c8
once again tidy was unhappy 2022-07-28 10:58:42 -06:00
Lokathor
9cf5b2d81c
Update thumbv4t_none_eabi.rs 2022-07-28 10:43:05 -06:00
Jack Wrenn
bc4a1dea41 Initial (incomplete) implementation of transmutability trait.
This initial implementation handles transmutations between types with specified layouts, except when references are involved.

Co-authored-by: Igor null <m1el.2027@gmail.com>
2022-07-27 17:33:56 +00:00