From 05c1aa18e53258fefee9a8aac656280475ccf614 Mon Sep 17 00:00:00 2001 From: Ben Smith Date: Mon, 3 Aug 2020 11:31:46 -0700 Subject: Add tools to use LLVM's libFuzzer (#1507) This is useful for reproducing bugs found by oss-fuzz (see https://bugs.chromium.org/p/oss-fuzz/issues/list?q=wabt) --- Makefile | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index d7e5bb9f..87f2c9a7 100644 --- a/Makefile +++ b/Makefile @@ -20,23 +20,19 @@ MAKEFILE_NAME := $(lastword $(MAKEFILE_LIST)) ROOT_DIR := $(dir $(abspath $(MAKEFILE_NAME))) USE_NINJA ?= 0 -FUZZ_BIN_DIR ?= ${ROOT_DIR}/afl-fuzz -GCC_FUZZ_CC := ${FUZZ_BIN_DIR}/afl-gcc -GCC_FUZZ_CXX := ${FUZZ_BIN_DIR}/afl-g++ EMSCRIPTEN_DIR ?= $(dir $(shell which emcc)) CMAKE_CMD ?= cmake DEFAULT_SUFFIX = clang-debug -COMPILERS := GCC GCC_I686 GCC_FUZZ CLANG CLANG_I686 EMCC +COMPILERS := GCC GCC_I686 CLANG CLANG_I686 EMCC BUILD_TYPES := DEBUG RELEASE -SANITIZERS := ASAN MSAN LSAN UBSAN +SANITIZERS := ASAN MSAN LSAN UBSAN FUZZ CONFIGS := NORMAL $(SANITIZERS) COV NO_TESTS # directory names GCC_DIR := gcc/ GCC_I686_DIR := gcc-i686/ -GCC_FUZZ_DIR := gcc-fuzz/ CLANG_DIR := clang/ CLANG_I686_DIR := clang-i686/ EMCC_DIR := emscripten/ @@ -47,6 +43,7 @@ ASAN_DIR := asan/ MSAN_DIR := msan/ LSAN_DIR := lsan/ UBSAN_DIR := ubsan/ +FUZZ_DIR := fuzz/ COV_DIR := cov/ NO_TESTS_DIR := no-tests/ @@ -54,10 +51,8 @@ NO_TESTS_DIR := no-tests/ GCC_FLAG := -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ GCC_I686_FLAG := -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ \ -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32 -GCC_FUZZ_FLAG := -DCMAKE_C_COMPILER=${GCC_FUZZ_CC} -DCMAKE_CXX_COMPILER=${GCC_FUZZ_CXX} -DWITH_EXCEPTIONS=ON CLANG_FLAG := -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ CLANG_I686_FLAG := -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \ - -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32 EMCC_FLAG := -DCMAKE_TOOLCHAIN_FILE=${EMSCRIPTEN_DIR}/cmake/Modules/Platform/Emscripten.cmake DEBUG_FLAG := -DCMAKE_BUILD_TYPE=Debug RELEASE_FLAG := -DCMAKE_BUILD_TYPE=Release @@ -66,13 +61,13 @@ ASAN_FLAG := -DUSE_ASAN=ON MSAN_FLAG := -DUSE_MSAN=ON LSAN_FLAG := -DUSE_LSAN=ON UBSAN_FLAG := -DUSE_UBSAN=ON +FUZZ_FLAG := -DBUILD_FUZZ_TOOLS=ON COV_FLAG := -DCODE_COVERAGE=ON NO_TESTS_FLAG := -DBUILD_TESTS=OFF # make target prefixes GCC_PREFIX := gcc GCC_I686_PREFIX := gcc-i686 -GCC_FUZZ_PREFIX := gcc-fuzz CLANG_PREFIX := clang CLANG_I686_PREFIX := clang-i686 EMCC_PREFIX := emscripten @@ -83,6 +78,7 @@ ASAN_PREFIX := -asan MSAN_PREFIX := -msan LSAN_PREFIX := -lsan UBSAN_PREFIX := -ubsan +FUZZ_PREFIX := -fuzz COV_PREFIX := -cov NO_TESTS_PREFIX := -no-tests -- cgit v1.2.3