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 @@ -2690,7 +2690,7 @@ fn relevant_lib(sess: &Session, lib: &NativeLib) -> bool {
26902690 }
26912691}
26922692
2693- fn are_upstream_rust_objects_already_included ( sess : & Session ) -> bool {
2693+ pub ( crate ) fn are_upstream_rust_objects_already_included ( sess : & Session ) -> bool {
26942694 match sess. lto ( ) {
26952695 config:: Lto :: Fat => true ,
26962696 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,
@@ -892,10 +893,14 @@ impl CrateInfo {
892893
893894 // Handle circular dependencies in the standard library.
894895 // See comment before `add_linked_symbol_object` function for the details.
895- // With msvc-like linkers it's both unnecessary (they support circular dependencies),
896- // and causes linking issues (when weak lang item symbols are "privatized" by LTO).
896+ // If global LTO is enabled then almost everything (*) is glued into a single object file,
897+ // so this logic is not necessary and can cause issues on some targets (due to weak lang
898+ // item symbols being "privatized" to that object file), so we disable it.
899+ // (*) Native libs, and `#[compiler_builtins]` and `#[no_builtins]` crates are not glued,
900+ // and we assume that they cannot define weak lang items. This is not currently enforced
901+ // by the compiler, but that's ok because all this stuff is unstable anyway.
897902 let target = & tcx. sess . target ;
898- if !target . is_like_msvc {
903+ if !are_upstream_rust_objects_already_included ( tcx . sess ) {
899904 let missing_weak_lang_items: FxHashSet < & Symbol > = info
900905 . used_crates
901906 . iter ( )
You can’t perform that action at this time.
0 commit comments