[libcxx-commits] [PATCH] D68269: [libc++] Define new/delete in libc++abi only by default

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Oct 1 12:49:05 PDT 2020


ldionne added a comment.

I just updated the review to match the behavior we had agreed on informally. Because this constitutes a tricky change, I'm going to re-iterate what the change does and what the potential implications of it are, and ask that vendors acknowledge the change again.

Currently, in the vanilla LLVM build, both libc++ and libc++abi define and export the various new/delete operators. This is both wrong (ODR violation) and also bad from a code size perspective. It's also just plain confusing. This change moves the operators to libc++abi only, and removes them from libc++. This means:

- On Linux: libc++.so will NOT be exporting new/delete operators. You'll have to link against libc++abi to get those (which should already be the case in most cases). This is an ABI break if you're shipping libc++.so and it links against another ABI library that doesn't provide new/delete.
- On Apple: libc++.dylib re-exports the new/delete operators from libc++abi.dylib, so there should be no functional change here.

For vendors who want to keep the new/delete operators in libc++.dylib, they can define `-DLIBCXX_ENABLE_NEW_DELETE_DEFINITIONS=ON` (and `-DLIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS=OFF`) to get that behavior.

Ping @thakis @srhines @emaste @dim @danalbert @phosek @mgorny @christof @EricWF . Sorry for pinging such a large number of people, but I'd rather have a large audience for a change of this nature.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68269/new/

https://reviews.llvm.org/D68269



More information about the libcxx-commits mailing list