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

13
Kconfig
View File

@ -1956,6 +1956,19 @@ config DEBUG_OPTLEVEL
This string represents the custom optimization level that will be
used if DEBUG_CUSTOMOPT.
config DEBUG_OPT_UNUSED_SECTIONS
bool "Optimization to eliminate the unused input sections"
default y
depends on ARCH_TOOLCHAIN_GNU
---help---
Use these options on systems where the linker can perform optimizations
to improve locality of reference in the instruction space. Most systems
using the ELF object format have linkers with such optimizations.
Enable this option to optimization the unused input sections with the
linker by compiling with " -ffunction-sections -fdata-sections ", and
linking with " --gc-sections ".
endmenu # Build Setup
menu "System Type"

View File

@ -98,6 +98,13 @@ ifneq ($(CONFIG_CXX_RTTI),y)
ARCHCXXFLAGS += -fno-rtti
endif
# Optimization of unused sections
ifeq ($(CONFIG_DEBUG_OPT_UNUSED_SECTIONS),y)
LDFLAGS += --gc-sections
MAXOPTIMIZATION += -ffunction-sections -fdata-sections
endif
# Default toolchain
CC = $(CROSSDEV)gcc

View File

@ -154,6 +154,13 @@ ifneq ($(CONFIG_CXX_RTTI),y)
ARCHCXXFLAGS += -fno-rtti
endif
# Optimization of unused sections
ifeq ($(CONFIG_DEBUG_OPT_UNUSED_SECTIONS),y)
LDFLAGS += --gc-sections
MAXOPTIMIZATION += -ffunction-sections -fdata-sections
endif
# Add the builtin library
COMPILER_RT_LIB = $(shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name)

View File

@ -129,6 +129,13 @@ ifneq ($(CONFIG_CXX_RTTI),y)
ARCHCXXFLAGS += -fno-rtti
endif
# Optimization of unused sections
ifeq ($(CONFIG_DEBUG_OPT_UNUSED_SECTIONS),y)
LDFLAGS += --gc-sections
MAXOPTIMIZATION += -ffunction-sections -fdata-sections
endif
# NuttX buildroot under Linux or Cygwin
ifeq ($(CONFIG_ARMV7A_TOOLCHAIN),BUILDROOT)

View File

@ -209,6 +209,13 @@ ifneq ($(CONFIG_CXX_RTTI),y)
ARCHCXXFLAGS += -fno-rtti
endif
# Optimization of unused sections
ifeq ($(CONFIG_DEBUG_OPT_UNUSED_SECTIONS),y)
LDFLAGS += --gc-sections
MAXOPTIMIZATION += -ffunction-sections -fdata-sections
endif
# Add the builtin library
COMPILER_RT_LIB = $(shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name)

View File

@ -121,6 +121,13 @@ ifneq ($(CONFIG_CXX_RTTI),y)
ARCHCXXFLAGS += -fno-rtti
endif
# Optimization of unused sections
ifeq ($(CONFIG_DEBUG_OPT_UNUSED_SECTIONS),y)
LDFLAGS += --gc-sections
MAXOPTIMIZATION += -ffunction-sections -fdata-sections
endif
# Default toolchain
CC = $(CROSSDEV)gcc

View File

@ -218,6 +218,13 @@ ifneq ($(CONFIG_CXX_RTTI),y)
ARCHCXXFLAGS += -fno-rtti
endif
# Optimization of unused sections
ifeq ($(CONFIG_DEBUG_OPT_UNUSED_SECTIONS),y)
LDFLAGS += --gc-sections
MAXOPTIMIZATION += -ffunction-sections -fdata-sections
endif
# Add the builtin library
COMPILER_RT_LIB = $(shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name)

View File

@ -86,7 +86,6 @@ INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)ble)
#INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)ble$(DELIM)include)
#INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)osal$(DELIM)include)
CFLAGS += -ffunction-sections
CFLAGS += -DCFG_CP
CFLAGS += -DPHY_MCU_TYPE=MCU_BUMBEE_M0
CFLAGS += -DHOST_CONFIG=4

View File

@ -277,6 +277,13 @@ NM = $(CROSSDEV)nm
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
# Optimization of unused sections
ifeq ($(CONFIG_DEBUG_OPT_UNUSED_SECTIONS),y)
LDFLAGS += --gc-sections
MAXOPTIMIZATION += -ffunction-sections -fdata-sections
endif
# Add the builtin library
EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name))

View File

