about summary refs log tree commit diff
path: root/src/librustc_target
AgeCommit message (Collapse)AuthorLines
2019-07-16Add supporting for vxWorksBaoshan Pang-1/+398
r? @alexcrichton
2019-07-15SGX target: don't pretend to be GNU/Linux to LLVMJethro Beekman-1/+1
2019-07-15rustc: precompute the largest Niche and store it in LayoutDetails.Eduard-Mihai Burtescu-0/+20
2019-07-15rustc_target: move abi::Niche from rustc::ty::layout.Eduard-Mihai Burtescu-0/+51
2019-07-13Make `newtype_index` hygienic and use allow_internal_unstableMatthew Jasper-5/+1
2019-07-10Rollup merge of #62474 - nikic:update-llvm, r=alexcrichtonMazdak Farrokhzad-44/+44
Prepare for LLVM 9 update Main changes: * In preparation for opaque pointer types, the `byval` attribute now takes a type. As such, the argument type needs to be threaded through to the function/callsite attribute application logic. * On ARM the `+fp-only-sp` and `+d16` features have become `-fp64` and `-d32`. I've switched the target definitions to use the new names, but also added bidirectional emulation so either can be used on any LLVM version for backwards compatibility. * The datalayout can now specify function pointer alignment. In particular on ARM `Fi8` is specified, which means that function pointer alignment is independent of function alignment. I've added this to our datalayouts to match LLVM (which is something we check) and strip the fnptr alignment for older LLVM versions. * The fmul/fadd reductions now always respect the accumulator (including for unordered reductions), so we should pass the identity instead of undef. Open issues: * https://reviews.llvm.org/D62106 causes linker errors with ld.bdf due to https://sourceware.org/bugzilla/show_bug.cgi?id=24784. To avoid this I've enabled `RelaxELFRelocations`, which results in a GOTPCRELX relocation for `__tls_get_addr` and avoids the issue. However, this is likely not acceptable because relax relocations are not supported by older linker versions. We may need an LLVM option to keep using PLT for `__tls_get_addr` despite `RtLibUseGOT`. The corresponding llvm-project PR is https://github.com/rust-lang/llvm-project/pull/19. r? @ghost
2019-07-10Rollup merge of #62283 - fintelia:patch-5, r=Mark-SimulacrumMazdak Farrokhzad-2/+2
Target::arch can take more than listed options A list of options in a comment like this is almost guaranteed to become out of date: right now it is missing "riscv32" and "riscv64" and perhaps other architectures as well.
2019-07-09Add function pointer alignment to ARM/Thumb data layoutNikita Popov-32/+32
2019-07-09Use new feature names in target feature listsNikita Popov-12/+12
2019-07-07Auto merge of #59800 - Zoxc:less-dylibs, r=alexcrichtonbors-6/+0
rustc: Remove `dylib` crate type from most rustc crates Revival of https://github.com/rust-lang/rust/pull/56987 cc @alexcrichton r? @michaelwoerister
2019-07-07rustc: Remove `dylib` crate type from most rustc cratesAlex Crichton-6/+0
Now that procedural macros no longer link transitively to libsyntax, this shouldn't be needed any more! This commit is an experiment in removing all dynamic libraries from rustc except for librustc_driver itself. Let's see how far we can get with that!
2019-07-07Auto merge of #62281 - Disasm:riscv-pic, r=nagisabors-0/+2
Add support for pc-relative addressing on 64-bit RISC-V These changes allow Rust to generate position-independent code on `riscv64` targets with code model `medium`. Closes: https://github.com/rust-lang/rust/issues/59802 See also: https://github.com/rust-embedded/riscv-rt/issues/25, https://github.com/rust-embedded/wg/issues/218
2019-07-05Rollup merge of #62380 - eddyb:x64-sysv-regs, r=nagisaMazdak Farrokhzad-9/+24
rustc_target: avoid negative register counts in the SysV x86_64 ABI. Because `needed_{int,sse}` and `{int,sse}_regs` were only used with integer literals, they were inferred to `i32` and `{int,sse}_regs` could therefore be negative. There was a check which prevented that, but *only* for aggregate arguments, not scalars. Fixes #62350. r? @nagisa or @rkruppe
2019-07-05Rollup merge of #61545 - flip1995:internal_lints, r=oli-obkMazdak Farrokhzad-1/+0
Implement another internal lints cc #49509 This adds ~~two~~ one internal lint~~s~~: 1. LINT_PASS_IMPL_WITHOUT_MACRO: Make sure, that the `{declare,impl}_lint_pass` macro is used to implement lint passes. cc #59669 2. ~~USAGE_OF_TYCTXT_AND_SPAN_ARGS: item 2 on the list in #49509~~ ~~With 2. I wasn't sure, if this lint should be applied everywhere. That means a careful review of 0955835 would be great. Also 73fb9b4 allows this lint on some functions. Should I also apply this lint there?~~ TODO (not directly relevant for review): - [ ] https://github.com/rust-lang/rust/pull/59316#discussion_r280186517 (not sure yet, if this works or how to query for `rustc_private`, since it's not in [`Features`](https://doc.rust-lang.org/nightly/nightly-rustc/syntax/feature_gate/struct.Features.html) :thinking: cc @eddyb) - [x] https://github.com/rust-lang/rust/pull/61735#discussion_r292389870 - [x] Check explicitly for the `{declare,impl}_lint_pass!` macros r? @oli-obk
2019-07-05rustc_target: avoid negative register counts in the SysV x86_64 ABI.Eduard-Mihai Burtescu-9/+24
2019-07-03Rollup merge of #62021 - crlf0710:msvc_link_output_improve, r=alexcrichtonMark Rousskov-0/+4
MSVC link output improve Resolves #35785. However i haven't come up with a idea to add test case for this :( r? @retep998
2019-07-01Target::arch can take more than listed optionsJonathan Behrens-2/+2
A list of options in a comment like this is almost guaranteed to become out of date. This list is missing "riscv32" and "riscv64" and perhaps other architectures as well.
2019-07-01Use code model 'medium' for 64-bit RISC-V targetsVadim Kaushan-0/+2
2019-06-27Rollup merge of #62131 - Xanewok:clip-some-nits, r=petrochenkovMazdak Farrokhzad-1/+1
libsyntax: Fix some Clippy warnings When I was working on it before a lot of these popped up in the RLS so I figured I'll send a small patch fixing only the (hopefully) uncontroversial ones. Others that could be also fixed included also [`clippy::print_with_newline`](https://rust-lang.github.io/rust-clippy/master/index.html#print_with_newline) and [`clippy::cast_lossless`](https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless). Should I add them as well? since most of it touches libsyntax... r? @petrochenkov
2019-06-27Added comment description.CrLF0710-0/+3
2019-06-26Fix clippy::redundant_field_namesIgor Matuszewski-1/+1
2019-06-26Auto merge of #62072 - eddyb:generator-memory-index, r=tmandrybors-1/+10
rustc: correctly transform memory_index mappings for generators. Fixes #61793, closes #62011 (previous attempt at fixing #61793). During #60187, I made the mistake of suggesting that the (re-)computation of `memory_index` in `ty::layout`, after generator-specific logic split/recombined fields, be done off of the `offsets` of those fields (which needed to be computed anyway), as opposed to the `memory_index`. `memory_index` maps each field to its in-memory order index, which ranges over the same `0..n` values as the fields themselves, making it a bijective mapping, and more specifically a permutation (indeed, it's the permutation resulting from field reordering optimizations). Each field has an unique "memory index", meaning a sort based on them, even an unstable one, will not put them in the wrong order. But offsets don't have that property, because of ZSTs (which do not increase the offset), so sorting based on the offset of fields alone can (and did) result in wrong orders. Instead of going back to sorting based on (slices/subsets of) `memory_index`, or special-casing ZSTs to make sorting based on offsets produce the right results (presumably), as #62011 does, I opted to drop sorting altogether and focus on `O(n)` operations involving *permutations*: * a permutation is easily inverted (see the `invert_mapping` `fn`) * an `inverse_memory_index` was already employed in other parts of the `ty::layout` code (that is, a mapping from memory order to field indices) * inverting twice produces the original permutation, so you can invert, modify, and invert again, if it's easier to modify the inverse mapping than the direct one * you can modify/remove elements in a permutation, as long as the result remains dense (i.e. using every integer in `0..len`, without gaps) * for splitting a `0..n` permutation into disjoint `0..x` and `x..n` ranges, you can pick the elements based on a `i < x` / `i >= x` predicate, and for the latter, also subtract `x` to compact the range to `0..n-x` * in the general case, for taking an arbitrary subset of the permutation, you need a renumbering from that subset to a dense `0..subset.len()` - but notably, this is still `O(n)`! * you can merge permutations, as long as the result remains disjoint (i.e. each element is unique) * for concatenating two `0..n` and `0..m` permutations, you can renumber the elements in the latter to `n..n+m` * some of these operations can be combined, and an inverse mapping (be it a permutation or not) can still be used instead of a forward one by changing the "domain" of the loop performing the operation I wish I had a nicer / more mathematical description of the recombinations involved, but my focus was to fix the bug (in a way which preserves information more directly than sorting would), so I may have missed potential changes in the surrounding generator layout code, that would make this all more straight-forward. r? @tmandry
2019-06-25rustc: correctly transform memory_index mappings for generators.Eduard-Mihai Burtescu-1/+10
2019-06-24Just switch to English linker output using environment variable when using msvc.CrLF0710-0/+1
2019-06-24Enable internal lints in bootstrapflip1995-1/+0
2019-06-23Fix meta-variable binding errors in macrosJulien Cretin-3/+3
The errors are either: - The meta-variable used in the right-hand side is not bound (or defined) in the left-hand side. - The meta-variable used in the right-hand side does not repeat with the same kleene operator as its binder in the left-hand side. Either it does not repeat enough, or it uses a different operator somewhere. This change should have no semantic impact.
2019-06-15Rollup merge of #61844 - AaronKutch:master, r=CentrilMazdak Farrokhzad-1/+1
Change `...` to `..=` where applicable This is mainly to fix #61816, but I decided to manually check a few thousand `...` throughout the code base to check for any other cases. I think I found a documentation bug in `src\libsyntax\ast.rs` where both `1..` and `1...` where mentioned. If there is internal support for both `1..` and `1..=` (that can exist before error handling gets to it), then I can add that back. There were some other cases that look like `// struct Closure<'l0...'li, T0...Tj, CK, CS, U0...Uk> {`, `// <P0 as Trait<P1...Pn>>::Foo: 'a`, and `assert!(min <= max, "discriminant range is {}...{}", min, max);`, but I am not sure if I should change those. There are a bunch of cases in the `/test/` directory that could be changed, but I presume I should just leave those be.
2019-06-15Auto merge of #59752 - Zoxc:dylib-fix, r=alexcrichtonbors-0/+14
Limit dylib symbols This makes `windows-gnu` match the behavior of `windows-msvc`. It probably doesn't make sense to export these symbols on other platforms either.
2019-06-14Change `...` to `..=` where applicableAaron Kutch-1/+1
2019-06-13Rollup merge of #61761 - lzutao:target-tuple-solaris, r=varkorMazdak Farrokhzad-8/+10
Add an alias for x86_64-sun-solaris target tuple Closes #40531 r? @varkor
2019-06-13Rollup merge of #61675 - fintelia:riscv-frame-pointer, r=nagisaMazdak Farrokhzad-0/+4
Include frame pointer for bare metal RISC-V targets This changes the default setting to enable the use of the frame pointer register when targeting RISC-V. On that architecture there is a dedicated frame pointer register which LLVM would otherwise never use so there is no increase in register pressure. Further, since these are bare metal targets, getting backtraces without the frame pointer is considerably more difficult (you can't just ask the OS to load the ELF executable and parse DWARF symbols). It is true that this setting can also be changed with the `-C force-frame-pointers` flag but that won't impact the compilation of the standard library, meaning that backtraces from, say, a panic handler would be useless.
2019-06-12Add a limit_rdylib_exports option and disable it for SolarisJohn Kåre Alsaker-0/+14
2019-06-12Add an alias for x86_64-sun-solaris target tupleLzu Tao-8/+10
2019-06-11rustc_target: deny(unused_lifetimes).Eduard-Mihai Burtescu-1/+2
2019-06-08Include frame pointer for bare metal RISC-V targetsJonathan Behrens-0/+4
2019-06-05Don't use GNU noexec stack notecoypoop-3/+0
NetBSD ignores this note and marks the stack no-exec unconditionally
2019-05-27Add `to_symbol` methods.Nicholas Nethercote-0/+9
2019-05-15Auto merge of #60775 - hellow554:no_bitrig, r=joshtriplettbors-42/+0
Remove bitrig support from rust Resolves #60743 using `find` and `rg` I delete every occurence of "bitrig" in the sources, expect for the llvm submodule (is this correct?). There's also this file https://github.com/rust-lang/rls/blob/5b8e99bb61958ca8abcb7c5eda70521726be1065/rls-analysis/test_data/rust-analysis/libstd-af9bacceee784405.json which contains a bitrig string in it. What to do with that?
2019-05-13default to $ARCH-apple-macosx10.7.0 LLVM triple for darwin targetsNathan Froyd-12/+5
Over in #60378, we made `rustc` switch LLVM target triples dynamically based on the `MACOSX_DEPLOYMENT_TARGET` environment variable. This change was made to align with `clang`'s behavior, and therefore make cross-language LTO feasible on OS X. Otherwise, `rustc` would produce LLVM bitcode files with a target triple of `x86_64-apple-darwin`, `clang` would produce LLVM bitcode files with a target triple of `x86_64-apple-macosx$VERSION`, and the linker would complain. This change worked fine, except for one corner case: if you didn't have `MACOSX_DEPLOYMENT_TARGET` set, and you wanted to do LTO on just Rust code, you'd get warning messages similar to: ``` warning: Linking two modules of different target triples: ' is 'x86_64-apple-macosx10.7.0' whereas 'main.7rcbfp3g-cgu.4' is 'x86_64-apple-darwin' ``` This message occurs because libstd is compiled with `MACOSX_DEPLOYMENT_TARGET` set to 10.7. The LLVM bitcode distributed in libstd's rlibs, then, is tagged with the target triple of `x86_64-apple-macosx10.7.0`, while the bitcode `rustc` produces for "user" code is tagged with the target triple of `x86_64-apple-darwin`. It's not good to have LTO on just Rust code (probably much more common than cross-language LTO) warn by default. These warnings also break Cargo's testsuite. This change defaults to acting as though `MACOSX_DEPLOYMENT_TARGET` was set to 10.7. "user" code will then be given a target triple that is equivalent to the target triple libstd bitcode is already using. The above warning will therefore go away. `rustc` already assumes that compiling without `MACOSX_DEPLOYMENT_TARGET` means that we're compiling for a target compatible with OS X 10.7 (e.g. that things like TLS work properly). So this change is really just making things conform more closely to the status quo. (It's also worth noting that before and after this patch, compiling with `MACOSX_DEPLOYMENT_TARGET` set to, say, 10.9, works just fine: target triples with an "apple" version ignore OS versions when checking compatibility, so bitcode with a `x86_64-apple-macosx10.7.0` triple works just fine with bitcode with a `x86_64-apple-macosx10.9.0` triple.)
2019-05-13Remove bitrig support from rustMarcel Hellwig-42/+0
2019-05-09Omit the vendor component in the WASI tripleDan Gohman-18/+18
This renames wasm32-unknown-wasi to wasm32-wasi, omitting the vendor component. This follows aarch64-linux-android, x86_64-fuchsia, and others in omitting the vendor field, which has the advantage of aligning with the [multiarch tuple](https://wiki.debian.org/Multiarch/Tuples), and of being less noisy.
2019-05-08Auto merge of #60378 - froydnj:apple-target-modifications, r=michaelwoeristerbors-10/+40
conditionally modify darwin targets to macosx targets with versions We need this behavior so that Rust LLVM IR objects match the target triple for Clang LLVM IR objects. This matching then convinces the linker that yes, you really can do cross-language LTO with objects from different compilers. The newly-added tests seem to pass locally on x86_64-unknown-linux-gnu. I haven't done a full test run or tried the new compiler in an cross-language LTO setup yet.
2019-05-07choose a more specific LLVM target on OS X when necessaryNathan Froyd-10/+40
This behavior matches clang's behavior, and makes cross-language LTO possible. Fixes #60235.
2019-05-05Auto merge of #60237 - saleemjaffer:issue-56166-miri-fntype-arg-passing, r=eddybbors-0/+31
Move pointee_info_at from rustc_codegen_llvm to rustc_target. Makes progress towards #56166. This is a continuation of https://github.com/rust-lang/rust/pull/57150. @oli-obk Should I close the older PR?
2019-05-04removing param_env from pointee_info_atSaleem Jaffer-7/+2
2019-05-04adding HasParamEnv traitSaleem Jaffer-9/+0
2019-05-04adding is_freeze to TyLayoutMethodsSaleem Jaffer-0/+9
2019-05-04tidy fixesSaleem Jaffer-1/+3
2019-05-04impl `pointee_info_at` in TyLayout.Daan de Graaf-0/+4
2019-05-04Add param_env parameter to pointee_info_at.Daan de Graaf-1/+4
An associated type ParamEnv has been added to TyLayoutMethods to facilitate this.