You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2026/10/18 18:18:10 UTC

(nuttx) 02/03: arch/arm: Let GCC run the LTRANS jobs in parallel with LTO.

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit d2dbed685713f0431b83f4e191df9b7988024499
Author: Marco Casaroli <ma...@gmail.com>
AuthorDate: Sun Oct 18 14:51:03 2026 +0200

    arch/arm: Let GCC run the LTRANS jobs in parallel with LTO.
    
    With CONFIG_LTO_FULL, GCC got -flto without a number of jobs, so
    lto-wrapper compiled the LTRANS units one after the other and warned:
    
      lto-wrapper: warning: using serial compilation of 2 LTRANS jobs
    
    Use -flto=auto: GCC uses the jobserver of make, or else one job per
    CPU.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <ma...@gmail.com>
---
 arch/arm/src/cmake/gcc.cmake       | 2 +-
 arch/arm/src/common/Toolchain.defs | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/arm/src/cmake/gcc.cmake b/arch/arm/src/cmake/gcc.cmake
index b11518bab32..acbdada38f0 100644
--- a/arch/arm/src/cmake/gcc.cmake
+++ b/arch/arm/src/cmake/gcc.cmake
@@ -184,7 +184,7 @@ endif()
 if(CONFIG_LTO_THIN)
   add_compile_options(-flto=thin)
 elseif(CONFIG_LTO_FULL)
-  add_compile_options(-flto)
+  add_compile_options(-flto=auto)
   add_compile_options(-fuse-linker-plugin)
 elseif(CONFIG_LTO_FAT)
   add_compile_options(-flto -ffat-lto-objects)
diff --git a/arch/arm/src/common/Toolchain.defs b/arch/arm/src/common/Toolchain.defs
index 787e048fcd9..deea8116de3 100644
--- a/arch/arm/src/common/Toolchain.defs
+++ b/arch/arm/src/common/Toolchain.defs
@@ -142,9 +142,10 @@ ifeq ($(CONFIG_LTO_THIN),y)
     LDFLAGS += --lto
   endif
 else ifeq ($(CONFIG_LTO_FULL),y)
-  ARCHOPTIMIZATION += -flto
   ifeq ($(CONFIG_ARM_TOOLCHAIN_GNU_EABI),y)
-    ARCHOPTIMIZATION += -fuse-linker-plugin
+    ARCHOPTIMIZATION += -flto=auto -fuse-linker-plugin
+  else
+    ARCHOPTIMIZATION += -flto
   endif
   ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),y)
     LDFLAGS += --lto