[libcxx-commits] [libcxx] [libc++] Encode the standard version in the ABI tag (PR #218527)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 17 12:46:56 PDT 2026


https://github.com/ldionne updated https://github.com/llvm/llvm-project/pull/218527

>From b4722350fa4c240afa136334b0f3bb2672272bb4 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Mon, 24 Aug 2026 17:13:01 -0400
Subject: [PATCH 1/2] [libc++] Encode the standard version in the ABI tag

This prevents ODR mismatch issues from biting us across standard versions.

Fixes #218524
---
 libcxx/include/__configuration/attributes.h | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/libcxx/include/__configuration/attributes.h b/libcxx/include/__configuration/attributes.h
index 2f8841fce0a07..8041581e649ba 100644
--- a/libcxx/include/__configuration/attributes.h
+++ b/libcxx/include/__configuration/attributes.h
@@ -150,10 +150,17 @@
 #  define _LIBCPP_EXCEPTIONS_SIG e
 #endif
 
-#define _LIBCPP_ODR_SIGNATURE                                                                                          \
-  _LIBCPP_CONCAT(                                                                                                      \
-      _LIBCPP_CONCAT(_LIBCPP_CONCAT(_LIBCPP_HARDENING_SIG, _LIBCPP_ASSERTION_SEMANTIC_SIG), _LIBCPP_EXCEPTIONS_SIG),   \
-      _LIBCPP_VERSION)
+#define _LIBCPP_STANDARD_VERSION_SIG _LIBCPP_CONCAT(std, _LIBCPP_STD_VER)
+
+// clang-format off
+#define _LIBCPP_ODR_SIGNATURE                                                                                           \
+  _LIBCPP_CONCAT(_LIBCPP_CONCAT(_LIBCPP_CONCAT(_LIBCPP_CONCAT(                                                          \
+    _LIBCPP_HARDENING_SIG,                                                                                              \
+    _LIBCPP_ASSERTION_SEMANTIC_SIG),                                                                                    \
+    _LIBCPP_EXCEPTIONS_SIG),                                                                                            \
+    _LIBCPP_VERSION),                                                                                                   \
+    _LIBCPP_STANDARD_VERSION_SIG)
+// clang-format on
 
 // This macro marks a symbol as being hidden from libc++'s ABI. This is achieved
 // on two levels:

>From d5748eddf22afd245154f331b5a6dced99f496eb Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Thu, 17 Sep 2026 12:45:44 -0700
Subject: [PATCH 2/2] Drop std prefix

---
 libcxx/include/__configuration/attributes.h | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/libcxx/include/__configuration/attributes.h b/libcxx/include/__configuration/attributes.h
index 8041581e649ba..5c045edd8f0a2 100644
--- a/libcxx/include/__configuration/attributes.h
+++ b/libcxx/include/__configuration/attributes.h
@@ -150,16 +150,14 @@
 #  define _LIBCPP_EXCEPTIONS_SIG e
 #endif
 
-#define _LIBCPP_STANDARD_VERSION_SIG _LIBCPP_CONCAT(std, _LIBCPP_STD_VER)
-
 // clang-format off
 #define _LIBCPP_ODR_SIGNATURE                                                                                           \
   _LIBCPP_CONCAT(_LIBCPP_CONCAT(_LIBCPP_CONCAT(_LIBCPP_CONCAT(                                                          \
-    _LIBCPP_HARDENING_SIG,                                                                                              \
+    _LIBCPP_VERSION,                                                                                                    \
+    _LIBCPP_HARDENING_SIG),                                                                                             \
     _LIBCPP_ASSERTION_SEMANTIC_SIG),                                                                                    \
     _LIBCPP_EXCEPTIONS_SIG),                                                                                            \
-    _LIBCPP_VERSION),                                                                                                   \
-    _LIBCPP_STANDARD_VERSION_SIG)
+    _LIBCPP_STD_VER)
 // clang-format on
 
 // This macro marks a symbol as being hidden from libc++'s ABI. This is achieved



More information about the libcxx-commits mailing list