You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/04/21 15:37:20 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6123: arch/arm: add support for GCC LTO

xiaoxiang781216 commented on code in PR #6123:
URL: https://github.com/apache/incubator-nuttx/pull/6123#discussion_r855324630


##########
arch/arm/src/arm/Toolchain.defs:
##########
@@ -113,15 +113,28 @@ endif
 
 # Default toolchain
 
-CC = $(CROSSDEV)gcc
-CXX = $(CROSSDEV)g++
-CPP = $(CROSSDEV)gcc -E -P -x c
-LD = $(CROSSDEV)ld
-STRIP = $(CROSSDEV)strip --strip-unneeded
-AR = $(CROSSDEV)ar rcs
-NM = $(CROSSDEV)nm
+CC      = $(CROSSDEV)gcc
+CXX     = $(CROSSDEV)g++
+CPP     = $(CROSSDEV)gcc -E -P -x c
+STRIP   = $(CROSSDEV)strip --strip-unneeded
 OBJCOPY = $(CROSSDEV)objcopy
 OBJDUMP = $(CROSSDEV)objdump
+LD      = $(CROSSDEV)ld
+AR      = $(CROSSDEV)ar rcs
+NM      = $(CROSSDEV)nm
+
+# Link Time Optimization
+
+ifeq ($(CONFIG_LTO_FULL),y)
+  MAXOPTIMIZATION += -flto
+  ifeq ($(CONFIG_ARM_TOOLCHAIN),GNU_EABI)
+    MAXOPTIMIZATION += -fuse-linker-plugin
+    MAXOPTIMIZATION += -fno-builtin
+    LD := $(CROSSDEV)gcc

Review Comment:
   why link with ld when CONFIG_LTO_FULL==n, but with gcc when CONFIG_LTO_FULL==y? and complicate src/arm/Makefile.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org