diff mbox

[18/58] Mark internal utmp functions with attribute_hidden [BZ #18822]

Message ID 20170901180029.9527-19-hjl.tools@gmail.com
State New, archived
Headers show

Commit Message

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

	[BZ #18822]
	* include/utmp.h (__updwtmp): Add attribute_hidden.
	(__utmpname): Likewise.
	(__getutent): Likewise.
	(__setutent): Likewise.
	(__endutent): Likewise.
	(__getutid): Likewise.
	(__getutline): Likewise.
	(__pututline): Likewise.
	(__getutent_r): Likewise.
	(__getutid_r): Likewise.
	(__getutline_r): Likewise.
---
 include/utmp.h | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

Comments

Florian Weimer Sept. 2, 2017, 8:58 p.m. UTC | #1
On 09/01/2017 07:59 PM, H.J. Lu wrote:
> Mark internal utmp functions with attribute_hidden to allow direct
> access within libc.so and libc.a without using GOT nor PLT.
> 
> 	[BZ #18822]
> 	* include/utmp.h (__updwtmp): Add attribute_hidden.
> 	(__utmpname): Likewise.
> 	(__getutent): Likewise.

I believe this causes:

/home/bmg/build/glibcs/s390-linux-gnu/glibc/login/utmpdump.o: In
function `main':
/home/bmg/build/glibcs/s390-linux-gnu/glibc-src/login/programs/utmpdump.c:93:
undefined reference to `getutent'
collect2: error: ld returned 1 exit status

That's presumably due to the renaming business in
sysdeps/unix/sysv/linux/s390/s390-32/getutent*.c

Thanks,
Florian
diff mbox

Patch

diff --git a/include/utmp.h b/include/utmp.h
index 6b2e262362..38538963e2 100644
--- a/include/utmp.h
+++ b/include/utmp.h
@@ -4,19 +4,25 @@ 
 # ifndef _ISOMAC
 
 /* Now define the internal interfaces.  */
-extern void __updwtmp (const char *__wtmp_file, const struct utmp *__utmp);
-extern int __utmpname (const char *__file);
-extern struct utmp *__getutent (void);
-extern void __setutent (void);
-extern void __endutent (void);
-extern struct utmp *__getutid (const struct utmp *__id);
-extern struct utmp *__getutline (const struct utmp *__line);
-extern struct utmp *__pututline (const struct utmp *__utmp_ptr);
-extern int __getutent_r (struct utmp *__buffer, struct utmp **__result);
+extern void __updwtmp (const char *__wtmp_file, const struct utmp *__utmp)
+     attribute_hidden;
+extern int __utmpname (const char *__file) attribute_hidden;
+extern struct utmp *__getutent (void) attribute_hidden;
+extern void __setutent (void) attribute_hidden;
+extern void __endutent (void) attribute_hidden;
+extern struct utmp *__getutid (const struct utmp *__id) attribute_hidden;
+extern struct utmp *__getutline (const struct utmp *__line)
+     attribute_hidden;
+extern struct utmp *__pututline (const struct utmp *__utmp_ptr)
+     attribute_hidden;
+extern int __getutent_r (struct utmp *__buffer, struct utmp **__result)
+     attribute_hidden;
 extern int __getutid_r (const struct utmp *__id, struct utmp *__buffer,
-			struct utmp **__result);
+			struct utmp **__result)
+     attribute_hidden;
 extern int __getutline_r (const struct utmp *__line,
-			  struct utmp *__buffer, struct utmp **__result);
+			  struct utmp *__buffer, struct utmp **__result)
+     attribute_hidden;
 
 libutil_hidden_proto (login_tty)