Use -flto and -flto-partition only as needed

This commit is contained in:
Dan Halbert 2022-05-26 10:58:08 -04:00
parent 8dcbd3ab47
commit d74193c298
6 changed files with 9 additions and 7 deletions

View File

@ -124,7 +124,7 @@ $(echo PERIPHERALS_CHIP_FAMILY=$(PERIPHERALS_CHIP_FAMILY))
ifeq ($(DEBUG), 1)
CFLAGS += -ggdb3 -Og -Os
# You may want to disable -flto if it interferes with debugging.
CFLAGS += -flto -flto-partition=none
CFLAGS += -flto -flto-partition=one
# You may want to enable these flags to make setting breakpoints easier.
# CFLAGS += -fno-inline -fno-ipa-sra
ifeq ($(CHIP_FAMILY), samd21)
@ -147,10 +147,11 @@ else
CFLAGS += -finline-limit=$(CFLAGS_INLINE_LIMIT)
endif
CFLAGS += -flto -flto-partition=none
CFLAGS += -flto
ifeq ($(CIRCUITPY_FULL_BUILD),0)
CFLAGS += --param inline-unit-growth=15 --param max-inline-insns-auto=20
CFLAGS += -flto-partition=one
endif
ifdef CFLAGS_BOARD
@ -168,6 +169,7 @@ CFLAGS += \
-msoft-float \
-mfloat-abi=soft \
-DSAMD21
-flto-partition=one
endif
ifeq ($(CHIP_FAMILY), samd51)
CFLAGS += \

View File

@ -91,7 +91,7 @@ ifeq ($(DEBUG), 1)
else
OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
CFLAGS += -DNDEBUG -ggdb3
CFLAGS += -flto -flto-partition=none
# If -flto is needed, give it in OPTIMIZATION_FLAGS per board
endif
ifeq ($(NRF_DEBUG_PRINT), 1)

View File

@ -50,4 +50,4 @@ SUPEROPT_GC = 0
SUPEROPT_VM = 0
# Override optimization to keep binary small
OPTIMIZATION_FLAGS = -Os
OPTIMIZATION_FLAGS = -Os -flto -flto-partition=one

View File

@ -30,6 +30,6 @@ CIRCUITPY_USB = 0
MICROPY_PY_ASYNC_AWAIT = 0
# Override optimization to keep binary small
OPTIMIZATION_FLAGS = -Os
OPTIMIZATION_FLAGS = -Os -flto -flto-partition=one
SUPEROPT_VM = 0
SUPEROPT_GC = 0

View File

@ -40,4 +40,4 @@ SUPEROPT_GC = 0
SUPEROPT_VM = 0
# Override optimization to keep binary small
OPTIMIZATION_FLAGS = -Os
OPTIMIZATION_FLAGS = -Os -flto -flto-partition=one

View File

@ -48,6 +48,6 @@ CIRCUITPY_ZLIB = 0
#CIRCUITPY_ENABLE_MPY_NATIVE = 1
# Override optimization to keep binary small
OPTIMIZATION_FLAGS = -Os
OPTIMIZATION_FLAGS = -Os -flto -flto-partition=one
SUPEROPT_VM = 0
SUPEROPT_GC = 0