about summary refs log tree commit diff
path: root/src/librustc_target/spec
AgeCommit message (Collapse)AuthorLines
2018-11-22Pass additional linker flags when targeting FuchsiaPetr Hosek-4/+15
This is a follow up to 8aa9267 which changed the driver to use lld directly rather than invoking it through Clang. This change ensures we pass all the necessary flags to lld.
2018-11-21Add x86_64-fortanix-unknown-sgx target to the compilerJethro Beekman-0/+74
2018-11-19Add `override_export_symbols` option to Rust target specificationJethro Beekman-0/+15
2018-11-15Add powerpc64-unknown-linux-musl targetSamuel Holland-0/+33
2018-11-15Add powerpc-unknown-linux-musl targetSamuel Holland-0/+32
2018-11-11rustc: Clean up allocator injection logicAlex Crichton-63/+0
This commit cleans up allocator injection logic found in the compiler around selecting the global allocator. It turns out that now that jemalloc is gone the compiler never actually injects anything! This means that basically everything around loading crates here and there can be easily pruned. This also removes the `exe_allocation_crate` option from custom target specs as it's no longer used by the compiler anywhere.
2018-11-10Set BINARYEN_TRAP_MODE=clampNikita Popov-1/+7
This avoids trapping in the -Zsaturating-float-casts implementation.
2018-11-08Rollup merge of #55659 - alexcrichton:musl-no-group, r=michaelwoeristerMark Rousskov-25/+0
rustc: Delete grouping logic from the musl target This commit deletes the injection of `-(` and `-)` options to the linker for the musl targets. This actually causes problems today on nightly if you execute: $ echo 'fn main() {}' >> foo.rs $ rustc --target x86_64-unknown-linux-musl -C panic=abort you get a linker error about "cannot nest groups". This comes about because rustc injects its own `--start-group` and `--end-group` variables which clash with the outer `-(` and `-)` variables. It's not entirely clear to me why this doesn't affect the musl target by default (in `-C panic=unwind` mode). The compiler's own injection of `--start-group` and `--end-group` should solve the issues mentioned in the comment for injecting `-(` and `-)` as well.
2018-11-06Auto merge of #55106 - petrhosek:fuchsia-lld, r=alexcrichtonbors-19/+10
Use lld directly for Fuchsia target Fuchsia already uses lld as the default linker, so there's no reason to always invoke it through Clang, instead we can simply invoke lld directly and pass the set of flags that matches Clang.
2018-11-05Use lld directly for Fuchsia targetPetr Hosek-19/+10
Fuchsia already uses lld as the default linker, so there's no reason to always invoke it through Clang, instead we can simply invoke lld directly and pass the set of flags that matches Clang.
2018-11-04rustc_target: pass contexts by reference, not value.Eduard-Mihai Burtescu-2/+2
2018-11-03rustc: Delete grouping logic from the musl targetAlex Crichton-25/+0
This commit deletes the injection of `-(` and `-)` options to the linker for the musl targets. This actually causes problems today on nightly if you execute: $ echo 'fn main() {}' >> foo.rs $ rustc --target x86_64-unknown-linux-musl -C panic=abort you get a linker error about "cannot nest groups". This comes about because rustc injects its own `--start-group` and `--end-group` variables which clash with the outer `-(` and `-)` variables. It's not entirely clear to me why this doesn't affect the musl target by default (in `-C panic=unwind` mode). The compiler's own injection of `--start-group` and `--end-group` should solve the issues mentioned in the comment for injecting `-(` and `-)` as well.
2018-11-02Use `jemalloc-sys` on Linux and OSX compilersAlex Crichton-1/+1
This commit adds opt-in support to the compiler to link to `jemalloc` in the compiler. When activated the compiler will depend on `jemalloc-sys`, instruct jemalloc to unprefix its symbols, and then link to it. The feature is activated by default on Linux/OSX compilers for x86_64/i686 platforms, and it's not enabled anywhere else for now. We may be able to opt-in other platforms in the future! Also note that the opt-in only happens on CI, it's otherwise unconditionally turned off by default. Closes #36963
2018-11-02Remove all jemalloc-related contentAlex Crichton-18/+0
This commit removes all jemalloc related submodules, configuration, etc, from the bootstrap, from the standard library, and from the compiler. This will be followed up with a change to use jemalloc specifically as part of rustc on blessed platforms.
2018-10-28msp430: remove the whole Atomic* APIJorge Aparicio-2/+7
PR #51953 enabled the Atomic*.{load,store} API on MSP430. Unfortunately, the LLVM backend doesn't currently support those atomic operations, so this commit removes the API and leaves instructions on how and when to enable it in the future.
2018-10-26Remove redundant cloneShotaro Yamada-4/+4
2018-10-19rename to thumbv8m.base-none-eabi, fix strict alignmenteV-1/+4
2018-10-13fix tidyeV-1/+1
2018-10-13targets: thumbv8m: Add target for baseline ARMv8-MeV-2/+37
2018-10-12rustc: Allow targets to specify SIMD args are by-valAlex Crichton-0/+15
The upcoming SIMD support in the wasm target is unique from the other platforms where it's either unconditionally available or not available, there's no halfway where a subsection of the program can use it but no other parts of the program can use it. In this world it's valid for wasm SIMD args to always be passed by value and there's no need to pass them by reference. This commit adds a new custom target specification option `simd_types_indirect` which defaults to `true`, but the wasm backend disables this and sets it to `false`.
2018-10-11Support for disabling the PLT on ELF targetsGabriel Majeri-0/+9
Disable the PLT where possible to improve performance for indirect calls into shared libraries. This optimization is enabled by default where possible. - Add the `NonLazyBind` attribute to `rustllvm`: This attribute informs LLVM to skip PLT calls in codegen. - Disable PLT unconditionally: Apply the `NonLazyBind` attribute on every function. - Only enable no-plt when full relro is enabled: Ensures we only enable it when we have linker support. - Add `-Z plt` as a compiler option
2018-09-27ignore {std,fast,vector,this}call on non-x86 windowsNathan Froyd-1/+11
MSVC ignores these keywords for C/C++ and uses the standard system calling convention. Rust should do so as well. Fixes #54569.
2018-09-22Rollup merge of #54402 - bgermann:master, r=alexcrichtonPietro Albini-1/+1
Use no_default_libraries for all NetBSD flavors The no_default_libraries was introduced in #28578 because the NetBSD-based rumprun needed to disable the link flag. This moves the definition to be used by all NetBSD linker flavors to close #49627. A different solution would be adding -lc but as there is no platform with explicit -lc, this approach is used.
2018-09-20Use no_default_libraries for all NetBSD flavorsbgermann-1/+1
The no_default_libraries was introduced in #28578 because the NetBSD-based rumprun needed to disable the link flag. This moves the definition to be used by all NetBSD linker flavors to close #49627. A different solution would be adding -lc but as there is no platform with explicit -lc, this approach is used.
2018-09-17Switch linker for aarch64-pc-windows-msvc from LLD to MSVC, since that seems ↵Michael Woerister-3/+2
to work better.
2018-09-13Auto merge of #53621 - jordanrh1:windows-arm, r=alexcrichtonbors-0/+51
Add target thumbv7a-pc-windows-msvc This is an early draft of support for Windows/ARM. To test it, 1. Install Visual Studio 2017 and Windows SDK version 17134. 1. Obtain alexcrichton/xz2-rs#35, rust-lang-nursery/compiler-builtins#256, and the fix for [LLVM Bug 38620](https://bugs.llvm.org/show_bug.cgi?id=38620). 2. Open a command prompt and run ``` set CC_thumbv7a-pc-windows-msvc=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\bin\HostX64\arm\CL.exe set CFLAGS_thumbv7a-pc-windows-msvc=/D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1 /nologo c:\python27\python.exe x.py build --host x86_64-pc-windows-msvc --build x86_64-pc-windows-msvc --target thumbv7a-pc-windows-msvc ``` It will build the stage 2 compiler, but fail building stage 2 test. To build an executable targeting windows/arm, 1. Copy `build\x86_64-pc-windows-msvc\stage0\bin\cargo.exe` to `build\x86_64-pc-windows-msvc\stage2\bin` 2. Open a command prompt and run ``` "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat" set PATH=build\x86_64-pc-windows-msvc\stage2\bin;%PATH% cargo new hello cd hello cargo build --target thumbv7a-pc-windows-msvc –release ``` Copy target\thumbv7a-pc-windows-msvc\release\hello.exe to your platform and run. There are a number of open issues that I'm hoping to get help with: - Error when compiling the `test` crate: `error: cannot link together two panic runtimes: panic_abort and panic_unwind` - Warnings when building the compiler_builtins crate: `warning: cl : Command line warning D9002 : ignoring unknown option '-fvisibility=hidden'`. It looks like the build system is passing GCC-style flags to MSVC. - How to specify the LIBPATH entries for ARM. Right now they are hardcoded as absolute paths in the target spec. This pull request depends on - alexcrichton/xz2-rs#35 - update vcxproj to Visual Studio 2017 - rust-lang-nursery/compiler-builtins#256 - fix compile errors when building for windows/arm - [Bug 38620 - ARM: Incorrect COFF relocation type for thumb bl instruction](https://bugs.llvm.org/show_bug.cgi?id=38620) This PR updates #52659
2018-09-12Expand comments in thumbv7a-pc-windows-msvc target specJordan Rhee-0/+8
2018-09-07Removed hardcoded paths and unnecessary LLVM featuresJordan Rhee-17/+2
2018-09-05Auto merge of #53878 - alexcrichton:wasm-atomics-feature, r=eddybbors-2/+1
rustc: Prepare the `atomics` feature for wasm This commit adds a few changes for atomic instructions on the `wasm32-unknown-unknown` target. Atomic instructions are not yet stable in WebAssembly itself but there are multiple implementations and LLVM has support for the proposed instruction set, so let's work on exposing it! Here there are a few inclusions: * The `atomics` feature was whitelisted for LLVM, allowing code in Rust to enable/disable/gate on this. * The `singlethread` option is turned off for wasm when the `atomics` feature is enabled. This means that by default wasm won't be lowering with atomics, but when atomics are enabled globally we'll turn off single-threaded mode to actually codegen atomics. This probably isn't what we'll want in the long term but for now it should work. * Finally the maximum atomic width is increased to 64 to reflect the current wasm spec.
2018-09-04Add target thumbv7a-pc-windows-msvcJordan Rhee-0/+58
2018-08-31rustc: Prepare the `atomics` feature for wasmAlex Crichton-2/+1
This commit adds a few changes for atomic instructions on the `wasm32-unknown-unknown` target. Atomic instructions are not yet stable in WebAssembly itself but there are multiple implementations and LLVM has support for the proposed instruction set, so let's work on exposing it! Here there are a few inclusions: * The `atomics` feature was whitelisted for LLVM, allowing code in Rust to enable/disable/gate on this. * The `singlethread` option is turned off for wasm when the `atomics` feature is enabled. This means that by default wasm won't be lowering with atomics, but when atomics are enabled globally we'll turn off single-threaded mode to actually codegen atomics. This probably isn't what we'll want in the long term but for now it should work. * Finally the maximum atomic width is increased to 64 to reflect the current wasm spec.
2018-08-30[RISCV] Disable atomics for riscv32imc-unknown-none-elf.David Craven-1/+2
2018-08-30[RISCV] Add riscv32imc-unknown-none-elf target.David Craven-14/+74
2018-08-30[RISCV] Enable C extension.David Craven-1/+1
2018-08-30[RISCV] Use lld as the default linker.David Craven-3/+4
2018-08-28Auto merge of #53679 - japaric:cortex-r, r=alexcrichtonbors-4/+129
add more Cortex-R targets This expands on PR #53663 to complete the set of Cortex-R targets and builds rust-std components for them. r? @alexcrichton each extra rust-std component (there's 4 of them) takes about 3 minutes to build on my local machine. In terms of stability (LLVM codegen bugs) these new targets should be as stable as the Cortex-M ones (e.g. `thumbv7m-none-eabi`). If the extra build time is too much we can leave the rust-std components out for now closes #53663 cc @paoloteti
2018-08-26more consistent llvm triplesJorge Aparicio-2/+2
2018-08-26add armebv7r-none-eabi targetJorge Aparicio-1/+42
2018-08-26set a default linker for the other Cortex-R targetsJorge Aparicio-4/+6
2018-08-26make the armebv7r target more consistent with the armv7r oneJorge Aparicio-1/+1
by removing the redundant +v7 feature
2018-08-26add armv7r-none-eabi targetJorge Aparicio-0/+41
2018-08-26Add target for Little-endian ARM Cortex-R4F/R5F MCUsPaolo Teti-0/+41
Similar to `armebv7r-none-eabihf`, but for Little-endian MCUs. As example TI RM4x/RM5x are Little-endian Cortex-R4F/R5F MCUs. CI/Dockerfile is intentionally in the disabled folder.
2018-08-24change the default linker of the ARM Cortex-M targetsJorge Aparicio-11/+10
to rust-lld so users won't need an external linker to build programs
2018-08-23use String::new() instead of String::from(""), "".to_string(), "".to_owned() ↵Matthias Krüger-68/+68
or "".into()
2018-08-20Auto merge of #52101 - japaric:linker-flavor, r=alexcrichtonbors-0/+44
try to infer linker flavor from linker name and vice versa This is a second take on PR #50359 that implements the logic proposed in https://github.com/rust-lang/rust/pull/50359#pullrequestreview-116663121 With this change it would become possible to link `thumb*` binaries using GNU's LD on stable as `-C linker=arm-none-eabi-ld` would be enough to change both the linker and the linker flavor from their default values of `arm-none-eabi-gcc` and `gcc`. To link `thumb*` binaries using rustc's LLD on stable `-Z linker-flavor` would need to be stabilized as `-C linker=rust-lld -Z linker-flavor=ld.lld` are both required to change the linker and the linker flavor, but this PR doesn't propose that. We would probably need some sort of stability guarantee around `rust-lld`'s name and availability to make linking with rustc's LLD truly stable. With this change it would also be possible to link `thumb*` binaries using a system installed LLD on stable using the `-C linker=ld.lld` flag (provided that `ld.lld` is a symlink to the system installed LLD). r? @alexcrichton
2018-08-18fully implement lld-flavorJorge Aparicio-0/+39
2018-08-18wasm32-unknown-unknown uses the WASM LLD flavorJorge Aparicio-0/+1
2018-08-18add lld_flavor info to target specJorge Aparicio-0/+4
this field defaults to the LD / GNU flavor
2018-08-15Start adding an `aarch64-pc-windows-msvc` targetAlex Crichton-0/+36
This commit adds the necessary definitions for target specs and such as well as the necessary support in libstd to compile basic `aarch64-pc-windows-msvc` binaries. The target is not currently built on CI, but it can be built locally with: ./configure --target=aarch64-pc-windows-msvc --set rust.lld ./x.py build src/libstd --target aarch64-pc-windows-msvc Currently this fails to build `libtest` due to a linker bug (seemingly in LLD?) which hasn't been investigate yet. Otherwise though with libstd you can build a hello world program (linked with LLD). I've not tried to execute it yet, but it at least links! Full support for this target is still a long road ahead, but this is hopefully a good stepping stone to get started. Points of note about this target are: * Currently defaults to `panic=abort` as support is still landing in LLVM for SEH on AArch64. * Currently defaults to LLD as a linker as I was able to get farther with it than I was with `link.exe`
2018-08-14Rollup merge of #53246 - ljedrz:cleanup_various, r=kennytmkennytm-8/+4
A few cleanups - change `skip(1).next()` to `nth(1)` - collapse some `if-else` expressions - remove a few explicit `return`s - remove an unnecessary field name - dereference once instead of matching on multiple references - prefer `iter().enumerate()` to indexing with `for` - remove some unnecessary lifetime annotations - use `writeln!()` instead of `write!()`+`\n` - remove redundant parentheses - shorten some enum variant names - a few other cleanups suggested by `clippy`