From 666e35a0286bc7a154ad616e4842c44273345430 Mon Sep 17 00:00:00 2001 From: Andrii Kurdiumov Date: Mon, 26 Jul 2021 00:35:39 +0600 Subject: [PATCH] Another round of changes required to compile on ARM (#1310) * Another round of changes required to compile on ARM - libunwind change is fix compilation type mismatch. Present in upstream https://github.com/llvm/llvm-project/blob/d480f968ad8b56d3ee4a6b6df5532d485b0ad01e/libunwind/src/libunwind.cpp#L102 - gcinfodecoder.cpp This one looks like leftover from other times? Would like to be educated. This location assumes that `src\coreclr\inc\regdisp.h` included, but `src\coreclr\nativeaot\Runtime\regdisplay.h` included. I again do not understand how this happens and why this is working for other targets. * Special case for the UNW_ARM_LR since it is located at index 13. --- src/coreclr/nativeaot/libunwind/src/libunwind.cpp | 4 ++-- src/coreclr/vm/gcinfodecoder.cpp | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/coreclr/nativeaot/libunwind/src/libunwind.cpp b/src/coreclr/nativeaot/libunwind/src/libunwind.cpp index e030fe9d5c32..387ad0fe1616 100644 --- a/src/coreclr/nativeaot/libunwind/src/libunwind.cpp +++ b/src/coreclr/nativeaot/libunwind/src/libunwind.cpp @@ -93,7 +93,7 @@ _LIBUNWIND_HIDDEN int __unw_set_reg(unw_cursor_t *cursor, unw_regnum_t regNum, unw_word_t value, unw_word_t *pos) { _LIBUNWIND_TRACE_API("__unw_set_reg(cursor=%p, regNum=%d, value=0x%" PRIxPTR ")", - static_cast(cursor), regNum, (unsigned long)value); + static_cast(cursor), regNum, value); typedef LocalAddressSpace::pint_t pint_t; AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor; if (co->validReg(regNum)) { @@ -155,7 +155,7 @@ _LIBUNWIND_HIDDEN int __unw_set_fpreg(unw_cursor_t *cursor, unw_regnum_t regNum, _LIBUNWIND_WEAK_ALIAS(__unw_set_fpreg, unw_set_fpreg) /// Get location of specified register at cursor position in stack frame. -_LIBUNWIND_HIDDEN int __unw_get_save_loc(unw_cursor_t *cursor, int regNum, +_LIBUNWIND_HIDDEN int __unw_get_save_loc(unw_cursor_t *cursor, int regNum, unw_save_loc_t* location) { AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor; diff --git a/src/coreclr/vm/gcinfodecoder.cpp b/src/coreclr/vm/gcinfodecoder.cpp index 8ca20eaca743..c07b22cf885a 100644 --- a/src/coreclr/vm/gcinfodecoder.cpp +++ b/src/coreclr/vm/gcinfodecoder.cpp @@ -1486,6 +1486,17 @@ OBJECTREF* GcInfoDecoder::GetRegisterSlot( _ASSERTE(regNum >= 0 && regNum <= 14); _ASSERTE(regNum != 13); // sp +#ifdef FEATURE_REDHAWK + if(regNum < 14) + { + PTR_UIntNative* ppReg = &pRD->pR0; + return (OBJECTREF*)*(ppReg + regNum); + } + else + { + return (OBJECTREF*) pRD->pLR; + } +#else DWORD **ppReg; if(regNum <= 3) @@ -1505,7 +1516,7 @@ OBJECTREF* GcInfoDecoder::GetRegisterSlot( ppReg = &pRD->pCurrentContextPointers->R4; return (OBJECTREF*)*(ppReg + regNum-4); - +#endif } #if defined(TARGET_UNIX) && !defined(FEATURE_REDHAWK)