summaryrefslogtreecommitdiffstats
path: root/scripts/recordmcount.h
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2011-04-12 18:53:25 -0400
committerSteven Rostedt <rostedt@goodmis.org>2011-05-16 14:44:20 -0400
commitdfad3d598c4bbbaf137588e22bac1ce624529f7e (patch)
tree7df293e467f93913d1979a0e7131bb6e1977acd7 /scripts/recordmcount.h
parentffd618fa39284f8cc343894b566dd42ec6e74e77 (diff)
downloadlinux-dfad3d598c4bbbaf137588e22bac1ce624529f7e.tar.bz2
ftrace/recordmcount: Add warning logic to warn on mcount not recorded
There's some sections that should not have mcount recorded and should not have modifications to the that code. But currently they waste some time by calling mcount anyway (which simply returns). As the real answer should be to either whitelist the section or have gcc ignore it fully. This change adds a option to recordmcount to warn when it finds a section that is ignored by ftrace but still contains mcount callers. This is not on by default as developers may not know if the section should be completely ignored or added to the whitelist. Cc: John Reiser <jreiser@bitwagon.com> Link: http://lkml.kernel.org/r/20110421023738.476989377@goodmis.org Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'scripts/recordmcount.h')
-rw-r--r--scripts/recordmcount.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
index 657dbedd1c7f..22033d563bcd 100644
--- a/scripts/recordmcount.h
+++ b/scripts/recordmcount.h
@@ -313,7 +313,8 @@ static uint_t *sift_rel_mcount(uint_t *mlocp,
* into nops.
*/
static void nop_mcount(Elf_Shdr const *const relhdr,
- Elf_Ehdr const *const ehdr)
+ Elf_Ehdr const *const ehdr,
+ const char *const txtname)
{
Elf_Shdr *const shdr0 = (Elf_Shdr *)(_w(ehdr->e_shoff)
+ (void *)ehdr);
@@ -336,6 +337,7 @@ static void nop_mcount(Elf_Shdr const *const relhdr,
unsigned mcountsym = 0;
unsigned t;
+ int once = 0;
for (t = nrel; t; --t) {
int ret = -1;
@@ -353,8 +355,18 @@ static void nop_mcount(Elf_Shdr const *const relhdr,
mcountsym = Elf_r_sym(relp);
}
- if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp))
- ret = make_nop((void *)ehdr, shdr->sh_offset + relp->r_offset);
+ if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) {
+ if (make_nop)
+ ret = make_nop((void *)ehdr, shdr->sh_offset + relp->r_offset);
+ if (warn_on_notrace_sect && !once) {
+ printf("Section %s has mcount callers being ignored\n",
+ txtname);
+ once = 1;
+ /* just warn? */
+ if (!make_nop)
+ return;
+ }
+ }
/*
* If we successfully removed the mcount, mark the relocation
@@ -501,12 +513,12 @@ do_func(Elf_Ehdr *const ehdr, char const *const fname, unsigned const reltype)
mlocp = sift_rel_mcount(mlocp,
(void *)mlocp - (void *)mloc0, &mrelp,
relhdr, ehdr, recsym, recval, reltype);
- } else if (make_nop && txtname) {
+ } else if (txtname && (warn_on_notrace_sect || make_nop)) {
/*
* This section is ignored by ftrace, but still
* has mcount calls. Convert them to nops now.
*/
- nop_mcount(relhdr, ehdr);
+ nop_mcount(relhdr, ehdr, txtname);
}
}
if (mloc0 != mlocp) {