mirror of
https://github.com/openai/codex.git
synced 2026-10-19 16:17:49 +00:00
V8 Bazel Build (#15021)
Alternative approach, we use rusty_v8 for all platforms that its predefined, but lets build from source a musl v8 version with bazel for x86 and aarch64 only. We would need to release this on github and then use the release.
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
exports_files([
|
||||
"aws-lc-sys_memcmp_check.patch",
|
||||
"v8_bazel_rules.patch",
|
||||
"v8_module_deps.patch",
|
||||
"v8_source_portability.patch",
|
||||
"windows-link.patch",
|
||||
])
|
||||
|
||||
@@ -0,0 +1,227 @@
|
||||
# What: adapt upstream V8 Bazel rules to this workspace's hermetic toolchains
|
||||
# and externally provided dependencies.
|
||||
# Scope: Bazel BUILD/defs/BUILD.icu integration only, including dependency
|
||||
# wiring, generated sources, and visibility; no standalone V8 source patching.
|
||||
|
||||
diff --git a/orig/v8-14.6.202.11/bazel/defs.bzl b/mod/v8-14.6.202.11/bazel/defs.bzl
|
||||
index 9648e4a..88efd41 100644
|
||||
--- a/orig/v8-14.6.202.11/bazel/defs.bzl
|
||||
+++ b/mod/v8-14.6.202.11/bazel/defs.bzl
|
||||
@@ -97,7 +97,7 @@ v8_config = rule(
|
||||
|
||||
def _default_args():
|
||||
return struct(
|
||||
- deps = [":define_flags", "@libcxx//:libc++"],
|
||||
+ deps = [":define_flags"],
|
||||
defines = select({
|
||||
"@v8//bazel/config:is_windows": [
|
||||
"UNICODE",
|
||||
@@ -128,12 +128,6 @@ def _default_args():
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
- "@v8//bazel/config:is_clang": [
|
||||
- "-Wno-invalid-offsetof",
|
||||
- "-Wno-deprecated-this-capture",
|
||||
- "-Wno-deprecated-declarations",
|
||||
- "-std=c++20",
|
||||
- ],
|
||||
"@v8//bazel/config:is_gcc": [
|
||||
"-Wno-extra",
|
||||
"-Wno-array-bounds",
|
||||
@@ -155,7 +149,12 @@ def _default_args():
|
||||
"@v8//bazel/config:is_windows": [
|
||||
"/std:c++20",
|
||||
],
|
||||
- "//conditions:default": [],
|
||||
+ "//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
|
||||
@@ -184,7 +183,7 @@ def _default_args():
|
||||
"Advapi32.lib",
|
||||
],
|
||||
"@v8//bazel/config:is_macos": ["-pthread"],
|
||||
- "//conditions:default": ["-Wl,--no-as-needed -ldl -latomic -pthread"],
|
||||
+ "//conditions:default": ["-Wl,--no-as-needed -ldl -pthread"],
|
||||
}) + select({
|
||||
":should_add_rdynamic": ["-rdynamic"],
|
||||
"//conditions:default": [],
|
||||
diff --git a/orig/v8-14.6.202.11/BUILD.bazel b/mod/v8-14.6.202.11/BUILD.bazel
|
||||
index 85f31b7..7314584 100644
|
||||
--- a/orig/v8-14.6.202.11/BUILD.bazel
|
||||
+++ b/mod/v8-14.6.202.11/BUILD.bazel
|
||||
@@ -303,7 +303,7 @@ v8_int(
|
||||
# If no explicit value for v8_enable_pointer_compression, we set it to 'none'.
|
||||
v8_string(
|
||||
name = "v8_enable_pointer_compression",
|
||||
- default = "none",
|
||||
+ default = "False",
|
||||
)
|
||||
|
||||
# Default setting for v8_enable_pointer_compression.
|
||||
@@ -4077,28 +4077,14 @@ filegroup(
|
||||
}),
|
||||
)
|
||||
|
||||
-v8_library(
|
||||
- name = "lib_dragonbox",
|
||||
- srcs = ["third_party/dragonbox/src/include/dragonbox/dragonbox.h"],
|
||||
- hdrs = [
|
||||
- "third_party/dragonbox/src/include/dragonbox/dragonbox.h",
|
||||
- ],
|
||||
- includes = [
|
||||
- "third_party/dragonbox/src/include",
|
||||
- ],
|
||||
+alias(
|
||||
+ name = "lib_dragonbox",
|
||||
+ actual = "@dragonbox//:dragonbox",
|
||||
)
|
||||
|
||||
-v8_library(
|
||||
- name = "lib_fp16",
|
||||
- srcs = ["third_party/fp16/src/include/fp16.h"],
|
||||
- hdrs = [
|
||||
- "third_party/fp16/src/include/fp16/fp16.h",
|
||||
- "third_party/fp16/src/include/fp16/bitcasts.h",
|
||||
- "third_party/fp16/src/include/fp16/macros.h",
|
||||
- ],
|
||||
- includes = [
|
||||
- "third_party/fp16/src/include",
|
||||
- ],
|
||||
+alias(
|
||||
+ name = "lib_fp16",
|
||||
+ actual = "@fp16//:fp16",
|
||||
)
|
||||
|
||||
filegroup(
|
||||
@@ -4405,6 +4391,20 @@ genrule(
|
||||
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",
|
||||
@@ -4426,15 +4426,19 @@ genrule(
|
||||
"src/inspector/protocol/Schema.cpp",
|
||||
"src/inspector/protocol/Schema.h",
|
||||
],
|
||||
- cmd = "$(location :code_generator) --jinja_dir . \
|
||||
- --inspector_protocol_dir third_party/inspector_protocol \
|
||||
+ cmd = "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) \
|
||||
--output_base $(@D)/src/inspector",
|
||||
local = 1,
|
||||
message = "Generating inspector files",
|
||||
tools = [
|
||||
- ":code_generator",
|
||||
+ "@rules_python//python/bin:python",
|
||||
+ requirement("jinja2"),
|
||||
+ requirement("markupsafe"),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -4448,6 +4451,15 @@ filegroup(
|
||||
],
|
||||
)
|
||||
|
||||
+cc_library(
|
||||
+ name = "rusty_v8_internal_headers",
|
||||
+ hdrs = [
|
||||
+ "src/libplatform/default-platform.h",
|
||||
+ ],
|
||||
+ strip_include_prefix = "",
|
||||
+ visibility = ["//visibility:public"],
|
||||
+)
|
||||
+
|
||||
filegroup(
|
||||
name = "d8_files",
|
||||
srcs = [
|
||||
@@ -4567,16 +4579,9 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
-cc_library(
|
||||
- name = "simdutf",
|
||||
- srcs = ["third_party/simdutf/simdutf.cpp"],
|
||||
- hdrs = ["third_party/simdutf/simdutf.h"],
|
||||
- copts = select({
|
||||
- "@v8//bazel/config:is_clang": ["-std=c++20"],
|
||||
- "@v8//bazel/config:is_gcc": ["-std=gnu++2a"],
|
||||
- "@v8//bazel/config:is_windows": ["/std:c++20"],
|
||||
- "//conditions:default": [],
|
||||
- }),
|
||||
+alias(
|
||||
+ name = "simdutf",
|
||||
+ actual = "@simdutf//:simdutf",
|
||||
)
|
||||
|
||||
v8_library(
|
||||
@@ -4593,7 +4598,7 @@ v8_library(
|
||||
copts = ["-Wno-implicit-fallthrough"],
|
||||
icu_deps = [
|
||||
":icu/generated_torque_definitions_headers",
|
||||
- "//external:icu",
|
||||
+ "@icu//:icu",
|
||||
],
|
||||
icu_srcs = [
|
||||
":generated_regexp_special_case",
|
||||
@@ -4608,7 +4613,7 @@ v8_library(
|
||||
],
|
||||
deps = [
|
||||
":lib_dragonbox",
|
||||
- "//third_party/fast_float/src:fast_float",
|
||||
+ "@fast_float//:fast_float",
|
||||
":lib_fp16",
|
||||
":simdutf",
|
||||
":v8_libbase",
|
||||
@@ -4664,6 +4669,7 @@ alias(
|
||||
alias(
|
||||
name = "core_lib_icu",
|
||||
actual = "icu/v8",
|
||||
+ visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
v8_library(
|
||||
@@ -4715,7 +4721,7 @@ v8_binary(
|
||||
],
|
||||
deps = [
|
||||
":v8_libbase",
|
||||
- "//external:icu",
|
||||
+ "@icu//:icu",
|
||||
],
|
||||
)
|
||||
|
||||
diff --git a/orig/v8-14.6.202.11/bazel/BUILD.icu b/mod/v8-14.6.202.11/bazel/BUILD.icu
|
||||
index 5fda2f4..381386c 100644
|
||||
--- a/orig/v8-14.6.202.11/bazel/BUILD.icu
|
||||
+++ b/mod/v8-14.6.202.11/bazel/BUILD.icu
|
||||
@@ -1,3 +1,5 @@
|
||||
+load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
+
|
||||
# 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.
|
||||
@@ -0,0 +1,256 @@
|
||||
# What: replace upstream V8 module dependency bootstrapping with repository
|
||||
# declarations and dependency setup that match this Bazel workspace.
|
||||
# Scope: upstream MODULE.bazel only; affects external repo resolution and Bazel
|
||||
# module wiring, not V8 source files.
|
||||
|
||||
diff --git a/orig/v8-14.6.202.11/MODULE.bazel b/mod/v8-14.6.202.11/MODULE.bazel
|
||||
--- a/orig/v8-14.6.202.11/MODULE.bazel
|
||||
+++ b/mod/v8-14.6.202.11/MODULE.bazel
|
||||
@@ -8,7 +8,57 @@
|
||||
bazel_dep(name = "rules_python", version = "1.0.0")
|
||||
bazel_dep(name = "platforms", version = "1.0.0")
|
||||
bazel_dep(name = "abseil-cpp", version = "20250814.0")
|
||||
-bazel_dep(name = "highway", version = "1.2.0")
|
||||
+bazel_dep(name = "rules_license", version = "0.0.4")
|
||||
+
|
||||
+git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
|
||||
+http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
+
|
||||
+http_archive(
|
||||
+ name = "highway",
|
||||
+ patch_args = ["-p1"],
|
||||
+ patches = ["@v8//:bazel/highway.patch"],
|
||||
+ sha256 = "7e0be78b8318e8bdbf6fa545d2ecb4c90f947df03f7aadc42c1967f019e63343",
|
||||
+ strip_prefix = "highway-1.2.0",
|
||||
+ urls = ["https://github.com/google/highway/archive/refs/tags/1.2.0.tar.gz"],
|
||||
+)
|
||||
+
|
||||
+git_repository(
|
||||
+ name = "icu",
|
||||
+ build_file = "@v8//:bazel/BUILD.icu",
|
||||
+ commit = "a86a32e67b8d1384b33f8fa48c83a6079b86f8cd",
|
||||
+ patch_cmds = ["find source -name BUILD.bazel | xargs rm"],
|
||||
+ patch_cmds_win = ["Get-ChildItem -Path source -File -Include BUILD.bazel -Recurse | Remove-Item"],
|
||||
+ remote = "https://chromium.googlesource.com/chromium/deps/icu.git",
|
||||
+)
|
||||
+
|
||||
+http_archive(
|
||||
+ name = "fast_float",
|
||||
+ build_file_content = 'load("@rules_cc//cc:defs.bzl", "cc_library")\n\ncc_library(\n name = "fast_float",\n hdrs = glob(["include/fast_float/*.h"]),\n include_prefix = "third_party/fast_float/src/include",\n strip_include_prefix = "include",\n visibility = ["//visibility:public"],\n)\n',
|
||||
+ sha256 = "e14a33089712b681d74d94e2a11362643bd7d769ae8f7e7caefe955f57f7eacd",
|
||||
+ strip_prefix = "fast_float-8.0.2",
|
||||
+ urls = ["https://github.com/fastfloat/fast_float/archive/refs/tags/v8.0.2.tar.gz"],
|
||||
+)
|
||||
+
|
||||
+git_repository(
|
||||
+ name = "simdutf",
|
||||
+ build_file_content = 'load("@rules_cc//cc:defs.bzl", "cc_library")\n\ncc_library(\n name = "simdutf",\n srcs = ["simdutf.cpp"],\n hdrs = ["simdutf.h"],\n copts = ["-std=c++20"],\n include_prefix = "third_party/simdutf",\n visibility = ["//visibility:public"],\n)\n',
|
||||
+ commit = "93b35aec29256f705c97f675fe4623578bd7a395",
|
||||
+ remote = "https://chromium.googlesource.com/chromium/src/third_party/simdutf",
|
||||
+)
|
||||
+
|
||||
+git_repository(
|
||||
+ name = "dragonbox",
|
||||
+ build_file_content = 'load("@rules_cc//cc:defs.bzl", "cc_library")\n\ncc_library(\n name = "dragonbox",\n hdrs = ["include/dragonbox/dragonbox.h"],\n include_prefix = "third_party/dragonbox/src/include",\n strip_include_prefix = "include",\n visibility = ["//visibility:public"],\n)\n',
|
||||
+ commit = "beeeef91cf6fef89a4d4ba5e95d47ca64ccb3a44",
|
||||
+ remote = "https://chromium.googlesource.com/external/github.com/jk-jeon/dragonbox.git",
|
||||
+)
|
||||
+
|
||||
+git_repository(
|
||||
+ name = "fp16",
|
||||
+ build_file_content = 'load("@rules_cc//cc:defs.bzl", "cc_library")\n\ncc_library(\n name = "fp16",\n hdrs = glob(["include/**/*.h"]),\n include_prefix = "third_party/fp16/src/include",\n includes = ["include"],\n strip_include_prefix = "include",\n visibility = ["//visibility:public"],\n)\n',
|
||||
+ commit = "3d2de1816307bac63c16a297e8c4dc501b4076df",
|
||||
+ remote = "https://chromium.googlesource.com/external/github.com/Maratyszcza/FP16.git",
|
||||
+)
|
||||
|
||||
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
|
||||
pip.parse(
|
||||
@@ -22,171 +72,3 @@
|
||||
)
|
||||
use_repo(pip, "v8_python_deps")
|
||||
|
||||
-# Define the local LLVM toolchain repository
|
||||
-llvm_toolchain_repository = use_repo_rule("//bazel/toolchain:llvm_repository.bzl", "llvm_toolchain_repository")
|
||||
-
|
||||
-llvm_toolchain_repository(
|
||||
- name = "llvm_toolchain",
|
||||
- path = "third_party/llvm-build/Release+Asserts",
|
||||
- config_file_content = """
|
||||
-load("@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl", "feature", "flag_group", "flag_set", "tool_path")
|
||||
-
|
||||
-def _impl(ctx):
|
||||
- tool_paths = [
|
||||
- tool_path(name = "gcc", path = "bin/clang"),
|
||||
- tool_path(name = "ld", path = "bin/lld"),
|
||||
- tool_path(name = "ar", path = "bin/llvm-ar"),
|
||||
- tool_path(name = "cpp", path = "bin/clang++"),
|
||||
- tool_path(name = "gcov", path = "/bin/false"),
|
||||
- tool_path(name = "nm", path = "bin/llvm-nm"),
|
||||
- tool_path(name = "objdump", path = "bin/llvm-objdump"),
|
||||
- tool_path(name = "strip", path = "bin/llvm-strip"),
|
||||
- ]
|
||||
-
|
||||
- features = [
|
||||
- feature(
|
||||
- name = "default_compile_flags",
|
||||
- enabled = True,
|
||||
- flag_sets = [
|
||||
- flag_set(
|
||||
- actions = [
|
||||
- "c-compile",
|
||||
- "c++-compile",
|
||||
- "c++-header-parsing",
|
||||
- "c++-module-compile",
|
||||
- "c++-module-codegen",
|
||||
- "linkstamp-compile",
|
||||
- "assemble",
|
||||
- "preprocess-assemble",
|
||||
- ],
|
||||
- flag_groups = [
|
||||
- flag_group(
|
||||
- flags = [
|
||||
- "--sysroot={WORKSPACE_ROOT}/build/linux/debian_bullseye_amd64-sysroot",
|
||||
- "-nostdinc++",
|
||||
- "-isystem",
|
||||
- "{WORKSPACE_ROOT}/buildtools/third_party/libc++",
|
||||
- "-isystem",
|
||||
- "{WORKSPACE_ROOT}/third_party/libc++/src/include",
|
||||
- "-isystem",
|
||||
- "{WORKSPACE_ROOT}/third_party/libc++abi/src/include",
|
||||
- "-isystem",
|
||||
- "{WORKSPACE_ROOT}/third_party/libc++/src/src",
|
||||
- "-isystem",
|
||||
- "{WORKSPACE_ROOT}/third_party/llvm-libc/src",
|
||||
- "-D_LIBCPP_HARDENING_MODE_DEFAULT=_LIBCPP_HARDENING_MODE_NONE",
|
||||
- "-DLIBC_NAMESPACE=__llvm_libc_cr",
|
||||
- ],
|
||||
- ),
|
||||
- ],
|
||||
- ),
|
||||
- ],
|
||||
- ),
|
||||
- feature(
|
||||
- name = "default_linker_flags",
|
||||
- enabled = True,
|
||||
- flag_sets = [
|
||||
- flag_set(
|
||||
- actions = [
|
||||
- "c++-link-executable",
|
||||
- "c++-link-dynamic-library",
|
||||
- "c++-link-nodeps-dynamic-library",
|
||||
- ],
|
||||
- flag_groups = [
|
||||
- flag_group(
|
||||
- flags = [
|
||||
- "--sysroot={WORKSPACE_ROOT}/build/linux/debian_bullseye_amd64-sysroot",
|
||||
- "-fuse-ld=lld",
|
||||
- "-lm",
|
||||
- "-lpthread",
|
||||
- ],
|
||||
- ),
|
||||
- ],
|
||||
- ),
|
||||
- ],
|
||||
- ),
|
||||
- ]
|
||||
-
|
||||
- return cc_common.create_cc_toolchain_config_info(
|
||||
- ctx = ctx,
|
||||
- features = features,
|
||||
- cxx_builtin_include_directories = [
|
||||
- "{WORKSPACE_ROOT}/buildtools/third_party/libc++",
|
||||
- "{WORKSPACE_ROOT}/third_party/libc++/src/include",
|
||||
- "{WORKSPACE_ROOT}/third_party/libc++abi/src/include",
|
||||
- "{WORKSPACE_ROOT}/third_party/libc++/src/src",
|
||||
- "{WORKSPACE_ROOT}/third_party/llvm-libc/src",
|
||||
- "{WORKSPACE_ROOT}/third_party/llvm-build/Release+Asserts/lib/clang/22/include",
|
||||
- "{WORKSPACE_ROOT}/third_party/llvm-build/Release+Asserts/lib/clang/23/include",
|
||||
- "{WORKSPACE_ROOT}/build/linux/debian_bullseye_amd64-sysroot/usr/include",
|
||||
- "{WORKSPACE_ROOT}/build/linux/debian_bullseye_amd64-sysroot/usr/local/include",
|
||||
- ],
|
||||
- toolchain_identifier = "local_clang",
|
||||
- host_system_name = "local",
|
||||
- target_system_name = "local",
|
||||
- target_cpu = "k8",
|
||||
- target_libc = "unknown",
|
||||
- compiler = "clang",
|
||||
- abi_version = "unknown",
|
||||
- abi_libc_version = "unknown",
|
||||
- tool_paths = tool_paths,
|
||||
- )
|
||||
-
|
||||
-cc_toolchain_config = rule(
|
||||
- implementation = _impl,
|
||||
- attrs = {},
|
||||
- provides = [CcToolchainConfigInfo],
|
||||
-)
|
||||
-""",
|
||||
- build_file_content = """
|
||||
-load(":cc_toolchain_config.bzl", "cc_toolchain_config")
|
||||
-
|
||||
-package(default_visibility = ["//visibility:public"])
|
||||
-
|
||||
-filegroup(
|
||||
- name = "all_files",
|
||||
- srcs = glob(["**/*"]),
|
||||
-)
|
||||
-
|
||||
-filegroup(name = "empty")
|
||||
-
|
||||
-cc_toolchain_config(name = "k8_toolchain_config")
|
||||
-
|
||||
-cc_toolchain(
|
||||
- name = "k8_toolchain",
|
||||
- all_files = ":all_files",
|
||||
- ar_files = ":all_files",
|
||||
- compiler_files = ":all_files",
|
||||
- dwp_files = ":empty",
|
||||
- linker_files = ":all_files",
|
||||
- objcopy_files = ":all_files",
|
||||
- strip_files = ":all_files",
|
||||
- supports_param_files = 0,
|
||||
- toolchain_config = ":k8_toolchain_config",
|
||||
- toolchain_identifier = "local_clang",
|
||||
-)
|
||||
-
|
||||
-toolchain(
|
||||
- name = "cc_toolchain_k8",
|
||||
- exec_compatible_with = [
|
||||
- "@platforms//cpu:x86_64",
|
||||
- "@platforms//os:linux",
|
||||
- ],
|
||||
- target_compatible_with = [
|
||||
- "@platforms//cpu:x86_64",
|
||||
- "@platforms//os:linux",
|
||||
- ],
|
||||
- toolchain = ":k8_toolchain",
|
||||
- toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
|
||||
-)
|
||||
-""",
|
||||
-)
|
||||
-
|
||||
-register_toolchains("@llvm_toolchain//:cc_toolchain_k8")
|
||||
-
|
||||
-# Define local repository for libc++ from third_party sources
|
||||
-libcxx_repository = use_repo_rule("//bazel/toolchain:libcxx_repository.bzl", "libcxx_repository")
|
||||
-
|
||||
-libcxx_repository(
|
||||
- name = "libcxx",
|
||||
-)
|
||||
diff --git a/orig/v8-14.6.202.11/bazel/highway.patch b/mod/v8-14.6.202.11/bazel/highway.patch
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/mod/v8-14.6.202.11/bazel/highway.patch
|
||||
@@ -0,0 +1,12 @@
|
||||
+diff --git a/BUILD b/BUILD
|
||||
+--- a/BUILD
|
||||
++++ b/BUILD
|
||||
+@@ -2,7 +2,7 @@
|
||||
+ load("@bazel_skylib//lib:selects.bzl", "selects")
|
||||
+ load("@rules_license//rules:license.bzl", "license")
|
||||
+
|
||||
+-load("@rules_cc//cc:defs.bzl", "cc_test")
|
||||
++load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
+ # Placeholder#2 for Guitar, do not remove
|
||||
+
|
||||
+ package(
|
||||
@@ -0,0 +1,78 @@
|
||||
# What: make upstream V8 sources build cleanly in this hermetic toolchain setup.
|
||||
# Scope: minimal source-level portability fixes only, such as libexecinfo guards,
|
||||
# weak glibc symbol handling, and warning annotations; no dependency
|
||||
# include-path rewrites or intentional V8 feature changes.
|
||||
|
||||
diff --git a/orig/v8-14.6.202.11/src/base/debug/stack_trace_posix.cc b/mod/v8-14.6.202.11/src/base/debug/stack_trace_posix.cc
|
||||
index 6176ed4..a02043d 100644
|
||||
--- a/orig/v8-14.6.202.11/src/base/debug/stack_trace_posix.cc
|
||||
+++ b/mod/v8-14.6.202.11/src/base/debug/stack_trace_posix.cc
|
||||
@@ -64,6 +64,7 @@ namespace {
|
||||
volatile sig_atomic_t in_signal_handler = 0;
|
||||
bool dump_stack_in_signal_handler = true;
|
||||
|
||||
+#if HAVE_EXECINFO_H
|
||||
// The prefix used for mangled symbols, per the Itanium C++ ABI:
|
||||
// http://www.codesourcery.com/cxx-abi/abi.html#mangling
|
||||
const char kMangledSymbolPrefix[] = "_Z";
|
||||
@@ -73,7 +74,6 @@ const char kMangledSymbolPrefix[] = "_Z";
|
||||
const char kSymbolCharacters[] =
|
||||
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
|
||||
|
||||
-#if HAVE_EXECINFO_H
|
||||
// Demangles C++ symbols in the given text. Example:
|
||||
//
|
||||
// "out/Debug/base_unittests(_ZN10StackTraceC1Ev+0x20) [0x817778c]"
|
||||
|
||||
diff --git a/orig/v8-14.6.202.11/src/base/platform/platform-posix.cc b/mod/v8-14.6.202.11/src/base/platform/platform-posix.cc
|
||||
index 4c7d878..0e45eb3 100644
|
||||
--- a/orig/v8-14.6.202.11/src/base/platform/platform-posix.cc
|
||||
+++ b/mod/v8-14.6.202.11/src/base/platform/platform-posix.cc
|
||||
@@ -95,7 +95,7 @@
|
||||
#endif
|
||||
|
||||
#if defined(V8_LIBC_GLIBC)
|
||||
-extern "C" void* __libc_stack_end;
|
||||
+extern "C" void* __libc_stack_end V8_WEAK;
|
||||
#endif
|
||||
|
||||
namespace v8 {
|
||||
@@ -1461,10 +1461,13 @@
|
||||
// pthread_getattr_np can fail for the main thread.
|
||||
// For the main thread we prefer using __libc_stack_end (if it exists) since
|
||||
// it generally provides a tighter limit for CSS.
|
||||
- return __libc_stack_end;
|
||||
+ if (__libc_stack_end != nullptr) {
|
||||
+ return __libc_stack_end;
|
||||
+ }
|
||||
#else
|
||||
return nullptr;
|
||||
#endif // !defined(V8_LIBC_GLIBC)
|
||||
+ return nullptr;
|
||||
}
|
||||
void* base;
|
||||
size_t size;
|
||||
@@ -1476,7 +1479,8 @@
|
||||
// __libc_stack_end is process global and thus is only valid for
|
||||
// the main thread. Check whether this is the main thread by checking
|
||||
// __libc_stack_end is within the thread's stack.
|
||||
- if ((base <= __libc_stack_end) && (__libc_stack_end <= stack_start)) {
|
||||
+ if (__libc_stack_end != nullptr &&
|
||||
+ (base <= __libc_stack_end) && (__libc_stack_end <= stack_start)) {
|
||||
DCHECK(MainThreadIsCurrentThread());
|
||||
return __libc_stack_end;
|
||||
}
|
||||
|
||||
diff --git a/orig/v8-14.6.202.11/src/libplatform/default-thread-isolated-allocator.cc b/mod/v8-14.6.202.11/src/libplatform/default-thread-isolated-allocator.cc
|
||||
index bda0e43..b44f1d9 100644
|
||||
--- a/orig/v8-14.6.202.11/src/libplatform/default-thread-isolated-allocator.cc
|
||||
+++ b/mod/v8-14.6.202.11/src/libplatform/default-thread-isolated-allocator.cc
|
||||
@@ -23,7 +23,7 @@ extern int pkey_free(int pkey) V8_WEAK;
|
||||
|
||||
namespace {
|
||||
|
||||
-bool KernelHasPkruFix() {
|
||||
+[[maybe_unused]] bool KernelHasPkruFix() {
|
||||
// PKU was broken on Linux kernels before 5.13 (see
|
||||
// https://lore.kernel.org/all/20210623121456.399107624@linutronix.de/).
|
||||
// A fix is also included in the 5.4.182 and 5.10.103 versions ("x86/fpu:
|
||||
Reference in New Issue
Block a user