[compiler-rt] [compiler-rt] Replace assignment w/.set directive (PR #107667)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 6 19:59:57 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Brian Cain (androm3da)

<details>
<summary>Changes</summary>

These assignment statements are rejected by `llvm-mc --triple=hexagon`, likely because the syntax so strongly resembles hexagon asm mnemonics.

The statements were being normalized by llvm-mc into `.set` directives for most architectures, so I assume that this change is a portable one.

---
Full diff: https://github.com/llvm/llvm-project/pull/107667.diff


1 Files Affected:

- (modified) compiler-rt/lib/sanitizer_common/sanitizer_redefine_builtins.h (+5-3) 


``````````diff
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_redefine_builtins.h b/compiler-rt/lib/sanitizer_common/sanitizer_redefine_builtins.h
index d24b179ef320c1..41e0613d6fc138 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_redefine_builtins.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_redefine_builtins.h
@@ -17,9 +17,11 @@
 // The asm hack only works with GCC and Clang.
 #    if !defined(_WIN32)
 
-asm("memcpy = __sanitizer_internal_memcpy");
-asm("memmove = __sanitizer_internal_memmove");
-asm("memset = __sanitizer_internal_memset");
+asm(R"(
+    .set memcpy, __sanitizer_internal_memcpy
+    .set memmove, __sanitizer_internal_memmove
+    .set memset, __sanitizer_internal_memset
+    )");
 
 #      if defined(__cplusplus) && \
           !defined(SANITIZER_COMMON_REDEFINE_BUILTINS_IN_STD)

``````````

</details>


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


More information about the llvm-commits mailing list