This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Multigot mechanism and a related MIPS linker error
- From: "Umashankar V.K." <shankar dot vk at gmail dot com>
- To: binutils at sourceware dot org, gcc-help at gcc dot gnu dot org
- Date: Tue, 13 Oct 2009 12:01:35 +0530
- Subject: Multigot mechanism and a related MIPS linker error
- References: <448a67a0910122243r56bf078di7b715c28ee145ea5@mail.gmail.com>
Posting again with? the proper subject title -
For our MIPS cross-compiler,
gcc version is? 4.2.0
binutils version is 2.17.90.
When our application? tries to link with third-party library,? the
MIPS linker reports? failure as
"ld: Bad value"
The library is not available to us.
Since the linking passes after applying the patches? given by Richard
Sandiford at http://sourceware.org/ml/binutils/2008-06/msg00270.html ,
we? figured that the error has something to do with multigot feature.
The description of the patch is difficult for us to understand.
We want to reproduce the failure with a test program.? As? a first
step, we are are trying to access? many extern symbols
from main(). But when the GOT table size? exceeds 64 Kb,? the linker
fails with message such as :
"relocation truncated to fit: R_MIPS_GOT16 against `global_variable__d13155'"
With less than 64 Kb GOT ,? I can see that the binary is in multigot
mode. (Each function's prolog is assigning
a different value for gp reg. )
a) In multigot mode, why should linker fail to create larger-than-64Kb
GOT ??? The very purpose of multigot
is to overcome this limit, isn't it ?
b) I looked at another application built in our company with same
toolchain.? Its GOT is 188 Kb in size.
(There are about 33000 extern symbol entries in the GOT .) I? looked
at its linking options and did not find anything special.
I looked? at its binary.? It is NOT in xgot mode.? Any clues ?
c) For the above binary mentioned in? ,? I can see lot of relocation
entries in .rel.dyn for the GOT table fixup.? From what I know,
in MIPS,? reloc entries are not needed for GOT relocation.? Why would
the linker output those for this binary?
d) I want to understand the ld test-suite
(/toolchain/testsuite/binutils/testsuite/ld/ld-mips-elf)? Is there any
writeup? somewhere ?
???????????????? thanks a lot
???????????????? shankar