diff options
author | Matt Caswell <matt@openssl.org> | 2016-10-18 15:11:57 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-11-02 23:32:50 +0000 |
commit | b6d5ba1a9f004d637acac18ae3519fe063b6b5e1 (patch) | |
tree | 68a43f7207dd3c8142bdba4a700c5c3b25cd4aa0 /crypto | |
parent | b987d748e46d4ec19a45e5ec9e890a9003a361d6 (diff) |
Link using -znodelete
Instead of deliberately leaking a reference to ourselves, use nodelete
which does this more neatly. Only for Linux at the moment.
Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/init.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/crypto/init.c b/crypto/init.c index ebc41465d5..cfa0ce0c86 100644 --- a/crypto/init.c +++ b/crypto/init.c @@ -81,6 +81,7 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_base) OPENSSL_cpuid_setup(); base_inited = 1; +#ifndef OPENSSL_USE_NODELETE /* * Deliberately leak a reference to ourselves. This will force the library * to remain loaded until the atexit() handler is run a process exit. @@ -91,6 +92,7 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_base) dso = DSO_dsobyaddr(&base_inited, DSO_FLAG_NO_UNLOAD_ON_FREE); DSO_free(dso); } +#endif return 1; } @@ -588,10 +590,11 @@ int OPENSSL_atexit(void (*handler)(void)) { OPENSSL_INIT_STOP *newhand; +#ifndef OPENSSL_USE_NODELETE /* * Deliberately leak a reference to the handler. This will force the * library/code containing the handler to remain loaded until we run the - * atexit handler. + * atexit handler. If -znodelete has been used then this is unneccessary. */ { DSO *dso = NULL; @@ -605,6 +608,7 @@ int OPENSSL_atexit(void (*handler)(void)) dso = DSO_dsobyaddr(handlersym.sym, DSO_FLAG_NO_UNLOAD_ON_FREE); DSO_free(dso); } +#endif newhand = OPENSSL_malloc(sizeof(*newhand)); if (newhand == NULL) |