[PATCH] D53787: [Sema] Use proper visibility for global new and delete declarations

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 31 16:01:04 PDT 2018


rsmith added a comment.

In https://reviews.llvm.org/D53787#1282995, @mcgrathr wrote:

> In https://reviews.llvm.org/D53787#1282975, @rsmith wrote:
>
> > Other symbols must have exactly one definition (modulo the permission for duplicate identical definitions for some cases), but these ones have a default definition that is designed to be overridable by a different definition appearing anywhere in the program.
>
>
> I don't understand this claim.  These are symbols like any others at link time.  A single definition must be supplied as for any other function.


The program has two choices: either it provides a definition, and that gets used everywhere, or it does not, and the default version (provided by the toolchain) gets used everywhere. This is what the language model requires, and it's so important that the entire program agrees on what the default heap is that we intentionally make this work even when using `-fvisibility=hidden`.

>> Other symbols are generally provided in one library and consumed by users of that library, whereas these symbols are typically provided by the main binary and consumed by the libraries that it uses. And so on.
> 
> I don't understand this claim.  These symbols are normally defined in libc++.so and nowhere else.

That's not accurate. As noted above, programs can provide their own definitions, which are required to replace the version that would otherwise be implicitly provided.


Repository:
  rC Clang

https://reviews.llvm.org/D53787





More information about the cfe-commits mailing list