summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/cr50/build.mk3
-rw-r--r--core/cortex-m/build.mk10
2 files changed, 12 insertions, 1 deletions
diff --git a/board/cr50/build.mk b/board/cr50/build.mk
index a7bde7a688..f92a527ad8 100644
--- a/board/cr50/build.mk
+++ b/board/cr50/build.mk
@@ -210,7 +210,8 @@ rw_board_deps := $(addsuffix .d, $(RW_FIPS_OBJS))
FIPS_CFLAGS = $(CFLAGS) -frandom-seed=0 -flto=1 -flto-partition=1to1 -fipa-pta\
-fvisibility=hidden -fipa-cp-clone -fweb -ftree-partial-pre\
-flive-range-shrinkage -fgcse-after-reload -fgcse-sm -fgcse-las -fivopts\
- -fpredictive-commoning -freorder-blocks-algorithm=stc
+ -fpredictive-commoning -freorder-blocks-algorithm=stc\
+ $(CFLAGS_LTO_PARTIAL_LINK)
$(RW_BD_OUT)/$(FIPS_MODULE): $(RW_FIPS_OBJS) $(FIPS_LD_SCRIPT)
@echo " LD $(notdir $@)"
diff --git a/core/cortex-m/build.mk b/core/cortex-m/build.mk
index 2bcf32317d..1066f71137 100644
--- a/core/cortex-m/build.mk
+++ b/core/cortex-m/build.mk
@@ -24,6 +24,16 @@ CFLAGS_CPU+=-flto
LDFLAGS_EXTRA+=-flto
endif
+# TODO: remove this workaround once migration to gcc 11.2 completed.
+GCC_VERSION := $(shell $(CROSS_COMPILE)gcc -dumpversion)
+ifeq ("$(GCC_VERSION)","11.2.0")
+# IPA modref pass crashes gcc 11.2 when LTO is used with partial linking
+CFLAGS_CPU += -fno-ipa-modref
+
+# Set an option to force LTO to generate target machine code
+export CFLAGS_LTO_PARTIAL_LINK := -flinker-output=nolto-rel
+endif
+
core-y=cpu.o init.o ldivmod.o llsr.o uldivmod.o vecttable.o
core-$(CONFIG_AES)+=aes.o
core-$(CONFIG_AES_GCM)+=ghash.o