Lines Matching +full:- +full:- +full:enable +full:- +full:werror
1 #!/bin/bash -e
3 # OSS-Fuzz build script. See:
4 # https://google.github.io/oss-fuzz/getting-started/new-project-guide/#buildsh
7 # https://github.com/google/oss-fuzz/blob/master/projects/qemu/Dockerfiles
10 # the COPYING file in the top-level directory.
17 # make -j$(nproc) all
21 # $CXX $CXXFLAGS -std=c++11 -Iinclude \
22 # /path/to/name_of_fuzzer.cc -o $OUT/name_of_fuzzer \
23 # -fsanitize=fuzzer /path/to/library.a
30 OSS_FUZZ_BUILD_DIR="./build-oss-fuzz/"
32 # There seems to be a bug in clang-11 (used for builds on oss-fuzz) :
37 # statement cannot be reached, and remove it. For some reason clang-11 doesn't
41 EXTRA_CFLAGS="$CFLAGS -U __OPTIMIZE__"
43 if ! { [ -e "./COPYING" ] &&
44 [ -e "./MAINTAINERS" ] &&
45 [ -e "./Makefile" ] &&
46 [ -d "./docs" ] &&
47 [ -e "./VERSION" ] &&
48 [ -d "./linux-user" ] &&
49 [ -d "./system" ];} ; then
53 mkdir -p $OSS_FUZZ_BUILD_DIR || fatal "mkdir $OSS_FUZZ_BUILD_DIR failed"
57 if [ -z ${OUT+x} ]; then
63 mkdir -p "$DEST_DIR/lib/" # Copy the shared libraries here
66 ../configure --disable-werror --cc="$CC" --cxx="$CXX" --enable-fuzzing \
67 --prefix="/opt/qemu-oss-fuzz" \
68 --extra-cflags="$EXTRA_CFLAGS" --target-list="i386-softmmu"
70 if ! make "-j$(nproc)" qemu-fuzz-i386; then
77 for i in $(ldd ./qemu-fuzz-i386 | cut -f3 -d' '); do
80 rm qemu-fuzz-i386
83 ../configure --disable-werror --cc="$CC" --cxx="$CXX" --enable-fuzzing \
84 --prefix="/opt/qemu-oss-fuzz" \
85 --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="-Wl,-rpath,\$ORIGIN/lib" \
86 --target-list="i386-softmmu"
87 make "-j$(nproc)" qemu-fuzz-i386 V=1
91 make install DESTDIR=$DEST_DIR/qemu-bundle
92 rm -rf $DEST_DIR/qemu-bundle/opt/qemu-oss-fuzz/bin
93 rm -rf $DEST_DIR/qemu-bundle/opt/qemu-oss-fuzz/libexec
96 targets=$(./qemu-fuzz-i386 | grep generic-fuzz | awk '$1 ~ /\*/ {print $2}')
97 base_copy="$DEST_DIR/qemu-fuzz-i386-target-$(echo "$targets" | head -n 1)"
99 cp "./qemu-fuzz-i386" "$base_copy"
101 # Run the fuzzer with no arguments, to print the help-string and get the list
102 # of available fuzz-targets. Copy over the qemu-fuzz-i386, naming it according
105 for target in $(echo "$targets" | tail -n +2);
107 # Ignore the generic-fuzz target, as it requires some environment variables
108 # to be configured. We have some generic-fuzz-{pc-q35, floppy, ...} targets
111 if [[ $target == "generic-fuzz-"* ]]; then
113 "$DEST_DIR/qemu-fuzz-i386-target-$target"