forked from vercel/pkg-fetch
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnode.v19.7.0.cpp.patch
576 lines (540 loc) · 19.9 KB
/
node.v19.7.0.cpp.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
diff --git node/common.gypi node/common.gypi
index b3718cff39..6a4a664ba0 100644
--- node/common.gypi
+++ node/common.gypi
@@ -174,7 +174,7 @@
'MSVC_runtimeType': 2 # MultiThreadedDLL (/MD)
}],
['llvm_version=="0.0"', {
- 'lto': ' -flto=4 -fuse-linker-plugin -ffat-lto-objects ', # GCC
+ 'lto': ' -flto=4 -ffat-lto-objects ', # GCC
}, {
'lto': ' -flto ', # Clang
}],
diff --git node/configure.py node/configure.py
index b1fc5513e7..cade999317 100755
--- node/configure.py
+++ node/configure.py
@@ -1265,9 +1265,7 @@ def configure_node(o):
o['variables']['want_separate_host_toolset'] = int(cross_compiling)
- # Enable branch protection for arm64
if target_arch == 'arm64':
- o['cflags']+=['-msign-return-address=all']
o['variables']['arm_fpu'] = options.arm_fpu or 'neon'
if options.node_snapshot_main is not None:
diff --git node/deps/v8/include/v8-initialization.h node/deps/v8/include/v8-initialization.h
index d3e35d6ec5..6e9bbe3849 100644
--- node/deps/v8/include/v8-initialization.h
+++ node/deps/v8/include/v8-initialization.h
@@ -89,6 +89,10 @@ class V8_EXPORT V8 {
static void SetFlagsFromCommandLine(int* argc, char** argv,
bool remove_flags);
+ static void EnableCompilationForSourcelessUse();
+ static void DisableCompilationForSourcelessUse();
+ static void FixSourcelessScript(Isolate* v8_isolate, Local<UnboundScript> script);
+
/** Get the version string. */
static const char* GetVersion();
diff --git node/deps/v8/src/api/api.cc node/deps/v8/src/api/api.cc
index a4a4381614..2998f3c49b 100644
--- node/deps/v8/src/api/api.cc
+++ node/deps/v8/src/api/api.cc
@@ -683,6 +683,29 @@ void V8::SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags) {
HelpOptions(HelpOptions::kDontExit));
}
+bool save_lazy;
+bool save_predictable;
+
+void V8::EnableCompilationForSourcelessUse() {
+ save_lazy = i::FLAG_lazy;
+ i::FLAG_lazy = false;
+ save_predictable = i::FLAG_predictable;
+ i::FLAG_predictable = true;
+}
+
+void V8::DisableCompilationForSourcelessUse() {
+ i::FLAG_lazy = save_lazy;
+ i::FLAG_predictable = save_predictable;
+}
+
+void V8::FixSourcelessScript(Isolate* v8_isolate, Local<UnboundScript> unbound_script) {
+ auto isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
+ auto function_info =
+ i::Handle<i::SharedFunctionInfo>::cast(Utils::OpenHandle(*unbound_script));
+ i::Handle<i::Script> script(i::Script::cast(function_info->script()), isolate);
+ script->set_source(i::ReadOnlyRoots(isolate).undefined_value());
+}
+
RegisteredExtension* RegisteredExtension::first_extension_ = nullptr;
RegisteredExtension::RegisteredExtension(std::unique_ptr<Extension> extension)
diff --git node/deps/v8/src/codegen/compiler.cc node/deps/v8/src/codegen/compiler.cc
index 5431deb83e..d11f04ccac 100644
--- node/deps/v8/src/codegen/compiler.cc
+++ node/deps/v8/src/codegen/compiler.cc
@@ -3497,7 +3497,7 @@ MaybeHandle<SharedFunctionInfo> GetSharedFunctionInfoForScriptImpl(
maybe_script = lookup_result.script();
maybe_result = lookup_result.toplevel_sfi();
is_compiled_scope = lookup_result.is_compiled_scope();
- if (!maybe_result.is_null()) {
+ if (!maybe_result.is_null() && source->length()) {
compile_timer.set_hit_isolate_cache();
} else if (can_consume_code_cache) {
compile_timer.set_consuming_code_cache();
diff --git node/deps/v8/src/objects/js-function.cc node/deps/v8/src/objects/js-function.cc
index 62fe309a47..f1875ce023 100644
--- node/deps/v8/src/objects/js-function.cc
+++ node/deps/v8/src/objects/js-function.cc
@@ -1245,6 +1245,9 @@ Handle<String> JSFunction::ToString(Handle<JSFunction> function) {
Handle<Object> maybe_class_positions = JSReceiver::GetDataProperty(
isolate, function, isolate->factory()->class_positions_symbol());
if (maybe_class_positions->IsClassPositions()) {
+ if (String::cast(Script::cast(shared_info->script()).source()).IsUndefined(isolate)) {
+ return isolate->factory()->NewStringFromAsciiChecked("class {}");
+ }
ClassPositions class_positions =
ClassPositions::cast(*maybe_class_positions);
int start_position = class_positions.start();
diff --git node/deps/v8/src/objects/shared-function-info-inl.h node/deps/v8/src/objects/shared-function-info-inl.h
index 43ef0d3d17..79b774463f 100644
--- node/deps/v8/src/objects/shared-function-info-inl.h
+++ node/deps/v8/src/objects/shared-function-info-inl.h
@@ -637,6 +637,14 @@ bool SharedFunctionInfo::ShouldFlushCode(
}
if (!data.IsBytecodeArray()) return false;
+ Object script_obj = script();
+ if (!script_obj.IsUndefined()) {
+ Script script = Script::cast(script_obj);
+ if (script.source().IsUndefined()) {
+ return false;
+ }
+ }
+
if (IsStressFlushingEnabled(code_flush_mode)) return true;
BytecodeArray bytecode = BytecodeArray::cast(data);
diff --git node/deps/v8/src/parsing/parsing.cc node/deps/v8/src/parsing/parsing.cc
index 8c55a6fb6e..70bf82a57d 100644
--- node/deps/v8/src/parsing/parsing.cc
+++ node/deps/v8/src/parsing/parsing.cc
@@ -42,6 +42,7 @@ bool ParseProgram(ParseInfo* info, Handle<Script> script,
Isolate* isolate, ReportStatisticsMode mode) {
DCHECK(info->flags().is_toplevel());
DCHECK_NULL(info->literal());
+ if (String::cast(script->source()).IsUndefined(isolate)) return false;
VMState<PARSER> state(isolate);
@@ -75,6 +76,7 @@ bool ParseFunction(ParseInfo* info, Handle<SharedFunctionInfo> shared_info,
// Create a character stream for the parser.
Handle<Script> script(Script::cast(shared_info->script()), isolate);
+ if (String::cast(script->source()).IsUndefined(isolate)) return false;
Handle<String> source(String::cast(script->source()), isolate);
std::unique_ptr<Utf16CharacterStream> stream(
ScannerStream::For(isolate, source, shared_info->StartPosition(),
diff --git node/deps/v8/src/snapshot/code-serializer.cc node/deps/v8/src/snapshot/code-serializer.cc
index 95352299f8..2dd794b855 100644
--- node/deps/v8/src/snapshot/code-serializer.cc
+++ node/deps/v8/src/snapshot/code-serializer.cc
@@ -661,11 +661,7 @@ SerializedCodeSanityCheckResult SerializedCodeData::SanityCheck(
}
SerializedCodeSanityCheckResult SerializedCodeData::SanityCheckJustSource(
- uint32_t expected_source_hash) const {
- uint32_t source_hash = GetHeaderValue(kSourceHashOffset);
- if (source_hash != expected_source_hash) {
- return SerializedCodeSanityCheckResult::kSourceMismatch;
- }
+ uint32_t) const {
return SerializedCodeSanityCheckResult::kSuccess;
}
@@ -682,10 +678,6 @@ SerializedCodeSanityCheckResult SerializedCodeData::SanityCheckWithoutSource()
if (version_hash != Version::Hash()) {
return SerializedCodeSanityCheckResult::kVersionMismatch;
}
- uint32_t flags_hash = GetHeaderValue(kFlagHashOffset);
- if (flags_hash != FlagList::Hash()) {
- return SerializedCodeSanityCheckResult::kFlagsMismatch;
- }
uint32_t payload_length = GetHeaderValue(kPayloadLengthOffset);
uint32_t max_payload_length = this->size_ - kHeaderSize;
if (payload_length > max_payload_length) {
diff --git node/lib/child_process.js node/lib/child_process.js
index 1ee9d56f86..ffbf3f093f 100644
--- node/lib/child_process.js
+++ node/lib/child_process.js
@@ -167,7 +167,7 @@ function fork(modulePath, args = [], options) {
throw new ERR_CHILD_PROCESS_IPC_REQUIRED('options.stdio');
}
- return spawn(options.execPath, args, options);
+ return module.exports.spawn(options.execPath, args, options);
}
function _forkChild(fd, serializationMode) {
diff --git node/lib/internal/bootstrap/pkg.js node/lib/internal/bootstrap/pkg.js
new file mode 100644
index 0000000000..e97e9e524c
--- /dev/null
+++ node/lib/internal/bootstrap/pkg.js
@@ -0,0 +1,44 @@
+'use strict';
+
+const {
+ prepareMainThreadExecution
+} = require('internal/process/pre_execution');
+
+prepareMainThreadExecution(true);
+
+(function () {
+ var __require__ = require;
+ var fs = __require__('fs');
+ var vm = __require__('vm');
+ function readPrelude (fd) {
+ var PAYLOAD_POSITION = '// PAYLOAD_POSITION //' | 0;
+ var PAYLOAD_SIZE = '// PAYLOAD_SIZE //' | 0;
+ var PRELUDE_POSITION = '// PRELUDE_POSITION //' | 0;
+ var PRELUDE_SIZE = '// PRELUDE_SIZE //' | 0;
+ if (!PRELUDE_POSITION) {
+ // no prelude - remove entrypoint from argv[1]
+ process.argv.splice(1, 1);
+ return { undoPatch: true };
+ }
+ var prelude = Buffer.alloc(PRELUDE_SIZE);
+ var read = fs.readSync(fd, prelude, 0, PRELUDE_SIZE, PRELUDE_POSITION);
+ if (read !== PRELUDE_SIZE) {
+ console.error('Pkg: Error reading from file.');
+ process.exit(1);
+ }
+ var s = new vm.Script(prelude, { filename: 'pkg/prelude/bootstrap.js' });
+ var fn = s.runInThisContext();
+ return fn(process, __require__,
+ console, fd, PAYLOAD_POSITION, PAYLOAD_SIZE);
+ }
+ (function () {
+ var fd = fs.openSync(process.execPath, 'r');
+ var result = readPrelude(fd);
+ if (result && result.undoPatch) {
+ var bindingFs = process.binding('fs');
+ fs.internalModuleStat = bindingFs.internalModuleStat;
+ fs.internalModuleReadJSON = bindingFs.internalModuleReadJSON;
+ fs.closeSync(fd);
+ }
+ }());
+}());
diff --git node/lib/internal/modules/cjs/loader.js node/lib/internal/modules/cjs/loader.js
index ec1d215074..c28fb8f3c2 100644
--- node/lib/internal/modules/cjs/loader.js
+++ node/lib/internal/modules/cjs/loader.js
@@ -94,7 +94,7 @@ const fs = require('fs');
const internalFS = require('internal/fs/utils');
const path = require('path');
const { sep } = path;
-const { internalModuleStat } = internalBinding('fs');
+const internalModuleStat = function (f) { return require('fs').internalModuleStat(f); };
const { safeGetenv } = internalBinding('credentials');
const {
privateSymbols: {
diff --git node/lib/internal/modules/package_json_reader.js node/lib/internal/modules/package_json_reader.js
index bb175d0df5..07f4834c07 100644
--- node/lib/internal/modules/package_json_reader.js
+++ node/lib/internal/modules/package_json_reader.js
@@ -1,7 +1,7 @@
'use strict';
const { SafeMap } = primordials;
-const { internalModuleReadJSON } = internalBinding('fs');
+const internalModuleReadJSON = function (f) { return require('fs').internalModuleReadJSON(f); };
const { pathToFileURL } = require('url');
const { toNamespacedPath } = require('path');
diff --git node/lib/internal/process/pre_execution.js node/lib/internal/process/pre_execution.js
index ebc699ef1d..f109969a94 100644
--- node/lib/internal/process/pre_execution.js
+++ node/lib/internal/process/pre_execution.js
@@ -36,7 +36,12 @@ const {
},
} = require('internal/v8/startup_snapshot');
+let _alreadyPrepared = false;
+
function prepareMainThreadExecution(expandArgv1 = false, initializeModules = true) {
+ if (_alreadyPrepared === true) return;
+ _alreadyPrepared = true;
+
prepareExecution({
expandArgv1,
initializeModules,
@@ -147,7 +152,8 @@ function patchProcessObject(expandArgv1) {
process.argv[0] = process.execPath;
if (expandArgv1 && process.argv[1] &&
- !StringPrototypeStartsWith(process.argv[1], '-')) {
+ !StringPrototypeStartsWith(process.argv[1], '-') &&
+ process.argv[1] !== 'PKG_DUMMY_ENTRYPOINT') {
// Expand process.argv[1] into a full path.
const path = require('path');
try {
@@ -597,6 +603,7 @@ function loadPreloadModules() {
// For user code, we preload modules if `-r` is passed
const preloadModules = getOptionValue('--require');
if (preloadModules && preloadModules.length > 0) {
+ assert(false, '--require is not supported');
const {
Module: {
_preloadModules,
diff --git node/lib/vm.js node/lib/vm.js
index f47a88a35d..1f17b8b90c 100644
--- node/lib/vm.js
+++ node/lib/vm.js
@@ -79,6 +79,7 @@ class Script extends ContextifyScript {
produceCachedData = false,
importModuleDynamically,
[kParsingContext]: parsingContext,
+ sourceless = false,
} = options;
validateString(filename, 'options.filename');
@@ -103,7 +104,8 @@ class Script extends ContextifyScript {
columnOffset,
cachedData,
produceCachedData,
- parsingContext);
+ parsingContext,
+ sourceless);
} catch (e) {
throw e; /* node-do-not-add-exception-line */
}
diff --git node/node.gyp node/node.gyp
index 6d1b2bf369..3a2e36b390 100644
--- node/node.gyp
+++ node/node.gyp
@@ -110,6 +110,9 @@
},
'conditions': [
+ ['target_arch=="arm64"', {
+ 'cflags': ['-msign-return-address=all'], # Pointer authentication.
+ }],
['OS=="aix"', {
'ldflags': [
'-Wl,-bnoerrmsg',
diff --git node/src/inspector_agent.cc node/src/inspector_agent.cc
index ad193d477a..e0444b9e05 100644
--- node/src/inspector_agent.cc
+++ node/src/inspector_agent.cc
@@ -696,8 +696,6 @@ bool Agent::Start(const std::string& path,
StartIoThreadAsyncCallback));
uv_unref(reinterpret_cast<uv_handle_t*>(&start_io_thread_async));
start_io_thread_async.data = this;
- // Ignore failure, SIGUSR1 won't work, but that should not block node start.
- StartDebugSignalHandler();
parent_env_->AddCleanupHook([](void* data) {
Environment* env = static_cast<Environment*>(data);
diff --git node/src/node.cc node/src/node.cc
index 6bdcbb3de9..f94d3d396d 100644
--- node/src/node.cc
+++ node/src/node.cc
@@ -303,6 +303,8 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) {
return env->RunSnapshotDeserializeMain();
}
+ StartExecution(env, "internal/bootstrap/pkg");
+
if (env->worker_context() != nullptr) {
return StartExecution(env, "internal/main/worker_thread");
}
@@ -506,14 +508,6 @@ static void PlatformInit(ProcessInitializationFlags::Flags flags) {
}
if (!(flags & ProcessInitializationFlags::kNoDefaultSignalHandling)) {
-#if HAVE_INSPECTOR
- sigset_t sigmask;
- sigemptyset(&sigmask);
- sigaddset(&sigmask, SIGUSR1);
- const int err = pthread_sigmask(SIG_SETMASK, &sigmask, nullptr);
- CHECK_EQ(err, 0);
-#endif // HAVE_INSPECTOR
-
ResetSignalHandlers();
}
diff --git node/src/node_contextify.cc node/src/node_contextify.cc
index d618dafcb5..a7e2826a59 100644
--- node/src/node_contextify.cc
+++ node/src/node_contextify.cc
@@ -75,6 +75,7 @@ using v8::ScriptOrigin;
using v8::String;
using v8::Uint32;
using v8::UnboundScript;
+using v8::V8;
using v8::Value;
using v8::WeakCallbackInfo;
using v8::WeakCallbackType;
@@ -771,11 +772,12 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
Local<ArrayBufferView> cached_data_buf;
bool produce_cached_data = false;
Local<Context> parsing_context = context;
+ bool sourceless = false;
if (argc > 2) {
// new ContextifyScript(code, filename, lineOffset, columnOffset,
// cachedData, produceCachedData, parsingContext)
- CHECK_EQ(argc, 7);
+ CHECK_EQ(argc, 8);
CHECK(args[2]->IsNumber());
line_offset = args[2].As<Int32>()->Value();
CHECK(args[3]->IsNumber());
@@ -794,6 +796,7 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
CHECK_NOT_NULL(sandbox);
parsing_context = sandbox->context();
}
+ sourceless = args[7]->IsTrue();
}
ContextifyScript* contextify_script =
@@ -844,6 +847,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
ShouldNotAbortOnUncaughtScope no_abort_scope(env);
Context::Scope scope(parsing_context);
+ if (sourceless && produce_cached_data) {
+ V8::EnableCompilationForSourcelessUse();
+ }
+
MaybeLocal<UnboundScript> maybe_v8_script =
ScriptCompiler::CompileUnboundScript(isolate, &source, compile_options);
@@ -857,6 +864,13 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
"ContextifyScript::New");
return;
}
+
+ if (sourceless && compile_options == ScriptCompiler::kConsumeCodeCache) {
+ if (!source.GetCachedData()->rejected) {
+ V8::FixSourcelessScript(env->isolate(), v8_script);
+ }
+ }
+
contextify_script->script_.Reset(isolate, v8_script);
std::unique_ptr<ScriptCompiler::CachedData> new_cached_data;
@@ -881,6 +895,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
.IsNothing())
return;
+ if (sourceless && produce_cached_data) {
+ V8::DisableCompilationForSourcelessUse();
+ }
+
TRACE_EVENT_END0(TRACING_CATEGORY_NODE2(vm, script), "ContextifyScript::New");
}
diff --git node/src/node_main.cc node/src/node_main.cc
index 56deaf47fa..e7ffa1baaa 100644
--- node/src/node_main.cc
+++ node/src/node_main.cc
@@ -22,6 +22,8 @@
#include "node.h"
#include <cstdio>
+int reorder(int argc, char** argv);
+
#ifdef _WIN32
#include <windows.h>
#include <VersionHelpers.h>
@@ -88,12 +90,95 @@ int wmain(int argc, wchar_t* wargv[]) {
}
argv[argc] = nullptr;
// Now that conversion is done, we can finally start.
- return node::Start(argc, argv);
+ return reorder(argc, argv);
}
#else
// UNIX
int main(int argc, char* argv[]) {
+ return reorder(argc, argv);
+}
+#endif
+
+#include <string.h>
+
+int strlen2 (char* s) {
+ int len = 0;
+ while (*s) {
+ len += 1;
+ s += 1;
+ }
+ return len;
+}
+
+bool should_set_dummy() {
+#ifdef _WIN32
+ #define MAX_ENV_LENGTH 32767
+ wchar_t execpath_env[MAX_ENV_LENGTH];
+ DWORD result = GetEnvironmentVariableW(L"PKG_EXECPATH", execpath_env, MAX_ENV_LENGTH);
+ if (result == 0 && GetLastError() != ERROR_SUCCESS) return true;
+ return wcscmp(execpath_env, L"PKG_INVOKE_NODEJS") != 0;
+#else
+ const char* execpath_env = getenv("PKG_EXECPATH");
+ if (!execpath_env) return true;
+ return strcmp(execpath_env, "PKG_INVOKE_NODEJS") != 0;
+#endif
+}
+
+// for uv_setup_args
+int adjacent(int argc, char** argv) {
+ size_t size = 0;
+ for (int i = 0; i < argc; i++) {
+ size += strlen(argv[i]) + 1;
+ }
+ char* args = new char[size];
+ size_t pos = 0;
+ for (int i = 0; i < argc; i++) {
+ memcpy(&args[pos], argv[i], strlen(argv[i]) + 1);
+ argv[i] = &args[pos];
+ pos += strlen(argv[i]) + 1;
+ }
return node::Start(argc, argv);
}
+
+volatile char* BAKERY = (volatile char*) "\0// BAKERY // BAKERY " \
+ "// BAKERY // BAKERY // BAKERY // BAKERY // BAKERY // BAKERY " \
+ "// BAKERY // BAKERY // BAKERY // BAKERY // BAKERY // BAKERY " \
+ "// BAKERY // BAKERY // BAKERY // BAKERY // BAKERY // BAKERY ";
+
+#ifdef __clang__
+__attribute__((optnone))
+#elif defined(__GNUC__)
+__attribute__((optimize(0)))
#endif
+
+int load_baked(char** nargv) {
+ int c = 1;
+
+ char* bakery = (char*) BAKERY;
+ while (true) {
+ size_t width = strlen2(bakery);
+ if (width == 0) break;
+ nargv[c++] = bakery;
+ bakery += width + 1;
+ }
+
+ return c;
+}
+
+int reorder(int argc, char** argv) {
+ char** nargv = new char*[argc + 64];
+
+ nargv[0] = argv[0];
+ int c = load_baked(nargv);
+
+ if (should_set_dummy()) {
+ nargv[c++] = (char*) "PKG_DUMMY_ENTRYPOINT";
+ }
+
+ for (int i = 1; i < argc; i++) {
+ nargv[c++] = argv[i];
+ }
+
+ return adjacent(c, nargv);
+}
diff --git node/src/node_options.cc node/src/node_options.cc
index e7b0ba1073..530d56bd76 100644
--- node/src/node_options.cc
+++ node/src/node_options.cc
@@ -301,6 +301,7 @@ void Parse(
// TODO(addaleax): Make that unnecessary.
DebugOptionsParser::DebugOptionsParser() {
+ return;
#ifndef DISABLE_SINGLE_EXECUTABLE_APPLICATION
if (sea::IsSingleExecutable()) return;
#endif
diff --git node/tools/icu/icu-generic.gyp node/tools/icu/icu-generic.gyp
index db45e6fbdf..3e39f1fbdf 100644
--- node/tools/icu/icu-generic.gyp
+++ node/tools/icu/icu-generic.gyp
@@ -52,7 +52,7 @@
'conditions': [
[ 'os_posix == 1 and OS != "mac" and OS != "ios"', {
'cflags': [ '-Wno-deprecated-declarations', '-Wno-strict-aliasing' ],
- 'cflags_cc': [ '-frtti' ],
+ 'cflags_cc': [ '-frtti', '-fno-lto' ],
'cflags_cc!': [ '-fno-rtti' ],
}],
[ 'OS == "mac" or OS == "ios"', {