[GSOC2013] Dynamic object file loading
chrisj at rtems.org
Sat Apr 20 04:01:58 UTC 2013
Peng Fan wrote:
> Added the code, I can see the three files: libx.a shell-init x.rap
> Here appears another problem:
> When"rap ld ./x.rap", it tells"error: loading: (0)"
> When"dlo x.rap","error: duplicate global symbol: hello". However, dlo libx.a:xa.c.1.o and dlo libx.a:x-long-name-to-create-gnu-extension-in-archive.c.1.o is ok.
> Tried to find why "When "rap ld ./x.rap", it tells "error: loading: (0)""
Did you grep for the string and set a break point in it and then look at
the back trace ? This is a pretty bad error message. Something is wrong
> I trace rtld using sparc-rtems4.11-gdb.
> In rap.c, there are two functions to do the loading ,linking and finding
> symbol job, dlopen foucsing on loading and resolving symbols, while
> dlsym returns the symbol address.
> When debugging dlopen returns sucessfully, but "init = dlsym
> (app->handle, "*rtems*");" returns with "init=NULL".Thus rap load failed.
What is "*rtems*" ? Wild cards will not work.
> In dlsym, It first try find the symbol in it's local "global_table".
> x.rap, It's global_table includes "hello", "w_writeln" ,"x_writeln",
> "y_writeln", "z_writeln", "public", "my_main". with no one matches
> "*rtems*". Then It tries to find the symbol in global symbol which maybe
> generated in rtld-gsyms.c using a hash method.However, it still can not
> find the match "rtems" symbol. Thus, failed.
Oh ok I get what is happening, yes this is correct. The symbols is
'rtems' and it is a kind of 'main' for the RTEMS application. It is
nothing more than that. The x.rap is a progression and I ended up
testing the whole think with a waf based libbsdports that create a RAP
image. I need to get this out onto a server somewhere.
> I do not know the "rtems" symbol means what. I see it is assigned to
> init, and then init(*, *). I am confusing about why "rtems".
This is understandable because I failed to add the reason to the doco.
As I said this is an RTEMS Application's main. I did not want to use
main because this has a well known and understood use.
Well done on getting this far. If you add an 'rtems' function to the
x.rap and have it print something the load should work.
More information about the devel