Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ build --tool_java_runtime_version=remotejdk_25
# Platform-specific C++ standard flags
build:macos --cxxopt=-std=c++20
build:macos --host_cxxopt=-std=c++20
# Apple's ld (MODULE.bazel extra_link_flags --ld-path=/usr/bin/ld) does not
# accept lld's --start-lib/--end-lib. Disabling this feature is a no-op for
# toolchains that never advertised it (wasm/emscripten) and only skips an
# lld grouping optimization elsewhere. Do not put --ld-path here: it would
# leak into wasm transitions via enable_platform_specific_config.
build:macos --features=-supports_start_end_lib
build:linux --cxxopt=-std=c++20
build:linux --host_cxxopt=-std=c++20
# Windows MSVC C++20 comes from the patched rules_cc default_cpp_std feature
Expand Down
10 changes: 10 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ llvm.toolchain(
# When bumping these versions, also update .bazelrc build:tsan_macos rpath
# (clang/N) and confirm Xcode ships the same major; see docs/BUILD_SYSTEM.md.
# Keep MSAN_LLVM_VERSION / MSAN_DISTRIBUTION below on the same LLVM release.
# LLVM 21 ld64.lld cannot parse MacOSX 27 SDK TBD files that list
# arm64e.x1. Apple's ld can; last --ld-path wins over the toolchain default
# --ld-path=ld64.lld. Pair with .bazelrc --features=-supports_start_end_lib
# because Apple ld rejects lld's --start-lib/--end-lib. Scoped to this
# toolchain so wasm/emscripten keeps wasm-ld (do not put --ld-path in
# build:macos --linkopt). See docs/BUILD_SYSTEM.md (macOS SDK section).
extra_link_flags = {
"darwin-aarch64": ["--ld-path=/usr/bin/ld"],
"darwin-x86_64": ["--ld-path=/usr/bin/ld"],
},
Comment thread
tameware marked this conversation as resolved.
llvm_versions = {
"darwin-aarch64": "21.1.8",
"linux-x86_64": "21.1.8",
Expand Down
11 changes: 11 additions & 0 deletions docs/BUILD_SYSTEM.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ If you see runtime loader failures after a toolchain or OS change:
2. Re-resolve Bazel toolchains (`bazelisk shutdown`, then `bazelisk clean --expunge`).
3. Re-run `bazelisk test //...` to confirm runtime compatibility.

**Xcode 27 / MacOSX 27 SDK TBD files.** The macOS 27 SDK lists `arm64e.x1` in
system `.tbd` stubs. LLVM 21's `ld64.lld` rejects those files (`unknown
architecture arm64e.x1`) and then reports a cascade of missing libc++ /
libSystem symbols. Native Darwin links therefore use Apple's `/usr/bin/ld`
via `llvm.toolchain.extra_link_flags` in `MODULE.bazel`, and `.bazelrc`
disables Bazel's `supports_start_end_lib` feature (Apple ld does not accept
`--start-lib` / `--end-lib`). That `--ld-path` override is toolchain-scoped
on purpose: putting it in `build:macos --linkopt` would leak into wasm
transitions and replace `wasm-ld`. Drop both workarounds when LLVM's Mach-O
linker can parse `arm64e.x1` TBD targets.

### AddressSanitizer, ThreadSanitizer, UndefinedBehaviorSanitizer, and MemorySanitizer

Sanitizer builds use `--config=asan`, `--config=tsan`, `--config=ubsan`, or
Expand Down