Skip to contentSkip to conversation

recordmcount: Fix handling of elf64 big-endian objects

GIT PULL Steven Rostedt 2 participants 2 messages Jan 7, 2012 – Jan 8, 2012

lore
Share & tools
lore
#0 lore raw

Ingo,

Please pull the latest tip/perf/urgent tree, which can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
tip/perf/urgent

Head SHA1: 2e885057b7f75035f0b85e02f737891482815a81

David Daney (1):
recordmcount: Fix handling of elf64 big-endian objects

----

 scripts/recordmcount.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---------------------------
commit 2e885057b7f75035f0b85e02f737891482815a81
Author: David Daney <[email protected]>
Date:   Mon Dec 19 17:42:42 2011 -0800

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.

scripts/recordmcount.h +1 -1
index f40a6af6..54e35c1 100644
@@ -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;
 }
#1 lore raw
Quoted 11 lines · Steven Rostedt

Ingo,

Please pull the latest tip/perf/urgent tree, which can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
tip/perf/urgent

Head SHA1: 2e885057b7f75035f0b85e02f737891482815a81

Quoted 6 lines

David Daney (1):
recordmcount: Fix handling of elf64 big-endian objects

----

 scripts/recordmcount.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Pulled, thanks Steve!

Ingo