cross-module-optimization: be more conservative when emitting a TBD file.

If we are emitting a TBD file, the TBD file only contains public symbols of this module.
But not public symbols of imported modules which are statically linked to the current binary.
This prevents referencing public symbols from other modules which could (potentially) linked statically.
Unfortunately there is no way to find out if another module is linked statically or dynamically, so we have to be conservative.

Fixes an unresolved-symbol linker error.
rdar://89364148
This commit is contained in:
Erik Eckstein
2022-03-03 11:41:55 +01:00
parent adabdcbd2e
commit 1dfb3b1a2a
6 changed files with 99 additions and 4 deletions

View File

@@ -1670,6 +1670,8 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
OPT_disable_previous_implementation_calls_in_dynamic_replacements);
Opts.ParseStdlib = FEOpts.ParseStdlib;
Opts.emitTBD = FEOpts.InputsAndOutputs.hasTBDPath();
if (const Arg *A = Args.getLastArg(OPT_save_optimization_record_EQ)) {
llvm::Expected<llvm::remarks::Format> formatOrErr =
llvm::remarks::parseFormat(A->getValue());