1 | #===- llvm/tools/clang/tools/clang-fuzzer ---------------------------------===// |
2 | # |
3 | # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | # See https://llvm.org/LICENSE.txt for license information. |
5 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | # |
7 | #===----------------------------------------------------------------------===// |
8 | # Produces an image that builds clang-proto-fuzzer |
9 | FROM ubuntu:16.04 |
10 | RUN apt-get update -y |
11 | RUN apt-get install -y autoconf automake libtool curl make g++ unzip wget git \ |
12 | binutils liblzma-dev libz-dev python-all cmake ninja-build subversion \ |
13 | pkg-config docbook2x |
14 | |
15 | WORKDIR /root |
16 | |
17 | # Get protobuf |
18 | RUN wget -qO- https://github.com/google/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz | tar zxf - |
19 | RUN cd protobuf-3.3.0 && ./autogen.sh && ./configure && make -j $(nproc) && make check -j $(nproc) && make install && ldconfig |
20 | # Get LLVM |
21 | RUN svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm |
22 | RUN cd llvm/tools && svn co http://llvm.org/svn/llvm-project/cfe/trunk clang -r $(cd ../ && svn info | grep Revision | awk '{print $2}') |
23 | RUN cd llvm/projects && svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt -r $(cd ../ && svn info | grep Revision | awk '{print $2}') |
24 | # Build plain LLVM (stage 0) |
25 | RUN mkdir build0 && cd build0 && cmake -GNinja -DCMAKE_BUILD_TYPE=Release ../llvm && ninja |
26 | # Configure instrumented LLVM (stage 1) |
27 | RUN mkdir build1 && cd build1 && cmake -GNinja -DCMAKE_BUILD_TYPE=Release ../llvm \ |
28 | -DLLVM_ENABLE_ASSERTIONS=ON \ |
29 | -DCMAKE_C_COMPILER=`pwd`/../build0/bin/clang \ |
30 | -DCMAKE_CXX_COMPILER=`pwd`/../build0/bin/clang++ \ |
31 | -DLLVM_USE_SANITIZE_COVERAGE=YES \ |
32 | -DLLVM_USE_SANITIZER=Address -DCLANG_ENABLE_PROTO_FUZZER=ON |
33 | # Build the fuzzers |
34 | RUN cd build1 && ninja clang-fuzzer |
35 | RUN cd build1 && ninja clang-proto-fuzzer |
36 | RUN cd build1 && ninja clang-proto-to-cxx |
37 | RUN cd build1 && ninja clang-loop-proto-to-cxx |
38 | RUN cd build1 && ninja clang-loop-proto-to-llvm |
39 | RUN cd build1 && ninja clang-loop-proto-fuzzer |
40 | RUN cd build1 && ninja clang-llvm-proto-fuzzer |
41 | |