Page MenuHomeFreeBSD

Bump libc++.so version for new std::pair ABI
Changes PlannedPublic

Authored by dim on May 26 2022, 4:05 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 22, 7:10 AM
Unknown Object (File)
Tue, Apr 2, 10:54 PM
Unknown Object (File)
Tue, Apr 2, 5:05 AM
Unknown Object (File)
Jan 11 2024, 6:51 AM
Unknown Object (File)
Dec 20 2023, 3:51 AM
Unknown Object (File)
Dec 16 2023, 5:04 AM
Unknown Object (File)
Nov 23 2023, 3:11 AM
Unknown Object (File)
Oct 22 2023, 2:09 AM

Details

Summary

Since ~2013 we have been using the earliest std::pair ABI in libc++,
where std::pair did not have a trivial copy constructor. This was
originally a defect in the C++ standard, which was corrected in
https://github.com/llvm/llvm-project/commit/ccad8c32e088.

However, as the upstream commit message explains, the Itanium ABI
specifies different calling conventions for trivial and non-trivial copy
constructors; therefore this changed the libc++ ABI. In a follow-up
commit https://github.com/llvm/llvm-project/commit/f9fd0d6d113c, the
change was made optional with a compile-time define, which FreeBSD has
been using ever since, to keep the old ABI. (E.g., our std::pair copy
constructors are never trivial.)

Since the non-triviality of std::pair constructors sometimes causes
build problems with C++ programs (for instance llvm-project itself, see
https://github.com/llvm/llvm-project/issues/55414), we will now
re-enable the new std::pair ABI for FreeBSD 14 and later.

To safely do this, bump the libc++.so version to 2, so older programs
can keep working with the old libc++.so.1, which will be moved into a
ports compat package.

MFC after: never
Relnotes: yes

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Errors
SeverityLocationCodeMessage
Errorlib/libc++/Makefile:NAME1Bad Filename
Unit
No Test Coverage
Build Status
Buildable 45725
Build 42613: arc lint + arc unit

Event Timeline

dim requested review of this revision.May 26 2022, 4:05 PM
dim created this revision.
dim planned changes to this revision.May 26 2022, 10:31 PM

Okay, let's put this on hold for a while; I submitted https://reviews.llvm.org/D126462 upstream, and it looks like the libc++ folks are not opposed to "officially" bumping their upstream ABI version. (They saved a bunch of incompatible changes under ABI version 2 for a while, but that has been marked unstable up to now.)

This is probably needed for the latest versions of www/webkit2-gtk, which use C++20 and these constructors/destructors amongst other things.

This is probably needed for the latest versions of www/webkit2-gtk, which use C++20 and these constructors/destructors amongst other things.

I don't want to work on this now, though. Upstream still has not "stabilized" their v2 ABI: https://github.com/llvm/llvm-project/blob/main/libcxx/CMakeLists.txt#L191

At some point I committed https://github.com/llvm/llvm-project/commit/6255157d24e27c604bda8fe8ce26e896f54785c0, which effectively made the change:

diff
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -164,7 +164,7 @@
 #    endif
 // Feature macros for disabling pre ABI v1 features. All of these options
 // are deprecated.
-#    if defined(__FreeBSD__)
+#    if defined(__FreeBSD__) && __FreeBSD__ < 14
 #      define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
 #    endif
 // For XCOFF linkers, we have problems if we see a weak hidden version of a symbol

but somehow this didn't end up in 14.0. :(

At least www/webkit2-gtk successfully built under libc++ without #define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR run in a libc++ with the define, though this may be due to dynamic linking.