$(CC) $(CFLAGS) -Wl,-s $^ -o $@
$(STRIPTOOL) -x -R .note -R .comment $@
-ldconfig: ldconfig.c readsoname.c
+ldconfig: ldconfig.c
$(CC) $(CFLAGS) -Wl,-s -static \
-DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
-DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I../ldso/include \
-DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I../ldso/include \
$^ -o $@
-ldconfig.host: ldconfig.c readsoname.c
+ldconfig.host: ldconfig.c
$(HOSTCC) $(HOSTCFLAGS) -Wl,-s \
-DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
-DUCLIBC_LDSO=$(UCLIBC_LDSO) -I. -I../ldso/include \
$(RM) $(TARGETS) *.o *~ core *.target elf.h iconv *.host
-readelf.c readsoname.c ldconfig.c ldd.c: headers
+readelf.c ldconfig.c ldd.c: headers
install: all
ifeq ($(strip $(HAVE_SHARED)),y)
#include <errno.h>
#include <sys/stat.h>
#include <sys/mman.h>
-#include "dl-elf.h"
-#include "readsoname.h"
+#include "dl-defs.h"
#define BUFFER_SIZE 4096
char *cachefile = LDSO_CACHE; /* default cache file */
#endif
+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 }
+};
+
+
/* These two are used internally -- you shouldn't need to use them */
static void verror_msg(const char *s, va_list p)
{
vfprintf(stderr, s, p);
}
-extern void warnx(const char *s, ...)
+static void warnx(const char *s, ...)
{
va_list p;
fprintf(stderr, "\n");
}
-extern void err(int errnum, const char *s, ...)
+static void err(int errnum, const char *s, ...)
{
va_list p;
fprintf(stderr, "%s%s\n", s, strerror(err));
}
-extern void warn(const char *s, ...)
+static void warn(const char *s, ...)
{
va_list p;
va_end(p);
}
-void *xmalloc(size_t size)
+static void *xmalloc(size_t size)
{
void *ptr;
if ((ptr = malloc(size)) == NULL)
return ptr;
}
-char *xstrdup(const char *str)
+static char *xstrdup(const char *str)
{
char *ptr;
if ((ptr = strdup(str)) == NULL)
return ptr;
}
+
+#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"
+
+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;
+}
+
+
+
/* If shared library, return a malloced copy of the soname and set the
type, else return NULL.
"\t-X:\t\tdon't update the library links\n"
"\t-l:\t\tlibrary mode, manually link libraries\n"
"\t-p:\t\tprint the current library cache\n"
+#ifdef __LDSO_CACHE_SUPPORT__
"\t-f conf :\tuse conf instead of %s\n"
"\t-C cache:\tuse cache instead of %s\n"
+#endif
"\t-r root :\tfirst, do a chroot to the indicated directory\n"
"\tdir ... :\tdirectories to process\n"
#ifdef __LDSO_CACHE_SUPPORT__
int libtype, islink;
char *chroot_dir = NULL;
int printcache = 0;
+#ifdef __LDSO_CACHE_SUPPORT__
char *extpath;
+#endif
prog = argv[0];
opterr = 0;
+++ /dev/null
-/* 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 <unistd.h>
-#include <sys/types.h>
-#include "dl-elf.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.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"