Skip to content

Commit 84d11d1

Browse files
committed
fix(macos): gate static libc++ on an explicitly declared deployment floor
Semantics: declaring a minimum macOS (env var or [build] macos_deployment_target) is what opts a build into the static LLVM libc++ — that's the mechanism that makes the declared floor real. With no declared floor the link stays on the dynamic system libc++ exactly as in 0.0.49 (zero behavior change for existing users), which also sidesteps a still-open SIGSEGV in mixed C/C++ static binaries (e2e 36_llvm_toolchain; investigation tracked in the design doc). Release pipelines declare 14.0, so the shipped mcpp/xlings binaries remain static + portable.
1 parent 8731c65 commit 84d11d1

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/build/flags.cppm

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,16 @@ CompileFlags compute_flags(const BuildPlan& plan) {
373373
// lld ships with the exact toolchain doing the compile.
374374
f.ldStdlibDefault = " -lc++";
375375
f.ldStdlibTest = " -lc++";
376-
if (f.staticStdlib && !llvmRootForStdlib.empty()) {
376+
// Static libc++ is tied to an EXPLICIT deployment floor: when the
377+
// user (or the release pipeline) declares a minimum macOS via the
378+
// env var or [build] macos_deployment_target, the static LLVM
379+
// libc++ is what makes that floor real (the system libc++ caps it
380+
// at the build host's OS). With no declared floor, keep the
381+
// 0.0.49 behavior — dynamic system libc++, host-coupled — which
382+
// also sidesteps a still-open SIGSEGV in mixed C/C++ static
383+
// binaries (e2e 36; tracked in the design doc).
384+
if (f.staticStdlib && !macosDeploymentTarget.empty()
385+
&& !llvmRootForStdlib.empty()) {
377386
auto libDir = llvmRootForStdlib / "lib";
378387
auto libcxxA = libDir / "libc++.a";
379388
auto libcxxAbiA = libDir / "libc++abi.a";

0 commit comments

Comments
 (0)