<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;"> ------------------------------------------------------------------------
r2596 | andersen | 2001-05-10 00:44:29 -0500 (Thu, 10 May 2001) | 7 lines
Changed paths:
   M /trunk/uClibc/ldso/ldso/boot1.c
   M /trunk/uClibc/ldso/ldso/ld-uClibc.c
   M /trunk/uClibc/ldso/ldso/ldso.c

Check if ld.so is included in the NEEDED list.  If so, do not _again_
try to fix up its symbols since they are already fixed up, thank-you
very much.

This checkin fixes the dlopen problems Manuel noticed.
 -Erik

 ------------------------------------------------------------------------
Index: ldso/ldso/ld-uClibc.c
===================================================================
--- ldso/ldso/ld-uClibc.c	(revision 2595)
+++ ldso/ldso/ld-uClibc.c	(revision 2596)
@@ -126,7 +126,7 @@
 static char *_dl_malloc_addr, *_dl_mmap_zero;
 char *_dl_library_path = 0;		/* Where we look for libraries */
 char *_dl_preload = 0;			/* Things to be loaded before the libs. */
-char *_dl_progname = "ld-linux-uclibc.so.0";
+#include "ld.so.h"			/* Pull in the name of ld.so */
 static char *_dl_not_lazy = 0;
 static char *_dl_warn = 0;		/* Used by ldd */
 static char *_dl_trace_loaded_objects = 0;
@@ -140,6 +140,7 @@
 void _dl_unsetenv(char *symbol, char **envp);
 int _dl_fixup(struct elf_resolve *tpnt);
 void _dl_debug_state(void);
+char *_dl_get_last_path_component(char *path);
 
 
 /* When we enter this piece of code, the program stack looks like this:
@@ -218,7 +219,7 @@
 	    //SEND_STDERR("Usage: ld.so EXECUTABLE [ARGS...]\n");
 	    SEND_STDERR("You have run `ld.so', the helper program for shared\n");
 	    SEND_STDERR("library executables.  You probably did not intend to\n");
-	    SEND_STDERR("run this program.  Goodbye.\n\n");
+	    SEND_STDERR("run this as a program.  Goodbye.\n\n");
 	    _dl_exit(0);
 	}
 #ifdef DL_DEBUG
@@ -692,9 +693,11 @@
 				if (dpnt-&gt;d_tag == DT_NEEDED) {
 					lpnt = tcurr-&gt;loadaddr + tcurr-&gt;dynamic_info[DT_STRTAB] +
 						dpnt-&gt;d_un.d_val;
-					if (tpnt &amp;&amp; _dl_strcmp(lpnt, tpnt-&gt;libname) == 0) {
+					if (tpnt &amp;&amp; _dl_strcmp(lpnt, 
+						    _dl_get_last_path_component(tpnt-&gt;libname)) == 0) {
 						struct elf_resolve *ttmp;
-
+						_dl_fdprintf(1, "\t%s =&gt; %s (0x%x)\n", 
+							lpnt, tpnt-&gt;libname, (unsigned) tpnt-&gt;loadaddr);
 						ttmp = _dl_loaded_modules;
 						while (ttmp-&gt;next)
 							ttmp = ttmp-&gt;next;
@@ -720,10 +723,10 @@
 							_dl_exit(16);
 						}
 					} else {
-						if (_dl_trace_loaded_objects
-							&amp;&amp; !tpnt1-&gt;usage_count)
-							_dl_fdprintf(1, "\t%s =&gt; %s (0x%x)\n", lpnt, 
-								tpnt1-&gt;libname, (unsigned) tpnt1-&gt;loadaddr);
+						if (_dl_trace_loaded_objects &amp;&amp; !tpnt1-&gt;usage_count)
+							_dl_fdprintf(1, "\t%s =&gt; %s (0x%x)\n", 
+								lpnt, tpnt1-&gt;libname, 
+								(unsigned) tpnt1-&gt;loadaddr);
 						rpnt-&gt;next = (struct dyn_elf *)
 							_dl_malloc(sizeof(struct dyn_elf));
 						_dl_memset(rpnt-&gt;next, 0, sizeof(*(rpnt-&gt;next)));
@@ -1038,3 +1041,23 @@
 	_dl_strcpy(retval, string);
 	return retval;
 }
+
+char *_dl_get_last_path_component(char *path)
+{
+	char *s;
+
+	s=path+_dl_strlen(path)-1;
+
+	/* strip trailing slashes */
+	while (s != path &amp;&amp; *s == '/') {
+		*s-- = '\0';
+	}
+
+	/* find last component */
+	s = _dl_strrchr(path, '/');
+	if (s == NULL || s[1] == '\0')
+		return path;
+	else
+		return s+1;
+}
+
Index: ldso/ldso/ldso.c
===================================================================
--- ldso/ldso/ldso.c	(revision 2595)
+++ ldso/ldso/ldso.c	(revision 2596)
@@ -126,7 +126,7 @@
 static char *_dl_malloc_addr, *_dl_mmap_zero;
 char *_dl_library_path = 0;		/* Where we look for libraries */
 char *_dl_preload = 0;			/* Things to be loaded before the libs. */
