mirror of
https://github.com/egzumer/uv-k5-firmware-custom
synced 2024-11-21 17:19:57 +00:00
Retain space saving benefits when not using LTO
This commit is contained in:
parent
fe949d2ae3
commit
4a05e69e19
10
Makefile
10
Makefile
@ -170,9 +170,14 @@ CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delet
|
|||||||
ifeq ($(ENABLE_LTO), 1)
|
ifeq ($(ENABLE_LTO), 1)
|
||||||
# CFLAGS += -flto
|
# CFLAGS += -flto
|
||||||
CFLAGS += -flto=2
|
CFLAGS += -flto=2
|
||||||
|
else
|
||||||
|
# We get most of the space savings if LTO creates problems
|
||||||
|
CFLAGS += -ffunction-sections -fdata-sections
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# May cause unhelpful build failures
|
||||||
#CFLAGS += -Wpadded
|
#CFLAGS += -Wpadded
|
||||||
|
|
||||||
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
|
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
|
||||||
CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\"
|
CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\"
|
||||||
ifeq ($(ENABLE_SWD),1)
|
ifeq ($(ENABLE_SWD),1)
|
||||||
@ -280,6 +285,11 @@ LDFLAGS = -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld
|
|||||||
# Use newlib-nano instead of newlib
|
# Use newlib-nano instead of newlib
|
||||||
LDFLAGS += --specs=nano.specs
|
LDFLAGS += --specs=nano.specs
|
||||||
|
|
||||||
|
ifeq ($(ENABLE_LTO), 0)
|
||||||
|
# Throw away unneeded func/data sections like LTO does
|
||||||
|
LDFLAGS += -Wl,--gc-sections
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(DEBUG),1)
|
ifeq ($(DEBUG),1)
|
||||||
ASFLAGS += -g
|
ASFLAGS += -g
|
||||||
CFLAGS += -g
|
CFLAGS += -g
|
||||||
|
@ -17,7 +17,7 @@ SECTIONS
|
|||||||
.text :
|
.text :
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
*(.text.isr) /* .text sections of code */
|
KEEP(*(.text.isr)) /* .text sections of code */
|
||||||
*(.text) /* .text sections of code */
|
*(.text) /* .text sections of code */
|
||||||
*(.text*) /* .text* sections of code */
|
*(.text*) /* .text* sections of code */
|
||||||
*(.rodata) /* .rodata sections */
|
*(.rodata) /* .rodata sections */
|
||||||
|
Loading…
Reference in New Issue
Block a user