Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #4000 from rahku/issue2963
Browse files Browse the repository at this point in the history
Fix issue 2963
  • Loading branch information
Rahul Kumar committed Apr 5, 2016
2 parents 3ec0813 + 9259831 commit caa979f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/zap/zapcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1939,6 +1939,18 @@ DWORD ZapLazyHelperThunk::SaveWorker(ZapWriter * pZapWriter)
if (pImage != NULL)
pImage->WriteReloc(buffer, (int)(p - buffer), m_pTarget, 0, IMAGE_REL_BASED_THUMB_BRANCH24);
p += 4;
#elif defined(_TARGET_ARM64_)
// ldr x1, [PC+8]
*(DWORD *)(p) =0x58000041;
p += 4;
// b JIT_StrCns
*(DWORD *)(p) = 0x14000000;
if (pImage != NULL)
pImage->WriteReloc(buffer, (int)(p - buffer), m_pTarget, 0, IMAGE_REL_ARM64_BRANCH26);
p += 4;
if (pImage != NULL)
pImage->WriteReloc(buffer, (int)(p - buffer), m_pArg, 0, IMAGE_REL_BASED_PTR);
p += 8;
#else
PORTABILITY_ASSERT("ZapLazyHelperThunk::Save");
#endif
Expand Down
2 changes: 2 additions & 0 deletions src/zap/zapinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2607,6 +2607,8 @@ WORD ZapInfo::getRelocTypeHint(void * target)
if (m_zapper->m_pOpt->m_fNGenLastRetry)
return (WORD)-1;
return IMAGE_REL_BASED_THUMB_BRANCH24;
#elif defined(_TARGET_ARM64_)
return IMAGE_REL_ARM64_BRANCH26;
#else
// No hints
return (WORD)-1;
Expand Down
14 changes: 14 additions & 0 deletions src/zap/zaprelocs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,20 @@ void ZapBaseRelocs::WriteReloc(PVOID pSrc, int offset, ZapNode * pTarget, int ta
// IMAGE_REL_BASED_THUMB_BRANCH24 does not need base reloc entry
return;
#endif
#if defined(_TARGET_ARM64_)
case IMAGE_REL_ARM64_BRANCH26:
{
TADDR pSite = (TADDR)m_pImage->GetBaseAddress() + rva;

INT64 relOffset = (INT64)(pActualTarget - (pSite + sizeof(INT64)));
if (!FitsInRel28(relOffset))
{
ThrowHR(COR_E_OVERFLOW);
}
PutArm64Rel28((UINT32 *)pLocation,(INT32)relOffset);
}
return;
#endif

default:
_ASSERTE(!"Unknown relocation type");
Expand Down

0 comments on commit caa979f

Please sign in to comment.