summaryrefslogtreecommitdiff
path: root/ldso/util/readsoname.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-06-04 22:13:51 +0000
committerEric Andersen <andersen@codepoet.org>2001-06-04 22:13:51 +0000
commitf68eb8d50b11310628f53a9378bf612e8d4bfa09 (patch)
treee3a4073bbc3ac2349c89ad9b3494b05838f95c0b /ldso/util/readsoname.c
parent03f338ab663d8b2fa16c8d1f83be51ecf9c79312 (diff)
Teach the ldso stuff to use the proper elf.h header file, not a local copy.
-Erik
Diffstat (limited to 'ldso/util/readsoname.c')
-rw-r--r--ldso/util/readsoname.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/ldso/util/readsoname.c b/ldso/util/readsoname.c
new file mode 100644
index 000000000..db772f0ae
--- /dev/null
+++ b/ldso/util/readsoname.c
@@ -0,0 +1,61 @@
+/* adapted from Eric Youngdale's readelf program */
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+#include <link.h>
+#include <elf.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include "../config.h"
+#include "readsoname.h"
+
+void warn(char *fmt, ...);
+char *xstrdup(char *);
+
+struct needed_tab
+{
+ char *soname;
+ int type;
+};
+
+struct needed_tab needed_tab[] = {
+ { "libc.so.5", LIB_ELF_LIBC5 },
+ { "libm.so.5", LIB_ELF_LIBC5 },
+ { "libdl.so.1", LIB_ELF_LIBC5 },
+ { "libc.so.6", LIB_ELF_LIBC6 },
+ { "libm.so.6", LIB_ELF_LIBC6 },
+ { "libdl.so.2", LIB_ELF_LIBC6 },
+ { NULL, LIB_ELF }
+};
+
+char *readsoname(char *name, FILE *infile, int expected_type,
+ int *type, int elfclass)
+{
+ char *res;
+
+ if (elfclass == ELFCLASS32)
+ res = readsoname32(name, infile, expected_type, type);
+ else
+ {
+ res = readsoname64(name, infile, expected_type, type);
+#if 0
+ *type |= LIB_ELF64;
+#endif
+ }
+
+ return res;
+}
+
+#undef __ELF_NATIVE_CLASS
+#undef readsonameXX
+#define readsonameXX readsoname32
+#define __ELF_NATIVE_CLASS 32
+#include "readsoname2.c"
+
+#undef __ELF_NATIVE_CLASS
+#undef readsonameXX
+#define readsonameXX readsoname64
+#define __ELF_NATIVE_CLASS 64
+#include "readsoname2.c"