[Bug 1884382] Re: __builtin_cpu_supports does not work in ifunc resolver
Dimitri John Ledkov
1884382 at bugs.launchpad.net
Sat Jun 20 18:39:41 UTC 2020
void *resolve_builtin_cpu(void) {
__builtin_cpu_init();
if (__builtin_cpu_supports("sse4.1"))
return sse41;
else
return portable;
}
Is the right way to implement ifunc resolver.
** Changed in: gcc-10 (Ubuntu)
Status: New => Invalid
** Changed in: glibc (Ubuntu)
Status: New => Invalid
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to glibc in Ubuntu.
https://bugs.launchpad.net/bugs/1884382
Title:
__builtin_cpu_supports does not work in ifunc resolver
Status in gcc-10 package in Ubuntu:
Invalid
Status in glibc package in Ubuntu:
Invalid
Bug description:
I am trying to use ifunc
On good architectures like armhf & arm64, glibc passes hwcaps argument
to the ifunc resolver function, which one can use to test for various
features.
On x86_64, no argument is passed, thus I'm trying to use
__builtin_cpu_supports() function instead. It would be nice if glibc
did pass something like whatever __builtin_cpu_supports() needs.
However, it seems like __builtin_cpu_supports is unusable from inside
ifunc resolver. Re-implementing __builtin_cpu_supports with
__get_cpuid works.
Using __builtin_cpu_supports in main() otherwise works.
Is my code wrong, or can gcc/glibc be improved, such that
__builtin_cpu_supports works in an ifunc resolver?
See attached code.
$ gcc-10 test_builtin_ifunc.c -o test_builtin_ifunc
$ ./test_builtin_ifunc
sse41
portable
sse41
Whereas on a machine that supports SSE4.1 the expected output is
sse41
sse41
sse41
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-10/+bug/1884382/+subscriptions
More information about the foundations-bugs
mailing list