[PATCH] Optional support for dynamic Asan runtime

Yuri Gribov tetra2005 at gmail.com
Tue Apr 1 09:30:47 PDT 2014


> When we link the executable with libclang_rt.asan-x86_64.so,
> linker doesn't know where this .so would come from

You mean static or dynamic linker (ld or ld.so)? Static linker does
know where rt comes from because we link by abs path. For dynamic
linker we need to specify LD_LIBRARY_PATH (and lit configs do specify
it).

> (we need to specify LD_LIBRARY_PATH for it), and therefore doesn't link in the transitive dependencies.

Hm, I don't think that ld adds trans dependencies:
$ bin/clang -fsanitize=address tmp.c -shared-libasan
$ readelf -d ./a.out | grep NEEDED
 0x0000000000000001 (NEEDED)             Shared library:
[libclang_rt.asan-x86_64.so]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
$ readelf -d lib/clang/3.5.0/lib/linux/libclang_rt.asan-x86_64.so  | grep NEEDED
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [ld-linux-x86-64.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]

-Y



More information about the llvm-commits mailing list