-char *_dl_progname = "ld-linux-uclibc.so.0";
+#include "ld.so.h"			/* Pull in the name of ld.so */
 static char *_dl_not_lazy = 0;
 static char *_dl_warn = 0;		/* Used by ldd */
 static char *_dl_trace_loaded_objects = 0;
@@ -140,6 +140,7 @@
 void _dl_unsetenv(char *symbol, char **envp);
 int _dl_fixup(struct elf_resolve *tpnt);
 void _dl_debug_state(void);
+char *_dl_get_last_path_component(char *path);
 
 
 /* When we enter this piece of code, the program stack looks like this:
@@ -218,7 +219,7 @@
 	    //SEND_STDERR("Usage: ld.so EXECUTABLE [ARGS...]\n");
 	    SEND_STDERR("You have run `ld.so', the helper program for shared\n");
 	    SEND_STDERR("library executables.  You probably did not intend to\n");
-	    SEND_STDERR("run this program.  Goodbye.\n\n");
+	    SEND_STDERR("run this as a program.  Goodbye.\n\n");
 	    _dl_exit(0);
 	}
 #ifdef DL_DEBUG
@@ -692,9 +693,11 @@
 				if (dpnt-&gt;d_tag == DT_NEEDED) {
 					lpnt = tcurr-&gt;loadaddr + tcurr-&gt;dynamic_info[DT_STRTAB] +
 						dpnt-&gt;d_un.d_val;
-					if (tpnt &amp;&amp; _dl_strcmp(lpnt, tpnt-&gt;libname) == 0) {
+					if (tpnt &amp;&amp; _dl_strcmp(lpnt, 
+						    _dl_get_last_path_component(tpnt-&gt;libname)) == 0) {
 						struct elf_resolve *ttmp;
-
+						_dl_fdprintf(1, "\t%s =&gt; %s (0x%x)\n", 
+							lpnt, tpnt-&gt;libname, (unsigned) tpnt-&gt;loadaddr);
 						ttmp = _dl_loaded_modules;
 						while (ttmp-&gt;next)
 							ttmp = ttmp-&gt;next;
@@ -720,10 +723,10 @@
 							_dl_exit(16);
 						}
 					} else {
-						if (_dl_trace_loaded_objects
-							&amp;&amp; !tpnt1-&gt;usage_count)
-							_dl_fdprintf(1, "\t%s =&gt; %s (0x%x)\n", lpnt, 
-								tpnt1-&gt;libname, (unsigned) tpnt1-&gt;loadaddr);
+						if (_dl_trace_loaded_objects &amp;&amp; !tpnt1-&gt;usage_count)
+							_dl_fdprintf(1, "\t%s =&gt; %s (0x%x)\n", 
+								lpnt, tpnt1-&gt;libname, 
+								(unsigned) tpnt1-&gt;loadaddr);
 						rpnt-&gt;next = (struct dyn_elf *)
 							_dl_malloc(sizeof(struct dyn_elf));
 						_dl_memset(rpnt-&gt;next, 0, sizeof(*(rpnt-&gt;next)));
@@ -1038,3 +1041,23 @@
 	_dl_strcpy(retval, string);
 	return retval;
 }
+
+char *_dl_get_last_path_component(char *path)
+{
+	char *s;
+
+	s=path+_dl_strlen(path)-1;
+
+	/* strip trailing slashes */
+	while (s != path &amp;&amp; *s == '/') {
+		*s-- = '\0';
+	}
+
+	/* find last component */
+	s = _dl_strrchr(path, '/');
+	if (s == NULL || s[1] == '\0')
+		return path;
+	else
+		return s+1;
+}
+
Index: ldso/ldso/boot1.c
===================================================================
--- ldso/ldso/boot1.c	(revision 2595)
+++ ldso/ldso/boot1.c	(revision 2596)
@@ -126,7 +126,7 @@
 static char *_dl_malloc_addr, *_dl_mmap_zero;
 char *_dl_library_path = 0;		/* Where we look for libraries */
 char *_dl_preload = 0;			/* Things to be loaded before the libs. */
