<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62270>62270</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[llvm] spurious multiple definition errors when linking with gcc
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
filnet
</td>
</tr>
</table>
<pre>
I am one of the maintainers of the MSYS2 build of Rust.
Since upgrading to LLVM 16.0 the gcc build of Rust fails with the following error.
I have traced the caused of the error to this change: https://github.com/llvm/llvm-project/commit/95b27b2a1e0e9fe0781ec76015b4016b9d04423d
Rerverting it fixes the build issue.
In a nutshell, Rust builds it own C++ wrappers around some LLVM classes.
It happens that both Rust and LLVM end up instantiating the same template.
Apparently having these instances constant allows gcc to merge them (?).
If they are not constant, gcc fails with `multiple definition` errors.
Note that the clang build is fine.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUU8FurDgQ_Bpzae3IGAbCgcMk0UiRkj0k0kp7NHYD3jU2spvM5u9XNjN5b6R3eRewrO5ydVW1jNFMDrFnx0d2fC7kRrMP_WisQyoGr7_6F5ALeIfgR6AZYZHGkTQOQ7xdvX38_SFg2IzV6ep9i3Rg_Jnx0_79ME4hbOsUpDZuAvLw-vrXG5TNgWeASan7dhilsREuhuZcMHpr_SX1Ygg-3KG_wCw_EShIhTpXK7lF1Dd2uSO9SbOJoGbpJmTVCWaiNbLqxMSZifNkaN6Gg_ILE2drP2-_P9bg_0FFTJyVXxaTDt1xEO0gZIkcuxF5-1CiahteHoeal83QaV7XotI7v3cMnxgokTcEo_kPY-a1D2xi3PB-HgcS3EZxRmuZeNoFydUxIfiLgycmHpl4hEuQ65qckMFvTkP0C-7aKitjxHhFfiGYU6VLT0uCwdO840qn9wZ0GrYVjIskHRmZCSeeUS4IhMtqJd2YntZVBnRkv5L418qI126FEZTfgUAm52K2mDwsGCZMxQsw8cCqMxPdjWO26wtkQHCevhGSBKn7p0iwhi-bJbNaBI2jcYaMd6zhu9nxTs8_PeE-dc6GlW761h5G424zFbqvdFd1ssC-bB4Er9quKYu575RStRBDg-04al5XZTuqUY2tllIMVVuYXnBR8VqUnNcNLw-6E03ZdKLuxk51x5rVHBdp7CEl6uDDVGTb-0aIlhdWDmhjXkEhHF72TDAh0kaGPqdw2KbIam5NpPgDhQzZvLs5sMdniOsWjN8i_EKeqzZwmdGBNe7fZFuWc1Kq2ILtf3sjMtHIxDkP8n8AAAD__--0a48">