From 1e24fc94f74f25ff77b88efe280d15066a0e3694 Mon Sep 17 00:00:00 2001 From: wangmingrong1 Date: Tue, 5 Nov 2024 14:42:18 +0800 Subject: [PATCH] toolchains: Compiler versioning adds --print-memory-usage --- arch/arm/src/common/Toolchain.defs | 20 ++++++++++++-------- arch/arm64/src/Toolchain.defs | 1 - 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/arch/arm/src/common/Toolchain.defs b/arch/arm/src/common/Toolchain.defs index ac37f8396ea..ba571237ade 100644 --- a/arch/arm/src/common/Toolchain.defs +++ b/arch/arm/src/common/Toolchain.defs @@ -312,14 +312,18 @@ else # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523 ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y) - ifeq ($(GCCVER),) - export GCCVER := $(shell $(CC) --version | grep gcc | sed -E "s/.* ([0-9]+\.[0-9]+).*/\1/" | cut -d'.' -f1) - 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 + ifeq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),) + ifeq ($(GCCVER),) + export GCCVER := $(shell $(CC) --version | grep gcc | sed -E "s/.* ([0-9]+\.[0-9]+).*/\1/" | cut -d'.' -f1) + 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),) + LDFLAGS += --no-warn-rwx-segments + endif endif endif endif diff --git a/arch/arm64/src/Toolchain.defs b/arch/arm64/src/Toolchain.defs index 1da73fb715b..00c484d7228 100644 --- a/arch/arm64/src/Toolchain.defs +++ b/arch/arm64/src/Toolchain.defs @@ -207,7 +207,6 @@ ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y) endif ifeq ($(shell expr "$(GCCVER)" \>= 12), 1) - LDFLAGS += --no-warn-rwx-segments LDFLAGS += --print-memory-usage endif endif