[PATCH] D20741: [LibFuzzer] Fix weak linking issues building tests under OSX.

Dan Liew via llvm-commits llvm-commits at lists.llvm.org
Tue May 31 17:58:30 PDT 2016


delcypher added a comment.

@kcc @mehdi_amini

> > so back to the whiteboard...

> 

> 

> No objections :)


So am I going with @kcc 's proposal?

I think it's probably fine for now but I don't think the goal of having a really simple compilation command line for LibFuzzer is sustainable long term (especially if someone decides to add support for Windows). It may be necessary in the future to divorce LibFuzzer from the LLVM build system and give LibFuzzer its own build system to do the work of compiling for different platforms (instead of having a simple command line to build the library).


================
Comment at: lib/Fuzzer/FuzzerInternal.h:475
@@ -471,1 +474,3 @@
+  // Interface to functions that may or may not be available.
+  ExternalFunctions &EF;
 };
----------------
kcc wrote:
> Does it have to be passed as a parameter? 
> Why not just this? 
> ExternalFunctions EF;
That is also fine. As a rule of thumb I try to avoid passing structs by value when possible but if you would rather it was passed by value I can do that.

================
Comment at: lib/Fuzzer/test/FuzzerUnittest.cpp:417
@@ -412,1 +416,3 @@
+  EF.Init();
+  Fuzzer Fuzz(LLVMFuzzerTestOneInput, MD, Options, EF);
   size_t N = 10;
----------------
kcc wrote:
> I wouldn't worry too much, dlsym is not that slow. 
> And if you follow my other comment you won't need any of this. 
Which comment are you referring to? Changing to passing the struct by value won't change having to call `ExternalFunctions::Init()`. I can drop this comment if you'd like though.


http://reviews.llvm.org/D20741





More information about the llvm-commits mailing list