This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
PATCH: Fix dl-profile
- To: GNU C Library <libc-alpha at sourceware dot cygnus dot com>
- Subject: PATCH: Fix dl-profile
- From: "H . J . Lu" <hjl at lucon dot org>
- Date: Thu, 20 Sep 2001 12:39:24 -0700
- Cc: Ulrich Drepper <drepper at cygnus dot com>
dl-profile inserts the new entry at the wrong place. It is off by one.
Here is a patch. Ulrich, could you please double check it?
Thanks.
H.J.
----
2001-09-20 H.J. Lu <hjl@gnu.org>
* elf/dl-profile.c (_dl_mcount): Properly adding new entry.
--- elf/dl-profile.c.prof Sat Jul 7 16:44:45 2001
+++ elf/dl-profile.c Thu Sep 20 12:34:09 2001
@@ -495,10 +495,10 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr
{
size_t to_index;
size_t newfromidx;
- to_index = (data[narcs].self_pc
+ to_index = (data[narcs - 1].self_pc
/ (hashfraction * sizeof (*tos)));
newfromidx = exchange_and_add (&fromidx, 1) + 1;
- froms[newfromidx].here = &data[narcs];
+ froms[newfromidx].here = &data[narcs - 1];
froms[newfromidx].link = tos[to_index];
tos[to_index] = newfromidx;
atomic_add (&narcs, 1);
@@ -507,7 +507,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr
/* If we still have no entry stop searching and insert. */
if (*topcindex == 0)
{
- uint_fast32_t newarc = 1 + exchange_and_add (narcsp, 1);
+ uint_fast32_t newarc = exchange_and_add (narcsp, 1);
/* In rare cases it could happen that all entries in FROMS are
occupied. So we cannot count this anymore. */