[07/58] Mark internal grp/pwd/shadow functions with attribute_hidden [BZ #18822]

Message ID 20170901180029.9527-8-hjl.tools@gmail.com
State Committed
Commit 783cd767af5f3746b639f76b1de5e0e3c3d64683
Headers

Commit Message

H.J. Lu Sept. 1, 2017, 5:59 p.m. UTC
  Mark internal grp/pwd/shadow functions with attribute_hidden to allow
direct access within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* include/grp.h (__fgetgrent_r): Add attribute_hidden.
	(__getgrgid_r): Likewise.
	(__getgrnam_r): Likewise.
	* include/pwd.h (__getpwuid_r): Likewise.
	(__getpwnam_r): Likewise.
	(__fgetpwent_r): Likewise.
	* include/shadow.h (__getspnam_r): Likewise.
	(__sgetspent_r): Likewise.
	(__fgetspent_r): Likewise.
---
 include/grp.h    | 6 +++---
 include/pwd.h    | 6 +++---
 include/shadow.h | 7 ++++---
 3 files changed, 10 insertions(+), 9 deletions(-)
  

Comments

H.J. Lu Oct. 1, 2017, 9:44 p.m. UTC | #1
On 9/1/17, H.J. Lu <hjl.tools@gmail.com> wrote:
> Mark internal grp/pwd/shadow functions with attribute_hidden to allow
> direct access within libc.so and libc.a without using GOT nor PLT.
>
> 	[BZ #18822]
> 	* include/grp.h (__fgetgrent_r): Add attribute_hidden.
> 	(__getgrgid_r): Likewise.
> 	(__getgrnam_r): Likewise.
> 	* include/pwd.h (__getpwuid_r): Likewise.
> 	(__getpwnam_r): Likewise.
> 	(__fgetpwent_r): Likewise.
> 	* include/shadow.h (__getspnam_r): Likewise.
> 	(__sgetspent_r): Likewise.
> 	(__fgetspent_r): Likewise.

Tested with build-many-glibcs.py.  I am checking it in.
  

Patch

diff --git a/include/grp.h b/include/grp.h
index 0fb5c9a574..871701adbe 100644
--- a/include/grp.h
+++ b/include/grp.h
@@ -12,12 +12,12 @@  extern int __old_getgrent_r (struct group *__resultbuf, char *buffer,
 			     size_t __buflen, struct group **__result);
 extern int __fgetgrent_r (FILE * __stream, struct group *__resultbuf,
 			  char *buffer, size_t __buflen,
-			  struct group **__result);
+			  struct group **__result) attribute_hidden;
 
 /* Search for an entry with a matching group ID.  */
 extern int __getgrgid_r (__gid_t __gid, struct group *__resultbuf,
 			 char *__buffer, size_t __buflen,
-			 struct group **__result);
+			 struct group **__result) attribute_hidden;
 extern int __old_getgrgid_r (__gid_t __gid, struct group *__resultbuf,
 			     char *__buffer, size_t __buflen,
 			     struct group **__result);
@@ -25,7 +25,7 @@  extern int __old_getgrgid_r (__gid_t __gid, struct group *__resultbuf,
 /* Search for an entry with a matching group name.  */
 extern int __getgrnam_r (const char *__name, struct group *__resultbuf,
 			 char *__buffer, size_t __buflen,
-			 struct group **__result);
+			 struct group **__result) attribute_hidden;
 extern int __old_getgrnam_r (const char *__name, struct group *__resultbuf,
 			     char *__buffer, size_t __buflen,
 			     struct group **__result);
diff --git a/include/pwd.h b/include/pwd.h
index 3b0f72540c..fc995065d9 100644
--- a/include/pwd.h
+++ b/include/pwd.h
@@ -10,19 +10,19 @@  extern int __old_getpwent_r (struct passwd *__resultbuf, char *__buffer,
 			     size_t __buflen, struct passwd **__result);
 extern int __getpwuid_r (__uid_t __uid, struct passwd *__resultbuf,
 			 char *__buffer, size_t __buflen,
-			 struct passwd **__result);
+			 struct passwd **__result) attribute_hidden;
 extern int __old_getpwuid_r (__uid_t __uid, struct passwd *__resultbuf,
 			     char *__buffer, size_t __buflen,
 			     struct passwd **__result);
 extern int __getpwnam_r (const char *__name, struct passwd *__resultbuf,
 			 char *__buffer, size_t __buflen,
-			 struct passwd **__result);
+			 struct passwd **__result) attribute_hidden;
 extern int __old_getpwnam_r (const char *__name, struct passwd *__resultbuf,
 			     char *__buffer, size_t __buflen,
 			     struct passwd **__result);
 extern int __fgetpwent_r (FILE * __stream, struct passwd *__resultbuf,
 			  char *__buffer, size_t __buflen,
-			  struct passwd **__result);
+			  struct passwd **__result) attribute_hidden;
 
 #include <nss.h>
 
diff --git a/include/shadow.h b/include/shadow.h
index 124a1ab50a..366ea83482 100644
--- a/include/shadow.h
+++ b/include/shadow.h
@@ -11,16 +11,17 @@  extern int __old_getspent_r (struct spwd *__result_buf, char *__buffer,
 			     size_t __buflen, struct spwd **__result);
 extern int __getspnam_r (const char *__name, struct spwd *__result_buf,
 			 char *__buffer, size_t __buflen,
-			 struct spwd **__result);
+			 struct spwd **__result) attribute_hidden;
 extern int __old_getspnam_r (const char *__name, struct spwd *__result_buf,
 			     char *__buffer, size_t __buflen,
 			     struct spwd **__result);
 extern int __sgetspent_r (const char *__string,
 			  struct spwd *__result_buf, char *__buffer,
-			  size_t __buflen, struct spwd **__result);
+			  size_t __buflen, struct spwd **__result)
+     attribute_hidden;
 extern int __fgetspent_r (FILE *__stream, struct spwd *__result_buf,
 			  char *__buffer, size_t __buflen,
-			  struct spwd **__result);
+			  struct spwd **__result) attribute_hidden;
 extern int __lckpwdf (void);
 extern int __ulckpwdf (void);