about summary refs log tree commit diff
path: root/compiler/rustc_target/src
AgeCommit message (Collapse)AuthorLines
2021-05-18add Align::ONE; add methods to access alloc.extraRalf Jung-1/+3
2021-05-16Auto merge of #85312 - ehuss:macro_use-unused-attr, r=petrochenkovbors-3/+0
Fix unused attributes on macro_rules. The `unused_attributes` lint wasn't firing on attributes of `macro_rules` definitions. The consequence is that many attributes are silently ignored on `macro_rules`. The reason is that `unused_attributes` is a late-lint pass, and only has access to the HIR, which does not have macro_rules definitions. My solution here is to change `non_exported_macro_attrs` to be `macro_attrs` (a list of all attributes used for `macro_rules`, instead of just those for `macro_export`), and then to check this list in the `unused_attributes` lint. There are a number of alternate approaches, but this seemed the most reliable and least invasive. I am open to completely different approaches, though. One concern is that I don't fully understand the implications of extending `non_exported_macro_attrs` to include non-exported macros. That list was originally added in #62042 to handle stability attributes, so I suspect it was just an optimization since that was all that was needed. It was later extended to be included in SVH in #83901. #80641 also added a use to check for `invalid` attributes, which seems a little odd to me (it didn't validate non-exported macros, and seems highly specific). Overall, there doesn't seem to be a clear story of when `unused_attributes` should be used versus an error like E0518. I considered alternatively using an "allow list" of built-in attributes that can be used on macro_rules (allow, warn, deny, forbid, cfg, cfg_attr, macro_export, deprecated, doc), but I feel like that could be a pain to maintain. Some built-in attributes already present hard-errors when used with macro_rules. These are each hard-coded in various places: - `derive` - `test` and `bench` - `proc_macro` and `proc_macro_derive` - `inline` - `global_allocator` The primary motivation is that I sometimes see people use `#[macro_use]` in front of `macro_rules`, which indicates there is some confusion out there (evident that there was even a case of it in rustc).
2021-05-15Windows mingw targets use gcc as the linker so the target spec should also ↵Luqman Aden-0/+1
indicate linker_is_gnu.
2021-05-15Fix unused attributes on macro_rules.Eric Huss-3/+0
2021-05-13Add asm!() support for PowerPC64Dr. Chat-5/+15
2021-05-11Add initial asm!() support for PowerPCDr. Chat-0/+171
This includes GPRs and FPRs only
2021-05-10Adjust target search algorithm for rustlib pathSimonas Kazlauskas-10/+66
With this the concerns expressed in #83800 should be addressed.
2021-05-09Auto merge of #83800 - xobs:impl-16351-nightly, r=nagisabors-4/+13
Add default search path to `Target::search()` The function `Target::search()` accepts a target triple and returns a `Target` struct defining the requested target. There is a `// FIXME 16351: add a sane default search path?` comment that indicates it is desirable to include some sort of default. This was raised in https://github.com/rust-lang/rust/issues/16351 which was closed without any resolution. https://github.com/rust-lang/rust/pull/31117 was proposed, however that has platform-specific logic that is unsuitable for systems without `/etc/`. This patch implements the suggestion raised in https://github.com/rust-lang/rust/issues/16351#issuecomment-180878193 where a `target.json` file may be placed in `$(rustc --print sysroot)/lib/rustlib/<target-triple>/target.json`. This allows shipping a toolchain distribution as a single file that gets extracted to the sysroot.
2021-05-07Rollup merge of #84930 - hermitcore:target, r=nagisaDylan DPC-1/+1
rename LLVM target for RustyHermit - RustyHermit is a library operating system, where the user- and the kernel-space use the same target - by a mistake a previous patch changes the target to an incorect value - this merge request revert the previous changes
2021-05-07rename LLVM target for RustyHermitStefan Lankes-1/+1
RustyHermit ist is a library operating system. In this case, we link a static library as kernel to the application. The final result is a bootable application. The library and the application have to use the same target. Currently, the targets are different (see also https://github.com/rust-lang/rust/blob/master/compiler/rustc_target/src/spec/x86_64_unknown_hermit.rs). Consequently, this commit change the LLVM target to 'hermit'. This kernel spec is needed to disable the usage of FPU registers, which are not allowed in kernel space. In contrast to Linux, everything is running in ring 0 and also in the same address space. Signed-off-by: Stefan Lankes <slankes@eonerc.rwth-aachen.de>
2021-05-06illumos should put libc last in library search orderJoshua M. Clulow-0/+11
Under some conditions, the toolchain will produce a sequence of linker arguments that result in a NEEDED list that puts libc before libgcc_s; e.g., [0] NEEDED 0x2046ba libc.so.1 [1] NEEDED 0x204723 libm.so.2 [2] NEEDED 0x204736 libsocket.so.1 [3] NEEDED 0x20478b libumem.so.1 [4] NEEDED 0x204763 libgcc_s.so.1 Both libc and libgcc_s provide an unwinder implementation, but libgcc_s provides some extra symbols upon which Rust directly depends. If libc is first in the NEEDED list we will find some of those symbols in libc but others in libgcc_s, resulting in undefined behaviour as the two implementations do not use compatible interior data structures. This solution is not perfect, but is the simplest way to produce correct binaries on illumos for now.
2021-05-03Rollup merge of #84072 - nagisa:target-family-two-the-movie, r=petrochenkovDylan DPC-29/+36
Allow setting `target_family` to multiple values, and implement `target_family="wasm"` As per the conclusion in [this thread](https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg.28wasm.29.3F/near/233158441), this implements an ability to specify any number of `target_family` values, allowing for more flexible generic groups, or "families", to be created than just the OS-based unix/windows dichotomy. cc https://github.com/rust-lang/reference/pull/1006
2021-05-03Set target_family="wasm" for wasm targetsSimonas Kazlauskas-1/+2
2021-05-01Auto merge of #84658 - Amanieu:reserved_regs, r=petrochenkovbors-9/+42
Be stricter about rejecting LLVM reserved registers in asm! LLVM will silently produce incorrect code if these registers are used as operands. cc `@rust-lang/wg-inline-asm`
2021-05-01Reserve x18 on AArch64 and un-reserve x16Amanieu d'Antras-3/+3
2021-04-29Change to probe-stack=call (instead of inline-or-call) everywhere again, for ↵Felix S. Klock II-31/+62
now. We had already reverted the change on stable back in PR #83412. Since then, we've had some movement on issue #83139, but not a 100% fix. But also since then, we had bug reported, issue #84667, that looks like outright codegen breakage, rather than problems confined to debuginfo issues. So we are reverting PR #77885 on stable and beta. We'll reland PR #77885 (or some variant) switching back to an LLVM-dependent selection of out-of-line call vs inline-asm, after these other issues have been resolved.
2021-04-28Be stricter about rejecting LLVM reserved registers in asm!Amanieu d'Antras-9/+42
2021-04-24Auto merge of #84310 - RalfJung:const-fn-feature-flags, r=oli-obkbors-1/+0
further split up const_fn feature flag This continues the work on splitting up `const_fn` into separate feature flags: * `const_fn_trait_bound` for `const fn` with trait bounds * `const_fn_unsize` for unsizing coercions in `const fn` (looks like only `dyn` unsizing is still guarded here) I don't know if there are even any things left that `const_fn` guards... at least libcore and liballoc do not need it any more. `@oli-obk` are you currently able to do reviews?
2021-04-25Merge remote-tracking branch 'upstream/master' into impl-16351-nightlySean Cross-409/+538
Signed-off-by: Sean Cross <sean@xobs.io>
2021-04-20Auto merge of #84334 - klensy:typo-compiler, r=jyn514bors-2/+2
fix few typos in comments
2021-04-19Rollup merge of #84126 - 12101111:musl-sanitizer, r=davidtwcoDylan DPC-1/+3
Enable sanitizers for x86_64-unknown-linux-musl Those 4 sanitizers get musl target support in LLVM 12 release.
2021-04-19fix few typosklensy-2/+2
2021-04-18fix feature use in rustc libsRalf Jung-1/+0
2021-04-14Replace get_mut(& with entry( for powerpc64le-unknown-freebsdpkubaj-1/+1
2021-04-14Switch powerpc64le-unknown-freebsd to or_default()pkubaj-1/+1
2021-04-13Avoid an `Option<Option<_>>`LingMan-2/+2
By simply swapping the calls to `map` and `and_then` around the complexity of handling an `Option<Option<_>>` disappears.
2021-04-11Allow setting `target_family` to multiple valuesSimonas Kazlauskas-29/+35
This enables us to set more generic labels shared between targets. For example `target_family="wasm"` across all targets that are conceptually "wasm". See https://github.com/rust-lang/reference/pull/1006
2021-04-09Enable sanitizers for x86_64-unknown-linux-musl12101111-1/+3
2021-04-08Auto merge of #84008 - Dylan-DPC:rollup-invxvg8, r=Dylan-DPCbors-1/+1
Rollup of 6 pull requests Successful merges: - #80733 (Improve links in inline code in `core::pin`.) - #81764 (Stabilize `rustdoc::bare_urls` lint) - #81938 (Stabilize `peekable_peek_mut`) - #83980 (Fix outdated crate names in compiler docs) - #83992 (Merge idents when generating source content) - #84001 (Update Clippy) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-04-08Fix outdated crate names in compiler docspierwill-1/+1
Changes `librustc_X` to `rustc_X`, only in documentation comments. Plain code comments are left unchanged. Also fix incorrect file paths.
2021-04-08rustc: Add a new `wasm` ABIAlex Crichton-103/+78
This commit implements the idea of a new ABI for the WebAssembly target, one called `"wasm"`. This ABI is entirely of my own invention and has no current precedent, but I think that the addition of this ABI might help solve a number of issues with the WebAssembly targets. When `wasm32-unknown-unknown` was first added to Rust I naively "implemented an abi" for the target. I then went to write `wasm-bindgen` which accidentally relied on details of this ABI. Turns out the ABI definition didn't match C, which is causing issues for C/Rust interop. Currently the compiler has a "wasm32 bindgen compat" ABI which is the original implementation I added, and it's purely there for, well, `wasm-bindgen`. Another issue with the WebAssembly target is that it's not clear to me when and if the default C ABI will change to account for WebAssembly's multi-value feature (a feature that allows functions to return multiple values). Even if this does happen, though, it seems like the C ABI will be guided based on the performance of WebAssembly code and will likely not match even what the current wasm-bindgen-compat ABI is today. This leaves a hole in Rust's expressivity in binding WebAssembly where given a particular import type, Rust may not be able to import that signature with an updated C ABI for multi-value. To fix these issues I had the idea of a new ABI for WebAssembly, one called `wasm`. The definition of this ABI is "what you write maps straight to wasm". The goal here is that whatever you write down in the parameter list or in the return values goes straight into the function's signature in the WebAssembly file. This special ABI is for intentionally matching the ABI of an imported function from the environment or exporting a function with the right signature. With the addition of a new ABI, this enables rustc to: * Eventually remove the "wasm-bindgen compat hack". Once this ABI is stable wasm-bindgen can switch to using it everywhere. Afterwards the wasm32-unknown-unknown target can have its default ABI updated to match C. * Expose the ability to precisely match an ABI signature for a WebAssembly function, regardless of what the C ABI that clang chooses turns out to be. * Continue to evolve the definition of the default C ABI to match what clang does on all targets, since the purpose of that ABI will be explicitly matching C rather than generating particular function imports/exports. Naturally this is implemented as an unstable feature initially, but it would be nice for this to get stabilized (if it works) in the near-ish future to remove the wasm32-unknown-unknown incompatibility with the C ABI. Doing this, however, requires the feature to be on stable because wasm-bindgen works with stable Rust.
2021-04-05rustc_target: Rely on defaults more in target specsVadim Petrochenkov-52/+6
2021-04-05Rollup merge of #83853 - Amanieu:asm_no_high_x86_64, r=nagisaDylan DPC-11/+3
Disallow the use of high byte registes as operands on x86_64 They are still allowed on x86 though. Fixes #83495 r? `@nagisa`
2021-04-05Disallow the use of high byte registes as operands on x86_64Amanieu d'Antras-11/+3
They are still allowed on x86 though. Fixes #83495
2021-04-05Rollup merge of #80525 - devsnek:wasm64, r=nagisaDylan DPC-7/+115
wasm64 support There is still some upstream llvm work needed before this can land.
2021-04-04wasm64Gus Caplan-7/+115
2021-04-03compiler: run `python3 ./x.py fmt`Sean Cross-5/+2
This fixes a build issue with formatting as part of #83800. Signed-off-by: Sean Cross <sean@xobs.io>
2021-04-03rustc: target: add sysroot to rust_target_pathSean Cross-4/+16
This enables placing a `target.json` file into the rust sysroot under the target-specific directory. Signed-off-by: Sean Cross <sean@xobs.io>
2021-04-03(De-)serialize the supported_sanitizersSimonas Kazlauskas-14/+59
2021-04-03Maintain supported sanitizers as a target propertySimonas Kazlauskas-10/+31
This commit adds an additional target property – `supported_sanitizers`, and replaces the hardcoded allowlists in argument parsing to use this new property. Fixes #81802
2021-04-03Move SanitizerSet to rustc_targetSimonas Kazlauskas-32/+87
2021-03-28linker: Use data execution prevention options by default when linker ↵Vadim Petrochenkov-73/+6
supports them
2021-03-28Auto merge of #83593 - petrochenkov:nounwrap, r=nagisabors-50/+50
rustc_target: Avoid unwraps when adding linker flags These `unwrap`s assume that some linker flags were already added by `*_base::opts()` methods, but that's doesn't necessarily remain the case when we are reducing the number of flags hardcoded in targets, as https://github.com/rust-lang/rust/pull/83587 shows. r? `@nagisa`
2021-03-28rustc_target: Avoid unwraps when adding linker flagsVadim Petrochenkov-61/+61
2021-03-28linker: Use `--as-needed` by default when linker supports itVadim Petrochenkov-94/+17
2021-03-27Add support for powerpc64le-unknown-freebsd.Piotr Kubaj-0/+17
2021-03-23Allow not emitting `uwtable` on Androidhyd-dev-1/+11
2021-03-21Move decision aboute noalias into codegen_llvmNikita Popov-2/+5
The frontend shouldn't be deciding whether or not to use mutable noalias attributes, as this is a pure LLVM concern. Only provide the necessary information and do the actual decision in codegen_llvm.
2021-03-17riscvgc-unknown-none-elf use lp64d ABIJustin Restivo-0/+1
2021-03-14Address review commentsAmanieu d'Antras-7/+7