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

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


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

@kcc do you agree with this diff? I include the header in `InitializeTest` and `BogusInitializeTest`, the same that we do for `CustomCrossOverTest` and `CustomMutatorTest`.


https://reviews.llvm.org/D29752

Files:
  lib/Fuzzer/FuzzerInterface.h
  lib/Fuzzer/test/BogusInitializeTest.cpp
  lib/Fuzzer/test/InitializeTest.cpp


Index: lib/Fuzzer/test/InitializeTest.cpp
===================================================================
--- lib/Fuzzer/test/InitializeTest.cpp
+++ lib/Fuzzer/test/InitializeTest.cpp
@@ -9,6 +9,8 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "FuzzerInterface.h"
+
 static char *argv0;
 
 extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) {
Index: lib/Fuzzer/test/BogusInitializeTest.cpp
===================================================================
--- lib/Fuzzer/test/BogusInitializeTest.cpp
+++ lib/Fuzzer/test/BogusInitializeTest.cpp
@@ -5,6 +5,8 @@
 #include <stddef.h>
 #include <stdint.h>
 
+#include "FuzzerInterface.h"
+
 extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) {
   ***argv = 'X';
   return 0;
Index: lib/Fuzzer/FuzzerInterface.h
===================================================================
--- lib/Fuzzer/FuzzerInterface.h
+++ lib/Fuzzer/FuzzerInterface.h
@@ -19,6 +19,7 @@
 #ifndef LLVM_FUZZER_INTERFACE_H
 #define LLVM_FUZZER_INTERFACE_H
 
+#include "FuzzerDefs.h"
 #include <stddef.h>
 #include <stdint.h>
 
@@ -36,19 +37,22 @@
 // If provided, this function will be called by libFuzzer once at startup.
 // It may read and modify argc/argv.
 // Must return 0.
+ATTRIBUTE_INTERFACE
 int LLVMFuzzerInitialize(int *argc, char ***argv);
 
 // Optional user-provided custom mutator.
 // Mutates raw data in [Data, Data+Size) inplace.
 // Returns the new size, which is not greater than MaxSize.
 // Given the same Seed produces the same mutation.
+ATTRIBUTE_INTERFACE
 size_t LLVMFuzzerCustomMutator(uint8_t *Data, size_t Size, size_t MaxSize,
                                unsigned int Seed);
 
 // Optional user-provided custom cross-over function.
 // Combines pieces of Data1 & Data2 together into Out.
 // Returns the new size, which is not greater than MaxOutSize.
 // Should produce the same mutation given the same Seed.
+ATTRIBUTE_INTERFACE
 size_t LLVMFuzzerCustomCrossOver(const uint8_t *Data1, size_t Size1,
                                  const uint8_t *Data2, size_t Size2,
                                  uint8_t *Out, size_t MaxOutSize,


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


More information about the llvm-commits mailing list