Add stubs for powerpc TLS.

Submitted by: ssouhlal
This commit is contained in:
dfr 2004-08-04 19:12:14 +00:00
parent 44a25b6e89
commit c42f6bfee0
3 changed files with 43 additions and 5 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -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);