summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllen Webb <allenwebb@google.com>2018-12-05 15:53:41 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-12-14 22:40:31 -0800
commiteb890d8891c23706bf1be934b4d73655b768826a (patch)
tree0af632b4111ed2cc94b5a1a7e13ccda2c1232a7f
parent4d15f8668fbadac39604c6e015a86c1634162584 (diff)
downloadchrome-ec-eb890d8891c23706bf1be934b4d73655b768826a.tar.gz
Makefiles: Set fuzz targets to use the correct CROSS_COMPILE.
This addresses a cross compilation bug for fuzzing targets where CROSS_COMPILE was always ''. BRANCH=None BUG=chromium:911310 TEST=USE="ubsan asan fuzzer" ./build_packages \ --board=amd64-generic --skip_chroot_upgrade chromeos-ec && (cd ../platform/ec && unset BOARD && make -j buildall) Change-Id: I1c0b99f4ecef1e6ddec489568ccb13a8e8f5fb85 Signed-off-by: Allen Webb <allenwebb@google.com> Reviewed-on: https://chromium-review.googlesource.com/1363541 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
-rw-r--r--Makefile.rules8
-rw-r--r--Makefile.toolchain1
2 files changed, 6 insertions, 3 deletions
diff --git a/Makefile.rules b/Makefile.rules
index 5a7ac71688..fd13a040ef 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -89,8 +89,8 @@ cmd_c_to_host = $(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -MMD -MF $@.d -o $@ \
cmd_cxx_to_host = $(HOSTCXX) -std=c++0x $(COMMON_WARN) $(HOST_CXXFLAGS)\
-I ./$($(notdir $@)_ROOT) -o $@ $(filter %.cc,$^) $($(notdir $@)_LIBS)
cmd_host_test = $(MAKE) --no-print-directory BOARD=host PROJECT=$* \
- V=$(V) out=build/host/$* TEST_BUILD=y EMU_BUILD=y $(TEST_FLAG) \
- CROSS_COMPILE= build/host/$*/$*.exe
+ V=$(V) out=build/host/$* TEST_BUILD=y EMU_BUILD=y CROSS_COMPILE= \
+ $(TEST_FLAG) build/host/$*/$*.exe
cmd_run_host_test = ./util/run_host_test $* $(silent)
# generate new version.h, compare if it changed and replace if so
cmd_version = ./util/getversion.sh > $@.tmp && cmp -s $@.tmp $@ || mv $@.tmp $@; rm -f $@.tmp
@@ -345,7 +345,9 @@ $(fuzz-test-targets): host-%:
.PHONY: buildfuzztests
buildfuzztests: TEST_FLAG=TEST_FUZZ=y TEST_ASAN=$(TEST_ASAN) \
- TEST_MSAN=$(TEST_MSAN) TEST_UBSAN=$(TEST_UBSAN)
+ TEST_MSAN=$(TEST_MSAN) TEST_UBSAN=$(TEST_UBSAN) \
+ CROSS_COMPILE=$(shell echo $(HOSTCC) | grep -v ccache | \
+ sed -e 's/[^-]*$$//')
buildfuzztests: $(fuzz-test-targets)
$(out)/libec.a: $(ro-objs)
diff --git a/Makefile.toolchain b/Makefile.toolchain
index 7473ebc005..ddf0901afc 100644
--- a/Makefile.toolchain
+++ b/Makefile.toolchain
@@ -131,6 +131,7 @@ LDFLAGS=-nostdlib -g -Wl,-X -Wl,--gc-sections -Wl,--build-id=none \
$(LDFLAGS_EXTRA) $(CFLAGS_CPU)
BUILD_LDFLAGS=$(LIBFTDI_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) \