Skip to content

Commit

Permalink
Set the wasRelocHandled flag (#99008)
Browse files Browse the repository at this point in the history
  • Loading branch information
kunalspathak authored Feb 27, 2024
1 parent 813d743 commit d06ebfe
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions src/coreclr/tools/superpmi/superpmi-shared/compileresult.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,6 @@ void CompileResult::applyRelocs(RelocContext* rc, unsigned char* block1, ULONG b
break;

case IMAGE_REL_ARM64_PAGEOFFSET_12A: // ADD 12 bit page offset
case IMAGE_REL_AARCH64_TLSDESC_ADD_LO12: // TLSDESC ADD for corresponding ADRP
{
if ((section_begin <= address) && (address < section_end)) // A reloc for our section?
{
Expand All @@ -889,28 +888,16 @@ void CompileResult::applyRelocs(RelocContext* rc, unsigned char* block1, ULONG b
}
break;

case IMAGE_REL_AARCH64_TLSDESC_LD64_LO12:
case IMAGE_REL_AARCH64_TLSDESC_ADD_LO12: // TLSDESC ADD for corresponding ADRP
case IMAGE_REL_AARCH64_TLSDESC_CALL:
case IMAGE_REL_TLSGD:
{
DWORDLONG fixupLocation = tmp.location;

size_t address = section_begin + (size_t)fixupLocation - (size_t)originalAddr;
if ((section_begin <= address) && (address < section_end)) // A reloc for our section?
{
LogDebug(" fixupLoc-%016" PRIX64 " (@%p) : %08X => %08X", fixupLocation, address,
*(DWORD*)address, (DWORD)tmp.target);
*(DWORD*)address = (DWORD)tmp.target;
}
// These are patched later by linker during actual execution
// and do not need relocation.
wasRelocHandled = true;
}
break;

case IMAGE_REL_AARCH64_TLSDESC_LD64_LO12:
{
// not needed
}
break;

default:
break;
}
Expand Down Expand Up @@ -938,6 +925,12 @@ void CompileResult::applyRelocs(RelocContext* rc, unsigned char* block1, ULONG b

wasRelocHandled = true;
}
else if (relocType == IMAGE_REL_TLSGD)
{
// These are patched later by linker during actual execution
// and do not need relocation.
wasRelocHandled = true;
}
}

if (wasRelocHandled)
Expand Down

0 comments on commit d06ebfe

Please sign in to comment.