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

    <tr>
        <th>Summary</th>
        <td>
            lld produces elf with corrupt string table index
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            lld
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          stsp
      </td>
    </tr>
</table>

<pre>
    [lld-tst.tar.gz](https://github.com/user-attachments/files/21052616/lld-tst.tar.gz)
This is a fully automated test-case.
Just  run:
```
$ ./test.sh
ld.lld -melf_i386 -static -o a.elf --defsym=loadaddr=0x900 -Tkernel.ld kernel.o entry.o io.o console.o serial.o printer.o execrh.o nlssupt.o procsupt.o dosidle.o int2f.o nls_hc.o intr.o irqstack.o cpu.o plt.o cdata.o floppy.o rdpcclk.o wrpcclk.o wratclk.o
nm: warning: a.elf has a corrupt string table index
```

The "good" run can be achieved
with: `LD=ld ./test.sh`.
In this case it uses GNU ld, and
`nm` just prints a symbol table.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8U02v5CYQ_DX40jLC-Gt88MHJaKJEUU6b8wpD22YXgwPt997k10fMjLTKHp40EiWo7q6pcquU7OoRR9b-wtproU7aQhwTpaOYg7nne-dMSYk4qcjXf1l7ZfKyER2J1ROTNyZvq6XtnLkOO5O3M2EsFZHS246eEpO3xTrMp6xEK7uqY_L2U1M5MDF92WwCm0DBcjp3B3VS2BWhAcJEpVYJORPTH2cigHj6PF9MrBOvn5iYbIAzect8njYmJme4cwbKHd3y1daXDspEiqyGMoDi6BYoS4NLuu-svrqgjDImsvoqPgYhoPzyHaNHx52BFwqAnuKdB7CBB9DBp-CQB0gYrcrvR7SeMGbmB-q48QDepXQe9HgM-gVNSNY8Sq0nuTxpXzf9vMj1Nv6TSOnvec5x5mqXC7VRpHiAxYXjyEqiObR2mfYefyBFD8TE5HdWT_Cuord-zfD5zzeVzdYhxvMgSBStX4HU7BCsN_jxs7s5IgQm5RqCYVLmEEArDzOC0pvFNzRMTO-WtjyEdeLPa3bV_C-UTuQUf_dAOe-cKliCM2GC3_76G5xh8ldQ3jyn-511Ar7lzB--ZsXpvs_BPZXywoy1GepBFThWfVt1VXO5NMU21vPQ1qZfNMqhW6q56VsjZtUMeq6kkENhRylkK3rRiL6pZMOHRfV9g62qxNCpXrBG4K6s48697TzEtbApnThWTS-qunBqRpceqyOly7pl3qE4Zno5n2tijXA2UfrRgCw5HPMnecRgTo0JchLZsk-CKM7oxk92Lrd_HeURwzfUxOTtITbv3Uvv2yj_CwAA___DWkbY">