From 30ac923dbe7d0c16df8a368150ecd736557508f4 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Wed, 21 Feb 2018 18:01:11 +0000 Subject: Fix -Os getc_unlocked linknamespace, localplt issues (bug 15105, bug 19463). Continuing the fixes for linknamespace and localplt test failures with -Os that arise from functions not being inlined in that case, this patch fixes such failures for getc_unlocked. __getc_unlocked already exists; this patch makes it explicitly hidden, calls it where needed for namespace reasons, adds an inline function for it when inline functions are used and adds libc_hidden_proto / libc_hidden_weak for getc_unlocked. Tested for x86_64 (both without -Os to make sure that case continues to work, and with -Os to make sure all the relevant linknamespace and localplt test failures are resolved). Because of other such failures that remain after this patch, neither of the bugs can yet be closed. [BZ #15105] [BZ #19463] * libio/getc_u.c (getc_unlocked): Use libc_hidden_weak. * include/stdio.h [!_ISOMAC] (__getc_unlocked): Use attribute_hidden, and define inline if [__USE_EXTERN_INLINES]. [!_ISOMAC] (getc_unlocked): Use libc_hidden_proto. * misc/getttyent.c (__getttyent): Call __getc_unlocked instead of getc_unlocked. * time/tzfile.c (__tzfile_read): Likewise. --- include/stdio.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/stdio.h b/include/stdio.h index 1bf49a92b5..937235f59a 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -119,7 +119,7 @@ extern void __funlockfile (FILE *__stream) attribute_hidden; possible. */ extern int __ftrylockfile (FILE *__stream); -extern int __getc_unlocked (FILE *__fp); +extern int __getc_unlocked (FILE *__fp) attribute_hidden; extern wint_t __getwc_unlocked (FILE *__fp); extern int __fxprintf (FILE *__fp, const char *__fmt, ...) @@ -187,6 +187,7 @@ libc_hidden_proto (feof_unlocked) extern __typeof (feof_unlocked) __feof_unlocked attribute_hidden; libc_hidden_proto (ferror_unlocked) extern __typeof (ferror_unlocked) __ferror_unlocked attribute_hidden; +libc_hidden_proto (getc_unlocked) libc_hidden_proto (fmemopen) /* The prototype needs repeating instead of using __typeof to use __THROW in C++ tests. */ @@ -219,6 +220,12 @@ __NTH (__ferror_unlocked (FILE *__stream)) { return __ferror_unlocked_body (__stream); } + +__extern_inline int +__getc_unlocked (FILE *__fp) +{ + return __getc_unlocked_body (__fp); +} # endif # endif /* not _ISOMAC */ -- cgit v1.2.3