about summary refs log tree commit diff
path: root/src/bootstrap/cc_detect.rs
AgeCommit message (Collapse)AuthorLines
2023-10-17move bootstrap utils into bootstrap/src/utils moduleonur-ozkan-273/+0
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-07-30bootstrap: inline format!() argsMatthias Krüger-1/+1
2023-06-12split finding the cc for a single target into a separate fnPietro Albini-48/+52
2023-06-12allow mutating the c compilers detected by bootstrapPietro Albini-5/+5
This will be needed to create synthetic targets in future commits.
2023-06-04Greatly decrease the size of `rustc_driver.so` when debuginfo is enabledjyn-0/+2
- Only add -gz if it's supported - Don't include extra unnecessary debuginfo when only debuginfo-level=1 is set - Compress debuginfo sections to reduce the size of debuginfo on disk. before: 650 MB line tables only: 335 MB compressed only: 216 MB compressed and line tables: 186 MB no debuginfo at all: 130 MB I want to investigate why `-C line-tables-only` is still ~tripling the size of the binary, but this seems like a good improvement in the meantime. I've tested that both valgrind and perf can read the debuginfo: ``` (bash@dev-desktop-us-1.infra.rust-lang.org) ~/rust [08:31:08] ; valgrind $(rustup which rustc --toolchain rust_stage2) --version ==441671== Memcheck, a memory error detector ==441671== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==441671== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info ==441671== Command: /home/gh-jyn514/.local/lib/rustup/toolchains/rust_stage2/bin/rustc --version ==441671== rustc 1.70.0-dev ==441671== ==441671== HEAP SUMMARY: ==441671== in use at exit: 231,289 bytes in 1,874 blocks ==441671== total heap usage: 2,538 allocs, 664 frees, 486,368 bytes allocated ==441671== ==441671== LEAK SUMMARY: ==441671== definitely lost: 70,656 bytes in 1 blocks ==441671== indirectly lost: 0 bytes in 0 blocks ==441671== possibly lost: 0 bytes in 0 blocks ==441671== still reachable: 160,633 bytes in 1,873 blocks ==441671== suppressed: 0 bytes in 0 blocks ==441671== Rerun with --leak-check=full to see details of leaked memory ==441671== ==441671== For lists of detected and suppressed errors, rerun with: -s ==441671== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) ; perf record $(rustup which rustc --toolchain rust_stage2) --version rustc 1.70.0-dev [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.005 MB perf.data (70 samples) ] ; perf report Samples: 70 of event 'cycles:u', Event count (approx.): 21356967 Overhead Command Shared Object Symbol 51.55% rustc ld-linux-aarch64.so.1 [.] _dl_lookup_symbol_x 18.70% rustc ld-linux-aarch64.so.1 [.] _dl_relocate_object 11.95% rustc ld-linux-aarch64.so.1 [.] do_lookup_x 5.55% rustc [unknown] [k] 0xffffa9ad41cfcfdc 2.68% rustc libc.so.6 [.] __GI___strlen_asimd 2.42% rustc librustc_driver-1a385c366c35e81a.so [.] llvm::StringMapImpl::LookupBucketFor 2.16% rustc librustc_driver-1a385c366c35e81a.so [.] _GLOBAL__sub_I_X86InstructionSelector.cpp 1.96% rustc libstd-990fe978dab76ef3.so [.] <alloc::vec::Vec<T,A> as core::clone::Clone>::clone 1.60% rustc librustc_driver-1a385c366c35e81a.so [.] llvm::cl::opt<bool, false, llvm::cl::parser<bool> >::~opt 1.22% rustc ld-linux-aarch64.so.1 [.] strcmp 0.13% rustc ld-linux-aarch64.so.1 [.] stat64 0.05% rustc ld-linux-aarch64.so.1 [.] __minimal_calloc 0.02% rustc ld-linux-aarch64.so.1 [.] __GI___tunables_init 0.02% rustc ld-linux-aarch64.so.1 [.] _dl_start 0.00% rustc [unknown] [k] 0xffffa9ad41cfd844 0.00% rustc ld-linux-aarch64.so.1 [.] _start ```
2022-12-14Update CI to use Android NDK r25bChris Wailes-6/+18
This commit updates the CI definitions to use the most recent Android LTS NDK release: r25b. Changes since the last NDK used by Rust negate the need to generate "standalone toolchains" and newer NDKs can be used in-place. See https://developer.android.com/ndk/guides/other_build_systems#overview
2022-11-19Revert "Update CI to use Android NDK r25b"Alex Pinkus-18/+6
This reverts commit bf7f1ca316a249cf99d722d79a0db12fef687142.
2022-11-17set correct default value for cc and cxx on androidPietro Albini-18/+22
2022-10-04Update CI to use Android NDK r25bChris Wailes-7/+18
This commit updates the CI definitions to use the most recent Android LTS NDK release: r25b. Changes since the last NDK used by Rust negate the need to generate "standalone toolchains" and newer NDKs can be used in-place. See https://developer.android.com/ndk/guides/other_build_systems#overview
2022-06-27Ensure that `static_crt` is set in the bootstrapper whenever using `cc` to ↵Daniel Paoliello-30/+27
get a compiler command line. When attempting to build rustc with LLVM on Windows, I noticed that the CRT flag provided to the C and C++ Compilers was inconsistent: ``` "-DCMAKE_C_FLAGS=-nologo -MT -Brepro" "-DCMAKE_CXX_FLAGS=-nologo -MD -Brepro" ``` Since the bootstrapper also sets the various `LLVM_USE_CRT` variables, this resulted in cl.exe reporting a bunch of warnings: ``` cl : Command line warning D9025 : overriding '/MD' with '/MT' ``` The root cause for this is that `cc_detect::find` was creating a `cc::Build` twice, but didn't set `static_crt` the second time. It's possible that this what is also causing #81381
2022-04-15Respect ranlib specified for target during LLVM buildNikita Popov-0/+4
The ranlib specified for the target was never actually transferred into the builder configuration. In the dist-x86_64-linux build we ended up using ranlib instead of llvm-ranlib.
2022-03-05Merge build_helper into utilbjorn3-1/+1
2022-03-05Remove build_helperbjorn3-2/+1
The majority of the code is only used by either rustbuild or rustc_llvm's build script. Rust_build is compiled once for rustbuild and once for every stage. This means that the majority of the code in this crate is needlessly compiled multiple times. By moving only the code actually used by the respective crates to rustbuild and rustc_llvm's build script, this needless duplicate compilation is avoided.
2022-03-03bootstrap: correct reading of flags for llvmJon Gjengset-3/+4
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.
2020-10-19bootstrap: fall back to auto-detected CXXJonas Schievink-1/+2
This allows us to use the C++ compiler configured via `CXX_target_triple` env vars
2020-08-25For VxWorks:Pang, Baoshan-1/+2
fix building errors use wr-c++ as linker
2020-07-17Teach bootstrap about target files vs target triplesJake Goulding-17/+17
`rustc` allows passing in predefined target triples as well as JSON target specification files. This change allows bootstrap to have the first inkling about those differences. This allows building a cross-compiler for an out-of-tree architecture (even though that compiler won't work for other reasons). Even if no one ever uses this functionality, I think the newtype around the `Interned<String>` improves the readability of the code.
2020-06-07Enable LVI hardening for x86_64-fortanix-unknown-sgxJethro Beekman-1/+3
2019-12-22Format the worldMark Rousskov-21/+40
2019-08-131. support crt-staticBaoshan Pang-1/+1
2. change armv7_wrs_vxworks to armv7_wrs_vxworks_eabihf. 3. use wr-** instead of vx-** 4. set PIE to false 5. code cleanup
2019-07-16Add supporting for vxWorksBaoshan Pang-0/+2
r? @alexcrichton
2019-06-24rustbuild: always set cxx for build hostMarc-Antoine Perennou-1/+1
Even if it's not in hosts Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2019-06-21rustbuild: only autodetect cxx for hostsMarc-Antoine Perennou-12/+9
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2019-06-13rustbuild: set cxx for hosts even if not configuredMarc-Antoine Perennou-1/+1
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2019-06-13rustbuild: don't set cxx if not configuredMarc-Antoine Perennou-10/+23
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2019-06-13rustbuild: fix default value for cxxMarc-Antoine Perennou-1/+3
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2019-06-12rustbuild: detect cxx for all targetsMarc-Antoine Perennou-17/+15
Replaces #61544 Fixes #59917 We need CXX to build llvm-libunwind which can be enabled for all targets. As we needed it for all hosts anyways, just move the detection so that it is ran for all targets (which contains all hosts) instead. Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2019-02-25bootstrap: deny(rust_2018_idioms)Taiki Endo-2/+1
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-19Rollup merge of #56947 - hsivonen:neon, r=alexcrichtonPietro Albini-1/+4
Add targets thumbv7neon-linux-androideabi and thumbv7neon-unknown-linux-gnueabihf These two targets enable both thumb-mode and NEON for ARMv7 CPUs. This another attempt at #49902, which cannot be reopened. Between that PR and this one, some subrepos with C code whose build systems were failing went away.
2018-12-13Add targets thumbv7neon-linux-androideabi and ↵Henri Sivonen-1/+4
thumbv7neon-unknown-linux-gnueabihf These two targets enable both thumb-mode and NEON for ARMv7 CPUs.
2018-12-10bootstrap: fix editionljedrz-3/+3
2018-09-10Add rustc SHA to released DWARF debuginfoAlex Crichton-2/+2
This commit updates the debuginfo that is encoded in all of our released artifacts by default. Currently it has paths like `/checkout/src/...` but these are a little inconsistent and have changed over time. This commit instead attempts to actually define the file paths in our debuginfo to be consistent between releases. All debuginfo paths are now intended to be `/rustc/$sha` where `$sha` is the git sha of the released compiler. Sub-paths are all paths into the git repo at that `$sha`.
2018-04-20Update the Cargo submoduleAlex Crichton-3/+12
2018-03-13rustbuild: Tweak CFLAGS to various libstd piecesAlex Crichton-2/+2
* Pass `opt_level(2)` when calculating CFLAGS to get the right flags on iOS * Unconditionally pass `-O2` when compiling libbacktrace This should... Close #48903 Close #48906
2018-03-03rust: Import LLD for linking wasm objectsAlex Crichton-0/+3
This commit imports the LLD project from LLVM to serve as the default linker for the `wasm32-unknown-unknown` target. The `binaryen` submoule is consequently removed along with "binaryen linker" support in rustc. Moving to LLD brings with it a number of benefits for wasm code: * LLD is itself an actual linker, so there's no need to compile all wasm code with LTO any more. As a result builds should be *much* speedier as LTO is no longer forcibly enabled for all builds of the wasm target. * LLD is quickly becoming an "official solution" for linking wasm code together. This, I believe at least, is intended to be the main supported linker for native code and wasm moving forward. Picking up support early on should help ensure that we can help LLD identify bugs and otherwise prove that it works great for all our use cases! * Improvements to the wasm toolchain are currently primarily focused around LLVM and LLD (from what I can tell at least), so it's in general much better to be on this bandwagon for bugfixes and new features. * Historical "hacks" like `wasm-gc` will soon no longer be necessary, LLD will [natively implement][gc] `--gc-sections` (better than `wasm-gc`!) which means a postprocessor is no longer needed to show off Rust's "small wasm binary size". LLD is added in a pretty standard way to rustc right now. A new rustbuild target was defined for building LLD, and this is executed when a compiler's sysroot is being assembled. LLD is compiled against the LLVM that we've got in tree, which means we're currently on the `release_60` branch, but this may get upgraded in the near future! LLD is placed into rustc's sysroot in a `bin` directory. This is similar to where `gcc.exe` can be found on Windows. This directory is automatically added to `PATH` whenever rustc executes the linker, allowing us to define a `WasmLd` linker which implements the interface that `wasm-ld`, LLD's frontend, expects. Like Emscripten the LLD target is currently only enabled for Tier 1 platforms, notably OSX/Windows/Linux, and will need to be installed manually for compiling to wasm on other platforms. LLD is by default turned off in rustbuild, and requires a `config.toml` option to be enabled to turn it on. Finally the unstable `#![wasm_import_memory]` attribute was also removed as LLD has a native option for controlling this. [gc]: https://reviews.llvm.org/D42511
2017-10-29ci: Upgrade Android SDK/NDK and refactor to use sdkmanager/avdmanager.kennytm-4/+31
* SDK tools is upgraded to 27.0.0. - Refactored to use `sdkmanager`/`avdmanager` instead of the deprecated `android` tool. * The Java version used by Android SDK is downgraded to OpenJDK-8, in order to download the SDK through HTTPS. * NDK is upgrade to r15c. - Dropped support for android-9 (2.3 / Gingerbread), the minimal supported version is now android-14 (4.0 / Ice Cream Sandwich). - Changed the default Android compiler from GCC to clang. - For details of change introduced by NDK r15, see https://github.com/android-ndk/ndk/wiki/Changelog-r15.
2017-10-15rustbuild: Support specifying archiver and linker explicitlyVadim Petrochenkov-7/+45
2017-09-28Update to the `cc` crateAlex Crichton-0/+147
This is the name the `gcc` crate has moved to