about summary refs log tree commit diff
path: root/compiler/rustc_target/src
AgeCommit message (Collapse)AuthorLines
2021-08-12Add support for clobber_abi to asm!Amanieu d'Antras-0/+182
2021-08-10STD support for the ESP-IDF frameworkivmarkov-0/+38
2021-08-09Auto merge of #85357 - Andy-Python-Programmer:aarch64_uefi_target, ↵bors-0/+28
r=petrochenkov Add `aarch64-unknown-uefi` target This pull request adds the `aarch64-unknown-uefi` target.
2021-08-09Add the aarch64-unknown-uefi targetunknown-0/+28
* This commit adds the aarch64-unknown-uefi target and also adds it into the supported targets list under the tier-3 target table. * Uses the small code model by default Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
2021-08-01Auto merge of #87664 - devnexen:netbsd_sanitizers_support, r=nagisabors-1/+3
netbsd x86_64 arch enable supported sanitizers.
2021-08-01Auto merge of #87449 - matthiaskrgr:clippyy_v2, r=nagisabors-1/+1
more clippy::complexity fixes (also a couple of clippy::perf fixes)
2021-07-31netbsd x86_64 arch enable supported sanitizers.David Carlier-1/+3
2021-07-25freebsd remove compiler workaround.David Carlier-2/+1
related issue #43575
2021-07-25clippy::useless_formatMatthias Krüger-1/+1
2021-07-22Add support for powerpc-unknown-freebsdPiotr Kubaj-0/+28
2021-07-17Auto merge of #87124 - Andy-Python-Programmer:code_model_uefi_patch, ↵bors-6/+2
r=petrochenkov Use small code model for UEFI targets * Since the code model only applies to the code and not the data and the code model only applies to functions you call through using `call`, `jmp` and data with `lea`, etc… If you are calling functions using the function pointers from the UEFI structures the code model does not apply in that case. It’s just related to the address space size of your own binary. Since UEFI (uefi is all relocatable) uses relocatable PEs (relocatable code does not care about the code model) so, we use the small code model here. * Since applications don't usually take gigabytes of memory, setting the target to use the small code model should result in better codegen (comparable with majority of other targets). Large code models are also known for generating horrible code, for example 16 bytes of code to load a single 8-byte value. Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
2021-07-17Auto merge of #86062 - nagisa:nagisa/what-a-lie, r=estebankbors-0/+4
Do not allow JSON targets to set is-builtin: true Note that this will affect (and make builds fail for) all of the projects out there that have target files invalid in this way. Crater, however, does not really cover these kinds of the codebases, so it is quite difficult to measure the impact. That said, the target files invalid in this way can start causing build failures each time LLVM is upgraded, anyway, so it is probably a good opportunity to disallow this property, entirely. Another approach considered was to simply not parse this field anymore, which would avoid making the builds explicitly fail, but it wasn't clear to me if `is-builtin` was always set unintentionally… In case this was the case, I'd expect people to file a feature request stating specifically for what purpose they were using `is-builtin`. Fixes #86017
2021-07-17Use small code model for UEFI targetsAndy-Python-Programmer-6/+2
* Since the code model only applies to the code and not the data and the code model only applies to functions you call through using `call`, `jmp` and data with `lea`, etc… If you are calling functions using the function pointers from the UEFI structures the code model does not apply in that case. It’s just related to the address space size of your own binary. Since UEFI (uefi is all relocatable) uses relocatable PEs (relocatable code does not care about the code model) so, we use the small code model here. * Since applications don't usually take gigabytes of memory, setting the target to use the small code model should result in better codegen (comparable with majority of other targets). Large code models are also known for generating horrible code, for example 16 bytes of code to load a single 8-byte value. * Use the LLVM default code model for the architecture for the x86_64-unknown-uefi targets. For reference small is the default code model on x86 in LLVM: <https://github.com/llvm/llvm-project/blob/7de2173c2a4c45711831cfee3ccf53690c76ff07/llvm/lib/Target/X86/X86TargetMachine.cpp#L204> * Remove the comments too as they are not UEFI-specific and applies to pretty much any target. I added them before as I was explicitily setting the code model to small. Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
2021-07-13Auto merge of #86922 - joshtriplett:target-abi, r=oli-obkbors-7/+98
target abi Implement cfg(target_abi) (RFC 2992) Add an `abi` field to `TargetOptions`, defaulting to "". Support using `cfg(target_abi = "...")` for conditional compilation on that field. Gated by `feature(cfg_target_abi)`. Add a test for `target_abi`, and a test for the feature gate. Add `target_abi` to tidy as a platform-specific cfg. Update targets to use `target_abi` All eabi targets have `target_abi = "eabi".` All eabihf targets have `target_abi = "eabihf"`. `armv6_unknown_freebsd` and `armv7_unknown_freebsd` have `target_abi = "eabihf"`. All abi64 targets have `target_abi = "abi64"`. All ilp32 targets have `target_abi = "ilp32"`. All softfloat targets have `target_abi = "softfloat"`. All *-uwp-windows-* targets have `target_abi = "uwp"`. All spe targets have `target_abi = "spe"`. All macabi targets have `target_abi = "macabi"`. aarch64-apple-ios-sim has `target_abi = "sim"`. `x86_64-fortanix-unknown-sgx` has `target_abi = "fortanix"`. `x86_64-unknown-linux-gnux32` has `target_abi = "x32"`. Add FIXME entries for targets for which existing values need to change once `cfg_target_abi` becomes stable. (All of them are tier 3 targets.) Add a test for `target_abi` in `--print cfg`.
2021-07-11Auto merge of #86416 - Amanieu:asm_clobber_only, r=nagisabors-36/+116
Add clobber-only register classes for asm! These are needed to properly express a function call ABI using a clobber list, even though we don't support passing actual values into/out of these registers.
2021-07-10Add AArch64 z* registers as aliases for v* registersAmanieu d'Antras-32/+32
2021-07-10Add clobber-only register classes for asm!Amanieu d'Antras-4/+84
These are needed to properly express a function call ABI using a clobber list, even though we don't support passing actual values into/out of these registers.
2021-07-08Do not allow JSON targets to set is-builtin: trueSimonas Kazlauskas-0/+4
2021-07-07Update targets to use target_abiJosh Triplett-7/+92
All eabi targets have target_abi = "eabi". All eabihf targets have target_abi = "eabihf". armv6_unknown_freebsd and armv7_unknown_freebsd have target_abi = "eabihf". All abi64 targets have target_abi = "abi64". All ilp32 targets have target_abi = "ilp32". All softfloat targets have target_abi = "softfloat". All *-uwp-windows-* targets have target_abi = "uwp". All spe targets have target_abi = "spe". All macabi targets have target_abi = "macabi". aarch64-apple-ios-sim has target_abi = "sim". x86_64-fortanix-unknown-sgx has target_abi = "fortanix". x86_64-unknown-linux-gnux32 has target_abi = "x32". Add FIXME entries for targets for which existing values need to change once cfg_target_abi becomes stable. (All of them are tier 3 targets.) Add a test for target_abi in `--print cfg`.
2021-07-07Implement cfg(target_abi) (RFC 2992)Josh Triplett-0/+6
Add an `abi` field to `TargetOptions`, defaulting to "". Support using `cfg(target_abi = "...")` for conditional compilation on that field. Gated by `feature(cfg_target_abi)`. Add a test for `target_abi`, and a test for the feature gate. Add `target_abi` to tidy as a platform-specific cfg. This does not add an abi to any existing target.
2021-07-06Replace per-target ABI denylist with an allowlistSimonas Kazlauskas-427/+202
It makes very little sense to maintain denylists of ABIs when, as far as non-generic ABIs are concerned, targets usually only support a small subset of the available ABIs. This has historically been a cause of bugs such as us allowing use of the platform-specific ABIs on x86 targets – these in turn would cause LLVM errors or assertions to fire. Fixes #57182 Sponsored by: standard.ai
2021-06-30Add support for leaf fn frame pointer eliminationSimonas Kazlauskas-33/+89
This PR adds ability for the target specifications to specify frame pointer emission type that's not just “always” or “whatever cg decides”. In particular there's a new mode that allows omission of the frame pointer for leaf functions (those that don't call any other functions). We then set this new mode for Aarch64-based Apple targets. Fixes #86196
2021-06-23Point to the updated version of some dead linksSmitty-1/+1
2021-06-23Use HTTPS links where possibleSmitty-9/+9
2021-06-21Auto merge of #85775 - adamrk:warn-unused-target-fields, r=nagisabors-86/+213
Emit warnings for unused fields in custom targets. Add a warning which lists any fields in a custom target `json` file that aren't used. Currently unrecognized fields are ignored so, for example, a typo in the `json` will silently produce a target which isn't the one intended.
2021-06-17Emit warnings for unused fields in custom targets.Adam Bratschi-Kaye-86/+213
2021-06-17Auto merge of #83572 - pkubaj:patch-1, r=nagisabors-0/+17
Add support for powerpc64le-unknown-freebsd
2021-06-14Use the now available implementation of `IntoIterator` for arraysLeSeulArtichaut-3/+3
2021-06-07Use `try_into` instead of asserting manuallyLingMan-10/+2
2021-06-06Rollup merge of #85920 - luqmana:wasm-linker-tweaks, r=petrochenkovYuki Okushi-0/+1
Tweak wasm_base target spec to indicate linker is not GNU and update linker inferring logic for wasm-ld. Reported via [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/wasi.20linker.20unknown.20argument.3A.20--as-needed): we try passing `--as-needed` to the linker if it's GNU ld which `wasm-ld` is not. Usually this isn't an issue for wasm as we would use the WasmLd linker driver but because the linker in question (`wasm32-unknown-wasi-wasm-ld`) ended with `-ld` our linker inferring [logic](https://github.com/rust-lang/rust/blob/f64503eb555475d65ae5503ef22439ca5dd394fd/compiler/rustc_codegen_ssa/src/back/link.rs#L957-L1040) used the `GccLinker` implementations. (UPD: The linker inferring logic actually didn't apply in this case because the linker is actually invoked through gcc in the reported issue. But it's still worth updating the logic I think.) This change then has 2 parts: 1. Update wasm_base target spec to indicate `linker_is_gnu: false` plus a few additions of `target.is_like_wasm` to handle flags `wasm-ld` does in fact support. 2. Improve the linker detection logic to properly determine the correct flavor of wasm linker we're using when we can. We need to add the new `target.is_like_wasm` branches to handle the case where the "linker" used could be something like clang which would then under the hood call wasm-ld.
2021-06-06Auto merge of #79608 - alessandrod:bpf, r=nagisabors-0/+259
BPF target support This adds `bpfel-unknown-none` and `bpfeb-unknown-none`, two new no_std targets that generate little and big endian BPF. The approach taken is very similar to the cuda target, where `TargetOptions::obj_is_bitcode` is enabled and code generation is done by the linker. I added the targets to `dist-various-2`. There are [some tests](https://github.com/alessandrod/bpf-linker/tree/main/tests/assembly) in bpf-linker and I'm planning to add more. Those are currently not ran as part of rust CI.
2021-06-05Rollup merge of #86014 - cr1901:msp430-link, r=jonas-schievinkGuillaume Gomez-0/+1
msp430 linker does not accept -znoexecstack. Set linker_is_gnu to fal… …se as workaround for now. Tested locally and works. Closes #85948.
2021-06-04msp430 linker does not accept -znoexecstack. Set linker_is_gnu to false as ↵William D. Jones-0/+1
workaround for now.
2021-06-05Rollup merge of #85966 - alexcrichton:wasm-simd-indirect, r=workingjubileeYuki Okushi-6/+0
wasm: Make simd types passed via indirection again This commit updates wasm target specs to use `simd_types_indirect: true` again. Long ago this was added since wasm simd types were always translated to `v128` under-the-hood in LLVM, meaning that it didn't matter whether that target feature was enabled or not. Now, however, `v128` is conditionally used in codegen depending on target features enabled, meaning that it's possible to get linker errors about different signatures in code that correctly uses simd types. The fix is the same as for all other platforms, which is to pass the type indirectly.
2021-06-04Rollup merge of #85850 - bjorn3:less_feature_gates, r=jyn514Yuki Okushi-2/+0
Remove unused feature gates The first commit removes a usage of a feature gate, but I don't expect it to be controversial as the feature gate was only used to workaround a limitation of rust in the past. (closures never being `Clone`) The second commit uses `#[allow_internal_unstable]` to avoid leaking the `trusted_step` feature gate usage from inside the index newtype macro. It didn't work for the `min_specialization` feature gate though. The third commit removes (almost) all feature gates from the compiler that weren't used anyway.
2021-06-03wasm: Make simd types passed via indirection againAlex Crichton-6/+0
This commit updates wasm target specs to use `simd_types_indirect: true` again. Long ago this was added since wasm simd types were always translated to `v128` under-the-hood in LLVM, meaning that it didn't matter whether that target feature was enabled or not. Now, however, `v128` is conditionally used in codegen depending on target features enabled, meaning that it's possible to get linker errors about different signatures in code that correctly uses simd types. The fix is the same as for all other platforms, which is to pass the type indirectly.
2021-06-03Rollup merge of #85706 - jrmuizel:fpe, r=nagisaYuki Okushi-5/+1
Turn off frame pointer elimination on all Apple platforms. This ends up disabling frame pointer elimination on aarch64_apple_darwin which matches what clang does by default along with the aarch64_apple_ios and x86_64_apple_darwin targets. Further, the Apple docs "Writing ARM64 Code for Apple Platforms" has a section called "Respect the Purpose of Specific CPU Registers" which specifically calls out the frame pointer register (x29): The frame pointer register (x29) must always address a valid frame record. Some functions — such as leaf functions or tail calls — may opt not to create an entry in this list As a result, stack traces are always meaningful, even without debug information. Other platforms are updated to not override the default.
2021-06-02Turn off frame pointer elimination on all Apple platforms.Jeff Muizelaar-5/+1
This ends up disabling frame pointer elimination on aarch64_apple_darwin which matches what clang does by default along with the aarch64_apple_ios and x86_64_apple_darwin targets. Further, the Apple docs "Writing ARM64 Code for Apple Platforms" has a section called "Respect the Purpose of Specific CPU Registers" which specifically calls out the frame pointer register (x29): The frame pointer register (x29) must always address a valid frame record. Some functions — such as leaf functions or tail calls — may opt not to create an entry in this list As a result, stack traces are always meaningful, even without debug information. Other platforms are updated to not override the default.
2021-06-02Miscellaneous inlining improvementsTomasz Miąsko-0/+5
2021-06-01Tweak wasm_base target spec to indicate linker is not GNU and update linker ↵Luqman Aden-0/+1
inferring logic for wasm-ld.
2021-05-31Remove unused feature gatesbjorn3-2/+0
2021-05-29BPF: misc minor review fixesAlessandro Decina-0/+4
2021-05-29BPF: abi: extend args/ret to 32 bitsAlessandro Decina-3/+3
Let LLVM extend to 64 bits when alu32 is not enabled
2021-05-26Specialize implementationsJacob Pratt-0/+2
Implementations in stdlib are now optimized as they were before.
2021-05-23Add support for BPF inline assemblyAlessandro Decina-3/+158
2021-05-23Add BPF targetAlessandro Decina-0/+100
This change adds the bpfel-unknown-none and bpfeb-unknown-none targets which can be used to generate little endian and big endian BPF
2021-05-20Remove linker_is_gnu: true cases as that is now the default.Luqman Aden-20/+0
2021-05-20Swap TargetOptions::linker_is_gnu default from false to true and update ↵Luqman Aden-2/+8
targets as appropriate.
2021-05-19Auto merge of #85376 - RalfJung:ptrless-allocs, r=oli-obkbors-1/+3
CTFE core engine allocation & memory API improvemenets This is a first step towards https://github.com/rust-lang/miri/issues/841. - make `Allocation` API offset-based (no more making up `Pointer`s just to access an `Allocation`) - make `Memory` API higher-level (combine checking for access and getting access into one operation) The Miri-side PR is at https://github.com/rust-lang/miri/pull/1804. r? `@oli-obk`
2021-05-18Rollup merge of #85274 - luqmana:linker-is-gnu-gc-sections, r=petrochenkovJack Huey-0/+1
Only pass --[no-]gc-sections if linker is GNU ld. Fixes a regression from #84468 where linking now fails with solaris linkers. LinkerFlavor::Gcc does not always mean GNU ld specifically. And in the case of at least the solaris ld in illumos, that flag is unrecognized and will cause the linking step to fail. Even though removing the `is_like_solaris` branch from `gc_sections` in #84468 made sense as `-z ignore/record` are more analogous to the `--[no-]-as-needed` flags, it inadvertently caused solaris linkers to be passed the `--gc-sections` flag. So let's just change it to be more explicit about when we pass those flags.