relocation truncated to fit errors

Niklaus niklaus@gmail.com
Mon Apr 3 15:25:00 GMT 2006


On 4/3/06, Marius Groeger <mgroeger@sysgo.com> wrote:
> On Mon, 3 Apr 2006, Niklaus wrote:
>
> > Good piece of information.  I tried writing a hello world program and
> > few others , it compiled file and i got the a.out. file showed it as
> > an mips executable.
> >
> > How do we provide the global pointer _gp.
>
> You need some linker script magic for that. As a totally random
> -- albeit visual -- example, take ...ldscripts/elf32ltsmip.x:
>
>    .data1          : { *(.data1) }
>    . = .;
>    _gp = ALIGN(16) + 0x7ff0;
>    .got            : { *(.got.plt) *(.got) }
>    /* We want the small data sections together, so single-instruction offsets
>       can access them all, and initialized data all before uninitialized, so
>
> This will define _gp in a way that it gives you a +/- 0x7ff0 range into the
> data segment. I'm not really knowledgable as to the gazillion aspects of
> current binutils linker script options, but this should at least give you
> some kind of a starting point.
>
> >> I'm not sure you're providing that.
> >> What's more, I think it'll also require the main program components be
> >> linked with -fPIC as well, which you are not doing.
> >>
> > I am not very sure about this. Can you tell me where i can find more
> > details about this.
>
> info gcc (and make sure you're browsing the info pages of your cross gcc,
> not the one installed on your development host!)
>
> >> I'm aware that this is no directly usable help for you. All I can advise is
> >> to carefully analyse (X-objdump -fph .. and X-objdump -d ..) ALL objects
> >> you're linking to make sure they're compatible with >each other.
> > How to check this if they are compatible.
>
pro@deb:~/scripe/cross/lib/gcc/mips-deb-linux/3.4.6$
mips-deb-linux-objdump -d libgcc.a  | grep __gp
pro@deb:~/scripe/cross/lib/gcc/mips-deb-linux/3.4.6$
mips-deb-linux-objdump -d libgcc.a  | egrep __gp
pro@deb:~/scripe/cross/lib/gcc/mips-deb-linux/3.4.6$

In archive libgcc.a:

_muldi3.oS:     file format elf32-tradbigmips

Disassembly of section .text:

00000000 <__muldi3>:
   0:   00870018        mult    a0,a3
   4:   00005012        mflo    t2
        ...
  10:   00a70019        multu   a1,a3
  14:   00001010        mfhi    v0
  18:   00001812        mflo    v1
        ...
  24:   00a60018        mult    a1,a2
  28:   00003012        mflo    a2
  2c:   00ca3021        addu    a2,a2,t2
  30:   03e00008        jr      ra
  34:   00c21021        addu    v0,a2,v0
        ...

_negdi2.oS:     file format elf32-tradbigmips

--More--

I don't find any __gp.


> Like I mentioned: run your cross objdump on the object files or the libgcc.a
> and scan the object's flags. With the -d option, you'll get a dissassembly.
> Looking more closely into that, you should find that all compiled C
> functions start with initializing the _gp pointer.
>
> > Thanks very much for the help and handholding so far.
>
> Not to worry -- I'm still not feeling like I provide much help here. I'm
> afraid you'll have to do quite some digging on your own here...
>
> Regards,
> Marius
>
> --
> Marius Groeger <mgroeger@sysgo.com>
> SYSGO AG                      Embedded and Real-Time Software
> Voice: +49 6136 9948 0                  FAX: +49 6136 9948 10
> www.sysgo.com | www.elinos.com | www.osek.de | www.pikeos.com
>
>

--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list