aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2018-05-10 19:51:56 +0000
committerEric Fiselier <eric@efcs.ca>2018-05-10 19:51:56 +0000
commit85ba3321c6253846dd597c8d8291c999f969ff45 (patch)
tree8351bbc4d958a376baef1b1d436f2bc7c43c5f4c /llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
parentb8238db4c4e09aac444c52941ef44449368a4884 (diff)
downloadllvm-85ba3321c6253846dd597c8d8291c999f969ff45.zip
llvm-85ba3321c6253846dd597c8d8291c999f969ff45.tar.gz
llvm-85ba3321c6253846dd597c8d8291c999f969ff45.tar.bz2
[Itanium] Emit type info names with external linkage.
Summary: The Itanium ABI requires that the type info for pointer-to-incomplete types to have internal linkage, so that it doesn't interfere with the type info once completed. Currently it also marks the type info name as internal as well. However, this causes a bug with the STL implementations, which use the type info name pointer to perform ordering and hashing of type infos. For example: ``` // header.h struct T; extern std::type_info const& Info; // tu_one.cpp #include "header.h" std::type_info const& Info = typeid(T*); // tu_two.cpp #include "header.h" struct T {}; int main() { auto &TI1 = Info; auto &TI2 = typeid(T*); assert(TI1 == TI2); // Fails assert(TI1.hash_code() == TI2.hash_code()); // Fails } ``` This patch fixes the STL bug by emitting the type info name as linkonce_odr when the type-info is for a pointer-to-incomplete type. Note that libc++ could fix this without a compiler change, but the quality of fix would be poor. The library would either have to: (A) Always perform strcmp/string hashes. (B) Determine if we have a pointer-to-incomplete type, and only do strcmp then. This would require an ABI break for libc++. Reviewers: rsmith, rjmccall, majnemer, vsapsai Reviewed By: rjmccall Subscribers: smeenai, cfe-commits Differential Revision: https://reviews.llvm.org/D46665 llvm-svn: 332028
Diffstat (limited to 'llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp')
0 files changed, 0 insertions, 0 deletions