From 7f44ecf5f650fe7c100e2c940a563e65e9b963c4 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Fri, 13 May 2016 16:32:51 +0200 Subject: [PATCH 1/2] build: turn on -fno-delete-null-pointer-checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Work around spec violations in V8 where it checks that `this == NULL`. GCC 6 started exploiting this particular kind of UB, resulting in runtime crashes. Fixes: https://github.com/nodejs/node/issues/6724 PR-URL: https://github.com/nodejs/node/pull/6738 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Michaƫl Zasso --- common.gypi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common.gypi b/common.gypi index 887df4b2285e2e..705245e69369df 100644 --- a/common.gypi +++ b/common.gypi @@ -179,7 +179,11 @@ }], [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', { 'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', '-pthread', ], - 'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ], + 'cflags_cc': [ + '-fno-delete-null-pointer-checks', + '-fno-exceptions', + '-fno-rtti', + ], 'ldflags': [ '-pthread', '-rdynamic' ], 'target_conditions': [ ['_type=="static_library"', { From 6a47a07e27fac153d389bb88a5dc8a8e4cf397ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Cie=C5=9Blak?= Date: Wed, 20 Jul 2016 08:44:28 +0000 Subject: [PATCH 2/2] build: add node_module_version to config.gypi Enable targetting of a different node version than the currently running one when building binary modules. Based on nodejs/node@410296c37 PR-URL: https://github.com/nodejs/node/pull/7808 Ref: https://github.com/nodejs/node-gyp/pull/855 --- configure | 2 ++ node.gyp | 1 + test/simple/test-module-version.js | 10 ++++++++++ 3 files changed, 13 insertions(+) create mode 100644 test/simple/test-module-version.js diff --git a/configure b/configure index 525503054797fb..1b2cc56bda01aa 100755 --- a/configure +++ b/configure @@ -546,6 +546,8 @@ def configure_node(o): else: o['variables']['node_tag'] = '' + o['variables']['node_module_version'] = 11 + def configure_libz(o): o['variables']['node_shared_zlib'] = b(options.shared_zlib) diff --git a/node.gyp b/node.gyp index 42051756074eba..3047b909ef70ea 100644 --- a/node.gyp +++ b/node.gyp @@ -13,6 +13,7 @@ 'node_use_openssl%': 'true', 'node_use_systemtap%': 'false', 'node_shared_openssl%': 'false', + 'node_module_version%': '', 'library_files': [ 'src/node.js', 'lib/_debugger.js', diff --git a/test/simple/test-module-version.js b/test/simple/test-module-version.js new file mode 100644 index 00000000000000..d8e4bf461ecd8b --- /dev/null +++ b/test/simple/test-module-version.js @@ -0,0 +1,10 @@ +'use strict'; +require('../common'); +var assert = require('assert'); + +// Check for existence +assert(process.config.variables.hasOwnProperty('node_module_version')); + +// Ensure that `node_module_version` is an Integer +assert(!Number.isNaN(parseInt(process.config.variables.node_module_version))); +assert.strictEqual(process.config.variables.node_module_version, 11);