All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	John Reiser <jreiser@bitwagon.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: [PATCH 13/15] ftrace/recordmcount: mcount address adjustment
Date: Wed, 18 May 2011 12:08:22 -0400	[thread overview]
Message-ID: <20110518160909.372894152@goodmis.org> (raw)
In-Reply-To: 20110518160809.724215604@goodmis.org

[-- Attachment #1: 0013-ftrace-recordmcount-mcount-address-adjustment.patch --]
[-- Type: text/plain, Size: 2378 bytes --]

From: Martin Schwidefsky <schwidefsky@de.ibm.com>

Introduce mcount_adjust{,_32,_64} to the C implementation of
recordmcount analog to $mcount_adjust in the perl script.
The adjustment is added to the address of the relocations
against the mcount symbol. If this adjustment is done by
recordmcount at compile time the ftrace_call_adjust function
can be turned into a nop.

Cc: John Reiser <jreiser@bitwagon.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 scripts/recordmcount.h |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
index 3c00fab..4be6036 100644
--- a/scripts/recordmcount.h
+++ b/scripts/recordmcount.h
@@ -22,6 +22,7 @@
 #undef is_fake_mcount
 #undef fn_is_fake_mcount
 #undef MIPS_is_fake_mcount
+#undef mcount_adjust
 #undef sift_rel_mcount
 #undef nop_mcount
 #undef find_secsym_ndx
@@ -63,6 +64,7 @@
 # define is_fake_mcount		is_fake_mcount64
 # define fn_is_fake_mcount	fn_is_fake_mcount64
 # define MIPS_is_fake_mcount	MIPS64_is_fake_mcount
+# define mcount_adjust		mcount_adjust_64
 # define Elf_Addr		Elf64_Addr
 # define Elf_Ehdr		Elf64_Ehdr
 # define Elf_Shdr		Elf64_Shdr
@@ -94,6 +96,7 @@
 # define is_fake_mcount		is_fake_mcount32
 # define fn_is_fake_mcount	fn_is_fake_mcount32
 # define MIPS_is_fake_mcount	MIPS32_is_fake_mcount
+# define mcount_adjust		mcount_adjust_32
 # define Elf_Addr		Elf32_Addr
 # define Elf_Ehdr		Elf32_Ehdr
 # define Elf_Shdr		Elf32_Shdr
@@ -132,6 +135,8 @@ static void fn_ELF_R_INFO(Elf_Rel *const rp, unsigned sym, unsigned type)
 }
 static void (*Elf_r_info)(Elf_Rel *const rp, unsigned sym, unsigned type) = fn_ELF_R_INFO;
 
+static int mcount_adjust = 0;
+
 /*
  * MIPS mcount long call has 2 _mcount symbols, only the position of the 1st
  * _mcount symbol is needed for dynamic function tracer, with it, to disable
@@ -317,8 +322,8 @@ static uint_t *sift_rel_mcount(uint_t *mlocp,
 			mcountsym = get_mcountsym(sym0, relp, str0);
 
 		if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) {
-			uint_t const addend = _w(_w(relp->r_offset) - recval);
-
+			uint_t const addend =
+				_w(_w(relp->r_offset) - recval + mcount_adjust);
 			mrelp->r_offset = _w(offbase
 				+ ((void *)mlocp - (void *)mloc0));
 			Elf_r_info(mrelp, recsym, reltype);
-- 
1.7.4.4



  parent reply	other threads:[~2011-05-18 16:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-18 16:08 [PATCH 00/15] [GIT PULL] ftrace/recordmcount: cleanups and updates for recordmcount processing Steven Rostedt
2011-05-18 16:08 ` [PATCH 01/15] ftrace/kbuild: Add recordmcount files to force full build Steven Rostedt
2011-05-18 16:08 ` [PATCH 02/15] ftrace/trivial: Clean up recordmcount.c to use Linux style Steven Rostedt
2011-05-18 16:08 ` [PATCH 03/15] ftrace/trivial: Clean up record mcount to use Linux switch style Steven Rostedt
2011-05-18 16:08 ` [PATCH 04/15] ftrace: Add .kprobe.text section to whitelist for recordmcount.c Steven Rostedt
2011-05-18 16:08 ` [PATCH 05/15] ftrace/recordmcount: Modify only executable sections Steven Rostedt
2011-05-18 16:08 ` [PATCH 06/15] ftrace/recordmcount: Make ignored mcount calls into nops at compile Steven Rostedt
2011-05-18 16:08 ` [PATCH 07/15] ftrace/recordmcount: Add warning logic to warn on mcount not Steven Rostedt
2011-05-18 16:08 ` [PATCH 08/15] kbuild/recordmcount: Add RECORDMCOUNT_WARN to warn about mcount Steven Rostedt
2011-05-18 16:08 ` [PATCH 09/15] ftrace: Avoid recording mcount on .init sections directly Steven Rostedt
2011-05-18 16:08 ` [PATCH 10/15] ftrace/x86: Do not trace .discard.text section Steven Rostedt
2011-05-18 16:08 ` [PATCH 11/15] ftrace/recordmcount: Remove duplicate code to find mcount symbol Steven Rostedt
2011-05-18 16:08 ` [PATCH 12/15] ftrace/recordmcount: Add helper function get_sym_str_and_relp() Steven Rostedt
2011-05-18 16:08 ` Steven Rostedt [this message]
2011-05-18 16:08 ` [PATCH 14/15] ftrace/x86: mcount offset calculation Steven Rostedt
2011-05-18 16:08 ` [PATCH 15/15] ftrace/s390: " Steven Rostedt
2011-05-18 16:28 ` [PATCH 00/15] [GIT PULL] ftrace/recordmcount: cleanups and updates for recordmcount processing Steven Rostedt
2011-05-18 18:13   ` Ingo Molnar
2011-05-18 18:52     ` Steven Rostedt
2011-05-18 18:02 ` Ingo Molnar

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=20110518160909.372894152@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=jreiser@bitwagon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=schwidefsky@de.ibm.com \
    /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.