https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112563

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Note, following patch
--- libsanitizer/sanitizer_common/sanitizer_redefine_builtins.h.jj     
2023-11-15 17:19:11.512783752 +0100
+++ libsanitizer/sanitizer_common/sanitizer_redefine_builtins.h 2023-11-19
22:52:14.659301189 +0100
@@ -17,9 +17,24 @@
 // The asm hack only works with GCC and Clang.
 #    if !defined(_WIN32)

+#      if !defined(__GNUC__) || defined(__clang__)
 asm("memcpy = __sanitizer_internal_memcpy");
 asm("memmove = __sanitizer_internal_memmove");
 asm("memset = __sanitizer_internal_memset");
+#      else
+#        if defined(__cplusplus)
+extern "C" {
+#        endif
+extern void *(memcpy) (void *, const void *, __SIZE_TYPE__) __asm
("__sanitizer_internal_memcpy");
+extern void *(memmove) (void *, const void *, __SIZE_TYPE__) __asm
("__sanitizer_internal_memmove");
+extern void *(memset) (void *, int, __SIZE_TYPE__) __asm
("__sanitizer_internal_memset");
+extern void *__builtin_memcpy (void *, const void *, __SIZE_TYPE__) __asm
("__sanitizer_internal_memcpy");
+extern void *__builtin_memmove (void *, const void *, __SIZE_TYPE__) __asm
("__sanitizer_internal_memmove");
+extern void *__builtin_memset (void *, int, __SIZE_TYPE__) __asm
("__sanitizer_internal_memset");
+#        if defined(__cplusplus)
+}
+#        endif
+#      endif

 #      if defined(__cplusplus) && \
           !defined(SANITIZER_COMMON_REDEFINE_BUILTINS_IN_STD)

passed bootstrap/regtest for me on x86_64-linux and i686-linux and didn't
create any new memset/memcpy/memmove calls in objdump -dr libasan.so.* (we have
2 memset calls
from inside of libbacktrace, guess we ought to deal with that eventually).
Does this help on Solaris/sparc?

Reply via email to