Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F143884111
D45143.id138314.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
D45143.id138314.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
@@ -172,7 +172,7 @@
Elf_Addr tls_offs;
};
-static Elf_Addr
+static struct tls_data *
reloc_tlsdesc_alloc(int tlsindex, Elf_Addr tlsoffs)
{
struct tls_data *tlsdesc;
@@ -182,18 +182,26 @@
tlsdesc->tls_index = tlsindex;
tlsdesc->tls_offs = tlsoffs;
- return ((Elf_Addr)tlsdesc);
+ return (tlsdesc);
}
+struct tlsdesc_entry {
+ void *(*func)(void *);
+ union {
+ Elf_Ssize addend;
+ Elf_Size offset;
+ struct tls_data *data;
+ };
+};
+
static void
-reloc_tlsdesc(const Obj_Entry *obj, const Elf_Rela *rela, Elf_Addr *where,
- int flags, RtldLockState *lockstate)
+reloc_tlsdesc(const Obj_Entry *obj, const Elf_Rela *rela,
+ struct tlsdesc_entry *where, int flags, RtldLockState *lockstate)
{
const Elf_Sym *def;
const Obj_Entry *defobj;
Elf_Addr offs;
-
offs = 0;
if (ELF_R_SYM(rela->r_info) != 0) {
def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, flags,
@@ -204,8 +212,8 @@
obj = defobj;
if (def->st_shndx == SHN_UNDEF) {
/* Weak undefined thread variable */
- where[0] = (Elf_Addr)_rtld_tlsdesc_undef;
- where[1] = rela->r_addend;
+ where->func = _rtld_tlsdesc_undef;
+ where->addend = rela->r_addend;
return;
}
}
@@ -213,12 +221,12 @@
if (obj->tlsoffset != 0) {
/* Variable is in initialy allocated TLS segment */
- where[0] = (Elf_Addr)_rtld_tlsdesc_static;
- where[1] = obj->tlsoffset + offs;
+ where->func = _rtld_tlsdesc_static;
+ where->offset = obj->tlsoffset + offs;
} else {
/* TLS offest is unknown at load time, use dynamic resolving */
- where[0] = (Elf_Addr)_rtld_tlsdesc_dynamic;
- where[1] = reloc_tlsdesc_alloc(obj->tlsindex, offs);
+ where->func = _rtld_tlsdesc_dynamic;
+ where->data = reloc_tlsdesc_alloc(obj->tlsindex, offs);
}
}
@@ -243,8 +251,8 @@
*where += (Elf_Addr)obj->relocbase;
break;
case R_AARCH64_TLSDESC:
- reloc_tlsdesc(obj, rela, where, SYMLOOK_IN_PLT | flags,
- lockstate);
+ reloc_tlsdesc(obj, rela, (struct tlsdesc_entry *)where,
+ SYMLOOK_IN_PLT | flags, lockstate);
break;
case R_AARCH64_IRELATIVE:
obj->irelative = true;
@@ -503,7 +511,8 @@
}
break;
case R_AARCH64_TLSDESC:
- reloc_tlsdesc(obj, rela, where, flags, lockstate);
+ reloc_tlsdesc(obj, rela, (struct tlsdesc_entry *)where,
+ flags, lockstate);
break;
case R_AARCH64_TLS_TPREL64:
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 2, 12:08 PM (18 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28413116
Default Alt Text
D45143.id138314.diff (2 KB)
Attached To
Mode
D45143: rtld-elf: Use a proper struct type for tlsdesc entries
Attached
Detach File
Event Timeline
Log In to Comment