summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authorgonzo <gonzo@FreeBSD.org>2012-08-15 03:07:41 +0000
committergonzo <gonzo@FreeBSD.org>2012-08-15 03:07:41 +0000
commit2187caf32ab56951cfad529357413ac58b57d553 (patch)
tree52190f099d65fdbdfdb7aa9bc95b9edeb8ba6534 /libexec
parent032427f3e9854fccfdddaea8fb15ae4603391a11 (diff)
downloadFreeBSD-src-2187caf32ab56951cfad529357413ac58b57d553.zip
FreeBSD-src-2187caf32ab56951cfad529357413ac58b57d553.tar.gz
Merging of projects/armv6, part 2
Handle TLS for ARMv6 and ARMv7
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rtld-elf/arm/reloc.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/libexec/rtld-elf/arm/reloc.c b/libexec/rtld-elf/arm/reloc.c
index 005c468..715cb7e 100644
--- a/libexec/rtld-elf/arm/reloc.c
+++ b/libexec/rtld-elf/arm/reloc.c
@@ -433,7 +433,9 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const Obj_Entry *defobj,
void
allocate_initial_tls(Obj_Entry *objs)
{
+#ifdef ARM_TP_ADDRESS
void **_tp = (void **)ARM_TP_ADDRESS;
+#endif
/*
* Fix the size of the static TLS block by using the maximum
@@ -443,16 +445,27 @@ allocate_initial_tls(Obj_Entry *objs)
tls_static_space = tls_last_offset + tls_last_size + RTLD_STATIC_TLS_EXTRA;
+#ifdef ARM_TP_ADDRESS
(*_tp) = (void *) allocate_tls(objs, NULL, TLS_TCB_SIZE, 8);
+#else
+ sysarch(ARM_SET_TP, allocate_tls(objs, NULL, TLS_TCB_SIZE, 8));
+#endif
}
void *
__tls_get_addr(tls_index* ti)
{
- void **_tp = (void **)ARM_TP_ADDRESS;
char *p;
+#ifdef ARM_TP_ADDRESS
+ void **_tp = (void **)ARM_TP_ADDRESS;
p = tls_get_addr_common((Elf_Addr **)(*_tp), ti->ti_module, ti->ti_offset);
+#else
+ void *_tp;
+ __asm __volatile("mrc p15, 0, %0, c13, c0, 3" \
+ : "=r" (_tp));
+ p = tls_get_addr_common((Elf_Addr **)(_tp), ti->ti_module, ti->ti_offset);
+#endif
return (p);
}
OpenPOWER on IntegriCloud