rtems dynamic loading with waf

Chris Johns chrisj at rtems.org
Thu Dec 29 08:52:01 UTC 2016


On 28/12/16 9:36 pm, Saeed Ehteshamifar wrote:
> Dear Xuelin,
> 
> I share the pointers I emailed you here. Maybe it'd be useful for
> someone else too.
> Instructions on how to build a DL app via WAF can be found at:
> http://rtems-fi.blogspot.com/2016/08/dynamic-linking-in-rtems.html

The blog post is not correct about loading being restricted due to
transferring object files on the fly. RTEMS will load any available obj
file and object files do not need to be bound into the base image using
tar, they just need to be available in a suitable file system. The
examples and tests bind the object files into the base image because we
cannot assume available media on a target, eg a simulator. A target with
a file system such as JFFS and networking could be updated externally
and the object files loaded from the JFFS file system.

The fact we require the same compiler flags to build the loadable object
file is a requirement, important and a feature. Code loaded by RTEMS's
libdl is the same as statically linked code so the performance is the
same. There is no difference in call overheads or access to global data
and this means you get the same performance as being statically linked.
RTEMS is a single address space and we need all code to be built the
same way, I consider anything else as risky.

> Disclaimer: An "unresolved external" error was encountered at run-time,
> after building the DL app via the above instructions.

The shell command should be able to print a list of unresolved symbols.

> The link also encompasses instructions on how to build a DL app via OMK,
> as an alternative to WAF. The OMK DL app ran without an error.
> 
> It'd be nice if you, or anyone who successfully builds a DL app via WAF,
> share the code/instructions here because AFAIK there's no such example
> in the RTEMS repository/wiki.

The following is the waf build script I used to develop libdl.

https://git.rtems.org/chrisj/rtl.git/tree/wscript

The libdl support and building for it is complicated and there is a wide
of things that are possible. Good documentation is needed and something
I would like to see exist.

Chris


More information about the users mailing list