From a37dce40d832b377aa46954a3b3401f0ec8b6bce Mon Sep 17 00:00:00 2001 From: Yihong Wang Date: Sat, 21 Oct 2017 23:16:50 -0700 Subject: [PATCH] src: explicitly register built-in modules Previously, built-in modules are registered before main() via __attribute__((constructor)) mechanism in GCC and similiar mechanism in MSVC. This causes some issues when node is built as static library. Calling module registration function for built-in modules in node::Init() helps to avoid the issues. Signed-off-by: Yihong Wang Refs: https://github.com/nodejs/node/pull/14986#issuecomment-332758206 Backport-PR-URL: https://github.com/nodejs/node/pull/17625 PR-URL: https://github.com/nodejs/node/pull/16565 Reviewed-By: Gireesh Punathil Reviewed-By: Anna Henningsen Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- node.gyp | 1 + src/async_wrap.cc | 2 +- src/cares_wrap.cc | 2 +- src/fs_event_wrap.cc | 2 +- src/inspector_js_api.cc | 2 +- src/js_stream.cc | 2 +- src/node.cc | 24 +++++++++- src/node_buffer.cc | 2 +- src/node_config.cc | 2 +- src/node_contextify.cc | 2 +- src/node_crypto.cc | 2 +- src/node_file.cc | 2 +- src/node_http2.cc | 2 +- src/node_http_parser.cc | 2 +- src/node_i18n.cc | 2 +- src/node_internals.h | 85 +++++++++++++++++++++++++++++++++- src/node_os.cc | 2 +- src/node_perf.cc | 2 +- src/node_serdes.cc | 2 +- src/node_url.cc | 2 +- src/node_util.cc | 2 +- src/node_v8.cc | 3 +- src/node_zlib.cc | 2 +- src/pipe_wrap.cc | 2 +- src/process_wrap.cc | 2 +- src/signal_wrap.cc | 2 +- src/spawn_sync.cc | 2 +- src/stream_wrap.cc | 2 +- src/tcp_wrap.cc | 2 +- src/timer_wrap.cc | 2 +- src/tls_wrap.cc | 2 +- src/tty_wrap.cc | 2 +- src/udp_wrap.cc | 2 +- src/uv.cc | 3 +- test/cctest/node_module_reg.cc | 28 +++++++++++ 35 files changed, 167 insertions(+), 35 deletions(-) create mode 100644 test/cctest/node_module_reg.cc diff --git a/node.gyp b/node.gyp index 3c2f0d332a1a49..70636e776592d3 100644 --- a/node.gyp +++ b/node.gyp @@ -815,6 +815,7 @@ 'defines': [ 'NODE_WANT_INTERNALS=1' ], 'sources': [ + 'test/cctest/node_module_reg.cc', 'test/cctest/node_test_fixture.cc', 'test/cctest/test_aliased_buffer.cc', 'test/cctest/test_base64.cc', diff --git a/src/async_wrap.cc b/src/async_wrap.cc index a58c59c212da4e..99d14fb2933cda 100644 --- a/src/async_wrap.cc +++ b/src/async_wrap.cc @@ -831,4 +831,4 @@ void EmitAsyncDestroy(Isolate* isolate, async_context asyncContext) { } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(async_wrap, node::AsyncWrap::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(async_wrap, node::AsyncWrap::Initialize) diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 71aefe7d479241..6d16cce2c87f10 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -2259,4 +2259,4 @@ void Initialize(Local target, } // namespace cares_wrap } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(cares_wrap, node::cares_wrap::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(cares_wrap, node::cares_wrap::Initialize) diff --git a/src/fs_event_wrap.cc b/src/fs_event_wrap.cc index cb011bcc0143b9..934b9d545c6ba4 100644 --- a/src/fs_event_wrap.cc +++ b/src/fs_event_wrap.cc @@ -221,4 +221,4 @@ void FSEventWrap::Close(const FunctionCallbackInfo& args) { } // anonymous namespace } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(fs_event_wrap, node::FSEventWrap::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(fs_event_wrap, node::FSEventWrap::Initialize) diff --git a/src/inspector_js_api.cc b/src/inspector_js_api.cc index 50374b7e24377b..428d8391f2581a 100644 --- a/src/inspector_js_api.cc +++ b/src/inspector_js_api.cc @@ -348,5 +348,5 @@ void InitInspectorBindings(Local target, Local unused, } // namespace inspector } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(inspector, +NODE_BUILTIN_MODULE_CONTEXT_AWARE(inspector, node::inspector::InitInspectorBindings); diff --git a/src/js_stream.cc b/src/js_stream.cc index 1b102451cd6d82..7d4ad7a4e978a6 100644 --- a/src/js_stream.cc +++ b/src/js_stream.cc @@ -251,4 +251,4 @@ void JSStream::Initialize(Local target, } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(js_stream, node::JSStream::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(js_stream, node::JSStream::Initialize) diff --git a/src/node.cc b/src/node.cc index 7384215106e191..5d9024bf5dca9a 100644 --- a/src/node.cc +++ b/src/node.cc @@ -123,6 +123,16 @@ typedef int mode_t; extern char **environ; #endif +// This is used to load built-in modules. Instead of using +// __attribute__((constructor)), we call the _register_ +// function for each built-in modules explicitly in +// node::RegisterBuiltinModules(). This is only forward declaration. +// The definitions are in each module's implementation when calling +// the NODE_BUILTIN_MODULE_CONTEXT_AWARE. +#define V(modname) void _register_##modname(); + NODE_BUILTIN_MODULES(V) +#undef V + namespace node { using v8::Array; @@ -4575,6 +4585,9 @@ void Init(int* argc, // Initialize prog_start_time to get relative uptime. prog_start_time = static_cast(uv_now(uv_default_loop())); + // Register built-in modules + node::RegisterBuiltinModules(); + // Make inherited handles noninheritable. uv_disable_stdio_inheritance(); @@ -4984,11 +4997,18 @@ int Start(int argc, char** argv) { return exit_code; } +// Call built-in modules' _register_ function to +// do module registration explicitly. +void RegisterBuiltinModules() { +#define V(modname) _register_##modname(); + NODE_BUILTIN_MODULES(V) +#undef V +} } // namespace node #if !HAVE_INSPECTOR -static void InitEmptyBindings() {} +void InitEmptyBindings() {} -NODE_MODULE_CONTEXT_AWARE_BUILTIN(inspector, InitEmptyBindings) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(inspector, InitEmptyBindings) #endif // !HAVE_INSPECTOR diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 15194723c7557a..b8f0cdda34afb6 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -1304,4 +1304,4 @@ void Initialize(Local target, } // namespace Buffer } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(buffer, node::Buffer::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(buffer, node::Buffer::Initialize) diff --git a/src/node_config.cc b/src/node_config.cc index b39dc20f870bf4..bf46444cabd107 100644 --- a/src/node_config.cc +++ b/src/node_config.cc @@ -132,4 +132,4 @@ static void InitConfig(Local target, } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(config, node::InitConfig) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(config, node::InitConfig) diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 7c705236a3d3d1..420cc77e927076 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -1171,4 +1171,4 @@ void InitContextify(Local target, } // anonymous namespace } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(contextify, node::InitContextify) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(contextify, node::InitContextify) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 56c25d0a0a6547..1f868afbed4d03 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -6286,4 +6286,4 @@ void InitCrypto(Local target, } // namespace crypto } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(crypto, node::crypto::InitCrypto) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(crypto, node::crypto::InitCrypto) diff --git a/src/node_file.cc b/src/node_file.cc index 3593971ddaf26c..9e7f7bb0e3566a 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -1473,4 +1473,4 @@ void InitFs(Local target, } // end namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(fs, node::InitFs) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(fs, node::InitFs) diff --git a/src/node_http2.cc b/src/node_http2.cc index 1c9a007252bc5f..b439ae588a7756 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -2250,4 +2250,4 @@ HTTP_STATUS_CODES(V) } // namespace http2 } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(http2, node::http2::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(http2, node::http2::Initialize) diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc index 06d6a488263a3d..c990b763be3f76 100644 --- a/src/node_http_parser.cc +++ b/src/node_http_parser.cc @@ -821,4 +821,4 @@ void InitHttpParser(Local target, } // anonymous namespace } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(http_parser, node::InitHttpParser) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(http_parser, node::InitHttpParser) diff --git a/src/node_i18n.cc b/src/node_i18n.cc index 7c769226062e5d..101ae4c79e42d2 100644 --- a/src/node_i18n.cc +++ b/src/node_i18n.cc @@ -874,6 +874,6 @@ void Init(Local target, } // namespace i18n } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(icu, node::i18n::Init) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(icu, node::i18n::Init) #endif // NODE_HAVE_I18N_SUPPORT diff --git a/src/node_internals.h b/src/node_internals.h index 9c8a80854a9932..0d766a59bf01a1 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -73,6 +73,81 @@ struct sockaddr; constant_attributes).FromJust(); \ } while (0) + +#if HAVE_OPENSSL +#define NODE_BUILTIN_OPENSSL_MODULES(V) V(crypto) V(tls_wrap) +#else +#define NODE_BUILTIN_OPENSSL_MODULES(V) +#endif + +#if NODE_HAVE_I18N_SUPPORT +#define NODE_BUILTIN_ICU_MODULES(V) V(icu) +#else +#define NODE_BUILTIN_ICU_MODULES(V) +#endif + +// A list of built-in modules. In order to do module registration +// in node::Init(), need to add built-in modules in the following list. +// Then in node::RegisterBuiltinModules(), it calls modules' registration +// function. This helps the built-in modules are loaded properly when +// node is built as static library. No need to depends on the +// __attribute__((constructor)) like mechanism in GCC. +#define NODE_BUILTIN_STANDARD_MODULES(V) \ + V(async_wrap) \ + V(buffer) \ + V(cares_wrap) \ + V(config) \ + V(contextify) \ + V(fs) \ + V(fs_event_wrap) \ + V(http2) \ + V(http_parser) \ + V(inspector) \ + V(js_stream) \ + V(module_wrap) \ + V(os) \ + V(performance) \ + V(pipe_wrap) \ + V(process_wrap) \ + V(serdes) \ + V(signal_wrap) \ + V(spawn_sync) \ + V(stream_wrap) \ + V(tcp_wrap) \ + V(timer_wrap) \ + V(tty_wrap) \ + V(udp_wrap) \ + V(url) \ + V(util) \ + V(uv) \ + V(v8) \ + V(zlib) + +#define NODE_BUILTIN_MODULES(V) \ + NODE_BUILTIN_STANDARD_MODULES(V) \ + NODE_BUILTIN_OPENSSL_MODULES(V) \ + NODE_BUILTIN_ICU_MODULES(V) + +#define NODE_MODULE_CONTEXT_AWARE_CPP(modname, regfunc, priv, flags) \ + static node::node_module _module = { \ + NODE_MODULE_VERSION, \ + flags, \ + nullptr, \ + __FILE__, \ + nullptr, \ + (node::addon_context_register_func) (regfunc), \ + NODE_STRINGIFY(modname), \ + priv, \ + nullptr \ + }; \ + void _register_ ## modname() { \ + node_module_register(&_module); \ + } + + +#define NODE_BUILTIN_MODULE_CONTEXT_AWARE(modname, regfunc) \ + NODE_MODULE_CONTEXT_AWARE_CPP(modname, regfunc, nullptr, NM_F_BUILTIN) + namespace node { // Set in node.cc by ParseArgs with the value of --openssl-config. @@ -205,6 +280,12 @@ void SetupProcessObject(Environment* env, int exec_argc, const char* const* exec_argv); +// Call _register functions for all of +// the built-in modules. Because built-in modules don't +// use the __attribute__((constructor)). Need to +// explicitly call the _register* functions. +void RegisterBuiltinModules(); + enum Endianness { kLittleEndian, // _Not_ LITTLE_ENDIAN, clashes with endian.h. kBigEndian @@ -328,8 +409,8 @@ class InternalCallbackScope { bool closed_ = false; }; -#define NODE_MODULE_CONTEXT_AWARE_INTERNAL(modname, regfunc) \ - NODE_MODULE_CONTEXT_AWARE_X(modname, regfunc, NULL, NM_F_INTERNAL) \ +#define NODE_MODULE_CONTEXT_AWARE_INTERNAL(modname, regfunc) \ + NODE_MODULE_CONTEXT_AWARE_CPP(modname, regfunc, nullptr, NM_F_INTERNAL) } // namespace node diff --git a/src/node_os.cc b/src/node_os.cc index f09cd6fa5a03ff..d66f8c72c7cb5c 100644 --- a/src/node_os.cc +++ b/src/node_os.cc @@ -414,4 +414,4 @@ void Initialize(Local target, } // namespace os } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(os, node::os::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(os, node::os::Initialize) diff --git a/src/node_perf.cc b/src/node_perf.cc index a3b428bac94fc4..94c3a0f8e0c047 100644 --- a/src/node_perf.cc +++ b/src/node_perf.cc @@ -390,4 +390,4 @@ void Init(Local target, } // namespace performance } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(performance, node::performance::Init) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(performance, node::performance::Init) diff --git a/src/node_serdes.cc b/src/node_serdes.cc index 449fe4a551a162..5eb4455a0eb807 100644 --- a/src/node_serdes.cc +++ b/src/node_serdes.cc @@ -483,4 +483,4 @@ void InitializeSerdesBindings(Local target, } // anonymous namespace } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(serdes, node::InitializeSerdesBindings) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(serdes, node::InitializeSerdesBindings) diff --git a/src/node_url.cc b/src/node_url.cc index 337eb55f4427c0..67c6986da876c8 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -2220,4 +2220,4 @@ static void Init(Local target, } // namespace url } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(url, node::url::Init) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(url, node::url::Init) diff --git a/src/node_util.cc b/src/node_util.cc index cf26eca692e6ed..864cb0f0e0b1b0 100644 --- a/src/node_util.cc +++ b/src/node_util.cc @@ -239,4 +239,4 @@ void Initialize(Local target, } // namespace util } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(util, node::util::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(util, node::util::Initialize) diff --git a/src/node_v8.cc b/src/node_v8.cc index 695a2bf3237314..e2ffedcea4b1b3 100644 --- a/src/node_v8.cc +++ b/src/node_v8.cc @@ -20,6 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. #include "node.h" +#include "node_internals.h" #include "env-inl.h" #include "util-inl.h" #include "v8.h" @@ -200,4 +201,4 @@ void InitializeV8Bindings(Local target, } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(v8, node::InitializeV8Bindings) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(v8, node::InitializeV8Bindings) diff --git a/src/node_zlib.cc b/src/node_zlib.cc index a614cdbe01da03..21145a0d5bdeb1 100644 --- a/src/node_zlib.cc +++ b/src/node_zlib.cc @@ -710,4 +710,4 @@ void InitZlib(Local target, } // anonymous namespace } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(zlib, node::InitZlib) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(zlib, node::InitZlib) diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index 5e061165e29bf8..76280f0ce77e86 100644 --- a/src/pipe_wrap.cc +++ b/src/pipe_wrap.cc @@ -240,4 +240,4 @@ void PipeWrap::Connect(const FunctionCallbackInfo& args) { } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(pipe_wrap, node::PipeWrap::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(pipe_wrap, node::PipeWrap::Initialize) diff --git a/src/process_wrap.cc b/src/process_wrap.cc index a73e4d9779ed46..3667b0449e4e2c 100644 --- a/src/process_wrap.cc +++ b/src/process_wrap.cc @@ -311,4 +311,4 @@ class ProcessWrap : public HandleWrap { } // anonymous namespace } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(process_wrap, node::ProcessWrap::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(process_wrap, node::ProcessWrap::Initialize) diff --git a/src/signal_wrap.cc b/src/signal_wrap.cc index 59aa45078b3ae6..5117d3ab1d1988 100644 --- a/src/signal_wrap.cc +++ b/src/signal_wrap.cc @@ -126,4 +126,4 @@ class SignalWrap : public HandleWrap { } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(signal_wrap, node::SignalWrap::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(signal_wrap, node::SignalWrap::Initialize) diff --git a/src/spawn_sync.cc b/src/spawn_sync.cc index 296b860a2ca3a9..2a524153a29d13 100644 --- a/src/spawn_sync.cc +++ b/src/spawn_sync.cc @@ -1073,5 +1073,5 @@ void SyncProcessRunner::KillTimerCloseCallback(uv_handle_t* handle) { } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(spawn_sync, +NODE_BUILTIN_MODULE_CONTEXT_AWARE(spawn_sync, node::SyncProcessRunner::Initialize) diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc index 1bd1d1d6390442..a737ed67b02c57 100644 --- a/src/stream_wrap.cc +++ b/src/stream_wrap.cc @@ -398,5 +398,5 @@ void LibuvStreamWrap::OnAfterWriteImpl(WriteWrap* w, void* ctx) { } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(stream_wrap, +NODE_BUILTIN_MODULE_CONTEXT_AWARE(stream_wrap, node::LibuvStreamWrap::Initialize) diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc index 7cb5d4735b9d40..8dd14e2e16c18b 100644 --- a/src/tcp_wrap.cc +++ b/src/tcp_wrap.cc @@ -387,4 +387,4 @@ Local AddressToJS(Environment* env, } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(tcp_wrap, node::TCPWrap::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(tcp_wrap, node::TCPWrap::Initialize) diff --git a/src/timer_wrap.cc b/src/timer_wrap.cc index eeaee70a02331c..874c80d8d7095b 100644 --- a/src/timer_wrap.cc +++ b/src/timer_wrap.cc @@ -136,4 +136,4 @@ class TimerWrap : public HandleWrap { } // anonymous namespace } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(timer_wrap, node::TimerWrap::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(timer_wrap, node::TimerWrap::Initialize) diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc index d1cfcd9f17e81f..3b899ea12d501d 100644 --- a/src/tls_wrap.cc +++ b/src/tls_wrap.cc @@ -982,4 +982,4 @@ void TLSWrap::Initialize(Local target, } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(tls_wrap, node::TLSWrap::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(tls_wrap, node::TLSWrap::Initialize) diff --git a/src/tty_wrap.cc b/src/tty_wrap.cc index 17462f6d21e49a..18f9feca57a4c2 100644 --- a/src/tty_wrap.cc +++ b/src/tty_wrap.cc @@ -175,4 +175,4 @@ TTYWrap::TTYWrap(Environment* env, } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(tty_wrap, node::TTYWrap::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(tty_wrap, node::TTYWrap::Initialize) diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index 6349b0bdc330e9..e1f478ac4f0b71 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -512,4 +512,4 @@ uv_udp_t* UDPWrap::UVHandle() { } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(udp_wrap, node::UDPWrap::Initialize) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(udp_wrap, node::UDPWrap::Initialize) diff --git a/src/uv.cc b/src/uv.cc index a13a0430c14b92..f70da1baae5deb 100644 --- a/src/uv.cc +++ b/src/uv.cc @@ -21,6 +21,7 @@ #include "uv.h" #include "node.h" +#include "node_internals.h" #include "env-inl.h" namespace node { @@ -58,4 +59,4 @@ void InitializeUV(Local target, } // anonymous namespace } // namespace node -NODE_MODULE_CONTEXT_AWARE_BUILTIN(uv, node::InitializeUV) +NODE_BUILTIN_MODULE_CONTEXT_AWARE(uv, node::InitializeUV) diff --git a/test/cctest/node_module_reg.cc b/test/cctest/node_module_reg.cc new file mode 100644 index 00000000000000..f8d9d03c1cdb99 --- /dev/null +++ b/test/cctest/node_module_reg.cc @@ -0,0 +1,28 @@ +// Need to create empty definition for these modules' +// registration function for cctest. Because when +// building cctest, the definitions for the following +// registration functions are not included. +void _register_cares_wrap() {} +void _register_config() {} +void _register_contextify() {} +void _register_fs() {} +void _register_fs_event_wrap() {} +void _register_http2() {} +void _register_http_parser() {} +void _register_js_stream() {} +void _register_module_wrap() {} +void _register_os() {} +void _register_pipe_wrap() {} +void _register_process_wrap() {} +void _register_serdes() {} +void _register_signal_wrap() {} +void _register_spawn_sync() {} +void _register_stream_wrap() {} +void _register_tcp_wrap() {} +void _register_timer_wrap() {} +void _register_tty_wrap() {} +void _register_udp_wrap() {} +void _register_util() {} +void _register_uv() {} +void _register_v8() {} +void _register_zlib() {}