[PATCH] D53111: [lit] Support the `%shared_libasan` lit substitution on Apple platforms.

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 10 14:44:20 PDT 2018


delcypher created this revision.
delcypher added reviewers: kubamracek, george.karpenkov, mgorny, phosek, etienneb, samsonov, kcc.
Herald added a subscriber: Sanitizers.

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.

For Linux we keep the existing behaviour of using just the
file name. Given the way `%shared_libasan` is currently used in tests
this is probably a bug. It probably should be an absolute path so the
dynamic linker doesn't pick up an ASan library installed in the system
instead of the one we just built. I'm leaving this unfixed for now
so we can discuss if this should be fixed in review.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D53111

Files:
  test/asan/lit.cfg


Index: test/asan/lit.cfg
===================================================================
--- test/asan/lit.cfg
+++ test/asan/lit.cfg
@@ -101,7 +101,18 @@
 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.host_os == 'Linux':
+  # FIXME: This should be an absolute path!
+  config.substitutions.append( ("%shared_libasan", "libclang_rt.asan%s.so" % 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
+    )
+  )
+  config.substitutions.append( ("%shared_libasan", shared_libasan_path) )
+
 if config.asan_dynamic:
   config.substitutions.append( ("%clang_asan_static ", build_invocation(clang_asan_static_cflags)) )
   config.substitutions.append( ("%clangxx_asan_static ", build_invocation(clang_asan_static_cxxflags)) )


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53111.169099.patch
Type: text/x-patch
Size: 1196 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181010/b092d17f/attachment.bin>


More information about the llvm-commits mailing list