[uClinux-dev] porting elf2flt

David McCullough davidm at snapgear.com
Mon Mar 31 03:05:41 EST 2003


Jivin John Williams lays it down ...
> Hi,
> 
> HAving got aound various issues re: Cygwin and elf2flt, I've got a 
> compiled binary.  However, the relocation stuff is all boilerplate so it 
> doesn't actually do anything.
> 
> Can anybody tell me where I will find the information required to fill 
> out the various entries in elf.h, and associated case statements in 
> elf2flt.c?
> 
> For example, from the v850 version, elf.h:
> 
> /* v850 relocations.  */
> #define R_V850_NONE             0
> #define R_V850_9_PCREL          1
> #define R_V850_22_PCREL         2
> #define R_V850_HI16_S           3
> #define R_V850_HI16             4
> #define R_V850_LO16             5
> #define R_V850_32               6
> #define R_V850_16               7
> #define R_V850_8                8
> #define R_V850_SDA_16_16_OFFSET 9       /* For ld.b, st.b, set1, clr1,
>                                            not1, tst1, movea, movhi */
> #define R_V850_SDA_15_16_OFFSET 10      /* For ld.w, ld.h, ld.hu, st.w, 
> .h */
> #define R_V850_ZDA_16_16_OFFSET 11      /* For ld.b, st.b, set1, clr1,
>                                            not1, tst1, movea, movhi */
> #define R_V850_ZDA_15_16_OFFSET 12      /* For ld.w, ld.h, ld.hu, st.w, 
> st.h */
> 
> Where are these relocation types and numbers defined?  I realise they'll 
> be different for each architecture, but it seems it's a standard 
> mechanism for gcc compilers to generate elf output.
> 
> I didn't do the toolchain (gcc) port, but I do have access to the source.

They should be in the binutils sources.  When you configure elf2flt you
tell it a few dirs to work with.  You may need to change the include of:

	<elf.h>

in elf2flt.c to something like:

	<elf/?microblaze?.h>

for your target.  This seems to get the defines that you will want,  though
without the microblaze gcc/binutils port it is hard to tell,  you will
need to go greping.

You will probably want to run elf2flt without any relocations
implemented first so that you can see which ones will be needed,  then
only implement those that give errors (a number you can then lookup in
the header file).

You can also run:

	$(CROSS)objdump -r elf-file

to list the "names" of the relocations among other things.  These names
can be greped from the binutils sources.

I am just doing some elf2flt work myself,  so if you need a hand feel
free to bounce stuff off me,

Cheers,
Davidm

-- 
David McCullough:    Ph: +61 7 3435 2815  http://www.SnapGear.com
davidm at snapgear.com  Fx: +61 7 3891 3630  Custom Embedded Solutions + Security



More information about the uClinux-dev mailing list