diff mbox

powerpc: Export __parse_hwcap_and_convert_at_platform to, libc.a

Message ID 56706135.1000901@linux.vnet.ibm.com
State New
Headers show

Commit Message

cseo Dec. 15, 2015, 6:51 p.m. UTC
Hi

Commit 67385a01d229751569b6aac067ffdcd813a15d7a added a new feature for 
powerpc, where we store HWCAP/Platform bits in the TCB.  In the dynamic 
linking case, we use the versioned symbol 
'__parse_hwcap_and_convert_at_platform' to verify if this feature is 
available.  However, the same symbol was not exported to libc.a, making 
it not possible for GCC to check for it prior to link time. This patch 
fixes that.

Regards,

Comments

Paul E. Murphy Dec. 17, 2015, 11:52 p.m. UTC | #1
On 12/15/2015 12:51 PM, Carlos Eduardo Seo wrote:
> 
> Hi
> 
> Commit 67385a01d229751569b6aac067ffdcd813a15d7a added a new feature for powerpc, where we store HWCAP/Platform bits in the TCB.  In the dynamic linking case, we use the versioned symbol '__parse_hwcap_and_convert_at_platform' to verify if this feature is available.  However, the same symbol was not exported to libc.a, making it not possible for GCC to check for it prior to link time. This patch fixes that.
> 
> Regards,
> 


Is this better or worse than amending the troublesome spot to:

#if IS_IN (rtld) || !defined (SHARED)

as versioned_symbol() translates to weak_alias() in the later case.

If not, LGTM.

Paul
Tulio Magno Quites Machado Filho Dec. 22, 2015, 5:33 p.m. UTC | #2
"Paul E. Murphy" <murphyp@linux.vnet.ibm.com> writes:

> On 12/15/2015 12:51 PM, Carlos Eduardo Seo wrote:
>> 
>> Hi
>> 
>> Commit 67385a01d229751569b6aac067ffdcd813a15d7a added a new feature
>> for powerpc, where we store HWCAP/Platform bits in the TCB.  In the
>> dynamic linking case, we use the versioned symbol
>> '__parse_hwcap_and_convert_at_platform' to verify if this feature is
>> available.  However, the same symbol was not exported to libc.a,
>> making it not possible for GCC to check for it prior to link
>> time. This patch fixes that.
>> 
>> Regards,
>> 
>
>
> Is this better or worse than amending the troublesome spot to:
>
> #if IS_IN (rtld) || !defined (SHARED)
>
> as versioned_symbol() translates to weak_alias() in the later case.
>
> If not, LGTM.

It makes sense in order to minimize code, but it would feels weird, because
we would have this:

    #if IS_IN (rtld) || !defined (SHARED)
    versioned_symbol (ld, __tcb_parse_hwcap_and_convert_at_platform, \
                      __parse_hwcap_and_convert_at_platform, GLIBC_2_23);
    #endif

So, the code says to add a symbol to ld, but it ends up in libc.a for the
static case.

It's a trade-off: the way Seo wrote makes it clearer without duplicating
too much code.

LGTM and I'm pushing it.

Thanks!
diff mbox

Patch

diff --git a/sysdeps/powerpc/hwcapinfo.c b/sysdeps/powerpc/hwcapinfo.c
index a115ffc..b885f1c 100644
--- a/sysdeps/powerpc/hwcapinfo.c
+++ b/sysdeps/powerpc/hwcapinfo.c
@@ -74,3 +74,11 @@  __tcb_parse_hwcap_and_convert_at_platform (void)
 versioned_symbol (ld, __tcb_parse_hwcap_and_convert_at_platform, \
 		  __parse_hwcap_and_convert_at_platform, GLIBC_2_23);
 #endif
+
+/* Export __parse_hwcap_and_convert_at_platform in libc.a.  This is used by
+   GCC to make sure that the HWCAP/Platform bits are stored in the TCB when
+   using __builtin_cpu_is()/__builtin_cpu_supports() in the static case.  */
+#ifndef SHARED
+weak_alias (__tcb_parse_hwcap_and_convert_at_platform, \
+	    __parse_hwcap_and_convert_at_platform);
+#endif