From 1fc8974f759ef467d759ba3a2a46c644dced3c14 Mon Sep 17 00:00:00 2001 From: Adeel Mujahid <3840695+am11@users.noreply.github.com> Date: Sat, 13 Jul 2024 02:46:12 +0300 Subject: [PATCH] Fix build on alpine-riscv64 (#4787) cc @viewizard @gbalykov ```sh docker run --rm -v$(pwd):/diagnostics -w /diagnostics --platform linux/riscv64 alpine:edge sh -c \ 'apk add build-base cmake bash curl clang llvm-dev && ./build.sh -skipmanaged' ``` --- src/SOS/lldbplugin/services.cpp | 4 ++++ src/shared/inc/regdisp.h | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/SOS/lldbplugin/services.cpp b/src/SOS/lldbplugin/services.cpp index f056814beb..291f0f677a 100644 --- a/src/SOS/lldbplugin/services.cpp +++ b/src/SOS/lldbplugin/services.cpp @@ -231,6 +231,8 @@ LLDBServices::VirtualUnwind( DWORD spToFind = dtcontext->Sp; #elif DBG_TARGET_ARM64 DWORD64 spToFind = dtcontext->Sp; +#elif DBG_TARGET_RISCV64 + DWORD64 spToFind = dtcontext->Sp; #else #error "spToFind undefined for this platform" #endif @@ -454,6 +456,8 @@ LLDBServices::GetExecutingProcessorType( *type = IMAGE_FILE_MACHINE_ARM64; #elif DBG_TARGET_X86 *type = IMAGE_FILE_MACHINE_I386; +#elif DBG_TARGET_RISCV64 + *type = IMAGE_FILE_MACHINE_RISCV64; #else #error "Unsupported target" #endif diff --git a/src/shared/inc/regdisp.h b/src/shared/inc/regdisp.h index 02e67dbdd4..406e3365f3 100644 --- a/src/shared/inc/regdisp.h +++ b/src/shared/inc/regdisp.h @@ -226,12 +226,12 @@ struct REGDISPLAY : public REGDISPLAY_BASE { inline TADDR GetRegdisplayFP(REGDISPLAY *display) { LIMITED_METHOD_CONTRACT; - return NULL; + return (TADDR)NULL; } inline TADDR GetRegdisplayFPAddress(REGDISPLAY *display) { LIMITED_METHOD_CONTRACT; - return NULL; + return (TADDR)NULL; } // This function tells us if the given stack pointer is in one of the frames of the functions called by the given frame @@ -248,14 +248,14 @@ inline TADDR GetRegdisplayStackMark(REGDISPLAY *display) _ASSERTE(GetRegdisplaySP(display) == GetSP(display->pCurrentContext)); return GetRegdisplaySP(display); -#elif defined(TARGET_ARM64) +#elif defined(TARGET_ARM64) || defined(TARGET_RISCV64) _ASSERTE(display->IsCallerContextValid); return GetSP(display->pCallerContext); #else // TARGET_AMD64 PORTABILITY_ASSERT("GetRegdisplayStackMark NYI for this platform (Regdisp.h)"); - return NULL; + return (TADDR)NULL; #endif // TARGET_AMD64 }