Move all configuration options into the new config system.
-Erik
be built for your target architecture. If this option is available,
to you, then you almost certainly want to answer Y.
+config LDSO_LDD_SUPPORT
+ bool "Native shared library loader 'ldd' support"
+ depends on BUILD_UCLIBC_LDSO
+ default y
+ help
+ Enable this to enable all the code needed to support traditional ldd,
+ which executes the shared library loader to resolve all dependancies
+ and then provide a list of shared libraries that are required for an
+ application to function. Disabling this option will makes uClibc's
+ shared library loader a little bit smaller. Most people will answer Y.
+
config UCLIBC_HAS_THREADS
bool "POSIX Threading Support"
default y
If you are doing development and want to debug uClibc, answer Y.
Otherwise, answer N.
+
+config SUPPORT_LD_DEBUG
+ bool "Build the shared library loader with debugging support"
+ depends on BUILD_UCLIBC_LDSO
+ default y
+ help
+ Answer Y here to enable all the extra code needed to debug the uClibc
+ native shared library loader. The level of debugging noise that is
+ generated depends on the LD_DEBUG environment variable... Just set
+ LD_DEBUG to something like: 'LD_DEBUG=token1,token2,.. prog' to
+ debug your application. Diagnostic messages will then be printed to
+ the stderr.
+
+ For now these debugging tokens are available:
+ detail provide more information for some options
+ move display copy processings
+ symbols display symbol table processing
+ reloc display relocation processing; detail shows the relocation patch
+ nofixups never fixes up jump relocations
+ bindings displays the resolve processing (function calls); detail shows the relocation patch
+ all Enable everything!
+
+ The additional environment variable:
+ LD_DEBUG_OUTPUT=file
+ redirects the diagnostics to an output file created using
+ the specified name and the process id as a suffix.
+
+ An excellent start is simply:
+ $ LD_DEBUG=binding,move,symbols,reloc,detail ./appname
+ or to log everything to a file named 'logfile', try this
+ $ LD_DEBUG=all LD_DEBUG_OUTPUT=logfile ./appname
+
+ If you are doing development and want to debug uClibc's shared library
+ loader, answer Y. Mere mortals answer N.
+
+config SUPPORT_LD_DEBUG_EARLY
+ bool "Build the shared library loader with early debugging support"
+ depends on BUILD_UCLIBC_LDSO
+ default y
+ help
+ Answer Y here to if you find the uClibc shared library loader is
+ crashing or otherwise not working very early on. This is typical
+ only when starting a new port when you havn't figured out how to
+ properly get the values for argc, argv, environ, etc. This method
+ allows a degree of visibility into the very early shared library
+ loader initialization process. If you are doing development and want
+ to debug the uClibc shared library loader early initialization,
+ answer Y. Mere mortals answer N.
+
endmenu
include $(TOPDIR)Rules.mak
LDSO_FULLNAME=ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).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+= -DLD_TRACE
-
-# Enable this to enable all the code needed for debugging the runtime
-# linking of an application using the LD_DEBUG environment variable:
-# LD_DEBUG=token1,token2,.. prog
-# enables diagnostics to the stderr.
-# For now there are these tokens possible:
-# bindings displays the resolve processing (function calls); detail shows the relocation patch
-# detail provide more information for some options
-# move display copy processings
-# reloc display relocation processing; detail shows the relocation patch
-# symbols display symbol table processing
-#
-# The additional environment variable:
-# LD_DEBUG_OUTPUT=file
-# redirects the diagnostics to an output file created using
-# the specified name and the process id as a suffix.
-#
-# try this
-# $ LD_DEBUG=binding,move,symbols,reloc,detail LD_DEBUG_OUTPUT=appname ./appname
-#
-#XXFLAGS+= -DSUPPORT_LD_DEBUG
-
-# Enable this for the very very early debugging. Really only useful
-# for people porting to new architectures.
-#XXFLAGS+= -DLD_DEBUG
-
-# Enable this to never actually fixup symbols...
-#XXFLAGS+= -DLD_NEVER_FIXUP_SYMBOLS
-
XXFLAGS+=-DUCLIBC_TARGET_PREFIX=\"$(TARGET_PREFIX)\" \
-DUCLIBC_DEVEL_PREFIX=\"$(DEVEL_PREFIX)\" \
-DUCLIBC_BUILD_DIR=\"$(shell cd $(TOPDIR) && pwd)\"
* SUCH DAMAGE.
*/
-#if defined (SUPPORT_LD_DEBUG) || defined (LD_DEBUG_SYMBOLS)
+#if defined (__SUPPORT_LD_DEBUG__)
static const char *_dl_reltypes_tab[] =
[0] "R_ARM_NONE", "R_ARM_PC24", "R_ARM_ABS32", "R_ARM_REL32",
[4] "R_ARM_PC13", "R_ARM_ABS16", "R_ARM_ABS12", "R_ARM_THM_ABS5",
_dl_progname, strtab + symtab[symtab_index].st_name);
_dl_exit(1);
};
-#if defined (SUPPORT_LD_DEBUG) || defined (LD_NEVER_FIXUP_SYMBOLS)
+#if defined (__SUPPORT_LD_DEBUG__)
if ((unsigned long) got_addr < 0x40000000)
{
-#ifndef SUPPORT_LD_DEBUG
- if (_dl_debug_bindings)
- {
- _dl_dprintf(_dl_debug_file, "\nresolve function: %s",
- strtab + symtab[symtab_index].st_name);
- if(_dl_debug_detail) _dl_dprintf(_dl_debug_file, "\tpatch %x ==> %x @ %x", *got_addr, new_addr, got_addr);
- }
-#endif
-#ifndef LD_NEVER_FIXUP_SYMBOLS
- *got_addr = new_addr;
-#endif
- } else {
- *got_addr = new_addr;
+ if (_dl_debug_bindings)
+ {
+ _dl_dprintf(_dl_debug_file, "\nresolve function: %s",
+ strtab + symtab[symtab_index].st_name);
+ if(_dl_debug_detail) _dl_dprintf(_dl_debug_file,
+ "\tpatch %x ==> %x @ %x", *got_addr, new_addr, got_addr);
+ }
+ }
+ if (!_dl_debug_nofixups) {
+ *got_addr = new_addr;
}
#else
*got_addr = new_addr;
_dl_symbol(strtab + symtab[symtab_index].st_name))
continue;
-#if defined (SUPPORT_LD_DEBUG) || defined (LD_DEBUG_SYMBOLS)
+#if defined (__SUPPORT_LD_DEBUG__)
debug_sym(symtab,strtab,symtab_index);
debug_reloc(symtab,strtab,rpnt);
#endif
if (res <0)
{
int reloc_type = ELF32_R_TYPE(rpnt->r_info);
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
_dl_dprintf(2, "can't handle reloc type %s\n ", _dl_reltypes(reloc_type));
#else
_dl_dprintf(2, "can't handle reloc type %x\n", reloc_type);
}
}
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
{
unsigned long old_val = *reloc_addr;
#endif
default:
return -1; /*call _dl_exit(1) */
}
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
if(_dl_debug_reloc && _dl_debug_detail)
_dl_dprintf(_dl_debug_file, "\tpatch: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr);
}
reloc_addr = (unsigned long *) (tpnt->loadaddr + (unsigned long) rpnt->r_offset);
reloc_type = ELF32_R_TYPE(rpnt->r_info);
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
{
unsigned long old_val = *reloc_addr;
#endif
default:
return -1; /*call _dl_exit(1) */
}
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
if(_dl_debug_reloc && _dl_debug_detail)
_dl_dprintf(_dl_debug_file, "\tpatch: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr);
}
if (!symbol_addr) goof++;
}
if (!goof) {
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
if(_dl_debug_move)
_dl_dprintf(_dl_debug_file,"\n%s move %x bytes from %x to %x",
strtab + symtab[symtab_index].st_name,
* SUCH DAMAGE.
*/
-#ifndef VERBOSE_DLINKER
-#define VERBOSE_DLINKER
-#endif
-
/* Support for the LD_DEBUG variable. */
-#if defined (SUPPORT_LD_DEBUG) || defined (LD_DEBUG_SYMBOLS)
+#if defined (__SUPPORT_LD_DEBUG__)
static const char *_dl_reltypes_tab[] = {
[0] "R_CRIS_NONE", "R_CRIS_8", "R_CRIS_16", "R_CRIS_32",
[4] "R_CRIS_8_PCREL", "R_CRIS_16_PCREL", "R_CRIS_32_PCREL", "R_CRIS_GNU_VTINHERIT",
_dl_exit(1);
}
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
if (_dl_debug_bindings) {
_dl_dprintf(_dl_debug_file, "\nresolve function: %s", strtab + symtab[symtab_index].st_name);
_dl_symbol(strtab + symtab[symtab_index].st_name))
continue;
-#if defined (SUPPORT_LD_DEBUG) || defined (LD_DEBUG_SYMBOLS)
+#if defined (__SUPPORT_LD_DEBUG__)
{
unsigned long old_val = *reloc_addr;
default:
_dl_dprintf(_dl_debug_file, "%s: Can't handle relocation type (lazy).\n",
_dl_progname);
-#ifdef SUPPORT_LD_DEBUG
+#ifdef __SUPPORT_LD_DEBUG__
_dl_dprintf(_dl_debug_file, "%s ", _dl_reltypes(reloc_type));
#endif
if (symtab_index)
_dl_exit(1);
}
-#if defined(SUPPORT_LD_DEBUG)
+#if defined(__SUPPORT_LD_DEBUG__)
if (_dl_debug_reloc && _dl_debug_detail)
_dl_dprintf(_dl_debug_file, "\tpatch: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr);
}
symbol_addr += rpnt->r_addend;
}
-#if defined(SUPPORT_LD_DEBUG)
+#if defined(__SUPPORT_LD_DEBUG__)
{
unsigned long old_val = *reloc_addr;
debug_sym(symtab,strtab,symtab_index);
break;
default:
_dl_dprintf(_dl_debug_file, "%s: Can't handle relocation type ", _dl_progname);
-#ifdef SUPPORT_LD_DEBUG
+#ifdef __SUPPORT_LD_DEBUG__
_dl_dprintf(_dl_debug_file, "%s\n", _dl_reltypes(reloc_type));
#endif
if (symtab_index) {
return -1;
}
}
-#if defined(SUPPORT_LD_DEBUG)
+#if defined(__SUPPORT_LD_DEBUG__)
if (_dl_debug_reloc && _dl_debug_detail)
_dl_dprintf(_dl_debug_file, "\tpatch: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr);
}
}
if (!goof) {
-#if defined(SUPPORT_LD_DEBUG)
+#if defined(__SUPPORT_LD_DEBUG__)
if (_dl_debug_move)
_dl_dprintf(_dl_debug_file, "\n%s move %x bytes from %x to %x",
strtab + symtab[symtab_index].st_name,
pnt++;
}
-#ifdef LD_DEBUG
- _dl_dprintf(_dl_debug_file, "searching for library: '%s'\n", libname);
+#if defined (__SUPPORT_LD_DEBUG__)
+ if(_dl_debug) _dl_dprintf(_dl_debug_file, "searching for library: '%s'\n", libname);
#endif
/* If the filename has any '/', try it straight and leave it at that.
For IBCS2 compatibility under linux, we substitute the string
if (pnt) {
pnt += (unsigned long) tpnt->loadaddr +
tpnt->dynamic_info[DT_STRTAB];
-#ifdef LD_DEBUG
- _dl_dprintf(_dl_debug_file, "searching RPATH: '%s'\n", pnt);
+#if defined (__SUPPORT_LD_DEBUG__)
+ if(_dl_debug) _dl_dprintf(_dl_debug_file, "searching RPATH: '%s'\n", pnt);
#endif
if ((tpnt1 = search_for_named_library(libname, secure, pnt, rpnt)) != NULL)
{
/* Check in LD_{ELF_}LIBRARY_PATH, if specified and allowed */
if (_dl_library_path) {
-#ifdef LD_DEBUG
- _dl_dprintf(_dl_debug_file, "searching _dl_library_path: '%s'\n", _dl_library_path);
+#if defined (__SUPPORT_LD_DEBUG__)
+ if(_dl_debug) _dl_dprintf(_dl_debug_file, "searching _dl_library_path: '%s'\n", _dl_library_path);
#endif
if ((tpnt1 = search_for_named_library(libname, secure, _dl_library_path, rpnt)) != NULL)
{
/* Look for libraries wherever the shared library loader
* was installed */
-#ifdef LD_DEBUG
- _dl_dprintf(_dl_debug_file, "searching in ldso dir: %s\n", _dl_ldsopath);
+#if defined (__SUPPORT_LD_DEBUG__)
+ if(_dl_debug) _dl_dprintf(_dl_debug_file, "searching in ldso dir: %s\n", _dl_ldsopath);
#endif
if ((tpnt1 = search_for_named_library(libname, secure, _dl_ldsopath, rpnt)) != NULL)
{
/* Lastly, search the standard list of paths for the library.
This list must exactly match the list in uClibc/ldso/util/ldd.c */
-#ifdef LD_DEBUG
- _dl_dprintf(_dl_debug_file, "searching full lib path list\n");
+#if defined (__SUPPORT_LD_DEBUG__)
+ if(_dl_debug) _dl_dprintf(_dl_debug_file, "searching full lib path list\n");
#endif
if ((tpnt1 = search_for_named_library(libname, secure,
UCLIBC_TARGET_PREFIX "/usr/lib:"
_dl_error_number = _dl_internal_error_number;
else
_dl_error_number = LD_ERROR_NOFILE;
-#ifdef LD_DEBUG
- _dl_dprintf(2, "Bummer: could not find '%s'!\n", libname);
+#if defined (__SUPPORT_LD_DEBUG__)
+ if(_dl_debug) _dl_dprintf(2, "Bummer: could not find '%s'!\n", libname);
#endif
return NULL;
}
return goof;
tpnt->init_flag |= COPY_RELOCS_DONE;
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
if(_dl_debug) _dl_dprintf(_dl_debug_file,"\nrelocation copy fixups: %s", tpnt->libname);
#endif
tpnt->dynamic_info[DT_RELSZ], 0);
#endif
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
if(_dl_debug) _dl_dprintf(_dl_debug_file,"\nrelocation copy fixups: %s; finished\n\n", tpnt->libname);
#endif
return goof;
* SUCH DAMAGE.
*/
-#if defined (SUPPORT_LD_DEBUG) || defined (LD_DEBUG_SYMBOLS)
+#if defined (__SUPPORT_LD_DEBUG__)
static const char *_dl_reltypes_tab[] =
{
[0] "R_386_NONE", "R_386_32", "R_386_PC32", "R_386_GOT32",
_dl_progname, strtab + symtab[symtab_index].st_name);
_dl_exit(1);
};
-#if defined (SUPPORT_LD_DEBUG) || defined (LD_NEVER_FIXUP_SYMBOLS)
+
+#if defined (__SUPPORT_LD_DEBUG__)
if ((unsigned long) got_addr < 0x40000000)
{
-#ifndef SUPPORT_LD_DEBUG
- if (_dl_debug_bindings)
- {
- _dl_dprintf(_dl_debug_file, "\nresolve function: %s",
- strtab + symtab[symtab_index].st_name);
- if(_dl_debug_detail) _dl_dprintf(_dl_debug_file, "\tpatch %x ==> %x @ %x", *got_addr, new_addr, got_addr);
- }
-#endif
-#ifndef LD_NEVER_FIXUP_SYMBOLS
- *got_addr = new_addr;
-#endif
- } else {
- *got_addr = new_addr;
+ if (_dl_debug_bindings)
+ {
+ _dl_dprintf(_dl_debug_file, "\nresolve function: %s",
+ strtab + symtab[symtab_index].st_name);
+ if(_dl_debug_detail) _dl_dprintf(_dl_debug_file,
+ "\tpatch %x ==> %x @ %x", *got_addr, new_addr, got_addr);
+ }
+ }
+ if (!_dl_debug_nofixups) {
+ *got_addr = new_addr;
}
#else
*got_addr = new_addr;
_dl_symbol(strtab + symtab[symtab_index].st_name))
continue;
-#if defined (SUPPORT_LD_DEBUG) || defined (LD_DEBUG_SYMBOLS)
+#if defined (__SUPPORT_LD_DEBUG__)
debug_sym(symtab,strtab,symtab_index);
debug_reloc(symtab,strtab,rpnt);
#endif
if (res <0)
{
int reloc_type = ELF32_R_TYPE(rpnt->r_info);
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
_dl_dprintf(2, "can't handle reloc type %s\n ", _dl_reltypes(reloc_type));
#else
_dl_dprintf(2, "can't handle reloc type %x\n", reloc_type);
}
}
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
{
unsigned long old_val = *reloc_addr;
#endif
default:
return -1; /*call _dl_exit(1) */
}
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
if(_dl_debug_reloc && _dl_debug_detail)
_dl_dprintf(_dl_debug_file, "\tpatch: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr);
}
reloc_addr = (unsigned long *) (tpnt->loadaddr + (unsigned long) rpnt->r_offset);
reloc_type = ELF32_R_TYPE(rpnt->r_info);
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
{
unsigned long old_val = *reloc_addr;
#endif
default:
return -1; /*call _dl_exit(1) */
}
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
if(_dl_debug_reloc && _dl_debug_detail)
_dl_dprintf(_dl_debug_file, "\tpatch: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr);
}
if (!symbol_addr) goof++;
}
if (!goof) {
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
if(_dl_debug_move)
_dl_dprintf(_dl_debug_file,"\n%s move %x bytes from %x to %x",
strtab + symtab[symtab_index].st_name,
* housekeeping chores and we can transfer control to the user's
* application.
*/
-#ifdef LD_DEBUG_SYMBOLS
-#ifdef SUPPORT_LD_DEBUG
-#undef SUPPORT_LD_DEBUG
-#endif
-#define SUPPORT_LD_DEBUG
-#endif
#include "ld_syscall.h"
#include "linuxelf.h"
char *_dl_preload = 0; /* Things to be loaded before the libs. */
char *_dl_ldsopath = 0;
static char *_dl_not_lazy = 0;
-#ifdef SUPPORT_LD_DEBUG
+#ifdef __SUPPORT_LD_DEBUG__
static char *_dl_debug = 0;
static char *_dl_debug_symbols = 0;
static char *_dl_debug_move = 0;
static char *_dl_debug_reloc = 0;
static char *_dl_debug_detail = 0;
+static char *_dl_debug_nofixups = 0;
static char *_dl_debug_bindings = 0;
static int _dl_debug_file = 2;
#else
auxvt[0...N] Auxiliary Vector Table elements (mixed types)
*/
-#ifdef LD_DEBUG
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
/* Debugging is especially tricky on PowerPC, since string literals
* require relocations. Thus, you can't use _dl_dprintf() for
* anything until the bootstrap relocations are finished. */
SEND_STDERR("Invalid ELF header\n");
_dl_exit(0);
}
-#ifdef LD_DEBUG
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
SEND_STDERR("ELF header=");
SEND_ADDRESS_STDERR(load_addr, 1);
#endif
Elf32_Shdr *shdr;
Elf32_Phdr *pt_load;
-#ifdef LD_DEBUG
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
SEND_STDERR("Finding the GOT using C code to read the ELF file\n");
#endif
/* Find where the dynamic linking information section is hiding */
/* Now, finally, fix up the location of the dynamic stuff */
dpnt = (Elf32_Dyn *) (*got + load_addr);
-#ifdef LD_DEBUG
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
SEND_STDERR("First Dynamic section entry=");
SEND_ADDRESS_STDERR(dpnt, 1);
#endif
/* OK, now do the relocations. We do not do a lazy binding here, so
that once we are done, we have considerably more flexibility. */
-#ifdef LD_DEBUG
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
SEND_STDERR("About to do library loader relocations.\n");
#endif
SEND_STDERR(" undefined.\n");
goof++;
}
-#ifdef LD_DEBUG_SYMBOLS
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
SEND_STDERR("About to fixup symbol: ");
SEND_STDERR(strtab + symtab[symtab_index].st_name);
SEND_STDERR("\n");
if (goof) {
_dl_exit(14);
}
-#ifdef LD_DEBUG
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
/* Wahoo!!! */
_dl_dprintf(_dl_debug_file, "Done relocating library loader, so we can now\n\tuse globals and make function calls!\n");
#endif
* Transfer control to the application.
*/
status = 0; /* Used on x86, but not on other arches */
-#ifdef LD_DEBUG
- _dl_dprintf(_dl_debug_file, "Calling application main()\n");
-#endif
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
if(_dl_debug) _dl_dprintf(_dl_debug_file,"\ntransfering control: %s\n\n", _dl_progname);
#endif
START();
}
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
static void debug_fini (int status, void *arg)
{
(void)status;
struct elf_resolve *tpnt1;
unsigned long brk_addr, *lpnt;
int (*_dl_atexit) (void *);
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
int (*_dl_on_exit) (void (*FUNCTION)(int STATUS, void *ARG),void*);
#endif
tpnt->loadaddr = (char *) load_addr;
INIT_GOT(lpnt, tpnt);
-#ifdef LD_DEBUG
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
_dl_dprintf(_dl_debug_file, "GOT found at %x\n", lpnt);
#endif
/* OK, this was a big step, now we need to scan all of the user images
if (readsize > 0 && readsize < (int)(sizeof(buf)-1)) {
pnt1 = _dl_strrchr(buf, '/');
if (pnt1 && buf != pnt1) {
-#ifdef LD_DEBUG
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
_dl_dprintf(_dl_debug_file, "changing tpnt->libname from '%s' to '%s'\n", tpnt->libname, buf);
#endif
tpnt->libname = _dl_strdup(buf);
} else {
_dl_ldsopath = tpnt->libname;
}
-#ifdef LD_DEBUG
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
_dl_dprintf(_dl_debug_file, "Lib Loader:\t(%x) %s\n", tpnt->loadaddr, tpnt->libname);
#endif
}
}
}
-#ifdef SUPPORT_LD_DEBUG
+#ifdef __SUPPORT_LD_DEBUG__
_dl_debug = _dl_getenv("LD_DEBUG", envp);
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_strstr(_dl_debug, "all");
+ = _dl_debug_reloc = _dl_debug_bindings = _dl_debug_nofixups = _dl_strstr(_dl_debug, "all");
}
else {
_dl_debug_detail = _dl_strstr(_dl_debug, "detail");
_dl_debug_move = _dl_strstr(_dl_debug, "move");
_dl_debug_symbols = _dl_strstr(_dl_debug, "sym");
_dl_debug_reloc = _dl_strstr(_dl_debug, "reloc");
+ _dl_debug_nofixups = _dl_strstr(_dl_debug, "nofix");
_dl_debug_bindings = _dl_strstr(_dl_debug, "bind");
}
}
#endif
- _dl_trace_loaded_objects = _dl_getenv("LD_TRACE_LOADED_OBJECTS", envp);
-#ifndef LD_TRACE
+ _dl_trace_loaded_objects = _dl_getenv("__LDSO_LDD_SUPPORT___LOADED_OBJECTS", envp);
+#ifndef __LDSO_LDD_SUPPORT__
if (_dl_trace_loaded_objects) {
_dl_dprintf(_dl_debug_file, "Use the ldd provided by uClibc\n");
_dl_exit(1);
{
tpnt1 = _dl_load_shared_library(_dl_secure, &rpnt, NULL, str);
if (!tpnt1) {
-#ifdef LD_TRACE
+#ifdef __LDSO_LDD_SUPPORT__
if (_dl_trace_loaded_objects)
_dl_dprintf(1, "\t%s => not found\n", str);
else {
_dl_dprintf(2, "%s: can't load "
"library '%s'\n", _dl_progname, str);
_dl_exit(15);
-#ifdef LD_TRACE
+#ifdef __LDSO_LDD_SUPPORT__
}
#endif
} else {
-#ifdef LD_DEBUG
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
_dl_dprintf(_dl_debug_file, "Loading:\t(%x) %s\n", tpnt1->loadaddr, tpnt1->libname);
#endif
-#ifdef LD_TRACE
+#ifdef __LDSO_LDD_SUPPORT__
if (_dl_trace_loaded_objects
&& tpnt1->usage_count==1) {
/* this is a real hack to make ldd not print
tpnt1 = _dl_load_shared_library(0, &rpnt, NULL, cp2);
if (!tpnt1) {
-#ifdef LD_TRACE
+#ifdef __LDSO_LDD_SUPPORT__
if (_dl_trace_loaded_objects)
_dl_dprintf(1, "\t%s => not found\n", cp2);
else {
_dl_dprintf(2, "%s: can't load library '%s'\n",
_dl_progname, cp2);
_dl_exit(15);
-#ifdef LD_TRACE
+#ifdef __LDSO_LDD_SUPPORT__
}
#endif
} else {
-#ifdef LD_DEBUG
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
_dl_dprintf(_dl_debug_file, "Loading:\t(%x) %s\n", tpnt1->loadaddr, tpnt1->libname);
#endif
-#ifdef LD_TRACE
+#ifdef __LDSO_LDD_SUPPORT__
if (_dl_trace_loaded_objects
&& tpnt1->usage_count==1) {
_dl_dprintf(1, "\t%s => %s (0x%x)\n", cp2,
if (tpnt && _dl_strcmp(lpntstr, _dl_get_last_path_component(tpnt->libname)) == 0) {
struct elf_resolve *ttmp;
-#ifdef LD_TRACE
+#ifdef __LDSO_LDD_SUPPORT__
if (_dl_trace_loaded_objects && tpnt->usage_count==1) {
_dl_dprintf(1, "\t%s => %s (0x%x)\n",
lpntstr, tpnt->libname, (unsigned) tpnt->loadaddr);
}
if (!(tpnt1 = _dl_load_shared_library(0, &rpnt, tcurr, lpntstr)))
{
-#ifdef LD_TRACE
+#ifdef __LDSO_LDD_SUPPORT__
if (_dl_trace_loaded_objects)
_dl_dprintf(1, "\t%s => not found\n", lpntstr);
else {
#endif
- _dl_dprintf(2, "%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);
-#ifdef LD_TRACE
+#ifdef __LDSO_LDD_SUPPORT__
}
#endif
} else {
-#ifdef LD_DEBUG
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
_dl_dprintf(_dl_debug_file, "Loading:\t(%x) %s\n", tpnt1->loadaddr, tpnt1->libname);
#endif
-#ifdef LD_TRACE
+#ifdef __LDSO_LDD_SUPPORT__
if (_dl_trace_loaded_objects && tpnt1->usage_count==1)
_dl_dprintf(1, "\t%s => %s (0x%x)\n", lpntstr, tpnt1->libname,
(unsigned) tpnt1->loadaddr);
_dl_unmap_cache();
#endif
/* ldd uses uses this. I am not sure how you pick up the other flags */
-#ifdef LD_TRACE
+#ifdef __LDSO_LDD_SUPPORT__
if (_dl_trace_loaded_objects) {
char *_dl_warn = 0;
_dl_warn = _dl_getenv("LD_WARN", envp);
rpnt->dyn = tpnt;
tpnt = NULL;
}
-#ifdef LD_TRACE
+#ifdef __LDSO_LDD_SUPPORT__
if (_dl_trace_loaded_objects) {
_dl_dprintf(1, "\t%s => %s (0x%x)\n", rpnt->dyn->libname + (_dl_strlen(_dl_ldsopath)) + 1,
rpnt->dyn->libname, rpnt->dyn->loadaddr);
_dl_perform_mips_global_got_relocations(_dl_loaded_modules);
#endif
-#ifdef LD_DEBUG
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
_dl_dprintf(_dl_debug_file, "Beginning relocation fixups\n");
#endif
/*
and we have to manually search for entries that require fixups.
Solaris gets this one right, from what I understand. */
-#ifdef LD_DEBUG
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
_dl_dprintf(_dl_debug_file, "Beginning copy fixups\n");
#endif
if (_dl_symbol_tables)
goof += _dl_copy_fixups(_dl_symbol_tables);
-#ifdef LD_TRACE
+#ifdef __LDSO_LDD_SUPPORT__
if (goof || _dl_trace_loaded_objects)
_dl_exit(0);
#endif
}
#endif
_dl_atexit = (int (*)(void *)) (intptr_t) _dl_find_hash("atexit", NULL, NULL, symbolrel);
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
_dl_on_exit = (int (*)(void (*)(int, void *),void*))
(intptr_t) _dl_find_hash("on_exit", NULL, NULL, symbolrel);
#endif
function call. */
((void (*)(void)) debug_addr->r_brk) ();
-#ifdef LD_DEBUG
- _dl_dprintf(_dl_debug_file, "Calling init/fini for shared libraries\n");
-#endif
-
for (rpnt = _dl_symbol_tables; rpnt!=NULL&& rpnt->next!=NULL; rpnt=rpnt->next)
;
if (tpnt->dynamic_info[DT_INIT]) {
_dl_elf_init = (int (*)(void)) (intptr_t) (tpnt->loadaddr + tpnt->dynamic_info[DT_INIT]);
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
if(_dl_debug) _dl_dprintf(_dl_debug_file,"\ncalling init: %s\n\n", tpnt->libname);
#endif
(*_dl_elf_init) ();
}
if (_dl_atexit && tpnt->dynamic_info[DT_FINI]) {
(*_dl_atexit) (tpnt->loadaddr + tpnt->dynamic_info[DT_FINI]);
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
if(_dl_debug && _dl_on_exit)
{
(*_dl_on_exit)(debug_fini, tpnt->libname);
}
#endif
}
-#ifdef LD_DEBUG
+#if defined (__SUPPORT_LD_DEBUG__)
else {
if (!_dl_atexit)
_dl_dprintf(_dl_debug_file, "%s: The address of atexit () is 0x0.\n", tpnt->libname);
if (tpnt->next)
goof += _dl_fixup(tpnt->next);
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
if(_dl_debug) _dl_dprintf(_dl_debug_file,"\nrelocation processing: %s", tpnt->libname);
#endif
goof += _dl_parse_relocation_information(tpnt, tpnt->dynamic_info[DT_JMPREL],
tpnt->dynamic_info[DT_PLTRELSZ], 0);
}
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
if(_dl_debug) {
_dl_dprintf(_dl_debug_file,"\nrelocation processing: %s", tpnt->libname);
_dl_dprintf(_dl_debug_file,"; finished\n\n");
void *retval;
#if 0
-#ifdef LD_DEBUG
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
_dl_dprintf(_dl_debug_file, "malloc: request for %d bytes\n", size);
#endif
#endif
return (*_dl_malloc_function) (size);
if (_dl_malloc_addr - _dl_mmap_zero + size > 4096) {
-#ifdef LD_DEBUG
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
_dl_dprintf(_dl_debug_file, "malloc: mmapping more memory\n");
#endif
_dl_mmap_zero = _dl_malloc_addr = _dl_mmap((void *) 0, size,
* SUCH DAMAGE.
*/
-#ifndef VERBOSE_DLINKER
-#define VERBOSE_DLINKER
-#endif
-#ifdef VERBOSE_DLINKER
+#if defined (__SUPPORT_LD_DEBUG__)
static const char *_dl_reltypes[] =
{
"R_68K_NONE",
instr_addr = (int) this_reloc->r_offset + (int) tpnt->loadaddr;
got_addr = (char **) instr_addr;
-#ifdef LD_DEBUG_SYMBOLS
- _dl_dprintf (2, "Resolving symbol %s\n",
- strtab + symtab[symtab_index].st_name);
+#ifdef __SUPPORT_LD_DEBUG__
+ if (_dl_debug_symbols) {
+ _dl_dprintf (2, "Resolving symbol %s\n", strtab + symtab[symtab_index].st_name);
+ }
#endif
/* Get the address of the GOT entry. */
_dl_progname, strtab + symtab[symtab_index].st_name);
_dl_exit (1);
}
-#ifdef LD_NEVER_FIXUP_SYMBOLS
- if ((unsigned int) got_addr < 0x40000000) {
- _dl_dprintf (2, "Calling library function: %s\n",
- strtab + symtab[symtab_index].st_name);
- } else {
- *got_addr = new_addr;
- }
+#if defined (__SUPPORT_LD_DEBUG__)
+ if ((unsigned long) got_addr < 0x40000000)
+ {
+ if (_dl_debug_bindings)
+ {
+ _dl_dprintf(_dl_debug_file, "\nresolve function: %s",
+ strtab + symtab[symtab_index].st_name);
+ if(_dl_debug_detail) _dl_dprintf(_dl_debug_file,
+ "\tpatch %x ==> %x @ %x", *got_addr, new_addr, got_addr);
+ }
+ }
+ if (!_dl_debug_nofixups) {
+ *got_addr = new_addr;
+ }
#else
- *got_addr = new_addr;
+ *got_addr = new_addr;
#endif
+
return (unsigned int) new_addr;
}
break;
default:
_dl_dprintf (2, "%s: (LAZY) can't handle reloc type ", _dl_progname);
-#ifdef VERBOSE_DLINKER
+#if defined (__SUPPORT_LD_DEBUG__)
_dl_dprintf (2, "%s ", _dl_reltypes[reloc_type]);
#endif
if (symtab_index)
break;
default:
_dl_dprintf (2, "%s: can't handle reloc type ", _dl_progname);
-#ifdef VERBOSE_DLINKER
+#if defined (__SUPPORT_LD_DEBUG__)
_dl_dprintf (2, "%s ", _dl_reltypes[reloc_type]);
#endif
if (symtab_index)
*(got + local_gotno + sym_index - gotsym) = value;
-#ifdef LD_DEBUG
+#if defined (__SUPPORT_LD_DEBUG__)
_dl_dprintf(2, "---RESOLVER---\n");
_dl_dprintf(2, "SYMTAB INDEX: %i\n", sym_index);
_dl_dprintf(2, " GOTSYM: %i\n", gotsym);
/* Relocate the global GOT entries for the object */
while(i--) {
-#ifdef LD_DEBUG
+#if defined (__SUPPORT_LD_DEBUG__)
_dl_dprintf(2,"BEFORE: %s=%x\n", strtab + sym->st_name,
*got_entry);
#endif
sym->st_name, tpnt->symbol_scope, NULL, copyrel);
}
-#ifdef LD_DEBUG
+#if defined (__SUPPORT_LD_DEBUG__)
if (*got_entry == 0)
_dl_dprintf(2,"ZERO: %s\n", strtab + sym->st_name);
else
* SUCH DAMAGE.
*/
-#ifndef VERBOSE_DLINKER
-#define VERBOSE_DLINKER
-#endif
-#ifdef VERBOSE_DLINKER
+#if defined (__SUPPORT_LD_DEBUG__)
static const char *_dl_reltypes[] =
{ "R_PPC_NONE", "R_PPC_ADDR32", "R_PPC_ADDR24", "R_PPC_ADDR16",
"R_PPC_ADDR16_LO", "R_PPC_ADDR16_HI", "R_PPC_ADDR16_HA",
working. */
-#ifdef LD_DEBUG_SYMBOLS
+#ifdef __SUPPORT_LD_DEBUG__
static void debug_sym(Elf32_Sym *symtab,char *strtab,int symtab_index);
static void debug_reloc(ELF_RELOC *rpnt);
-#define DPRINTF(fmt,args...) _dl_dprintf(2,fmt,args)
+#define DPRINTF(fmt,args...) if (_dl_debug) _dl_dprintf(2,fmt,args)
#else
#define debug_sym(a,b,c)
#define debug_reloc(a)
default:
_dl_dprintf(2, "%s: (LAZY) can't handle reloc type ",
_dl_progname);
-#ifdef VERBOSE_DLINKER
+#if defined (__SUPPORT_LD_DEBUG__)
_dl_dprintf(2, "%s ", _dl_reltypes[reloc_type]);
#endif
if (symtab_index)
break;
default:
_dl_dprintf(2, "%s: can't handle reloc type ", _dl_progname);
-#ifdef VERBOSE_DLINKER
+#if defined (__SUPPORT_LD_DEBUG__)
_dl_dprintf(2, "%s ", _dl_reltypes[reloc_type]);
#endif
if (symtab_index)
#endif
-#ifdef LD_DEBUG_SYMBOLS
+#ifdef __SUPPORT_LD_DEBUG__
static void debug_sym(Elf32_Sym *symtab,char *strtab,int symtab_index)
{
- if(symtab_index){
- _dl_dprintf(2, "sym: name=%s value=%x size=%x info=%x other=%x shndx=%x\n",
- strtab + symtab[symtab_index].st_name,
- symtab[symtab_index].st_value,
- symtab[symtab_index].st_size,
- symtab[symtab_index].st_info,
- symtab[symtab_index].st_other,
- symtab[symtab_index].st_shndx);
- }else{
- _dl_dprintf(2, "sym: null\n");
+ if (_dl_debug_symbols) {
+ if(symtab_index){
+ _dl_dprintf(2, "sym: name=%s value=%x size=%x info=%x other=%x shndx=%x\n",
+ strtab + symtab[symtab_index].st_name,
+ symtab[symtab_index].st_value,
+ symtab[symtab_index].st_size,
+ symtab[symtab_index].st_info,
+ symtab[symtab_index].st_other,
+ symtab[symtab_index].st_shndx);
+ }else{
+ _dl_dprintf(2, "sym: null\n");
+ }
}
}
static void debug_reloc(ELF_RELOC *rpnt)
{
- _dl_dprintf(2, "reloc: offset=%x type=%x sym=%x addend=%x\n",
- rpnt->r_offset,
- ELF32_R_TYPE(rpnt->r_info),
- ELF32_R_SYM(rpnt->r_info),
- rpnt->r_addend);
+ if (_dl_debug_reloc) {
+ _dl_dprintf(2, "reloc: offset=%x type=%x sym=%x addend=%x\n",
+ rpnt->r_offset,
+ ELF32_R_TYPE(rpnt->r_info),
+ ELF32_R_SYM(rpnt->r_info),
+ rpnt->r_addend);
+ }
}
#endif
pnt++;
}
-#ifdef LD_DEBUG
- _dl_dprintf(_dl_debug_file, "searching for library: '%s'\n", libname);
+#if defined (__SUPPORT_LD_DEBUG__)
+ if(_dl_debug) _dl_dprintf(_dl_debug_file, "searching for library: '%s'\n", libname);
#endif
/* If the filename has any '/', try it straight and leave it at that.
For IBCS2 compatibility under linux, we substitute the string
if (pnt) {
pnt += (unsigned long) tpnt->loadaddr +
tpnt->dynamic_info[DT_STRTAB];
-#ifdef LD_DEBUG
- _dl_dprintf(_dl_debug_file, "searching RPATH: '%s'\n", pnt);
+#if defined (__SUPPORT_LD_DEBUG__)
+ if(_dl_debug) _dl_dprintf(_dl_debug_file, "searching RPATH: '%s'\n", pnt);
#endif
if ((tpnt1 = search_for_named_library(libname, secure, pnt, rpnt)) != NULL)
{
/* Check in LD_{ELF_}LIBRARY_PATH, if specified and allowed */
if (_dl_library_path) {
-#ifdef LD_DEBUG
- _dl_dprintf(_dl_debug_file, "searching _dl_library_path: '%s'\n", _dl_library_path);
+#if defined (__SUPPORT_LD_DEBUG__)
+ if(_dl_debug) _dl_dprintf(_dl_debug_file, "searching _dl_library_path: '%s'\n", _dl_library_path);
#endif
if ((tpnt1 = search_for_named_library(libname, secure, _dl_library_path, rpnt)) != NULL)
{
/* Look for libraries wherever the shared library loader
* was installed */
-#ifdef LD_DEBUG
- _dl_dprintf(_dl_debug_file, "searching in ldso dir: %s\n", _dl_ldsopath);
+#if defined (__SUPPORT_LD_DEBUG__)
+ if(_dl_debug) _dl_dprintf(_dl_debug_file, "searching in ldso dir: %s\n", _dl_ldsopath);
#endif
if ((tpnt1 = search_for_named_library(libname, secure, _dl_ldsopath, rpnt)) != NULL)
{
/* Lastly, search the standard list of paths for the library.
This list must exactly match the list in uClibc/ldso/util/ldd.c */
-#ifdef LD_DEBUG
- _dl_dprintf(_dl_debug_file, "searching full lib path list\n");
+#if defined (__SUPPORT_LD_DEBUG__)
+ if(_dl_debug) _dl_dprintf(_dl_debug_file, "searching full lib path list\n");
#endif
if ((tpnt1 = search_for_named_library(libname, secure,
UCLIBC_TARGET_PREFIX "/usr/lib:"
_dl_error_number = _dl_internal_error_number;
else
_dl_error_number = LD_ERROR_NOFILE;
-#ifdef LD_DEBUG
- _dl_dprintf(2, "Bummer: could not find '%s'!\n", libname);
+#if defined (__SUPPORT_LD_DEBUG__)
+ if(_dl_debug) _dl_dprintf(2, "Bummer: could not find '%s'!\n", libname);
#endif
return NULL;
}
return goof;
tpnt->init_flag |= COPY_RELOCS_DONE;
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
if(_dl_debug) _dl_dprintf(_dl_debug_file,"\nrelocation copy fixups: %s", tpnt->libname);
#endif
tpnt->dynamic_info[DT_RELSZ], 0);
#endif
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
if(_dl_debug) _dl_dprintf(_dl_debug_file,"\nrelocation copy fixups: %s; finished\n\n", tpnt->libname);
#endif
return goof;
* SUCH DAMAGE.
*/
-#if defined (SUPPORT_LD_DEBUG) || defined (LD_DEBUG_SYMBOLS)
+#if defined (__SUPPORT_LD_DEBUG__)
static const char *_dl_reltypes_tab[] =
{
[0] "R_SH_NONE", "R_SH_DIR32", "R_SH_REL32", "R_SH_DIR8WPN",
_dl_exit(1);
}
-#if defined (SUPPORT_LD_DEBUG) || defined (LD_NEVER_FIXUP_SYMBOLS)
+#if defined (__SUPPORT_LD_DEBUG__)
if ((unsigned long) got_addr < 0x20000000)
{
-#ifndef SUPPORT_LD_DEBUG
- if (_dl_debug_bindings)
- {
- _dl_dprintf(_dl_debug_file, "\nresolve function: %s",
- strtab + symtab[symtab_index].st_name);
- if(_dl_debug_detail) _dl_dprintf(_dl_debug_file, "\tpatch %x ==> %x @ %x", *got_addr, new_addr, got_addr);
- }
-#endif
-#ifndef LD_NEVER_FIXUP_SYMBOLS
- *got_addr = new_addr;
-#endif
- } else {
- *got_addr = new_addr;
+ if (_dl_debug_bindings)
+ {
+ _dl_dprintf(_dl_debug_file, "\nresolve function: %s",
+ strtab + symtab[symtab_index].st_name);
+ if(_dl_debug_detail) _dl_dprintf(_dl_debug_file,
+ "\tpatch %x ==> %x @ %x", *got_addr, new_addr, got_addr);
+ }
+ }
+ if (!_dl_debug_nofixups) {
+ *got_addr = new_addr;
}
#else
*got_addr = new_addr;
_dl_symbol(strtab + symtab[symtab_index].st_name))
continue;
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
debug_sym(symtab,strtab,symtab_index);
debug_reloc(symtab,strtab,rpnt);
#endif
if (res <0)
{
int reloc_type = ELF32_R_TYPE(rpnt->r_info);
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
_dl_dprintf(2, "can't handle reloc type %s\n ", _dl_reltypes(reloc_type));
#else
_dl_dprintf(2, "can't handle reloc type %x\n", reloc_type);
}
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
{
unsigned long old_val = *reloc_addr;
#endif
default:
return -1; /*call _dl_exit(1) */
}
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
if(_dl_debug_reloc && _dl_debug_detail)
_dl_dprintf(_dl_debug_file, "\tpatch: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr);
}
reloc_addr = (unsigned long *)(intptr_t) (tpnt->loadaddr + (unsigned long) rpnt->r_offset);
reloc_type = ELF32_R_TYPE(rpnt->r_info);
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
{
unsigned long old_val = *reloc_addr;
#endif
default:
return -1; /*call _dl_exit(1) */
}
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
if(_dl_debug_reloc && _dl_debug_detail)
_dl_dprintf(_dl_debug_file, "\tpatch: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr);
}
if (!symbol_addr) goof++;
}
if (!goof) {
-#if defined (SUPPORT_LD_DEBUG)
+#if defined (__SUPPORT_LD_DEBUG__)
if(_dl_debug_move)
_dl_dprintf(_dl_debug_file,"\n%s move %x bytes from %x to %x",
strtab + symtab[symtab_index].st_name,
* SUCH DAMAGE.
*/
-#ifndef VERBOSE_DLINKER
-#define VERBOSE_DLINKER
-#endif
-#ifdef VERBOSE_DLINKER
+#if defined (__SUPPORT_LD_DEBUG__)
static const char * _dl_reltypes[] = { "R_SPARC_NONE", "R_SPARC_8",
"R_SPARC_16", "R_SPARC_32", "R_SPARC_DISP8", "R_SPARC_DISP16",
"R_SPARC_DISP32", "R_SPARC_WDISP30", "R_SPARC_WDISP22",
_dl_dprintf(2, "symtab_index %d\n", symtab_index);
-#ifdef LD_DEBUG_SYMBOLS
- _dl_dprintf(2, "Resolving symbol %s\n",
- strtab + symtab[symtab_index].st_name);
+#ifdef __SUPPORT_LD_DEBUG__
+ if (_dl_debug_symbols) {
+ _dl_dprintf(2, "Resolving symbol %s\n",
+ strtab + symtab[symtab_index].st_name);
+ }
#endif
/* Get the address of the GOT entry */
_dl_progname, strtab + symtab[symtab_index].st_name);
_dl_exit(31);
};
-#ifdef LD_NEVER_FIXUP_SYMBOLS
- if((unsigned int) got_addr < 0x40000000) {
- _dl_dprintf(2, "Calling library function: %s\n",
- strtab + symtab[symtab_index].st_name);
- } else {
- got_addr[1] = (char *) (0x03000000 | (((unsigned int) new_addr >> 10) & 0x3fffff));
- got_addr[2] = (char *) (0x81c06000 | ((unsigned int) new_addr & 0x3ff));
- }
+
+#if defined (__SUPPORT_LD_DEBUG__)
+ if ((unsigned long) got_addr < 0x40000000)
+ {
+ if (_dl_debug_bindings)
+ {
+ _dl_dprintf(_dl_debug_file, "\nresolve function: %s",
+ strtab + symtab[symtab_index].st_name);
+ if(_dl_debug_detail) _dl_dprintf(_dl_debug_file,
+ "\tpatch %x ==> %x @ %x", *got_addr, new_addr, got_addr);
+ }
+ }
+ if (!_dl_debug_nofixups) {
+ got_addr[1] = (char *) (0x03000000 | (((unsigned int) new_addr >> 10) & 0x3fffff));
+ got_addr[2] = (char *) (0x81c06000 | ((unsigned int) new_addr & 0x3ff));
+ }
#else
- got_addr[1] = (char *) (0x03000000 | (((unsigned int) new_addr >> 10) & 0x3fffff));
- got_addr[2] = (char *) (0x81c06000 | ((unsigned int) new_addr & 0x3ff));
+ got_addr[1] = (char *) (0x03000000 | (((unsigned int) new_addr >> 10) & 0x3fffff));
+ got_addr[2] = (char *) (0x81c06000 | ((unsigned int) new_addr & 0x3ff));
#endif
- _dl_dprintf(2, "Address = %x\n",new_addr);
- _dl_exit(32);
+
+ _dl_dprintf(2, "Address = %x\n",new_addr);
+ _dl_exit(32);
return (unsigned int) new_addr;
}
break;
default:
_dl_dprintf(2, "%s: (LAZY) can't handle reloc type ", _dl_progname);
-#ifdef VERBOSE_DLINKER
+#if defined (__SUPPORT_LD_DEBUG__)
_dl_dprintf(2, "%s ", _dl_reltypes[reloc_type]);
#endif
if(symtab_index) _dl_dprintf(2, "'%s'\n",
break;
default:
_dl_dprintf(2, "%s: can't handle reloc type ", _dl_progname);
-#ifdef VERBOSE_DLINKER
+#if defined (__SUPPORT_LD_DEBUG__)
_dl_dprintf(2, "%s ", _dl_reltypes[reloc_type]);
#endif
if (symtab_index)