about summary refs log tree commit diff
path: root/compiler/rustc_target
AgeCommit message (Collapse)AuthorLines
2021-01-28Auto merge of #81388 - bjorn3:wasm_bindgen_fix, r=nikomatsakisbors-2/+2
Fix abi for wasm-bindgen Hopefully fixes https://github.com/rust-lang/rust/issues/81386. `@alexcrichton` can you confirm this fixes wasm-bindgen? r? `@alexcrichton`
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-27Fix ARM and AArch64 calling convention for passing small composite typesAmanieu d'Antras-30/+3
On big-endian the values need to be right-aligned within a 64-bit register, as if the value had been read with a 64-bit load instruction.
2021-01-27Inline trivial implementation of rustc_target::abi::AlignTomasz Miąsko-2/+18
2021-01-26Use PassMode::Direct for Abi::Aggregate by defaultbjorn3-2/+2
2021-01-26Revert "Wasm-bindgen abi compat using cast_to"bjorn3-48/+8
This reverts commit 903c553f4a2fc8344edac0da565e6c1a7fad4b39.
2021-01-26Wasm-bindgen abi compat using cast_tobjorn3-8/+48
2021-01-26Revert "Share wasm-bindgen compat abi selection code"bjorn3-16/+4
This reverts commit e7a056fe20f7ec5a475923ff2f4eda8ca9e1a74b.
2021-01-25Share wasm-bindgen compat abi selection codebjorn3-4/+16
2021-01-24Auto merge of #80838 - nagisa:nagisa/stack-probe-type, r=cuviperbors-68/+178
Target stack-probe support configurable finely 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. Note that this removes the ability to turn off the generation of the stack-probe attribute. This is valid to replace it with inline-asm for all targets because `probe-stack="inline-asm"` will not generate any machine code on targets that do not currently support stack probes. This makes support for stack probes on targets that don't have any right now automatic with LLVM upgrades in the future. (This is valid to do based on the fact that clang unconditionally sets this attribute when `-fstack-clash-protection` is used, AFAICT) cc #77885 r? `@cuviper`
2021-01-23Add some comments to PassModebjorn3-0/+6
2021-01-23Never create an temporary PassMode::Direct when it is not a valid pass mode ↵bjorn3-17/+31
for a type
2021-01-23Use PassMode::Pair by default for Abi::ScalarPair for all abi's and in ↵bjorn3-2/+8
return position Abi::ScalarPair is only ever used for types that don't have a stable layout anyway so this doesn't break any FFI. It does however reduce the amount of special casing on the abi outside of the code responsible for abi specific adjustments to the pass mode.
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 #80042 - sivadeilra:cold_bits, r=oli-obkYuki Okushi-6/+20
Split a func into cold/hot parts, reducing binary size I noticed that the Size::bits function is called in many places, and is inlined into them. On x86_64-pc-windows-msvc, this function is inlined 527 times, and compiled separately (non-inlined) 3 times. Each of those inlined calls contains code that panics. This commit moves the `panic!` call into a separate function and marks that function with `#[cold]`. This reduces binary size by 24 KB. Not much, but it's something. Changes like this often reduce pressure on instruction-caches, since it reduces the amount of code that is inlined into hot code paths. Or more precisely, it removes cold code from hot cache lines.
2021-01-12Rollup merge of #79998 - devsnek:wasm32-bindgen-compat, r=alexcrichtonYuki Okushi-4/+5
Use correct ABI for wasm32 by default Introduces `wasm32-unknown-bindgen` for those wishing to use the bindgen compat abi. `wasm32-*` now uses the correct abi by default. Fixes https://github.com/rustwasm/team/issues/291
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-11squash! fix wasiGus Caplan-14/+5
2021-01-11new targetGus Caplan-6/+11
2021-01-11Use correct ABI for wasm32 by defaultGus Caplan-1/+6
Introduces `RUSTC_USE_WASM32_BINDGEN_COMPAT_ABI` env var to use the compat ABI if need.
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-12/+48
2021-01-05Split a func into cold/hot parts, reducing binary sizeArlie Davis-6/+20
I noticed that the Size::bits function is called in many places, and is inlined into them. On x86_64-pc-windows-msvc, this function is inlined 527 times, and compiled separately (non-inlined) 3 times. Each of those inlined calls contains code that panics. This commit moves the `panic!` call into a separate function and marks that function with `#[cold]`. This reduces binary size by 24 KB. By itself, that's not a substantial reduction. However, changes like this often reduce pressure on instruction-caches, since it reduces the amount of code that is inlined into hot code paths. Or more precisely, it removes cold code from hot cache lines. It also removes all conditionals from Size::bits(), which is called in many places.
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-10Rollup merge of #79917 - sivadeilra:asm_symbols, r=petrochenkovTyler Mandry-29/+22
Use Symbol for inline asm register class names This takes care of one "FIXME": // FIXME: use direct symbol comparison for register class names Instead of using string literals, this uses Symbol for register class names. This is part of work I am doing to improve how Symbol interning works.
2020-12-10Use Symbol for inline asm register class namesArlie Davis-29/+22
This takes care of one "FIXME": // FIXME: use direct symbol comparison for register class names Instead of using string literals, this uses Symbol for register class names.
2020-12-07Dogfood 'str_split_once() with `compiler/`Eric Arellano-4/+2
2020-12-01Auto merge of #78684 - devsnek:inline-asm-wasm, r=Amanieubors-0/+67
Add wasm32 support to inline asm There is some contention around inline asm and wasm, and I really only made this to figure out the process of hacking on rustc, but I figured as long as the code existed, it was worth uploading. cc `@Amanieu`
2020-12-01Add wasm32 support to inline asmGus Caplan-0/+67
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-21Replace sext() and zext() with single ext() methodbjorn3-15/+9
2020-11-21Rename prefix_chunk to prefix_chunk_sizebjorn3-6/+6
2020-11-21Remove StructRet arg attrbjorn3-5/+0
It is applied exactly when the return value has an indirect pass mode. Except for InReg on x86 fastcall, arg attrs are now only used for optimization purposes and thus are fine to ignore.
2020-11-21Replace ByVal attribute with on_stack field for Indirectbjorn3-12/+19
This makes it clearer that only PassMode::Indirect allows ByVal
2020-11-21Replace ZExt and SExt flags with ArgExtension enumbjorn3-7/+33
Both flags are mutually exclusive
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`
2020-11-14Auto merge of #78951 - petrochenkov:unknown, r=ehussbors-20/+19
rustc_target: Change os and vendor values to "none" and "unknown" for some targets Closes https://github.com/rust-lang/rust/issues/77730 r? `@ehuss`
2020-11-12Rollup merge of #78950 - khyperia:spirv-asm, r=AmanieuMara Bos-0/+67
Add asm register information for SPIR-V As discussed in [zulip](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Defining.20asm!.20for.20new.20architecture), we at [rust-gpu](https://github.com/EmbarkStudios/rust-gpu) would like to support `asm!` for our SPIR-V backend. However, we cannot do so purely without frontend support: [this match](https://github.com/rust-lang/rust/blob/d4ea0b3e46a0303d5802b632e88ba1ba84d9d16f/compiler/rustc_target/src/asm/mod.rs#L185) fails and so `asm!` is not supported ([error reported here](https://github.com/rust-lang/rust/blob/d4ea0b3e46a0303d5802b632e88ba1ba84d9d16f/compiler/rustc_ast_lowering/src/expr.rs#L1095)). To resolve this, we need to stub out register information for SPIR-V to support getting the `asm!` content all the way to [`AsmBuilderMethods::codegen_inline_asm`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/traits/trait.AsmBuilderMethods.html#tymethod.codegen_inline_asm), at which point the rust-gpu backend can do all the parsing and codegen that is needed. This is a pretty weird PR - adding support for a backend that isn't in-tree feels pretty gross to me, but I don't see an easy way around this. ``@Amanieu`` said I should submit it anyway, so, here we are! Let me know if this needs to go through a more formal process (MCP?) and what I should do to help this along. I based this off the [wasm asm PR](https://github.com/rust-lang/rust/pull/78684), which unfortunately this PR conflicts with that one quite a bit, sorry for any merge conflict pain :( --- Some open questions: - What do we call the register class? Some context, SPIR-V is an SSA-based IR, there are "instructions" that create IDs (referred to as `<id>` in the spec), which can be referenced by other instructions. So, `reg` isn't exactly accurate, they're SSA IDs, not re-assignable registers. - What happens when a SPIR-V register gets to the LLVM backend? Right now it's a `bug!`, but should that be a `sess.fatal()`? I'm not sure if it's even possible to reach that point, maybe there's a check that prevents the `spirv` target from even reaching that codepath.
2020-11-12rustc_target: Mark UEFI targets as `is_like_windows`/`is_like_msvc`Vadim Petrochenkov-12/+18
Document what `is_like_windows` and `is_like_msvc` mean in more detail.
2020-11-12rustc_target: Fix dash vs underscore mismatches in option namesVadim Petrochenkov-8/+8
2020-11-11Rollup merge of #78930 - petrochenkov:notlikeandroid, r=Mark-SimulacrumJonas Schievink-7/+0
rustc_taret: Remove `TargetOptions::is_like_android` This option was replaced by more specific options and is no longer used by the compiler.