LDSO Question

Sebastian Sumpf Sebastian.Sumpf at ...1...
Thu Mar 17 15:50:28 CET 2011

>     <config>
>         <parent-provides>
>             <service name="ROM"/>
>             <service name="RAM"/>
>             <service name="IRQ"/>
>             <service name="IO_MEM"/>
>             <service name="IO_PORT"/>
>             <service name="CAP"/>
>             <service name="PD"/>
>             <service name="RM"/>
>             <service name="CPU"/>
>             <service name="LOG"/>
>         </parent-provides>
>         <default-route>
>             <any-service> <parent/> <any-child/> </any-service>
>         </default-route>
>         <start name="ps2_drv">
>             <resource name="RAM" quantum="1M"/>
>             <provides><service name="Input"/></provides>
>         </start>
>         <start name="pci_drv">
>                 <resource name="RAM" quantum="1M"/>
>                 <provides><service name="PCI"/></provides>
>         </start>
>         <start name="timer">
>             <resource name="RAM" quantum="1M"/>
>             <provides><service name="Timer"/></provides>
>         </start>
>         <start name="nitpicker">
>             <resource name="RAM" quantum="1M"/>
>             <provides><service name="Nitpicker"/></provides>
>         </start>
>         <start name="vesa_drv">
>             <resource name="RAM" quantum="1M"/>
>             <provides><service name="Framebuffer"/></provides>
>         </start>
>         <start name="launchpad">
>             <resource name="RAM" quantum="32M"/>
>         </start>
>         <start name="ldso">
>             <resource name="RAM" quantum="32M"/>
>         </start>
>         <start name="sharedlib">
>             <resource name="RAM" quantum="10M"/>
>         </start>
>         <memsection name="ldso" file="ldso" direct="true" />
>     </config>

As I mentioned before, *never* start ldso in your Genode config file.
All <start> tags are programs that will be launched by Genode, if during
this process a binary is encountered that is linked against shared
libraries, Genode will *automatically* invoke ldso in order to load the
program and the needed shared libs.

To give you a small example (please run make run/ldso from your Genode
build directory). This will build an application called 'test-ldso'.

If you run 'objdump -p test-ldso you will see:

bin/test-ldso:     file format elf32-i386

Program Header:
    PHDR off    0x00000034 vaddr 0x00001034 paddr 0x00000000 align 2**2
         filesz 0x000000c0 memsz 0x000000c0 flags r--
  INTERP off    0x000190b5 vaddr 0x003180b5 paddr 0x003180b5 align 2**0
         filesz 0x00000007 memsz 0x00000007 flags r--
    LOAD off    0x00001000 vaddr 0x00300000 paddr 0x00300000 align 2**12
         filesz 0x0002499c memsz 0x0002499c flags r-x
    LOAD off    0x00026000 vaddr 0x00325000 paddr 0x00325000 align 2**12
         filesz 0x00008037 memsz 0x0001b070 flags rwx
 DYNAMIC off    0x0002b4ec vaddr 0x0032a4ec paddr 0x0032a4ec align 2**12
         filesz 0x00002b4b memsz 0x00015293 flags rwx
EH_FRAME off    0x00024cc8 vaddr 0x00323cc8 paddr 0x00323cc8 align 2**2
         filesz 0x00000cd4 memsz 0x00000cd4 flags r--

Dynamic Section:
  NEEDED               /build/genode_rtld_elf/var/libcache/libc/
  NEEDED               /build/genode_rtld_elf/var/libcache/libm/
  HASH                 0x003180bc
  STRTAB               0x0031bc00
  SYMTAB               0x00319320
  STRSZ                0x0000564f
  SYMENT               0x00000010
  DEBUG                0x00000000
  PLTGOT               0x0032a59c
  PLTRELSZ             0x00000018
  PLTREL               0x00000011
  JMPREL               0x00321510
  REL                  0x00321250
  RELSZ                0x000002c0
  RELENT               0x00000008

The 'NEEDED' shows you that test-ldso depends on,, and In order to start the application in
Genode a config file would look like this:

            <service name="ROM"/>
            <service name="LOG"/>
            <any-service> <parent/> </any-service>
        <start name="test-ldso">
            <resource name="RAM" quantum="1M"/>

You only need to start 'test-ldso', but the boot loader file would look
like this:

title Genode on L4ka::Pistachio
 kernel /pistachio/kickstart
 module /pistachio/x86-kernel
 module /pistachio/sigma0
 module /genode/core
 module /genode/config
 module /genode/init
 module /genode/ldso
 module /genode/test-ldso
 module /genode/
 module /genode/
 module /genode/

Here you load the shared libaries and ldso so Genode can find them when
starting test-ldso. You can find the whole example under

So, assuming that 'sharedlib' is a program and *not* a library:

Remove this part from your config file:

   <start name="ldso">
            <resource name="RAM" quantum="32M"/>

If 'sharedlib' is a library remove this start tag a well and substitute it with the actual program using the library.


  <memsection name="ldso" file="ldso" direct="true" />

This looks like it was taken from an elfweaver config file which is OKL4 specific and has nothing to do with Genode configuration altogether.

Good luck,

-- Sebastian

More information about the users mailing list