diff options
| author | Doug Rabson <dfr@FreeBSD.org> | 2004-08-04 19:12:14 +0000 |
|---|---|---|
| committer | Doug Rabson <dfr@FreeBSD.org> | 2004-08-04 19:12:14 +0000 |
| commit | fca32c746eb922c56e6d4123f6731073561e4c79 (patch) | |
| tree | 1800afe500fdade8ce865bcc7debe2b3d788862b /libexec/rtld-elf | |
| parent | f9b3b0e6d4fb732add525de6738b751670bd4ca8 (diff) | |
Notes
Diffstat (limited to 'libexec/rtld-elf')
| -rw-r--r-- | libexec/rtld-elf/powerpc/reloc.c | 26 | ||||
| -rw-r--r-- | libexec/rtld-elf/powerpc/rtld_machdep.h | 15 | ||||
| -rw-r--r-- | libexec/rtld-elf/rtld.c | 7 |
3 files changed, 43 insertions, 5 deletions
diff --git a/libexec/rtld-elf/powerpc/reloc.c b/libexec/rtld-elf/powerpc/reloc.c index 9894033e459a..1f9f05a1ba0e 100644 --- a/libexec/rtld-elf/powerpc/reloc.c +++ b/libexec/rtld-elf/powerpc/reloc.c @@ -489,3 +489,29 @@ init_pltgot(Obj_Entry *obj) */ __syncicache(pltcall, 72 + N * 8); } + +void +allocate_initial_tls(Obj_Entry *list) +{ + register Elf_Addr **tp __asm__("r2"); + + /* + * Fix the size of the static TLS block by using the maximum + * offset allocated so far and adding a bit for dynamic modules to + * use. + */ + + tls_static_space = tls_last_offset + tls_last_size + RTLD_STATIC_TLS_EXTRA; + + tp = (Elf_Addr **) ((char *) allocate_tls(list, 0, 8, 8) + 0x7008); +} + +void* +__tls_get_addr(tls_index* ti) +{ + register Elf_Addr **tp __asm__("r2"); + char *p; + + p = tls_get_addr_common(tp, ti->ti_module, ti->ti_offset); + return p + 0x8000; +} diff --git a/libexec/rtld-elf/powerpc/rtld_machdep.h b/libexec/rtld-elf/powerpc/rtld_machdep.h index 77495d76b41d..534882b1cedb 100644 --- a/libexec/rtld-elf/powerpc/rtld_machdep.h +++ b/libexec/rtld-elf/powerpc/rtld_machdep.h @@ -62,4 +62,19 @@ void _rtld_bind_start(void); void _rtld_powerpc_pltresolve(void); void _rtld_powerpc_pltcall(void); +#define round(size, align) \ + (((size) + (align) - 1) & ~((align) - 1)) +#define calculate_first_tls_offset(size, align) \ + round(8, align) +#define calculate_tls_offset(prev_offset, prev_size, size, align) \ + round(prev_offset + prev_size, align) +#define calculate_tls_end(off, size) ((off) + (size)) + +typedef struct { + unsigned long ti_module; + unsigned long ti_offset; +} tls_index; + +extern void *__tls_get_addr(tls_index* ti); + #endif diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 97ddf578147b..3891f174236b 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -2508,9 +2508,9 @@ tls_get_addr_common(Elf_Addr** dtvp, int index, size_t offset) return (void*) (dtv[index + 1] + offset); } -/* XXX not sure what variants to use for arm and powerpc. */ +/* XXX not sure what variants to use for arm. */ -#if defined(__ia64__) || defined(__alpha__) +#if defined(__ia64__) || defined(__alpha__) || defined(__powerpc__) /* * Allocate Static TLS using the Variant I method. @@ -2525,9 +2525,6 @@ allocate_tls(Obj_Entry *objs, void *oldtls, size_t tcbsize, size_t tcbalign) Elf_Addr addr; int i; - assert(tcbsize == 16); - assert(tcbalign == 16); - size = tls_static_space; tls = malloc(size); |
