diff options
author | Xi Ruoyao <xry111@xry111.site> | 2024-02-02 21:00:58 +0800 |
---|---|---|
committer | liuzhensong <liuzhensong@loongson.cn> | 2024-02-04 11:23:49 +0800 |
commit | 029e52bac7f3a6dd8b39f7f3d298b73174da806b (patch) | |
tree | a094b4ff73593732976a9ab32d2f1f70f1daab0e /gdb | |
parent | 9fdd490b6bff83e6a436e670517fa633d302ad57 (diff) | |
download | gdb-029e52bac7f3a6dd8b39f7f3d298b73174da806b.zip gdb-029e52bac7f3a6dd8b39f7f3d298b73174da806b.tar.gz gdb-029e52bac7f3a6dd8b39f7f3d298b73174da806b.tar.bz2 |
LoongArch: gas: Fix the types of symbols referred with %le_*_r in the symtab
When a symbol is referred with %le_{hi20,lo12,add}_r, it's definitely a
TLS symbol and we should set its type to TLS in the symtab. Otherwise
when building Perl with gcc-14 -flto, we get:
/usr/bin/ld: PL_current_context: TLS definition in
./miniperl.ltrans0.ltrans.o section .tbss mismatches non-TLS reference
in ./miniperl.ltrans1.ltrans.o
A minimal reproducer:
$ cat t1.s
.section .tbss
.globl x
x: .word 0
$ cat t2.s
f:
lu12i.w $a0, %le_hi20_r(x)
add.d $a0, $a0, $tp, %le_add_r(x)
li.w $a1, 1
st.w $a1, $a0, %le_lo12_r(x)
$ gas/as-new t1.s -o t1.o
$ gas/as-new t2.s -o t2.o
$ ld/ld-new t1.o t2.o
ld/ld-new: x: TLS definition in t1.o section .tbss mismatches
non-TLS reference in t2.o
Unfortunately this was undetected before Binutils-2.42 release because
GCC < 14 does not use %le_*_r, and without LTO it's very rare to have a
TLS LE definition and its reference in two different translation units.
So this fix should be backported to Binutils-2.42 branch too.
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Diffstat (limited to 'gdb')
0 files changed, 0 insertions, 0 deletions