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

Roland McGrath via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 31 15:36:54 PDT 2018


mcgrathr added a comment.

In https://reviews.llvm.org/D53787#1282975, @rsmith wrote:

> These symbols really are special. Other symbols are introduced explicitly by a declaration, whereas these are declared implicitly by the compiler.


The implicit declaration is the only difference that actually makes sense to me.

> 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.

> 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.

>> It is especially bizarre to me that explicit attributes on the definition sites are silently ignored for these functions and no others.
> 
> Do you have a testcase? That's not the behavior I'm seeing. What I see is that we get a hard error for an explicit attribute on the definition site, because the prior compiler-generated declaration has default visibility. Eg:

You're right.  It's been quite a while since I was fighting with this originally.  It might have been GCC that ignored explicit attributes.


Repository:
  rC Clang

https://reviews.llvm.org/D53787





More information about the cfe-commits mailing list