Skip to main content

Module gcc

Module gcc 

Source
Expand description

Compilation of native dependencies like GCC.

Native projects like GCC unfortunately aren’t suited just yet for compilation in build scripts that Cargo has. This is because the compilation takes a very long time but also because we don’t want to compile GCC 3 times as part of a normal bootstrap (we want it cached).

GCC and compiler-rt are essentially just wired up to everything else to ensure that they’re always in place if needed.

Re-exportsΒ§

use std::fmt::Display; πŸ”’
use std::fmt::Formatter; πŸ”’
use std::fs; πŸ”’
use std::path::Path; πŸ”’
use std::path::PathBuf; πŸ”’
use std::sync::OnceLock; πŸ”’
use build_helper::git::PathFreshness; πŸ”’
use crate::core::builder::Builder; πŸ”’
use crate::core::builder::Cargo; πŸ”’
use crate::core::builder::CommandLineStep; πŸ”’
use crate::core::builder::Kind; πŸ”’
use crate::core::builder::RunConfig; πŸ”’
use crate::core::builder::ShouldRun; πŸ”’
use crate::core::config::Config; πŸ”’
use crate::core::config::TargetSelection; πŸ”’
use crate::utils::build_stamp::BuildStamp; πŸ”’
use crate::utils::build_stamp::generate_smart_stamp_hash; πŸ”’
use crate::utils::exec::command; πŸ”’
use crate::utils::helpers; πŸ”’
use crate::utils::helpers::t; πŸ”’

StructsΒ§

Gcc
GccOutput
GccTargetPair
GCC cannot cross-compile from a single binary to multiple targets. So we need to have a separate GCC dylib for each (host, target) pair. We represent this explicitly using this struct.
Meta

EnumsΒ§

GccBuildStatus

FunctionsΒ§

add_cg_gcc_cargo_flags
Configures a Cargo invocation so that it can build the GCC codegen backend.
build_gcc πŸ”’
ci_gcc_root πŸ”’
The absolute path to the downloaded GCC artifacts.
detect_gcc_freshness πŸ”’
Detect whether GCC sources have been modified locally or not.
gcc_out πŸ”’
get_gcc_build_status
This returns information about whether GCC should be built or if it’s already built. It transparently handles downloading GCC from CI if needed.
libgccjit_built_path πŸ”’
Returns the path to a libgccjit.so file in the install directory of GCC.
try_download_gcc πŸ”’
Tries to download GCC from CI if it is enabled and GCC artifacts are available for the given target. Returns a path to the libgccjit.so file.