aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/generic/dl-cache.c
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 /sysdeps/generic/dl-cache.c
parent7626e16ceb26772b82ae4ef32e8e4b027cd79ed0 (diff)
downloadglibc-e25054c49c92587a07de4badfe4b7e01ceb99858.tar
glibc-e25054c49c92587a07de4badfe4b7e01ceb99858.tar.gz
glibc-e25054c49c92587a07de4badfe4b7e01ceb99858.tar.bz2
glibc-e25054c49c92587a07de4badfe4b7e01ceb99858.zip
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.
Diffstat (limited to 'sysdeps/generic/dl-cache.c')
-rw-r--r--sysdeps/generic/dl-cache.c26
1 files changed, 16 insertions, 10 deletions
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)