]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix -Os ferror_unlocked linknamespace, localplt issues (bug 15105, bug 19463).
authorJoseph Myers <joseph@codesourcery.com>
Mon, 19 Feb 2018 17:32:34 +0000 (17:32 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Mon, 19 Feb 2018 17:32:34 +0000 (17:32 +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 ferror_unlocked.

The usual approach is followed of adding __ferror_unlocked (inlined
when ferror_unlocked is), making calls use it when required for
namespace reasons (only one such call), and using libc_hidden_proto /
libc_hidden_weak for the ferror_unlocked weak alias when only localplt
but not namespace issues are involved.

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/ferror_u.c (ferror_unlocked): Rename to __ferror_unlocked
and define as weak alias of __ferror_unlocked.  Use
libc_hidden_weak.
* include/stdio.h [!_ISOMAC] (ferror_unlocked): Use
libc_hidden_proto.
[!_ISOMAC] (__ferror_unlocked) New declaration, and inline
function if [__USE_EXTERN_INLINES].
* time/getdate.c (__getdate_r): Call __ferror_unlocked instead of
ferror_unlocked.

ChangeLog
include/stdio.h
libio/ferror_u.c
time/getdate.c

index 35bf20ac11a321b2d56fff9e35c7d3fb7f9a6065..de48635f3f90a556cd23eab3fc279b0ed861b129 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2018-02-19  Joseph Myers  <joseph@codesourcery.com>
+
+       [BZ #15105]
+       [BZ #19463]
+       * libio/ferror_u.c (ferror_unlocked): Rename to __ferror_unlocked
+       and define as weak alias of __ferror_unlocked.  Use
+       libc_hidden_weak.
+       * include/stdio.h [!_ISOMAC] (ferror_unlocked): Use
+       libc_hidden_proto.
+       [!_ISOMAC] (__ferror_unlocked) New declaration, and inline
+       function if [__USE_EXTERN_INLINES].
+       * time/getdate.c (__getdate_r): Call __ferror_unlocked instead of
+       ferror_unlocked.
+
 2018-02-19  Rical Jasan  <ricaljasan@pacific.net>
 
        [BZ #6889]
index 7871000071956419686d56dcafa7e50c76b18f0c..1bf49a92b55e5368ae70e617a3405f6b5a35a407 100644 (file)
@@ -185,6 +185,8 @@ extern __typeof (fputs_unlocked) __fputs_unlocked;
 libc_hidden_proto (__fputs_unlocked)
 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 (fmemopen)
 /* The prototype needs repeating instead of using __typeof to use
    __THROW in C++ tests.  */
@@ -211,6 +213,12 @@ __NTH (__feof_unlocked (FILE *__stream))
 {
   return __feof_unlocked_body (__stream);
 }
+
+__extern_inline int
+__NTH (__ferror_unlocked (FILE *__stream))
+{
+  return __ferror_unlocked_body (__stream);
+}
 #  endif
 
 # endif /* not _ISOMAC */
index afd0bef225ecf1430ff79a1a072f5feb89babac9..3eaf84e07430d494f45ceae21b380e9838a2ecac 100644 (file)
 #undef ferror_unlocked
 
 int
-ferror_unlocked (_IO_FILE *fp)
+__ferror_unlocked (_IO_FILE *fp)
 {
   CHECK_FILE (fp, EOF);
   return _IO_ferror_unlocked (fp);
 }
+weak_alias (__ferror_unlocked, ferror_unlocked)
+libc_hidden_weak (ferror_unlocked)
index 29ad760c29480000dd65b37b18c4aa92d49b9222..e568149cdf63883a45b9dc95c7bbf7c50663f8ef 100644 (file)
@@ -206,7 +206,7 @@ __getdate_r (const char *string, struct tm *tp)
   free (line);
 
   /* Check for errors. */
-  if (ferror_unlocked (fp))
+  if (__ferror_unlocked (fp))
     {
       fclose (fp);
       return 5;