[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/28387] New: ld: Move R_*_TLSDESC to .rela.dyn
From: |
i at maskray dot me |
Subject: |
[Bug binutils/28387] New: ld: Move R_*_TLSDESC to .rela.dyn |
Date: |
Sat, 25 Sep 2021 20:26:35 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=28387
Bug ID: 28387
Summary: ld: Move R_*_TLSDESC to .rela.dyn
Product: binutils
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: binutils
Assignee: unassigned at sourceware dot org
Reporter: i at maskray dot me
Target Milestone: ---
Lazy R_*_TLSDESC resolving has several problems (e.g. data race) and glibc has
eagerly resolved R_*_TLSDESC for all(?) supported ports: arm (PR18572)/aarch64
(PR18034)/x86 (PR27137).
It is also odd to overload .rela.plt (PLT) with TLSDESC which have quite
different semantics.
Currently GNU ld still uses .rela.plt, but it probably makes sense to switch to
.rela.dyn instead.
% cat x.c
extern __thread int tlsdesc;
int get(void) { return tlsdesc; }
% gcc -fpic -mtls-dialect=gnu2 -shared x.c && readelf -r a.out
...
Relocation section '.rela.plt' at offset 0x440 contains 1 entry:
Offset Info Type Sym. Value Sym. Name +
Addend
000000004018 000200000024 R_X86_64_TLSDESC 0000000000000000 tlsdesc + 0
% aarch64-linux-gnu-gcc -fpic -shared x.c && readelf -r a.out
...
Relocation section '.rela.plt' at offset 0x400 contains 3 entries:
Offset Info Type Sym. Value Sym. Name +
Addend
000000011000 000300000402 R_AARCH64_JUMP_SL 0000000000000000 __cxa_finalize +
0
000000011008 000700000402 R_AARCH64_JUMP_SL 0000000000000000 __gmon_start__ +
0
000000011010 000400000407 R_AARCH64_TLSDESC 0000000000000000 tlsdesc + 0
% arm-linux-gnueabi-gcc -fpic -mtls-dialect=gnu2 -fuse-ld=bfd -shared x.c &&
readelf -r a.out
...
Relocation section '.rel.plt' at offset 0x264 contains 3 entries:
Offset Info Type Sym.Value Sym. Name
0001100c 00000316 R_ARM_JUMP_SLOT 00000000 __cxa_finalize
00011010 00000716 R_ARM_JUMP_SLOT 00000000 __gmon_start__
00011014 0000040d R_ARM_TLS_DESC 00000000 tlsdesc
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug binutils/28387] New: ld: Move R_*_TLSDESC to .rela.dyn,
i at maskray dot me <=