From 039c721a30392790be50dba53b4c72dbcd65be67 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Wed, 21 Feb 2018 18:02:24 +0000 Subject: Fix -Os putc_unlocked, fputc_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 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 [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. --- libio/fputc_u.c | 1 + libio/putc_u.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'libio') diff --git a/libio/fputc_u.c b/libio/fputc_u.c index abe07f33d3..25e2035cf4 100644 --- a/libio/fputc_u.c +++ b/libio/fputc_u.c @@ -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) diff --git a/libio/putc_u.c b/libio/putc_u.c index 61ca95beda..2d122a6d23 100644 --- a/libio/putc_u.c +++ b/libio/putc_u.c @@ -21,8 +21,10 @@ #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) -- cgit 1.4.1