[libcxx-commits] [PATCH] D127444: [libc++] Use ABI tags instead of internal linkage to provide per-TU insulation

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 9 14:41:11 PDT 2022


ldionne created this revision.
Herald added a subscriber: mgorny.
Herald added a project: All.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127444

Files:
  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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127444.435690.patch
Type: text/x-patch
Size: 11758 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220609/7cc07657/attachment-0001.bin>


More information about the libcxx-commits mailing list