* 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.
This commit is contained in:
Ulrich Drepper 2001-02-28 06:36:10 +00:00
parent b5ba065963
commit 35fc382add
28 changed files with 216 additions and 305 deletions

View File

@ -28,6 +28,12 @@
* 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.

View File

@ -27,8 +27,6 @@
#include <sys/types.h>
#include <sys/mman.h>
#include <stdio-common/_itoa.h>
/* Type of the constructor functions. */
typedef void (*fini_t) (void);
@ -76,11 +74,8 @@ _dl_close (void *_map)
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. */
@ -134,10 +129,8 @@ _dl_close (void *_map)
&& 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)

View File

@ -121,9 +121,9 @@ empty dynamics string token substitution")); \
{ \
/* 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; \
} \
} \
@ -294,11 +294,10 @@ _dl_map_object_deps (struct link_map *map,
{
/* 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. */
@ -317,11 +316,10 @@ _dl_map_object_deps (struct link_map *map,
{
/* 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))

View File

@ -1,5 +1,5 @@
/* 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
@ -97,13 +97,14 @@ _dl_signal_error (int errcode, const char *objname, const char *errstring)
{
/* 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);
: ""));
}
}
@ -143,7 +144,7 @@ _dl_catch_error (const char **objname, const char **errstring,
old = tsd_getspecific ();
errcode = setjmp (c.env);
if (errcode == 0)
if (__builtin_expect (errcode, 0) == 0)
{
tsd_setspecific (&c);
(*operate) (args);

View File

@ -147,9 +147,8 @@ _dl_fini (void)
/* 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)

View File

@ -54,8 +54,8 @@ call_init (struct link_map *l, int argc, char **argv, char **env)
/* 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
@ -109,9 +109,9 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env)
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);

View File

@ -30,7 +30,6 @@
#include <sys/stat.h>
#include <sys/types.h>
#include "dynamic-link.h"
#include <stdio-common/_itoa.h>
#include <dl-dst.h>
@ -802,7 +801,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
/* 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;
@ -1060,34 +1059,14 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
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);
@ -1172,7 +1151,7 @@ print_search_path (struct r_search_path_elem **list,
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, ==. */
{
@ -1187,18 +1166,23 @@ print_search_path (struct r_search_path_elem **list,
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);
}
/* Open a file and verify it is an ELF file for this architecture. We
@ -1373,7 +1357,7 @@ open_path (const char *name, size_t namelen, int preloaded,
/* 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)
@ -1507,9 +1491,8 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
/* 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)
{
@ -1518,7 +1501,7 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
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;
@ -1655,7 +1638,7 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
/* 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
{

View File

@ -162,12 +162,11 @@ add_dependency (struct link_map *undef_map, struct link_map *map)
/* 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. */
@ -243,14 +242,12 @@ _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map,
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))
{
@ -322,14 +319,12 @@ _dl_lookup_symbol_skip (const char *undef_name,
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))
{
@ -450,15 +445,13 @@ _dl_lookup_versioned_symbol (const char *undef_name,
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))
{
@ -541,15 +534,13 @@ _dl_lookup_versioned_symbol_skip (const char *undef_name,
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))
{

View File

@ -187,13 +187,10 @@ void weak_function
__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);
}
@ -203,15 +200,10 @@ __assert_perror_fail (int errnum,
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

View File

@ -243,17 +243,8 @@ dl_open_worker (void *a)
{
/* 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. */
@ -343,17 +334,8 @@ dl_open_worker (void *a)
/* 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);
}
@ -453,17 +435,15 @@ show_scope (struct link_map *new)
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

View File

@ -266,9 +266,8 @@ _dl_start_profile (struct link_map *map, const char *output_dir)
{
/* 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;
}
@ -278,9 +277,8 @@ _dl_start_profile (struct link_map *map, const char *output_dir)
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;
}
@ -300,9 +298,8 @@ _dl_start_profile (struct link_map *map, const char *output_dir)
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;
}
@ -319,9 +316,8 @@ _dl_start_profile (struct link_map *map, const char *output_dir)
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;
}
@ -332,9 +328,8 @@ _dl_start_profile (struct link_map *map, const char *output_dir)
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;
}
@ -377,7 +372,7 @@ _dl_start_profile (struct link_map *map, const char *output_dir)
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 */
}

View File

@ -41,9 +41,8 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
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))
{
@ -99,17 +98,18 @@ cannot make segment writable for relocation"));
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);
}
}

