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


##########
arch/arm/src/Makefile:
##########
@@ -138,6 +138,15 @@ $(KBIN): $(OBJS)
 board$(DELIM)libboard$(LIBEXT):
        $(Q) $(MAKE) -C board libboard$(LIBEXT) EXTRAFLAGS="$(EXTRAFLAGS)"
 
+ifeq ($(CONFIG_LTO_FULL),y)
+  ifeq (,$(findstring("gcc", $(notdir $(LD)))))
+    LDSTARTGROUP := $(addprefix -Xlinker ,$(LDSTARTGROUP))
+    LDENDGROUP   := $(addprefix -Xlinker ,$(LDENDGROUP))
+    LDFLAGS      := $(addprefix -Xlinker ,$(LDFLAGS))
+    LDFLAGS      += $(CFLAGS)
+  endif
+endif

Review Comment:
   I see
   ```
   LDSTARTGROUP ?= --start-group
   LDENDGROUP ?= --end-group
   ```
   at line 92 and 93. Is it possible to change it to more agnostic variant like
   ```
   ifeq ($(LD),$(CC))
     LDSTARTGROUP ?= -Wl,--start-group
     LDENDGROUP ?= -Wl,--end-group
   else
     LDSTARTGROUP ?= --start-group
     LDENDGROUP ?= --end-group
   endif
   ```
   I'm not sure if that is reasonable, but maybe can be explored. I mean that 
linking with `ld` or `gcc` should not depend on `CONFIG_LTO_FULL=y` or 
`CONFIG_LTO_FULL=n`.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to