Skip to content

Commit

Permalink
Use protected symbols when building rustc_driver
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlattimore committed Oct 30, 2024
1 parent 759e07f commit 977730b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,10 @@ pub fn rustc_cargo(
cargo.rustflag("-l").rustflag("Enzyme-19");
}

if builder.build.config.protected_symbol_definitions {
cargo.rustflag("-Zdefault-visibility=protected");
}

// We currently don't support cross-crate LTO in stage0. This also isn't hugely necessary
// and may just be a time sink.
if compiler.stage != 0 {
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ pub struct Config {
pub llvm_profile_generate: bool,
pub llvm_libunwind_default: Option<LlvmLibunwind>,
pub enable_bolt_settings: bool,
pub protected_symbol_definitions: bool,

pub reproducible_artifacts: Vec<String>,

Expand Down Expand Up @@ -1308,6 +1309,7 @@ impl Config {
config.llvm_profile_generate = flags.llvm_profile_generate;
config.enable_bolt_settings = flags.enable_bolt_settings;
config.bypass_bootstrap_lock = flags.bypass_bootstrap_lock;
config.protected_symbol_definitions = flags.protected_symbol_definitions;

// Infer the rest of the configuration.

Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/src/core/config/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ pub struct Flags {
/// Enable BOLT link flags
#[arg(global = true, long)]
pub enable_bolt_settings: bool,
/// Use protected symbol definitions in rustc_driver
#[arg(global = true, long, default_value_t = true)]
pub protected_symbol_definitions: bool,
/// Skip stage0 compiler validation
#[arg(global = true, long)]
pub skip_stage0_validation: bool,
Expand Down

0 comments on commit 977730b

Please sign in to comment.