aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-reloc.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2003-03-01 22:32:04 +0000
committerRoland McGrath <roland@gnu.org>2003-03-01 22:32:04 +0000
commit7ed33cba81fdcef882edda1c9a9a12397dcc3616 (patch)
treea8befa34016aa235ea3cdb7f168c200f083bfa25 /elf/dl-reloc.c
parentf88658e9b9f14f856ef41021eadfd3bb13db3297 (diff)
downloadglibc-7ed33cba81fdcef882edda1c9a9a12397dcc3616.zip
glibc-7ed33cba81fdcef882edda1c9a9a12397dcc3616.tar.gz
glibc-7ed33cba81fdcef882edda1c9a9a12397dcc3616.tar.bz2
* elf/dl-reloc.c (allocate_static_tls): Fix calculations.
From Jakub Jelinek <jakub@redhat.com>. * sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h: Revert last change, which duplicated the O_DIRECT defn. 2003-03-01 GOTO Masanori <gotom@debian.or.jp> * stdlib/stdlib.h: Add missing __USE_BSD enclosure for BSD derived random functions. * resolv/Makefile (tests): Don't depend on $(objpfx)mtrace-tst-leaks when cross compiling.
Diffstat (limited to 'elf/dl-reloc.c')
-rw-r--r--elf/dl-reloc.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
index 0443011..ad6c00c 100644
--- a/elf/dl-reloc.c
+++ b/elf/dl-reloc.c
@@ -44,23 +44,31 @@
static void __attribute_noinline__
allocate_static_tls (struct link_map *map)
{
- size_t offset = roundup (GL(dl_tls_static_used), map->l_tls_align);
- if (offset + map->l_tls_blocksize
+ size_t offset, used, check;
+
# if TLS_TCB_AT_TP
- + TLS_TCB_SIZE
+ offset = roundup (GL(dl_tls_static_used) + map->l_tls_blocksize,
+ map->l_tls_align);
+ used = offset;
+ check = offset + TLS_TCB_SIZE;
# elif TLS_DTV_AT_TP
+ offset = roundup (GL(dl_tls_static_used), map->l_tls_align);
+ used = offset + map->l_tls_blocksize;
+ check = used;
/* dl_tls_static_used includes the TCB at the beginning. */
# else
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
# endif
- > GL(dl_tls_static_size))
+
+ if (check > GL(dl_tls_static_size))
{
const char *errstring = N_("\
shared object cannot be dlopen()ed: static TLS memory too small");
INTUSE(_dl_signal_error) (0, (map)->l_name, NULL, errstring);
}
+
map->l_tls_offset = offset;
- GL(dl_tls_static_used) = offset + map->l_tls_blocksize;
+ GL(dl_tls_static_used) = used;
}
#endif