From: Dan Liew Date: Mon, 6 Jun 2016 20:27:09 +0000 (+0000) Subject: [LibFuzzer] Provide stub implementation of __sanitizer_cov_trace_pc_indir X-Git-Tag: android-x86-7.1-r4~32201 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=47f223bd24f08a80b272103b66119870f8f1f579;p=android-x86%2Fexternal-llvm.git [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. Differential Revision: http://reviews.llvm.org/D20946 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271938 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Fuzzer/FuzzerTracePC.cpp b/lib/Fuzzer/FuzzerTracePC.cpp index 250deeff25f..46c43d0c17f 100644 --- a/lib/Fuzzer/FuzzerTracePC.cpp +++ b/lib/Fuzzer/FuzzerTracePC.cpp @@ -57,7 +57,15 @@ static void HandlePC(uint32_t PC) { } // namespace fuzzer -extern "C" void __sanitizer_cov_trace_pc() { +extern "C" { +void __sanitizer_cov_trace_pc() { fuzzer::HandlePC(static_cast( reinterpret_cast(__builtin_return_address(0)))); } + +void __sanitizer_cov_trace_pc_indir(int *) { + // Stub to allow linking with code built with + // -fsanitize=indirect-calls,trace-pc. + // This isn't used currently. +} +}