@ -119,11 +119,6 @@ CHIP_CSRCS += bl602_netdev.c
EXTRA_LIBPATHS += -L $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)$(WIRELESS_DRV_UNPACK)$(DELIM)libs$(DELIM)BL602$(DELIM)nuttx
EXTRA_LIBS += -lbl602_wifi -lbl602_wifi_manage -lblecontroller
# Due to some Wi-Fi related libraries, the option is need to avoid linking too much
# unused functions.
LDFLAGS += --gc-sections
ifeq ($(CONFIG_BL602_WIRELESS_DEBUG),y)
LDFLAGS += -defsym _wifi_log_flag=1
endif

View File

@ -66,6 +66,13 @@ ifneq ($(CONFIG_CXX_RTTI),y)
ARCHCXXFLAGS += -fno-rtti
endif
# Optimization of unused sections
ifeq ($(CONFIG_DEBUG_OPT_UNUSED_SECTIONS),y)
LDFLAGS += --gc-sections
MAXOPTIMIZATION += -ffunction-sections -fdata-sections
endif
# Generic GNU RVG toolchain
ifeq ($(CONFIG_RISCV_TOOLCHAIN),GNU_RVG)

View File

@ -221,11 +221,6 @@ INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)esp-wire
EXTRA_LIBPATHS += -L $(ARCH_SRCDIR)$(DELIM)chip$(DELIM)esp-wireless-drivers-3rdparty$(DELIM)libs$(DELIM)esp32c3
EXTRA_LIBS += -lphy
# Due to some Wi-Fi related libraries, the option is need to avoid linking too much
# unused functions.
LDFLAGS += --gc-sections
# Wireless interfaces.
CHIP_CSRCS += esp32c3_wireless.c

View File

@ -254,11 +254,6 @@ EXTRA_LIBS += -lbtdm_app
endif
endif
# Due to some Wi-Fi related libraries, the option is need to avoid linking too much
# unused functions.
LDFLAGS += --gc-sections
# Wireless interfaces.
CHIP_CSRCS += esp32_wireless.c

View File

@ -70,6 +70,13 @@ ifneq ($(CONFIG_CXX_RTTI),y)
ARCHCXXFLAGS += -fno-rtti
endif
# Optimization of unused sections
ifeq ($(CONFIG_DEBUG_OPT_UNUSED_SECTIONS),y)
LDFLAGS += --gc-sections
MAXOPTIMIZATION += -ffunction-sections -fdata-sections
endif
# Default toolchain
ifeq ($(CONFIG_XTENSA_TOOLCHAIN_XCC), y)
CC = $(CROSSDEV)xcc

View File

@ -70,6 +70,13 @@ ifneq ($(CONFIG_CXX_RTTI),y)
ARCHCXXFLAGS += -fno-rtti
endif
# Optimization of unused sections
ifeq ($(CONFIG_DEBUG_OPT_UNUSED_SECTIONS),y)
LDFLAGS += --gc-sections
MAXOPTIMIZATION += -ffunction-sections -fdata-sections
endif
# Default toolchain
ifeq ($(CONFIG_XTENSA_TOOLCHAIN_XCC), y)
CC = $(CROSSDEV)xcc

View File

@ -51,7 +51,7 @@ endif
ARCHSTDINCLUDES =
ARCHCPUFLAGS = -Dinterrupt="__attribute__((__interrupt__))" -ffreestanding
ARCHCPUFLAGS += -ffunction-sections -fdata-sections -Wa,-march=ez80
ARCHCPUFLAGS += -Wa,-march=ez80
ARCHLIST =
ARCHWARNINGS = -Wall -Wextra -Wno-incompatible-library-redeclaration
ARCHWARNINGS += -Wno-main-return-type -Wno-unused-parameter
@ -64,7 +64,12 @@ ARCHASMINCLUDES = -include chip/clang-compat.asm
ARCHASMLIST =
ARCHASMWARNINGS = -W
LDFLAGS += --gc-sections
# Optimization of unused sections
ifeq ($(CONFIG_DEBUG_OPT_UNUSED_SECTIONS),y)
LDFLAGS += --gc-sections
MAXOPTIMIZATION += -ffunction-sections -fdata-sections
endif
# Tool names/paths.

View File

