Convert indirect calls to direct when possible.
authorSriraman Tallam <tmsriram@google.com>
Tue, 28 Jun 2016 22:42:33 +0000 (15:42 -0700)
committerSriraman Tallam <tmsriram@google.com>
Tue, 28 Jun 2016 22:42:33 +0000 (15:42 -0700)
commit3a4f096e5ff41e2a3b832cf6c815ad1f28437c63
tree4b687f6684621526904028771534d04e5da2f0bf
parent8032ac03390ca5bc33f8efe29447d0a4bc492950
Convert indirect calls to direct when possible.

Please see patch discussion:
https://www.sourceware.org/ml/binutils/2016-05/msg00322.html

2016-06-28  Sriraman Tallam  <tmsriram@google.com>

* x86_64.cc (Lazy_view): New class.
(can_convert_mov_to_lea): Templatize function.  Make the function
check for appropriate relocation types and use the view parameter
to get section contents.
(can_convert_callq_to_direct): New function.
(Target_x86_64<size>::Scan::global): Refactor.
(Target_x86_64<size>::Relocate::relocate): Refactor. Change any indirect
call via GOT that can be converted.
* testsuite/Makefile.am (x86_64_indirect_call_to_direct.sh): New test.
* testsuite/Makefile.in: Regenerate.
* testsuite/x86_64_indirect_call_to_direct1.s: New file.
* testsuite/x86_64_indirect_jump_to_direct1.s: New file.
gold/ChangeLog
gold/testsuite/Makefile.am
gold/testsuite/Makefile.in
gold/testsuite/x86_64_indirect_call_to_direct.sh [new file with mode: 0755]
gold/testsuite/x86_64_indirect_call_to_direct1.s [new file with mode: 0644]
gold/testsuite/x86_64_indirect_jump_to_direct1.s [new file with mode: 0644]
gold/x86_64.cc