[uClinux-dev] uClinux porting of MIPS

Justin Wojdacki justin.wojdacki at analog.com
Mon Apr 8 13:03:09 EDT 2002


Zhao Tiecheng wrote:
> 
> On Monday 08 April 2002 10:37 am, you wrote:
> > Hi,
> >
> >
> > Seldom MIPS topic discussed here.
> >
> > I had ever ported uclinux+Microwin+Viewm on MIPS platform with gcc-2.96.
> >
> > In fact, the most puzzle is the "elf2flt" tool during porting process.
> >
> > I don't know how you convert ELF to your working FLAT format,
> >
> > but my method is to modify the elf2flt source code based on the version for
> >
> > ARM.
> >
> > I had it supported for R_MIPS_HI16, R_MIPS_LO16, R_MIPS_CALL16,
> >
> > R_MIPS_GOT16, R_MIPS_32 and R_MIPS_GPREL32.
> >
> > Actually, using GLOBAL OFFSET TABLE, we only need to do recloation for
> >
> > R_MIPS_32, R_MIPS_CALL16 & R_MIPS_GOT16 and to set the "_gp" to the correct
> >
> > value in the "elf2flt.ld".
> 
>         But how to set "_gp " ? I puzzle in MIPS CPU on gp very much!
> 

You should be setting $gp in your userland code based on $t9. (See the
MIPS ABI for more info). $t9 carries a base address from which $gp is
calculated.

_gp on MIPS should be set to the base of the GOT:

                 /* GP relative addressing assumes that the _gp - 32K
is
                 * set here
                 */
                _gp = ALIGN(0x10) + 0x7ff0 ;

                *(.got.plt)
                *(.got)

(this goes in the .data section of your linker file)

-- 
-------------------------------------------------
Justin Wojdacki        
justin.wojdacki at analog.com         (408) 350-5032
Communications Processors Group -- Analog Devices
This message resent by the uclinux-dev at uclinux.org list server http://www.uClinux.org/



More information about the uClinux-dev mailing list