public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* PATCH: Replace @PLT with @GOTPCREL(%rip) in call
@ 2016-03-03 13:21 H.J. Lu
  2016-03-04  0:03 ` Roland McGrath
  0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 2016-03-03 13:21 UTC (permalink / raw)
  To: GNU C Library

Since both PREINIT_FUNCTION and __libc_start_main are defined externally, 
they are called via PLT.  Use "call *func@GOTPCREL(%rip)" removes the
extra branch to PLT entry.

	[BZ #19745]
	* sysdeps/x86_64/crti.S (_init): Replace @PLT with
	@GOTPCREL(%rip) in call.
	* sysdeps/x86_64/start.S (_start): Likewise.
---
 sysdeps/x86_64/crti.S   |  2 +-
 sysdeps/x86_64/start.S  |  2 +-
 sysdeps/x86_64/sysdep.h | 14 +++++++++++---
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/sysdeps/x86_64/crti.S b/sysdeps/x86_64/crti.S
index a345259..3dff141 100644
--- a/sysdeps/x86_64/crti.S
+++ b/sysdeps/x86_64/crti.S
@@ -66,7 +66,7 @@ _init:
 	movq PREINIT_FUNCTION@GOTPCREL(%rip), %rax
 	testq %rax, %rax
 	je .Lno_weak_fn
-	call PREINIT_FUNCTION@PLT
+	call *PREINIT_FUNCTION@GOTPCREL(%rip)
 .Lno_weak_fn:
 #else
 	call PREINIT_FUNCTION
diff --git a/sysdeps/x86_64/start.S b/sysdeps/x86_64/start.S
index 1374974..22b18ae 100644
--- a/sysdeps/x86_64/start.S
+++ b/sysdeps/x86_64/start.S
@@ -105,7 +105,7 @@ ENTRY (_start)
 
 	/* Call the user's main function, and exit with its value.
 	   But let the libc call main.	  */
-	call __libc_start_main@PLT
+	call *__libc_start_main@GOTPCREL(%rip)
 #else
 	/* Pass address of our own entry points to .fini and .init.  */
 	mov $__libc_csu_fini, %R8_LP

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-03-04 23:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-03 13:21 PATCH: Replace @PLT with @GOTPCREL(%rip) in call H.J. Lu
2016-03-04  0:03 ` Roland McGrath
2016-03-04 23:40   ` H.J. Lu
2016-03-04 23:46     ` Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).