<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/113974>113974</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
lld-link LTO doesn't support comdat selection kinds
</td>
</tr>
<tr>
<th>Labels</th>
<td>
lld:COFF
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
rnk
</td>
</tr>
</table>
<pre>
[This code in LLD COFF](https://github.com/llvm/llvm-project/blob/474234a09655e57b7a4270150f0926db77e864b4/lld/COFF/InputFiles.cpp#L1200) doesn't ever look at the LLVM IR comdat selection kind, so it doesn't implement selection kinds other than "any". It simply boils comdats down to a boolean, rather than a selection kind.
This means that mixing RTTI code with no-RTTI code can crash at runtime because the static linker forgot to implement `IMAGE_COMDAT_SELECT_LARGEST` or the `largest` comdat selection kind ([LangRef](https://llvm.org/docs/LangRef.html#comdats:~:text=the%20same%20data.-,largest,-The%20linker%20will)).
A Chrome-related user exercised these conditions and reported those symptoms, and I'm reasonably convinced I've spotted the bug by looking at the source code. The source does say "// FIXME: Check nodeduplicate" after all. =S
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVE1v4zgM_TXKhYhh01_xwYdMUg8CpCjQBou9FbLFxNrIkiHJaXPZ376QkyKzg17mYgsURfLxPZI7J0-aqGb5D5ZvF3zyvbG11edFa8Q1mA-9dNAZQSA17Pdb2Lw0Dcu3DFe996Nj6Zphw7A5Sd9PbdSZgWGj1OXrtxyt-Yc6z7BplWkZNlmZYZrxuCrynPKyLXmGZZzk8TGusBBtWdKqyNpsDiAYNnNKbHZ6nHwjFbmoG0eG6T7BOGZYgTDkNMPSA13IgjLmDNyD7wn2-7-eYfcKnRkE9-BIUeel0XCWWjDcgDMg_S8R5DAqGkj_7uvA-J4s-J5rYIhcXxliBDsPLry5QmukcvdEDoT50OANcGiNUcR1SGb5Iwb_LUHE4i2L17fv3PaBuHbB2cMgP6U-wev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