<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/107371>107371</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[lld][coff] spurious duplicate symbols with delayload on x86
</td>
</tr>
<tr>
<th>Labels</th>
<td>
lld
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
glandium
</td>
</tr>
</table>
<pre>
STR:
- Download https://drive.google.com/file/d/1AESRw2pf8lbMwfKl4S238UlOBqf1YHCR/view?usp=sharing
- Unpack the archive and enter the `repro` directory.
- Run `lld-link @response.txt`
Expected result: success
Actual result:
```
lld-link: error: duplicate symbol: __declspec(dllimport) __load_timeBeginPeriod
lld-link: error: duplicate symbol: __declspec(dllimport) __load_timeEndPeriod
lld-link: error: duplicate symbol: __declspec(dllimport) __load_CoInitializeEx
lld-link: error: duplicate symbol: __declspec(dllimport) __load_GetClientRect
```
Removing `-DELAYLOAD:ole32.dll`, `-DELAYLOAD:user32.dll`, and `-DELAYLOAD:winmm.dll` from the response file makes the issue go away.
What's peculiar in this link is that there are COFF import files in gkrust.lib that repeats symbols from other `.lib`s. Those come from rust's raw-dylib feature. It somehow makes the linker trip with the delayload, but only on x86, not x86_64 or aarch64.
Cc: @mstorsjo
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VF-P46YX_TTkBcXC2HGcBz9kkvj3W3WrqTK7qvYpwnBts4PB5U886aevsJPuTrePXSki-HI4cA_nXuac7DRAhTZPaHNcseB7Y6tOMS1kGFaNEbfq5dMZZXtEjojs1_hoJq0ME7j3fnRxgdaI1sLKKySdMZ2ChJsB0bqVCuIKonW6P72cJzq2pWp-ndpfVP5Cs_Kzen76o02__P9wRrS-SphQVgc3ouzoemal7h6HftYj46_Y94CZ5b28AmZaYNAe7BxFBbEwWoMKgoW0wL2xt-Sx_Rx0RCgl1krqV4xyYsGNRjtI_JtHBVmQy3h6G4F7ENiCC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