You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/09/26 10:23:34 UTC
[incubator-nuttx] branch master updated: arm/armlink: add support of link time optimization(lto)
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new a2cd1b0db3 arm/armlink: add support of link time optimization(lto)
a2cd1b0db3 is described below
commit a2cd1b0db3a9b37c056c94bb63cf2c6a7a192e5a
Author: chao an <an...@xiaomi.com>
AuthorDate: Mon Sep 26 13:55:24 2022 +0800
arm/armlink: add support of link time optimization(lto)
Optimization goal(Code size)
Smaller GCC(-Os) GCC(-flto -Os) CLANG(-flto -Oz) ARMCLANG(-flto -Oz/-Omin)
lm3s6965-ek/qemu-flat(Cortex-M3) 208662 193893 199525 195464
-7.07% -4.37% -6.32%
sabre-6quad/smp(Cortex-A9) 131360 122500 N/A 123988
-6.74% N/A -5.61%
Faster performance GCC(-O3) GCC(-flto -O3) CLANG(-flto -Ofast) ARMCLANG(-flto -Ofast) ARMCLANG(-flto -Omax)
lm3s6965-ek/qemu-flat(Cortex-M3) 257502 296364 369465 346696 384204
+15.00% +43.40% +34.60% +49.20%
sabre-6quad/smp(Cortex-A9) 166520 196004 N/A 207908 224140
+17.70% N/A +24.85% +34.60%
Reference:
https://developer.arm.com/documentation/101754/0618/armclang-Reference/armclang-Command-line-Options/-O--armclang-
Signed-off-by: chao an <an...@xiaomi.com>
---
arch/arm/src/common/Toolchain.defs | 11 +++++++++--
boards/arm/imx6/sabre-6quad/scripts/dramboot.sct | 2 +-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/arch/arm/src/common/Toolchain.defs b/arch/arm/src/common/Toolchain.defs
index 8c71515b9a..e8dee55235 100644
--- a/arch/arm/src/common/Toolchain.defs
+++ b/arch/arm/src/common/Toolchain.defs
@@ -78,11 +78,17 @@ endif
ifeq ($(CONFIG_LTO_THIN),y)
ARCHOPTIMIZATION += -flto=thin
+ ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),y)
+ LDFLAGS += --lto
+ endif
else ifeq ($(CONFIG_LTO_FULL),y)
ARCHOPTIMIZATION += -flto
ifeq ($(CONFIG_ARM_TOOLCHAIN_GNU_EABI),y)
ARCHOPTIMIZATION += -fuse-linker-plugin
endif
+ ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),y)
+ LDFLAGS += --lto
+ endif
endif
# NuttX buildroot under Linux or Cygwin
@@ -220,9 +226,10 @@ ifneq ($(CONFIG_CXX_RTTI),y)
endif
ARCHOPTIMIZATION += -fno-common -Wall -Wshadow -Wundef
-ARCHOPTIMIZATION += -nostdlib
-ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),)
+ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),y)
+ ARCHOPTIMIZATION += -nostdlib
+else
LDFLAGS += -nostdlib
endif
diff --git a/boards/arm/imx6/sabre-6quad/scripts/dramboot.sct b/boards/arm/imx6/sabre-6quad/scripts/dramboot.sct
index c93ab492bc..2c4509fa8e 100644
--- a/boards/arm/imx6/sabre-6quad/scripts/dramboot.sct
+++ b/boards/arm/imx6/sabre-6quad/scripts/dramboot.sct
@@ -101,7 +101,7 @@ OSCRAM_SECTIONS DDR3_START DDR3_SIZE
CONSTRUCTORS
}
- bss AlignExpr(ImageLimit(data), 0x8)
+ bss AlignExpr(ImageLimit(data), 0x10)
{
*(.bss)
*(.bss.*)