mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
Application.mk:define application attribute in elf symbol
Emit --defsym for nx_stacksize, nx_priority (and nx_uid/nx_gid/nx_mode under CONFIG_SCHED_USER_IDENTITY) into MODLDFLAGS so the ELF binary loader can recover the application's configured attributes at load time. Also skip builtin registration for separately-built module ELFs (BUILD_MODULE instead of DYNLIB). Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
parent
eceb30e59c
commit
bf5e567bc0
1 changed files with 27 additions and 2 deletions
|
|
@ -133,7 +133,32 @@ ifneq ($(strip $(PROGNAME)),)
|
|||
$(if $(word $i,$(GID)),$(word $i,$(GID)),$(lastword $(GID)))) \
|
||||
$(eval MODE_$(word $i,$(REGLIST)) := \
|
||||
$(if $(word $i,$(MODE)),$(word $i,$(MODE)),$(lastword $(MODE)))) \
|
||||
$(eval STACKSIZE_$(word $i,$(PROGLIST)) := $(STACKSIZE_$(word $i,$(REGLIST)))) \
|
||||
$(eval PRIORITY_$(word $i,$(PROGLIST)) := $(PRIORITY_$(word $i,$(REGLIST)))) \
|
||||
$(eval UID_$(word $i,$(PROGLIST)) := $(UID_$(word $i,$(REGLIST)))) \
|
||||
$(eval GID_$(word $i,$(PROGLIST)) := $(GID_$(word $i,$(REGLIST)))) \
|
||||
$(eval MODE_$(word $i,$(PROGLIST)) := $(MODE_$(word $i,$(REGLIST)))) \
|
||||
)
|
||||
|
||||
# Emit the application's configured attributes as absolute ELF symbols
|
||||
# (nx_stacksize, nx_priority, and nx_uid/nx_gid/nx_mode under
|
||||
# CONFIG_SCHED_USER_IDENTITY) so the binary loader can recover them.
|
||||
# Per-target so each PROGLIST entry picks up its own STACKSIZE_/PRIORITY_.
|
||||
|
||||
$(PROGLIST): SYM_PRIORITY = $(if $(filter SCHED_PRIORITY_DEFAULT,$(PRIORITY_$@)),0,$(PRIORITY_$@))
|
||||
$(PROGLIST): MODLDFLAGS += \
|
||||
$(if $(STACKSIZE_$@),--defsym nx_stacksize=$(STACKSIZE_$@)) \
|
||||
$(if $(PRIORITY_$@),--defsym nx_priority=$(SYM_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_$@))
|
||||
endif
|
||||
|
||||
# Keep the attribute symbols through --strip-unneeded so the binary loader
|
||||
# can still read them from the stripped runtime image in bin/.
|
||||
$(PROGLIST): NX_KEEP = $(if $(STACKSIZE_$@),-K nx_stacksize) $(if $(PRIORITY_$@),-K nx_priority) $(if $(UID_$@),-K nx_uid) $(if $(GID_$@),-K nx_gid) $(if $(MODE_$@),-K nx_mode)
|
||||
endif
|
||||
|
||||
# Condition flags
|
||||
|
|
@ -148,7 +173,7 @@ ifeq ($(WASM_BUILD),y)
|
|||
DO_REGISTRATION = n
|
||||
endif
|
||||
|
||||
ifeq ($(DYNLIB),y)
|
||||
ifeq ($(BUILD_MODULE),y)
|
||||
DO_REGISTRATION = n
|
||||
endif
|
||||
|
||||
|
|
@ -310,7 +335,7 @@ $(PROGLIST): $(MAINCOBJ) $(MAINCXXOBJ) $(MAINRUSTOBJ) $(MAINZIGOBJ) $(MAINDOBJ)
|
|||
ifneq ($(CONFIG_DEBUG_SYMBOLS),)
|
||||
$(Q) mkdir -p $(BINDIR_DEBUG)
|
||||
$(Q) cp $@ $(BINDIR_DEBUG)
|
||||
$(Q) $(MODULESTRIP) $@
|
||||
$(Q) $(MODULESTRIP) $(NX_KEEP) $@
|
||||
endif
|
||||
|
||||
install:: $(PROGLIST)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue