Convert mov foo@GOT(%reg), %reg to lea foo@GOTOFF(%reg), %reg
authorIlya Tocar <ilya.tocar@intel.com>
Wed, 1 Apr 2015 13:48:38 +0000 (16:48 +0300)
committerIlya Tocar <ilya.tocar@intel.com>
Wed, 1 Apr 2015 13:52:09 +0000 (16:52 +0300)
commitc4fc4724a6afd605692b24c0af24c7e234dc5ace
treeef7b18e27f5dcaffe75a1d7bf68dc0ec0349d88a
parent918357b9556c9eaf81129ea6691bb6e461e80f86
Convert mov foo@GOT(%reg), %reg to lea foo@GOTOFF(%reg), %reg

2015-04-01  Ilya Tocar  <ilya.tocar@intel.com>

PR gold/17640
* i386.cc (Target_i386::can_convert_mov_to_lea): New.
(Target_i386::Scan::local): Don't create GOT entry, when we
can convert GOT to GOTOFF.
(Target_i386::Scan::global): Ditto.
(Target_i386::Relocate::relocate): Convert  mov foo@GOT(%reg), %reg to
lea foo@GOTOFF(%reg), %reg if possible.
* testsuite/Makefile.am (i386_mov_to_lea): New test.
* testsuite/i386_mov_to_lea1.s: New.
* testsuite/i386_mov_to_lea2.s: Ditto.
* testsuite/i386_mov_to_lea3.s: Ditto.
* testsuite/i386_mov_to_lea4.s: Ditto.
* testsuite/i386_mov_to_lea5.s: Ditto.
* testsuite/i386_mov_to_lea.sh: Ditto.
gold/ChangeLog
gold/i386.cc
gold/testsuite/Makefile.am
gold/testsuite/i386_mov_to_lea.sh [new file with mode: 0755]
gold/testsuite/i386_mov_to_lea1.s [new file with mode: 0644]
gold/testsuite/i386_mov_to_lea2.s [new file with mode: 0644]
gold/testsuite/i386_mov_to_lea3.s [new file with mode: 0644]
gold/testsuite/i386_mov_to_lea4.s [new file with mode: 0644]
gold/testsuite/i386_mov_to_lea5.s [new file with mode: 0644]