OSDN Git Service

[libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not...
authorDokyung Song <dokyungs@google.com>
Thu, 16 Jul 2020 20:26:03 +0000 (20:26 +0000)
committerMatt Morehouse <mascasa@google.com>
Thu, 16 Jul 2020 20:26:35 +0000 (20:26 +0000)
commitf78d9fceea736d431e9e3cbca291e3909e3aa46d
treeb37be5eed9816fb5d162ba438a82fafdc5f2f382
parente04fe9aefd4b95e0f0d93b14be28aa1ae2f42258
[libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked.

Summary: libFuzzer intercepts certain library functions such as memcmp/strcmp by defining weak hooks. Weak hooks, however, are called only when other runtimes such as ASan is linked. This patch defines libFuzzer's own interceptors, which is linked into the libFuzzer executable when other runtimes are not linked, i.e., when -fsanitize=fuzzer is given, but not others.

Reviewers: kcc, morehouse, hctim

Reviewed By: morehouse, hctim

Subscribers: krytarowski, mgorny, cfe-commits, #sanitizers

Tags: #clang, #sanitizers

Differential Revision: https://reviews.llvm.org/D83494
clang/include/clang/Driver/SanitizerArgs.h
clang/lib/Driver/SanitizerArgs.cpp
clang/lib/Driver/ToolChains/CommonArgs.cpp
compiler-rt/lib/fuzzer/CMakeLists.txt
compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp [new file with mode: 0644]
compiler-rt/test/fuzzer/memcmp.test
compiler-rt/test/fuzzer/memcmp64.test
compiler-rt/test/fuzzer/strcmp.test
compiler-rt/test/fuzzer/strncmp.test
compiler-rt/test/fuzzer/strstr.test