summaryrefslogtreecommitdiffstats
path: root/tools/clang-fuzzer
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2017-08-12 01:27:10 +0000
committerKostya Serebryany <kcc@google.com>2017-08-12 01:27:10 +0000
commit1daee8a30da6755652e67584cfa769c3cd4a0537 (patch)
treead729960d3038a8fe32922cb7e754f4f738e408e /tools/clang-fuzzer
parent7ecee51e078daed0524a5349ed06679e113df98e (diff)
Add a Dockerfile for clang-proto-fuzzer
Summary: Add a Dockerfile for clang-proto-fuzzer Reviewers: morehouse, vitalybuka Reviewed By: morehouse Subscribers: hintonda, cfe-commits Differential Revision: https://reviews.llvm.org/D36635 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310774 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/clang-fuzzer')
-rw-r--r--tools/clang-fuzzer/Dockerfile37
-rw-r--r--tools/clang-fuzzer/README.txt2
2 files changed, 39 insertions, 0 deletions
diff --git a/tools/clang-fuzzer/Dockerfile b/tools/clang-fuzzer/Dockerfile
new file mode 100644
index 0000000000..1946b8bf88
--- /dev/null
+++ b/tools/clang-fuzzer/Dockerfile
@@ -0,0 +1,37 @@
+#===- llvm/tools/clang/tools/clang-fuzzer ---------------------------------===//
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+#===----------------------------------------------------------------------===//
+# Produces an image that builds clang-proto-fuzzer
+FROM ubuntu:16.04
+RUN apt-get update -y
+RUN apt-get install -y autoconf automake libtool curl make g++ unzip wget git \
+ binutils liblzma-dev libz-dev python-all cmake ninja-build subversion \
+ pkg-config docbook2x
+
+WORKDIR /root
+
+# Get protobuf
+RUN wget -qO- https://github.com/google/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz | tar zxf -
+RUN cd protobuf-3.3.0 && ./autogen.sh && ./configure && make -j $(nproc) && make check -j $(nproc) && make install && ldconfig
+# Get LLVM
+RUN svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
+RUN cd llvm/tools && svn co http://llvm.org/svn/llvm-project/cfe/trunk clang -r $(cd ../ && svn info | grep Revision | awk '{print $2}')
+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}')
+# Build plain LLVM (stage 0)
+RUN mkdir build0 && cd build0 && cmake -GNinja -DCMAKE_BUILD_TYPE=Release ../llvm && ninja
+# Configure instrumented LLVM (stage 1)
+RUN mkdir build1 && cd build1 && cmake -GNinja -DCMAKE_BUILD_TYPE=Release ../llvm \
+ -DLLVM_ENABLE_ASSERTIONS=ON \
+ -DCMAKE_C_COMPILER=`pwd`/../build0/bin/clang \
+ -DCMAKE_CXX_COMPILER=`pwd`/../build0/bin/clang++ \
+ -DLLVM_USE_SANITIZE_COVERAGE=YES \
+ -DLLVM_USE_SANITIZER=Address -DCLANG_ENABLE_PROTO_FUZZER=ON
+# Build the fuzzers
+RUN cd build1 && ninja clang-fuzzer
+RUN cd build1 && ninja clang-proto-fuzzer
+RUN cd build1 && ninja clang-proto-to-cxx
diff --git a/tools/clang-fuzzer/README.txt b/tools/clang-fuzzer/README.txt
index 0e302ff8a3..35476d33c5 100644
--- a/tools/clang-fuzzer/README.txt
+++ b/tools/clang-fuzzer/README.txt
@@ -59,6 +59,8 @@ Example:
-DCLANG_ENABLE_PROTO_FUZZER=ON
ninja clang-proto-fuzzer clang-proto-to-cxx
+This directory also contains a Dockerfile which sets up all required
+dependencies and builds the fuzzers.
=====================
Running the fuzzers