s390x: Hide internal cpuid symbol and function
authorJuergen Christ <jchrist@linux.ibm.com>
Wed, 23 Mar 2022 12:26:13 +0000 (13:26 +0100)
committerTomas Mraz <tomas@openssl.org>
Fri, 25 Mar 2022 13:18:56 +0000 (14:18 +0100)
The symbol OPENSSL_s390xcap_P and the OPENSSL_cpuid_setup function are not
exported by the version script of OpenSSL.  However, if someone uses the
static library without the version script, these symbols all of a sudden
become global symbols and their usage in assembler code does not correctly
reflect that for PIC.  Since these symbols should never be used outside of
OpenSSL, hide them inside the binary.

Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17946)

crypto/s390x_arch.h
crypto/s390xcap.c

index fa920d14da1a65667407fc1ec5995d16bf02bfa1..3b489b9144a325f4d8da62b6384e5b39bd5e850d 100644 (file)
@@ -72,6 +72,9 @@ struct OPENSSL_s390xcap_st {
     unsigned long long kdsa[2];
 };
 
+#if defined(__GNUC__) && defined(__linux)
+__attribute__ ((visibility("hidden")))
+#endif
 extern struct OPENSSL_s390xcap_st OPENSSL_s390xcap_P;
 
 /* Max number of 64-bit words currently returned by STFLE */
index f8e0234968e4fc408f3317233a74eb1b9fa77b90..d433df98eb9602d185bd09d412ea33757fccc431 100644 (file)
@@ -74,6 +74,9 @@ void OPENSSL_s390x_functions(void);
 
 struct OPENSSL_s390xcap_st OPENSSL_s390xcap_P;
 
+#if defined(__GNUC__) && defined(__linux)
+__attribute__ ((visibility("hidden")))
+#endif
 void OPENSSL_cpuid_setup(void)
 {
     struct OPENSSL_s390xcap_st cap;