[PATCH] (version 2) Change MIPS linker stubs to allow for more than 2^15 symbols.

David Daney ddaney@avtrex.com
Thu Jun 8 23:03:00 GMT 2006


As noted in this thread:

http://sourceware.org/ml/binutils/2006-06/msg00086.html

The mips linker would not reliably allow for more than 2^15 dynamic 
symbols.  This prevents GCC's libgcj java runtime library from being 
correctly linked.

This new version of the patch fixes allows up to 2^31 - 1 dynamic 
symbols by modifying linker stub generation.

If there are more than 2^16 dynamic symbols (as is the case for 
libgcj.so) a 20 byte stub is used.

For objects with 2^16 or fewer dynamic symbols, a stub of the original 
16 byte size is used.  This case is further divided in to two sub-cases: 
For an index value less than 2^15 the original sign extending stub is 
used, for index values of 2^15 through 2^16 a new non sign extending 
(but still 16 byte) stub is used.  The idea is to make the stub as small 
as possible as well as not change its form unless necessary.  It is 
thought that this strategy will decrease the chance of breaking existing 
tools.

Tested mipsel-linux cross build running on i686-pc-linux-gnu with make 
-k check showing no regressions.  Also tested that java executables from 
GCC-4.2 now are able to run.  Small objects still have the original 16 
byte stub, libgcj.so.7.0.0 uses the 20 byte stub.

Perhaps others could test on mips64 and/or big-endian systems.

OK to commit?

I know it is a bit late in the game, but how about for 2.17?  It would 
be nice to say that gcc-4.2 can be used with an official binutils release.

David Daney

2006-06-08  David Daney  <ddaney@avtrex.com>

	* elfxx-mips.c (STUB_LI16): Removed.
	(STUB_LUI): New macro.
	(STUB_LI16U): Ditto.
	(STUB_LI16S): Ditto.
	(MIPS_FUNCTION_STUB_SIZE): Rewrote to take info parameter.
	(_bfd_mips_elf_adjust_dynamic_symbol): Pass info parameter to
	MIPS_FUNCTION_STUB_SIZE.
	(_bfd_mips_elf_always_size_sections): Ditto.
	(_bfd_mips_elf_size_dynamic_sections): Ditto.
	(_bfd_mips_elf_finish_dynamic_sections): Ditto.
	(_bfd_mips_elf_finish_dynamic_symbol): Rewrote stub generation
	to allow larger symbol table indexes.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mips-stubs.diff.txt
URL: <https://sourceware.org/pipermail/binutils/attachments/20060608/188bf7f0/attachment.txt>


More information about the Binutils mailing list