PATCH: Fix dl-profile
H . J . Lu
hjl@lucon.org
Thu Sep 20 12:39:00 GMT 2001
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. */
More information about the Libc-alpha
mailing list