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: 331287 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 7E9332C00B7 for ; Tue, 18 Mar 2014 16:53:33 +1100 (EST) 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=aTvHFcEK20GT41EpIFuWS6o7gxZUu NZPuEb//jFrMnhedYrfCyzPWo3qwRGRTrLzl8k6rF6kL658+prlbEX7ZnP2x333X pOE3to1wmYBB1Ja9cIdox3OBpnuyypcAHPUu73M2h7hsEU4aeW6/ARZiMoUU1kZy A5W4xUE3J97eBg= 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=cw6 OR0dsa6n2t1s7lzF/WWAYeURqNFQmYToSycFGzFe39bfeUZerDd8pMH4UAcG1Ce9 IpoFZaqABWRpOyN6UaX+K79naIYkYsCWVDgYsT5vJAkf58s5FMpClb/Bjvh3miL8 S4lexoeSx0qfRibi3rVOkpMT7gmzDbdkBx6rVQls= 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) 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),