mirror of
https://github.com/openai/codex.git
synced 2026-10-29 19:08:43 +00:00
## Why Pre-generated bindings can disagree with native V8 layouts, including CppGC member storage and the inline typed-array size. Source archives need bindings generated with the same headers, defines, and target configuration. ## What changed - Generate bindings through Bazel using the archive's C++ compilation metadata, and include them in Darwin and Linux release pairs and source builds. - Select native Windows MSVC archives and matching bindings together with `--//:rusty_v8_from_source=true`, and generate target-specific Windows GNU bindings. - Pin a corrected `rusty_v8` revision for Cargo and Bazel, and track native Windows LLVM tools and resources as action inputs so pin changes invalidate cached actions. - Run release and canary Cargo smoke tests with explicit target triples, required Linux linkers, and `--include-ignored`. ## Testing Add `codex-v8-poc` coverage for CppGC member size, alignment, tracing, and weak references; typed-array contents and backing-store promotion; and microtask queues across garbage collection and context reassignment. Enable the otherwise ignored CppGC ABI checks for Bazel source builds and staged release smoke tests. GitOrigin-RevId: 9edfa057a0ef2e323543bb8132c070d336ded1b2
110 lines
4.4 KiB
Diff
110 lines
4.4 KiB
Diff
# Reuse rules_cc's installed SDK setup with an explicitly declared LLVM repo.
|
|
# Only the V8 repository has native_llvm; ordinary local_config_cc keeps its
|
|
# installed compiler and input files. Track the fetched LLVM tools and resources
|
|
# as action inputs so changes to the pin invalidate cached compilation and links.
|
|
diff --git a/cc/private/toolchain/windows_cc_configure.bzl b/cc/private/toolchain/windows_cc_configure.bzl
|
|
--- a/cc/private/toolchain/windows_cc_configure.bzl
|
|
+++ b/cc/private/toolchain/windows_cc_configure.bzl
|
|
@@ -539,6 +539,12 @@
|
|
The path to the LLVM installation, or None if not found.
|
|
"""
|
|
|
|
+ # Codex's opt-in V8 toolchain supplies a Bazel-fetched compiler.
|
|
+ # Ordinary cc_autoconf repositories have no such attribute.
|
|
+ llvm_label = getattr(repository_ctx.attr, "native_llvm", None)
|
|
+ if llvm_label:
|
|
+ return str(repository_ctx.path(llvm_label).dirname).replace("/", "\\")
|
|
+
|
|
# 1. Check if BAZEL_LLVM is already set by user.
|
|
bazel_llvm = _get_path_env_var(repository_ctx, "BAZEL_LLVM")
|
|
if bazel_llvm:
|
|
@@ -602,7 +608,7 @@
|
|
|
|
def _use_clang_cl(repository_ctx):
|
|
"""Returns True if USE_CLANG_CL is set to 1."""
|
|
- return _get_env_var(repository_ctx, "USE_CLANG_CL", default = "0") == "1"
|
|
+ return getattr(repository_ctx.attr, "native_llvm", None) != None or _get_env_var(repository_ctx, "USE_CLANG_CL", default = "0") == "1"
|
|
|
|
def _find_missing_llvm_tools(repository_ctx, llvm_path):
|
|
"""Check if any required tool is missing under given LLVM path."""
|
|
@@ -716,6 +722,7 @@
|
|
|
|
build_tools["CL"] = find_llvm_tool(repository_ctx, llvm_path, "clang-cl.exe")
|
|
build_tools["ML"] = find_msvc_tool(repository_ctx, vc_path, "ml64.exe", "x64")
|
|
+ build_tools["DUMPBIN"] = find_msvc_tool(repository_ctx, vc_path, "dumpbin.exe", target_arch)
|
|
build_tools["LINK"] = find_llvm_tool(repository_ctx, llvm_path, "lld-link.exe")
|
|
if not build_tools["LINK"]:
|
|
build_tools["LINK"] = find_msvc_tool(repository_ctx, vc_path, "link.exe", "x64")
|
|
@@ -923,6 +930,12 @@
|
|
)
|
|
|
|
template_vars = dict()
|
|
+ native_llvm = getattr(repository_ctx.attr, "native_llvm", None)
|
|
+ for group in ["compiler_files", "linker_files", "archiver_files", "all_files"]:
|
|
+ files = [str(native_llvm.same_package_label(group))] if native_llvm else []
|
|
+ if native_llvm and group == "all_files":
|
|
+ files.append(":msvc_compiler_files")
|
|
+ template_vars["%{native_llvm_" + group + "}"] = repr(files)
|
|
msvc_vars_x64 = _get_msvc_vars(repository_ctx, paths, "x64")
|
|
template_vars.update(msvc_vars_x64)
|
|
template_vars.update(_get_clang_cl_vars(repository_ctx, paths, msvc_vars_x64, "x64"))
|
|
diff --git a/cc/private/toolchain/BUILD.windows.tpl b/cc/private/toolchain/BUILD.windows.tpl
|
|
--- a/cc/private/toolchain/BUILD.windows.tpl
|
|
+++ b/cc/private/toolchain/BUILD.windows.tpl
|
|
@@ -67,7 +67,22 @@
|
|
"%{msvc_deps_scanner_wrapper_path_x64}",
|
|
"%{msvc_deps_scanner_wrapper_path_arm}",
|
|
"%{msvc_deps_scanner_wrapper_path_arm64}",
|
|
- ]
|
|
+ ] + %{native_llvm_compiler_files}
|
|
+)
|
|
+
|
|
+filegroup(
|
|
+ name = "msvc_all_files",
|
|
+ srcs = %{native_llvm_all_files},
|
|
+)
|
|
+
|
|
+filegroup(
|
|
+ name = "msvc_linker_files",
|
|
+ srcs = %{native_llvm_linker_files},
|
|
+)
|
|
+
|
|
+filegroup(
|
|
+ name = "msvc_archiver_files",
|
|
+ srcs = %{native_llvm_archiver_files},
|
|
)
|
|
|
|
# Hardcoded toolchain, legacy behaviour.
|
|
@@ -301,12 +316,12 @@
|
|
name = "cc-compiler-x64_windows",
|
|
toolchain_identifier = "msvc_x64",
|
|
toolchain_config = ":msvc_x64",
|
|
- all_files = ":empty",
|
|
- ar_files = ":empty",
|
|
+ all_files = ":msvc_all_files",
|
|
+ ar_files = ":msvc_archiver_files",
|
|
as_files = ":msvc_compiler_files",
|
|
compiler_files = ":msvc_compiler_files",
|
|
dwp_files = ":empty",
|
|
- linker_files = ":empty",
|
|
+ linker_files = ":msvc_linker_files",
|
|
objcopy_files = ":empty",
|
|
strip_files = ":empty",
|
|
supports_param_files = 1,
|
|
@@ -526,12 +541,12 @@
|
|
name = "cc-compiler-arm64_windows",
|
|
toolchain_identifier = "msvc_arm64",
|
|
toolchain_config = ":msvc_arm64",
|
|
- all_files = ":empty",
|
|
- ar_files = ":empty",
|
|
+ all_files = ":msvc_all_files",
|
|
+ ar_files = ":msvc_archiver_files",
|
|
as_files = ":msvc_compiler_files",
|
|
compiler_files = ":msvc_compiler_files",
|
|
dwp_files = ":empty",
|
|
- linker_files = ":empty",
|
|
+ linker_files = ":msvc_linker_files",
|
|
objcopy_files = ":empty",
|
|
strip_files = ":empty",
|
|
supports_param_files = 1,
|