diff --git a/oscar64/Linker.h b/oscar64/Linker.h index 9229a4b..66ecd86 100644 --- a/oscar64/Linker.h +++ b/oscar64/Linker.h @@ -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 { diff --git a/oscar64/NativeCodeGenerator.cpp b/oscar64/NativeCodeGenerator.cpp index 3cec456..14413b5 100644 --- a/oscar64/NativeCodeGenerator.cpp +++ b/oscar64/NativeCodeGenerator.cpp @@ -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); }