Basil L. Contovounesios wrote:
> > CC="clang -Wl,-rpath,$CLANG_INSTALLATION_DIR/lib -fsanitize=address"
> 
> Is it sufficient to specify the -rpath, without the need for the
> LD_PRELOAD hack (see below)?

That depends whether the library that you link with, which according
to Collin's mail is libclang_rt.asan.so, depends on the library
which you have in LD_PRELOAD, namely libclang_rt.asan-$(uname -m).so.
If it has this dependency, you shouldn't need the LD_PRELOAD.

> > CFLAGS="-O0 -fno-omit-frame-pointer -ggdb"
> 
> [ Just to be clear, these CFLAGS should be needed only for debugging. ]

These CFLAGS are also needed for reasonable stack traces in the log,
AFAIU.

> >    but instead playing with libclang_rt in undocumented ways,
> 
> It's a hack, but it's the only documented way to load an
> instrumented shared object into an uninstrumented binary:
> - https://github.com/google/sanitizers/wiki/AddressSanitizerAsDso

Ho hmm. A wiki page for the predecessor of the LLVM analyzer (the
Google analyzer), from 2015, which says "ASAN-DSO is not (yet?)
officially supported. Use it at your own risk." To me, that counts
as undocumented.

> I get the behaviour I expect when I export LD_PRELOAD and ASAN_OPTIONS
> before the configure step.

Good to hear that.

Bruno




Reply via email to