IRGen: force lazy metadata initialization for PE/COFF

The metadata reference to the pre-exsting VWT cannot be supported on PE/COFF
due to the direct reference to a value in an external module that is in
static data (the model requires indirecting through memory).  Always
force the lazy initialization for the metadata on such platforms.

This requires a secondary change - to initialize the VWT as well.  This
is ideally moved into the runtime where we can do this uniformly.
This commit is contained in:
Saleem Abdulrasool
2018-11-14 10:50:20 -08:00
parent 2dde40f3c6
commit 13d56a4f56
4 changed files with 14 additions and 7 deletions

View File

@@ -1060,6 +1060,10 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
Opts.EnableResilienceBypass = true;
}
// PE/COFF cannot deal with the cross-module reference to the metadata parent
// (e.g. NativeObject). Force the lazy initialization of the VWT always.
Opts.LazyInitializeClassMetadata = Triple.isOSBinFormatCOFF();
if (const Arg *A = Args.getLastArg(OPT_read_type_info_path_EQ)) {
Opts.ReadTypeInfoPath = A->getValue();
}