[PATCH] Don't add sanitizer init function directly into module constructors

Ismail Pazarbasi ismail.pazarbasi at gmail.com
Wed Apr 1 04:56:01 PDT 2015


In http://reviews.llvm.org/D8754#150182, @kcc wrote:

> > Yes; Darwin. Dynamic linker is expecting module initializer to be defined within the module itself, otherwise it says:
>
> >  dyld: initializer function <address> not in mapped image
>
>
> Interesting. Does this mean that you are porting tsan/msan to Darwin? 
>  This, especially for msan, could be a great challenge.


Yes, tsan on Darwin. It's mostly working. TLS is the biggest problem. My patches are far from submission quality right now, but I am working on it. Basically;

- `cur_thread()` cannot use `cur_thread_placeholder`, because its storage initialized too late. I will certainly need help with this one. I use `malloc` to obtain storage, and store this pointer with `pthread_setspecific`, where key is the finalize key (and that is still a problem :) )
- Race report doesn't print function name - I think this is easy to fix, although I didn't carefully check yet. I have found TSan's report format is slightly different with ASan's, and ASan report prints function name. Maybe it's really that easy, maybe not...
- I mostly copied `pthread_barrier` implementation from FreeBSD, as some tests use this.

After getting TSan to run on Darwin, I can try MSan as well.


http://reviews.llvm.org/D8754

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list