Skip to content

Commit 360872d

Browse files
committed
core: Build option for LTO(Link Time Optimization)
This makes firmware size small but need to be tested more. https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#Optimize-Options arduino/Arduino#660 https://github.com/arduino/ArduinoCore-avr/blob/master/platform.txt * No `-fno-fat-lto-objects` is needed, it is the default. https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-ffat-lto-objects * No `-fuse-linker-plugin` is needed, it is the default. https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-fuse-linker-plugin
1 parent 0e1aeaa commit 360872d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: tmk_core/rules.mk

+4
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ CFLAGS += -Wstrict-prototypes
139139
CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
140140
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
141141
CFLAGS += $(CSTANDARD)
142+
CFLAGS += -flto
142143
ifdef CONFIG_H
143144
CFLAGS += -include $(CONFIG_H)
144145
endif
@@ -173,6 +174,7 @@ CPPFLAGS += -Wundef
173174
CPPFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
174175
CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
175176
#CPPFLAGS += $(CSTANDARD)
177+
CPPFLAGS += -flto
176178
ifdef CONFIG_H
177179
CPPFLAGS += -include $(CONFIG_H)
178180
endif
@@ -189,6 +191,7 @@ endif
189191
# dump that will be displayed for a given single line of source input.
190192
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100
191193
ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
194+
ASFLAGS += -flto
192195
ifdef CONFIG_H
193196
ASFLAGS += -include $(CONFIG_H)
194197
endif
@@ -261,6 +264,7 @@ LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
261264
#LDFLAGS += -T linker_script.x
262265
# You can give EXTRALDFLAGS at 'make' command line.
263266
LDFLAGS += $(EXTRALDFLAGS)
267+
LDFLAGS += -flto
264268

265269

266270

0 commit comments

Comments
 (0)