[llvm-commits] [compiler-rt] r150683 - in /compiler-rt/trunk/lib/asan: asan_interceptors.cc asan_interceptors.h

David Dean david_dean at apple.com
Thu Feb 16 08:51:52 PST 2012


I'm see this when trying to build:

/Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/llvm/projects/compiler-rt/lib/asan/asan_interceptors.cc:222:5: error: conflicting types for 'pthread_create'
int pthread_create(void *thread, const void *attr,
    ^
/usr/include/pthread.h:298:11: note: previous declaration is here
int       pthread_create(pthread_t * __restrict,
          ^



On 16 Feb 2012, at 3:26 AM, Alexey Samsonov wrote:

> Author: samsonov
> Date: Thu Feb 16 05:26:52 2012
> New Revision: 150683
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=150683&view=rev
> Log:
> AddressSanitizer: don't include pthread.h and signal.h in interceptors on Mac
> 
> Modified:
>    compiler-rt/trunk/lib/asan/asan_interceptors.cc
>    compiler-rt/trunk/lib/asan/asan_interceptors.h
> 
> 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=150683&r1=150682&r2=150683&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/asan_interceptors.cc (original)
> +++ compiler-rt/trunk/lib/asan/asan_interceptors.cc Thu Feb 16 05:26:52 2012
> @@ -34,11 +34,11 @@
> 
> #if defined(__APPLE__)
> // FIXME(samsonov): Gradually replace system headers with declarations of
> -// intercepted functions.
> -#include <pthread.h>
> -#include <signal.h>
> +// intercepted functions. We need these declarations on Mac to get addresses of
> +// the functions to intercept.
> #include <string.h>
> #include <strings.h>
> +
> #endif  // __APPLE__
> 
> namespace __asan {
> @@ -218,8 +218,10 @@
> }
> 
> #ifndef _WIN32
> -INTERCEPTOR(int, pthread_create, pthread_t *thread,
> -                                 const pthread_attr_t *attr,
> +extern "C"
> +int pthread_create(void *thread, const void *attr,
> +                   void *(*start_routine)(void*), void *arg);
> +INTERCEPTOR(int, pthread_create, void *thread, const void *attr,
>                                  void *(*start_routine)(void*), void *arg) {
>   GET_STACK_TRACE_HERE(kStackTraceMax);
>   int current_tid = asanThreadRegistry().GetCurrentTidOrMinusOne();
> @@ -237,8 +239,9 @@
>   return NULL;
> }
> 
> -INTERCEPTOR(int, sigaction, int signum, const struct sigaction *act,
> -                            struct sigaction *oldact) {
> +extern "C"
> +int sigaction(int signum, const void *act, void *oldact);
> +INTERCEPTOR(int, sigaction, int signum, const void *act, void *oldact) {
>   if (!AsanInterceptsSignal(signum)) {
>     return REAL(sigaction)(signum, act, oldact);
>   }
> @@ -393,8 +396,7 @@
> #endif
> 
> #ifdef ANDROID
> -DEFINE_REAL(int, sigaction, int signum, const struct sigaction *act,
> -    struct sigaction *oldact);
> +DEFINE_REAL(int, sigaction, int signum, const void *act, void *oldact);
> #endif
> 
> INTERCEPTOR(int, strcasecmp, const char *s1, const char *s2) {
> 
> Modified: compiler-rt/trunk/lib/asan/asan_interceptors.h
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interceptors.h?rev=150683&r1=150682&r2=150683&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/asan_interceptors.h (original)
> +++ compiler-rt/trunk/lib/asan/asan_interceptors.h Thu Feb 16 05:26:52 2012
> @@ -24,9 +24,7 @@
> DECLARE_REAL(size_t, strlen, const char *s);
> DECLARE_REAL(char*, strncpy, char *to, const char *from, size_t size);
> DECLARE_REAL(size_t, strnlen, const char *s, size_t maxlen);
> -struct sigaction;
> -DECLARE_REAL(int, sigaction, int signum, const struct sigaction *act,
> -                             struct sigaction *oldact);
> +DECLARE_REAL(int, sigaction, int signum, const void *act, void *oldact);
> 
> namespace __asan {
> 
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-David





More information about the llvm-commits mailing list