diff --git a/.bazelrc b/.bazelrc index de01a87443f..b227d0444e6 100644 --- a/.bazelrc +++ b/.bazelrc @@ -18,7 +18,15 @@ common --enable_platform_specific_config common:linux --host_platform=//:local_linux common:windows --host_platform=//:local_windows common --@rules_cc//cc/toolchains/args/archiver_flags:use_libtool_on_macos=False -common --@llvm//config:experimental_stub_libgcc_s +# The hermetic LLVM toolchain module is imported as toolchains_llvm_bootstrapped +# (see MODULE.bazel); the upstream @llvm name no longer exists in the repo map. +common --@toolchains_llvm_bootstrapped//config:experimental_stub_libgcc_s + +# Bazelisk picks the latest Bazel (no .bazelversion), and the resolved module +# graph (rules_cc 0.2.16 vs 0.2.17) differs between runs; both rewrite the +# committed MODULE.bazel.lock and trip check-clean-worktree. Ignore the lockfile +# for builds; the repository cache keeps module resolution cheap. +build --lockfile_mode=off # TODO(zbarsky): rules_rust doesn't implement this flag properly with remote exec... # common --@rules_rust//rust/settings:pipelined_compilation diff --git a/.github/scripts/rusty_v8_bazel.py b/.github/scripts/rusty_v8_bazel.py index e30efb48f52..a5c674da810 100644 --- a/.github/scripts/rusty_v8_bazel.py +++ b/.github/scripts/rusty_v8_bazel.py @@ -65,7 +65,7 @@ def bazel_output_files( "cquery", "-c", compilation_mode, - f"--platforms=@llvm//platforms:{platform}", + f"--platforms=@toolchains_llvm_bootstrapped//platforms:{platform}", *[f"--config={config}" for config in bazel_configs], "--output=files", expression, @@ -90,7 +90,7 @@ def bazel_build( "build", "-c", compilation_mode, - f"--platforms=@llvm//platforms:{platform}", + f"--platforms=@toolchains_llvm_bootstrapped//platforms:{platform}", *[f"--config={config}" for config in bazel_configs], *download_args, *labels, diff --git a/.github/workflows/rusty-v8-release.yml b/.github/workflows/rusty-v8-release.yml index 92be3761ddb..3f9d5855214 100644 --- a/.github/workflows/rusty-v8-release.yml +++ b/.github/workflows/rusty-v8-release.yml @@ -66,7 +66,6 @@ jobs: actions: read environment: name: bazel - deployment: false strategy: fail-fast: false matrix: @@ -198,11 +197,11 @@ jobs: build -c opt - "--platforms=@llvm//platforms:${PLATFORM}" + "--platforms=@toolchains_llvm_bootstrapped//platforms:${PLATFORM}" --config=rusty-v8-upstream-libcxx "--config=v8-target-${V8_CPU}" "${pair_target}" - --build_metadata=COMMIT_SHA=$(git rev-parse HEAD) + "--build_metadata=COMMIT_SHA=$(git rev-parse HEAD)" ) if [[ "${SANDBOX}" != "true" ]]; then bazel_args+=(--config=v8-release-compat) diff --git a/.github/workflows/v8-canary.yml b/.github/workflows/v8-canary.yml index efa06aaad74..0c07ac33269 100644 --- a/.github/workflows/v8-canary.yml +++ b/.github/workflows/v8-canary.yml @@ -110,7 +110,6 @@ jobs: actions: read environment: name: bazel - deployment: false strategy: fail-fast: false matrix: @@ -240,11 +239,12 @@ jobs: bazel_args=( build - "--platforms=@llvm//platforms:${PLATFORM}" + "--platforms=@toolchains_llvm_bootstrapped//platforms:${PLATFORM}" --config=rusty-v8-upstream-libcxx "--config=v8-target-${V8_CPU}" "${pair_target}" - --build_metadata=COMMIT_SHA=$(git rev-parse HEAD) + --verbose_failures + "--build_metadata=COMMIT_SHA=$(git rev-parse HEAD)" ) if [[ "${SANDBOX}" != "true" ]]; then bazel_args+=(--config=v8-release-compat) diff --git a/.gitignore b/.gitignore index 32a2dc23318..bbb12eb6d5b 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,11 @@ bazel-* build/ out/ +# CI: upstream rusty_v8 checkout used by the v8-canary windows-source job. +# The workflow checks this repo out into the workspace, so exclude it from +# the check-clean-worktree gate (the checkout is intentional, not debris). +/upstream-rusty-v8/ + # Node.js node_modules/ .pnpm-store/ diff --git a/.taplo.toml b/.taplo.toml new file mode 100644 index 00000000000..be4ca0506ba --- /dev/null +++ b/.taplo.toml @@ -0,0 +1,6 @@ +# TOML formatting style for this repository (used by the `taplo` linter in +# .trunk/trunk.yaml). The existing Cargo.toml files indent array entries +# with 4 spaces, so keep taplo aligned with that instead of its 2-space +# default. +[formatting] +indent_string = " " diff --git a/.trunk/.gitignore b/.trunk/.gitignore new file mode 100644 index 00000000000..1e24652901a --- /dev/null +++ b/.trunk/.gitignore @@ -0,0 +1,8 @@ +*out +*logs +*actions +*notifications +*tools +plugins +user_trunk.yaml +user.yaml diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index fbb1fbcb053..6ddd777b631 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -1,3 +1,4 @@ +--- # ============================================================================= # Trunk.io — Plugin versions for linting/formatting tools # ============================================================================= @@ -5,109 +6,78 @@ # https://docs.trunk.io/check/reference # ============================================================================= -plugins: - sources: - - id: trunk - ref: v1.2.2 - - id: community - ref: main +version: 0.1 -# Linters (auto-detected by file type) -linters: - actionlint: - enabled: true - commands: - - name: actionlint - run: actionlint ${target} - direct_configs: - - .github/workflows/*.yml - black: - enabled: true - commands: - - name: black - run: black --check --line-length 100 ${target} - direct_configs: - - pyproject.toml - - ruff.toml - clippy: - enabled: true - commands: - - name: clippy - run: cargo clippy --all-targets --all-features -- -D warnings - eslint: - enabled: true - direct_configs: - - .eslintrc.* - - eslint.config.* - golangci-lint: - enabled: true - direct_configs: - - .golangci.yml - - .golangci.yaml - mypy: - enabled: true - commands: - - name: mypy - run: mypy --ignore-missing-imports ${target} - ruff: - enabled: true - commands: - - name: ruff - run: ruff check --output-format=github ${target} - direct_configs: - - ruff.toml - - pyproject.toml - shellcheck: - enabled: true - taplo: - enabled: true - yamllint: - enabled: true +# CLI version pinned for reproducible runs (matches the version CI downloads). +cli: + version: 1.22.2 -# Formatters -formatters: - black: - enabled: true - commands: - - name: black - run: black --line-length 100 ${target} - direct_configs: - - pyproject.toml - prettier: - enabled: true - direct_configs: - - .prettierrc - - prettier.config.* - rustfmt: - enabled: true - commands: - - name: rustfmt - run: rustfmt ${target} +# The `trunk` plugin provides the linter/formatter definitions used below. +# User definitions merge over the plugin: fields set in this file override the +# plugin, everything else (files, tools, runtimes, version pins) is inherited. +plugins: + sources: + - id: trunk + ref: v1.11.0 + uri: https://github.com/trunk-io/plugins -# Actions (CI optimization) -actions: - trunk-check: - enabled: true - size: 5GB - memory: 16GB - disk: 10GB - trunk-merge: - enabled: true - size: 5GB - trunk-push: - enabled: true - size: 5GB +lint: + # Repo-specific command overrides merged over the plugin definitions. + definitions: + # black: enforce 100-char line length in both lint and format modes. + - name: black + commands: + - name: lint + output: pass_fail + run: black --check --line-length 100 ${target} + success_codes: [0, 1] + - name: format + output: rewrite + run: black --line-length 100 ${target} + success_codes: [0] + batch: true + in_place: true + formatter: true + # clippy: lint all targets/features and fail on any warning. + - name: clippy + commands: + - name: lint + output: clippy + target: ${parent_with(Cargo.toml)} + run: > + cargo clippy --message-format json --all-targets + --all-features + --locked -- -D warnings + success_codes: [0, 101, 383] + disable_upstream: true -# Caching -cache: - enabled: true - storage: local + # Enabled tools (plugin defaults unless overridden above). Versions are + # pinned explicitly: an unpinned entry resolves to the SYSTEM copy of the + # tool instead of a trunk-managed install. + enabled: + - actionlint@1.7.8 + - black@25.9.0 + - clippy@1.88.0 + - eslint@8.10.0 + - golangci-lint@2.6.1 + - mypy@2.1.0 + - prettier@3.6.2 + - ruff@0.16.2 + - rustfmt@1.88.0 + - shellcheck@0.10.0 + - taplo@0.10.0 + - yamllint@1.37.1 -# CLI -cli: - version: 1.22.2 + # GitHub workflow files are covered by actionlint (syntax + shellcheck). + # prettier's YAML printer re-indents `on:`-keyed workflow files with a + # nonstandard style, and yamllint's 80-column default flags long action + # refs; neither reflects this repo's intent, so scope both off workflows. + ignore: + - linters: [prettier, yamllint] + paths: + - .github/workflows/** -# Environment -env: - variables: - EDITOR: vim +# Git hooks: run `trunk check` before `git push`. +actions: + enabled: + - trunk-check-pre-push diff --git a/BUILD.bazel b/BUILD.bazel index a82126e6f1e..61df9c966da 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -9,7 +9,7 @@ platform( name = "local_linux", constraint_values = [ # We mark the local platform as glibc-compatible because musl-built rust cannot dlopen proc macros. - "@llvm//constraints/libc:gnu.2.28", + "@toolchains_llvm_bootstrapped//constraints/libc:gnu.2.28", ], parents = ["@platforms//host"], ) diff --git a/MODULE.bazel b/MODULE.bazel index 5366f7cc158..b7e1ad98daa 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -7,6 +7,7 @@ single_version_override( patch_strip = 1, patches = [ "//patches:toolchains_llvm_bootstrapped_resource_dir.patch", + "//patches:toolchains_llvm_bootstrapped_rusty_v8_runtime_lib.patch", ], ) @@ -37,7 +38,15 @@ use_repo(osx, "macosx15.4.sdk") # Needed to disable xcode... bazel_dep(name = "apple_support", version = "2.1.0") +bazel_dep(name = "bazel_skylib", version = "1.8.2") bazel_dep(name = "rules_cc", version = "0.2.16") +single_version_override( + module_name = "rules_cc", + patch_strip = 1, + patches = [ + "//patches:rules_cc_rusty_v8_custom_libcxx.patch", + ], +) bazel_dep(name = "rules_platform", version = "0.1.0") bazel_dep(name = "rules_rs", version = "0.0.23") @@ -223,3 +232,133 @@ rbe_platform_repository = use_repo_rule("//:rbe.bzl", "rbe_platform_repository") rbe_platform_repository( name = "rbe_platform", ) + +# --------------------------------------------------------------------------- +# V8 / rusty_v8 consumer wiring (restored 2026-08-09). +# +# The original v8 section was lost when MODULE.bazel was rewritten during the +# codex import (#603). Rebuilt from the pre-import upstream layout (git history +# cf7d639e6~1) with the currently pinned versions: +# - v8 crate: 149.2.0 (codex-rs/Cargo.lock) +# - upstream V8 source: 14.9.207.2 (third_party/v8/README.md) +# All integrity digests were computed from the pinned upstream artifacts on +# 2026-08-09; the Windows prebuilt shas match +# third_party/v8/rusty_v8_149_2_0.sha256. +# --------------------------------------------------------------------------- + +http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +http_file = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") +new_local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "new_local_repository") +git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") + +# Maps the third_party/v8 package into a repo so the generated v8 crate rules +# can consume the per-target archive/binding selectors. +new_local_repository( + name = "v8_targets", + build_file = "//third_party/v8:BUILD.bazel", + path = "third_party/v8", +) + +crate.annotation( + build_script_data = [ + "@v8_targets//:rusty_v8_archive_for_target", + "@v8_targets//:rusty_v8_binding_for_target", + ], + build_script_env = { + "RUSTY_V8_ARCHIVE": "$(execpath @v8_targets//:rusty_v8_archive_for_target)", + "RUSTY_V8_SRC_BINDING_PATH": "$(execpath @v8_targets//:rusty_v8_binding_for_target)", + }, + crate = "v8", + gen_build_script = "on", + patch_args = ["-p1"], + patches = [ + "//patches:rusty_v8_prebuilt_out_dir.patch", + ], +) + +inject_repo(crate, "v8_targets") + +bazel_dep(name = "v8", version = "14.9.207.2") +archive_override( + module_name = "v8", + integrity = "sha256-tflbZE5srqal6leMxJjK/ZQtwpF96OMGJ6avd5lice4=", + patch_strip = 3, + patches = [ + "//patches:v8_module_deps.patch", + "//patches:v8_bazel_rules.patch", + "//patches:v8_source_portability.patch", + ], + strip_prefix = "v8-14.9.207.2", + urls = ["https://github.com/v8/v8/archive/refs/tags/14.9.207.2.tar.gz"], +) + +# rustc-style bindings vendored into the v8 crate archives. +http_archive( + name = "v8_crate_149_2_0", + build_file = "//third_party/v8:v8_crate.BUILD.bazel", + sha256 = "46dccf61a364b61bbaac70a8ba64a1a1006e87123b7d62eaeec999a3ba31ecdb", + strip_prefix = "v8-149.2.0", + type = "tar.gz", + urls = ["https://static.crates.io/crates/v8/v8-149.2.0.crate"], +) + +# Legacy binding targets in third_party/v8/BUILD.bazel still reference the +# 146.4.0 crate archive; keep both pinned until those targets are retired. +http_archive( + name = "v8_crate_146_4_0", + build_file = "//third_party/v8:v8_crate.BUILD.bazel", + sha256 = "d97bcac5cdc5a195a4813f1855a6bc658f240452aac36caa12fd6c6f16026ab1", + strip_prefix = "v8-146.4.0", + type = "tar.gz", + urls = ["https://static.crates.io/crates/v8/v8-146.4.0.crate"], +) + +# Custom libc++/libc++abi sources for the v8 consumer builds, matched to the +# hermetic toolchain's LLVM 21.1.8. The BUILD overlays live in third_party/v8. +http_archive( + name = "rusty_v8_libcxx", + build_file = "//third_party/v8:libcxx.BUILD.bazel", + sha256 = "6422a58a5c29b7f4fda224cfdc07842be8a208a61301bbba7a219116e3351809", + strip_prefix = "libcxx-21.1.8.src", + urls = ["https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.8/libcxx-21.1.8.src.tar.xz"], + patch_args = ["-p1"], + patches = [ + "//patches:rusty_v8_libcxx_include_next.patch", + ], +) + +http_archive( + name = "rusty_v8_libcxxabi", + build_file = "//third_party/v8:libcxxabi.BUILD.bazel", + sha256 = "709c9a63bde1e36a80d8675becc38073b85f0fa1b4111e34542b885c9e1239da", + strip_prefix = "libcxxabi-21.1.8.src", + urls = ["https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.8/libcxxabi-21.1.8.src.tar.xz"], +) + +# llvm-libc headers (chromium mirror pin, matching upstream codex usage). +git_repository( + name = "rusty_v8_llvm_libc", + build_file = "//third_party/v8:llvm_libc.BUILD.bazel", + commit = "9309c117ebae84dd2f9df1ef99de4782162527d5", + remote = "https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libc.git", +) + +# Prebuilt Windows MSVC archives — the only remaining prebuilt rusty_v8 inputs; +# every other target is source-built by Bazel. +http_file( + name = "rusty_v8_149_2_0_aarch64_pc_windows_msvc_archive", + downloaded_file_path = "rusty_v8_release_aarch64-pc-windows-msvc.lib.gz", + sha256 = "923f2b6ccdc14526b814e171e34c9aafd7969f12304948857c6696d022f0fb3c", + urls = [ + "https://github.com/denoland/rusty_v8/releases/download/v149.2.0/rusty_v8_release_aarch64-pc-windows-msvc.lib.gz", + ], +) + +http_file( + name = "rusty_v8_149_2_0_x86_64_pc_windows_msvc_archive", + downloaded_file_path = "rusty_v8_release_x86_64-pc-windows-msvc.lib.gz", + sha256 = "12b5a791b54e92f748738ad8d0d12dad8d281a2d836638ad1aa6678e3b855d9a", + urls = [ + "https://github.com/denoland/rusty_v8/releases/download/v149.2.0/rusty_v8_release_x86_64-pc-windows-msvc.lib.gz", + ], +) diff --git a/bazel/platforms/release_binaries.bzl b/bazel/platforms/release_binaries.bzl index 2e2f4450364..94927705d63 100644 --- a/bazel/platforms/release_binaries.bzl +++ b/bazel/platforms/release_binaries.bzl @@ -15,7 +15,7 @@ def multiplatform_binaries(name, platforms = PLATFORMS): for platform in platforms: platform_data( name = name + "_" + platform, - platform = "@llvm//platforms:" + platform, + platform = "@toolchains_llvm_bootstrapped//platforms:" + platform, target = name, tags = ["manual"], ) diff --git a/bazel/rules/testing/wine/wine_runtime.bzl b/bazel/rules/testing/wine/wine_runtime.bzl index 9f47bdcff00..2df87497094 100644 --- a/bazel/rules/testing/wine/wine_runtime.bzl +++ b/bazel/rules/testing/wine/wine_runtime.bzl @@ -14,7 +14,7 @@ _WINE_RUNTIME_DATA = [ ] WINE_TEST_TARGET_COMPATIBLE_WITH = [ - "@llvm//constraints/libc:gnu.2.28", + "@toolchains_llvm_bootstrapped//constraints/libc:gnu.2.28", "@platforms//cpu:x86_64", "@platforms//os:linux", ] diff --git a/codex-rs/Cargo.lock b/codex-rs/Cargo.lock index fee1821a871..e5e902ab6a4 100644 --- a/codex-rs/Cargo.lock +++ b/codex-rs/Cargo.lock @@ -4307,6 +4307,14 @@ dependencies = [ "pretty_assertions", ] +[[package]] +name = "codex-v8-poc" +version = "0.0.0" +dependencies = [ + "pretty_assertions", + "v8", +] + [[package]] name = "codex-web-search-extension" version = "0.0.0" diff --git a/codex-rs/Cargo.toml b/codex-rs/Cargo.toml index a39ca2c1cea..bb391150107 100644 --- a/codex-rs/Cargo.toml +++ b/codex-rs/Cargo.toml @@ -61,6 +61,7 @@ members = [ "codex-api", "state", "codex-experimental-api-macros", + "v8-poc", ] resolver = "2" @@ -372,7 +373,10 @@ tokio-tungstenite = { version = "0.28.0", features = [ "rustls-tls-native-roots", ] } tokio-util = "0.7.18" -tonic = { version = "0.14.3", default-features = false, features = ["channel", "codegen"] } +tonic = { version = "0.14.3", default-features = false, features = [ + "channel", + "codegen", +] } tonic-prost = "0.14.3" toml = "0.9.5" toml_edit = "0.24.0" diff --git a/patches/BUILD.bazel b/patches/BUILD.bazel index ed141371700..f164ad0eff7 100644 --- a/patches/BUILD.bazel +++ b/patches/BUILD.bazel @@ -20,6 +20,7 @@ exports_files([ "rules_rs_windows_exec_linker.patch", "rusty_v8_prebuilt_out_dir.patch", "ring_windows_msvc_include_dirs.patch", + "toolchains_llvm_bootstrapped_rusty_v8_runtime_lib.patch", "v8_bazel_rules.patch", "v8_module_deps.patch", "v8_source_portability.patch", diff --git a/patches/rusty_v8_libcxx_include_next.patch b/patches/rusty_v8_libcxx_include_next.patch new file mode 100644 index 00000000000..38a3eda1544 --- /dev/null +++ b/patches/rusty_v8_libcxx_include_next.patch @@ -0,0 +1,392 @@ +diff --git a/include/complex.h b/include/complex.h +index 8a1f926..4129487 100644 +--- a/include/complex.h ++++ b/include/complex.h +@@ -7,8 +7,6 @@ + // + //===----------------------------------------------------------------------===// + +-#ifndef _LIBCPP_COMPLEX_H +-#define _LIBCPP_COMPLEX_H + + /* + complex.h synopsis +@@ -31,6 +29,7 @@ + # elif __has_include_next() + # include_next + # endif +-#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +- ++#ifndef _LIBCPP_COMPLEX_H ++#define _LIBCPP_COMPLEX_H + #endif // _LIBCPP_COMPLEX_H ++#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +diff --git a/include/ctype.h b/include/ctype.h +index 066f450..c0d4373 100644 +--- a/include/ctype.h ++++ b/include/ctype.h +@@ -7,8 +7,6 @@ + // + //===----------------------------------------------------------------------===// + +-#ifndef _LIBCPP_CTYPE_H +-#define _LIBCPP_CTYPE_H + + /* + ctype.h synopsis +@@ -41,6 +39,8 @@ int toupper(int c); + # if __has_include_next() + # include_next + # endif ++#ifndef _LIBCPP_CTYPE_H ++#define _LIBCPP_CTYPE_H + + # ifdef __cplusplus + +@@ -60,6 +60,5 @@ int toupper(int c); + # undef toupper + + # endif +-#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +- + #endif // _LIBCPP_CTYPE_H ++#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +diff --git a/include/errno.h b/include/errno.h +index 692f00f..68edc7e 100644 +--- a/include/errno.h ++++ b/include/errno.h +@@ -7,8 +7,6 @@ + // + //===----------------------------------------------------------------------===// + +-#ifndef _LIBCPP_ERRNO_H +-#define _LIBCPP_ERRNO_H + + /* + errno.h synopsis +@@ -34,6 +32,8 @@ Macros: + # if __has_include_next() + # include_next + # endif ++#ifndef _LIBCPP_ERRNO_H ++#define _LIBCPP_ERRNO_H + + # ifdef __cplusplus + +@@ -398,6 +398,5 @@ static const int __elast2 = 105; + # endif + + # endif // __cplusplus +-#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +- + #endif // _LIBCPP_ERRNO_H ++#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +diff --git a/include/fenv.h b/include/fenv.h +index 157c24f..b1e0679 100644 +--- a/include/fenv.h ++++ b/include/fenv.h +@@ -7,8 +7,6 @@ + // + //===----------------------------------------------------------------------===// + +-#ifndef _LIBCPP_FENV_H +-#define _LIBCPP_FENV_H + + /* + fenv.h synopsis +@@ -61,6 +59,8 @@ int feupdateenv(const fenv_t* envp); + # if __has_include_next() + # include_next + # endif ++#ifndef _LIBCPP_FENV_H ++#define _LIBCPP_FENV_H + + # ifdef __cplusplus + +@@ -113,6 +113,5 @@ extern "C++" { + } // extern "C++" + + # endif // defined(__cplusplus) +-#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +- + #endif // _LIBCPP_FENV_H ++#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +diff --git a/include/float.h b/include/float.h +index a6e79db..0b460e4 100644 +--- a/include/float.h ++++ b/include/float.h +@@ -7,8 +7,6 @@ + // + //===----------------------------------------------------------------------===// + +-#ifndef _LIBCPP_FLOAT_H +-#define _LIBCPP_FLOAT_H + + /* + float.h synopsis +@@ -82,6 +80,8 @@ Macros: + # if __has_include_next() + # include_next + # endif ++#ifndef _LIBCPP_FLOAT_H ++#define _LIBCPP_FLOAT_H + + # ifdef __cplusplus + +@@ -94,6 +94,5 @@ Macros: + # endif + + # endif // __cplusplus +-#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +- + #endif // _LIBCPP_FLOAT_H ++#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +diff --git a/include/inttypes.h b/include/inttypes.h +index 1869284..8322b38 100644 +--- a/include/inttypes.h ++++ b/include/inttypes.h +@@ -7,14 +7,6 @@ + // + //===----------------------------------------------------------------------===// + +-#ifndef _LIBCPP_INTTYPES_H +-// AIX system headers need inttypes.h to be re-enterable while _STD_TYPES_T +-// is defined until an inclusion of it without _STD_TYPES_T occurs, in which +-// case the header guard macro is defined. +-#if !defined(_AIX) || !defined(_STD_TYPES_T) +-# define _LIBCPP_INTTYPES_H +-#endif // _STD_TYPES_T +- + /* + inttypes.h synopsis + +@@ -255,6 +247,14 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int + # include_next + # endif + ++#ifndef _LIBCPP_INTTYPES_H ++// AIX system headers need inttypes.h to be re-enterable while _STD_TYPES_T ++// is defined until an inclusion of it without _STD_TYPES_T occurs, in which ++// case the header guard macro is defined. ++#if !defined(_AIX) || !defined(_STD_TYPES_T) ++# define _LIBCPP_INTTYPES_H ++#endif // _STD_TYPES_T ++ + # ifdef __cplusplus + + # include +@@ -263,6 +263,5 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int + # undef imaxdiv + + # endif // __cplusplus +-#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +- + #endif // _LIBCPP_INTTYPES_H ++#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +diff --git a/include/math.h b/include/math.h +index 929bef6..6121409 100644 +--- a/include/math.h ++++ b/include/math.h +@@ -7,9 +7,6 @@ + // + //===----------------------------------------------------------------------===// + +-#ifndef _LIBCPP_MATH_H +-# define _LIBCPP_MATH_H +- + /* + math.h synopsis + +@@ -304,6 +301,9 @@ long double truncl(long double x); + # include_next + # endif + ++#ifndef _LIBCPP_MATH_H ++# define _LIBCPP_MATH_H ++ + # ifdef __cplusplus + + // We support including .h headers inside 'extern "C"' contexts, so switch +@@ -498,18 +498,4 @@ using std::__math::trunc; + # endif // __cplusplus + # endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) + +-#else // _LIBCPP_MATH_H +- +-// This include lives outside the header guard in order to support an MSVC +-// extension which allows users to do: +-// +-// #define _USE_MATH_DEFINES +-// #include +-// +-// and receive the definitions of mathematical constants, even if +-// has previously been included. +-# if defined(_LIBCPP_MSVCRT) && defined(_USE_MATH_DEFINES) +-# include_next +-# endif +- + #endif // _LIBCPP_MATH_H +diff --git a/include/stdatomic.h b/include/stdatomic.h +index 2991030..3482fb3 100644 +--- a/include/stdatomic.h ++++ b/include/stdatomic.h +@@ -7,8 +7,6 @@ + // + //===----------------------------------------------------------------------===// + +-#ifndef _LIBCPP_STDATOMIC_H +-#define _LIBCPP_STDATOMIC_H + + /* + stdatomic.h synopsis +@@ -240,8 +238,9 @@ using std::atomic_thread_fence _LIBCPP_USING_IF_EXISTS; + # if __has_include_next() + # include_next + # endif ++#ifndef _LIBCPP_STDATOMIC_H ++#define _LIBCPP_STDATOMIC_H + + # endif // defined(__cplusplus) && _LIBCPP_STD_VER >= 23 +-#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +- + #endif // _LIBCPP_STDATOMIC_H ++#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +diff --git a/include/stdbool.h b/include/stdbool.h +index c34853b..ca4d3f3 100644 +--- a/include/stdbool.h ++++ b/include/stdbool.h +@@ -7,8 +7,6 @@ + // + //===----------------------------------------------------------------------===// + +-#ifndef _LIBCPP_STDBOOL_H +-#define _LIBCPP_STDBOOL_H + + /* + stdbool.h synopsis +@@ -31,6 +29,8 @@ Macros: + # if __has_include_next() + # include_next + # endif ++#ifndef _LIBCPP_STDBOOL_H ++#define _LIBCPP_STDBOOL_H + + # ifdef __cplusplus + # undef bool +@@ -39,6 +39,5 @@ Macros: + # undef __bool_true_false_are_defined + # define __bool_true_false_are_defined 1 + # endif +-#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +- + #endif // _LIBCPP_STDBOOL_H ++#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +diff --git a/include/string.h b/include/string.h +index 6bdcd6a..b1de45e 100644 +--- a/include/string.h ++++ b/include/string.h +@@ -7,8 +7,6 @@ + // + //===----------------------------------------------------------------------===// + +-#ifndef _LIBCPP_STRING_H +-#define _LIBCPP_STRING_H + + /* + string.h synopsis +@@ -63,6 +61,8 @@ size_t strlen(const char* s); + # if __has_include_next() + # include_next + # endif ++#ifndef _LIBCPP_STRING_H ++#define _LIBCPP_STRING_H + + // MSVCRT, GNU libc and its derivates may already have the correct prototype in + // . This macro can be defined by users if their C library provides +@@ -110,6 +110,5 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD char* strstr(char* __s1, + } + } // extern "C++" + # endif +-#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +- + #endif // _LIBCPP_STRING_H ++#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +diff --git a/include/tgmath.h b/include/tgmath.h +index 3f8f14f..e3df073 100644 +--- a/include/tgmath.h ++++ b/include/tgmath.h +@@ -7,8 +7,6 @@ + // + //===----------------------------------------------------------------------===// + +-#ifndef _LIBCPP_TGMATH_H +-#define _LIBCPP_TGMATH_H + + /* + tgmath.h synopsis +@@ -33,7 +31,8 @@ + # if __has_include_next() + # include_next + # endif ++#ifndef _LIBCPP_TGMATH_H ++#define _LIBCPP_TGMATH_H + # endif +-#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +- + #endif // _LIBCPP_TGMATH_H ++#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +diff --git a/include/uchar.h b/include/uchar.h +index 01e1d57..236caf5 100644 +--- a/include/uchar.h ++++ b/include/uchar.h +@@ -7,8 +7,6 @@ + // + //===----------------------------------------------------------------------===// + +-#ifndef _LIBCPP_UCHAR_H +-#define _LIBCPP_UCHAR_H + + /* + uchar.h synopsis // since C++11 +@@ -54,7 +52,9 @@ size_t c32rtomb(char* s, char32_t c32, mbstate_t* ps); + # include + # endif + ++#ifndef _LIBCPP_UCHAR_H ++#define _LIBCPP_UCHAR_H ++#endif // _LIBCPP_UCHAR_H ++ + # endif // _LIBCPP_CXX03_LANG + #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +- +-#endif // _LIBCPP_UCHAR_H +diff --git a/include/wctype.h b/include/wctype.h +index 9a5b163..fbdfe3c 100644 +--- a/include/wctype.h ++++ b/include/wctype.h +@@ -7,8 +7,6 @@ + // + //===----------------------------------------------------------------------===// + +-#ifndef _LIBCPP_WCTYPE_H +-#define _LIBCPP_WCTYPE_H + + /* + wctype.h synopsis +@@ -65,6 +63,8 @@ wctrans_t wctrans(const char* property); + # if __has_include_next() + # include_next + # define _LIBCPP_INCLUDED_C_LIBRARY_WCTYPE_H ++#ifndef _LIBCPP_WCTYPE_H ++#define _LIBCPP_WCTYPE_H + # endif + + # ifdef __cplusplus +@@ -89,6 +89,5 @@ wctrans_t wctrans(const char* property); + # undef wctrans + + # endif // __cplusplus +-#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +- + #endif // _LIBCPP_WCTYPE_H ++#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) diff --git a/patches/toolchains_llvm_bootstrapped_rusty_v8_runtime_lib.patch b/patches/toolchains_llvm_bootstrapped_rusty_v8_runtime_lib.patch new file mode 100644 index 00000000000..9e6c4710690 --- /dev/null +++ b/patches/toolchains_llvm_bootstrapped_rusty_v8_runtime_lib.patch @@ -0,0 +1,58 @@ +diff --git a/runtimes/BUILD.bazel b/runtimes/BUILD.bazel +index 03f48fb..189bfdd 100644 +--- a/runtimes/BUILD.bazel ++++ b/runtimes/BUILD.bazel +@@ -72,6 +72,21 @@ filegroup( + visibility = ["//visibility:public"], + ) + ++# V8's custom-libc++ build ships its own libc++/libc++abi runtime and must ++# not also link the toolchain's copies (duplicate std::* symbols at link ++# time). libunwind is still needed: the custom libc++abi uses its _Unwind_* ++# entry points and does not define them itself. ++filegroup( ++ name = "static_runtime_lib_no_libcxx", ++ srcs = select({ ++ "@platforms//os:linux": [ ++ "@libunwind//:libunwind.static", ++ ], ++ "//conditions:default": [], ++ }), ++ visibility = ["//visibility:public"], ++) ++ + cc_library( + name = "empty", + srcs = ["empty.c"], +diff --git a/toolchain/BUILD.bazel b/toolchain/BUILD.bazel +index d38c471..e39c0da 100644 +--- a/toolchain/BUILD.bazel ++++ b/toolchain/BUILD.bazel +@@ -20,6 +20,9 @@ string_setting( + "complete", # depends on above: user programs. + ], + build_setting_default = "complete", ++ # Referenced by the main repo's config_setting for the custom-libc++ ++ # build (use_rusty_v8_custom_libcxx_user_targets). ++ visibility = ["//visibility:public"], + ) + + # Controls whether targets are built with bootstrapped toolchain or prebuilt toolchain. +diff --git a/toolchain/cc_toolchain.bzl b/toolchain/cc_toolchain.bzl +index 01851e2..6a92376 100644 +--- a/toolchain/cc_toolchain.bzl ++++ b/toolchain/cc_toolchain.bzl +@@ -109,11 +109,13 @@ def cc_toolchain(name, tool_map, module_map = None): + tool_map = tool_map, + module_map = module_map, + static_runtime_lib = select({ ++ "@@//third_party/v8:use_rusty_v8_custom_libcxx_user_targets": "@toolchains_llvm_bootstrapped//runtimes:static_runtime_lib_no_libcxx", + "@toolchains_llvm_bootstrapped//toolchain:runtimes_none": "@toolchains_llvm_bootstrapped//runtimes:none", + "@toolchains_llvm_bootstrapped//toolchain:runtimes_stage1": "@toolchains_llvm_bootstrapped//runtimes:none", + "//conditions:default": "@toolchains_llvm_bootstrapped//runtimes:static_runtime_lib", + }), + dynamic_runtime_lib = select({ ++ "@@//third_party/v8:use_rusty_v8_custom_libcxx_user_targets": "@toolchains_llvm_bootstrapped//runtimes:none", + "@toolchains_llvm_bootstrapped//toolchain:runtimes_none": "@toolchains_llvm_bootstrapped//runtimes:none", + "@toolchains_llvm_bootstrapped//toolchain:runtimes_stage1": "@toolchains_llvm_bootstrapped//runtimes:none", + "//conditions:default": "@toolchains_llvm_bootstrapped//runtimes:dynamic_runtime_lib", diff --git a/patches/v8_bazel_rules.patch b/patches/v8_bazel_rules.patch index fce2be28949..ec945e44f51 100644 --- a/patches/v8_bazel_rules.patch +++ b/patches/v8_bazel_rules.patch @@ -32,7 +32,7 @@ index bbe1495..6673518 100644 def v8_string(name, default = ""): _create_option_string(name = name, build_setting_default = default) -@@ -97,7 +109,13 @@ v8_config = rule( +@@ -97,7 +109,14 @@ v8_config = rule( def _default_args(): return struct( @@ -41,6 +41,7 @@ index bbe1495..6673518 100644 + "@v8//:is_v8_use_rusty_v8_custom_libcxx": [ + "@@//third_party/v8:rusty_v8_custom_libcxx_headers", + "@@//third_party/v8:rusty_v8_custom_libcxx_runtime", ++ "@@//third_party/v8:rusty_v8_c_library_headers", + ], + "//conditions:default": [], + }), @@ -383,7 +384,7 @@ diff --git a/orig/v8-14.9.207.2/bazel/BUILD.icu b/mod/v8-14.9.207.2/bazel/BUILD. index 5fda2f4..8c3c372 100644 --- a/orig/v8-14.9.207.2/bazel/BUILD.icu +++ b/mod/v8-14.9.207.2/bazel/BUILD.icu -@@ -1,3 +1,24 @@ +@@ -1,3 +1,25 @@ +load("@rules_cc//cc:defs.bzl", "cc_library") + +CUSTOM_LIBCXX_COPTS = select({ @@ -401,6 +402,7 @@ index 5fda2f4..8c3c372 100644 + "@v8//:is_v8_use_rusty_v8_custom_libcxx": [ + "@@//third_party/v8:rusty_v8_custom_libcxx_headers", + "@@//third_party/v8:rusty_v8_custom_libcxx_runtime", ++ "@@//third_party/v8:rusty_v8_c_library_headers", + ], + "//conditions:default": [], +}) @@ -408,7 +410,7 @@ index 5fda2f4..8c3c372 100644 # Copyright 2021 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -@@ -16,15 +37,12 @@ cc_library( +@@ -16,15 +38,12 @@ cc_library( ]), copts = select({ "@platforms//os:windows": [ @@ -426,7 +428,7 @@ index 5fda2f4..8c3c372 100644 data = [":icudata"], defines = [ "HAVE_DLOPEN=0", -@@ -54,6 +72,7 @@ cc_library( +@@ -54,6 +73,7 @@ cc_library( "U_ICUDATAENTRY_IN_COMMON", ], tags = ["requires-rtti"], @@ -434,7 +436,7 @@ index 5fda2f4..8c3c372 100644 alwayslink = 1, ) -@@ -65,19 +84,16 @@ cc_library( +@@ -65,19 +85,16 @@ cc_library( ]), copts = select({ "@platforms//os:windows": [ @@ -457,7 +459,7 @@ index 5fda2f4..8c3c372 100644 alwayslink = 1, ) -@@ -93,13 +109,10 @@ cc_library( +@@ -93,13 +110,10 @@ cc_library( ]), copts = select({ "@platforms//os:windows": [ @@ -473,7 +475,7 @@ index 5fda2f4..8c3c372 100644 include_prefix = "third_party/icu", local_defines = [ "U_COMMON_IMPLEMENTATION", -@@ -108,6 +121,6 @@ cc_library( +@@ -108,6 +122,6 @@ cc_library( deps = [ ":icui18n", ":icuuc", diff --git a/rbe.bzl b/rbe.bzl index 57e301ac776..0cf7c4e9e23 100644 --- a/rbe.bzl +++ b/rbe.bzl @@ -18,7 +18,7 @@ platform( "@platforms//cpu:{cpu}", "@platforms//os:linux", "@bazel_tools//tools/cpp:clang", - "@llvm//constraints/libc:gnu.2.28", + "@toolchains_llvm_bootstrapped//constraints/libc:gnu.2.28", ], exec_properties = {{ # Ubuntu-based image that includes git, python3, dotslash, and other diff --git a/third_party/v8/BUILD.bazel b/third_party/v8/BUILD.bazel index 4edad427310..123cf9b1b1a 100644 --- a/third_party/v8/BUILD.bazel +++ b/third_party/v8/BUILD.bazel @@ -9,7 +9,7 @@ config_setting( constraint_values = [ "@platforms//cpu:aarch64", "@platforms//os:linux", - "@llvm//constraints/libc:musl", + "@toolchains_llvm_bootstrapped//constraints/libc:musl", ], ) @@ -18,7 +18,7 @@ config_setting( constraint_values = [ "@platforms//cpu:x86_64", "@platforms//os:linux", - "@llvm//constraints/libc:musl", + "@toolchains_llvm_bootstrapped//constraints/libc:musl", ], ) @@ -27,6 +27,21 @@ config_setting( flag_values = { "@v8//:v8_use_rusty_v8_custom_libcxx": "True", }, + visibility = ["//visibility:public"], +) + +# Same as use_rusty_v8_custom_libcxx but only for user targets (runtime +# stage "complete"). The custom libcxx/libcxxabi runtimes are themselves +# built with the bootstrap toolchain (runtime_stage stage0/stage1), which +# must keep the toolchain's runtime wiring for the link to work; the +# toolchain module selects on this setting to suppress its own libc++. +config_setting( + name = "use_rusty_v8_custom_libcxx_user_targets", + flag_values = { + "@v8//:v8_use_rusty_v8_custom_libcxx": "True", + "@toolchains_llvm_bootstrapped//toolchain:runtime_stage": "complete", + }, + visibility = ["//visibility:public"], ) alias( @@ -144,7 +159,7 @@ cc_library( ":platform_aarch64_unknown_linux_musl": ["ANDROID_HOST_MUSL"], ":platform_x86_64_unknown_linux_musl": ["ANDROID_HOST_MUSL"], "//conditions:default": [], - }), + }) + ["_GNU_SOURCE"], visibility = ["//visibility:public"], deps = [ "@rusty_v8_libcxx//:headers", @@ -161,6 +176,25 @@ cc_library( ], ) +# Hermetic C library headers for the custom-libc++ builds. libc++'s C-compat +# wrappers (e.g. ) reach the C library via #include_next, so the +# include search must land on the real glibc/musl headers instead of the +# toolchain's own libc++ copies. v8+ references this wrapper (rather than the +# toolchain module directly, which is invisible from that external repo). +cc_library( + name = "rusty_v8_c_library_headers", + visibility = ["//visibility:public"], + deps = select({ + "@toolchains_llvm_bootstrapped//platforms/config:gnu": [ + "@@toolchains_llvm_bootstrapped++glibc+glibc//:gnu_libc_headers", + ], + "@toolchains_llvm_bootstrapped//platforms/config:musl": [ + "@@toolchains_llvm_bootstrapped++musl+musl_libc//:musl_libc_headers", + ], + "//conditions:default": [], + }), +) + genrule( name = "binding_cc", srcs = ["@v8_crate_146_4_0//:binding_cc"], @@ -306,23 +340,23 @@ genrule( name = "v8_146_4_0_aarch64_unknown_linux_musl_release", srcs = [ ":v8_146_4_0_aarch64_unknown_linux_musl_release_base", - "@llvm//runtimes/compiler-rt:clang_rt.builtins.static", + "@toolchains_llvm_bootstrapped//runtimes/compiler-rt:clang_rt.builtins.static", ], outs = ["libv8_146_4_0_aarch64_unknown_linux_musl.a"], cmd = """ cat > "$(@D)/merge.mri" <<'EOF' create $@ addlib $(location :v8_146_4_0_aarch64_unknown_linux_musl_release_base) -addlib $(location @llvm//runtimes/compiler-rt:clang_rt.builtins.static) +addlib $(location @toolchains_llvm_bootstrapped//runtimes/compiler-rt:clang_rt.builtins.static) save end EOF - $(location @llvm//tools:llvm-ar) -M < "$(@D)/merge.mri" - $(location @llvm//tools:llvm-ranlib) "$@" + $(location @toolchains_llvm_bootstrapped//tools:llvm-ar) -M < "$(@D)/merge.mri" + $(location @toolchains_llvm_bootstrapped//tools:llvm-ranlib) "$@" """, tools = [ - "@llvm//tools:llvm-ar", - "@llvm//tools:llvm-ranlib", + "@toolchains_llvm_bootstrapped//tools:llvm-ar", + "@toolchains_llvm_bootstrapped//tools:llvm-ranlib", ], ) @@ -379,23 +413,23 @@ genrule( name = "v8_149_2_0_aarch64_unknown_linux_musl_release", srcs = [ ":v8_149_2_0_aarch64_unknown_linux_musl_release_base", - "@llvm//runtimes/compiler-rt:clang_rt.builtins.static", + "@toolchains_llvm_bootstrapped//runtimes/compiler-rt:clang_rt.builtins.static", ], outs = ["libv8_149_2_0_aarch64_unknown_linux_musl.a"], cmd = """ cat > "$(@D)/merge.mri" <<'EOF' create $@ addlib $(location :v8_149_2_0_aarch64_unknown_linux_musl_release_base) -addlib $(location @llvm//runtimes/compiler-rt:clang_rt.builtins.static) +addlib $(location @toolchains_llvm_bootstrapped//runtimes/compiler-rt:clang_rt.builtins.static) save end EOF - $(location @llvm//tools:llvm-ar) -M < "$(@D)/merge.mri" - $(location @llvm//tools:llvm-ranlib) "$@" + $(location @toolchains_llvm_bootstrapped//tools:llvm-ar) -M < "$(@D)/merge.mri" + $(location @toolchains_llvm_bootstrapped//tools:llvm-ranlib) "$@" """, tools = [ - "@llvm//tools:llvm-ar", - "@llvm//tools:llvm-ranlib", + "@toolchains_llvm_bootstrapped//tools:llvm-ar", + "@toolchains_llvm_bootstrapped//tools:llvm-ranlib", ], ) diff --git a/third_party/v8/libcxx.BUILD.bazel b/third_party/v8/libcxx.BUILD.bazel index aeff24a8e6a..a03906d173d 100644 --- a/third_party/v8/libcxx.BUILD.bazel +++ b/third_party/v8/libcxx.BUILD.bazel @@ -1,4 +1,4 @@ -load("@llvm//toolchain/runtimes:cc_runtime_library.bzl", "cc_runtime_stage0_library") +load("@toolchains_llvm_bootstrapped//toolchain/runtimes:cc_runtime_library.bzl", "cc_runtime_stage0_library") load("@rules_cc//cc:defs.bzl", "cc_library") package(default_visibility = ["//visibility:public"]) @@ -111,6 +111,10 @@ cc_runtime_stage0_library( "//conditions:default": ["-fPIC"], }), defines = [ + # Chromium always builds libc++ with _GNU_SOURCE; without it glibc + # does not declare iswspace_l/iswprint_l/... which libc++'s + # __locale_dir/support/linux.h relies on. + "_GNU_SOURCE", "CR_LIBCXX_REVISION=99457fa555797f8c5ac3c076ca288d8481d3b23a", "LIBCXX_BUILDING_LIBCXXABI", "LIBC_NAMESPACE=__llvm_libc_cr", @@ -121,7 +125,7 @@ cc_runtime_stage0_library( "_LIBCPP_INSTRUMENTED_WITH_ASAN=0", "_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS", ] + select({ - "@llvm//platforms/config:musl": [ + "@toolchains_llvm_bootstrapped//platforms/config:musl": [ # Chromium's checked-in __config_site uses this switch to enable # libc++'s musl-specific configuration. "ANDROID_HOST_MUSL", @@ -142,15 +146,15 @@ cc_runtime_stage0_library( "@rusty_v8_llvm_libc//:headers", ] + select({ ":is_linux": [ - "@@llvm++kernel_headers+kernel_headers//:kernel_headers", + "@@toolchains_llvm_bootstrapped++kernel_headers+kernel_headers//:kernel_headers", ], "//conditions:default": [], }) + select({ - "@llvm//platforms/config:gnu": [ - "@@llvm++glibc+glibc//:gnu_libc_headers", + "@toolchains_llvm_bootstrapped//platforms/config:gnu": [ + "@@toolchains_llvm_bootstrapped++glibc+glibc//:gnu_libc_headers", ], - "@llvm//platforms/config:musl": [ - "@@llvm++musl+musl_libc//:musl_libc_headers", + "@toolchains_llvm_bootstrapped//platforms/config:musl": [ + "@@toolchains_llvm_bootstrapped++musl+musl_libc//:musl_libc_headers", ], "//conditions:default": [], }), diff --git a/third_party/v8/libcxxabi.BUILD.bazel b/third_party/v8/libcxxabi.BUILD.bazel index 24e8ed5a623..b03acbd03ee 100644 --- a/third_party/v8/libcxxabi.BUILD.bazel +++ b/third_party/v8/libcxxabi.BUILD.bazel @@ -1,4 +1,4 @@ -load("@llvm//toolchain/runtimes:cc_runtime_library.bzl", "cc_runtime_stage0_library") +load("@toolchains_llvm_bootstrapped//toolchain/runtimes:cc_runtime_library.bzl", "cc_runtime_stage0_library") load("@rules_cc//cc:defs.bzl", "cc_library") package(default_visibility = ["//visibility:public"]) @@ -66,7 +66,7 @@ cc_runtime_stage0_library( "_LIBCPP_INSTRUMENTED_WITH_ASAN=0", "_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS", ] + select({ - "@llvm//platforms/config:musl": [ + "@toolchains_llvm_bootstrapped//platforms/config:musl": [ "ANDROID_HOST_MUSL", ], "//conditions:default": [], @@ -78,15 +78,15 @@ cc_runtime_stage0_library( "@rusty_v8_libcxx//:internal_headers", ] + select({ ":is_linux": [ - "@@llvm++kernel_headers+kernel_headers//:kernel_headers", + "@@toolchains_llvm_bootstrapped++kernel_headers+kernel_headers//:kernel_headers", ], "//conditions:default": [], }) + select({ - "@llvm//platforms/config:gnu": [ - "@@llvm++glibc+glibc//:gnu_libc_headers", + "@toolchains_llvm_bootstrapped//platforms/config:gnu": [ + "@@toolchains_llvm_bootstrapped++glibc+glibc//:gnu_libc_headers", ], - "@llvm//platforms/config:musl": [ - "@@llvm++musl+musl_libc//:musl_libc_headers", + "@toolchains_llvm_bootstrapped//platforms/config:musl": [ + "@@toolchains_llvm_bootstrapped++musl+musl_libc//:musl_libc_headers", ], "//conditions:default": [], }),