]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix -Os putc_unlocked, fputc_unlocked linknamespace, localplt issues (bug 15105,...
authorJoseph Myers <joseph@codesourcery.com>
Wed, 21 Feb 2018 18:02:24 +0000 (18:02 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Wed, 21 Feb 2018 18:02:24 +0000 (18:02 +0000)
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 putc_unlocked and fputc_unlocked.

libc_hidden_* are used for both functions, while namespace issues are
addressed by making putc_unlocked a weak alias of hidden
__putc_unlocked, which is called in the one place where namespace
issues arise (and defined as an inline function in include/stdio.h).

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).  This completes fixing the -Os
linknamespace failures (at least for x86_64); localplt failures remain
after this patch.

2018-02-19  Joseph Myers  <joseph@codesourcery.com>

[BZ #15105]
[BZ #19463]
* libio/fputc_u.c (fputc_unlocked): Use libc_hidden_def.
* libio/putc_u.c (putc_unlocked): Rename to __putc_unlocked and
define as weak alias of __putc_unlocked.  Use libc_hidden_weak.
* include/stdio.h [!_ISOMAC] (fputc_unlocked): Use
libc_hidden_proto.
[!_ISOMAC] (putc_unlocked): Likewise.
[!_ISOMAC] (__putc_unlocked): Declare as hidden function, and
define inline if [__USE_EXTERN_INLINES].
* misc/syslog.c (__vsyslog_chk): Call __putc_unlocked instead of
putc_unlocked.

ChangeLog
include/stdio.h
libio/fputc_u.c
libio/putc_u.c
misc/syslog.c

index d9249a15358d620577a1ef01effb0e7a08d7117e..64d0cfaa7ae10f3f0f35fe89341804a71ad7d01a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2018-02-21  Joseph Myers  <joseph@codesourcery.com>
 
+       [BZ #15105]
+       [BZ #19463]
+       * libio/fputc_u.c (fputc_unlocked): Use libc_hidden_def.
+       * libio/putc_u.c (putc_unlocked): Rename to __putc_unlocked and
+       define as weak alias of __putc_unlocked.  Use libc_hidden_weak.
+       * include/stdio.h [!_ISOMAC] (fputc_unlocked): Use
+       libc_hidden_proto.
+       [!_ISOMAC] (putc_unlocked): Likewise.
+       [!_ISOMAC] (__putc_unlocked): Declare as hidden function, and
+       define inline if [__USE_EXTERN_INLINES].
+       * misc/syslog.c (__vsyslog_chk): Call __putc_unlocked instead of
+       putc_unlocked.
+
        [BZ #15105]
        [BZ #19463]
        * libio/getc_u.c (getc_unlocked): Use libc_hidden_weak.
index 937235f59a8097d3c19650cfcd4a1d8511ef46cb..aac5acdb2fb4abb35ad3363ba202d6aef1bcb5a4 100644 (file)
@@ -188,6 +188,9 @@ 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 (fputc_unlocked)
+libc_hidden_proto (putc_unlocked)
+extern __typeof (putc_unlocked) __putc_unlocked attribute_hidden;
 libc_hidden_proto (fmemopen)
 /* The prototype needs repeating instead of using __typeof to use
    __THROW in C++ tests.  */
@@ -226,6 +229,12 @@ __getc_unlocked (FILE *__fp)
 {
   return __getc_unlocked_body (__fp);
 }
+
+__extern_inline int
+__putc_unlocked (int __c, FILE *__stream)
+{
+  return __putc_unlocked_body (__c, __stream);
+}
 #  endif
 
 # endif /* not _ISOMAC */
index abe07f33d3c9b8a95570f8a0b7a4d10dfc47e0d2..25e2035cf49149e2991e83e957919b878bd1e79f 100644 (file)
@@ -35,3 +35,4 @@ fputc_unlocked (int c, _IO_FILE *fp)
   CHECK_FILE (fp, EOF);
   return _IO_putc_unlocked (c, fp);
 }
+libc_hidden_def (fputc_unlocked)
index 61ca95bedaa623f54a590e2c1088434981c7f75d..2d122a6d23c24ce1b81cf97c44998940613b0574 100644 (file)
 #undef putc_unlocked
 
 int
-putc_unlocked (int c, _IO_FILE *fp)
+__putc_unlocked (int c, _IO_FILE *fp)
 {
   CHECK_FILE (fp, EOF);
   return _IO_putc_unlocked (c, fp);
 }
+weak_alias (__putc_unlocked, putc_unlocked)
+libc_hidden_weak (putc_unlocked)
index 2b6bd373bc0c8a60844d3364095436ccf20cee88..644dbe80ec0b90d208515c95a53ba2d1ea86dd74 100644 (file)
@@ -207,8 +207,8 @@ __vsyslog_chk(int pri, int flag, const char *fmt, va_list ap)
              fprintf (f, "[%d]", (int) __getpid ());
            if (LogTag != NULL)
              {
-               putc_unlocked (':', f);
-               putc_unlocked (' ', f);
+               __putc_unlocked (':', f);
+               __putc_unlocked (' ', f);
              }
 
            /* Restore errno for %m format.  */