[PATCH] D46665: [Itanium] Emit type info names with external linkage.

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 16 17:33:14 PDT 2018


rsmith added a comment.

In https://reviews.llvm.org/D46665#1102290, @rjmccall wrote:

> I believe static and dynamic linkers — at least on ELF and Mach-O — will always drop weak symbols for strong ones.  Now, I think that isn't LLVM's posted semantics for linkonce_odr, but to me that means that LLVM's semantics are inadequate, not that we should decline to take advantage of them.
>
> If we can't rely on that, it probably means that the type name symbol for class types always has to be linkonce_odr, even if it's for a type with a key function.


That all makes sense to me. (But I think `weak_odr` would be more formally correct, even though the symbol will never actually be discarded as it's referenced from the type_info and vtable.)

The rule that ASan is using is that if there is an `external` definition for a global variable, there should not be any other definitions for that symbol, which seems right given LLVM's semantics, but wrong here.

For now, the simplest thing to do seem to be to weaken `external` linkage to `weak_odr` for the type info name.


Repository:
  rC Clang

https://reviews.llvm.org/D46665





More information about the cfe-commits mailing list