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

Dan Liew via llvm-commits llvm-commits at lists.llvm.org
Fri May 27 14:40:22 PDT 2016


delcypher added inline comments.

================
Comment at: lib/Fuzzer/test/uninstrumented/CMakeLists.txt:21
@@ +20,3 @@
+  __sanitizer_set_death_callback
+  __sanitizer_update_counter_bitset_and_clear_counters
+)
----------------
mehdi_amini wrote:
> Where is this list coming from? Why is it needed? ....
This test links libFuzzer against an uninstrumented binary. An instrumented binary would normally have all of the above function defined (coming from the ASan and sanitizer coverage runtimes in compiler-rt) which LibFuzzer calls into.

An uninstrumented binary won't have the ASan and sanitizer coverage runtimes linked in so a linking libFuzzer against the uninstrumented would in principle cause a link error because those functions are not declared as weak in compiler-rt. However `FuzzerLoop.cpp` in LibFuzzer redeclares these symbols as weak to avoid this at issue at link time on Linux.


http://reviews.llvm.org/D20741





More information about the llvm-commits mailing list