casaroli commented on code in PR #3884:
URL: https://github.com/apache/nuttx-apps/pull/3884#discussion_r4319069542
##########
Application.mk:
##########
@@ -134,19 +134,37 @@ ifneq ($(strip $(PROGNAME)),)
$(eval MODE_$(word $i,$(PROGLIST)) := $(MODE_$(word $i,$(REGLIST)))) \
)
+ # With CONFIG_LTO_FULL the compiler driver links the module: a linker
+ # option needs -Wl, and a partial link (-r) must compile the LTO objects
+ # to machine code with the compile options (-mthumb, -mlong-calls, ...),
+ # as the loader cannot use LTO data.
+
+ ifneq ($(filter %gcc %clang,$(firstword $(MODULELD))),)
+ DEFSYM = -Wl,--defsym=
+ else
+ DEFSYM = --defsym=
+ endif
+
+ ifneq ($(filter %gcc,$(firstword $(MODULELD))),)
+ ifneq ($(filter -r,$(MODLDFLAGS)),)
+ MODLDFLAGS += -flinker-output=nolto-rel \
Review Comment:
Done. Make.defs now adds the options to LDMODULEFLAGS and LDELFFLAGS, so
MODLDFLAGS has them from its first definition, and MODDEFSYM is set next to it.
The arch Toolchain.defs of nuttx is not the place: several board Make.defs
files set LDELFFLAGS or LDMODULEFLAGS again, and mkexport.sh sets LDMODULEFLAGS
to -r.
##########
Library.mk:
##########
@@ -66,6 +66,17 @@ LOCAL_CXX_OBJS :=
$(LOCAL_CXX_SRCS:%=$(LOCAL_PREFIX)%$(LOCAL_SUFFIX)$(OBJEXT))
LOCAL_OBJS := $(LOCAL_C_OBJS) $(LOCAL_CC_OBJS) $(LOCAL_CPP_OBJS) \
$(LOCAL_CXX_OBJS)
+# With CONFIG_LTO_FULL the compiler driver links the library: a partial
+# link (-r) must compile the LTO objects to machine code with the compile
+# options.
+
+ifneq ($(filter %gcc,$(firstword $(MODULELD))),)
+ ifneq ($(filter -r,$(LDMODULEFLAGS)),)
+ LDMODULEFLAGS += -flinker-output=nolto-rel \
Review Comment:
Done.
--
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]