Application.mk: emit application attribute as ELF symbols#3641
Open
anjiahao1 wants to merge 1 commit into
Open
Application.mk: emit application attribute as ELF symbols#3641anjiahao1 wants to merge 1 commit into
anjiahao1 wants to merge 1 commit into
Conversation
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>
5 tasks
xiaoxiang781216
approved these changes
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
uid/gid/modeunderCONFIG_SCHED_USER_IDENTITY) as absolute ELFsymbols (
nx_stacksize,nx_priority,nx_uid,nx_gid,nx_mode)via
--defsyminMODLDFLAGS, so the NuttX binary loader can recoverthem at load time.
$(PROGLIST)entry picks up itsown
STACKSIZE_/PRIORITY_/...), and only emits a symbol when theapplication actually configures that attribute.
nx_*symbols through--strip-unneeded(via-K) so theysurvive in the stripped runtime image under
bin/.(
BUILD_MODULEinstead ofDYNLIB), matching the kernel-build modelwhere apps are loaded as file ELFs.
Impact
application attributes are embedded as ELF symbols for the loader.
only emitted when configured; otherwise behavior is unchanged.
links now carry
--defsym nx_*flags and the strippedbin/imageretains those symbols.
heapsizeis intentionally not emitted (depends on the separatetask-heap feature); a typo in the original (
nx_mod/wrong source) isfixed to
nx_modefromMODE.teaches
binfmt/elf.cto parse these symbols.Testing
I confirm that changes are verified on local setup and works as intended:
qemu-armv7a:knsh(CONFIG_BUILD_KERNEL), apps built from../appsand mounted via hostfs as/system.makethenmake installin the apps tree (kernel-build moduleELFs).
qemu-system-arm -semihosting -M virt -m 1024 -nographic -kernel ./nuttxTesting logs after change (the
getprimeapp, configured withSTACKSIZE=8192/PRIORITY=50, carries the symbols into the strippedruntime ELF, and the loaded task honors them):
hello,ostest,init(NSH) all build and run; no regression onknsh. (nx_stacksize/nx_priorityare retained inbin/after--strip-unneededthanks to-K.)PR verification Self-Check