<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/117854>117854</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Linking multiple C objects that included intrin.h yields duplicate symbol errors
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
momo5502
</td>
</tr>
</table>
<pre>
Compiling two or more C files with clang-cl generates the following linker error, if they inlcude `intrin.h`:
```
lld-link: error: duplicate symbol: __inbyte
>>> defined at /builds/llvm/lib/clang/19/include/intrin.h:335
>>> capstone.lib(AArch64Disassembler.c.obj)
>>> defined at capstone.lib(AArch64InstPrinter.c.obj)
lld-link: error: duplicate symbol: __inword
>>> defined at /builds/llvm/lib/clang/19/include/intrin.h:341
>>> capstone.lib(AArch64Disassembler.c.obj)
>>> defined at capstone.lib(AArch64InstPrinter.c.obj)
lld-link: error: duplicate symbol: __indword
>>> defined at /builds/llvm/lib/clang/19/include/intrin.h:347
>>> capstone.lib(AArch64Disassembler.c.obj)
>>> defined at capstone.lib(AArch64InstPrinter.c.obj)
lld-link: error: duplicate symbol: __outbyte
>>> defined at /builds/llvm/lib/clang/19/include/intrin.h:352
>>> capstone.lib(AArch64Disassembler.c.obj)
>>> defined at capstone.lib(AArch64InstPrinter.c.obj)
lld-link: error: duplicate symbol: __outword
>>> defined at /builds/llvm/lib/clang/19/include/intrin.h:356
>>> capstone.lib(AArch64Disassembler.c.obj)
>>> defined at capstone.lib(AArch64InstPrinter.c.obj)
lld-link: error: duplicate symbol: __outdword
>>> defined at /builds/llvm/lib/clang/19/include/intrin.h:360
>>> capstone.lib(AArch64Disassembler.c.obj)
>>> defined at capstone.lib(AArch64InstPrinter.c.obj)
```
This issue was introduced by the following commit: https://github.com/llvm/llvm-project/commit/348240362f9673c824c0ad22fd9e13ae3f937864
I think `inline` is not a valid keyword here. And due to functions being declared previously in intrin.h, the static keyword has no effect.
Other definitions in this header use `__inline__` instead. This fixes the issue for me.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUlkur4zgThn-NvCmOkSVf4oUX_k5_gYaBmcXsD7JUjquPLAVJTib_fpAT-jKXRS_CcECQEKJXbz2lUpWKkU4OcWDN_1jzqVBbWnwYVr_6puGimLy5Da9-PZMld4J09eADrD4gvMJMFiNcKS2grXKnF23hhA6DShghLQizt9Zf805L7h0DYAg-MPEKNOc_3ICc1ZtBYC0nlwK5cmEtZ3JkfF8tfyw-WmtesgyT40NHjmC2syWtEkK8rZO3-be3N3LTLWHeL_9_X2BwJocGVAImjtNG1kQmjtZe1vxBExPHPQomjlXPxJGctpvB_dvDmBylbH5Q1eock3dY7gKHcQx6aetPFFWMuE4WQ6lLP31hov83N_8s8dnF9Fsgl35U-CkGVx_MMxjU1cdhYJ4GofsoEPyWnlUNjfhAEJ51E5r2A0F4Wj3sT_R_R-H7RsH4-PtCESjGDeGqImSj3mwaDUy3v3Qm7deVUga0pHSOufWIIxPHE6Vlm0rt1-9o2Mv6cg7-C-qUsdy3iqOsD6LmshVz33ZSH0StuTJCzKbHSiqUcy-7Q1szPn6GtJB7vzc8Sw5Zy4EiOJ9AwUVZMvCOt5wmWDBgCaMzYDaE5GHenE7kXYQJs3eD2qqABs4BL-S3aHNHha95Ea97sDGpRPqbrMrHAc4z6lQyPv6aFgx39HSXJ5dtRlhQGQywxb1D5wc1W3572027mFCZEnbYM_3xaPp37HOeE7AszCBNL3tV4FB1UrR9c6hlsQxVzedJzRxbrUxV6ZpjNdc9P7S1mWQ3FzQILuqqEh3f4ZZ8xqZreFXVsu9a3rGa46rIljkrpQ-nYj95qKru0NSFVRPauA82Qji83n0xIfKcE4Y9ldN2iqzmlmKK32QSJYvDL-TeM-N1s4nONg88fsqJz1GqBI8yMF9pw43Qmvi32rtXZSy2YIefvmK76VyPj6gug_gzAAD__9hPIUg">