diff --git a/compiler-rt/lib/asan/asan_interceptors.cpp b/compiler-rt/lib/asan/asan_interceptors.cpp --- a/compiler-rt/lib/asan/asan_interceptors.cpp +++ b/compiler-rt/lib/asan/asan_interceptors.cpp @@ -443,7 +443,7 @@ #if ASAN_INTERCEPT_INDEX # if ASAN_USE_ALIAS_ATTRIBUTE_FOR_INDEX INTERCEPTOR(char*, index, const char *string, int c) - ALIAS(WRAPPER_NAME(strchr)); + ALIAS(WRAP(strchr)); # else # if SANITIZER_APPLE DECLARE_REAL(char*, index, const char *string, int c) diff --git a/compiler-rt/lib/hwasan/hwasan_allocation_functions.cpp b/compiler-rt/lib/hwasan/hwasan_allocation_functions.cpp --- a/compiler-rt/lib/hwasan/hwasan_allocation_functions.cpp +++ b/compiler-rt/lib/hwasan/hwasan_allocation_functions.cpp @@ -159,13 +159,13 @@ // Fuchsia does not use WRAP/wrappers used for the interceptor infrastructure. # define INTERCEPTOR_ALIAS(RET, FN, ARGS...) \ extern "C" SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE RET FN( \ - ARGS) ALIAS("__sanitizer_" #FN) + ARGS) ALIAS(__sanitizer_##FN) #else # define INTERCEPTOR_ALIAS(RET, FN, ARGS...) \ extern "C" SANITIZER_INTERFACE_ATTRIBUTE RET WRAP(FN)(ARGS) \ - ALIAS("__sanitizer_" #FN); \ + ALIAS(__sanitizer_##FN); \ extern "C" SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE RET FN( \ - ARGS) ALIAS("__sanitizer_" #FN) + ARGS) ALIAS(__sanitizer_##FN) #endif INTERCEPTOR_ALIAS(int, posix_memalign, void **memptr, SIZE_T alignment, diff --git a/compiler-rt/lib/interception/interception.h b/compiler-rt/lib/interception/interception.h --- a/compiler-rt/lib/interception/interception.h +++ b/compiler-rt/lib/interception/interception.h @@ -118,13 +118,11 @@ } # define WRAP(x) wrap_##x -# define WRAPPER_NAME(x) "wrap_"#x # define INTERCEPTOR_ATTRIBUTE # define DECLARE_WRAPPER(ret_type, func, ...) #elif SANITIZER_WINDOWS # define WRAP(x) __asan_wrap_##x -# define WRAPPER_NAME(x) "__asan_wrap_"#x # define INTERCEPTOR_ATTRIBUTE __declspec(dllexport) # define DECLARE_WRAPPER(ret_type, func, ...) \ extern "C" ret_type func(__VA_ARGS__); @@ -132,7 +130,6 @@ extern "C" __declspec(dllimport) ret_type __stdcall func(__VA_ARGS__); #elif SANITIZER_FREEBSD || SANITIZER_NETBSD # define WRAP(x) __interceptor_ ## x -# define WRAPPER_NAME(x) "__interceptor_" #x # define INTERCEPTOR_ATTRIBUTE __attribute__((visibility("default"))) // FreeBSD's dynamic linker (incompliantly) gives non-weak symbols higher // priority than weak ones so weak aliases won't work for indirect calls @@ -142,7 +139,6 @@ __attribute__((alias("__interceptor_" #func), visibility("default"))); #elif !SANITIZER_FUCHSIA # define WRAP(x) __interceptor_ ## x -# define WRAPPER_NAME(x) "__interceptor_" #x # define INTERCEPTOR_ATTRIBUTE __attribute__((visibility("default"))) # define DECLARE_WRAPPER(ret_type, func, ...) \ extern "C" ret_type func(__VA_ARGS__) \ diff --git a/compiler-rt/lib/lsan/lsan_interceptors.cpp b/compiler-rt/lib/lsan/lsan_interceptors.cpp --- a/compiler-rt/lib/lsan/lsan_interceptors.cpp +++ b/compiler-rt/lib/lsan/lsan_interceptors.cpp @@ -197,7 +197,7 @@ #endif // SANITIZER_INTERCEPT_PVALLOC #if SANITIZER_INTERCEPT_CFREE -INTERCEPTOR(void, cfree, void *p) ALIAS(WRAPPER_NAME(free)); +INTERCEPTOR(void, cfree, void *p) ALIAS(WRAP(free)); #define LSAN_MAYBE_INTERCEPT_CFREE INTERCEPT_FUNCTION(cfree) #else #define LSAN_MAYBE_INTERCEPT_CFREE diff --git a/compiler-rt/lib/memprof/memprof_interceptors.cpp b/compiler-rt/lib/memprof/memprof_interceptors.cpp --- a/compiler-rt/lib/memprof/memprof_interceptors.cpp +++ b/compiler-rt/lib/memprof/memprof_interceptors.cpp @@ -192,7 +192,7 @@ DEFINE_REAL_PTHREAD_FUNCTIONS INTERCEPTOR(char *, index, const char *string, int c) -ALIAS(WRAPPER_NAME(strchr)); +ALIAS(WRAP(strchr)); // For both strcat() and strncat() we need to check the validity of |to| // argument irrespective of the |from| length. diff --git a/compiler-rt/lib/msan/msan_interceptors.cpp b/compiler-rt/lib/msan/msan_interceptors.cpp --- a/compiler-rt/lib/msan/msan_interceptors.cpp +++ b/compiler-rt/lib/msan/msan_interceptors.cpp @@ -1109,7 +1109,7 @@ #if SANITIZER_NETBSD INTERCEPTOR(int, __libc_thr_keycreate, __sanitizer_pthread_key_t *m, void (*dtor)(void *value)) -ALIAS(WRAPPER_NAME(pthread_key_create)); +ALIAS(WRAP(pthread_key_create)); #endif INTERCEPTOR(int, pthread_join, void *thread, void **retval) { diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc @@ -4456,7 +4456,7 @@ #if SANITIZER_INTERCEPT___LIBC_MUTEX INTERCEPTOR(int, __libc_thr_setcancelstate, int state, int *oldstate) -ALIAS(WRAPPER_NAME(pthread_setcancelstate)); +ALIAS(WRAP(pthread_setcancelstate)); #define INIT___LIBC_THR_SETCANCELSTATE \ COMMON_INTERCEPT_FUNCTION(__libc_thr_setcancelstate) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h --- a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h @@ -217,7 +217,7 @@ # define WARN_UNUSED_RESULT #else // _MSC_VER # define ALWAYS_INLINE inline __attribute__((always_inline)) -# define ALIAS(x) __attribute__((alias(x))) +# define ALIAS(x) __attribute__((alias(SANITIZER_STRINGIFY(x)))) // Please only use the ALIGNED macro before the type. // Using ALIGNED after the variable declaration is not portable! # define ALIGNED(x) __attribute__((aligned(x))) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_win_dll_thunk.h b/compiler-rt/lib/sanitizer_common/sanitizer_win_dll_thunk.h --- a/compiler-rt/lib/sanitizer_common/sanitizer_win_dll_thunk.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_win_dll_thunk.h @@ -84,7 +84,7 @@ // which isn't a big deal. #define INTERCEPT_LIBRARY_FUNCTION(name) \ extern "C" void name(); \ - INTERCEPT_OR_DIE(WRAPPER_NAME(name), name) + INTERCEPT_OR_DIE(STRINGIFY(WRAP(name)), name) // Use these macros for functions that could be called before __dll_thunk_init() // is executed and don't lead to errors if defined (free, malloc, etc). diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_testlib.cpp b/compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_testlib.cpp --- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_testlib.cpp +++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_testlib.cpp @@ -165,13 +165,13 @@ } #if SANITIZER_INTERCEPT_CFREE -void cfree(void *p) ALIAS("free"); +void cfree(void *p) ALIAS(free); #endif // SANITIZER_INTERCEPT_CFREE #if SANITIZER_INTERCEPT_PVALLOC -void *pvalloc(size_t size) ALIAS("valloc"); +void *pvalloc(size_t size) ALIAS(valloc); #endif // SANITIZER_INTERCEPT_PVALLOC #if SANITIZER_INTERCEPT_MEMALIGN -void *__libc_memalign(size_t alignment, size_t size) ALIAS("memalign"); +void *__libc_memalign(size_t alignment, size_t size) ALIAS(memalign); #endif // SANITIZER_INTERCEPT_MEMALIGN void malloc_usable_size() { @@ -190,11 +190,11 @@ struct nothrow_t; } -void *operator new(size_t size) ALIAS("malloc"); -void *operator new[](size_t size) ALIAS("malloc"); -void *operator new(size_t size, std::nothrow_t const&) ALIAS("malloc"); -void *operator new[](size_t size, std::nothrow_t const&) ALIAS("malloc"); -void operator delete(void *ptr) throw() ALIAS("free"); -void operator delete[](void *ptr) throw() ALIAS("free"); -void operator delete(void *ptr, std::nothrow_t const&) ALIAS("free"); -void operator delete[](void *ptr, std::nothrow_t const&) ALIAS("free"); +void *operator new(size_t size) ALIAS(malloc); +void *operator new[](size_t size) ALIAS(malloc); +void *operator new(size_t size, std::nothrow_t const&) ALIAS(malloc); +void *operator new[](size_t size, std::nothrow_t const&) ALIAS(malloc); +void operator delete(void *ptr) throw() ALIAS(free); +void operator delete[](void *ptr) throw() ALIAS(free); +void operator delete(void *ptr, std::nothrow_t const&) ALIAS(free); +void operator delete[](void *ptr, std::nothrow_t const&) ALIAS(free); diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors.h b/compiler-rt/lib/tsan/rtl/tsan_interceptors.h --- a/compiler-rt/lib/tsan/rtl/tsan_interceptors.h +++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors.h @@ -82,7 +82,7 @@ #if SANITIZER_FREEBSD # define TSAN_INTERCEPTOR_FREEBSD_ALIAS(ret, func, ...) \ TSAN_INTERCEPTOR(ret, _pthread_##func, __VA_ARGS__) \ - ALIAS(WRAPPER_NAME(pthread_##func)); + ALIAS(WRAP(pthread_##func)); #else # define TSAN_INTERCEPTOR_FREEBSD_ALIAS(ret, func, ...) #endif @@ -90,13 +90,13 @@ #if SANITIZER_NETBSD # define TSAN_INTERCEPTOR_NETBSD_ALIAS(ret, func, ...) \ TSAN_INTERCEPTOR(ret, __libc_##func, __VA_ARGS__) \ - ALIAS(WRAPPER_NAME(pthread_##func)); + ALIAS(WRAP(pthread_##func)); # define TSAN_INTERCEPTOR_NETBSD_ALIAS_THR(ret, func, ...) \ TSAN_INTERCEPTOR(ret, __libc_thr_##func, __VA_ARGS__) \ - ALIAS(WRAPPER_NAME(pthread_##func)); + ALIAS(WRAP(pthread_##func)); # define TSAN_INTERCEPTOR_NETBSD_ALIAS_THR2(ret, func, func2, ...) \ TSAN_INTERCEPTOR(ret, __libc_thr_##func, __VA_ARGS__) \ - ALIAS(WRAPPER_NAME(pthread_##func2)); + ALIAS(WRAP(pthread_##func2)); #else # define TSAN_INTERCEPTOR_NETBSD_ALIAS(ret, func, ...) # define TSAN_INTERCEPTOR_NETBSD_ALIAS_THR(ret, func, ...)