[LIT][Darwin] Preload libclang_rt.asan_osx_dynamic.dylib when necessary
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Thu, 4 Aug 2016 22:01:38 +0000 (22:01 +0000)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Thu, 4 Aug 2016 22:01:38 +0000 (22:01 +0000)
commit8daab7582bef4e5d887fc214c9f64dfee122349e
tree05d4585263186a3bfec09737d30bee5d7e310bc9
parentb44444b3f19ff335cbd13d3e810f3128a6897030
[LIT][Darwin] Preload libclang_rt.asan_osx_dynamic.dylib when necessary

Green Dragon's darwin stage2 asan bot fails on some checks:
http://lab.llvm.org:8080/green/job/clang-stage2-cmake-RgSan_check

  test/tools/lto/hide-linkonce-odr.ll
  test/tools/lto/opt-level.ll

ERROR: Interceptors are not working. This may be because
AddressSanitizer is loaded too late (e.g. via dlopen)

To fix this, %ld64 needs to load 'libclang_rt.asan_osx_dynamic.dylib'
before libLTO.dylib, via DYLD_INSERT_LIBRARIES. This won't work by
updating config.environment, since some shim binary in the way scrubs
the env vars. Instead, provide the path to this lib through %asanrtlib,
which can then be used by tests directly with DYLD_INSERT_LIBRARIES.

rdar://problem/24300926

llvm-svn: 277778
llvm/test/lit.cfg
llvm/test/tools/lto/hide-linkonce-odr.ll
llvm/test/tools/lto/opt-level.ll