Tue Nov 20 07:30:18 2018 UTC ()
Don't expose a getauxval symbol.

The code already knows how to handle it, but it assumes anyone who uses
GCC or clang might resolve the getauxval function to something eventually.

The only time we will expose getauxval is if a package tries to substitute
getauxval too, and then code will start having mysterious failures.

getauxval is purely a linux function (as far as I can see), so limit it to
that.

PR pkg/53387, PR port-arm/53386


(maya)
diff -r1.7 -r1.8 src/crypto/external/bsd/openssl/dist/crypto/armcap.c
diff -r1.8 -r1.9 src/crypto/external/bsd/openssl/dist/crypto/ppccap.c

cvs diff -r1.7 -r1.8 src/crypto/external/bsd/openssl/dist/crypto/armcap.c (expand / switch to unified diff)

--- src/crypto/external/bsd/openssl/dist/crypto/armcap.c 2018/09/23 13:32:55 1.7
+++ src/crypto/external/bsd/openssl/dist/crypto/armcap.c 2018/11/20 07:30:17 1.8
@@ -60,27 +60,27 @@ uint32_t OPENSSL_rdtsc(void) @@ -60,27 +60,27 @@ uint32_t OPENSSL_rdtsc(void)
60 return _armv7_tick(); 60 return _armv7_tick();
61 else 61 else
62#endif 62#endif
63 return 0; 63 return 0;
64} 64}
65 65
66# if defined(__GNUC__) && __GNUC__>=2 66# if defined(__GNUC__) && __GNUC__>=2
67void OPENSSL_cpuid_setup(void) __attribute__ ((constructor)); 67void OPENSSL_cpuid_setup(void) __attribute__ ((constructor));
68# endif 68# endif
69/* 69/*
70 * Use a weak reference to getauxval() so we can use it if it is available but 70 * Use a weak reference to getauxval() so we can use it if it is available but
71 * don't break the build if it is not. 71 * don't break the build if it is not.
72 */ 72 */
73# if defined(__GNUC__) && __GNUC__>=2 && defined(__ELF__) 73# if defined(__linux__)
74extern unsigned long getauxval(unsigned long type) __attribute__ ((weak)); 74extern unsigned long getauxval(unsigned long type) __attribute__ ((weak));
75# else 75# else
76static unsigned long (*getauxval) (unsigned long) = NULL; 76static unsigned long (*getauxval) (unsigned long) = NULL;
77# endif 77# endif
78 78
79/* 79/*
80 * ARM puts the feature bits for Crypto Extensions in AT_HWCAP2, whereas 80 * ARM puts the feature bits for Crypto Extensions in AT_HWCAP2, whereas
81 * AArch64 used AT_HWCAP. 81 * AArch64 used AT_HWCAP.
82 */ 82 */
83# if defined(__arm__) || defined (__arm) 83# if defined(__arm__) || defined (__arm)
84# define HWCAP 16 84# define HWCAP 16
85 /* AT_HWCAP */ 85 /* AT_HWCAP */
86# define HWCAP_NEON (1 << 12) 86# define HWCAP_NEON (1 << 12)

cvs diff -r1.8 -r1.9 src/crypto/external/bsd/openssl/dist/crypto/ppccap.c (expand / switch to unified diff)

--- src/crypto/external/bsd/openssl/dist/crypto/ppccap.c 2018/09/23 13:32:55 1.8
+++ src/crypto/external/bsd/openssl/dist/crypto/ppccap.c 2018/11/20 07:30:17 1.9
@@ -168,27 +168,27 @@ static void ill_handler(int sig) @@ -168,27 +168,27 @@ static void ill_handler(int sig)
168 168
169void OPENSSL_fpu_probe(void); 169void OPENSSL_fpu_probe(void);
170void OPENSSL_ppc64_probe(void); 170void OPENSSL_ppc64_probe(void);
171void OPENSSL_altivec_probe(void); 171void OPENSSL_altivec_probe(void);
172void OPENSSL_crypto207_probe(void); 172void OPENSSL_crypto207_probe(void);
173void OPENSSL_madd300_probe(void); 173void OPENSSL_madd300_probe(void);
174 174
175/* 175/*
176 * Use a weak reference to getauxval() so we can use it if it is available 176 * Use a weak reference to getauxval() so we can use it if it is available
177 * but don't break the build if it is not. Note that this is *link-time* 177 * but don't break the build if it is not. Note that this is *link-time*
178 * feature detection, not *run-time*. In other words if we link with 178 * feature detection, not *run-time*. In other words if we link with
179 * symbol present, it's expected to be present even at run-time. 179 * symbol present, it's expected to be present even at run-time.
180 */ 180 */
181#if defined(__GNUC__) && __GNUC__>=2 && defined(__ELF__) 181#if defined(__linux__)
182extern unsigned long getauxval(unsigned long type) __attribute__ ((weak)); 182extern unsigned long getauxval(unsigned long type) __attribute__ ((weak));
183#else 183#else
184static unsigned long (*getauxval) (unsigned long) = NULL; 184static unsigned long (*getauxval) (unsigned long) = NULL;
185#endif 185#endif
186 186
187/* I wish <sys/auxv.h> was universally available */ 187/* I wish <sys/auxv.h> was universally available */
188#define HWCAP 16 /* AT_HWCAP */ 188#define HWCAP 16 /* AT_HWCAP */
189#define HWCAP_PPC64 (1U << 30) 189#define HWCAP_PPC64 (1U << 30)
190#define HWCAP_ALTIVEC (1U << 28) 190#define HWCAP_ALTIVEC (1U << 28)
191#define HWCAP_FPU (1U << 27) 191#define HWCAP_FPU (1U << 27)
192#define HWCAP_POWER6_EXT (1U << 9) 192#define HWCAP_POWER6_EXT (1U << 9)
193#define HWCAP_VSX (1U << 7) 193#define HWCAP_VSX (1U << 7)
194 194