Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144563204
D50591.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
D50591.diff
View Options
diff --git a/libexec/rtld-elf/aarch64/reloc.c b/libexec/rtld-elf/aarch64/reloc.c
--- a/libexec/rtld-elf/aarch64/reloc.c
+++ b/libexec/rtld-elf/aarch64/reloc.c
@@ -629,8 +629,5 @@
void *
__tls_get_addr(tls_index* ti)
{
- struct dtv **dtvp;
-
- dtvp = &_tcb_get()->tcb_dtv;
- return (tls_get_addr_common(dtvp, ti->ti_module, ti->ti_offset));
+ return (tls_get_addr_common(_tcb_get(), ti->ti_module, ti->ti_offset));
}
diff --git a/libexec/rtld-elf/aarch64/rtld_start.S b/libexec/rtld-elf/aarch64/rtld_start.S
--- a/libexec/rtld-elf/aarch64/rtld_start.S
+++ b/libexec/rtld-elf/aarch64/rtld_start.S
@@ -189,7 +189,7 @@
/*
* Slow path
* return(
- * tls_get_addr_common(tp, tlsdesc->tls_index, tlsdesc->tls_offs));
+ * tls_get_addr_common(tcb, tlsdesc->tls_index, tlsdesc->tls_offs));
*
*/
1:
@@ -223,7 +223,7 @@
.cfi_rel_offset x18, 120
/* Find the tls offset */
- mov x0, x4 /* tp */
+ mov x0, x4 /* tcb */
mov x3, x1 /* tlsdesc ptr */
ldr w1, [x3, #8] /* tlsdec->tls_index */
ldr x2, [x3, #16] /* tlsdec->tls_offs */
diff --git a/libexec/rtld-elf/amd64/reloc.c b/libexec/rtld-elf/amd64/reloc.c
--- a/libexec/rtld-elf/amd64/reloc.c
+++ b/libexec/rtld-elf/amd64/reloc.c
@@ -558,10 +558,7 @@
void *
__tls_get_addr(tls_index *ti)
{
- struct dtv **dtvp;
-
- dtvp = &_tcb_get()->tcb_dtv;
- return (tls_get_addr_common(dtvp, ti->ti_module, ti->ti_offset));
+ return (tls_get_addr_common(_tcb_get(), ti->ti_module, ti->ti_offset));
}
size_t
diff --git a/libexec/rtld-elf/arm/reloc.c b/libexec/rtld-elf/arm/reloc.c
--- a/libexec/rtld-elf/arm/reloc.c
+++ b/libexec/rtld-elf/arm/reloc.c
@@ -465,8 +465,5 @@
void *
__tls_get_addr(tls_index* ti)
{
- struct dtv **dtvp;
-
- dtvp = &_tcb_get()->tcb_dtv;
- return (tls_get_addr_common(dtvp, ti->ti_module, ti->ti_offset));
+ return (tls_get_addr_common(_tcb_get(), ti->ti_module, ti->ti_offset));
}
diff --git a/libexec/rtld-elf/i386/reloc.c b/libexec/rtld-elf/i386/reloc.c
--- a/libexec/rtld-elf/i386/reloc.c
+++ b/libexec/rtld-elf/i386/reloc.c
@@ -523,20 +523,14 @@
__attribute__((__regparm__(1))) void *
___tls_get_addr(tls_index *ti)
{
- struct dtv **dtvp;
-
- dtvp = &_tcb_get()->tcb_dtv;
- return (tls_get_addr_common(dtvp, ti->ti_module, ti->ti_offset));
+ return (tls_get_addr_common(_tcb_get(), ti->ti_module, ti->ti_offset));
}
/* Sun ABI */
void *
__tls_get_addr(tls_index *ti)
{
- struct dtv **dtvp;
-
- dtvp = &_tcb_get()->tcb_dtv;
- return (tls_get_addr_common(dtvp, ti->ti_module, ti->ti_offset));
+ return (tls_get_addr_common(_tcb_get(), ti->ti_module, ti->ti_offset));
}
size_t
diff --git a/libexec/rtld-elf/powerpc/reloc.c b/libexec/rtld-elf/powerpc/reloc.c
--- a/libexec/rtld-elf/powerpc/reloc.c
+++ b/libexec/rtld-elf/powerpc/reloc.c
@@ -837,9 +837,6 @@
void*
__tls_get_addr(tls_index* ti)
{
- struct dtv **dtvp;
-
- dtvp = &_tcb_get()->tcb_dtv;
- return (tls_get_addr_common(dtvp, ti->ti_module, ti->ti_offset +
+ return (tls_get_addr_common(_tcb_get(), ti->ti_module, ti->ti_offset +
TLS_DTV_OFFSET));
}
diff --git a/libexec/rtld-elf/powerpc64/reloc.c b/libexec/rtld-elf/powerpc64/reloc.c
--- a/libexec/rtld-elf/powerpc64/reloc.c
+++ b/libexec/rtld-elf/powerpc64/reloc.c
@@ -734,9 +734,6 @@
void*
__tls_get_addr(tls_index* ti)
{
- struct dtv **dtvp;
-
- dtvp = &_tcb_get()->tcb_dtv;
- return (tls_get_addr_common(dtvp, ti->ti_module, ti->ti_offset +
+ return (tls_get_addr_common(_tcb_get(), ti->ti_module, ti->ti_offset +
TLS_DTV_OFFSET));
}
diff --git a/libexec/rtld-elf/riscv/reloc.c b/libexec/rtld-elf/riscv/reloc.c
--- a/libexec/rtld-elf/riscv/reloc.c
+++ b/libexec/rtld-elf/riscv/reloc.c
@@ -478,9 +478,6 @@
void *
__tls_get_addr(tls_index* ti)
{
- struct dtv **dtvp;
-
- dtvp = &_tcb_get()->tcb_dtv;
- return (tls_get_addr_common(dtvp, ti->ti_module, ti->ti_offset +
+ return (tls_get_addr_common(_tcb_get(), ti->ti_module, ti->ti_offset +
TLS_DTV_OFFSET));
}
diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h
--- a/libexec/rtld-elf/rtld.h
+++ b/libexec/rtld-elf/rtld.h
@@ -415,7 +415,7 @@
void *rtld_resolve_ifunc(const Obj_Entry *obj, const Elf_Sym *def);
void symlook_init(SymLook *, const char *);
int symlook_obj(SymLook *, const Obj_Entry *);
-void *tls_get_addr_common(struct dtv **dtvp, int index, size_t offset);
+void *tls_get_addr_common(struct tcb *tcb, int index, size_t offset);
void *allocate_tls(Obj_Entry *, void *, size_t, size_t);
void free_tls(void *, size_t, size_t);
void *allocate_module_tls(int index);
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
@@ -170,7 +170,7 @@
static int symlook_needed(SymLook *, const Needed_Entry *, DoneList *);
static int symlook_obj1_sysv(SymLook *, const Obj_Entry *);
static int symlook_obj1_gnu(SymLook *, const Obj_Entry *);
-static void *tls_get_addr_slow(struct dtv **, int, size_t, bool) __noinline;
+static void *tls_get_addr_slow(struct tcb *, int, size_t, bool) __noinline;
static void trace_loaded_objects(Obj_Entry *, bool);
static void unlink_object(Obj_Entry *);
static void unload_object(Obj_Entry *, RtldLockState *lockstate);
@@ -4312,15 +4312,12 @@
static void
rtld_fill_dl_phdr_info(const Obj_Entry *obj, struct dl_phdr_info *phdr_info)
{
- struct dtv **dtvp;
-
phdr_info->dlpi_addr = (Elf_Addr)obj->relocbase;
phdr_info->dlpi_name = obj->path;
phdr_info->dlpi_phdr = obj->phdr;
phdr_info->dlpi_phnum = obj->phsize / sizeof(obj->phdr[0]);
phdr_info->dlpi_tls_modid = obj->tlsindex;
- dtvp = &_tcb_get()->tcb_dtv;
- phdr_info->dlpi_tls_data = (char *)tls_get_addr_slow(dtvp,
+ phdr_info->dlpi_tls_data = (char *)tls_get_addr_slow(_tcb_get(),
obj->tlsindex, 0, true);
phdr_info->dlpi_adds = obj_loads;
phdr_info->dlpi_subs = obj_loads - obj_count;
@@ -5350,13 +5347,13 @@
* Common code for MD __tls_get_addr().
*/
static void *
-tls_get_addr_slow(struct dtv **dtvp, int index, size_t offset, bool locked)
+tls_get_addr_slow(struct tcb *tcb, int index, size_t offset, bool locked)
{
struct dtv *newdtv, *dtv;
RtldLockState lockstate;
int to_copy;
- dtv = *dtvp;
+ dtv = tcb->tcb_dtv;
/* Check dtv generation in case new modules have arrived */
if (dtv->dtv_gen != tls_dtv_generation) {
if (!locked)
@@ -5373,7 +5370,7 @@
free(dtv);
if (!locked)
lock_release(rtld_bind_lock, &lockstate);
- dtv = *dtvp = newdtv;
+ dtv = tcb->tcb_dtv = newdtv;
}
/* Dynamically allocate module TLS if necessary */
@@ -5391,16 +5388,16 @@
}
void *
-tls_get_addr_common(struct dtv **dtvp, int index, size_t offset)
+tls_get_addr_common(struct tcb *tcb, int index, size_t offset)
{
struct dtv *dtv;
- dtv = *dtvp;
+ dtv = tcb->tcb_dtv;
/* Check dtv generation in case new modules have arrived */
if (__predict_true(dtv->dtv_gen == tls_dtv_generation &&
dtv->dtv_slots[index - 1].dtvs_tls != 0))
return (dtv->dtv_slots[index - 1].dtvs_tls + offset);
- return (tls_get_addr_slow(dtvp, index, offset, false));
+ return (tls_get_addr_slow(tcb, index, offset, false));
}
#ifdef TLS_VARIANT_I
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Feb 10, 3:12 PM (11 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28627010
Default Alt Text
D50591.diff (6 KB)
Attached To
Mode
D50591: rtld-elf: Pass struct tcb * around rather than struct dtv **
Attached
Detach File
Event Timeline
Log In to Comment