<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/118148>118148</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
LD does not allow zero-length symbols at end of section
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
lorc
</td>
</tr>
</table>
<pre>
Found in the wild when tried to link Xen with LLVM LD. Here is script for reproduction:
```
#!/usr/bin/env bash
cat >1.c <<EOF
void test(void)
{
asm ( ".pushsection .rodata.str, \"aMS\", %progbits, 1\n"
"1: .asciz \"test\" \n"
"2:\n"
".popsection\n"
".pushsection .bug_frames, \"a\", %progbits\n"
"3:\n"
".p2align 2\n"
".long (1b - 3b)\n"
".long (2b - 3b)\n"
".popsection");
}
EOF
clang -target arm64 -c 1.c -o 1.o
ld.lld -r 1.o -o 2.o
```
`ld.lld` fails with the message:
```
ld.lld: error: 1.o:(.rodata.str): offset is outside the section
```
While GNU ld handles the file as expected.
`ld.lld` version is `LLD 18.1.8 (compatible with GNU linkers)`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVE2P4zYM_TXyhYhhUXYSH3zIJOv2kG0PRT9uhWzRtrqKZEhy0t1fX8jJoDNopmsIMCU-ko_is2UIerREDateWHXK5BIn5xvjfJ91Tn1tWrdYBdpCnAhu2ii4TWQhek0KogOj7Rf4gyzcdJzgfP7tM5xPOfxInkAHCL3Xc4TBefA0e6eWPmpnmTiwYl3b4rGKA0PBkDNsl-AZtp22DFuyV-hkmO7wXkZg4hPPe2DiyMTx088tKw5XpxVECpHhPtkM64TfvbDiIMMFGO6BIebzEqZAKwPIvVMyyjxEz_AIrDoyRPn5l7uxHmE1ezd2Ooa05aw62uQqDvD6METOxAFyGXr97ZFkJbJa8CaEIWJq-2mSfHbzg9hHgLfUu2X8c_DyQuEN9efEn2YT74ms-VEaPVrAD-obZ8d0j7yDDYgu3fD_A_F7wDctJ9o1Ey_r0E73Ud8nm2ZupB1hE6UfKYL0l20Jmx6SBjYOeO7uMKNyYxRsfDpKHnz1vNPYur1j2baAQWoT7tpNAr9QCHKkp_J8BIkDkPfOJyMVFweG-3diqpPLDUOgmD4Bt8SgFa35Xxv-D6nfJ20IfvjpVzAKJmmVobBGDOlcBqC_Z-ojqfxJE1fyIelCB2Db4nw-Ad_nPE-a3_fuMsuoO0P3LtcS2n4hHxLTtX6mGqFqUcuMGr4TWGNdc5FNza4qS94Xqq5U1-27cuCdqHlZd4ojql2d6QYLLDkXRcGx4iLfD4UYdmpbVkrVRcVZWdBFapMbc73kzo-ZDmGhhvM9L_eZkR2ZsP58EC3dYPUmPVSnzDcpaNMtY2BlYXSI4d80UUdDzfkEylEA6yJIY9wNvpF3G0N2jBOEr5fOmQAyAlkFbni9_2zxpplinMM6vpZhO-o4LV3euwvDNlV5vDazd39RHxm2K7fAsH2Qvzb4TwAAAP__nZh_3Q">