about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-03-03 13:34:35 +0000
committerJakub Jelinek <jakub@redhat.com>2005-03-03 13:34:35 +0000
commitd0fec8d06cc2234c8114b51f630466eff9d5f841 (patch)
tree223a7fdae69137bd5670e59249442bc6a2db1ad1 /elf
parent00e4559b612f179492ff3721f86c92498894432f (diff)
downloadglibc-d0fec8d06cc2234c8114b51f630466eff9d5f841.tar.gz
glibc-d0fec8d06cc2234c8114b51f630466eff9d5f841.tar.xz
glibc-d0fec8d06cc2234c8114b51f630466eff9d5f841.zip
Updated to fedora-glibc-20050302T1820
Diffstat (limited to 'elf')
-rw-r--r--elf/Makefile9
-rw-r--r--elf/dl-addr.c16
-rw-r--r--elf/dl-load.c2
-rw-r--r--elf/dl-lookup.c6
-rw-r--r--elf/dl-reloc.c8
-rw-r--r--elf/dynamic-link.h12
-rw-r--r--elf/tst-array1-static.c1
7 files changed, 35 insertions, 19 deletions
diff --git a/elf/Makefile b/elf/Makefile
index 47e6ea4d58..8a8bb3a239 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -141,7 +141,10 @@ tests-static = tst-tls1-static tst-tls2-static
 ifeq (yesyesyes,$(build-static)$(build-shared)$(elf))
 tests-static += tst-tls9-static
 tst-tls9-static-ENV = \
-	LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn
+       LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn
+endif
+ifeq (yes,$(have-initfini-array))
+tests-static += tst-array1-static
 endif
 tests += $(tests-static)
 endif
@@ -701,6 +704,10 @@ $(objpfx)tst-array1.out: $(objpfx)tst-array1
 	  $(objpfx)tst-array1 > $@
 	cmp $@ tst-array1.exp > /dev/null
 
+$(objpfx)tst-array1-static.out: $(objpfx)tst-array1-static
+	$(objpfx)tst-array1-static > $@
+	cmp $@ tst-array1.exp > /dev/null
+
 $(objpfx)tst-array2: $(objpfx)tst-array2dep.so
 $(objpfx)tst-array2.out: $(objpfx)tst-array2
 	$(elf-objpfx)$(rtld-installed-name) \
diff --git a/elf/dl-addr.c b/elf/dl-addr.c
index 685cab9be8..c56736ceb1 100644
--- a/elf/dl-addr.c
+++ b/elf/dl-addr.c
@@ -1,5 +1,5 @@
 /* Locate the shared object symbol nearest a given address.
-   Copyright (C) 1996-2003, 2004   Free Software Foundation, Inc.
+   Copyright (C) 1996-2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -28,16 +28,12 @@ _dl_addr (const void *address, Dl_info *info,
 	  struct link_map **mapp, const ElfW(Sym) **symbolp)
 {
   const ElfW(Addr) addr = DL_LOOKUP_ADDRESS (address);
-  struct link_map *match;
-  const ElfW(Sym) *symtab, *matchsym, *symtabend;
-  const char *strtab;
-  ElfW(Word) strtabsize;
 
   /* Protect against concurrent loads and unloads.  */
   __rtld_lock_lock_recursive (GL(dl_load_lock));
 
   /* Find the highest-addressed object that ADDRESS is not below.  */
-  match = NULL;
+  struct link_map *match = NULL;
   for (Lmid_t ns = 0; ns < DL_NNS; ++ns)
     for (struct link_map *l = GL(dl_ns)[ns]._ns_loaded; l; l = l->l_next)
       if (addr >= l->l_map_start && addr < l->l_map_end)
@@ -72,11 +68,12 @@ _dl_addr (const void *address, Dl_info *info,
 	  && match->l_type == lt_executable)
 	info->dli_fname = _dl_argv[0];
 
-      symtab = (const void *) D_PTR (match, l_info[DT_SYMTAB]);
-      strtab = (const void *) D_PTR (match, l_info[DT_STRTAB]);
+      const ElfW(Sym) *symtab = D_PTR (match, l_info[DT_SYMTAB]);
+      const char *strtab = (const char *) D_PTR (match, l_info[DT_STRTAB]);
 
-      strtabsize = match->l_info[DT_STRSZ]->d_un.d_val;
+      ElfW(Word) strtabsize = match->l_info[DT_STRSZ]->d_un.d_val;
 
+      const ElfW(Sym) *symtabend;
       if (match->l_info[DT_HASH] != NULL)
 	symtabend = (symtab
 		     + ((Elf_Symndx *) D_PTR (match, l_info[DT_HASH]))[1]);
