This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: mips multi-got error
- From: Richard Sandiford <richard at codesourcery dot com>
- To: Thiemo Seufer <ths at networkno dot de>
- Cc: David Daney <ddaney at avtrex dot com>, ligang at sunnorth dot com dot cn, binutils at sourceware dot org
- Date: Wed, 05 Jul 2006 08:52:03 +0100
- Subject: Re: mips multi-got error
- References: <OF29091AE6.0760DEBD-ON4825719B.00339737-4825719B.00349078@sunnorth.com.cn> <44A2A56C.2090307@avtrex.com> <20060628172309.GF6676@networkno.de> <44A2BCB6.1070504@avtrex.com> <20060630133009.GA21946@networkno.de>
Thiemo Seufer <ths@networkno.de> writes:
> David Daney wrote:
>> Thiemo Seufer wrote:
>> >David Daney wrote:
>> >[snip]
>> >
>> >>That is not supposed to work. Multi-got linking only works if there are
>> >>fewer than 8192 symbols per compilation unit (input .o to the linker).
>> >>See the multi-got-1 testcase in ld/testsuite/ld-mips-elf.
>> >>
>> >>If you need more than 8192 symbols per compilation unit you must use
>> >>-xgot for the assembler. Recent GCC versions have a -mxgot option that
>> >>does the same thing for GCC.
>> >
>> >
>> >Actually, it is supposed to work. :-) It is also a known deficiency
>> >in the current assembler/linker implementation.
David's surely right here. It isn't _supposed_ to work. You might
be able to invent new schemes that allow it to work, but it won't
work with the current scheme.
>> How?
>>
>> The gp is set in the function prolog. If a single function references
>> more got/plt entries than can be indexed with a 16 bit offset, wouldn't
>> you need to either load the gp before each got access(very inefficient I
>> would think) or use a 32 bit offset (somewhat inefficient)?
>
> It doesn't need a gp load before each access, one per 16-bit addressable
> GOT block would be enough. (This implies a Multi-GOT extension for
> relocatable object files, probably with gp0..gpN / _gp_disp0.._gp_dispN
> as per-GOT symbols.)
But how would you know which _gp_dispN applied to a given GOT relocation?
I hope it wouldn't be by comparing relocation field addresses.
Richard