src: fix --disable-single-executable-application · nodejs/node@5034363 · GitHub
Skip to content

Commit 5034363

Browse files
joyeecheungtargos
authored andcommitted
src: fix --disable-single-executable-application
Previously it would not compile if the build is configured with --disable-single-executable-application because we use directives to exclude the definition of SEA-related code completely. This patch changes them so that the SEA code are still compiled and internals can still check whether the executable is an SEA. The executable would not try to load the SEA blob at all if SEA is disabled. If future modifications to the C++ code attempt to load the SEA blob when SEA is disabled, UNREACHABLE() would be raised. If user attempt to generate the SEA blob with --experimental-sea-config with an executable that disables SEA, they would get an error. PR-URL: #51808 Fixes: #51730 Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent fcc6d54 commit 5034363

3 files changed

Lines changed: 9 additions & 10 deletions

File tree

src/node.cc

Lines changed: 5 additions & 2 deletions

src/node_sea.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
#include <tuple>
2828
#include <vector>
2929

30-
#if !defined(DISABLE_SINGLE_EXECUTABLE_APPLICATION)
31-
3230
using node::ExitCode;
3331
using v8::ArrayBuffer;
3432
using v8::BackingStore;
@@ -189,6 +187,7 @@ SeaResource SeaDeserializer::Read() {
189187
}
190188

191189
std::string_view FindSingleExecutableBlob() {
190+
#if !defined(DISABLE_SINGLE_EXECUTABLE_APPLICATION)
192191
CHECK(IsSingleExecutable());
193192
static const std::string_view result = []() -> std::string_view {
194193
size_t size;
@@ -209,6 +208,9 @@ std::string_view FindSingleExecutableBlob() {
209208
result.data(),
210209
result.size());
211210
return result;
211+
#else
212+
UNREACHABLE();
213+
#endif // !defined(DISABLE_SINGLE_EXECUTABLE_APPLICATION)
212214
}
213215

214216
} // anonymous namespace
@@ -668,5 +670,3 @@ void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
668670

669671
NODE_BINDING_CONTEXT_AWARE_INTERNAL(sea, node::sea::Initialize)
670672
NODE_BINDING_EXTERNAL_REFERENCE(sea, node::sea::RegisterExternalReferences)
671-
672-
#endif // !defined(DISABLE_SINGLE_EXECUTABLE_APPLICATION)

src/node_sea.h

Lines changed: 0 additions & 4 deletions

0 commit comments

Comments
 (0)