[PATCH] D18349: [ELF][MIPS] Reduce number of redundant entries in the local part of MIPS GOT

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 22 09:29:19 PDT 2016


BTW, what result do you get with gold/bfd?

Cheers,
Rafael


On 22 March 2016 at 12:28, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:
> On 22 March 2016 at 12:14, Simon Atanasyan <simon at atanasyan.com> wrote:
>> atanasyan added a comment.
>>
>> In http://reviews.llvm.org/D18349#380312, @rafael wrote:
>>
>>> That is still more than needed, no?
>>
>>
>> Yes. If symbols point only to the thirst 64kb page of large output section we allocate "page" entries covers the section completely.
>>
>>> A single symbol pointing to a 8k page would create 2 got entries but
>>
>>>  only needs one. Is that correct?
>>
>>
>> I do not consider local symbols individually at all. If a single symbol pointing to a 8k page we get one redundant entry. It is not good but acceptable. If we have more than one symbol pointing to the adjacent addresses, exact number of required GOT entries depends on the final values of these addresses. In the best case they all belong to the same final 64kb page and have the same high 16 bits. In the worst case we will need two page addresses. But to get optimal result we will have to calculate number of required GOT entries after all output section will be finalized and aligned.
>
> I wonder if with SymbolBodies being allocated to local symbols if we
> can compute the exact answer.
>
> Would this work?:
>
> * Represent the .got section with just a vector of symbol bodies.
> * Make sure .got is placed after all sections that a got entry can point to.
> * Layout all sections that go before got.
> * We can now compute the values of the symbols.
>
> Cheers,
> Rafael


More information about the llvm-commits mailing list