summary refs log tree commit diff
path: root/src/librustc_back
AgeCommit message (Collapse)AuthorLines
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
2017-04-22Haiku: fix initial platform supportJessica Hamilton-1/+2
2017-04-20Add x86_64-linux-android targetMarco A L Barbosa-0/+35
2017-04-14Compile WASM as WASM instead of asm.jsChristopher Serr-1/+1
Looks like the LinkerFlavor change introduced in #40018 accidentally uses GCC for the WebAssembly target, causing Rust to never actually pass the post link args to emscripten. This then causes the code to be compiled as asm.js instead of WebAssembly, because the Binaryen tools never run due to the missing linker argument.
2017-04-07-Z linker-flavorJorge Aparicio-187/+475
This patch adds a `-Z linker-flavor` flag to rustc which can be used to invoke the linker using a different interface. For example, by default rustc assumes that all the Linux targets will be linked using GCC. This makes it impossible to use LLD as a linker using just `-C linker=ld.lld` because that will invoke LLD with invalid command line arguments. (e.g. rustc will pass -Wl,--gc-sections to LLD but LLD doesn't understand that; --gc-sections would be the right argument) With this patch one can pass `-Z linker-flavor=ld` to rustc to invoke the linker using a LD-like interface. This way, `rustc -C linker=ld.lld -Z linker-flavor=ld` will invoke LLD with the right arguments. `-Z linker-flavor` accepts 4 different arguments: `em` (emcc), `ld`, `gcc`, `msvc` (link.exe). `em`, `gnu` and `msvc` cover all the existing linker interfaces. `ld` is a new flavor for interfacing GNU's ld and LLD. This patch also changes target specifications. `linker-flavor` is now a mandatory field that specifies the *default* linker flavor that the target will use. This change also makes the linker interface *explicit*; before, it used to be derived from other fields like linker-is-gnu, is-like-msvc, is-like-emscripten, etc. Another change to target specifications is that the fields `pre-link-args`, `post-link-args` and `late-link-args` now expect a map from flavor to linker arguments. ``` diff - "pre-link-args": ["-Wl,--as-needed", "-Wl,-z,-noexecstack"], + "pre-link-args": { + "gcc": ["-Wl,--as-needed", "-Wl,-z,-noexecstack"], + "ld": ["--as-needed", "-z,-noexecstack"], + }, ``` [breaking-change] for users of custom targets specifications
2017-03-23Remove internal liblogAlex Crichton-1/+1
This commit deletes the internal liblog in favor of the implementation that lives on crates.io. Similarly it's also setting a convention for adding crates to the compiler. The main restriction right now is that we want compiler implementation details to be unreachable from normal Rust code (e.g. requires a feature), and by default everything in the sysroot is reachable via `extern crate`. The proposal here is to require that crates pulled in have these lines in their `src/lib.rs`: #![cfg_attr(rustbuild, feature(staged_api, rustc_private))] #![cfg_attr(rustbuild, unstable(feature = "rustc_private", issue = "27812"))] This'll mean that by default they're not using these attributes but when compiled as part of the compiler they do a few things: * Mark themselves as entirely unstable via the `staged_api` feature and the `#![unstable]` attribute. * Allow usage of other unstable crates via `feature(rustc_private)` which is required if the crate relies on any other crates to compile (other than std).
2017-03-12Update usages of 'OSX' (and other old names) to 'macOS'.Corey Farwell-6/+6
As of last year with version 'Sierra', the Mac operating system is now called 'macOS'.
2017-02-16add solaris sparcv9 supportShawn Walker-Salas-0/+36
* Update bootstrap to recognize the cputype 'sparcv9' (used on Solaris) * Change to never use -fomit-frame-pointer on Solaris or for sparc * Adds rust target sparcv9-sun-solaris Fixes #39901
2017-02-07Rollup merge of #39426 - jakllsch:netbsd-c, r=alexcrichtonCorey Farwell-0/+31
Add i686-unknown-netbsdelf target
2017-02-06Rename i686-unknown-netbsdelf target to i686-unknown-netbsdJonathan A. Kollasch-1/+1
2017-02-05Rollup merge of #39491 - dumbbell:support-aarch64-unknown-freebsd, ↵Corey Farwell-0/+35
r=alexcrichton Support aarch64-unknown-freebsd
2017-02-05Rollup merge of #39193 - pepyakin:emcc-strip-panic-rt, r=alexcrichtonCorey Farwell-0/+9
Tell emscripten to remove exception handling code when panic=abort Fixes #36900
2017-02-03Add `aarch64-unknown-freebsd` to the supported targetsJean-Sébastien Pédron-0/+35