[uClinux-dev] elf2flt porting questions

Greg Ungerer gerg at snapgear.com
Tue Mar 4 02:24:33 EST 2003

Hi Matt,

Matt Waddel wrote:
> I am trying to port the elf2flt code to a new architecure
> and I have some questions.
> 1) Are uClinux relocations limited to 4 bytes by the
> operating system?

No. That is just the most common size by far.
This is very much architecture dependant.

>  The following statement emits an error
> when a 2 byte relocation is encountered, but 2 byte
> relocations are used in the blackfin processor. (R_huimm16
> and R_luimm16)  Is it ok to allow a sym_reloc_size of 2?
>    /* Calculate the sym address ourselves.  */
>    sym_reloc_size = bfd_get_reloc_size(q->howto);
>    if (sym_reloc_size != 4) {
>        printf("ERROR: bad reloc size=%d for symbol=%s\n",
>                sym_reloc_size, sym_name);
>        rc = -1;
>        continue;
>        }

Ahh, I see. Looking at this I think this is a throw back
to the original m68k elf2flt. I don't think this check
should be done for all architectures...

> 2) Since there has been a some activity recently on the
> uClinux mailing list about the elf2flt conversion, how is
> the best way to determine if this is working correctly in
> a new system?  Any troubleshooting tips would be
> appreciated.

Start small :-)
I would suggest constructing some very simple test cases.
A single system call (write is a good one) for example.
You pretty much need to manually check that your relocation
is being performed as expected.

Make sure you check relocatable values inside instructions too,
if your architecture does that. The sparc support in elf2flt
and linux-2.0.x/binfmt_flat.c is an example of this.

> 3) I get errors and the build dies during the creation of
> the .gdb file.  I have commented out the .gdb file creation,
> but could this be repaired by adding the stabs sections to
> the linker script?

Hmm, I would not have thought so. What are the errors?


Greg Ungerer  --  Chief Software Wizard        EMAIL:  gerg at snapgear.com
SnapGear Pty Ltd                               PHONE:    +61 7 3435 2888
825 Stanley St,                                  FAX:    +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia              WEB:   www.SnapGear.com

More information about the uClinux-dev mailing list