Fix build on alpine-riscv64 (#4787)
authorAdeel Mujahid <3840695+am11@users.noreply.github.com>
Fri, 12 Jul 2024 23:46:12 +0000 (02:46 +0300)
committerGitHub <noreply@github.com>
Fri, 12 Jul 2024 23:46:12 +0000 (16:46 -0700)
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
src/shared/inc/regdisp.h

index f056814beba78fd05ba4c0e865bad9c073bc5a54..291f0f677a5dc690d493ab9e27ff3669a5a6768d 100644 (file)
@@ -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
index 02e67dbdd4c1845130654b851b9d1032fe8d5d49..406e3365f3058d642000c31b67b0fe136c750e57 100644 (file)
@@ -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
 }