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:
parent
7afee44c22
commit
7e342b3422
8
Kconfig
8
Kconfig
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue