From 156f0561f2e9865eb76a79742d8224cdd7100f27 Mon Sep 17 00:00:00 2001 From: Stefan Kerkmann Date: Sun, 27 Feb 2022 04:05:03 +0100 Subject: [PATCH] [Core] Squeeze AVR some more with `-mrelax` and `-mcall-prologues` (#16269) --- platforms/avr/platform.mk | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/platforms/avr/platform.mk b/platforms/avr/platform.mk index 4d9cafaeef..9f304d2e20 100644 --- a/platforms/avr/platform.mk +++ b/platforms/avr/platform.mk @@ -18,6 +18,13 @@ COMPILEFLAGS += -ffunction-sections COMPILEFLAGS += -fdata-sections COMPILEFLAGS += -fpack-struct COMPILEFLAGS += -fshort-enums +COMPILEFLAGS += -mcall-prologues + +# Linker relaxation is only possible if +# link time optimizations are not enabled. +ifeq ($(strip $(LTO_ENABLE)), no) + COMPILEFLAGS += -mrelax +endif ASFLAGS += $(AVR_ASFLAGS) @@ -28,7 +35,7 @@ CFLAGS += -fno-strict-aliasing CXXFLAGS += $(COMPILEFLAGS) CXXFLAGS += -fno-exceptions -std=c++11 -LDFLAGS +=-Wl,--gc-sections +LDFLAGS += -Wl,--gc-sections OPT_DEFS += -DF_CPU=$(F_CPU)UL