about summary refs log tree commit diff
path: root/src/librustc_llvm/build.rs
AgeCommit message (Collapse)AuthorLines
2020-09-09Move `rustllvm` into `rustc_llvm`Vadim Petrochenkov-322/+0
2020-09-01Link to zlib while cross-compiling LLVM on HaikuNiels Sascha Reedijk-1/+1
PR #72696 enabled the option LLVM_ENABLE_ZLIB for the LLVM builds. On Haiku, zlib is linked as a shared library. When cross-compiling LLVM, rustbuild should be instructed to explicitly linking to libz.
2020-08-25Enable zlib for NetBSDMateusz Mikuła-0/+2
2020-08-19Fix windows-gnu host cross-compilationMateusz Mikuła-0/+9
2020-07-22build: Harden env var tracking in build scriptsVadim Petrochenkov-14/+10
2020-07-22build: Remove unnecessary `cargo:rerun-if-env-changed` annotationsVadim Petrochenkov-1/+1
2020-07-17Generating the coverage mapRich Kadel-2/+11
rustc now generates the coverage map and can support (limited) coverage report generation, at the function level. Example: $ BUILD=$HOME/rust/build/x86_64-unknown-linux-gnu $ $BUILD/stage1/bin/rustc -Zinstrument-coverage \ $HOME/rust/src/test/run-make-fulldeps/instrument-coverage/main.rs $ LLVM_PROFILE_FILE="main.profraw" ./main called $ $BUILD/llvm/bin/llvm-profdata merge -sparse main.profraw -o main.profdata $ $BUILD/llvm/bin/llvm-cov show --instr-profile=main.profdata main 1| 1|pub fn will_be_called() { 2| 1| println!("called"); 3| 1|} 4| | 5| 0|pub fn will_not_be_called() { 6| 0| println!("should not have been called"); 7| 0|} 8| | 9| 1|fn main() { 10| 1| let less = 1; 11| 1| let more = 100; 12| 1| 13| 1| if less < more { 14| 1| will_be_called(); 15| 1| } else { 16| 1| will_not_be_called(); 17| 1| } 18| 1|}
2020-07-11RISC-V GNU/Linux as host platformmsizanoen1-0/+5
2020-06-19Cleanup MinGW LLVM linkage workaroundMateusz Mikuła-4/+2
2020-06-09[AVR] Add AVR platform supportJake Goulding-0/+1
2020-05-02Don't skip building LLVM if already builtMark Rousskov-1/+1
2020-04-11Don't emit rerun-if-changed on llvm-config if using system LLVMLuca Barbieri-10/+20
The code was broken because it printed "llvm-config" instead of the absolute path to the llvm-config executable, causing Cargo to always rebuild librustc_llvm if using system LLVM. Also, it's not the build system's job to rebuild when a system library changes, so we simply don't emit "rerun-if-changed" if a path to LLVM was not explicitly provided.
2020-03-23rustc_llvm: don't use -g when LLVM_NDEBUG is set.Eduard-Mihai Burtescu-0/+1
2020-02-27use char instead of &str for single char patternsMatthias Krüger-1/+1
2020-01-14Better support for cross compilation on Windows.Daniel Frampton-4/+6
2019-12-22Format the worldMark Rousskov-56/+44
2019-10-30Statically link libstdc++ on windows-gnuMateusz Mikuła-1/+5
2019-09-04fix a few typos in commentsGuanqun Lu-3/+3
2019-08-17Rollup merge of #63621 - jgalenson:dndebug, r=alexcrichtonMazdak Farrokhzad-0/+4
Modify librustc_llvm to pass -DNDEBUG while compiling. Currently, librustc_llvm builds are not reproducible because the LLVM files it compiles use the debug version of llvm_unreachable, which uses __FILE__. To fix this, we propagate NDEBUG from bootstrap if applicable and use it when compiling librustc_llvm. r? @alexcrichton
2019-08-15Modify librustc_llvm to pass -DNDEBUG while compiling.Joel Galenson-0/+4
Currently, librustc_llvm builds are not reproducible because the LLVM files it compiles use the debug version of llvm_unreachable, which uses __FILE__. To fix this, we propagate NDEBUG from bootstrap if applicable and use it when compiling librustc_llvm.
2019-08-15add sparc64-unknown-openbsd targetSébastien Marie-2/+5
on OpenBSD, some architectures relies on libc++ (from LLVM) and some others on libestdc++ (particular version of libstdc++ from GCC). sparc64-unknown-openbsd needs libestdc++ and libgcc (as x86_64 some years ago). Reintroduce the support of them for openbsd, only for sparc64 arch. Some others architectures on OpenBSD could use them too.
2019-07-26Rollup merge of #62907 - nikic:msp430-asmparser, r=alexcrichtonMazdak Farrokhzad-0/+4
Initialize the MSP430 AsmParser Hopefully fixes #59077. r? @alexcrichton
2019-07-24Initialize the MSP430 AsmParser if availableNikita Popov-0/+4
2019-07-20Don't link mcjit/interpreter LLVM componentsNikita Popov-10/+3
2019-06-10Pass LLVM linker flags to librustc_llvm buildPetr Hosek-0/+15
Some -L and -l flags may be needed even when building librustc_llvm, for example when using static libc++ on Linux we may need to manually specify the library search path and -ldl -lpthread as additional link dependencies. We pass LLVM linker flags from config to librustc_llvm build to make sure these cases are handled.
2019-02-07librustc_llvm => 2018Taiki Endo-3/+0
2019-01-26Workaround presence of LLVM library in stage0/libMark Rousskov-0/+2
This commit works around the newly-introduced LLVM shared library. This is needed such that llvm-config run from librustc_llvm's build script can correctly locate it's own LLVM, not the one in stage0/lib. The LLVM build system uses the DT_RUNPATH/RUNPATH header within the llvm-config binary, which we want to use, but because Cargo always adds the host compiler's "libdir" (stage0/lib in our case) to the dynamic linker's search path, we weren't properly finding the freshly-built LLVM in llvm/lib. By restoring the environment variable setting the search path to what bootstrap sees, the problem is resolved and librustc_llvm correctly links and finds the appropriate LLVM. Several run-make-fulldeps tests are also updated with similar handling.
2019-01-25librustc_llvm: default to libc++ for darwinJosh Stone-0/+2
2019-01-07Rollup merge of #57369 - petrhosek:llvm-libcxx, r=alexcrichtonPietro Albini-0/+3
Provide the option to use libc++ even on all platforms This is the default on platforms which use libc++ as the default C++ library but this option allows using libc++ on others as well.
2019-01-05Provide the option to use libc++ even on all platformsPetr Hosek-0/+3
This is the default on platforms which use libc++ as the default C++ library but this option allows using libc++ on others as well.
2019-01-02bootstrap: Link LLVM as a dylib with ThinLTOAlex Crichton-0/+4
When building a distributed compiler on Linux where we use ThinLTO to create the LLVM shared object this commit switches the compiler to dynamically linking that LLVM artifact instead of statically linking to LLVM. The primary goal here is to reduce CI compile times, avoiding two+ ThinLTO builds of all of LLVM. By linking dynamically to LLVM we'll reuse the one ThinLTO step done by LLVM's build itself. Lots of discussion about this change can be found [here] and down. A perf run will show whether this is worth it or not! [here]: https://github.com/rust-lang/rust/pull/53245#issuecomment-417015334
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-25Revert "Rollup merge of #56944 - alexcrichton:less-thin2, r=michaelwoerister"kennytm-4/+0
This reverts commit f1051b574c26e20608ff26415a3dddd13f140925, reversing changes made to 833e0b3b8a9f1487a61152ca76f7f74a6b32cc0c.
2018-12-17bootstrap: Link LLVM as a dylib with ThinLTOAlex Crichton-0/+4
When building a distributed compiler on Linux where we use ThinLTO to create the LLVM shared object this commit switches the compiler to dynamically linking that LLVM artifact instead of statically linking to LLVM. The primary goal here is to reduce CI compile times, avoiding two+ ThinLTO builds of all of LLVM. By linking dynamically to LLVM we'll reuse the one ThinLTO step done by LLVM's build itself. Lots of discussion about this change can be found [here] and down. A perf run will show whether this is worth it or not! [here]: https://github.com/rust-lang/rust/pull/53245#issuecomment-417015334
2018-12-12Bump to 1.33.0Alex Crichton-2/+2
* Update bootstrap compiler * Update version to 1.33.0 * Remove some `#[cfg(stage0)]` annotations Actually updating the version number is blocked on updating Cargo
2018-10-23Revert "rustc: Fix (again) simd vectors by-val in ABI"Alex Crichton-3/+1
This reverts commit 3cc8f738d4247a9b475d8e074b621e602ac2b7be.
2018-10-19rustc: Fix (again) simd vectors by-val in ABIAlex Crichton-1/+3
The issue of passing around SIMD types as values between functions has seen [quite a lot] of [discussion], and although we thought [we fixed it][quite a lot] it [wasn't]! This PR is a change to rustc to, again, try to fix this issue. The fundamental problem here remains the same, if a SIMD vector argument is passed by-value in LLVM's function type, then if the caller and callee disagree on target features a miscompile happens. We solve this by never passing SIMD vectors by-value, but LLVM will still thwart us with its argument promotion pass to promote by-ref SIMD arguments to by-val SIMD arguments. This commit is an attempt to thwart LLVM thwarting us. We, just before codegen, will take yet another look at the LLVM module and demote any by-value SIMD arguments we see. This is a very manual attempt by us to ensure the codegen for a module keeps working, and it unfortunately is likely producing suboptimal code, even in release mode. The saving grace for this, in theory, is that if SIMD types are passed by-value across a boundary in release mode it's pretty unlikely to be performance sensitive (as it's already doing a load/store, and otherwise perf-sensitive bits should be inlined). The implementation here is basically a big wad of C++. It was largely copied from LLVM's own argument promotion pass, only doing the reverse. In local testing this... Closes #50154 Closes #52636 Closes #54583 Closes #55059 [quite a lot]: https://github.com/rust-lang/rust/pull/47743 [discussion]: https://github.com/rust-lang/rust/issues/44367 [wasn't]: https://github.com/rust-lang/rust/issues/50154
2018-08-20Actually enable the amdgpu component if present.Richard Diamond-1/+1
2018-08-01[RISCV] Enable LLVM backend.David Craven-0/+4
2018-07-31rustc_llvm: fix linking on mingw.Irina Popa-0/+1
2018-04-19Add rerun-if-env-changed=RUST_CHECK to librustc_llvmvarkor-0/+1
2018-04-18Do not rebuild LLVM for x.py checkvarkor-0/+5
2018-02-12rustc: Persist LLVM's `Linker` in Fat LTOAlex Crichton-0/+1
This commit updates our Fat LTO logic to tweak our custom wrapper around LLVM's "link modules" functionality. Previously whenever the `LLVMRustLinkInExternalBitcode` function was called it would call LLVM's `Linker::linkModules` wrapper. Internally this would crate an instance of a `Linker` which internally creates an instance of an `IRMover`. Unfortunately for us the creation of `IRMover` is somewhat O(n) with the input module. This means that every time we linked a module it was O(n) with respect to the entire module we had built up! Now the modules we build up during LTO are quite large, so this quickly started creating an O(n^2) problem for us! Discovered in #48025 it turns out this has always been a problem and we just haven't noticed it. It became particularly worse recently though due to most libraries having 16x more object files than they previously did (1 -> 16). This commit fixes this performance issue by preserving the `Linker` instance across all links into the main LLVM module. This means we only create one `IRMover` and allows LTO to progress much speedier. From the `cargo-cache` project in #48025 a **full build** locally when from 5m15s to 2m24s. Looking at the timing logs each object file was linked in in single-digit millisecond rather than hundreds, clearly being a nice improvement! Closes #48025
2018-01-27rustc: Load the `rustc_trans` crate at runtimeAlex Crichton-0/+1
Building on the work of # 45684 this commit updates the compiler to unconditionally load the `rustc_trans` crate at runtime instead of linking to it at compile time. The end goal of this work is to implement # 46819 where rustc will have multiple backends available to it to load. This commit starts off by removing the `extern crate rustc_trans` from the driver. This involved moving some miscellaneous functionality into the `TransCrate` trait and also required an implementation of how to locate and load the trans backend. This ended up being a little tricky because the sysroot isn't always the right location (for example `--sysroot` arguments) so some extra code was added as well to probe a directory relative to the current dll (the rustc_driver dll). Rustbuild has been updated accordingly as well to have a separate compilation invocation for the `rustc_trans` crate and assembly it accordingly into the sysroot. Finally, the distribution logic for the `rustc` package was also updated to slurp up the trans backends folder. A number of assorted fallout changes were included here as well to ensure tests pass and such, and they should all be commented inline.
2017-12-22Re-do the FreeBSD cross-builds to use Clang and libc++. Fixes #44433.Jed Davis-0/+2
The main goal here is to use FreeBSD's normal libc++, instead of statically linking the libstdc++ packaged with GCC, because that libstdc++ has bugs that cause rustc to deadlock inside LLVM. But the easiest way to use libc++ is to switch the build from GCC to Clang, and the Clang package in the Ubuntu image already knows how to cross-compile (given a sysroot and preferably cross-binutils), so the toolchain script now uses that instead of building a custom compiler. This also de-duplicates the `build-toolchain.sh` script.
2017-12-03Auto merge of #46435 - cuviper:min-llvm-3.9, r=rkruppebors-32/+12
Assume at least LLVM 3.9 in rustllvm and rustc_llvm We bumped the minimum LLVM to 3.9 in #45326. This just cleans up the conditional code in the `rustllvm` C++ wrappers to assume that minimum, and similarly cleans up the `rustc_llvm` build script.
2017-12-01rustc_llvm: Assume at least LLVM 3.9 in build.rsJosh Stone-32/+12
2017-11-28*: strip calls to cc::Build::compileTamir Duberstein-1/+1
The documentation states: "The name output should be the name of the library." and this is already done in more recently-added callers.
2017-11-28rustc_llvm: use cc::Build::defineTamir Duberstein-3/+3
2017-11-26make OpenBSD to use libc++ instead of (e)stdc++Sébastien Marie-2/+2