This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: sparc TPOFF handling in GOLD
From: Ian Lance Taylor <iant@google.com>
Date: Wed, 10 Feb 2010 12:54:00 -0800
> David Miller <davem@davemloft.net> writes:
>
>> From: David Miller <davem@davemloft.net>
>> Date: Tue, 09 Feb 2010 23:37:01 -0800 (PST)
>>
>>> Maybe I'm missing something obvious here that can be used to make this
>>> work? Perhaps I need to use a target specific relocation?
>>
>> Ian, in thinking about this more, I think there is a reasonable
>> need for being able to emit relocations that:
>>
>> 1) Behave like ->add_*_relative() wrt. setting the symbol index
>> and computing the RELA addend.
>>
>> 2) But does not influence reloc sorting or the incrementing
>> of RELACOUNT.
>>
>> This could be simply implemented using two boolean states
>> instead of one in Output_reloc, then adding a variant of
>> the ->add_*_relative() methods which takes an extra boolean
>> to indicate "this is a relative reloc but not R_${TGT}_RELATIVE"
>
> I'm curious about the symbol index: is a SPARC TPOFFnn reloc really
> supposed to always have a zero symbol index?
Only for local symbols.
> That doesn't seem to be
> what bfd/elfxx-sparc.c does for this case.
Yes it does:
indx = h && h->dynindx != -1 ? h->dynindx : 0;
if (r_type == R_SPARC_TLS_IE_HI22
|| r_type == R_SPARC_TLS_IE_LO10)
dr_type = SPARC_ELF_TPOFF_RELOC (htab);
else
dr_type = SPARC_ELF_DTPMOD_RELOC (htab);
> I haven't yet looked into how x86_64 works, but it seems to me that
> the problem kind of boils down the fact that there is no way to
> control the addend when using add_local_with_rela. Does that sound
> right to you?
Yep, that sounds about right.
> Looking at elfxx-sparc.c, for a global symbol the relocation does not
> have any addend. Does your current gold have a problem with global
> symbols, or only with local symbols?
Currently, I'm pretty sure the IE TLS relocs only get imporperly
computed for local symbols.
But look at that GOLD sparc ->add_*_relative() patch I put in
yesterday. All of those cases needed this behavior, although
I think the section cases is OK.