[PATCH] BZ #14545: Always check dtv before freeing dtv[-1]
Roland McGrath
roland@hack.frob.com
Thu Sep 6 19:43:00 GMT 2012
> diff --git a/csu/libc-tls.c b/csu/libc-tls.c
> index b00a5cc..eb9c502 100644
> --- a/csu/libc-tls.c
> +++ b/csu/libc-tls.c
> @@ -65,6 +65,8 @@ size_t _dl_tls_static_size = 2048;
> size_t _dl_tls_static_used;
> /* Alignment requirement of the static TLS block. */
> size_t _dl_tls_static_align;
> +/* Initial dtv of the main thread, not allocated with normal malloc. */
> +void *_dl_initial_dtv = &static_dtv[1];
Make this 'void *const' so it stays in .rodata.
Better yet, make static_dtv a global _dl_static_dtv and put:
#ifndef SHARED
# define _dl_initial_dtv ((void *) &_dl_static_dtv[1])
#endif
into ldsodefs.h so we don't waste a data word on this at all.
Thanks,
Roland
More information about the Libc-alpha
mailing list