From 64d7326ed56b9f2352be9520700cb6e5043c31d7 Mon Sep 17 00:00:00 2001 From: "chao.an" Date: Thu, 21 Apr 2022 18:10:40 +0800 Subject: [PATCH] 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 --- Kconfig | 13 +++++++++++++ arch/arm/src/arm/Toolchain.defs | 7 +++++++ arch/arm/src/armv6-m/Toolchain.defs | 7 +++++++ arch/arm/src/armv7-a/Toolchain.defs | 7 +++++++ arch/arm/src/armv7-m/Toolchain.defs | 7 +++++++ arch/arm/src/armv7-r/Toolchain.defs | 7 +++++++ arch/arm/src/armv8-m/Toolchain.defs | 7 +++++++ arch/arm/src/phy62xx/Make.defs | 1 - arch/mips/src/mips32/Toolchain.defs | 7 +++++++ arch/risc-v/src/bl602/Make.defs | 5 ----- arch/risc-v/src/common/Toolchain.defs | 7 +++++++ arch/risc-v/src/esp32c3/Make.defs | 5 ----- arch/xtensa/src/esp32/Make.defs | 5 ----- arch/xtensa/src/lx6/Toolchain.defs | 7 +++++++ arch/xtensa/src/lx7/Toolchain.defs | 7 +++++++ arch/z80/src/ez80/Toolchain.defs | 9 +++++++-- boards/arm/cxd56xx/spresense/scripts/Make.defs | 4 +--- boards/arm/imx6/sabre-6quad/scripts/Make.defs | 4 +--- .../arm/lc823450/lc823450-xgevk/scripts/Make.defs | 4 +--- boards/arm/phy62xx/phy6222/scripts/Make.defs | 4 +--- boards/arm/stm32/b-g431b-esc1/scripts/Make.defs | 6 +++--- boards/arm/stm32/b-g474e-dpow1/scripts/Make.defs | 6 +++--- boards/arm/stm32/nucleo-g431kb/scripts/Make.defs | 6 +++--- boards/arm/stm32/nucleo-g431rb/scripts/Make.defs | 6 +++--- boards/arm/stm32/photon/scripts/Make.defs | 6 ++---- .../arm/stm32/stm32f103-minimum/scripts/Make.defs | 4 +--- boards/arm/stm32/stm32f4discovery/scripts/Make.defs | 6 ++---- .../mips/pic32mz/chipkit-wifire/scripts/Make.defs | 2 +- .../pic32mz/flipnclick-pic32mz/scripts/Make.defs | 2 +- .../pic32mz/pic32mz-starterkit/scripts/Make.defs | 2 +- boards/risc-v/bl602/bl602evb/scripts/Make.defs | 8 +++----- boards/risc-v/c906/smartl-c906/scripts/Make.defs | 4 ++-- .../risc-v/esp32c3/esp32c3-devkit/scripts/Make.defs | 6 +++--- boards/risc-v/fe310/hifive1-revb/scripts/Make.defs | 4 ++-- boards/risc-v/k210/maix-bit/scripts/Make.defs | 4 ++-- boards/risc-v/litex/arty_a7/scripts/Make.defs | 4 ++-- boards/risc-v/mpfs/icicle/scripts/Make.defs | 4 ++-- boards/risc-v/mpfs/m100pfsevp/scripts/Make.defs | 4 ++-- boards/risc-v/qemu-rv/rv-virt/scripts/Make.defs | 6 +++--- boards/risc-v/rv32m1/rv32m1-vega/scripts/Make.defs | 4 ++-- boards/xtensa/esp32/esp32-devkitc/scripts/Make.defs | 4 ++-- .../esp32/esp32-ethernet-kit/scripts/Make.defs | 4 ++-- .../xtensa/esp32/esp32-wrover-kit/scripts/Make.defs | 4 ++-- .../xtensa/esp32/ttgo_lora_esp32/scripts/Make.defs | 4 ++-- .../esp32s2/esp32s2-saola-1/scripts/Make.defs | 4 ++-- .../xtensa/esp32s3/esp32s3-devkit/scripts/Make.defs | 4 ++-- 46 files changed, 149 insertions(+), 93 deletions(-) diff --git a/Kconfig b/Kconfig index 87fefc98b1..6f17d66a93 100644 --- a/Kconfig +++ b/Kconfig @@ -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" diff --git a/arch/arm/src/arm/Toolchain.defs b/arch/arm/src/arm/Toolchain.defs index 84cb931319..dc8c98b14e 100644 --- a/arch/arm/src/arm/Toolchain.defs +++ b/arch/arm/src/arm/Toolchain.defs @@ -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 diff --git a/arch/arm/src/armv6-m/Toolchain.defs b/arch/arm/src/armv6-m/Toolchain.defs index f66849c96e..dd50320fd7 100644 --- a/arch/arm/src/armv6-m/Toolchain.defs +++ b/arch/arm/src/armv6-m/Toolchain.defs @@ -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) diff --git a/arch/arm/src/armv7-a/Toolchain.defs b/arch/arm/src/armv7-a/Toolchain.defs index 2f03798197..b9769aee8e 100644 --- a/arch/arm/src/armv7-a/Toolchain.defs +++ b/arch/arm/src/armv7-a/Toolchain.defs @@ -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) diff --git a/arch/arm/src/armv7-m/Toolchain.defs b/arch/arm/src/armv7-m/Toolchain.defs index 1b8e9ac84b..2744a7e4f4 100644 --- a/arch/arm/src/armv7-m/Toolchain.defs +++ b/arch/arm/src/armv7-m/Toolchain.defs @@ -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) diff --git a/arch/arm/src/armv7-r/Toolchain.defs b/arch/arm/src/armv7-r/Toolchain.defs index 0c589fe2be..f582aef010 100644 --- a/arch/arm/src/armv7-r/Toolchain.defs +++ b/arch/arm/src/armv7-r/Toolchain.defs @@ -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 diff --git a/arch/arm/src/armv8-m/Toolchain.defs b/arch/arm/src/armv8-m/Toolchain.defs index 7624e149ff..b4adbdcaaa 100644 --- a/arch/arm/src/armv8-m/Toolchain.defs +++ b/arch/arm/src/armv8-m/Toolchain.defs @@ -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) diff --git a/arch/arm/src/phy62xx/Make.defs b/arch/arm/src/phy62xx/Make.defs index bad299a1d6..6aa45028fd 100644 --- a/arch/arm/src/phy62xx/Make.defs +++ b/arch/arm/src/phy62xx/Make.defs @@ -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 diff --git a/arch/mips/src/mips32/Toolchain.defs b/arch/mips/src/mips32/Toolchain.defs index ef928fe8e6..6b19c7dd3d 100644 --- a/arch/mips/src/mips32/Toolchain.defs +++ b/arch/mips/src/mips32/Toolchain.defs @@ -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)) diff --git a/arch/risc-v/src/bl602/Make.defs b/arch/risc-v/src/bl602/Make.defs index 1a6850d8ee..72e53b5484 100644 --- a/arch/risc-v/src/bl602/Make.defs +++ b/arch/risc-v/src/bl602/Make.defs @@ -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 diff --git a/arch/risc-v/src/common/Toolchain.defs b/arch/risc-v/src/common/Toolchain.defs index 81adabc348..fb52eaa0e9 100644 --- a/arch/risc-v/src/common/Toolchain.defs +++ b/arch/risc-v/src/common/Toolchain.defs @@ -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) diff --git a/arch/risc-v/src/esp32c3/Make.defs b/arch/risc-v/src/esp32c3/Make.defs index a72ac8b69b..15640d9392 100644 --- a/arch/risc-v/src/esp32c3/Make.defs +++ b/arch/risc-v/src/esp32c3/Make.defs @@ -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 diff --git a/arch/xtensa/src/esp32/Make.defs b/arch/xtensa/src/esp32/Make.defs index 90bda81fec..3e084afa09 100644 --- a/arch/xtensa/src/esp32/Make.defs +++ b/arch/xtensa/src/esp32/Make.defs @@ -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 diff --git a/arch/xtensa/src/lx6/Toolchain.defs b/arch/xtensa/src/lx6/Toolchain.defs index e6a76079c8..8a0e64bb1d 100644 --- a/arch/xtensa/src/lx6/Toolchain.defs +++ b/arch/xtensa/src/lx6/Toolchain.defs @@ -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 diff --git a/arch/xtensa/src/lx7/Toolchain.defs b/arch/xtensa/src/lx7/Toolchain.defs index 7b18be03b3..9c838cc619 100644 --- a/arch/xtensa/src/lx7/Toolchain.defs +++ b/arch/xtensa/src/lx7/Toolchain.defs @@ -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 diff --git a/arch/z80/src/ez80/Toolchain.defs b/arch/z80/src/ez80/Toolchain.defs index 10821d2483..1a818199c7 100644 --- a/arch/z80/src/ez80/Toolchain.defs +++ b/arch/z80/src/ez80/Toolchain.defs @@ -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. diff --git a/boards/arm/cxd56xx/spresense/scripts/Make.defs b/boards/arm/cxd56xx/spresense/scripts/Make.defs index ad457edd4b..16dfaa719a 100644 --- a/boards/arm/cxd56xx/spresense/scripts/Make.defs +++ b/boards/arm/cxd56xx/spresense/scripts/Make.defs @@ -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 diff --git a/boards/arm/imx6/sabre-6quad/scripts/Make.defs b/boards/arm/imx6/sabre-6quad/scripts/Make.defs index 532764d003..e15fcd078e 100644 --- a/boards/arm/imx6/sabre-6quad/scripts/Make.defs +++ b/boards/arm/imx6/sabre-6quad/scripts/Make.defs @@ -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 diff --git a/boards/arm/lc823450/lc823450-xgevk/scripts/Make.defs b/boards/arm/lc823450/lc823450-xgevk/scripts/Make.defs index 400e4729d6..c1e8f04ea6 100644 --- a/boards/arm/lc823450/lc823450-xgevk/scripts/Make.defs +++ b/boards/arm/lc823450/lc823450-xgevk/scripts/Make.defs @@ -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" diff --git a/boards/arm/phy62xx/phy6222/scripts/Make.defs b/boards/arm/phy62xx/phy6222/scripts/Make.defs index 629b3b6d5d..b51fb4bf55 100644 --- a/boards/arm/phy62xx/phy6222/scripts/Make.defs +++ b/boards/arm/phy62xx/phy6222/scripts/Make.defs @@ -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 diff --git a/boards/arm/stm32/b-g431b-esc1/scripts/Make.defs b/boards/arm/stm32/b-g431b-esc1/scripts/Make.defs index 6d53b770b8..a526d4b902 100644 --- a/boards/arm/stm32/b-g431b-esc1/scripts/Make.defs +++ b/boards/arm/stm32/b-g431b-esc1/scripts/Make.defs @@ -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: diff --git a/boards/arm/stm32/b-g474e-dpow1/scripts/Make.defs b/boards/arm/stm32/b-g474e-dpow1/scripts/Make.defs index c774504438..db270148fc 100644 --- a/boards/arm/stm32/b-g474e-dpow1/scripts/Make.defs +++ b/boards/arm/stm32/b-g474e-dpow1/scripts/Make.defs @@ -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: diff --git a/boards/arm/stm32/nucleo-g431kb/scripts/Make.defs b/boards/arm/stm32/nucleo-g431kb/scripts/Make.defs index 5233f43700..ed43db161d 100755 --- a/boards/arm/stm32/nucleo-g431kb/scripts/Make.defs +++ b/boards/arm/stm32/nucleo-g431kb/scripts/Make.defs @@ -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: diff --git a/boards/arm/stm32/nucleo-g431rb/scripts/Make.defs b/boards/arm/stm32/nucleo-g431rb/scripts/Make.defs index 13f822b3f4..b761097bb8 100644 --- a/boards/arm/stm32/nucleo-g431rb/scripts/Make.defs +++ b/boards/arm/stm32/nucleo-g431rb/scripts/Make.defs @@ -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: diff --git a/boards/arm/stm32/photon/scripts/Make.defs b/boards/arm/stm32/photon/scripts/Make.defs index c99f415403..b5e438190e 100644 --- a/boards/arm/stm32/photon/scripts/Make.defs +++ b/boards/arm/stm32/photon/scripts/Make.defs @@ -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 diff --git a/boards/arm/stm32/stm32f103-minimum/scripts/Make.defs b/boards/arm/stm32/stm32f103-minimum/scripts/Make.defs index def2af90ae..9baeb4403b 100644 --- a/boards/arm/stm32/stm32f103-minimum/scripts/Make.defs +++ b/boards/arm/stm32/stm32f103-minimum/scripts/Make.defs @@ -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 diff --git a/boards/arm/stm32/stm32f4discovery/scripts/Make.defs b/boards/arm/stm32/stm32f4discovery/scripts/Make.defs index 2e9806128e..15a1b12afd 100644 --- a/boards/arm/stm32/stm32f4discovery/scripts/Make.defs +++ b/boards/arm/stm32/stm32f4discovery/scripts/Make.defs @@ -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 diff --git a/boards/mips/pic32mz/chipkit-wifire/scripts/Make.defs b/boards/mips/pic32mz/chipkit-wifire/scripts/Make.defs index 45daea2dbd..4f6e84bced 100644 --- a/boards/mips/pic32mz/chipkit-wifire/scripts/Make.defs +++ b/boards/mips/pic32mz/chipkit-wifire/scripts/Make.defs @@ -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 diff --git a/boards/mips/pic32mz/flipnclick-pic32mz/scripts/Make.defs b/boards/mips/pic32mz/flipnclick-pic32mz/scripts/Make.defs index 4af862cbb2..d8aa5ff6d5 100644 --- a/boards/mips/pic32mz/flipnclick-pic32mz/scripts/Make.defs +++ b/boards/mips/pic32mz/flipnclick-pic32mz/scripts/Make.defs @@ -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 diff --git a/boards/mips/pic32mz/pic32mz-starterkit/scripts/Make.defs b/boards/mips/pic32mz/pic32mz-starterkit/scripts/Make.defs index db611e57c5..f2c46053bc 100644 --- a/boards/mips/pic32mz/pic32mz-starterkit/scripts/Make.defs +++ b/boards/mips/pic32mz/pic32mz-starterkit/scripts/Make.defs @@ -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 diff --git a/boards/risc-v/bl602/bl602evb/scripts/Make.defs b/boards/risc-v/bl602/bl602evb/scripts/Make.defs index 90b57409c5..59897b407d 100644 --- a/boards/risc-v/bl602/bl602evb/scripts/Make.defs +++ b/boards/risc-v/bl602/bl602evb/scripts/Make.defs @@ -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 diff --git a/boards/risc-v/c906/smartl-c906/scripts/Make.defs b/boards/risc-v/c906/smartl-c906/scripts/Make.defs index c906417474..ea3408ab04 100644 --- a/boards/risc-v/c906/smartl-c906/scripts/Make.defs +++ b/boards/risc-v/c906/smartl-c906/scripts/Make.defs @@ -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 diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/scripts/Make.defs b/boards/risc-v/esp32c3/esp32c3-devkit/scripts/Make.defs index 6f618131b2..f857d2af8e 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/scripts/Make.defs +++ b/boards/risc-v/esp32c3/esp32c3-devkit/scripts/Make.defs @@ -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 diff --git a/boards/risc-v/fe310/hifive1-revb/scripts/Make.defs b/boards/risc-v/fe310/hifive1-revb/scripts/Make.defs index 561f9aff0a..6b8f9ae69e 100644 --- a/boards/risc-v/fe310/hifive1-revb/scripts/Make.defs +++ b/boards/risc-v/fe310/hifive1-revb/scripts/Make.defs @@ -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 diff --git a/boards/risc-v/k210/maix-bit/scripts/Make.defs b/boards/risc-v/k210/maix-bit/scripts/Make.defs index a1758c88d5..d8aea87887 100644 --- a/boards/risc-v/k210/maix-bit/scripts/Make.defs +++ b/boards/risc-v/k210/maix-bit/scripts/Make.defs @@ -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 diff --git a/boards/risc-v/litex/arty_a7/scripts/Make.defs b/boards/risc-v/litex/arty_a7/scripts/Make.defs index ca1fe5b6b8..33510446be 100644 --- a/boards/risc-v/litex/arty_a7/scripts/Make.defs +++ b/boards/risc-v/litex/arty_a7/scripts/Make.defs @@ -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 diff --git a/boards/risc-v/mpfs/icicle/scripts/Make.defs b/boards/risc-v/mpfs/icicle/scripts/Make.defs index fc7b2176c1..b13aeee99e 100755 --- a/boards/risc-v/mpfs/icicle/scripts/Make.defs +++ b/boards/risc-v/mpfs/icicle/scripts/Make.defs @@ -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 diff --git a/boards/risc-v/mpfs/m100pfsevp/scripts/Make.defs b/boards/risc-v/mpfs/m100pfsevp/scripts/Make.defs index a95f85efe2..a15e261d01 100755 --- a/boards/risc-v/mpfs/m100pfsevp/scripts/Make.defs +++ b/boards/risc-v/mpfs/m100pfsevp/scripts/Make.defs @@ -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 diff --git a/boards/risc-v/qemu-rv/rv-virt/scripts/Make.defs b/boards/risc-v/qemu-rv/rv-virt/scripts/Make.defs index d56039a894..e8ec54e86d 100644 --- a/boards/risc-v/qemu-rv/rv-virt/scripts/Make.defs +++ b/boards/risc-v/qemu-rv/rv-virt/scripts/Make.defs @@ -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 diff --git a/boards/risc-v/rv32m1/rv32m1-vega/scripts/Make.defs b/boards/risc-v/rv32m1/rv32m1-vega/scripts/Make.defs index 0bc04d0c14..4c623ba66f 100644 --- a/boards/risc-v/rv32m1/rv32m1-vega/scripts/Make.defs +++ b/boards/risc-v/rv32m1/rv32m1-vega/scripts/Make.defs @@ -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 diff --git a/boards/xtensa/esp32/esp32-devkitc/scripts/Make.defs b/boards/xtensa/esp32/esp32-devkitc/scripts/Make.defs index f9f73f3745..afa6a7c39e 100644 --- a/boards/xtensa/esp32/esp32-devkitc/scripts/Make.defs +++ b/boards/xtensa/esp32/esp32-devkitc/scripts/Make.defs @@ -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 diff --git a/boards/xtensa/esp32/esp32-ethernet-kit/scripts/Make.defs b/boards/xtensa/esp32/esp32-ethernet-kit/scripts/Make.defs index 18447585ca..30778dbd9e 100644 --- a/boards/xtensa/esp32/esp32-ethernet-kit/scripts/Make.defs +++ b/boards/xtensa/esp32/esp32-ethernet-kit/scripts/Make.defs @@ -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 diff --git a/boards/xtensa/esp32/esp32-wrover-kit/scripts/Make.defs b/boards/xtensa/esp32/esp32-wrover-kit/scripts/Make.defs index 05b597ad9c..855a8c1994 100644 --- a/boards/xtensa/esp32/esp32-wrover-kit/scripts/Make.defs +++ b/boards/xtensa/esp32/esp32-wrover-kit/scripts/Make.defs @@ -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 diff --git a/boards/xtensa/esp32/ttgo_lora_esp32/scripts/Make.defs b/boards/xtensa/esp32/ttgo_lora_esp32/scripts/Make.defs index a9946516dd..b459003113 100644 --- a/boards/xtensa/esp32/ttgo_lora_esp32/scripts/Make.defs +++ b/boards/xtensa/esp32/ttgo_lora_esp32/scripts/Make.defs @@ -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 diff --git a/boards/xtensa/esp32s2/esp32s2-saola-1/scripts/Make.defs b/boards/xtensa/esp32s2/esp32s2-saola-1/scripts/Make.defs index 48041c88f9..828e3b07da 100644 --- a/boards/xtensa/esp32s2/esp32s2-saola-1/scripts/Make.defs +++ b/boards/xtensa/esp32s2/esp32s2-saola-1/scripts/Make.defs @@ -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 diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/scripts/Make.defs b/boards/xtensa/esp32s3/esp32s3-devkit/scripts/Make.defs index 6031b03d12..79396a053c 100644 --- a/boards/xtensa/esp32s3/esp32s3-devkit/scripts/Make.defs +++ b/boards/xtensa/esp32s3/esp32s3-devkit/scripts/Make.defs @@ -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