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 31, 2024
1 parent 759e07f commit 00da974
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 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,14 @@ pub fn rustc_cargo(
cargo.rustflag("-l").rustflag("Enzyme-19");
}

// Building with protected visibility reduces the number of dynamic relocations needed, giving
// us a faster startup time. However GNU ld < 2.40 will error if we try to link a shared object
// with direct references to protected symbols, so for now we only use protected symbols if
// linking with LLD is enabled.
if builder.build.config.lld_mode.is_used() {
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

0 comments on commit 00da974

Please sign in to comment.