Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hang in debug builds / don't strip debug builds #63

Merged
merged 2 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libexec/extract-node
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ cd "${src}/node-v${version}"
patch -p1 < "${top}"/patch/v8-std-is-trivially-destructible.patch
patch -p1 < "${top}"/patch/v8-disable-madv-dontfork.patch
patch -p1 < "${top}"/patch/v8-disable-pkey.patch
patch -p1 < "${top}"/patch/v8-debug-flags-hang.patch
4 changes: 3 additions & 1 deletion libexec/inject-libv8
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ for lib in libv8_monolith.a; do
"$AR" "$AREXTRACTFLAGS" "$BASEDIR/out/${BUILDTYPE}/$lib"

# strip all objects
"$FIND" -type f -exec "$STRIP" -Sx {} +
if [ "$BUILDTYPE" = "Release" ]; then
"$FIND" -type f -exec "$STRIP" -Sx {} +
fi

# rebuild the archive
"$FIND" -type f -exec "$AR" "$ARCOLLECTFLAGS" "../$lib" {} +
Expand Down
26 changes: 26 additions & 0 deletions patch/v8-debug-flags-hang.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/deps/v8/src/flags/flags-impl.h b/deps/v8/src/flags/flags-impl.h
index d2d440c026..111b9b5b9c 100644
--- a/deps/v8/src/flags/flags-impl.h
+++ b/deps/v8/src/flags/flags-impl.h
@@ -5,6 +5,8 @@
#ifndef V8_FLAGS_FLAGS_IMPL_H_
#define V8_FLAGS_FLAGS_IMPL_H_

+#include <unordered_set>
+
#include "src/base/macros.h"
#include "src/base/optional.h"
#include "src/base/vector.h"
@@ -91,9 +93,12 @@ struct Flag {
#ifdef DEBUG
bool ImpliedBy(const void* ptr) const {
const Flag* current = this->implied_by_ptr_;
+ std::unordered_set<const Flag*> visited_flags;
while (current != nullptr) {
+ visited_flags.insert(current);
if (current->PointsTo(ptr)) return true;
current = current->implied_by_ptr_;
+ if (visited_flags.contains(current)) break;
}
return false;
}
Loading