From: Yaroslav Yamshchikov Date: Tue, 4 Feb 2020 02:46:54 +0000 (+0300) Subject: set THUMB_CODE bit (#21180) X-Git-Tag: submit/tizen/20210909.063632~10044 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cd0631eae8d2e3c20e8e00abed2805783c5a9def;p=platform%2Fupstream%2Fdotnet%2Fruntime.git set THUMB_CODE bit (#21180) --- diff --git a/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DelayLoadHelperImport.cs b/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DelayLoadHelperImport.cs index c49d91dc..75a7bf5 100644 --- a/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DelayLoadHelperImport.cs +++ b/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/DelayLoadHelperImport.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using Internal.Text; +using Internal.TypeSystem; using Internal.ReadyToRunConstants; namespace ILCompiler.DependencyAnalysis.ReadyToRun @@ -57,8 +58,14 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun { // This needs to be an empty target pointer since it will be filled in with Module* // when loaded by CoreCLR + int codeDelta = 0; + if (factory.Target.Architecture == TargetArchitecture.ARM) + { + // THUMB_CODE + codeDelta = 1; + } dataBuilder.EmitReloc(_delayLoadHelper, - factory.Target.PointerSize == 4 ? RelocType.IMAGE_REL_BASED_HIGHLOW : RelocType.IMAGE_REL_BASED_DIR64); + factory.Target.PointerSize == 4 ? RelocType.IMAGE_REL_BASED_HIGHLOW : RelocType.IMAGE_REL_BASED_DIR64, codeDelta); } public override IEnumerable GetStaticDependencies(NodeFactory factory) diff --git a/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/RuntimeFunctionsTableNode.cs b/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/RuntimeFunctionsTableNode.cs index 013fa3f..9901498 100644 --- a/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/RuntimeFunctionsTableNode.cs +++ b/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/RuntimeFunctionsTableNode.cs @@ -81,7 +81,13 @@ namespace ILCompiler.DependencyAnalysis.ReadyToRun FrameInfo frameInfo = method.FrameInfos[frameIndex]; // StartOffset of the runtime function - runtimeFunctionsBuilder.EmitReloc(method, RelocType.IMAGE_REL_BASED_ADDR32NB, delta: frameInfo.StartOffset); + int codeDelta = 0; + if (Target.Architecture == TargetArchitecture.ARM) + { + // THUMB_CODE + codeDelta = 1; + } + runtimeFunctionsBuilder.EmitReloc(method, RelocType.IMAGE_REL_BASED_ADDR32NB, delta: frameInfo.StartOffset + codeDelta); if (!relocsOnly && Target.Architecture == TargetArchitecture.X64) { // On Amd64, the 2nd word contains the EndOffset of the runtime function