This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v3 7/7] powerpc64le: Enable float128
On 6/27/17 2:05 AM, Florian Weimer wrote:
> On 06/27/2017 01:02 AM, Joseph Myers wrote:
>> I'm seeing a testsuite regression for powerpc64le with
>> build-many-glibcs.py with this patch (elf/check-localplt fails), did you
>> not see that in your testing?
>>
>> https://sourceware.org/ml/libc-testresults/2017-q2/msg00427.html
>>
>> The failure is: "Extra PLT reference: libc.so: __getauxval". As the
>> __getauxval reference comes from have_ieee_hw_p in libgcc, presumably you
>> need to allow that PLT reference in localplt.data with an appropriate
>> comment, as it won't be readily possible to avoid it.
>
> The __getauxval call happens from IFUNC resolvers and violates current
> guidelines regarding what can be done from IFUNC resolvers. This is
> another reason to get rid of the PLT reference.
>
> My IFUNC resolver enhancements are not ready for 2.26, and I plan to
> wait for DJ's dl-minimal malloc improvements to land, rather than
> rolling my own memory allocator to back the IFUNC resolver queue.
We have a __builtin_cpu_supports() version that can test for float128, so
why can't we use the following? On older systems (ie, older glibcs),
the builtin will expand to false, which is conservatively correct.
Peter
-/* Use the namespace clean version of getauxval. However, not all versions of
- sys/auxv.h declare it, so declare it here. This code is intended to be
- temporary until a suitable version of __builtin_cpu_supports is added that
- allows us to tell quickly if the machine supports IEEE 128-bit hardware. */
-extern unsigned long __getauxval (unsigned long);
-
-static int
-have_ieee_hw_p (void)
-{
- static int ieee_hw_p = -1;
-
- if (ieee_hw_p < 0)
- {
- char *p = (char *) __getauxval (AT_PLATFORM);
-
- ieee_hw_p = 0;
-
- /* Don't use atoi/strtol/strncmp/etc. These may require the normal
- environment to be setup to set errno to 0, and the ifunc resolvers run
- before the whole glibc environment is initialized. */
- if (p && p[0] == 'p' && p[1] == 'o' && p[2] == 'w' && p[3] == 'e'
- && p[4] == 'r')
- {
- long n = 0;
- char ch;
-
- p += 5;
- while ((ch = *p++) >= '0' && (ch <= '9'))
- n = (n * 10) + (ch - '0');
-
- if (n >= 9)
- ieee_hw_p = 1;
- }
- }
-
- return ieee_hw_p;
-}
-
-#define SW_OR_HW(SW, HW) (have_ieee_hw_p () ? HW : SW)
+#define SW_OR_HW(SW, HW) (__builtin_cpu_supports ("ieee128") ? HW : SW)