[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 08:21:21 PDT 2016

That is still more than needed, no?

A single symbol pointing to a 8k page would create 2 got entries but
only needs one. Is that correct?


On 22 March 2016 at 08:59, Simon Atanasyan <simon at atanasyan.com> wrote:
> atanasyan created this revision.
> atanasyan added reviewers: ruiu, rafael.
> atanasyan added a subscriber: llvm-commits.
> atanasyan set the repository for this revision to rL LLVM.
> atanasyan added a project: lld.
> Local symbol which requires GOT entry initialized by "page" address. This address is high 16 bits of sum of the symbol value and the relocation addend. In the relocation scanning phase final values of symbols are unknown so to reduce number of allocated GOT entries do the following trick. Save all output sections referenced by GOT relocations during the relocation scanning phase. Then later in the `GotSection::finalize` method calculate number of "pages" required to cover all saved output sections and allocate appropriate number of GOT entries. We assume that symbols referenced by GOT relocations are spread uniformly among output sections.
> Alternative approach might be creation of something like `MipsGotSection`, making some methods of `GotSection` virtuals, and moving all MIPS specific code and data structures into it.
> Repository:
>   rL LLVM
> http://reviews.llvm.org/D18349
> Files:
>   ELF/OutputSections.cpp
>   ELF/OutputSections.h
>   ELF/Writer.cpp
>   test/ELF/mips-got-redundant.s

More information about the llvm-commits mailing list