From 2f95bcd3824e0276e3969686f4eee9a77ed2b597 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Sun, 17 Mar 2002 07:22:47 +0000 Subject: Enable trace support by default, since it only costs 300 bytes anyways, and people seem to expect it. -Erik --- ldso/ldso/Makefile | 6 ++++++ ldso/ldso/ldso.c | 10 +++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'ldso') diff --git a/ldso/ldso/Makefile b/ldso/ldso/Makefile index 55d3f00c6..5e9a71f63 100644 --- a/ldso/ldso/Makefile +++ b/ldso/ldso/Makefile @@ -27,6 +27,12 @@ DOPIC=true include $(TOPDIR)Rules.mak 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 #XXFLAGS+= -DDL_DEBUG #XXFLAGS+= -DDL_DEBUG_SYMBOLS diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index 36580e26a..0a08d2bf7 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -145,9 +145,7 @@ char *_dl_ldsopath = 0; static char *_dl_not_lazy = 0; static char *_dl_malloc_addr, *_dl_mmap_zero; -#ifdef DL_TRACE static char *_dl_trace_loaded_objects = 0; -#endif static int (*_dl_elf_main) (int, char **, char **); static int (*_dl_elf_init) (void); 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); +#ifndef DL_TRACE + if (_dl_trace_loaded_objects) { + _dl_dprintf(2, "Use the ldd provided by uClibc\n"); + _dl_exit(1); + } #endif /* 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 @@ -944,6 +946,8 @@ static void _dl_get_ready_to_run(struct elf_resolve *tpnt, struct elf_resolve *a if (_dl_trace_loaded_objects) { 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); if (!_dl_warn) _dl_exit(0); -- cgit v1.2.3