[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
Tue Dec 27 16:46:42 PST 2016
mpividori added a comment.
@kcc
To build `libFuzer.lib` this changes are not needed, they are only needed when compiling the code to be fuzzed with cmake, which means, it is only necessary for the tests. Because of that, I include this changes in the CMake file in the test folder only.
If we want to compile the tests on command line with clang-cl, it would be:
clang-cl -fsanitize-coverage=trace-pc-guard,.... -fsanitize=address Test.cpp LLVMFuzzer.lib /MD /link /SUBSYSTEM:CONSOLE
Cmake split this command in 2 steps, compiling and linking:
clang-cl -fsanitize-coverage=trace-pc-guard -fsanitize=address /c Test.cpp
link.exe /MD Test.obj LLVMFuzzer.lib /SUBSYSTEM:CONSOLE
The last command fails, because we don't provide compiler-rt libraries to the linker.
So, basically, I change the link command, so cmake execute this:
clang-cl -fsanitize-coverage=trace-pc-guard -fsanitize=address /c Test.cpp
clang-cl -fsanitize-coverage=trace-pc-guard -fsanitize=address /MD Test.obj LLVMFuzzer.lib /link /SUBSYSTEM:CONSOLE
Now, clang-cl will include compiler-rt libraries.
Repository:
rL LLVM
https://reviews.llvm.org/D27869
More information about the llvm-commits
mailing list