aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKip Macy <kmacy@FreeBSD.org>2006-10-08 02:50:34 +0000
committerKip Macy <kmacy@FreeBSD.org>2006-10-08 02:50:34 +0000
commitb84c7a797ca0806b362a1dd0ecbca9e728dde5c5 (patch)
tree6ad8c75d0dc911debb2ae132787ef8e5be588a57
parenta5ad0b523b825cecb3d2cf90d279eb2c4001fad0 (diff)
Notes
-rw-r--r--lib/csu/sparc64/crt1.c7
-rw-r--r--lib/libc/gen/tls.c11
-rw-r--r--lib/libc/sparc64/gen/_set_tp.c3
-rw-r--r--libexec/rtld-elf/sparc64/reloc.c5
4 files changed, 17 insertions, 9 deletions
diff --git a/lib/csu/sparc64/crt1.c b/lib/csu/sparc64/crt1.c
index 19c0fadb738d..5d8e37162446 100644
--- a/lib/csu/sparc64/crt1.c
+++ b/lib/csu/sparc64/crt1.c
@@ -98,13 +98,12 @@ _start(char **ap, void (*cleanup)(void), struct Struct_Obj_Entry *obj __unused,
__progname = s + 1;
}
- __sparc_utrap_setup();
-
if (&_DYNAMIC != NULL)
atexit(cleanup);
- else
+ else {
+ __sparc_utrap_setup();
_init_tls();
-
+ }
#ifdef GCRT
atexit(_mcleanup);
#endif
diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c
index 76e195052f05..5bc4b87faab4 100644
--- a/lib/libc/gen/tls.c
+++ b/lib/libc/gen/tls.c
@@ -58,6 +58,15 @@ void _rtld_free_tls(void *tls, size_t tcbsize, size_t tcbalign);
void *__libc_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign);
void __libc_free_tls(void *tls, size_t tcbsize, size_t tcbalign);
+#if defined(__ia64__) || defined(__amd64__)
+#define TLS_TCB_ALIGN 16
+#elif defined(__powerpc__) || defined(__i386__) || defined(__arm__) || \
+ defined(__sparc64__)
+#define TLS_TCB_ALIGN sizeof(void *)
+#else
+#error TLS_TCB_ALIGN undefined for target architecture
+#endif
+
#if defined(__ia64__) || defined(__powerpc__)
#define TLS_VARIANT_I
#endif
@@ -299,7 +308,7 @@ _init_tls()
}
}
- tls = _rtld_allocate_tls(NULL, TLS_TCB_SIZE, 1);
+ tls = _rtld_allocate_tls(NULL, TLS_TCB_SIZE, TLS_TCB_ALIGN);
_set_tp(tls);
#endif
diff --git a/lib/libc/sparc64/gen/_set_tp.c b/lib/libc/sparc64/gen/_set_tp.c
index 6255fd33ce1d..cf9db2676937 100644
--- a/lib/libc/sparc64/gen/_set_tp.c
+++ b/lib/libc/sparc64/gen/_set_tp.c
@@ -29,7 +29,6 @@
void
_set_tp(void *tpval)
{
- register void* tp __asm__("%g7");
- tp = tpval;
+ __asm __volatile("mov %0, %%g7" : : "r" (tpval));
}
diff --git a/libexec/rtld-elf/sparc64/reloc.c b/libexec/rtld-elf/sparc64/reloc.c
index dc0d83069822..225322ed93e0 100644
--- a/libexec/rtld-elf/sparc64/reloc.c
+++ b/libexec/rtld-elf/sparc64/reloc.c
@@ -723,7 +723,7 @@ install_plt(Elf_Word *pltgot, Elf_Addr proc)
void
allocate_initial_tls(Obj_Entry *objs)
{
- register Elf_Addr** tp __asm__("%g7");
+ Elf_Addr* tpval;
/*
* Fix the size of the static TLS block by using the maximum
@@ -731,7 +731,8 @@ allocate_initial_tls(Obj_Entry *objs)
* use.
*/
tls_static_space = tls_last_offset + RTLD_STATIC_TLS_EXTRA;
- tp = allocate_tls(objs, NULL, 3*sizeof(Elf_Addr), sizeof(Elf_Addr));
+ tpval = allocate_tls(objs, NULL, 3*sizeof(Elf_Addr), sizeof(Elf_Addr));
+ __asm __volatile("mov %0, %%g7" : : "r" (tpval));
}
void *__tls_get_addr(tls_index *ti)