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 @@ -2690,7 +2690,7 @@ fn relevant_lib(sess: &Session, lib: &NativeLib) -> bool {
2690
2690
}
2691
2691
}
2692
2692
2693
- fn are_upstream_rust_objects_already_included ( sess : & Session ) -> bool {
2693
+ pub ( crate ) fn are_upstream_rust_objects_already_included ( sess : & Session ) -> bool {
2694
2694
match sess. lto ( ) {
2695
2695
config:: Lto :: Fat => true ,
2696
2696
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,
@@ -892,10 +893,14 @@ impl CrateInfo {
892
893
893
894
// Handle circular dependencies in the standard library.
894
895
// 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.
897
902
let target = & tcx. sess . target ;
898
- if !target . is_like_msvc {
903
+ if !are_upstream_rust_objects_already_included ( tcx . sess ) {
899
904
let missing_weak_lang_items: FxHashSet < & Symbol > = info
900
905
. used_crates
901
906
. iter ( )
You can’t perform that action at this time.
0 commit comments