[llvm] 4d21f66 - Be smarter about the GLIBCXX_USE_CXX11_ABI default (#155781)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 29 23:45:59 PDT 2025


Author: serge-sans-paille
Date: 2025-08-30T06:45:55Z
New Revision: 4d21f664db63a30e331696a28b9c340a2f059997

URL: https://github.com/llvm/llvm-project/commit/4d21f664db63a30e331696a28b9c340a2f059997
DIFF: https://github.com/llvm/llvm-project/commit/4d21f664db63a30e331696a28b9c340a2f059997.diff

LOG: 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.

Added: 
    

Modified: 
    llvm/cmake/modules/HandleLLVMOptions.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index e60ad4b5c2f5c..97aa1317bc218 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -183,7 +183,15 @@ CHECK_CXX_SOURCE_COMPILES("
 int main() { return 0; }
 " LLVM_USES_LIBSTDCXX)
 
-option(GLIBCXX_USE_CXX11_ABI "Use new libstdc++ CXX11 ABI" ON)
+CHECK_CXX_SOURCE_COMPILES("
+#include <string>
+#if _GLIBCXX_USE_CXX11_ABI == 0
+#error _GLIBCXX_USE_CXX11_ABI not active
+#endif
+int main() { return 0; }
+" LLVM_DEFAULT_TO_GLIBCXX_USE_CXX11_ABI)
+
+option(GLIBCXX_USE_CXX11_ABI "Use new libstdc++ CXX11 ABI" ${LLVM_DEFAULT_TO_GLIBCXX_USE_CXX11_ABI})
 
 if (LLVM_USES_LIBSTDCXX)
   if (GLIBCXX_USE_CXX11_ABI)


        


More information about the llvm-commits mailing list