[PATCH] Add compiler support for dynamic Asan runtime

Yury Gribov tetra2005 at gmail.com
Wed Mar 19 09:08:24 PDT 2014

  > Please add tests for this

  Done as part of D3043. Or do you want Clang tests? But I don't think we have any to date, everything is tested in compiler-rt...

Comment at: lib/Driver/SanitizerArgs.cpp:176
@@ +175,3 @@
+      Args.hasFlag(options::OPT_shared_libasan,
+                   options::OPT_shared_libasan,
+                   /* Default */false);
Alexey Samsonov wrote:
> Why not hasArg()?
Will fix.

Comment at: lib/Driver/Tools.cpp:1837
@@ -1824,3 +1836,3 @@
   // whole-archive.
-  SmallVector<const char *, 3> LibSanitizerArgs;
+  SmallVector<const char *, 4> LibSanitizerArgs;
Alexey Samsonov wrote:
> The logic is too obscure here. --whole-archive makes no sense for dynamic library.
> If we're linking executable, add "--whole-archive X --no-whole-archive", where X is either full asan, or preinit-asan.
> Otherwise add libasan.so.
> Maybe it would be even simpler to pull this logic to addAsanRT (we handle dynamic runtime for Android there, for instance),
> and call addSanitizerRTLinkFlags with either "asan", or "asan-preinit".
Ok, agreed. I'll see what I can do.


More information about the llvm-commits mailing list