Skip to content

Commit 396979a

Browse files
committed
atmel-samd: parallelize lto linking
This decreases the link time, especially on desktop machines with many CPU cores. However, it does come at a slight cost in binary size, making the flash section about 200 bytes bigger for circuitplayground_express. Before, linking build-circuitplayground_express/firmware.elf takes 8.8s elapsed time, leaving 3128 bytes free in flash. After, linking build-circuitplayground_express/firmware.elf takes 2.8s elapsed time, leaving 2924 bytes free in flash. (-6 seconds, -204 bytes free) If necessary, we can make this per-board or even per-translation to squeeze full builds.
1 parent 539e6c6 commit 396979a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ports/atmel-samd/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ $(echo PERIPHERALS_CHIP_FAMILY=$(PERIPHERALS_CHIP_FAMILY))
121121
ifeq ($(DEBUG), 1)
122122
CFLAGS += -ggdb3 -Og
123123
# You may want to disable -flto if it interferes with debugging.
124-
CFLAGS += -flto -flto-partition=none
124+
CFLAGS += -flto
125125
# You may want to enable these flags to make setting breakpoints easier.
126126
# CFLAGS += -fno-inline -fno-ipa-sra
127127
ifeq ($(CHIP_FAMILY), samd21)
@@ -144,7 +144,7 @@ else
144144
CFLAGS += -finline-limit=$(CFLAGS_INLINE_LIMIT)
145145
endif
146146

147-
CFLAGS += -flto -flto-partition=none
147+
CFLAGS += -flto
148148

149149
ifeq ($(CIRCUITPY_FULL_BUILD),0)
150150
CFLAGS += --param inline-unit-growth=15 --param max-inline-insns-auto=20
@@ -197,6 +197,7 @@ endif
197197

198198

199199
LDFLAGS = $(CFLAGS) -nostartfiles -Wl,-nostdlib -Wl,-T,$(GENERATED_LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nano.specs
200+
LDFLAGS += -flto=$(shell nproc)
200201
LIBS := -lgcc -lc
201202

202203
# Use toolchain libm if we're not using our own.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy