[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
Mon Dec 19 17:24:30 PST 2016


mpividori updated this revision to Diff 82047.
mpividori added a comment.

@beanz Thanks for that information.

@zturner This libraries are only created for a specific test. So, I think that is the reason why Kostya outputs it to "${CMAKE_BINARY_DIR}/lib/Fuzzer/lib" instead of the main "${CMAKE_BINARY_DIR}/lib" directory.

I modified the cmake file, so now we create the dll in the same folder that the test: "${CMAKE_BINARY_DIR}/lib/Fuzzer/test".
And the import library in: "${CMAKE_BINARY_DIR}/lib/Fuzzer/lib". Would you agree?

Thanks.


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,13 @@
 
 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")
+
+set_output_directory(LLVMFuzzer-DSO1
+    BINARY_DIR "${CMAKE_BINARY_DIR}/lib/Fuzzer/test"
+    LIBRARY_DIR "${CMAKE_BINARY_DIR}/lib/Fuzzer/lib")
+set_output_directory(LLVMFuzzer-DSO2
+    BINARY_DIR "${CMAKE_BINARY_DIR}/lib/Fuzzer/test"
+    LIBRARY_DIR "${CMAKE_BINARY_DIR}/lib/Fuzzer/lib")
 
 set(TestBinaries ${TestBinaries} LLVMFuzzer-DSOTest)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27870.82047.patch
Type: text/x-patch
Size: 1617 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161220/a5eb77fd/attachment.bin>


More information about the llvm-commits mailing list