Cause of the C++ problem

Amadeus amadeus at iksw-muees.de
Fri Jul 20 19:55:42 CEST 2007


Hello everybody,

I digged somewhat deeper into the problem and found:

The linker is called 3 times:

> $LINKER $EMUL -r -d -o "$OFILE.elf2flt" $ARG1
> $LINKER $EMUL $SDIRS -T $LDSCRIPT -Ur -o "$OFILE.elf" "$OFILE.elf2flt"
> $LINKER $EMUL $SDIRS -T $LDSCRIPT -o "$OFILE.gdb" "$OFILE.elf2flt"

The flat binary is generated with:

> $ELF2FLT -v $FLTFLAGS -o "$OFILE" -p "$OFILE.gdb" "$OFILE.elf"

"arm-linux-elf-objdump -h rtest.elf" gives me:

> Sections:
> Idx Name          Size      VMA       LMA       File off  Algn
>   0 _ZTV5test1    00000008  00000000  00000000  00000034  2**2
>            CONTENTS, READONLY, EXCLUDE, GROUP,LINK_ONCE_DISCARD
> 1 .text         00004400  00000000  00000000 00000040  2**4 
>       CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE 
> 2 .data       00000460  00004400  00004400  00004440  2**4 
>       CONTENTS, ALLOC, LOAD, RELOC, DATA
> 3 .gnu.linkonce.d._ZTV5test1 0000000c  00000000  00000000  000048a0
>       2**2 CONTENTS, ALLOC, LOAD, RELOC, DATA  

"arm-linux-elf-objdump -h rtest.gdb" gives me:

> Sections:
> Idx Name          Size      VMA       LMA       File off  Algn
>   0 .text         00004400  00000000  00000000  00008000  2**4
>                   CONTENTS, ALLOC, LOAD, READONLY, CODE
>   1 .data         00000530  00004400  00004400  0000c400  2**4
>                   CONTENTS, ALLOC, LOAD, DATA

You see that in the "abs" file "rtest.gdb", the 
section .gnu.linkonce.d.* is collapsed into the .data section (as 
expected in the linker script!

But in the "rel" file "rtest.elf" the section is present (it is 
generated with the SAME linker script!). So the section comparator in 
elf2flt.c failed:

>       /* Now search for the equivalent section in the relocation 
binary
>        * and use that relocation information to build reloc entries
>        * for this one.
>        */
>       for (r=rel_bfd->sections; r != NULL; r=r->next)
>               if (strcmp(a->name, r->name) == 0)
>                       break;
>       if (r == NULL)
>         continue;

I do not think that it EVER worked!
I will have to look at the linker now....

regards
Amadeus
-- 
We're back to the times when men were men 
and wrote their own device drivers.

(Linus Torvalds)



More information about the dslinux-devel mailing list