Loading shared objects in an l4env_freebsd application

Derick Swanepoel dswanepoel at gmail.com
Fri Jun 10 10:43:19 CEST 2005

On 6/9/05, Frank Mehnert <fm3 at os.inf.tu-dresden.de> wrote:
> On Thursday 09 June 2005 14:45, Derick Swanepoel wrote:
> > On 6/9/05, Frank Mehnert <fm3 at os.inf.tu-dresden.de> wrote:
> > > On Thursday 09 June 2005 14:06, Derick Swanepoel wrote:
> > > > I need to load shared objects in my application. I've got .so loading
> > > > working in a loader-mode app, but my app uses the l4env_freebsd mode
> > > > so I cannot link against libloader.s.so. I've tried to link against
> > > > libloaderif.a, but the l4loader_attach_relocateable() function is only
> > > > available in libloader.s.so.
> > >
> > > I do not fully understand your problem. Why do you cannot link against
> > > the libloaders.s.so when you are using l4env_freebsd_mode?
> >
> > The example loader applications use the loader mode, which links the
> > application dynamically, and it links against libloader.s.so (it uses
> > -lloader.s as a linker argument). When using the l4env_freebsd mode
> > the application is linked statically so it wants to link against
> > libloader.s.a (which doesn't exist) when using -lloader.s. I see that
> > there is a static loader library (libloaderif.a), but it doesn't
> > contain the l4loader_attach_relocateable() function which I need.
> If you need the libraries of the l4env_freebsd_mode, it should be
> possible to add these libraries using the LIBS= parameter. If you
> look at the appropriate Makefile you will see, that libloaderif.a
> contains only the client stub of the loader IDL and therefore has
> nothing to do with the shared library stuff.
> The point is that you should start from the loader mode and enhance
> this mode for your needs since the loader mode uses a different
> startup strategy than the sigma0 mode.

Thanks for the advice. I have created a new mode to combine the loader
mode with what I need from l4env_freebsd, and I can successfully
compile and link my application. Unfortunately it causes a double
pagefault when loaded...:

loader  | "(nd)/fiasco/ds/test" is a valid binary image
loader  | Setting libpath to (nd)/fiasco/ds/
exec    | test: Loading
exec    | test: Saved 457726 bytes of symbols
exec    | libloader.s.so: Relocating to 0000e000
exec    | libloader.s.so: Linking
exec    | libloader.s.so: Relocating entry 000058d0 => 000138d0
exec    | libloader.s.so: Setting section flag 0800
exec    | test: Setting section flag 0800
loader  | test: Starting l4env-style application
loader  | test,#11: Starting at l4loader_init (00014080)
loader  | test,#11: Double PF (r) at 00000000 eip 00000000 (11.00)

A backtrace of the thread shows the following:

backtrace (thread 11.00, fp=00009af4, pc=00000000):
  #2  016f4c37
  #3  016f4c85
  #4  016f4cd3
  #5  016f426c
  #6  016ea0b3
  #7  016edf23
  #8  016ea3be
  #9  016ea1e9
 #10  00014057

My application is compiled with debug info so I assume this happened
in some other library. Sorry, I don't know enough about debugging to
provide more detailed information.

Thanks again,


More information about the l4-hackers mailing list