svn commit: trunk/uClibc/ldso/libdl
jocke at uclibc.org
jocke at uclibc.org
Tue Mar 13 10:13:35 UTC 2007
Author: jocke
Date: 2007-03-13 03:13:35 -0700 (Tue, 13 Mar 2007)
New Revision: 18082
Log:
Carmelo Amoroso writes:
Hi All,
the attached patch completes my previous patch on statically linked
application calling dlopen enabling the support for LD_DEBUG.
Further it fixes the missing initialization of the _dl_library_path
variable.
This patch has been fully tested with the uClibc-nptl branch (sh4).
Modified:
trunk/uClibc/ldso/libdl/libdl.c
Changeset:
Modified: trunk/uClibc/ldso/libdl/libdl.c
===================================================================
--- trunk/uClibc/ldso/libdl/libdl.c 2007-03-13 00:02:10 UTC (rev 18081)
+++ trunk/uClibc/ldso/libdl/libdl.c 2007-03-13 10:13:35 UTC (rev 18082)
@@ -71,7 +71,16 @@
* the symbols that otherwise would have been loaded in from ldso... */
#ifdef __SUPPORT_LD_DEBUG__
+/* Needed for 'strstr' prototype' */
+#include <string.h>
char *_dl_debug = 0;
+char *_dl_debug_symbols = 0;
+char *_dl_debug_move = 0;
+char *_dl_debug_reloc = 0;
+char *_dl_debug_detail = 0;
+char *_dl_debug_nofixups = 0;
+char *_dl_debug_bindings = 0;
+int _dl_debug_file = 2;
#endif
const char *_dl_progname = ""; /* Program name */
char *_dl_library_path = 0; /* Where we look for libraries */
@@ -160,6 +169,25 @@
if (!libname)
return _dl_symbol_tables;
+#ifndef SHARED
+# ifdef __SUPPORT_LD_DEBUG__
+ _dl_debug = getenv("LD_DEBUG");
+ if (_dl_debug) {
+ if (_dl_strstr(_dl_debug, "all")) {
+ _dl_debug_detail = _dl_debug_move = _dl_debug_symbols
+ = _dl_debug_reloc = _dl_debug_bindings = _dl_debug_nofixups = (void*)1;
+ } else {
+ _dl_debug_detail = strstr(_dl_debug, "detail");
+ _dl_debug_move = strstr(_dl_debug, "move");
+ _dl_debug_symbols = strstr(_dl_debug, "sym");
+ _dl_debug_reloc = strstr(_dl_debug, "reloc");
+ _dl_debug_nofixups = strstr(_dl_debug, "nofix");
+ _dl_debug_bindings = strstr(_dl_debug, "bind");
+ }
+ }
+# endif
+#endif
+
_dl_map_cache();
/*
@@ -186,6 +214,11 @@
if (getenv("LD_BIND_NOW"))
now_flag = RTLD_NOW;
+#ifndef SHARED
+ /* When statically linked, the _dl_library_path is not yet initialized */
+ _dl_library_path = getenv("LD_LIBRARY_PATH");
+#endif
+
/* Try to load the specified library */
_dl_if_debug_print("Trying to dlopen '%s', RTLD_GLOBAL:%d RTLD_NOW:%d\n",
(char*)libname, (flag & RTLD_GLOBAL ? 1:0), (now_flag & RTLD_NOW ? 1:0));
More information about the uClibc-cvs
mailing list