* elf/dl-reloc.c (allocate_static_tls): Fix calculations.
authorRoland McGrath <roland@gnu.org>
Sat, 1 Mar 2003 22:32:04 +0000 (22:32 +0000)
committerRoland McGrath <roland@gnu.org>
Sat, 1 Mar 2003 22:32:04 +0000 (22:32 +0000)
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.

ChangeLog
elf/dl-reloc.c
stdlib/stdlib.h
sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h

index 024df1c..e35228f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
+2003-03-01  Roland McGrath  <roland@redhat.com>
+
+       * 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.
+
 2003-03-01  Andreas Schwab  <schwab@suse.de>
 
+       * resolv/Makefile (tests): Don't depend on
+       $(objpfx)mtrace-tst-leaks when cross compiling.
+
        * sysdeps/m68k/dl-machine.h (_dl_start_user): Access
        __libc_stack_end through GOT since it is a global symbol.
 
index 0443011..ad6c00c 100644 (file)
 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
 
index 6ab675f..87b559a 100644 (file)
@@ -410,7 +410,9 @@ extern char *l64a (long int __n) __THROW;
 /* Read a number from a string S in base 64 as above.  */
 extern long int a64l (__const char *__s) __THROW __attribute_pure__;
 
+#endif /* Use SVID || extended X/Open.  */
 
+#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED || defined __USE_BSD
 # include <sys/types.h>        /* we need int32_t... */
 
 /* These are the functions that actually do things.  The `random', `srandom',
@@ -463,7 +465,7 @@ extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
 extern int setstate_r (char *__restrict __statebuf,
                       struct random_data *__restrict __buf) __THROW;
 # endif        /* Use misc.  */
-#endif /* Use SVID || extended X/Open */
+#endif /* Use SVID || extended X/Open || BSD. */
 
 
 __BEGIN_NAMESPACE_STD
index 342fc65..98608c5 100644 (file)
@@ -45,7 +45,6 @@
 # define O_DIRECT      0400000 /* Direct disk access.  */
 # define O_DIRECTORY    040000 /* Must be a directory.  */
 # define O_NOFOLLOW    0100000 /* Do not follow links.  */
-# define O_DIRECT      0400000 /* Direct disk access.  */
 #endif
 
 #ifdef __USE_LARGEFILE64