about summary refs log tree commit diff
path: root/src/librustc_back/target
AgeCommit message (Collapse)AuthorLines
2018-04-26Rename rustc_back::target to rustc_target::spec.Irina Popa-5139/+0
2018-04-26rustc_back: move LinkerFlavor, PanicStrategy, and RelroLevel to target.Irina Popa-188/+220
2018-04-21rustc: Always emit `uwtable` on AndroidAlex Crichton-0/+11
Long ago (#40549) we enabled the `uwtable` attribute on Windows by default (even with `-C panic=abort`) to allow unwinding binaries for [stack unwinding information][winstack]. It looks like this same issue is [plaguing][arm1] Gecko's Android platforms [as well][arm2]. This commit applies the same fix as #40549 except that this time it's applied for all Android targets. Generating a `-C panic=abort` binary for `armv7-linux-androideabi` before this commit generated a number of `cantunwind` functions (detected with `readelf -u`) but after this commit they all list appropriate unwind information. Closes #49867 [winstack]: https://bugzilla.mozilla.org/show_bug.cgi?id=1302078 [arm1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1453220 [arm2]: https://bugzilla.mozilla.org/show_bug.cgi?id=1451741
2018-04-06refactor: simplify `needs_gdb_debug_scripts_section`Jorge Aparicio-0/+3
2018-04-06add emit_debug_gdb_scripts target option and ..Jorge Aparicio-0/+16
set it to false for no-std targets like ARM Cortex-M and MSP430. For the rationale of this change see the comment in thumb_base.rs
2018-03-26Add a hash when a TargetPath is displayedPhilipp Oppermann-1/+20
2018-03-26Canonicalize pathsPhilipp Oppermann-2/+8
2018-03-26Introduce a TargetTriple enum to support absolute target pathsPhilipp Oppermann-25/+64
2018-03-16Auto merge of #48896 - alexcrichton:bitcode-in-object, r=michaelwoeristerbors-0/+6
rustc: Enable embedding LLVM bitcode for iOS This commit updates rustc to embed bitcode in each object file generated by default when compiling for iOS. This was determined in #35968 as a step towards better compatibility with the iOS toolchain, so let's give it a spin and see how it turns out! Note that this also updates the `cc` dependency which should propagate this change of embedding bitcode for C dependencies as well.
2018-03-15setting ABORTING_MALLOC for asmjs backendsnf-1/+3
2018-03-15Rollup merge of #48874 - jcowgill:mips-features, r=sanxiynkennytm-7/+7
bump mipsel isa leval and enable fpxx This PR: * Bumps the default ISA level of the mipsel targets to `mips32r2`. The big endian mips targets are already built with `mips32r2`. This is the usual baseline for the MIPS ISA these days used by other projects, although it does drop support for the 4K processor (which was the only processor released with mips32 r1). Debian no longer supports pre-R2 processors. Using R2 also improves code generation in FPXX in certain circumstances. * Enables the FPXX floating point ABI[1] on 32-bit hard-float targets by default. This ABI adds some extra restrictions to the existing ABI which allows code to run on the two main floating point modes found on MIPS (FR0 and FR1) and remains compatible with the FR32 ABI currently in use. All code within an executable (including all shared libraries) must be compiled with FPXX/FP64 to be able to use MSA on 32-bit MIPS. * Enables the "nooddspreg" feature with FPXX. This feature is usually enabled whenever FPXX is. It also helps workaround some issues on Loongson processors. I'm hoping this will fix some test failures mentioned in #39013. * Adds the `fp64` feature to the MIPS whitelist. This feature must be enabled to use MSA on 32-bit MIPS, otherwise LLVM will complain. [1] See https://dmz-portal.mips.com/wiki/MIPS_O32_ABI_-_FR0_and_FR1_Interlinking
2018-03-13rustc: Embed LLVM bitcode by default on iOSAlex Crichton-0/+6
This commit updates rustc to embed bitcode in each object file generated by default when compiling for iOS. This was determined in #35968 as a step towards better compatibility with the iOS toolchain, so let's give it a spin and see how it turns out! Note that this also updates the `cc` dependency which should propagate this change of embedding bitcode for C dependencies as well.
2018-03-13Rollup merge of #48725 - humenda:master, r=nikomatsakiskennytm-56/+17
Update L4Re target specification Due to the dynamically generated linker arguments of the L4Re build system, it is not a good idea to hard-code them in Rust. This PR undoes this step. It also adds an empty implementation to retrieve the number of CPUs.
2018-03-10add stub for retrieving number of CPUsSebastian Humenda-1/+1
2018-03-10remove linker arguments from L4Re targetSebastian Humenda-56/+17
These change from release to release and are impossible to get right, since they are generated by Make magic.
2018-03-09Make the default relro level be doing nothing at allJohannes Löthberg-1/+1
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
2018-03-08librustc_back: enable fpxx on 32-bit hardfloat mips targetsJames Cowgill-2/+2
See this page for details about FPXX: https://dmz-portal.mips.com/wiki/MIPS_O32_ABI_-_FR0_and_FR1_Interlinking Using FPXX is the most compatible floating point mode available and allows the generated code to work in both FR0 and FR1 modes of the processor. Using MSA (MIPS SIMD) requires FR1, so to use any MSA code we need a compatible floating point mode. This commit also sets nooddspreg (disabling the use of odd numbered single precision float registers) as recommended when enabling FPXX.
2018-03-08librustc_back: bump ISA level of mipsel targets to mips32r2James Cowgill-6/+6
2018-03-03rustc: Tweak default linker selectionAlex Crichton-44/+12
This commit refactors how the path to the linker that we're going to invoke is selected. Previously all targets listed *both* a `LinkerFlavor` and a `linker` (path) option, but this meant that whenever you changed one you had to change the other. The purpose of this commit is to avoid coupling these where possible. Target specifications now only unconditionally define the *flavor* of the linker that they're using by default. If not otherwise specified each flavor now implies a particular default linker to run. As a result, this means that if you'd like to test out `ld` for example you should be able to do: rustc -Z linker-flavor=ld foo.rs whereas previously you had to do rustc -Z linker-flavor=ld -C linker=ld foo.rs This will hopefully make it a bit easier to tinker around with variants that should otherwise be well known to work, for example with LLD, `ld` on OSX, etc.
2018-03-03rust: Import LLD for linking wasm objectsAlex Crichton-44/+11
This commit imports the LLD project from LLVM to serve as the default linker for the `wasm32-unknown-unknown` target. The `binaryen` submoule is consequently removed along with "binaryen linker" support in rustc. Moving to LLD brings with it a number of benefits for wasm code: * LLD is itself an actual linker, so there's no need to compile all wasm code with LTO any more. As a result builds should be *much* speedier as LTO is no longer forcibly enabled for all builds of the wasm target. * LLD is quickly becoming an "official solution" for linking wasm code together. This, I believe at least, is intended to be the main supported linker for native code and wasm moving forward. Picking up support early on should help ensure that we can help LLD identify bugs and otherwise prove that it works great for all our use cases! * Improvements to the wasm toolchain are currently primarily focused around LLVM and LLD (from what I can tell at least), so it's in general much better to be on this bandwagon for bugfixes and new features. * Historical "hacks" like `wasm-gc` will soon no longer be necessary, LLD will [natively implement][gc] `--gc-sections` (better than `wasm-gc`!) which means a postprocessor is no longer needed to show off Rust's "small wasm binary size". LLD is added in a pretty standard way to rustc right now. A new rustbuild target was defined for building LLD, and this is executed when a compiler's sysroot is being assembled. LLD is compiled against the LLVM that we've got in tree, which means we're currently on the `release_60` branch, but this may get upgraded in the near future! LLD is placed into rustc's sysroot in a `bin` directory. This is similar to where `gcc.exe` can be found on Windows. This directory is automatically added to `PATH` whenever rustc executes the linker, allowing us to define a `WasmLd` linker which implements the interface that `wasm-ld`, LLD's frontend, expects. Like Emscripten the LLD target is currently only enabled for Tier 1 platforms, notably OSX/Windows/Linux, and will need to be installed manually for compiling to wasm on other platforms. LLD is by default turned off in rustbuild, and requires a `config.toml` option to be enabled to turn it on. Finally the unstable `#![wasm_import_memory]` attribute was also removed as LLD has a native option for controlling this. [gc]: https://reviews.llvm.org/D42511
2018-03-03Rollup merge of #48466 - sanxiyn:no-neon, r=alexcrichtonkennytm-8/+8
Disable NEON on musl ARMv7 `armv7-unknown-linux-musleabihf` target diverged a bit from `armv7-unknown-linux-gnueabihf` target. This PR re-syncs them. Fix #47765.
2018-02-28Rollup merge of #48560 - bdrewery:freebsd-struct-abi, r=estebankkennytm-7/+10
Fix FreeBSD struct returning ABI. FreeBSD has had a patch similar to this for a while. See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223047. This reworks 6774e7a to be more specific about what `compute_abi_info` is checking for per target.
2018-02-26FreeBSD uses Clang which can return small structs as an integer.Bryan Drewery-0/+1
2018-02-26Add specific target option for returning struct as an integer.Bryan Drewery-7/+9
2018-02-26librustc_back: Add support for powerpc-linux-gnuspeJohn Paul Adrian Glaubitz-0/+36
2018-02-25Rollup merge of #48494 - bdrewery:freebsd-omit-frame-pointer, r=eddybkennytm-0/+1
Workaround abort(2) on compilation error on FreeBSD. Same problem as OpenBSD, tracking bug #43575. @semarie @dumbbell
2018-02-25Rollup merge of #48297 - glaubitz:sparc-linux, r=estebankkennytm-0/+35
Add missing pieces for sparc-linux-gnu support I noticed that while Rust has CABI support for 32-bit SPARC, there are still some pieces missing to be able to use Rust on a 32-Bit SPARC system like Gentoo which still defaults to a 32-bit port unlike Debian's sparc64 port. This PR is an attempt to add the missing pieces. I will send the necessary changes for libc in a separate PR. CC @jrtc27
2018-02-23Workaround abort(2) on compilation error on FreeBSD.Bryan Drewery-0/+1
Same problem as OpenBSD, tracking bug #43575.
2018-02-23librustc_back: Add support for sparc-linux-gnuJohn Paul Adrian Glaubitz-0/+35
2018-02-23Disable NEON on musl ARMv7Seo Sanghyeon-8/+8
2018-02-16Add powerpc-unknown-netbsd targetJonathan A. Kollasch-0/+36
2018-01-31Rollup merge of #47890 - pftbest:no_trap, r=alexcrichtonkennytm-0/+6
[MSP430] Don't enable trap_unreachable option by default on msp. Since MSP430 doesn't meaningfully support faulting on illegal instructions, LLVM generates a call to abort() function instead of a trap instruction. Such calls are 4 bytes long, and that is too much overhead for such small target. r? @alexcrichton
2018-01-31[MSP430] Don't enable trap_unreachable option by default on msp.Vadzim Dambrouski-0/+6
Since MSP430 doesn't meaningfully support faulting on illegal instructions, LLVM generates a call to abort() function instead of a trap instruction. Such calls are 4 bytes long, and that is too much overhead for such small target.
2018-01-30rustc: Add an option to default hidden visibilityAlex Crichton-0/+10
This commit adds a new option to target specifictions to specify that symbols should be "hidden" visibility by default in LLVM. While there are no existing targets that take advantage of this the `wasm32-unknown-unknown` target will soon start to use this visibility. The LLD linker currently interprets `hidden` as "don't export this from the wasm module" which is what we want for 90% of our functions. While the LLD linker does have a "export this symbol" argument which is what we use for other linkers, it was also somewhat easier to do this change instead which'll involve less arguments flying around. Additionally there's no need for non-`hidden` visibility for most of our symbols! This change should not immediately impact the wasm targets as-is, but rather this is laying the foundations for soon integrating LLD as a linker for wasm code.
2018-01-28rustc: Split Emscripten to a separate codegen backendAlex Crichton-0/+8
This commit introduces a separately compiled backend for Emscripten, avoiding compiling the `JSBackend` target in the main LLVM codegen backend. This builds on the foundation provided by #47671 to create a new codegen backend dedicated solely to Emscripten, removing the `JSBackend` of the main codegen backend in the process. A new field was added to each target for this commit which specifies the backend to use for translation, the default being `llvm` which is the main backend that we use. The Emscripten targets specify an `emscripten` backend instead of the main `llvm` one. There's a whole bunch of consequences of this change, but I'll try to enumerate them here: * A *second* LLVM submodule was added in this commit. The main LLVM submodule will soon start to drift from the Emscripten submodule, but currently they're both at the same revision. * Logic was added to rustbuild to *not* build the Emscripten backend by default. This is gated behind a `--enable-emscripten` flag to the configure script. By default users should neither check out the emscripten submodule nor compile it. * The `init_repo.sh` script was updated to fetch the Emscripten submodule from GitHub the same way we do the main LLVM submodule (a tarball fetch). * The Emscripten backend, turned off by default, is still turned on for a number of targets on CI. We'll only be shipping an Emscripten backend with Tier 1 platforms, though. All cross-compiled platforms will not be receiving an Emscripten backend yet. This commit means that when you download the `rustc` package in Rustup for Tier 1 platforms you'll be receiving two trans backends, one for Emscripten and one that's the general LLVM backend. If you never compile for Emscripten you'll never use the Emscripten backend, so we may update this one day to only download the Emscripten backend when you add the Emscripten target. For now though it's just an extra 10MB gzip'd. Closes #46819
2018-01-28Auto merge of #47663 - malbarbo:mips-crt-static, r=alexcrichtonbors-22/+18
Do not assume dynamic linking for musl/mips[el] targets All musl targets except mips[el] assume static linking by default. This can be [confusing](https://users.rust-lang.org/t/static-cross-compiled-binaries-arent-really-static/6084). When the musl/mips[el] targets was [added](https://github.com/rust-lang/rust/pull/31298), dynamic linking was chosen because of binary size concerns, and probably also because libunwind [didn't](https://users.rust-lang.org/t/static-cross-compiled-binaries-arent-really-static/6084/8) supported mips. Now that we have `crt-static` target-feature (the user can choose dynamic link for musl targets), and libunwind [6.0](https://github.com/llvm-mirror/libunwind/commits/release_60) add support to mips, we do not need to assume dynamic linking.
2018-01-24llvm6: CodeModel::{JIT,}Default no longer existsAlex Crichton-4/+4
LLVM has since removed the `CodeModel::Default` enum value in favor of an `Optional` implementationg throughout LLVM. Let's mirror the same change in Rust and update the various bindings we call accordingly. Removed in llvm-mirror/llvm@9aafb854c
2018-01-23Set crt_static_default = false for musl/mips[el] targetsMarco A L Barbosa-0/+2
2018-01-22Do not assume dynamic linking for musl/mips[el] targetsMarco A L Barbosa-22/+16
All musl targets except mips[el] assume static linking by default. This can be confusing https://users.rust-lang.org/t/static-cross-compiled-binaries-arent-really-static/6084 When the musl/mips[el] targets was [added](https://github.com/rust-lang/rust/pull/31298), dynamic linking was chosen because of binary size concerns, and probably also because libunwind [didn't](https://users.rust-lang.org/t/static-cross-compiled-binaries-arent-really-static/6084/8) supported mips. Now that we have `crt-static` target-feature (the user can choose dynamic link for musl targets), and libunwind [6.0](https://github.com/llvm-mirror/libunwind/commits/release_60) add support to mips, we do not need to assume dynamic linking.
2018-01-19Give TargetOptions::linker a sane default value.Ed Schouten-0/+4
Though some parts of rust use cc-rs to invoke a compiler/linker, Cargo seems to make use of the TargetOptions::linker property. Make the out of the box experience for CloudABI a bit better by using the same compiler name as cc-rs.
2018-01-17Document the mingw -lmsvcrt hack betterSegev Finer-1/+9
2018-01-16Add "-lmsvcrt" twice to get rustc to build with the latest mingw64Segev Finer-0/+1
2018-01-13Rollup merge of #47328 - mbrubeck:fs_read, r=sfacklerkennytm-5/+2
Use the new fs_read_write functions in rustc internals Uses `fs::read` and `fs::write` (added by #45837) where appropriate, to simplify code and dog-food these new APIs. This also improves performance, when combined with #47324.
2018-01-11Add i586-unknown-linux-musl targetMarco A L Barbosa-2/+22
2018-01-10Use the new fs_read_write functions in rustc internalsMatt Brubeck-5/+2
2018-01-05Rollup merge of #47110 - EdSchouten:cloudabi-tls, r=kennytmkennytm-0/+12
Use the right TLS model for CloudABI. CloudABI doesn't do dynamic linking. For this reason, there is no need to handle any other TLS model than local-exec. CloudABI's C library doesn't provide a __tls_get_addr() function to do Dynamic TLS. By forcing local-exec to be used here, we ensure that we don't generate function calls to __tls_get_addr().
2018-01-03Explain why local-exec is used by CloudABI.Ed Schouten-0/+11
2018-01-01Use the right TLS model for CloudABI.Ed Schouten-0/+1
CloudABI doesn't do dynamic linking. For this reason, there is no need to handle any other TLS model than local-exec. CloudABI's C library doesn't provide a __tls_get_addr() function to do Dynamic TLS. By forcing local-exec to be used here, we ensure that we don't generate function calls to __tls_get_addr().
2018-01-01Fix docs for future pulldown migrationMalo Jaffré-1/+1
2017-12-31Don't announce CloudABI as being UNIX.Ed Schouten-1/+1
This was originally brought in, because the definitions are based on those of FreeBSD, Linux, etc. Even though CloudABI is based on POSIX, it uses a subset that is so small that it's not reasonable to call it POSIX. Now that I'm porting libstd, I'm running into some spots where I have to explicitly disable code paths that were enabled by cfg(unix).