[PATCH] D20946: [LibFuzzer] Provide stub implementation of __sanitizer_cov_trace_pc_indir

Dan Liew via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 2 20:38:48 PDT 2016


delcypher created this revision.
delcypher added reviewers: kcc, aizatsky.
delcypher added subscribers: kcc, aizatsky, zaks.anna, dcoughlin, kubabrecka, llvm-commits.

[LibFuzzer] Provide stub implementation of __sanitizer_cov_trace_pc_indir

Calls to this function are currently injected by the
``SanitizerCoverageModule`` pass when the both the ``indirect-calls``
and ``trace-pc`` sanitizer coverage options are enabled and the code
being instrumented has indirect calls. Previously because LibFuzzer did
not define this function this would lead to link errors when building
some of the tests on OSX.

This combined with http://reviews.llvm.org/D20943 is enough to fix compilation of the LibFuzzer tests on OSX.


http://reviews.llvm.org/D20946

Files:
  lib/Fuzzer/FuzzerTracePC.cpp

Index: lib/Fuzzer/FuzzerTracePC.cpp
===================================================================
--- lib/Fuzzer/FuzzerTracePC.cpp
+++ lib/Fuzzer/FuzzerTracePC.cpp
@@ -57,7 +57,14 @@
 
 } // namespace fuzzer
 
-extern "C" void __sanitizer_cov_trace_pc() {
+extern "C" {
+void __sanitizer_cov_trace_pc() {
   fuzzer::HandlePC(static_cast<uint32_t>(
       reinterpret_cast<uintptr_t>(__builtin_return_address(0))));
 }
+
+void __sanitizer_cov_trace_pc_indir(int *) {
+  // Stub to allow linking with code built with
+  // -fsanitize=indirect-calls,trace-pc.
+}
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20946.59488.patch
Type: text/x-patch
Size: 569 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160603/9bad3477/attachment.bin>


More information about the llvm-commits mailing list