summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYihong Wang <yh.wang@ibm.com>2017-10-21 23:16:50 -0700
committerGibson Fahnestock <gibfahn@gmail.com>2017-11-13 23:17:34 +0000
commit8680bb9f1a0163cfbdc4443c1eb2b56c5e443616 (patch)
tree16d97c77379adba2d45dc17787f314b9e3cb1b1b /src
parent21a7459d490d832d5d547833d527083e460999e1 (diff)
downloadandroid-node-v8-8680bb9f1a0163cfbdc4443c1eb2b56c5e443616.tar.gz
android-node-v8-8680bb9f1a0163cfbdc4443c1eb2b56c5e443616.tar.bz2
android-node-v8-8680bb9f1a0163cfbdc4443c1eb2b56c5e443616.zip
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 <yh.wang@ibm.com> PR-URL: https://github.com/nodejs/node/pull/16565 Refs: https://github.com/nodejs/node/pull/14986#issuecomment-332758206 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/async-wrap.cc2
-rw-r--r--src/cares_wrap.cc2
-rw-r--r--src/fs_event_wrap.cc2
-rw-r--r--src/inspector_js_api.cc2
-rw-r--r--src/js_stream.cc2
-rw-r--r--src/node.cc24
-rw-r--r--src/node_buffer.cc2
-rw-r--r--src/node_config.cc2
-rw-r--r--src/node_contextify.cc2
-rw-r--r--src/node_crypto.cc2
-rw-r--r--src/node_file.cc2
-rw-r--r--src/node_http2.cc2
-rw-r--r--src/node_http_parser.cc2
-rw-r--r--src/node_i18n.cc2
-rw-r--r--src/node_internals.h85
-rw-r--r--src/node_os.cc2
-rw-r--r--src/node_perf.cc2
-rw-r--r--src/node_serdes.cc2
-rw-r--r--src/node_url.cc2
-rw-r--r--src/node_util.cc2
-rw-r--r--src/node_v8.cc3
-rw-r--r--src/node_zlib.cc2
-rw-r--r--src/pipe_wrap.cc2
-rw-r--r--src/process_wrap.cc2
-rw-r--r--src/signal_wrap.cc2
-rw-r--r--src/spawn_sync.cc2
-rw-r--r--src/stream_wrap.cc2
-rw-r--r--src/tcp_wrap.cc2
-rw-r--r--src/timer_wrap.cc2
-rw-r--r--src/tls_wrap.cc2
-rw-r--r--src/tty_wrap.cc2
-rw-r--r--src/udp_wrap.cc2
-rw-r--r--src/uv.cc3
33 files changed, 138 insertions, 35 deletions
diff --git a/src/async-wrap.cc b/src/async-wrap.cc
index 8f2b8f377f..af0336d492 100644
--- a/src/async-wrap.cc
+++ b/src/async-wrap.cc
@@ -719,4 +719,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 7c09b01d80..1382d60ee3 100644
--- a/src/cares_wrap.cc
+++ b/src/cares_wrap.cc
@@ -2265,4 +2265,4 @@ void Initialize(Local<Object> 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 da39602c1b..0a4d6452f5 100644
--- a/src/fs_event_wrap.cc
+++ b/src/fs_event_wrap.cc
@@ -221,4 +221,4 @@ void FSEventWrap::Close(const FunctionCallbackInfo<Value>& 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 f72517bac1..df700bf6a1 100644
--- a/src/inspector_js_api.cc
+++ b/src/inspector_js_api.cc
@@ -348,5 +348,5 @@ void InitInspectorBindings(Local<Object> target, Local<Value> 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 9d28b90585..842fc3b711 100644
--- a/src/js_stream.cc
+++ b/src/js_stream.cc
@@ -251,4 +251,4 @@ void JSStream::Initialize(Local<Object> 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 05120fbde1..cced5e7f8f 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -124,6 +124,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_<modname>
+// 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;
@@ -4305,6 +4315,9 @@ void Init(int* argc,
// Initialize prog_start_time to get relative uptime.
prog_start_time = static_cast<double>(uv_now(uv_default_loop()));
+ // Register built-in modules
+ node::RegisterBuiltinModules();
+
// Make inherited handles noninheritable.
uv_disable_stdio_inheritance();
@@ -4694,11 +4707,18 @@ int Start(int argc, char** argv) {
return exit_code;
}
+// Call built-in modules' _register_<module name> 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 4c60073c30..008ac46918 100644
--- a/src/node_buffer.cc
+++ b/src/node_buffer.cc
@@ -1300,4 +1300,4 @@ void Initialize(Local<Object> 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 b39dc20f87..bf46444cab 100644
--- a/src/node_config.cc
+++ b/src/node_config.cc
@@ -132,4 +132,4 @@ static void InitConfig(Local<Object> 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 47806aa7f6..9d3d620027 100644
--- a/src/node_contextify.cc
+++ b/src/node_contextify.cc
@@ -1171,4 +1171,4 @@ void InitContextify(Local<Object> 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 e5728583ea..8535f52398 100644
--- a/src/node_crypto.cc
+++ b/src/node_crypto.cc
@@ -6285,4 +6285,4 @@ void InitCrypto(Local<Object> 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 9da3fc7f2e..76ab7f9f33 100644
--- a/src/node_file.cc
+++ b/src/node_file.cc
@@ -1473,4 +1473,4 @@ void InitFs(Local<Object> 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 83bd2781e4..84c1cfd977 100644
--- a/src/node_http2.cc
+++ b/src/node_http2.cc
@@ -1396,4 +1396,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 9102f9f886..ccb0942609 100644
--- a/src/node_http_parser.cc
+++ b/src/node_http_parser.cc
@@ -808,4 +808,4 @@ void InitHttpParser(Local<Object> 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 30f421a8b8..e16831fd62 100644
--- a/src/node_i18n.cc
+++ b/src/node_i18n.cc
@@ -874,6 +874,6 @@ void Init(Local<Object> 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 579221b85c..b432c44beb 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.
@@ -201,6 +276,12 @@ void SetupProcessObject(Environment* env,
int exec_argc,
const char* const* exec_argv);
+// Call _register<module_name> 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
@@ -650,8 +731,8 @@ static inline const char *errno_string(int errorno) {
}
}
-#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 c57841ca9e..f6dbf76b4c 100644
--- a/src/node_os.cc
+++ b/src/node_os.cc
@@ -428,4 +428,4 @@ void Initialize(Local<Object> 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 155f1e66e4..a27a1b3dd7 100644
--- a/src/node_perf.cc
+++ b/src/node_perf.cc
@@ -388,4 +388,4 @@ void Init(Local<Object> 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 4e99513a5f..19b6f163e6 100644
--- a/src/node_serdes.cc
+++ b/src/node_serdes.cc
@@ -483,4 +483,4 @@ void InitializeSerdesBindings(Local<Object> 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 49c005a23b..651e9b2af8 100644
--- a/src/node_url.cc
+++ b/src/node_url.cc
@@ -2220,4 +2220,4 @@ static void Init(Local<Object> 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 6683eee07a..0c4eaa4aa7 100644
--- a/src/node_util.cc
+++ b/src/node_util.cc
@@ -230,4 +230,4 @@ void Initialize(Local<Object> 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 695a2bf323..e2ffedcea4 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<Object> 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 01f713afd7..9d035030e8 100644
--- a/src/node_zlib.cc
+++ b/src/node_zlib.cc
@@ -710,4 +710,4 @@ void InitZlib(Local<Object> 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 5a6eeaa3eb..d84458570d 100644
--- a/src/pipe_wrap.cc
+++ b/src/pipe_wrap.cc
@@ -204,4 +204,4 @@ void PipeWrap::Connect(const FunctionCallbackInfo<Value>& 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 a73e4d9779..3667b0449e 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 70b831132b..6d466f2cc3 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 626ecbb04f..4e51cc5d8f 100644
--- a/src/spawn_sync.cc
+++ b/src/spawn_sync.cc
@@ -1081,5 +1081,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 01022c9174..3bd95fb4e3 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 ce86108cb0..af64f89b54 100644
--- a/src/tcp_wrap.cc
+++ b/src/tcp_wrap.cc
@@ -360,4 +360,4 @@ Local<Object> 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 aabde9a613..ba7f5b2d07 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 3315267330..d5b56ca9ba 100644
--- a/src/tls_wrap.cc
+++ b/src/tls_wrap.cc
@@ -982,4 +982,4 @@ void TLSWrap::Initialize(Local<Object> 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 4d49e1a65c..c3bd48bf41 100644
--- a/src/tty_wrap.cc
+++ b/src/tty_wrap.cc
@@ -176,4 +176,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 05682a3e1f..df78596cab 100644
--- a/src/udp_wrap.cc
+++ b/src/udp_wrap.cc
@@ -514,4 +514,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 a13a0430c1..f70da1baae 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<Object> target,
} // anonymous namespace
} // namespace node
-NODE_MODULE_CONTEXT_AWARE_BUILTIN(uv, node::InitializeUV)
+NODE_BUILTIN_MODULE_CONTEXT_AWARE(uv, node::InitializeUV)