This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] BZ #14545: Always check dtv before freeing dtv[-1]


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]