Files
Jacob Pratt 5f9254e47d Rollup merge of #158808 - chitao1234:fix-rustc-llvm-cross-libstdcxx-abi, r=cuviper
Filter host libstdc++ ABI flag in rustc_llvm cross builds

`compiler/rustc_llvm/build.rs` invokes `llvm-config` for the build host machine in cross compilation scenarios. In particular, the normal LLVM configuration on Linux sets `_GLIBCXX_USE_CXX11_ABI=1` and those flags would then pollute C++ wrapper objects being compiled for the target.

This patch makes `rustc_llvm` avoid propagating that macro when cross-compiling. This follows the existing pattern in `rustc_llvm/build.rs`, which already treats parts of cross `llvm-config` output as host-specific by filtering `-m*` flags and rewriting include paths. Although I think the more appropriate approach is to use a separate target LLVM C++ flags setting.

This currently affects Haiku rustc cross-compilation from Linux hosts. The Haiku target currently uses the old libstdc++ string ABI by default and that creates an ABI mismatch. I currently work around this locally by setting environment variable `CXXFLAGS_x86_64_unknown_haiku=-D_GLIBCXX_USE_CXX11_ABI=0`.
2026-07-20 23:38:03 -04:00
..