From 0eb33d5867e4fdc5f863ba6da5d74ad3c0a78109 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tom=C3=A1=C5=A1=20Rylek?= Date: Thu, 12 Mar 2020 10:37:22 +0100 Subject: [PATCH] Fix assertion failure when running some composite CoreCLR tests (#33503) In composite testing, ReadyToRunInfo::GetImage() returns the composite image layout (NativeImageLayout) for which PEDecoder::GetReadyToRunHeader doesn't work (we decided we don't want to modify the general PEDecoder logic). A simple fix is not to go through GetImage() and expose the header on the R2R info directly instead. Thanks Tomas --- src/coreclr/src/vm/codeman.cpp | 2 +- src/coreclr/src/vm/readytoruninfo.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/coreclr/src/vm/codeman.cpp b/src/coreclr/src/vm/codeman.cpp index 49de94334ce..d3ca9d9c52d 100644 --- a/src/coreclr/src/vm/codeman.cpp +++ b/src/coreclr/src/vm/codeman.cpp @@ -6495,7 +6495,7 @@ UINT32 ReadyToRunJitManager::JitTokenToGCInfoVersion(const METHODTOKEN& MethodTo SUPPORTS_DAC; } CONTRACTL_END; - READYTORUN_HEADER * header = JitTokenToReadyToRunInfo(MethodToken)->GetImage()->GetReadyToRunHeader(); + READYTORUN_HEADER * header = JitTokenToReadyToRunInfo(MethodToken)->GetReadyToRunHeader(); return GCInfoToken::ReadyToRunVersionToGcInfoVersion(header->MajorVersion); } diff --git a/src/coreclr/src/vm/readytoruninfo.h b/src/coreclr/src/vm/readytoruninfo.h index 35fd42acb93..1d1185a8659 100644 --- a/src/coreclr/src/vm/readytoruninfo.h +++ b/src/coreclr/src/vm/readytoruninfo.h @@ -88,6 +88,8 @@ public: bool IsComponentAssembly() const { return m_isComponentAssembly; } + PTR_READYTORUN_HEADER GetReadyToRunHeader() const { return m_pHeader; } + PTR_NativeImage GetNativeImage() const { return m_pNativeImage; } PTR_PEImageLayout GetImage() const { return m_pComposite->GetImage(); } -- 2.34.1