mirror of
git://sourceware.org/git/glibc.git
synced 2024-12-09 04:11:27 +08:00
67aae64512
Commit 389d1f1b23
(“Partial ILP32
support for aarch64”) broke dynamic TLS support because a load
offset changed:
0000000000000030 <_dl_tlsdesc_dynamic>:
30: a9bc7bfd stp x29, x30, [sp,#-64]!
34: 910003fd mov x29, sp
38: a9020be1 stp x1, x2, [sp,#32]
3c: a90313e3 stp x3, x4, [sp,#48]
40: d53bd044 mrs x4, tpidr_el0
44: c8dffc1f ldar xzr, [x0]
48: f9400401 ldr x1, [x0,#8]
4c: f9400080 ldr x0, [x4]
50: f9400823 ldr x3, [x1,#16]
54: f9400002 ldr x2, [x0]
58: eb02007f cmp x3, x2
5c: 540001a8 b.hi 90 <_dl_tlsdesc_dynamic+0x60>
60: f9400022 ldr x2, [x1]
64: 8b021000 add x0, x0, x2, lsl #4
68: f9400000 ldr x0, [x0]
6c: b100041f cmn x0, #0x1
70: 54000100 b.eq 90 <_dl_tlsdesc_dynamic+0x60>
- 74: f9400421 ldr x1, [x1,#8]
+ 74: f9400821 ldr x1, [x1,#16]
78: 8b010000 add x0, x0, x1
…
This commit introduces explicit struct offsets, generated
from the C headers, fixing the regression.
19 lines
548 B
Plaintext
19 lines
548 B
Plaintext
#include <stddef.h>
|
|
#include <sysdep.h>
|
|
#include <tls.h>
|
|
#include <link.h>
|
|
#include <dl-tlsdesc.h>
|
|
|
|
--
|
|
|
|
-- Abuse tls.h macros to derive offsets relative to the thread register.
|
|
|
|
TLSDESC_ARG offsetof(struct tlsdesc, arg)
|
|
|
|
TLSDESC_GEN_COUNT offsetof(struct tlsdesc_dynamic_arg, gen_count)
|
|
TLSDESC_MODID offsetof(struct tlsdesc_dynamic_arg, tlsinfo.ti_module)
|
|
TLSDESC_MODOFF offsetof(struct tlsdesc_dynamic_arg, tlsinfo.ti_offset)
|
|
TCBHEAD_DTV offsetof(tcbhead_t, dtv)
|
|
DTV_COUNTER offsetof(dtv_t, counter)
|
|
TLS_DTV_UNALLOCATED TLS_DTV_UNALLOCATED
|