[PATCH] D47092: downgrade strong type info names to weak_odr linkage

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 18 15:26:26 PDT 2018


rsmith created this revision.
rsmith added reviewers: EricWF, rjmccall, eli.friedman, jgorbe.
Herald added a reviewer: javed.absar.

After https://reviews.llvm.org/D46665 / https://reviews.llvm.org/rC332028, we now emit `linkonce_odr` definitions of type info names for incomplete class types. This results in formal violations of LLVM's linkage rules (which, for example, cause ASan's ODR violation checker to complain) if the type info name is declared with `external` linkage in another IR module. To solve this, downgrade any type info names that we would give `external` linkage to instead have `weak_odr` linkage. Exception: if we would emit a non-unique `type_info` name anyway, leave the linkage alone.

This required a bit of rearrangement: the uniqueness of the name can no longer depend on the linkage of the name, because the linkage of the name now depends on the uniqueness of the name! Fortunately, the uniqueness doesn't *really* depend on the linkage of the name, it only depends on the uniqueness of the type. I've split out the type uniqueness / name uniqueness / type_info uniqueness calculations to try to make this a bit clearer.


Repository:
  rC Clang

https://reviews.llvm.org/D47092

Files:
  lib/CodeGen/ItaniumCXXABI.cpp
  test/CodeGenCXX/arm64.cpp
  test/CodeGenCXX/rtti-linkage.cpp
  test/CodeGenCXX/type_visibility.cpp
  test/CodeGenCXX/vtable-available-externally.cpp
  test/CodeGenCXX/vtable-key-function-arm.cpp
  test/CodeGenCXX/vtable-linkage.cpp
  test/CodeGenCXX/windows-itanium-type-info.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47092.147600.patch
Type: text/x-patch
Size: 15450 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180518/f7f896c3/attachment-0001.bin>


More information about the cfe-commits mailing list