summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2020-12-29 14:57:37 +0800
committerCommit Bot <commit-bot@chromium.org>2020-12-29 10:19:15 +0000
commitfd092935f365e608c9b4825b7b53b355e58a1a61 (patch)
tree47317609958d14f5e73adf310130f2789e011022
parent5213877f265446c9cc7b3d0fed10b3a98ebf11d8 (diff)
downloadchrome-ec-fd092935f365e608c9b4825b7b53b355e58a1a61.tar.gz
core/riscv-rv32i: Make it possible to enable LTO
This is especially useful to reduce the total code size if we enable division by zero UBSAN. BRANCH=none BUG=b:173969773 TEST=Enable on asurada[_scp], boot Change-Id: I86212a5834e5dd86e75bc3247f4365a6e102c45e Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2605037 Reviewed-by: Tzung-Bi Shih <tzungbi@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@chromium.org>
-rw-r--r--core/riscv-rv32i/build.mk5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/riscv-rv32i/build.mk b/core/riscv-rv32i/build.mk
index a69e2ecafc..76a318a500 100644
--- a/core/riscv-rv32i/build.mk
+++ b/core/riscv-rv32i/build.mk
@@ -17,4 +17,9 @@ CFLAGS_CPU+=-march=rv32ima$(_FPU_EXTENSION)c -mabi=ilp32$(_FPU_EXTENSION) -Os
LDFLAGS_EXTRA+=-mrelax
LDFLAGS_EXTRA+=-static-libgcc -lgcc
+ifneq ($(CONFIG_LTO),)
+CFLAGS_CPU+=-flto
+LDFLAGS_EXTRA+=-flto
+endif
+
core-y=cpu.o init.o panic.o task.o switch.o __builtin.o math.o