]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorAndreas Jaeger <aj@suse.de>
Wed, 17 May 2000 11:04:21 +0000 (11:04 +0000)
committerAndreas Jaeger <aj@suse.de>
Wed, 17 May 2000 11:04:21 +0000 (11:04 +0000)
2000-05-17  Jakub Jelinek  <jakub@redhat.com>

* sysdeps/generic/dl-cache.h (_DL_CACHE_DEFAULT_ID): Only define if
not yet defined.
(_dl_cache_check_flags): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/dl-cache.h: include_next
dl-cache.h.

2000-05-17  Andreas Jaeger  <aj@suse.de>

* manual/creature.texi (Feature Test Macros): Remove paragraph
since the description is wrong.
Closes PR libc/1691, reported by Geoff Clare <gwc@unisoft.com>.

2000-05-17  Andreas Jaeger  <aj@suse.de>

* time/test_time.args: Removed.
* time/Makefile (test_time-ARGS): Added contents here instead.

* posix/tstgetopt.args: Removed.
* posix/Makefile (tstgetopt-ARGS): Added contents here instead.

* Rules: Allow arguments for test files to be specified in
Makefile with testname-ARGS; remove rules with .args in it.

* dirent/Makefile (opendir-tst1-ARGS): Use this for opendir-tst1,
remove old bogus rule for opendir-tst1.args.

* stdlib/test-canon.c: Rewrite to use test-skeleton.c.

* stdlib/Makefile (test-canon-ARGS): New, supply argument to chdir
into objdir.  This allows a readonly sourcetree.
Reported by lrgallardo@yahoo.com, closes PR libc/1421.

2000-05-16  Andreas Jaeger  <aj@suse.de>,
            David Huggins-Daines <dhd@linuxcare.com>

* sysdeps/generic/dl-cache.c (_dl_load_cache_lookup): Set
cache_data in case of only new cache format correctly.

* sysdeps/generic/dl-cache.c (_dl_load_cache_lookup): Align struct
cache_file_new.

* sysdeps/generic/dl-cache.h (ALIGN_CACHE): New macro to align
struct cache_file_new.

* elf/cache.c (save_cache): Fix str_offset if only new cache is
present.

* elf/cache.c (save_cache): Align struct new_file_cache.
(print_cache): Likewise.

13 files changed:
ChangeLog
dirent/Makefile
elf/cache.c
manual/creature.texi
posix/Makefile
posix/tstgetopt.args [deleted file]
stdlib/Makefile
stdlib/test-canon.c
sysdeps/generic/dl-cache.c
sysdeps/generic/dl-cache.h
sysdeps/unix/sysv/linux/sparc/sparc64/dl-cache.h
time/Makefile
time/test_time.args [deleted file]

index 7e553e05930e604bcaf8e8fea9aa85b67bafd9be..1cf6b1ec3a7eb291aae9ee450712bfc6916cf65b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,61 @@
+2000-05-17  Jakub Jelinek  <jakub@redhat.com>
+
+       * sysdeps/generic/dl-cache.h (_DL_CACHE_DEFAULT_ID): Only define if
+       not yet defined.
+       (_dl_cache_check_flags): Likewise.
+       * sysdeps/unix/sysv/linux/sparc/sparc64/dl-cache.h: include_next
+       dl-cache.h.
+
+2000-05-17  Andreas Jaeger  <aj@suse.de>
+
+       * manual/creature.texi (Feature Test Macros): Remove paragraph
+       since the description is wrong.
+       Closes PR libc/1691, reported by Geoff Clare <gwc@unisoft.com>.
+
 2000-05-17  Andreas Jaeger  <aj@suse.de>
 
        * scripts/config.sub: New version.
        * scripts/config.guess: Likewise.
        * manual/texinfo.tex: Likewise.
 
