File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
compiler/rustc_codegen_ssa/src/back Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -1823,6 +1823,21 @@ pub(crate) fn linked_symbols(
18231823 }
18241824 }
18251825
1826+ match tcx. sess . lto ( ) {
1827+ Lto :: No | Lto :: ThinLocal => { }
1828+ Lto :: Thin | Lto :: Fat => {
1829+ // We really only need symbols from upstream rlibs to end up in the linked symbols list.
1830+ // The rest are in separate object files which the linker will always link in and
1831+ // doesn't have rules around the order in which they need to appear.
1832+ // When doing LTO, some of the symbols in the linked symbols list may end up getting
1833+ // internalized, which then prevents referencing them from symbols.o. When doing LTO,
1834+ // all object files that get linked in will be local object files rather than pulled in
1835+ // from rlibs, so an empty linked symbols list works fine to avoid referencing all those
1836+ // internalized symbols from symbols.o.
1837+ return Vec :: new ( ) ;
1838+ }
1839+ }
1840+
18261841 let mut symbols = Vec :: new ( ) ;
18271842
18281843 let export_threshold = symbol_export:: crates_export_threshold ( & [ crate_type] ) ;
You can’t perform that action at this time.
0 commit comments