Executable file loading from weaver.elf
Norman Feske
norman.feske at ...1...
Thu Jul 16 12:11:39 CEST 2009
Hi Sven,
> I've added
>
> --
> LD_SCRIPT = $(call select_from_repositories,src/platform/genode.ld)
> CXX_LINK_OPT = -static -nostdlib -Wl,-nostdlib
> CXX_LINK_OPT += -Wl,-T$(LD_SCRIPT) -Wl,-Ttext=0x01000000
> --
> to its target.mk. That worked fine.
It is actually sufficient to specify:
CXX_LINK_OPT += -Wl,-Ttext=0x01000000
Please note that this way, the -Ttext argument will appear twice
(once with your custom value and once with the original value) at
the linker command line. You can see this when building with
'make VERBOSE='. However, fortunately, the linker seems to use the
value of the first occurrence, which is the custom value specified
in your 'target.mk'.
> But then, the mapping of .text and .data sections failed during startup.
> The same happened when I tried 0x04000000 as base address.
>
> --
> [init] Genode::addr_t _setup_elf(Genode::Parent_capability,
> Genode::Dataspace_capability, Genode::Ram_session&,
> Genode::Rm_session&): addresses differ after attach (addr=1000000 out_ptr=0)
> [init] Genode::addr_t _setup_elf(Genode::Parent_capability,
> Genode::Dataspace_capability, Genode::Ram_session&,
> Genode::Rm_session&): addresses differ after attach (addr=106e000 out_ptr=0)
> Start thread ip=10545d4 sp=0, pd=4, tid=0
> no RM attachment (READ pf_addr=0 pf_ip=10545d4 from 04)
> --
>
> Is there anything else I must know about the startup process?
Normally, this output occurs if there are region conflicts. The ELF
loader specifies the virtual address to which the segment should
be mapped. If there already is a region that overlaps with the
specified address range, core refuses attach the dataspace. However,
it is not clear to me what could cause the conflict here. When
comparing your last output of readelf with the output you posted
yesterday, there are several differences apart from the changed base
address. Is this the same program? One strange thing is the file
offset of your text segment. In you last output, the offset is 0x82000
and there is no section using the file offsets below that value.
In your yesterday's output, the file offset for the text segement
has a reasonable value of 0x1000.
I have tried the link address 0x1000000 for the init binary (loaded by
core) and the link address 0x3000000 for launchpad (loaded by init) and
both programs are loaded just fine. I also tried changing the link
address of test-dde_linux26_usbhid to 0x1000000 (to see if the issue is
related to DDE) and the result gets loaded without problems as well.
In all cases, the file offset of the text segment is 0x1000.
Could you try changing the link address for a simple binary (e.g., init)
first? - just to see if this issue is specific for your particular
program.
BTW, are you using the Genode SVN or the last snapshot?
Regards
Norman
More information about the users
mailing list