Browse Source

Enable trace support by default, since it only costs 300 bytes
anyways, and people seem to expect it.
-Erik

Eric Andersen 23 years ago
parent
commit
2f95bcd382
2 changed files with 13 additions and 3 deletions
  1. 6 0
      ldso/ldso/Makefile
  2. 7 3
      ldso/ldso/ldso.c

+ 6 - 0
ldso/ldso/Makefile

@@ -27,6 +27,12 @@ DOPIC=true
 include $(TOPDIR)Rules.mak
 include $(TOPDIR)Rules.mak
 LDSO_FULLNAME=ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so
 LDSO_FULLNAME=ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so
 
 
+# Enable this to enable all the code needed to support traditional ldd
+# (i.e. where the shared library loader does all the heavy lifting)
+# Since this currently only saves about 300 bytes, I'm going to leave 
+# it enabled...
+XXFLAGS+= -DDL_TRACE
+
 # Enable this to enable debugging output from ld.so
 # Enable this to enable debugging output from ld.so
 #XXFLAGS+= -DDL_DEBUG
 #XXFLAGS+= -DDL_DEBUG
 #XXFLAGS+= -DDL_DEBUG_SYMBOLS
 #XXFLAGS+= -DDL_DEBUG_SYMBOLS

+ 7 - 3
ldso/ldso/ldso.c

@@ -145,9 +145,7 @@ char *_dl_ldsopath = 0;
 static char *_dl_not_lazy = 0;
 static char *_dl_not_lazy = 0;
 static char *_dl_malloc_addr, *_dl_mmap_zero;
 static char *_dl_malloc_addr, *_dl_mmap_zero;
 
 
-#ifdef DL_TRACE
 static char *_dl_trace_loaded_objects = 0;
 static char *_dl_trace_loaded_objects = 0;
-#endif
 static int (*_dl_elf_main) (int, char **, char **);
 static int (*_dl_elf_main) (int, char **, char **);
 static int (*_dl_elf_init) (void);
 static int (*_dl_elf_init) (void);
 void *(*_dl_malloc_function) (int size) = NULL;
 void *(*_dl_malloc_function) (int size) = NULL;
@@ -701,8 +699,12 @@ static void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *a
 		}
 		}
 	}
 	}
 
 
-#ifdef DL_TRACE
 	_dl_trace_loaded_objects = _dl_getenv("LD_TRACE_LOADED_OBJECTS", envp);
 	_dl_trace_loaded_objects = _dl_getenv("LD_TRACE_LOADED_OBJECTS", envp);
+#ifndef DL_TRACE
+	if (_dl_trace_loaded_objects) {
+		_dl_dprintf(2, "Use the ldd provided by uClibc\n");
+		_dl_exit(1);
+	}
 #endif
 #endif
 	/* OK, we now have the application in the list, and we have some
 	/* OK, we now have the application in the list, and we have some
 	   basic stuff in place.  Now search through the list for other shared
 	   basic stuff in place.  Now search through the list for other shared
@@ -944,6 +946,8 @@ static void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *a
 	if (_dl_trace_loaded_objects) {
 	if (_dl_trace_loaded_objects) {
 		char *_dl_warn = 0;
 		char *_dl_warn = 0;
 
 
+		_dl_dprintf(1, "\t%s => %s (0x%x)\n", tpnt->libname + (_dl_strlen(_dl_ldsopath)) + 1, 
+				tpnt->libname, tpnt->loadaddr);  
 		_dl_warn = _dl_getenv("LD_WARN", envp);
 		_dl_warn = _dl_getenv("LD_WARN", envp);
 		if (!_dl_warn)
 		if (!_dl_warn)
 			_dl_exit(0);
 			_dl_exit(0);