<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/93947>93947</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[LLD] Invalid 'there is a cycle in linker script INCLUDEs' error
</td>
</tr>
<tr>
<th>Labels</th>
<td>
lld
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
partaror
</td>
</tr>
</table>
<pre>
LLD incorrectly reports 'there is a cycle in linker script INCLUDEs' error when a linker script is included multiple times (but there is no cycle). Reproducible example:
```bash
#!/usr/bin/env bash
cat > incrementDotBy100.t \EOF
. = . + 100;
EOF
cat >1.t <<\EOF
SECTIONS {
FOO : {
*(*foo*)
INCLUDE incrementDotBy100.t
}
BAR : {
*(*bar*)
INCLUDE incrementDotBy100.t
}
}
EOF
touch 1.c
clang-15 -o 1.o 1.c -c
ld.lld -o 1.elf 1.o -T 1.t
```
Output:
```
ld.lld: error: 1.t:8: there is a cycle in linker script INCLUDEs
>>> INCLUDE incrementDotBy100.t
>>>
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVN2OozoMfppwYxWRpJRywUVbijRSNZVm5jxACG7JOSlBSejZvv0q0L8ZrVb7I4VgxV--z3YsC-fUsUMsSLomaRmJwbfGFr2wXlhjo9o0l2K3K0F10liL0usLWOyN9Q4Iy3yLFkE5ECAvUiOoDrTq_kMLTlrVe3h53ez-KbeOsAzQWmPh_xY7EF9gygUJPTTYwGnQXvUawasTBpllPXi4S3Vm0iIsj-ENe2uaQapaI-A3ceo1Er4iSUmS275IplUL116PGCeMElYNzhJW1aojrMLuDE-QcZfCA-HbEJvFE3a-NH59oUkSeyDpZruvJhxADISXYWdroElC-Hry3CGfCGm4zzdhPbG8bzcfL_vXdyDZ-sZb7fdA-Or5CICwFWFLwlYHY0Y7f_iuBf9RyDcQycqbuV69_YS-FvZv6O_GlyJ4M8gWaCyvNdGiO85oCjMDNA6fhNnVp5tY62byoD6M_tkH0Jva_XGf-feD7wf_aIPPmIkyJD32YzACHV8tg_kbHT2R8-204Jeq84B_iS1qCt7kPBcRFjSjGU1pmuZRWyyztMGG1YdmkS3FIl-gkGwhDov5YT6nDCNVsITNk5RTmnDG81hmMjtk6SITHNNlmpJ5giehdKz1-RQbe4yUcwMWOc_nWaRFjdqNA4CxUBjGwiSwRUDP6uHoyDzRynn3uO-V1-PM2O1Kkpbw0p2FVs0fToRosLpove9deDJWEVYdlW-HOpbmRFgVZK-_WW_Nvyg9YdWYgyOsmtI4F-x7AAAA__8pGV2E">