From ab190cdfdf3f9796a27232b4e206c106462cbf3b Mon Sep 17 00:00:00 2001 From: Sean Huang Date: Wed, 28 Oct 2026 20:49:37 +0000 Subject: [PATCH] Build V8 from source by default in Bazel (#57832) ## Why Source-built V8 archives and generated Rust bindings must agree on their ABI, including in debug builds. Linux platform selection must also distinguish GNU and musl when using LLVM platforms. ## What changed - Always select source-built V8 archives and matching bindings for Bazel consumers, removing the `rusty_v8_from_source` flag. - Use LLVM's libc-aware Linux selectors for archives, bindings, headers, and bindgen targets. - Keep `V8_ENABLE_CHECKS` undefined in debug builds to match Rust's `HandleScope` layout, and set `V8_LOGGING_LEVEL=2` for debug verification. - Include compiler-rt builtins in the ARM64 GNU/Linux archive to provide `__clear_cache`. - Set the Intel macOS minimum version for `codex-code-mode-host` releases to 10.13 for V8's aligned allocation support. ## Testing Always include the existing ignored CppGC ABI checks in Bazel `v8-poc` unit tests and remove their exclusion from Bazel CI. GitOrigin-RevId: f698a47502154cdfb80febed02e4465d9f2d1e0c --- .github/workflows/bazel.yml | 1 - BUILD.bazel | 8 -- bazel/rules/runtime_package.bzl | 4 +- codex-rs/code-mode-host/BUILD.bazel | 2 + codex-rs/v8-poc/BUILD.bazel | 7 +- third_party/v8/BUILD.bazel | 118 +++++++++++----------------- third_party/v8/README.md | 59 ++++++-------- third_party/v8/engine.BUILD.bazel | 7 +- 8 files changed, 80 insertions(+), 126 deletions(-) diff --git a/.github/workflows/bazel.yml b/.github/workflows/bazel.yml index f90a7453b1..9bf3ebf548 100644 --- a/.github/workflows/bazel.yml +++ b/.github/workflows/bazel.yml @@ -96,7 +96,6 @@ jobs: # path. V8 consumers under `//codex-rs/...` still participate # transitively through `//...`. -//third_party/v8:all - -//codex-rs/v8-poc:v8-poc-unit-tests ) bazel_wrapper_args=( diff --git a/BUILD.bazel b/BUILD.bazel index 9a6e5fb5c0..10d64abbaa 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,12 +1,4 @@ load("@apple_support//xcode:xcode_config.bzl", "xcode_config") -load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") - -# Set for builds that need custom V8 C++ flags or source instrumentation. -bool_flag( - name = "rusty_v8_from_source", - build_setting_default = False, - visibility = ["//visibility:public"], -) xcode_config(name = "disable_xcode") diff --git a/bazel/rules/runtime_package.bzl b/bazel/rules/runtime_package.bzl index ba4cdad58f..b0d9919c19 100644 --- a/bazel/rules/runtime_package.bzl +++ b/bazel/rules/runtime_package.bzl @@ -152,7 +152,7 @@ def runtime_archive(name, srcs, **kwargs): **kwargs ) -def release_binary(binary, name = "release", **kwargs): +def release_binary(binary, name = "release", macos_x86_64_minimum_os = "10.12", **kwargs): """Expose release_files and release.tar.gz; override name for sibling binaries.""" kwargs.setdefault("tags", ["manual"]) kwargs.setdefault("visibility", ["//visibility:public"]) @@ -166,7 +166,7 @@ def release_binary(binary, name = "release", **kwargs): }), macos_minimum_os = select({ "@platforms//cpu:aarch64": "11.0", - "//conditions:default": "10.12", + "//conditions:default": macos_x86_64_minimum_os, }), symbol_group = select({ "@platforms//os:macos": "dsym_folder", diff --git a/codex-rs/code-mode-host/BUILD.bazel b/codex-rs/code-mode-host/BUILD.bazel index 73cd63d40e..69be2b6316 100644 --- a/codex-rs/code-mode-host/BUILD.bazel +++ b/codex-rs/code-mode-host/BUILD.bazel @@ -8,4 +8,6 @@ codex_rust_crate( release_binary( binary = ":codex-code-mode-host", + # V8 and its libc++ use aligned new and delete, available on macOS 10.13. + macos_x86_64_minimum_os = "10.13", ) diff --git a/codex-rs/v8-poc/BUILD.bazel b/codex-rs/v8-poc/BUILD.bazel index cb17229600..29cd311e79 100644 --- a/codex-rs/v8-poc/BUILD.bazel +++ b/codex-rs/v8-poc/BUILD.bazel @@ -5,11 +5,8 @@ codex_rust_crate( crate_features = ["sandbox"], crate_name = "codex_v8_poc", deps_extra = ["@crates//:v8"], - # The ignored CppGC ABI checks require the native archive/binding pair. - unit_test_args = select({ - "//third_party/v8:use_rusty_v8_prebuilts": [], - "//conditions:default": ["--include-ignored"], - }), + # Bazel always builds the native pair required by the CppGC ABI checks. + unit_test_args = ["--include-ignored"], ) alias( diff --git a/third_party/v8/BUILD.bazel b/third_party/v8/BUILD.bazel index f6356c8499..908e9a3edf 100644 --- a/third_party/v8/BUILD.bazel +++ b/third_party/v8/BUILD.bazel @@ -35,24 +35,6 @@ config_setting( ], ) -config_setting( - name = "platform_aarch64_unknown_linux_musl", - constraint_values = [ - "@platforms//cpu:aarch64", - "@platforms//os:linux", - "@llvm//constraints/libc:musl", - ], -) - -config_setting( - name = "platform_x86_64_unknown_linux_musl", - constraint_values = [ - "@platforms//cpu:x86_64", - "@platforms//os:linux", - "@llvm//constraints/libc:musl", - ], -) - config_setting( name = "use_rusty_v8_custom_libcxx", flag_values = { @@ -94,35 +76,24 @@ alias( actual = ":v8_152_2_0_x86_64_pc_windows_gnullvm_bazel", ) -# Both ordinary consumers and source consumers use the current sandbox ABI. -# Switch the archive and binding together for source instrumentation. The same -# root setting is visible in the @v8_targets copy used by rules_rs. -config_setting( - name = "use_rusty_v8_prebuilts", - flag_values = { - "@//:rusty_v8_from_source": "False", - }, -) - alias( name = "rusty_v8_archive_for_target", - actual = select({ - ":use_rusty_v8_prebuilts": ":rusty_v8_prebuilt_archive_for_target", - "//conditions:default": ":rusty_v8_source_archive_for_target", - }), + actual = ":rusty_v8_source_archive_for_target", ) +# Use LLVM's libc-aware Linux selectors for archives and bindings: LLVM musl +# platforms omit rules_rs' separate libc constraint, which defaults to glibc. alias( name = "rusty_v8_prebuilt_archive_for_target", actual = select({ "@rules_rs//rs/platforms/config:aarch64-pc-windows-msvc": ":v8_152_2_0_aarch64_pc_windows_msvc", "@rules_rs//rs/platforms/config:x86_64-pc-windows-msvc": ":v8_152_2_0_x86_64_pc_windows_msvc", "@rules_rs//rs/platforms/config:aarch64-apple-darwin": "@rusty_v8_152_2_0_aarch64_apple_darwin_archive//file", - "@rules_rs//rs/platforms/config:aarch64-unknown-linux-gnu": ":v8_152_2_0_aarch64_unknown_linux_gnu_prebuilt", + "@llvm//platforms/config:linux_aarch64_gnu": ":v8_152_2_0_aarch64_unknown_linux_gnu_prebuilt", "@rules_rs//rs/platforms/config:x86_64-apple-darwin": "@rusty_v8_152_2_0_x86_64_apple_darwin_archive//file", - "@rules_rs//rs/platforms/config:x86_64-unknown-linux-gnu": ":v8_152_2_0_x86_64_unknown_linux_gnu_prebuilt", - ":platform_aarch64_unknown_linux_musl": ":v8_152_2_0_aarch64_unknown_linux_musl_prebuilt", - ":platform_x86_64_unknown_linux_musl": ":v8_152_2_0_x86_64_unknown_linux_musl_prebuilt", + "@llvm//platforms/config:linux_x86_64_gnu": ":v8_152_2_0_x86_64_unknown_linux_gnu_prebuilt", + "@llvm//platforms/config:linux_aarch64_musl": ":v8_152_2_0_aarch64_unknown_linux_musl_prebuilt", + "@llvm//platforms/config:linux_x86_64_musl": ":v8_152_2_0_x86_64_unknown_linux_musl_prebuilt", "//conditions:default": ":rusty_v8_source_archive_for_target", }), ) @@ -164,25 +135,22 @@ alias( "@rules_rs//rs/platforms/config:aarch64-apple-darwin": ":v8_152_2_0_aarch64_apple_darwin_bazel", "@rules_rs//rs/platforms/config:aarch64-pc-windows-gnullvm": ":v8_152_2_0_aarch64_pc_windows_gnullvm", "@rules_rs//rs/platforms/config:aarch64-pc-windows-msvc": ":v8_152_2_0_aarch64_pc_windows_msvc_bazel", - "@rules_rs//rs/platforms/config:aarch64-unknown-linux-gnu": ":v8_152_2_0_aarch64_unknown_linux_gnu_bazel", + "@llvm//platforms/config:linux_aarch64_gnu": ":v8_152_2_0_aarch64_unknown_linux_gnu_bazel", # Rust's compiler-builtins archive does not supply V8's __clear_cache. # Use the merged archive containing the ARM64 compiler-rt builtins. - ":platform_aarch64_unknown_linux_musl": ":v8_152_2_0_aarch64_unknown_linux_musl_release", + "@llvm//platforms/config:linux_aarch64_musl": ":v8_152_2_0_aarch64_unknown_linux_musl_release", "@rules_rs//rs/platforms/config:x86_64-apple-darwin": ":v8_152_2_0_x86_64_apple_darwin_bazel", "@rules_rs//rs/platforms/config:x86_64-pc-windows-gnullvm": ":v8_152_2_0_x86_64_pc_windows_gnullvm", "@rules_rs//rs/platforms/config:x86_64-pc-windows-msvc": ":v8_152_2_0_x86_64_pc_windows_msvc_bazel", - "@rules_rs//rs/platforms/config:x86_64-unknown-linux-gnu": ":v8_152_2_0_x86_64_unknown_linux_gnu_bazel", - ":platform_x86_64_unknown_linux_musl": ":v8_152_2_0_x86_64_unknown_linux_musl_release", + "@llvm//platforms/config:linux_x86_64_gnu": ":v8_152_2_0_x86_64_unknown_linux_gnu_bazel", + "@llvm//platforms/config:linux_x86_64_musl": ":v8_152_2_0_x86_64_unknown_linux_musl_release", "//conditions:default": ":v8_152_2_0_x86_64_unknown_linux_gnu_bazel", }), ) alias( name = "rusty_v8_binding_for_target", - actual = select({ - ":use_rusty_v8_prebuilts": ":rusty_v8_prebuilt_binding_for_target", - "//conditions:default": ":rusty_v8_source_binding_for_target", - }), + actual = ":rusty_v8_source_binding_for_target", ) alias( @@ -191,11 +159,11 @@ alias( "@rules_rs//rs/platforms/config:aarch64-pc-windows-msvc": "@rusty_v8_152_2_0_aarch64_pc_windows_msvc_binding//file", "@rules_rs//rs/platforms/config:x86_64-pc-windows-msvc": "@rusty_v8_152_2_0_x86_64_pc_windows_msvc_binding//file", "@rules_rs//rs/platforms/config:aarch64-apple-darwin": "@rusty_v8_152_2_0_aarch64_apple_darwin_binding//file", - "@rules_rs//rs/platforms/config:aarch64-unknown-linux-gnu": "@rusty_v8_152_2_0_aarch64_unknown_linux_gnu_binding//file", + "@llvm//platforms/config:linux_aarch64_gnu": "@rusty_v8_152_2_0_aarch64_unknown_linux_gnu_binding//file", "@rules_rs//rs/platforms/config:x86_64-apple-darwin": "@rusty_v8_152_2_0_x86_64_apple_darwin_binding//file", - "@rules_rs//rs/platforms/config:x86_64-unknown-linux-gnu": "@rusty_v8_152_2_0_x86_64_unknown_linux_gnu_binding//file", - ":platform_aarch64_unknown_linux_musl": "@rusty_v8_152_2_0_aarch64_unknown_linux_musl_binding//file", - ":platform_x86_64_unknown_linux_musl": "@rusty_v8_152_2_0_x86_64_unknown_linux_musl_binding//file", + "@llvm//platforms/config:linux_x86_64_gnu": "@rusty_v8_152_2_0_x86_64_unknown_linux_gnu_binding//file", + "@llvm//platforms/config:linux_aarch64_musl": "@rusty_v8_152_2_0_aarch64_unknown_linux_musl_binding//file", + "@llvm//platforms/config:linux_x86_64_musl": "@rusty_v8_152_2_0_x86_64_unknown_linux_musl_binding//file", "//conditions:default": ":rusty_v8_source_binding_for_target", }), ) @@ -206,13 +174,13 @@ alias( "@rules_rs//rs/platforms/config:aarch64-apple-darwin": ":src_binding_aarch64_apple_darwin_152_2_0_bazel", "@rules_rs//rs/platforms/config:aarch64-pc-windows-gnullvm": ":src_binding_aarch64_pc_windows_gnullvm_152_2_0_bazel", "@rules_rs//rs/platforms/config:aarch64-pc-windows-msvc": ":src_binding_aarch64_pc_windows_msvc_152_2_0_bazel", - "@rules_rs//rs/platforms/config:aarch64-unknown-linux-gnu": ":src_binding_aarch64_unknown_linux_gnu_152_2_0_bazel", - ":platform_aarch64_unknown_linux_musl": ":src_binding_aarch64_unknown_linux_musl_152_2_0_bazel", + "@llvm//platforms/config:linux_aarch64_gnu": ":src_binding_aarch64_unknown_linux_gnu_152_2_0_bazel", + "@llvm//platforms/config:linux_aarch64_musl": ":src_binding_aarch64_unknown_linux_musl_152_2_0_bazel", "@rules_rs//rs/platforms/config:x86_64-apple-darwin": ":src_binding_x86_64_apple_darwin_152_2_0_bazel", "@rules_rs//rs/platforms/config:x86_64-pc-windows-gnullvm": ":src_binding_x86_64_pc_windows_gnullvm_152_2_0_bazel", "@rules_rs//rs/platforms/config:x86_64-pc-windows-msvc": ":src_binding_x86_64_pc_windows_msvc_152_2_0_bazel", - "@rules_rs//rs/platforms/config:x86_64-unknown-linux-gnu": ":src_binding_x86_64_unknown_linux_gnu_152_2_0_bazel", - ":platform_x86_64_unknown_linux_musl": ":src_binding_x86_64_unknown_linux_musl_152_2_0_bazel", + "@llvm//platforms/config:linux_x86_64_gnu": ":src_binding_x86_64_unknown_linux_gnu_152_2_0_bazel", + "@llvm//platforms/config:linux_x86_64_musl": ":src_binding_x86_64_unknown_linux_musl_152_2_0_bazel", "//conditions:default": ":src_binding_x86_64_unknown_linux_gnu_152_2_0_bazel", }), ) @@ -254,8 +222,8 @@ alias( cc_library( name = "rusty_v8_custom_libcxx_headers", defines = select({ - ":platform_aarch64_unknown_linux_musl": ["ANDROID_HOST_MUSL"], - ":platform_x86_64_unknown_linux_musl": ["ANDROID_HOST_MUSL"], + "@llvm//platforms/config:linux_aarch64_musl": ["ANDROID_HOST_MUSL"], + "@llvm//platforms/config:linux_x86_64_musl": ["ANDROID_HOST_MUSL"], "//conditions:default": [], }), visibility = ["//visibility:public"], @@ -464,13 +432,13 @@ rust_bindgen( "@rules_rs//rs/platforms/config:aarch64-apple-darwin": ["--target=arm64-apple-darwin"], "@rules_rs//rs/platforms/config:aarch64-pc-windows-gnullvm": ["--target=aarch64-w64-windows-gnu"], "@rules_rs//rs/platforms/config:aarch64-pc-windows-msvc": ["--target=aarch64-pc-windows-msvc"], - "@llvm//platforms/config:linux_aarch64": ["--target=aarch64-unknown-linux-gnu"], - ":platform_aarch64_unknown_linux_musl": ["--target=aarch64-unknown-linux-musl"], + "@llvm//platforms/config:linux_aarch64_gnu": ["--target=aarch64-unknown-linux-gnu"], + "@llvm//platforms/config:linux_aarch64_musl": ["--target=aarch64-unknown-linux-musl"], "@rules_rs//rs/platforms/config:x86_64-apple-darwin": ["--target=x86_64-apple-darwin"], "@rules_rs//rs/platforms/config:x86_64-pc-windows-gnullvm": ["--target=x86_64-w64-windows-gnu"], "@rules_rs//rs/platforms/config:x86_64-pc-windows-msvc": ["--target=x86_64-pc-windows-msvc"], - "@llvm//platforms/config:linux_x86_64": ["--target=x86_64-unknown-linux-gnu"], - ":platform_x86_64_unknown_linux_musl": ["--target=x86_64-unknown-linux-musl"], + "@llvm//platforms/config:linux_x86_64_gnu": ["--target=x86_64-unknown-linux-gnu"], + "@llvm//platforms/config:linux_x86_64_musl": ["--target=x86_64-unknown-linux-musl"], }), header = "@v8_crate_152_2_0//:binding_hpp", tags = ["manual"], @@ -596,7 +564,7 @@ cc_static_library( ) cc_static_library( - name = "_v8_152_2_0_aarch64_unknown_linux_gnu_bazel", + name = "_v8_152_2_0_aarch64_unknown_linux_gnu_bazel_base", features = V8_STATIC_LIBRARY_FEATURES, visibility = ["//visibility:private"], deps = [ @@ -622,6 +590,21 @@ cc_static_library( ], ) +# Rust's compiler-builtins omit __clear_cache on ARM64 Linux, while V8 calls +# it to flush generated code. Carry compiler-rt in both native archive inputs. +# llvm-ar's L modifier merges archive members; s writes the symbol index. +genrule( + name = "_v8_152_2_0_aarch64_unknown_linux_gnu_bazel", + srcs = [ + ":_v8_152_2_0_aarch64_unknown_linux_gnu_bazel_base", + "@llvm//runtimes/compiler-rt:clang_rt.builtins.static", + ], + outs = ["libv8_152_2_0_aarch64_unknown_linux_gnu.a"], + cmd = '$(location @llvm//tools:llvm-ar) qcsL "$@" $(SRCS)', + tools = ["@llvm//tools:llvm-ar"], + visibility = ["//visibility:private"], +) + genrule( name = "_v8_152_2_0_aarch64_unknown_linux_musl_release", srcs = [ @@ -629,21 +612,8 @@ genrule( "@llvm//runtimes/compiler-rt:clang_rt.builtins.static", ], outs = ["libv8_152_2_0_aarch64_unknown_linux_musl.a"], - cmd = """ - cat > "$(@D)/merge.mri" <<'EOF' -create $@ -addlib $(location :_v8_152_2_0_aarch64_unknown_linux_musl_release_base) -addlib $(location @llvm//runtimes/compiler-rt:clang_rt.builtins.static) -save -end -EOF - $(location @llvm//tools:llvm-ar) -M < "$(@D)/merge.mri" - $(location @llvm//tools:llvm-ranlib) "$@" - """, - tools = [ - "@llvm//tools:llvm-ar", - "@llvm//tools:llvm-ranlib", - ], + cmd = '$(location @llvm//tools:llvm-ar) qcsL "$@" $(SRCS)', + tools = ["@llvm//tools:llvm-ar"], visibility = ["//visibility:private"], ) diff --git a/third_party/v8/README.md b/third_party/v8/README.md index 8bb43de724..9b74a8d8a0 100644 --- a/third_party/v8/README.md +++ b/third_party/v8/README.md @@ -1,26 +1,20 @@ # `rusty_v8` Consumer Artifacts -This directory wires the `v8` crate to exact-version Bazel inputs. -Bazel consumer builds use: +This directory wires the `v8` crate to exact-version Bazel inputs. Bazel +consumers build V8 archives from source and generate matching Rust bindings on +Darwin, GNU/musl Linux, and Windows MSVC/GNU. `MODULE.bazel` wires +`RUSTY_V8_ARCHIVE` and `RUSTY_V8_SRC_BINDING_PATH` to the `@v8_targets` copy of +these consumer-facing selectors: -- Codex-published sandbox archive/binding pairs on Darwin, GNU/musl Linux, - and Windows MSVC (x64 and arm64), with checksums pinned from the trusted - release manifests -- source-built V8 archives and matching generated bindings on Windows GNU +- `//third_party/v8:rusty_v8_archive_for_target` +- `//third_party/v8:rusty_v8_binding_for_target` + +The Bazel `v8` crate and its native source targets enable V8's in-process +sandbox and pointer compression. Local Cargo builds still use upstream prebuilt `rusty_v8` archives by default. Selected Cargo CI, release, and package builds override -`RUSTY_V8_ARCHIVE`/`RUSTY_V8_SRC_BINDING_PATH` with Codex release assets. Bazel -sets those variables independently in `MODULE.bazel`, selecting the pair above -for its consumers. All Bazel compilation modes use the same published V8 -release archive on supported platforms. - -The Bazel `v8` crate and its native source targets enable V8's in-process -sandbox and pointer compression. For instrumentation, use -`--//:rusty_v8_from_source=true`: on Darwin, Linux and native Windows MSVC -the archive and bindings both come from source instead of the pinned published -sandbox pair. The published archive cannot incorporate native debug or sanitizer -settings. +`RUSTY_V8_ARCHIVE`/`RUSTY_V8_SRC_BINDING_PATH` with Codex release assets. Source targets enforce the workspace runtime and sandbox/pointer-compression ABI. Release-pair targets enforce either the legacy or sandbox ABI plus @@ -30,7 +24,7 @@ settings are internal; callers do not pass separate V8 feature or libc++ flags. Current pinned versions: - Rust crate: `v8 = =152.2.0` -- Embedded upstream V8 source for Bazel-produced release builds: `15.2.124.1` +- Embedded upstream V8 source for Bazel builds: `15.2.124.1` ## Updating to a new `v8` release @@ -68,11 +62,6 @@ and binding checksums into `rusty_v8_.sha256`, then run these commands. They validate every matching `http_file` entry, and CI blocks checksum drift. -The consumer-facing selectors are: - -- `//third_party/v8:rusty_v8_archive_for_target` -- `//third_party/v8:rusty_v8_binding_for_target` - Published release assets are expected at the tag: - `rusty-v8-v` @@ -120,9 +109,9 @@ select those headers and fold the matching runtime objects into the final static archive so consumers can link it with the `v8` crate's default `use_custom_libcxx` feature. The profile keeps the object files and the bundled runtime on Chromium's `std::__Cr` ABI namespace instead of mixing those objects -with the toolchain libc++ default namespace. Bazel consumers use these -published archives for supported Darwin/Linux platforms, as do Cargo release and -package builds. On Linux, Bazel decompresses to a private output and weakens +with the toolchain libc++ default namespace. Selected Cargo release and package +builds use these published archives. The explicit Bazel prebuilt archive targets +remain available; on Linux, they decompress to a private output and weaken the ten shared `std::logic_error` and `std::runtime_error` constructors and assignment entry points listed in `gnu_libcxx_shared_exception_symbols.txt`. libc++ keeps these exception functions in `std::` across inline ABI namespaces; @@ -130,8 +119,9 @@ the toolchain's definitions then take precedence if both runtimes are linked. Constructors accepting Chromium's `std::__Cr::string` remain strong in the V8 archive. The verified input and the producer's archive are never mutated. This depends on libc++'s shared exception-object ABI; updates to either libc++ -revision must keep the native GNU link/runtime checks passing. The Bazel pair targets above still point directly to source -targets so a new release or canary never depends on an older published copy. +revision must keep the native GNU link/runtime checks passing. The Bazel pair +targets above point directly to source targets so a new release or canary never +depends on an older published copy. Native Windows x64 and ARM64 hosts can build sandbox archives and matching Rust bindings with pinned clang-cl and the installed Microsoft SDK using @@ -141,9 +131,8 @@ The producer selectors `//third_party/v8:rusty_v8_native_windows_archive_for_tar and `//third_party/v8:rusty_v8_native_windows_binding_for_target` select source outputs directly. Both use the same sandbox, pointer compression, target CPU, and Chromium libc++ profile. The bindings use V8's compiled headers and defines -so their sizes follow the archive, including CppGC members. Default MSVC -consumers keep the published pair; `--//:rusty_v8_from_source=true` selects -the newly built archive and bindings together. +so their sizes follow the archive, including CppGC members. Bazel MSVC consumers +use the newly built archive and bindings together. The owned engine policy preserves the GN MSVC defaults for GC-managed microtask queues, random Wasm module generation, disabled imminent-deprecation warnings, @@ -167,10 +156,10 @@ bazel build --config=ci-windows-msvc ` Bazel fetches and verifies LLVM 22.1.8 for the host, the same major and patch version as the libclang that generates bindings. The V8 artifact profile selects clang-cl, lld-link, llvm-lib and compiler-rt only for its Windows MSVC source -archive and bindings, together with the installed SDK. Other C++ dependencies -in the same `ci-windows-msvc` build keep the installed MSVC compiler. Selecting -the explicit source target is the opt-in; no whole-build V8 compiler flag is -needed. +archive and bindings, together with the installed SDK. Bazel consumers now +cross this same boundary automatically. Other C++ +dependencies in the same `ci-windows-msvc` build keep the installed MSVC +compiler; no whole-build V8 compiler flag is needed. This is a native Windows build, not an x64-to-ARM64 or remote Linux build: V8's snapshot generator must execute on the target architecture. The repository diff --git a/third_party/v8/engine.BUILD.bazel b/third_party/v8/engine.BUILD.bazel index 36e276b7a9..ac15cf3ad2 100644 --- a/third_party/v8/engine.BUILD.bazel +++ b/third_party/v8/engine.BUILD.bazel @@ -140,9 +140,14 @@ v8_config( "V8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64", ], }) + select({ + # Rusty V8's v8_enable_v8_checks feature is off in Codex. Keep the + # matching C++ flag undefined even in debug: it adds a HandleScope + # field that Rust would not allocate. DEBUG itself preserves that ABI. + # V8's BUILD.gn also selects logging level 2 for debug verification. + # Debug-only FATAL_WITH_LOC sites require that level to use the location. "@v8//bazel/config:is_debug": [ "DEBUG", - "V8_ENABLE_CHECKS", + "V8_LOGGING_LEVEL=2", ], "//conditions:default": [], }) + select({