about summary refs log tree commit diff
path: root/compiler/rustc_target/src/spec
AgeCommit message (Collapse)AuthorLines
2021-03-23Allow not emitting `uwtable` on Androidhyd-dev-1/+11
2021-03-17riscvgc-unknown-none-elf use lp64d ABIJustin Restivo-0/+1
2021-03-10Auto merge of #82982 - Dylan-DPC:rollup-mt497z7, r=Dylan-DPCbors-4/+6
Rollup of 9 pull requests Successful merges: - #81309 (always eagerly eval consts in Relate) - #82217 (Edition-specific preludes) - #82807 (rustdoc: Remove redundant enableSearchInput function) - #82924 (WASI: Switch to crt1-command.o to enable support for new-style commands) - #82949 (Do not attempt to unlock envlock in child process after a fork.) - #82955 (fix: wrong word) - #82962 (Treat header as first paragraph for shortened markdown descriptions) - #82976 (fix error message for copy(_nonoverlapping) overflow) - #82977 (Rename `Option::get_or_default` to `get_or_insert_default`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-03-10Rollup merge of #82924 - sunfishcode:wasi-command, r=alexcrichtonDylan DPC-4/+6
WASI: Switch to crt1-command.o to enable support for new-style commands This switches Rust's WASI target to use crt1-command.o instead of crt1.o, which enables support for new-style commands. By default, new-style commands work the same way as old-style commands, so nothing immediately changes here, but this will be needed by later changes to enable support for typed arguments. See here for more information on new-style commands: - https://github.com/WebAssembly/wasi-libc/pull/203 - https://reviews.llvm.org/D81689 r? ```@alexcrichton```
2021-03-10Auto merge of #76570 - cratelyn:implement-rfc-2945-c-unwind-abi, r=Amanieubors-27/+97
Implement RFC 2945: "C-unwind" ABI ## Implement RFC 2945: "C-unwind" ABI This branch implements [RFC 2945]. The tracking issue for this RFC is #74990. The feature gate for the issue is `#![feature(c_unwind)]`. This RFC was created as part of the ffi-unwind project group tracked at rust-lang/lang-team#19. ### Changes Further details will be provided in commit messages, but a high-level overview of the changes follows: * A boolean `unwind` payload is added to the `C`, `System`, `Stdcall`, and `Thiscall` variants, marking whether unwinding across FFI boundaries is acceptable. The cases where each of these variants' `unwind` member is true correspond with the `C-unwind`, `system-unwind`, `stdcall-unwind`, and `thiscall-unwind` ABI strings introduced in RFC 2945 [3]. * This commit adds a `c_unwind` feature gate for the new ABI strings. Tests for this feature gate are included in `src/test/ui/c-unwind/`, which ensure that this feature gate works correctly for each of the new ABIs. A new language features entry in the unstable book is added as well. * We adjust the `rustc_middle::ty::layout::fn_can_unwind` function, used to compute whether or not a `FnAbi` object represents a function that should be able to unwind when `panic=unwind` is in use. * Changes are also made to `rustc_mir_build::build::should_abort_on_panic` so that the function ABI is used to determind whether it should abort, assuming that the `panic=unwind` strategy is being used, and no explicit unwind attribute was provided. [RFC 2945]: https://github.com/rust-lang/rfcs/blob/master/text/2945-c-unwind-abi.md
2021-03-10Rollup merge of #82733 - Yn0ga:master, r=estebankYuki Okushi-0/+17
Add powerpc-unknown-openbsd target
2021-03-09address pr review commentskatelyn a. martin-2/+13
### Add debug assertion to check `AbiDatas` ordering This makes a small alteration to `Abi::index`, so that we include a debug assertion to check that the index we are returning corresponds with the same abi in our data array. This will help prevent ordering bugs in the future, which can manifest in rather strange errors. ### Using exhaustive ABI matches This slightly modifies the changes from our previous commits, favoring exhaustive matches in place of `_ => ...` fall-through arms. This should help with maintenance in the future, when additional ABI's are added, or when existing ABI's are modified. ### List all `-unwind` ABI's in unstable book This updates the `c-unwind` page in the unstable book to list _all_ of the other ABI strings that are introduced by this feature gate. Now, all of the ABI's specified by RFC 2945 are shown. Co-authored-by: Amanieu d'Antras <amanieu@gmail.com> Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
2021-03-09rustc_target: add "unwind" payloads to `Abi`katelyn a. martin-27/+86
### Overview This commit begins the implementation work for RFC 2945. For more information, see the rendered RFC [1] and tracking issue [2]. A boolean `unwind` payload is added to the `C`, `System`, `Stdcall`, and `Thiscall` variants, marking whether unwinding across FFI boundaries is acceptable. The cases where each of these variants' `unwind` member is true correspond with the `C-unwind`, `system-unwind`, `stdcall-unwind`, and `thiscall-unwind` ABI strings introduced in RFC 2945 [3]. ### Feature Gate and Unstable Book This commit adds a `c_unwind` feature gate for the new ABI strings. Tests for this feature gate are included in `src/test/ui/c-unwind/`, which ensure that this feature gate works correctly for each of the new ABIs. A new language features entry in the unstable book is added as well. ### Further Work To Be Done This commit does not proceed to implement the new unwinding ABIs, and is intentionally scoped specifically to *defining* the ABIs and their feature flag. ### One Note on Test Churn This will lead to some test churn, in re-blessing hash tests, as the deleted comment in `src/librustc_target/spec/abi.rs` mentioned, because we can no longer guarantee the ordering of the `Abi` variants. While this is a downside, this decision was made bearing in mind that RFC 2945 states the following, in the "Other `unwind` Strings" section [3]: > More unwind variants of existing ABI strings may be introduced, > with the same semantics, without an additional RFC. Adding a new variant for each of these cases, rather than specifying a payload for a given ABI, would quickly become untenable, and make working with the `Abi` enum prone to mistakes. This approach encodes the unwinding information *into* a given ABI, to account for the future possibility of other `-unwind` ABI strings. ### Ignore Directives `ignore-*` directives are used in two of our `*-unwind` ABI test cases. Specifically, the `stdcall-unwind` and `thiscall-unwind` test cases ignore architectures that do not support `stdcall` and `thiscall`, respectively. These directives are cribbed from `src/test/ui/c-variadic/variadic-ffi-1.rs` for `stdcall`, and `src/test/ui/extern/extern-thiscall.rs` for `thiscall`. This would otherwise fail on some targets, see: https://github.com/rust-lang-ci/rust/commit/fcf697f90206e9c87b39d494f94ab35d976bfc60 ### Footnotes [1]: https://github.com/rust-lang/rfcs/blob/master/text/2945-c-unwind-abi.md [2]: https://github.com/rust-lang/rust/issues/74990 [3]: https://github.com/rust-lang/rfcs/blob/master/text/2945-c-unwind-abi.md#other-unwind-abi-strings
2021-03-08WASI: Switch to crt1-command.o to enable support for new-style commandsDan Gohman-4/+6
This switches Rust's WASI target to use crt1-command.o instead of crt1.o, which enables support for new-style commands. By default, new-style commands work the same way as old-style commands, so nothing immediately changes here, but this will be needed by later changes to enable support for typed arguments. See here for more information on new-style commands: - https://github.com/WebAssembly/wasi-libc/pull/203 - https://reviews.llvm.org/D81689
2021-03-07Rollup merge of #77916 - QuiltOS:kernel-code-targets-os-none, r=joshtriplettYuki Okushi-5/+9
Change built-in kernel targets to be os = none throughout Whether for Rust's own `target_os`, LLVM's triples, or GNU config's, the OS-related have fields have been for code running *on* that OS, not code hat is *part* of the OS. The difference is huge, as syscall interfaces are nothing like freestanding interfaces. Kernels are (hypervisors and other more exotic situations aside) freestanding programs that use the interfaces provided by the hardware. It's *those* interfaces, the ones external to the program being built and its software dependencies, that are the content of the target. For the Linux Kernel in particular, `target_env: "gnu"` is removed for the same reason: that `-gnu` refers to glibc or GNU/linux, neither of which applies to the kernel itself. Relates to #74247
2021-03-04Add powerpc-unknown-openbsd targetyn0ga-0/+17
Add powerpc-unknown-openbsd target * Fix missing abi::endian crate * Missing platform-support.md
2021-03-04Auto merge of #81451 - nikic:llvm-12, r=nagisabors-5/+5
Upgrade to LLVM 12 This implements the necessary adjustments to make rustc work with LLVM 12. I didn't encounter any major issues so far. r? `@cuviper`
2021-03-01Change built-in kernel targets to be os = none throughoutJohn Ericson-5/+9
Whether for Rust's own `target_os`, LLVM's triples, or GNU config's, the OS-related have fields have been for code running *on* that OS, not code that is *part* of the OS. The difference is huge, as syscall interfaces are nothing like freestanding interfaces. Kernels are (hypervisors and other more exotic situations aside) freestanding programs that use the interfaces provided by the hardware. It's *those* interfaces, the ones external to the program being built and its software dependencies, that are the content of the target. For the Linux Kernel in particular, `target_env: "gnu"` is removed for the same reason: that `-gnu` refers to glibc or GNU/linux, neither of which applies to the kernel itself. Relates to #74247 Thanks @ojeda for catching some things.
2021-03-01Change default Solaris x86 target to x86_64-pc-solarisJakub Kulik-22/+23
2021-03-01Auto merge of #82601 - terhechte:catalyst-support-m1-fix, r=petrochenkovbors-5/+3
Fixed support for macOS Catalyst on ARM64 When I initially added Arm64 Catalyst support in https://github.com/rust-lang/rust/pull/77484 I had access to a DTK. However, while waiting to merge the PR some other changes were merged which caused conflicts in the branch. When fixing those conflicts I had no access to the DTK anymore and didn't try out if the resulting binaries did indeed work on Apple Silicon. I finally have a M1 and I realized that some small changes were necessary to support Apple Silicon. This PR adds the required changes. I've been running binaries generated with this branch for some time now and they work without issues.
2021-02-28Support LLVM 12 in rustcNikita Popov-5/+5
2021-02-28Auto merge of #82594 - nagisa:nagisa/remove-rumprun, r=petrochenkovbors-26/+0
Remove the x86_64-rumprun-netbsd target Herein we remove the target from the compiler and the code from libstd intended to support the now-defunct rumprun project. Closes #81514
2021-02-27Fixed support for macOS Catalyst for Apple SiliconBenedikt Terhechte-5/+3
2021-02-27Remove the x86_64-rumprun-netbsd targetSimonas Kazlauskas-26/+0
Closes #81514
2021-02-26Link crtbegin/crtend on musl to terminate .eh_frameNikita Popov-7/+14
For some targets, rustc uses a "CRT fallback", where it links CRT object files it ships instead of letting the host compiler link them. On musl, rustc currently links crt1, crti and crtn (provided by libc), but does not link crtbegin and crtend (provided by libgcc). In particular, crtend is responsible for terminating the .eh_frame section. Lack of terminator may result in segfaults during unwinding, as reported in #47551 and encountered by the LLVM 12 update in #81451. This patch links crtbegin and crtend for musl as well, following the table at the top of crt_objects.rs.
2021-02-23Rollup merge of #82166 - kaniini:s390x-musl-target, r=nagisaDylan DPC-0/+25
add s390x-unknown-linux-musl target This is the first step in bringup for Rust on s390x. The libc and std crates need modifications as well, but getting this upstream makes that work easier.
2021-02-21Rollup merge of #81966 - deg4uss3r:degausser/aarch64_apple_ios_sim, r=shepmasterYuki Okushi-6/+61
Add new `rustc` target for Arm64 machines that can target the iphonesimulator This PR lands a new target (`aarch64-apple-ios-sim`) that targets arm64 iphone simulator, previously unreachable from Apple Silicon machines. resolves #81632 r? `@shepmaster`
2021-02-20iOS simulator: pick the target based on the environment variableJan-Erik Rediger-6/+25
LLVM picks the right things to put into the compiled object file based on the target deployment version. We need to communicate it through the target triple. Only with that LLVM will use the right commands in the file to make it look and behave like code compiled for the arm64 iOS simulator target.
2021-02-19added aarch64_apple_ios_sim as a rustc targetRicky (deg4uss3r)-1/+37
2021-02-19add s390x-unknown-linux-musl targetAriadne Conill-0/+25
2021-02-16add specs for riscv32/riscv64 musl targetsKhem Raj-0/+40
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2021-02-16avoid full-slicing slicesMatthias Krüger-1/+1
If we already have a slice, there is no need to get another full-range slice from that, just use the original. clippy::redundant_slicing
2021-02-11Stack probes: fix error messageMiguel Ojeda-1/+1
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2021-02-03Auto merge of #81346 - hug-dev:nonsecure-call-abi, r=jonas-schievinkbors-0/+2
Add a new ABI to support cmse_nonsecure_call This adds support for the `cmse_nonsecure_call` feature to be able to perform non-secure function call. See the discussion on Zulip [here](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Support.20for.20callsite.20attributes/near/223054928). This is a followup to #75810 which added `cmse_nonsecure_entry`. As for that PR, I assume that the changes are small enough to not have to go through a RFC but I don't mind doing one if needed 😃 I did not yet create a tracking issue, but if most of it is fine, I can create one and update the various files accordingly (they refer to the other tracking issue now). On the Zulip chat, I believe `@jonas-schievink` volunteered to be a reviewer 💯
2021-02-02Rollup merge of #81455 - Amanieu:aarch64_ilp32, r=sanxiynJack Huey-0/+62
Add AArch64 big-endian and ILP32 targets This PR adds 3 new AArch64 targets: - `aarch64_be-unknown-linux-gnu` - `aarch64-unknown-linux-gnu_ilp32` - `aarch64_be-unknown-linux-gnu_ilp32` It also fixes some ABI issues on big-endian ARM and AArch64.
2021-02-02Add a new ABI to support cmse_nonsecure_callHugues de Valon-0/+2
This commit adds a new ABI to be selected via `extern "C-cmse-nonsecure-call"` on function pointers in order for the compiler to apply the corresponding cmse_nonsecure_call callsite attribute. For Armv8-M targets supporting TrustZone-M, this will perform a non-secure function call by saving, clearing and calling a non-secure function pointer using the BLXNS instruction. See the page on the unstable book for details. Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>
2021-01-31Rollup merge of #81255 - sunfishcode:wasi-no-export-dynamic, r=alexcrichtonJonas Schievink-15/+24
Don't link with --export-dynamic on wasm32-wasi Remove --export-dynamic from the link arguments on the wasm32-wasi target, as it emits spurious exports and increases code size. Leave it in place for wasm32-unknown-unknown and wasm32-unknown-emscripten. Even though it isn't a great solution there, users are likely depending on its behavior there.
2021-01-28rustc: Stabilize `-Zrun-dsymutil` as `-Csplit-debuginfo`Alex Crichton-2/+92
This commit adds a new stable codegen option to rustc, `-Csplit-debuginfo`. The old `-Zrun-dsymutil` flag is deleted and now subsumed by this stable flag. Additionally `-Zsplit-dwarf` is also subsumed by this flag but still requires `-Zunstable-options` to actually activate. The `-Csplit-debuginfo` flag takes one of three values: * `off` - This indicates that split-debuginfo from the final artifact is not desired. This is not supported on Windows and is the default on Unix platforms except macOS. On macOS this means that `dsymutil` is not executed. * `packed` - This means that debuginfo is desired in one location separate from the main executable. This is the default on Windows (`*.pdb`) and macOS (`*.dSYM`). On other Unix platforms this subsumes `-Zsplit-dwarf=single` and produces a `*.dwp` file. * `unpacked` - This means that debuginfo will be roughly equivalent to object files, meaning that it's throughout the build directory rather than in one location (often the fastest for local development). This is not the default on any platform and is not supported on Windows. Each target can indicate its own default preference for how debuginfo is handled. Almost all platforms default to `off` except for Windows and macOS which default to `packed` for historical reasons. Some equivalencies for previous unstable flags with the new flags are: * `-Zrun-dsymutil=yes` -> `-Csplit-debuginfo=packed` * `-Zrun-dsymutil=no` -> `-Csplit-debuginfo=unpacked` * `-Zsplit-dwarf=single` -> `-Csplit-debuginfo=packed` * `-Zsplit-dwarf=split` -> `-Csplit-debuginfo=unpacked` Note that `-Csplit-debuginfo` still requires `-Zunstable-options` for non-macOS platforms since split-dwarf support was *just* implemented in rustc. There's some more rationale listed on #79361, but the main gist of the motivation for this commit is that `dsymutil` can take quite a long time to execute in debug builds and provides little benefit. This means that incremental compile times appear that much worse on macOS because the compiler is constantly running `dsymutil` over every single binary it produces during `cargo build` (even build scripts!). Ideally rustc would switch to not running `dsymutil` by default, but that's a problem left to get tackled another day. Closes #79361
2021-01-27Add big-endian and ILP32 AArch64 targetsAmanieu d'Antras-0/+62
2021-01-21Don't link with --export-dynamic on wasm32-wasiDan Gohman-15/+24
Remove --export-dynamic from the link arguments on the wasm32-wasi target, as it emits spurious exports and increases code size. Leave it in place for wasm32-unknown-unknown and wasm32-unknown-emscripten. Even though it isn't a great solution there, users are likely depending on its behavior there.
2021-01-20Use a call probe on the x86_64-uefi targetSimonas Kazlauskas-1/+3
Fixes #81196
2021-01-16Target stack-probe support configurable finelySimonas Kazlauskas-68/+176
This adds capability to configure the target's stack probe support in a more precise manner than just on/off. In particular now we allow choosing between always inline-asm, always call or either one of those depending on the LLVM version on a per-target basis.
2021-01-13Rollup merge of #80662 - rxrbln:master, r=estebankDylan DPC-0/+16
Added support for i386-unknown-linux-gnu and i486-unknown-linux-gnu Support for both can be useful when creating new firmware, boot loaders, or embedded operating systems.
2021-01-12Rollup merge of #79997 - coolreader18:wasm-reactor, r=alexcrichtonYuki Okushi-10/+16
Emit a reactor for cdylib target on wasi Fixes #79199, and relevant to #73432 Implements wasi reactors, as described in WebAssembly/WASI#13 and [`design/application-abi.md`](https://github.com/WebAssembly/WASI/blob/master/design/application-abi.md) Empty `lib.rs`, `lib.crate-type = ["cdylib"]`: ```shell $ cargo +reactor build --release --target wasm32-wasi Compiling wasm-reactor v0.1.0 (/home/coolreader18/wasm-reactor) Finished release [optimized] target(s) in 0.08s $ wasm-dis target/wasm32-wasi/release/wasm_reactor.wasm >reactor.wat ``` `reactor.wat`: ```wat (module (type $none_=>_none (func)) (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (import "wasi_snapshot_preview1" "fd_prestat_get" (func $__wasi_fd_prestat_get (param i32 i32) (result i32))) (import "wasi_snapshot_preview1" "fd_prestat_dir_name" (func $__wasi_fd_prestat_dir_name (param i32 i32 i32) (result i32))) (import "wasi_snapshot_preview1" "proc_exit" (func $__wasi_proc_exit (param i32))) (import "wasi_snapshot_preview1" "environ_sizes_get" (func $__wasi_environ_sizes_get (param i32 i32) (result i32))) (import "wasi_snapshot_preview1" "environ_get" (func $__wasi_environ_get (param i32 i32) (result i32))) (memory $0 17) (table $0 1 1 funcref) (global $global$0 (mut i32) (i32.const 1048576)) (global $global$1 i32 (i32.const 1049096)) (global $global$2 i32 (i32.const 1049096)) (export "memory" (memory $0)) (export "_initialize" (func $_initialize)) (export "__data_end" (global $global$1)) (export "__heap_base" (global $global$2)) (func $__wasm_call_ctors (call $__wasilibc_initialize_environ_eagerly) (call $__wasilibc_populate_preopens) ) (func $_initialize (call $__wasm_call_ctors) ) (func $malloc (param $0 i32) (result i32) (call $dlmalloc (local.get $0) ) ) ;; lots of dlmalloc, memset/memcpy, & libpreopen code ) ``` I went with repurposing cdylib because I figured that it doesn't make much sense to have a wasi shared library that can't be initialized, and even if someone was using it adding an `_initialize` export is a very small change.
2021-01-08Add wasi-exec-model cg option for emitting wasi reactorsNoah-10/+16
2021-01-06Change related spec files to use the new enumLzu Tao-37/+50
2021-01-06Prefer enum Endian in rustc_target::TargetLzu Tao-4/+7
2021-01-05Added support for i386-unknown-linux-gnu and i486-unknown-linux-gnuRené Rebe-0/+16
Support for both can be useful when creating new firmware, boot loaders, or embedded operating systems.
2020-12-16Add support for target aliasesJakub Kulik-0/+18
2020-12-07Dogfood 'str_split_once() with `compiler/`Eric Arellano-4/+1
2020-11-30Add built-in support for the armv5te-unknown-linux-uclibceabi targetOndrej Perutka-0/+21
2020-11-26Add support for Arm64 Catalyst on ARM MacsBenedikt Terhechte-1/+35
2020-11-22Drop support for cloudabi targetsLzu Tao-115/+0
2020-11-15Rollup merge of #78993 - petrochenkov:specdash, r=oli-obkDylan DPC-8/+8
rustc_target: Fix dash vs underscore mismatches in option names Fixes https://github.com/rust-lang/rust/issues/78981 (regression from https://github.com/rust-lang/rust/pull/78875, the old option names used dashes)
2020-11-14Auto merge of #78959 - petrochenkov:likeuefi, r=nagisabors-12/+18
rustc_target: Mark UEFI targets as `is_like_windows`/`is_like_msvc` And document what `is_like_windows` and `is_like_msvc` actually mean in more detail. Addresses FIXMEs left from https://github.com/rust-lang/rust/pull/71030. r? `@nagisa`