[compiler-rt] [llvm] [compiler-rt][msan] Add MSan support for RISC-V 64-bit Linux (PR #206674)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 30 01:10:53 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- compiler-rt/lib/msan/msan.h compiler-rt/lib/msan/msan_allocator.cpp llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/compiler-rt/lib/msan/msan.h b/compiler-rt/lib/msan/msan.h
index f51518966..b23886543 100644
--- a/compiler-rt/lib/msan/msan.h
+++ b/compiler-rt/lib/msan/msan.h
@@ -153,7 +153,8 @@ const MappingDesc kMemoryLayout[] = {
     {0x003000000000ULL, 0x003c00000000ULL, MappingDesc::ORIGIN, "origin"},
     {0x003c00000000ULL, 0x004000000000ULL, MappingDesc::APP, "app-hi"},
 };
-#  define MEM_TO_SHADOW(mem) ((((uptr)(mem) & ~0x3c00000000ULL) ^ 0x0800000000ULL) + 0x1000000000ULL)
+#  define MEM_TO_SHADOW(mem) \
+    ((((uptr)(mem) & ~0x3c00000000ULL) ^ 0x0800000000ULL) + 0x1000000000ULL)
 #  define SHADOW_TO_ORIGIN(shadow) (((uptr)(shadow)) + 0x2000000000ULL)
 
 #elif SANITIZER_LINUX && SANITIZER_S390_64
diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index 3779d8c1c..8a99156e0 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -522,10 +522,10 @@ static const MemoryMapParams Linux_Hexagon_MemoryMapParams = {
 
 // riscv64 Linux — SV39 (256GB)
 static const MemoryMapParams Linux_RISCV64_MemoryMapParams = {
-    0x3C00000000,   // AndMask (fold bits 34-37)
-    0x0800000000,   // XorMask (flip bit 35)
-    0x1000000000,   // ShadowBase (shadow at 64GB)
-    0x3000000000,   // OriginBase (origin at 192GB)
+    0x3C00000000, // AndMask (fold bits 34-37)
+    0x0800000000, // XorMask (flip bit 35)
+    0x1000000000, // ShadowBase (shadow at 64GB)
+    0x3000000000, // OriginBase (origin at 192GB)
 };
 
 // aarch64 FreeBSD

``````````

</details>


https://github.com/llvm/llvm-project/pull/206674


More information about the llvm-commits mailing list