<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/133044>133044</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [lld-link] error : duplicate symbol
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          co-neco
      </td>
    </tr>
</table>

<pre>
    Hi, I want to build mariadb using CLANGCL toolset on windows.

How to reproduce the issue:
There are two source files as below:
hello.cpp
``` cpp
#include <iostream>

extern void ttt();

int main() {
    std::cout << "Hello, World!" << std::endl;
 ttt();
    return 0;
}
```

ttt.cpp
``` cpp
#include <iostream>

void ttt() {
    std::cout << "hello world\n";
}
```

The main.cpp use an extern function ttt defined in ttt.cpp, I have following build steps:
1. use cl compiler to build ttt.obj, hello.obj
2. use lib to build ttt.lib
3. use link to link ttt.lib and hello.obj to hello.exe:
`link /OUT:"hello.exe" ttt.lib /machine:ARM64 hello.obj ttt.obj`
the above process was successful. 
But if I use lld-link to run the linker command:
`lld-link /OUT:"hello.exe" ttt.lib /machine:ARM64 hello.obj ttt.obj`
It complained that 
```
lld-link: error: duplicate symbol: void __cdecl ttt(void)
>>> defined at ttt.obj
>>> defined at ttt.lib(ttt.obj)
```
And if I run:
``lld-link /OUT:"hello.exe" ttt.lib /machine:ARM64 hello.obj`
It completed without error.

After some examination, I found the output of 'dumpbin /symbols ttt.obj' command showed that ttt function is external, and its' code is in ttt.lib.
I think the implementation in ttt.lib and extern declaration in ttt.obj can both exist in the linker command, like the way Windows link.exe does, is it right?
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVd9v4zYM_muUF6KBI8dJ85AHN13WArcNGDrc40GW6Fh3shToR93-9wMlJ712w2EYDggQS6Sojx8_iiIEfbKIe9bcseZ-IVIcnN9Ld2NRukXn1Ov-QTN-gEeYhI0QHXRJG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