[PATCH] D27869: [libFuzzer] Diff 24 - Use clang as linker in Windows, to properly include sanitizer libraries.

Marcos Pividori via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 20 15:00:11 PST 2017

This revision was automatically updated to reflect the committed changes.
Closed by commit rL292669: [libFuzzer] Use clang as linker on Windows, to properly include sanitizer… (authored by mpividori).

Changed prior to commit:




Index: llvm/trunk/lib/Fuzzer/test/CMakeLists.txt
--- llvm/trunk/lib/Fuzzer/test/CMakeLists.txt
+++ llvm/trunk/lib/Fuzzer/test/CMakeLists.txt
@@ -27,6 +27,21 @@
 # Enable the coverage instrumentation (it is disabled for the Fuzzer lib).
 set(CMAKE_CXX_FLAGS "${LIBFUZZER_FLAGS_BASE} -fsanitize-coverage=trace-pc-guard,indirect-calls,trace-cmp,trace-div,trace-gep -gline-tables-only")
+  # In order to use the sanitizers in Windows, we need to link against many
+  # runtime libraries which will depend on the target being created
+  # (executable or dll) and the c runtime library used (MT/MD).
+  # By default, cmake uses link.exe for linking, which fails because we don't
+  # specify the appropiate dependencies.
+  # As we don't want to consider all of that possible situations which depends
+  # on the implementation of the compiler-rt, the simplest option is to change
+  # the rules for linking executables and shared libraries, using the compiler
+  # instead of link.exe. Clang will consider the sanitizer flags, and
+  # automatically provide the required libraries to the linker.
 # add_libfuzzer_test(<name>
 #   SOURCES source0.cpp [source1.cpp ...]
 #   )

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27869.85203.patch
Type: text/x-patch
Size: 1698 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170120/60ad2b53/attachment.bin>

More information about the llvm-commits mailing list