On Thu, Feb 6, 2014 at 1:44 PM, Konstantin Serebryany < [email protected]> wrote:
> You can build asan.so from LLVM tree like this: > cd lvm/projects/compiler-rt/lib > clang -o asan.so -DASAN_USE_PREINIT_ARRAY=0 -fno-exceptions -fno-rtti -I. > -O2 -fPIC -shared asan/*.cc sanitizer_common/*.cc interception/*.cc > lsan/lsan_common.cc lsan/lsan_common_linux.cc > also add "-ldl -lpthread -lm" to this command line > > LD_PRELOAD may appear to work for simple cases, but the devil is in the > detail. > What if your process creates other processes? They will also have asan.so > preloaded. > Sometimes it's ok, sometimes not. > > We may be able to support building asan as a DSO in clang tree as well, > but I don't want to do this unless we know that someone really needs it > and this is the right way to solve some problem. > > --kcc > > > > On Thu, Feb 6, 2014 at 1:32 PM, mjoc <[email protected]> wrote: > >> Thanks Kcc and Yuri, >> >> Running on Linux. >> >> I have been using clang, I will try gcc and LD_PRELOAD. >> >> Thanks, >> >> mjoc >> >> >> On Wednesday, 5 February 2014 14:25:34 UTC, Yuri Gribov wrote: >>> >>> >> Is there anyway to build a shared object with asan support and load >>> this >>> >> in a non-asan executable? >>> >>> Which platform are we talking about? >>> >>> > For your case, you may try to build asan run time as a shared library >>> and >>> > LD_PRELOAD it into your process. >>> > But this is really tricky and I don't recommend this unless you are >>> > desperate. >>> >>> FYI this works out-of-the-box with GCC ASan (which allows dynamic ASan >>> runtime). >>> >>> -Y >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "address-sanitizer" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- You received this message because you are subscribed to the Google Groups "address-sanitizer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
