<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/111478>111478</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[LLD] symbol not found with PROVIDE script
</td>
</tr>
<tr>
<th>Labels</th>
<td>
lld,
regression:19
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
DianQK
</td>
</tr>
</table>
<pre>
I tried the following code. I expect lld to link successful while also removing unused symbols, but it reports `symbol not found: bar`.
a.s:
```asm
.global _start
_start:
nop
.section .text.foo,"ax",@progbits
.global foo
foo:
nop
.section .text.bar,"ax",@progbits
.global bar
bar:
nop
```
script.t:
```
PROVIDE(foo = bar);
```
commands:
```bash
llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o
ld.lld -o a_gc a.o --gc-sections -T script.t
```
output:
```
ld.lld: error: script.t:1: symbol not found: bar
ld.lld: error: script.t:1: symbol not found: bar
ld.lld: error: script.t:1: symbol not found: bar
```
cc @MaskRay ebb326a51fec37b5a47e5702e8ea157cd4f835cd
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVE1vrTYU_DVmcwQyNp8LFu89eqWor2obVd1G_gKcGIxsk9z77ysDTVMlabushOB4OGfMDCMz7_W4KNWh8isq-4RtYbKu6zVbfv0x4VbeujsITisJYVIwWGPsi15GEFaqDO5AXVclAhgjIVgwenkCvwmhvB82Ay-TNgqY8Racmu1znNyWzSsJ_jZzazwi34BvAXQAp1brggdU4eMlLDbAYLdFIvoFOHOowhnCPcJfjjvLPKJnjSp8XMzPB5KNxnJm4MEH5sKBnfWfQ7DY9Wz2SgRtF8iCuoZssBaRb4gQdkWExLLAq7Mj18H_nT127kAs_pU3ivhvvLFzB2LxnvdV7ls_vHB6DVl4b8qx_OX-59_v-h8QaQZrAdF-34W0iH79B1Zh55kt8gOrOfPTARnzPKezgHTQRoXbqhDtLX-ENDi9mri6NtVDVQDLPKQWWHa6ZmQWsxOhh1FEHNJ0FOlpm4f0N3iV9fk32i2s26e6j01iiJRzNtoJb6zK9_UniftfzH_8WwSgAv_E_NM9u4HinJKKlfmgBK15yYpalTUmqlEsL2shi6GhpZCJ7KhsacsS1eU1aWiVt5QkU1cpXjSECzZIXAtJedNWreADrrHksh4S3RFMihzjBheU5CRjFRa5bHmFJaG0qFGB1cy0yWIYMuvGRHu_qS7P86JuEsO4Mn4_aAiJdhz5J8Sp0SnvtV2iGW3Eyz5x3Z4pvo0eFdhoH_xfxEEHs59Z37_3qOzfuQcvOkxwxv30Otmc6aYQ1j3I5ILIZdRh2ngm7IzIJZKfj3R19lGJgMhll-ARuZwqnjvyRwAAAP__QvaLyg">