]> granicus.if.org Git - clang/commit
MS ABI: Stick internal vftables in a comdat if they have RTTI data
authorDavid Majnemer <david.majnemer@gmail.com>
Sun, 13 Jul 2014 05:19:56 +0000 (05:19 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Sun, 13 Jul 2014 05:19:56 +0000 (05:19 +0000)
commit1fef4d1c6aa1c8a8995888693237fe20cfa3245a
tree12c32cfb32bafbed84e4601b7d19d57e5feefa51
parentca1863eec72a53b1b6e7f70b1807df92c837be22
MS ABI: Stick internal vftables in a comdat if they have RTTI data

Previously, we would have a private backing variable and an internal
alias pointing at it.

However, -fdata-sections only fires if a global variable has non-private
linkage.  This means that an unreferenced vftable wouldn't get
discarded, bloating the object file.

Instead, stick the backing variable in a comdat even if the alias has
internal linkage.  This will allow the linker to drop the vftable if it
is unused.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212901 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/MicrosoftCXXABI.cpp
test/CodeGenCXX/microsoft-abi-vftables.cpp