2001-11-06 Ulrich Drepper <drepper@redhat.com>
+ * elf/dl-profile.c: Replace state variable with simple flag named
+ running. Remove commented-out code.
+
* elf/dl-load.c (decompose_rpath): Optimize error handling for size.
(_dl_init_paths): Likewise.
(_dl_map_object_from_fd): Likewise.
+ * elf/dl-reloc.c (_dl_relocate_object): Likewise.
2001-11-06 Roland McGrath <roland@frob.com>
static struct here_cg_arc_record *data;
+/* Nonzero if profiling is under way. */
+static int running;
+
/* This is the number of entry which have been incorporated in the toset. */
static uint32_t narcs;
/* This is a pointer to the object representing the number of entries
lists. */
static volatile uint32_t *narcsp;
-/* Description of the currently profiled object. */
-static long int state = GMON_PROF_OFF;
-
static volatile uint16_t *kcount;
static size_t kcountsize;
/* Now we can compute the size of the profiling data. This is done
with the same formulars as in `monstartup' (see gmon.c). */
- state = GMON_PROF_OFF;
+ running = 0;
lowpc = ROUNDDOWN (mapstart + map->l_addr,
HISTFRACTION * sizeof (HISTCOUNTER));
highpc = ROUNDUP (mapend + map->l_addr,
__profil ((void *) kcount, kcountsize, lowpc, s_scale);
/* Turn on profiling. */
- state = GMON_PROF_ON;
+ running = 1;
}
size_t i, fromindex;
struct here_fromstruct *fromp;
-#if 0
- /* XXX I think this is now not necessary anymore. */
- if (! compare_and_swap (&state, GMON_PROF_ON, GMON_PROF_BUSY))
- return;
-#else
- if (state != GMON_PROF_ON)
+ if (! running)
return;
-#endif
/* Compute relative addresses. The shared object can be loaded at
any address. The value of frompc could be anything. We cannot
atomic_add (&fromp->here->count, 1);
done:
-#if 0
- /* XXX See above, Shouldn't be necessary anymore. */
- state = GMON_PROF_ON;
-#else
;
-#endif
}
if (__builtin_expect (consider_profiling, 0))
{
+ const char *errstring = NULL;
+
/* Allocate the array which will contain the already found
relocations. If the shared object lacks a PLT (for example
if it only contains lead function) the l_info[DT_PLTRELSZ]
will be NULL. */
if (l->l_info[DT_PLTRELSZ] == NULL)
- _dl_fatal_printf ("%s: profiler found no PLTREL in object %s\n",
- _dl_argv[0] ?: "<program name unknown>",
- l->l_name);
+ {
+ errstring = N_("%s: profiler found no PLTREL in object %s\n");
+ fatal:
+ _dl_fatal_printf (errstring,
+ _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_fatal_printf ("\
-%s: profiler out of memory shadowing PLTREL of %s\n",
- _dl_argv[0] ?: "<program name unknown>",
- l->l_name);
+ {
+ errstring = N_("\
+%s: profiler out of memory shadowing PLTREL of %s\n");
+ goto fatal;
+ }
}
}