xiaoxiang781216 commented on a change in pull request #95: Avoid calling
ARCHIVE in multiple places (again)
URL:
https://github.com/apache/incubator-nuttx-apps/pull/95#discussion_r384274672
##########
File path: Application.mk
##########
@@ -163,6 +157,9 @@ endif
install:: $(PROGLIST)
+show-objs:
Review comment:
The right sequence is:
1.Compile all source files(except main) and archieve into libapps.a
Note: this is done step by step, with this patch we do it in one step
2.Compile main source file and link with libapps.a to get the executable
Note:
a.For non kernel build, the executable still contian the unresolved
symbols outside libapps.a(.e.g. printf, open...).
b.For kernel build, since LDLIBS contain all userspace library, the
executable is totally self contained.
c.NuttX support the explicit dynamic loading, but not implicit dynamic
loading now, which mean that the executable must be self contained in kernel
mode, but it can call dlopen to load the shared library manully.
3.Generate symbols source file from all exectuable unresolved symbols
Note: For kernel build, symbol table should be empty as note 2.b.
4.Compile and archieve symbols source file into libapps.a
Note: this is required for two reason:
a.binfmt need the symbol table to load the exectutable at runtime
b.symbol table ensure the linker don't remove these unresolved symbols
5.libapps.a link with other libarary to get nuttx.bin or userspace.bin
Note: this just happen for flat and protected build, all exectuable need put
into the file system and load through binfmt subsytem in kernel build, no big
image blob(nuttx.bin or userspace.bin) exist at all.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services