Auto merge of #95604 - nbdd0121:used2, r=petrochenkov

Generate synthetic object file to ensure all exported and used symbols participate in the linking

Fix #50007 and #47384

This is the synthetic object file approach that I described in https://github.com/rust-lang/rust/pull/95363#issuecomment-1079932354, allowing all exported and used symbols to be linked while still allowing them to be GCed.

Related #93791, #95363

r? `@petrochenkov`
cc `@carbotaniuman`
This commit is contained in:
bors 2022-04-25 16:14:54 +00:00
commit 18b53cefdf
23 changed files with 324 additions and 75 deletions

View file

@ -23,7 +23,7 @@ use rustc_incremental::{
};
use rustc_metadata::EncodedMetadata;
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
use rustc_middle::middle::exported_symbols::SymbolExportLevel;
use rustc_middle::middle::exported_symbols::SymbolExportInfo;
use rustc_middle::ty::TyCtxt;
use rustc_session::cgu_reuse_tracker::CguReuseTracker;
use rustc_session::config::{self, CrateType, Lto, OutputFilenames, OutputType};
@ -304,7 +304,7 @@ pub type TargetMachineFactoryFn<B> = Arc<
+ Sync,
>;
pub type ExportedSymbols = FxHashMap<CrateNum, Arc<Vec<(String, SymbolExportLevel)>>>;
pub type ExportedSymbols = FxHashMap<CrateNum, Arc<Vec<(String, SymbolExportInfo)>>>;
/// Additional resources used by optimize_and_codegen (not module specific)
#[derive(Clone)]