RFH/RFC: symbol index overflow in MIPS linker stubs...

David Daney ddaney@avtrex.com
Thu Jun 8 19:35:00 GMT 2006
Richard Sandiford wrote:
> David Daney <ddaney@avtrex.com> writes:
> 
>>I think we could easily change the stubs so that they used ori (an 
>>unsigned immediate load), instead of li.  This would work for symbol 
>>tables of size up to 2^16.
>>
>>FWIW: I tested this theory by hand editing the stubs to use the unsigned 
>>immediate load and the library now runs correctly.
>>
>>A second option might be to use a two instruction sequence to load t8, 
>>but that would change the size of the stubs.  I don't know if that would 
>>be portable or possible.
> 
> 
> I'm with Daniel (if I've understood him correctly): I think it _is_
> worth going the extra mile and only using the longer stubs if the
> largest dynindx requires it.  We know when calculating the size of
> the stub section what the maximum dynindx should be, so we can select
> between the 16- and 20-byte stubs at the same time.  We can then record
> the chosen size in mips_elf_link_hash_table.
> 
> I'm a little worried that using longer stubs might confuse the native
> IRIX tools, but I no longer have access to IRIX, so I can't check.
> I don't think that's a problem for the cases that really need it --
> what else can we do? -- but I think it is one reason to prefer the
> traditional stubs when possible.
> 

Thanks for looking at this.

What is your take on changing the 16 byte stub to not do sign extension? 
The stub size would remain the same, only the contents of the stub would 
change.

There are three ways to do this:

1) Always use a 20 byte stub.  This allows for up to 2^31 - 1 dynamic 
symbols.  You are concerned that this would break IRIX tools.

2) Use modified 16 byte stub if there are fewer than 2^16 dynamic 
symbols, otherwise use new 20 byte stub.

3) Use original 16 byte stub if fewer than 2^15 - 1 dynamic symbols. 
Modified 16 byte stub for 2^15 - 2^16 dynamic symbols.  Otherwise, use 
the new 20 byte stub.

Option #1 is easiest.  I already have a working patch.

Options #2 and #3 are more work, which would you prefer?

David Daney.



More information about the Binutils mailing list