Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

fix(v8): compile Windows extensions with clang-cl

ldm098dacf8105db
diff --git a/vendor/v8-152.2.0/MOLI_VENDORING.md b/vendor/v8-152.2.0/MOLI_VENDORING.md
index d2cfb2050..859f16d78 100644
--- a/vendor/v8-152.2.0/MOLI_VENDORING.md
+++ b/vendor/v8-152.2.0/MOLI_VENDORING.md
@@ -19,6 +19,9 @@ Moli extensions:
- `build.rs` compiles Moli's small V8 C++ shims through
`build_moli_v8_ext()`. Keep new Moli-owned C++ shims in separate
`src/*_ext.cc` files instead of editing upstream `src/binding.cc` directly.
+- Windows shims use `clang-cl`, matching V8's supported Windows compiler and
+ the MSVC ABI of the prebuilt archive. V8's public headers use Clang builtins
+ and cannot be compiled as C++ translation units by `cl.exe`.
- `src/object_template_ext.cc`, `src/object_ext.cc`, and
`src/function_template_ext.cc` expose embedder APIs required by Moli's DOM
and Web IDL bindings.
diff --git a/vendor/v8-152.2.0/build.rs b/vendor/v8-152.2.0/build.rs
index 887a40283..3451db4f7 100644
--- a/vendor/v8-152.2.0/build.rs
+++ b/vendor/v8-152.2.0/build.rs
@@ -406,6 +406,13 @@ fn build_moli_v8_ext(sources: &[PathBuf]) {
.include("v8/include")
.std("c++20")
.flag_if_supported("-w");
+ if env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") {
+ // V8's Windows build and public headers require Clang intrinsics such as
+ // `__builtin_frame_address`. clang-cl preserves the MSVC ABI used by the
+ // prebuilt archive while compiling Moli's local extension translation
+ // units with the same compiler family as upstream V8.
+ build.prefer_clang_cl_over_msvc(true);
+ }
// These definitions change V8's public header ABI and must match the
// prebuilt archive (or the GN configuration used for a source build).
if env::var("CARGO_FEATURE_V8_ENABLE_POINTER_COMPRESSION").is_ok() {