File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
compiler/rustc_codegen_ssa/src Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -2698,7 +2698,7 @@ fn relevant_lib(sess: &Session, lib: &NativeLib) -> bool {
26982698 }
26992699}
27002700
2701- fn are_upstream_rust_objects_already_included ( sess : & Session ) -> bool {
2701+ pub ( crate ) fn are_upstream_rust_objects_already_included ( sess : & Session ) -> bool {
27022702 match sess. lto ( ) {
27032703 config:: Lto :: Fat => true ,
27042704 config:: Lto :: Thin => {
Original file line number Diff line number Diff line change 1+ use crate :: back:: link:: are_upstream_rust_objects_already_included;
12use crate :: back:: metadata:: create_compressed_metadata_file;
23use crate :: back:: write:: {
34 compute_per_cgu_lto_type, start_async_codegen, submit_codegened_module_to_llvm,
@@ -854,10 +855,14 @@ impl CrateInfo {
854855
855856 // Handle circular dependencies in the standard library.
856857 // See comment before `add_linked_symbol_object` function for the details.
857- // With msvc-like linkers it's both unnecessary (they support circular dependencies),
858- // and causes linking issues (when weak lang item symbols are "privatized" by LTO).
858+ // If global LTO is enabled then almost everything (*) is glued into a single object file,
859+ // so this logic is not necessary and can cause issues on some targets (due to weak lang
860+ // item symbols being "privatized" to that object file), so we disable it.
861+ // (*) Native libs, and `#[compiler_builtins]` and `#[no_builtins]` crates are not glued,
862+ // and we assume that they cannot define weak lang items. This is not currently enforced
863+ // by the compiler, but that's ok because all this stuff is unstable anyway.
859864 let target = & tcx. sess . target ;
860- if !target . is_like_msvc {
865+ if !are_upstream_rust_objects_already_included ( tcx . sess ) {
861866 let missing_weak_lang_items: FxHashSet < & Symbol > = info
862867 . used_crates
863868 . iter ( )
You can’t perform that action at this time.
0 commit comments