[PATCH] D21297: [ELF][MIPS] Support GOT entries for non-preemptible symbols with different addends

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 15 23:08:06 PDT 2016


atanasyan updated this revision to Diff 60947.
atanasyan added a comment.

I was not quite right when said that BFD/Gold linkers are able to handle GOT relocations against preemptable symbols and non-zero addends. The accept such relocations because sometimes we need to create a GOT entry just because we need to create a dynamic relocation and the dynamic relocation handles addend (see http://reviews.llvm.org/rL266921). But anyway each preemptable symbol referenced by GOT relocations got single GOT entry.

In this patch I try to handle GOT relocation for preemptable and non-preemptable symbols uniformly.

- There are only two MIPS GOT specific relocation expressions R_MIPS_GOT_LOCAL_PAGE and R_MIPS_GOT_OFF.
- All GOT entries created for R_MIPS_GOT_OFF expressions stored in `MipsLocal` and `MipsGlobal` vectors.
- We do not need to save addends for preemptable symbol but using the same type for `MipsLocal` and `MipsGlobal` elements simplify the code.
- All GOT offsets calculated by `GotSection<ELFT>::getMipsGotOffset` method. I did not put this code to the `SymbolBody::getGotOffset` to escape exposing `GotSection` implementation details.


Repository:
  rL LLVM

http://reviews.llvm.org/D21297

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-64-disp.s
  test/ELF/mips-64-got.s
  test/ELF/mips-dynamic.s
  test/ELF/mips-got16.s
  test/ELF/mips-plt-copy.s
  test/ELF/mips-sto-plt.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21297.60947.patch
Type: text/x-patch
Size: 30562 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160616/0c91061b/attachment-0001.bin>


More information about the llvm-commits mailing list