Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Isolate V8 source dependencies and their C++ runtime settings (#56261)

Sean Huang85de07048c21
diff --git a/MODULE.bazel b/MODULE.bazel
index 92c8e81cd9..b4bcc6f994 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -151,14 +151,6 @@ bazel_dep(name = "rules_cc", version = "0.2.18")
cc_configure = use_extension("@rules_cc//cc:extensions.bzl", "cc_configure_extension")
use_repo(cc_configure, "local_config_cc")
-single_version_override(
- module_name = "rules_cc",
- patch_strip = 1,
- patches = [
- "//patches:rules_cc_rusty_v8_custom_libcxx.patch",
- ],
-)
-
bazel_dep(name = "rules_platform", version = "0.1.0")
bazel_dep(name = "rules_pkg", version = "1.0.1")
bazel_dep(name = "aws-lc", version = "5.1.0.bcr.1")
@@ -816,6 +808,8 @@ inject_repo(crate, "alsa_lib")
]
bazel_dep(name = "v8", version = "15.2.124.1")
+bazel_dep(name = "rules_license", version = "1.0.0")
+
archive_override(
module_name = "v8",
integrity = "sha256-aNN5G427qQbP/5o+NXONgXR8ZvS6mjf6mfAI6jtxyzI=",
@@ -830,6 +824,33 @@ archive_override(
urls = ["https://github.com/v8/v8/archive/refs/tags/15.2.124.1.tar.gz"],
)
+# The dependency repos and their BUILD files belong to Codex. V8 only needs
+# its original apparent repo names to resolve to these same imports.
+v8_dependencies = use_extension("//third_party/v8:dependencies.bzl", "dependencies")
+use_repo(
+ v8_dependencies,
+ "v8_abseil",
+ "v8_dragonbox",
+ "v8_fast_float",
+ "v8_fp16",
+ "v8_highway",
+ "v8_icu",
+ "v8_simdutf",
+)
+
+v8_dependency_bridge = use_extension("@v8//:bazel/codex_deps.bzl", "codex_deps")
+
+inject_repo(
+ v8_dependency_bridge,
+ dragonbox = "v8_dragonbox",
+ fast_float = "v8_fast_float",
+ fp16 = "v8_fp16",
+ highway = "v8_highway",
+ icu = "v8_icu",
+ simdutf = "v8_simdutf",
+ v8_abseil = "v8_abseil",
+)
+
http_archive(
name = "v8_crate_152_2_0",
build_file = "//third_party/v8:v8_crate.BUILD.bazel",
diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock
index 6c74634d02..1efc6c8e4b 100644
--- a/MODULE.bazel.lock
+++ b/MODULE.bazel.lock
@@ -193,7 +193,6 @@
"https://bcr.bazel.build/modules/rules_kotlin/1.9.6/MODULE.bazel": "d269a01a18ee74d0335450b10f62c9ed81f2321d7958a2934e44272fe82dcef3",
"https://bcr.bazel.build/modules/rules_kotlin/1.9.6/source.json": "2faa4794364282db7c06600b7e5e34867a564ae91bda7cae7c29c64e9466b7d5",
"https://bcr.bazel.build/modules/rules_license/0.0.3/MODULE.bazel": "627e9ab0247f7d1e05736b59dbb1b6871373de5ad31c3011880b4133cafd4bd0",
- "https://bcr.bazel.build/modules/rules_license/0.0.4/MODULE.bazel": "6a88dd22800cf1f9f79ba32cacad0d3a423ed28efa2c2ed5582eaa78dd3ac1e5",
"https://bcr.bazel.build/modules/rules_license/0.0.7/MODULE.bazel": "088fbeb0b6a419005b89cf93fe62d9517c0a2b8bb56af3244af65ecfe37e7d5d",
"https://bcr.bazel.build/modules/rules_license/1.0.0/MODULE.bazel": "a7fda60eefdf3d8c827262ba499957e4df06f659330bbe6cdbdb975b768bb65c",
"https://bcr.bazel.build/modules/rules_license/1.0.0/source.json": "a52c89e54cc311196e478f8382df91c15f7a2bfdf4c6cd0e2675cc2ff0b56efb",
diff --git a/patches/BUILD.bazel b/patches/BUILD.bazel
index 17410e8d40..039167a738 100644
--- a/patches/BUILD.bazel
+++ b/patches/BUILD.bazel
@@ -12,7 +12,6 @@ exports_files([
"rules_rust_windows_execroot_separators.patch",
"rules_rust_windows_msvc_direct_link_args.patch",
"rules_rust_windows_process_wrapper_skip_temp_outputs.patch",
- "rules_cc_rusty_v8_custom_libcxx.patch",
"rules_foreign_cc_make_cppflags.patch",
"rules_foreign_cc_make_xcompile.patch",
"rules_foreign_cc_make_msvc_stdint.patch",
diff --git a/patches/rules_cc_rusty_v8_custom_libcxx.patch b/patches/rules_cc_rusty_v8_custom_libcxx.patch
deleted file mode 100644
index 3efda03525..0000000000
--- a/patches/rules_cc_rusty_v8_custom_libcxx.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-diff --git a/cc/cc_library.bzl b/cc/cc_library.bzl
-index c45c5fd954..2e3a01f12a 100644
---- a/cc/cc_library.bzl
-+++ b/cc/cc_library.bzl
-@@ -15,5 +15,39 @@
-
- load("@cc_compatibility_proxy//:proxy.bzl", _cc_library = "cc_library")
-
-+_RUSTY_V8_CUSTOM_LIBCXX_COPTS = select({
-+ "@@//third_party/v8:use_rusty_v8_custom_libcxx": [
-+ "-nostdinc++",
-+ "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
-+ "-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE",
-+ "-D_LIBCPP_INSTRUMENTED_WITH_ASAN=0",
-+ "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
-+ ],
-+ "//conditions:default": [],
-+})
-+
-+_RUSTY_V8_CUSTOM_LIBCXX_DEPS = select({
-+ "@@//third_party/v8:use_rusty_v8_custom_libcxx": [
-+ "@@//third_party/v8:rusty_v8_custom_libcxx_headers",
-+ ],
-+ "//conditions:default": [],
-+})
-+
-+_RUSTY_V8_CUSTOM_LIBCXX_REPOS = [
-+ # V8 and ICU are patched in-tree. These external C++ dependencies still
-+ # build inside the artifact closure once the LLVM toolchain's default
-+ # libc++ headers are suppressed.
-+ "@abseil-cpp+",
-+ "@v8++http_archive+highway",
-+ "@v8++http_archive+simdutf",
-+]
-+
-+def _should_use_rusty_v8_custom_libcxx():
-+ return native.repository_name() in _RUSTY_V8_CUSTOM_LIBCXX_REPOS
-+
- def cc_library(**kwargs):
-+ if _should_use_rusty_v8_custom_libcxx():
-+ kwargs["copts"] = (kwargs.get("copts", []) or []) + _RUSTY_V8_CUSTOM_LIBCXX_COPTS
-+ kwargs["deps"] = (kwargs.get("deps", []) or []) + _RUSTY_V8_CUSTOM_LIBCXX_DEPS
-+ kwargs["features"] = (kwargs.get("features", []) or []) + ["-module_maps"]
- _cc_library(**kwargs)
diff --git a/patches/v8_bazel_rules.patch b/patches/v8_bazel_rules.patch
index c2d557ad3d..bcdb9deab5 100644
--- a/patches/v8_bazel_rules.patch
+++ b/patches/v8_bazel_rules.patch
@@ -332,10 +332,28 @@ diff --git a/orig/v8-15.2.124.1/BUILD.bazel b/mod/v8-15.2.124.1/BUILD.bazel
)
v8_library(
-@@ -4660,16 +4697,9 @@
+@@ -4625,9 +4662,9 @@
+ copts = ["-Wno-implicit-fallthrough"],
+ deps = [
+ ":llvm_libc_headers",
+- "@abseil-cpp//absl/synchronization",
+- "@abseil-cpp//absl/time",
+- "@abseil-cpp//absl/functional:overload",
++ "@v8_abseil//:synchronization",
++ "@v8_abseil//:time",
++ "@v8_abseil//:overload",
],
)
+@@ -4655,21 +4692,14 @@
+ deps = [
+ ":torque_base_headers",
+ ":v8_libbase",
+- "@abseil-cpp//absl/container:node_hash_map",
+- "@abseil-cpp//absl/container:node_hash_set",
+- ],
+-)
+-
-cc_library(
- name = "simdutf",
- srcs = ["third_party/simdutf/simdutf.cpp"],
@@ -346,6 +364,11 @@ diff --git a/orig/v8-15.2.124.1/BUILD.bazel b/mod/v8-15.2.124.1/BUILD.bazel
- "@v8//bazel/config:is_windows": ["/std:c++20"],
- "//conditions:default": [],
- }),
++ "@v8_abseil//:node_hash_map",
++ "@v8_abseil//:node_hash_set",
++ ],
++)
++
+alias(
+ name = "simdutf",
+ actual = "@simdutf//:simdutf",
@@ -361,7 +384,7 @@ diff --git a/orig/v8-15.2.124.1/BUILD.bazel b/mod/v8-15.2.124.1/BUILD.bazel
],
icu_srcs = [
":generated_regexp_special_case",
-@@ -4701,7 +4731,7 @@
+@@ -4701,14 +4731,14 @@
],
deps = [
":lib_dragonbox",
@@ -370,6 +393,17 @@ diff --git a/orig/v8-15.2.124.1/BUILD.bazel b/mod/v8-15.2.124.1/BUILD.bazel
":lib_fp16",
":simdutf",
":v8_libbase",
+- "@abseil-cpp//absl/container:btree",
+- "@abseil-cpp//absl/container:flat_hash_map",
+- "@abseil-cpp//absl/container:flat_hash_set",
+- "@abseil-cpp//absl/functional:overload",
++ "@v8_abseil//:btree",
++ "@v8_abseil//:flat_hash_map",
++ "@v8_abseil//:flat_hash_set",
++ "@v8_abseil//:overload",
+ "@highway//:hwy",
+ ],
+ )
@@ -4757,6 +4787,7 @@
alias(
name = "core_lib_icu",
@@ -387,6 +421,17 @@ diff --git a/orig/v8-15.2.124.1/BUILD.bazel b/mod/v8-15.2.124.1/BUILD.bazel
],
)
+@@ -4830,8 +4861,8 @@
+ }),
+ deps = [
+ "v8_libbase",
+- "@abseil-cpp//absl/container:node_hash_map",
+- "@abseil-cpp//absl/container:node_hash_set",
++ "@v8_abseil//:node_hash_map",
++ "@v8_abseil//:node_hash_set",
+ ],
+ )
+
@@ -4852,9 +4883,20 @@
":icu/generated_torque_initializers",
":icu/v8_initializers_files",
diff --git a/patches/v8_module_deps.patch b/patches/v8_module_deps.patch
index 3bd5008abd..b0ce2f6298 100644
--- a/patches/v8_module_deps.patch
+++ b/patches/v8_module_deps.patch
@@ -1,68 +1,17 @@
-# What: replace upstream V8 module dependency bootstrapping with repository
-# declarations and dependency setup that match this Bazel workspace.
-# Scope: upstream MODULE.bazel only; affects external repo resolution and Bazel
-# module wiring, not V8 source files.
+# What: remove Chromium's checkout-only toolchain bootstrapping and expose one
+# module-extension bridge for dependency imports owned by Codex.
+# Scope: V8 MODULE and the small ingress extension only. Versions, BUILD files,
+# and dependency build policy live in //third_party/v8.
diff --git a/orig/v8-15.2.124.1/MODULE.bazel b/mod/v8-15.2.124.1/MODULE.bazel
--- a/orig/v8-15.2.124.1/MODULE.bazel
+++ b/mod/v8-15.2.124.1/MODULE.bazel
-@@ -8,12 +8,65 @@
+@@ -7,13 +7,13 @@
+ bazel_dep(name = "rules_cc", version = "0.2.17")
bazel_dep(name = "rules_python", version = "1.7.0")
bazel_dep(name = "platforms", version = "1.0.0")
- bazel_dep(name = "abseil-cpp", version = "20250814.1")
+-bazel_dep(name = "abseil-cpp", version = "20250814.1")
-bazel_dep(name = "highway", version = "1.2.0")
-+bazel_dep(name = "rules_license", version = "0.0.4")
-+
-+git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
-+http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
-+
-+http_archive(
-+ name = "highway",
-+ patch_args = ["-p1"],
-+ patches = ["@v8//:bazel/highway.patch"],
-+ sha256 = "741d705781e0b3e406beda8f1f994fbae01321237ce8023a1ad90fbaf7940c25",
-+ strip_prefix = "highway-2607d3b5b0113992fe84d3848859eae13b3b52c1",
-+ urls = ["https://github.com/google/highway/archive/2607d3b5b0113992fe84d3848859eae13b3b52c1.tar.gz"],
-+)
-+
-+git_repository(
-+ name = "icu",
-+ build_file = "@@//third_party/v8:icu.BUILD.bazel",
-+ commit = "d578f2e8b7bd5938e21cfb6bf15c079e0aa5b738",
-+ patch_cmds = ["find source -name BUILD.bazel | xargs rm"],
-+ patch_cmds_win = ["Get-ChildItem -Path source -File -Include BUILD.bazel -Recurse | Remove-Item"],
-+ remote = "https://chromium.googlesource.com/chromium/deps/icu.git",
-+)
-+
-+http_archive(
-+ name = "fast_float",
-+ build_file_content = 'load("@rules_cc//cc:defs.bzl", "cc_library")\n\ncc_library(\n name = "fast_float",\n hdrs = glob(["include/fast_float/*.h"]),\n include_prefix = "third_party/fast_float/src/include",\n strip_include_prefix = "include",\n visibility = ["//visibility:public"],\n)\n',
-+ sha256 = "76f958dd97b1cf4d8862d1f0986a47d4bdfa8845252bae15ef0f40de3b95961f",
-+ strip_prefix = "fast_float-8.2.10",
-+ urls = ["https://github.com/fastfloat/fast_float/archive/refs/tags/v8.2.10.tar.gz"],
-+)
-+
-+http_archive(
-+ name = "simdutf",
-+ build_file_content = 'load("@rules_cc//cc:defs.bzl", "cc_library")\n\ncc_library(\n name = "simdutf",\n srcs = ["src/simdutf.cpp"],\n hdrs = glob(["include/**/*.h"]),\n textual_hdrs = glob(["src/**/*.h", "src/**/*.cpp"], exclude = ["src/simdutf.cpp"]),\n copts = ["-std=c++20"],\n include_prefix = "third_party/simdutf",\n includes = ["include", "src"],\n strip_include_prefix = "include",\n visibility = ["//visibility:public"],\n)\n',
-+ sha256 = "0180de81a1dd48a87b8c0442ffa81734f3db91a7350914107a449935124e3c6f",
-+ strip_prefix = "simdutf-7.7.0",
-+ urls = ["https://github.com/simdutf/simdutf/archive/refs/tags/v7.7.0.tar.gz"],
-+)
-+
-+git_repository(
-+ name = "dragonbox",
-+ build_file_content = 'load("@rules_cc//cc:defs.bzl", "cc_library")\n\ncc_library(\n name = "dragonbox",\n hdrs = ["include/dragonbox/dragonbox.h"],\n include_prefix = "third_party/dragonbox/src/include",\n strip_include_prefix = "include",\n visibility = ["//visibility:public"],\n)\n',
-+ commit = "beeeef91cf6fef89a4d4ba5e95d47ca64ccb3a44",
-+ remote = "https://chromium.googlesource.com/external/github.com/jk-jeon/dragonbox.git",
-+)
-+
-+git_repository(
-+ name = "fp16",
-+ build_file_content = 'load("@rules_cc//cc:defs.bzl", "cc_library")\n\ncc_library(\n name = "fp16",\n hdrs = glob(["include/**/*.h"]),\n include_prefix = "third_party/fp16/src/include",\n includes = ["include"],\n strip_include_prefix = "include",\n visibility = ["//visibility:public"],\n)\n',
-+ commit = "782eea126dc5c755827be751a099eb01826175cf",
-+ remote = "https://chromium.googlesource.com/external/github.com/Maratyszcza/FP16.git",
-+)
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
@@ -73,11 +22,10 @@ diff --git a/orig/v8-15.2.124.1/MODULE.bazel b/mod/v8-15.2.124.1/MODULE.bazel
requirements_lock = "//:bazel/requirements.txt",
extra_pip_args = [
"--require-hashes",
-@@ -21,180 +74,3 @@
- ],
+@@ -22,179 +22,15 @@
)
use_repo(pip, "v8_python_deps")
--
+
-# Define the local LLVM toolchain repository
-llvm_toolchain_repository = use_repo_rule("//bazel/toolchain:llvm_repository.bzl", "llvm_toolchain_repository")
-
@@ -193,7 +141,18 @@ diff --git a/orig/v8-15.2.124.1/MODULE.bazel b/mod/v8-15.2.124.1/MODULE.bazel
- implementation = _impl,
- attrs = {},
- provides = [CcToolchainConfigInfo],
--)
++# Codex supplies the dependency repositories used by its V8 builds.
++codex_deps = use_extension("//:bazel/codex_deps.bzl", "codex_deps")
++use_repo(
++ codex_deps,
++ "v8_abseil",
++ "dragonbox",
++ "fast_float",
++ "fp16",
++ "highway",
++ "icu",
++ "simdutf",
+ )
-""",
- build_file_content = """
-load("@rules_cc//cc:defs.bzl", "cc_toolchain")
@@ -254,24 +213,19 @@ diff --git a/orig/v8-15.2.124.1/MODULE.bazel b/mod/v8-15.2.124.1/MODULE.bazel
- patches = ["//bazel/patches:highway_rules_cc.patch"],
- patch_strip = 1,
-)
-diff --git a/orig/v8-15.2.124.1/bazel/highway.patch b/mod/v8-15.2.124.1/bazel/highway.patch
+
+diff --git a/orig/v8-15.2.124.1/bazel/codex_deps.bzl b/mod/v8-15.2.124.1/bazel/codex_deps.bzl
new file mode 100644
--- /dev/null
-+++ b/mod/v8-15.2.124.1/bazel/highway.patch
-@@ -0,0 +1,16 @@
-+diff --git a/BUILD b/BUILD
-+--- a/BUILD
-++++ b/BUILD
-+@@ -118,11 +118,7 @@
-+ ],
-+ })
++++ b/mod/v8-15.2.124.1/bazel/codex_deps.bzl
+@@ -0,0 +1,10 @@
++"""Dependency ingress for V8 when built by Codex.
++
++The root module injects the repositories; this extension declares no defaults
++that could silently select a different dependency from the one Codex builds.
++"""
+
-+-DEFINES = select({
-+- ":compiler_msvc": ["HWY_SHARED_DEFINE"],
-+- ":compiler_clangcl": ["HWY_SHARED_DEFINE"],
-+- "//conditions:default": [],
-+-})
-++DEFINES = []
++def _codex_deps_impl(module_ctx):
++ return module_ctx.extension_metadata(reproducible = True)
+
-+ # Unused on Bazel builds, where this is not defined/known; Copybara replaces
-+ # usages with an empty list.
++codex_deps = module_extension(implementation = _codex_deps_impl)
diff --git a/third_party/v8/BUILD.bazel b/third_party/v8/BUILD.bazel
index 4c93e5b494..333a608f37 100644
--- a/third_party/v8/BUILD.bazel
+++ b/third_party/v8/BUILD.bazel
@@ -4,7 +4,18 @@ load("@rules_cc//cc:defs.bzl", "cc_library")
package(default_visibility = ["//visibility:public"])
-exports_files(["icu.BUILD.bazel"])
+exports_files([
+ "abseil.BUILD.bazel",
+ "abseil_repository.bzl",
+ "dependencies.bzl",
+ "dependency_config.bzl",
+ "dragonbox.BUILD.bazel",
+ "fast_float.BUILD.bazel",
+ "fp16.BUILD.bazel",
+ "highway.BUILD.bazel",
+ "icu.BUILD.bazel",
+ "simdutf.BUILD.bazel",
+])
config_setting(
name = "platform_aarch64_unknown_linux_musl",
diff --git a/third_party/v8/README.md b/third_party/v8/README.md
index ee77030172..b9659d957e 100644
--- a/third_party/v8/README.md
+++ b/third_party/v8/README.md
@@ -32,8 +32,10 @@ Current pinned versions:
Use this as the maintainer flow for a version bump:
1. Bump the `v8` crate version and refresh `codex-rs/Cargo.lock`.
-2. Update the Bazel versioned inputs in `MODULE.bazel`, then refresh the
- matching checksum manifest and generated checksums as described below.
+2. Update the Bazel versioned inputs in `MODULE.bazel` and the source pins
+ in `third_party/v8/dependencies.bzl` and `abseil_repository.bzl` using
+ [the source dependency update procedure](#updating-source-dependencies).
+ Then refresh the matching checksum manifest and generated checksums below.
3. Publish a release-candidate PR and validate that `v8-canary` passes.
4. If the canary is green, publish the release tag and release build.
5. Independently verify the published Codex-built checksum manifests and record
@@ -135,3 +137,83 @@ under `rusty-v8-v<crate_version>`.
Do not mix artifacts across crate versions. The archive and binding must match
the exact resolved `v8` crate version in `codex-rs/Cargo.lock`.
+
+## Source dependency ownership
+
+The Darwin, Linux GNU/musl and Windows GNU source targets consume Codex-owned
+Abseil, Highway, simdutf, ICU, fast_float, dragonbox and fp16 repositories.
+`dependencies.bzl` declares the pinned imports; the `*.BUILD.bazel` overlays
+here declare the targets V8 uses. Abseil, Highway and simdutf apply their C++ runtime
+settings through `dependency_config.bzl`; ICU defines its settings in its own
+overlay.
+
+V8's module has a small dependency ingress. The root `MODULE.bazel` injects
+the seven Codex repositories there, so V8's `@highway`, `@icu`, etc. resolve to
+the same repositories Codex declares. The bridge has no fallback downloads.
+V8's BUILD patch still wires these targets into its generator and library graph.
+
+V8's private Abseil is built from the pinned 20250814.1 sources and uses
+`codex_v8_lts_20250814` for its supported inline-namespace option. Protobuf
+keeps the regular shared Abseil module and its `lts_20250814` namespace.
+Both can link into one binary without interposing functions built for different
+C++ runtimes. No V8 dependency needs a hook in shared `rules_cc` libraries.
+
+### Updating source dependencies
+
+These are reviewed with each V8 source upgrade. There is no source-pin
+autoupdater: the prebuilt checksum commands above and their CI check validate
+published archive/binding pairs, not these source revisions. Bazel verifies
+the declared download hashes and Git revisions; it does not choose them for us.
+
+Use the V8 tag in the root `MODULE.bazel` `archive_override(module_name = "v8")`
+(currently `15.2.124.1`) as the input. Read that tag's **unpatched** `DEPS`
+and `MODULE.bazel`; the fetched `@v8` MODULE has Codex's bridge applied.
+
+```bash
+v8_tag=15.2.124.1 # Replace with the V8 source tag selected for this upgrade.
+gh api "repos/v8/v8/contents/DEPS?ref=$v8_tag" \
+ -H 'Accept: application/vnd.github.raw+json' |
+ rg -n -A 2 "'third_party/(highway/src|icu|dragonbox/src|fp16/src|fast_float/src|simdutf)'"
+gh api "repos/v8/v8/contents/MODULE.bazel?ref=$v8_tag" \
+ -H 'Accept: application/vnd.github.raw+json' | rg 'bazel_dep\(name = "abseil-cpp"'
+```
+
+- `v8_highway`, `v8_icu`, `v8_dragonbox`, `v8_fp16`: copy the respective
+ DEPS commits. For Highway, use that commit in the archive URL and strip prefix.
+- `v8_fast_float`: use the DEPS commit. If selecting a release-tag archive,
+ verify the tag resolves to that commit, e.g.
+ `gh api repos/fastfloat/fast_float/git/ref/tags/v8.2.10 --jq '.object'`
+ (dereference annotated tags). Current v8.2.10 equals DEPS commit `34164f5`.
+- `v8_simdutf`: DEPS points at a Chromium vendoring repo, not the simdutf
+ source repo. Read the metadata at that DEPS commit:
+
+ ```bash
+ simdutf_chromium=f7356eed293f8208c40b3c1b344a50bd70971983 # from new DEPS
+ curl -fsSL "https://chromium.googlesource.com/chromium/src/third_party/simdutf/+/$simdutf_chromium/README.chromium?format=TEXT" |
+ base64 -d
+ ```
+
+ Match its `Version:` to the upstream release tag and inspect Chromium's
+ local changes before accepting the source form. Chromium vendors amalgamated
+ files; we build upstream `src/simdutf.cpp`. At the current pin it reports
+ 7.7.0, but its `Revision: da645ece` predates the v7.7.0 tag. This is a
+ version match, not an assertion that the repositories' commits or bytes match.
+- `v8_abseil`: follow `abseil-cpp` in V8's unpatched MODULE, not its Chromium
+ DEPS vendor revision. Refresh `abseil_repository.bzl` release archive and
+ its guarded inline namespace together; the V8 namespace must stay private.
+
+For each `http_archive`/`download_and_extract` source, hash the exact new
+URL, not a different archive of the same commit:
+
+```bash
+source_url='https://github.com/google/highway/archive/2607d3b5b0113992fe84d3848859eae13b3b52c1.tar.gz'
+curl -fsSL "$source_url" | shasum -a 256
+# For an integrity= field (Abseil) instead:
+curl -fsSL "$source_url" | openssl dgst -sha256 -binary | openssl base64 -A
+```
+
+Record the hex digest in `sha256`, or prefix the base64 digest with `sha256-`
+for `integrity`. Review each matching BUILD overlay against its stated source,
+then build the V8 generator and source/archive targets on supported platforms.
+The regular V8 canary/release checks validate the resulting engine; they do not
+prove upstream-version equivalence for a substituted source.
diff --git a/third_party/v8/abseil.BUILD.bazel b/third_party/v8/abseil.BUILD.bazel
new file mode 100644
index 0000000000..9c09d9e3e0
--- /dev/null
+++ b/third_party/v8/abseil.BUILD.bazel
@@ -0,0 +1,294 @@
+# Codex-owned build of the eight Abseil entry points V8 15.2.124.1 uses.
+# Sources are from their transitive closure in Abseil 20250814.1's BUILD files.
+# Share headers, but compile runtime objects only when a caller needs them.
+# Keep non-Cord strings below time/synchronization: Cord depends on both.
+load("@@//third_party/v8:dependency_config.bzl", "RUSTY_V8_DEPENDENCY_COPTS", "RUSTY_V8_DEPENDENCY_DEPS")
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"]) # Apache-2.0
+
+exports_files(["LICENSE"])
+
+config_setting(
+ name = "windows",
+ constraint_values = ["@platforms//os:windows"],
+)
+
+# Include the OS constraint so these settings refine :windows in selects.
+config_setting(
+ name = "windows_msvc",
+ constraint_values = ["@platforms//os:windows"],
+ flag_values = {"@bazel_tools//tools/cpp:compiler": "msvc-cl"},
+)
+
+config_setting(
+ name = "windows_clang_cl",
+ constraint_values = ["@platforms//os:windows"],
+ flag_values = {"@bazel_tools//tools/cpp:compiler": "clang-cl"},
+)
+
+config_setting(
+ name = "windows_lexan",
+ constraint_values = ["@platforms//os:windows"],
+ flag_values = {"@bazel_tools//tools/cpp:compiler": "lexan"},
+)
+
+cc_library(
+ name = "headers",
+ hdrs = glob(
+ ["absl/**/*.h"],
+ exclude = [
+ "absl/**/*_test*.h",
+ "absl/**/testdata/**",
+ ],
+ ),
+ # Abseil offers a supported control for this. GNU Windows needs the same
+ # C++11 TLS path as native Windows; avoid patching thread_identity.h.
+ defines = select({
+ ":windows": ["ABSL_FORCE_THREAD_IDENTITY_MODE=ABSL_THREAD_IDENTITY_MODE_USE_CPP11"],
+ "//conditions:default": [],
+ }),
+ features = ["-module_maps"],
+ includes = [
+ ".",
+ "absl/time/internal/cctz/include",
+ ],
+ linkopts = select({
+ ":windows_msvc": [
+ "advapi32.lib",
+ "dbghelp.lib",
+ ],
+ ":windows_clang_cl": [
+ "advapi32.lib",
+ "dbghelp.lib",
+ ],
+ ":windows_lexan": [
+ "advapi32.lib",
+ "dbghelp.lib",
+ ],
+ ":windows": [
+ "-ladvapi32",
+ "-ldbghelp",
+ ],
+ "//conditions:default": ["-pthread"],
+ }),
+ textual_hdrs = glob(["absl/**/*.inc"]),
+ visibility = ["//visibility:private"],
+ deps = RUSTY_V8_DEPENDENCY_DEPS,
+)
+
+cc_library(
+ name = "base",
+ srcs = [
+ "absl/base/internal/cycleclock.cc",
+ "absl/base/internal/low_level_alloc.cc",
+ "absl/base/internal/raw_logging.cc",
+ "absl/base/internal/spinlock.cc",
+ "absl/base/internal/spinlock_wait.cc",
+ "absl/base/internal/sysinfo.cc",
+ "absl/base/internal/thread_identity.cc",
+ "absl/base/internal/throw_delegate.cc",
+ "absl/base/internal/tracing.cc",
+ "absl/base/internal/unscaledcycleclock.cc",
+ "absl/base/log_severity.cc",
+ "absl/numeric/int128.cc",
+ ],
+ copts = RUSTY_V8_DEPENDENCY_COPTS,
+ features = ["-module_maps"],
+ visibility = ["//visibility:private"],
+ deps = [
+ ":headers",
+ ],
+)
+
+cc_library(
+ name = "strings",
+ srcs = [
+ "absl/strings/ascii.cc",
+ "absl/strings/charconv.cc",
+ "absl/strings/escaping.cc",
+ "absl/strings/internal/charconv_bigint.cc",
+ "absl/strings/internal/charconv_parse.cc",
+ "absl/strings/internal/damerau_levenshtein_distance.cc",
+ "absl/strings/internal/escaping.cc",
+ "absl/strings/internal/memutil.cc",
+ "absl/strings/internal/ostringstream.cc",
+ "absl/strings/internal/str_format/arg.cc",
+ "absl/strings/internal/str_format/bind.cc",
+ "absl/strings/internal/str_format/extension.cc",
+ "absl/strings/internal/str_format/float_conversion.cc",
+ "absl/strings/internal/str_format/output.cc",
+ "absl/strings/internal/str_format/parser.cc",
+ "absl/strings/internal/stringify_sink.cc",
+ "absl/strings/internal/utf8.cc",
+ "absl/strings/match.cc",
+ "absl/strings/numbers.cc",
+ "absl/strings/str_cat.cc",
+ "absl/strings/str_replace.cc",
+ "absl/strings/str_split.cc",
+ "absl/strings/string_view.cc",
+ "absl/strings/substitute.cc",
+ ],
+ copts = RUSTY_V8_DEPENDENCY_COPTS,
+ features = ["-module_maps"],
+ visibility = ["//visibility:private"],
+ deps = [
+ ":base",
+ ],
+)
+
+cc_library(
+ name = "time",
+ srcs = [
+ "absl/time/civil_time.cc",
+ "absl/time/clock.cc",
+ "absl/time/duration.cc",
+ "absl/time/format.cc",
+ "absl/time/internal/cctz/src/civil_time_detail.cc",
+ "absl/time/internal/cctz/src/time_zone_fixed.cc",
+ "absl/time/internal/cctz/src/time_zone_format.cc",
+ "absl/time/internal/cctz/src/time_zone_if.cc",
+ "absl/time/internal/cctz/src/time_zone_impl.cc",
+ "absl/time/internal/cctz/src/time_zone_info.cc",
+ "absl/time/internal/cctz/src/time_zone_libc.cc",
+ "absl/time/internal/cctz/src/time_zone_lookup.cc",
+ "absl/time/internal/cctz/src/time_zone_posix.cc",
+ "absl/time/internal/cctz/src/zone_info_source.cc",
+ "absl/time/time.cc",
+ ],
+ copts = RUSTY_V8_DEPENDENCY_COPTS,
+ features = ["-module_maps"],
+ deps = [
+ ":strings",
+ ],
+)
+
+cc_library(
+ name = "synchronization",
+ srcs = [
+ "absl/debugging/internal/address_is_readable.cc",
+ "absl/debugging/internal/decode_rust_punycode.cc",
+ "absl/debugging/internal/demangle.cc",
+ "absl/debugging/internal/demangle_rust.cc",
+ "absl/debugging/internal/elf_mem_image.cc",
+ "absl/debugging/internal/utf8_for_code_point.cc",
+ "absl/debugging/internal/vdso_support.cc",
+ "absl/debugging/stacktrace.cc",
+ "absl/debugging/symbolize.cc",
+ "absl/synchronization/barrier.cc",
+ "absl/synchronization/blocking_counter.cc",
+ "absl/synchronization/internal/create_thread_identity.cc",
+ "absl/synchronization/internal/futex_waiter.cc",
+ "absl/synchronization/internal/graphcycles.cc",
+ "absl/synchronization/internal/kernel_timeout.cc",
+ "absl/synchronization/internal/per_thread_sem.cc",
+ "absl/synchronization/internal/pthread_waiter.cc",
+ "absl/synchronization/internal/sem_waiter.cc",
+ "absl/synchronization/internal/stdcpp_waiter.cc",
+ "absl/synchronization/internal/waiter_base.cc",
+ "absl/synchronization/internal/win32_waiter.cc",
+ "absl/synchronization/mutex.cc",
+ "absl/synchronization/notification.cc",
+ ],
+ copts = RUSTY_V8_DEPENDENCY_COPTS,
+ features = ["-module_maps"],
+ deps = [
+ ":time",
+ ],
+)
+
+cc_library(
+ name = "cord",
+ srcs = [
+ "absl/crc/crc32c.cc",
+ "absl/crc/internal/cpu_detect.cc",
+ "absl/crc/internal/crc.cc",
+ "absl/crc/internal/crc_cord_state.cc",
+ "absl/crc/internal/crc_memcpy_fallback.cc",
+ "absl/crc/internal/crc_memcpy_x86_arm_combined.cc",
+ "absl/crc/internal/crc_non_temporal_memcpy.cc",
+ "absl/crc/internal/crc_x86_arm_combined.cc",
+ "absl/profiling/internal/exponential_biased.cc",
+ "absl/strings/cord.cc",
+ "absl/strings/cord_analysis.cc",
+ "absl/strings/internal/cord_internal.cc",
+ "absl/strings/internal/cord_rep_btree.cc",
+ "absl/strings/internal/cord_rep_btree_navigator.cc",
+ "absl/strings/internal/cord_rep_btree_reader.cc",
+ "absl/strings/internal/cord_rep_consume.cc",
+ "absl/strings/internal/cord_rep_crc.cc",
+ "absl/strings/internal/cordz_functions.cc",
+ "absl/strings/internal/cordz_handle.cc",
+ "absl/strings/internal/cordz_info.cc",
+ ],
+ copts = RUSTY_V8_DEPENDENCY_COPTS,
+ features = ["-module_maps"],
+ visibility = ["//visibility:private"],
+ deps = [
+ ":strings",
+ ":synchronization",
+ ],
+)
+
+cc_library(
+ name = "hash_containers",
+ srcs = [
+ "absl/container/internal/hashtablez_sampler.cc",
+ "absl/container/internal/hashtablez_sampler_force_weak_definition.cc",
+ "absl/container/internal/raw_hash_set.cc",
+ "absl/hash/internal/city.cc",
+ "absl/hash/internal/hash.cc",
+ ],
+ copts = RUSTY_V8_DEPENDENCY_COPTS,
+ features = ["-module_maps"],
+ visibility = ["//visibility:private"],
+ deps = [
+ ":cord",
+ ":synchronization",
+ ],
+)
+
+cc_library(
+ name = "btree",
+ deps = [":cord"],
+)
+
+alias(
+ name = "overload",
+ actual = ":headers",
+)
+
+alias(
+ name = "flat_hash_map",
+ actual = ":hash_containers",
+)
+
+alias(
+ name = "flat_hash_set",
+ actual = ":hash_containers",
+)
+
+alias(
+ name = "node_hash_map",
+ actual = ":hash_containers",
+)
+
+alias(
+ name = "node_hash_set",
+ actual = ":hash_containers",
+)
+
+# Compatibility for the engine graph further up the V8 build stack. The
+# individual V8 targets in this layer use the narrower entry points above.
+cc_library(
+ name = "abseil",
+ deps = [
+ ":btree",
+ ":flat_hash_map",
+ ":overload",
+ ":synchronization",
+ ":time",
+ ],
+)
diff --git a/third_party/v8/abseil_repository.bzl b/third_party/v8/abseil_repository.bzl
new file mode 100644
index 0000000000..7e1ee85980
--- /dev/null
+++ b/third_party/v8/abseil_repository.bzl
@@ -0,0 +1,57 @@
+"""Source-only, private Abseil build for V8.
+
+Abseil's inline namespace is deliberately set in options.h, not a command line
+override: upstream's options header defines it unconditionally. That file is
+Abseil's supported build configuration interface for packagers. Namespace all
+of the V8 copy (including its public headers) identically so it can coexist in
+the same binary with the shared Abseil module compiled for protobuf.
+"""
+
+def _v8_abseil_repository_impl(repository_ctx):
+ repository_ctx.download_and_extract(
+ url = "https://github.com/abseil/abseil-cpp/releases/download/20250814.1/abseil-cpp-20250814.1.tar.gz",
+ integrity = "sha256-FpL3fRc5us8/lDNxiLeFg88JurfkINLcbFYFpPhnhaE=",
+ stripPrefix = "abseil-cpp-20250814.1",
+ )
+
+ # Our root BUILD must own all sources beneath absl/. Native Starlark
+ # filesystem operations work on Windows as well; no shell or Python.
+ directories = [repository_ctx.path("absl")]
+ for _ in range(32):
+ if not directories:
+ break
+ next_directories = []
+ for directory in directories:
+ for entry in directory.readdir():
+ if entry.basename in ["BUILD", "BUILD.bazel"]:
+ repository_ctx.delete(entry)
+ elif entry.is_dir:
+ next_directories.append(entry)
+ directories = next_directories
+ if directories:
+ fail("V8 Abseil source tree exceeds the supported traversal depth")
+ repository_ctx.delete("BUILD")
+ repository_ctx.delete("BUILD.bazel")
+ repository_ctx.symlink(repository_ctx.attr.build_file, "BUILD.bazel")
+
+ # Do not silently configure a new Abseil version as this version on upgrade.
+ # See absl/base/options.h: ABSL_OPTION_INLINE_NAMESPACE_NAME.
+ options = repository_ctx.read("absl/base/options.h")
+ original = "#define ABSL_OPTION_INLINE_NAMESPACE_NAME lts_20250814"
+ if options.count(original) != 1:
+ fail("Unexpected Abseil inline namespace: recheck the private V8 ABI for this source revision")
+ repository_ctx.file(
+ "absl/base/options.h",
+ options.replace(original, "#define ABSL_OPTION_INLINE_NAMESPACE_NAME codex_v8_lts_20250814"),
+ executable = False,
+ )
+
+v8_abseil_repository = repository_rule(
+ implementation = _v8_abseil_repository_impl,
+ attrs = {
+ "build_file": attr.label(
+ default = Label("//third_party/v8:abseil.BUILD.bazel"),
+ allow_single_file = True,
+ ),
+ },
+)
diff --git a/third_party/v8/dependencies.bzl b/third_party/v8/dependencies.bzl
new file mode 100644
index 0000000000..50dd8221be
--- /dev/null
+++ b/third_party/v8/dependencies.bzl
@@ -0,0 +1,73 @@
+"""Pinned source imports for Codex's V8 dependency builds.
+
+V8 uses these same repositories through the codex_deps module-extension bridge
+in its MODULE.bazel. The BUILD files, and all dependency compilation policy,
+live next to this file so updating V8 does not require patching shared rules.
+
+On V8 upgrades follow README.md#updating-source-dependencies. Highway, ICU,
+dragonbox, FP16 and fast_float follow the pinned V8 DEPS; simdutf matches the
+version in Chromium's vendored metadata. Abseil follows V8's unpatched MODULE.
+Source versions are reviewed manually, not by the prebuilt checksum CI check.
+"""
+
+load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+load(":abseil_repository.bzl", "v8_abseil_repository")
+
+def _dependencies_impl(module_ctx):
+ v8_abseil_repository(name = "v8_abseil")
+
+ http_archive(
+ name = "v8_highway",
+ build_file = Label("//third_party/v8:highway.BUILD.bazel"),
+ sha256 = "741d705781e0b3e406beda8f1f994fbae01321237ce8023a1ad90fbaf7940c25",
+ strip_prefix = "highway-2607d3b5b0113992fe84d3848859eae13b3b52c1",
+ urls = ["https://github.com/google/highway/archive/2607d3b5b0113992fe84d3848859eae13b3b52c1.tar.gz"],
+ )
+
+ git_repository(
+ name = "v8_icu",
+ build_file = Label("//third_party/v8:icu.BUILD.bazel"),
+ commit = "d578f2e8b7bd5938e21cfb6bf15c079e0aa5b738",
+ patch_cmds = ["find source -name BUILD.bazel | xargs rm"],
+ patch_cmds_win = ["Get-ChildItem -Path source -File -Include BUILD.bazel -Recurse | Remove-Item"],
+ remote = "https://chromium.googlesource.com/chromium/deps/icu.git",
+ )
+
+ http_archive(
+ name = "v8_fast_float",
+ build_file = Label("//third_party/v8:fast_float.BUILD.bazel"),
+ sha256 = "76f958dd97b1cf4d8862d1f0986a47d4bdfa8845252bae15ef0f40de3b95961f",
+ strip_prefix = "fast_float-8.2.10",
+ urls = ["https://github.com/fastfloat/fast_float/archive/refs/tags/v8.2.10.tar.gz"],
+ )
+
+ http_archive(
+ name = "v8_simdutf",
+ build_file = Label("//third_party/v8:simdutf.BUILD.bazel"),
+ sha256 = "0180de81a1dd48a87b8c0442ffa81734f3db91a7350914107a449935124e3c6f",
+ strip_prefix = "simdutf-7.7.0",
+ urls = ["https://github.com/simdutf/simdutf/archive/refs/tags/v7.7.0.tar.gz"],
+ )
+
+ git_repository(
+ name = "v8_dragonbox",
+ build_file = Label("//third_party/v8:dragonbox.BUILD.bazel"),
+ commit = "beeeef91cf6fef89a4d4ba5e95d47ca64ccb3a44",
+ remote = "https://chromium.googlesource.com/external/github.com/jk-jeon/dragonbox.git",
+ )
+
+ git_repository(
+ name = "v8_fp16",
+ build_file = Label("//third_party/v8:fp16.BUILD.bazel"),
+ commit = "782eea126dc5c755827be751a099eb01826175cf",
+ remote = "https://chromium.googlesource.com/external/github.com/Maratyszcza/FP16.git",
+ )
+
+ return module_ctx.extension_metadata(
+ reproducible = True,
+ root_module_direct_deps = "all",
+ root_module_direct_dev_deps = [],
+ )
+
+dependencies = module_extension(implementation = _dependencies_impl)
diff --git a/third_party/v8/dependency_config.bzl b/third_party/v8/dependency_config.bzl
new file mode 100644
index 0000000000..2b1fc02c12
--- /dev/null
+++ b/third_party/v8/dependency_config.bzl
@@ -0,0 +1,23 @@
+"""Runtime settings for Codex's Highway and simdutf V8 dependencies.
+
+These targets build with the same Chromium libc++ headers as V8 when that
+profile is active. Shared libraries such as Abseil remain separate.
+"""
+
+RUSTY_V8_DEPENDENCY_COPTS = select({
+ "@@//third_party/v8:use_rusty_v8_custom_libcxx": [
+ "-nostdinc++",
+ "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE",
+ "-D_LIBCPP_INSTRUMENTED_WITH_ASAN=0",
+ "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ ],
+ "//conditions:default": [],
+})
+
+RUSTY_V8_DEPENDENCY_DEPS = select({
+ "@@//third_party/v8:use_rusty_v8_custom_libcxx": [
+ "@@//third_party/v8:rusty_v8_custom_libcxx_headers",
+ ],
+ "//conditions:default": [],
+})
diff --git a/third_party/v8/dragonbox.BUILD.bazel b/third_party/v8/dragonbox.BUILD.bazel
new file mode 100644
index 0000000000..80bc390fec
--- /dev/null
+++ b/third_party/v8/dragonbox.BUILD.bazel
@@ -0,0 +1,11 @@
+# Codex overlay for the V8 DEPS revision. Mirrors :lib_dragonbox in V8's
+# BUILD.bazel, exporting the include path V8 expects from a separate repo.
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
+cc_library(
+ name = "dragonbox",
+ hdrs = ["include/dragonbox/dragonbox.h"],
+ include_prefix = "third_party/dragonbox/src/include",
+ strip_include_prefix = "include",
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/v8/fast_float.BUILD.bazel b/third_party/v8/fast_float.BUILD.bazel
new file mode 100644
index 0000000000..9b3c036a93
--- /dev/null
+++ b/third_party/v8/fast_float.BUILD.bazel
@@ -0,0 +1,11 @@
+# Codex header-only overlay for the V8 DEPS revision; the include prefix
+# preserves V8's third_party checkout layout across the repository boundary.
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
+cc_library(
+ name = "fast_float",
+ hdrs = glob(["include/fast_float/*.h"]),
+ include_prefix = "third_party/fast_float/src/include",
+ strip_include_prefix = "include",
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/v8/fp16.BUILD.bazel b/third_party/v8/fp16.BUILD.bazel
new file mode 100644
index 0000000000..e3ffa1780c
--- /dev/null
+++ b/third_party/v8/fp16.BUILD.bazel
@@ -0,0 +1,12 @@
+# Codex overlay for the V8 DEPS revision. Mirrors :lib_fp16 in V8's
+# BUILD.bazel, exporting its headers at V8's expected include path.
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
+cc_library(
+ name = "fp16",
+ hdrs = glob(["include/**/*.h"]),
+ include_prefix = "third_party/fp16/src/include",
+ includes = ["include"],
+ strip_include_prefix = "include",
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/v8/highway.BUILD.bazel b/third_party/v8/highway.BUILD.bazel
new file mode 100644
index 0000000000..09d318ef52
--- /dev/null
+++ b/third_party/v8/highway.BUILD.bazel
@@ -0,0 +1,184 @@
+# Adapted from google/highway's BUILD at the V8 DEPS revision 2607d3b5:
+# https://github.com/google/highway/blob/2607d3b5b0113992fe84d3848859eae13b3b52c1/BUILD
+# Keep :hwy and its compiler configuration; omit upstream tests/other libraries.
+# Codex adds private V8 runtime settings, disables module maps and builds
+# statically (no upstream HWY_SHARED_DEFINE). See README.md for update checks.
+load("@@//third_party/v8:dependency_config.bzl", "RUSTY_V8_DEPENDENCY_COPTS", "RUSTY_V8_DEPENDENCY_DEPS")
+load("@bazel_skylib//lib:selects.bzl", "selects")
+load("@rules_cc//cc:defs.bzl", "cc_library")
+load("@rules_license//rules:license.bzl", "license")
+
+package(
+ default_applicable_licenses = [":license"],
+ default_visibility = ["//visibility:public"],
+)
+
+license(
+ name = "license",
+ package_name = "highway",
+ license_kinds = ["@rules_license//licenses/generic:notice"],
+)
+
+# Dual-licensed Apache 2 and 3-clause BSD.
+licenses(["notice"])
+
+exports_files(["LICENSE"])
+
+# Detect compiler:
+config_setting(
+ name = "compiler_clang",
+ flag_values = {"@bazel_tools//tools/cpp:compiler": "clang"},
+)
+
+config_setting(
+ name = "compiler_clangcl",
+ flag_values = {"@bazel_tools//tools/cpp:compiler": "lexan"},
+)
+
+config_setting(
+ name = "compiler_msvc",
+ flag_values = {"@bazel_tools//tools/cpp:compiler": "msvc-cl"},
+)
+
+config_setting(
+ name = "compiler_emscripten",
+ constraint_values = [
+ "@platforms//cpu:wasm32",
+ ],
+)
+
+# See https://github.com/bazelbuild/bazel/issues/12707
+config_setting(
+ name = "compiler_gcc_bug",
+ flag_values = {
+ "@bazel_tools//tools/cpp:compiler": "compiler",
+ },
+)
+
+config_setting(
+ name = "compiler_gcc_actual",
+ flag_values = {
+ "@bazel_tools//tools/cpp:compiler": "gcc",
+ },
+)
+
+selects.config_setting_group(
+ name = "compiler_gcc",
+ match_any = [
+ ":compiler_gcc_bug",
+ ":compiler_gcc_actual",
+ ],
+)
+
+# Additional warnings for Clang OR GCC (skip for MSVC)
+CLANG_GCC_COPTS = [
+ "-Wunused",
+ "-Wextra-semi",
+ "-Wunreachable-code",
+ "-Wshadow",
+ "-Wmissing-declarations",
+]
+
+# Warnings supported by Clang and Clang-cl
+CLANG_OR_CLANGCL_OPTS = CLANG_GCC_COPTS + [
+ "-Wfloat-overflow-conversion",
+ "-Wfloat-zero-conversion",
+ "-Wfor-loop-analysis",
+ "-Wgnu-redeclared-enum",
+ "-Winfinite-recursion",
+ "-Wliteral-conversion",
+ "-Wno-c++98-compat",
+ "-Wno-unused-command-line-argument",
+ "-Wprivate-header",
+ "-Wself-assign",
+ "-Wstring-conversion",
+ "-Wtautological-overlap-compare",
+ "-Wthread-safety-analysis",
+ "-Wundefined-func-template",
+ "-Wunreachable-code-aggressive",
+ "-Wunused-comparison",
+]
+
+# Warnings only supported by Clang, but not Clang-cl
+CLANG_ONLY_COPTS = CLANG_OR_CLANGCL_OPTS + [
+ # Do not treat the third_party headers as system headers when building
+ # highway - the errors are pertinent.
+ "--no-system-header-prefix=third_party/highway",
+]
+
+COPTS = select({
+ ":compiler_msvc": [],
+ ":compiler_gcc": CLANG_GCC_COPTS,
+ ":compiler_clangcl": CLANG_OR_CLANGCL_OPTS,
+ # Default to clang because compiler detection only works in Bazel
+ "//conditions:default": CLANG_ONLY_COPTS,
+}) + select({
+ "@platforms//cpu:riscv64": [
+ "-march=rv64gcv1p0",
+ "-menable-experimental-extensions",
+ ],
+ "//conditions:default": [
+ ],
+})
+
+# V8 embeds Highway in a static archive, including on Windows: do not set
+# HWY_SHARED_DEFINE, which marks its consumers as importing from a DLL.
+cc_library(
+ name = "hwy",
+ srcs = [
+ "hwy/abort.cc",
+ "hwy/aligned_allocator.cc",
+ "hwy/per_target.cc",
+ "hwy/print.cc",
+ "hwy/targets.cc",
+ ],
+ # Normal headers with include guards
+ hdrs = [
+ "hwy/abort.h",
+ "hwy/aligned_allocator.h",
+ "hwy/base.h",
+ "hwy/cache_control.h",
+ "hwy/detect_compiler_arch.h", # private
+ "hwy/print.h",
+ "hwy/x86_cpuid.h",
+ ],
+ copts = COPTS + RUSTY_V8_DEPENDENCY_COPTS,
+ features = ["-module_maps"],
+ local_defines = ["hwy_EXPORTS"],
+ textual_hdrs = [
+ # These are textual because config macros influence them:
+ "hwy/detect_targets.h", # private
+ "hwy/targets.h",
+ # This .cc file #includes itself through foreach_target.h
+ "hwy/per_target.cc",
+ # End of list
+ "hwy/highway.h", # public
+ "hwy/foreach_target.h", # public
+ "hwy/per_target.h", # public
+ "hwy/print-inl.h", # public
+ "hwy/highway_export.h", # public
+ "hwy/ops/arm_neon-inl.h",
+ "hwy/ops/arm_sve-inl.h",
+ "hwy/ops/emu128-inl.h",
+ "hwy/ops/generic_ops-inl.h",
+ "hwy/ops/inside-inl.h",
+ "hwy/ops/scalar-inl.h",
+ "hwy/ops/set_macros-inl.h",
+ "hwy/ops/shared-inl.h",
+ "hwy/ops/x86_128-inl.h",
+ "hwy/ops/x86_256-inl.h",
+ "hwy/ops/x86_512-inl.h",
+ "hwy/ops/x86_avx3-inl.h",
+ # Select avoids recompiling native arch if only non-native changed
+ ] + select({
+ ":compiler_emscripten": [
+ "hwy/ops/wasm_128-inl.h",
+ "hwy/ops/wasm_256-inl.h",
+ ],
+ "//conditions:default": [],
+ }) + select({
+ "@platforms//cpu:riscv64": ["hwy/ops/rvv-inl.h"],
+ "//conditions:default": [],
+ }),
+ deps = RUSTY_V8_DEPENDENCY_DEPS,
+)
diff --git a/third_party/v8/simdutf.BUILD.bazel b/third_party/v8/simdutf.BUILD.bazel
new file mode 100644
index 0000000000..f4ee690c9c
--- /dev/null
+++ b/third_party/v8/simdutf.BUILD.bazel
@@ -0,0 +1,28 @@
+# Codex overlay for upstream simdutf source, not copied from V8's BUILD.
+# V8 builds Chromium's single-header vendored form; match its Version field
+# and review vendor changes on each upgrade (README.md#updating-source-dependencies).
+load("@@//third_party/v8:dependency_config.bzl", "RUSTY_V8_DEPENDENCY_COPTS", "RUSTY_V8_DEPENDENCY_DEPS")
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
+cc_library(
+ name = "simdutf",
+ srcs = ["src/simdutf.cpp"],
+ hdrs = glob(["include/**/*.h"]),
+ copts = ["-std=c++20"] + RUSTY_V8_DEPENDENCY_COPTS,
+ features = ["-module_maps"],
+ include_prefix = "third_party/simdutf",
+ includes = [
+ "include",
+ "src",
+ ],
+ strip_include_prefix = "include",
+ textual_hdrs = glob(
+ [
+ "src/**/*.h",
+ "src/**/*.cpp",
+ ],
+ exclude = ["src/simdutf.cpp"],
+ ),
+ visibility = ["//visibility:public"],
+ deps = RUSTY_V8_DEPENDENCY_DEPS,
+)