summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.de>2000-05-17 11:04:21 +0000
committerAndreas Jaeger <aj@suse.de>2000-05-17 11:04:21 +0000
commite25054c49c92587a07de4badfe4b7e01ceb99858 (patch)
tree1ad481eff77aa0310a5b5c664917467b450bce6c
parent7626e16ceb26772b82ae4ef32e8e4b027cd79ed0 (diff)
Update.
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.
-rw-r--r--ChangeLog52
-rw-r--r--dirent/Makefile2
-rw-r--r--elf/cache.c36
-rw-r--r--manual/creature.texi5
-rw-r--r--posix/Makefile2
-rw-r--r--posix/tstgetopt.args2
-rw-r--r--stdlib/Makefile5
-rw-r--r--stdlib/test-canon.c12
-rw-r--r--sysdeps/generic/dl-cache.c26
-rw-r--r--sysdeps/generic/dl-cache.h20
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/dl-cache.h4
-rw-r--r--time/Makefile1
-rw-r--r--time/test_time.args2
13 files changed, 127 insertions, 42 deletions
diff --git a/ChangeLog b/ChangeLog
index 7e553e0593..1cf6b1ec3a 100644
--- 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
diff --git a/dirent/Makefile b/dirent/Makefile
index 6040a3a744..fcd6dcdcc4 100644
--- a/dirent/Makefile
+++ b/dirent/Makefile
@@ -32,4 +32,4 @@ tests := list tst-seekdir opendir-tst1
include ../Rules
-opendir-tst1.args = --test-dir=${objdir}
+opendir-tst1-ARGS = --test-dir=${objdir}
diff --git a/elf/cache.c b/elf/cache.c
index fbbc426268..08cb5f373b 100644
--- a/elf/cache.c
+++ b/elf/cache.c
@@ -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"));
diff --git a/manual/creature.texi b/manual/creature.texi
index f0cd093afa..5247d7192d 100644
--- a/manual/creature.texi
+++ b/manual/creature.texi
@@ -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)
diff --git a/posix/Makefile b/posix/Makefile
index 509cc7033d..eb48d1c422 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -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
index c82c86560e..0000000000
--- a/posix/tstgetopt.args
+++ /dev/null
@@ -1,2 +0,0 @@
--a -b -cfoobar --required foobar --optional=bazbug --none random
-
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 29adea4425..2427e617fc 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -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
diff --git a/stdlib/test-canon.c b/stdlib/test-canon.c
index c8be8d2d96..2ece136435 100644
--- a/stdlib/test-canon.c
+++ b/stdlib/test-canon.c
@@ -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>.
@@ -28,6 +28,10 @@
#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.");
diff --git a/sysdeps/generic/dl-cache.c b/sysdeps/generic/dl-cache.c
index 28fab0b19e..85db10e06c 100644
--- a/sysdeps/generic/dl-cache.c
+++ b/sysdeps/generic/dl-cache.c
@@ -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)
diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h
index 4eb64cf557..197638b09d 100644
--- a/sysdeps/generic/dl-cache.h
+++ b/sysdeps/generic/dl-cache.h
@@ -17,11 +17,14 @@
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"
@@ -32,12 +35,14 @@
/* 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)
{
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/dl-cache.h b/sysdeps/unix/sysv/linux/sparc/sparc64/dl-cache.h
index 2d074ffa9c..eb9c040429 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/dl-cache.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/dl-cache.h
@@ -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>
diff --git a/time/Makefile b/time/Makefile
index baa26e9bf3..ff1e42eae2 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -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
index d84cd1c066..0000000000
--- a/time/test_time.args
+++ /dev/null
@@ -1,2 +0,0 @@
-EST5EDT
-CST