Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F157001150
D50229.id155026.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D50229.id155026.diff
View Options
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -5368,7 +5368,8 @@
{
Obj_Entry *obj;
char *tls_block;
- uintptr_t *dtv, **tcb;
+ uintptr_t *dtv;
+ struct tcb *tcb;
char *addr;
uintptr_t i;
size_t extra_size, maxalign, post_size, pre_size, tls_block_size;
@@ -5391,7 +5392,7 @@
/* Allocate whole TLS block */
tls_block = xmalloc_aligned(tls_block_size, maxalign, 0);
- tcb = (uintptr_t **)(tls_block + pre_size + extra_size);
+ tcb = (struct tcb *)(tls_block + pre_size + extra_size);
if (oldtcb != NULL) {
memcpy(tls_block, get_tls_block_ptr(oldtcb, tcbsize),
@@ -5399,7 +5400,7 @@
free(get_tls_block_ptr(oldtcb, tcbsize));
/* Adjust the DTV. */
- dtv = tcb[0];
+ dtv = tcb->tcb_dtv;
for (i = 0; i < dtv[1]; i++) {
if (dtv[i + 2] >= (uintptr_t)oldtcb &&
dtv[i + 2] < (uintptr_t)oldtcb + tls_static_space) {
@@ -5409,7 +5410,7 @@
}
} else {
dtv = xcalloc(tls_max_index + 2, sizeof(uintptr_t));
- tcb[0] = dtv;
+ tcb->tcb_dtv = dtv;
dtv[0] = tls_dtv_generation;
dtv[1] = tls_max_index;
@@ -5456,7 +5457,7 @@
tlsstart = (uintptr_t)tcb + TLS_TCB_SIZE + post_size;
tlsend = (uintptr_t)tcb + tls_static_space;
- dtv = *(uintptr_t **)tcb;
+ dtv = ((struct tcb *)tcb)->tcb_dtv;
dtvsize = dtv[1];
for (i = 0; i < dtvsize; i++) {
if (dtv[i + 2] != 0 && (dtv[i + 2] < tlsstart ||
@@ -5482,7 +5483,7 @@
size_t size, ralign;
char *tls_block;
uintptr_t *dtv, *olddtv;
- uintptr_t **tcb;
+ struct tcb *tcb;
char *addr;
size_t i;
@@ -5495,9 +5496,9 @@
tls_block = xmalloc_aligned(size, ralign, 0 /* XXX */);
dtv = xcalloc(tls_max_index + 2, sizeof(uintptr_t));
- tcb = (uintptr_t **)(tls_block + roundup(tls_static_space, ralign));
- tcb[0] = (uintptr_t *)tcb;
- tcb[1] = dtv;
+ tcb = (struct tcb *)(tls_block + roundup(tls_static_space, ralign));
+ tcb->tcb_self = tcb;
+ tcb->tcb_dtv = dtv;
dtv[0] = tls_dtv_generation;
dtv[1] = tls_max_index;
@@ -5514,7 +5515,7 @@
* If any dynamic TLS blocks have been created tls_get_addr(),
* move them over.
*/
- olddtv = ((uintptr_t **)oldtcb)[1];
+ olddtv = ((struct tcb *)oldtcb)->tcb_dtv;
for (i = 0; i < olddtv[1]; i++) {
if (olddtv[i + 2] < (uintptr_t)oldtcb - size ||
olddtv[i + 2] > (uintptr_t)oldtcb) {
@@ -5563,7 +5564,7 @@
ralign = tls_static_max_align;
size = roundup(tls_static_space, ralign);
- dtv = ((uintptr_t **)tcb)[1];
+ dtv = ((struct tcb *)tcb)->tcb_dtv;
dtvsize = dtv[1];
tlsend = (uintptr_t)tcb;
tlsstart = tlsend - size;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, May 18, 9:33 PM (5 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33270091
Default Alt Text
D50229.id155026.diff (2 KB)
Attached To
Mode
D50229: rtld-elf: Use struct tcb * rather than uintptr_t ** for the tcb
Attached
Detach File
Event Timeline
Log In to Comment