mirror of
https://github.com/openai/codex.git
synced 2026-10-19 16:17:49 +00:00
Upgrade V8 to 152.2.0 and backport Array.sort safety guards (#54519)
## Why Optimized `Array.prototype.sort` can write objects into incompatible array element storage when receiver element kinds differ and the comparator mutates the array. ## What changed - Upgrade `v8` to `152.2.0`, the Bazel V8 source to `15.2.124.1`, and ICU data and initialization to version 78. - Backport element-kind agreement checks for sort inlining in TurboFan and Maglev. Apply the patch to Bazel builds and Windows MSVC source builds, and include it in source-build cache keys and canary triggers. - Refresh pinned sandbox archives and bindings, extend Bazel prebuilt coverage to musl Linux, and use matching sandbox bindings on Windows MSVC. - Update Bazel integration patches and runtime dependencies for the new V8 release, and download the pinned Windows build tools in source-build workflows. ## Testing Include the upstream sort regression test covering mixed element kinds, comparator mutation, and continued optimization for matching kinds. Add a test requiring canary and Windows source builds when the backport changes, and update artifact-fetch tests for the new version. GitOrigin-RevId: 138b7821cddd25466c10aced1dd22be24837caf0
This commit is contained in:
@@ -25,6 +25,7 @@ exports_files([
|
||||
"ring_windows_msvc_include_dirs.patch",
|
||||
"tikv-jemalloc-sys_make_env.patch",
|
||||
"tikv-jemalloc-sys_dependency_flags.patch",
|
||||
"v8_array_sort_elements_kind.patch",
|
||||
"v8_bazel_rules.patch",
|
||||
"v8_module_deps.patch",
|
||||
"v8_source_portability.patch",
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
# What: backport CVE-2026-85046 to V8 15.2.124.1 by rejecting mixed
|
||||
# elements kinds when inlining Array.prototype.sort.
|
||||
# Scope: Maglev/TurboFan implementation guards and the upstream regression test.
|
||||
# Upstream M152 fix: https://github.com/v8/v8/commit/94c34b200ae9caf83d06c167a070746a1c7e825c
|
||||
# CVE advisory: https://chromereleases.googleblog.com/2026/09/stable-channel-update-for-desktop_01882797386.html
|
||||
|
||||
diff --git a/orig/v8-15.2.124.1/src/compiler/js-call-reducer.cc b/mod/v8-15.2.124.1/src/compiler/js-call-reducer.cc
|
||||
index e8707261d3e2..0e2d9bfd0a74 100644
|
||||
--- a/orig/v8-15.2.124.1/src/compiler/js-call-reducer.cc
|
||||
+++ b/mod/v8-15.2.124.1/src/compiler/js-call-reducer.cc
|
||||
@@ -4068,6 +4068,10 @@ class IteratingArrayBuiltinHelper {
|
||||
return;
|
||||
}
|
||||
|
||||
+ all_elements_kinds_equal_ = std::all_of(
|
||||
+ receiver_maps.begin(), receiver_maps.end(),
|
||||
+ [&](MapRef map) { return map.elements_kind() == elements_kind_; });
|
||||
+
|
||||
// TODO(jgruber): May only be needed for holey elements kinds.
|
||||
if (!dependencies->DependOnNoElementsProtector()) return;
|
||||
|
||||
@@ -4083,10 +4087,13 @@ class IteratingArrayBuiltinHelper {
|
||||
Control control() const { return control_; }
|
||||
MapInference* inference() { return &inference_; }
|
||||
ElementsKind elements_kind() const { return elements_kind_; }
|
||||
+ // False when elements_kind() is a union over differing receiver kinds.
|
||||
+ bool all_elements_kinds_equal() const { return all_elements_kinds_equal_; }
|
||||
|
||||
private:
|
||||
bool can_reduce_ = false;
|
||||
bool has_stability_dependency_ = false;
|
||||
+ bool all_elements_kinds_equal_ = false;
|
||||
Node* receiver_;
|
||||
Effect effect_;
|
||||
Control control_;
|
||||
@@ -4126,6 +4133,11 @@ Reduction JSCallReducer::ReduceArraySort(Node* node,
|
||||
IteratingArrayBuiltinHelper h(node, broker(), jsgraph(), dependencies());
|
||||
if (!h.can_reduce()) return h.inference()->NoChange();
|
||||
|
||||
+ // The union kind is only an upper bound on each receiver's own kind. Loads
|
||||
+ // through it widen and are sound; stores narrow and are not. Unlike the
|
||||
+ // iterating builtins, sort writes its snapshot back into the receiver.
|
||||
+ if (!h.all_elements_kinds_equal()) return h.inference()->NoChange();
|
||||
+
|
||||
// Only non-holey, non-double PACKED kinds are supported. Holey arrays need
|
||||
// hole handling; double arrays need a FixedDoubleArray temp copy.
|
||||
if (IsHoleyElementsKind(h.elements_kind())) return h.inference()->NoChange();
|
||||
diff --git a/orig/v8-15.2.124.1/src/maglev/maglev-graph-builder.cc b/mod/v8-15.2.124.1/src/maglev/maglev-graph-builder.cc
|
||||
index c40cadb32d92..c6ae7f791267 100644
|
||||
--- a/orig/v8-15.2.124.1/src/maglev/maglev-graph-builder.cc
|
||||
+++ b/mod/v8-15.2.124.1/src/maglev/maglev-graph-builder.cc
|
||||
@@ -9797,6 +9797,16 @@ MaybeReduceResult MaglevGraphBuilder::TryReduceArrayPrototypeSort(
|
||||
" array iteration");
|
||||
}
|
||||
|
||||
+ // The union kind is only an upper bound on each receiver's own kind. Loads
|
||||
+ // through it widen and are sound; stores narrow and are not. Unlike the
|
||||
+ // iterating builtins, sort writes its snapshot back into the receiver.
|
||||
+ if (std::any_of(possible_maps->begin(), possible_maps->end(),
|
||||
+ [&](compiler::MapRef map) {
|
||||
+ return map.elements_kind() != elements_kind;
|
||||
+ })) {
|
||||
+ FAIL(" to reduce Array.prototype.sort - receiver elements kinds disagree");
|
||||
+ }
|
||||
+
|
||||
// Holey arrays require holes to be moved to the end of the sorted result
|
||||
// (ECMA-262 23.1.3.30 step 5, skip-holes mode). The insertion sort does
|
||||
// not implement this, so bail out for any holey kind.
|
||||
diff --git a/orig/v8-15.2.124.1/test/mjsunit/regress/regress-crbug-542403045.js b/mod/v8-15.2.124.1/test/mjsunit/regress/regress-crbug-542403045.js
|
||||
new file mode 100644
|
||||
index 000000000000..e60a974f8784
|
||||
--- /dev/null
|
||||
+++ b/mod/v8-15.2.124.1/test/mjsunit/regress/regress-crbug-542403045.js
|
||||
@@ -0,0 +1,89 @@
|
||||
+// Copyright 2026 the V8 project authors. All rights reserved.
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
+
|
||||
+// Flags: --allow-natives-syntax --maglev
|
||||
+
|
||||
+// The inlined sort snapshots the receiver's elements, runs comparefn, then
|
||||
+// copies the snapshot back specialized on the receiver's elements kind. With
|
||||
+// polymorphic {PACKED_SMI,PACKED} feedback that kind is the union
|
||||
+// PACKED_ELEMENTS, which no longer describes a receiver that comparefn has
|
||||
+// narrowed back to PACKED_SMI_ELEMENTS.
|
||||
+
|
||||
+function sort(a) {
|
||||
+ function compare() {
|
||||
+ a.fill(0);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return a.sort(compare);
|
||||
+}
|
||||
+
|
||||
+%PrepareFunctionForOptimization(sort);
|
||||
+for (let i = 0; i < 100; ++i) {
|
||||
+ sort([1, 2]);
|
||||
+ sort([{}, {}]);
|
||||
+}
|
||||
+%OptimizeMaglevOnNextCall(sort);
|
||||
+sort([1, 2]);
|
||||
+
|
||||
+const object = {};
|
||||
+const bad = [object, {}];
|
||||
+sort(bad);
|
||||
+
|
||||
+// A Smi-elements array must never hold a HeapObject.
|
||||
+assertFalse(%HasSmiElements(bad) && bad[0] === object);
|
||||
+
|
||||
+// Mixed-kind feedback is not inlined, but still sorts correctly.
|
||||
+function sortMixed(a) {
|
||||
+ return a.sort((x, y) => x - y);
|
||||
+}
|
||||
+%PrepareFunctionForOptimization(sortMixed);
|
||||
+for (let i = 0; i < 100; ++i) {
|
||||
+ sortMixed([2, 1]);
|
||||
+ sortMixed([{}, {}]);
|
||||
+}
|
||||
+%OptimizeMaglevOnNextCall(sortMixed);
|
||||
+assertEquals([1, 2, 3], sortMixed([3, 1, 2]));
|
||||
+
|
||||
+// Same via a Smi/double mix, whose union kind PACKED_DOUBLE_ELEMENTS is
|
||||
+// rejected by the double bailout rather than the kind-agreement one.
|
||||
+function sortDouble(a) {
|
||||
+ function compare(x, y) {
|
||||
+ a.fill(0);
|
||||
+ return x - y;
|
||||
+ }
|
||||
+ return a.sort(compare);
|
||||
+}
|
||||
+%PrepareFunctionForOptimization(sortDouble);
|
||||
+for (let i = 0; i < 100; ++i) {
|
||||
+ sortDouble([2, 1]);
|
||||
+ sortDouble([2.5, 1.5]);
|
||||
+}
|
||||
+%OptimizeMaglevOnNextCall(sortDouble);
|
||||
+sortDouble([2, 1]);
|
||||
+// The sort writes its snapshot back, so comparefn's fill is not observable.
|
||||
+assertEquals([1.5, 2.5], sortDouble([2.5, 1.5]));
|
||||
+
|
||||
+// Sites whose receiver kinds agree keep the inlined path, including when the
|
||||
+// maps themselves differ.
|
||||
+function withProperty() {
|
||||
+ const a = [{}, {}];
|
||||
+ a.foo = 1;
|
||||
+ return a;
|
||||
+}
|
||||
+function sortSameKind(a) {
|
||||
+ return a.sort((x, y) => 0);
|
||||
+}
|
||||
+%PrepareFunctionForOptimization(sortSameKind);
|
||||
+for (let i = 0; i < 100; ++i) {
|
||||
+ sortSameKind([{}, {}]);
|
||||
+ sortSameKind(withProperty());
|
||||
+}
|
||||
+%OptimizeMaglevOnNextCall(sortSameKind);
|
||||
+sortSameKind([{}, {}]);
|
||||
+assertOptimized(sortSameKind);
|
||||
+for (let i = 0; i < 100; ++i) {
|
||||
+ sortSameKind([{}, {}]);
|
||||
+ sortSameKind(withProperty());
|
||||
+}
|
||||
+assertOptimized(sortSameKind);
|
||||
@@ -3,20 +3,23 @@
|
||||
# Scope: Bazel BUILD/defs/BUILD.icu integration only, including dependency
|
||||
# wiring, generated sources, and visibility; no standalone V8 source patching.
|
||||
|
||||
diff --git a/orig/v8-15.0.245.2/bazel/defs.bzl b/mod/v8-15.0.245.2/bazel/defs.bzl
|
||||
index bbe1495..6673518 100644
|
||||
--- a/orig/v8-15.0.245.2/bazel/defs.bzl
|
||||
+++ b/mod/v8-15.0.245.2/bazel/defs.bzl
|
||||
@@ -33,9 +33,25 @@ _create_option_int = rule(
|
||||
diff --git a/orig/v8-15.2.124.1/bazel/defs.bzl b/mod/v8-15.2.124.1/bazel/defs.bzl
|
||||
--- a/orig/v8-15.2.124.1/bazel/defs.bzl
|
||||
+++ b/mod/v8-15.2.124.1/bazel/defs.bzl
|
||||
@@ -42,12 +42,30 @@
|
||||
)
|
||||
|
||||
|
||||
def v8_flag(name, default = False):
|
||||
- _create_option_flag(name = name, build_setting_default = default)
|
||||
- _create_option_flag(name = name, build_setting_default = default, scope = "universal")
|
||||
- native.config_setting(name = "is_" + name, flag_values = {name: "True"})
|
||||
- native.config_setting(name = "is_not_" + name, flag_values = {name: "False"})
|
||||
-
|
||||
-def v8_string(name, default = ""):
|
||||
- _create_option_string(name = name, build_setting_default = default, scope = "universal")
|
||||
+ _create_option_flag(
|
||||
+ name = name,
|
||||
+ build_setting_default = default,
|
||||
+ scope = "universal",
|
||||
+ visibility = ["//visibility:public"],
|
||||
+ )
|
||||
+ native.config_setting(
|
||||
@@ -29,17 +32,19 @@ index bbe1495..6673518 100644
|
||||
+ flag_values = {name: "False"},
|
||||
+ visibility = ["//visibility:public"],
|
||||
+ )
|
||||
|
||||
-def v8_string(name, default = ""):
|
||||
- _create_option_string(name = name, build_setting_default = default)
|
||||
+
|
||||
+def v8_string(name, default = "", visibility = None):
|
||||
+ _create_option_string(
|
||||
+ name = name,
|
||||
+ build_setting_default = default,
|
||||
+ scope = "universal",
|
||||
+ visibility = visibility,
|
||||
+ )
|
||||
@@ -97,7 +109,13 @@ v8_config = rule(
|
||||
|
||||
|
||||
def v8_int(name, default = 0):
|
||||
_create_option_int(name = name, build_setting_default = default, scope = "universal")
|
||||
@@ -106,7 +124,13 @@
|
||||
|
||||
def _default_args():
|
||||
return struct(
|
||||
- deps = [":define_flags", "@libcxx//:libc++"],
|
||||
@@ -53,7 +58,7 @@ index bbe1495..6673518 100644
|
||||
defines = select({
|
||||
"@v8//bazel/config:is_windows": [
|
||||
"UNICODE",
|
||||
@@ -127,12 +145,15 @@ def _default_args():
|
||||
@@ -136,12 +160,15 @@
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
@@ -62,23 +67,26 @@ index bbe1495..6673518 100644
|
||||
- "-Wno-deprecated-this-capture",
|
||||
- "-Wno-deprecated-declarations",
|
||||
- "-std=c++20",
|
||||
- ],
|
||||
+ "@v8//:is_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": [],
|
||||
+ }) + select({
|
||||
"@v8//bazel/config:is_gcc": [
|
||||
"-Wno-extra",
|
||||
"-Wno-array-bounds",
|
||||
@@ -152,9 +173,17 @@ def _default_args():
|
||||
@@ -161,9 +188,17 @@
|
||||
"-std=gnu++2a",
|
||||
],
|
||||
"@v8//bazel/config:is_windows": [
|
||||
- "/std:c++20",
|
||||
- ],
|
||||
- "//conditions:default": [],
|
||||
+ "-Wno-invalid-offsetof",
|
||||
+ "-Wno-deprecated-this-capture",
|
||||
+ "-Wno-deprecated-declarations",
|
||||
@@ -89,12 +97,11 @@ index bbe1495..6673518 100644
|
||||
+ "-Wno-deprecated-this-capture",
|
||||
+ "-Wno-deprecated-declarations",
|
||||
+ "-std=c++20",
|
||||
],
|
||||
- "//conditions:default": [],
|
||||
+ ],
|
||||
}) + select({
|
||||
"@v8//bazel/config:is_gcc_fastbuild": [
|
||||
# Non-debug builds without optimizations fail because
|
||||
@@ -178,12 +207,12 @@ def _default_args():
|
||||
@@ -187,12 +222,12 @@
|
||||
includes = ["include"],
|
||||
linkopts = select({
|
||||
"@v8//bazel/config:is_windows": [
|
||||
@@ -111,7 +118,7 @@ index bbe1495..6673518 100644
|
||||
}) + select({
|
||||
":should_add_rdynamic": ["-rdynamic"],
|
||||
"//conditions:default": [],
|
||||
@@ -459,6 +488,11 @@
|
||||
@@ -466,6 +501,11 @@
|
||||
def _mksnapshot(ctx):
|
||||
prefix = ctx.attr.prefix
|
||||
suffix = ctx.attr.suffix
|
||||
@@ -123,7 +130,8 @@ index bbe1495..6673518 100644
|
||||
outs = [
|
||||
ctx.actions.declare_file(prefix + "/snapshot" + suffix + ".cc"),
|
||||
ctx.actions.declare_file(prefix + "/embedded" + suffix + ".S"),
|
||||
@@ -477,6 +511,6 @@
|
||||
@@ -483,7 +523,7 @@
|
||||
"--embedded_src",
|
||||
outs[1].path,
|
||||
] + ctx.attr.args,
|
||||
- executable = ctx.executable.tool,
|
||||
@@ -131,7 +139,7 @@ index bbe1495..6673518 100644
|
||||
progress_message = "Running mksnapshot",
|
||||
)
|
||||
return [DefaultInfo(files = depset(outs))]
|
||||
@@ -491,6 +525,12 @@
|
||||
@@ -498,6 +538,12 @@
|
||||
executable = True,
|
||||
cfg = "exec",
|
||||
),
|
||||
@@ -144,7 +152,7 @@ index bbe1495..6673518 100644
|
||||
"target_os": attr.string(mandatory = True),
|
||||
"prefix": attr.string(mandatory = True),
|
||||
"suffix": attr.string(mandatory = True),
|
||||
@@ -504,6 +544,7 @@
|
||||
@@ -511,6 +557,7 @@
|
||||
args = args,
|
||||
prefix = "noicu",
|
||||
tool = ":noicu/mksnapshot" + suffix,
|
||||
@@ -152,7 +160,7 @@ index bbe1495..6673518 100644
|
||||
suffix = suffix,
|
||||
target_os = select({
|
||||
"@v8//bazel/config:is_macos": "mac",
|
||||
@@ -516,6 +557,7 @@
|
||||
@@ -523,6 +570,7 @@
|
||||
args = args,
|
||||
prefix = "icu",
|
||||
tool = ":icu/mksnapshot" + suffix,
|
||||
@@ -160,22 +168,21 @@ index bbe1495..6673518 100644
|
||||
suffix = suffix,
|
||||
target_os = select({
|
||||
"@v8//bazel/config:is_macos": "mac",
|
||||
diff --git a/orig/v8-15.0.245.2/BUILD.bazel b/mod/v8-15.0.245.2/BUILD.bazel
|
||||
index b432f86..28c567b 100644
|
||||
--- a/orig/v8-15.0.245.2/BUILD.bazel
|
||||
+++ b/mod/v8-15.0.245.2/BUILD.bazel
|
||||
@@ -148,6 +148,10 @@ v8_flag(name = "v8_enable_trace_maps")
|
||||
|
||||
diff --git a/orig/v8-15.2.124.1/BUILD.bazel b/mod/v8-15.2.124.1/BUILD.bazel
|
||||
--- a/orig/v8-15.2.124.1/BUILD.bazel
|
||||
+++ b/mod/v8-15.2.124.1/BUILD.bazel
|
||||
@@ -154,6 +154,10 @@
|
||||
|
||||
v8_flag(name = "v8_enable_v8_checks")
|
||||
|
||||
|
||||
+v8_flag(name = "v8_enable_sandbox")
|
||||
+
|
||||
+v8_flag(name = "v8_use_rusty_v8_custom_libcxx")
|
||||
+
|
||||
v8_flag(name = "v8_enable_verify_csa")
|
||||
|
||||
|
||||
v8_flag(name = "v8_enable_verify_heap")
|
||||
@@ -313,7 +317,8 @@ v8_int(
|
||||
@@ -319,7 +323,8 @@
|
||||
# If no explicit value for v8_enable_pointer_compression, we set it to 'none'.
|
||||
v8_string(
|
||||
name = "v8_enable_pointer_compression",
|
||||
@@ -183,9 +190,9 @@ index b432f86..28c567b 100644
|
||||
+ default = "False",
|
||||
+ visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
|
||||
# Default setting for v8_enable_pointer_compression.
|
||||
@@ -513,6 +517,7 @@ v8_config(
|
||||
@@ -520,6 +525,7 @@
|
||||
"v8_enable_slow_dchecks": "ENABLE_SLOW_DCHECKS",
|
||||
"v8_enable_runtime_call_stats": "V8_RUNTIME_CALL_STATS",
|
||||
"v8_enable_snapshot_native_code_counters": "V8_SNAPSHOT_NATIVE_CODE_COUNTERS",
|
||||
@@ -193,10 +200,10 @@ index b432f86..28c567b 100644
|
||||
"v8_enable_trace_maps": "V8_TRACE_MAPS",
|
||||
"v8_enable_turbofan": "V8_ENABLE_TURBOFAN",
|
||||
"v8_enable_v8_checks": "V8_ENABLE_CHECKS",
|
||||
@@ -4125,28 +4130,14 @@ filegroup(
|
||||
@@ -4170,28 +4176,14 @@
|
||||
}),
|
||||
)
|
||||
|
||||
|
||||
-v8_library(
|
||||
- name = "lib_dragonbox",
|
||||
- srcs = ["third_party/dragonbox/src/include/dragonbox/dragonbox.h"],
|
||||
@@ -206,11 +213,8 @@ index b432f86..28c567b 100644
|
||||
- includes = [
|
||||
- "third_party/dragonbox/src/include",
|
||||
- ],
|
||||
+alias(
|
||||
+ name = "lib_dragonbox",
|
||||
+ actual = "@dragonbox//:dragonbox",
|
||||
)
|
||||
|
||||
-)
|
||||
-
|
||||
-v8_library(
|
||||
- name = "lib_fp16",
|
||||
- srcs = ["third_party/fp16/src/include/fp16.h"],
|
||||
@@ -223,12 +227,17 @@ index b432f86..28c567b 100644
|
||||
- "third_party/fp16/src/include",
|
||||
- ],
|
||||
+alias(
|
||||
+ name = "lib_dragonbox",
|
||||
+ actual = "@dragonbox//:dragonbox",
|
||||
+)
|
||||
+
|
||||
+alias(
|
||||
+ name = "lib_fp16",
|
||||
+ actual = "@fp16//:fp16",
|
||||
)
|
||||
|
||||
|
||||
filegroup(
|
||||
@@ -4441,6 +4432,20 @@ genrule(
|
||||
@@ -4486,6 +4478,20 @@
|
||||
srcs = [
|
||||
"include/js_protocol.pdl",
|
||||
"src/inspector/inspector_protocol_config.json",
|
||||
@@ -249,7 +258,7 @@ index b432f86..28c567b 100644
|
||||
],
|
||||
outs = [
|
||||
"include/inspector/Debugger.h",
|
||||
@@ -4462,15 +4467,19 @@ genrule(
|
||||
@@ -4507,15 +4513,19 @@
|
||||
"src/inspector/protocol/Schema.cpp",
|
||||
"src/inspector/protocol/Schema.h",
|
||||
],
|
||||
@@ -272,11 +281,13 @@ index b432f86..28c567b 100644
|
||||
+ requirement("markupsafe"),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -4484,6 +4493,35 @@ filegroup(
|
||||
|
||||
@@ -4527,6 +4537,35 @@
|
||||
":v8_libsampler_files",
|
||||
":v8_shared_internal_headers",
|
||||
],
|
||||
)
|
||||
|
||||
+)
|
||||
+
|
||||
+cc_library(
|
||||
+ name = "rusty_v8_internal_headers",
|
||||
+ hdrs = [
|
||||
@@ -304,34 +315,27 @@ index b432f86..28c567b 100644
|
||||
+ ],
|
||||
+ strip_include_prefix = "",
|
||||
+ visibility = ["//visibility:public"],
|
||||
+)
|
||||
+
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "d8_files",
|
||||
srcs = [
|
||||
@@ -4576,12 +4614,10 @@ cc_library(
|
||||
@@ -4609,11 +4648,9 @@
|
||||
strip_include_prefix = "noicu",
|
||||
)
|
||||
-
|
||||
+
|
||||
|
||||
-cc_library(
|
||||
- name = "llvm_libc_headers",
|
||||
+alias(
|
||||
name = "llvm_libc_headers",
|
||||
- hdrs = glob(["third_party/llvm-libc/src/shared/**/*.h"]),
|
||||
- includes = ["third_party/llvm-libc/src"],
|
||||
- defines = ["LIBC_NAMESPACE=__llvm_libc_cr"],
|
||||
-)
|
||||
+alias(
|
||||
+ name = "llvm_libc_headers",
|
||||
+ actual = "@@//third_party/v8:rusty_v8_llvm_libc_headers",
|
||||
+)
|
||||
-
|
||||
+
|
||||
)
|
||||
|
||||
v8_library(
|
||||
name = "v8_libbase",
|
||||
@@ -4603,16 +4641,9 @@ cc_library(
|
||||
@@ -4660,16 +4697,9 @@
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
-cc_library(
|
||||
- name = "simdutf",
|
||||
- srcs = ["third_party/simdutf/simdutf.cpp"],
|
||||
@@ -346,9 +350,9 @@ index b432f86..28c567b 100644
|
||||
+ name = "simdutf",
|
||||
+ actual = "@simdutf//:simdutf",
|
||||
)
|
||||
|
||||
|
||||
v8_library(
|
||||
@@ -4629,7 +4660,7 @@ v8_library(
|
||||
@@ -4686,7 +4716,7 @@
|
||||
copts = ["-Wno-implicit-fallthrough"],
|
||||
icu_deps = [
|
||||
":icu/generated_torque_definitions_headers",
|
||||
@@ -357,7 +361,7 @@ index b432f86..28c567b 100644
|
||||
],
|
||||
icu_srcs = [
|
||||
":generated_regexp_special_case",
|
||||
@@ -4644,7 +4675,7 @@ v8_library(
|
||||
@@ -4701,7 +4731,7 @@
|
||||
],
|
||||
deps = [
|
||||
":lib_dragonbox",
|
||||
@@ -366,15 +370,15 @@ index b432f86..28c567b 100644
|
||||
":lib_fp16",
|
||||
":simdutf",
|
||||
":v8_libbase",
|
||||
@@ -4700,6 +4731,7 @@ alias(
|
||||
@@ -4757,6 +4787,7 @@
|
||||
alias(
|
||||
name = "core_lib_icu",
|
||||
actual = "icu/v8",
|
||||
+ visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
|
||||
v8_library(
|
||||
@@ -4751,7 +4783,7 @@ v8_binary(
|
||||
@@ -4808,7 +4839,7 @@
|
||||
],
|
||||
deps = [
|
||||
":v8_libbase",
|
||||
@@ -382,8 +386,8 @@ index b432f86..28c567b 100644
|
||||
+ "@icu//:icu",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -4791,9 +4823,20 @@ v8_binary(
|
||||
|
||||
@@ -4852,9 +4883,20 @@
|
||||
":icu/generated_torque_initializers",
|
||||
":icu/v8_initializers_files",
|
||||
],
|
||||
@@ -405,10 +409,9 @@ index b432f86..28c567b 100644
|
||||
}),
|
||||
noicu_deps = [":v8_libshared_noicu"],
|
||||
noicu_srcs = [
|
||||
diff --git a/orig/v8-15.0.245.2/bazel/BUILD.icu b/mod/v8-15.0.245.2/bazel/BUILD.icu
|
||||
index 5fda2f4..8c3c372 100644
|
||||
--- a/orig/v8-15.0.245.2/bazel/BUILD.icu
|
||||
+++ b/mod/v8-15.0.245.2/bazel/BUILD.icu
|
||||
diff --git a/orig/v8-15.2.124.1/bazel/BUILD.icu b/mod/v8-15.2.124.1/bazel/BUILD.icu
|
||||
--- a/orig/v8-15.2.124.1/bazel/BUILD.icu
|
||||
+++ b/mod/v8-15.2.124.1/bazel/BUILD.icu
|
||||
@@ -1,3 +1,24 @@
|
||||
+load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
+
|
||||
@@ -434,7 +437,7 @@ index 5fda2f4..8c3c372 100644
|
||||
# Copyright 2021 the V8 project authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
@@ -16,15 +37,12 @@ cc_library(
|
||||
@@ -16,15 +37,12 @@
|
||||
]),
|
||||
copts = select({
|
||||
"@platforms//os:windows": [
|
||||
@@ -452,15 +455,15 @@ index 5fda2f4..8c3c372 100644
|
||||
data = [":icudata"],
|
||||
defines = [
|
||||
"HAVE_DLOPEN=0",
|
||||
@@ -54,6 +72,7 @@ cc_library(
|
||||
@@ -54,6 +72,7 @@
|
||||
"U_ICUDATAENTRY_IN_COMMON",
|
||||
],
|
||||
tags = ["requires-rtti"],
|
||||
+ deps = CUSTOM_LIBCXX_DEPS,
|
||||
alwayslink = 1,
|
||||
)
|
||||
|
||||
@@ -65,19 +84,16 @@ cc_library(
|
||||
|
||||
@@ -65,19 +84,16 @@
|
||||
]),
|
||||
copts = select({
|
||||
"@platforms//os:windows": [
|
||||
@@ -482,8 +485,8 @@ index 5fda2f4..8c3c372 100644
|
||||
+ deps = [":icuuc"] + CUSTOM_LIBCXX_DEPS,
|
||||
alwayslink = 1,
|
||||
)
|
||||
|
||||
@@ -93,13 +109,10 @@ cc_library(
|
||||
|
||||
@@ -93,13 +109,10 @@
|
||||
]),
|
||||
copts = select({
|
||||
"@platforms//os:windows": [
|
||||
@@ -499,7 +502,7 @@ index 5fda2f4..8c3c372 100644
|
||||
include_prefix = "third_party/icu",
|
||||
local_defines = [
|
||||
"U_COMMON_IMPLEMENTATION",
|
||||
@@ -108,6 +121,6 @@ cc_library(
|
||||
@@ -108,6 +121,6 @@
|
||||
deps = [
|
||||
":icui18n",
|
||||
":icuuc",
|
||||
|
||||
@@ -3,25 +3,14 @@
|
||||
# Scope: upstream MODULE.bazel only; affects external repo resolution and Bazel
|
||||
# module wiring, not V8 source files.
|
||||
|
||||
diff --git a/orig/v8-15.0.245.2/MODULE.bazel b/mod/v8-15.0.245.2/MODULE.bazel
|
||||
index b8bf8bd..573f463 100644
|
||||
--- a/orig/v8-15.0.245.2/MODULE.bazel
|
||||
+++ b/mod/v8-15.0.245.2/MODULE.bazel
|
||||
@@ -8,193 +8,67 @@ bazel_dep(name = "rules_cc", version = "0.2.0")
|
||||
bazel_dep(name = "rules_python", version = "1.0.0")
|
||||
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 @@
|
||||
bazel_dep(name = "rules_python", version = "1.7.0")
|
||||
bazel_dep(name = "platforms", version = "1.0.0")
|
||||
bazel_dep(name = "abseil-cpp", version = "20250814.0")
|
||||
bazel_dep(name = "abseil-cpp", version = "20250814.1")
|
||||
-bazel_dep(name = "highway", version = "1.2.0")
|
||||
-
|
||||
-pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
|
||||
-pip.parse(
|
||||
- hub_name = "v8_python_deps",
|
||||
- python_version = "3.11",
|
||||
- requirements_lock = "//:bazel/requirements.txt",
|
||||
- extra_pip_args = [
|
||||
- "--require-hashes",
|
||||
- "--index-url=https://pypi.org/simple",
|
||||
- ],
|
||||
+bazel_dep(name = "rules_license", version = "0.0.4")
|
||||
+
|
||||
+git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
|
||||
@@ -31,11 +20,63 @@ index b8bf8bd..573f463 100644
|
||||
+ name = "highway",
|
||||
+ patch_args = ["-p1"],
|
||||
+ patches = ["@v8//:bazel/highway.patch"],
|
||||
+ sha256 = "7e0be78b8318e8bdbf6fa545d2ecb4c90f947df03f7aadc42c1967f019e63343",
|
||||
+ strip_prefix = "highway-1.2.0",
|
||||
+ urls = ["https://github.com/google/highway/archive/refs/tags/1.2.0.tar.gz"],
|
||||
+ sha256 = "741d705781e0b3e406beda8f1f994fbae01321237ce8023a1ad90fbaf7940c25",
|
||||
+ strip_prefix = "highway-2607d3b5b0113992fe84d3848859eae13b3b52c1",
|
||||
+ urls = ["https://github.com/google/highway/archive/2607d3b5b0113992fe84d3848859eae13b3b52c1.tar.gz"],
|
||||
+)
|
||||
+
|
||||
+git_repository(
|
||||
+ name = "icu",
|
||||
+ build_file = "@v8//:bazel/BUILD.icu",
|
||||
+ 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(
|
||||
hub_name = "v8_python_deps",
|
||||
python_version = "3.11",
|
||||
+ # Use the pip resolver to preserve V8's hashes and repository names.
|
||||
+ simpleapi_skip = ["jinja2", "markupsafe"],
|
||||
requirements_lock = "//:bazel/requirements.txt",
|
||||
extra_pip_args = [
|
||||
"--require-hashes",
|
||||
@@ -21,180 +74,3 @@
|
||||
],
|
||||
)
|
||||
-use_repo(pip, "v8_python_deps")
|
||||
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")
|
||||
@@ -46,7 +87,7 @@ index b8bf8bd..573f463 100644
|
||||
- config_file_content = """
|
||||
-load("@rules_cc//cc:defs.bzl", "CcToolchainConfigInfo", "cc_common")
|
||||
-load("@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl", "feature", "flag_group", "flag_set", "tool_path")
|
||||
|
||||
-
|
||||
-def _impl(ctx):
|
||||
- tool_paths = [
|
||||
- tool_path(name = "gcc", path = "bin/clang"),
|
||||
@@ -152,32 +193,19 @@ index b8bf8bd..573f463 100644
|
||||
- implementation = _impl,
|
||||
- attrs = {},
|
||||
- provides = [CcToolchainConfigInfo],
|
||||
+git_repository(
|
||||
+ name = "icu",
|
||||
+ build_file = "@v8//:bazel/BUILD.icu",
|
||||
+ commit = "a86a32e67b8d1384b33f8fa48c83a6079b86f8cd",
|
||||
+ 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",
|
||||
)
|
||||
-)
|
||||
-""",
|
||||
- build_file_content = """
|
||||
-load("@rules_cc//cc:defs.bzl", "cc_toolchain")
|
||||
-load(":cc_toolchain_config.bzl", "cc_toolchain_config")
|
||||
-
|
||||
-package(default_visibility = ["//visibility:public"])
|
||||
|
||||
-
|
||||
-filegroup(
|
||||
- name = "all_files",
|
||||
- srcs = glob(["**/*"]),
|
||||
+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 = "e14a33089712b681d74d94e2a11362643bd7d769ae8f7e7caefe955f57f7eacd",
|
||||
+ strip_prefix = "fast_float-8.0.2",
|
||||
+ urls = ["https://github.com/fastfloat/fast_float/archive/refs/tags/v8.0.2.tar.gz"],
|
||||
)
|
||||
|
||||
-)
|
||||
-
|
||||
-filegroup(name = "empty")
|
||||
-
|
||||
-cc_toolchain_config(name = "k8_toolchain_config")
|
||||
@@ -194,14 +222,8 @@ index b8bf8bd..573f463 100644
|
||||
- supports_param_files = 0,
|
||||
- toolchain_config = ":k8_toolchain_config",
|
||||
- toolchain_identifier = "local_clang",
|
||||
+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"],
|
||||
)
|
||||
|
||||
-)
|
||||
-
|
||||
-toolchain(
|
||||
- name = "cc_toolchain_k8",
|
||||
- exec_compatible_with = [
|
||||
@@ -216,13 +238,8 @@ index b8bf8bd..573f463 100644
|
||||
- toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
|
||||
-)
|
||||
-""",
|
||||
+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",
|
||||
)
|
||||
|
||||
-)
|
||||
-
|
||||
-register_toolchains("@llvm_toolchain//:cc_toolchain_k8")
|
||||
-
|
||||
-# Define local repository for libc++ from third_party sources
|
||||
@@ -230,47 +247,22 @@ index b8bf8bd..573f463 100644
|
||||
-
|
||||
-libcxx_repository(
|
||||
- name = "libcxx",
|
||||
+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 = "3d2de1816307bac63c16a297e8c4dc501b4076df",
|
||||
+ remote = "https://chromium.googlesource.com/external/github.com/Maratyszcza/FP16.git",
|
||||
)
|
||||
|
||||
-)
|
||||
-
|
||||
-single_version_override(
|
||||
- module_name = "highway",
|
||||
- patches = ["//bazel/patches:highway_rules_cc.patch"],
|
||||
- patch_strip = 1,
|
||||
+pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
|
||||
+pip.parse(
|
||||
+ hub_name = "v8_python_deps",
|
||||
+ python_version = "3.11",
|
||||
+ requirements_lock = "//:bazel/requirements.txt",
|
||||
+ extra_pip_args = [
|
||||
+ "--require-hashes",
|
||||
+ "--index-url=https://pypi.org/simple",
|
||||
+ ],
|
||||
)
|
||||
+use_repo(pip, "v8_python_deps")
|
||||
diff --git a/mod/v8-15.0.245.2/bazel/highway.patch b/mod/v8-15.0.245.2/bazel/highway.patch
|
||||
-)
|
||||
diff --git a/orig/v8-15.2.124.1/bazel/highway.patch b/mod/v8-15.2.124.1/bazel/highway.patch
|
||||
new file mode 100644
|
||||
index 0000000..5a13dd0
|
||||
--- /dev/null
|
||||
+++ b/mod/v8-15.0.245.2/bazel/highway.patch
|
||||
@@ -0,0 +1,25 @@
|
||||
+++ b/mod/v8-15.2.124.1/bazel/highway.patch
|
||||
@@ -0,0 +1,16 @@
|
||||
+diff --git a/BUILD b/BUILD
|
||||
+--- a/BUILD
|
||||
++++ b/BUILD
|
||||
+@@ -2,7 +2,7 @@
|
||||
+ load("@bazel_skylib//lib:selects.bzl", "selects")
|
||||
+ load("@rules_license//rules:license.bzl", "license")
|
||||
+
|
||||
+-load("@rules_cc//cc:defs.bzl", "cc_test")
|
||||
++load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
+ # Placeholder#2 for Guitar, do not remove
|
||||
+
|
||||
+ package(
|
||||
+@@ -134,11 +134,7 @@ COPTS = select({
|
||||
+@@ -118,11 +118,7 @@
|
||||
+ ],
|
||||
+ })
|
||||
+
|
||||
|
||||
Reference in New Issue
Block a user