boards: Add --gc-sections for photon and stm32f4discovery

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
Huang Qi 2022-02-26 21:53:01 +08:00 committed by Xiang Xiao
parent d0356bb9ba
commit 1f84f5b0ed
2 changed files with 10 additions and 7 deletions

View File

@ -43,8 +43,8 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
endif
ARCHCFLAGS = -fno-common -fno-builtin
ARCHCXXFLAGS = -fno-common -fno-builtin -fno-exceptions -fcheck-new -fno-rtti
ARCHCFLAGS = -fno-common -fno-builtin -ffunction-sections -fdata-sections
ARCHCXXFLAGS = -fno-common -fno-builtin -fno-exceptions -fcheck-new -fno-rtti -ffunction-sections -fdata-sections
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
@ -64,6 +64,8 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif
LDFLAGS += --gc-sections
ifeq ($(CONFIG_DFU_BINARY),y)
define FLASH

View File

@ -34,11 +34,10 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
endif
ARCHCFLAGS = -fno-common -fno-builtin
ifeq ($(CONFIG_CXX_EXCEPTION),y)
ARCHCXXFLAGS = -fno-common -fno-builtin
else
ARCHCXXFLAGS = -fno-common -fno-builtin -fno-exceptions -fcheck-new
ARCHCFLAGS = -fno-common -fno-builtin -ffunction-sections -fdata-sections
ARCHCXXFLAGS = -fno-common -fno-builtin -ffunction-sections -fdata-sections
ifneq ($(CONFIG_CXX_EXCEPTION),y)
ARCHCXXFLAGS = -fno-exceptions -fcheck-new
endif
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
@ -65,6 +64,8 @@ NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
LDNXFLATFLAGS = -e main -s 2048
LDFLAGS += --gc-sections
# Loadable module definitions
CMODULEFLAGS = $(CFLAGS) -mlong-calls # --target1-abs