* sysdeps/arm/dl-machine.h: Likewise.
* sysdeps/hppa/dl-machine.h: Likewise.
* sysdeps/m68k/dl-machine.h: Likewise.
* sysdeps/powerpc/dl-machine.h: Likewise.
* sysdeps/s390/dl-machine.h: Likewise.
* sysdeps/sh/dl-machine.h: Likewise.
* sysdeps/generic/dl-sysdep.c: Likewise.
* sysdeps/generic/libc-start.c: Likewise.
* sysdeps/i386/dl-machine.h: Likewise.
+ * sysdeps/arm/dl-machine.h: Likewise.
+ * sysdeps/hppa/dl-machine.h: Likewise.
+ * sysdeps/m68k/dl-machine.h: Likewise.
+ * sysdeps/powerpc/dl-machine.h: Likewise.
+ * sysdeps/s390/dl-machine.h: Likewise.
+ * sysdeps/sh/dl-machine.h: Likewise.
* sysdeps/unix/sysv/linux/dl-osinfo.h: Likewise.
* sysdeps/unix/sysv/linux/i386/dl-librecon.h: Likewise.
* sysdeps/unix/sysv/linux/i386/dl-procinfo.h: Likewise.
#include <sys/types.h>
#include <sys/mman.h>
-#include <stdio-common/_itoa.h>
-
/* Type of the constructor functions. */
typedef void (*fini_t) (void);
buf[sizeof buf - 1] = '\0';
- _dl_debug_message (1, "\nclosing file=", map->l_name,
- "; opencount == ",
- _itoa_word (map->l_opencount,
- buf + sizeof buf - 1, 10, 0),
- "\n", NULL);
+ _dl_debug_printf ("\nclosing file=%s; opencount == %u\n",
+ map->l_name, map->l_opencount);
}
/* One decrement the object itself, not the dependencies. */
&& imap->l_init_called)
{
/* When debugging print a message first. */
- if (//__builtin_expect (_dl_debug_impcalls, 0))
- __builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
- _dl_debug_message (1, "\ncalling fini: ", imap->l_name,
- "\n\n", NULL);
+ if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
+ _dl_debug_printf ("\ncalling fini: %s\n\n", imap->l_name);
/* Call its termination function. */
if (imap->l_info[DT_FINI_ARRAY] != NULL)
{ \
/* This is for DT_AUXILIARY. */ \
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0)) \
- _dl_debug_message (1, "cannot load auxiliary `", __str, \
- "' because of empty dynamic string" \
- " token substitution\n", NULL); \
+ _dl_debug_printf ("cannot load auxiliary `%s' because of" \
+ "empty dynamic string token " \
+ "substitution\n", __str); \
continue; \
} \
} \
{
/* Say that we are about to load an auxiliary library. */
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0))
- _dl_debug_message (1, "load auxiliary object=",
- name, " requested by file=",
- l->l_name[0]
- ? l->l_name : _dl_argv[0],
- "\n", NULL);
+ _dl_debug_printf ("load auxiliary object=%s"
+ " requested by file=%s\n", name,
+ l->l_name[0]
+ ? l->l_name : _dl_argv[0]);
/* We must be prepared that the addressed shared
object is not available. */
{
/* Say that we are about to load an auxiliary library. */
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0))
- _dl_debug_message (1, "load filtered object=", name,
- " requested by file=",
- l->l_name[0]
- ? l->l_name : _dl_argv[0],
- "\n", NULL);
+ _dl_debug_printf ("load filtered object=%s"
+ " requested by file=%s\n", name,
+ l->l_name[0]
+ ? l->l_name : _dl_argv[0]);
/* For filter objects the dependency must be available. */
if (_dl_catch_error (&objname, &errstring, openaux, &args))
/* Error handling for runtime dynamic linker.
- Copyright (C) 1995,96,97,98,99,2000 Free Software Foundation, Inc.
+ Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
{
/* Lossage while resolving the program's own symbols is always fatal. */
char buffer[1024];
- _dl_sysdep_fatal (_dl_argv[0] ?: "<program name unknown>",
- ": error while loading shared libraries: ",
+ _dl_fatal_printf ("\
+%s: error while loading shared libraries: %s%s%s%s%s\n",
+ _dl_argv[0] ?: "<program name unknown>",
objname ?: "", objname && *objname ? ": " : "",
errstring, errcode ? ": " : "",
(errcode
? __strerror_r (errcode, buffer, sizeof buffer)
- : ""), "\n", NULL);
+ : ""));
}
}
old = tsd_getspecific ();
errcode = setjmp (c.env);
- if (errcode == 0)
+ if (__builtin_expect (errcode, 0) == 0)
{
tsd_setspecific (&c);
(*operate) (args);
/* When debugging print a message first. */
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
- _dl_debug_message (1, "\ncalling fini: ",
- l->l_name[0] ? l->l_name : _dl_argv[0],
- "\n\n", NULL);
+ _dl_debug_printf ("\ncalling fini: %s\n\n",
+ l->l_name[0] ? l->l_name : _dl_argv[0]);
/* First see whether an array is given. */
if (l->l_info[DT_FINI_ARRAY] != NULL)
/* Print a debug message if wanted. */
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
- _dl_debug_message (1, "\ncalling init: ",
- l->l_name[0] ? l->l_name : _dl_argv[0], "\n\n", NULL);
+ _dl_debug_printf ("\ncalling init: %s\n\n",
+ l->l_name[0] ? l->l_name : _dl_argv[0]);
/* Now run the local constructors. There are two forms of them:
- the one named by DT_INIT
unsigned int cnt;
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
- _dl_debug_message (1, "\ncalling preinit: ",
- main_map->l_name[0]
- ? main_map->l_name : _dl_argv[0], "\n\n", NULL);
+ _dl_debug_printf ("\ncalling preinit: %s\n\n",
+ main_map->l_name[0]
+ ? main_map->l_name : _dl_argv[0]);
addrs = (ElfW(Addr) *) (main_map->l_info[DT_PREINIT_ARRAY]->d_un.d_ptr
+ main_map->l_addr);
#include <sys/stat.h>
#include <sys/types.h>
#include "dynamic-link.h"
-#include <stdio-common/_itoa.h>
#include <dl-dst.h>
/* Print debugging message. */
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0))
- _dl_debug_message (1, "file=", name, "; generating link map\n", NULL);
+ _dl_debug_printf ("file=%s; generating link map\n", name);
/* This is the ELF header. We read it in `open_verify'. */
header = (void *) fbp->buf;
l->l_entry += l->l_addr;
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0))
- {
- const size_t nibbles = sizeof (void *) * 2;
- char buf1[nibbles + 1];
- char buf2[nibbles + 1];
- char buf3[nibbles + 1];
-
- buf1[nibbles] = '\0';
- buf2[nibbles] = '\0';
- buf3[nibbles] = '\0';
-
- memset (buf1, '0', nibbles);
- memset (buf2, '0', nibbles);
- memset (buf3, '0', nibbles);
- _itoa_word ((unsigned long int) l->l_ld, &buf1[nibbles], 16, 0);
- _itoa_word ((unsigned long int) l->l_addr, &buf2[nibbles], 16, 0);
- _itoa_word (maplength, &buf3[nibbles], 16, 0);
-
- _dl_debug_message (1, " dynamic: 0x", buf1, " base: 0x", buf2,
- " size: 0x", buf3, "\n", NULL);
- memset (buf1, '0', nibbles);
- memset (buf2, '0', nibbles);
- memset (buf3, ' ', nibbles);
- _itoa_word ((unsigned long int) l->l_entry, &buf1[nibbles], 16, 0);
- _itoa_word ((unsigned long int) l->l_phdr, &buf2[nibbles], 16, 0);
- _itoa_word (l->l_phnum, &buf3[nibbles], 10, 0);
- _dl_debug_message (1, " entry: 0x", buf1, " phdr: 0x", buf2,
- " phnum: ", buf3, "\n\n", NULL);
- }
+ _dl_debug_printf (" dynamic: 0x%0*lx base: 0x%0*lx size: 0x%0*Zx\n"
+ " entry: 0x%0*lx phdr: 0x%0*lx phnum: %*u\n\n",
+ sizeof (void *) * 2, (unsigned long int) l->l_ld,
+ sizeof (void *) * 2, (unsigned long int) l->l_addr,
+ sizeof (void *) * 2, maplength,
+ sizeof (void *) * 2, (unsigned long int) l->l_entry,
+ sizeof (void *) * 2, (unsigned long int) l->l_phdr,
+ sizeof (void *) * 2, l->l_phnum);
elf_get_dynamic_info (l);
char buf[max_dirnamelen + max_capstrlen];
int first = 1;
- _dl_debug_message (1, " search path=", NULL);
+ _dl_debug_printf (" search path=");
while (*list != NULL && (*list)->what == what) /* Yes, ==. */
{
cp[0] = '\0';
else
cp[-1] = '\0';
- _dl_debug_message (0, first ? "" : ":", buf, NULL);
- first = 0;
+ if (first)
+ {
+ _dl_debug_printf_c ("%s", buf);
+ first = 0;
+ }
+ else
+ _dl_debug_printf_c (":%s", buf);
}
++list;
}
if (name != NULL)
- _dl_debug_message (0, "\t\t(", what, " from file ",
- name[0] ? name : _dl_argv[0], ")\n", NULL);
+ _dl_debug_printf_c ("\t\t(%s from file %s)\n", what,
+ name[0] ? name : _dl_argv[0]);
else
- _dl_debug_message (0, "\t\t(", what, ")\n", NULL);
+ _dl_debug_printf_c ("\t\t(%s)\n", what);
}
\f
/* Open a file and verify it is an ELF file for this architecture. We
/* Print name we try if this is wanted. */
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0))
- _dl_debug_message (1, " trying file=", buf, "\n", NULL);
+ _dl_debug_printf (" trying file=%s\n", buf);
fd = open_verify (buf, fbp);
if (this_dir->status[cnt] == unknown)
/* Display information if we are debugging. */
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0) && loader != NULL)
- _dl_debug_message (1, "\nfile=", name, "; needed by ",
- loader->l_name[0] ? loader->l_name : _dl_argv[0],
- "\n", NULL);
+ _dl_debug_printf ("\nfile=%s; needed by %s\n", name,
+ loader->l_name[0] ? loader->l_name : _dl_argv[0]);
if (strchr (name, '/') == NULL)
{
size_t namelen = strlen (name) + 1;
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0))
- _dl_debug_message (1, "find library=", name, "; searching\n", NULL);
+ _dl_debug_printf ("find library=%s; searching\n", name);
fd = -1;
/* Add another newline when we a tracing the library loading. */
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0))
- _dl_debug_message (1, "\n", NULL);
+ _dl_debug_printf ("\n");
}
else
{
/* Display information if we are debugging. */
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0))
- _dl_debug_message (1, "\nfile=",
- map->l_name[0] ? map->l_name : _dl_argv[0],
- "; needed by ",
- undef_map->l_name[0]
- ? undef_map->l_name : _dl_argv[0],
- " (relocation dependency)\n\n", NULL);
+ _dl_debug_printf ("\
+\nfile=%s; needed by %s (relocation dependency)\n\n",
+ map->l_name[0] ? map->l_name : _dl_argv[0],
+ undef_map->l_name[0]
+ ? undef_map->l_name : _dl_argv[0]);
}
else
/* Whoa, that was bad luck. We have to search again. */
protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED;
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_BINDINGS, 0))
- _dl_debug_message (1, "binding file ",
- (reference_name && reference_name[0]
- ? reference_name
- : (_dl_argv[0] ?: "<main program>")),
- " to ", current_value.m->l_name[0]
+ _dl_debug_printf ("binding file %s to %s: %s symbol `%s'\n",
+ (reference_name && reference_name[0]
+ ? reference_name : (_dl_argv[0] ?: "<main program>")),
+ current_value.m->l_name[0]
? current_value.m->l_name : _dl_argv[0],
- ": ", protected ? "protected" : "normal",
- " symbol `", undef_name, "'\n", NULL);
+ protected ? "protected" : "normal", undef_name);
if (__builtin_expect (protected == 0, 1))
{
protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED;
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_BINDINGS, 0))
- _dl_debug_message (1, "binding file ",
+ _dl_debug_printf ("binding file %s to %s: %s symbol `%s'\n",
(reference_name && reference_name[0]
- ? reference_name
- : (_dl_argv[0] ?: "<main program>")),
- " to ", current_value.m->l_name[0]
+ ? reference_name : (_dl_argv[0] ?: "<main program>")),
+ current_value.m->l_name[0]
? current_value.m->l_name : _dl_argv[0],
- ": ", protected ? "protected" : "normal",
- " symbol `", undef_name, "'\n", NULL);
+ protected ? "protected" : "normal", undef_name);
if (__builtin_expect (protected == 0, 1))
{
protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED;
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_BINDINGS, 0))
- _dl_debug_message (1, "binding file ",
+ _dl_debug_printf ("binding file %s to %s: %s symbol `%s' [%s]\n",
(reference_name && reference_name[0]
- ? reference_name
- : (_dl_argv[0] ?: "<main program>")),
- " to ", current_value.m->l_name[0]
+ ? reference_name : (_dl_argv[0] ?: "<main program>")),
+ current_value.m->l_name[0]
? current_value.m->l_name : _dl_argv[0],
- ": ", protected ? "protected" : "normal",
- " symbol `", undef_name, "' [", version->name,
- "]\n", NULL);
+ protected ? "protected" : "normal",
+ undef_name, version->name);
if (__builtin_expect (protected == 0, 1))
{
protected = *ref && ELFW(ST_VISIBILITY) ((*ref)->st_other) == STV_PROTECTED;
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_BINDINGS, 0))
- _dl_debug_message (1, "binding file ",
- (reference_name && reference_name[0]
- ? reference_name
- : (_dl_argv[0] ?: "<main program>")),
- " to ", current_value.m->l_name[0]
- ? current_value.m->l_name : _dl_argv[0],
- ": ", protected ? "protected" : "normal",
- " symbol `", undef_name, "' [", version->name,
- "]\n", NULL);
+ _dl_debug_printf ("binding file %s to %s: %s symbol `%s' [%s]\n",
+ (reference_name && reference_name[0]
+ ? reference_name : (_dl_argv[0] ?: "<main program>")),
+ current_value.m->l_name[0]
+ ? current_value.m->l_name : _dl_argv[0],
+ protected ? "protected" : "normal",
+ undef_name, version->name);
if (__builtin_expect (protected == 0, 1))
{
__assert_fail (const char *assertion,
const char *file, unsigned int line, const char *function)
{
- char buf[64];
- buf[sizeof buf - 1] = '\0';
- _dl_sysdep_fatal ("BUG IN DYNAMIC LINKER ld.so: ",
- file, ": ", _itoa_word (line, buf + sizeof buf - 1, 10, 0),
- ": ", function ?: "", function ? ": " : "",
- "Assertion `", assertion, "' failed!\n",
- NULL);
+ _dl_fatal_printf ("\
+BUG IN DYNAMIC LINKER ld.so: %s: %u: %s%sAssertion `%s' failed!\n",
+ file, line, function ?: "", function ? ": " : "",
+ assertion);
}
const char *function)
{
char errbuf[64];
- char buf[64];
- buf[sizeof buf - 1] = '\0';
- _dl_sysdep_fatal ("BUG IN DYNAMIC LINKER ld.so: ",
- file, ": ", _itoa_word (line, buf + sizeof buf - 1, 10, 0),
- ": ", function ?: "", function ? ": " : "",
- "Unexpected error: ",
- __strerror_r (errnum, errbuf, sizeof (errbuf)), "\n",
- NULL);
-
+ _dl_fatal_printf ("\
+BUG IN DYNAMIC LINKER ld.so: %s: %u: %s%sUnexpected error: %s\n",
+ file, line, function ?: "", function ? ": " : "",
+ __strerror_r (errnum, errbuf, sizeof (errbuf)));
}
#endif
{
/* Let the user know about the opencount. */
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0))
- {
- char buf[20];
-
- buf[sizeof buf - 1] = '\0';
-
- _dl_debug_message (1, "opening file=", new->l_name,
- "; opencount == ",
- _itoa_word (new->l_opencount,
- buf + sizeof buf - 1, 10, 0),
- "\n\n", NULL);
- }
+ _dl_debug_printf ("opening file=%s; opencount == %u\n\n",
+ new->l_name, new->l_opencount);
/* If the user requested the object to be in the global namespace
but it is not so far, add it now. */
/* Let the user know about the opencount. */
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0))
- {
- char buf[20];
-
- buf[sizeof buf - 1] = '\0';
-
- _dl_debug_message (1, "opening file=", new->l_name,
- "; opencount == ",
- _itoa_word (new->l_opencount,
- buf + sizeof buf - 1, 10, 0),
- "\n\n", NULL);
- }
+ _dl_debug_printf ("opening file=%s; opencount == %u\n\n",
+ new->l_name, new->l_opencount);
}
numbuf[0] = '0' + scope_cnt;
numbuf[1] = '\0';
- _dl_sysdep_message ("scope ", numbuf, ":", NULL);
+ _dl_printf ("scope %s:", numbuf);
for (cnt = 0; cnt < new->l_scope[scope_cnt]->r_nlist; ++cnt)
if (*new->l_scope[scope_cnt]->r_list[cnt]->l_name)
- _dl_sysdep_message (" ",
- new->l_scope[scope_cnt]->r_list[cnt]->l_name,
- NULL);
+ _dl_printf (" %s", new->l_scope[scope_cnt]->r_list[cnt]->l_name)
else
- _dl_sysdep_message (" <main>", NULL);
+ _dl_printf (" <main>", NULL);
- _dl_sysdep_message ("\n", NULL);
+ _dl_printf ("\n", NULL);
}
}
#endif
{
/* We cannot write the profiling data so don't do anything. */
char buf[400];
- _dl_sysdep_message (filename, ": cannot open file: ",
- __strerror_r (errno, buf, sizeof buf),
- "\n", NULL);
+ _dl_error_printf ("%s: cannot open file: %s\n", filename,
+ __strerror_r (errno, buf, sizeof buf));
return;
}
char buf[400];
int errnum = errno;
__close (fd);
- _dl_sysdep_message (filename, ": cannot stat file: ",
- __strerror_r (errnum, buf, sizeof buf),
- "\n", NULL);
+ _dl_error_printf ("%s: cannot stat file: %s\n", filename,
+ __strerror_r (errnum, buf, sizeof buf));
return;
}
cannot_create:
errnum = errno;
__close (fd);
- _dl_sysdep_message (filename, ": cannot create file: ",
- __strerror_r (errnum, buf, sizeof buf),
- "\n", NULL);
+ _dl_error_printf ("%s: cannot create file: %s\n", filename,
+ __strerror_r (errnum, buf, sizeof buf));
return;
}
if (addr != NULL)
__munmap ((void *) addr, expected_size);
- _dl_sysdep_message (filename,
- ": file is no correct profile data file for `",
- _dl_profile, "'\n", NULL);
+ _dl_error_printf ("%s: file is no correct profile data file for `%s'\n",
+ filename, _dl_profile);
return;
}
char buf[400];
int errnum = errno;
__close (fd);
- _dl_sysdep_message (filename, ": cannot map file: ",
- __strerror_r (errnum, buf, sizeof buf),
- "\n", NULL);
+ _dl_error_printf ("%s: cannot map file: %s\n", filename,
+ __strerror_r (errnum, buf, sizeof buf));
return;
}
if (tos == NULL)
{
__munmap ((void *) addr, expected_size);
- _dl_sysdep_fatal ("Out of memory while initializing profiler\n", NULL);
+ _dl_fatal_printf ("Out of memory while initializing profiler\n");
/* NOTREACHED */
}
lazy = 0;
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_RELOC, 0))
- _dl_debug_message (1, "\nrelocation processing: ",
- l->l_name[0] ? l->l_name : _dl_argv[0],
- lazy ? " (lazy)\n" : "\n", NULL);
+ _dl_printf ("\nrelocation processing: %s%s\n",
+ l->l_name[0] ? l->l_name : _dl_argv[0], lazy ? " (lazy)" : "");
if (__builtin_expect (l->l_info[DT_TEXTREL] != NULL, 0))
{
if it only contains lead function) the l_info[DT_PLTRELSZ]
will be NULL. */
if (l->l_info[DT_PLTRELSZ] == NULL)
- _dl_sysdep_fatal (_dl_argv[0] ?: "<program name unknown>",
- ": profiler found no PLTREL in object ",
- l->l_name, "\n", NULL);
+ _dl_fatal_printf ("%s: profiler found no PLTREL in object %s\n",
+ _dl_argv[0] ?: "<program name unknown>",
+ l->l_name);
l->l_reloc_result =
(ElfW(Addr) *) calloc (sizeof (ElfW(Addr)),
l->l_info[DT_PLTRELSZ]->d_un.d_val);
if (l->l_reloc_result == NULL)
- _dl_sysdep_fatal (_dl_argv[0] ?: "<program name unknown>",
- ": profiler out of memory shadowing PLTREL of ",
- l->l_name, "\n", NULL);
+ _dl_fatal_printf ("\
+%s: profiler out of memory shadowing PLTREL of %s\n",
+ _dl_argv[0] ?: "<program name unknown>",
+ l->l_name);
}
}
/* Display information about what we are doing while debugging. */
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_VERSIONS, 0))
- _dl_debug_message (1, "checking for version `", string, "' in file ",
- map->l_name[0] ? map->l_name : _dl_argv[0],
- " required by file ", name, "\n", NULL);
+ _dl_debug_printf ("\
+checking for version `%s' in file %s required by file %s\n",
+ string, map->l_name[0] ? map->l_name : _dl_argv[0],
+ name);
if (__builtin_expect (map->l_info[VERSYMIDX (DT_VERDEF)] == NULL, 0))
{
/* Print some debugging info if wanted. */
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_SYMBOLS, 0))
- _dl_debug_message (1, "symbol=", undef_name, "; lookup in file=",
- map->l_name[0] ? map->l_name : _dl_argv[0],
- "\n", NULL);
+ _dl_debug_printf ("symbol=%s; lookup in file=%s\n", undef_name,
+ map->l_name[0] ? map->l_name : _dl_argv[0]);
symtab = (const void *) D_PTR (map, l_info[DT_SYMTAB]);
strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
/* If we have no further argument the program was called incorrectly.
Grant the user some education. */
if (_dl_argc < 2)
- _dl_sysdep_fatal ("\
+ _dl_fatal_printf ("\
Usage: ld.so [OPTION]... EXECUTABLE-FILE [ARGS-FOR-PROGRAM...]\n\
You have invoked `ld.so', the helper program for shared library executables.\n\
This program usually lives in the file `/lib/ld.so', and special directives\n\
--library-path PATH use given PATH instead of content of the environment\n\
variable LD_LIBRARY_PATH\n\
--inhibit-rpath LIST ignore RUNPATH and RPATH information in object names\n\
- in LIST\n",
- NULL);
+ in LIST\n");
++_dl_skip_args;
--_dl_argc;
This will be what dlopen on "" returns. */
_dl_new_object ((char *) "", "", lt_executable, NULL);
if (_dl_loaded == NULL)
- _dl_sysdep_fatal ("cannot allocate memory for link map\n", NULL);
+ _dl_fatal_printf ("cannot allocate memory for link map\n");
_dl_loaded->l_phdr = phdr;
_dl_loaded->l_phnum = phnum;
_dl_loaded->l_entry = *user_entry;
functions we call below for output may no longer work properly
after relocation. */
if (! _dl_loaded->l_info[DT_NEEDED])
- _dl_sysdep_message ("\t", "statically linked\n", NULL);
+ _dl_printf ("\tstatically linked\n");
else
{
struct link_map *l;
for (l = _dl_loaded->l_next; l; l = l->l_next)
if (l->l_faked)
/* The library was not found. */
- _dl_sysdep_message ("\t", l->l_libname->name, " => not found\n",
- NULL);
+ _dl_printf ("\t%s => not found\n", l->l_libname->name);
else
- {
- char buf[20], *bp;
- buf[sizeof buf - 1] = '\0';
- bp = _itoa_word (l->l_addr, &buf[sizeof buf - 1], 16, 0);
- while ((size_t) (&buf[sizeof buf - 1] - bp)
- < sizeof l->l_addr * 2)
- *--bp = '0';
- _dl_sysdep_message ("\t", l->l_libname->name, " => ",
- l->l_name, " (0x", bp, ")\n", NULL);
- }
+ _dl_printf ("\t%s => %s (0x%0*Zx)\n", l->l_libname->name,
+ l->l_name, sizeof l->l_addr * 2, l->l_addr);
}
if (__builtin_expect (mode, trace) != trace)
const ElfW(Sym) *ref = NULL;
ElfW(Addr) loadbase;
lookup_t result;
- char buf[20], *bp;
result = _dl_lookup_symbol (_dl_argv[i], _dl_loaded,
&ref, _dl_loaded->l_scope,
loadbase = LOOKUP_VALUE_ADDRESS (result);
- buf[sizeof buf - 1] = '\0';
- bp = _itoa_word (ref->st_value, &buf[sizeof buf - 1], 16, 0);
- while ((size_t) (&buf[sizeof buf - 1] - bp) < sizeof loadbase * 2)
- *--bp = '0';
- _dl_sysdep_message (_dl_argv[i], " found at 0x", bp, NULL);
- buf[sizeof buf - 1] = '\0';
- bp = _itoa_word (loadbase, &buf[sizeof buf - 1], 16, 0);
- while ((size_t) (&buf[sizeof buf - 1] - bp) < sizeof loadbase * 2)
- *--bp = '0';
- _dl_sysdep_message (" in object at 0x", bp, "\n", NULL);
+ _dl_printf ("%s found at 0x%0*Zd in object at 0x%0*Zd\n",
+ _dl_argv[i], sizeof ref->st_value * 2, ref->st_value,
+ sizeof loadbase * 2, loadbase);
}
else
{
if (first)
{
- _dl_sysdep_message ("\n\tVersion information:\n", NULL);
+ _dl_printf ("\n\tVersion information:\n");
first = 0;
}
- _dl_sysdep_message ("\t", (map->l_name[0]
- ? map->l_name : _dl_argv[0]),
- ":\n", NULL);
+ _dl_printf ("\t%s:\n",
+ map->l_name[0] ? map->l_name : _dl_argv[0]);
while (1)
{
{
const char *fname = NULL;
- _dl_sysdep_message ("\t\t",
- strtab + ent->vn_file,
- " (", strtab + aux->vna_name,
- ") ",
- (aux->vna_flags
- & VER_FLG_WEAK
- ? "[WEAK] " : ""),
- "=> ", NULL);
-
if (needed != NULL
&& match_version (strtab + aux->vna_name,
needed))
fname = needed->l_name;
- _dl_sysdep_message (fname ?: "not found", "\n",
- NULL);
+ _dl_printf ("\t\t%s (%s) %s=> %s\n",
+ strtab + ent->vn_file,
+ strtab + aux->vna_name,
+ aux->vna_flags & VER_FLG_WEAK
+ ? "[WEAK] " : "",
+ fname ?: "not found");
if (aux->vna_next == 0)
/* No more symbols. */
{
if (objname[0] == '\0')
objname = _dl_argv[0] ?: "<main program>";
- _dl_sysdep_error (errstring, " (", objname, ")\n", NULL);
+ _dl_error_printf ("%s (%s)\n", errstring, objname);
}
\f
/* This is a little helper function for resolving symbols while
print_missing_version (int errcode __attribute__ ((unused)),
const char *objname, const char *errstring)
{
- _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>", ": ",
- objname, ": ", errstring, "\n", NULL);
+ _dl_error_printf ("%s: %s: %s\n", _dl_argv[0] ?: "<program name unknown>",
+ objname, errstring);
}
\f
/* Nonzero if any of the debugging options is enabled. */
case 4:
if (memcmp (dl_debug, "help", 4) == 0)
{
- _dl_sysdep_message ("\
+ _dl_printf ("\
Valid options for the LD_DEBUG environment variable are:\n\
\n\
bindings display information about symbol binding\n\
versions display version dependencies\n\
\n\
To direct the debugging output into a file instead of standard output\n\
-a filename can be specified using the LD_DEBUG_OUTPUT environment variable.\n",
- NULL);
+a filename can be specified using the LD_DEBUG_OUTPUT environment variable.\n");
_exit (0);
}
{
/* Display a warning and skip everything until next separator. */
char *startp = strndupa (dl_debug, len);
- _dl_sysdep_error ("warning: debug option `", startp,
- "' unknown; try LD_DEBUG=help\n", NULL);
+ _dl_error_printf ("\
+warning: debug option `%s' unknown; try LD_DEBUG=help\n", startp);
break;
}
}
if (HP_TIMING_AVAIL)
{
HP_TIMING_PRINT (buf, sizeof (buf), rtld_total_time);
- _dl_debug_message (1, "\nruntime linker statistics:\n"
- " total startup time in dynamic loader: ",
- buf, "\n", NULL);
+ _dl_debug_printf ("\nruntime linker statistics:\n"
+ " total startup time in dynamic loader: %s\n", buf);
}
/* Print relocation statistics. */
if (HP_TIMING_AVAIL)
{
+ char pbuf[30];
HP_TIMING_PRINT (buf, sizeof (buf), relocate_time);
- _dl_debug_message (1, " time needed for relocation: ", buf,
- NULL);
cp = _itoa_word ((1000 * relocate_time) / rtld_total_time,
- buf + sizeof (buf), 10, 0);
- wp = buf;
- switch (buf + sizeof (buf) - cp)
+ pbuf + sizeof (pbuf), 10, 0);
+ wp = pbuf;
+ switch (pbuf + sizeof (pbuf) - cp)
{
case 3:
*wp++ = *cp++;
*wp++ = *cp++;
}
*wp = '\0';
- _dl_debug_message (0, " (", buf, "%)\n", NULL);
+ _dl_debug_printf (" time needed for relocation: %s (%s)\n",
+ buf, pbuf);
}
#endif
- buf[sizeof (buf) - 1] = '\0';
- _dl_debug_message (1, " number of relocations: ",
- _itoa_word (_dl_num_relocations,
- buf + sizeof (buf) - 1, 10, 0),
- "\n", NULL);
+ _dl_debug_printf (" number of relocations: %lu\n",
+ _dl_num_relocations);
#ifndef HP_TIMING_NONAVAIL
/* Time spend while loading the object and the dependencies. */
if (HP_TIMING_AVAIL)
{
+ char pbuf[30];
HP_TIMING_PRINT (buf, sizeof (buf), load_time);
- _dl_debug_message (1, " time needed to load objects: ", buf,
- NULL);
cp = _itoa_word ((1000 * load_time) / rtld_total_time,
- buf + sizeof (buf), 10, 0);
- wp = buf;
- switch (buf + sizeof (buf) - cp)
+ pbuf + sizeof (pbuf), 10, 0);
+ wp = pbuf;
+ switch (pbuf + sizeof (pbuf) - cp)
{
case 3:
*wp++ = *cp++;
*wp++ = *cp++;
}
*wp = '\0';
- _dl_debug_message (0, " (", buf, "%)\n", NULL);
+ _dl_debug_printf (" time needed to load objects: %s (%s)\n",
+ buf, pbuf);
}
#endif
}
/* Machine-dependent ELF dynamic relocation inline functions. ARM version.
- Copyright (C) 1995,96,97,98,99,2000 Free Software Foundation, Inc.
+ Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
const char *strtab;
strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
- _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
- ": Symbol `", strtab + refsym->st_name,
- "' has different size in shared object, "
- "consider re-linking\n", NULL);
+ _dl_error_printf ("\
+%s: Symbol `%s' has different size in shared object, consider re-linking\n",
+ _dl_argv[0] ?: "<program name unknown>",
+ strtab + refsym->st_name);
}
memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
refsym->st_size));
/* Print a message if the loading of libs is traced. */
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0))
- _dl_debug_message (1, " search cache=", LD_SO_CACHE, "\n", NULL);
+ _dl_debug_printf (" search cache=%s\n", LD_SO_CACHE);
if (cache == NULL)
{
/* Print our result if wanted. */
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0) && best != NULL)
- _dl_debug_message (1, " trying file=", best, "\n", NULL);
+ _dl_debug_printf (" trying file=%s\n", best);
return best;
}
else if (__builtin_expect (auxvars[idx].form, hex) == hex)
val = _itoa_word (av->a_un.a_val, buf + sizeof buf - 1, 16, 0);
- _dl_sysdep_message (auxvars[idx].label, val, "\n", NULL);
+ _dl_printf ("%s%s\n", auxvars[idx].label, val);
}
}
}
/* Call the initializer of the program, if any. */
#ifdef SHARED
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
- _dl_debug_message (1, "\ninitialize program: ", argv[0], "\n\n", NULL);
+ _dl_debug_printf ("\ninitialize program: %s\n\n", argv[0]);
#endif
if (init)
(*init) ();
#ifdef SHARED
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
- _dl_debug_message (1, "\ntransferring control: ", argv[0], "\n\n", NULL);
+ _dl_debug_printf ("\ntransferring control: %s\n\n", argv[0]);
#endif
exit ((*main) (argc, argv, __environ));
/* Machine-dependent ELF dynamic relocation inline functions. PA-RISC version.
- Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1995,1996,1997,1999,2000,2001 Free Software Foundation, Inc.
Contributed by David Huggins-Daines <dhd@debian.org>
This file is part of the GNU C Library.
const char *strtab;
strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]);
- _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
- ": Symbol `", strtab + refsym->st_name,
- "' has different size in shared object, "
- "consider re-linking\n", NULL);
+ _dl_error_printf ("\
+%s: Symbol `%s' has different size in shared object, consider re-linking\n",
+ _dl_argv[0] ?: "<program name unknown>",
+ strtab + refsym->st_name);
}
memcpy (reloc_addr, (void *) value,
MIN (sym->st_size, refsym->st_size));
/* Machine-dependent ELF dynamic relocation inline functions. i386 version.
- Copyright (C) 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
const char *strtab;
strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]);
- _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
- ": Symbol `", strtab + refsym->st_name,
- "' has different size in shared object, "
- "consider re-linking\n", NULL);
+ _dl_error_printf ("\
+%s: Symbol `%s' has different size in shared object, consider re-linking\n",
+ _dl_argv[0] ?: "<program name unknown>",
+ strtab + refsym->st_name);
}
memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
refsym->st_size));
/* Machine-dependent ELF dynamic relocation inline functions. m68k version.
- Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
const char *strtab;
strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
- _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
- ": Symbol `", strtab + refsym->st_name,
- "' has different size in shared object, "
- "consider re-linking\n", NULL);
+ _dl_error_printf ("\
+%s: Symbol `%s' has different size in shared object, consider re-linking\n",
+ _dl_argv[0] ?: "<program name unknown>",
+ strtab + refsym->st_name);
}
memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
refsym->st_size));
const char *strtab;
strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
- _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
- ": Symbol `", strtab + refsym->st_name,
- "' has different size in shared object, "
- "consider re-linking\n", NULL);
+ _dl_error_printf ("\
+%s: Symbol `%s' has different size in shared object, onsider re-linking\n"
+ _dl_argv[0] ?: "<program name unknown>",
+ strtab + refsym->st_name);
}
memcpy (reloc_addr, (char *) finaladdr, MIN (sym->st_size,
refsym->st_size));
/* Machine-dependent ELF dynamic relocation inline functions. S390 Version.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001 Free Software Foundation, Inc.
Contributed by Carl Pederson & Martin Schwidefsky.
This file is part of the GNU C Library.
const char *strtab;
strtab = (const char *) D_PTR(map,l_info[DT_STRTAB]);
- _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
- ": Symbol `", strtab + refsym->st_name,
- "' has different size in shared object, "
- "consider re-linking\n", NULL);
+ _dl_error_printf ("\
+%s: Symbol `%s' has different size in shared object, consider re-linking\n",
+ _dl_argv[0] ?: "<program name unknown>",
+ strtab + refsym->st_name);
}
memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
refsym->st_size));
/* Machine-dependent ELF dynamic relocation inline functions. SH version.
- Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
const char *strtab;
strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]);
- _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
- ": Symbol `", strtab + refsym->st_name,
- "' has different size in shared object, "
- "consider re-linking\n", NULL);
+ _dl_error_printf ("\
+%s: Symbol `%s' has different size in shared object, consider re-linking\n"
+ _dl_argv[0] ?: "<program name unknown>",
+ strtab + refsym->st_name);
}
memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
refsym->st_size));
__attribute__ ((__noreturn__))
dl_fatal (const char *str)
{
- _dl_sysdep_output (2, str, NULL);
+ _dl_dprintf (2, str);
_exit (1);
}
#endif
/* Optional code to distinguish library flavours.
- Copyright (C) 1998 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
break; \
\
/* We print a `5' or `6' depending on the outcome. */ \
- _dl_sysdep_message (d->d_tag != DT_NULL ? "5\n" : "6\n", NULL); \
+ _dl_printf (d->d_tag != DT_NULL ? "5\n" : "6\n"); \
} \
} \
while (0)
#ifndef _DL_PROCINFO_H
#define _DL_PROCINFO_H 1
+#include <ldsodefs.h>
+
/* If anything should be added here check whether the size of each string
is still ok with the given array size. */
extern const char _dl_x86_cap_flags[][7];
in the kernel sources. */
int i;
- _dl_sysdep_message ("AT_HWCAP: ", NULL);
+ _dl_printf ("AT_HWCAP: ");
for (i = 0; i < _DL_HWCAP_COUNT; ++i)
if (word & (1 << i))
- _dl_sysdep_message (" ", _dl_x86_cap_flags[i], NULL);
+ _dl_printf (" %s", _dl_x86_cap_flags[i]);
- _dl_sysdep_message ("\n", NULL);
+ _dl_printf ("\n");
return 0;
}