about summary refs log tree commit diff
path: root/src/bootstrap/native.rs
AgeCommit message (Collapse)AuthorLines
2022-03-04Support RelWithDebInfo for lld.ridwanabdillahi-1/+9
2022-03-03bootstrap: correct reading of flags for llvmJon Gjengset-12/+14
First, this reverts the `CFLAGS`/`CXXFLAGS` of #93918. Those flags are already read by `cc` and populated into `Build` earlier on in the process. We shouldn't be overriding that based on `CFLAGS`, since `cc` also respects overrides like `CFLAGS_{TARGET}` and `HOST_CFLAGS`, which we want to take into account. Second, this adds the same capability to specify target-specific versions of `LDFLAGS` as we have through `cc` for the `C*` flags: https://github.com/alexcrichton/cc-rs#external-configuration-via-environment-variables Note that this also necessitated an update to compiletest to treat CXXFLAGS separately from CFLAGS.
2022-02-11bootstrap: -static-libstdc++ is a linker flagJon Gjengset-14/+8
Fixes #70468. Closes #89983.
2022-02-11bootstrap: make LLVM build respect *FLAGS envvarsJon Gjengset-22/+63
This tidies up the logic in `src/bootstrap/native.rs` such that: - `CMAKE_*_LINKER_FLAGS` is not overridden if we add to it twice. - `CMAKE_*_FLAGS` also include the standard `*FLAGS` environment variables, which CMake respects when we _don't_ set `CMAKE_*_FLAGS`. - `llvm.ldflags` from `config.toml` appends to the ldflags Rust's bootstrap logic adds, rather than replacing them. Fixes #93880.
2022-02-09Add llvm.build-config optionTyler Mandry-0/+4
2021-12-03Explain why libatomic is not needed on FreeBSD riscv64Tobias Kortkamp-2/+7
From Jessica Clarke (jrtc27@)
2021-11-27Add riscv64gc-unknown-freebsdTobias Kortkamp-1/+1
2021-10-22Update the minimum external LLVM to 12Josh Stone-2/+2
2021-10-22Update the minimum external LLVM to 11Josh Stone-2/+2
2021-10-18config: add the option to enable LLVM testsAugie Fackler-1/+2
I'm working on some LLVM patches in concert with a Rust patch, and it's helping me quite a bit to have this as an option. It doesn't seem that hard, so I figured I'd formalize it in x.py and send it upstream.
2021-09-17bootstrap: Add LLVM target matching for M68kJohn Paul Adrian Glaubitz-1/+1
2021-09-04Auto merge of #88364 - pietroalbini:llvm-install-filecheck, r=Mark-Simulacrumbors-0/+5
Make sure FileCheck is copied in the LLVM output directory The tool, which is needed by parts of our test suite, is built as part of LLVM but is *not* copied to the directory containing the output LLVM binaries. This adds a flag to ensure the binary is copied. This shouldn't add any extra built time, as the flag just installs extra binaries that were already compiled. This is not strictly needed for the test suite to work (as it also checks `build/$target/llvm/build/bin` for the binary), but it allows deleting the `build/$TARGET/llvm/build` directory (which also contains the intermediary build artifacts) without affecting the test suite, saving disk space.
2021-08-30sunos systems add sanitizer supported.David Carlier-0/+2
2021-08-28build llvm libunwind.a in rustbuild12101111-1/+152
2021-08-26make sure FileCheck is copied in the LLVM output directoryPietro Albini-0/+5
The tool, which is needed by parts of our test suite, is built as part of LLVM but is *not* copied to the directory containing the output LLVM binaries. This adds a flag to ensure the binary is copied. This shouldn't add any extra built time, as the flag just installs extra binaries that were already compiled.
2021-08-24PGO for LLVM builds on x86_64-unknown-linux-gnu in CIMark Rousskov-0/+8
This shows up to 5% less instruction counts on multiple benchmarks, and up to 19% wins on the -j1 wall times for rustc self-compilation. We can afford to spend the extra cycles building LLVM essentially once more for the x86_64-unknown-linux-gnu CI build today. The builder finishes in around 50 minutes on average, and this adds just 10 more minutes. Given the sizeable improvements in compiler performance, this is definitely worth it.
2021-08-16Set LLVM_INCLUDE_TESTS=OFF when building LLVMNikita Popov-0/+1
When LLVM_INCLUDE_TESTS is enabled (by default), LLVM requires Python 3.6 for the lit test runner, otherwise only Python 3.0 is required. As we have many docker images using Ubuntu 16.04, which only has Python 3.5, this avoids the need to install a newer Python version for them.
2021-08-02Auto merge of #87297 - ZuseZ4:new_build_flags, r=Mark-Simulacrumbors-0/+6
add two new build flags to build clang and enable llvm plugins Based on the discussion here: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Add.20configure.20flag.20to.20build.20clang/near/246439138 It allows building clang (which already is part of the llvm-project) based on the same llvm version which we use to build rustc. It also allows enabling llvm's plugin interface, which is required for https://enzyme.mit.edu/. There is no further integration beside of this basic build support.
2021-07-31add two new build flags to build clang and enable llvm pluginsManuel Drehwald-0/+6
2021-07-31netbsd x86_64 arch enable supported sanitizers.David Carlier-0/+3
2021-07-22Add support for powerpc-unknown-freebsdPiotr Kubaj-0/+9
2021-07-20Update all submodules that rustbuild doesn't depend on lazilyJoshua Nelson-84/+2
This only updates the submodules the first time they're needed, instead of unconditionally the first time you run x.py. Ideally, this would move *all* submodules and not exclude some tools and backtrace. Unfortunately, cargo requires all `Cargo.toml` files in the whole workspace to be present to build any crate. On my machine, this takes the time for an initial submodule clone (for `x.py --help`) from 55.70 to 15.87 seconds. This uses exactly the same logic as the LLVM update used, modulo some minor cleanups: - Use a local variable for `src.join(relative_path)` - Remove unnecessary arrays for `book!` macro and make the macro simpler to use - Add more comments
2021-07-10Account for `submodules = false` in config.toml when updating LLVM submoduleJoshua Nelson-0/+4
2021-06-26Auto merge of #86586 - Smittyvb:https-everywhere, r=petrochenkovbors-2/+2
Use HTTPS links where possible While looking at #86583, I wondered how many other (insecure) HTTP links were in `rustc`. This changes most other `http` links to `https`. While most of the links are in comments or documentation, there are a few other HTTP links that are used by CI that are changed to HTTPS. Notes: - I didn't change any to or in licences - Some links don't support HTTPS :( - Some `http` links were dead, in those cases I upgraded them to their new places (all of which used HTTPS)
2021-06-25Auto merge of #86015 - jyn514:revert-revert, r=Mark-Simulacrumbors-1/+80
Move LLVM submodule updates back to native.rs Time to find more bugs! The first commit is a straight revert of https://github.com/rust-lang/rust/pull/85647, the second is a fix for https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/x.2Epy.20always.20updates.20LLVM.20submodule/near/240113320 and https://github.com/rust-lang/rust/pull/82653#issuecomment-846755631. I haven't been able to replicate https://github.com/rust-lang/rust/pull/82653#issuecomment-849013698.
2021-06-23Use HTTPS links where possibleSmitty-2/+2
2021-06-06Auto merge of #79608 - alessandrod:bpf, r=nagisabors-1/+1
BPF target support This adds `bpfel-unknown-none` and `bpfeb-unknown-none`, two new no_std targets that generate little and big endian BPF. The approach taken is very similar to the cuda target, where `TargetOptions::obj_is_bitcode` is enabled and code generation is done by the linker. I added the targets to `dist-various-2`. There are [some tests](https://github.com/alessandrod/bpf-linker/tree/main/tests/assembly) in bpf-linker and I'm planning to add more. Those are currently not ran as part of rust CI.
2021-06-05Simplify commit checkJoshua Nelson-22/+15
2021-06-04Fix commit checkJoshua Nelson-4/+8
2021-06-04Revert "Revert "Move llvm submodule updates to rustbuild""Joshua Nelson-1/+83
This reverts commit ad308264a38531bc8d2179324bac3652a1cda640.
2021-05-31Auto merge of #85395 - 12101111:build-crt, r=petrochenkovbors-0/+66
Build crtbegin.o/crtend.o from source code Build crtbengin.o/crtend.o from source code instead of copying from gcc. The crtbegin and crtend implementation from llvm don't need `crtbeginS.o` for PIC. `crtbegin{,S,T}.o` is unified into one generic `crtbegin.o`. See the comments in https://reviews.llvm.org/D28791#1419436 and https://reviews.llvm.org/D28791#1420914 fix: https://github.com/rust-lang/rust/issues/85310 , fix: https://github.com/rust-lang/rust/issues/47551 , fix: https://github.com/rust-lang/rust/issues/84033
2021-05-31Build crtbengin.o/crtend.o from source code12101111-0/+66
2021-05-29BPF: misc minor review fixesAlessandro Decina-2/+2
2021-05-27Do not try to build LLVM with Zlib on WindowsMateusz MikuĊ‚a-1/+1
We do not install Zlib on the CI but recent builds somehow started picking it's shared version. To avoid relying on CI binaries so let's explicitly disable it.
2021-05-24Revert "Move llvm submodule updates to rustbuild"Mark Rousskov-83/+1
2021-05-23Add BPF targetAlessandro Decina-1/+1
This change adds the bpfel-unknown-none and bpfeb-unknown-none targets which can be used to generate little endian and big endian BPF
2021-05-22Move llvm submodule updates to rustbuildJoshua Nelson-1/+83
This enables better caching, since LLVM is only updated when needed, not whenever x.py is run. Before, bootstrap.py had to use heuristics to guess if LLVM would be needed, and updated the module more often than necessary as a result. This syncs the LLVM submodule only just before building the compiler, so people working on the standard library never have to worry about it. Example output: ``` Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu) Updating submodule src/llvm-project Submodule 'src/llvm-project' (https://github.com/rust-lang/llvm-project.git) registered for path 'src/llvm-project' Submodule path 'src/llvm-project': checked out 'f9a8d70b6e0365ac2172ca6b7f1de0341297458d' ``` - Don't try to update the LLVM submodule when using system LLVM Previously, this would try to update LLVM unconditionally. Now the submodule is only initialized if `llvm-config` is not set. - Don't update LLVM submodule in dry runs This prevents the following test failures: ``` running 17 tests fatal: invalid gitfile format: /checkout/src/llvm-project/.git test builder::tests::defaults::build_cross_compile ... FAILED ---- builder::tests::defaults::build_default stdout ---- thread 'main' panicked at 'command did not execute successfully: "git" "rev-parse" "HEAD" expected success, got: exit code: 128', src/build_helper/lib.rs:139:9 ``` - Try running git without --progress if it fails the first time This avoids having to do version detection to see if --progress is supported or not. - Don't try to update submodules when the source repository isn't managed by git - Update LLVM submodules that have already been checked out - Only check for whether the submodule should be updated in lib.rs; update it unconditionally in native.rs
2021-04-09Enable sanitizers for x86_64-unknown-linux-musl12101111-0/+3
2021-04-07Cleanup option parsing and config.toml.exampleJoshua Nelson-2/+2
- Add an assertion that `link-shared = true` when `thin-lto = true`. Previously, link-shared would be silently overwritten. - Get rid of `Option<bool>` in bootstrap/config.rs. Set defaults immediately instead of delaying until later in bootstrap. This makes it easier to find what the default value is. - Remove redundant `config.x = false` when the default was already false - Set defaults for `bindir` in `default_opts()` instead of `parse()` - Update `download-ci-llvm = if-supported` option to match bootstrap.py - Remove redundant check for link_shared. Previously, it was checked twice. - Update various options in config.toml.example to their defaults. Previously, some options showed an example value instead of the default value. - Fix incorrect defaults in config.toml.example + `use-libcxx` defaults to false + Add missing `check-stage = 0` + Update several defaults to be conditional (e.g. `if incremental { 10 } else { 100 }`) - Remove redundant defaults in prose - Use the same comment for the default and target-dependent `musl-root` - Fix typos - Link to `cc_detect` for `cc` and `cxx`, since the logic is ... complicated. - Update more defaults to better reflect how they actually get set - Remove ignored `gpg-password-file` option This stopped being used in https://github.com/rust-lang/rust/commit/7704d35accfe1b587ce41ea09ca3bf6a47aca117, but was never removed from config.toml. - Remove unused flags from `config.toml` + Disallow `infodir` and `localstatedir` in `config.toml` + Allow the flags in `./configure`, but give a warning that they will be ignored. + Fix incorrect comment that `datadir` will be ignored. Example output: ``` $ ./configure --set install.infodir=xxx configure: processing command line configure: configure: install.infodir := xxx configure: build.configure-args := ['--set', 'install.infodir=xxx'] warning: infodir will be ignored configure: configure: writing `config.toml` in current directory configure: configure: run `python /home/joshua/rustc3/x.py --help` configure: ``` - Update CHANGELOG - Add "as an example" where appropriate - Link to an issue instead of to ephemeral chats
2021-03-22Update the minimum external LLVM to 10Josh Stone-2/+2
2021-03-01Set CMAKE_SYSTEM_NAME for solaris/illumosNikita Popov-0/+2
When cross-compiling to solaris/illumos targets, set CMAKE_SYSTEM_NAME to SunOS.
2021-02-07HWASan supportTri Vo-1/+1
2021-01-30Revert "Auto merge of #81489 - nikic:x86-64-dist-update, r=Mark-Simulacrum"Nikita Popov-4/+1
This reverts commit cb6787ae82d388045cdf6b5dc73787d828d91feb, reversing changes made to 0248c6f178ab3a4d2ec702b7d418ff8375ab0515.
2021-01-28Use LLVM_USE_LINKER instead of LLVM_ENABLE_LLDNikita Popov-1/+1
This avoids a conflict if llvm.thin-lto=true is combined with an explicit llvm.use-linker=lld.
2021-01-28Update Python and Clang on x86 dist imagesNikita Popov-0/+3
LLVM 12 no longer builds with Python 2, so install Python 3 in preparatin. However, Clang 10 does not build with Python 3, so we need update to Clang 11 as well, which supports both. Unfortunately, doing so results in errors while linking the libLLVM.so into other binaries: > __morestack: invalid needed version 2 This is fixed by using LLD instead. Possibly this is due to a binutils linker bug, but updating to the latest binutils version does not fix it.
2021-01-15Allow downloading LLVM on WindowsJoshua Nelson-1/+0
- Don't ignore packaging `llvm/lib/` for `rust-dev` when LLVM is linked statically - Add `link-type.txt` so bootstrap knows whether llvm was linked statically or dynamically - Don't assume CI LLVM is linked dynamically in `bootstrap::config` - Fall back to dynamic linking if `link-type.txt` doesn't exist - Fix existing bug that split the output of `llvm-config` on lines, not spaces - Enable building LLVM tests This works around the following llvm bug: ``` llvm-config: error: component libraries and shared library llvm-config: error: missing: /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/llvm/build/lib/libgtest.a llvm-config: error: missing: /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/llvm/build/lib/libgtest_main.a llvm-config: error: missing: /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/llvm/build/lib/libLLVMTestingSupport.a thread 'main' panicked at 'command did not execute successfully: "/home/joshua/rustc2/build/x86_64-unknown-linux-gnu/llvm/build/bin/llvm-config" "--libfiles" ``` I'm not sure why llvm-config thinks these are required, but to avoid the error, this builds them anyway. - Temporarily set windows as the try builder. This should be reverted before merging. - Bump version of `download-ci-llvm-stamp` `src/llvm-project` hasn't changed, but the generated tarball has. - Only special case MacOS when dynamic linking. Static linking works fine. - Store `link-type.txt` to the top-level of the tarball This allows writing the link type unconditionally. Previously, bootstrap had to keep track of whether the file IO *would* succeed (it would fail if `lib/` didn't exist), which was prone to bugs. - Make `link-type.txt` required Anyone downloading this from CI should be using a version of bootstrap that matches the version of the uploaded artifacts. So a missing link-type indicates a bug in x.py.
2020-12-09Enable ASan, TSan, UBSan for aarch64-apple-darwin.Corey Farwell-0/+1
2020-11-12Bump the minimal supported LLVM version in the bootstrapping code to 9.0DevJPM-2/+2
2020-10-30Enable LLVM Polly via llvm-args.Joseph Rafael Ferrer-0/+4
2020-10-16Haiku: explicitly set CMAKE_SYSTEM_NAME when cross-compilingNiels Sascha Reedijk-0/+2
This resolves issues where the cross-build of LLVM fails because it tries to link to the host's system libraries instead of the target's system libraries.