From 4968f0be12aa4a9465bf92548198475d7dc882de Mon Sep 17 00:00:00 2001 From: Egor Chesakov Date: Fri, 8 Nov 2019 22:09:47 -0800 Subject: [PATCH] Fix computation of n-th item in an array in PC_REL_OFFSET(_field) macro in src/vm/arm64/virtualcallstubcpu.hpp (dotnet/coreclr#27783) Commit migrated from https://github.com/dotnet/coreclr/commit/5b02f3fb91c62e71377c4c31d8dd147d49220e8d --- src/coreclr/src/vm/arm64/virtualcallstubcpu.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/coreclr/src/vm/arm64/virtualcallstubcpu.hpp b/src/coreclr/src/vm/arm64/virtualcallstubcpu.hpp index 7f64990..6f011fc 100644 --- a/src/coreclr/src/vm/arm64/virtualcallstubcpu.hpp +++ b/src/coreclr/src/vm/arm64/virtualcallstubcpu.hpp @@ -218,7 +218,7 @@ struct ResolveHolder #define Dataregionbase _pCounter #define DATA_OFFSET(_fieldHigh) (DWORD)((offsetof(ResolveStub, _fieldHigh ) - offsetof(ResolveStub, Dataregionbase)) & 0xffffffff) -#define PC_REL_OFFSET(_field) (DWORD)((offsetof(ResolveStub, _field) - (offsetof(ResolveStub, _resolveEntryPoint) + sizeof(ResolveStub::_resolveEntryPoint) * n)) & 0xffffffff) +#define PC_REL_OFFSET(_field) (DWORD)((offsetof(ResolveStub, _field) - (offsetof(ResolveStub, _resolveEntryPoint) + sizeof(*ResolveStub::_resolveEntryPoint) * n)) & 0xffffffff) //ldr x12, [x0,#Object.m_pMethTab ] ; methodTable from object in x0 _stub._resolveEntryPoint[n++] = RESOLVE_STUB_FIRST_DWORD; //0xF940000C @@ -318,7 +318,7 @@ struct ResolveHolder // } #undef PC_REL_OFFSET -#define PC_REL_OFFSET(_field) (DWORD)((offsetof(ResolveStub, _field) - (offsetof(ResolveStub, _slowEntryPoint) + sizeof(ResolveStub::_slowEntryPoint) * n)) & 0xffffffff ) +#define PC_REL_OFFSET(_field) (DWORD)((offsetof(ResolveStub, _field) - (offsetof(ResolveStub, _slowEntryPoint) + sizeof(*ResolveStub::_slowEntryPoint) * n)) & 0xffffffff ) n = 0; // ;;slowEntryPoint: // ;;fall through to the slow case @@ -349,7 +349,7 @@ struct ResolveHolder // } #undef PC_REL_OFFSET //NOTE Offset can be negative -#define PC_REL_OFFSET(_field) (DWORD)((offsetof(ResolveStub, _field) - (offsetof(ResolveStub, _failEntryPoint) + sizeof(ResolveStub::_failEntryPoint) * n)) & 0xffffffff) +#define PC_REL_OFFSET(_field) (DWORD)((offsetof(ResolveStub, _field) - (offsetof(ResolveStub, _failEntryPoint) + sizeof(*ResolveStub::_failEntryPoint) * n)) & 0xffffffff) n = 0; //;;failEntryPoint -- 2.7.4