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

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 22 14:05:02 PDT 2016

atanasyan added a comment.

In http://reviews.llvm.org/D18349#380355, @rafael wrote:

> 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.

There are two problems in this approach (though it allows to get ideal result):

- We need to create a local symbol body for each unique combination of local symbol referenced by GOT relocation and addend. Number of such combinations might be very large. And we need to read relocation addend in relocation scanning phase.
- For some end-users like embedded developers it might be essential to be able to place sections in specific order.

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

Almost all test cases from LLVM Test suite show similar results. For example (size of .got section):
7zip-benchmark: BFD: 0x17a4 LLD: 0x177c
tramp3d-v4: BFD: 0x11a4 LLD: 0x11b8

There are couple exceptions `mafft/pairlocalalign` and `NPB-serial/is/is`. These executables have large .bss section and the patch produces the GOT bigger than necessary. But anyway it is better than current trunk implementation.



More information about the llvm-commits mailing list