about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-02-22 03:51:38 +0000
committerUlrich Drepper <drepper@redhat.com>2005-02-22 03:51:38 +0000
commite13e33e279e193191e06811cb7ae3518d7acad1a (patch)
treeaf79ff3fe269f056259402f256fdd3f0d78aab6e
parentaf272d4fa88306ec6a9c112cae6ebbb45f0b296e (diff)
downloadglibc-e13e33e279e193191e06811cb7ae3518d7acad1a.tar.gz
glibc-e13e33e279e193191e06811cb7ae3518d7acad1a.tar.xz
glibc-e13e33e279e193191e06811cb7ae3518d7acad1a.zip
2005-02-21 Alan Modra <amodra@bigpond.net.au>
	* elf/dl-reloc.c (_dl_nothread_init_static_tls): Assert that dtv
	array index is within bounds.

	* elf/dl-load.c: Do not allow PT_TLS in modules loaded in statically
	linked code.
	* sysdeps/generic/dl-tls.c [!SHARED]: Don't build _dl_next_tls_modid.
	* elf/Makefile: Remove rules to build and run tst-tls9-static.
-rw-r--r--ChangeLog20
-rw-r--r--elf/Makefile7
-rw-r--r--elf/dl-load.c9
-rw-r--r--elf/dl-reloc.c2
-rw-r--r--libidn/ChangeLog11
-rw-r--r--libidn/Makefile7
-rw-r--r--sysdeps/generic/dl-tls.c2
7 files changed, 35 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index 1253fefb3a..a52a9ca85e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,19 +1,19 @@
+2005-02-21  Alan Modra <amodra@bigpond.net.au>
+
+	* elf/dl-reloc.c (_dl_nothread_init_static_tls): Assert that dtv
+	array index is within bounds.
+
 2005-02-21  Ulrich Drepper  <drepper@redhat.com>
 
+	* elf/dl-load.c: Do not allow PT_TLS in modules loaded in statically
+	linked code.
+	* sysdeps/generic/dl-tls.c [!SHARED]: Don't build _dl_next_tls_modid.
+	* elf/Makefile: Remove rules to build and run tst-tls9-static.
+
 	* elf/dl-reloc.c (_dl_nothread_init_static_tls): Avoid using
 	THREAD_DTV multiple times, this minimally reduces code size on
 	some archs.
 
-2005-02-12  Simon Josefsson  <jas@extundo.com >
-
-	* iconvme.h: New file, extracted from toutf8.c but improved.
-	* iconvme.c: New file.
-	* toutf8.c: Include stringprep.h first, to make the compiler check
-	that stringprep.h is standalone.  Improve comments.  Replace
-	#include of errno.h and sys/param.h with iconvme.h.  Don't define
-	ICONV_CONST.
-	(stringprep_convert): Rewrite to use iconvme.h.
-
 2005-02-21  Jakub Jelinek  <jakub@redhat.com>
 
 	* nscd/nscd_gethst_r.c (nscd_gethst_r): Set *h_errnop to
diff --git a/elf/Makefile b/elf/Makefile
index 6c34d8ab44..e7c16f44df 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -139,12 +139,7 @@ endif
 ifeq (yes,$(build-static))
 tests-static = tst-tls1-static tst-tls2-static
 ifeq (yes,$(have-initfini-array))
-tests-static += tst-array1-static 
-endif
-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
+tests-static += tst-array1-static
 endif
 tests += $(tests-static)
 endif
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 088b2224e2..5c562471c9 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1056,6 +1056,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
 
 	case PT_TLS:
 #ifdef USE_TLS
+# ifdef SHARED
 	  if (ph->p_memsz == 0)
 	    /* Nothing to do for an empty segment.  */
 	    break;
@@ -1083,7 +1084,6 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
 	      break;
 	    }
 
-# ifdef SHARED
 	  if (l->l_prev == NULL || (mode & __RTLD_AUDIT) != 0)
 	    /* We are loading the executable itself when the dynamic linker
 	       was executed directly.  The setup will happen later.  */
@@ -1092,7 +1092,6 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
 	  /* In a static binary there is no way to tell if we dynamically
 	     loaded libpthread.  */
 	  if (GL(dl_error_catch_tsd) == &_dl_initial_error_catch_tsd)
-# endif
 	    {
 	      /* We have not yet loaded libpthread.
 		 We can do the TLS setup right now!  */
@@ -1125,6 +1124,12 @@ cannot allocate TLS data structures for initial thread");
 	      _dl_deallocate_tls (tcb, 1);
 	      goto call_lose;
 	    }
+# else
+	  errval = EINVAL;
+	  errstring = N_("\
+statically linked code cannot load module with TLS");
+	  goto call_lose;
+# endif
 #endif
 
 	  /* Uh-oh, the binary expects TLS support but we cannot
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
index c3a58dd921..140093c6ce 100644
--- a/elf/dl-reloc.c
+++ b/elf/dl-reloc.c
@@ -125,6 +125,8 @@ _dl_nothread_init_static_tls (struct link_map *map)
 
   /* Fill in the DTV slot so that a later LD/GD access will find it.  */
   dtv_t *dtv = THREAD_DTV ();
+  _dl_printf("modid=%u, counter=%u\n", map->l_tls_modid, dtv[-1].counter);
+  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;
 
diff --git a/libidn/ChangeLog b/libidn/ChangeLog
index daeb4bdef0..df3a6269e8 100644
--- a/libidn/ChangeLog
+++ b/libidn/ChangeLog
@@ -1,3 +1,14 @@
+2005-02-12  Simon Josefsson  <jas@extundo.com >
+
+	* iconvme.h: New file, extracted from toutf8.c but improved.
+	* iconvme.c: New file.
+	* toutf8.c: Include stringprep.h first, to make the compiler check
+	that stringprep.h is standalone.  Improve comments.  Replace
+	#include of errno.h and sys/param.h with iconvme.h.  Don't define
+	ICONV_CONST.
+	(stringprep_convert): Rewrite to use iconvme.h.
+	* Makefile (libcidn-routines): Add iconvme.
+
 2004-10-05  Ulrich Drepper  <drepper@redhat.com>
 
 	* idn-stub.c (unload_libidn): Don't define outside libc.
diff --git a/libidn/Makefile b/libidn/Makefile
index 8e8759bdcc..3d2ef5ef9b 100644
--- a/libidn/Makefile
+++ b/libidn/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -20,14 +20,15 @@
 
 subdir	:= libidn
 
-distribute := punycode.h stringprep.h idna.h
+distribute := punycode.h stringprep.h idna.h iconvme.h
 
 routines = idn-stub
 
 extra-libs		= libcidn
 extra-libs-others	= $(extra-libs)
 
-libcidn-routines := punycode toutf8 nfkc stringprep rfc3454 profiles idna
+libcidn-routines := punycode toutf8 nfkc stringprep rfc3454 profiles idna \
+		    iconvme
 
 
 include ../Makeconfig
diff --git a/sysdeps/generic/dl-tls.c b/sysdeps/generic/dl-tls.c
index 099742ceff..ee4acb5a64 100644
--- a/sysdeps/generic/dl-tls.c
+++ b/sysdeps/generic/dl-tls.c
@@ -49,7 +49,6 @@ oom (void)
 {
   _dl_fatal_printf ("cannot allocate memory for thread-local data: ABORT\n");
 }
-# endif
 
 
 
@@ -115,7 +114,6 @@ _dl_next_tls_modid (void)
   return result;
 }
 
-# ifdef SHARED
 
 void
 internal_function