[uClinux-dev] relocs problems with arm

Fabrice Gautier Fabrice_Gautier at sdesigns.com
Fri Nov 30 22:46:54 EST 2001


> -----Original Message-----
> From: Tom Walsh [mailto:tom at cyberiansoftware.com]
> Subject: Re: [uClinux-dev] relocs problems with arm
> 
> Fabrice Gautier wrote:
> > 
> > A quick update on the endianness problem for thebinary flat format.
> > 
> > I don't think there is anything like a "standard" for this 
> format but as per
> > this chunk of kernel code:
> > 
> > rp = (unsigned long *) calc_reloc(ntohl(reloc[i]), text_len);
> > /* Get the pointer's value.  */
> > addr = get_unaligned (rp);
> > if (addr != 0) {
> >   /* Do the relocation.  */
> >   addr = calc_reloc (ntohl (addr), text_len);
> >   /* Write back the relocated pointer.  */
> >   put_unaligned (addr, rp);
> > }
> > 
> > It seems that the kernel expect to have everything in 
> network format (that
> > is big endian if i got it right)
> 
> Nope, you don't have it right.  The calc_reloc is apparently 
> making sure
> that *it* doesn't run into an endian problem and is letting the ntohl
> macro ensure a common format for the data it is processing.  The way
> that the ntohl macro works on your particular processor implementation
> is entirely despendant upon how you set it up.

When I said "the kernel expect to have everything in network format" that
was supposed to mean "the kernel expect all the relocation fields in the
flat file to be in network format (aka big-endian)"

So i think we agree.

> If you don't know which end is up (big or little ;), 

But i know it's little endian (ie like x86). (otherwise my kernel wont boot
at all)

(damn, those guys could have agreed on a common format at the beginning !)
This message resent by the uclinux-dev at uclinux.org list server http://www.uClinux.org/



More information about the uClinux-dev mailing list