+2000-05-17  Andreas Jaeger  <aj@suse.de>
+
+       * time/test_time.args: Removed.
+       * time/Makefile (test_time-ARGS): Added contents here instead.
+
+       * posix/tstgetopt.args: Removed.
+       * posix/Makefile (tstgetopt-ARGS): Added contents here instead.
+
+       * Rules: Allow arguments for test files to be specified in
+       Makefile with testname-ARGS; remove rules with .args in it.
+
+       * dirent/Makefile (opendir-tst1-ARGS): Use this for opendir-tst1,
+       remove old bogus rule for opendir-tst1.args.
+
+       * stdlib/test-canon.c: Rewrite to use test-skeleton.c.
+
+       * stdlib/Makefile (test-canon-ARGS): New, supply argument to chdir
+       into objdir.  This allows a readonly sourcetree.
+       Reported by lrgallardo@yahoo.com, closes PR libc/1421.
+
+2000-05-16  Andreas Jaeger  <aj@suse.de>,
+            David Huggins-Daines <dhd@linuxcare.com>
+
+       * sysdeps/generic/dl-cache.c (_dl_load_cache_lookup): Set
+       cache_data in case of only new cache format correctly.
+
+       * sysdeps/generic/dl-cache.c (_dl_load_cache_lookup): Align struct
+       cache_file_new.
+
+       * sysdeps/generic/dl-cache.h (ALIGN_CACHE): New macro to align
+       struct cache_file_new.
+
+       * elf/cache.c (save_cache): Fix str_offset if only new cache is
+       present.
+
+       * elf/cache.c (save_cache): Align struct new_file_cache.
+       (print_cache): Likewise.
+
 2000-05-13  Jakub Jelinek  <jakub@redhat.com>
 
        * elf/soinit.c (__libc_global_ctors): Move
index 6040a3a744cae89a6f563abb8e57f1e7b74c5960..fcd6dcdcc493516a9bc49bffb450c040f31d6481 100644 (file)
@@ -32,4 +32,4 @@ tests    := list tst-seekdir opendir-tst1
 
 include ../Rules
 
-opendir-tst1.args = --test-dir=${objdir}
+opendir-tst1-ARGS = --test-dir=${objdir}
index fbbc4262683ed0a4d7e2b0bd019084d9da66894e..08cb5f373bb9135022f5b9bc2ddfaf0ddd666379 100644 (file)
@@ -49,7 +49,6 @@ static struct cache_entry *entries;
 static const char *flag_descr[] =
 { "libc4", "ELF", "libc5", "libc6"};
 
-
 /* Print a single entry.  */
 static void
 print_entry (const char *lib, int flag, unsigned long int hwcap, const char *key)
@@ -130,25 +129,29 @@ print_cache (const char *cache_name)
        error (EXIT_FAILURE, 0, _("File is not a cache file.\n"));
       format = 1;
       /* This is where the strings start.  */
-      cache_data = (const char *) cache;
+      cache_data = (const char *) cache_new;
     }
   else
     {
+      size_t offset = ALIGN_CACHE (sizeof (struct cache_file)
+                                  + cache->nlibs * sizeof (struct file_entry));
       /* This is where the strings start.  */
       cache_data = (const char *) &cache->libs[cache->nlibs];
 
       /* Check for a new cache embedded in the old format.  */
       if (cache_size >
-         (sizeof (struct cache_file)
-          + cache->nlibs * sizeof (struct file_entry)
-          + sizeof (struct cache_file_new)))
+         (offset + sizeof (struct cache_file_new)))
        {
-         cache_new = (struct cache_file_new *) cache_data;
+
+         cache_new = (struct cache_file_new *) ((void *)cache + offset);
 
          if (!memcmp (cache_new->magic, CACHEMAGIC_NEW, sizeof CACHEMAGIC_NEW - 1)
              && !memcmp (cache_new->version, CACHE_VERSION,
                          sizeof CACHE_VERSION - 1))
-           format = 1;
+           {
+             cache_data = (const char *) cache_new;
+             format = 1;
+           }
        }
     }
 
