[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/29820] New: ld x86: -r should not define _TLS_MODULE_BASE_
From: |
i at maskray dot me |
Subject: |
[Bug ld/29820] New: ld x86: -r should not define _TLS_MODULE_BASE_ |
Date: |
Tue, 22 Nov 2022 20:58:15 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=29820
Bug ID: 29820
Summary: ld x86: -r should not define _TLS_MODULE_BASE_
Product: binutils
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: i at maskray dot me
Target Milestone: ---
cat > a.s <<eof
leaq _TLS_MODULE_BASE_@tlsdesc(%rip), %rax
call *_TLS_MODULE_BASE_@tlscall(%rax)
movl %fs:a@dtpoff(%rax), %edx
addl %fs:b@dtpoff(%rax), %edx
.section .tbss
.zero 8
a:
.zero 4
b:
.zero 4
eof
cc -c a.s
ld.bfd -r a.o a.o -o a.ro
ld.bfd a.ro
The -r link should not define _TLS_MODULE_BASE_.
% readelf -Ws a.ro
12: 0000000000000000 0 TLS LOCAL DEFAULT 3 _TLS_MODULE_BASE_
Since ld currently does define _TLS_MODULE_BASE_, the final output has two
local
_TLS_MODULE_BASE_ and the relaxation result is incorrect.
% objdump -d a.out
...
0000000000401000 <.text>:
401000: 48 c7 c0 e0 ff ff ff movq $-0x20, %rax #####
should be $0x0
401007: 66 90 nop
401009: 64 8b 90 e8 ff ff ff movl %fs:-0x18(%rax), %edx
401010: 64 03 90 ec ff ff ff addl %fs:-0x14(%rax), %edx
401017: 48 c7 c0 e0 ff ff ff movq $-0x20, %rax #####
should be $0x0
40101e: 66 90 nop
401020: 64 8b 90 f8 ff ff ff movl %fs:-0x8(%rax), %edx
401027: 64 03 90 fc ff ff ff addl %fs:-0x4(%rax), %edx
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/29820] New: ld x86: -r should not define _TLS_MODULE_BASE_,
i at maskray dot me <=