[compiler-rt] r200844 - [sanitizer] hide two functions in the __sanitizer namespace to avoid exporting them (gold complained)

Kostya Serebryany kcc at google.com
Wed Feb 5 07:06:32 PST 2014


Author: kcc
Date: Wed Feb  5 09:06:32 2014
New Revision: 200844

URL: http://llvm.org/viewvc/llvm-project?rev=200844&view=rev
Log:
[sanitizer] hide two functions in the __sanitizer namespace to avoid exporting them (gold complained)

Modified:
    compiler-rt/trunk/lib/asan/asan_interceptors.cc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc

Modified: compiler-rt/trunk/lib/asan/asan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interceptors.cc?rev=200844&r1=200843&r2=200844&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_interceptors.cc Wed Feb  5 09:06:32 2014
@@ -203,11 +203,12 @@ INTERCEPTOR(int, sigaction, int signum,
   return 0;
 }
 
-extern "C"
-int __sanitizer_sigaction_f(int signum, const void *act, void *oldact) {
+namespace __sanitizer {
+int real_sigaction(int signum, const void *act, void *oldact) {
   return REAL(sigaction)(signum,
                          (struct sigaction *)act, (struct sigaction *)oldact);
 }
+}  // namespace __sanitizer
 
 #elif SANITIZER_POSIX
 // We need to have defined REAL(sigaction) on posix systems.

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc?rev=200844&r1=200843&r2=200844&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc Wed Feb  5 09:06:32 2014
@@ -2753,10 +2753,11 @@ INTERCEPTOR(int, pthread_attr_getstack,
 // We may need to call the real pthread_attr_getstack from the run-time
 // in sanitizer_common, but we don't want to include the interception headers
 // there. So, just define this function here.
-extern "C" int __sanitizer_pthread_attr_getstack(void *attr, void **addr,
-                                                 SIZE_T *size) {
+namespace __sanitizer {
+int real_pthread_attr_getstack(void *attr, void **addr, SIZE_T *size) {
   return REAL(pthread_attr_getstack)(attr, addr, size);
 }
+}  // namespace __sanitizer
 
 #define INIT_PTHREAD_ATTR_GET                             \
   COMMON_INTERCEPT_FUNCTION(pthread_attr_getdetachstate); \

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc?rev=200844&r1=200843&r2=200844&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc Wed Feb  5 09:06:32 2014
@@ -36,29 +36,25 @@
 #include <unistd.h>
 #endif
 
+namespace __sanitizer {
+
 #ifndef SANITIZER_GO
 // This function is defined elsewhere if we intercepted pthread_attr_getstack.
-extern "C" SANITIZER_WEAK_ATTRIBUTE int
-__sanitizer_pthread_attr_getstack(void *attr, void **addr, size_t *size);
+SANITIZER_WEAK_ATTRIBUTE int
+real_pthread_attr_getstack(void *attr, void **addr, size_t *size);
 
 static int my_pthread_attr_getstack(void *attr, void **addr, size_t *size) {
-  if (__sanitizer_pthread_attr_getstack)
-    return __sanitizer_pthread_attr_getstack((pthread_attr_t *)attr, addr,
-                                             size);
-
+  if (real_pthread_attr_getstack)
+    return real_pthread_attr_getstack((pthread_attr_t *)attr, addr, size);
   return pthread_attr_getstack((pthread_attr_t *)attr, addr, size);
 }
-#endif  // #ifndef SANITIZER_GO
 
-namespace __sanitizer {
-
-#ifndef SANITIZER_GO
-extern "C" SANITIZER_WEAK_ATTRIBUTE int
-__sanitizer_sigaction_f(int signum, const void *act, void *oldact);
+SANITIZER_WEAK_ATTRIBUTE int
+real_sigaction(int signum, const void *act, void *oldact);
 
 int internal_sigaction(int signum, const void *act, void *oldact) {
-  if (__sanitizer_sigaction_f)
-    return __sanitizer_sigaction_f(signum, act, oldact);
+  if (real_sigaction)
+    return real_sigaction(signum, act, oldact);
   return sigaction(signum, (struct sigaction *)act, (struct sigaction *)oldact);
 }
 





More information about the llvm-commits mailing list