[PATCH] D29752: [libFuzzer] Export external functions.

Marcos Pividori via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 9 15:20:57 PST 2017


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

@kcc Ok, this final diff is the best I can do.
I tried to use an "export.def" file, but that is not possible because these symbols are optional. I mean, they are not always present.
In the "export.def" I can not specify a symbol as optional. If it is not defined the linker fails.

So, I think these changes are ok, would you agree? I only add `dllexports` for the tests on Windows.
Otherwise, I should disable the tests, but I really think we should consider that tests on Windows.


https://reviews.llvm.org/D29752

Files:
  lib/Fuzzer/test/BogusInitializeTest.cpp
  lib/Fuzzer/test/CustomCrossOverTest.cpp
  lib/Fuzzer/test/CustomMutatorTest.cpp
  lib/Fuzzer/test/InitializeTest.cpp


Index: lib/Fuzzer/test/InitializeTest.cpp
===================================================================
--- lib/Fuzzer/test/InitializeTest.cpp
+++ lib/Fuzzer/test/InitializeTest.cpp
@@ -11,6 +11,9 @@
 
 static char *argv0;
 
+#ifdef _WIN32
+__declspec( dllexport )
+#endif
 extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) {
   assert(*argc > 0);
   argv0 = **argv;
Index: lib/Fuzzer/test/CustomMutatorTest.cpp
===================================================================
--- lib/Fuzzer/test/CustomMutatorTest.cpp
+++ lib/Fuzzer/test/CustomMutatorTest.cpp
@@ -27,6 +27,9 @@
   return 0;
 }
 
+#ifdef _WIN32
+__declspec( dllexport )
+#endif
 extern "C" size_t LLVMFuzzerCustomMutator(uint8_t *Data, size_t Size,
                                           size_t MaxSize, unsigned int Seed) {
   static bool Printed;
Index: lib/Fuzzer/test/CustomCrossOverTest.cpp
===================================================================
--- lib/Fuzzer/test/CustomCrossOverTest.cpp
+++ lib/Fuzzer/test/CustomCrossOverTest.cpp
@@ -32,6 +32,9 @@
   return 0;
 }
 
+#ifdef _WIN32
+__declspec( dllexport )
+#endif
 extern "C" size_t LLVMFuzzerCustomCrossOver(const uint8_t *Data1, size_t Size1,
                                             const uint8_t *Data2, size_t Size2,
                                             uint8_t *Out, size_t MaxOutSize,
Index: lib/Fuzzer/test/BogusInitializeTest.cpp
===================================================================
--- lib/Fuzzer/test/BogusInitializeTest.cpp
+++ lib/Fuzzer/test/BogusInitializeTest.cpp
@@ -5,6 +5,9 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#ifdef _WIN32
+__declspec( dllexport )
+#endif
 extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) {
   ***argv = 'X';
   return 0;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29752.87888.patch
Type: text/x-patch
Size: 1773 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170209/6e3cd437/attachment.bin>


More information about the llvm-commits mailing list