gustavonihei edited a comment on pull request #3836:
URL: https://github.com/apache/incubator-nuttx/pull/3836#issuecomment-853785193


   > It is not so simple.
   > 
   > ```
   > LD: nuttx
   > arm-none-eabi-gcc: error: unrecognized command line option '--start-group'
   > arm-none-eabi-gcc: error: unrecognized command line option '--end-group'
   > ```
   
   Yeah, these flags and some others are specific to LD, so when provided to 
the GCC frontend they must be provided with `-Wl,--start-group`
   
   Other changes that I have locally here for a previous attempt to enable the 
LTO build:
   
   ```patch
   -LDSTARTGROUP ?= --start-group
   -LDENDGROUP ?= --end-group
   +LDSTARTGROUP ?= -Wl,--start-group
   +LDENDGROUP ?= -Wl,--end-group
    LDFLAGS += $(ARCHSCRIPT)
    
    BOARDMAKE = $(if $(wildcard board$(DELIM)Makefile),y,)
   @@ -103,7 +103,7 @@ board/libboard$(LIBEXT):
    
    nuttx$(EXEEXT): $(STARTUP_OBJS) board/libboard$(LIBEXT)
           @echo "LD: nuttx"
   -       $(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \
   +       $(Q) $(LD) -Wl,--entry=__start $(LDFLAGS) $(LIBPATHS) 
$(EXTRA_LIBPATHS) \
                   -o $(NUTTX) $(STARTUP_OBJS) $(EXTRA_OBJS) \
                   $(LDSTARTGROUP) $(LDLIBS) $(EXTRA_LIBS) $(LDENDGROUP)
    ifneq ($(CONFIG_WINDOWS_NATIVE),y)
   ```
   ```patch
    ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
   -  LDFLAGS += -Map="${shell cygpath -w $(TOPDIR)/nuttx.map}" --cref
   +  LDFLAGS += -Wl,-Map="${shell cygpath -w $(TOPDIR)/nuttx.map}" -Wl,--cref
    else
   -  LDFLAGS += -Map=$(TOPDIR)/nuttx.map --cref
   +  LDFLAGS += -Wl,-Map=$(TOPDIR)/nuttx.map -Wl,--cref
    endif
    
    ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
   ```


-- 
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.

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


Reply via email to