Auto merge of #131634 - davidlattimore:lld-protected, r=Kobzol · rust-lang/rust@9fa9ef3 (original) (raw)

File tree

1 file changed

lines changed

1 file changed

lines changed

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