[uClibc-cvs] CVS uClibc/utils

CVS User andersen andersen at codepoet.org
Wed Jan 12 01:23:00 UTC 2005


Update of /var/cvs/uClibc/utils
In directory nail:/tmp/cvs-serv25250

Modified Files:
	Makefile ldconfig.c 
Removed Files:
	readsoname.c readsoname.h 
Log Message:
cleanup, and prevent failures due to including architecture specific
header files into ldconfig when building for the host.


--- /var/cvs/uClibc/utils/Makefile	2004/12/22 21:04:50	1.21
+++ /var/cvs/uClibc/utils/Makefile	2005/01/12 01:22:59	1.22
@@ -44,7 +44,7 @@
 	$(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 \
@@ -76,7 +76,7 @@
 		-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 \
@@ -89,7 +89,7 @@
 	$(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)
--- /var/cvs/uClibc/utils/ldconfig.c	2005/01/11 06:39:19	1.12
+++ /var/cvs/uClibc/utils/ldconfig.c	2005/01/12 01:22:59	1.13
@@ -37,8 +37,7 @@
 #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
 
@@ -99,6 +98,26 @@
 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)
 {
@@ -107,7 +126,7 @@
 	vfprintf(stderr, s, p);
 }
 
-extern void warnx(const char *s, ...)
+static void warnx(const char *s, ...)
 {
 	va_list p;
 
@@ -117,7 +136,7 @@
 	fprintf(stderr, "\n");
 }
 
-extern void err(int errnum, const char *s, ...)
+static void err(int errnum, const char *s, ...)
 {
 	va_list p;
 
@@ -140,7 +159,7 @@
 	fprintf(stderr, "%s%s\n", s, strerror(err));
 }
 
-extern void warn(const char *s, ...)
+static void warn(const char *s, ...)
 {
 	va_list p;
 
@@ -149,7 +168,7 @@
 	va_end(p);
 }
 
-void *xmalloc(size_t size)
+static void *xmalloc(size_t size)
 {
     void *ptr;
     if ((ptr = malloc(size)) == NULL)
@@ -157,7 +176,7 @@
     return ptr;
 }
 
-char *xstrdup(const char *str)
+static char *xstrdup(const char *str)
 {
     char *ptr;
     if ((ptr = strdup(str)) == NULL)
@@ -165,6 +184,39 @@
     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.
 
@@ -753,8 +805,10 @@
 	    "\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__
@@ -776,7 +830,9 @@
     int libtype, islink;
     char *chroot_dir = NULL;
     int printcache = 0;
+#ifdef __LDSO_CACHE_SUPPORT__
     char *extpath;
+#endif
 
     prog = argv[0];
     opterr = 0;



More information about the uClibc-cvs mailing list