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

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


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

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.

>From b15976d1c544a21a2673662c1681ac681e7faa2e Mon Sep 17 00:00:00 2001
From: Brian Cain <bcain at quicinc.com>
Date: Fri, 6 Sep 2024 19:56:27 -0700
Subject: [PATCH] [compiler-rt] Replace assignment w/.set directive

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.
---
 .../lib/sanitizer_common/sanitizer_redefine_builtins.h    | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

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)



More information about the llvm-commits mailing list