1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00
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.
This commit is contained in:
Andreas Jaeger
2000-05-17 11:04:21 +00:00
parent 7626e16ceb
commit e25054c49c
13 changed files with 127 additions and 42 deletions

View File

@ -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> 2000-05-17 Andreas Jaeger <aj@suse.de>
* scripts/config.sub: New version. * scripts/config.sub: New version.
* scripts/config.guess: Likewise. * scripts/config.guess: Likewise.
* manual/texinfo.tex: 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> 2000-05-13 Jakub Jelinek <jakub@redhat.com>
* elf/soinit.c (__libc_global_ctors): Move * elf/soinit.c (__libc_global_ctors): Move

View File

@ -32,4 +32,4 @@ tests := list tst-seekdir opendir-tst1
include ../Rules include ../Rules
opendir-tst1.args = --test-dir=${objdir} opendir-tst1-ARGS = --test-dir=${objdir}

View File

@ -49,7 +49,6 @@ static struct cache_entry *entries;
static const char *flag_descr[] = static const char *flag_descr[] =
{ "libc4", "ELF", "libc5", "libc6"}; { "libc4", "ELF", "libc5", "libc6"};
/* Print a single entry. */ /* Print a single entry. */
static void static void
print_entry (const char *lib, int flag, unsigned long int hwcap, const char *key) 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")); error (EXIT_FAILURE, 0, _("File is not a cache file.\n"));
format = 1; format = 1;
/* This is where the strings start. */ /* This is where the strings start. */
cache_data = (const char *) cache; cache_data = (const char *) cache_new;
} }
else else
{ {
size_t offset = ALIGN_CACHE (sizeof (struct cache_file)
+ cache->nlibs * sizeof (struct file_entry));
/* This is where the strings start. */ /* This is where the strings start. */
cache_data = (const char *) &cache->libs[cache->nlibs]; cache_data = (const char *) &cache->libs[cache->nlibs];
/* Check for a new cache embedded in the old format. */ /* Check for a new cache embedded in the old format. */
if (cache_size > if (cache_size >
(sizeof (struct cache_file) (offset + sizeof (struct cache_file_new)))
+ cache->nlibs * sizeof (struct file_entry)
+ 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) if (!memcmp (cache_new->magic, CACHEMAGIC_NEW, sizeof CACHEMAGIC_NEW - 1)
&& !memcmp (cache_new->version, CACHE_VERSION, && !memcmp (cache_new->version, CACHE_VERSION,
sizeof CACHE_VERSION - 1)) 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; int cache_entry_count = 0;
/* Number of normal cache entries. */ /* Number of normal cache entries. */
int cache_entry_old_count = 0; 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. */ /* 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->nlibs = cache_entry_count;
file_entries_new->len_strings = total_strlen; 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 /* 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 table, we have to adjust all string indices for this so that
old libc5/glibc 2 dynamic linkers just ignore them. */ old libc5/glibc 2 dynamic linkers just ignore them. */
if (opt_format == 1) if (opt_format != 0)
str_offset = file_entries_new_size; str_offset = file_entries_new_size;
else else
str_offset = 0; str_offset = 0;
@ -298,7 +305,7 @@ save_cache (const char *cache_name)
{ {
file_entries->libs[idx_old].flags = entry->flags; file_entries->libs[idx_old].flags = entry->flags;
/* XXX: Actually we can optimize here and remove duplicates. */ /* 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) if (opt_format != 0)
{ {
@ -317,7 +324,7 @@ save_cache (const char *cache_name)
str_offset += len + 1; str_offset += len + 1;
/* Then the path. */ /* Then the path. */
if (opt_format != 2) 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) if (opt_format != 0)
file_entries_new->libs[idx_new].value = str_offset; file_entries_new->libs[idx_new].value = str_offset;
len = strlen (entry->path); len = strlen (entry->path);
@ -354,6 +361,13 @@ save_cache (const char *cache_name)
} }
if (opt_format != 0) 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) if (write (fd, file_entries_new, file_entries_new_size)
!= (ssize_t)file_entries_new_size) != (ssize_t)file_entries_new_size)
error (EXIT_FAILURE, errno, _("Writing of cache data failed")); error (EXIT_FAILURE, errno, _("Writing of cache data failed"));

View 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 if you define @code{_POSIX_C_SOURCE} to a value greater than
or equal to @code{199506L}, then the functionality from the 1996 or equal to @code{199506L}, then the functionality from the 1996
edition is made available. 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 @end defvr
@comment (none) @comment (none)

View File

@ -101,6 +101,8 @@ endif
CFLAGS-regex.c = -Wno-strict-prototypes CFLAGS-regex.c = -Wno-strict-prototypes
CFLAGS-getaddrinfo.c = -DRESOLVER CFLAGS-getaddrinfo.c = -DRESOLVER
tstgetopt-ARGS = -a -b -cfoobar --required foobar --optional=bazbug \
--none random
$(objpfx)libposix.a: $(dep-dummy-lib); $(make-dummy-lib) $(objpfx)libposix.a: $(dep-dummy-lib); $(make-dummy-lib)
lib: $(objpfx)libposix.a lib: $(objpfx)libposix.a

View File

@ -1,2 +0,0 @@
-a -b -cfoobar --required foobar --optional=bazbug --none random

View 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. # This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or # The GNU C Library is free software; you can redistribute it and/or
@ -126,6 +126,9 @@ clean-mpn:
endif 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. # Run a test on the header files we use.
tests: $(objpfx)isomac tests: $(objpfx)isomac
$(dir $<)$(notdir $<) '$(CC)' '-I../include -I.. $(+sysdep-includes)' > $<.out $(dir $<)$(notdir $<) '$(CC)' '-I../include -I.. $(+sysdep-includes)' > $<.out

View File

@ -1,5 +1,5 @@
/* Test program for returning the canonical absolute name of a given file. /* 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. This file is part of the GNU C Library.
Contributed by David Mosberger <davidm@azstarnet.com>. Contributed by David Mosberger <davidm@azstarnet.com>.
@ -28,6 +28,10 @@
#include <unistd.h> #include <unistd.h>
#include <sys/param.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 #ifndef PATH_MAX
# define PATH_MAX 4096 # define PATH_MAX 4096
#endif #endif
@ -55,7 +59,7 @@ struct {
{"/////////////////////////////////", "/"}, {"/////////////////////////////////", "/"},
{"/.././.././.././..///", "/"}, {"/.././.././.././..///", "/"},
{"/etc", "/etc"}, {"/etc", "/etc"},
{"/etc/../etc", "/etc"}, {"/etc/../etc", "/etc"},
/* 5 */ /* 5 */
{"/doesNotExist/../etc", 0, "/doesNotExist", ENOENT}, {"/doesNotExist/../etc", 0, "/doesNotExist", ENOENT},
{"./././././././././.", "."}, {"./././././././././.", "."},
@ -111,7 +115,7 @@ check_path (const char * result, const char * expected)
int int
main (int argc, char ** argv) do_test (int argc, char ** argv)
{ {
char * result; char * result;
int fd, i, errors = 0; int fd, i, errors = 0;
@ -198,7 +202,7 @@ main (int argc, char ** argv)
if (errors != 0) if (errors != 0)
{ {
printf ("%d errors.\n", errors); printf ("%d errors.\n", errors);
exit (EXIT_FAILURE); return EXIT_FAILURE;
} }
puts ("No errors."); puts ("No errors.");

View File

@ -52,7 +52,7 @@ do \
right = cache->nlibs - 1; \ right = cache->nlibs - 1; \
middle = (left + right) / 2; \ middle = (left + right) / 2; \
cmpres = 1; \ cmpres = 1; \
\ \
while (left <= right) \ while (left <= right) \
{ \ { \
/* Make sure string table indices are not bogus before using \ /* Make sure string table indices are not bogus before using \
@ -121,7 +121,7 @@ do \
{ \ { \
HWCAP_CHECK; \ HWCAP_CHECK; \
best = cache_data + cache->libs[middle].value; \ best = cache_data + cache->libs[middle].value; \
\ \
if (flags == _dl_correct_cache_id) \ if (flags == _dl_correct_cache_id) \
/* We've found an exact match for the shared \ /* We've found an exact match for the shared \
object and no general `ELF' release. Stop \ object and no general `ELF' release. Stop \
@ -166,14 +166,16 @@ _dl_load_cache_lookup (const char *name)
if (file && cachesize > sizeof *cache && if (file && cachesize > sizeof *cache &&
!memcmp (file, CACHEMAGIC, sizeof CACHEMAGIC - 1)) !memcmp (file, CACHEMAGIC, sizeof CACHEMAGIC - 1))
{ {
size_t offset;
/* Looks ok. */ /* Looks ok. */
cache = file; cache = file;
/* Check for new version. */ /* Check for new version. */
cache_new = (struct cache_file_new *) &cache->libs[cache->nlibs]; offset = ALIGN_CACHE (sizeof (struct cache_file)
if (cachesize < + cache->nlibs * sizeof (struct file_entry));
(sizeof (struct cache_file) + cache->nlibs * sizeof (struct file_entry)
+ sizeof (struct cache_file_new)) cache_new = (struct cache_file_new *) ((void *)cache + offset);
if (cachesize < (offset + sizeof (struct cache_file_new))
|| memcmp (cache_new->magic, CACHEMAGIC_NEW, || memcmp (cache_new->magic, CACHEMAGIC_NEW,
sizeof CACHEMAGIC_NEW - 1) sizeof CACHEMAGIC_NEW - 1)
|| memcmp (cache_new->version, CACHE_VERSION, || 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. */ /* Previously looked for the cache file and didn't find it. */
return NULL; return NULL;
/* This is where the strings start. */
cache_data = (const char *) &cache->libs[cache->nlibs];
best = NULL; best = NULL;
if (cache_new != (void *) -1) if (cache_new != (void *) -1)
@ -213,6 +212,9 @@ _dl_load_cache_lookup (const char *name)
unsigned long int *hwcap; unsigned long int *hwcap;
weak_extern (_dl_hwcap); weak_extern (_dl_hwcap);
/* This is where the strings start. */
cache_data = (const char *) cache_new;
hwcap = &_dl_hwcap; hwcap = &_dl_hwcap;
#define HWCAP_CHECK \ #define HWCAP_CHECK \
@ -221,9 +223,13 @@ _dl_load_cache_lookup (const char *name)
SEARCH_CACHE (cache_new); SEARCH_CACHE (cache_new);
} }
else else
{
/* This is where the strings start. */
cache_data = (const char *) &cache->libs[cache->nlibs];
#undef HWCAP_CHECK #undef HWCAP_CHECK
#define HWCAP_CHECK do {} while (0) #define HWCAP_CHECK do {} while (0)
SEARCH_CACHE (cache); SEARCH_CACHE (cache);
}
/* Print our result if wanted. */ /* Print our result if wanted. */
if (_dl_debug_libs && best != NULL) if (_dl_debug_libs && best != NULL)

View File

@ -17,11 +17,14 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ 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) ((flags) == 1 || (flags) == _DL_CACHE_DEFAULT_ID)
#endif
#ifndef LD_SO_CACHE #ifndef LD_SO_CACHE
# define LD_SO_CACHE "/etc/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 /* libc5 and glibc 2.0/2.1 use the same format. For glibc 2.2 another
format has been added in a compatible way: format has been added in a compatible way:
The beginning of the string table is used for the new table: The beginning of the string table is used for the new table:
old_magic old_magic
nlibs nlibs
libs[0] libs[0]
... ...
libs[nlibs-1] 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 newnlibs
... ...
newlibs[0] newlibs[0]
@ -82,6 +87,11 @@ struct cache_file_new
/* After this the string table of size len_strings is found. */ /* 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 static int
_dl_cache_libcmp (const char *p1, const char *p2) _dl_cache_libcmp (const char *p1, const char *p2)
{ {

View File

@ -1,5 +1,5 @@
/* Support for reading /etc/ld.so.cache files written by Linux ldconfig. /* 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -21,3 +21,5 @@
#define _dl_cache_check_flags(flags) \ #define _dl_cache_check_flags(flags) \
((flags) == _DL_CACHE_DEFAULT_ID) ((flags) == _DL_CACHE_DEFAULT_ID)
#include_next <dl-cache.h>

View File

@ -46,3 +46,4 @@ CFLAGS-tzset.c = $(tz-cflags)
CFLAGS-test_time.c = -Wno-format CFLAGS-test_time.c = -Wno-format
tst-getdate-ENV= DATEMSK=datemsk tst-getdate-ENV= DATEMSK=datemsk
test_time-ARGS= EST5EDT CST

View File

@ -1,2 +0,0 @@
EST5EDT
CST