Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F143106703
D50225.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D50225.diff
View Options
diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c
--- a/lib/libc/gen/tls.c
+++ b/lib/libc/gen/tls.c
@@ -200,10 +200,10 @@
void
__libc_free_tls(void *tcb, size_t tcbsize, size_t tcbalign __unused)
{
- Elf_Addr *dtv;
- Elf_Addr **tls;
+ uintptr_t *dtv;
+ uintptr_t **tls;
- tls = (Elf_Addr **)tcb;
+ tls = (uintptr_t **)tcb;
dtv = tls[0];
__je_bootstrap_free(dtv);
libc_free_aligned(get_tls_block_ptr(tcb, tcbsize));
@@ -232,7 +232,7 @@
void *
__libc_allocate_tls(void *oldtcb, size_t tcbsize, size_t tcbalign)
{
- Elf_Addr *dtv, **tcb;
+ uintptr_t *dtv, **tcb;
char *tls_block, *tls;
size_t extra_size, maxalign, post_size, pre_size, tls_block_size;
@@ -261,7 +261,7 @@
abort();
}
memset(tls_block, 0, tls_block_size);
- tcb = (Elf_Addr **)(tls_block + pre_size + extra_size);
+ tcb = (uintptr_t **)(tls_block + pre_size + extra_size);
tls = (char *)tcb + TLS_TCB_SIZE + post_size;
if (oldtcb != NULL) {
@@ -271,9 +271,9 @@
/* Adjust the DTV. */
dtv = tcb[0];
- dtv[2] = (Elf_Addr)tls;
+ dtv[2] = (uintptr_t)tls;
} else {
- dtv = __je_bootstrap_malloc(3 * sizeof(Elf_Addr));
+ dtv = __je_bootstrap_malloc(3 * sizeof(uintptr_t));
if (dtv == NULL) {
tls_msg("__libc_allocate_tls: Out of memory.\n");
abort();
@@ -282,7 +282,7 @@
tcb[0] = dtv;
dtv[0] = 1; /* Generation. */
dtv[1] = 1; /* Segments count. */
- dtv[2] = (Elf_Addr)tls;
+ dtv[2] = (uintptr_t)tls;
if (libc_tls_init_size > 0)
memcpy(tls, libc_tls_init, libc_tls_init_size);
@@ -302,8 +302,8 @@
__libc_free_tls(void *tcb, size_t tcbsize __unused, size_t tcbalign)
{
size_t size;
- Elf_Addr* dtv;
- Elf_Addr tlsstart, tlsend;
+ uintptr_t *dtv;
+ uintptr_t tlsstart, tlsend;
/*
* Figure out the size of the initial TLS block so that we can
@@ -312,8 +312,8 @@
tcbalign = MAX(tcbalign, libc_tls_init_align);
size = roundup2(libc_tls_static_space, tcbalign);
- dtv = ((Elf_Addr**)tcb)[1];
- tlsend = (Elf_Addr) tcb;
+ dtv = ((uintptr_t **)tcb)[1];
+ tlsend = (uintptr_t)tcb;
tlsstart = tlsend - size;
libc_free_aligned((void*)tlsstart);
__je_bootstrap_free(dtv);
@@ -327,29 +327,29 @@
{
size_t size;
char *tls;
- Elf_Addr *dtv;
- Elf_Addr segbase, oldsegbase;
+ uintptr_t *dtv;
+ uintptr_t segbase, oldsegbase;
tcbalign = MAX(tcbalign, libc_tls_init_align);
size = roundup2(libc_tls_static_space, tcbalign);
- if (tcbsize < 2 * sizeof(Elf_Addr))
- tcbsize = 2 * sizeof(Elf_Addr);
+ if (tcbsize < 2 * sizeof(uintptr_t))
+ tcbsize = 2 * sizeof(uintptr_t);
tls = libc_malloc_aligned(size + tcbsize, tcbalign);
if (tls == NULL) {
tls_msg("__libc_allocate_tls: Out of memory.\n");
abort();
}
memset(tls, 0, size + tcbsize);
- dtv = __je_bootstrap_malloc(3 * sizeof(Elf_Addr));
+ dtv = __je_bootstrap_malloc(3 * sizeof(uintptr_t));
if (dtv == NULL) {
tls_msg("__libc_allocate_tls: Out of memory.\n");
abort();
}
- segbase = (Elf_Addr)(tls + size);
- ((Elf_Addr*)segbase)[0] = segbase;
- ((Elf_Addr*)segbase)[1] = (Elf_Addr) dtv;
+ segbase = (uintptr_t)(tls + size);
+ ((uintptr_t *)segbase)[0] = segbase;
+ ((uintptr_t *)segbase)[1] = (uintptr_t)dtv;
dtv[0] = 1;
dtv[1] = 1;
@@ -359,7 +359,7 @@
/*
* Copy the static TLS block over whole.
*/
- oldsegbase = (Elf_Addr) oldtls;
+ oldsegbase = (uintptr_t)oldtls;
memcpy((void *)(segbase - libc_tls_static_space),
(const void *)(oldsegbase - libc_tls_static_space),
libc_tls_static_space);
@@ -368,7 +368,8 @@
* We assume that this block was the one we created with
* allocate_initial_tls().
*/
- _rtld_free_tls(oldtls, 2*sizeof(Elf_Addr), sizeof(Elf_Addr));
+ _rtld_free_tls(oldtls, 2 * sizeof(uintptr_t),
+ sizeof(uintptr_t));
} else {
memcpy((void *)(segbase - libc_tls_static_space),
libc_tls_init, libc_tls_init_size);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 27, 1:34 AM (14 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28047954
Default Alt Text
D50225.diff (3 KB)
Attached To
Mode
D50225: libc: Consistently use uintptr_t for TLS implementation
Attached
Detach File
Event Timeline
Log In to Comment