@ -44,7 +44,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
endif
ARCHCFLAGS += -fno-common -mabi=aapcs -ffunction-sections -fdata-sections
ARCHCFLAGS += -fno-common -mabi=aapcs
ARCHCXXFLAGS += -fno-common -std=c++11
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
@ -76,8 +76,6 @@ CXXELFFLAGS = $(CXXFLAGS)
LDELFFLAGS = -r -e main
LDELFFLAGS += -T $(call CONVERT_PATH,$(BOARD_DIR)$(DELIM)scripts$(DELIM)gnu-elf.ld)
LDFLAGS += --gc-sections
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
CFLAGS += -gdwarf-3
CXXFLAGS += -gdwarf-3

View File

@ -34,7 +34,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
endif
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCFLAGS += -fno-common
ARCHCXXFLAGS += -fno-common
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
@ -61,8 +61,6 @@ CXXELFFLAGS = $(CXXFLAGS) -mlong-calls # --target1-abs
LDELFFLAGS = -r -e main
LDELFFLAGS += -T $(call CONVERT_PATH,$(BOARD_DIR)$(DELIM)scripts$(DELIM)gnu-elf.ld)
LDFLAGS += --gc-sections
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif

View File

@ -42,7 +42,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
endif
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCFLAGS += -fno-common
ARCHCXXFLAGS += -fno-common -nostdinc++
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
@ -77,8 +77,6 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif
LDFLAGS += --gc-sections
ifeq ($(CONFIG_LC823450_SDIF_PATCH),y)
ARCH_LIBS += -lSdDr_patch_es2
ARCH_LIBPATHS += -L"$(TOPDIR)/arch/arm/src/lc823450"

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

View File

@ -44,9 +44,9 @@ ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -ffunction-sections -fdata-sections -pipe
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -ffunction-sections -fdata-sections -pipe
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
@ -60,7 +60,7 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
endif
# Provide map file needed by the "Memory Allocation" view in Eclipse:
LDFLAGS += -Map=$(TOPDIR)/NuttX.map --gc-sections
LDFLAGS += -Map=$(TOPDIR)/NuttX.map
# Embed absolute path to source file in debug information so that Eclipse
# source level debugging won't get confused. See:

View File

@ -44,9 +44,9 @@ ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -ffunction-sections -fdata-sections -pipe
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -ffunction-sections -fdata-sections -pipe
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
@ -60,7 +60,7 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
endif
# Provide map file needed by the "Memory Allocation" view in Eclipse:
LDFLAGS += -Map=$(TOPDIR)/NuttX.map --gc-sections
LDFLAGS += -Map=$(TOPDIR)/NuttX.map
# Embed absolute path to source file in debug information so that Eclipse
# source level debugging won't get confused. See:

View File

@ -44,9 +44,9 @@ ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -ffunction-sections -fdata-sections -pipe
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -ffunction-sections -fdata-sections -pipe
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
@ -60,7 +60,7 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
endif
# Provide map file needed by the "Memory Allocation" view in Eclipse:
LDFLAGS += -Map=$(TOPDIR)/NuttX.map --gc-sections
LDFLAGS += -Map=$(TOPDIR)/NuttX.map
# Embed absolute path to source file in debug information so that Eclipse
# source level debugging won't get confused. See:

View File

@ -44,9 +44,9 @@ ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -ffunction-sections -fdata-sections -pipe
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -ffunction-sections -fdata-sections -pipe
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
@ -60,7 +60,7 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
endif
# Provide map file needed by the "Memory Allocation" view in Eclipse:
LDFLAGS += -Map=$(TOPDIR)/NuttX.map --gc-sections
LDFLAGS += -Map=$(TOPDIR)/NuttX.map
# Embed absolute path to source file in debug information so that Eclipse
# source level debugging won't get confused. See:

View File

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

View File

@ -44,7 +44,7 @@ ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -ffunction-sections -fdata-sections -pipe
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
@ -55,8 +55,6 @@ 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
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif

View File

@ -34,8 +34,8 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
endif
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCFLAGS += -fno-common
ARCHCXXFLAGS += -fno-common
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
@ -61,8 +61,6 @@ 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

View File

@ -78,7 +78,7 @@ CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
ifeq ($(CONFIG_MIPS32_TOOLCHAIN_MICROCHIPL_XC32),y)
LDFLAGS = -nostdlib --defsym=__MPLAB_BUILD=1 --defsym=__MPLAB_DEBUG=1 --defsym=__DEBUG=1 --defsym=__MPLAB_DEBUGGER_PK3=1 --defsym=_min_heap_size=0 --gc-sections
LDFLAGS = -nostdlib --defsym=__MPLAB_BUILD=1 --defsym=__MPLAB_DEBUG=1 --defsym=__DEBUG=1 --defsym=__MPLAB_DEBUGGER_PK3=1 --defsym=_min_heap_size=0
else
LDFLAGS = # -no-isn32 --relax
endif

