]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Replace @PLT with @GOTPCREL(%rip) in call
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 4 Mar 2016 23:28:59 +0000 (15:28 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Sat, 5 Mar 2016 00:15:41 +0000 (16:15 -0800)
Since __libc_start_main is called very early, lazy binding isn't relevant
here.  Use indirect branch via GOT to avoid extra branch to PLT slot.

[BZ #19745]
* sysdeps/x86_64/start.S (_start): __libc_start_main@PLT
with *__libc_start_main@GOTPCREL(%rip) in call.

ChangeLog
sysdeps/x86_64/start.S

index 143d4a65bcfc50a150bcdf18f4f9c554dacf40da..af555291a9a0ceb9620aea1aad4dbf75dd86e156 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-03-04  H.J. Lu  <hongjiu.lu@intel.com>
+
+       [BZ #19745]
+       * sysdeps/x86_64/start.S (_start): Replace __libc_start_main@PLT
+       with *__libc_start_main@GOTPCREL(%rip) in call.
+
 2016-03-04  Roland McGrath  <roland@hack.frob.com>
 
        * Makefile (tests-special): Add $(objpfx)c++-types-check.out only
index 1374974307b4f605cb0ac759d311b3c94b545cf8..2369b69ec359e3d01f2bd16426e51d4ea2fca0ee 100644 (file)
@@ -104,8 +104,10 @@ ENTRY (_start)
        mov main@GOTPCREL(%rip), %RDI_LP
 
        /* Call the user's main function, and exit with its value.
-          But let the libc call main.    */
-       call __libc_start_main@PLT
+          But let the libc call main.  Since __libc_start_main is
+          called very early, lazy binding isn't relevant here.  Use
+          indirect branch via GOT to avoid extra branch to PLT slot.  */
+       call *__libc_start_main@GOTPCREL(%rip)
 #else
        /* Pass address of our own entry points to .fini and .init.  */
        mov $__libc_csu_fini, %R8_LP