[PATCH] D15779: [ELF] - Implemented optimization for R_X86_64_GOTPCREL relocation.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 25 09:16:35 PST 2015


grimar created this revision.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar.

System V Application Binary Interface AMD64 Architecture Processor Supplement Draft Version 0.99.8 
(https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-r249.pdf, B.2 "B.2 Optimize GOTPCRELX Relocations")
introduces possible relaxations for GOTPCRELX Relocations.
R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX should be generated instead of R_X86_64_GOTPCREL for places where relaxation is possible.
At the same time nothing stops us from using it right now for R_X86_64_GOTPCREL if we perform additional check of instructions. 
Both gold and bfd do the same for R_X86_64_GOTPCREL now.

That patch implements the next relaxation: mov foo at GOTPCREL(%rip), %reg  =>  lea foo(%rip), %reg

Below link is a patch for gold used as reference.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=1fa29f10602cd0ab395e0f83c9d87ab160b0df8a

http://reviews.llvm.org/D15779

Files:
  ELF/InputSection.cpp
  ELF/Target.cpp
  ELF/Target.h
  ELF/Writer.cpp
  test/ELF/Inputs/gotpc-relax-und-dso.s
  test/ELF/gotpc-relax-und-dso.s
  test/ELF/gotpc-relax.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15779.43635.patch
Type: text/x-patch
Size: 20557 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151225/aa6a42e0/attachment.bin>


More information about the llvm-commits mailing list