[PATCH] D29754: [clang] Add linker flag "wholearchive" for asan_cxx.

Marcos Pividori via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 9 01:30:25 PST 2017


mpividori created this revision.

We need `-wholearchive` for `asan_cxx`, the same than for `asan`.
Clang Driver will add `asan_cxx` at the beginning of the arg list that we pass to the linker.
To ensure that all the static libraries are linked to `asan_cxx`, we force the linker to include the object files in `asan_cxx`.

This fixes some linker errors when compiling with address sanitizer for MT and passing the static library `libFuzzer`.


https://reviews.llvm.org/D29754

Files:
  lib/Driver/Tools.cpp


Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -11007,6 +11007,8 @@
       // interface exported by the static lib in the main executable.
       CmdArgs.push_back(Args.MakeArgString(std::string("-wholearchive:") +
           TC.getCompilerRT(Args, "asan")));
+      CmdArgs.push_back(Args.MakeArgString(std::string("-wholearchive:") +
+          TC.getCompilerRT(Args, "asan_cxx")));
     }
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29754.87773.patch
Type: text/x-patch
Size: 501 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170209/840e6559/attachment.bin>


More information about the llvm-commits mailing list