[PATCH] Add compiler support for dynamic Asan runtime

Alexey Samsonov samsonov at google.com
Tue Mar 25 10:52:42 PDT 2014


  I think this change will be fine to go in after the following fixes. I'll take a look at compiler-rt part tomorrow.


================
Comment at: lib/Driver/Tools.cpp:1866
@@ -1851,2 +1865,3 @@
   if (ExportSymbols) {
-    if (llvm::sys::fs::exists(LibSanitizer + ".syms"))
+    const char *LibSanitizer = getSanitizerRTLibName(TC, Sanitizer, Args,
+      /*Shared*/ false);
----------------
Delete this. You already have LibSanitizer defined above.

================
Comment at: lib/Driver/SanitizerArgs.cpp:174
@@ -172,1 +173,3 @@
+  if (NeedsAsan) {
+    AsanSharedRuntime = Args.hasArg(options::OPT_shared_libasan);
     AsanZeroBaseShadow =
----------------
AsanSharedRuntime should be true on Android.

================
Comment at: lib/Driver/Tools.cpp:1882
@@ -1865,3 +1881,3 @@
     SmallString<128> LibAsan = getCompilerRTLibDir(TC);
     llvm::sys::path::append(LibAsan,
                             (Twine("libclang_rt.asan-") +
----------------
Please put this Android-specific logic to getSanitizerRTLibName. Then you'll be able to merge this block with the following one (and quit early on Android - there's no asan-preinit there.

================
Comment at: lib/Driver/Tools.cpp:1899
@@ +1898,3 @@
+    const char *LibAsanStaticPart = Shared ? "asan-preinit" : "asan";
+    bool ExportSymbols = !Shared,
+      LinkDeps = !Shared,
----------------
Oh, let's switch back to a single
  addSanitizerRTLinkFlags(TC, Args, CmdArgs, LibAsanStaticPart,
    /* BeforeLibStdCXX */ true, /* Export Symbols */ !Shared, /* Link Deps */ !Shared);
Sorry for changing my mind.


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



More information about the llvm-commits mailing list