Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow turning off LTO #673

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions Arduino.mk
Original file line number Diff line number Diff line change
Expand Up @@ -1243,13 +1243,20 @@ CXXFLAGS += -fpermissive -fno-exceptions $(CXXFLAGS_STD)
ASFLAGS += -x assembler-with-cpp
DIAGNOSTICS_COLOR_WHEN ?= always

LTO ?= y
# Flags for AVR
ifeq ($(findstring avr, $(strip $(CC_NAME))), avr)
ifeq ($(shell expr $(CC_VERNUM) '>' 490), 1)
ASFLAGS += -flto
CXXFLAGS += -fno-threadsafe-statics -flto -fno-devirtualize -fdiagnostics-color=$(DIAGNOSTICS_COLOR_WHEN)
CFLAGS += -flto -fno-fat-lto-objects -fdiagnostics-color=$(DIAGNOSTICS_COLOR_WHEN)
LDFLAGS += -flto -fuse-linker-plugin
ifeq ($(LTO), y)
LTO_ASFLAGS = -flto
LTO_CXXFLAGS = -flto
LTO_CFLAGS = -flto -fno-fat-lto-objects
LTO_LDFLAGS = -flto
endif
ASFLAGS += $(LTO_ASFLAGS)
CXXFLAGS += -fno-threadsafe-statics $(LTO_CXXFLAGS) -fno-devirtualize -fdiagnostics-color=$(DIAGNOSTICS_COLOR_WHEN)
CFLAGS += $(LTO_CFLAGS) -fdiagnostics-color=$(DIAGNOSTICS_COLOR_WHEN)
LDFLAGS += $(LTO_LDFLAGS) -fuse-linker-plugin
endif
# Flags for ARM (most set in Sam.mk)
else
Expand Down