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

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Tue May 31 17:23:54 PDT 2016


kcc added a comment.

No extra linker flags, please. 
No ifdefs, other than for an entire file, please. 
I am ok with this approach: 
Create FuzzerExtFunctionsWeak.cpp and FuzzerExtFunctionsDlsym.cpp,
have weak functions in the first one and dlsym in the second one.
Have a file scope ifdefs in these files (#if LIBFUZZER_LINUX in the first one, #if LIBFUZZER_APPLE in the second one)


================
Comment at: lib/Fuzzer/FuzzerInternal.h:475
@@ -471,1 +474,3 @@
+  // Interface to functions that may or may not be available.
+  ExternalFunctions &EF;
 };
----------------
Does it have to be passed as a parameter? 
Why not just this? 
ExternalFunctions EF;

================
Comment at: lib/Fuzzer/test/FuzzerUnittest.cpp:417
@@ -412,1 +416,3 @@
+  EF.Init();
+  Fuzzer Fuzz(LLVMFuzzerTestOneInput, MD, Options, EF);
   size_t N = 10;
----------------
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. 


http://reviews.llvm.org/D20741





More information about the llvm-commits mailing list