summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kerkmann <karlk90@pm.me>2022-02-27 04:05:03 +0100
committerGitHub <noreply@github.com>2022-02-26 19:05:03 -0800
commit156f0561f2e9865eb76a79742d8224cdd7100f27 (patch)
treea431db28d19ef49004600d6be69e738cc0a4c672
parentcb8528c33cafbd609a19ddc749a6c2eb4e611992 (diff)
[Core] Squeeze AVR some more with `-mrelax` and `-mcall-prologues` (#16269)
-rw-r--r--platforms/avr/platform.mk9
1 files changed, 8 insertions, 1 deletions
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