Skip to content

Commit 75baeb6

Browse files
committed
v8,tools: expose necessary V8 defines
nodejs/node#50820
1 parent 8d030c9 commit 75baeb6

File tree

2 files changed

+17
-53
lines changed

2 files changed

+17
-53
lines changed

patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,36 @@ Subject: build: ensure native module compilation fails if not using a new
77
This should not be upstreamed, it is a quality-of-life patch for downstream module builders.
88

99
diff --git a/common.gypi b/common.gypi
10-
index b7f9e44f827e58ac3b9376ec291f42cceb2b28bb..24cc9efe32c083d0cecd1ae94514b5a2d24ca2d6 100644
10+
index f52d4f805406c513904151be90e433948764b3ad..343bbafa9787f56646ee7332151d21152ecf5379 100644
1111
--- a/common.gypi
1212
+++ b/common.gypi
13-
@@ -79,6 +79,8 @@
14-
# TODO(refack): make v8-perfetto happen
13+
@@ -86,6 +86,8 @@
1514
'v8_use_perfetto': 0,
15+
'tsan%': 0,
1616

1717
+ 'using_electron_config_gypi%': 0,
1818
+
1919
##### end V8 defaults #####
2020

2121
# When building native modules using 'npm install' with the system npm,
22-
@@ -282,6 +284,7 @@
23-
'V8_DEPRECATION_WARNINGS',
24-
'V8_IMMINENT_DEPRECATION_WARNINGS',
22+
@@ -285,6 +287,7 @@
23+
# Defines these mostly for node-gyp to pickup.
24+
'defines': [
2525
'_GLIBCXX_USE_CXX11_ABI=1',
2626
+ 'ELECTRON_ENSURE_CONFIG_GYPI',
2727
],
2828

2929
# Forcibly disable -Werror. We support a wide range of compilers, it's
30-
@@ -388,6 +391,11 @@
31-
}],
32-
],
30+
@@ -396,6 +399,9 @@
31+
['v8_enable_v8_checks == 1', {
32+
'defines': ['V8_ENABLE_CHECKS'],
3333
}],
3434
+ ['using_electron_config_gypi == 1', {
35-
+ 'defines': [
36-
+ 'USING_ELECTRON_CONFIG_GYPI',
37-
+ ],
35+
+ 'defines': ['USING_ELECTRON_CONFIG_GYPI'],
3836
+ }],
3937
['v8_enable_pointer_compression == 1', {
40-
'defines': [
41-
'V8_COMPRESS_POINTERS',
38+
'defines': ['V8_COMPRESS_POINTERS'],
39+
}],
4240
diff --git a/configure.py b/configure.py
4341
index 7b80ec63a082ce93ba81ca6dd41ec03041534ff7..926659883d3bd6d447c89a50d6770988b59d6f88 100755
4442
--- a/configure.py

patches/node/build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -7,49 +7,15 @@ Aligns common.gypi with the current build flag state of //v8.
77

88
Specifically enables `V8_ENABLE_SANDBOX`, `V8_SANDBOXED_POINTERS`, `V8_COMPRESS_POINTERS` and `V8_COMPRESS_POINTERS_IN_SHARED_CAGE`.
99

10-
diff --git a/common.gypi b/common.gypi
11-
index 225b3df380caca809926d6af9fc1001057237752..b7f9e44f827e58ac3b9376ec291f42cceb2b28bb 100644
12-
--- a/common.gypi
13-
+++ b/common.gypi
14-
@@ -65,6 +65,7 @@
15-
# node-gyp to build addons.
16-
'v8_enable_pointer_compression%': 0,
17-
'v8_enable_31bit_smis_on_64bit_arch%': 0,
18-
+ 'v8_enable_sandbox%': 0,
19-
20-
# Disable v8 hugepage by default.
21-
'v8_enable_hugepage%': 0,
22-
@@ -123,6 +124,7 @@
23-
['target_arch in "arm ia32 mips mipsel ppc"', {
24-
'v8_enable_pointer_compression': 0,
25-
'v8_enable_31bit_smis_on_64bit_arch': 0,
26-
+ 'v8_enable_sandbox': 0,
27-
}],
28-
['target_arch in "ppc64 s390x"', {
29-
'v8_enable_backtrace': 1,
30-
@@ -389,9 +391,12 @@
31-
['v8_enable_pointer_compression == 1', {
32-
'defines': [
33-
'V8_COMPRESS_POINTERS',
34-
- 'V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE',
35-
+ 'V8_COMPRESS_POINTERS_IN_SHARED_CAGE',
36-
],
37-
}],
38-
+ ['v8_enable_sandbox == 1', {
39-
+ 'defines': ['V8_ENABLE_SANDBOX']
40-
+ }],
41-
['v8_enable_pointer_compression == 1 or v8_enable_31bit_smis_on_64bit_arch == 1', {
42-
'defines': ['V8_31BIT_SMIS_ON_64BIT_ARCH'],
43-
}],
4410
diff --git a/configure.py b/configure.py
45-
index 62f041ce52bf85136175e733216671e2811a337b..7b80ec63a082ce93ba81ca6dd41ec03041534ff7 100755
11+
index 84b016cd853080656d4dcf982e64855fcfa72a55..5ede37578480b06daf7ffab786a1361eeae3c6b4 100755
4612
--- a/configure.py
4713
+++ b/configure.py
48-
@@ -1497,6 +1497,7 @@ def configure_v8(o):
49-
o['variables']['v8_use_siphash'] = 0 if options.without_siphash else 1
14+
@@ -1503,6 +1503,7 @@ def configure_v8(o):
15+
o['variables']['v8_enable_maglev'] = 1 if options.v8_enable_maglev else 0
5016
o['variables']['v8_enable_pointer_compression'] = 1 if options.enable_pointer_compression else 0
5117
o['variables']['v8_enable_31bit_smis_on_64bit_arch'] = 1 if options.enable_pointer_compression else 0
5218
+ o['variables']['v8_enable_sandbox'] = 1 if options.enable_pointer_compression else 0
5319
o['variables']['v8_enable_shared_ro_heap'] = 0 if options.enable_pointer_compression or options.disable_shared_ro_heap else 1
54-
o['variables']['v8_trace_maps'] = 1 if options.trace_maps else 0
55-
o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform)
20+
o['variables']['v8_enable_extensible_ro_snapshot'] = 0
21+
o['variables']['v8_enable_v8_checks'] = 1 if options.debug else 0

0 commit comments

Comments
 (0)