Base: codex-main originale (prima del fork aKode)
This commit is contained in:
813
third_party/v8/BUILD.bazel
vendored
Normal file
813
third_party/v8/BUILD.bazel
vendored
Normal file
@@ -0,0 +1,813 @@
|
||||
load("@@//third_party/v8:artifact_profile.bzl", "v8_artifact_files")
|
||||
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
|
||||
load("@rules_cc//cc:cc_static_library.bzl", "cc_static_library")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
load("@rules_rs//rs:rules_rust_bindgen.bzl", "rust_bindgen")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
exports_files([
|
||||
"abseil.BUILD.bazel",
|
||||
"abseil_repository.bzl",
|
||||
"artifact_profile.bzl",
|
||||
"dependencies.bzl",
|
||||
"dependency_config.bzl",
|
||||
"dragonbox.BUILD.bazel",
|
||||
"engine.BUILD.bazel",
|
||||
"engine_repository.bzl",
|
||||
"engine_rules.bzl",
|
||||
"fast_float.BUILD.bazel",
|
||||
"fp16.BUILD.bazel",
|
||||
"highway.BUILD.bazel",
|
||||
"icu.BUILD.bazel",
|
||||
"libcxx_rules.bzl",
|
||||
"native_windows.bzl",
|
||||
"push_registers_gnullvm.S",
|
||||
"simdutf.BUILD.bazel",
|
||||
"v8_defs.patch",
|
||||
])
|
||||
|
||||
config_setting(
|
||||
name = "platform_windows_msvc",
|
||||
constraint_values = [
|
||||
"@platforms//os:windows",
|
||||
"@llvm//constraints/windows/abi:msvc",
|
||||
],
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "use_rusty_v8_custom_libcxx",
|
||||
flag_values = {
|
||||
"@v8//:v8_use_rusty_v8_custom_libcxx": "True",
|
||||
},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "use_rusty_v8_custom_libcxx_native_windows",
|
||||
constraint_values = [
|
||||
"@platforms//os:windows",
|
||||
"@llvm//constraints/windows/abi:msvc",
|
||||
],
|
||||
flag_values = {
|
||||
"@v8//:v8_use_rusty_v8_custom_libcxx": "True",
|
||||
},
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "v8_152_2_0_x86_64_pc_windows_msvc",
|
||||
actual = "@rusty_v8_152_2_0_x86_64_pc_windows_msvc_archive//file",
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "v8_152_2_0_aarch64_pc_windows_msvc",
|
||||
actual = "@rusty_v8_152_2_0_aarch64_pc_windows_msvc_archive//file",
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "v8_152_2_0_aarch64_pc_windows_gnullvm",
|
||||
# `rusty_v8` only ships prebuilt Windows archives for MSVC. Build the
|
||||
# GNU-flavored archive in-tree so windows-gnullvm consumers can link
|
||||
# against a matching ABI instead of trying to reuse the MSVC release.
|
||||
actual = ":v8_152_2_0_aarch64_pc_windows_gnullvm_bazel",
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "v8_152_2_0_x86_64_pc_windows_gnullvm",
|
||||
actual = ":v8_152_2_0_x86_64_pc_windows_gnullvm_bazel",
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "rusty_v8_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",
|
||||
"@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",
|
||||
"@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",
|
||||
}),
|
||||
)
|
||||
|
||||
# A Linux Codex release archive carries Chromium's namespaced libc++ runtime.
|
||||
# Bazel also links its own libc++. Both keep their exception classes in std::,
|
||||
# so prefer the toolchain definitions of just those shared ABI entry points.
|
||||
# Inputs remain checksum-verified and immutable; only the Bazel output changes.
|
||||
[
|
||||
genrule(
|
||||
name = "v8_152_2_0_%s_unknown_linux_%s_prebuilt" % (arch, libc),
|
||||
srcs = [
|
||||
":gnu_libcxx_shared_exception_symbols.txt",
|
||||
"@rusty_v8_152_2_0_%s_unknown_linux_%s_archive//file" % (arch, libc),
|
||||
],
|
||||
outs = ["libv8_152_2_0_%s_unknown_linux_%s_prebuilt.a" % (arch, libc)],
|
||||
cmd = """
|
||||
gzip -dc "$(location @rusty_v8_152_2_0_%s_unknown_linux_%s_archive//file)" > "$@.unadjusted"
|
||||
$(location @llvm//tools:llvm-objcopy) \
|
||||
--weaken-symbols="$(location :gnu_libcxx_shared_exception_symbols.txt)" \
|
||||
"$@.unadjusted" "$@"
|
||||
rm "$@.unadjusted"
|
||||
""" % (arch, libc),
|
||||
tools = ["@llvm//tools:llvm-objcopy"],
|
||||
)
|
||||
for arch in [
|
||||
"aarch64",
|
||||
"x86_64",
|
||||
]
|
||||
for libc in [
|
||||
"gnu",
|
||||
"musl",
|
||||
]
|
||||
]
|
||||
|
||||
alias(
|
||||
name = "rusty_v8_source_archive_for_target",
|
||||
actual = select({
|
||||
"@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",
|
||||
"@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.
|
||||
"@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",
|
||||
"@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 = ":rusty_v8_source_binding_for_target",
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "rusty_v8_prebuilt_binding_for_target",
|
||||
actual = select({
|
||||
"@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",
|
||||
"@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",
|
||||
"@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",
|
||||
}),
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "rusty_v8_source_binding_for_target",
|
||||
actual = select({
|
||||
"@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",
|
||||
"@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",
|
||||
"@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",
|
||||
}),
|
||||
)
|
||||
|
||||
V8_COPTS = select({
|
||||
":platform_windows_msvc": [
|
||||
"/std:c++20",
|
||||
"/Zc:__cplusplus",
|
||||
],
|
||||
"//conditions:default": ["-std=c++20"],
|
||||
})
|
||||
|
||||
V8_CUSTOM_LIBCXX_COPTS = select({
|
||||
":use_rusty_v8_custom_libcxx_native_windows": [
|
||||
"/D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
|
||||
"/D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE",
|
||||
"/D_LIBCPP_INSTRUMENTED_WITH_ASAN=0",
|
||||
],
|
||||
":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": [],
|
||||
})
|
||||
|
||||
V8_STATIC_LIBRARY_FEATURES = [
|
||||
"-symbol_check",
|
||||
"-validate-static-library",
|
||||
]
|
||||
|
||||
alias(
|
||||
name = "rusty_v8_llvm_libc_headers",
|
||||
actual = "@rusty_v8_llvm_libc//:v8_headers",
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "rusty_v8_custom_libcxx_headers",
|
||||
defines = select({
|
||||
"@llvm//platforms/config:linux_aarch64_musl": ["ANDROID_HOST_MUSL"],
|
||||
"@llvm//platforms/config:linux_x86_64_musl": ["ANDROID_HOST_MUSL"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["@rusty_v8_libcxx//:headers"] + select({
|
||||
":use_rusty_v8_custom_libcxx_native_windows": [],
|
||||
"//conditions:default": ["@rusty_v8_libcxxabi//:headers"],
|
||||
}),
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "rusty_v8_custom_libcxx_runtime",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["@rusty_v8_libcxx//:libcxx"] + select({
|
||||
":use_rusty_v8_custom_libcxx_native_windows": [],
|
||||
"//conditions:default": ["@rusty_v8_libcxxabi//:libcxxabi"],
|
||||
}),
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "binding_cc_152_2_0",
|
||||
srcs = ["@v8_crate_152_2_0//:binding_cc"],
|
||||
outs = ["binding_152_2_0.cc"],
|
||||
cmd = " ".join([
|
||||
"sed",
|
||||
"-e '/#include \"v8\\/src\\/flags\\/flags.h\"/d'",
|
||||
"-e 's|\"v8/src/libplatform/default-platform.h\"|\"src/libplatform/default-platform.h\"|'",
|
||||
"-e 's|#include \"support.h\"|#include \"support_152_2_0.h\"|'",
|
||||
"-e 's| namespace i = v8::internal;| (void)usage;|'",
|
||||
"-e '/using HelpOptions = i::FlagList::HelpOptions;/d'",
|
||||
"-e '/HelpOptions help_options = HelpOptions(HelpOptions::kExit, usage);/d'",
|
||||
"-e 's| i::FlagList::SetFlagsFromCommandLine(argc, argv, true, help_options);| v8::V8::SetFlagsFromCommandLine(argc, argv, true);|'",
|
||||
"$(location @v8_crate_152_2_0//:binding_cc)",
|
||||
">",
|
||||
'"$@"',
|
||||
]),
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "crdtp_binding_cc_152_2_0",
|
||||
srcs = ["@v8_crate_152_2_0//:crdtp_binding_cc"],
|
||||
outs = ["crdtp_binding_152_2_0.cc"],
|
||||
cmd = " ".join([
|
||||
"sed",
|
||||
"-e 's|#include \"support.h\"|#include \"support_152_2_0.h\"|'",
|
||||
"-e 's|\"v8/third_party/inspector_protocol/|\"third_party/inspector_protocol/|g'",
|
||||
"$(location @v8_crate_152_2_0//:crdtp_binding_cc)",
|
||||
">",
|
||||
'"$@"',
|
||||
]),
|
||||
)
|
||||
|
||||
copy_file(
|
||||
name = "support_h_152_2_0",
|
||||
src = "@v8_crate_152_2_0//:support_h",
|
||||
out = "support_152_2_0.h",
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "v8_152_2_0_binding",
|
||||
srcs = [
|
||||
":binding_cc_152_2_0",
|
||||
":crdtp_binding_cc_152_2_0",
|
||||
],
|
||||
hdrs = [":support_h_152_2_0"],
|
||||
copts = V8_COPTS + V8_CUSTOM_LIBCXX_COPTS,
|
||||
deps = [
|
||||
"@v8//:core_lib_icu",
|
||||
"@v8//:rusty_v8_crdtp_headers",
|
||||
"@v8//:rusty_v8_internal_headers",
|
||||
] + select({
|
||||
":use_rusty_v8_custom_libcxx": [
|
||||
":rusty_v8_custom_libcxx_headers",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "native_windows_compiler_builtins",
|
||||
actual = "@v8_native_windows_llvm//:builtins",
|
||||
tags = ["manual"],
|
||||
target_compatible_with = select({
|
||||
":platform_windows_msvc": [],
|
||||
"//conditions:default": ["@platforms//:incompatible"],
|
||||
}),
|
||||
)
|
||||
|
||||
# Compile the pinned Chromium libc++ into V8 with the Microsoft CRT.
|
||||
cc_static_library(
|
||||
name = "v8_152_2_0_native_windows_objects",
|
||||
features = V8_STATIC_LIBRARY_FEATURES,
|
||||
tags = ["manual"],
|
||||
target_compatible_with = select({
|
||||
":platform_windows_msvc": [],
|
||||
"//conditions:default": ["@platforms//:incompatible"],
|
||||
}),
|
||||
deps = [
|
||||
":rusty_v8_custom_libcxx_runtime",
|
||||
":v8_152_2_0_binding",
|
||||
],
|
||||
)
|
||||
|
||||
# cc_static_library only collects object files, not prebuilt libraries.
|
||||
# The Rust build script receives one .lib without Bazel's CcInfo/linkdeps, so
|
||||
# merge compiler-rt into the staged artifact explicitly.
|
||||
genrule(
|
||||
name = "v8_152_2_0_native_windows_library",
|
||||
srcs = [
|
||||
":v8_152_2_0_native_windows_objects",
|
||||
"@v8_native_windows_llvm//:builtins_archive",
|
||||
],
|
||||
outs = ["rusty_v8_native_windows.lib"],
|
||||
cmd_bat = '""$(location @v8_native_windows_llvm//:llvm-lib)" /NOLOGO /OUT:"$@" "$(location :v8_152_2_0_native_windows_objects)" "$(location @v8_native_windows_llvm//:builtins_archive)""',
|
||||
tags = ["manual"],
|
||||
target_compatible_with = [
|
||||
"@platforms//os:windows",
|
||||
"@llvm//constraints/windows/abi:msvc",
|
||||
],
|
||||
tools = ["@v8_native_windows_llvm//:llvm-lib"],
|
||||
)
|
||||
|
||||
[
|
||||
v8_artifact_files(
|
||||
name = "v8_152_2_0_%s_pc_windows_msvc_bazel" % arch,
|
||||
srcs = [":v8_152_2_0_native_windows_library"],
|
||||
profile = "sandbox_release",
|
||||
tags = ["manual"],
|
||||
target_compatible_with = [
|
||||
"@platforms//cpu:%s" % arch,
|
||||
"@platforms//os:windows",
|
||||
"@llvm//constraints/windows/abi:msvc",
|
||||
],
|
||||
v8_cpu = cpu,
|
||||
)
|
||||
for arch, cpu in [
|
||||
("x86_64", "x64"),
|
||||
("aarch64", "arm64"),
|
||||
]
|
||||
]
|
||||
|
||||
# Producer selectors never fall back to published inputs. Keep them separate
|
||||
# from the consumer aliases so a version upgrade can build before publishing.
|
||||
alias(
|
||||
name = "rusty_v8_native_windows_archive_for_target",
|
||||
actual = select({
|
||||
"@rules_rs//rs/platforms/config:aarch64-pc-windows-msvc": ":v8_152_2_0_aarch64_pc_windows_msvc_bazel",
|
||||
"@rules_rs//rs/platforms/config:x86_64-pc-windows-msvc": ":v8_152_2_0_x86_64_pc_windows_msvc_bazel",
|
||||
}),
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
# Bindgen reads the same CcInfo as the C++ archive. Pass local libc++ options
|
||||
# explicitly because CcInfo propagates defines and headers, but not copts.
|
||||
cc_library(
|
||||
name = "binding_headers_152_2_0",
|
||||
hdrs = [
|
||||
"@v8_crate_152_2_0//:binding_hpp",
|
||||
"@v8_crate_152_2_0//:support_h",
|
||||
],
|
||||
tags = ["manual"],
|
||||
# Bindgen asks the toolchain for C flags, which omit its C++ header search
|
||||
# paths. Source profiles use the workspace headers; release profiles get
|
||||
# their pinned Chromium headers from the profiled binding dependency.
|
||||
deps = [":v8_152_2_0_binding"] + select({
|
||||
":use_rusty_v8_custom_libcxx": [],
|
||||
"@platforms//os:osx": [],
|
||||
"//conditions:default": [
|
||||
"@llvm-project//libcxx:headers",
|
||||
"@llvm-project//libcxxabi:headers",
|
||||
],
|
||||
}),
|
||||
)
|
||||
|
||||
rust_bindgen(
|
||||
name = "binding_generated_152_2_0",
|
||||
bindgen_flags = [
|
||||
"--generate-cstr",
|
||||
"--rustified-enum=.*UseCounterFeature",
|
||||
"--rustified-enum=.*ModuleImportPhase",
|
||||
"--rustified-enum=.*Intercepted",
|
||||
"--bitfield-enum=.*GCType",
|
||||
"--bitfield-enum=.*GCCallbackFlags",
|
||||
"--allowlist-item=v8__.*",
|
||||
"--allowlist-item=cppgc__.*",
|
||||
"--allowlist-item=RustObj",
|
||||
"--allowlist-item=memory_span_t",
|
||||
"--allowlist-item=const_memory_span_t",
|
||||
"--allowlist-item=ExternalConstOneByteStringResource",
|
||||
"--blocklist-item=cppgc.*Visitor",
|
||||
"--blocklist-item=RustObj.*Trace",
|
||||
],
|
||||
cc_lib = ":binding_headers_152_2_0",
|
||||
clang_flags = [
|
||||
"-x",
|
||||
"c++",
|
||||
"-std=c++20",
|
||||
] + V8_CUSTOM_LIBCXX_COPTS + select({
|
||||
# Match the C++ toolchain. Bindgen asks for C flags and otherwise
|
||||
# enables C++20 modules, for which the macOS SDK's types are cyclic.
|
||||
"@platforms//os:osx": [
|
||||
"-Xclang",
|
||||
"-fno-cxx-modules",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
"@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_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_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"],
|
||||
)
|
||||
|
||||
v8_artifact_files(
|
||||
name = "src_binding_aarch64_pc_windows_msvc_152_2_0_bazel",
|
||||
srcs = [":binding_generated_152_2_0"],
|
||||
profile = "sandbox_release",
|
||||
tags = ["manual"],
|
||||
target_compatible_with = [
|
||||
"@platforms//cpu:aarch64",
|
||||
"@platforms//os:windows",
|
||||
"@llvm//constraints/windows/abi:msvc",
|
||||
],
|
||||
v8_cpu = "arm64",
|
||||
)
|
||||
|
||||
v8_artifact_files(
|
||||
name = "src_binding_x86_64_pc_windows_msvc_152_2_0_bazel",
|
||||
srcs = [":binding_generated_152_2_0"],
|
||||
profile = "sandbox_release",
|
||||
tags = ["manual"],
|
||||
target_compatible_with = [
|
||||
"@platforms//cpu:x86_64",
|
||||
"@platforms//os:windows",
|
||||
"@llvm//constraints/windows/abi:msvc",
|
||||
],
|
||||
v8_cpu = "x64",
|
||||
)
|
||||
|
||||
v8_artifact_files(
|
||||
name = "src_binding_aarch64_pc_windows_gnullvm_152_2_0_bazel",
|
||||
srcs = [":binding_generated_152_2_0"],
|
||||
profile = "source",
|
||||
tags = ["manual"],
|
||||
target_compatible_with = [
|
||||
"@platforms//cpu:aarch64",
|
||||
"@platforms//os:windows",
|
||||
"@llvm//constraints/windows/abi:gnullvm",
|
||||
],
|
||||
v8_cpu = "arm64",
|
||||
)
|
||||
|
||||
v8_artifact_files(
|
||||
name = "src_binding_x86_64_pc_windows_gnullvm_152_2_0_bazel",
|
||||
srcs = [":binding_generated_152_2_0"],
|
||||
profile = "source",
|
||||
tags = ["manual"],
|
||||
target_compatible_with = [
|
||||
"@platforms//cpu:x86_64",
|
||||
"@platforms//os:windows",
|
||||
"@llvm//constraints/windows/abi:gnullvm",
|
||||
],
|
||||
v8_cpu = "x64",
|
||||
)
|
||||
|
||||
v8_artifact_files(
|
||||
name = "src_binding_aarch64_apple_darwin_152_2_0_bazel",
|
||||
srcs = [":binding_generated_152_2_0"],
|
||||
profile = "source",
|
||||
tags = ["manual"],
|
||||
v8_cpu = "arm64",
|
||||
)
|
||||
|
||||
v8_artifact_files(
|
||||
name = "src_binding_x86_64_apple_darwin_152_2_0_bazel",
|
||||
srcs = [":binding_generated_152_2_0"],
|
||||
profile = "source",
|
||||
tags = ["manual"],
|
||||
v8_cpu = "x64",
|
||||
)
|
||||
|
||||
v8_artifact_files(
|
||||
name = "src_binding_aarch64_unknown_linux_gnu_152_2_0_bazel",
|
||||
srcs = [":binding_generated_152_2_0"],
|
||||
profile = "source",
|
||||
tags = ["manual"],
|
||||
v8_cpu = "arm64",
|
||||
)
|
||||
|
||||
v8_artifact_files(
|
||||
name = "src_binding_x86_64_unknown_linux_gnu_152_2_0_bazel",
|
||||
srcs = [":binding_generated_152_2_0"],
|
||||
profile = "source",
|
||||
tags = ["manual"],
|
||||
v8_cpu = "x64",
|
||||
)
|
||||
|
||||
v8_artifact_files(
|
||||
name = "src_binding_aarch64_unknown_linux_musl_152_2_0_bazel",
|
||||
srcs = [":binding_generated_152_2_0"],
|
||||
profile = "source",
|
||||
tags = ["manual"],
|
||||
v8_cpu = "arm64",
|
||||
)
|
||||
|
||||
v8_artifact_files(
|
||||
name = "src_binding_x86_64_unknown_linux_musl_152_2_0_bazel",
|
||||
srcs = [":binding_generated_152_2_0"],
|
||||
profile = "source",
|
||||
tags = ["manual"],
|
||||
v8_cpu = "x64",
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "rusty_v8_native_windows_binding_for_target",
|
||||
actual = select({
|
||||
"@rules_rs//rs/platforms/config:aarch64-pc-windows-msvc": ":src_binding_aarch64_pc_windows_msvc_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",
|
||||
}),
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
cc_static_library(
|
||||
name = "_v8_152_2_0_aarch64_apple_darwin_bazel",
|
||||
features = V8_STATIC_LIBRARY_FEATURES,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":rusty_v8_custom_libcxx_runtime",
|
||||
":v8_152_2_0_binding",
|
||||
],
|
||||
)
|
||||
|
||||
cc_static_library(
|
||||
name = "_v8_152_2_0_aarch64_unknown_linux_gnu_bazel_base",
|
||||
features = V8_STATIC_LIBRARY_FEATURES,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":rusty_v8_custom_libcxx_runtime",
|
||||
":v8_152_2_0_binding",
|
||||
],
|
||||
)
|
||||
|
||||
cc_static_library(
|
||||
name = "_v8_152_2_0_aarch64_pc_windows_gnullvm_bazel",
|
||||
features = V8_STATIC_LIBRARY_FEATURES,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [":v8_152_2_0_binding"],
|
||||
)
|
||||
|
||||
cc_static_library(
|
||||
name = "_v8_152_2_0_aarch64_unknown_linux_musl_release_base",
|
||||
features = V8_STATIC_LIBRARY_FEATURES,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":rusty_v8_custom_libcxx_runtime",
|
||||
":v8_152_2_0_binding",
|
||||
],
|
||||
)
|
||||
|
||||
# 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 = [
|
||||
":_v8_152_2_0_aarch64_unknown_linux_musl_release_base",
|
||||
"@llvm//runtimes/compiler-rt:clang_rt.builtins.static",
|
||||
],
|
||||
outs = ["libv8_152_2_0_aarch64_unknown_linux_musl.a"],
|
||||
cmd = '$(location @llvm//tools:llvm-ar) qcsL "$@" $(SRCS)',
|
||||
tools = ["@llvm//tools:llvm-ar"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
cc_static_library(
|
||||
name = "_v8_152_2_0_x86_64_apple_darwin_bazel",
|
||||
features = V8_STATIC_LIBRARY_FEATURES,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":rusty_v8_custom_libcxx_runtime",
|
||||
":v8_152_2_0_binding",
|
||||
],
|
||||
)
|
||||
|
||||
cc_static_library(
|
||||
name = "_v8_152_2_0_x86_64_unknown_linux_gnu_bazel",
|
||||
features = V8_STATIC_LIBRARY_FEATURES,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":rusty_v8_custom_libcxx_runtime",
|
||||
":v8_152_2_0_binding",
|
||||
],
|
||||
)
|
||||
|
||||
cc_static_library(
|
||||
name = "_v8_152_2_0_x86_64_pc_windows_gnullvm_bazel",
|
||||
features = V8_STATIC_LIBRARY_FEATURES,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [":v8_152_2_0_binding"],
|
||||
)
|
||||
|
||||
cc_static_library(
|
||||
name = "_v8_152_2_0_x86_64_unknown_linux_musl_release",
|
||||
features = V8_STATIC_LIBRARY_FEATURES,
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":rusty_v8_custom_libcxx_runtime",
|
||||
":v8_152_2_0_binding",
|
||||
],
|
||||
)
|
||||
|
||||
# Local source producers match the Rust consumer's sandbox ABI, and use the
|
||||
# workspace C++ runtime. Release pairs below select pinned Chromium libc++ and
|
||||
# build the private source nodes directly under their own profiles.
|
||||
[
|
||||
v8_artifact_files(
|
||||
name = name,
|
||||
srcs = [":_" + name],
|
||||
profile = "source",
|
||||
v8_cpu = cpu,
|
||||
)
|
||||
for name, cpu in [
|
||||
("v8_152_2_0_aarch64_apple_darwin_bazel", "arm64"),
|
||||
("v8_152_2_0_aarch64_unknown_linux_gnu_bazel", "arm64"),
|
||||
("v8_152_2_0_aarch64_pc_windows_gnullvm_bazel", "arm64"),
|
||||
("v8_152_2_0_aarch64_unknown_linux_musl_release", "arm64"),
|
||||
("v8_152_2_0_x86_64_apple_darwin_bazel", "x64"),
|
||||
("v8_152_2_0_x86_64_unknown_linux_gnu_bazel", "x64"),
|
||||
("v8_152_2_0_x86_64_pc_windows_gnullvm_bazel", "x64"),
|
||||
("v8_152_2_0_x86_64_unknown_linux_musl_release", "x64"),
|
||||
]
|
||||
]
|
||||
|
||||
v8_artifact_files(
|
||||
name = "rusty_v8_release_pair_x86_64_apple_darwin",
|
||||
srcs = [
|
||||
":_v8_152_2_0_x86_64_apple_darwin_bazel",
|
||||
":binding_generated_152_2_0",
|
||||
],
|
||||
profile = "release",
|
||||
v8_cpu = "x64",
|
||||
)
|
||||
|
||||
v8_artifact_files(
|
||||
name = "rusty_v8_release_pair_aarch64_apple_darwin",
|
||||
srcs = [
|
||||
":_v8_152_2_0_aarch64_apple_darwin_bazel",
|
||||
":binding_generated_152_2_0",
|
||||
],
|
||||
profile = "release",
|
||||
v8_cpu = "arm64",
|
||||
)
|
||||
|
||||
v8_artifact_files(
|
||||
name = "rusty_v8_release_pair_x86_64_unknown_linux_gnu",
|
||||
srcs = [
|
||||
":_v8_152_2_0_x86_64_unknown_linux_gnu_bazel",
|
||||
":binding_generated_152_2_0",
|
||||
],
|
||||
profile = "release",
|
||||
v8_cpu = "x64",
|
||||
)
|
||||
|
||||
v8_artifact_files(
|
||||
name = "rusty_v8_release_pair_aarch64_unknown_linux_gnu",
|
||||
srcs = [
|
||||
":_v8_152_2_0_aarch64_unknown_linux_gnu_bazel",
|
||||
":binding_generated_152_2_0",
|
||||
],
|
||||
profile = "release",
|
||||
v8_cpu = "arm64",
|
||||
)
|
||||
|
||||
v8_artifact_files(
|
||||
name = "rusty_v8_release_pair_x86_64_unknown_linux_musl",
|
||||
srcs = [
|
||||
":_v8_152_2_0_x86_64_unknown_linux_musl_release",
|
||||
":binding_generated_152_2_0",
|
||||
],
|
||||
profile = "release",
|
||||
v8_cpu = "x64",
|
||||
)
|
||||
|
||||
v8_artifact_files(
|
||||
name = "rusty_v8_release_pair_aarch64_unknown_linux_musl",
|
||||
srcs = [
|
||||
":_v8_152_2_0_aarch64_unknown_linux_musl_release",
|
||||
":binding_generated_152_2_0",
|
||||
],
|
||||
profile = "release",
|
||||
v8_cpu = "arm64",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "rusty_v8_release_pair_x86_64_pc_windows_msvc",
|
||||
srcs = [
|
||||
":v8_152_2_0_x86_64_pc_windows_msvc",
|
||||
"@rusty_v8_152_2_0_x86_64_pc_windows_msvc_binding//file",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "rusty_v8_release_pair_aarch64_pc_windows_msvc",
|
||||
srcs = [
|
||||
":v8_152_2_0_aarch64_pc_windows_msvc",
|
||||
"@rusty_v8_152_2_0_aarch64_pc_windows_msvc_binding//file",
|
||||
],
|
||||
)
|
||||
|
||||
v8_artifact_files(
|
||||
name = "rusty_v8_sandbox_release_pair_x86_64_apple_darwin",
|
||||
srcs = [
|
||||
":_v8_152_2_0_x86_64_apple_darwin_bazel",
|
||||
":binding_generated_152_2_0",
|
||||
],
|
||||
profile = "sandbox_release",
|
||||
v8_cpu = "x64",
|
||||
)
|
||||
|
||||
v8_artifact_files(
|
||||
name = "rusty_v8_sandbox_release_pair_aarch64_apple_darwin",
|
||||
srcs = [
|
||||
":_v8_152_2_0_aarch64_apple_darwin_bazel",
|
||||
":binding_generated_152_2_0",
|
||||
],
|
||||
profile = "sandbox_release",
|
||||
v8_cpu = "arm64",
|
||||
)
|
||||
|
||||
v8_artifact_files(
|
||||
name = "rusty_v8_sandbox_release_pair_x86_64_unknown_linux_gnu",
|
||||
srcs = [
|
||||
":_v8_152_2_0_x86_64_unknown_linux_gnu_bazel",
|
||||
":binding_generated_152_2_0",
|
||||
],
|
||||
profile = "sandbox_release",
|
||||
v8_cpu = "x64",
|
||||
)
|
||||
|
||||
v8_artifact_files(
|
||||
name = "rusty_v8_sandbox_release_pair_aarch64_unknown_linux_gnu",
|
||||
srcs = [
|
||||
":_v8_152_2_0_aarch64_unknown_linux_gnu_bazel",
|
||||
":binding_generated_152_2_0",
|
||||
],
|
||||
profile = "sandbox_release",
|
||||
v8_cpu = "arm64",
|
||||
)
|
||||
|
||||
v8_artifact_files(
|
||||
name = "rusty_v8_sandbox_release_pair_x86_64_unknown_linux_musl",
|
||||
srcs = [
|
||||
":_v8_152_2_0_x86_64_unknown_linux_musl_release",
|
||||
":binding_generated_152_2_0",
|
||||
],
|
||||
profile = "sandbox_release",
|
||||
v8_cpu = "x64",
|
||||
)
|
||||
|
||||
v8_artifact_files(
|
||||
name = "rusty_v8_sandbox_release_pair_aarch64_unknown_linux_musl",
|
||||
srcs = [
|
||||
":_v8_152_2_0_aarch64_unknown_linux_musl_release",
|
||||
":binding_generated_152_2_0",
|
||||
],
|
||||
profile = "sandbox_release",
|
||||
v8_cpu = "arm64",
|
||||
)
|
||||
271
third_party/v8/README.md
vendored
Normal file
271
third_party/v8/README.md
vendored
Normal file
@@ -0,0 +1,271 @@
|
||||
# `rusty_v8` Consumer Artifacts
|
||||
|
||||
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:
|
||||
|
||||
- `//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.
|
||||
|
||||
Source targets enforce the workspace runtime and sandbox/pointer-compression
|
||||
ABI. Release-pair targets enforce either the legacy or sandbox ABI plus
|
||||
Chromium's pinned runtime. Target CPU follows the named artifact. These V8
|
||||
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 builds: `15.2.124.1`
|
||||
|
||||
## Updating to a new `v8` release
|
||||
|
||||
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` and the source pins
|
||||
in `third_party/v8/dependencies.bzl` and `abseil_repository.bzl` using
|
||||
[the source dependency update procedure](#updating-source-dependencies).
|
||||
Verify the imported source groups by querying the source archive and generating Torque
|
||||
and snapshots for each supported platform. If V8 changes its BUILD section
|
||||
layout, the importer fails instead of silently using an old inventory;
|
||||
update that boundary and review its fixed feature and CPU selections.
|
||||
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
|
||||
their SHA-256 digests in
|
||||
`third_party/v8/rusty_v8_<version>_release_manifests.sha256`.
|
||||
6. Once the release build completes, rerun the build on the candidate branch
|
||||
and verify that the final artifact builds and tests pass.
|
||||
|
||||
When changing the prebuilt `rusty_v8` `http_file` inputs, keep the
|
||||
checked-in checksum manifest and `MODULE.bazel` in sync:
|
||||
|
||||
```bash
|
||||
python3 .github/scripts/rusty_v8_bazel.py update-module-bazel
|
||||
python3 .github/scripts/rusty_v8_bazel.py check-module-bazel
|
||||
```
|
||||
|
||||
For all eight published pairs, verify each published
|
||||
`rusty_v8_ptrcomp_sandbox_release_<target>.sha256` against the committed
|
||||
`rusty_v8_<version>_release_manifests.sha256` first. Copy the verified archive
|
||||
and binding checksums into `rusty_v8_<version>.sha256`, then run these
|
||||
commands. They validate every matching `http_file` entry, and CI blocks
|
||||
checksum drift.
|
||||
|
||||
Published release assets are expected at the tag:
|
||||
|
||||
- `rusty-v8-v<crate_version>`
|
||||
|
||||
with these raw asset names:
|
||||
|
||||
- `librusty_v8_release_<target>.a.gz`
|
||||
- `src_binding_release_<target>.rs`
|
||||
|
||||
During the sandbox rollout, sandbox-enabled assets are published alongside those
|
||||
current assets on the same tag, with the Rust crate's sandbox feature suffix in
|
||||
their raw names:
|
||||
|
||||
- `librusty_v8_ptrcomp_sandbox_release_<target>.a.gz`
|
||||
- `rusty_v8_ptrcomp_sandbox_release_<target>.lib.gz` on Windows MSVC
|
||||
- `src_binding_ptrcomp_sandbox_release_<target>.rs`
|
||||
|
||||
The dedicated publishing workflow is `.github/workflows/rusty-v8-release.yml`.
|
||||
Tagged runs build release artifacts from the Bazel graph itself:
|
||||
|
||||
- `//third_party/v8:rusty_v8_release_pair_x86_64_apple_darwin`
|
||||
- `//third_party/v8:rusty_v8_release_pair_aarch64_apple_darwin`
|
||||
- `//third_party/v8:rusty_v8_release_pair_x86_64_unknown_linux_gnu`
|
||||
- `//third_party/v8:rusty_v8_release_pair_aarch64_unknown_linux_gnu`
|
||||
- `//third_party/v8:rusty_v8_release_pair_x86_64_unknown_linux_musl`
|
||||
- `//third_party/v8:rusty_v8_release_pair_aarch64_unknown_linux_musl`
|
||||
|
||||
The same run also builds the matching sandbox pair targets:
|
||||
|
||||
- `//third_party/v8:rusty_v8_sandbox_release_pair_x86_64_apple_darwin`
|
||||
- `//third_party/v8:rusty_v8_sandbox_release_pair_aarch64_apple_darwin`
|
||||
- `//third_party/v8:rusty_v8_sandbox_release_pair_x86_64_unknown_linux_gnu`
|
||||
- `//third_party/v8:rusty_v8_sandbox_release_pair_aarch64_unknown_linux_gnu`
|
||||
- `//third_party/v8:rusty_v8_sandbox_release_pair_x86_64_unknown_linux_musl`
|
||||
- `//third_party/v8:rusty_v8_sandbox_release_pair_aarch64_unknown_linux_musl`
|
||||
|
||||
The workflow also builds sandbox-enabled
|
||||
`x86_64-pc-windows-msvc` and `aarch64-pc-windows-msvc` archive/binding pairs
|
||||
from upstream `rusty_v8` source. Those ABI-specific outputs cannot be produced
|
||||
by Codex's Bazel Windows GNU toolchain.
|
||||
|
||||
The Bazel graph pins the same libc++, libc++abi, and llvm-libc source revisions
|
||||
used by `rusty_v8 v152.2.0`. The named release and sandbox-release pair targets
|
||||
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. 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;
|
||||
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 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
|
||||
`//third_party/v8:v8_152_2_0_x86_64_pc_windows_msvc_bazel` and
|
||||
`//third_party/v8:v8_152_2_0_aarch64_pc_windows_msvc_bazel`.
|
||||
The producer selectors `//third_party/v8:rusty_v8_native_windows_archive_for_target`
|
||||
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. 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,
|
||||
and external TypedArray backing stores. Other source targets retain the published
|
||||
Unix policy, including a 64-byte inline TypedArray threshold. Generated Rust
|
||||
bindings use that same threshold; never pair a native 64-byte threshold with
|
||||
GN's size-zero binding constant. These are fixed platform choices, not additional
|
||||
developer build switches.
|
||||
|
||||
Use a native Visual Studio Developer PowerShell with the C++ tools and Windows
|
||||
SDK available. The SDK supplies headers, libraries, `dumpbin.exe`, and the
|
||||
assembler. From the repo root, build the archive for that host:
|
||||
|
||||
```powershell
|
||||
bazel build --config=ci-windows-msvc `
|
||||
--host_platform=//:local_windows_msvc --platforms=//:local_windows_msvc `
|
||||
//third_party/v8:rusty_v8_native_windows_archive_for_target `
|
||||
//third_party/v8:rusty_v8_native_windows_binding_for_target
|
||||
```
|
||||
|
||||
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. 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
|
||||
inputs pinned in #4009 are MSVC/SDK files, not a registered clang-cl toolchain;
|
||||
making them replace the installed SDK is the separate hermetic MSVC migration.
|
||||
|
||||
Release and CI Cargo builds for Darwin and Linux use `RUSTY_V8_ARCHIVE` plus a
|
||||
downloaded `RUSTY_V8_SRC_BINDING_PATH` to point at those `openai/codex` release
|
||||
assets directly. We do not use `RUSTY_V8_MIRROR` because the upstream `v8` crate
|
||||
hardcodes a `v<crate_version>` tag layout, while our artifacts are published
|
||||
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 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.
|
||||
|
||||
`engine_repository.bzl` fetches the V8 source pin and installs Codex's engine
|
||||
BUILD into `@v8`. Source filegroups are read from the pinned upstream BUILD
|
||||
each fetch, including added, removed or reordered groups. The importer rejects
|
||||
missing boundaries, malformed or empty sections, and new compiled targets. Only
|
||||
the two known Dragonbox and FP16 declarations are skipped, since the dependency
|
||||
overlays already supply them. `v8_binary` is valid V8 syntax, but compiled targets
|
||||
must be reviewed against the owned engine BUILD on an upgrade.
|
||||
The upstream `bazel/config` platform and CPU package is reused; only the CPU
|
||||
setting changes from a CLI flag to an internal setting. `v8_defs.patch` records
|
||||
that change and the Codex differences to upstream's `bazel/defs.bzl`:
|
||||
internal ABI/runtime settings, their visibility, libc++ headers/runtime, Windows
|
||||
compiler and linker settings, and snapshot generation. All engine rules,
|
||||
including Torque and V8's test configuration helpers, load from that file.
|
||||
The engine BUILD owns feature policy and dependency targets. ABI, runtime and
|
||||
CPU settings are selected together by `artifact_profile.bzl` for source and
|
||||
release-pair targets.
|
||||
|
||||
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` `engine_repository(name = "v8")`
|
||||
(currently `15.2.124.1`) as the input. Read that tag's **unpatched** `DEPS`
|
||||
and `MODULE.bazel`; `@v8` deliberately does not include upstream's MODULE.
|
||||
On an upgrade, also review `v8_defs.patch` against the new `bazel/defs.bzl`
|
||||
and run the V8 source canary. A cleanly applying patch does not by itself
|
||||
verify new upstream defaults or code-generation behavior.
|
||||
|
||||
```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.
|
||||
294
third_party/v8/abseil.BUILD.bazel
vendored
Normal file
294
third_party/v8/abseil.BUILD.bazel
vendored
Normal file
@@ -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",
|
||||
],
|
||||
)
|
||||
57
third_party/v8/abseil_repository.bzl
vendored
Normal file
57
third_party/v8/abseil_repository.bzl
vendored
Normal file
@@ -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,
|
||||
),
|
||||
},
|
||||
)
|
||||
95
third_party/v8/artifact_profile.bzl
vendored
Normal file
95
third_party/v8/artifact_profile.bzl
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
"""Complete V8 artifact profiles, enforced at the source archive boundary.
|
||||
|
||||
The source profile is for local consumers and uses the workspace C++ runtime.
|
||||
Published profiles embed the pinned Chromium runtime. Generators inherit the
|
||||
V8 target CPU even when their executable is built for the exec platform.
|
||||
"""
|
||||
|
||||
_POINTER_COMPRESSION = "@v8//:v8_enable_pointer_compression"
|
||||
_SANDBOX = "@v8//:v8_enable_sandbox"
|
||||
_LIBCXX = "@v8//:v8_use_rusty_v8_custom_libcxx"
|
||||
_TARGET_CPU = "@v8//bazel/config:v8_target_cpu"
|
||||
_TOOLCHAINS = "//command_line_option:extra_toolchains"
|
||||
_NATIVE_WINDOWS_TOOLCHAINS = [
|
||||
str(Label("@v8_native_windows_cc//:cc-toolchain-x64_windows")),
|
||||
str(Label("@v8_native_windows_cc//:cc-toolchain-arm64_windows")),
|
||||
]
|
||||
_CPU_CONSTRAINTS = {
|
||||
"arm64": Label("@platforms//cpu:aarch64"),
|
||||
"x64": Label("@platforms//cpu:x86_64"),
|
||||
}
|
||||
|
||||
def _artifact_profile_impl(settings, attr):
|
||||
sandbox = attr.profile != "release"
|
||||
return {
|
||||
_POINTER_COMPRESSION: "True" if sandbox else "False",
|
||||
_SANDBOX: sandbox,
|
||||
_LIBCXX: attr.profile != "source",
|
||||
_TARGET_CPU: attr.v8_cpu,
|
||||
# Select clang-cl only below the V8 archive/binding boundary. Keep the
|
||||
# caller's toolchains (including the ordinary MSVC compiler) elsewhere.
|
||||
_TOOLCHAINS: settings[_TOOLCHAINS] + (_NATIVE_WINDOWS_TOOLCHAINS if attr.native_windows else []),
|
||||
}
|
||||
|
||||
_artifact_profile = transition(
|
||||
implementation = _artifact_profile_impl,
|
||||
inputs = [_TOOLCHAINS],
|
||||
outputs = [_POINTER_COMPRESSION, _SANDBOX, _LIBCXX, _TARGET_CPU, _TOOLCHAINS],
|
||||
)
|
||||
|
||||
def _profiled_files_impl(ctx):
|
||||
constraint_target = ctx.attr._arm64 if ctx.attr.v8_cpu == "arm64" else ctx.attr._x64
|
||||
if not ctx.target_platform_has_constraint(constraint_target[platform_common.ConstraintValueInfo]):
|
||||
fail("%s: V8 CPU %s requires %s on the Bazel target platform. Choose a matching artifact target and --platforms." % (
|
||||
ctx.label,
|
||||
ctx.attr.v8_cpu,
|
||||
constraint_target.label,
|
||||
))
|
||||
files = depset(transitive = [target[DefaultInfo].files for target in ctx.attr.srcs])
|
||||
runfiles = ctx.runfiles().merge_all([
|
||||
target[DefaultInfo].default_runfiles
|
||||
for target in ctx.attr.srcs
|
||||
])
|
||||
return [DefaultInfo(files = files, runfiles = runfiles)]
|
||||
|
||||
_v8_artifact_files = rule(
|
||||
implementation = _profiled_files_impl,
|
||||
doc = "Build a source archive or release pair under its named V8 profile.",
|
||||
attrs = {
|
||||
"native_windows": attr.bool(mandatory = True),
|
||||
"profile": attr.string(
|
||||
mandatory = True,
|
||||
values = ["source", "release", "sandbox_release"],
|
||||
),
|
||||
"srcs": attr.label_list(allow_files = True, cfg = _artifact_profile, mandatory = True),
|
||||
"v8_cpu": attr.string(mandatory = True, values = ["arm64", "x64"]),
|
||||
"_allowlist_function_transition": attr.label(
|
||||
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
|
||||
),
|
||||
"_arm64": attr.label(default = _CPU_CONSTRAINTS["arm64"]),
|
||||
"_x64": attr.label(default = _CPU_CONSTRAINTS["x64"]),
|
||||
},
|
||||
)
|
||||
|
||||
def v8_artifact_files(name, v8_cpu, **kwargs):
|
||||
"""Declare an artifact that is only valid for its requested CPU.
|
||||
|
||||
Fixed-CPU targets without explicit platform constraints can be skipped in
|
||||
wildcard builds. Preserve constraints on targets such as native Windows
|
||||
which already specify their CPU and ABI. The rule checks the resolved CPU
|
||||
in both cases, including values chosen by select().
|
||||
The generator exec platform remains independent of this target constraint.
|
||||
"""
|
||||
if type(v8_cpu) == "string":
|
||||
kwargs.setdefault("target_compatible_with", [_CPU_CONSTRAINTS[v8_cpu]])
|
||||
_v8_artifact_files(
|
||||
name = name,
|
||||
# Derived from the target platform; callers cannot set this knob.
|
||||
native_windows = select({
|
||||
"@rules_rs//rs/platforms/config:aarch64-pc-windows-msvc": True,
|
||||
"@rules_rs//rs/platforms/config:x86_64-pc-windows-msvc": True,
|
||||
"//conditions:default": False,
|
||||
}),
|
||||
v8_cpu = v8_cpu,
|
||||
**kwargs
|
||||
)
|
||||
73
third_party/v8/dependencies.bzl
vendored
Normal file
73
third_party/v8/dependencies.bzl
vendored
Normal file
@@ -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)
|
||||
28
third_party/v8/dependency_config.bzl
vendored
Normal file
28
third_party/v8/dependency_config.bzl
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
"""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_native_windows": [
|
||||
"/D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
|
||||
"/D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE",
|
||||
"/D_LIBCPP_INSTRUMENTED_WITH_ASAN=0",
|
||||
],
|
||||
"@@//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": [],
|
||||
})
|
||||
11
third_party/v8/dragonbox.BUILD.bazel
vendored
Normal file
11
third_party/v8/dragonbox.BUILD.bazel
vendored
Normal file
@@ -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"],
|
||||
)
|
||||
981
third_party/v8/engine.BUILD.bazel
vendored
Normal file
981
third_party/v8/engine.BUILD.bazel
vendored
Normal file
@@ -0,0 +1,981 @@
|
||||
# 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.
|
||||
|
||||
load("@@//third_party/v8:engine_rules.bzl", "v8_build_config", "v8_fixed_source_features")
|
||||
load("@bazel_skylib//lib:selects.bzl", "selects")
|
||||
load("@rules_cc//cc:cc_library.bzl", "cc_library")
|
||||
load("@rules_python//python:defs.bzl", "py_binary", "py_test")
|
||||
load(
|
||||
"@v8//:bazel/defs.bzl",
|
||||
"v8_binary",
|
||||
"v8_config",
|
||||
"v8_flag",
|
||||
"v8_library",
|
||||
"v8_mksnapshot",
|
||||
"v8_string",
|
||||
"v8_torque_files",
|
||||
)
|
||||
load("@v8//:bazel/v8-non-pointer-compression.bzl", "v8_binary_non_pointer_compression")
|
||||
load("@v8_python_deps//:requirements.bzl", "requirement")
|
||||
|
||||
# Used by the Codex-owned pip hub; pin changes travel with the V8 source.
|
||||
exports_files(["bazel/requirements.txt"])
|
||||
|
||||
# Codex V8 source policy. Only ABI, runtime and target CPU vary, selected by
|
||||
# artifact profiles. CPU selection lives in bazel/config.
|
||||
# Platform feature choices preserve the published Bazel Unix and GN MSVC builds.
|
||||
# ICU and no-ICU remain separate targets for the engine and its generators.
|
||||
v8_flag(name = "v8_enable_sandbox")
|
||||
|
||||
v8_flag(name = "v8_use_rusty_v8_custom_libcxx")
|
||||
|
||||
# Maglev is supported on the two architectures shipped by Codex. Keep the
|
||||
# architecture tests separate from feature policy for host-tool transitions.
|
||||
selects.config_setting_group(
|
||||
name = "enable_maglev",
|
||||
match_any = [
|
||||
"@v8//bazel/config:v8_target_x64",
|
||||
"@v8//bazel/config:v8_target_arm64",
|
||||
],
|
||||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "enable_maglev_x64",
|
||||
match_all = [
|
||||
":enable_maglev",
|
||||
"@v8//bazel/config:v8_target_x64",
|
||||
],
|
||||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "enable_maglev_arm64",
|
||||
match_all = [
|
||||
":enable_maglev",
|
||||
"@v8//bazel/config:v8_target_arm64",
|
||||
],
|
||||
)
|
||||
|
||||
# WebAssembly remains enabled; its source implementation still depends on OS.
|
||||
selects.config_setting_group(
|
||||
name = "webassembly_on_posix",
|
||||
match_any = ["@v8//bazel/config:is_posix"],
|
||||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "webassembly_on_windows",
|
||||
match_any = ["@v8//bazel/config:is_windows"],
|
||||
)
|
||||
|
||||
# Artifact transitions set True or False, never the upstream "none" auto mode.
|
||||
# The 32-bit Torque helper can also force this off.
|
||||
v8_string(
|
||||
name = "v8_enable_pointer_compression",
|
||||
default = "False",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "is_v8_enable_pointer_compression",
|
||||
flag_values = {":v8_enable_pointer_compression": "True"},
|
||||
)
|
||||
|
||||
# V8's pinned default short-call policy differs on x64 and arm64. In particular
|
||||
# the legacy arm64 non-pointer-compressed profile still uses short calls.
|
||||
selects.config_setting_group(
|
||||
name = "v8_target_x64_default_short_builtin_calls",
|
||||
match_all = [
|
||||
"@v8//bazel/config:v8_target_x64",
|
||||
":is_v8_enable_pointer_compression",
|
||||
],
|
||||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "v8_target_arm64_default_short_builtin_calls",
|
||||
match_all = [
|
||||
"@v8//bazel/config:v8_target_arm64",
|
||||
"@v8//bazel/config:is_not_android",
|
||||
],
|
||||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "is_v8_enable_short_builtin_calls",
|
||||
match_any = [
|
||||
":v8_target_x64_default_short_builtin_calls",
|
||||
":v8_target_arm64_default_short_builtin_calls",
|
||||
],
|
||||
)
|
||||
|
||||
# Fixed V8 15.2 Codex feature contract: TurboFan and WebAssembly enabled;
|
||||
# experiments, VTune and profiling disabled. Do not hard-code ABI-sensitive
|
||||
# values such as sandbox, pointer compression or target CPU into this baseline.
|
||||
v8_config(
|
||||
name = "define_flags",
|
||||
conditional_defines = {"v8_enable_sandbox": "V8_ENABLE_SANDBOX"},
|
||||
defines = [
|
||||
"V8_DEPRECATION_WARNINGS",
|
||||
"V8_ENABLE_LAZY_SOURCE_POSITIONS",
|
||||
"V8_ENABLE_TURBOFAN",
|
||||
"V8_ENABLE_WEBASSEMBLY",
|
||||
"V8_ENABLE_UNDEFINED_DOUBLE",
|
||||
"V8_USE_HOST_CPU_ARM_FEATURES",
|
||||
] + [
|
||||
"GOOGLE3",
|
||||
"V8_ADVANCED_BIGINT_ALGORITHMS",
|
||||
"V8_CONCURRENT_MARKING",
|
||||
"V8_ENABLE_SPARKPLUG",
|
||||
"V8_ENABLE_EXTENSIBLE_RO_SNAPSHOT",
|
||||
"V8_ENABLE_CONTINUATION_PRESERVED_EMBEDDER_DATA",
|
||||
"V8_TLS_USED_IN_LIBRARY",
|
||||
] + select({
|
||||
# The published MSVC artifacts used GN's CppGC queue and Wasm fuzzers.
|
||||
# Keep these choices in the owned policy, including snapshot generators.
|
||||
"@@//third_party/v8:platform_windows_msvc": [
|
||||
"V8_CPPGC_MICROTASK_QUEUE",
|
||||
"V8_WASM_RANDOM_FUZZERS",
|
||||
"V8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=0",
|
||||
],
|
||||
"//conditions:default": [
|
||||
"V8_IMMINENT_DEPRECATION_WARNINGS",
|
||||
"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_LOGGING_LEVEL=2",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
"@v8//bazel/config:asan_enabled": ["V8_USE_ADDRESS_SANITIZER"],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
"@v8//bazel/config:hwasan_enabled": ["V8_USE_HWADDRESS_SANITIZER"],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
"@v8//bazel/config:msan_enabled": ["V8_USE_MEMORY_SANITIZER"],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
"@v8//bazel/config:ubsan_enabled": ["V8_USE_UNDEFINED_BEHAVIOR_SANITIZER"],
|
||||
"//conditions:default": [],
|
||||
}) + select(
|
||||
{
|
||||
"@v8//bazel/config:v8_target_ia32": ["V8_TARGET_ARCH_IA32"],
|
||||
"@v8//bazel/config:v8_target_x64": [
|
||||
"V8_TARGET_ARCH_X64",
|
||||
"V8_ENABLE_SPARKPLUG_PLUS",
|
||||
],
|
||||
"@v8//bazel/config:v8_target_arm": [
|
||||
"V8_TARGET_ARCH_ARM",
|
||||
"CAN_USE_ARMV7_INSTRUCTIONS",
|
||||
"CAN_USE_VFP3_INSTRUCTIONS",
|
||||
],
|
||||
"@v8//bazel/config:v8_target_arm64": [
|
||||
"V8_TARGET_ARCH_ARM64",
|
||||
"V8_ENABLE_SPARKPLUG_PLUS",
|
||||
],
|
||||
"@v8//bazel/config:v8_target_s390x": [
|
||||
"V8_TARGET_ARCH_S390X",
|
||||
],
|
||||
"@v8//bazel/config:v8_target_riscv64": [
|
||||
# NOTE: Bazel rules for riscv64 weren't tested on a real system.
|
||||
"V8_TARGET_ARCH_RISCV64",
|
||||
"CAN_USE_FPU_INSTRUCTIONS",
|
||||
],
|
||||
"@v8//bazel/config:v8_target_ppc64le": [
|
||||
# NOTE: Bazel rules for ppc64le weren't tested on a real system.
|
||||
"V8_TARGET_ARCH_PPC64",
|
||||
],
|
||||
},
|
||||
no_match_error = "Please specify a target cpu supported by v8",
|
||||
) + select({
|
||||
"@v8//bazel/config:is_android": [
|
||||
"V8_HAVE_TARGET_OS",
|
||||
"V8_TARGET_OS_ANDROID",
|
||||
],
|
||||
"@v8//bazel/config:is_linux": [
|
||||
"V8_HAVE_TARGET_OS",
|
||||
"V8_TARGET_OS_LINUX",
|
||||
],
|
||||
"@v8//bazel/config:is_macos": [
|
||||
"V8_HAVE_TARGET_OS",
|
||||
"V8_TARGET_OS_MACOS",
|
||||
],
|
||||
"@v8//bazel/config:is_windows": [
|
||||
"V8_HAVE_TARGET_OS",
|
||||
"V8_TARGET_OS_WIN",
|
||||
"UNICODE",
|
||||
"_UNICODE",
|
||||
"_CRT_RAND_S",
|
||||
"_WIN32_WINNT=0x0A00",
|
||||
],
|
||||
}) + select({
|
||||
":is_v8_enable_pointer_compression": [
|
||||
"V8_COMPRESS_POINTERS",
|
||||
"V8_31BIT_SMIS_ON_64BIT_ARCH",
|
||||
"V8_CONTIGUOUS_COMPRESSED_RO_SPACE",
|
||||
"V8_CONTIGUOUS_COMPRESSED_RO_SPACE_SIZE_MB=8",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
":is_v8_enable_pointer_compression": [
|
||||
"V8_COMPRESS_POINTERS_IN_SHARED_CAGE",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
":is_v8_enable_short_builtin_calls": [
|
||||
"V8_SHORT_BUILTIN_CALLS",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
":is_v8_enable_pointer_compression": [
|
||||
"V8_EXTERNAL_CODE_SPACE",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
":is_v8_enable_pointer_compression": [
|
||||
"V8_STATIC_ROOTS",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
":enable_maglev": [
|
||||
"V8_ENABLE_MAGLEV",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + [] + [],
|
||||
deps = [],
|
||||
)
|
||||
|
||||
# Source inventory and dependency aliases.
|
||||
|
||||
# The imported groups retain upstream select names. They express our pinned
|
||||
# feature contract here; only CPU, ABI and the C++ runtime actually vary.
|
||||
v8_fixed_source_features(
|
||||
name = "pinned_source_features",
|
||||
build_setting_default = True,
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "is_v8_enable_webassembly",
|
||||
flag_values = {":pinned_source_features": "True"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "disabled_pinned_source_feature",
|
||||
flag_values = {":pinned_source_features": "False"},
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "enable_drumbrake_arm64",
|
||||
actual = ":disabled_pinned_source_feature",
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "enable_drumbrake_x64",
|
||||
actual = ":disabled_pinned_source_feature",
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "enable_maglev_arm",
|
||||
actual = ":disabled_pinned_source_feature",
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "enable_maglev_riscv",
|
||||
actual = ":disabled_pinned_source_feature",
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "is_v8_enable_drumbrake",
|
||||
actual = ":disabled_pinned_source_feature",
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "is_v8_enable_experimental_tq_to_tsa",
|
||||
actual = ":disabled_pinned_source_feature",
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "is_v8_wasm_random_fuzzers",
|
||||
actual = "@@//third_party/v8:platform_windows_msvc",
|
||||
)
|
||||
|
||||
# @CODEX_V8_UPSTREAM_FILEGROUPS@
|
||||
|
||||
filegroup(
|
||||
name = "windows_x64_stack_assembly",
|
||||
# The import preserves upstream MASM; only GNU builds use our GAS source.
|
||||
srcs = select({
|
||||
"@@//third_party/v8:platform_windows_msvc": ["src/heap/base/asm/x64/push_registers_masm.asm"],
|
||||
"//conditions:default": ["@@//third_party/v8:push_registers_gnullvm.S"],
|
||||
}),
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "lib_dragonbox",
|
||||
actual = "@v8_dragonbox//:dragonbox",
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "lib_fp16",
|
||||
actual = "@v8_fp16//:fp16",
|
||||
)
|
||||
|
||||
# Generated files
|
||||
|
||||
# Define file groups for torque definitions and initializers. Both are
|
||||
# generated together, but we can use output_group to split them.
|
||||
filegroup(
|
||||
name = "icu/generated_torque_definitions",
|
||||
srcs = [":icu/generated_torque_files"],
|
||||
output_group = "definitions",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "noicu/generated_torque_definitions",
|
||||
srcs = [":noicu/generated_torque_files"],
|
||||
output_group = "definitions",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "icu/generated_torque_initializers",
|
||||
srcs = [":icu/generated_torque_files"],
|
||||
output_group = "initializers",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "noicu/generated_torque_initializers",
|
||||
srcs = [":noicu/generated_torque_files"],
|
||||
output_group = "initializers",
|
||||
)
|
||||
|
||||
# TODO(victorgomes): Add support to tools/debug_helper,
|
||||
# which needs class-debug-readers and debug-macros.
|
||||
v8_torque_files(
|
||||
name = "generated_torque_files",
|
||||
args = [] + select({
|
||||
"@v8//bazel/config:v8_target_is_32_bits": ["-m32"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
definition_extras = [
|
||||
"bit-field-asserts.cc",
|
||||
"builtin-definitions.h",
|
||||
# "class-debug-readers.cc",
|
||||
# "class-debug-readers.h",
|
||||
"class-forward-declarations.h",
|
||||
# "debug-macros.cc",
|
||||
# "debug-macros.h",
|
||||
"instance-types.h",
|
||||
"interface-descriptors.inc",
|
||||
],
|
||||
icu_srcs = [":icu/torque_files"],
|
||||
initializer_extras = [
|
||||
"csa-types.h",
|
||||
"enum-verifiers.cc",
|
||||
"exported-macros-assembler.cc",
|
||||
"exported-macros-assembler.h",
|
||||
],
|
||||
noicu_srcs = [":noicu/torque_files"],
|
||||
)
|
||||
|
||||
py_binary(
|
||||
name = "code_generator",
|
||||
srcs = [
|
||||
"third_party/inspector_protocol/code_generator.py",
|
||||
"third_party/inspector_protocol/pdl.py",
|
||||
],
|
||||
data = [
|
||||
"third_party/inspector_protocol/lib/Forward_h.template",
|
||||
"third_party/inspector_protocol/lib/Object_cpp.template",
|
||||
"third_party/inspector_protocol/lib/Object_h.template",
|
||||
"third_party/inspector_protocol/lib/Protocol_cpp.template",
|
||||
"third_party/inspector_protocol/lib/ValueConversions_cpp.template",
|
||||
"third_party/inspector_protocol/lib/ValueConversions_h.template",
|
||||
"third_party/inspector_protocol/lib/Values_cpp.template",
|
||||
"third_party/inspector_protocol/lib/Values_h.template",
|
||||
"third_party/inspector_protocol/templates/Exported_h.template",
|
||||
"third_party/inspector_protocol/templates/Imported_h.template",
|
||||
"third_party/inspector_protocol/templates/TypeBuilder_cpp.template",
|
||||
"third_party/inspector_protocol/templates/TypeBuilder_h.template",
|
||||
],
|
||||
imports = ["third_party/inspector_protocol/"],
|
||||
deps = [
|
||||
requirement("jinja2"),
|
||||
],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "generated_inspector_files",
|
||||
srcs = [
|
||||
"include/js_protocol.pdl",
|
||||
"src/inspector/inspector_protocol_config.json",
|
||||
"third_party/inspector_protocol/code_generator.py",
|
||||
"third_party/inspector_protocol/pdl.py",
|
||||
"third_party/inspector_protocol/lib/Forward_h.template",
|
||||
"third_party/inspector_protocol/lib/Object_cpp.template",
|
||||
"third_party/inspector_protocol/lib/Object_h.template",
|
||||
"third_party/inspector_protocol/lib/Protocol_cpp.template",
|
||||
"third_party/inspector_protocol/lib/ValueConversions_cpp.template",
|
||||
"third_party/inspector_protocol/lib/ValueConversions_h.template",
|
||||
"third_party/inspector_protocol/lib/Values_cpp.template",
|
||||
"third_party/inspector_protocol/lib/Values_h.template",
|
||||
"third_party/inspector_protocol/templates/Exported_h.template",
|
||||
"third_party/inspector_protocol/templates/Imported_h.template",
|
||||
"third_party/inspector_protocol/templates/TypeBuilder_cpp.template",
|
||||
"third_party/inspector_protocol/templates/TypeBuilder_h.template",
|
||||
],
|
||||
outs = [
|
||||
"include/inspector/Debugger.h",
|
||||
"include/inspector/Runtime.h",
|
||||
"include/inspector/Schema.h",
|
||||
"src/inspector/protocol/Forward.h",
|
||||
"src/inspector/protocol/Protocol.cpp",
|
||||
"src/inspector/protocol/Protocol.h",
|
||||
"src/inspector/protocol/Console.cpp",
|
||||
"src/inspector/protocol/Console.h",
|
||||
"src/inspector/protocol/Debugger.cpp",
|
||||
"src/inspector/protocol/Debugger.h",
|
||||
"src/inspector/protocol/HeapProfiler.cpp",
|
||||
"src/inspector/protocol/HeapProfiler.h",
|
||||
"src/inspector/protocol/Profiler.cpp",
|
||||
"src/inspector/protocol/Profiler.h",
|
||||
"src/inspector/protocol/Runtime.cpp",
|
||||
"src/inspector/protocol/Runtime.h",
|
||||
"src/inspector/protocol/Schema.cpp",
|
||||
"src/inspector/protocol/Schema.h",
|
||||
],
|
||||
cmd = select({
|
||||
"@@//third_party/v8:platform_windows_msvc": "$(execpath :code_generator) --jinja_dir . --inspector_protocol_dir $$(dirname $(execpath third_party/inspector_protocol/code_generator.py)) --config $(location :src/inspector/inspector_protocol_config.json) --config_value protocol.path=$(location :include/js_protocol.pdl) --config_value crdtp.dir=third_party/inspector_protocol/crdtp --output_base $(@D)/src/inspector",
|
||||
"//conditions:default": "INSPECTOR_PROTOCOL_DIR=$$(dirname $(execpath third_party/inspector_protocol/code_generator.py)); \
|
||||
PYTHONPATH=$$INSPECTOR_PROTOCOL_DIR:external/rules_python++pip+v8_python_deps_311_jinja2/site-packages:external/rules_python++pip+v8_python_deps_311_markupsafe/site-packages:$${PYTHONPATH-} \
|
||||
$(execpath @rules_python//python/bin:python) $(execpath third_party/inspector_protocol/code_generator.py) --jinja_dir . \
|
||||
--inspector_protocol_dir $$INSPECTOR_PROTOCOL_DIR \
|
||||
--config $(location :src/inspector/inspector_protocol_config.json) \
|
||||
--config_value protocol.path=$(location :include/js_protocol.pdl) \
|
||||
--config_value crdtp.dir=third_party/inspector_protocol/crdtp \
|
||||
--output_base $(@D)/src/inspector",
|
||||
}),
|
||||
message = "Generating inspector files",
|
||||
tools = select({
|
||||
"@@//third_party/v8:platform_windows_msvc": [":code_generator"],
|
||||
"//conditions:default": [
|
||||
"@rules_python//python/bin:python",
|
||||
requirement("jinja2"),
|
||||
requirement("markupsafe"),
|
||||
],
|
||||
}),
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "v8_common_libshared_files",
|
||||
srcs = [
|
||||
":torque_runtime_support_files",
|
||||
":v8_libplatform_files",
|
||||
":v8_libsampler_files",
|
||||
":v8_shared_internal_headers",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "rusty_v8_internal_headers",
|
||||
hdrs = [
|
||||
"src/libplatform/default-platform.h",
|
||||
],
|
||||
strip_include_prefix = "",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "rusty_v8_crdtp_headers",
|
||||
hdrs = [
|
||||
"third_party/inspector_protocol/crdtp/cbor.h",
|
||||
"third_party/inspector_protocol/crdtp/dispatch.h",
|
||||
"third_party/inspector_protocol/crdtp/error_support.h",
|
||||
"third_party/inspector_protocol/crdtp/export.h",
|
||||
"third_party/inspector_protocol/crdtp/find_by_first.h",
|
||||
"third_party/inspector_protocol/crdtp/frontend_channel.h",
|
||||
"third_party/inspector_protocol/crdtp/json.h",
|
||||
"third_party/inspector_protocol/crdtp/parser_handler.h",
|
||||
"third_party/inspector_protocol/crdtp/protocol_core.h",
|
||||
"third_party/inspector_protocol/crdtp/serializable.h",
|
||||
"third_party/inspector_protocol/crdtp/span.h",
|
||||
"third_party/inspector_protocol/crdtp/status.h",
|
||||
],
|
||||
strip_include_prefix = "",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "d8_files",
|
||||
srcs = [
|
||||
"src/d8/async-hooks-wrapper.cc",
|
||||
"src/d8/async-hooks-wrapper.h",
|
||||
"src/d8/d8.cc",
|
||||
"src/d8/d8.h",
|
||||
"src/d8/d8-console.cc",
|
||||
"src/d8/d8-console.h",
|
||||
"src/d8/d8-js.cc",
|
||||
"src/d8/d8-platforms.cc",
|
||||
"src/d8/d8-platforms.h",
|
||||
"src/d8/d8-posix.cc",
|
||||
"src/d8/d8-test.cc",
|
||||
"src/d8/hardware-watchpoints.cc",
|
||||
"src/d8/hardware-watchpoints.h",
|
||||
"src/d8/memory-access-information.cc",
|
||||
"src/d8/memory-access-information.h",
|
||||
],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "generated_bytecode_builtins_list",
|
||||
srcs = [],
|
||||
outs = ["builtins-generated/bytecodes-builtins-list.h"],
|
||||
cmd = "$(location :bytecode_builtins_list_generator) $@",
|
||||
cmd_bat = "$(location :bytecode_builtins_list_generator) $@",
|
||||
tools = [":bytecode_builtins_list_generator"],
|
||||
)
|
||||
|
||||
genrule(
|
||||
name = "generated_regexp_special_case",
|
||||
srcs = [],
|
||||
outs = ["src/regexp/special-case.cc"],
|
||||
cmd = "$(location :regexp_special_case_generator) $@",
|
||||
cmd_bat = "$(location :regexp_special_case_generator) $@",
|
||||
tools = [":regexp_special_case_generator"],
|
||||
)
|
||||
|
||||
v8_mksnapshot(
|
||||
name = "generated_snapshot_files",
|
||||
args = [] + [] + [] + ["--no-native-code-counters"],
|
||||
)
|
||||
|
||||
# =================================================
|
||||
# Libraries rules
|
||||
# =================================================
|
||||
|
||||
# NOTE: This allow headers to be accessed without the icu/noicu prefixes.
|
||||
cc_library(
|
||||
name = "icu/generated_torque_definitions_headers",
|
||||
hdrs = [":icu/generated_torque_definitions"],
|
||||
copts = ["-Wno-implicit-fallthrough"],
|
||||
strip_include_prefix = "icu",
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "noicu/generated_torque_definitions_headers",
|
||||
hdrs = [":noicu/generated_torque_definitions"],
|
||||
copts = ["-Wno-implicit-fallthrough"],
|
||||
strip_include_prefix = "noicu",
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "llvm_libc_headers",
|
||||
actual = "@@//third_party/v8:rusty_v8_llvm_libc_headers",
|
||||
)
|
||||
|
||||
v8_library(
|
||||
name = "v8_libbase",
|
||||
srcs = [
|
||||
":v8_libbase_files",
|
||||
":v8_shared_internal_headers",
|
||||
],
|
||||
copts = ["-Wno-implicit-fallthrough"],
|
||||
deps = [
|
||||
":llvm_libc_headers",
|
||||
"@v8_abseil//:overload",
|
||||
"@v8_abseil//:synchronization",
|
||||
"@v8_abseil//:time",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "torque_base_headers",
|
||||
hdrs = [
|
||||
"src/torque/kythe-data.h",
|
||||
"src/torque/torque-compiler.h",
|
||||
],
|
||||
copts = ["-Wno-implicit-fallthrough"],
|
||||
include_prefix = "third_party/v8",
|
||||
includes = ["."],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "kythe_torque_base",
|
||||
srcs = [
|
||||
":torque_base_files",
|
||||
],
|
||||
copts = ["-Wno-implicit-fallthrough"] + select({
|
||||
"@v8//bazel/config:is_posix": ["-fexceptions"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
features = ["-use_header_modules"],
|
||||
deps = [
|
||||
":torque_base_headers",
|
||||
":v8_libbase",
|
||||
"@v8_abseil//:node_hash_map",
|
||||
"@v8_abseil//:node_hash_set",
|
||||
],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "simdutf",
|
||||
actual = "@v8_simdutf//:simdutf",
|
||||
)
|
||||
|
||||
v8_library(
|
||||
name = "v8_libshared",
|
||||
srcs = [
|
||||
":v8_base_without_compiler_files",
|
||||
":v8_common_libshared_files",
|
||||
] + [
|
||||
":v8_compiler_files",
|
||||
],
|
||||
copts = ["-Wno-implicit-fallthrough"],
|
||||
icu_deps = [
|
||||
":icu/generated_torque_definitions_headers",
|
||||
"@v8_icu//:icu",
|
||||
],
|
||||
icu_srcs = [
|
||||
":generated_regexp_special_case",
|
||||
":icu/generated_torque_definitions",
|
||||
":icu/v8_base_without_compiler_files",
|
||||
],
|
||||
noicu_deps = [
|
||||
":noicu/generated_torque_definitions_headers",
|
||||
],
|
||||
noicu_srcs = [
|
||||
":noicu/generated_torque_definitions",
|
||||
],
|
||||
deps = [
|
||||
# keep
|
||||
":lib_dragonbox",
|
||||
"@v8_fast_float//:fast_float",
|
||||
":lib_fp16",
|
||||
":simdutf",
|
||||
":v8_libbase",
|
||||
"@v8_abseil//:btree",
|
||||
"@v8_abseil//:flat_hash_map",
|
||||
"@v8_abseil//:flat_hash_set",
|
||||
"@v8_abseil//:overload",
|
||||
"@v8_highway//:hwy",
|
||||
],
|
||||
)
|
||||
|
||||
v8_library(
|
||||
name = "v8",
|
||||
srcs = [
|
||||
":v8_inspector_files",
|
||||
] + [],
|
||||
hdrs = [":public_header_files"],
|
||||
copts = ["-Wno-implicit-fallthrough"],
|
||||
icu_deps = [":icu/v8_libshared"],
|
||||
icu_srcs = [":icu/snapshot_files"],
|
||||
noicu_deps = [":noicu/v8_libshared"],
|
||||
noicu_srcs = [":noicu/snapshot_files"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
v8_library(
|
||||
name = "wee8",
|
||||
srcs = [":wee8_files"],
|
||||
hdrs = [":public_wasm_c_api_header_files"],
|
||||
copts = ["-Wno-implicit-fallthrough"],
|
||||
strip_include_prefix = "third_party",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [":noicu/v8"] + [],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "core_lib_noicu",
|
||||
actual = "noicu/v8",
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "core_lib_icu",
|
||||
actual = "icu/v8",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
v8_library(
|
||||
name = "v8_vtune",
|
||||
srcs = [
|
||||
"third_party/vtune/v8-vtune.h",
|
||||
"third_party/vtune/vtune-jit.cc",
|
||||
"third_party/vtune/vtune-jit.h",
|
||||
],
|
||||
copts = ["-I"],
|
||||
deps = [
|
||||
":core_lib_noicu",
|
||||
"@intel_ittapi//:lib_ittapi",
|
||||
],
|
||||
)
|
||||
|
||||
# =================================================
|
||||
# Binary rules
|
||||
# =================================================
|
||||
|
||||
v8_binary(
|
||||
name = "bytecode_builtins_list_generator",
|
||||
srcs = [
|
||||
"src/builtins/generate-bytecodes-builtins-list.cc",
|
||||
"src/interpreter/bytecode-operands.cc",
|
||||
"src/interpreter/bytecode-operands.h",
|
||||
"src/interpreter/bytecode-traits.h",
|
||||
"src/interpreter/bytecodes.cc",
|
||||
"src/interpreter/bytecodes.h",
|
||||
],
|
||||
copts = ["-Wno-implicit-fallthrough"],
|
||||
deps = ["v8_libbase"],
|
||||
)
|
||||
|
||||
v8_binary(
|
||||
name = "regexp_special_case_generator",
|
||||
srcs = [
|
||||
"src/regexp/gen-regexp-special-case.cc",
|
||||
"src/regexp/special-case.h",
|
||||
":v8_shared_internal_headers",
|
||||
],
|
||||
copts = ["-Wno-implicit-fallthrough"],
|
||||
defines = [
|
||||
"V8_INTL_SUPPORT",
|
||||
"ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC",
|
||||
# src/regexp/regexp-compiler-tonode.cc uses an unsafe ICU method and
|
||||
# access a character implicitly.
|
||||
"UNISTR_FROM_CHAR_EXPLICIT=",
|
||||
],
|
||||
deps = [
|
||||
":v8_libbase",
|
||||
"@v8_icu//:icu",
|
||||
],
|
||||
)
|
||||
|
||||
v8_binary(
|
||||
name = "torque",
|
||||
srcs = [
|
||||
"src/torque/torque.cc",
|
||||
":torque_base_files",
|
||||
],
|
||||
copts = ["-Wno-implicit-fallthrough"] + select({
|
||||
"@v8//bazel/config:is_posix": ["-fexceptions"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
features = ["-use_header_modules"],
|
||||
icu_defines = ["V8_INTL_SUPPORT"],
|
||||
linkopts = select({
|
||||
"@v8//bazel/config:is_android": ["-llog"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
deps = [
|
||||
"v8_libbase",
|
||||
"@v8_abseil//:node_hash_map",
|
||||
"@v8_abseil//:node_hash_set",
|
||||
],
|
||||
)
|
||||
|
||||
v8_binary(
|
||||
name = "mksnapshot",
|
||||
srcs = [
|
||||
":mksnapshot_files",
|
||||
] + [],
|
||||
copts = ["-Wno-implicit-fallthrough"],
|
||||
# Match GN's mksnapshot `disable_icf` config. If the linker folds distinct
|
||||
# external-reference helpers together while producing the snapshot, the
|
||||
# final embedder binary may not fold the same pair and startup
|
||||
# deserialization will reject the snapshot.
|
||||
# GN also increases the x64 Windows stack reserve because constructing the
|
||||
# snapshot overflows the linker's 1 MiB default.
|
||||
# The MSVC toolchain adds /OPT:ICF after user linkopts in opt mode.
|
||||
# Disable that feature so the snapshot remains usable in debug embedders.
|
||||
features = select({
|
||||
"@@//third_party/v8:platform_windows_msvc": ["-smaller_binary"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
icu_deps = [":icu/v8_libshared"],
|
||||
icu_srcs = [
|
||||
":icu/generated_torque_initializers",
|
||||
":icu/v8_initializers_files",
|
||||
],
|
||||
linkopts = select({
|
||||
"@v8//bazel/config:is_android": ["-llog"],
|
||||
"@v8//bazel/config:is_macos": ["-Wl,-no_deduplicate"],
|
||||
"@@//third_party/v8:platform_windows_msvc": [
|
||||
"/OPT:NOICF",
|
||||
"/OPT:REF",
|
||||
"/STACK:2097152",
|
||||
],
|
||||
"@v8//bazel/config:is_windows": [
|
||||
"-Wl,/OPT:NOICF",
|
||||
"-Wl,/STACK:2097152",
|
||||
],
|
||||
"//conditions:default": ["-Wl,--icf=none"],
|
||||
}),
|
||||
noicu_deps = [":v8_libshared_noicu"],
|
||||
noicu_srcs = [
|
||||
":noicu/generated_torque_initializers",
|
||||
":noicu/v8_initializers_files",
|
||||
],
|
||||
)
|
||||
|
||||
v8_binary(
|
||||
name = "d8",
|
||||
srcs = [":d8_files"],
|
||||
copts = ["-Wno-implicit-fallthrough"],
|
||||
icu_deps = [":icu/v8"],
|
||||
noicu_deps = [":noicu/v8"],
|
||||
)
|
||||
|
||||
# This target forces torque to be compiled without pointer compression.
|
||||
v8_binary_non_pointer_compression(
|
||||
name = "noicu/torque_non_pointer_compression",
|
||||
binary = "noicu/torque",
|
||||
)
|
||||
|
||||
v8_binary_non_pointer_compression(
|
||||
name = "icu/torque_non_pointer_compression",
|
||||
binary = "icu/torque",
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "v8ci",
|
||||
actual = "noicu/v8",
|
||||
)
|
||||
|
||||
# =================================================
|
||||
# Tests
|
||||
# =================================================
|
||||
|
||||
v8_build_config(
|
||||
name = "v8_build_config",
|
||||
arch = select({
|
||||
"@v8//bazel/config:v8_target_arm64": "arm64",
|
||||
"@v8//bazel/config:v8_target_x64": "x64",
|
||||
"//conditions:default": "x64",
|
||||
}),
|
||||
)
|
||||
|
||||
# Runs mjsunit with d8.
|
||||
py_test(
|
||||
name = "noicu/mjsunit",
|
||||
size = "medium",
|
||||
srcs = [
|
||||
"test/mjsunit/testcfg.py",
|
||||
"tools/predictable_wrapper.py",
|
||||
"tools/run-tests.py",
|
||||
] + glob(["tools/testrunner/**/*.py"]),
|
||||
args = [
|
||||
"--no-sorting",
|
||||
"--nopresubmit",
|
||||
"--variant=google3",
|
||||
"--outdir noicu",
|
||||
"--verbose",
|
||||
] + select({
|
||||
"@v8//bazel/config:v8_target_arm64": [
|
||||
"--arch=arm64",
|
||||
],
|
||||
"@v8//bazel/config:v8_target_x64": [
|
||||
"--arch=x64",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + [
|
||||
"mjsunit",
|
||||
],
|
||||
data = [
|
||||
"test",
|
||||
":noicu/d8",
|
||||
":noicu/v8_build_config",
|
||||
"//testing/pybase",
|
||||
] + glob(["test/**"]) + glob(["tools/**/*.js"]) + glob(["tools/**/*.mjs"]),
|
||||
main = "tools/run-tests.py",
|
||||
tags = [
|
||||
# Disable sanitizers, as they don't work in general in V8.
|
||||
"nosan",
|
||||
],
|
||||
)
|
||||
|
||||
py_test(
|
||||
name = "icu/mjsunit",
|
||||
size = "medium",
|
||||
srcs = [
|
||||
"test/mjsunit/testcfg.py",
|
||||
"tools/predictable_wrapper.py",
|
||||
"tools/run-tests.py",
|
||||
] + glob(["tools/testrunner/**/*.py"]),
|
||||
args = [
|
||||
"--no-sorting",
|
||||
"--nopresubmit",
|
||||
"--variant=google3",
|
||||
"--outdir icu",
|
||||
"--verbose",
|
||||
] + select({
|
||||
"@v8//bazel/config:v8_target_arm64": [
|
||||
"--arch=arm64",
|
||||
],
|
||||
"@v8//bazel/config:v8_target_x64": [
|
||||
"--arch=x64",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + [
|
||||
"mjsunit",
|
||||
],
|
||||
data = [
|
||||
"test",
|
||||
":icu/d8",
|
||||
":icu/v8_build_config",
|
||||
"//testing/pybase",
|
||||
] + glob(["test/**"]) + glob(["tools/**/*.js"]) + glob(["tools/**/*.mjs"]),
|
||||
main = "tools/run-tests.py",
|
||||
tags = [
|
||||
# Disable sanitizers, as they don't work in general in V8.
|
||||
"nosan",
|
||||
],
|
||||
)
|
||||
|
||||
py_test(
|
||||
name = "icu/intl",
|
||||
size = "medium",
|
||||
srcs = [
|
||||
"test/intl/testcfg.py",
|
||||
"tools/predictable_wrapper.py",
|
||||
"tools/run-tests.py",
|
||||
] + glob(["tools/testrunner/**/*.py"]),
|
||||
args = [
|
||||
"--no-sorting",
|
||||
"--nopresubmit",
|
||||
"--variant=google3",
|
||||
"--outdir icu",
|
||||
"--verbose",
|
||||
] + select({
|
||||
"@v8//bazel/config:v8_target_arm64": [
|
||||
"--arch=arm64",
|
||||
],
|
||||
"@v8//bazel/config:v8_target_x64": [
|
||||
"--arch=x64",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + [
|
||||
"intl",
|
||||
],
|
||||
data = [
|
||||
"test",
|
||||
":icu/d8",
|
||||
":icu/v8_build_config",
|
||||
"//testing/pybase",
|
||||
] + glob(["test/**"]) + glob(["tools/**/*.js"]) + glob(["tools/**/*.mjs"]),
|
||||
main = "tools/run-tests.py",
|
||||
tags = [
|
||||
# Disable sanitizers, as they don't work in general in V8.
|
||||
"nosan",
|
||||
],
|
||||
)
|
||||
|
||||
# V8's existing converter builds snapshot assembly as C++ for clang-cl.
|
||||
py_binary(
|
||||
name = "native_windows_inline_asm",
|
||||
srcs = ["tools/snapshot/asm_to_inline_asm.py"],
|
||||
main = "tools/snapshot/asm_to_inline_asm.py",
|
||||
tags = ["manual"],
|
||||
)
|
||||
101
third_party/v8/engine_repository.bzl
vendored
Normal file
101
third_party/v8/engine_repository.bzl
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
"""V8 source import with Codex-owned Bazel entry points.
|
||||
|
||||
The root package is placed inside the fetched source tree so relative source
|
||||
labels and globs have their normal Bazel semantics. Reuse upstream's platform
|
||||
and CPU configuration in place, with Codex's narrow patch to bazel/defs.bzl
|
||||
and the target CPU setting.
|
||||
V8's MODULE and toolchain BUILD files are never part of Codex's dependency or
|
||||
toolchain graph.
|
||||
"""
|
||||
|
||||
# Upstream keeps its source groups in BUILD.bazel, which cannot be loaded as
|
||||
# a Starlark library. Reuse filegroups, so labels/globs retain their semantics
|
||||
# inside @v8. Compiled targets (including valid V8 v8_library/v8_binary calls)
|
||||
# belong in engine.BUILD.bazel, where we wire Codex's dependencies and runtime.
|
||||
_INVENTORY_SLOT = "# @CODEX_V8_UPSTREAM_FILEGROUPS@"
|
||||
_FILE_GROUPS = "# File group rules"
|
||||
_GENERATED_FILES = "# Generated files"
|
||||
|
||||
def _upstream_filegroups(upstream):
|
||||
before_and_groups = upstream.split(_FILE_GROUPS)
|
||||
if len(before_and_groups) != 2:
|
||||
fail("V8 source import: expected one File group rules section; review the new pin's BUILD.bazel")
|
||||
groups_and_after = before_and_groups[1].split(_GENERATED_FILES)
|
||||
if len(groups_and_after) != 2:
|
||||
fail("V8 source import: expected one Generated files boundary; review the new pin's BUILD.bazel")
|
||||
|
||||
groups = []
|
||||
statement = []
|
||||
for line in groups_and_after[0].split("\n"):
|
||||
if statement:
|
||||
statement.append(line)
|
||||
if line == ")":
|
||||
source = "\n".join(statement)
|
||||
if statement[0] == "filegroup(":
|
||||
groups.append(source)
|
||||
elif 'name = "lib_dragonbox",' not in source and 'name = "lib_fp16",' not in source:
|
||||
fail("V8 filegroup import: unexpected library; review and wire it in third_party/v8/engine.BUILD.bazel: " + source)
|
||||
statement = []
|
||||
elif line in ["filegroup(", "v8_library("]:
|
||||
# The pinned section happens to contain two libraries. Both are
|
||||
# already provided by our dependency overlays; skip only those names.
|
||||
statement = [line]
|
||||
elif line.strip() and not line.startswith("#"):
|
||||
fail("V8 filegroup import: only filegroups can be reused here; review compiled targets (including v8_binary) in third_party/v8/engine.BUILD.bazel. Unexpected statement: " + line)
|
||||
|
||||
# Group count and library order can change without changing the owned graph.
|
||||
# Fail only when the source section is empty, malformed, or unsafe to reuse.
|
||||
if statement:
|
||||
fail("V8 filegroup import: unterminated statement; review the pinned BUILD.bazel: " + "\n".join(statement))
|
||||
if not groups:
|
||||
fail("V8 filegroup import: no filegroups found; review the pinned BUILD.bazel")
|
||||
return "\n\n".join(groups)
|
||||
|
||||
def _engine_repository_impl(ctx):
|
||||
ctx.download_and_extract(
|
||||
url = ctx.attr.urls,
|
||||
integrity = ctx.attr.integrity,
|
||||
stripPrefix = ctx.attr.strip_prefix,
|
||||
)
|
||||
inventory = _upstream_filegroups(ctx.read("BUILD.bazel"))
|
||||
|
||||
# MSVC and GNU Windows require different x64 stack scanners. Keep that one
|
||||
# choice in our graph while taking all other membership from the V8 pin.
|
||||
msvc_scanner = '"src/heap/base/asm/x64/push_registers_masm.asm"'
|
||||
if inventory.count(msvc_scanner) != 1:
|
||||
fail("V8 source import: expected one x64 MSVC scanner input; review the Windows stack selector")
|
||||
inventory = inventory.replace(msvc_scanner, '":windows_x64_stack_assembly"')
|
||||
template = ctx.read(ctx.attr._engine_build)
|
||||
if template.count(_INVENTORY_SLOT) != 1:
|
||||
fail("Codex V8 BUILD template must contain exactly one upstream filegroup slot")
|
||||
|
||||
for patch in ctx.attr.patches:
|
||||
ctx.patch(patch, strip = ctx.attr.patch_strip)
|
||||
|
||||
# Preserve V8's source layout and the two third-party package boundaries
|
||||
# (disarm and fadec); neither is in the Codex V8 closure. Keep upstream's
|
||||
# platform/CPU package and prevent upstream toolchain discovery.
|
||||
for path in [
|
||||
"MODULE.bazel",
|
||||
"BUILD.bazel",
|
||||
"bazel/toolchain/BUILD.bazel",
|
||||
"bazel/patches/BUILD.bazel",
|
||||
]:
|
||||
ctx.delete(path)
|
||||
ctx.file("BUILD.bazel", template.replace(_INVENTORY_SLOT, inventory))
|
||||
|
||||
engine_repository = repository_rule(
|
||||
implementation = _engine_repository_impl,
|
||||
attrs = {
|
||||
"urls": attr.string_list(mandatory = True),
|
||||
"integrity": attr.string(mandatory = True),
|
||||
"strip_prefix": attr.string(mandatory = True),
|
||||
"patches": attr.label_list(allow_files = True),
|
||||
"patch_strip": attr.int(default = 3),
|
||||
"_engine_build": attr.label(
|
||||
default = Label("//third_party/v8:engine.BUILD.bazel"),
|
||||
allow_single_file = True,
|
||||
),
|
||||
},
|
||||
doc = "Fetch the pinned V8 source tree and install Codex's engine graph.",
|
||||
)
|
||||
45
third_party/v8/engine_rules.bzl
vendored
Normal file
45
third_party/v8/engine_rules.bzl
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"""Owned V8 source selection and test metadata derived from the engine policy."""
|
||||
|
||||
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
|
||||
load("@v8//:bazel/defs.bzl", "FlagInfo", "build_config_content")
|
||||
|
||||
def _options_impl(ctx):
|
||||
return FlagInfo(value = ctx.build_setting_value)
|
||||
|
||||
# Source-only features keep upstream select names without adding CLI options.
|
||||
# ABI/runtime selections are internal settings controlled by artifact profiles.
|
||||
v8_fixed_source_features = rule(
|
||||
implementation = _options_impl,
|
||||
build_setting = config.bool(flag = False),
|
||||
)
|
||||
|
||||
def _v8_build_config_impl(ctx):
|
||||
config = json.decode(build_config_content(json.encode(ctx.attr.arch), "true" if ctx.attr.icu else "false"))
|
||||
defines = ctx.attr.config[CcInfo].compilation_context.defines.to_list()
|
||||
config.update({
|
||||
"cppgc_microtask_queue": "V8_CPPGC_MICROTASK_QUEUE" in defines,
|
||||
"wasm_random_fuzzers": "V8_WASM_RANDOM_FUZZERS" in defines,
|
||||
})
|
||||
ctx.actions.write(ctx.outputs.out, json.encode(config) + "\n")
|
||||
return [DefaultInfo(files = depset([ctx.outputs.out]))]
|
||||
|
||||
_v8_build_config = rule(
|
||||
implementation = _v8_build_config_impl,
|
||||
attrs = {
|
||||
"arch": attr.string(mandatory = True),
|
||||
"config": attr.label(mandatory = True, providers = [CcInfo]),
|
||||
"icu": attr.bool(mandatory = True),
|
||||
"out": attr.output(mandatory = True),
|
||||
},
|
||||
)
|
||||
|
||||
def v8_build_config(name, arch):
|
||||
"""Keep upstream test metadata aligned with the owned platform features."""
|
||||
for mode in ["icu", "noicu"]:
|
||||
_v8_build_config(
|
||||
name = mode + "/" + name,
|
||||
arch = arch,
|
||||
config = ":define_flags",
|
||||
icu = mode == "icu",
|
||||
out = mode + "/" + name + ".json",
|
||||
)
|
||||
11
third_party/v8/fast_float.BUILD.bazel
vendored
Normal file
11
third_party/v8/fast_float.BUILD.bazel
vendored
Normal file
@@ -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"],
|
||||
)
|
||||
12
third_party/v8/fp16.BUILD.bazel
vendored
Normal file
12
third_party/v8/fp16.BUILD.bazel
vendored
Normal file
@@ -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"],
|
||||
)
|
||||
13
third_party/v8/gnu_libcxx_shared_exception_symbols.txt
vendored
Normal file
13
third_party/v8/gnu_libcxx_shared_exception_symbols.txt
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# libc++ intentionally leaves these exception functions in std:: across ABI
|
||||
# namespaces. Prefer the Bazel toolchain definitions if both runtimes link.
|
||||
# Keep constructors taking std::__Cr::string strong in the V8 archive.
|
||||
_ZNSt11logic_errorC1EPKc
|
||||
_ZNSt11logic_errorC1ERKS_
|
||||
_ZNSt11logic_errorC2EPKc
|
||||
_ZNSt11logic_errorC2ERKS_
|
||||
_ZNSt11logic_erroraSERKS_
|
||||
_ZNSt13runtime_errorC1EPKc
|
||||
_ZNSt13runtime_errorC1ERKS_
|
||||
_ZNSt13runtime_errorC2EPKc
|
||||
_ZNSt13runtime_errorC2ERKS_
|
||||
_ZNSt13runtime_erroraSERKS_
|
||||
197
third_party/v8/highway.BUILD.bazel
vendored
Normal file
197
third_party/v8/highway.BUILD.bazel
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
# 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_lexan",
|
||||
flag_values = {"@bazel_tools//tools/cpp:compiler": "lexan"},
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "compiler_clang_cl",
|
||||
flag_values = {"@bazel_tools//tools/cpp:compiler": "clang-cl"},
|
||||
)
|
||||
|
||||
selects.config_setting_group(
|
||||
name = "compiler_clangcl",
|
||||
match_any = [
|
||||
":compiler_clang_cl",
|
||||
":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,
|
||||
)
|
||||
131
third_party/v8/icu.BUILD.bazel
vendored
Normal file
131
third_party/v8/icu.BUILD.bazel
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
# 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.
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
# ICU must use the same C++ runtime as the V8 artifact and its host generators.
|
||||
_ICU_V8_COPTS = select({
|
||||
"@@//third_party/v8:use_rusty_v8_custom_libcxx_native_windows": [
|
||||
"/D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
|
||||
"/D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE",
|
||||
"/D_LIBCPP_INSTRUMENTED_WITH_ASAN=0",
|
||||
],
|
||||
"@@//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": [],
|
||||
})
|
||||
|
||||
_ICU_MSVC_COPTS = [
|
||||
"/wd4005",
|
||||
"/wd4068",
|
||||
"/wd4267",
|
||||
"/utf-8",
|
||||
]
|
||||
|
||||
_ICU_LIBRARY_COPTS = select({
|
||||
"@@//third_party/v8:platform_windows_msvc": _ICU_MSVC_COPTS,
|
||||
"//conditions:default": ["-Wno-deprecated-declarations"],
|
||||
}) + _ICU_V8_COPTS
|
||||
|
||||
_ICU_V8_RUNTIME_DEPS = select({
|
||||
"@@//third_party/v8:use_rusty_v8_custom_libcxx": [
|
||||
"@@//third_party/v8:rusty_v8_custom_libcxx_headers",
|
||||
"@@//third_party/v8:rusty_v8_custom_libcxx_runtime",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
})
|
||||
|
||||
filegroup(
|
||||
name = "icudata",
|
||||
srcs = ["common/icudtl.dat"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "icuuc",
|
||||
srcs = glob([
|
||||
"source/common/**/*.h",
|
||||
"source/common/**/*.cpp",
|
||||
]),
|
||||
copts = _ICU_LIBRARY_COPTS,
|
||||
data = [":icudata"],
|
||||
defines = [
|
||||
"HAVE_DLOPEN=0",
|
||||
"UCONFIG_ONLY_HTML_CONVERSION=1",
|
||||
"U_CHARSET_IS_UTF8=1",
|
||||
"U_USING_ICU_NAMESPACE=0",
|
||||
"U_ENABLE_DYLOAD=0",
|
||||
"USE_CHROMIUM_ICU=1",
|
||||
"U_ENABLE_TRACING=1",
|
||||
"U_ENABLE_RESOURCE_TRACING=0",
|
||||
"UNISTR_FROM_STRING_EXPLICIT=",
|
||||
"UNISTR_FROM_CHAR_EXPLICIT=",
|
||||
] + select({
|
||||
"@platforms//os:windows": [
|
||||
"U_STATIC_IMPLEMENTATION",
|
||||
"UNICODE",
|
||||
"_UNICODE",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
includes = [
|
||||
"source/common",
|
||||
"source/i18n",
|
||||
],
|
||||
local_defines = [
|
||||
"U_COMMON_IMPLEMENTATION",
|
||||
"U_ICUDATAENTRY_IN_COMMON",
|
||||
],
|
||||
tags = ["requires-rtti"],
|
||||
deps = _ICU_V8_RUNTIME_DEPS,
|
||||
alwayslink = 1,
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "icui18n",
|
||||
srcs = glob([
|
||||
"source/i18n/**/*.h",
|
||||
"source/i18n/**/*.cpp",
|
||||
]),
|
||||
copts = _ICU_LIBRARY_COPTS,
|
||||
local_defines = [
|
||||
"U_I18N_IMPLEMENTATION",
|
||||
],
|
||||
deps = [":icuuc"] + _ICU_V8_RUNTIME_DEPS,
|
||||
alwayslink = 1,
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "icu",
|
||||
srcs = [
|
||||
"source/stubdata/stubdata.cpp",
|
||||
"source/stubdata/stubdata.h",
|
||||
],
|
||||
hdrs = glob([
|
||||
"source/common/unicode/*.h",
|
||||
"source/i18n/unicode/*.h",
|
||||
]),
|
||||
copts = select({
|
||||
"@@//third_party/v8:platform_windows_msvc": _ICU_MSVC_COPTS,
|
||||
"@platforms//os:windows": [
|
||||
"-Wno-deprecated-declarations",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + _ICU_V8_COPTS,
|
||||
include_prefix = "third_party/icu",
|
||||
local_defines = [
|
||||
"U_COMMON_IMPLEMENTATION",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":icui18n",
|
||||
":icuuc",
|
||||
] + _ICU_V8_RUNTIME_DEPS,
|
||||
alwayslink = 1,
|
||||
)
|
||||
205
third_party/v8/libcxx.BUILD.bazel
vendored
Normal file
205
third_party/v8/libcxx.BUILD.bazel
vendored
Normal file
@@ -0,0 +1,205 @@
|
||||
load("@//third_party/v8:libcxx_rules.bzl", "libcxx_library")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
config_setting(
|
||||
name = "is_linux",
|
||||
constraint_values = ["@platforms//os:linux"],
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "is_macos",
|
||||
constraint_values = ["@platforms//os:macos"],
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "is_windows",
|
||||
constraint_values = ["@platforms//os:windows"],
|
||||
)
|
||||
|
||||
LIBCXX_SRCS = [
|
||||
"src/algorithm.cpp",
|
||||
"src/any.cpp",
|
||||
"src/atomic.cpp",
|
||||
"src/barrier.cpp",
|
||||
"src/bind.cpp",
|
||||
"src/call_once.cpp",
|
||||
"src/charconv.cpp",
|
||||
"src/chrono.cpp",
|
||||
"src/condition_variable.cpp",
|
||||
"src/condition_variable_destructor.cpp",
|
||||
"src/error_category.cpp",
|
||||
"src/exception.cpp",
|
||||
"src/filesystem/directory_iterator.cpp",
|
||||
"src/filesystem/filesystem_error.cpp",
|
||||
"src/filesystem/operations.cpp",
|
||||
"src/filesystem/path.cpp",
|
||||
"src/functional.cpp",
|
||||
"src/future.cpp",
|
||||
"src/hash.cpp",
|
||||
"src/ios.cpp",
|
||||
"src/ios.instantiations.cpp",
|
||||
"src/iostream.cpp",
|
||||
"src/locale.cpp",
|
||||
"src/memory.cpp",
|
||||
"src/mutex.cpp",
|
||||
"src/mutex_destructor.cpp",
|
||||
"src/new.cpp",
|
||||
"src/new_handler.cpp",
|
||||
"src/new_helpers.cpp",
|
||||
"src/optional.cpp",
|
||||
"src/random.cpp",
|
||||
"src/random_shuffle.cpp",
|
||||
"src/regex.cpp",
|
||||
"src/ryu/d2fixed.cpp",
|
||||
"src/ryu/d2s.cpp",
|
||||
"src/ryu/f2s.cpp",
|
||||
"src/shared_mutex.cpp",
|
||||
"src/stdexcept.cpp",
|
||||
"src/string.cpp",
|
||||
"src/strstream.cpp",
|
||||
"src/system_error.cpp",
|
||||
"src/thread.cpp",
|
||||
"src/typeinfo.cpp",
|
||||
"src/valarray.cpp",
|
||||
"src/variant.cpp",
|
||||
"src/vector.cpp",
|
||||
"src/verbose_abort.cpp",
|
||||
]
|
||||
|
||||
cc_library(
|
||||
name = "headers",
|
||||
hdrs = glob(["include/**"]),
|
||||
strip_include_prefix = "include",
|
||||
deps = ["@//third_party/v8/libcxx_config:headers"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "internal_headers",
|
||||
hdrs = glob([
|
||||
"src/**/*.h",
|
||||
"src/**/*.ipp",
|
||||
]),
|
||||
includes = ["src"],
|
||||
)
|
||||
|
||||
libcxx_library(
|
||||
name = "libcxx",
|
||||
srcs = LIBCXX_SRCS + select({
|
||||
"@//third_party/v8:use_rusty_v8_custom_libcxx_native_windows": [
|
||||
"src/filesystem/filesystem_clock.cpp",
|
||||
],
|
||||
":is_linux": [
|
||||
"src/filesystem/directory_entry.cpp",
|
||||
"src/filesystem/filesystem_clock.cpp",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
":is_windows": [
|
||||
"src/support/win32/locale_win32.cpp",
|
||||
"src/support/win32/support.cpp",
|
||||
"src/support/win32/thread_win32.cpp",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
copts = select({
|
||||
"@//third_party/v8:use_rusty_v8_custom_libcxx_native_windows": [
|
||||
"/EHsc",
|
||||
"/GR",
|
||||
"/std:c++latest",
|
||||
"/Zc:__cplusplus",
|
||||
"/clang:-fstrict-aliasing",
|
||||
"/clang:-Wno-nullability-completeness",
|
||||
"/clang:-Wno-unused-parameter",
|
||||
"/clang:-Wundef",
|
||||
# libc++ uses the Microsoft exception implementation with /MT.
|
||||
"/clang:-Xclang",
|
||||
"/clang:--dependent-lib=libcpmt",
|
||||
"/wd4005",
|
||||
],
|
||||
"//conditions:default": [
|
||||
"-fexceptions",
|
||||
"-frtti",
|
||||
"-fstrict-aliasing",
|
||||
"-fvisibility=hidden",
|
||||
"-fvisibility-inlines-hidden",
|
||||
"-nostdinc++",
|
||||
"-std=c++23",
|
||||
"-Wno-nullability-completeness",
|
||||
"-Wno-unused-parameter",
|
||||
"-Wundef",
|
||||
],
|
||||
}) + select({
|
||||
"@//third_party/v8:use_rusty_v8_custom_libcxx_native_windows": [],
|
||||
":is_windows": ["-Wno-macro-redefined"],
|
||||
"//conditions:default": ["-fPIC"],
|
||||
}) + select({
|
||||
":is_macos": [
|
||||
"-Wno-pragma-clang-attribute",
|
||||
"-Wno-thread-safety-analysis",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
defines = [
|
||||
"CR_LIBCXX_REVISION=b16984ce99c702355a5b2b4c52574e82cec41fb9",
|
||||
"LIBC_NAMESPACE=__llvm_libc_cr",
|
||||
"_LIBCPP_BUILDING_LIBRARY",
|
||||
"_LIBCPP_CONSTINIT=constinit",
|
||||
"_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
|
||||
"_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE",
|
||||
"_LIBCPP_INSTRUMENTED_WITH_ASAN=0",
|
||||
] + select({
|
||||
# The Windows build uses the Microsoft ABI, never Itanium libc++abi.
|
||||
"@//third_party/v8:use_rusty_v8_custom_libcxx_native_windows": [],
|
||||
"//conditions:default": [
|
||||
"LIBCXX_BUILDING_LIBCXXABI",
|
||||
"_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
|
||||
],
|
||||
}) + select({
|
||||
"@llvm//platforms/config:musl": [
|
||||
# Chromium's checked-in __config_site uses this switch to enable
|
||||
# libc++'s musl-specific configuration.
|
||||
"ANDROID_HOST_MUSL",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
"@//third_party/v8:use_rusty_v8_custom_libcxx_native_windows": [],
|
||||
":is_windows": [
|
||||
"NTDDI_VERSION=NTDDI_WIN7",
|
||||
"WINVER=_WIN32_WINNT_WIN7",
|
||||
"_WIN32_WINNT=_WIN32_WINNT_WIN7",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
implementation_deps = [
|
||||
":headers",
|
||||
":internal_headers",
|
||||
"@rusty_v8_llvm_libc//:headers",
|
||||
] + select({
|
||||
"@//third_party/v8:use_rusty_v8_custom_libcxx_native_windows": [],
|
||||
"//conditions:default": ["@rusty_v8_libcxxabi//:headers"],
|
||||
}) + select({
|
||||
":is_linux": [
|
||||
"@@llvm++kernel_headers+kernel_headers//:kernel_headers",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
"@llvm//platforms/config:gnu": [
|
||||
"@@llvm++glibc+glibc//:gnu_libc_headers",
|
||||
],
|
||||
"@llvm//platforms/config:musl": [
|
||||
"@@llvm++musl+musl_libc//:musl_libc_headers",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
includes = ["src"],
|
||||
local_defines = select({
|
||||
"@//third_party/v8:use_rusty_v8_custom_libcxx_native_windows": [
|
||||
"NTDDI_VERSION=NTDDI_WIN7",
|
||||
"WINVER=_WIN32_WINNT_WIN7",
|
||||
"_WIN32_WINNT=_WIN32_WINNT_WIN7",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
)
|
||||
12
third_party/v8/libcxx_config/BUILD.bazel
vendored
Normal file
12
third_party/v8/libcxx_config/BUILD.bazel
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
cc_library(
|
||||
name = "headers",
|
||||
hdrs = [
|
||||
"__assertion_handler",
|
||||
"__config_site",
|
||||
],
|
||||
includes = ["."],
|
||||
)
|
||||
27
third_party/v8/libcxx_config/__assertion_handler
vendored
Normal file
27
third_party/v8/libcxx_config/__assertion_handler
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
// -*- C++ -*-
|
||||
|
||||
#ifndef _LIBCPP___ASSERTION_HANDLER
|
||||
#define _LIBCPP___ASSERTION_HANDLER
|
||||
|
||||
#include <__config>
|
||||
#include <__verbose_abort>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if defined(OFFICIAL_BUILD) && !defined(DCHECK_ALWAYS_ON)
|
||||
|
||||
[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI void __libcpp_hardening_failure() {
|
||||
__builtin_trap();
|
||||
}
|
||||
|
||||
#define _LIBCPP_ASSERTION_HANDLER(message) ((void)message, __libcpp_hardening_failure())
|
||||
|
||||
#else
|
||||
|
||||
#define _LIBCPP_ASSERTION_HANDLER(message) _LIBCPP_VERBOSE_ABORT("%s", message)
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP___ASSERTION_HANDLER
|
||||
55
third_party/v8/libcxx_config/__config_site
vendored
Normal file
55
third_party/v8/libcxx_config/__config_site
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
#ifndef _LIBCPP_CONFIG_SITE
|
||||
#define _LIBCPP_CONFIG_SITE
|
||||
|
||||
#define _LIBCPP_ABI_NAMESPACE __Cr
|
||||
#define _LIBCPP_ABI_VERSION 2
|
||||
|
||||
#define _LIBCPP_ABI_FORCE_ITANIUM 0
|
||||
#define _LIBCPP_ABI_FORCE_MICROSOFT 0
|
||||
#define _LIBCPP_HAS_THREADS 1
|
||||
#define _LIBCPP_HAS_MONOTONIC_CLOCK 1
|
||||
#define _LIBCPP_HAS_TERMINAL 1
|
||||
|
||||
#ifdef ANDROID_HOST_MUSL
|
||||
#define _LIBCPP_HAS_MUSL_LIBC 1
|
||||
#else
|
||||
#define _LIBCPP_HAS_MUSL_LIBC 0
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define _LIBCPP_HAS_THREAD_API_PTHREAD 0
|
||||
#define _LIBCPP_HAS_THREAD_API_EXTERNAL 0
|
||||
#define _LIBCPP_HAS_THREAD_API_WIN32 1
|
||||
#else
|
||||
#define _LIBCPP_HAS_THREAD_API_PTHREAD 1
|
||||
#define _LIBCPP_HAS_THREAD_API_EXTERNAL 0
|
||||
#define _LIBCPP_HAS_THREAD_API_WIN32 0
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS 0
|
||||
#define _LIBCPP_HAS_FILESYSTEM 1
|
||||
#define _LIBCPP_HAS_RANDOM_DEVICE 1
|
||||
#define _LIBCPP_HAS_LOCALIZATION 1
|
||||
#define _LIBCPP_HAS_UNICODE 1
|
||||
#define _LIBCPP_HAS_WIDE_CHARACTERS 1
|
||||
#define _LIBCPP_HAS_TIME_ZONE_DATABASE 1
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#define _LIBCPP_PSTL_BACKEND_LIBDISPATCH
|
||||
#else
|
||||
#define _LIBCPP_PSTL_BACKEND_STD_THREAD
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_ASSERTION_SEMANTIC_DEFAULT \
|
||||
_LIBCPP_ASSERTION_SEMANTIC_HARDENING_DEPENDENT
|
||||
|
||||
#define _LIBCPP_LIBC_PICOLIBC 0
|
||||
#define _LIBCPP_LIBC_NEWLIB 0
|
||||
|
||||
#define _LIBCPP_NO_AUTO_LINK
|
||||
#define _LIBCPP_REMOVE_TRANSITIVE_INCLUDES
|
||||
#define _LIBCPP_NO_ABI_TAG
|
||||
#define _LIBCPP_VERBOSE_ABORT(...) ::std::__libcpp_verbose_abort(__VA_ARGS__)
|
||||
#define _LIBCPP_HAS_NO_INCOMPLETE_PSTL
|
||||
|
||||
#endif // _LIBCPP_CONFIG_SITE
|
||||
26
third_party/v8/libcxx_rules.bzl
vendored
Normal file
26
third_party/v8/libcxx_rules.bzl
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
"""Select the installed SDK-capable toolchain for native Windows libc++."""
|
||||
|
||||
load("@llvm//toolchain/runtimes:cc_runtime_library.bzl", "cc_runtime_stage0_library")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
def libcxx_library(name, **kwargs):
|
||||
cc_runtime_stage0_library(
|
||||
name = name + "_stage0",
|
||||
**kwargs
|
||||
)
|
||||
cc_library(
|
||||
name = name + "_native_windows",
|
||||
linkstatic = True,
|
||||
target_compatible_with = select({
|
||||
"@//third_party/v8:use_rusty_v8_custom_libcxx_native_windows": [],
|
||||
"//conditions:default": ["@platforms//:incompatible"],
|
||||
}),
|
||||
**kwargs
|
||||
)
|
||||
native.alias(
|
||||
name = name,
|
||||
actual = select({
|
||||
"@//third_party/v8:use_rusty_v8_custom_libcxx_native_windows": ":" + name + "_native_windows",
|
||||
"//conditions:default": ":" + name + "_stage0",
|
||||
}),
|
||||
)
|
||||
99
third_party/v8/libcxxabi.BUILD.bazel
vendored
Normal file
99
third_party/v8/libcxxabi.BUILD.bazel
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
load("@llvm//toolchain/runtimes:cc_runtime_library.bzl", "cc_runtime_stage0_library")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
config_setting(
|
||||
name = "is_linux",
|
||||
constraint_values = ["@platforms//os:linux"],
|
||||
)
|
||||
|
||||
config_setting(
|
||||
name = "is_windows",
|
||||
constraint_values = ["@platforms//os:windows"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "headers",
|
||||
hdrs = glob(["include/**"]),
|
||||
strip_include_prefix = "include",
|
||||
)
|
||||
|
||||
cc_runtime_stage0_library(
|
||||
name = "libcxxabi",
|
||||
srcs = [
|
||||
"src/abort_message.cpp",
|
||||
"src/cxa_aux_runtime.cpp",
|
||||
"src/cxa_default_handlers.cpp",
|
||||
"src/cxa_demangle.cpp",
|
||||
"src/cxa_exception.cpp",
|
||||
"src/cxa_exception_storage.cpp",
|
||||
"src/cxa_guard.cpp",
|
||||
"src/cxa_handlers.cpp",
|
||||
"src/cxa_personality.cpp",
|
||||
"src/cxa_vector.cpp",
|
||||
"src/cxa_virtual.cpp",
|
||||
"src/fallback_malloc.cpp",
|
||||
"src/private_typeinfo.cpp",
|
||||
"src/stdlib_exception.cpp",
|
||||
"src/stdlib_stdexcept.cpp",
|
||||
"src/stdlib_typeinfo.cpp",
|
||||
] + select({
|
||||
":is_linux": ["src/cxa_thread_atexit.cpp"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
copts = [
|
||||
"-fexceptions",
|
||||
"-frtti",
|
||||
"-fstrict-aliasing",
|
||||
"-fvisibility=hidden",
|
||||
"-fvisibility-inlines-hidden",
|
||||
"-nostdinc++",
|
||||
"-std=c++23",
|
||||
"-Wno-nullability-completeness",
|
||||
"-Wno-unused-parameter",
|
||||
"-Wundef",
|
||||
] + select({
|
||||
":is_windows": ["-Wno-macro-redefined"],
|
||||
"//conditions:default": ["-fPIC"],
|
||||
}),
|
||||
defines = [
|
||||
"LIBCXXABI_SILENT_TERMINATE",
|
||||
"_LIBCPP_BUILDING_LIBRARY",
|
||||
"_LIBCPP_CONSTINIT=constinit",
|
||||
"_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
|
||||
"_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE",
|
||||
"_LIBCPP_INSTRUMENTED_WITH_ASAN=0",
|
||||
"_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
|
||||
] + select({
|
||||
"@llvm//platforms/config:musl": [
|
||||
"ANDROID_HOST_MUSL",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
implementation_deps = [
|
||||
":headers",
|
||||
"@//third_party/v8/libcxx_config:headers",
|
||||
"@rusty_v8_libcxx//:headers",
|
||||
"@rusty_v8_libcxx//:internal_headers",
|
||||
] + select({
|
||||
":is_linux": [
|
||||
"@@llvm++kernel_headers+kernel_headers//:kernel_headers",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
"@llvm//platforms/config:gnu": [
|
||||
"@@llvm++glibc+glibc//:gnu_libc_headers",
|
||||
],
|
||||
"@llvm//platforms/config:musl": [
|
||||
"@@llvm++musl+musl_libc//:musl_libc_headers",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
includes = ["src"],
|
||||
textual_hdrs = glob([
|
||||
"src/**/*.def",
|
||||
"src/**/*.h",
|
||||
"src/**/*.inc",
|
||||
]),
|
||||
)
|
||||
17
third_party/v8/llvm_libc.BUILD.bazel
vendored
Normal file
17
third_party/v8/llvm_libc.BUILD.bazel
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
cc_library(
|
||||
name = "headers",
|
||||
hdrs = glob(["**/*.h"]),
|
||||
defines = ["LIBC_NAMESPACE=__llvm_libc_cr"],
|
||||
includes = ["."],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "v8_headers",
|
||||
hdrs = glob(["shared/**/*.h"]),
|
||||
include_prefix = "third_party/llvm-libc/src",
|
||||
deps = [":headers"],
|
||||
)
|
||||
102
third_party/v8/native_windows.bzl
vendored
Normal file
102
third_party/v8/native_windows.bzl
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
"""Inputs for the native Windows V8 build, using rules_cc's installed SDK."""
|
||||
|
||||
load("@llvm//toolchain:selects.bzl", "LLVM_VERSION")
|
||||
load("@rules_cc//cc/private/toolchain:cc_configure.bzl", "MSVC_ENVVARS")
|
||||
load("@rules_cc//cc/private/toolchain:windows_cc_configure.bzl", "configure_windows_toolchain")
|
||||
|
||||
# Match @llvm 0.8.11's bindgen compiler. Unlike its minimal bootstrap seed,
|
||||
# these official distributions also contain the MSVC compiler-rt builtins.
|
||||
_LLVM_WINDOWS = {
|
||||
"x86_64": "d96c2cc1736f4eb7fa43cb9bbdf56d93551a9ae0a9aadb9c99c3c3b2b712a234",
|
||||
"aarch64": "de718c58ebbc5f61d58c17b90457fcf42983bc2c4a4aba3e010d108713bfd7f1",
|
||||
}
|
||||
|
||||
def _native_windows_llvm_impl(repository_ctx):
|
||||
if repository_ctx.os.name.lower().find("windows") != -1:
|
||||
arch = repository_ctx.os.arch.lower()
|
||||
arch = {"amd64": "x86_64", "arm64": "aarch64"}.get(arch, arch)
|
||||
if arch not in _LLVM_WINDOWS:
|
||||
fail("V8's native Windows build supports x64 and arm64, got " + arch)
|
||||
filename = "clang+llvm-%s-%s-pc-windows-msvc" % (LLVM_VERSION, arch)
|
||||
repository_ctx.download_and_extract(
|
||||
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-%s/%s.tar.xz" % (LLVM_VERSION, filename.replace("+", "%2B")),
|
||||
sha256 = _LLVM_WINDOWS[arch],
|
||||
stripPrefix = filename,
|
||||
)
|
||||
|
||||
# Native-only inputs are empty on other hosts, without fetching Windows
|
||||
# archives on Linux/macOS during //... queries or public lockfile checks.
|
||||
repository_ctx.file("BUILD.bazel", """
|
||||
load("@rules_cc//cc:defs.bzl", "cc_import")
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
exports_files(["BUILD.bazel"])
|
||||
filegroup(name = "llvm-readobj", srcs = glob(["bin/llvm-readobj.exe"], allow_empty = True))
|
||||
filegroup(name = "llvm-lib", srcs = glob(["bin/llvm-lib.exe"], allow_empty = True))
|
||||
# Tool paths alone do not invalidate cached C++ actions when the pin changes.
|
||||
# Keep compiler resources and bundled runtime DLLs in the toolchain inputs.
|
||||
filegroup(
|
||||
name = "compiler_files",
|
||||
srcs = glob(["bin/clang-cl.exe", "bin/*.dll", "lib/clang/*/include/**"], allow_empty = True),
|
||||
)
|
||||
filegroup(
|
||||
name = "linker_files",
|
||||
srcs = glob(["bin/lld-link.exe", "bin/*.dll"], allow_empty = True),
|
||||
)
|
||||
filegroup(
|
||||
name = "archiver_files",
|
||||
srcs = glob(["bin/llvm-lib.exe", "bin/*.dll"], allow_empty = True),
|
||||
)
|
||||
filegroup(
|
||||
name = "all_files",
|
||||
srcs = [":compiler_files", ":linker_files", ":archiver_files"],
|
||||
)
|
||||
[
|
||||
filegroup(
|
||||
name = "builtins_" + arch,
|
||||
srcs = glob(["lib/clang/*/lib/windows/clang_rt.builtins-%s.lib" % arch], allow_empty = True),
|
||||
)
|
||||
for arch in ["x86_64", "aarch64"]
|
||||
]
|
||||
filegroup(
|
||||
name = "builtins_archive",
|
||||
srcs = select({
|
||||
"@platforms//cpu:x86_64": [":builtins_x86_64"],
|
||||
"@platforms//cpu:aarch64": [":builtins_aarch64"],
|
||||
}),
|
||||
)
|
||||
cc_import(
|
||||
name = "builtins",
|
||||
static_library = ":builtins_archive",
|
||||
)
|
||||
""")
|
||||
|
||||
native_windows_llvm = repository_rule(
|
||||
implementation = _native_windows_llvm_impl,
|
||||
)
|
||||
|
||||
def _native_windows_cc_impl(repository_ctx):
|
||||
if repository_ctx.os.name.lower().find("windows") != -1:
|
||||
configure_windows_toolchain(repository_ctx)
|
||||
else:
|
||||
repository_ctx.file("BUILD.bazel", "# Native Windows toolchains are only available on Windows.\n")
|
||||
|
||||
native_windows_cc = repository_rule(
|
||||
implementation = _native_windows_cc_impl,
|
||||
attrs = {
|
||||
# A Bazel repo label rather than a user's ambient installation path.
|
||||
# The rules_cc pin patch reads this only for this opt-in repository.
|
||||
"native_llvm": attr.label(allow_single_file = True, mandatory = True),
|
||||
},
|
||||
environ = MSVC_ENVVARS + [
|
||||
"BAZEL_CONLYOPTS",
|
||||
"BAZEL_COPTS",
|
||||
"BAZEL_CXXOPTS",
|
||||
"BAZEL_LINKOPTS",
|
||||
"BAZEL_SH",
|
||||
"BAZEL_WIN32_WINNT",
|
||||
"SYSTEMROOT",
|
||||
"PROGRAMFILES",
|
||||
],
|
||||
configure = True,
|
||||
local = True,
|
||||
)
|
||||
7
third_party/v8/native_windows_link_probe.c
vendored
Normal file
7
third_party/v8/native_windows_link_probe.c
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// __powidf2 is in compiler-rt's generic builtins on both x64 and arm64.
|
||||
// MSVC must resolve it from the staged V8 archive without any LLVM search path.
|
||||
extern double __powidf2(double, int);
|
||||
|
||||
int main(void) {
|
||||
return __powidf2(3.0, 4) == 81.0 ? 0 : 1;
|
||||
}
|
||||
47
third_party/v8/push_registers_gnullvm.S
vendored
Normal file
47
third_party/v8/push_registers_gnullvm.S
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
.text
|
||||
.globl PushAllRegistersAndIterateStack
|
||||
.seh_proc PushAllRegistersAndIterateStack
|
||||
PushAllRegistersAndIterateStack:
|
||||
push %rbp
|
||||
.seh_pushreg %rbp
|
||||
mov %rsp, %rbp
|
||||
.seh_setframe %rbp, 0
|
||||
push $0xCDCDCD
|
||||
.seh_stackalloc 8
|
||||
push %rsi
|
||||
.seh_pushreg %rsi
|
||||
push %rdi
|
||||
.seh_pushreg %rdi
|
||||
push %rbx
|
||||
.seh_pushreg %rbx
|
||||
push %r12
|
||||
.seh_pushreg %r12
|
||||
push %r13
|
||||
.seh_pushreg %r13
|
||||
push %r14
|
||||
.seh_pushreg %r14
|
||||
push %r15
|
||||
.seh_pushreg %r15
|
||||
sub $160, %rsp
|
||||
.seh_stackalloc 160
|
||||
# Preserve Windows unwind metadata even though this is now GNU syntax.
|
||||
# Without the .seh_* directives, SEH and stack walking can mis-handle
|
||||
# unwinding across this callback frame.
|
||||
.seh_endprologue
|
||||
movdqa %xmm6, 144(%rsp)
|
||||
movdqa %xmm7, 128(%rsp)
|
||||
movdqa %xmm8, 112(%rsp)
|
||||
movdqa %xmm9, 96(%rsp)
|
||||
movdqa %xmm10, 80(%rsp)
|
||||
movdqa %xmm11, 64(%rsp)
|
||||
movdqa %xmm12, 48(%rsp)
|
||||
movdqa %xmm13, 32(%rsp)
|
||||
movdqa %xmm14, 16(%rsp)
|
||||
movdqa %xmm15, 0(%rsp)
|
||||
mov %r8, %r9
|
||||
mov %rsp, %r8
|
||||
call *%r9
|
||||
add $224, %rsp
|
||||
pop %rbp
|
||||
ret
|
||||
.seh_endproc
|
||||
16
third_party/v8/rusty_v8_152_2_0.sha256
vendored
Normal file
16
third_party/v8/rusty_v8_152_2_0.sha256
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
feab9ae0384bebaa99c1d000654462c9d42123d587185c7876aaeef7d76ff749 librusty_v8_ptrcomp_sandbox_release_aarch64-apple-darwin.a.gz
|
||||
b9d5652ebca515eb2bf4c2ee4a6551b2567117b5aa720f430d2032616dd7e3b5 src_binding_ptrcomp_sandbox_release_aarch64-apple-darwin.rs
|
||||
daf327876f7753a94b3b05d6d64776258def3ae67503ac75db9c35c6deaa28a5 rusty_v8_ptrcomp_sandbox_release_aarch64-pc-windows-msvc.lib.gz
|
||||
572ed16ff09bb7944f4b35c659ff62dcd3faf43a0351e3f94f011e01b2f92a62 src_binding_ptrcomp_sandbox_release_aarch64-pc-windows-msvc.rs
|
||||
1054464a623006cdf5e25ae20877002bf3edb9a2c2f3e64f44a8714742b15e87 librusty_v8_ptrcomp_sandbox_release_aarch64-unknown-linux-gnu.a.gz
|
||||
3e4d5fecdbe0f98a6017e69d7ca82519a77fb032c5eb5e4cdbecdd3e2ec519d5 src_binding_ptrcomp_sandbox_release_aarch64-unknown-linux-gnu.rs
|
||||
1a60f36a3dd8778802e6980668c4d65a3c7305d85a5d2debf466d9aa0daadd75 librusty_v8_ptrcomp_sandbox_release_aarch64-unknown-linux-musl.a.gz
|
||||
3e4d5fecdbe0f98a6017e69d7ca82519a77fb032c5eb5e4cdbecdd3e2ec519d5 src_binding_ptrcomp_sandbox_release_aarch64-unknown-linux-musl.rs
|
||||
bfe19d9b633b61d99780ece89690427fef4b985c6b4196536eaf94571166fc24 librusty_v8_ptrcomp_sandbox_release_x86_64-apple-darwin.a.gz
|
||||
b9d5652ebca515eb2bf4c2ee4a6551b2567117b5aa720f430d2032616dd7e3b5 src_binding_ptrcomp_sandbox_release_x86_64-apple-darwin.rs
|
||||
cd829415695b30ad61b306b23a381e11276f14bb0b46815ac5ed8b96711d002d rusty_v8_ptrcomp_sandbox_release_x86_64-pc-windows-msvc.lib.gz
|
||||
572ed16ff09bb7944f4b35c659ff62dcd3faf43a0351e3f94f011e01b2f92a62 src_binding_ptrcomp_sandbox_release_x86_64-pc-windows-msvc.rs
|
||||
b3b490f2aa809eda7f6ac727f851fb00ce8355be72827577cfaac28c7137dbcd librusty_v8_ptrcomp_sandbox_release_x86_64-unknown-linux-gnu.a.gz
|
||||
3e4d5fecdbe0f98a6017e69d7ca82519a77fb032c5eb5e4cdbecdd3e2ec519d5 src_binding_ptrcomp_sandbox_release_x86_64-unknown-linux-gnu.rs
|
||||
2f2679773a12576dc6b89b0f7d70e8190e5aea8a57f8f6364efaffdd1497d0e7 librusty_v8_ptrcomp_sandbox_release_x86_64-unknown-linux-musl.a.gz
|
||||
3e4d5fecdbe0f98a6017e69d7ca82519a77fb032c5eb5e4cdbecdd3e2ec519d5 src_binding_ptrcomp_sandbox_release_x86_64-unknown-linux-musl.rs
|
||||
8
third_party/v8/rusty_v8_152_2_0_release_manifests.sha256
vendored
Normal file
8
third_party/v8/rusty_v8_152_2_0_release_manifests.sha256
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
5cebc5830127b460ae8af23004430fd70b535bb22d599d68d024b60df08400d8 rusty_v8_ptrcomp_sandbox_release_aarch64-apple-darwin.sha256
|
||||
a4c895148240270c8b685bf0b86ca6257533c3ecad8833560e462b0854cb3bfc rusty_v8_ptrcomp_sandbox_release_aarch64-pc-windows-msvc.sha256
|
||||
94195fe3a70a6043474afabd145c0bbe322f409e95a52c745d64c9f929f80a22 rusty_v8_ptrcomp_sandbox_release_aarch64-unknown-linux-gnu.sha256
|
||||
c35b823c23c32d349029467e8fa75cc492146a658dc5bd37597d93b125cc64e8 rusty_v8_ptrcomp_sandbox_release_aarch64-unknown-linux-musl.sha256
|
||||
f9259abda68c50bfd71d856ece97d272832ac9c18e91fdc892fa9625a003b7bc rusty_v8_ptrcomp_sandbox_release_x86_64-apple-darwin.sha256
|
||||
e16bf2d7bc4b64a96a89e87048d61b9c466040e4c82ae64cfe9f7f2052ef3179 rusty_v8_ptrcomp_sandbox_release_x86_64-pc-windows-msvc.sha256
|
||||
1ec730635970ab1c0e8f4764ea113ad29d69d7f8d4c2ae69f3d766434a759350 rusty_v8_ptrcomp_sandbox_release_x86_64-unknown-linux-gnu.sha256
|
||||
12acf8747729db642a9d49d3448174471fb07cf47e01a6238222e2d9299de72f rusty_v8_ptrcomp_sandbox_release_x86_64-unknown-linux-musl.sha256
|
||||
35
third_party/v8/simdutf.BUILD.bazel
vendored
Normal file
35
third_party/v8/simdutf.BUILD.bazel
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
# 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"]),
|
||||
# Match V8's C++20 feature macros, including atomic_ref for the base64 API.
|
||||
copts = select({
|
||||
"@@//third_party/v8:platform_windows_msvc": [
|
||||
"/std:c++20",
|
||||
"/Zc:__cplusplus",
|
||||
],
|
||||
"//conditions:default": ["-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,
|
||||
)
|
||||
21
third_party/v8/v8_crate.BUILD.bazel
vendored
Normal file
21
third_party/v8/v8_crate.BUILD.bazel
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
filegroup(
|
||||
name = "binding_cc",
|
||||
srcs = ["src/binding.cc"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "binding_hpp",
|
||||
srcs = ["src/binding.hpp"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "crdtp_binding_cc",
|
||||
srcs = ["src/crdtp_binding.cc"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "support_h",
|
||||
srcs = ["src/support.h"],
|
||||
)
|
||||
254
third_party/v8/v8_defs.patch
vendored
Normal file
254
third_party/v8/v8_defs.patch
vendored
Normal file
@@ -0,0 +1,254 @@
|
||||
# What: adapt the pinned V8 rule helpers to Codex's engine configuration.
|
||||
# Scope: bazel/defs.bzl and bazel/config/v8-target-cpu.bzl; the engine graph
|
||||
# and dependency choices live in third_party/v8/engine.BUILD.bazel. ABI,
|
||||
# runtime and CPU settings are internal outputs of artifact_profile.bzl.
|
||||
# Preserve Chromium libc++ headers/runtime, Clang Windows driver flags, and
|
||||
# the Windows target-ABI snapshot tool. The optional
|
||||
# Linux backtrace link flag is omitted because that feature is fixed off.
|
||||
# On a V8 pin change, review these hunks and build the native canary matrix.
|
||||
|
||||
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
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
_create_option_flag = rule(
|
||||
implementation = _options_impl,
|
||||
- build_setting = config.bool(flag = True),
|
||||
+ build_setting = config.bool(flag = False),
|
||||
attrs = {
|
||||
"scope": attr.string(),
|
||||
},
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
_create_option_string = rule(
|
||||
implementation = _options_impl,
|
||||
- build_setting = config.string(flag = True),
|
||||
+ build_setting = config.string(flag = False),
|
||||
attrs = {
|
||||
"scope": attr.string(),
|
||||
},
|
||||
@@ -42,12 +42,30 @@
|
||||
)
|
||||
|
||||
def v8_flag(name, default = False):
|
||||
- _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(
|
||||
+ name = "is_" + name,
|
||||
+ flag_values = {name: "True"},
|
||||
+ visibility = ["//visibility:public"],
|
||||
+ )
|
||||
+ native.config_setting(
|
||||
+ name = "is_not_" + name,
|
||||
+ flag_values = {name: "False"},
|
||||
+ visibility = ["//visibility:public"],
|
||||
+ )
|
||||
+
|
||||
+def v8_string(name, default = "", visibility = None):
|
||||
+ _create_option_string(
|
||||
+ name = name,
|
||||
+ build_setting_default = default,
|
||||
+ scope = "universal",
|
||||
+ visibility = visibility,
|
||||
+ )
|
||||
|
||||
def v8_int(name, default = 0):
|
||||
_create_option_int(name = name, build_setting_default = default, scope = "universal")
|
||||
@@ -106,7 +124,18 @@
|
||||
|
||||
def _default_args():
|
||||
return struct(
|
||||
- deps = [":define_flags", "@libcxx//:libc++"],
|
||||
+ deps = [":define_flags"] + select({
|
||||
+ "@v8//:is_v8_use_rusty_v8_custom_libcxx": [
|
||||
+ "@@//third_party/v8:rusty_v8_custom_libcxx_headers",
|
||||
+ "@@//third_party/v8:rusty_v8_custom_libcxx_runtime",
|
||||
+ ],
|
||||
+ "//conditions:default": [],
|
||||
+ }) + select({
|
||||
+ "@@//third_party/v8:platform_windows_msvc": [
|
||||
+ "@@//third_party/v8:native_windows_compiler_builtins",
|
||||
+ ],
|
||||
+ "//conditions:default": [],
|
||||
+ }),
|
||||
defines = select({
|
||||
"@v8//bazel/config:is_windows": [
|
||||
"UNICODE",
|
||||
@@ -136,11 +165,27 @@
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
- "@v8//bazel/config:is_clang": [
|
||||
- "-Wno-invalid-offsetof",
|
||||
- "-Wno-deprecated-this-capture",
|
||||
- "-Wno-deprecated-declarations",
|
||||
- "-std=c++20",
|
||||
+ "@@//third_party/v8:use_rusty_v8_custom_libcxx_native_windows": [
|
||||
+ "/D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
|
||||
+ "/D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE",
|
||||
+ "/D_LIBCPP_INSTRUMENTED_WITH_ASAN=0",
|
||||
+ ],
|
||||
+ "@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({
|
||||
+ "@@//third_party/v8:platform_windows_msvc": [
|
||||
+ "/std:c++20",
|
||||
+ "/Zc:__cplusplus",
|
||||
+ "/clang:-fconstexpr-steps=2000000",
|
||||
+ "/clang:-Wno-deprecated-declarations",
|
||||
+ "/clang:-Wno-deprecated-this-capture",
|
||||
+ "/clang:-Wno-invalid-offsetof",
|
||||
],
|
||||
"@v8//bazel/config:is_gcc": [
|
||||
"-Wno-extra",
|
||||
@@ -161,9 +206,17 @@
|
||||
"-std=gnu++2a",
|
||||
],
|
||||
"@v8//bazel/config:is_windows": [
|
||||
- "/std:c++20",
|
||||
- ],
|
||||
- "//conditions:default": [],
|
||||
+ "-Wno-invalid-offsetof",
|
||||
+ "-Wno-deprecated-this-capture",
|
||||
+ "-Wno-deprecated-declarations",
|
||||
+ "-std=c++20",
|
||||
+ ],
|
||||
+ "//conditions:default": [
|
||||
+ "-Wno-invalid-offsetof",
|
||||
+ "-Wno-deprecated-this-capture",
|
||||
+ "-Wno-deprecated-declarations",
|
||||
+ "-std=c++20",
|
||||
+ ],
|
||||
}) + select({
|
||||
"@v8//bazel/config:is_gcc_fastbuild": [
|
||||
# Non-debug builds without optimizations fail because
|
||||
@@ -186,16 +239,18 @@
|
||||
}),
|
||||
includes = ["include"],
|
||||
linkopts = select({
|
||||
- "@v8//bazel/config:is_windows": [
|
||||
+ "@@//third_party/v8:platform_windows_msvc": [
|
||||
"Winmm.lib",
|
||||
"DbgHelp.lib",
|
||||
"Advapi32.lib",
|
||||
],
|
||||
+ "@v8//bazel/config:is_windows": [
|
||||
+ "-lwinmm",
|
||||
+ "-ldbghelp",
|
||||
+ "-ladvapi32",
|
||||
+ ],
|
||||
"@v8//bazel/config:is_macos": ["-pthread"],
|
||||
- "//conditions:default": ["-Wl,--no-as-needed -ldl -latomic -pthread"],
|
||||
- }) + select({
|
||||
- ":should_add_rdynamic": ["-rdynamic"],
|
||||
- "//conditions:default": [],
|
||||
+ "//conditions:default": ["-Wl,--no-as-needed -ldl -pthread"],
|
||||
}),
|
||||
)
|
||||
|
||||
@@ -466,6 +521,12 @@
|
||||
def _mksnapshot(ctx):
|
||||
prefix = ctx.attr.prefix
|
||||
suffix = ctx.attr.suffix
|
||||
+
|
||||
+ # Windows cross-builds use Linux for the exec configuration, but the
|
||||
+ # snapshot generator must match the target ABI and run on the Windows
|
||||
+ # runner. Action strategies only choose where an action runs; they cannot
|
||||
+ # change this executable from the exec to the target configuration.
|
||||
+ tool = ctx.executable.target_tool if ctx.attr.target_os == "win" else ctx.executable.tool
|
||||
outs = [
|
||||
ctx.actions.declare_file(prefix + "/snapshot" + suffix + ".cc"),
|
||||
ctx.actions.declare_file(prefix + "/embedded" + suffix + ".S"),
|
||||
@@ -483,9 +544,22 @@
|
||||
"--embedded_src",
|
||||
outs[1].path,
|
||||
] + ctx.attr.args,
|
||||
- executable = ctx.executable.tool,
|
||||
+ executable = tool,
|
||||
progress_message = "Running mksnapshot",
|
||||
)
|
||||
+ if ctx.attr.inline_asm_converter:
|
||||
+ # The installed Windows toolchain sends .S files to MASM. V8 provides
|
||||
+ # this conversion for clang-cl so its generated assembly is compiled
|
||||
+ # as C++, using the same target flags as the rest of the engine.
|
||||
+ embedded_cc = ctx.actions.declare_file(prefix + "/embedded" + suffix + ".cc")
|
||||
+ ctx.actions.run(
|
||||
+ executable = ctx.attr.inline_asm_converter[DefaultInfo].files_to_run,
|
||||
+ inputs = [outs[1]],
|
||||
+ outputs = [embedded_cc],
|
||||
+ arguments = [outs[1].path, embedded_cc.path],
|
||||
+ mnemonic = "V8NativeWindowsInlineAssembly",
|
||||
+ )
|
||||
+ outs = [outs[0], embedded_cc]
|
||||
return [DefaultInfo(files = depset(outs))]
|
||||
|
||||
_v8_mksnapshot = rule(
|
||||
@@ -498,6 +572,13 @@
|
||||
executable = True,
|
||||
cfg = "exec",
|
||||
),
|
||||
+ "target_tool": attr.label(
|
||||
+ mandatory = True,
|
||||
+ allow_files = True,
|
||||
+ executable = True,
|
||||
+ cfg = "target",
|
||||
+ ),
|
||||
+ "inline_asm_converter": attr.label(executable = True, cfg = "exec"),
|
||||
"target_os": attr.string(mandatory = True),
|
||||
"prefix": attr.string(mandatory = True),
|
||||
"suffix": attr.string(mandatory = True),
|
||||
@@ -511,6 +592,11 @@
|
||||
args = args,
|
||||
prefix = "noicu",
|
||||
tool = ":noicu/mksnapshot" + suffix,
|
||||
+ target_tool = ":noicu/mksnapshot" + suffix,
|
||||
+ inline_asm_converter = select({
|
||||
+ "@@//third_party/v8:platform_windows_msvc": ":native_windows_inline_asm",
|
||||
+ "//conditions:default": None,
|
||||
+ }),
|
||||
suffix = suffix,
|
||||
target_os = select({
|
||||
"@v8//bazel/config:is_macos": "mac",
|
||||
@@ -523,6 +609,11 @@
|
||||
args = args,
|
||||
prefix = "icu",
|
||||
tool = ":icu/mksnapshot" + suffix,
|
||||
+ target_tool = ":icu/mksnapshot" + suffix,
|
||||
+ inline_asm_converter = select({
|
||||
+ "@@//third_party/v8:platform_windows_msvc": ":native_windows_inline_asm",
|
||||
+ "//conditions:default": None,
|
||||
+ }),
|
||||
suffix = suffix,
|
||||
target_os = select({
|
||||
"@v8//bazel/config:is_macos": "mac",
|
||||
diff --git a/orig/v8-15.2.124.1/bazel/config/v8-target-cpu.bzl b/mod/v8-15.2.124.1/bazel/config/v8-target-cpu.bzl
|
||||
--- a/orig/v8-15.2.124.1/bazel/config/v8-target-cpu.bzl
|
||||
+++ b/mod/v8-15.2.124.1/bazel/config/v8-target-cpu.bzl
|
||||
@@ -24,8 +24,8 @@
|
||||
|
||||
v8_target_cpu = rule(
|
||||
implementation = _host_target_cpu_impl,
|
||||
- build_setting = config.string(flag = True),
|
||||
- doc = "CPU that V8 will generate code for.",
|
||||
+ build_setting = config.string(flag = False),
|
||||
+ doc = "Internal CPU that V8 generates code for; set by the artifact transition.",
|
||||
attrs = {
|
||||
"scope": attr.string(),
|
||||
},
|
||||
Reference in New Issue
Block a user