summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Sukhomlinov <sukhomlinov@google.com>2021-09-29 17:14:33 -0700
committerCommit Bot <commit-bot@chromium.org>2021-10-01 18:12:57 +0000
commit88768bef5f6356fd415321e228a2e4627112ec27 (patch)
treed49ceaded2f75840f2b477381cd8ed62fb0568bf
parentc13fecc4b009ea4ec6583896cea4cea07390df68 (diff)
downloadchrome-ec-88768bef5f6356fd415321e228a2e4627112ec27.tar.gz
chip/g: fix gcc 11.2 build issues
For some reason didn't spot earlier another unnecessary complains of gcc 11.2 in private-cr5x builds with make buildall -j. Made it so BOARD can override settings done by CHIP even though CHIP is loaded later. These settings should apply to both CFLAGS and LDFLAGS due to LTO build. BUG=none TEST=make buildall -j Signed-off-by: Vadim Sukhomlinov <sukhomlinov@google.com> Change-Id: I8880c518b23778cccf969909e330e9e2d62b5fae Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3194984 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Tested-by: Vadim Sukhomlinov <sukhomlinov@chromium.org> Commit-Queue: Vadim Sukhomlinov <sukhomlinov@chromium.org> Auto-Submit: Vadim Sukhomlinov <sukhomlinov@chromium.org>
-rw-r--r--Makefile.toolchain4
-rw-r--r--board/cr50/build.mk3
-rw-r--r--chip/g/build.mk3
-rw-r--r--core/cortex-m/build.mk2
4 files changed, 10 insertions, 2 deletions
diff --git a/Makefile.toolchain b/Makefile.toolchain
index 9f16a3fcaf..63f04cfe0c 100644
--- a/Makefile.toolchain
+++ b/Makefile.toolchain
@@ -103,6 +103,8 @@ ifneq ($(cc-name),clang)
CFLAGS+= -ffat-lto-objects
CFLAGS+= -fconserve-stack
endif
+CFLAGS+=$(CFLAGS_CHIP) $(CFLAGS_BOARD)
+
CXXFLAGS+=-DPROTOBUF_INLINE_NOT_IN_HEADERS=0
FTDIVERSION:=$(shell $(PKG_CONFIG) --modversion libftdi1 2>/dev/null)
@@ -136,7 +138,7 @@ ifneq (${SYSROOT},)
LDFLAGS_EXTRA+=--sysroot=${SYSROOT}
endif
LDFLAGS=-nostdlib -g -Wl,-X -Wl,--gc-sections -Wl,--build-id=none \
- $(LDFLAGS_EXTRA) $(CFLAGS_CPU)
+ $(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\
diff --git a/board/cr50/build.mk b/board/cr50/build.mk
index a6abbe2fed..7eda0385ec 100644
--- a/board/cr50/build.mk
+++ b/board/cr50/build.mk
@@ -10,6 +10,9 @@ CHIP:=g
CHIP_FAMILY:=cr50
CHIP_VARIANT ?= cr50_fpga
+# Additional / overriding warnings for common rules and chip
+CFLAGS_BOARD :=-Warray-parameter -Wstringop-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
# a guard so that recipe definitions and variable extensions only happen the
diff --git a/chip/g/build.mk b/chip/g/build.mk
index c5227412c3..b7bf498cd2 100644
--- a/chip/g/build.mk
+++ b/chip/g/build.mk
@@ -7,6 +7,9 @@
CORE:=cortex-m
CFLAGS_CPU+=-march=armv7-m -mcpu=cortex-m3
+# Flags to reduce unnecessary warnings with gcc 11.2
+CFLAGS_CHIP :=-Wno-stringop-overflow -Wno-array-parameter -Wno-stringop-overread
+
ifeq ($(CONFIG_DCRYPTO),y)
INCLUDE_ROOT := $(abspath ./include)
CPPFLAGS += -I$(abspath .)
diff --git a/core/cortex-m/build.mk b/core/cortex-m/build.mk
index 049eb49859..2bcf32317d 100644
--- a/core/cortex-m/build.mk
+++ b/core/cortex-m/build.mk
@@ -16,7 +16,7 @@ CFLAGS_FPU-$(CONFIG_FPU)=-mfpu=fpv4-sp-d16 -mfloat-abi=hard
# CPU specific compilation flags
CFLAGS_CPU+=-mthumb -Os -mno-sched-prolog
-CFLAGS_CPU+=-mno-unaligned-access -Wno-stringop-overflow
+CFLAGS_CPU+=-mno-unaligned-access
CFLAGS_CPU+=$(CFLAGS_FPU-y)
ifneq ($(CONFIG_LTO),)