about summary refs log tree commit diff
path: root/src/bootstrap/native.rs
AgeCommit message (Collapse)AuthorLines
2023-03-24Rename 'src/bootstrap/native.rs' to llvm.rsRobin Hafid-1358/+0
Renamed 'native.rs' to 'llvm.rs', also moved `TestHelpers` to `test.rs`.Replaced all the `native.rs` ocurrences at `src/bootstrap` files to `llvm.rs`
2023-03-22Rollup merge of #109373 - ids1024:llvm-unreachable-optimize, r=ozkanonurMatthias Krüger-0/+1
Set LLVM `LLVM_UNREACHABLE_OPTIMIZE` to `OFF` This option was added to LLVM in https://reviews.llvm.org/D121750?id=416339. It makes `llvm_unreachable` in builds without assertions compile to an `LLVM_BUILTIN_TRAP` instead of `LLVM_BUILTIN_UNREACHABLE` (which causes undefined behavior and is equivalent to `std::hint::unreachable_unchecked`). Having compiler bugs triggering undefined behavior generally seems undesirable and inconsistent with Rust's goals. There is a check in `src/tools/tidy/src/style.rs` to reject code using `llvm_unreachable`. But it is used a lot within LLVM itself. For instance, this changes a failure I get compiling `libcore` for m68k from a `SIGSEGV` to `SIGILL`, which seems better though it still doesn't provide a useful message without switching to an LLVM build with asserts. It may be best not to do this if it noticeably degrades compiler performance, but worthwhile if it doesn't do so in any significant way. I haven't looked into what benchmarks there are for Rustc. That should be considered before merging.
2023-03-21Set LLVM `LLVM_UNREACHABLE_OPTIMIZE` to `OFF`Ian Douglas Scott-0/+1
This option was added to LLVM in https://reviews.llvm.org/D121750?id=416339. It makes `llvm_unreachable` in builds without assertions compile to an `LLVM_BUILTIN_TRAP` instead of `LLVM_BUILTIN_UNREACHABLE` (which causes undefined behavior and is equivalent to `std::hint::unreachable_unchecked`). Having compiler bugs triggering undefined behavior generally seems undesirable and inconsistent with Rust's goals. There is a check in `src/tools/tidy/src/style.rs` to reject code using `llvm_unreachable`. But it is used a lot within LLVM itself. For instance, this changes a failure I get compiling `libcore` for m68k from a `SIGSEGV` to `SIGILL`, which seems better though it still doesn't provide a useful message without switching to an LLVM build with asserts. It may be best not to do this if it noticeably degrades compiler performance, but worthwhile if it doesn't do so in any significant way. I haven't looked into what benchmarks there are for Rustc. That should be considered before merging.
2023-03-20Rollup merge of #109170 - eggyal:xc-linux-cmake, r=Mark-SimulacrumMatthias Krüger-0/+2
Set `CMAKE_SYSTEM_NAME` for Linux targets When bootstrap compiles native dependencies like LLVM, it should set `CMAKE_SYSTEM_NAME` for the target system; otherwise cmake may not identify that it is cross-compiling. In particular, when building a Linux rustc on a macOS host, cmake was including `-isysroot /path/to/macOS.sdk` options that caused things to break. By setting `CMAKE_SYSTEM_NAME=Linux` when building for Linux targets, the macOS SDK is no longer passed as sysroot to the compiler. r? bootstrap
2023-03-15Set CMAKE_SYSTEM_NAME for Linux targetsAlan Egerton-0/+2
When bootstrap compiles native dependencies like LLVM, it should set CMAKE_SYSTEM_NAME for the target system; otherwise cmake may not identify that it is cross-compiling. In particular, when building a Linux rustc on a macOS host, cmake was including `-isysroot /path/to/macOS.sdk` options that caused things to break. By setting `CMAKE_SYSTEM_NAME=Linux` when building for Linux targets, the macOS SDK is no longer passed as sysroot to the compiler.
2023-03-15add `enable-warnings` flag for llvmozkanonur-6/+3
Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-03-11Rename `config.toml.example` to `config.example.toml`Thom Chiovoloni-1/+1
2023-03-09only call git on git checkoutsJacob Heider-1/+1
2023-03-07Rollup merge of #108619 - jyn514:llvm-version-check, r=cuviperYuki Okushi-4/+0
Remove the option to disable `llvm-version-check` We don't support old versions of LLVM; there's no reason to have an easy way to force bootstrap to use them anyway. If someone really needs to use an unsupported version, they can modify bootstrap to change the version range. r? ``@cuviper`` on whether we want to do this or not, since you maintain rust on Fedora and touched this config last.
2023-03-05Remove the option to disable `llvm-version-check`Joshua Nelson-4/+0
We don't support old versions of LLVM; there's no reason to have an easy way to force bootstrap to use them anyway. If someone really needs to use an unsupported version, they can modify bootstrap to change the version range.
2023-03-05Rollup merge of #108613 - jyn514:rm-skip-rebuild, r=Mark-SimulacrumMatthias Krüger-9/+0
Remove `llvm.skip-rebuild` option This was added to in 2019 to speed up rebuild times when LLVM was modified. Now that download-ci-llvm exists, I don't think it makes sense to support an unsound option like this that can lead to miscompiles; and the code cleanup is nice too. r? `@Mark-Simulacrum` cc `@varkor` #65612
2023-03-04Apply BOLT optimizations without rebuilding LLVMJakub Beránek-23/+0
2023-03-02Auto merge of #107879 - icedrocket:update-llvm, r=cuviperbors-9/+12
Update LLVM submodule Fixes #105626
2023-03-01Remove `llvm.skip-rebuild` optionJoshua Nelson-9/+0
This was added to in 2019 to speed up rebuild times when LLVM was modified. Now that download-ci-llvm exists, I don't think it makes sense to support an unsound option like this that can lead to miscompiles; and the code cleanup is nice too.
2023-02-28Skip test `download_ci_llvm` with modified LLVMJosh Stone-9/+12
2023-02-21Revert "port over symlink_file function from Build to Config and create ↵Jakub Beránek-1/+1
symlink for legacy rustfmt path" This reverts commit 41c6c5d4996728b5a635319ef9b077a3d0ccc480.
2023-02-18Auto merge of #106476 - ↵bors-3/+22
keith:ks/add-sanitizer-support-for-modern-ios-platforms, r=badboy Add sanitizer support for modern iOS platforms asan and tsan generally support iOS, but that previously wasn't configured in rust. This only adds support for the simulator architectures, and arm64 device architecture, not the older 32 bit architectures.
2023-02-12Add sanitizer support for modern iOS platformsKeith Smiley-3/+22
asan and tsan generally support iOS, but that previously wasn't configured in rust. This only adds support for the simulator architectures, and arm64 device architecture, not the older 32 bit architectures.
2023-02-10Update the minimum external LLVM to 14Josh Stone-2/+2
2023-02-09port over symlink_file function from Build to Config and create symlink for ↵Zephaniah Ong-1/+1
legacy rustfmt path
2023-01-27Revisit fix_is_ci_llvm_available logic; read build triple from tomlSergey Prytkov-34/+31
2023-01-20Enable sanitizers for s390x-linuxUlrich Weigand-0/+6
Include sanitizers supported by LLVM on s390x (asan, lsan, msan, tsan) in the target definition, as well as in the compiletest supported list. Build sanitizer runtime for the target. Enable sanitizers in the CI.
2023-01-11Change `src/test` to `tests` in source files, fix tidy and testsAlbert Larsan-3/+3
2023-01-06Auto merge of #106415 - Nilstrieb:where-is-my-master-branch, r=jyn514bors-1/+3
Handle non-existent upstream master branches in `x fmt` People who do have a remote for `rust-lang/rust` but don't have the master branch checked out there used to get this error when running `x fmt`: > fatal: ambiguous argument 'rust/master': unknown revision or path not in the working tree. > Use '--' to separate paths from revisions, like this: > 'git <command> [<revision>...] -- [<file>...]' > rust/master Which is not exactly helpful. Now, we fall back to `origin/master` (hoping that at least that remote exists) for that case. If there is still some error, we just fall back to `x fmt .` and print a warning. r? `@jyn514`
2023-01-05Add vendor to Fuchsia's target tripleDavid Koloski-2/+2
Historically, Rust's Fuchsia targets have been labeled x86_64-fuchsia and aarch64-fuchsia. However, they should technically contain vendor information. This CL changes Fuchsia's target triples to include the "unknown" vendor since Clang now does normalization and handles all triple spellings. This was previously attempted in #90510, which was closed due to inactivity.
2023-01-03turn a comment into an actual doc commentRémy Rakic-7/+7
2023-01-03slight cleanupRémy Rakic-2/+1
2023-01-03make the `native::LLD` step able to use an already built lldRémy Rakic-0/+14
Makes the lld step avoid building it from source when possible: when dist has packaged it along the other LLVM binaries for the rust-dev component.
2023-01-03Add `build_helper` crate to share code between tidy and bootstrapNilstrieb-1/+3
2022-12-31Revert "Auto merge of #105058 - ↵Joshua Nelson-3/+1
Nilstrieb:no-merge-commits-for-you-only-bors-is-allowed-to-do-that, r=jyn514" This reverts commit 4839886f0abe208ab8f2bb73a3076a59fe2ab60c, reversing changes made to ce85c98575e3016cf2007d90a85be321e592aa96.
2022-12-30Add `build_helper` crate to share code between tidy and bootstrapNilstrieb-1/+3
2022-12-22Auto merge of #106000 - nikic:lld-build, r=Mark-Simulacrumbors-63/+46
Make LLD build forward-compatible with LLVM 16 Switch to using the cmake module instead of llvm-config. I believe this also removes the need for llvm-config-wrapper.
2022-12-22Use LLVM_CMAKE_DIR for lld buildNikita Popov-59/+46
LLVM_CONFIG_PATH is no longer supported as of LLVM 16, switch to using the cmake module instead. We separately return the llvm-config and cmake directory paths, because llvm-config always refers to the host binary, while the cmake directory is for the target triple.
2022-12-21Don't explicitly set C++ standard for lldNikita Popov-4/+0
LLVM does this itself since 606cb8548a1b7763e0c8489c5efe66803a7ede72, and 14 is no longer the correct standard when building lld 16, causing build failures.
2022-12-19Fix arch flag on i686-apple-darwinMarcus Calhoun-Lopez-0/+3
i686-apple-darwin should use `-arch i386` instead of `-arch i686`
2022-11-13Make all download functions need only Config, not BuilderJoshua Nelson-79/+5
This also adds a new `mod download` instead of scattering the download code across `config.rs` and `native.rs`.
2022-11-12Distinguish `--dry-run` from the automatic dry run checkJoshua Nelson-10/+10
2022-11-03Fix artifact version/channel detection for stableMark Rousskov-2/+2
On stable, our artifacts are uploaded with the raw version number (e.g., 1.65.0), not the channel. This adjusts our detection logic to use the version number from src/version when we detect the stable channel.
2022-10-10Auto merge of #94381 - Kobzol:llvm-bolt, r=Mark-Simulacrumbors-0/+29
Use BOLT in CI to optimize LLVM This PR adds an optimization step in the Linux `dist` CI pipeline that uses [BOLT](https://github.com/llvm/llvm-project/tree/main/bolt) to optimize the `libLLVM.so` library built by boostrap. Steps: - [x] Use LLVM 15 as a bootstrap compiler and use it to build BOLT - [x] Compile LLVM with support for relocations (`-DCMAKE_SHARED_LINKER_FLAGS="-Wl,-q"`) - [x] Gather profile data using instrumented LLVM - [x] Apply profile to LLVM that has already been PGOfied - [x] Run with BOLT profiling on more benchmarks - [x] Decide on the order of optimization (PGO -> BOLT?) - [x] Decide how we should get `bolt` (currently we use the host `bolt`) - [x] Clean up The latest perf results can be found [here](https://github.com/rust-lang/rust/pull/94381#issuecomment-1258269440). The current CI build time with BOLT applied is around 1h 55 minutes.
2022-10-09Use BOLT in x64 dist CI to optimize LLVMJakub Beránek-0/+29
2022-10-07Don't run llvm-config in dry runsJosh Stone-5/+10
2022-10-07Let llvm-config tell us where to find its toolsJosh Stone-9/+4
2022-10-02Auto merge of #100557 - dawnofmidnight:tarball-commit-info, r=Mark-Simulacrumbors-22/+30
fix: use git-commit-info for version information Fixes #33286. Fixes #86587. This PR changes the current `git-commit-hash` file that `./x.py` dist puts in the `rustc-{version}-src.tar.{x,g}z` to contain the hash, the short hash, and the commit date from which the tarball was created, assuming git was available when it was. It uses this for reading the version so that rustc has all the appropriate metadata. # Testing Testing this is kind of a pain. I did it with something like ```sh ./x.py dist # ensure that `ignore-git` is `false` in config.toml cp ./build/dist/rustc-1.65.0-dev-src.tar.gz ../rustc-1.65.0-dev-src.tar.gz cd .. && tar -xzf rustc-1.65.0-dev-src && cd rustc-1.65.0-dev-src ./x.py build ``` Then, the output of `rustc -vV` with the stage1 compiler should have the `commit-hash` and `commit-date` fields filled, rather than be `unknown`. To be completely sure, you can use `rustc --sysroot` with the stdlib that the original `./x.py dist` made, which will require that the metadata matches.
2022-10-01fix: use git-commit-info for version informationdawnofmidnight-22/+30
This PR adds support for fetching version information from the `git-commit-info` file when building the compiler from a source tarball.
2022-09-16Remove the allow-list for dynamic linking of LLVM toolsChris Wailes-7/+2
This commit removes an allow-list for the dynamic linking of the LLVM tools and instead relies on the builder's linking preference only.
2022-09-01Auto merge of #100707 - dzvon:fix-typo, r=davidtwcobors-1/+1
Fix a bunch of typo This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-31Fix a bunch of typoDezhi Wu-1/+1
This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-28add riscv64gc-unknown-openbsd support (target riscv64-unknown-openbsd on ↵Sébastien Marie-2/+3
OpenBSD) - add platform-support documentation - add riscv64gc-unknown-openbsd spec - do not try to link with -latomic on openbsd
2022-08-20Enable downloading prebuilt LLVM in test buildersMark Rousskov-1/+7
See comment added for details on the test builder restriction. This is primarily intended for macOS CI, but is likely to be a slight win on other builders too.
2022-08-19Refactor if-available setting to work in CIMark Rousskov-9/+74
This verifies if the HEAD sha matches with the detected LLVM SHA, and if not, permits usage of the detected LLVM. Otherwise, we fallback on regular non-downloaded LLVM (currently still cached with sccache, though that's still 10+ minutes on macOS).