diff --git a/src/coreclr/jit/emit.cpp b/src/coreclr/jit/emit.cpp index 4271c3d817977b..029d5f44e4ba76 100644 --- a/src/coreclr/jit/emit.cpp +++ b/src/coreclr/jit/emit.cpp @@ -8516,40 +8516,10 @@ void emitter::emitOutputDataSec(dataSecDsc* sec, AllocMemChunk* chunks) if (m_compiler->opts.compReloc) { -#ifdef TARGET_ARM - // The runtime and ILC will handle setting the thumb bit on the async resumption stub entrypoint, - // either directly in the emitAsyncResumeStubEntryPoint value (runtime) or will add the thumb bit - // to the symbol definition (ilc). ReadyToRun is different here: it emits method symbols without the - // thumb bit, then during fixups, the runtime adds the thumb bit. This works for all cases where - // the method entrypoint is fixed up at runtime, but doesn't hold for the resumption stub, which is - // emitted as a direct call without the typical indirection cell + fixup. This is okay in this case - // (while regular method calls could not do this) because the async method and its resumption stub - // are tightly coupled and effectively funclets of the same method. However, this means that - // crossgen needs the reloc for the resumption stubs entrypoint to include the thumb bit. Until we - // unify the behavior of crossgen with the runtime and ilc, we will work around this by emitting the - // reloc with the addend for the thumb bit. - if (m_compiler->IsReadyToRun()) - { - emitRecordRelocationWithAddlDelta(&aDstRW[i].Resume, emitAsyncResumeStubEntryPoint, - CorInfoReloc::DIRECT, 1); - } - else -#endif - { - emitRecordRelocation(&aDstRW[i].Resume, emitAsyncResumeStubEntryPoint, CorInfoReloc::DIRECT); - } + emitRecordRelocation(&aDstRW[i].Resume, emitAsyncResumeStubEntryPoint, CorInfoReloc::DIRECT); if (target != nullptr) { -#ifdef TARGET_ARM - if (m_compiler->IsReadyToRun()) - { - emitRecordRelocationWithAddlDelta(&aDstRW[i].DiagnosticIP, target, CorInfoReloc::DIRECT, 1); - } - else -#endif - { - emitRecordRelocation(&aDstRW[i].DiagnosticIP, target, CorInfoReloc::DIRECT); - } + emitRecordRelocation(&aDstRW[i].DiagnosticIP, target, CorInfoReloc::DIRECT); } } diff --git a/src/coreclr/jit/emitarm.cpp b/src/coreclr/jit/emitarm.cpp index 8532b6dbdb3cea..f0696f010d3331 100644 --- a/src/coreclr/jit/emitarm.cpp +++ b/src/coreclr/jit/emitarm.cpp @@ -5307,9 +5307,10 @@ BYTE* emitter::emitOutputLJ(insGroup* ig, BYTE* dst, instrDesc* i) assert(ins == INS_movw || ins == INS_movt); distVal = (ssize_t)emitOffsetToPtr(dstOffs); - // ILC defines method symbols with the thumb bit already set, so don't add it here. - // For ReadyToRun and non-relocatable code (runtime JIT), we set it ourselves. - if (!m_compiler->IsNativeAot()) + // ILC and crossgen2 defines method symbols with the thumb bit already set, so don't add it here. + // Assume compilations with relocs will put the thumb bit in the symbol. + // For non-relocatable code (runtime JIT), we set it ourselves. + if (!(m_compiler->opts.compReloc)) { distVal += 1; } diff --git a/src/coreclr/tools/Common/Compiler/ObjectWriter/ObjectWriter.cs b/src/coreclr/tools/Common/Compiler/ObjectWriter/ObjectWriter.cs index 5eb2018c7cf947..ca055358afa637 100644 --- a/src/coreclr/tools/Common/Compiler/ObjectWriter/ObjectWriter.cs +++ b/src/coreclr/tools/Common/Compiler/ObjectWriter/ObjectWriter.cs @@ -177,7 +177,6 @@ or IMAGE_REL_BASED_THUMB_BRANCH24 or IMAGE_REL_BASED_THUMB_MOV32_PCREL && // Method symbols should be defined with the thumb bit (+1) set per the AAELF ABI // convention. For BRANCH24, the encoding cannot represent the thumb bit // (per AAELF formula ((S + A) | T) – P), so strip it from the symbol value. - // NOTE: R2R doesn't currently add the thumb bit to the symbol value, so this is a NOP. long symbolValue = relocType is IMAGE_REL_BASED_THUMB_BRANCH24 ? definedSymbol.Value & ~1L : definedSymbol.Value; @@ -409,12 +408,8 @@ public virtual void EmitObject(Stream outputFileStream, IReadOnlyCollection +