@@ -105,24 +105,18 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, cnum: CrateNum) -> DefIdMap<
105
105
}
106
106
} )
107
107
. map ( |def_id| {
108
- let export_level = if special_runtime_crate {
108
+ let ( export_level, used ) = if special_runtime_crate {
109
109
let name = tcx. symbol_name ( Instance :: mono ( tcx, def_id. to_def_id ( ) ) ) . name ;
110
- // We can probably do better here by just ensuring that
111
- // it has hidden visibility rather than public
112
- // visibility, as this is primarily here to ensure it's
113
- // not stripped during LTO.
114
- //
115
- // In general though we won't link right if these
116
- // symbols are stripped, and LTO currently strips them.
117
- match name {
110
+ // We won't link right if these symbols are stripped during LTO.
111
+ let used = match name {
118
112
"rust_eh_personality"
119
113
| "rust_eh_register_frames"
120
- | "rust_eh_unregister_frames" =>
121
- SymbolExportLevel :: C ,
122
- _ => SymbolExportLevel :: Rust ,
123
- }
114
+ | "rust_eh_unregister_frames" => true ,
115
+ _ => false ,
116
+ } ;
117
+ ( SymbolExportLevel :: Rust , used )
124
118
} else {
125
- symbol_export_level ( tcx, def_id. to_def_id ( ) )
119
+ ( symbol_export_level ( tcx, def_id. to_def_id ( ) ) , false )
126
120
} ;
127
121
let codegen_attrs = tcx. codegen_fn_attrs ( def_id. to_def_id ( ) ) ;
128
122
debug ! (
@@ -142,7 +136,7 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, cnum: CrateNum) -> DefIdMap<
142
136
SymbolExportKind :: Text
143
137
} ,
144
138
used : codegen_attrs. flags . contains ( CodegenFnAttrFlags :: USED )
145
- || codegen_attrs. flags . contains ( CodegenFnAttrFlags :: USED_LINKER ) ,
139
+ || codegen_attrs. flags . contains ( CodegenFnAttrFlags :: USED_LINKER ) || used ,
146
140
} )
147
141
} )
148
142
. collect ( ) ;
0 commit comments