Link against a **custom** asan library

53 views
Skip to first unread message

Dmitry Work

unread,
Jan 27, 2022, 6:21:52 PM1/27/22
to address-sanitizer
Hello,

What is the right way of using a custom (built by me from llvm sources) asan library?

During compilation I am using -fsanitize=address.

But what should I use for linking? It is recommended everywhere to use -static-libasan or -shared-libasan, but as far as I understand, linker will use the library that comes with compiler (not mine).

Shall I drop -static-libasan / -shared-libasan and just link against the clang_rt.asan-dynamic-x86_64 built by me? Or something else?


Thank you in advance.

Jeffrey Walton

unread,
Feb 23, 2022, 8:09:09 AM2/23/22
to address-...@googlegroups.com
According to the compiler folks, you should drive link through the
compiler driver. The compiler driver will add the proper libraries for
you.

Do not invoke LD yourself. It is getting too hard to get right,
especially when you have a compiler located at a non-standard location
like /opt or /opt/local.

Jeff
Reply all
Reply to author
Forward
0 new messages