Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the wasRelocHandled flag #99008

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading