diff options
author | 2019-08-12 18:35:53 +0200 | |
---|---|---|
committer | 2019-08-12 09:35:53 -0700 | |
commit | 0802984dd81a5638adc7607f92682cb629ec12bd (patch) | |
tree | 5003e4638bfa5c0774bdfedc5f58c11e4316e75a /projects/spidermonkey-ufi/build.sh | |
parent | 5edcd421d9c170ea30ac9ef82df8f574b6a16dae (diff) |
[spidermonkey-ufi] Add spidermonkey-ufi project (#2676)
Diffstat (limited to 'projects/spidermonkey-ufi/build.sh')
-rwxr-xr-x | projects/spidermonkey-ufi/build.sh | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/projects/spidermonkey-ufi/build.sh b/projects/spidermonkey-ufi/build.sh new file mode 100755 index 00000000..2ed658cb --- /dev/null +++ b/projects/spidermonkey-ufi/build.sh @@ -0,0 +1,59 @@ +#!/bin/bash -eu +# Copyright 2019 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +# Case-sensitive names of internal Firefox fuzzing targets. Edit to add more. +FUZZ_TARGETS=( + StructuredCloneReader + Wasm +) + +# Install dependencies. Note that bootstrap installs cargo, which must be added +# to PATH via source. In a successive run (for a different sanitizer), the +# cargo installation carries over, but bootstrap fails if cargo is not in PATH. +export SHELL=/bin/bash +[[ -f "$HOME/.cargo/env" ]] && source $HOME/.cargo/env +../../mach bootstrap --no-interactive --application-choice browser +source $HOME/.cargo/env + +autoconf2.13 + +# Update internal libFuzzer. +(cd ../../tools/fuzzing/libfuzzer && ./clone_libfuzzer.sh HEAD) + +mkdir -p build_OPT.OBJ +cd build_OPT.OBJ + +../configure \ + --enable-optimize \ + --disable-shared-js \ + --disable-jemalloc \ + --enable-tests \ + --enable-fuzzing \ + --enable-address-sanitizer + +make "-j$(nproc)" + +cp dist/bin/fuzz-tests $OUT + +# Build a wrapper binary for each target to set environment variables. +for FUZZ_TARGET in ${FUZZ_TARGETS[@]} +do + $CC $CFLAGS -O0 \ + -DFUZZ_TARGET=$FUZZ_TARGET \ + $SRC/target.c -o $OUT/$FUZZ_TARGET +done + |