Skip to content

Linking multiple C objects that included intrin.h yields duplicate symbol errors #117854

Closed
@momo5502

Description

@momo5502

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: 3482403
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions