From 1d0ad7736265961192d5f7db11d55b49392c0936 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Wed, 18 Sep 2002 01:18:08 +0000 Subject: * elf/dl-lookup.c (_dl_debug_bindings): Print TLS lookups always. * elf/elf.h (R_386_TLS_TPOFF, R_386_TLS_IE, R_386_TLS_GOTIE, R_386_TLS_LE): Define. (R_386_TLS_IE_32, R_386_TLS_LE_32, R_386_TLS_TPOFF32): Update comments. * sysdeps/i386/dl-machine.h (elf_machine_type_class): Return ELF_RTYPE_CLASS_PLT for R_386_TLS_TPOFF. (elf_machine_rel): Handle R_386_TLS_TPOFF. (elf_machine_rela): Likewise. Remove unnecessary RTLD_BOOTSTRAP #ifdefs. --- sysdeps/i386/dl-machine.h | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) (limited to 'sysdeps/i386') diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index 8f17441dd8..1784a3a737 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -302,7 +302,8 @@ _dl_start_user:\n\ #ifdef USE_TLS # define elf_machine_type_class(type) \ ((((type) == R_386_JMP_SLOT || (type) == R_386_TLS_DTPMOD32 \ - || (type) == R_386_TLS_DTPOFF32 || (type) == R_386_TLS_TPOFF32) \ + || (type) == R_386_TLS_DTPOFF32 || (type) == R_386_TLS_TPOFF32 \ + || (type) == R_386_TLS_TPOFF) \ * ELF_RTYPE_CLASS_PLT) \ | (((type) == R_386_COPY) * ELF_RTYPE_CLASS_COPY)) #else @@ -444,6 +445,18 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, block we subtract the offset from that of the TLS block. */ if (sym != NULL) *reloc_addr += sym_map->l_tls_offset - sym->st_value; +# endif + break; + case R_386_TLS_TPOFF: + /* The offset is negative, forward from the thread pointer. */ +# ifdef RTLD_BOOTSTRAP + *reloc_addr += sym->st_value - map->l_tls_offset; +# else + /* We know the offset of object the symbol is contained in. + It is a negative value which will be added to the + thread pointer. */ + if (sym != NULL) + *reloc_addr += sym->st_value - sym_map->l_tls_offset; # endif break; #endif /* use TLS */ @@ -517,31 +530,18 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, #ifdef USE_TLS case R_386_TLS_DTPMOD32: -# ifdef RTLD_BOOTSTRAP - /* During startup the dynamic linker is always the module - with index 1. - XXX If this relocation is necessary move before RESOLVE - call. */ - *reloc_addr = 1; -# else /* Get the information from the link map returned by the resolv function. */ if (sym_map != NULL) *reloc_addr = sym_map->l_tls_modid; -# endif break; case R_386_TLS_DTPOFF32: -# ifndef RTLD_BOOTSTRAP /* During relocation all TLS symbols are defined and used. Therefore the offset is already correct. */ *reloc_addr = (sym == NULL ? 0 : sym->st_value) + reloc->r_addend; -# endif break; case R_386_TLS_TPOFF32: /* The offset is positive, backward from the thread pointer. */ -# ifdef RTLD_BOOTSTRAP - *reloc_addr = map->l_tls_offset - sym->st_value + reloc->r_addend; -# else /* We know the offset of object the symbol is contained in. It is a positive value which will be subtracted from the thread pointer. To get the variable position in the TLS @@ -549,7 +549,15 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, *reloc_addr = (sym == NULL ? 0 : sym_map->l_tls_offset - sym->st_value) + reloc->r_addend; -# endif + break; + case R_386_TLS_TPOFF: + /* The offset is negative, forward from the thread pointer. */ + /* We know the offset of object the symbol is contained in. + It is a negative value which will be added to the + thread pointer. */ + *reloc_addr + = (sym == NULL ? 0 : sym->st_value - sym_map->l_tls_offset) + + reloc->r_addend; break; #endif /* use TLS */ default: -- cgit 1.4.1