<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/77265>77265</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[lld][ELF] lld reports error when linker script contains symbol :
</td>
</tr>
<tr>
<th>Labels</th>
<td>
lld
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Yunzezhu94
</td>
</tr>
</table>
<pre>
When I try to run binutils ld test with lld to figure out difference between gnu ld and lld, I found lld reports error:
```
error: overlay-size.t:27: malformed number: :
>>> OVERLAY :
>>> ^
```
where the linker script is
```
MEMORY
{
TEXTMEM (ARX) : ORIGIN = 0x10000, LENGTH = 32K
DATAMEM (AW) : ORIGIN = 0x20000, LENGTH = 32K
LOADMEM (AW) : ORIGIN = 0x30000, LENGTH = 32K
}
/* Map should be:
SIZE VMA LMA
.bss1 10 20000 20000
.bss2 30 20000 20010
.bss3 20 20000 20040
.mbss 230 20030 20060
.mtext 20 10000 30000
.text1 80 10020 30020
.text2 40 10020 300a0
.text3 20 10020 300e0
.data1 30 20260 30100
.data2 40 20260 30130
.data3 50 20260 30170 */
SECTIONS
{
OVERLAY :
{
.bss1 { *(.bss1) }
.bss2 { *(.bss2) }
.bss3 { *(.bss3) }
} > DATAMEM
end_of_bss_overlays = . ;
.mtext : { *(.mtext) } > TEXTMEM AT > LOADMEM
.mbss : AT (__load_stop_bss3)
{
*(.mbss)
. += 0x200;
} > DATAMEM
OVERLAY :
{
.text1 { *(.text1) }
.text2 { *(.text2) }
.text3 { *(.text3) }
} > TEXTMEM AT > LOADMEM
end_of_text_overlays = . ;
OVERLAY :
{
.data1 { *(.data1) }
.data2 { *(.data2) }
.data3 { *(.data3) }
} > DATAMEM AT > LOADMEM
end_of_data_overlays = . ;
. = 0x8000;
/DISCARD/ : { *(.reginfo) *(.MIPS.abiflags) }
}
```
and the source file is
```
.section .bss1, "aw", "nobits"
.space 0x10
.section .bss2, "aw", "nobits"
.space 0x30
.section .bss3, "aw", "nobits"
.space 0x20
.section .text1, "ax", "progbits"
.space 0x80
.section .text2, "ax", "progbits"
.space 0x40
.section .text3, "ax", "progbits"
.space 0x20
.section .data1, "aw", "progbits"
.space 0x30
.section .data2, "aw", "progbits"
.space 0x40
.section .data3, "aw", "progbits"
.space 0x50
.section .mtext, "ax", "progbits"
.space 0x20
.section .mbss, "aw", "nobits"
.space 0x30
```
It looks lld treats symbol : as a tok, and this issue is similar with this : [https://discourse.llvm.org/t/memory-command-region-name-syntax/75145](https://discourse.llvm.org/t/memory-command-region-name-syntax/75145)
which lld treats string as Expr and split in function tokenizeExpr.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysV1tv4jgb_jXm5hXIcUgTLrigBeZDX5mu2moOe4OcxIC3iY1sZ3r49Ss7TkM4dMpoK9TEzpPnPT52TLXmG8HYGEXXKJr2aGW2Uo1_VuKNvW2r0bCXyvx1_H3LBCzAqFcwElQlIOWiMrzQUORgmDbwzM0WCjuSsOabSjGQlYGcr9dMMZExSJl5ZkzARlT2LSpyi0fkBhawllU9BMV2UhkNTCmpUDhBeIrwBF1h_3PD5iGA_MVUQV_7mr-xgUHhhMR2vqTFWqqS5SCqMmUO25KFs_oHAHffZve3k5_gAEdPmz8UzU768bxlioHZMii4eGIKdKb4zgDXJ-HL2fLu_qd_FF_XNwCPsx-Py9kSEEkm9z8QGTlv7u4XXxZfAYVTwC8BxhjbVN3Ovn55_J-bDcn_G4bp5HHSMHy3BMcM5EOG27vJ9DcE4UcEKJ76m_o_mSMygSXdgd7KqsghZW36vdPvfw-Lv12yvy3d7O2yhQxSrQMHCjCAi8FfPMQCiAOEHUCAOxyhg5AOZLgHKVOtgXgKf2mqtocy7MU0REFNFO45AzCwCOdwgi2C1AhygHAeD2sSD6EHkHDPDsEWwY78yamhQRs7uXJUwb4_FvJurYaEOAgPEM5Y1CGJMQAirpJ7Vh9mN4-Lu68PRz18rCOnmxYA79VE8XXNnLix6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