Skip to content

chore: update V8 to 13.8.258.26 #442

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

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 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
17 changes: 12 additions & 5 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,17 @@ build:gcc --action_env=CXX=g++

# Use Zig C/C++ compiler.
build:zig-cc --incompatible_enable_cc_toolchain_resolution
build:zig-cc --extra_toolchains @zig_sdk//:aarch64-linux-gnu.2.28_toolchain
build:zig-cc --extra_toolchains @zig_sdk//:x86_64-linux-gnu.2.28_toolchain
build:zig-cc --action_env BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
build:zig-cc --extra_toolchains @llvm_toolchain//:cc-toolchain-x86_64-linux
build:zig-cc --extra_toolchains @llvm_aarch64//:cc-toolchain-aarch64-linux
build:zig-cc --extra_toolchains @emsdk//emscripten_toolchain:cc-toolchain-wasm
build:zig-cc --host_copt=-fno-sanitize=undefined

# Use Zig C/C++ compiler (cross-compile to Linux/aarch64).
build:zig-cc-linux-aarch64 --config=zig-cc
build:zig-cc-linux-aarch64 --platforms @zig_sdk//:linux_aarch64_platform
build:zig-cc-linux-aarch64 --run_under=qemu-aarch64-static
build:zig-cc-linux-aarch64 --test_env=QEMU_LD_PREFIX=/usr/aarch64-linux-gnu/
#build:zig-cc-linux-aarch64 --platforms @zig_sdk//platform:linux_arm64
build:zig-cc-linux-aarch64 --platforms @toolchains_llvm//platforms:linux-aarch64
build:zig-cc-linux-aarch64 --cxxopt --gcc-install-dir=external/sysroot_linux_arm64/usr/lib/gcc/aarch64-linux-gnu/13/

build --enable_platform_specific_config

Expand All @@ -86,6 +88,11 @@ build:linux --cxxopt=-std=c++20 --host_cxxopt=-std=c++20
build:macos --cxxopt=-std=c++20 --host_cxxopt=-std=c++20
build:windows --cxxopt="/std:c++20" --host_cxxopt="/std:c++20"

# For Zig C/C++ compiler.
build:linux --sandbox_add_mount_pair=/tmp
build:macos --sandbox_add_mount_pair=/var/tmp
build:windows --sandbox_add_mount_pair=C:\Temp

# Enable symlinks and runfiles on Windows (enabled by default on other platforms).
startup --windows_enable_symlinks
build:windows --enable_runfiles
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ jobs:
- name: 'V8 on macOS/x86_64'
engine: 'v8'
repo: 'v8'
os: macos-13
os: macos-15
arch: x86_64
action: test
cache: true
Expand Down
38 changes: 29 additions & 9 deletions bazel/dependencies.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@bazel-zig-cc//toolchain:defs.bzl", zig_register_toolchains = "register_toolchains")
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
load("@envoy_toolshed//sysroot:sysroot.bzl", "setup_sysroots")
load("@proxy_wasm_cpp_host//bazel/cargo/wasmsign/remote:crates.bzl", wasmsign_crate_repositories = "crate_repositories")
load("@proxy_wasm_cpp_host//bazel/cargo/wasmtime/remote:crates.bzl", wasmtime_crate_repositories = "crate_repositories")
load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains")
load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")
load("@rules_rust//rust:repositories.bzl", "rust_repositories", "rust_repository_set")
load("@toolchains_llvm//toolchain:deps.bzl", "bazel_toolchain_dependencies")
load("@toolchains_llvm//toolchain:rules.bzl", "llvm_toolchain")

def proxy_wasm_cpp_host_dependencies():
# Bazel extensions.
Expand Down Expand Up @@ -52,14 +54,32 @@ def proxy_wasm_cpp_host_dependencies():
)
crate_universe_dependencies(bootstrap = True)

