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.
This commit is contained in:
Ulrich Drepper 2005-02-22 03:51:38 +00:00
parent af272d4fa8
commit e13e33e279
7 changed files with 35 additions and 23 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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.

View File

@ -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

View File

@ -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