diff options
Diffstat (limited to 'sysdeps/generic')
-rw-r--r-- | sysdeps/generic/dl-tls.c | 12 | ||||
-rw-r--r-- | sysdeps/generic/ldsodefs.h | 3 | ||||
-rw-r--r-- | sysdeps/generic/libc-tls.c | 13 |
3 files changed, 19 insertions, 9 deletions
diff --git a/sysdeps/generic/dl-tls.c b/sysdeps/generic/dl-tls.c index b92fecbe27..2c68a251b6 100644 --- a/sysdeps/generic/dl-tls.c +++ b/sysdeps/generic/dl-tls.c @@ -31,6 +31,10 @@ # include <dl-tls.h> # include <ldsodefs.h> +/* Amount of excess space to allocate in the static TLS area + to allow dynamic loading of modules defining IE-model TLS data. */ +# define TLS_STATIC_SURPLUS 64 + /* Value used for dtv entries for which the allocation is delayed. */ # define TLS_DTV_UNALLOCATED ((void *) -1l) @@ -150,7 +154,9 @@ _dl_determine_tlsoffset (void) // XXX would invalidate the offsets the linker creates for the LE // XXX model. - GL(dl_tls_static_size) = offset + TLS_TCB_SIZE; + GL(dl_tls_static_used) = offset; + GL(dl_tls_static_size) = roundup (offset + TLS_STATIC_SURPLUS + TLS_TCB_SIZE, + TLS_TCB_ALIGN); # elif TLS_DTV_AT_TP /* The TLS blocks start right after the TCB. */ offset = TLS_TCB_SIZE; @@ -186,7 +192,9 @@ _dl_determine_tlsoffset (void) offset += prev_size; } - GL(dl_tls_static_size) = offset; + GL(dl_tls_static_used) = offset; + GL(dl_tls_static_size) = roundup (offset + TLS_STATIC_SURPLUS, + TLS_TCB_ALIGN); # else # error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined" # endif diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index 92fe6191b9..8321b96b5f 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -326,9 +326,6 @@ struct rtld_global /* Number of additional slots in the dtv allocated. */ # define DTV_SURPLUS (14) -/* The value of _dl_tls_static_size is kept a multiple of this. */ -# define TLS_STATIC_MIN (1024) - /* Initial dtv of the main thread, not allocated with normal malloc. */ EXTERN void *_dl_initial_dtv; /* Generation counter for the dtv. */ diff --git a/sysdeps/generic/libc-tls.c b/sysdeps/generic/libc-tls.c index 64fe7c3ad7..26fd6e09c9 100644 --- a/sysdeps/generic/libc-tls.c +++ b/sysdeps/generic/libc-tls.c @@ -182,12 +182,17 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign) GL(dl_tls_max_dtv_idx) = 1; GL(dl_tls_dtv_slotinfo_list) = &static_slotinfo.si; - /* That is the size of the TLS memory for this object. */ - GL(dl_tls_static_size) = (roundup (memsz, align ?: 1) + memsz = roundup (memsz, align ?: 1); # if TLS_TCB_AT_TP - + tcbsize + memsz += tcbsize; # endif - ); + + /* That is the size of the TLS memory for this object. The initialized + value of _dl_tls_static_size is provided by dl-open.c to request some + surplus that permits dynamic loading of modules with IE-model TLS. */ + GL(dl_tls_static_size) = roundup (memsz + GL(dl_tls_static_size), + TLS_TCB_ALIGN); + GL(dl_tls_static_used) = memsz; /* The alignment requirement for the static TLS block. */ GL(dl_tls_static_align) = MAX (TLS_TCB_ALIGN, max_align); /* Number of elements in the static TLS block. */ |