compile/opt: add config DEBUG_OPT_UNUSED_SECTIONS

Enable this option to optimization the unused input sections with the
linker by compiling with " -ffunction-sections -fdata-sections ", and
linking with " --gc-sections ".

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an
2022-04-21 18:10:40 +08:00
committed by Xiang Xiao
parent 56ecd44f63
commit 64d7326ed5
46 changed files with 149 additions and 93 deletions
+1 -3
View File
@@ -47,7 +47,7 @@ CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
CFLAGS += -ffunction-sections -fdata-sections
CFLAGS +=
NXFLATLDFLAGS1 = -r -Wl,-d -Wl,-warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -Wl,-no-check-sections
@@ -56,5 +56,3 @@ LDNXFLATFLAGS = -e main -s 2048
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif
LDFLAGS += --gc-sections