From 2b93a0cc832d984ed26a634c50242a62dced398b Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 17 Sep 2026 11:12:34 -0700 Subject: [PATCH] Fix .NET 11 rc1 SDK crash on RHEL8 arm64 (#133887) Fixes #133675 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com> Co-authored-by: Jan Kotas --- src/coreclr/nativeaot/Runtime/ThunksMapping.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git dotnet/src/runtime/src/coreclr/nativeaot/Runtime/ThunksMapping.cpp dotnet/src/runtime/src/coreclr/nativeaot/Runtime/ThunksMapping.cpp index 9e00ebeded19a3..2bfa55f125e2b0 100644 --- dotnet/src/runtime/src/coreclr/nativeaot/Runtime/ThunksMapping.cpp +++ dotnet/src/runtime/src/coreclr/nativeaot/Runtime/ThunksMapping.cpp @@ -215,7 +215,7 @@ EXTERN_C HRESULT QCALLTYPE RhAllocateThunksMapping(void** ppThunksSection) #elif TARGET_ARM64 //adr xip0, - //ldr xip1, [xip0, ] + //ldr xip1, //br xip1 //brk 0xf000 //Stubs need to be 16 byte aligned therefore we fill with a break here @@ -223,7 +223,9 @@ EXTERN_C HRESULT QCALLTYPE RhAllocateThunksMapping(void** ppThunksSection) *((uint32_t*)pCurrentThunkAddress) = 0x10000010 | (((delta & 0x03) << 29) | (((delta & 0x1FFFFC) >> 2) << 5)); pCurrentThunkAddress += 4; - *((uint32_t*)pCurrentThunkAddress) = 0xF9400211 | (((uint32_t)((OS_PAGE_SIZE - POINTER_SIZE - (i * POINTER_SIZE * 2)) / 8) << 10)); + delta = (int)(pDataBlockAddress + OS_PAGE_SIZE - POINTER_SIZE - pCurrentThunkAddress); + ASSERT((-0x100000 <= delta) && (delta < 0x100000) && ((delta & 3) == 0)); + *((uint32_t*)pCurrentThunkAddress) = 0x58000011 | (((delta & 0x1FFFFC) >> 2) << 5); pCurrentThunkAddress += 4; *((uint32_t*)pCurrentThunkAddress) = 0xD61F0220;