[PATCH] D25833: [ELF][MIPS] Put local GOT entries accessed via a 16-bit index first

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 20 11:03:24 PDT 2016


atanasyan created this revision.
atanasyan added a reviewer: ruiu.
atanasyan added a subscriber: llvm-commits.
atanasyan set the repository for this revision to rL LLVM.
atanasyan added a project: lld.
Herald added a subscriber: sdardis.

Some MIPS relocations used to access GOT entries are able to manipulate 16-bit index. The other ones like R_MIPS_CALL_HI16/LO16 can handle 32-bit indexes. 16-bit relocations are generated by default. The 32-bit relocations are generated by -mxgot flag passed to compiler. Usually these relocation are not mixed in the same code but files like crt*.o contain 16-bit relocations so even if all "user's" code compiled with -mxgot flag a few 16-bit relocations might come to the linking phase.

Now LLD does not differentiate local GOT entries accessed via a 16-bit and 32-bit indexes. That might lead to relocation's overflow if 16-bit entries are allocated to far from the beginning of the GOT.

The patch introduces new "part" of MIPS GOT dedicated to the local GOT entries accessed by 32-bit relocations. That allows to put local GOT entries accessed via a 16-bit index first and escape relocation's overflow.


Repository:
  rL LLVM

https://reviews.llvm.org/D25833

Files:
  ELF/InputSection.cpp
  ELF/OutputSections.cpp
  ELF/OutputSections.h
  ELF/Relocations.cpp
  ELF/Relocations.h
  ELF/Symbols.cpp
  ELF/Symbols.h
  ELF/Target.cpp
  test/ELF/mips-xgot-order.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25833.75319.patch
Type: text/x-patch
Size: 8629 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161020/e70df6af/attachment.bin>


More information about the llvm-commits mailing list