arch: Add --whole-archive linker option for some of architectures

Add Kconfig option that enable --whole-archive linker option for some of architectures

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
This commit is contained in:
yanghuatao
2024-06-27 16:59:08 +02:00
committed by Xiang Xiao
parent 7afee44c22
commit 7e342b3422
10 changed files with 62 additions and 0 deletions
+8
View File
@@ -2483,6 +2483,14 @@ config DEBUG_OPT_UNUSED_SECTIONS
linker by compiling with " -ffunction-sections -fdata-sections ", and
linking with " --gc-sections ".
config DEBUG_LINK_WHOLE_ARCHIVE
bool "Force every object to be included in the resulting shared library."
default n
depends on DEBUG_OPT_UNUSED_SECTIONS
---help---
Selecting this option will pass "--whole-archive" to ld
when linking NuttX ELF.
config DEBUG_LINK_MAP
bool "Generate link map file"
default y
+6
View File
@@ -157,6 +157,12 @@ if(CONFIG_DEBUG_OPT_UNUSED_SECTIONS)
add_compile_options(-ffunction-sections -fdata-sections)
endif()
# Debug --whole-archive
if(CONFIG_DEBUG_LINK_WHOLE_ARCHIVE)
add_link_options(-Wl,--whole-archive)
endif()
if(CONFIG_ENDIAN_BIG)
add_compile_options(-mbig-endian)
endif()
+6
View File
@@ -351,6 +351,12 @@ ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),)
endif
endif
# Debug --whole-archive
ifeq ($(CONFIG_DEBUG_LINK_WHOLE_ARCHIVE),y)
LDFLAGS += --whole-archive
endif
# Debug link map
ifeq ($(CONFIG_DEBUG_LINK_MAP),y)
+6
View File
@@ -137,6 +137,12 @@ ifeq ($(CONFIG_DEBUG_OPT_UNUSED_SECTIONS),y)
ARCHOPTIMIZATION += -ffunction-sections -fdata-sections
endif
# Debug --whole-archive
ifeq ($(CONFIG_DEBUG_LINK_WHOLE_ARCHIVE),y)
LDFLAGS += --whole-archive
endif
# Debug link map
ifeq ($(CONFIG_DEBUG_LINK_MAP),y)
+6
View File
@@ -249,6 +249,12 @@ ifeq ($(CONFIG_DEBUG_OPT_UNUSED_SECTIONS),y)
ARCHOPTIMIZATION += -ffunction-sections -fdata-sections
endif
# Debug --whole-archive
ifeq ($(CONFIG_DEBUG_LINK_WHOLE_ARCHIVE),y)
LDFLAGS += --whole-archive
endif
# Debug link map
ifeq ($(CONFIG_DEBUG_LINK_MAP),y)
+6
View File
@@ -197,6 +197,12 @@ if(CONFIG_DEBUG_OPT_UNUSED_SECTIONS)
add_compile_options(-ffunction-sections -fdata-sections)
endif()
# Debug --whole-archive
if(CONFIG_DEBUG_LINK_WHOLE_ARCHIVE)
add_link_options(-Wl,--whole-archive)
endif()
add_link_options(-nostdlib)
add_link_options(-Wl,--entry=__start)
+6
View File
@@ -137,6 +137,12 @@ endif
LDFLAGS += -nostdlib
ARCHOPTIMIZATION += -nostdlib
# Debug --whole-archive
ifeq ($(CONFIG_DEBUG_LINK_WHOLE_ARCHIVE),y)
LDFLAGS += --whole-archive
endif
# Debug link map
ifeq ($(CONFIG_DEBUG_LINK_MAP),y)
+6
View File
@@ -149,6 +149,12 @@ ifeq ($(CONFIG_DEBUG_LINK_MAP),y)
LDFLAGS += --cref -Map=$(call CONVERT_PATH,$(TOPDIR)$(DELIM)nuttx.map)
endif
# Debug --whole-archive
ifeq ($(CONFIG_DEBUG_LINK_WHOLE_ARCHIVE),y)
LDFLAGS += --whole-archive
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATION += -g
endif
+6
View File
@@ -147,6 +147,12 @@ ifeq ($(CONFIG_DEBUG_OPT_UNUSED_SECTIONS),y)
ARCHOPTIMIZATION += -ffunction-sections -fdata-sections
endif
# Debug --whole-archive
ifeq ($(CONFIG_DEBUG_LINK_WHOLE_ARCHIVE),y)
LDFLAGS += --whole-archive
endif
# Debug link map
ifeq ($(CONFIG_DEBUG_LINK_MAP),y)
+6
View File
@@ -79,6 +79,12 @@ ifeq ($(CONFIG_DEBUG_OPT_UNUSED_SECTIONS),y)
ARCHOPTIMIZATION += -ffunction-sections -fdata-sections
endif
# Debug --whole-archive
ifeq ($(CONFIG_DEBUG_LINK_WHOLE_ARCHIVE),y)
LDFLAGS += --whole-archive
endif
# Debug link map
ifeq ($(CONFIG_DEBUG_LINK_MAP),y)