-char *_dl_progname = "ld-linux-uclibc.so.0";
+#include "ld.so.h"			/* Pull in the name of ld.so */
 static char *_dl_not_lazy = 0;
 static char *_dl_warn = 0;		/* Used by ldd */
 static char *_dl_trace_loaded_objects = 0;
@@ -140,6 +140,7 @@
 void _dl_unsetenv(char *symbol, char **envp);
 int _dl_fixup(struct elf_resolve *tpnt);
 void _dl_debug_state(void);
+char *_dl_get_last_path_component(char *path);
 
 
 /* When we enter this piece of code, the program stack looks like this:
@@ -218,7 +219,7 @@
 	    //SEND_STDERR("Usage: ld.so EXECUTABLE [ARGS...]\n");
 	    SEND_STDERR("You have run `ld.so', the helper program for shared\n");
 	    SEND_STDERR("library executables.  You probably did not intend to\n");
-	    SEND_STDERR("run this program.  Goodbye.\n\n");
+	    SEND_STDERR("run this as a program.  Goodbye.\n\n");
 	    _dl_exit(0);
 	}
 #ifdef DL_DEBUG
@@ -692,9 +693,11 @@
 				if (dpnt-&gt;d_tag == DT_NEEDED) {
 					lpnt = tcurr-&gt;loadaddr + tcurr-&gt;dynamic_info[DT_STRTAB] +
 						dpnt-&gt;d_un.d_val;
-					if (tpnt &amp;&amp; _dl_strcmp(lpnt, tpnt-&gt;libname) == 0) {
+					if (tpnt &amp;&amp; _dl_strcmp(lpnt, 
+						    _dl_get_last_path_component(tpnt-&gt;libname)) == 0) {
 						struct elf_resolve *ttmp;
-
+						_dl_fdprintf(1, "\t%s =&gt; %s (0x%x)\n", 
+							lpnt, tpnt-&gt;libname, (unsigned) tpnt-&gt;loadaddr);
 						ttmp = _dl_loaded_modules;
 						while (ttmp-&gt;next)
 							ttmp = ttmp-&gt;next;
@@ -720,10 +723,10 @@
 							_dl_exit(16);
 						}
 					} else {
-						if (_dl_trace_loaded_objects
-							&amp;&amp; !tpnt1-&gt;usage_count)
-							_dl_fdprintf(1, "\t%s =&gt; %s (0x%x)\n", lpnt, 
-								tpnt1-&gt;libname, (unsigned) tpnt1-&gt;loadaddr);
+						if (_dl_trace_loaded_objects &amp;&amp; !tpnt1-&gt;usage_count)
+							_dl_fdprintf(1, "\t%s =&gt; %s (0x%x)\n", 
+								lpnt, tpnt1-&gt;libname, 
+								(unsigned) tpnt1-&gt;loadaddr);
 						rpnt-&gt;next = (struct dyn_elf *)
 							_dl_malloc(sizeof(struct dyn_elf));
 						_dl_memset(rpnt-&gt;next, 0, sizeof(*(rpnt-&gt;next)));
@@ -1038,3 +1041,23 @@
 	_dl_strcpy(retval, string);
 	return retval;
 }
+
+char *_dl_get_last_path_component(char *path)
+{
+	char *s;
+
+	s=path+_dl_strlen(path)-1;
+
+	/* strip trailing slashes */
+	while (s != path &amp;&amp; *s == '/') {
+		*s-- = '\0';
+	}
+
+	/* find last component */
+	s = _dl_strrchr(path, '/');
+	if (s == NULL || s[1] == '\0')
+		return path;
+	else
+		return s+1;
+}
+
</pre></body></html>