<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63919>63919</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
ld.lld fillexp does not work as expected
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
finchky
</td>
</tr>
</table>
<pre>
Per the [LLVM linker script policy](https://lld.llvm.org/ELF/linker_script.html), script features should match that of the `ld` manual.
It appears that the fillexp does not behave the same between GCC/ld and LLVM/lld.
Given the sample example `SECTIONS { .text : { *(.text) } ={INSERT_FILL} }`
Using GCC and an INSERT_FILL value of 0xFF, I get the following SREC output:
```
S3150100A200FFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFF5D
S3150100A210FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF47
S3150100A220FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF37
S3150100A230FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF27
```
But when using LLVM and an INSERT_FILL of 0xFF, I get:
```
S3150100A200FFF9FFFF000000FF000000FF000000FF54
S3150100A210FFFFFFFF000000FF000000FF000000FF3E
S3150100A220000000FF000000FF000000FF000000FF2B
S3150100A230000000FF000000FF000000FF000000FF1B
```
However, if I use LLVM with an INSERT_FILL of 0xFFFFFFFF, I get the desired output:
```
S3150100A200FFF9FFFFFFFFFFFFFFFFFFFFFFFFFFFF5D
S3150100A210FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF47
S3150100A220FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF37
S3150100A230FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF27
```
**Expected result**: a fillexp value of 0xFF should produce the same fill output between GCC and LLVM, per [ld 3.6.8.8](https://sourceware.org/binutils/docs/ld/Output-Section-Fill.html)
**Actual result:** a 0xFF fillexp value in LLVM/lld does not produce the same out as GCC/ld
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsVVuP4jgT_TXmpdSR45DbQx64ZT4kvpnVMLuvIxMXxNsmjnwB-t-vkkBPeqC7te9rIVspfOI6x5VT3Fp5aBALEs9JvJxw72ptir1sqvr5ZbLT4qX4Aw24GoHE883mr_-Dks0zGrCVka2DVitZvZB4SVhWO9daEs0IKwkrlRKBUqdjoM2BsHK16YM9-OcADmp3VITlhC1ur9sjd96gBVtrrwQcuatqcDV3oPdDGglVgiQUjrzxXAVA6JLQ2TCvHfC2RW7sgOkAe6kUXloQGi002sEOa37C_j_Ljwg7dGfEBr4sFl2GAngjoKN6JTE-4Is8YXODtgoBL8NKErpdLX6sv33dAknnEDi8OCDRrH8ibEZY1scIy4GkSyDRkqTz9dft6vuPn-V6s-mD6ZIkdHzgn1Y2hy61PivewAgBJ648dsLQS1l2Kq7hgFfWWil97rDb76sFaO9a77q7Gd6d0Ouvf9xGYUxDSmeM0rIs8_KDES_hd1BIPwJ0Y5regdinoOgeFH0KYulDhsM89w7ONTbge1X7cn4g6--C_hvZaD_u13j6gWzvgaLVA9ne23xb2fyBbJ-BwvkHsv1Pn_GEptND7mEN3uKg3Vm6-h3xhvG2JgVaaVD8V4zjuXOG2erSYuVQgEHrlRuCnXnwV_t6863f7LE1Wvhq5GXd7qu-Y18bWdoCWjSdmSsBUZAEWZA9cm-rvanwzA1e_XsnG--ksoSVQle2d0rCym_9WU9brJzUzVMplXq19RHBWeU8Vzd60TUKfGDzlqNsRu77y7bvuGrvgNtX256IIhJ5lPMJFmGS5Uk4jdN4UhdJXuWYRYyLhDHO8jSPpmGU8RinlO-zfCILRllE0zANU8biOEhpHFKahHteZSETOzKleORSvfazibTWY5FEeZhPFN-hsrcWaopu09POHyyZUiWts79gTjqFRd8YxX1jOmvz3DHCazVMvFHF22s5SFf7XVDpYy_P6bY8tUb_jZUjrOxT6-6nz-6fAAAA__84DTvD">