<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/108482>108482</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[lld] empy sections use PROGBITS without any payload
</td>
</tr>
<tr>
<th>Labels</th>
<td>
lld
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
quic-seaswara
</td>
</tr>
</table>
<pre>
Empty sections are assigned PROGBITS type with LLD.
BFD linker uses NOBITS for empty sections without any payload.
```
cat > script.t << \!
SECTIONS {
.empty : {
. = . + 100;
}
}
!
cat > 1.c << \!
int foo() { return 0; }
!
/usr/bin/clang -c 1.c -fno-asynchronous-unwind-tables
ld.lld 1.o -T script.t && readelf -S -W a.out | grep empty
/usr/bin/ld.bfd 1.o -T script.t && readelf -S -W a.out | grep empty
```
Output from readelf :-
```
+ readelf -S -W a.out
+ grep empty
[ 1] .empty PROGBITS 0000000000000000 001000 000064 00 A 0 0 1
+ /usr/bin/ld.bfd 1.o -T script.t
+ readelf -S -W a.out
+ grep empty
[ 2] .empty NOBITS 0000000000000008 200008 000064 00 WA 0 0 1
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVF1v6jgQ_TWTl1Eix4YkPOQBSFlVqspqqdRnJ3bAuybO-qMV__4qBAqt0qsr1UIeYs-cczxjD3dO7TspS5ivYF5FPPiDseX_QTWxk9y9c8uj2ohT-XDs_QmdbLwynUNuJV6CBf79z_av1ePLDv2pl_iu_AGfnqoESAVkOc6rTYVadf9Ji8FJh8_bc0BrLMrPyEO4CR55d8Ken7Th4hMSZOTyO3823COwB3SNVb1PPCKwNbA1wnwNNB2ddg_rl8ft8w4hX40riMnIC2x5v4qYILBqmOkKU0KAXfcgry4KPv5c8T9LSZNmSoTqPLbGAC2ALgZOtNIH2-HAgd-BAt0EZ4FuatUB3TSad3uMmzNJ3HYm5u7UNQdrOhNcHLp31YnY81pLNwJokWgtME0Mxi-3NAHNgGZoJRdStxjvMH5FngyZh3yNeyv7sTKTMrRI6vbnoFMFHedt8H3w2Fpz_IADtox_F0hXU8y3za_0iDBfYQrz6noZ7sbHnb4M8mUgIeloCMlmSAgiLhEJEsT0xvlHefuRfjqt__LA8Bv9BdLR3Ol_PevH-xNM5TkSJRMLtuCRLNOcZumiyIosOpRpLhZ13UoheC3auklJnc_aXJIsIyyTJFIlJXRGFikjjBUkS0jbZHlT06KtiUzZDGZEHrnSidZvx8TYfaScC7JMSTEraKR5LbU79ypKtRZAh8NHthzc4zrsHcyIVs67G4BXXp_b2-A_r4b83TWb4OSt0hOdJwpWlwfvewdseANAN3vlD6FOGnMc6qnfriburflXNh7o5izaAd1cdL-V9FcAAAD__1gzf8o">