Skip to content

Commit 4d21f66

Browse files
Be smarter about the GLIBCXX_USE_CXX11_ABI default (#155781)
It appears that unconditionally using GLIBCXX_USE_CXX11_ABI=0 is slow on modern libstdc++, while using GLIBCXX_USE_CXX11_ABI=1 breaks old buildbots, so use the compiler default unless asked to do differently.
1 parent 257975f commit 4d21f66

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

llvm/cmake/modules/HandleLLVMOptions.cmake

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,15 @@ CHECK_CXX_SOURCE_COMPILES("
183183
int main() { return 0; }
184184
" LLVM_USES_LIBSTDCXX)
185185

186-
option(GLIBCXX_USE_CXX11_ABI "Use new libstdc++ CXX11 ABI" ON)
186+
CHECK_CXX_SOURCE_COMPILES("
187+
#include <string>
188+
#if _GLIBCXX_USE_CXX11_ABI == 0
189+
#error _GLIBCXX_USE_CXX11_ABI not active
190+
#endif
191+
int main() { return 0; }
192+
" LLVM_DEFAULT_TO_GLIBCXX_USE_CXX11_ABI)
193+
194+
option(GLIBCXX_USE_CXX11_ABI "Use new libstdc++ CXX11 ABI" ${LLVM_DEFAULT_TO_GLIBCXX_USE_CXX11_ABI})
187195

188196
if (LLVM_USES_LIBSTDCXX)
189197
if (GLIBCXX_USE_CXX11_ABI)

0 commit comments

Comments
 (0)