diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile.toolchain | 59 | ||||
-rw-r--r-- | board/cr50/build.mk | 2 | ||||
-rw-r--r-- | fuzz/fuzz_config.h | 10 |
4 files changed, 41 insertions, 31 deletions
diff --git a/.gitignore b/.gitignore index a2081bd226..aeadec0735 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ cscope.* .tests-passed .failedboards/ .sizes.txt +.vscode/
\ No newline at end of file diff --git a/Makefile.toolchain b/Makefile.toolchain index 63f04cfe0c..c5c665bacc 100644 --- a/Makefile.toolchain +++ b/Makefile.toolchain @@ -10,7 +10,7 @@ min_make_version:=3.82 make_version_ok:=$(filter $(min_make_version), \ - $(firstword $(sort $(MAKE_VERSION) $(min_make_version)))) + $(firstword $(sort $(MAKE_VERSION) $(min_make_version)))) ifeq ($(make_version_ok),) $(error ERROR: GNU make version $(min_make_version) or higher required.) endif @@ -46,12 +46,12 @@ PROTOC?=protoc C_WARN = -Wstrict-prototypes -Wdeclaration-after-statement -Wno-pointer-sign COMMON_WARN = -Wall -Wundef -Werror -Werror-implicit-function-declaration \ - -Wno-trigraphs -Wno-format-security -Wno-address-of-packed-member \ - -fno-common -fno-strict-aliasing -fno-strict-overflow + -Wno-trigraphs -Wno-format-security -Wno-address-of-packed-member \ + -fno-common -fno-strict-aliasing -fno-strict-overflow UBSAN_FLAGS=-fsanitize=array-bounds,vla-bound \ - -fno-sanitize=vptr \ - -fno-sanitize-recover=all + -fno-sanitize=vptr \ + -fno-sanitize-recover=all CFLAGS_WARN = $(COMMON_WARN) $(C_WARN) CXXFLAGS_WARN = $(COMMON_WARN) @@ -67,28 +67,31 @@ CFLAGS_TEST=$(if $(TEST_BUILD),-DTEST_BUILD=$(EMPTY) \ $(if $(TEST_MSAN),-fsanitize=memory) \ $(if $(TEST_UBSAN),$(UBSAN_FLAGS)) \ $(if $(TEST_FUZZ),-fsanitize=fuzzer-no-link \ - -fno-experimental-new-pass-manager -DTEST_FUZZ=$(EMPTY)) + -fno-experimental-new-pass-manager \ + -fcoverage-mapping \ + -fprofile-instr-generate \ + -DTEST_FUZZ=$(EMPTY)) CFLAGS_COVERAGE=$(if $(TEST_COVERAGE),-fprofile-arcs -ftest-coverage \ - -DTEST_COVERAGE=$(EMPTY),) + -DTEST_COVERAGE=$(EMPTY),) CFLAGS_DEFINE=-DOUTDIR=$(out)/$(BLD) -DCHIP=$(CHIP) -DBOARD_TASKFILE=$(_tsk_lst_file) \ -DBOARD=$(BOARD) -DCORE=$(CORE) -DPROJECT=$(PROJECT) \ -DCHIP_VARIANT=$(CHIP_VARIANT) -DCHIP_FAMILY=$(CHIP_FAMILY) \ -DBOARD_$(UC_BOARD)=$(EMPTY) \ - -DCHIP_$(UC_CHIP)=$(EMPTY) \ - -DCORE_$(UC_CORE)=$(EMPTY) \ + -DCHIP_$(UC_CHIP)=$(EMPTY) \ + -DCORE_$(UC_CORE)=$(EMPTY) \ -DCHIP_VARIANT_$(UC_CHIP_VARIANT)=$(EMPTY) \ - -DCHIP_FAMILY_$(UC_CHIP_FAMILY)=$(EMPTY) \ - -DFINAL_OUTDIR=$(out) \ + -DCHIP_FAMILY_$(UC_CHIP_FAMILY)=$(EMPTY) \ + -DFINAL_OUTDIR=$(out) \ $(CFLAGS_BASEBOARD) CPPFLAGS=$(CFLAGS_DEFINE) $(CFLAGS_INCLUDE) $(CFLAGS_TEST) \ - $(EXTRA_CFLAGS) $(CFLAGS_COVERAGE) $(LATE_CFLAGS_DEFINE) \ - -DSECTION_IS_$(BLD)=$(EMPTY) -DSECTION=$(BLD) $(CPPFLAGS_$(BLD)) + $(EXTRA_CFLAGS) $(CFLAGS_COVERAGE) $(LATE_CFLAGS_DEFINE) \ + -DSECTION_IS_$(BLD)=$(EMPTY) -DSECTION=$(BLD) $(CPPFLAGS_$(BLD)) BUILD_CPPFLAGS=$(CFLAGS_DEFINE) -Icore/host $(CFLAGS_INCLUDE) $(CFLAGS_TEST) \ - $(EXTRA_CFLAGS) $(CFLAGS_COVERAGE) $(LATE_CFLAGS_DEFINE) \ - -DSECTION_IS_$(BLD)=$(EMPTY) -DSECTION=$(BLD) $(CPPFLAGS_$(BLD)) + $(EXTRA_CFLAGS) $(CFLAGS_COVERAGE) $(LATE_CFLAGS_DEFINE) \ + -DSECTION_IS_$(BLD)=$(EMPTY) -DSECTION=$(BLD) $(CPPFLAGS_$(BLD)) HOST_CPPFLAGS=$(CFLAGS_DEFINE) $(CFLAGS_INCLUDE) $(CFLAGS_TEST) \ - $(EXTRA_CFLAGS) $(CFLAGS_COVERAGE) $(LATE_CFLAGS_DEFINE) \ - -DSECTION_IS_$(BLD)=$(EMPTY) -DSECTION=$(BLD) $(CPPFLAGS_$(BLD)) + $(EXTRA_CFLAGS) $(CFLAGS_COVERAGE) $(LATE_CFLAGS_DEFINE) \ + -DSECTION_IS_$(BLD)=$(EMPTY) -DSECTION=$(BLD) $(CPPFLAGS_$(BLD)) ifneq ($(BOARD),host) CPPFLAGS+=-ffreestanding -fno-builtin -nostdinc -nostdlib CPPFLAGS+=-Ibuiltin/ @@ -122,32 +125,32 @@ LIBPROTOBUF_CFLAGS:=$(shell $(PKG_CONFIG) --cflags protobuf) LIBPROTOBUF_LDLIBS:=$(shell $(PKG_CONFIG) --libs protobuf) LIBPROTOBUF_MUTATOR_CFLAGS:=${LIBPROTOBUF_CFLAGS} \ - $(shell $(PKG_CONFIG) --cflags libprotobuf-mutator) + $(shell $(PKG_CONFIG) --cflags libprotobuf-mutator) LIBPROTOBUF_MUTATOR_LDLIBS:=$(shell $(PKG_CONFIG) --libs libprotobuf-mutator) \ - ${LIBPROTOBUF_LDLIBS} + ${LIBPROTOBUF_LDLIBS} endif BUILD_CFLAGS=$(LIBFTDIUSB_CFLAGS) $(BUILD_CPPFLAGS) -O3 $(CFLAGS_DEBUG) BUILD_CFLAGS+=$(CFLAGS_WARN) BUILD_CFLAGS+=-DCHROMIUM_EC=$(EMPTY) HOST_CFLAGS=$(HOST_CPPFLAGS) -O3 $(CFLAGS_DEBUG) $(CFLAGS_WARN) \ - -DHOST_TOOLS_BUILD=$(EMPTY) + -DHOST_TOOLS_BUILD=$(EMPTY) HOST_CFLAGS+=$(LIBFTDIUSB_CFLAGS) HOST_CFLAGS+=-DCHROMIUM_EC=$(EMPTY) ifneq (${SYSROOT},) LDFLAGS_EXTRA+=--sysroot=${SYSROOT} endif LDFLAGS=-nostdlib -g -Wl,-X -Wl,--gc-sections -Wl,--build-id=none \ - $(LDFLAGS_EXTRA) $(CFLAGS_CPU) $(CFLAGS_CHIP) $(CFLAGS_BOARD) + $(LDFLAGS_EXTRA) $(CFLAGS_CPU) $(CFLAGS_CHIP) $(CFLAGS_BOARD) BUILD_LDFLAGS=$(LIBFTDIUSB_LDLIBS) HOST_LDFLAGS=$(LIBFTDIUSB_LDLIBS) -HOST_TEST_LDFLAGS=-Wl,-T core/host/host_exe.lds -lrt -pthread -rdynamic -lm\ - -fuse-ld=bfd \ - $(if $(TEST_COVERAGE),-fprofile-arcs,) \ - $(if $(TEST_ASAN), -fsanitize=address) \ - $(if $(TEST_MSAN), -fsanitize=memory) \ - $(if $(TEST_UBSAN), ${UBSAN_FLAGS}) \ - $(if $(TEST_FUZZ), -fsanitize=fuzzer) +HOST_TEST_LDFLAGS=-Wl,-T core/host/host_exe.lds -lrt -pthread -rdynamic -lm -g \ + -fuse-ld=bfd \ + $(if $(TEST_COVERAGE), -fprofile-arcs) \ + $(if $(TEST_ASAN), -fsanitize=address) \ + $(if $(TEST_MSAN), -fsanitize=memory) \ + $(if $(TEST_UBSAN), ${UBSAN_FLAGS}) \ + $(if $(TEST_FUZZ), -fsanitize=fuzzer -fcoverage-mapping -fprofile-instr-generate) # utility function to provide overridable defaults # $1: name of variable to set diff --git a/board/cr50/build.mk b/board/cr50/build.mk index b6d1d959cb..87c05f66a0 100644 --- a/board/cr50/build.mk +++ b/board/cr50/build.mk @@ -12,7 +12,7 @@ CHIP_VARIANT ?= cr50_fpga # Additional / overriding warnings for common rules and chip # (TODO) enable after https://crrev.com/c/3198155 -# CFLAGS_BOARD :=-Warray-parameter -Wstringop-overread +# CFLAGS_BOARD :=-Wno-array-parameter -Wno-stringop-overread # This file is included twice by the Makefile, once to determine the CHIP info # and then again after defining all the CONFIG_ and HAS_TASK variables. We use diff --git a/fuzz/fuzz_config.h b/fuzz/fuzz_config.h index b2318975cf..781921870a 100644 --- a/fuzz/fuzz_config.h +++ b/fuzz/fuzz_config.h @@ -102,5 +102,11 @@ enum nvmem_users { #endif /* TEST_HOST_COMMAND_FUZZ */ -#endif /* TEST_FUZZ */ -#endif /* __FUZZ_FUZZ_CONFIG_H */ +#ifdef TEST_CR50_U2F_FUZZ +#define CONFIG_DCRYPTO +#define CONFIG_U2F +#define CC_EXTENSION CC_COMMAND +#endif /* TEST_CR50_U2F_FUZZ */ + +#endif /* TEST_FUZZ */ +#endif /* __FUZZ_FUZZ_CONFIG_H */ |