diff options
author | John Chen (CLR) <jochen@microsoft.com> | 2016-08-05 16:08:18 -0700 |
---|---|---|
committer | John Chen (CLR) <jochen@microsoft.com> | 2016-08-08 13:36:34 -0700 |
commit | 21df26e038c4039150a7978188ecd0b6a5f23d2b (patch) | |
tree | 9ff37042706b455e937751b2d27aff2a9ae9eba6 /src/zap | |
parent | deb00ad58acf627763b6c0a7833fa789e3bb1cd0 (diff) | |
download | coreclr-21df26e038c4039150a7978188ecd0b6a5f23d2b.tar.gz coreclr-21df26e038c4039150a7978188ecd0b6a5f23d2b.tar.bz2 coreclr-21df26e038c4039150a7978188ecd0b6a5f23d2b.zip |
Modify "crossgen -createpdb" to skip loading clrjit.dll (#6607)
The -JITPath option doesn't work properly when CrossGen is used to
create a PDB file (issue #6607). Since clrjit.dll isn't really
needed for creating PDB files, the issue is fixed by modifying
CrossGen to skip loading clrjit.dll when -createpdb option is given.
Also following suggestion from issue #6607, added a new switch
-diasymreaderPath to CrossGen, to allow loading diasymreader.dll
from an alternative path.
Diffstat (limited to 'src/zap')
-rw-r--r-- | src/zap/zapper.cpp | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/src/zap/zapper.cpp b/src/zap/zapper.cpp index 0ad910865b..bcb1b0edca 100644 --- a/src/zap/zapper.cpp +++ b/src/zap/zapper.cpp @@ -240,7 +240,7 @@ STDAPI NGenWorker(LPCWSTR pwzFilename, DWORD dwFlags, LPCWSTR pwzPlatformAssembl return hr; } -STDAPI CreatePDBWorker(LPCWSTR pwzAssemblyPath, LPCWSTR pwzPlatformAssembliesPaths, LPCWSTR pwzTrustedPlatformAssemblies, LPCWSTR pwzPlatformResourceRoots, LPCWSTR pwzAppPaths, LPCWSTR pwzAppNiPaths, LPCWSTR pwzPdbPath, BOOL fGeneratePDBLinesInfo, LPCWSTR pwzManagedPdbSearchPath, LPCWSTR pwzPlatformWinmdPaths) +STDAPI CreatePDBWorker(LPCWSTR pwzAssemblyPath, LPCWSTR pwzPlatformAssembliesPaths, LPCWSTR pwzTrustedPlatformAssemblies, LPCWSTR pwzPlatformResourceRoots, LPCWSTR pwzAppPaths, LPCWSTR pwzAppNiPaths, LPCWSTR pwzPdbPath, BOOL fGeneratePDBLinesInfo, LPCWSTR pwzManagedPdbSearchPath, LPCWSTR pwzPlatformWinmdPaths, LPCWSTR pwzDiasymreaderPath) { HRESULT hr = S_OK; @@ -255,6 +255,10 @@ STDAPI CreatePDBWorker(LPCWSTR pwzAssemblyPath, LPCWSTR pwzPlatformAssembliesPat zap = Zapper::NewZapper(&ngo); +#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE) + zap->SetDontLoadJit(); +#endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE) + if (pwzPlatformAssembliesPaths != nullptr) zap->SetPlatformAssembliesPaths(pwzPlatformAssembliesPaths); @@ -273,6 +277,11 @@ STDAPI CreatePDBWorker(LPCWSTR pwzAssemblyPath, LPCWSTR pwzPlatformAssembliesPat if (pwzPlatformWinmdPaths != nullptr) zap->SetPlatformWinmdPaths(pwzPlatformWinmdPaths); +#if defined(FEATURE_CORECLR) && !defined(NO_NGENPDB) + if (pwzDiasymreaderPath != nullptr) + zap->SetDiasymreaderPath(pwzDiasymreaderPath); +#endif // defined(FEATURE_CORECLR) && !defined(NO_NGENPDB) + // Avoid unnecessary security failures, since permissions are irrelevant when // generating NGEN PDBs zap->SetForceFullTrust(true); @@ -676,6 +685,10 @@ void Zapper::Init(ZapperOptions *pOptions, bool fFreeZapperOptions) _ASSERTE(SUCCEEDED(hr)); #endif +#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE) + m_fDontLoadJit = false; +#endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE) + m_fForceFullTrust = false; } @@ -707,6 +720,11 @@ void Zapper::LoadAndInitializeJITForNgen(LPCWSTR pwzJitName, OUT HINSTANCE* phJi extern HINSTANCE g_hThisInst; #if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE) + if (m_fDontLoadJit) + { + return; + } + if (m_CLRJITPath.GetCount() > 0) { // If we have been asked to load a specific JIT binary, load it. @@ -2215,7 +2233,15 @@ void Zapper::CreatePdbInCurrentDomain(BSTR pAssemblyPathOrName, BSTR pNativeImag tkFile, &hModule)); } - IfFailThrow(::CreatePdb(hAssembly, pNativeImagePath, pPdbPath, pdbLines, pManagedPdbSearchPath)); + LPCWSTR pDiasymreaderPath = nullptr; +#if defined(FEATURE_CORECLR) && !defined(NO_NGENPDB) + if (m_DiasymreaderPath.GetCount() > 0) + { + pDiasymreaderPath = m_DiasymreaderPath.GetUnicode(); + } +#endif // defined(FEATURE_CORECLR) && !defined(NO_NGENPDB) + + IfFailThrow(::CreatePdb(hAssembly, pNativeImagePath, pPdbPath, pdbLines, pManagedPdbSearchPath, pDiasymreaderPath)); } EX_CATCH { @@ -4037,8 +4063,20 @@ void Zapper::SetCLRJITPath(LPCWSTR pwszCLRJITPath) { m_CLRJITPath.Set(pwszCLRJITPath); } + +void Zapper::SetDontLoadJit() +{ + m_fDontLoadJit = true; +} #endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE) +#if defined(FEATURE_CORECLR) && !defined(NO_NGENPDB) +void Zapper::SetDiasymreaderPath(LPCWSTR pwzDiasymreaderPath) +{ + m_DiasymreaderPath.Set(pwzDiasymreaderPath); +} +#endif // defined(FEATURE_CORECLR) && !defined(NO_NGENPDB) + #if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE) void Zapper::SetPlatformAssembliesPaths(LPCWSTR pwzPlatformAssembliesPaths) |