From f6bf38d5fa037cd8da7379dc2281ae06e6b883dd Mon Sep 17 00:00:00 2001 From: xuliangyu Date: Wed, 11 Sep 2024 09:06:27 +0800 Subject: [PATCH] [LoongArch64] Fix the clr build error on Alpine. * Apply libunwind: https://github.com/libunwind/libunwind/pull/741 --- src/coreclr/vm/loongarch64/stubs.cpp | 10 +++++----- src/coreclr/vm/loongarch64/virtualcallstubcpu.hpp | 2 +- src/native/external/libunwind-version.txt | 1 + .../external/libunwind/src/loongarch64/getcontext.S | 1 - 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/coreclr/vm/loongarch64/stubs.cpp b/src/coreclr/vm/loongarch64/stubs.cpp index 94e71fc9fcee2..ac1b170ebec9a 100644 --- a/src/coreclr/vm/loongarch64/stubs.cpp +++ b/src/coreclr/vm/loongarch64/stubs.cpp @@ -319,7 +319,7 @@ void LazyMachState::unwindLazyState(LazyMachState* baseState, context.S8 = unwoundstate->captureCalleeSavedRegisters[8] = baseState->captureCalleeSavedRegisters[8]; context.Fp = unwoundstate->captureCalleeSavedRegisters[9] = baseState->captureCalleeSavedRegisters[9]; context.Tp = unwoundstate->captureCalleeSavedRegisters[10] = baseState->captureCalleeSavedRegisters[10]; - context.Ra = NULL; // Filled by the unwinder + context.Ra = 0; // Filled by the unwinder context.Sp = baseState->captureSp; context.Pc = baseState->captureIp; @@ -340,7 +340,7 @@ void LazyMachState::unwindLazyState(LazyMachState* baseState, nonVolContextPtrs.S8 = &unwoundstate->captureCalleeSavedRegisters[8]; nonVolContextPtrs.Fp = &unwoundstate->captureCalleeSavedRegisters[9]; nonVolContextPtrs.Tp = &unwoundstate->captureCalleeSavedRegisters[10]; - nonVolContextPtrs.Ra = NULL; // Filled by the unwinder + nonVolContextPtrs.Ra = 0; // Filled by the unwinder #endif // DACCESS_COMPILE @@ -487,7 +487,7 @@ void HelperMethodFrame::UpdateRegDisplay(const PREGDISPLAY pRD, bool updateFloat pRD->pCurrentContext->S8 = (DWORD64)(pUnwoundState->captureCalleeSavedRegisters[8]); pRD->pCurrentContext->Fp = (DWORD64)(pUnwoundState->captureCalleeSavedRegisters[9]); pRD->pCurrentContext->Tp = (DWORD64)(pUnwoundState->captureCalleeSavedRegisters[10]); - pRD->pCurrentContext->Ra = NULL; // Unwind again to get Caller's PC + pRD->pCurrentContext->Ra = 0; // Unwind again to get Caller's PC pRD->pCurrentContextPointers->S0 = pUnwoundState->ptrCalleeSavedRegisters[0]; pRD->pCurrentContextPointers->S1 = pUnwoundState->ptrCalleeSavedRegisters[1]; @@ -525,7 +525,7 @@ void HelperMethodFrame::UpdateRegDisplay(const PREGDISPLAY pRD, bool updateFloat pRD->pCurrentContext->S8 = m_MachState.ptrCalleeSavedRegisters[8] ? *m_MachState.ptrCalleeSavedRegisters[8] : m_MachState.captureCalleeSavedRegisters[8]; pRD->pCurrentContext->Fp = m_MachState.ptrCalleeSavedRegisters[9] ? *m_MachState.ptrCalleeSavedRegisters[9] : m_MachState.captureCalleeSavedRegisters[9]; pRD->pCurrentContext->Tp = m_MachState.ptrCalleeSavedRegisters[10] ? *m_MachState.ptrCalleeSavedRegisters[10] : m_MachState.captureCalleeSavedRegisters[10]; - pRD->pCurrentContext->Ra = NULL; // Unwind again to get Caller's PC + pRD->pCurrentContext->Ra = 0; // Unwind again to get Caller's PC #else // TARGET_UNIX pRD->pCurrentContext->S0 = *m_MachState.ptrCalleeSavedRegisters[0]; pRD->pCurrentContext->S1 = *m_MachState.ptrCalleeSavedRegisters[1]; @@ -538,7 +538,7 @@ void HelperMethodFrame::UpdateRegDisplay(const PREGDISPLAY pRD, bool updateFloat pRD->pCurrentContext->S8 = *m_MachState.ptrCalleeSavedRegisters[8]; pRD->pCurrentContext->Fp = *m_MachState.ptrCalleeSavedRegisters[9]; pRD->pCurrentContext->Tp = *m_MachState.ptrCalleeSavedRegisters[10]; - pRD->pCurrentContext->Ra = NULL; // Unwind again to get Caller's PC + pRD->pCurrentContext->Ra = 0; // Unwind again to get Caller's PC #endif #if !defined(DACCESS_COMPILE) diff --git a/src/coreclr/vm/loongarch64/virtualcallstubcpu.hpp b/src/coreclr/vm/loongarch64/virtualcallstubcpu.hpp index ed1a13fda4257..ff1952a6c63d7 100644 --- a/src/coreclr/vm/loongarch64/virtualcallstubcpu.hpp +++ b/src/coreclr/vm/loongarch64/virtualcallstubcpu.hpp @@ -343,7 +343,7 @@ struct ResolveHolder _stub._resolveWorkerTarget = resolveWorkerTarget; _ASSERTE(resolveWorkerTarget == (PCODE)ResolveWorkerChainLookupAsmStub); - _ASSERTE(patcherTarget == NULL); + _ASSERTE(patcherTarget == (PCODE)NULL); #undef DATA_OFFSET #undef PC_REL_OFFSET diff --git a/src/native/external/libunwind-version.txt b/src/native/external/libunwind-version.txt index 82cbcf4866c0a..4c0f4bdf5b3d0 100644 --- a/src/native/external/libunwind-version.txt +++ b/src/native/external/libunwind-version.txt @@ -10,3 +10,4 @@ Apply https://github.com/libunwind/libunwind/pull/714 Revert https://github.com/libunwind/libunwind/commit/ec03043244082b8f552881ba9fb790aa49c85468 and follow up changes in the same file # issue: https://github.com/libunwind/libunwind/issues/715 Apply https://github.com/libunwind/libunwind/pull/734 Apply https://github.com/libunwind/libunwind/pull/758 +Apply https://github.com/libunwind/libunwind/pull/741 diff --git a/src/native/external/libunwind/src/loongarch64/getcontext.S b/src/native/external/libunwind/src/loongarch64/getcontext.S index 3344fc2e277ac..c568832c1b105 100644 --- a/src/native/external/libunwind/src/loongarch64/getcontext.S +++ b/src/native/external/libunwind/src/loongarch64/getcontext.S @@ -25,7 +25,6 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "offsets.h" -#include .text #define SREG(X) st.d $r##X, $r4, (LINUX_UC_MCONTEXT_GREGS + 8 * X)