[PATCH] Add compiler support for dynamic Asan runtime

Alexey Samsonov samsonov at google.com
Wed Mar 19 08:19:53 PDT 2014



================
Comment at: lib/Driver/Tools.cpp:1837
@@ -1824,3 +1836,3 @@
   // whole-archive.
-  SmallVector<const char *, 3> LibSanitizerArgs;
+  SmallVector<const char *, 4> LibSanitizerArgs;
   LibSanitizerArgs.push_back("-whole-archive");
----------------
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".

================
Comment at: lib/Driver/SanitizerArgs.cpp:176
@@ +175,3 @@
+      Args.hasFlag(options::OPT_shared_libasan,
+                   options::OPT_shared_libasan,
+                   /* Default */false);
----------------
Why not hasArg()?


http://llvm-reviews.chandlerc.com/D3043



More information about the llvm-commits mailing list