Fix native code jmp offsets for inline assembly

This commit is contained in:
drmortalwombat 2021-12-01 08:40:36 +01:00
parent f1f3c609fd
commit 7e07f083a6
2 changed files with 7 additions and 0 deletions

View File

@ -53,6 +53,7 @@ public:
static const uint32 LREF_LOWBYTE = 0x00000001;
static const uint32 LREF_HIGHBYTE = 0x00000002;
static const uint32 LREF_TEMPORARY = 0x00000004;
static const uint32 LREF_INBLOCK = 0x00000008;
class LinkerReference
{

View File

@ -2375,6 +2375,7 @@ void NativeCodeInstruction::Assemble(NativeCodeBasicBlock* block)
{
rl.mRefObject = nullptr;
rl.mRefOffset += pos;
rl.mFlags |= LREF_INBLOCK;
}
block->mRelocations.Push(rl);
}
@ -11101,6 +11102,11 @@ void NativeCodeBasicBlock::CopyCode(NativeCodeProcedure * proc, uint8* target)
{
LinkerReference& rl(mRelocations[i]);
rl.mOffset += mOffset;
if (rl.mFlags & LREF_INBLOCK)
{
rl.mRefOffset += mOffset;
rl.mFlags &= ~LREF_INBLOCK;
}
proc->mRelocations.Push(rl);
}