View File

@ -78,7 +78,7 @@ CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
ifeq ($(CONFIG_MIPS32_TOOLCHAIN_MICROCHIPL_XC32),y)
LDFLAGS = -nostdlib --defsym=__MPLAB_BUILD=1 --defsym=__MPLAB_DEBUG=1 --defsym=__DEBUG=1 --defsym=__MPLAB_DEBUGGER_PK3=1 --defsym=_min_heap_size=0 --gc-sections
LDFLAGS = -nostdlib --defsym=__MPLAB_BUILD=1 --defsym=__MPLAB_DEBUG=1 --defsym=__DEBUG=1 --defsym=__MPLAB_DEBUGGER_PK3=1 --defsym=_min_heap_size=0
else
LDFLAGS = # -no-isn32 --relax
endif

View File

@ -78,7 +78,7 @@ CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
ifeq ($(CONFIG_MIPS32_TOOLCHAIN_MICROCHIPL_XC32),y)
LDFLAGS = -nostdlib --defsym=__MPLAB_BUILD=1 --defsym=__MPLAB_DEBUG=1 --defsym=__DEBUG=1 --defsym=__MPLAB_DEBUGGER_PK3=1 --defsym=_min_heap_size=0 --gc-sections
LDFLAGS = -nostdlib --defsym=__MPLAB_BUILD=1 --defsym=__MPLAB_DEBUG=1 --defsym=__DEBUG=1 --defsym=__MPLAB_DEBUGGER_PK3=1 --defsym=_min_heap_size=0
else
LDFLAGS = # -no-isn32 --relax
endif

View File

@ -34,15 +34,13 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ASARCHCPUFLAGS += -Wa,-g
endif
MAXOPTIMIZATION = -Os
ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
endif
ARCHCPUFLAGS += -mno-relax
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS += -fno-common -ffunction-sections -fdata-sections -std=c++17 -pipe
ARCHCFLAGS += -fno-common
ARCHCXXFLAGS += -fno-common -std=c++17 -pipe
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
@ -68,6 +66,6 @@ CXXELFFLAGS = $(CXXFLAGS)
LDELFFLAGS = -melf32lriscv -r -e main
LDELFFLAGS += -T $(call CONVERT_PATH,$(BOARD_DIR)$(DELIM)scripts$(DELIM)gnu-elf.ld)
LDFLAGS += --gc-sections -melf32lriscv --cref
LDFLAGS += -melf32lriscv --cref
LDFLAGS += -Map=$(TOPDIR)/nuttx.map

View File