@@ -230,6 +233,8 @@ save_cache (const char *cache_name)
   int cache_entry_count = 0;
   /* Number of normal cache entries.  */
   int cache_entry_old_count = 0;
+  /* Pad for alignment of cache_file_new.  */
+  size_t pad;
 
   /* The cache entries are sorted already, save them in this order. */
 
@@ -280,11 +285,13 @@ save_cache (const char *cache_name)
       file_entries_new->nlibs = cache_entry_count;
       file_entries_new->len_strings = total_strlen;
     }
-
+  
+  pad = ALIGN_CACHE (file_entries_size) - file_entries_size;
+  
   /* If we have both formats, we hide the new format in the strings
      table, we have to adjust all string indices for this so that
      old libc5/glibc 2 dynamic linkers just ignore them.  */
-  if (opt_format == 1)
+  if (opt_format != 0)
     str_offset = file_entries_new_size;
   else
     str_offset = 0;
@@ -298,7 +305,7 @@ save_cache (const char *cache_name)
        {
          file_entries->libs[idx_old].flags = entry->flags;
          /* XXX: Actually we can optimize here and remove duplicates.  */
-         file_entries->libs[idx_old].key = str_offset;
+         file_entries->libs[idx_old].key = str_offset + pad;
        }
       if (opt_format != 0)
        {
@@ -317,7 +324,7 @@ save_cache (const char *cache_name)
       str_offset += len + 1;
       /* Then the path.  */
       if (opt_format != 2)
-       file_entries->libs[idx_old].value = str_offset;
+       file_entries->libs[idx_old].value = str_offset + pad;
       if (opt_format != 0)
        file_entries_new->libs[idx_new].value = str_offset;
       len = strlen (entry->path);
@@ -354,6 +361,13 @@ save_cache (const char *cache_name)
     }
   if (opt_format != 0)
     {
+      /* Align cache.  */
+      if (opt_format != 2)
+       {
+         char zero [pad];
+         if (write (fd, zero, pad) != (ssize_t)pad)
+           error (EXIT_FAILURE, errno, _("Writing of cache data failed"));
+       }
       if (write (fd, file_entries_new, file_entries_new_size)
          != (ssize_t)file_entries_new_size)
        error (EXIT_FAILURE, errno, _("Writing of cache data failed"));
index f0cd093afa03a609a441b75b76c6447fb66328a6..5247d7192d2014979d691c40b16d50f8691cdd14 100644 (file)
@@ -70,11 +70,6 @@ The 1996 edition of POSIX.1 (ISO/IEC 9945-1: 1996) states that
 if you define @code{_POSIX_C_SOURCE} to a value greater than
 or equal to @code{199506L}, then the functionality from the 1996
 edition is made available.
-
-The Single Unix Specification specify that setting this macro to the
-value @code{199506L} selects all the values specified by the POSIX
-standards plus those of the Single Unix Specification, i.e., is the
-same as if @code{_XOPEN_SOURCE} is set to @code{500} (see below).
 @end defvr
 
 @comment (none)
index 509cc7033d2c71b35f5a2b5eb5baeefc3b0577b7..eb48d1c422058f2516c285c24e051bdfe714b8b2 100644 (file)
@@ -101,6 +101,8 @@ endif
 
 CFLAGS-regex.c = -Wno-strict-prototypes
 CFLAGS-getaddrinfo.c = -DRESOLVER
+tstgetopt-ARGS = -a -b -cfoobar --required foobar --optional=bazbug \
+               --none random
 
 $(objpfx)libposix.a: $(dep-dummy-lib); $(make-dummy-lib)
 lib: $(objpfx)libposix.a
diff --git a/posix/tstgetopt.args b/posix/tstgetopt.args
deleted file mode 100644 (file)
index c82c865..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
--a -b -cfoobar --required foobar --optional=bazbug --none random
-
index 29adea442540da2845ed973239b29dc4b79666d0..2427e617fc67d9e5e2b12d2f849c9dd42366b1ec 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 1991,92,93,94,95,96,97,98,99 Free Software Foundation, Inc.
+# Copyright (C) 1991,92,93,94,95,96,97,98,99,2000 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -126,6 +126,9 @@ clean-mpn:
 
 endif
 
+# Testdir has to be named stdlib and needs to be writable
+test-canon-ARGS = --test-dir=${objdir}/stdlib
+
 # Run a test on the header files we use.
 tests: $(objpfx)isomac
        $(dir $<)$(notdir $<) '$(CC)' '-I../include -I.. $(+sysdep-includes)' > $<.out
index c8be8d2d962172263844d3b6975b45363c858f2e..2ece136435898606a9ea63aa505e61e23d2f361f 100644 (file)
@@ -1,5 +1,5 @@
 /* Test program for returning the canonical absolute name of a given file.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by David Mosberger <davidm@azstarnet.com>.
 
 #include <unistd.h>
 #include <sys/param.h>
 
+/* Prototype for our test function.  */
+extern int do_test (int argc, char *argv[]);
+#include <test-skeleton.c>
+
 #ifndef PATH_MAX
 # define PATH_MAX 4096
 #endif
@@ -55,7 +59,7 @@ struct {
   {"/////////////////////////////////",        "/"},
   {"/.././.././.././..///",            "/"},
   {"/etc",                             "/etc"},
-  {"/etc/../etc",                      "/etc"},
+  {"/etc/../etc",                      "/etc"},
   /*  5 */
   {"/doesNotExist/../etc",             0, "/doesNotExist", ENOENT},
   {"./././././././././.",              "."},
@@ -111,7 +115,7 @@ check_path (const char * result, const char * expected)
 
 
 int
-main (int argc, char ** argv)
+do_test (int argc, char ** argv)
 {
   char * result;
   int fd, i, errors = 0;
@@ -198,7 +202,7 @@ main (int argc, char ** argv)
   if (errors != 0)
     {
       printf ("%d errors.\n", errors);
-      exit (EXIT_FAILURE);
+      return EXIT_FAILURE;
     }
 
   puts ("No errors.");
index 28fab0b19ed56c16909b76529f9015545eda49cb..85db10e06cb3d62ad078d00ff108b30cab8e56a6 100644 (file)
@@ -52,7 +52,7 @@ do                                                                      \
     right = cache->nlibs - 1;                                            \
     middle = (left + right) / 2;                                         \
     cmpres = 1;                                                                  \
-                                                                         \
+                                                                         \
     while (left <= right)                                                \
       {                                                                          \
        /* Make sure string table indices are not bogus before using      \
@@ -121,7 +121,7 @@ do                                                                    \
                  {                                                       \
                    HWCAP_CHECK;                                          \
                    best = cache_data + cache->libs[middle].value;        \
-                                                                         \
+                                                                         \
                    if (flags == _dl_correct_cache_id)                    \
                      /* We've found an exact match for the shared        \
                         object and no general `ELF' release.  Stop       \
@@ -166,14 +166,16 @@ _dl_load_cache_lookup (const char *name)
       if (file && cachesize > sizeof *cache &&
          !memcmp (file, CACHEMAGIC, sizeof CACHEMAGIC - 1))
        {
+         size_t offset;
          /* Looks ok.  */
          cache = file;
 
          /* Check for new version.  */
-         cache_new = (struct cache_file_new *) &cache->libs[cache->nlibs];
-         if (cachesize <
-             (sizeof (struct cache_file) + cache->nlibs * sizeof (struct file_entry)
-              + sizeof (struct cache_file_new))
+         offset = ALIGN_CACHE (sizeof (struct cache_file)
+                               + cache->nlibs * sizeof (struct file_entry));
+
+         cache_new = (struct cache_file_new *) ((void *)cache + offset);
+         if (cachesize < (offset + sizeof (struct cache_file_new))
              || memcmp (cache_new->magic, CACHEMAGIC_NEW,
                          sizeof CACHEMAGIC_NEW - 1)
              || memcmp (cache_new->version, CACHE_VERSION,
@@ -202,9 +204,6 @@ _dl_load_cache_lookup (const char *name)
     /* Previously looked for the cache file and didn't find it.  */
     return NULL;
 
-  /* This is where the strings start.  */
-  cache_data = (const char *) &cache->libs[cache->nlibs];
-
   best = NULL;
 
   if (cache_new != (void *) -1)
@@ -213,6 +212,9 @@ _dl_load_cache_lookup (const char *name)
       unsigned long int *hwcap;
       weak_extern (_dl_hwcap);
 
+      /* This is where the strings start.  */
+      cache_data = (const char *) cache_new;
+
       hwcap = &_dl_hwcap;
 
 #define HWCAP_CHECK                                                         \
@@ -221,9 +223,13 @@ _dl_load_cache_lookup (const char *name)
       SEARCH_CACHE (cache_new);
     }
   else
+    {
+      /* This is where the strings start.  */
+      cache_data = (const char *) &cache->libs[cache->nlibs];
 #undef HWCAP_CHECK
 #define HWCAP_CHECK do {} while (0)
-    SEARCH_CACHE (cache);
+      SEARCH_CACHE (cache);
+    }
 
   /* Print our result if wanted.  */
   if (_dl_debug_libs && best != NULL)
index 4eb64cf5576725676a1495651427609daa6f788b..197638b09d3ff01e380421ea6cbadc5fe2323765 100644 (file)
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#define _DL_CACHE_DEFAULT_ID   3
+#ifndef _DL_CACHE_DEFAULT_ID
+# define _DL_CACHE_DEFAULT_ID  3
+#endif
 
-#define _dl_cache_check_flags(flags)                   \
+#ifndef _dl_cache_check_flags
+# define _dl_cache_check_flags(flags)                  \
   ((flags) == 1 || (flags) == _DL_CACHE_DEFAULT_ID)
-
+#endif
 
 #ifndef LD_SO_CACHE
 # define LD_SO_CACHE "/etc/ld.so.cache"
 /* libc5 and glibc 2.0/2.1 use the same format.  For glibc 2.2 another
    format has been added in a compatible way:
    The beginning of the string table is used for the new table:
-       old_magic
+       old_magic
        nlibs
        libs[0]
        ...
        libs[nlibs-1]
-       new magic
+       pad, new magic needs to be aligned
+            - this is string[0] for the old format
+       new magic - this is string[0] for the new format
        newnlibs
        ...
        newlibs[0]
@@ -82,6 +87,11 @@ struct cache_file_new
   /* After this the string table of size len_strings is found.  */
 };
 
+/* Used to align cache_file_new.  */
+#define ALIGN_CACHE(addr)                              \
+(((addr) + __alignof__ (struct cache_file_new) -1)     \
+ & (~(__alignof__ (struct cache_file_new) - 1)))
+
 static int
 _dl_cache_libcmp (const char *p1, const char *p2)
 {
index 2d074ffa9c248d050defb2f155db203147472852..eb9c04042923411ce5aed0e324dfa89b30ffc5f0 100644 (file)
@@ -1,5 +1,5 @@
 /* Support for reading /etc/ld.so.cache files written by Linux ldconfig.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -21,3 +21,5 @@
 
 #define _dl_cache_check_flags(flags)                   \
   ((flags) == _DL_CACHE_DEFAULT_ID)
+
+#include_next <dl-cache.h>
index baa26e9bf3b948945e46172c8cbc5670ae709c6d..ff1e42eae22abd83daf7225a26121c9772755b0f 100644 (file)
@@ -46,3 +46,4 @@ CFLAGS-tzset.c = $(tz-cflags)
 CFLAGS-test_time.c = -Wno-format
 
 tst-getdate-ENV= DATEMSK=datemsk
+test_time-ARGS= EST5EDT CST
diff --git a/time/test_time.args b/time/test_time.args
deleted file mode 100644 (file)
index d84cd1c..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-EST5EDT
-CST