summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Nissler <mnissler@chromium.org>2019-10-14 17:03:45 +0200
committerCommit Bot <commit-bot@chromium.org>2019-10-17 06:08:24 +0000
commit089a944d51778640d26a125123e1d1946c828e90 (patch)
treeeb050cd9b57200e79d7daab55c4113a6b57fe3a3 /Makefile
parent7be3991ed441865f325182885ea08dc199ddbfd5 (diff)
downloadvboot-089a944d51778640d26a125123e1d1946c828e90.tar.gz
This adds a fuzzer binary to exercise GPT parsing. BUG=chromium:1014101 TEST=Build and run fuzzer. BRANCH=none Change-Id: Idecc0ddf491e976d4e01f5778e51a01ac317d961 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1859595 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: Manoj Gupta <manojgupta@chromium.org> Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile22
1 files changed, 22 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index d5aa28f3..93ac67c1 100644
--- a/Makefile
+++ b/Makefile
@@ -242,6 +242,10 @@ LDFLAGS += -static
PKG_CONFIG += --static
endif
+ifneq (${FUZZ_FLAGS},)
+CFLAGS += ${FUZZ_FLAGS}
+endif
+
# Optional Libraries
LIBZIP_VERSION := $(shell ${PKG_CONFIG} --modversion libzip 2>/dev/null)
HAVE_LIBZIP := $(if ${LIBZIP_VERSION},1)
@@ -775,6 +779,14 @@ TEST21_BINS = $(addprefix ${BUILD}/,${TEST21_NAMES})
# Directory containing test keys
TEST_KEYS = ${SRC_RUN}/tests/testkeys
+# ----------------------------------------------------------------------------
+# Fuzzing binaries
+
+FUZZ_TEST_NAMES = \
+ tests/cgpt_fuzzer
+
+FUZZ_TEST_BINS = $(addprefix ${BUILD}/,${FUZZ_TEST_NAMES})
+FUZZ_TEST_OBJS += $(addsuffix .o,${FUZZ_TEST_BINS})
##############################################################################
# Finally, some targets. High-level ones first.
@@ -793,6 +805,7 @@ host_tools: utils futil tests
.PHONY: host_stuff
host_stuff: utillib hostlib \
+ $(if $(filter x86_64,${ARCH}),fuzzers) \
$(if ${NO_BUILD_TOOLS},,cgpt host_tools)
.PHONY: clean
@@ -1073,6 +1086,15 @@ ${TESTLIB}: ${TESTLIB_OBJS}
@${PRINTF} " AR $(subst ${BUILD}/,,$@)\n"
${Q}ar qc $@ $^
+# ----------------------------------------------------------------------------
+# Fuzzers
+
+.PHONY: fuzzers
+fuzzers: ${FUZZ_TEST_BINS}
+
+${FUZZ_TEST_BINS}: ${FWLIB}
+${FUZZ_TEST_BINS}: LIBS = ${FWLIB}
+${FUZZ_TEST_BINS}: LDFLAGS += -fsanitize=fuzzer
# ----------------------------------------------------------------------------
# Generic build rules. LIBS and OBJS can be overridden to tweak the generic