From: Jon Spillett Date: Thu, 21 Apr 2022 06:49:04 +0000 (+1000) Subject: Prefer GNU library initialization mechanism over platform one X-Git-Tag: openssl-3.2.0-alpha1~2734 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2dc3a4a4a57eca0d9bebd87234c7d682506188fc;p=thirdparty%2Fopenssl.git Prefer GNU library initialization mechanism over platform one If GNU toolchain is used, use the __attribute__((constructor)) Reviewed-by: Matt Caswell Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/18147) --- diff --git a/providers/fips/self_test.c b/providers/fips/self_test.c index a41f49b8871..07534e89750 100644 --- a/providers/fips/self_test.c +++ b/providers/fips/self_test.c @@ -103,6 +103,13 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) } return TRUE; } + +#elif defined(__GNUC__) +# undef DEP_INIT_ATTRIBUTE +# undef DEP_FINI_ATTRIBUTE +# define DEP_INIT_ATTRIBUTE static __attribute__((constructor)) +# define DEP_FINI_ATTRIBUTE static __attribute__((destructor)) + #elif defined(__sun) # pragma init(init) # pragma fini(cleanup) @@ -125,12 +132,6 @@ void _cleanup(void) # pragma init "init" # pragma fini "cleanup" -#elif defined(__GNUC__) -# undef DEP_INIT_ATTRIBUTE -# undef DEP_FINI_ATTRIBUTE -# define DEP_INIT_ATTRIBUTE static __attribute__((constructor)) -# define DEP_FINI_ATTRIBUTE static __attribute__((destructor)) - #elif defined(__TANDEM) /* Method automatically called by the NonStop OS when the DLL loads */ void __INIT__init(void) {