[PATCH] D151152: [compiler-rt] Avoid memintrinsic calls inserted by the compiler

Jakub JelĂ­nek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 20 11:40:08 PST 2023


jakubjelinek added a comment.

Note, this doesn't really work on SPARC Solaris when using the Solaris assembler, see https://gcc.gnu.org/PR112563 for details.
extern "C" void *memcpy (void *, const void *, decltype (sizeof 0)) __asm ("__sanitizer_internal_memcpy");
extern "C" void *memmove (void *, const void *, decltype (sizeof 0)) __asm ("__sanitizer_internal_memmove");
extern "C" void *memset (void *, int, decltype (sizeof 0)) __asm ("__sanitizer_internal_memset");
would work if -fno-builtin flag wouldn't be used, but for some reason it is.

extern "C" {

  static void *memcpy (void *, const void *, decltype (sizeof 0)) __attribute__ ((weakref ("__sanitizer_internal_memcpy")));
  static void *memmove (void *, const void *, decltype (sizeof 0)) __attribute__ ((weakref ("__sanitizer_internal_memmove")));
  static void *memset (void *, int, decltype (sizeof 0)) __attribute__ ((weakref ("__sanitizer_internal_memset")));

}
seems to work somehow, but explicit calls to the mem* or __builtin_mem* functions seem to be at least on SPARC less optimized (indirect calls rather than direct).  But I bet compiler-rt doesn't really call the functions directly but calls __sanitizer_internal_mem* instead.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151152/new/

https://reviews.llvm.org/D151152



More information about the llvm-commits mailing list