summaryrefslogtreecommitdiff
path: root/elf/readlib.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-08-12 20:09:16 +0000
committerUlrich Drepper <drepper@redhat.com>2007-08-12 20:09:16 +0000
commit27d9ffda17df4d2388687afd12897774fde39bcc (patch)
treee68c74b095d9ae0b5eea23c0b80c54b73b94d3b6 /elf/readlib.c
parent8d944b0fc6195a2cd2308287e96a46b21f675015 (diff)
downloadglibc-27d9ffda17df4d2388687afd12897774fde39bcc.tar.gz
2007-08-01 Andreas Jaeger <aj@suse.de>
Jakub Jelinek <jakub@redhat.com> * elf/ldconfig.c (opt_ignore_aux_cache): Add new option. (options): Add option. (parse_opt): Handle option. (manual_link): Adjust process_file caller. Call implicit_soname. (search_dir): Formatting. Use and populate auxiliary cache. (main): Load and save auxiliary cache. * elf/readlib.c (process_file): Add stat_buf argument. Pass struct stat64 from fstat64 to caller. (implicit_soname): New function. * elf/readelflib.c (process_elf_file): If DT_SONAME is not present, leave *soname as NULL. * elf/cache.c: Include libgen.h. (print_entry, print_cache, compare, save_cache, add_to_cache): Formatting and cleanups. (aux_cache_entry_id, aux_cache_entry, aux_cache_file_entry, aux_cache_file): New structures. (AUX_CACHEMAGIC): Define. (primes): New array. (aux_hash_size, aux_hash): New variables. (aux_cache_entry_id_hash, nextprime, init_aux_cache, search_aux_cache, insert_to_aux_cache, add_to_aux_cache, load_aux_cache, save_aux_cache): New functions. * sysdeps/generic/ldconfig.h (_PATH_LDCONFIG_AUX_CACHE): Define. (init_aux_cache, search_aux_cache, add_to_aux_cache, load_aux_cache, save_aux_cache, implicit_soname): New prototypes. (process_file): Adjust prototype.
Diffstat (limited to 'elf/readlib.c')
-rw-r--r--elf/readlib.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/elf/readlib.c b/elf/readlib.c
index a3278d935e..eb64a79f10 100644
--- a/elf/readlib.c
+++ b/elf/readlib.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2003, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2003, 2005, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 1999 and
Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -69,7 +69,7 @@ static struct known_names known_libs[] =
int
process_file (const char *real_file_name, const char *file_name,
const char *lib, int *flag, unsigned int *osversion,
- char **soname, int is_link)
+ char **soname, int is_link, struct stat64 *stat_buf)
{
FILE *file;
struct stat64 statbuf;
@@ -135,7 +135,7 @@ process_file (const char *real_file_name, const char *file_name,
)
{
/* Aout files don't have a soname, just return the name
- including the major number. */
+ including the major number. */
char *copy, *major, *dot;
copy = xstrdup (lib);
major = strstr (copy, ".so.");
@@ -175,8 +175,31 @@ process_file (const char *real_file_name, const char *file_name,
munmap (file_contents, statbuf.st_size);
fclose (file);
+ *stat_buf = statbuf;
return ret;
}
+/* Returns made up soname if lib doesn't have explicit DT_SONAME. */
+
+char *
+implicit_soname (const char *lib, int flag)
+{
+ char *soname = xstrdup (lib);
+
+ if ((flag & FLAG_TYPE_MASK) != FLAG_LIBC4)
+ return soname;
+
+ /* Aout files don't have a soname, just return the name
+ including the major number. */
+ char *major = strstr (soname, ".so.");
+ if (major)
+ {
+ char *dot = strstr (major + 4, ".");
+ if (dot)
+ *dot = '\0';
+ }
+ return soname;
+}
+
/* Get architecture specific version of process_elf_file. */
#include <readelflib.c>