about summary refs log tree commit diff
path: root/src/librustc_back
AgeCommit message (Collapse)AuthorLines
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
2017-01-31Add i686-unknown-netbsdelf targetJonathan A. Kollasch-0/+31
2017-01-29Fix backtraces on i686-pc-windows-gnu by disabling FPOSegev Finer-0/+1
This might have performance implications. But do note that MSVC disables FPO by default nowadays and it's use is limited in exception heavy languages like C++. Closes: #28218
2017-01-22travis: Enable testing i686 muslAlex Crichton-0/+14
This fixes the final issues with the target related to unwinding by disabling removal of frame pointers.
2017-01-20Json encoding/decoding for is_like_emscriptenSergey Pepyakin-0/+2
2017-01-19tell emcc stip exception handling if panic rt usedSergey Pepyakin-0/+7
2017-01-12Disable jemalloc on s390x as well (closes #38596)Ximin Luo-0/+2
See also #37320 and #37392
2017-01-08Auto merge of #38679 - alexcrichton:always-deny-warnings, r=nrcbors-1/+1
Remove not(stage0) from deny(warnings) Historically this was done to accommodate bugs in lints, but there hasn't been a bug in a lint since this feature was added which the warnings affected. Let's completely purge warnings from all our stages by denying warnings in all stages. This will also assist in tracking down `stage0` code to be removed whenever we're updating the bootstrap compiler.
2017-01-04Auto merge of #38707 - redox-os:master, r=brsonbors-9/+1
Add socket timeout and ttl support in `sys::redox` This adds support for `read_timeout`, `write_timeout`, and `ttl` on `TcpStream`, `TcpListener`, and `UdpSocket` in the `sys::redox` module. The DNS lookup has been set to use a 5 second timeout by default.
2017-01-03Remove -lc, -lm from the target spec - the cross compiler will link thoseJeremy Soller-9/+1
2017-01-01Merge branch 'master' into sparc64Seo Sanghyeon-4/+24
2016-12-30sparc64-linux supportJorge Aparicio-0/+32
2016-12-31Auto merge of #38601 - schulzch:master, r=brsonbors-4/+24
Partial fix for #38489. Fixes script name resolution for windows by invoking `emcc.bat` instead of `emcc`, etc. Remaining issue: ``` Traceback (most recent call last): File "C:\Program Files\Emscripten\emscripten\1.35.0\\emcc", line 1309, in <module> final = shared.Building.llvm_opt(final, link_opts, DEFAULT_FINAL) File "C:\Program Files\Emscripten\emscripten\1.35.0\tools\shared.py", line 1471, in llvm_opt assert os.path.exists(target), 'Failed to run llvm optimizations: ' + output AssertionError: Failed to run llvm optimizations: ```