relocation truncated to fit errors

Marius Groeger mgroeger@sysgo.com
Mon Apr 3 14:22:00 GMT 2006


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.

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