From patchwork Fri Jun 12 22:26:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 483776 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id CDD1D1401F0 for ; Sat, 13 Jun 2015 08:26:21 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=sourceware.org header.i=@sourceware.org header.b=N4izZrLP; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; q=dns; s=default; b=lKrpucQNEt+wMAd7SkOIeWEzDiNXp 6m6VCbDqZVSB2+SFm5GcZ9EDD1xzdWhIxkut7mZMZ9l/sTNOlGMWwX+SeI0CNzS3 QowoHGsAXnT9cddux6vgb/mFMazKpnkFOMcCYOAFEGJ/SY0SzuuSHfjUKHHHoH3r MntXHqELti5Gx4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; s=default; bh=Hn8Xii0uFu9GaxeQsz7aULXcVt8=; b=N4i zZrLP/xQhLK4NzQ4kDDCfnkb3In6gytG8LuDsugDhYJKPGDT+Nc8lWOyroUlaJ69 unlU4u0MnRgLCVvbk23e/XmssxVNvsbPa3boG+YvF9Vl7QFkH5jTAkwUvAmnyITa L1uFsTVv4ys59jofrxwyDZLbwLX5wtSZXSvZVsxY= Received: (qmail 110924 invoked by alias); 12 Jun 2015 22:26:15 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 110911 invoked by uid 89); 12 Jun 2015 22:26:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Date: Fri, 12 Jun 2015 22:26:06 +0000 From: Joseph Myers To: Subject: Fix syslog fputs_unlocked namespace (bug 18530) Message-ID: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 syslog (XSI POSIX) brings in references to fputs_unlocked (not POSIX). This patch fixes this by making fputs_unlocked into a weak alias for __fputs_unlocked and using __fputs_unlocked as needed. (No linknamespace test XFAILs are removed because there are other failures from syslog as well.) Tested for x86_64 and x86 (testsuite, and comparison of disassembly of installed stripped shared libraries). Disassembly of installed stripped shared libraries is unchanged on x86_64; on x86, I see some small changes to instruction ordering and register choice, with no apparent reason for such changes to be related to this patch, but they also seem completely harmless with no change to code size. 2015-06-12 Joseph Myers [BZ #18530] * libio/iofputs.c [!_IO_MTSAFE_IO] (__fputs_unlocked): Define as strong alias of _IO_fputs. Use libc_hidden_def. * libio/iofputs_u.c (fputs_unlocked): Rename to __fputs_unlocked and define as weak alias of __fputs_unlocked. Use libc_hidden_weak. * include/stdio.h (__fputs_unlocked): Declare. Use libc_hidden_proto. * misc/syslog.c (__vsyslog_chk): Call __fputs_unlocked instead of fputs_unlocked. diff --git a/include/stdio.h b/include/stdio.h index 489e419..6ae70a3 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -159,6 +159,8 @@ libc_hidden_proto (fgets_unlocked) extern __typeof (fgets_unlocked) __fgets_unlocked; libc_hidden_proto (__fgets_unlocked) libc_hidden_proto (fputs_unlocked) +extern __typeof (fputs_unlocked) __fputs_unlocked; +libc_hidden_proto (__fputs_unlocked) libc_hidden_proto (fmemopen) /* The prototype needs repeating instead of using __typeof to use __THROW in C++ tests. */ diff --git a/libio/iofputs.c b/libio/iofputs.c index 00c1cba..d1e34e4 100644 --- a/libio/iofputs.c +++ b/libio/iofputs.c @@ -48,6 +48,8 @@ libc_hidden_def (_IO_fputs) weak_alias (_IO_fputs, fputs) # ifndef _IO_MTSAFE_IO +strong_alias (_IO_fputs, __fputs_unlocked) +libc_hidden_def (__fputs_unlocked) weak_alias (_IO_fputs, fputs_unlocked) libc_hidden_ver (_IO_fputs, fputs_unlocked) # endif diff --git a/libio/iofputs_u.c b/libio/iofputs_u.c index 6f79838..f823686 100644 --- a/libio/iofputs_u.c +++ b/libio/iofputs_u.c @@ -29,7 +29,7 @@ #include int -fputs_unlocked (str, fp) +__fputs_unlocked (str, fp) const char *str; _IO_FILE *fp; { @@ -40,4 +40,6 @@ fputs_unlocked (str, fp) result = 1; return result; } -libc_hidden_def (fputs_unlocked) +libc_hidden_def (__fputs_unlocked) +weak_alias (__fputs_unlocked, fputs_unlocked) +libc_hidden_weak (fputs_unlocked) diff --git a/misc/syslog.c b/misc/syslog.c index 23a4f7b..3979f42 100644 --- a/misc/syslog.c +++ b/misc/syslog.c @@ -202,7 +202,7 @@ __vsyslog_chk(int pri, int flag, const char *fmt, va_list ap) if (LogTag == NULL) LogTag = __progname; if (LogTag != NULL) - fputs_unlocked (LogTag, f); + __fputs_unlocked (LogTag, f); if (LogStat & LOG_PID) fprintf (f, "[%d]", (int) __getpid ()); if (LogTag != NULL)