summaryrefslogtreecommitdiffstats
path: root/crypto/ppccap.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2019-01-16 06:31:15 +0100
committerRichard Levitte <levitte@openssl.org>2019-01-16 18:04:22 +0100
commitb36b1632e20f7d218f23c36e9c55ea44e4be7f97 (patch)
tree41df0d3cd98b4808fe113801c1bed0d71b340b0e /crypto/ppccap.c
parent6ffcd10ade7fac6cd08dff3dba304b9d8d9de0a4 (diff)
crypto/armcap.c, crypto/ppccap.c: stricter use of getauxval()
Having a weak getauxval() and only depending on GNU C without looking at the library we build against meant that it got picked up where not really expected. So we change this to check for the glibc version, and since we know it exists from that version, there's no real need to make it weak. Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/8028) (cherry picked from commit 5f40dd158cbfa0a3bd86c32f7a77fec8754bb245)
Diffstat (limited to 'crypto/ppccap.c')
-rw-r--r--crypto/ppccap.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/crypto/ppccap.c b/crypto/ppccap.c
index 8b7d765c3a..a0a41b32ea 100644
--- a/crypto/ppccap.c
+++ b/crypto/ppccap.c
@@ -168,16 +168,11 @@ void OPENSSL_altivec_probe(void);
void OPENSSL_crypto207_probe(void);
void OPENSSL_madd300_probe(void);
-/*
- * Use a weak reference to getauxval() so we can use it if it is available
- * but don't break the build if it is not. Note that this is *link-time*
- * feature detection, not *run-time*. In other words if we link with
- * symbol present, it's expected to be present even at run-time.
- */
-#if defined(__GNUC__) && __GNUC__>=2 && defined(__ELF__)
-extern unsigned long getauxval(unsigned long type) __attribute__ ((weak));
-#else
-static unsigned long (*getauxval) (unsigned long) = NULL;
+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
+# if __GLIBC_PREREQ(2, 16)
+# include <sys/auxv.h>
+# define OSSL_IMPLEMENT_GETAUXVAL
+# endif
#endif
/* I wish <sys/auxv.h> was universally available */
@@ -277,7 +272,8 @@ void OPENSSL_cpuid_setup(void)
}
#endif
- if (getauxval != NULL) {
+#ifdef OSSL_IMPLEMENT_GETAUXVAL
+ {
unsigned long hwcap = getauxval(HWCAP);
if (hwcap & HWCAP_FPU) {
@@ -307,6 +303,7 @@ void OPENSSL_cpuid_setup(void)
return;
}
+#endif
sigfillset(&all_masked);
sigdelset(&all_masked, SIGILL);