#else
# define __dl_debug_dprint(fmt, args...) do {} while (0)
# define _dl_if_debug_dprint(fmt, args...) do {} while (0)
-# define _dl_debug_file 2
+/* disabled on purpose, _dl_debug_file should be guarded by __SUPPORT_LD_DEBUG__
+# define _dl_debug_file 2*/
#endif /* __SUPPORT_LD_DEBUG__ */
#ifdef IS_IN_rtld
extern void _dl_free(void *);
extern char *_dl_getenv(const char *symbol, char **envp);
extern void _dl_unsetenv(const char *symbol, char **envp);
+#ifdef IS_IN_rtld
extern char *_dl_strdup(const char *string);
extern void _dl_dprintf(int, const char *, ...);
+#else
+# include <string.h>
+# define _dl_strdup strdup
+# include <stdio.h>
+# ifdef __USE_GNU
+# define _dl_dprintf dprintf
+# else
+# define _dl_dprintf(fd, fmt, args...) fprintf(stderr, fmt, ## args)
+# endif
+#endif
#ifndef DL_GET_READY_TO_RUN_EXTRA_PARMS
# define DL_GET_READY_TO_RUN_EXTRA_PARMS
}
}
#else
- _dl_dprintf(_dl_debug_file, "Can't modify %s's text section."
+ _dl_dprintf(2, "Can't modify %s's text section."
" Use GCC option -fPIC for shared objects, please.\n",
libname);
_dl_exit(1);
return goof;
}
+#ifdef IS_IN_rtld
/* Minimal printf which handles only %s, %d, and %x */
void _dl_dprintf(int fd, const char *fmt, ...)
{
break;
}
case 'x':
- case 'X':
+ case 'p':
{
char tmp[22];
#if __WORDSIZE > 32
_dl_strcpy(retval, string);
return retval;
}
+#endif
unsigned int _dl_parse_dynamic_info(ElfW(Dyn) *dpnt, unsigned long dynamic_info[],
void *debug_addr, DL_LOADADDR_TYPE load_off)
_dl_mmap_zero = _dl_malloc_addr = _dl_mmap((void *) 0, rounded_size,
PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_UNINITIALIZE, -1, 0);
if (_dl_mmap_check_error(_dl_mmap_zero)) {
- _dl_dprintf(_dl_debug_file, "%s: mmap of a spare page failed!\n", _dl_progname);
+ _dl_dprintf(2, "%s: mmap of a spare page failed!\n", _dl_progname);
_dl_exit(20);
}
}
#ifndef __LDSO_STANDALONE_SUPPORT__
if (_start == (void *) auxvt[AT_ENTRY].a_un.a_val) {
- _dl_dprintf(_dl_debug_file, "Standalone execution is not enabled\n");
+ _dl_dprintf(2, "Standalone execution is not enabled\n");
_dl_exit(1);
}
#endif
*/
app_tpnt = _dl_load_elf_shared_library(_dl_secure, &rpnt, _dl_progname);
if (!app_tpnt) {
- _dl_dprintf(_dl_debug_file, "can't load '%s'\n", _dl_progname);
+ _dl_dprintf(2, "can't load '%s'\n", _dl_progname);
_dl_exit(16);
}
/*
}
#else
if (app_tpnt->dynamic_info[DT_TEXTREL]) {
- _dl_dprintf(_dl_debug_file, "Can't modify application's text section; use the GCC option -fPIE for position-independent executables.\n");
+ _dl_dprintf(2, "Can't modify application's text section; use the GCC option -fPIE for position-independent executables.\n");
_dl_exit(1);
}
#endif
_dl_debug_early("Found TLS header for application program\n");
break;
#else
- _dl_dprintf(_dl_debug_file, "Program uses unsupported TLS data!\n");
+ _dl_dprintf(2, "Program uses unsupported TLS data!\n");
_dl_exit(1);
#endif
}
#ifndef __LDSO_LDD_SUPPORT__
if (trace_loaded_objects) {
- _dl_dprintf(_dl_debug_file, "Use the ldd provided by uClibc\n");
+ _dl_dprintf(2, "Use the ldd provided by uClibc\n");
_dl_exit(1);
}
#endif
else
#endif
{
- _dl_dprintf(_dl_debug_file, "%s: library '%s' "
+ _dl_dprintf(2, "%s: library '%s' "
"from LD_PRELOAD can't be preloaded: ignored.\n",
_dl_progname, str);
}
}
if ((fd = _dl_open(LDSO_PRELOAD, O_RDONLY, 0)) < 0) {
- _dl_dprintf(_dl_debug_file, "%s: can't open file '%s'\n",
+ _dl_dprintf(2, "%s: can't open file '%s'\n",
_dl_progname, LDSO_PRELOAD);
break;
}
PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
_dl_close(fd);
if (preload == (caddr_t) -1) {
- _dl_dprintf(_dl_debug_file, "%s:%i: can't map '%s'\n",
+ _dl_dprintf(2, "%s:%i: can't map '%s'\n",
_dl_progname, __LINE__, LDSO_PRELOAD);
break;
}
else
# endif
{
- _dl_dprintf(_dl_debug_file, "%s: can't load library '%s'\n", _dl_progname, cp2);
+ _dl_dprintf(2, "%s: can't load library '%s'\n", _dl_progname, cp2);
_dl_exit(15);
}
} else {
} else
#endif
{
- _dl_dprintf(_dl_debug_file, "%s: can't load library '%s'\n", _dl_progname, lpntstr);
+ _dl_dprintf(2, "%s: can't load library '%s'\n", _dl_progname, lpntstr);
_dl_exit(16);
}
}