diff options
author | dfr <dfr@FreeBSD.org> | 2004-08-03 08:51:00 +0000 |
---|---|---|
committer | dfr <dfr@FreeBSD.org> | 2004-08-03 08:51:00 +0000 |
commit | 4e9853427fa3cd90808fd8369e917f588b1ee5c0 (patch) | |
tree | 5493edb6b3a69f88f4154145f1edf0879595204f /libexec/rtld-elf/sparc64 | |
parent | 5a48e6bc9fa5e4eb90bf8dc018ec35469df1d4ea (diff) | |
download | FreeBSD-src-4e9853427fa3cd90808fd8369e917f588b1ee5c0.zip FreeBSD-src-4e9853427fa3cd90808fd8369e917f588b1ee5c0.tar.gz |
Add support for Thread Local Storage.
Diffstat (limited to 'libexec/rtld-elf/sparc64')
-rw-r--r-- | libexec/rtld-elf/sparc64/reloc.c | 21 | ||||
-rw-r--r-- | libexec/rtld-elf/sparc64/rtld_machdep.h | 15 |
2 files changed, 36 insertions, 0 deletions
diff --git a/libexec/rtld-elf/sparc64/reloc.c b/libexec/rtld-elf/sparc64/reloc.c index c083c9c..0b44bec 100644 --- a/libexec/rtld-elf/sparc64/reloc.c +++ b/libexec/rtld-elf/sparc64/reloc.c @@ -717,3 +717,24 @@ install_plt(Elf_Half *pltgot, Elf_Addr proc) pltgot[7] = MOV_g1_o0; flush(pltgot, 28); } + +void +allocate_initial_tls(Obj_Entry *objs) +{ + register Elf_Addr** tp __asm__("%g7"); + + /* + * 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 + RTLD_STATIC_TLS_EXTRA; + tp = allocate_tls(objs, NULL, 2*sizeof(Elf_Addr), sizeof(Elf_Addr)); +} + +void *__tls_get_addr(tls_index *ti) +{ + register Elf_Addr** tp __asm__("%g7"); + + return tls_get_addr_common(tp, ti->ti_module, ti->ti_offset); +} diff --git a/libexec/rtld-elf/sparc64/rtld_machdep.h b/libexec/rtld-elf/sparc64/rtld_machdep.h index 27276ee..db2ce25 100644 --- a/libexec/rtld-elf/sparc64/rtld_machdep.h +++ b/libexec/rtld-elf/sparc64/rtld_machdep.h @@ -52,4 +52,19 @@ Elf_Addr reloc_jmpslot(Elf_Addr *, Elf_Addr, #define call_initfini_pointer(obj, target) \ (((InitFunc)(target))()) +#define round(size, align) \ + (((size) + (align) - 1) & ~((align) - 1)) +#define calculate_first_tls_offset(size, align) \ + round(size, align) +#define calculate_tls_offset(prev_offset, prev_size, size, align) \ + round((prev_offset) + (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 |