This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] powerpc: New feature - HWCAP/HWCAP2 bits in the TCB
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Alan Modra <amodra at gmail dot com>, OndÅej BÃlka <neleai at seznam dot cz>
- Cc: munroesj at linux dot vnet dot ibm dot com, Rich Felker <dalias at libc dot org>, libc-alpha at sourceware dot org
- Date: Wed, 08 Jul 2015 04:00:35 -0400
- Subject: Re: [PATCH] powerpc: New feature - HWCAP/HWCAP2 bits in the TCB
- Authentication-results: sourceware.org; auth=none
- References: <55760314 dot 6070601 at linux dot vnet dot ibm dot com> <20150609163835 dot GI17573 at brightrain dot aerifal dot cx> <1435777940 dot 7125 dot 132 dot camel at oc7878010663> <20150703195313 dot GB23898 at domone> <20150707040217 dot GA28571 at bubble dot grove dot modra dot org>
On 07/07/2015 12:02 AM, Alan Modra wrote:
> On Fri, Jul 03, 2015 at 09:53:13PM +0200, OndÅej BÃlka wrote:
>> hwcap.h:
>> int __hwcap __attribute__ ((visibility ("hidden"))) ;
>>
>> hwcap.c:
>>
>> #include <hwcap.h>
>>
>> // gcc needs to make this first constructor.
>> extern int __global_hwcap;
>> void __attribute__ ((constructor))
>> set_hwcap ()
>> {
>> __hwcap = __global_hwcap;
>> }
>
> We considered using this scheme. In fact, I put forward the idea.
> However, it was discarded as second best, due to the need to set up
> GOT/TOC addressing on a variable access. Nothing beats Steve's single
> instruction "ld r,-0x7068(r13)" to read hwcap.
Agreed, and you should be allowed to use it given that you have ABI
space allocated for it. It still makes me sad to see the kind
of code it enables though.
My other comments to Steven still stand though, with stack reuse
via the internal cache I think you have no guarantees the words you
want will be zero. Therefore you need to version this interface for
it to be generally safe and use it only if you know the hwcap in the
TCB was initialized by glibc. I do not think it is a good trade to
have "hard to debug crashes" along with "support for all versions of
glibc with TLS." I would rather see "never crashes" and "works with
glibc 2.22 and newer."
Cheers,
Carlos.