[llvm-dev] moving libfuzzer to compiler-rt?

Kostya Serebryany via llvm-dev llvm-dev at lists.llvm.org
Wed Jul 12 15:26:17 PDT 2017

On Wed, Jul 12, 2017 at 3:07 PM, Johan Engelen via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> I'd like to add another perspective: LDC (LLVM D Compiler) can use
> libFuzzer and AddressSanitizer from compiler-rt, and it'd be great if
> building them would not require a fresh-built clang. I believe the only
> reason libFuzzer needs a fresh-built clang is because of the dependence on
> the sanitizer interface?

Not really. libFuzzer depends on the coverage instrumentation applied to
the target code.
I.e we can build libFuzzer with any compiler (even some old GCC) but we
have to use a recent clang to build the target code (including libFuzzer's
own tests).

> compiler-rt can already be built without using clang, libFuzzer is a
> little more tricky: libFuzzer depends on <sanitizer/coverage_interface.h>,

Not any more, removed in r307858.
It loosely depends on sanitizer/lsan_interface.h though

> note the angle brackets, meaning that you have to install compiler-rt's
> include files to have libFuzzer be in version-sync with the sanitizers.
> My hope is that moving libFuzzer to compiler-rt will make it possible to
> build it together with the sanitizers, so that it is a little easier to
> build it for non-clang use cases.
> Kind regards,
>   Johan
> On Tue, May 2, 2017 at 9:26 PM, George Karpenkov via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>> Hi All,
>> Currently libfuzzer depends on (often freshly built) clang, yet the
>> dependency is not explicitly specified
>> in cmake.
>> That leads to various issues: for instance, it’s not possible to check
>> out LLVM repo and run libfuzzer
>> tests: one would often need to compile fresh clang first, and then create
>> a separate build directory,
>> where libfuzzer could be tested.
>> For the buildbot this problem is approached by grabbing a freshly built
>> binary from another buildbot
>> and using that for testing.
>> Needless to say, that could be quite annoying.
>> Additionally, my recent changes start using libfuzzer from Clang driver:
>> and finding the actual archive file
>> requires some hardcoding of directory paths, as one would need to go up
>> the tree from the Clang binary
>> (in swift, for example, the situation is even worse, as the path to Clang
>> is a symlink, and getting an archive file
>> from the LLVM tree would require going quite a few levels up).
>> From my understanding, all these problems can be solved entirely
>> by moving libfuzzer to compiler-rt, where (other) sanitizers already
>> reside.
>> Any thoughts on the suggestion?
>> It would be still possible to compile just libfuzzer with no
>> dependencies, by simply making a partial checkout from SVN,
>> and only the repo path would change.
>> George
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170712/074ef402/attachment.html>

More information about the llvm-dev mailing list