public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* mips multi-got error
@ 2006-06-28 11:32 ligang
  2006-06-28 17:09 ` David Daney
  0 siblings, 1 reply; 6+ messages in thread
From: ligang @ 2006-06-28 11:32 UTC (permalink / raw)
  To: binutils





Hi all,

I am using mips ld to generate multi-got, but, it seems that ld can not
generate multi-got for ld
print a serial of "truncate..." error message. Is it a bug? or, is my usage
not correct?

as command line is : ./mips-linux-elf-as multi-got.s -KPIC -o multi-got.o
ld command line is : ./mips-linux-elf-ld multi-got.o

The test case is as follows:
===================================
.macro  one_sym count
        .globl  sym_1_\count
sym_1_\count:
        la      $2, sym_1_\count
        .endm

        .text
        .globl  func1
        .ent    func1
func1:
        .frame  $sp,0,$31
        .set noreorder
        .cpload $25
        .set reorder
        .cprestore 8
        .set noreorder

        .irp    milo,0,1
        .irp    thou,0,1,2,3,4,5,6,7,8
        .irp    hund,0,1,2,3,4,5,6,7,8,9
        .irp    tens,0,1,2,3,4,5,6,7,8,9
        .irp    ones,0,1,2,3,4,5,6,7,8,9
        one_sym \milo\thou\hund\tens\ones
        .endr
        .endr
        .endr
        .endr
        .endr
        .end    func1
=================================


Best regards
                     Ligang

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: mips multi-got error
  2006-06-28 11:32 mips multi-got error ligang
@ 2006-06-28 17:09 ` David Daney
  2006-06-28 17:30   ` Thiemo Seufer
  0 siblings, 1 reply; 6+ messages in thread
From: David Daney @ 2006-06-28 17:09 UTC (permalink / raw)
  To: ligang; +Cc: binutils

ligang@sunnorth.com.cn wrote:
> 
> 
> 
> Hi all,
> 
> I am using mips ld to generate multi-got, but, it seems that ld can not
> generate multi-got for ld
> print a serial of "truncate..." error message. Is it a bug? or, is my usage
> not correct?
> 
> as command line is : ./mips-linux-elf-as multi-got.s -KPIC -o multi-got.o
> ld command line is : ./mips-linux-elf-ld multi-got.o
> 
> The test case is as follows:
> ===================================
> .macro  one_sym count
>         .globl  sym_1_\count
> sym_1_\count:
>         la      $2, sym_1_\count
>         .endm
> 
>         .text
>         .globl  func1
>         .ent    func1
> func1:
>         .frame  $sp,0,$31
>         .set noreorder
>         .cpload $25
>         .set reorder
>         .cprestore 8
>         .set noreorder
> 
>         .irp    milo,0,1
>         .irp    thou,0,1,2,3,4,5,6,7,8
>         .irp    hund,0,1,2,3,4,5,6,7,8,9
>         .irp    tens,0,1,2,3,4,5,6,7,8,9
>         .irp    ones,0,1,2,3,4,5,6,7,8,9
>         one_sym \milo\thou\hund\tens\ones
>         .endr
>         .endr
>         .endr
>         .endr
>         .endr
>         .end    func1
> =================================
> 
> 
> Best regards
>                      Ligang
> 

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.

David Daney.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: mips multi-got error
  2006-06-28 17:09 ` David Daney
@ 2006-06-28 17:30   ` Thiemo Seufer
  2006-06-28 18:45     ` David Daney
  0 siblings, 1 reply; 6+ messages in thread
From: Thiemo Seufer @ 2006-06-28 17:30 UTC (permalink / raw)
  To: David Daney; +Cc: ligang, binutils

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.


Thiemo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: mips multi-got error
  2006-06-28 17:30   ` Thiemo Seufer
@ 2006-06-28 18:45     ` David Daney
  2006-06-30 13:35       ` Thiemo Seufer
  0 siblings, 1 reply; 6+ messages in thread
From: David Daney @ 2006-06-28 18:45 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: ligang, binutils

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.

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)?

David Daney.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: mips multi-got error
  2006-06-28 18:45     ` David Daney
@ 2006-06-30 13:35       ` Thiemo Seufer
  2006-07-05  7:52         ` Richard Sandiford
  0 siblings, 1 reply; 6+ messages in thread
From: Thiemo Seufer @ 2006-06-30 13:35 UTC (permalink / raw)
  To: David Daney; +Cc: ligang, binutils

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.
> 
> 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.)


Thiemo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: mips multi-got error
  2006-06-30 13:35       ` Thiemo Seufer
@ 2006-07-05  7:52         ` Richard Sandiford
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Sandiford @ 2006-07-05  7:52 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: David Daney, ligang, binutils

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-07-05  7:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-28 11:32 mips multi-got error ligang
2006-06-28 17:09 ` David Daney
2006-06-28 17:30   ` Thiemo Seufer
2006-06-28 18:45     ` David Daney
2006-06-30 13:35       ` Thiemo Seufer
2006-07-05  7:52         ` Richard Sandiford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).