toolchains: Compiler versioning adds --print-memory-usage

1. The "-print-memory-usage" parameter introduced in GNU Link version 2.26

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
This commit is contained in:
wangmingrong1 2024-11-05 14:42:18 +08:00 committed by Xiang Xiao
parent 593b4bfbf5
commit 6381685a8b
4 changed files with 5 additions and 5 deletions

View file

@ -65,6 +65,7 @@ if(CONFIG_ARCH_TOOLCHAIN_GNU AND NOT CONFIG_ARCH_TOOLCHAIN_CLANG)
set(GCCVER ${CMAKE_MATCH_1})
if(GCCVER GREATER_EQUAL 12)
add_link_options(-Wl,--print-memory-usage)
add_compile_options(--param=min-pagesize=0)
if(CONFIG_ARCH_RAMFUNCS OR NOT CONFIG_BOOT_RUNFROMFLASH)
add_link_options(-Wl,--no-warn-rwx-segments)
@ -229,8 +230,6 @@ if(CONFIG_DEBUG_LINK_MAP)
add_link_options(-Wl,--cref -Wl,-Map=nuttx.map)
endif()
add_link_options(-Wl,--print-memory-usage)
if(CONFIG_DEBUG_SYMBOLS)
add_compile_options(${CONFIG_DEBUG_SYMBOLS_LEVEL})
endif()

View file

@ -318,6 +318,7 @@ else
endif
ifeq ($(shell expr "$(GCCVER)" \>= 12), 1)
ARCHOPTIMIZATION += --param=min-pagesize=0
LDFLAGS += --print-memory-usage
ifeq ($(CONFIG_ARCH_RAMFUNCS),y)
LDFLAGS += --no-warn-rwx-segments
else ifeq ($(CONFIG_BOOT_RUNFROMFLASH),)
@ -328,8 +329,6 @@ else
endif
LDFLAGS += --entry=__start
LDFLAGS += --print-memory-usage
endif
ifeq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),y)

View file

@ -197,6 +197,8 @@ ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
LDFLAGS += --no-warn-rwx-segments
endif
endif
ifeq ($(shell expr "$(GCCVER)" \>= 12), 1)
LDFLAGS += --print-memory-usage
endif
endif

View file

@ -198,8 +198,8 @@ if(CONFIG_ARCH_TOOLCHAIN_GNU AND NOT CONFIG_ARCH_TOOLCHAIN_CLANG)
set(GCCVER ${CMAKE_MATCH_1})
endif()
if(GCCVER GREATER_EQUAL 12)
add_link_options(-Wl,--print-memory-usage)
add_link_options(-Wl,--no-warn-rwx-segments)
endif()
add_link_options(-Wl,--print-memory-usage)
endif()