File tree 2 files changed +9
-4
lines changed
compiler/rustc_codegen_ssa/src
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 {
2698
2698
}
2699
2699
}
2700
2700
2701
- fn are_upstream_rust_objects_already_included ( sess : & Session ) -> bool {
2701
+ pub ( crate ) fn are_upstream_rust_objects_already_included ( sess : & Session ) -> bool {
2702
2702
match sess. lto ( ) {
2703
2703
config:: Lto :: Fat => true ,
2704
2704
config:: Lto :: Thin => {
Original file line number Diff line number Diff line change
1
+ use crate :: back:: link:: are_upstream_rust_objects_already_included;
1
2
use crate :: back:: metadata:: create_compressed_metadata_file;
2
3
use crate :: back:: write:: {
3
4
compute_per_cgu_lto_type, start_async_codegen, submit_codegened_module_to_llvm,
@@ -854,10 +855,14 @@ impl CrateInfo {
854
855
855
856
// Handle circular dependencies in the standard library.
856
857
// 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.
859
864
let target = & tcx. sess . target ;
860
- if !target . is_like_msvc {
865
+ if !are_upstream_rust_objects_already_included ( tcx . sess ) {
861
866
let missing_weak_lang_items: FxHashSet < & Symbol > = info
862
867
. used_crates
863
868
. iter ( )
You can’t perform that action at this time.
0 commit comments