summaryrefslogtreecommitdiff
path: root/elf/readlib.c
diff options
context:
space:
mode:
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>