diff options
author | Jon Spillett <jon.spillett@oracle.com> | 2022-04-21 16:49:04 +1000 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-04-27 10:08:43 +0200 |
commit | 8e03413d87395fdf39f67a588daaac1750d266d6 (patch) | |
tree | 2f8950b0b1396b282df364d6605eff0598d408f6 /providers | |
parent | c1a5e4c564742354148e3aab1f81a9b0177e832c (diff) |
Prefer GNU library initialization mechanism over platform one
If GNU toolchain is used, use the __attribute__((constructor))
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18147)
(cherry picked from commit 2dc3a4a4a57eca0d9bebd87234c7d682506188fc)
Diffstat (limited to 'providers')
-rw-r--r-- | providers/fips/self_test.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/providers/fips/self_test.c b/providers/fips/self_test.c index e236bd421a..d003842e50 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) { |