1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

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.
This commit is contained in:
Ulrich Drepper
2007-08-12 20:09:16 +00:00
parent 8d944b0fc6
commit 27d9ffda17
6 changed files with 540 additions and 154 deletions

View File

@ -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>