summaryrefslogtreecommitdiff
path: root/deps/v8
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2017-08-17 14:57:35 +0200
committerAnna Henningsen <anna@addaleax.net>2017-09-13 16:16:32 +0200
commitbd6907bad42b7cb45799787dc5aefed3ffd8400e (patch)
tree77a688885196369af78e402ad8a3fa389d2665fd /deps/v8
parente55b7f3e26931a3c62d787182bd48e052a9ddc41 (diff)
downloadandroid-node-v8-bd6907bad42b7cb45799787dc5aefed3ffd8400e.tar.gz
android-node-v8-bd6907bad42b7cb45799787dc5aefed3ffd8400e.tar.bz2
android-node-v8-bd6907bad42b7cb45799787dc5aefed3ffd8400e.zip
deps: cherry-pick e020aae394 from V8 upstream
Original commit message: Work around glibc thread-local storage bug glibc before 2.17 has a bug that makes it impossible to execute binaries that have single-byte thread-local variables: % node --version node: error while loading shared libraries: cannot allocate memory in static TLS block Work around that by making the one instance in the V8 code base an int. See: https://sourceware.org/bugzilla/show_bug.cgi?id=14898 See: https://github.com/nodesource/distributions/issues/513 See: https://github.com/nodejs/build/pull/809 Change-Id: Iefd8009100cd93e26cf8dc5dc03f2d622b423385 Reviewed-on: https://chromium-review.googlesource.com/612351 Commit-Queue: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-by: Eric Holk <eholk@chromium.org> Cr-Commit-Position: refs/heads/master@{#47400} PR-URL: https://github.com/nodejs/node/pull/14913 Ref: https://github.com/nodejs/build/pull/809 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Nikolai Vavilov <vvnicholas@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'deps/v8')
-rw-r--r--deps/v8/src/trap-handler/handler-shared.cc9
-rw-r--r--deps/v8/src/trap-handler/trap-handler.h2
2 files changed, 9 insertions, 2 deletions
diff --git a/deps/v8/src/trap-handler/handler-shared.cc b/deps/v8/src/trap-handler/handler-shared.cc
index 7b399f5eea..d1b549a170 100644
--- a/deps/v8/src/trap-handler/handler-shared.cc
+++ b/deps/v8/src/trap-handler/handler-shared.cc
@@ -23,7 +23,14 @@ namespace v8 {
namespace internal {
namespace trap_handler {
-THREAD_LOCAL bool g_thread_in_wasm_code = false;
+// We declare this as int rather than bool as a workaround for a glibc bug, in
+// which the dynamic loader cannot handle executables whose TLS area is only
+// 1 byte in size; see https://sourceware.org/bugzilla/show_bug.cgi?id=14898.
+THREAD_LOCAL int g_thread_in_wasm_code = false;
+
+static_assert(sizeof(g_thread_in_wasm_code) > 1,
+ "sizeof(thread_local_var) must be > 1, see "
+ "https://sourceware.org/bugzilla/show_bug.cgi?id=14898");
size_t gNumCodeObjects = 0;
CodeProtectionInfoListEntry* gCodeObjects = nullptr;
diff --git a/deps/v8/src/trap-handler/trap-handler.h b/deps/v8/src/trap-handler/trap-handler.h
index 5494c5fdb3..ed9459918b 100644
--- a/deps/v8/src/trap-handler/trap-handler.h
+++ b/deps/v8/src/trap-handler/trap-handler.h
@@ -65,7 +65,7 @@ inline bool UseTrapHandler() {
return FLAG_wasm_trap_handler && V8_TRAP_HANDLER_SUPPORTED;
}
-extern THREAD_LOCAL bool g_thread_in_wasm_code;
+extern THREAD_LOCAL int g_thread_in_wasm_code;
inline bool IsThreadInWasm() { return g_thread_in_wasm_code; }