From ed747ba8849f4b33117184cb54ea5c537f888b0b Mon Sep 17 00:00:00 2001 From: Luca Lindhorst Date: Tue, 4 Jun 2019 20:15:50 +0200 Subject: [PATCH] deps: dlloads node static linked executable OpenSSL dlloads itself to prevent unloading, in case it might be dynamically loaded. However when linked statically this will lead to dloading the main executable. Refs: https://github.com/nodejs/node/pull/21848#issuecomment-498396551 Fixes: https://github.com/nodejs/node/issues/29992 PR-URL: https://github.com/nodejs/node/pull/28045 Fixes: https://github.com/nodejs/node/issues/27925 Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: Rich Trott --- common.gypi | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/common.gypi b/common.gypi index 97fe1f9e92a5be..ad1a041d650918 100644 --- a/common.gypi +++ b/common.gypi @@ -521,7 +521,19 @@ 'ldflags': [ '-Wl,--export-dynamic', ], - }] + }], + # if node is built as an executable, + # the openssl mechanism for keeping itself "dload"-ed to ensure proper + # atexit cleanup does not apply + ['node_shared_openssl!="true" and node_shared!="true"', { + 'defines': [ + # `OPENSSL_NO_PINSHARED` prevents openssl from dload + # current node executable, + # see https://github.com/nodejs/node/pull/21848 + # or https://github.com/nodejs/node/issues/27925 + 'OPENSSL_NO_PINSHARED' + ], + }], ], } }