Skip to content

Commit 00da974

Browse files
Use protected symbols when building rustc_driver
1 parent 759e07f commit 00da974

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/bootstrap/src/core/build_steps/compile.rs

+8
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,14 @@ pub fn rustc_cargo(
10571057
cargo.rustflag("-l").rustflag("Enzyme-19");
10581058
}
10591059

1060+
// Building with protected visibility reduces the number of dynamic relocations needed, giving
1061+
// us a faster startup time. However GNU ld < 2.40 will error if we try to link a shared object
1062+
// with direct references to protected symbols, so for now we only use protected symbols if
1063+
// linking with LLD is enabled.
1064+
if builder.build.config.lld_mode.is_used() {
1065+
cargo.rustflag("-Zdefault-visibility=protected");
1066+
}
1067+
10601068
// We currently don't support cross-crate LTO in stage0. This also isn't hugely necessary
10611069
// and may just be a time sink.
10621070
if compiler.stage != 0 {

0 commit comments

Comments
 (0)