Dynamic load real-time tasks
Chris Johns
chrisj at rtems.org
Tue Jun 27 04:41:56 UTC 2017
On 26/06/2017 18:34, Павел Жданов wrote:
> Hello everyone.
>
> I'm interested in dynamic loading and have the following situation:
>
> 1. There are two files init.c and dl.c.
> 2. dl.с defines rtems_main function . This function just print some string
> using printf fuction. It complied to dl.o but not linked against standard
> libraries so printf symbol is unresolved.
> 3. I want to load dl.o from init.с and use rtems_main function (with dl_open
> and so on). Final init.exe is linked against standard libraries so it has
> printf symbol resolved.
> 4. dl.o is loaded from the dos partition.
> 5. At the moment a can load dl.o and call rtems_main only if it doesn't use
> printf or functions from other libraries.
>
> My questions are:
>
> 1. Is this scenario possible?
Yes.
> 2. How to link dl.o with init.exe to resolve printf (and may be other functions
> that are used by rtems_main and resolved in init.exe)?
Have you loaded a symbol table for the base image that contains the 'printf'
function. To create see:
https://docs.rtems.org/branches/master/user/tools/index.html#rtems-symbols
>
> Platfrom: i386, pc486. I tried to use rtems-ld and i386-rtems4.11-ld but could
> not resolve necessary symbols.
>
Dynamic loading of code requires the dependence between your base image code,
dynamically loaded and the system libraries needs to be managed. You can do this
manually and Joel gave a hint, or could take a look at the RAP format executable
format the 'rtems-ld' generates.
Chris
More information about the users
mailing list