From a5f280d54f6cb941205a6ed7d11f12ceed5166fe Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Wed, 21 Feb 2024 08:48:57 +0100 Subject: [PATCH] Fix missing relocations in NativeAOT x86 output --- src/coreclr/jit/emitxarch.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/coreclr/jit/emitxarch.cpp b/src/coreclr/jit/emitxarch.cpp index 9e80da3bfaf9ab..6951bc85da1a2c 100644 --- a/src/coreclr/jit/emitxarch.cpp +++ b/src/coreclr/jit/emitxarch.cpp @@ -15330,13 +15330,10 @@ BYTE* emitter::emitOutputRI(BYTE* dst, instrDesc* id) if (id->idIsCnsReloc()) { - if (emitComp->IsTargetAbi(CORINFO_NATIVEAOT_ABI)) + if (emitComp->IsTargetAbi(CORINFO_NATIVEAOT_ABI) && id->idAddr()->iiaSecRel) { - if (id->idAddr()->iiaSecRel) - { - // For section relative, the immediate offset is relocatable and hence need IMAGE_REL_SECREL - emitRecordRelocation((void*)(dst - (unsigned)EA_SIZE(size)), (void*)(size_t)val, IMAGE_REL_SECREL); - } + // For section relative, the immediate offset is relocatable and hence need IMAGE_REL_SECREL + emitRecordRelocation((void*)(dst - (unsigned)EA_SIZE(size)), (void*)(size_t)val, IMAGE_REL_SECREL); } else {