This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new ca8ebfd4e Application.mk: Give the program attributes to gcc with -Wl,.
ca8ebfd4e is described below
commit ca8ebfd4ee4bc174ecbdfb064b34463a9719256e
Author: Marco Casaroli <[email protected]>
AuthorDate: Wed Oct 21 00:22:09 2026 +0200
Application.mk: Give the program attributes to gcc with -Wl,.
With CONFIG_LTO_FULL (GCC), LD is the compiler driver, and a loadable
module (and a program of a kernel build) is linked with it, because
MODULELD defaults to LD. Application.mk gave the program attributes
as "--defsym nx_stacksize=...", and gcc stopped with "unrecognized
command-line option '--defsym'".
Where Application.mk sets MODLDFLAGS, it now also sets MODDEFSYM:
"-Wl,--defsym=" when MODULELD is gcc or clang, and "--defsym=" for ld.
A link with ld gets "--defsym=sym=value" in place of "--defsym sym
value", which GNU ld and ld.lld read the same way.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <[email protected]>
---
Application.mk | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/Application.mk b/Application.mk
index 8606e5d3a..9ff99450f 100644
--- a/Application.mk
+++ b/Application.mk
@@ -38,6 +38,14 @@ ifneq ($(MAINSRC),)
MODCXXFLAGS = $(CXXELFFLAGS)
MODLDFLAGS = $(LDELFFLAGS)
endif
+
+ # The compiler driver (CONFIG_LTO_FULL) takes a linker option with -Wl,
+
+ ifneq ($(filter %gcc %clang,$(firstword $(MODULELD))),)
+ MODDEFSYM = -Wl,--defsym=
+ else
+ MODDEFSYM = --defsym=
+ endif
endif
# The GNU make CURDIR will always be a POSIX-like path with forward slashes
@@ -140,13 +148,13 @@ ifneq ($(strip $(PROGNAME)),)
# Per-target so each PROGLIST entry picks up its own STACKSIZE_/PRIORITY_.
$(PROGLIST): MODLDFLAGS += \
- $(if $(STACKSIZE_$@),--defsym nx_stacksize=$(STACKSIZE_$@)) \
- $(if $(filter-out SCHED_PRIORITY_DEFAULT,$(PRIORITY_$@)),--defsym
nx_priority=$(PRIORITY_$@))
+ $(if $(STACKSIZE_$@),$(MODDEFSYM)nx_stacksize=$(STACKSIZE_$@)) \
+ $(if $(filter-out
SCHED_PRIORITY_DEFAULT,$(PRIORITY_$@)),$(MODDEFSYM)nx_priority=$(PRIORITY_$@))
ifeq ($(CONFIG_SCHED_USER_IDENTITY),y)
$(PROGLIST): MODLDFLAGS += \
- $(if $(UID_$@),--defsym nx_uid=$(UID_$@)) \
- $(if $(GID_$@),--defsym nx_gid=$(GID_$@)) \
- $(if $(MODE_$@),--defsym nx_mode=$(MODE_$@))
+ $(if $(UID_$@),$(MODDEFSYM)nx_uid=$(UID_$@)) \
+ $(if $(GID_$@),$(MODDEFSYM)nx_gid=$(GID_$@)) \
+ $(if $(MODE_$@),$(MODDEFSYM)nx_mode=$(MODE_$@))
endif
# Keep the attribute symbols through --strip-unneeded so the binary loader