diff options
| author | Dan Liew <dan@su-root.co.uk> | 2018-10-12 23:36:23 +0000 |
|---|---|---|
| committer | Dan Liew <dan@su-root.co.uk> | 2018-10-12 23:36:23 +0000 |
| commit | 74c6aaf81c326f20cd064cadd44afda8990c5644 (patch) | |
| tree | 330801d121e7190c38ee91d6eeb48363cd0d277e | |
| parent | bc504559ec6723b61535fb8df48a736420db3891 (diff) | |
| download | bcm5719-llvm-74c6aaf81c326f20cd064cadd44afda8990c5644.tar.gz bcm5719-llvm-74c6aaf81c326f20cd064cadd44afda8990c5644.zip | |
[lit] Support the `%shared_libasan` lit substitution on Apple platforms.
Summary:
The previous value looks Linux specific so that has been guarded with
the host OS being Linux.
On Apple platforms `%shared_libasan` expands to the absolute path of the
ASan dylib.
Previously on Linux `%shared_libasan` expanded to just the file name
of the shared library rather than the absolute path to the library.
This is likely a bug because it would rely on the OS's dynamic linker
to find the shared library which could accidentally pick up a system copy
rather than the shared library that was just built.
For other platforms we emit a warning if `config.asan_dynamic` is true.
This patch also only defines the substitution when `config.asan_dynamic`
is true because using this substitution only makes sense when the
dynamic library is available.
Reviewers: kubamracek, george.karpenkov, mgorny, phosek, etienneb, samsonov, kcc
Subscribers: #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D53111
llvm-svn: 344434
| -rw-r--r-- | compiler-rt/test/asan/lit.cfg | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/compiler-rt/test/asan/lit.cfg b/compiler-rt/test/asan/lit.cfg index f8994d069ad..a5e3f7bdc23 100644 --- a/compiler-rt/test/asan/lit.cfg +++ b/compiler-rt/test/asan/lit.cfg @@ -101,8 +101,17 @@ config.substitutions.append( ("%clang ", build_invocation(target_cflags)) ) config.substitutions.append( ("%clangxx ", build_invocation(target_cxxflags)) ) config.substitutions.append( ("%clang_asan ", build_invocation(clang_asan_cflags)) ) config.substitutions.append( ("%clangxx_asan ", build_invocation(clang_asan_cxxflags)) ) -config.substitutions.append( ("%shared_libasan", "libclang_rt.asan%s.so" % config.target_suffix)) if config.asan_dynamic: + if config.host_os == 'Linux': + shared_libasan_path = os.path.join(config.compiler_rt_libdir, "libclang_rt.asan{}.so".format(config.target_suffix)) + elif config.host_os == 'Darwin': + shared_libasan_path = os.path.join(config.compiler_rt_libdir, 'libclang_rt.asan_{}_dynamic.dylib'.format(config.apple_platform)) + else: + lit_config.warning('%shared_libasan substitution not set but dynamic ASan is available.') + shared_libasan_path = None + + if shared_libasan_path is not None: + config.substitutions.append( ("%shared_libasan", shared_libasan_path) ) config.substitutions.append( ("%clang_asan_static ", build_invocation(clang_asan_static_cflags)) ) config.substitutions.append( ("%clangxx_asan_static ", build_invocation(clang_asan_static_cxxflags)) ) |

