From db36fc7dfb08d06200246217988c53ff08d1680a Mon Sep 17 00:00:00 2001 From: Bruce Forstall Date: Tue, 13 Dec 2022 14:53:46 -0800 Subject: [PATCH 1/2] Only apply addlDelta for IMAGE_REL_BASED_REL32 relocs This matches what ngen did, and makes sense since only IP-relative relocations need to addlDelta to determine the address of the next instruction. Fixes #79170 --- src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs index a0b956c3d8fc9..666f2cde30923 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs @@ -3752,10 +3752,14 @@ private void recordRelocation(void* location, void* locationRW, void* target, us break; } - relocDelta += addlDelta; - TargetArchitecture targetArchitecture = _compilation.TypeSystemContext.Target.Architecture; RelocType relocType = GetRelocType(targetArchitecture, fRelocType); + + if (relocType == RelocType.IMAGE_REL_BASED_REL32) + { + relocDelta += addlDelta; + } + // relocDelta is stored as the value Relocation.WriteValue(relocType, location, relocDelta); From fdc71c8881921716a3eed127a816b07daf465839 Mon Sep 17 00:00:00 2001 From: Bruce Forstall Date: Tue, 13 Dec 2022 14:57:47 -0800 Subject: [PATCH 2/2] Re-enable test --- src/tests/issues.targets | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/tests/issues.targets b/src/tests/issues.targets index 3d63cbd86274b..96265b5f9edf3 100644 --- a/src/tests/issues.targets +++ b/src/tests/issues.targets @@ -277,9 +277,6 @@ https://github.com/dotnet/runtime/issues/57458 - - https://github.com/dotnet/runtime/issues/79170 -