1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00

* Makerules (cpp-srcs-left): When setting this to run

cppflags-iterator.mk, must append .c to $(tests) and $(xtests)
	words.  Combine the two loops into one on the concatenated list,
	including those as well as $(test-srcs).

	* elf/dl-minimal.c (__libc_memalign): Guts of malloc moved here,
	since we align here with optimally minimal waste anyway.
	(malloc): Just call that.

	* sysdeps/generic/libc-tls.c (__libc_setup_tls): Set l_tls_offset to
	the right variable.

	* elf/dl-load.c (_dl_map_object_from_fd): Use p_vaddr, not p_offset,
	to compute memory location for l_tls_initimage.
	* elf/rtld.c (_dl_start): Likewise.
	* sysdeps/generic/libc-tls.c (__libc_setup_tls): Likewise.

	* libio/oldiopopen.c: Move #include's before #if SHLIB_COMPAT,
	because the .d file is generated in the non-shared case and
	so fails to catch them otherwise.

	* sysdeps/generic/dl-tls.c (_dl_allocate_tls_storage): New function,
	split out of _dl_allocate_tls.
	(_dl_allocate_tls_init): Likewise.
	(_dl_allocate_tls): Call those.
	* sysdeps/generic/ldsodefs.h: Declare them with attribute_hidden.
	* elf/rtld.c (dl_main): Call them separately instead of calling
	_dl_allocate_tls.  Delay _dl_allocate_tls_init until after relocation
	is finished, so that the initializer data has been relocated before we
	copy it into the main thread's TLS block.

	* sysdeps/generic/dl-tls.c (_dl_allocate_tls): Fix off-by-one error in
	loop conditions, prevented the last used module from being initialized.
This commit is contained in:
Roland McGrath
2002-08-05 01:21:25 +00:00
parent 581dc54b74
commit a816b435dd
8 changed files with 83 additions and 35 deletions

View File

@ -191,7 +191,7 @@ _dl_start (void *arg)
assert (bootstrap_map.l_tls_blocksize != 0);
bootstrap_map.l_tls_initimage_size = phdr[cnt].p_filesz;
bootstrap_map.l_tls_initimage = (void *) (bootstrap_map.l_addr
+ phdr[cnt].p_offset);
+ phdr[cnt].p_vaddr);
/* We can now allocate the initial TLS block. This can happen
on the stack. We'll get the final memory later when we
@ -1087,13 +1087,10 @@ of this helper program; chances are you did not intend to run this program.\n\
for the thread descriptor. The memory for the TLS block will
never be freed. It should be allocated accordingly. The dtv
array can be changed if dynamic loading requires it. */
tcbp = INTUSE(_dl_allocate_tls) ();
tcbp = _dl_allocate_tls_storage ();
if (tcbp == NULL)
_dl_fatal_printf ("\
cannot allocate TLS data structures for initial thread");
/* And finally install it for the main thread. */
TLS_INIT_TP (tcbp);
}
#endif
@ -1445,6 +1442,21 @@ cannot allocate TLS data structures for initial thread");
we need it in the memory handling later. */
GL(dl_initial_searchlist) = *GL(dl_main_searchlist);
#ifdef USE_TLS
# ifndef SHARED
if (GL(dl_tls_max_dtv_idx) > 0)
# endif
{
/* Now that we have completed relocation, the initializer data
for the TLS blocks has its final values and we can copy them
into the main thread's TLS area, which we allocated above. */
_dl_allocate_tls_init (tcbp);
/* And finally install it for the main thread. */
TLS_INIT_TP (tcbp);
}
#endif
{
/* Initialize _r_debug. */
struct r_debug *r = _dl_debug_initialize (GL(dl_rtld_map).l_addr);