aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/i386/dl-machine.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-02-05 00:57:29 +0000
committerUlrich Drepper <drepper@redhat.com>2002-02-05 00:57:29 +0000
commit535b764df5ca722066c2db615190e6a70688c6a6 (patch)
tree06f6ba9853ac4e8f698fc1e3b0b4cb80ffd06bae /sysdeps/i386/dl-machine.h
parent67ddea92542c12f2099a89dbc58a045a65bb7771 (diff)
downloadglibc-535b764df5ca722066c2db615190e6a70688c6a6.tar
glibc-535b764df5ca722066c2db615190e6a70688c6a6.tar.gz
glibc-535b764df5ca722066c2db615190e6a70688c6a6.tar.bz2
glibc-535b764df5ca722066c2db615190e6a70688c6a6.zip
Update.
* elf/rtld.c (_dl_start_final): Allocate TLS and initialize thread-pointer as soon as possible. * sysdeps/generic/ldsodefs.h: Include <tls.h>. Define first TLS elements in rtld_global. * sysdeps/generic/tls.h: New file. * elf/Makefile (distribute): Add tls.h. * sysdeps/i386/dl-machine.h (elf_machine_rel): Add support for TLS relocations. Not complete yet. * resolv/resolv.h: Allow user to define __need_res_state and only define __res_start structure then. * include/resolv.h: Only declare functions if _RESOLV_H_ is defined.
Diffstat (limited to 'sysdeps/i386/dl-machine.h')
-rw-r--r--sysdeps/i386/dl-machine.h39
1 files changed, 38 insertions, 1 deletions
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index 69a0c5550e..f791fa3ffa 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -342,7 +342,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
else
#endif
{
-#ifdef RTLD_BOOTSTRAP
+#if defined RTLD_BOOTSTRAP && !defined USE_TLS
Elf32_Addr value;
assert (r_type == R_386_GLOB_DAT || r_type == R_386_JMP_SLOT);
@@ -352,7 +352,9 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
#else
const Elf32_Sym *const refsym = sym;
Elf32_Addr value = RESOLVE (&sym, version, r_type);
+# ifndef RTLD_BOOTSTRAP
if (sym)
+# endif
value += sym->st_value;
switch (r_type)
@@ -361,6 +363,40 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
case R_386_JMP_SLOT:
*reloc_addr = value;
break;
+
+ /* XXX Remove TLS relocations which are not needed. */
+
+ 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
+ /* XXX Implement. RESOLVE must return the map from which we
+ get the module ID. */
+ _exit (99);
+# 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->st_value;
+# endif
+ break;
+ case R_386_TLS_TPOFF32:
+ /* The offset is positive, backward from the thread pointer. */
+# ifdef RTLD_BOOTSTRAP
+ *reloc_addr = GL(rtld_tlsoffset) - sym->st_value;
+# else
+ /* XXX Implement. */
+ _exit (98);
+# endif
+ break;
+
+# ifndef RTLD_BOOTSTRAP
case R_386_32:
*reloc_addr += value;
break;
@@ -390,6 +426,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
default:
_dl_reloc_bad_type (map, r_type, 0);
break;
+# endif
}
#endif
}