From fe020380b604ea514594360eb77baaccd6533f68 Mon Sep 17 00:00:00 2001 From: Simon John Date: Tue, 11 Oct 2016 15:23:36 +0100 Subject: Changed LTO support check to avr-gcc > 4.9.0 as the 4.8.1 bundled with the IDE prior to 1.6.10 doesn't support LTO or plugins. Fixes Issue #456 So essentially LTO support will only be enabled with avr-gcc 4.9.2 which comes with 1.6.10 or later and Debian, Ubuntu etc; not 4.8.1 which comes with IDE 1.6.9 and a few earlier versions. Tested with: * 1.6.8 (avr-gcc 4.8.1 which doesn't support LTO so uses avr-ar and doesn't set LTO flags) * 1.6.12 (avr-gcc 4.9.2 which supports LTO so uses avr-gcc-ar and sets LTO flags) * 1.0.5 with Debian avr-gcc 4.9.2 (supports LTO so uses avr-gcc-ar and sets LTO flags) --- Arduino.mk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Arduino.mk') diff --git a/Arduino.mk b/Arduino.mk index 15e242d..133a9a2 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -1032,7 +1032,7 @@ CC_VERNUM = $(shell $(CC) -dumpversion | sed 's/\.//g') # moved from above so we can find version-dependant ar ifndef AR_NAME - ifeq ($(shell expr $(CC_VERNUM) '>' 480), 1) + ifeq ($(shell expr $(CC_VERNUM) '>' 490), 1) AR_NAME = avr-gcc-ar else AR_NAME = avr-ar @@ -1040,7 +1040,7 @@ ifndef AR_NAME endif ifndef CFLAGS_STD - ifeq ($(shell expr $(CC_VERNUM) '>' 480), 1) + ifeq ($(shell expr $(CC_VERNUM) '>' 490), 1) CFLAGS_STD = -std=gnu11 -flto -fno-fat-lto-objects else CFLAGS_STD = @@ -1051,7 +1051,7 @@ else endif ifndef CXXFLAGS_STD - ifeq ($(shell expr $(CC_VERNUM) '>' 480), 1) + ifeq ($(shell expr $(CC_VERNUM) '>' 490), 1) CXXFLAGS_STD = -std=gnu++11 -fno-threadsafe-statics -flto else CXXFLAGS_STD = @@ -1064,11 +1064,11 @@ endif CFLAGS += $(CFLAGS_STD) CXXFLAGS += -fpermissive -fno-exceptions $(CXXFLAGS_STD) ASFLAGS += -x assembler-with-cpp -ifeq ($(shell expr $(CC_VERNUM) '>' 480), 1) +ifeq ($(shell expr $(CC_VERNUM) '>' 490), 1) ASFLAGS += -flto endif LDFLAGS += -$(MCU_FLAG_NAME)=$(MCU) -Wl,--gc-sections -O$(OPTIMIZATION_LEVEL) -ifeq ($(shell expr $(CC_VERNUM) '>' 480), 1) +ifeq ($(shell expr $(CC_VERNUM) '>' 490), 1) LDFLAGS += -flto -fuse-linker-plugin endif SIZEFLAGS ?= --mcu=$(MCU) -C -- cgit v1.2.3