This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] PR gold/18609
- From: Cary Coutant <ccoutant at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: Andrew Senkevich <andrew dot n dot senkevich at gmail dot com>, Binutils <binutils at sourceware dot org>
- Date: Tue, 21 Jul 2015 18:06:22 -0700
- Subject: Re: [PATCH] PR gold/18609
- Authentication-results: sourceware.org; auth=none
- References: <CAMXFM3ufsJmH8trBQ6GJ5ZWBRxEpXbTTr-cDY_X=hxrkEsK=pQ at mail dot gmail dot com> <CAJimCsGgpjpAZdmwZF+kviPANMWnS_Fi6+hPtKftN82nJOLT7A at mail dot gmail dot com> <CAMXFM3tDV0tELGu6iiLop6gBO2c0S48GYTDaMet-wHXbQxGF6g at mail dot gmail dot com> <CAMe9rOrGp-KGrRyqH6TNsMJfsAOS3ze=e=O1SAOgd0GQhQqBMA at mail dot gmail dot com> <CAMXFM3vmaJNcg_Kz5tMUoR7jsJABiF2qVYRrXqg1p=qok_g5aQ at mail dot gmail dot com> <CAMe9rOrKALc8Q363j28vz3BjyBHXXN2vRwFUy2LEj-k6vrtuzQ at mail dot gmail dot com> <CAMXFM3un-Sj0r4p22pSn9op23ZUp9kfK9Gb2HQeSKkNY_OWx-w at mail dot gmail dot com> <CAMe9rOpf=+KzO0GSgTB7fwS6f6j0-X+di5eTOp+c7uRQ2oqBOw at mail dot gmail dot com>
>>>>> If you remove those changes, won't it generate an unused GOT slot
>>>>> when GOTPCREL relocation is converted to PC-relative relocation?
>>>>
>>>> Yes, it can generate unused GOT slots.
>>>
>>> I think we should add a testcase to check for the unused GOT slot.
>>> Please check if you can implement similar heuristic in gold:
>>>
>>> https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=59cab532835904f368b0aa99267afba5fda5ded2
>>
>> No addresses available at the time of Target_x86_64<size>::Scan::local
>> and *::global work, so not clear how to use some heuristics here...
>
> There are no addresses available in ld.bfd neither. An estimate was
> used in ld.bfd.
In gold, I think the best you can do is check to see if the branch and
its target are in the same output section, then use
output_section_offset() plus offset within the input section to check
distance between the two. At the time you're scanning relocations, we
haven't even done a tentative layout of output sections, so you'll
have to be pessimistic if the two aren't in the same output section.
-cary