@@ -90,6 +87,7 @@ _dl_addr (const void *address, Dl_info *info,
       /* We assume that the string table follows the symbol table,
 	 because there is no way in ELF to know the size of the
 	 dynamic symbol table!!  */
+      const ElfW(Sym) *matchsym;
       for (matchsym = NULL; (void *) symtab < (void *) symtabend; ++symtab)
 	if (addr >= match->l_addr + symtab->st_value
 #if defined USE_TLS
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 088b2224e2..97e1e0089c 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -110,6 +110,8 @@ int __stack_prot attribute_hidden attribute_relro
   = PROT_GROWSDOWN;
 #elif _STACK_GROWS_UP && defined PROT_GROWSUP
   = PROT_GROWSUP;
+#else
+  = 0;
 #endif
 
 
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index fdb076951d..24fc89af10 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -1,5 +1,5 @@
 /* Look up a symbol in the loaded objects.
-   Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -395,11 +395,13 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
 
   if (GLRO(dl_debug_mask) & DL_DEBUG_BINDINGS)
     {
-      _dl_debug_printf ("binding file %s to %s: %s symbol `%s'",
+      _dl_debug_printf ("binding file %s [%lu] to %s [%lu]: %s symbol `%s'",
 			(reference_name[0]
 			 ? reference_name
 			 : (rtld_progname ?: "<main program>")),
+			undef_map->l_ns,
 			value->m->l_name[0] ? value->m->l_name : rtld_progname,
+			value->m->l_ns,
 			protected ? "protected" : "normal", undef_name);
       if (version)
 	_dl_debug_printf_c (" [%s]\n", version->name);
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
index b680683198..2d309fb210 100644
--- a/elf/dl-reloc.c
+++ b/elf/dl-reloc.c
@@ -1,5 +1,5 @@
 /* Relocate a shared object and resolve its references to other loaded objects.
-   Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -124,8 +124,10 @@ _dl_nothread_init_static_tls (struct link_map *map)
 # endif
 
   /* Fill in the DTV slot so that a later LD/GD access will find it.  */
-  THREAD_DTV ()[map->l_tls_modid].pointer.val = dest;
-  THREAD_DTV ()[map->l_tls_modid].pointer.is_static = true;
+  dtv_t *dtv = THREAD_DTV ();
+  assert (map->l_tls_modid <= dtv[-1].counter);
+  dtv[map->l_tls_modid].pointer.val = dest;
+  dtv[map->l_tls_modid].pointer.is_static = true;
 
   /* Initialize the memory.  */
   memset (__mempcpy (dest, map->l_tls_initimage, map->l_tls_initimage_size),
diff --git a/elf/dynamic-link.h b/elf/dynamic-link.h
index 5118144174..1d6806f50c 100644
--- a/elf/dynamic-link.h
+++ b/elf/dynamic-link.h
@@ -1,5 +1,5 @@
 /* Inline functions for dynamic linking.
-   Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -31,20 +31,24 @@
    optimizing away alignment tests or using word instructions for
    copying memory, breaking the very code written to handle the
    unaligned cases.  */
+# if ! ELF_MACHINE_NO_REL
 auto void __attribute__((always_inline))
 elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
 		 const ElfW(Sym) *sym, const struct r_found_version *version,
 		 void *const reloc_addr);
 auto void __attribute__((always_inline))
+elf_machine_rel_relative (ElfW(Addr) l_addr, const ElfW(Rel) *reloc,
+			  void *const reloc_addr);
+# endif
+# if ! ELF_MACHINE_NO_RELA
+auto void __attribute__((always_inline))
 elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
 		  const ElfW(Sym) *sym, const struct r_found_version *version,
 		  void *const reloc_addr);
 auto void __attribute__((always_inline))
-elf_machine_rel_relative (ElfW(Addr) l_addr, const ElfW(Rel) *reloc,
-			  void *const reloc_addr);
-auto void __attribute__((always_inline))
 elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc,
 			   void *const reloc_addr);
+# endif
 # if ELF_MACHINE_NO_RELA || defined ELF_MACHINE_PLT_REL
 auto void __attribute__((always_inline))
 elf_machine_lazy_rel (struct link_map *map,
diff --git a/elf/tst-array1-static.c b/elf/tst-array1-static.c
new file mode 100644
index 0000000000..21539a4212
--- /dev/null
+++ b/elf/tst-array1-static.c
@@ -0,0 +1 @@
+#include "tst-array1.c"