From e556691e4f2411bddc228266e9fcb8dbbf122ac6 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 6 Nov 2003 22:38:49 +0000 Subject: Begin converting the client utils --- utils/readsoname.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 utils/readsoname.c (limited to 'utils/readsoname.c') diff --git a/utils/readsoname.c b/utils/readsoname.c new file mode 100644 index 000000000..12c2428f2 --- /dev/null +++ b/utils/readsoname.c @@ -0,0 +1,63 @@ +/* adapted from Eric Youngdale's readelf program */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "readsoname.h" + +void warn(char *fmt, ...); +char *xstrdup(char *); + +struct needed_tab +{ + char *soname; + int type; +}; + +struct needed_tab needed_tab[] = { + { "libc.so.0", LIB_ELF_LIBC0 }, + { "libm.so.0", LIB_ELF_LIBC0 }, + { "libdl.so.0", LIB_ELF_LIBC0 }, + { "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" -- cgit v1.2.3