public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/google/grte/v5-2.27/master] Fix -Os ferror_unlocked linknamespace, localplt issues (bug 15105, bug 19463).
@ 2021-11-15 22:40 Fangrui Song
  0 siblings, 0 replies; only message in thread
From: Fangrui Song @ 2021-11-15 22:40 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4525e7b469e2418cb0d532f42f71b46c209e08b2

commit 4525e7b469e2418cb0d532f42f71b46c209e08b2
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Mon Feb 19 17:32:34 2018 +0000

    Fix -Os ferror_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 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.
    
    (cherry picked from commit ec481ad81b0436460de417a8e0084935b3763ebb)

Diff:
---
 include/stdio.h  | 8 ++++++++
 libio/ferror_u.c | 4 +++-
 time/getdate.c   | 2 +-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/include/stdio.h b/include/stdio.h
index 820ba5491f..2da3452c2b 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -180,6 +180,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.  */
@@ -206,6 +208,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 */
diff --git a/libio/ferror_u.c b/libio/ferror_u.c
index afd0bef225..3eaf84e074 100644
--- a/libio/ferror_u.c
+++ b/libio/ferror_u.c
@@ -30,8 +30,10 @@
 #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)
diff --git a/time/getdate.c b/time/getdate.c
index 29ad760c29..e568149cdf 100644
--- a/time/getdate.c
+++ b/time/getdate.c
@@ -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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-15 22:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 22:40 [glibc/google/grte/v5-2.27/master] Fix -Os ferror_unlocked linknamespace, localplt issues (bug 15105, bug 19463) Fangrui Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).