diff options
Diffstat (limited to 'libexec/rtld-elf/alpha')
-rw-r--r-- | libexec/rtld-elf/alpha/reloc.c | 22 | ||||
-rw-r--r-- | libexec/rtld-elf/alpha/rtld_machdep.h | 15 |
2 files changed, 37 insertions, 0 deletions
diff --git a/libexec/rtld-elf/alpha/reloc.c b/libexec/rtld-elf/alpha/reloc.c index 535419c..1ec66ca 100644 --- a/libexec/rtld-elf/alpha/reloc.c +++ b/libexec/rtld-elf/alpha/reloc.c @@ -505,3 +505,25 @@ init_pltgot(Obj_Entry *obj) obj->pltgot[3] = (Elf_Addr) obj; } } + +void +allocate_initial_tls(Obj_Entry *list) +{ + void *tls; + + /* + * 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; + tls = allocate_tls(list, 0, 16, 16); + alpha_pal_wrunique((u_int64_t) tls); +} + +void *__tls_get_addr(tls_index* ti) +{ + Elf_Addr** tp = (Elf_Addr**) alpha_pal_rdunique(); + + return tls_get_addr_common(tp, ti->ti_module, ti->ti_offset); +} diff --git a/libexec/rtld-elf/alpha/rtld_machdep.h b/libexec/rtld-elf/alpha/rtld_machdep.h index 008abce..397139e 100644 --- a/libexec/rtld-elf/alpha/rtld_machdep.h +++ b/libexec/rtld-elf/alpha/rtld_machdep.h @@ -60,4 +60,19 @@ Elf_Addr reloc_jmpslot(Elf_Addr *, Elf_Addr, /* Lazy binding entry point, called via PLT. */ void _rtld_bind_start_old(void); +#define round(size, align) \ + (((size) + (align) - 1) & ~((align) - 1)) +#define calculate_first_tls_offset(size, align) \ + round(16, 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 |