casaroli commented on code in PR #3884:
URL: https://github.com/apache/nuttx-apps/pull/3884#discussion_r4331226078


##########
Make.defs:
##########
@@ -72,6 +72,21 @@ BINDIR_DEBUG ?= $(APPDIR)$(DELIM)bin_debug
 
 BUILD_SHARED_LIBRARY ?= $(APPDIR)$(DELIM)Library.mk
 
+# With CONFIG_LTO_FULL the gcc driver links a module.  A partial link (-r)
+# must compile the LTO objects to machine code, with the module options
+# (-mthumb, -mlong-calls, ...): the loader cannot use LTO data.
+
+ifneq ($(filter %gcc,$(firstword $(MODULELD))),)
+  ifneq ($(filter -r,$(LDMODULEFLAGS)),)
+    LDMODULEFLAGS += -flinker-output=nolto-rel \

Review Comment:
   Done: the arm, arm64 and risc-v `Toolchain.defs` now set 
`-flinker-output=nolto-rel`, the module options and `-Wno-error` in 
`LDMODULEFLAGS` and `LDELFFLAGS` when gcc does the partial link 
(apache/nuttx#20846), and the `Make.defs` part is gone from this PR. This PR 
now only gives the program attributes to the gcc driver as `-Wl,--defsym=` in 
`Application.mk`. With both, an LTO module on `qemu-armv8a:nsh` loads and 
prints `Hello, World!!`.
   



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