deps: rebuild V8 without sandbox (enables zero-copy ArrayBuffer)#7
Merged
Conversation
Rebuilt from V8 commit 5297e56d91816747d539abca52b578e5832135f0
with v8_enable_sandbox=false for all 4 platforms:
- linux/amd64 (CI)
- linux/arm64 (CI cross-compile with sysroot + custom libcxx)
- darwin/arm64 (CI)
- darwin/amd64 (local cross-compile from arm64)
Removes -DV8_ENABLE_SANDBOX from cgo.go so NewArrayBufferExternal
uses the true zero-copy path (no memcpy fallback).
Adds local dep modules under deps/{os}_{arch}/ with replace
directives in go.mod.
GNU ld on Ubuntu rejects llvm-ar's 64-bit symbol table format
when using -L/-l flags ('skipping incompatible'). Pass archives
as direct paths instead, which forces the linker to read them
regardless of symbol table format.
V8's clang enables ThinLTO by default in release builds, producing LLVM bitcode objects that GNU ld cannot link. Add use_thin_lto=false to both the CI workflow and local build script.
llvm-ar produces archives in a format GNU ld cannot read
('unknown architecture'). Use system ar for Linux targets
which produces compatible GNU-format archives.
V8's clang produces ELF objects with features GNU ld cannot parse
('unknown architecture'). Use LLVM's lld linker via -fuse-ld=lld
for Linux targets. Install lld in CI.
…ves) CGo's security policy rejects -fuse-ld=lld in #cgo LDFLAGS. Set it via CGO_LDFLAGS environment variable in CI instead.
V8's clang produces ELF objects with features GNU ld cannot parse. Use system gcc for the native linux/amd64 build to produce standard GNU-compatible ELF objects. Keep clang for cross-compile targets (linux/arm64, darwin/*) where it's required. Revert lld workaround — not needed with gcc objects.
Rebuilt with is_clang=false to produce standard GNU ELF objects compatible with GNU ld.
Instead of passing -fuse-ld=lld via CGO_LDFLAGS (which causes segfaults), install lld and make it the default ld via update-alternatives. Restore clang-built V8 archives.
Use gcc-built V8 archives (GNU ld compatible) with --start-group/--end-group to resolve cross-archive dependencies. Remove lld workaround.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
v8_enable_sandbox=false-DV8_ENABLE_SANDBOXfromcgo.godeps/{os}_{arch}/with replace directivesSandboxEnabled()now returnsfalseNewArrayBufferExternaluses true zero-copy (no memcpy fallback)Build sources
Test plan
go test ./...)TestNewArrayBufferExternal_SharedMemoryno longer skippedTestNewArrayBufferExternal_JSWritesGoMemoryno longer skipped