about summary refs log tree commit diff
path: root/compiler/rustc_target
AgeCommit message (Collapse)AuthorLines
2022-08-09Add support for link-flavor rust-lld for macOSMary-55/+59
Also refactor iOS, watchOS and tvOS common code.
2022-08-07Create armv4t_none_eabi.rsLokathor-0/+54
2022-08-03Rollup merge of #98771 - Thog:rust-lld-apple-target, r=petrochenkovMatthias Krüger-8/+91
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-03Add support for link-flavor rust-lld for iOS, tvOS and watchOSmary-8/+91
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-02Auto merge of #92268 - jswrenn:transmute, r=oli-obkbors-1/+2
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-01Auto merge of #99476 - dpaoliello:rawdylibvectorcall, r=michaelwoeristerbors-5/+7
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-07-31reorder fields in Laout debug outputRalf Jung-6/+7
2022-07-30Rollup merge of #99227 - Lokathor:fix-thumbv4t-none-eabi-frame-pointer, ↵Yuki Okushi-3/+21
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-28once again tidy was unhappyLokathor-1/+3
2022-07-28Update thumbv4t_none_eabi.rsLokathor-2/+3
2022-07-27Initial (incomplete) implementation of transmutability trait.Jack Wrenn-1/+2
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-26Fix vectorcallDaniel Paoliello-5/+7
2022-07-24Revert "Mark atomics as unsupported on thumbv6m"Amanieu d'Antras-2/+1
This reverts commit 75146102197c7f35e6c38cb402b2bc1065858c54.
2022-07-23Auto merge of #99652 - GuillaumeGomez:rollup-38v0x7y, r=GuillaumeGomezbors-1/+2
Rollup of 6 pull requests Successful merges: - #99298 (Make `ui-fulldeps/gated-plugins` and `ui-fulldeps/multiple-plugins` tests stage 2 only) - #99396 (Add some additional double-adjustment regression tests) - #99449 (Do not resolve associated const when there is no provided value) - #99595 (Mark atomics as unsupported on thumbv6m) - #99627 (Lock stdout once when listing tests) - #99638 (Remove Clean trait implementation for hir::Ty and middle::Ty) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-07-23Rollup merge of #99595 - nikic:thumbv6m-atomics, r=nagisaGuillaume Gomez-1/+2
Mark atomics as unsupported on thumbv6m The thumbv6m target does not support atomics. Historically, LLVM had a bug where atomic load/stores for this target were emitted as plain load/stores rather than as libatomic calls. This was fixed in https://reviews.llvm.org/D120026, which will be part of LLVM 15. As we require that "atomic support" does not use libatomic, we need to indicate that this target does not have native atomics.
2022-07-23Auto merge of #98208 - ivanloz:master, r=nagisabors-0/+5
Add support for LLVM ShadowCallStack. LLVMs ShadowCallStack provides backward edge control flow integrity protection by using a separate shadow stack to store and retrieve a function's return address. LLVM currently only supports this for AArch64 targets. The x18 register is used to hold the pointer to the shadow stack, and therefore this only works on ABIs which reserve x18. Further details are available in the [LLVM ShadowCallStack](https://clang.llvm.org/docs/ShadowCallStack.html) docs. # Usage `-Zsanitizer=shadow-call-stack` # Comments/Caveats * Currently only enabled for the aarch64-linux-android target * Requires the platform to define a runtime to initialize the shadow stack, see the [LLVM docs](https://clang.llvm.org/docs/ShadowCallStack.html) for more detail.
2022-07-22do not mark interior mutable shared refs as dereferenceableRalf Jung-3/+7
2022-07-22rename PointerKind::Shared → SharedMutable to indicate this is NOT the ↵Ralf Jung-1/+1
usual shared reference
2022-07-22Mark atomics as unsupported on thumbv6mNikita Popov-1/+2
The thumbv6m target does not support atomics. Historically, LLVM had a bug where atomic load/stores for this target were emitted as plain load/stores rather than as libatomic calls. This was fixed in https://reviews.llvm.org/D120026, which will be part of LLVM 15. As we require that "atomic support" does not use libatomic, we need to indicate that this target does not have native atomics.
2022-07-20Add ShadowCallStack SupportIvan Lozano-0/+5
Adds support for the LLVM ShadowCallStack sanitizer.
2022-07-20Remove unused StableMap and StableSet types from rustc_data_structuresMichael Woerister-4/+4
2022-07-17Auto merge of #99033 - 5225225:interpreter-validity-checks, r=oli-obkbors-23/+15
Use constant eval to do strict mem::uninit/zeroed validity checks I'm not sure about the code organisation here, I just dumped the check in rustc_const_eval at the root. Not hard to move it elsewhere, in any case. Also, this means cranelift codegen intrinsics lose the strict checks, since they don't seem to depend on rustc_const_eval, and I didn't see a point in keeping around two copies. I also left comments in the is_zero_valid methods about "uhhh help how do i do this", those apply to both methods equally. Also rustc_codegen_ssa now depends on rustc_const_eval... is this okay? Pinging `@RalfJung` since you were the one who mentioned this to me, so I'm assuming you're interested. Haven't had a chance to run full tests on this since it's really warm, and it's 1AM, I'll check out any failures/comments in the morning :)
2022-07-14Use constant eval to do strict validity checks5225225-23/+15
2022-07-14Rename aarch64-nintendo-switch to aarch64-nintendo-switch-freestandingleo60228-2/+2
2022-07-14Remove obsolete crt0 references in linker scriptleo60228-6/+1
2022-07-14Remove unneeded options from Nintendo Switch targetjam1garner-23/+13
2022-07-14Add linker script for switchleo60228-0/+86
2022-07-14Remove unnecessary linker argsleo60228-8/+2
2022-07-14Add Nintendo Switch tier 3 targetjam1garner-0/+41
2022-07-14tidy demands this whitespace go awayLokathor-1/+1
2022-07-13conform to the tidy expectationsLokathor-1/+1
2022-07-13add missing imports.Lokathor-1/+1
2022-07-13Update thumbv4t_none_eabi.rsLokathor-1/+8
2022-07-13word-wrap the comments.Lokathor-2/+10
2022-07-11rustc_target: Flip the default for `TargetOptions::executables` to trueVadim Petrochenkov-52/+3
Also change `executables` to true for linux-kernel and windows-uwp-gnu targets
2022-07-09Rollup merge of #99043 - compiler-errors:derive-nit, r=cjgillotDylan DPC-48/+8
Collapse some weirdly-wrapping derives self-explanatory
2022-07-08Implement support for DWARF version 5.Patrick Walton-13/+13
DWARF version 5 brings a number of improvements over version 4. Quoting from the announcement [1]: > Version 5 incorporates improvements in many areas: better data compression, > separation of debugging data from executable files, improved description of > macros and source files, faster searching for symbols, improved debugging > optimized code, as well as numerous improvements in functionality and > performance. On platforms where DWARF version 5 is supported (Linux, primarily), this commit adds support for it behind a new `-Z dwarf-version=5` flag. [1]: https://dwarfstd.org/Public_Review.php
2022-07-08Collapse some weirdly-wrapping derivesMichael Goulet-48/+8
2022-07-06fix issue 97463 using change suggested by nbdd0121.Felix S. Klock II-8/+44
parameterized on target details to decide value-extension policy on calls, in order to address how Apple's aarch64 ABI differs from that on Linux and Windows. Updated to incorporate review feedback: adjust comment on new enum specifying param extension policy. Updated to incorporate review feedback: shorten enum names and those of its variants to make it less unwieldy. placate tidy.
2022-06-25rustc_target: Some more tests and fixes for linker argumentsVadim Petrochenkov-44/+132
2022-06-25rustc_target: Add convenience functions for adding linker argumentsVadim Petrochenkov-420/+348
They ensure that lld and non-lld linker flavors get the same set of arguments
2022-06-24Set relocation_model to Pic on emscripten targetHood Chatham-1/+2
2022-06-24Rollup merge of #98214 - petrochenkov:islike, r=compiler-errorsYuki Okushi-15/+6
rustc_target: Remove some redundant target properties `is_like_emscripten` is equivalent to `os == "emscripten"`, so it's removed. `is_like_fuchsia` is equivalent to `os == "fuchsia"`, so it's removed. `is_like_osx` also falls into the same category and is equivalent to `vendor == "apple"`, but it's commonly used so I kept it as is for now. `is_like_(solaris,windows,wasm)` are combinations of different operating systems or architectures (see compiler/rustc_target/src/spec/tests/tests_impl.rs) so they are also kept as is. I think `is_like_wasm` (and maybe `is_like_osx`) are sufficiently closed sets, so we can remove these fields as well and replace them with methods like `fn is_like_wasm() { arch == "wasm32" || arch == "wasm64" }`. On other hand, `is_like_solaris` and `is_like_windows` are sufficiently open and I can imagine custom targets introducing other values for `os`. This is kind of a gray area.
2022-06-22Set no_default_libraries: false in wasm32_emscripten targetHood Chatham-0/+1
2022-06-21Re-enable atomic loads and stores for all RISC-V targetsSimon Sapin-3/+3
This roughly reverts PR https://github.com/rust-lang/rust/pull/66548 Atomic "CAS" are still disabled for targets without the *“A” Standard Extension for Atomic Instructions*. However this extension only adds instructions for operations more complex than simple loads and stores, which are always atomic when aligned. In the [Unprivileged Spec v. 20191213](https://riscv.org/technical/specifications/) section 2.6 *Load and Store Instructions* of chapter 2 *RV32I Base Integer Instruction Set* (emphasis mine): > Even when misaligned loads and stores complete successfully, > these accesses might run extremely slowly depending on the implementation > (e.g., when implemented via an invisible trap). Further-more, whereas > **naturally aligned loads and stores are guaranteed to execute atomically**, > misaligned loads and stores might not, and hence require > additional synchronization to ensure atomicity. Unfortunately PR https://github.com/rust-lang/rust/pull/66548 did not provide much details on the bug that motivated it, but https://github.com/rust-lang/rust/issues/66240 and https://github.com/rust-lang/rust/issues/85736 appear related and happen with targets that do have the A extension.
2022-06-20Rollup merge of #98225 - bjorn3:stable_target_json_hash, r=nagisaYuki Okushi-25/+99
Make debug_triple depend on target json file content rather than file path This ensures that changes to target json files will force a recompilation. And more importantly that moving the files doesn't force a recompilation. This should fix https://github.com/Rust-for-Linux/linux/issues/792 (cc ``@ojeda)``
2022-06-19Preserve the path of the target spec json file for usage by rustdocbjorn3-8/+76
2022-06-18ENH Move --memory-init-file flag from EmLinker to asmjs target specHood Chatham-5/+5
2022-06-18Make debug_triple depend on target json file content rather than file pathbjorn3-22/+28
This ensures that changes to target json files will force a recompilation. And more importantly that moving the files doesn't force a recompilation.
2022-06-18rustc_target: Remove some redundant target propertiesVadim Petrochenkov-15/+6