This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] PR gold/18609
- From: Andrew Senkevich <andrew dot n dot senkevich at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: Cary Coutant <ccoutant at gmail dot com>, Binutils <binutils at sourceware dot org>
- Date: Mon, 20 Jul 2015 18:24:49 +0300
- 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>
>> diff --git a/gold/x86_64.cc b/gold/x86_64.cc
>> index 007af1d..8f53bfc 100644
>> --- a/gold/x86_64.cc
>> +++ b/gold/x86_64.cc
>> @@ -2480,23 +2480,6 @@ Target_x86_64<size>::Scan::local(Symbol_table* symtab,
>> // The symbol requires a GOT section.
>> Output_data_got<64, false>* got = target->got_section(symtab, layout);
>>
>> - // If the relocation symbol isn't IFUNC,
>> - // and is local, then we will convert
>> - // mov foo@GOTPCREL(%rip), %reg
>> - // to lea foo(%rip), %reg.
>> - // in Relocate::relocate.
>> - if (r_type == elfcpp::R_X86_64_GOTPCREL
>> - && reloc.get_r_offset() >= 2
>> - && !is_ifunc)
>> - {
>> - section_size_type stype;
>> - const unsigned char* view = object->section_contents(data_shndx,
>> - &stype, true);
>> - if (view[reloc.get_r_offset() - 2] == 0x8b)
>> - break;
>> - }
>> -
>> -
>> // The symbol requires a GOT entry.
>> unsigned int r_sym = elfcpp::elf_r_sym<size>(reloc.get_r_info());
>>
>> @@ -2906,21 +2889,6 @@ Target_x86_64<size>::Scan::global(Symbol_table* symtab,
>> // The symbol requires a GOT entry.
>> Output_data_got<64, false>* got = target->got_section(symtab, layout);
>>
>> - // If we convert this from
>> - // mov foo@GOTPCREL(%rip), %reg
>> - // to lea foo(%rip), %reg.
>> - // in Relocate::relocate, then there is nothing to do here.
>> - if (r_type == elfcpp::R_X86_64_GOTPCREL
>> - && reloc.get_r_offset() >= 2
>> - && Target_x86_64<size>::can_convert_mov_to_lea(gsym))
>> - {
>> - section_size_type stype;
>> - const unsigned char* view = object->section_contents(data_shndx,
>> - &stype, true);
>> - if (view[reloc.get_r_offset() - 2] == 0x8b)
>> - break;
>> - }
>> -
>
> 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.
--
WBR,
Andrew