[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 05:59:47 PDT 2016


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18349.51277.patch
Type: text/x-patch
Size: 6039 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160322/ff2cd48f/attachment.bin>


More information about the llvm-commits mailing list