[PATCH] D20741: [LibFuzzer] Reimplement how the optional user functions are called.

Dan Liew via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 1 18:59:40 PDT 2016


delcypher marked an inline comment as done.

================
Comment at: lib/Fuzzer/FuzzerExtFunctions.h:22
@@ +21,3 @@
+  // will be set to nullptr.
+  void Init();
+
----------------
kcc wrote:
> Why not ExternalFunctions::ExternalFunctions? 
My original thinking here is that you might not want to initialize immediately after allocating memory for an instance of `ExternalFunctions`. My worry is that if `ExternalFunctions` was ever created in some early start up code (i.e. before `main()` is called) then we might not want to call `dlsym()` at this time.

This is quite a narrow use case (that's not even required right now) so perhaps it would be better to just use a normal class initializer?

================
Comment at: lib/Fuzzer/FuzzerExtFunctionsWeak.cpp:21
@@ +20,3 @@
+extern "C" {
+// Declare these symbols as weak to allow them to be optionally defined.
+__attribute__((weak)) int LLVMFuzzerInitialize(int *argc, char ***argv);
----------------
kcc wrote:
> can you also use FuzzerExtFunctions.def here? 
Doing so would reduce clarity but I can if you want.

================
Comment at: lib/Fuzzer/FuzzerMain.cpp:12
@@ -11,2 +11,3 @@
 
+#include "FuzzerExtFunctions.h"
 #include "FuzzerInterface.h"
----------------
kcc wrote:
> do you still need this? 
Nope. Good catch.

================
Comment at: lib/Fuzzer/test/FuzzerUnittest.cpp:4
@@ -3,2 +3,3 @@
 
+#include "FuzzerExtFunctions.h"
 #include "FuzzerInternal.h"
----------------
kcc wrote:
> do you still need this? 
Nope. Good catch.


http://reviews.llvm.org/D20741





More information about the llvm-commits mailing list