From a33459e7badf5472edb498ed5fa9216c6bf82bb6 Mon Sep 17 00:00:00 2001 From: Alastair Donaldson Date: Thu, 28 Apr 2022 19:01:08 +0100 Subject: [PATCH] Update tint project to reflect new build requirements. (#7625) * Update tint project to reflect new build requirements. * Fix build for i386. --- projects/tint/Dockerfile | 14 ++++++++--- projects/tint/build.sh | 49 ++++++++++++++++++++------------------ projects/tint/project.yaml | 4 ++-- 3 files changed, 39 insertions(+), 28 deletions(-) diff --git a/projects/tint/Dockerfile b/projects/tint/Dockerfile index dc293e905..bc88e517d 100644 --- a/projects/tint/Dockerfile +++ b/projects/tint/Dockerfile @@ -15,9 +15,17 @@ ################################################################################ FROM gcr.io/oss-fuzz-base/base-builder -RUN apt-get update && apt-get install -y make autoconf automake libtool ninja-build +RUN apt-get update && apt-get install -y make autoconf automake libtool ninja-build \ + libgl-dev libgl-dev \ + libx11-dev libx11-dev:i386 \ + libx11-xcb-dev \ + libxcursor-dev \ + libxext-dev \ + libxi-dev \ + libxinerama-dev \ + libxrandr-dev RUN git clone 'https://chromium.googlesource.com/chromium/tools/depot_tools.git' --depth 1 ENV PATH="${SRC}/depot_tools:${PATH}" -RUN git clone --depth 1 https://dawn.googlesource.com/tint tint -WORKDIR tint +RUN git clone --depth 1 https://dawn.googlesource.com/dawn dawn +WORKDIR dawn COPY build.sh $SRC/ diff --git a/projects/tint/build.sh b/projects/tint/build.sh index 8e3b97cd3..6d95733cf 100755 --- a/projects/tint/build.sh +++ b/projects/tint/build.sh @@ -15,18 +15,6 @@ # ################################################################################ -cp standalone.gclient .gclient -gclient sync - -mkdir -p out/Debug -pushd out/Debug - -# ubsan's vptr sanitization is desabled as it requires RTTI, which is disabled -# when building tint. -CFLAGS="$CFLAGS -fno-sanitize=vptr" \ -CXXFLAGS="$CXXFLAGS -fno-sanitize=vptr" \ -cmake -GNinja ../.. -DCMAKE_BUILD_TYPE=Release -DTINT_BUILD_FUZZERS=ON -DTINT_BUILD_SPIRV_TOOLS_FUZZER=ON -DTINT_BUILD_TESTS=OFF -DTINT_LIB_FUZZING_ENGINE_LINK_OPTIONS=$LIB_FUZZING_ENGINE - if [ -n "${OSS_FUZZ_CI-}" ] then # When running in the CI, restrict to a small number of fuzz targets to save @@ -47,16 +35,11 @@ else ${SPIRV_TOOLS_FUZZERS}" fi -# The spirv-as tool is used to build seed corpora -ninja ${SPIRV_FUZZERS} - -cp ${SPIRV_FUZZERS} $OUT - -popd - # An un-instrumented build of spirv-as is used to generate a corpus of SPIR-V binaries. -mkdir -p out/Standard -pushd out/Standard +git clone --depth 1 https://github.com/KhronosGroup/SPIRV-Tools.git spirv-tools +git clone https://github.com/KhronosGroup/SPIRV-Headers spirv-tools/external/spirv-headers --depth=1 +mkdir -p out/spirv-tools-build +pushd out/spirv-tools-build # Back-up instrumentation options CFLAGS_SAVE="$CFLAGS" @@ -65,7 +48,7 @@ unset CFLAGS unset CXXFLAGS export AFL_NOOPT=1 -cmake -GNinja ../.. -DCMAKE_BUILD_TYPE=Release +cmake -GNinja ../../spirv-tools -DCMAKE_BUILD_TYPE=Release ninja spirv-as # Restore instrumentation options @@ -78,7 +61,7 @@ popd # Generate a corpus of SPIR-V binaries from the SPIR-V assembly files in the # tint repository. mkdir $WORK/spirv-corpus -python3 src/tint/fuzzers/generate_spirv_corpus.py test $WORK/spirv-corpus out/Standard/spirv-as +python3 src/tint/fuzzers/generate_spirv_corpus.py test/tint $WORK/spirv-corpus out/spirv-tools-build/tools/spirv-as mkdir $WORK/spirv-corpus-hashed-names for f in `ls $WORK/spirv-corpus/*.spv` @@ -104,3 +87,23 @@ tint_enable_all_mutations = false tint_mutation_batch_size = 5 " > "$OUT/${fuzzer}.options" done + +# Now actually build tint + +cp scripts/standalone.gclient .gclient +gclient sync + +mkdir -p out/Debug +pushd out/Debug + +# ubsan's vptr sanitization is desabled as it requires RTTI, which is disabled +# when building tint. +CFLAGS="$CFLAGS -fno-sanitize=vptr" \ +CXXFLAGS="$CXXFLAGS -fno-sanitize=vptr" \ +cmake -GNinja ../.. -DCMAKE_BUILD_TYPE=Release -DTINT_BUILD_FUZZERS=ON -DTINT_BUILD_SPIRV_TOOLS_FUZZER=ON -DTINT_BUILD_TESTS=OFF -DTINT_LIB_FUZZING_ENGINE_LINK_OPTIONS=$LIB_FUZZING_ENGINE + +ninja ${SPIRV_FUZZERS} + +cp ${SPIRV_FUZZERS} $OUT + +popd diff --git a/projects/tint/project.yaml b/projects/tint/project.yaml index 46fec183e..dab53933e 100644 --- a/projects/tint/project.yaml +++ b/projects/tint/project.yaml @@ -1,4 +1,4 @@ -homepage: https://dawn.googlesource.com/tint +homepage: https://dawn.googlesource.com language: c++ primary_contact: bclayton@google.com auto_ccs: @@ -7,7 +7,7 @@ sanitizers: - address - memory - undefined -main_repo: 'https://dawn.googlesource.com/tint.git' +main_repo: 'https://dawn.googlesource.com/dawn.git' architectures: - x86_64 - i386