mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for David Daney <david.daney@cavium.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	rostedt@goodmis.org, david.daney@cavium.com, tglx@linutronix.de
Subject: [tip:perf/core] recordmcount: Fix handling of elf64 big-endian objects.
Date: Sun, 8 Jan 2012 03:51:09 -0800	[thread overview]
Message-ID: <tip-2e885057b7f75035f0b85e02f737891482815a81@git.kernel.org> (raw)
In-Reply-To: <1324345362-12230-1-git-send-email-ddaney.cavm@gmail.com>

Commit-ID:  2e885057b7f75035f0b85e02f737891482815a81
Gitweb:     http://git.kernel.org/tip/2e885057b7f75035f0b85e02f737891482815a81
Author:     David Daney <david.daney@cavium.com>
AuthorDate: Mon, 19 Dec 2011 17:42:42 -0800
Committer:  Steven Rostedt <rostedt@goodmis.org>
CommitDate: Fri, 6 Jan 2012 17:06:42 -0500

recordmcount: Fix handling of elf64 big-endian objects.

In ELF64, the sh_flags field is 64-bits wide.  recordmcount was
erroneously treating it as a 32-bit wide field.  For little endian
objects this works because the flags of interest (SHF_EXECINSTR)
reside in the lower 32 bits of the word, and you get the same result
with either a 32-bit or 64-bit read.  Big endian objects on the
other hand do not work at all with this error.

The fix:  Correctly treat sh_flags as 64-bits wide in elf64 objects.

The symptom I observed was that my
__start_mcount_loc..__stop_mcount_loc was empty even though ftrace
function tracing was enabled.

Link: http://lkml.kernel.org/r/1324345362-12230-1-git-send-email-ddaney.cavm@gmail.com

Cc: stable@kernel.org # 3.0+
Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 scripts/recordmcount.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
index f40a6af6..54e35c1 100644
--- a/scripts/recordmcount.h
+++ b/scripts/recordmcount.h
@@ -462,7 +462,7 @@ __has_rel_mcount(Elf_Shdr const *const relhdr,  /* is SHT_REL or SHT_RELA */
 		succeed_file();
 	}
 	if (w(txthdr->sh_type) != SHT_PROGBITS ||
-	    !(w(txthdr->sh_flags) & SHF_EXECINSTR))
+	    !(_w(txthdr->sh_flags) & SHF_EXECINSTR))
 		return NULL;
 	return txtname;
 }

      parent reply	other threads:[~2012-01-08 11:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-20  1:42 [PATCH] " David Daney
2011-12-20  3:09 ` Steven Rostedt
2012-01-06 20:42   ` David Daney
2012-01-06 21:47     ` Steven Rostedt
2012-01-06 23:09     ` Steven Rostedt
2012-01-06 23:15       ` David Daney
2012-01-06 23:24         ` Steven Rostedt
2012-01-08 11:51 ` tip-bot for David Daney [this message]

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=tip-2e885057b7f75035f0b85e02f737891482815a81@git.kernel.org \
    --to=david.daney@cavium.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome