From patchwork Wed Feb 25 20:44:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 5286 X-Patchwork-Delegate: azanella@linux.vnet.ibm.com Received: (qmail 115802 invoked by alias); 25 Feb 2015 20:44:45 -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 115784 invoked by uid 89); 25 Feb 2015 20:44:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e24smtp01.br.ibm.com Message-ID: <54EE3430.30608@linux.vnet.ibm.com> Date: Wed, 25 Feb 2015 17:44:32 -0300 From: Adhemerval Zanella User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: "GNU C. Library" Subject: [PATCH] powerpc: Fix __wcschr static build X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15022520-1524-0000-0000-000001E8BD3E This patch fix the static build for strftime, which uses __wcschr. Current powerpc32 implementation defines the __wcschr be an alias to __wcschr_ppc32 and current implementation misses the correct alias for static build. It also changes the default wcschr.c logic so a IFUNC implementation should just define WCSCHR and undefine the required alias/internal definitions. I see a better logic to undefine the required macros in the ifunc files themselves instead of adding more logic on default implementations. It is easier for implementation, such as powerpc32, that does not support IFUNC symbols for internal calls. Tested on powerpc32, powerpc64 and i386. --- * wcsmbs/wcschr.c [WCSCHR] (wcschr): Define as __wcschr. Remove conditionals for weak_alias and libc_hidden_weak. * sysdeps/i386/i686/multiarch/wcschr-c.c [libc]: Undefine libc_hidden_weak and weak_alias. * sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-ppc32.c [libc]: Undefine libc_hidden_weak. Define libc_hidden_def for SHARED builds and weak_alias for static one. --- diff --git a/sysdeps/i386/i686/multiarch/wcschr-c.c b/sysdeps/i386/i686/multiarch/wcschr-c.c index 786c132..38d41d0 100644 --- a/sysdeps/i386/i686/multiarch/wcschr-c.c +++ b/sysdeps/i386/i686/multiarch/wcschr-c.c @@ -1,6 +1,12 @@ #include #if IS_IN (libc) +# undef libc_hidden_weak +# define libc_hidden_weak(name) + +# undef weak_alias +# define weak_alias(name,alias) + # ifdef SHARED # undef libc_hidden_def # define libc_hidden_def(name) \ @@ -8,9 +14,9 @@ strong_alias (__wcschr_ia32, __wcschr_ia32_1); \ __hidden_ver1 (__wcschr_ia32_1, __GI___wcschr, __wcschr_ia32_1); # endif -# define WCSCHR __wcschr_ia32 #endif extern __typeof (wcschr) __wcschr_ia32; -#include "wcsmbs/wcschr.c" +#define WCSCHR __wcschr_ia32 +#include diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-ppc32.c b/sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-ppc32.c index df586a6..3b2ab3a 100644 --- a/sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-ppc32.c +++ b/sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-ppc32.c @@ -18,16 +18,26 @@ #include #if IS_IN (libc) +# undef libc_hidden_weak +# define libc_hidden_weak(name) + +# undef weak_alias +# undef libc_hidden_def + # ifdef SHARED -# undef libc_hidden_def -# define libc_hidden_def(name) \ +# define libc_hidden_def(name) \ __hidden_ver1 (__wcschr_ppc, __GI_wcschr, __wcschr_ppc); \ strong_alias (__wcschr_ppc, __wcschr_ppc_1); \ __hidden_ver1 (__wcschr_ppc_1, __GI___wcschr, __wcschr_ppc_1); -# endif -# define WCSCHR __wcschr_ppc +# define weak_alias(name,alias) +# else +# define weak_alias(name, alias) \ + _weak_alias(__wcschr_ppc, __wcschr) +# define libc_hidden_def(name) +# endif /* SHARED */ #endif extern __typeof (wcschr) __wcschr_ppc; +#define WCSCHR __wcschr_ppc #include diff --git a/wcsmbs/wcschr.c b/wcsmbs/wcschr.c index a287283..ed0cecd 100644 --- a/wcsmbs/wcschr.c +++ b/wcsmbs/wcschr.c @@ -18,16 +18,12 @@ #include /* Find the first occurrence of WC in WCS. */ -#ifdef WCSCHR -# define wcschr WCSCHR -#else +#ifndef WCSCHR # define wcschr __wcschr #endif wchar_t * -wcschr (wcs, wc) - const wchar_t *wcs; - const wchar_t wc; +WCSCHR (const wchar_t *wcs, const wchar_t wc) { do if (*wcs == wc) @@ -37,8 +33,5 @@ wcschr (wcs, wc) return NULL; } libc_hidden_def (wcschr) -#ifndef WCSCHR -# undef wcschr weak_alias (__wcschr, wcschr) libc_hidden_weak (wcschr) -#endif