Update.
2000-06-19 Ulrich Drepper <drepper@redhat.com> * elf/sprof.c (print_version): Update year. * elf/sprof.c (load_shobj): Don't always add load address to dynamic table entry values. Use D_PTR. * elf/dl-reloc.c (_dl_relocate_object): Don't start profiling weird binaries without PLT. Patches by James Mathiesen <james@curl.com>.
This commit is contained in:
parent
131bf9f388
commit
ea97f90c9a
@ -1,3 +1,12 @@
|
|||||||
|
2000-06-19 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* elf/sprof.c (print_version): Update year.
|
||||||
|
|
||||||
|
* elf/sprof.c (load_shobj): Don't always add load address to dynamic
|
||||||
|
table entry values. Use D_PTR.
|
||||||
|
* elf/dl-reloc.c (_dl_relocate_object): Don't start profiling weird
|
||||||
|
binaries without PLT. Patches by James Mathiesen <james@curl.com>.
|
||||||
|
|
||||||
2000-06-20 Jes Sorensen <jes@linuxcare.com>
|
2000-06-20 Jes Sorensen <jes@linuxcare.com>
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/ia64/Makefile: New file.
|
* sysdeps/unix/sysv/linux/ia64/Makefile: New file.
|
||||||
|
@ -94,13 +94,21 @@ cannot make segment writable for relocation"));
|
|||||||
if (__builtin_expect (_dl_profile != NULL, 0))
|
if (__builtin_expect (_dl_profile != NULL, 0))
|
||||||
{
|
{
|
||||||
/* Allocate the array which will contain the already found
|
/* Allocate the array which will contain the already found
|
||||||
relocations. */
|
relocations. If the shared object lacks a PLT (for example
|
||||||
|
if it inly 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);
|
||||||
|
|
||||||
l->l_reloc_result =
|
l->l_reloc_result =
|
||||||
(ElfW(Addr) *) calloc (sizeof (ElfW(Addr)),
|
(ElfW(Addr) *) calloc (sizeof (ElfW(Addr)),
|
||||||
l->l_info[DT_PLTRELSZ]->d_un.d_val);
|
l->l_info[DT_PLTRELSZ]->d_un.d_val);
|
||||||
if (l->l_reloc_result == NULL)
|
if (l->l_reloc_result == NULL)
|
||||||
_dl_sysdep_fatal (_dl_argv[0] ?: "<program name unknown>",
|
_dl_sysdep_fatal (_dl_argv[0] ?: "<program name unknown>",
|
||||||
"cannot allocate memory for profiling", NULL);
|
": profiler outof memory shadowing PLTREL of ",
|
||||||
|
l->l_name, "\n", NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
16
elf/sprof.c
16
elf/sprof.c
@ -357,7 +357,7 @@ Copyright (C) %s Free Software Foundation, Inc.\n\
|
|||||||
This is free software; see the source for copying conditions. There is NO\n\
|
This is free software; see the source for copying conditions. There is NO\n\
|
||||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
|
||||||
"),
|
"),
|
||||||
"1999");
|
"2000");
|
||||||
fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
|
fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,8 +504,7 @@ load_shobj (const char *name)
|
|||||||
if (map->l_info[DT_STRTAB] == NULL)
|
if (map->l_info[DT_STRTAB] == NULL)
|
||||||
result->dynstrtab = NULL;
|
result->dynstrtab = NULL;
|
||||||
else
|
else
|
||||||
result->dynstrtab = (const char *) (map->l_addr
|
result->dynstrtab = (const char *) D_PTR (map, l_info[DT_STRTAB]);
|
||||||
+ map->l_info[DT_STRTAB]->d_un.d_ptr);
|
|
||||||
if (do_test)
|
if (do_test)
|
||||||
printf ("string table: %p\n", result->dynstrtab);
|
printf ("string table: %p\n", result->dynstrtab);
|
||||||
|
|
||||||
@ -514,7 +513,7 @@ load_shobj (const char *name)
|
|||||||
result->soname = NULL;
|
result->soname = NULL;
|
||||||
else
|
else
|
||||||
result->soname = result->dynstrtab + map->l_info[DT_SONAME]->d_un.d_val;
|
result->soname = result->dynstrtab + map->l_info[DT_SONAME]->d_un.d_val;
|
||||||
if (do_test)
|
if (do_test && result->soname != NULL)
|
||||||
printf ("soname: %s\n", result->soname);
|
printf ("soname: %s\n", result->soname);
|
||||||
|
|
||||||
/* Now we have to load the symbol table.
|
/* Now we have to load the symbol table.
|
||||||
@ -903,7 +902,6 @@ printsym (const void *node, VISIT value, int level)
|
|||||||
static void
|
static void
|
||||||
read_symbols (struct shobj *shobj)
|
read_symbols (struct shobj *shobj)
|
||||||
{
|
{
|
||||||
void *load_addr = (void *) shobj->map->l_addr;
|
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
/* Initialize the obstacks. */
|
/* Initialize the obstacks. */
|
||||||
@ -960,10 +958,10 @@ read_symbols (struct shobj *shobj)
|
|||||||
{
|
{
|
||||||
/* Blarg, the binary is stripped. We have to rely on the
|
/* Blarg, the binary is stripped. We have to rely on the
|
||||||
information contained in the dynamic section of the object. */
|
information contained in the dynamic section of the object. */
|
||||||
const ElfW(Sym) *symtab = (load_addr
|
const ElfW(Sym) *symtab = (ElfW(Sym) *) D_PTR (shobj->map,
|
||||||
+ shobj->map->l_info[DT_SYMTAB]->d_un.d_ptr);
|
l_info[DT_SYMTAB]);
|
||||||
const char *strtab = (load_addr
|
const char *strtab = (const char *) D_PTR (shobj->map,
|
||||||
+ shobj->map->l_info[DT_STRTAB]->d_un.d_ptr);
|
l_info[DT_STRTAB]);
|
||||||
|
|
||||||
/* We assume that the string table follows the symbol table,
|
/* We assume that the string table follows the symbol table,
|
||||||
because there is no way in ELF to know the size of the
|
because there is no way in ELF to know the size of the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user