summary refs log tree commit diff
path: root/src/librustc_back
AgeCommit message (Collapse)AuthorLines
2017-10-26Disable jemalloc for sparcv9-sun-solarisbgermann-0/+1
Similar to #36994, rust programs segfault on SPARC64 Solaris machines. (cherry picked from commit 7bab5dabddc858d7213e2d4d453caa90a86d8586)
2017-10-09Auto merge of #45041 - est31:master, r=alexcrichtonbors-52/+0
Remove support for the PNaCl target (le32-unknown-nacl) This removes support for the `le32-unknown-nacl` target which is currently supported by rustc on tier 3. Despite the "nacl" in the name, the target doesn't output native code (x86, ARM, MIPS), instead it outputs binaries in the PNaCl format. There are two reasons for the removal: * Google [has announced](https://blog.chromium.org/2017/05/goodbye-pnacl-hello-webassembly.html) deprecation of the PNaCl format. The suggestion is to migrate to wasm. Happens we already have a wasm backend! * Our PNaCl LLVM backend is provided by the fastcomp patch set that the LLVM fork used by rustc contains in addition to vanilla LLVM (`src/llvm/lib/Target/JSBackend/NaCl`). Upstream LLVM doesn't have PNaCl support. Removing PNaCl support will enable us to move away from fastcomp (#44006) and have a lighter set of patches on top of upstream LLVM inside our LLVM fork. This will help distribution packagers of Rust. Fixes #42420
2017-10-08Rollup merge of #45094 - japaric:strict-align, r=alexcrichtonkennytm-5/+5
enable strict alignment (+strict-align) on ARMv6 As discovered in #44538 ARMv6 devices may or may not support unaligned memory accesses. ARMv6 Linux *seems* to have no problem with unaligned accesses but this is because the kernel is stepping in to fix each unaligned memory access -- this incurs in a performance penalty. This commit enforces aligned memory accesses on all our in-tree ARM targets that may be used with ARMv6 devices. This should improve performance of Rust programs on ARMv6 devices. For the record, clang also applies this attribute when targeting ARMv6 devices that are not running Darwin or NetBSD. closes #44538 r? @alexcrichton
2017-10-07enable strict alignment (+strict-align) on ARMv6Jorge Aparicio-5/+5
As discovered in #44538 ARMv6 devices may or may not support unaligned memory accesses. ARMv6 Linux *seems* to have no problem with unaligned accesses but this is because the kernel is stepping in to fix each unaligned memory access -- this incurs in a performance penalty. This commit enforces aligned memory accesses on all our in-tree ARM targets that may be used with ARMv6 devices. This should improve performance of Rust programs on ARMv6 devices. For the record, clang also applies this attribute when targeting ARMv6 devices that are not running Darwin or NetBSD.
2017-10-05Remove nacl from librustc_backest31-52/+0
2017-10-02Allow atomic operations up to 32 bitsJames Munns-2/+6
The ARMv5te platform does not have instruction-level support for atomics, however the kernel provides [user space helpers](https://www.kernel.org/doc/Documentation/arm/kernel_user_helpers.txt) which can be used to perform atomic operations. When linked with `libc`, the atomic symbols needed by Rust will be provided, rather than CPU level intrinsics. As this target is specifically `linux` and `gnueabi`, it is reasonable to assume the Linux Kernel and libc will be available for the target. There is a large performance penalty, as we are not using CPU level intrinsics, however this penalty is likely preferable to not having the target at all. I have used this change in a custom target (along with `xargo`) to build `std`, as well as a number of higher level crates.
2017-09-30rustc: Use 16bit c_int for msp430Daniel Klauer-1/+1
Fix regression from c2fe69b9, where main() signature was changed from using 16bit isize to 32bit c_int for argc parameter/result.
2017-09-30rustc: Specify c_int width for each targetDaniel Klauer-0/+75
(all i32 for now, as in liblibc)
2017-09-23add aarch64-unknown-linux-musl targetBen Cressey-0/+37
Signed-off-by: Ben Cressey <bcressey@amazon.com> Signed-off-by: Tom Kirchner <tjk@amazon.com>
2017-09-19rework the README.md for rustc and add other readmesNiko Matsakis-0/+6
This takes way longer than I thought it would. =)
2017-09-15Require +thumb-mode to generate thumb2 code for Android/armv7-aMakoto Kato-1/+1
2017-09-08Add `TargetOptions::min_global_align`, with s390x at 16-bitJosh Stone-0/+7
The SystemZ `LALR` instruction provides PC-relative addressing for globals, but only to *even* addresses, so other compilers make sure that such globals are always 2-byte aligned. In Clang, this is modeled with `TargetInfo::MinGlobalAlign`, and `TargetOptions::min_global_align` now serves the same purpose for rustc. In Clang, the only targets that set this are SystemZ, Lanai, and NVPTX, and the latter two don't have targets in rust master.
2017-08-26Rollup merge of #44091 - kallisti5:haiku-fix, r=eddybCorey Farwell-1/+0
haiku/librustc_back: Remove incorrect no_integrated_as * Makes rust bootstrap incorrectly search for xxx.s vs xxx.0.s * Not needed or incorrect fix for another issue.
2017-08-25haiku/librustc_back: Remove incorrect no_integrated_asAlexander von Gluck IV-1/+0
* Makes rust bootstrap incorrectly search for xxx.s vs xxx.0.s * Not needed or incorrect fix for another issue.
2017-08-25*: remove crate_{name,type} attributesTamir Duberstein-3/+0
Fixes #41701.
2017-08-24Auto merge of #44011 - TobiasSchaffner:improved_target_spec_clean, ↵bors-6/+56
r=alexcrichton L4Re Target: Add the needed Libraries and locate them Add the libraries and objects that have to be linked to a get working L4Re Binary using pre- and post-link-args. Additionaly some ld commands had to be passed. * L4Re libraries and objects will be located by an environment variable. * gcc libraries and objects will be located using a gcc call. GCC is mandatory for this target, that might need documentation somewhere. As soon as something mandatory cannot be found, the compiler will panic. This is intended, because the functions involved don't allow the usage of a Result type. libgcc_eh is now passed using `-l` and crtbeginT.o and crtend.o are now located using `gcc -print-filename`.
2017-08-22Support dynamic linking for musl-based targetsSamuel Holland-7/+0
Note that this commit does not affect mips-musl targets, as they do not inherit from linux_musl_base.
2017-08-22Introduce target feature crt_static_allows_dylibsSamuel Holland-0/+6
Most UNIX-like platforms do not allow shared libraries to statically link their own libc, as libc expects to have consistent process-global state. On those platforms, when we do not have a shared libc available, we must not attempt to link dylibs or cdylibs. On Windows, however, it is expected to statically link the CRT into dynamic libraries. This feature is only relevant for targets that support both fully-static and fully-dynamic linkage, such as musl on Linux.
2017-08-22Introduce temporary target feature crt_static_respectedSamuel Holland-0/+8
This feature allows targets to opt in to full support of the crt-static feature. Currently, crt-static is allowed on all targets, even those that really can't or really shouldn't support it. This works because it is very loose in the specification of its effects. Changing the behavior of crt-static to be more strict in how it chooses libraries and links executables would likely cause compilation to fail on these platforms. To avoid breaking existing uses of crt-static, whitelist targets that support the new, stricter behavior. For all other targets, this changes crt-static from being "mostly a no-op" to "explicitly a no-op".
2017-08-22Return L4Re TargetOptions as a Result type instead of panicTobias Schaffner-6/+6
If the environment variable L4RE_LIBDIR ist not set an Error will be returned wrapped in a result type instead of a panic.
2017-08-22L4Re Target: Add the needed Libraries and locate themSebastian Humenda-2/+52
Add the libraries and objects that have to be linked to a get working L4Re Binary using pre- and post-link-args. Additionaly some ld commands had to be passed. * L4Re libraries and objects will be located by an environment variable. * gcc libraries and objects will be located using a gcc call. GCC is mandatory for this target, that might need documentation somewhere. As soon as something mandatory cannot be found, the compiler will panic. This is intended, because the functions involved don't allow the usage of a Result type. libgcc_eh is now passed using `-l` and crtbeginT.o and crtend.o are now located using `gcc -print-filename`. Co-authored-by: TobiasSchaffner <tobiasschaffner@outlook.com>
2017-08-19rustc: Remove some dead codeVadim Petrochenkov-43/+2
2017-08-16Enable unwinding panics on RedoxIan Douglas Scott-2/+1
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-8/+8
Like #43008 (f668999), but _much more aggressive_.
2017-08-04Add L4Re Support in librustc_backTobias Schaffner-0/+66
Add support for x86_64-unknown-l4re-uclibc target, which covers the L4 Runtime Environment.
2017-07-22rustc: Add some build scripts for librustc cratesAlex Crichton-0/+15
This commit adds some "boilerplate" build scripts to librustc/libsyntax crates to declare dependencies on various environment variables that are configured throughout the build. Cargo recently gained the ability to depend on environment variables in build scripts which can help trigger recompilation of a crate. This should fix weird bugs where after you make a commit or a few days later you'll get weird "not built with the same compiler" errors hopefully.
2017-07-19Pass debugging arguments to emccThomas Lively-1/+4
Tells emcc to enable assertions and debugging information for wasm32-experimental-emscripten. This makes the codegen issues caused by LLVM bug 33824 manifest more frequently at runtime and improves the wasm debugging experience.
2017-07-18Implement FromStr for RelroLevel rather than duplicating the matchJohannes Löthberg-4/+17
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
2017-07-14Make partial RELRO default on ppc64 due to segfaultJohannes Löthberg-1/+5
On at least RHEL6 there is a segfault caused by the older ld.so version when BIND_NOW is used, so use partial RELRO by default on ppc64 architectures for now. Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
2017-07-14Support both partial and full RELROJohannes Löthberg-21/+63
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
2017-07-11Add support for full RELROJohannes Löthberg-0/+13
This commit adds support for full RELRO, and enables it for the platforms I know have support for it. Full RELRO makes the PLT+GOT data read-only on startup, preventing it from being overwritten. http://tk-blog.blogspot.com/2009/02/relro-not-so-well-known-memory.html Fixes rust-lang/rust#29877. Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
2017-07-07Auto merge of #43099 - japaric:msp430, r=alexcrichtonbors-0/+55
add a built-in MSP430 target the MSP430 backend has been enabled for a while but no target was added to rustc to encourage out of tree experimentation. We believe the out of tree (custom) target has been iterated long enough and is stable enough for inclusion in the compiler. Kudos to @pftbest and @awygle for fixing several LLVM / codegen bugs this target had! The target name chosen is a slight variation of the triple gcc uses, which is simply `msp430-elf`. We picked `msp430-none-elf` to leave room for custom targets that target some embedded OS running on MSP430 devices. (cf. the custom `thumbv7m-tockos-eabi` target TockOS uses vs the built-in `thumbv7m-none-eabi`). There's one expected change in the specification of the proposed target: the `asm_args` and `no_integrated_as` fields will change to their default values. Once the LLVM backend gains the ability to directly produce MSP430 object files we can stop depending on `msp430-elf-gcc` for producing object files; when that occurs the `asm` related fields will change. This change won't break existing user code. r? @alexcrichton cc @brson
2017-07-06add a built-in MSP430 targetJorge Aparicio-0/+55
2017-07-06rustc: Implement stack probes for x86Alex Crichton-0/+31
This commit implements stack probes on x86/x86_64 using the freshly landed support upstream in LLVM. The purpose of stack probes here are to guarantee a segfault on stack overflow rather than having a chance of running over the guard page already present on all threads by accident. At this time there's no support for any other architecture because LLVM itself does not have support for other architectures.
2017-07-05rustc: Implement the #[global_allocator] attributeAlex Crichton-33/+23
This PR is an implementation of [RFC 1974] which specifies a new method of defining a global allocator for a program. This obsoletes the old `#![allocator]` attribute and also removes support for it. [RFC 1974]: https://github.com/rust-lang/rfcs/pull/197 The new `#[global_allocator]` attribute solves many issues encountered with the `#![allocator]` attribute such as composition and restrictions on the crate graph itself. The compiler now has much more control over the ABI of the allocator and how it's implemented, allowing much more freedom in terms of how this feature is implemented. cc #27389
2017-06-24Auto merge of #42784 - tlively:wasm-bot, r=alexcrichtonbors-0/+33
Make wasm32 buildbot test LLVM backend This adds the experimental targets option to configure so it can be used by the builders and changes the wasm32 Dockerfile accordingly. Instead of using LLVM from the emsdk, the builder's emscripten tools now uses the Rust in-tree LLVM, since this is the one built with wasm support.
2017-06-23Add Target (de)serialization for environment varsThomas Lively-0/+28
Also turn WebAssembly backend back on in its builder.
2017-06-23rustc: Enable #[thread_local] for WindowsAlex Crichton-0/+1
I think LLVM has had support for quite some time now for this, we just never got around to testing it out and binding it. We've had some trouble landing this in the past I believe, but it's time to try again! This commit flags the `#[thread_local]` attribute as being available for Windows targets and adds an implementation of `register_dtor` in the `thread::local` module to ensure we can destroy these keys. The same functionality is implemented in clang via a function called `__tlregdtor` (presumably provided in some Windows runtime somewhere), but this function unfortunately does not take a data pointer (just a thunk) which means we can't easily call it. For now destructors are just run in the same way the Linux fallback is implemented, which is just keeping track via a single OS-based TLS key.
2017-06-22Add target option for linker environment variablesThomas Lively-0/+5
This is used in wasm32-experimental-emscripten to ensure that emscripten links against the libc bitcode files produced by the wasm LLVM backend, instead of using fastcomp.
2017-06-20Auto merge of #42571 - tlively:wasm-dev, r=alexcrichtonbors-0/+54
Enable wasm LLVM backend Enables compilation to WebAssembly with the LLVM backend using the target triple "wasm32-unknown-unknown". This is the beginning of my work on #38804. **edit:** The new new target is now wasm32-experimental-emscripten instead of wasm32-unknown-unknown.
2017-06-19Bump version and stage0 compilerAlex Crichton-4/+0
2017-06-16Add target to use LLVM wasm backendThomas Lively-0/+54
The new target is wasm32-experimental-emscripten. Adds a new configuration option to opt in to building experimental LLVM backends such as the WebAssembly backend. The target name was chosen to be similar to the existing wasm32-unknown-emscripten target so that the build and tests would work with minimal other code changes. When/if the new target replaces the old target, simply renaming it should just work.
2017-05-30ARMv5 needs +strict-alignJan Niehusmann-1/+1
Without that flag, LLVM generates unaligned memory access instructions, which are not allowed on ARMv5. For example, the 'hello world' example from `cargo --new` failed with: ``` $ ./hello Hello, world! thread 'main' panicked at 'assertion failed: end <= len', src/libcollections/vec.rs:1113 note: Run with `RUST_BACKTRACE=1` for a backtrace. ``` I traced this error back to the following assembler code in `BufWriter::flush_buf`: ``` 6f44: e28d0018 add r0, sp, #24 [...] 6f54: e280b005 add fp, r0, #5 [...] 7018: e5cd001c strb r0, [sp, #28] 701c: e1a0082a lsr r0, sl, #16 7020: 03a01001 moveq r1, #1 7024: e5cb0002 strb r0, [fp, #2] 7028: e1cba0b0 strh sl, [fp] ``` Note that `fp` points to `sp + 29`, so the three `str*`-instructions should fill up a 32bit - value at `sp + 28`, which is later used as the value `n` in `Ok(n) => written += n`. This doesn't work on ARMv5 as the `strh` can't write to the unaligned contents of `fp`, so the upper bits of `n` won't get cleared, leading to the assertion failure in Vec::drain. With `+strict-align`, the code works as expected.
2017-05-24add thiscall calling convention supportNathan Froyd-1/+1
This support is needed for bindgen to work well on 32-bit Windows, and also enables people to begin experimenting with C++ FFI support on that platform. Fixes #42044.
2017-05-11rustc: Remove #![unstable] annotationAlex Crichton-3/+4
These are now no longer necessary with `-Z force-unstable-if-unmarked`
2017-05-02Rollup merge of #41657 - malbarbo:android-armv7-linker, r=alexcrichtonCorey Farwell-0/+2
Add -march=armv7-a parameter to armv7 android linker Without this option, the linker fails to link any library that uses `std::future`. The error points some undefined references, like `std::__future_base::_Result_base`. For example, it fails to link rustc because llvm 4.0 uses `std::future`. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64735
2017-04-30Add -march=armv7-a parameter to armv7 android linkerMarco A L Barbosa-0/+2
2017-04-30Change arm-linux-androideabi to correspond to the armeabi official ABIMarco A L Barbosa-1/+2
Fixes #40941.
2017-04-26Rollup merge of #41456 - jessicah:haiku-support, r=alexcrichtonAriel Ben-Yehuda-1/+4
Haiku: fix initial platform support
2017-04-24Haiku: add missing cases of using LIBRARY_PATHJessica Hamilton-0/+2