summary refs log tree commit diff
path: root/src/librustc_target
AgeCommit message (Collapse)AuthorLines
2020-07-10Reoder order in which MinGW libs are linkedMateusz Mikuła-1/+1
2020-05-31Auto merge of #72116 - petrhosek:fuchsia-ld-flags, r=tmandrybors-0/+7
Update the Fuchsia linker defaults This updates the linker defaults aligning them with Clang. Specifically, we use 4K pages on all platforms, we always use BIND_NOW, we prefer all loadable segments be separate and page aligned, and we support RELR relocations.
2020-05-29Rollup merge of #72439 - westernmagic:master, r=AmanieuRalf Jung-3/+75
NVPTX support for new asm! This PR implements the new `asm!` syntax for the `nvptx64-nvidia-cuda` target. r? @Amanieu
2020-05-29Rollup merge of #71804 - petrochenkov:static-pie, r=cuviperRalf Jung-0/+5
linker: Support `-static-pie` and `-static -shared` This PR adds support for passing linker arguments for creating statically linked position-independent executables and "statically linked" shared libraries. Therefore it incorporates the majority of https://github.com/rust-lang/rust/pull/70740 except for the linker rerun hack and actually flipping the "`static-pie` is supported" switch for musl targets.
2020-05-28update data layout for illumos x86Joshua M. Clulow-1/+2
In a recent change, 8b199222cc92667cd0e57595ad435cd0a7526af8, adjustments were made to the data layout we pass to LLVM. Unfortunately, the illumos target was missed in this change. See also: https://github.com/rust-lang/rust/pull/67900
2020-05-26Export ZERO_AR_DATE for macos linker invocationsAlex Crichton-0/+11
This commit attempts to improve reproducibility of builds on macOS by exporting the `ZERO_AR_DATE=1` environment variable for all invocations of the linker. While it looks like this env var is targeted at just the `ar` command (which does actually read this) it appears that recent-ish versions of the linker *also* read this environment variable. This env var forces the linker to set a deterministic zero value for the mtime in the N_OSO field of the object file. Currently it's believe that older versions of the linker will simply ignore this env var, while newer versions will read it and produce a deterministic output for compilations with debuginfo. Closes #47086 Closes #66568
2020-05-24Added comment on there being no predefined registersMichal Sudwoj-0/+2
2020-05-24Deduplicated macro codeMichal Sudwoj-27/+5
2020-05-24Minor fixes, as requested in PR reviewMichal Sudwoj-50/+27
2020-05-24Formatted correctlyMichal Sudwoj-3/+1
2020-05-24NVPTX support for new asm!Michal Sudwoj-0/+117
2020-05-23Fix ice-72487Gary Guo-13/+13
2020-05-22Rollup merge of #72304 - petrochenkov:sgxunwind, ↵Ralf Jung-3/+1
r=nikomatsakis,jethrogb,dingelish rustc_target: Avoid an inappropriate use of `post_link_objects` It isn't supposed to be used for linking libraries. Also linking libunwind unconditionally (and not together with the `src/libunwind` crate) is suspicious. @jethrogb @VardhanThigle Could you verify that it works as expected?
2020-05-22Rollup merge of #72133 - bdbai:master, r=joshtriplettRalf Jung-0/+31
Add target thumbv7a-uwp-windows-msvc Add target spec for thumbv7a-uwp-windows-msvc, so that libraries written in Rust will have a chance to run on ARM-based devices with Windows 10. So far I managed to create a proof-of-concept library for Universal Windows Platform apps to consume and it worked on a Windows Phone. However, building a standalone executable seemed troublesome due to `LLVM ERROR: target does not implement codeview register mapping` stuff (see also https://github.com/rust-lang/rust/issues/52659#issuecomment-408233322 ). Steps to test: 1. Clone and build this version ```sh git clone https://github.com/bdbai/rust.git cd rust python x.py build -i --target thumbv7a-uwp-windows-msvc --stage 1 src/libstd rustup toolchain link arm-uwp-stage1 .\build\x86_64-pc-windows-msvc\stage1\ ``` 2. Create a new library crate ```sh cargo new --lib arm-uwp-test cd arm-uwp-test ``` 3. Change `crate-type` in `Cargo.toml` to `staticlib` ```toml [lib] crate-type=["staticlib"] ``` 4. Replace the following code in `src/lib.rs` ```rust #[no_mangle] pub extern "system" fn call_rust() -> i32 { 2333 } ``` 5. Build the crate ```sh cargo +arm-uwp-stage1 build -v --target thumbv7a-uwp-windows-msvc ``` 6. `arm-uwp-test.lib` should appear in `target\thumbv7a-uwp-windows-msvc\debug` To consume this library: 1. Make sure Visual Studio 2017 and Windows 10 SDK (10.0.17134 or above) are installed 2. Create a new Blank App (C++/WinRT) in Visual Studio 2017 (Visual Studio 2019 cannot deploy UWP apps to Windows Phone) 3. Go to Property Pages, and then Linker->Input->Additional Dependencies, add `arm-uwp-test.lib` produced just now 4. Manually declare function prototypes in `MainPage.h` ```c++ extern "C" { int call_rust(); } ``` 5. Replace the `ClickHandler` part in `MainPage.cpp` ```c++ myButton().Content(box_value(std::to_wstring(call_rust()))); ``` 6. Build and deploy this app to an ARM device running Windows 10. The app should run and show `2333` when the button is clicked.
2020-05-20llvm: Expose tiny code model to usersVadim Petrochenkov-1/+1
2020-05-20rustc_target: Avoid an inappropriate use of `post_link_objects`Vadim Petrochenkov-3/+1
2020-05-20rustc_target: Add a target spec option for static-pie supportVadim Petrochenkov-0/+5
2020-05-20Auto merge of #71769 - petrochenkov:crto, r=cuviperbors-82/+290
linker: More systematic handling of CRT objects Document which kinds of `crt0.o`-like objects we link and in which cases, discovering bugs in process. `src/librustc_target/spec/crt_objects.rs` is the place to start reading from. This PR also automatically contains half of the `-static-pie` support (https://github.com/rust-lang/rust/pull/70740), because that's one of the six cases that we need to consider when linking CRT objects. This is a breaking change for custom target specifications that specify CRT objects. Closes https://github.com/rust-lang/rust/issues/30868
2020-05-18Simplify register name output for x86Amanieu d'Antras-8/+7
2020-05-18Move InlineAsmTemplatePiece and InlineAsmOptions to librustc_astAmanieu d'Antras-56/+2
2020-05-18The h modifier is only supported by reg_abcdAmanieu d'Antras-1/+1
2020-05-18Implement att_syntax optionAmanieu d'Antras-0/+1
2020-05-18Add notes about functions that are not currently usedAmanieu d'Antras-6/+26
2020-05-18Add support for high byte registers on x86Amanieu d'Antras-50/+138
2020-05-18Apply review feedbackAmanieu d'Antras-59/+72
2020-05-18Add inline asm register definitions to librustc_targetAmanieu d'Antras-1/+1448
2020-05-16rustc_target: Stop using "string typing" for code modelsVadim Petrochenkov-12/+62
Introduce `enum CodeModel` instead.
2020-05-15Rollup merge of #72062 - overdrivenpotato:psp, r=jonas-schievinkDylan DPC-0/+86
Add built in PSP target This adds a new target, `mipsel-sony-psp`, corresponding to the Sony PSP. The linker script is necessary to handle special sections, which are required by the target. This has been tested with my [rust-psp] crate and I can confirm it works as intended. The linker script is taken from [here]. It has been slightly adapted to work with rust and LLD. The `stdarch` submodule was also updated in order for `libcore` to build successfully. [rust-psp]: https://github.com/overdrivenpotato/rust-psp [here]: https://github.com/pspdev/pspsdk/blob/master/src/base/linkfile.prx.in
2020-05-14Rewrite link script from scratchMarko Mijalkovic-276/+21
This absolves previous licensing issues.
2020-05-14linker: More systematic handling of CRT objectsVadim Petrochenkov-82/+290
2020-05-12Add target thumbv7a-uwp-windows-msvcbdbai-0/+31
2020-05-11Update the Fuchsia linker defaultsPetr Hosek-0/+7
This updates the linker defaults aligning them with Clang. Specifically, we use 4K pages on all platforms, we always use BIND_NOW, we prefer all loadable segments be separate and page aligned, and we support RELR relocations.
2020-05-10Renamed lld_link_script to link_script and support all GNU-like linkersMarko Mijalkovic-7/+9
2020-05-10Add lld_link_script to TargetOptionsMarko Mijalkovic-15/+8
2020-05-09FormattingMarko Mijalkovic-8/+4
2020-05-09Add mipsel-sony-psp targetMarko Mijalkovic-0/+350
2020-05-09Rollup merge of #71234 - maurer:init-array, r=cuviperRalf Jung-0/+8
rustllvm: Use .init_array rather than .ctors LLVM TargetMachines default to using the (now-legacy) .ctors representation of init functions. Mixing .ctors and .init_array representations can cause issues when linking with lld. This happens in practice for: * Our profiling runtime which is currently implicitly built with .init_array since it is built by clang, which sets this field. * External C/C++ code that may be linked into the same process. Fixes: #71233
2020-05-08Rollup merge of #72017 - ctaggart:wasm2, r=ecstatic-morseDylan DPC-0/+4
Work around ICEs during cross-compilation for target, ast, & attr This applies the fix for #72003 to work around #56935 to three more libraries. With these additional fixes, I'm able to use rustfmt_lib from wasm (https://github.com/rust-lang/rustfmt/issues/4132#issuecomment-616587989), which was my goal. To get it working locally and to test, I copied the `.cargo/registry/src` and applied the fix and replaced the reference in my project: ``` toml [replace] "rustc-ap-rustc_span:656.0.0" = { path = "../rustc-ap-rustc_span" } "rustc-ap-rustc_target:656.0.0" = { path = "../rustc-ap-rustc_target" } "rustc-ap-rustc_ast:656.0.0" = { path = "../rustc-ap-rustc_ast" } "rustc-ap-rustc_attr:656.0.0" = { path = "../rustc-ap-rustc_attr" } ```
2020-05-08Work around ICEs during cross-compilationCameron Taggart-0/+4
2020-05-07Provide configurable LLVM cmdline section via target specTom Karpiniec-0/+16
The App Store performs certain sanity checks on bitcode, including that an acceptable set of command line arguments was used when compiling a given module. For Rust code to be distributed on the app store with bitcode rustc must pretend to have the same command line arguments.
2020-05-07Force embed-bitcode on non-simulator iOS/tvOS targetsTom Karpiniec-0/+7
At this time Apple recommends Bitcode be included for iOS apps, and requires it for tvOS. It is unlikely that a developer would want to disable bitcode when building for these targets, yet by default it will not be generated. This presents a papercut for developers on those platforms. Introduces a new TargetOption boolean key for specific triples to indicate that bitcode should be generated, even if cargo attempts to optimise with -Cembed-bitcode=no.
2020-05-01Auto merge of #71623 - petrochenkov:localink, r=estebankbors-4/+0
Disable localization for all linkers We previously disabled non-English output from `link.exe` due to encoding issues (#35785). In https://github.com/rust-lang/rust/pull/70740 it was pointed out that it also prevents correct inspection of the linker output, which we have to do occasionally. So this PR disables localization for all linkers.
2020-04-29Use .init_array rather than .ctorsMatthew Maurer-0/+8
LLVM TargetMachines default to using the (now-legacy) .ctors representation of init functions. Mixing .ctors and .init_array representations can cause issues when linking with lld. This happens in practice for: * Our profiling runtime which is currently implicitly built with .init_array since it is built by clang, which sets this field. * External C/C++ code that may be linked into the same process. To support legacy systems which may use .ctors, targets may now specify that they use .ctors via the use_ctors attribute which defaults to false. For debugging and manual control, -Z use-ctors-section=yes/no will allow manual override. Fixes: #71233
2020-04-27Disable localization for all linkersVadim Petrochenkov-4/+0
2020-04-26rustc_target: Stop using "string typing" for TLS modelsVadim Petrochenkov-11/+61
Introduce `enum TlsModel` instead.
2020-04-26rustc_target: Stop using "string typing" for relocation modelsVadim Petrochenkov-42/+103
Introduce `enum RelocModel` instead.
2020-04-24Avoid unused Option::map resultsJosh Stone-18/+19
These are changes that would be needed if we add `#[must_use]` to `Option::map`, per #71484.
2020-04-16rustc_target::abi: add Primitive variant to FieldsShape.Ana-Maria Mihalache-9/+29
2020-04-16Rollup merge of #71145 - pfmooney:illumos-triple, r=nagisaDylan DPC-0/+75
Add illumos triple This fixes rust-lang/rust#55553 and adds support for `illumos` as a `target_os` on `x86_64`. In addition to the compile spec and libstd additions, several library dependencies have been bumped in order to permit working builds of cargo and rustup for the new target. Work originally started by @jasonbking, with subsequent additions by @pfmooney and @jclulow.
2020-04-14Add illumos triplePatrick Mooney-0/+75
Co-Authored-By: Jason King <jason.brian.king@gmail.com> Co-Authored-By: Joshua M. Clulow <jmc@oxide.computer>