zig_register_toolchains(
version = "0.9.1",
url_format = "https://ziglang.org/download/{version}/zig-{host_platform}-{version}.tar.xz",
host_platform_sha256 = {
"linux-aarch64": "5d99a39cded1870a3fa95d4de4ce68ac2610cca440336cfd252ffdddc2b90e66",
"linux-x86_64": "be8da632c1d3273f766b69244d80669fe4f5e27798654681d77c992f17c237d7",
"macos-aarch64": "8c473082b4f0f819f1da05de2dbd0c1e891dff7d85d2c12b6ee876887d438287",
"macos-x86_64": "2d94984972d67292b55c1eb1c00de46580e9916575d083003546e9a01166754c",
setup_sysroots()
bazel_toolchain_dependencies()
llvm_toolchain(
name = "llvm_toolchain",
llvm_version = "18.1.8",
sha256 = {
"linux-x86_64": "54ec30358afcc9fb8aa74307db3046f5187f9fb89fb37064cdde906e062ebf36",
},
strip_prefix = {
"linux-x86_64": "clang+llvm-18.1.8-x86_64-linux-gnu-ubuntu-18.04",
},
urls = {
"linux-x86_64": [
"https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.8/clang+llvm-18.1.8-x86_64-linux-gnu-ubuntu-18.04.tar.xz",
],
},
)

llvm_toolchain(
name = "llvm_aarch64",
llvm_version = "18.1.8",
toolchain_roots = {
"": "@llvm_toolchain_llvm//",
},
sysroot = {
"linux-aarch64": "@sysroot_linux_arm64//:sysroot",
},
)

Expand Down
3 changes: 3 additions & 0 deletions bazel/dependencies_import.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ load("@fuzzing_py_deps//:requirements.bzl", pip_fuzzing_dependencies = "install_
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
load("@rules_fuzzing//fuzzing:repositories.bzl", "rules_fuzzing_dependencies")
load("@v8_python_deps//:requirements.bzl", pip_v8_dependencies = "install_deps")
load("@llvm_toolchain//:toolchains.bzl", "llvm_register_toolchains")

def proxy_wasm_cpp_host_dependencies_import():
llvm_register_toolchains()

rules_foreign_cc_dependencies()
rules_fuzzing_dependencies()

Expand Down
12 changes: 12 additions & 0 deletions bazel/external/dragonbox.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
load("@rules_cc//cc:defs.bzl", "cc_library")

licenses(["notice"]) # Apache 2

package(default_visibility = ["//visibility:public"])

cc_library(
name = "dragonbox",
srcs = [],
hdrs = ["include/dragonbox/dragonbox.h"],
includes = ["include/"],
)
15 changes: 15 additions & 0 deletions bazel/external/fp16.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
load("@rules_cc//cc:defs.bzl", "cc_library")

licenses(["notice"]) # MIT

package(default_visibility = ["//visibility:public"])

cc_library(
name = "FP16",
hdrs = [
"include/fp16.h",
"include/fp16/bitcasts.h",
"include/fp16/fp16.h",
],
includes = ["include/"],
)
11 changes: 11 additions & 0 deletions bazel/external/simdutf.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
load("@rules_cc//cc:defs.bzl", "cc_library")

licenses(["notice"]) # Apache 2

package(default_visibility = ["//visibility:public"])

cc_library(
name = "simdutf",
srcs = ["simdutf.cpp"],
hdrs = ["simdutf.h"],
)
212 changes: 172 additions & 40 deletions bazel/external/v8.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# 1. Disable pointer compression (limits the maximum number of WasmVMs).
# 2. Don't expose Wasm C API (only Wasm C++ API).
# 3. Fix gcc build error by disabling nonnull warning.
# 4. Allow compiling v8 on macOS 10.15 to 13.0. TODO(dio): Will remove this patch when https://bugs.chromium.org/p/v8/issues/detail?id=13428 is fixed.
From bc2a85e39fd55879b9baed51429c08b27d5514c8 Mon Sep 17 00:00:00 2001
From: Matt Leon <[email protected]>
Date: Wed, 16 Jul 2025 16:55:02 -0400
Subject: [PATCH 1/6] Disable pointer compression

Pointer compression limits the maximum number of WasmVMs.

Signed-off-by: Matt Leon <[email protected]>
---
BUILD.bazel | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BUILD.bazel b/BUILD.bazel
index 4e89f90e7e..3fcb38b3f3 100644
index 3f5a87d054e..0a693b7ee10 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -157,7 +157,7 @@ v8_int(
@@ -292,7 +292,7 @@ v8_int(
# If no explicit value for v8_enable_pointer_compression, we set it to 'none'.
v8_string(
name = "v8_enable_pointer_compression",
Expand All @@ -16,45 +23,80 @@ index 4e89f90e7e..3fcb38b3f3 100644
)

# Default setting for v8_enable_pointer_compression.
--
2.50.0.727.gbf7dc18ff4-goog


From 61898e9a63ac89a37261c081b84714cfc400a4b1 Mon Sep 17 00:00:00 2001
From: Matt Leon <[email protected]>
Date: Wed, 16 Jul 2025 16:56:31 -0400
Subject: [PATCH 2/6] Restore _allowlist_function_transition

Reverts v8 commit b26554ec368e9553782012c96aa5e99b163eaff2, which removed use of
_allowlist_function_transition from v8 bazel/defs.bzl, since it is still required
by the version of Bazel we currently use (6.5.0).

Signed-off-by: Matt Leon <[email protected]>
---
bazel/defs.bzl | 3 +++
bazel/v8-non-pointer-compression.bzl | 11 +++++++++++
2 files changed, 14 insertions(+)

diff --git a/bazel/defs.bzl b/bazel/defs.bzl
index e957c0fad3..063627b72b 100644
index 0539ea176ac..14d7ace5e59 100644
--- a/bazel/defs.bzl
+++ b/bazel/defs.bzl
@@ -131,6 +131,10 @@ def _default_args():
"-Wno-redundant-move",
"-Wno-return-type",
"-Wno-stringop-overflow",
+ "-Wno-nonnull",
+ "-Wno-error=pessimizing-move",
+ "-Wno-error=dangling-reference",
+ "-Wno-error=dangling-pointer=",
# Use GNU dialect, because GCC doesn't allow using
# ##__VA_ARGS__ when in standards-conforming mode.
"-std=gnu++17",
@@ -151,6 +152,18 @@ def _default_args():
"-fno-integrated-as",
],
"//conditions:default": [],
+ }) + select({
+ "@v8//bazel/config:is_macos": [
+ # The clang available on macOS catalina has a warning that isn't clean on v8 code.
+ "-Wno-range-loop-analysis",
+
+ # To supress warning on deprecated declaration on v8 code. For example:
+ # external/v8/src/base/platform/platform-darwin.cc:56:22: 'getsectdatafromheader_64'
+ # is deprecated: first deprecated in macOS 13.0.
+ # https://bugs.chromium.org/p/v8/issues/detail?id=13428.
+ "-Wno-deprecated-declarations",
+ ],
+ "//conditions:default": [],
}),
includes = ["include"],
linkopts = select({
@@ -485,6 +485,9 @@ _v8_mksnapshot = rule(
cfg = "exec",
),
"target_os": attr.string(mandatory = True),
+ "_allowlist_function_transition": attr.label(
+ default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
+ ),
"prefix": attr.string(mandatory = True),
"suffix": attr.string(mandatory = True),
},
diff --git a/bazel/v8-non-pointer-compression.bzl b/bazel/v8-non-pointer-compression.bzl
index 8c929454840..57336154cf7 100644
--- a/bazel/v8-non-pointer-compression.bzl
+++ b/bazel/v8-non-pointer-compression.bzl
@@ -47,6 +47,17 @@ v8_binary_non_pointer_compression = rule(
# Note specificaly how it's configured with v8_target_cpu_transition, which
# ensures that setting propagates down the graph.
"binary": attr.label(cfg = v8_disable_pointer_compression),
+ # This is a stock Bazel requirement for any rule that uses Starlark
+ # transitions. It's okay to copy the below verbatim for all such rules.
+ #
+ # The purpose of this requirement is to give the ability to restrict
+ # which packages can invoke these rules, since Starlark transitions
+ # make much larger graphs possible that can have memory and performance
+ # consequences for your build. The whitelist defaults to "everything".
+ # But you can redefine it more strictly if you feel that's prudent.
+ "_allowlist_function_transition": attr.label(
+ default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
+ ),
},
# Making this executable means it works with "$ bazel run".
executable = True,
--
2.50.0.727.gbf7dc18ff4-goog


From 4a6e7158fd4ca48c75c8e33ea15760c9beea1d2f Mon Sep 17 00:00:00 2001
From: Matt Leon <[email protected]>
Date: Wed, 16 Jul 2025 16:56:52 -0400
Subject: [PATCH 3/6] Don't expose Wasm C API (only Wasm C++ API).

Signed-off-by: Matt Leon <[email protected]>
---
src/wasm/c-api.cc | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/src/wasm/c-api.cc b/src/wasm/c-api.cc
index 4473e205c0..65a6ec7e1d 100644
index 05e4029f183..d705be96a16 100644
--- a/src/wasm/c-api.cc
+++ b/src/wasm/c-api.cc
@@ -2247,6 +2247,8 @@ auto Instance::exports() const -> ownvec<Extern> {
@@ -2472,6 +2472,8 @@ WASM_EXPORT auto Instance::exports() const -> ownvec<Extern> {

} // namespace wasm

Expand All @@ -63,9 +105,99 @@ index 4473e205c0..65a6ec7e1d 100644
// BEGIN FILE wasm-c.cc

extern "C" {
@@ -3274,3 +3276,5 @@ wasm_instance_t* wasm_frame_instance(const wasm_frame_t* frame) {
@@ -3518,3 +3520,5 @@ wasm_instance_t* wasm_frame_instance(const wasm_frame_t* frame) {
#undef WASM_DEFINE_SHARABLE_REF

} // extern "C"
+
+#endif
--
2.50.0.727.gbf7dc18ff4-goog


From 7b593eb8086dcfe9012d4fa694d622f21dadb731 Mon Sep 17 00:00:00 2001
From: Matt Leon <[email protected]>
Date: Wed, 16 Jul 2025 16:58:02 -0400
Subject: [PATCH 4/6] Stub out fast_float for bazel-supplied version

Signed-off-by: Matt Leon <[email protected]>
---
BUILD.bazel | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BUILD.bazel b/BUILD.bazel
index 0a693b7ee10..eafd9dad20c 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -4438,7 +4438,7 @@ v8_library(
],
deps = [
":lib_dragonbox",
- "//third_party/fast_float/src:fast_float",
+ "@fast_float//:fast_float",
":lib_fp16",
":simdutf",
":v8_libbase",
--
2.50.0.727.gbf7dc18ff4-goog


From b442d34b12dd513946f509d9db86839ce8aa4d7f Mon Sep 17 00:00:00 2001
From: Matt Leon <[email protected]>
Date: Wed, 16 Jul 2025 20:04:05 -0400
Subject: [PATCH 5/6] Stub out vendored dependencies for bazel-sourced versions

Signed-off-by: Matt Leon <[email protected]>
---
BUILD.bazel | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/BUILD.bazel b/BUILD.bazel
index eafd9dad20c..ce36666e36e 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -4437,10 +4437,10 @@ v8_library(
":noicu/generated_torque_definitions",
],
deps = [
- ":lib_dragonbox",
+ "@dragonbox//:dragonbox",
"@fast_float//:fast_float",
- ":lib_fp16",
- ":simdutf",
+ "@fp16//:FP16",
+ "@simdutf//:simdutf",
":v8_libbase",
"@abseil-cpp//absl/container:btree",
"@abseil-cpp//absl/container:flat_hash_map",
--
2.50.0.727.gbf7dc18ff4-goog


From e0b8f32cc057a3c0875437d5d54d012cabcab458 Mon Sep 17 00:00:00 2001
From: Matt Leon <[email protected]>
Date: Wed, 16 Jul 2025 20:29:10 -0400
Subject: [PATCH 6/6] Add build flags to make V8 compile with GCC

Signed-off-by: Matt Leon <[email protected]>
---
bazel/defs.bzl | 3 +++
1 file changed, 3 insertions(+)

diff --git a/bazel/defs.bzl b/bazel/defs.bzl
index 14d7ace5e59..c7a48d4e805 100644
--- a/bazel/defs.bzl
+++ b/bazel/defs.bzl
@@ -117,6 +117,9 @@ def _default_args():
"-Wno-implicit-int-float-conversion",
"-Wno-deprecated-copy",
"-Wno-non-virtual-dtor",
+ "-Wno-invalid-offsetof",
+ "-Wno-dangling-pointer",
+ "-Wno-dangling-reference",
"-isystem .",
],
"//conditions:default": [],
--
2.50.0.727.gbf7dc18ff4-goog

Loading
Loading