This is an archive of the discontinued LLVM Phabricator instance.

[LibFuzzer] Allow fuzzer to be built standalone
AbandonedPublic

Authored by kongyi on Nov 28 2017, 5:15 PM.

Details

Summary

Add back the ability to build standalone LibFuzzer.

Diff Detail

Event Timeline

kongyi created this revision.Nov 28 2017, 5:15 PM
Herald added subscribers: Restricted Project, llvm-commits, mgorny. · View Herald TranscriptNov 28 2017, 5:15 PM
srhines added a reviewer: kcc.Nov 28 2017, 5:26 PM

@kcc
Fuzzer can be built in the same tree with other sanitizer runtimes.
Why do you need a standalone build?

kcc edited edge metadata.Nov 28 2017, 5:29 PM

kongyi , what exactly are you trying to achieve?

srhines edited edge metadata.Nov 28 2017, 5:36 PM

@kcc
Fuzzer can be built in the same tree with other sanitizer runtimes.
Why do you need a standalone build?

For Android's toolchain, this library has to be built multiple times. Once is for the platform developers to use (i.e. the latest API level). At least one more build has to be done using API 14 (our lowest native supported API level, but this is 21 for 64-bit) for NDK users. We then package both libFuzzer.a libraries, and allow the build to select the correct one (platform or NDK/app user).

kcc added a comment.Nov 28 2017, 5:38 PM

Do you need an LLVM cmake rule for that?

The build rule is and will remain extremely simple, see lib/fuzzer/build.sh
Can you just use that?

For sanitizers, we build only for api 14 and use that binary everywhere. Why is libfuzzer special?

One option is to configure the whole compiler-rt build tree, and then do "ninja fuzzer" w/o building the rest of the libraries.

The build rule is and will remain extremely simple

+1

pirama edited edge metadata.Dec 4 2017, 3:37 PM

For sanitizers, we build only for api 14 and use that binary everywhere. Why is libfuzzer special?

libfuzzer depends on the C++ stl. This makes a common libfuzzer.a infeasible because the STL namespace gets specialized when built against the NDK and causes a link failure when such an archive is built against the platform.

One option is to configure the whole compiler-rt build tree, and then do "ninja fuzzer" w/o building the rest of the libraries.

I believe Yi encounted an error during CMake configuration itself, but he can clarify.

kongyi abandoned this revision.Dec 27 2017, 1:46 PM