@ -48,7 +48,7 @@ endif
ARCHCPUFLAGS += -mcmodel=medany
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCFLAGS += -fno-common
ARCHCXXFLAGS += -fno-common
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
@ -77,4 +77,4 @@ LDELFFLAGS += -T $(call CONVERT_PATH,$(BOARD_DIR)$(DELIM)scripts$(DELIM)gnu-elf.
# File extensions
LDFLAGS += --gc-sections -melf64lriscv
LDFLAGS += -melf64lriscv

View File

@ -41,8 +41,8 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
endif
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections -msmall-data-limit=0
ARCHCXXFLAGS += -fno-common -ffunction-sections -fdata-sections -msmall-data-limit=0 -std=c++17
ARCHCFLAGS += -fno-common -msmall-data-limit=0
ARCHCXXFLAGS += -fno-common -msmall-data-limit=0 -std=c++17
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic
@ -70,4 +70,4 @@ LDELFFLAGS = -melf32lriscv -r -e main
LDELFFLAGS += -T $(call CONVERT_PATH,$(TOPDIR)$(DELIM)binfmt$(DELIM)libelf$(DELIM)gnu-elf.ld)
LDFLAGS += -Map=$(call CONVERT_PATH,$(TOPDIR)/nuttx.map) --cref
LDFLAGS += --gc-sections -melf32lriscv
LDFLAGS += -melf32lriscv

View File

@ -41,7 +41,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
endif
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCFLAGS += -fno-common
ARCHCXXFLAGS += -fno-common
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
@ -54,4 +54,4 @@ CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS += $(CFLAGS) -D__ASSEMBLY__ $(ASARCHCPUFLAGS)
LDFLAGS += --gc-sections -melf32lriscv
LDFLAGS += -melf32lriscv

View File

@ -38,7 +38,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
endif
ARCHCPUFLAGS += -mcmodel=medany -mstrict-align
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCFLAGS += -fno-common
ARCHCXXFLAGS += -fno-common
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
@ -67,4 +67,4 @@ LDELFFLAGS += -T $(call CONVERT_PATH,$(BOARD_DIR)$(DELIM)scripts$(DELIM)gnu-elf.
# File extensions
LDFLAGS += --gc-sections -melf64lriscv
LDFLAGS += -melf64lriscv

View File

@ -37,7 +37,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
endif
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCFLAGS += -fno-common
ARCHCXXFLAGS += -fno-common
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
@ -50,4 +50,4 @@ CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS += $(CFLAGS) -D__ASSEMBLY__ $(ASARCHCPUFLAGS)
LDFLAGS += --gc-sections -melf32lriscv
LDFLAGS += -melf32lriscv

View File

@ -63,7 +63,7 @@ endif
ARCHCPUFLAGS += -mcmodel=medany
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCFLAGS += -fno-common
ARCHCXXFLAGS += -fno-common
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
@ -92,4 +92,4 @@ LDELFFLAGS += -T $(call CONVERT_PATH,$(BOARD_DIR)$(DELIM)scripts$(DELIM)gnu-elf.
# File extensions
LDFLAGS += --gc-sections -melf64lriscv
LDFLAGS += -melf64lriscv

View File

@ -48,7 +48,7 @@ endif
ARCHCPUFLAGS += -mcmodel=medany
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCFLAGS += -fno-common
ARCHCXXFLAGS += -fno-common
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
@ -77,4 +77,4 @@ LDELFFLAGS += -T $(call CONVERT_PATH,$(BOARD_DIR)$(DELIM)scripts$(DELIM)gnu-elf.
# File extensions
LDFLAGS += --gc-sections -melf64lriscv
LDFLAGS += -melf64lriscv

View File

@ -40,7 +40,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
endif
ARCHCPUFLAGS += -mcmodel=medany
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCFLAGS += -fno-common
ARCHCXXFLAGS += -fno-common
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
@ -54,7 +54,7 @@ CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS += $(CFLAGS) -D__ASSEMBLY__ $(ASARCHCPUFLAGS)
ifeq ($(CONFIG_ARCH_RV32),y)
LDFLAGS += --gc-sections -melf32lriscv
LDFLAGS += -melf32lriscv
else
LDFLAGS += --gc-sections -melf64lriscv
LDFLAGS += -melf64lriscv
endif

View File

@ -53,7 +53,7 @@ ifeq ($(CONFIG_RV32M1_OPENISA_TOOLCHAIN),y)
endif
endif
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCFLAGS += -fno-common
ARCHCXXFLAGS += -fno-common
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
@ -66,4 +66,4 @@ CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS += $(CFLAGS) -D__ASSEMBLY__ $(ASARCHCPUFLAGS)
LDFLAGS += --gc-sections -melf32lriscv
LDFLAGS += -melf32lriscv

View File

@ -65,8 +65,8 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
endif
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS += -fno-common -ffunction-sections -fdata-sections -std=c++17
ARCHCFLAGS += -fno-common
ARCHCXXFLAGS += -fno-common -std=c++17
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic

View File

@ -65,8 +65,8 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
endif
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS += -fno-common -ffunction-sections -fdata-sections -std=c++17
ARCHCFLAGS += -fno-common
ARCHCXXFLAGS += -fno-common -std=c++17
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic

View File

@ -65,8 +65,8 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
endif
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS += -fno-common -ffunction-sections -fdata-sections -std=c++17
ARCHCFLAGS += -fno-common
ARCHCXXFLAGS += -fno-common -std=c++17
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic

View File

@ -65,8 +65,8 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
endif
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS += -fno-common -ffunction-sections -fdata-sections -std=c++17
ARCHCFLAGS += -fno-common
ARCHCXXFLAGS += -fno-common -std=c++17
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic

View File

@ -46,8 +46,8 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
endif
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS += -fno-common -ffunction-sections -fdata-sections -std=c++17
ARCHCFLAGS += -fno-common
ARCHCXXFLAGS += -fno-common -std=c++17
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic

View File

@ -36,8 +36,8 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce
endif
ARCHCFLAGS += -fno-common -ffunction-sections -fdata-sections
ARCHCXXFLAGS += -fno-common -ffunction-sections -fdata-sections -std=c++17
ARCHCFLAGS += -fno-common
ARCHCXXFLAGS += -fno-common -std=c++17
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
ARCHPICFLAGS = -fpic