View File

@ -84,9 +84,10 @@ match_symbol (const char *name, ElfW(Word) hash, const char *string,
/* 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))
{

View File

@ -61,9 +61,8 @@ FCT (const char *undef_name, unsigned long int hash, const ElfW(Sym) *ref,
/* 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]);

View File

@ -452,7 +452,7 @@ dl_main (const ElfW(Phdr) *phdr,
/* 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\
@ -472,8 +472,7 @@ of this helper program; chances are you did not intend to run this program.\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;
@ -522,7 +521,7 @@ of this helper program; chances are you did not intend to run this program.\n\
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;
@ -865,7 +864,7 @@ of this helper program; chances are you did not intend to run this program.\n\
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;
@ -873,19 +872,10 @@ of this helper program; chances are you did not intend to run this program.\n\
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)
@ -894,7 +884,6 @@ of this helper program; chances are you did not intend to run this program.\n\
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,
@ -902,16 +891,9 @@ of this helper program; chances are you did not intend to run this program.\n\
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
{
@ -961,13 +943,12 @@ of this helper program; chances are you did not intend to run this program.\n\
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)
{
@ -981,22 +962,17 @@ of this helper program; chances are you did not intend to run this program.\n\
{
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. */
@ -1155,7 +1131,7 @@ print_unresolved (int errcode __attribute__ ((unused)), const char *objname,
{
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);
}
/* This is a little helper function for resolving symbols while
@ -1164,8 +1140,8 @@ static void
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);
}
/* Nonzero if any of the debugging options is enabled. */
@ -1206,7 +1182,7 @@ process_dl_debug (const char *dl_debug)
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\
@ -1219,8 +1195,7 @@ Valid options for the LD_DEBUG environment variable are:\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);
}
@ -1288,8 +1263,8 @@ a filename can be specified using the LD_DEBUG_OUTPUT environment variable.\n",
{
/* 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;
}
}
@ -1511,21 +1486,19 @@ print_statistics (void)
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++;
@ -1536,26 +1509,23 @@ print_statistics (void)
*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++;
@ -1566,7 +1536,8 @@ print_statistics (void)
*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
}

View File

@ -1,5 +1,5 @@
/* 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
@ -436,10 +436,10 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
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));

View File

@ -155,7 +155,7 @@ _dl_load_cache_lookup (const char *name)
/* 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)
{
@ -253,7 +253,7 @@ _dl_load_cache_lookup (const char *name)
/* 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;
}

View File

@ -264,7 +264,7 @@ _dl_show_auxv (void)
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);
}
}
}

View File

@ -116,14 +116,14 @@ BP_SYM (__libc_start_main) (int (*main) (int, char **, char **),
/* 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));

View File

@ -1,5 +1,5 @@
/* 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.
@ -575,10 +575,10 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
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));

View File

@ -1,5 +1,5 @@
/* 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
@ -351,10 +351,10 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
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));

View File

@ -1,5 +1,5 @@
/* 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
@ -255,10 +255,10 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
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));

View File

@ -468,10 +468,10 @@ __process_machine_rela (struct link_map *map,
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));

View File

@ -1,5 +1,5 @@
/* 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.
@ -395,10 +395,10 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
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));

View File

@ -1,5 +1,5 @@
/* 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
@ -461,10 +461,10 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
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));

View File

@ -33,7 +33,7 @@ static inline void
__attribute__ ((__noreturn__))
dl_fatal (const char *str)
{
_dl_sysdep_output (2, str, NULL);
_dl_dprintf (2, str);
_exit (1);
}
#endif

View File

@ -1,5 +1,5 @@
/* 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.
@ -41,7 +41,7 @@
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)

View File

@ -21,6 +21,8 @@
#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];
@ -43,13 +45,13 @@ _dl_procinfo (int word)
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;
}