diff --git a/src/raw_sock.c b/src/raw_sock.c index a6773e790..cc72e6023 100644 --- a/src/raw_sock.c +++ b/src/raw_sock.c @@ -474,12 +474,13 @@ static struct xprt_ops raw_sock = { }; -__attribute__((constructor)) static void __raw_sock_init(void) { xprt_register(XPRT_RAW, &raw_sock); } +INITCALL0(STG_REGISTER, __raw_sock_init); + /* * Local variables: * c-indent-level: 8 diff --git a/src/ssl_sock.c b/src/ssl_sock.c index d823d92d3..fd2aff92a 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -7939,7 +7939,6 @@ static void ssl_sock_clt_sni_free_func(void *parent, void *ptr, CRYPTO_EX_DATA * pool_free(ssl_sock_client_sni_pool, ptr); } -__attribute__((constructor)) static void __ssl_sock_init(void) { #if (!defined(OPENSSL_NO_COMP) && !defined(SSL_OP_NO_COMPRESSION)) @@ -8036,6 +8035,7 @@ static void __ssl_sock_init(void) */ hap_register_post_deinit(ssl_sock_unregister_msg_callbacks); } +INITCALL0(STG_REGISTER, __ssl_sock_init); /* Compute and register the version string */ static void ssl_register_build_options() @@ -8135,7 +8135,6 @@ void ssl_free_dh(void) { } #endif -__attribute__((destructor)) static void __ssl_sock_deinit(void) { #if (defined SSL_CTRL_SET_TLSEXT_HOSTNAME && !defined SSL_NO_GENERATE_CERTIFICATES) @@ -8157,6 +8156,7 @@ static void __ssl_sock_deinit(void) #endif BIO_meth_free(ha_meth); } +REGISTER_POST_DEINIT(__ssl_sock_deinit); /* diff --git a/src/xprt_handshake.c b/src/xprt_handshake.c index 75ebdae76..7b2265f5a 100644 --- a/src/xprt_handshake.c +++ b/src/xprt_handshake.c @@ -291,8 +291,9 @@ struct xprt_ops xprt_handshake = { .name = "HS", }; -__attribute__((constructor)) static void __xprt_handshake_init(void) { xprt_register(XPRT_HANDSHAKE, &xprt_handshake); } + +INITCALL0(STG_REGISTER, __xprt_handshake_init); diff --git a/src/xprt_quic.c b/src/xprt_quic.c index 7f331d169..0b2c59c6f 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -5769,18 +5769,18 @@ static struct xprt_ops ssl_quic = { .name = "QUIC", }; -__attribute__((constructor)) static void __quic_conn_init(void) { ha_quic_meth = BIO_meth_new(0x666, "ha QUIC methods"); xprt_register(XPRT_QUIC, &ssl_quic); } +INITCALL0(STG_REGISTER, __quic_conn_init); -__attribute__((destructor)) static void __quic_conn_deinit(void) { BIO_meth_free(ha_quic_meth); } +REGISTER_POST_DEINIT(__quic_conn_deinit); /* Read all the QUIC packets found in from QUIC connection with * as owner calling function.