Skip to content

Commit

Permalink
Only apply addlDelta for IMAGE_REL_BASED_REL32 relocs
Browse files Browse the repository at this point in the history
This matches what ngen did, and makes sense since only IP-relative
relocations need to addlDelta to determine the address of the next
instruction.

Fixes dotnet#79170
  • Loading branch information
BruceForstall committed Dec 13, 2022
1 parent c03de20 commit db36fc7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3752,10 +3752,14 @@ private void recordRelocation(void* location, void* locationRW, void* target, us
break;
}

relocDelta += addlDelta;

TargetArchitecture targetArchitecture = _compilation.TypeSystemContext.Target.Architecture;
RelocType relocType = GetRelocType(targetArchitecture, fRelocType);

if (relocType == RelocType.IMAGE_REL_BASED_REL32)
{
relocDelta += addlDelta;
}

// relocDelta is stored as the value
Relocation.WriteValue(relocType, location, relocDelta);

Expand Down

0 comments on commit db36fc7

Please sign in to comment.