From 37f60b86bc2a1fb05727151b772793a4141a275b Mon Sep 17 00:00:00 2001 From: Kunal Pathak Date: Tue, 27 Feb 2024 09:53:17 -0800 Subject: [PATCH] Set the wasRelocHandled flag --- .../superpmi-shared/compileresult.cpp | 27 +++++++------------ 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/coreclr/tools/superpmi/superpmi-shared/compileresult.cpp b/src/coreclr/tools/superpmi/superpmi-shared/compileresult.cpp index 7f9c64eedd1857..74040dc5aa3bef 100644 --- a/src/coreclr/tools/superpmi/superpmi-shared/compileresult.cpp +++ b/src/coreclr/tools/superpmi/superpmi-shared/compileresult.cpp @@ -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? { @@ -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; } @@ -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)