From: Rusty Russell <rusty@rustcorp.com.au>
To: Paul Mackerras <paulus@samba.org>
Cc: sfr@canb.auug.org.au, linuxppc-dev@ozlabs.org, ntl@pobox.com,
linuxppc-embedded@ozlabs.org
Subject: Re: [PATCH] [POWERPC] Optimize counting distinct entries in the relocation sections
Date: Mon, 12 Nov 2007 19:01:38 +1100 [thread overview]
Message-ID: <200711121901.39163.rusty@rustcorp.com.au> (raw)
In-Reply-To: <18231.60427.229658.485287@cargo.ozlabs.ibm.com>
On Monday 12 November 2007 17:00:43 Paul Mackerras wrote:
> Emil Medve writes:
> > (Not sure why the relocation tables could contain lots of duplicates and
> > why they are not trimmed at compile time by the linker. In some test
> > cases, out of 35K relocation entries only 1.5K were distinct/unique)
>
> Presumably you have lots of calls to the same function, or lots of
> references to the same variable.
Yes, and objdump -r is your friend here. It might be worth checking that
we're counting relocs in a section we actually care about (ie. it's
SHF_ALLOC).
It'd be a shame to optimize this only to find it could be fixed with a
one-liner.
> The first is to use the st_other field in the symbol to
> record whether we have seen a R_PPC_REL24 reloc referring to the
> symbol with r_addend=0. That would make count_relocs of complexity
> O(N) for N relocs.
Just note when you implement this: there may be two PLT entries per symbol:
one for init code and one for core code. But that's just two bits.
If Paul is right about r_addend=0 being common, you can simply count unique
occurences of that, and add all the r_addend != 0 cases as if they were
unique (note: it's fine to over-estimate).
> As far as your proposed patch is concerned, I don't like having a
> function called "count_relocs" changing the array of relocations. At
> the very least it needs a different name.
Yes, and it should also return "u32" not "uint32_t" if you're going to change
the return type.
Cheers,
Rusty.
next prev parent reply other threads:[~2007-11-12 8:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-08 23:36 [PATCH] [POWERPC] Optimize counting distinct entries in the relocation sections Emil Medve
2007-11-12 6:00 ` Paul Mackerras
2007-11-12 8:01 ` Rusty Russell [this message]
2007-11-12 11:55 ` Modulo operation in C for -ve values Deepak Gaur
2007-11-12 16:50 ` [PATCH] [POWERPC] Optimize counting distinct entries in the relocation sections Medve Emilian
2007-11-12 22:31 ` [PATCH] [POWERPC] Optimize counting distinct entries in therelocation sections Medve Emilian
2007-11-13 2:49 ` Paul Mackerras
2007-11-13 4:27 ` Rusty Russell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200711121901.39163.rusty@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=linuxppc-dev@ozlabs.org \
--cc=linuxppc-embedded@ozlabs.org \
--cc=ntl@pobox.com \
--cc=paulus@samba.org \
--cc=sfr@canb.auug.org.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.