From patchwork Tue Mar 18 05:54:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 137 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx21.g.dreamhost.com (caibbdcaaahb.dreamhost.com [208.113.200.71]) by wilcox.dreamhost.com (Postfix) with ESMTP id 8CDBB3600D7 for ; Mon, 17 Mar 2014 22:53:30 -0700 (PDT) Received: by homiemail-mx21.g.dreamhost.com (Postfix, from userid 14307373) id 2AC60C91427; Mon, 17 Mar 2014 22:53:30 -0700 (PDT) X-Original-To: glibc@patchwork.siddhesh.in Delivered-To: x14307373@homiemail-mx21.g.dreamhost.com 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 homiemail-mx21.g.dreamhost.com (Postfix) with ESMTPS id F39D4C98425 for ; Mon, 17 Mar 2014 22:53:29 -0700 (PDT) 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=ttX9GR5PcjgKwnS5n0ZZSmFF3NHj8 QzwapCRrWGiyWJvqYMVfySkwQrKKx/avOgj/7lYe1uTxYtooj5kL7gEyAEBSRzuK NaqtDnf6gsuBt9YOcxUA0ctLsExRvEMhubzhjEEHsbc50MC4IH2rwtO3N19tVC6z ScToeSxxISzkZs= 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=RIkERSjvkxepzIyewhOKY/gLtII=; b=Phk 6WFA2St2QQKW/8EGhc5BgOA/4J4gTUdrmcN5/uIkeo3cJqYmZP3uH4eWNubsssY+ mgVZ2dMsLuFP80fieHKwZUp1pmrR9KYgrJYBQ7u/zugcFRtoYJHPr9GrC/KApXb7 ay/hJXy5SYiebZwYvx0NoXeJMioEgd5jgPzRLi5U= Received: (qmail 23926 invoked by alias); 18 Mar 2014 05:53:27 -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 23917 invoked by uid 89); 18 Mar 2014 05:53:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.8 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Date: Tue, 18 Mar 2014 11:24:03 +0530 From: Siddhesh Poyarekar To: libc-alpha@sourceware.org Subject: [PATCH] Use SHLIB_COMPAT for libc symbols only if building libc.so Message-ID: <20140318055403.GR1850@spoyarek.pnq.redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.22.1-rc1 (2013-10-16) X-DH-Original-To: glibc@patchwork.siddhesh.in Hi, SHLIB_COMPAT implicitly assumes that IS_IN_$(lib) is defined for the library it is called for, which is not always true. When building libm.so and libpthread.so, one would encounter SHLIB_COMPAT calls for libc, which gets called without IS_IN_libc being defined, which raises a warning with -Wundef. One way to fix this would have been to change the conditional in SHLIB_COMPAT definition to use if defined IS_IN_##lib, but I chose the more explicit path, which was to mark only callers that would encounter this problem, i.e. code where SHLIB_COMPAT(libc,...) is used outside of libc.so. I took a sha1sum of all generated binaries and verified that they're the same before and after. Siddhesh * libio/libio.h [defined _LIBC && defined SHARED]: Call SHLIB_COMPAT only when building libc.so. * nptl/forward.c: Likewise. diff --git a/libio/libio.h b/libio/libio.h index 6077f5c..060b5f5 100644 --- a/libio/libio.h +++ b/libio/libio.h @@ -482,7 +482,7 @@ extern int _IO_fwide (_IO_FILE *__fp, int __mode) __THROW; versions. */ # if defined _LIBC && defined SHARED # include -# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) +# if !defined NOT_IN_libc && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) # define _IO_fwide_maybe_incompatible \ (__builtin_expect (&_IO_stdin_used == NULL, 0)) extern const int _IO_stdin_used; diff --git a/nptl/forward.c b/nptl/forward.c index 6355c23..ff4c6e5 100644 --- a/nptl/forward.c +++ b/nptl/forward.c @@ -58,7 +58,7 @@ name decl \ FORWARD (pthread_attr_destroy, (pthread_attr_t *attr), (attr), 0) -#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_1) +#if !defined NOT_IN_libc && SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_1) FORWARD (__pthread_attr_init_2_0, (pthread_attr_t *attr), (attr), 0) compat_symbol (libc, __pthread_attr_init_2_0, pthread_attr_init, GLIBC_2_0); #endif @@ -98,7 +98,7 @@ FORWARD (pthread_attr_setscope, (pthread_attr_t *attr, int scope), FORWARD (pthread_condattr_destroy, (pthread_condattr_t *attr), (attr), 0) FORWARD (pthread_condattr_init, (pthread_condattr_t *attr), (attr), 0) -#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2) +#if !defined NOT_IN_libc && SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2) FORWARD2 (__pthread_cond_broadcast_2_0, int attribute_compat_text_section, (pthread_cond_2_0_t *cond), (cond), return 0) compat_symbol (libc, __pthread_cond_broadcast_2_0, pthread_cond_broadcast, @@ -108,7 +108,7 @@ FORWARD (__pthread_cond_broadcast, (pthread_cond_t *cond), (cond), 0) versioned_symbol (libc, __pthread_cond_broadcast, pthread_cond_broadcast, GLIBC_2_3_2); -#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2) +#if !defined NOT_IN_libc && SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2) FORWARD2 (__pthread_cond_destroy_2_0, int attribute_compat_text_section, (pthread_cond_2_0_t *cond), (cond), return 0) compat_symbol (libc, __pthread_cond_destroy_2_0, pthread_cond_destroy, @@ -118,7 +118,7 @@ FORWARD (__pthread_cond_destroy, (pthread_cond_t *cond), (cond), 0) versioned_symbol (libc, __pthread_cond_destroy, pthread_cond_destroy, GLIBC_2_3_2); -#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2) +#if !defined NOT_IN_libc && SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2) FORWARD2 (__pthread_cond_init_2_0, int attribute_compat_text_section, (pthread_cond_2_0_t *cond, const pthread_condattr_t *cond_attr), (cond, cond_attr), return 0) @@ -129,7 +129,7 @@ FORWARD (__pthread_cond_init, (cond, cond_attr), 0) versioned_symbol (libc, __pthread_cond_init, pthread_cond_init, GLIBC_2_3_2); -#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2) +#if !defined NOT_IN_libc && SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2) FORWARD2 (__pthread_cond_signal_2_0, int attribute_compat_text_section, (pthread_cond_2_0_t *cond), (cond), return 0) compat_symbol (libc, __pthread_cond_signal_2_0, pthread_cond_signal, @@ -139,7 +139,7 @@ FORWARD (__pthread_cond_signal, (pthread_cond_t *cond), (cond), 0) versioned_symbol (libc, __pthread_cond_signal, pthread_cond_signal, GLIBC_2_3_2); -#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2) +#if !defined NOT_IN_libc && SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2) FORWARD2 (__pthread_cond_wait_2_0, int attribute_compat_text_section, (pthread_cond_2_0_t *cond, pthread_mutex_t *mutex), (cond, mutex), return 0) @@ -151,7 +151,7 @@ FORWARD (__pthread_cond_wait, (pthread_cond_t *cond, pthread_mutex_t *mutex), versioned_symbol (libc, __pthread_cond_wait, pthread_cond_wait, GLIBC_2_3_2); -#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2) +#if !defined NOT_IN_libc && SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2) FORWARD2 (__pthread_cond_timedwait_2_0, int attribute_compat_text_section, (pthread_cond_2_0_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime), (cond, mutex, abstime),