[libc++] Use ABI tags instead of internal linkage to provide per-TU insulation
authorLouis Dionne <ldionne.2@gmail.com>
Thu, 9 Jun 2022 21:36:33 +0000 (17:36 -0400)
committerLouis Dionne <ldionne.2@gmail.com>
Wed, 6 Jul 2022 19:30:04 +0000 (15:30 -0400)
commit9ee97ce3b8305c5762ec34eecb4daf379984c95b
tree39ebae14313adba037359d04b1ac8a555624e314
parent8f83f8f999fb251fd05307bec6d0c9b0a671b2fe
[libc++] Use ABI tags instead of internal linkage to provide per-TU insulation

Instead of marking private symbols with internal_linkage (which leads to
one copy per translation unit -- rather wasteful), use an ABI tag that
gets rev'd with each libc++ version. That way, we know that we can't have
name collisions between implementation-detail functions across libc++
versions, so we'll never violate the ODR. However, within a single program,
each symbol still has a proper name with external linkage, which means
that the linker is free to deduplicate symbols even across TUs.

This actually means that we can guarantee that versions of libc++ can
be mixed within the same program without ever having to take a code size
hit, and without having to manually opt-in -- it should just work out of
the box.

Differential Revision: https://reviews.llvm.org/D127444
libcxx/CMakeLists.txt
libcxx/cmake/caches/Apple.cmake
libcxx/docs/BuildingLibcxx.rst
libcxx/docs/DesignDocs/VisibilityMacros.rst
libcxx/docs/ReleaseNotes.rst
libcxx/include/__config
libcxx/include/__config_site.in
libcxx/test/libcxx/strings/basic.string/PR42676.sh.cpp [deleted file]