diff options
| author | Jeff Epler <jepler@gmail.com> | 2020-10-11 21:01:12 -0500 |
|---|---|---|
| committer | Jeff Epler <jepler@gmail.com> | 2020-10-17 20:08:32 -0500 |
| commit | 396979a67e538da087136ce01dbc4c7a670bf60e (patch) | |
| tree | ccbcca7ac60aeb76b303de7f7bedb081598a5134 | |
| parent | 539e6c6bf6ff63ccf369b1c7b0316359580c3762 (diff) | |
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.
| -rw-r--r-- | ports/atmel-samd/Makefile | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index 1ee21679d..2593377eb 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -121,7 +121,7 @@ $(echo PERIPHERALS_CHIP_FAMILY=$(PERIPHERALS_CHIP_FAMILY)) ifeq ($(DEBUG), 1) CFLAGS += -ggdb3 -Og # You may want to disable -flto if it interferes with debugging. - CFLAGS += -flto -flto-partition=none + CFLAGS += -flto # You may want to enable these flags to make setting breakpoints easier. # CFLAGS += -fno-inline -fno-ipa-sra ifeq ($(CHIP_FAMILY), samd21) @@ -144,7 +144,7 @@ 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 @@ -197,6 +197,7 @@ endif LDFLAGS = $(CFLAGS) -nostartfiles -Wl,-nostdlib -Wl,-T,$(GENERATED_LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nano.specs +LDFLAGS += -flto=$(shell nproc) LIBS := -lgcc -lc # Use toolchain libm if we're not using our own. |
