[PATCH] D27870: [libFuzzer] Diff 25 - Fix test with shared libraries on Windows.
Marcos Pividori via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 16 16:12:53 PST 2016
mpividori created this revision.
mpividori added reviewers: zturner, kcc.
mpividori added a subscriber: llvm-commits.
mpividori set the repository for this revision to rL LLVM.
Herald added a subscriber: mgorny.
Repository:
rL LLVM
https://reviews.llvm.org/D27870
Files:
lib/Fuzzer/test/CMakeLists.txt
lib/Fuzzer/test/DSO1.cpp
lib/Fuzzer/test/DSO2.cpp
Index: lib/Fuzzer/test/DSO2.cpp
===================================================================
--- lib/Fuzzer/test/DSO2.cpp
+++ lib/Fuzzer/test/DSO2.cpp
@@ -2,7 +2,9 @@
// License. See LICENSE.TXT for details.
// Source code for a simple DSO.
-
+#ifdef _WIN32
+__declspec( dllexport )
+#endif
int DSO2(int a) {
if (a < 3598235)
return 0;
Index: lib/Fuzzer/test/DSO1.cpp
===================================================================
--- lib/Fuzzer/test/DSO1.cpp
+++ lib/Fuzzer/test/DSO1.cpp
@@ -2,7 +2,9 @@
// License. See LICENSE.TXT for details.
// Source code for a simple DSO.
-
+#ifdef _WIN32
+__declspec( dllexport )
+#endif
int DSO1(int a) {
if (a < 123456)
return 0;
Index: lib/Fuzzer/test/CMakeLists.txt
===================================================================
--- lib/Fuzzer/test/CMakeLists.txt
+++ lib/Fuzzer/test/CMakeLists.txt
@@ -215,10 +215,23 @@
set_target_properties(LLVMFuzzer-DSOTest PROPERTIES RUNTIME_OUTPUT_DIRECTORY
"${CMAKE_BINARY_DIR}/lib/Fuzzer/test")
-set_target_properties(LLVMFuzzer-DSO1 PROPERTIES LIBRARY_OUTPUT_DIRECTORY
- "${CMAKE_BINARY_DIR}/lib/Fuzzer/lib")
-set_target_properties(LLVMFuzzer-DSO2 PROPERTIES LIBRARY_OUTPUT_DIRECTORY
- "${CMAKE_BINARY_DIR}/lib/Fuzzer/lib")
+if(MSVC)
+ # Import libraries will be created in the bin directory.
+ # Fixme: I couldn't modify CMAKE_CXX_CREATE_SHARED_LIBRARY to output the
+ # import library in the ARCHIVE_OUTPUT_DIRECTORY property of the target.
+ # Now, if we change ARCHIVE_OUTPUT_DIRECTORY to a different directory, the
+ # library won't be found when needed, because it will be created in the bin
+ # directory anyway.
+ set_target_properties(LLVMFuzzer-DSO1 PROPERTIES ARCHIVE_OUTPUT_DIRECTORY
+ "${CMAKE_BINARY_DIR}/bin")
+ set_target_properties(LLVMFuzzer-DSO2 PROPERTIES ARCHIVE_OUTPUT_DIRECTORY
+ "${CMAKE_BINARY_DIR}/bin")
+else()
+ set_target_properties(LLVMFuzzer-DSO1 PROPERTIES LIBRARY_OUTPUT_DIRECTORY
+ "${CMAKE_BINARY_DIR}/lib/Fuzzer/lib")
+ set_target_properties(LLVMFuzzer-DSO2 PROPERTIES LIBRARY_OUTPUT_DIRECTORY
+ "${CMAKE_BINARY_DIR}/lib/Fuzzer/lib")
+endif()
set(TestBinaries ${TestBinaries} LLVMFuzzer-DSOTest)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27870.81818.patch
Type: text/x-patch
Size: 2198 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161217/28feab74/attachment.bin>
More information about the llvm-commits
mailing list