diff options
author | John Chen <jochen@microsoft.com> | 2016-10-28 11:48:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-28 11:48:58 -0700 |
commit | 7d945336a9307eaaf59f985e4ec2c1b5b8c052b4 (patch) | |
tree | 9fdee4004e8fffb50e5d063aacf1fab72b1d5ed5 /src/zap | |
parent | dfcc8d72d9e11af945c7dff80f923ba0575f158c (diff) | |
download | coreclr-7d945336a9307eaaf59f985e4ec2c1b5b8c052b4.tar.gz coreclr-7d945336a9307eaaf59f985e4ec2c1b5b8c052b4.tar.bz2 coreclr-7d945336a9307eaaf59f985e4ec2c1b5b8c052b4.zip |
Ensure the module slot in R2R image can be located (#7875)
Each Ready-to-Run image has a slot for storing a pointer to the Module
object associated with this image. However, if the image contains no
code (e.g., facade assemblies), the import table needed to locate
this slot wasn't written out, so the runtime couldn't find this slot.
This casued "crossgen /createpdb" command to fail on facade assemblies
after PR #7809, and required a workaround (commit c4d8994).
This commit ensures writing the import table needed to locate the
slot for module. It also removes the workaround in commit c4d8994,
which is no longer necessary.
Diffstat (limited to 'src/zap')
-rw-r--r-- | src/zap/zapimage.cpp | 6 | ||||
-rw-r--r-- | src/zap/zapreadytorun.cpp | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/zap/zapimage.cpp b/src/zap/zapimage.cpp index a6f80d2540..f39b8f8f54 100644 --- a/src/zap/zapimage.cpp +++ b/src/zap/zapimage.cpp @@ -291,6 +291,12 @@ void ZapImage::InitializeSectionsForReadyToRun() // Always allocate slot for module - it is used to determine that the image is used // m_pImportTable->GetPlacedHelperImport(READYTORUN_HELPER_Module); + + // + // Make sure the import sections table is in the image, so we can find the slot for module + // + _ASSERTE(m_pImportSectionsTable->GetSize() != 0); + GetReadyToRunHeader()->RegisterSection(READYTORUN_SECTION_IMPORT_SECTIONS, m_pImportSectionsTable); } #endif // FEATURE_READYTORUN_COMPILER diff --git a/src/zap/zapreadytorun.cpp b/src/zap/zapreadytorun.cpp index ea42a25b8d..30ad296f95 100644 --- a/src/zap/zapreadytorun.cpp +++ b/src/zap/zapreadytorun.cpp @@ -291,9 +291,6 @@ void ZapImage::OutputEntrypointsTableForReadyToRun() pReadyToRunHeader->RegisterSection(READYTORUN_SECTION_INSTANCE_METHOD_ENTRYPOINTS, pHashtableBlob); pReadyToRunHeader->RegisterSection(READYTORUN_SECTION_RUNTIME_FUNCTIONS, m_pRuntimeFunctionSection); - if (m_pImportSectionsTable->GetSize() != 0) - pReadyToRunHeader->RegisterSection(READYTORUN_SECTION_IMPORT_SECTIONS, m_pImportSectionsTable); - if (m_pLazyMethodCallHelperSection->GetNodeCount() != 0) pReadyToRunHeader->RegisterSection(READYTORUN_SECTION_DELAYLOAD_METHODCALL_THUNKS, m_pLazyMethodCallHelperSection); |