public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Roland McGrath <roland@hack.frob.com>
To: "GNU C. Library" <libc-alpha@sourceware.org>
Subject: [COMMITTED PATCH] PLT avoidance for _exit in rtld.
Date: Thu, 09 Jul 2015 22:28:00 -0000	[thread overview]
Message-ID: <20150709222814.C47F62C39DC@topped-with-meat.com> (raw)

This saves 24 bytes of code on i686-linux-gnu, where calls the compiler
thinks will use the PLT (but actually won't at link time) require setting
up %ebx.  It has no effect at all on x86_64-linux-gnu (and probably most or
all other machines).


Thanks,
Roland


2015-07-09  Roland McGrath  <roland@hack.frob.com>

	* include/unistd.h: Add rtld_hidden_proto for _exit.
	* posix/_exit.c: Add rtld_hidden_def.
	* sysdeps/mach/hurd/_exit.c: Likewise.
	* sysdeps/nacl/_exit.c: Likewise.
	* sysdeps/unix/sysv/linux/_exit.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/_exit.S: Likewise.

diff --git a/include/unistd.h b/include/unistd.h
index 61df3af..fbba393 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -5,6 +5,7 @@
 __BEGIN_DECLS
 
 libc_hidden_proto (_exit, __noreturn__)
+rtld_hidden_proto (_exit, __noreturn__)
 libc_hidden_proto (alarm)
 libc_hidden_proto (confstr)
 libc_hidden_proto (execl)
diff --git a/posix/_exit.c b/posix/_exit.c
index ceff1a3..f4d76a1 100644
--- a/posix/_exit.c
+++ b/posix/_exit.c
@@ -29,6 +29,7 @@ _exit (status)
   abort ();
 }
 libc_hidden_def (_exit)
+rtld_hidden_def (_exit)
 weak_alias (_exit, _Exit)
 
 stub_warning (_exit)
diff --git a/sysdeps/mach/hurd/_exit.c b/sysdeps/mach/hurd/_exit.c
index 15c21fc..978b68f 100644
--- a/sysdeps/mach/hurd/_exit.c
+++ b/sysdeps/mach/hurd/_exit.c
@@ -52,4 +52,5 @@ _exit (status)
   _hurd_exit (W_EXITCODE (status, 0));
 }
 libc_hidden_def (_exit)
+rtld_hidden_def (_exit)
 weak_alias (_exit, _Exit)
diff --git a/sysdeps/nacl/_exit.c b/sysdeps/nacl/_exit.c
index 6006e26..b3b32ee 100644
--- a/sysdeps/nacl/_exit.c
+++ b/sysdeps/nacl/_exit.c
@@ -31,4 +31,5 @@ _exit (int status)
     __builtin_trap ();
 }
 libc_hidden_def (_exit)
+rtld_hidden_def (_exit)
 weak_alias (_exit, _Exit)
diff --git a/sysdeps/unix/sysv/linux/_exit.c b/sysdeps/unix/sysv/linux/_exit.c
index 7228181..2294c80 100644
--- a/sysdeps/unix/sysv/linux/_exit.c
+++ b/sysdeps/unix/sysv/linux/_exit.c
@@ -39,4 +39,5 @@ _exit (status)
     }
 }
 libc_hidden_def (_exit)
+rtld_hidden_def (_exit)
 weak_alias (_exit, _Exit)
diff --git a/sysdeps/unix/sysv/linux/i386/_exit.S b/sysdeps/unix/sysv/linux/i386/_exit.S
index 8841110..f470be8 100644
--- a/sysdeps/unix/sysv/linux/i386/_exit.S
+++ b/sysdeps/unix/sysv/linux/i386/_exit.S
@@ -40,4 +40,5 @@ _exit:
 	.size	_exit,.-_exit
 
 libc_hidden_def (_exit)
+rtld_hidden_def (_exit)
 weak_alias (_exit, _Exit)

                 reply	other threads:[~2015-07-09 22:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150709222814.C47F62C39DC@topped-with-meat.com \
    --to=roland@hack.frob.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).