From: Martin Schwidefsky <schwidefsky@de.ibm.com> To: linux-arch@vger.kernel.org, Steven Rostedt <rostedt@goodmis.org>, Frederic Weisbecker <fweisbec@gmail.com>, Ingo Molnar <mingo@redhat.com>, Thomas Gleixner <tglx@linutronix.de>, H. Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Subject: [patch 1/4] recordmcount mcount address adjustment Date: Tue, 10 May 2011 10:10:40 +0200 [thread overview] Message-ID: <20110510081103.049030384@de.ibm.com> (raw) In-Reply-To: 20110510081039.241831019@de.ibm.com [-- Attachment #1: 300-mcount-adjust.diff --] [-- Type: text/plain, Size: 2222 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. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> --- scripts/recordmcount.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) Index: test-2.6/scripts/recordmcount.h =================================================================== --- test-2.6.orig/scripts/recordmcount.h 2011-01-07 09:17:19.000000000 +0100 +++ test-2.6/scripts/recordmcount.h 2011-05-03 09:38:56.781445980 +0200 @@ -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 find_secsym_ndx #undef __has_rel_mcount @@ -57,6 +58,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 @@ -85,6 +87,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 @@ -123,6 +126,8 @@ } 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 @@ -285,8 +290,8 @@ } 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);
WARNING: multiple messages have this Message-ID (diff)
From: Martin Schwidefsky <schwidefsky@de.ibm.com> To: linux-arch@vger.kernel.org, Steven Rostedt <rostedt@goodmis.org>, Frederic Weisbecker <fweisbec@gmail.com>, Ingo Molnar <mingo@redhat.com>, Thomas Gleixner <tglx@linutronix.de>, "H. Peter Anvin" <hpa@zytor.com>, Tony Luck <tony.luck@intel.com>, Fenghua Yu <fenghua.yu@intel.com>, Russell King <linux@arm.linux.org.uk>, Rabin Vincent <rabin@rab.in> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Subject: [patch 1/4] recordmcount mcount address adjustment Date: Tue, 10 May 2011 10:10:40 +0200 [thread overview] Message-ID: <20110510081103.049030384@de.ibm.com> (raw) Message-ID: <20110510081040.6WI5pLqhfDjlZLBLWzwOpSXoOqGwec0rG5WTeln8_Yc@z> (raw) In-Reply-To: 20110510081039.241831019@de.ibm.com [-- Attachment #1: 300-mcount-adjust.diff --] [-- Type: text/plain, Size: 2223 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. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> --- scripts/recordmcount.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) Index: test-2.6/scripts/recordmcount.h =================================================================== --- test-2.6.orig/scripts/recordmcount.h 2011-01-07 09:17:19.000000000 +0100 +++ test-2.6/scripts/recordmcount.h 2011-05-03 09:38:56.781445980 +0200 @@ -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 find_secsym_ndx #undef __has_rel_mcount @@ -57,6 +58,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 @@ -85,6 +87,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 @@ -123,6 +126,8 @@ } 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 @@ -285,8 +290,8 @@ } 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);
next prev parent reply other threads:[~2011-05-10 8:11 UTC|newest] Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-05-10 8:10 [patch 0/4] [RFC] mcount address adjustment Martin Schwidefsky 2011-05-10 8:10 ` Martin Schwidefsky 2011-05-10 8:10 ` Martin Schwidefsky [this message] 2011-05-10 8:10 ` [patch 1/4] recordmcount " Martin Schwidefsky 2011-05-10 8:10 ` [patch 2/4] x86 mcount offset calculation Martin Schwidefsky 2011-05-10 8:10 ` Martin Schwidefsky 2011-05-10 8:10 ` [patch 3/4] ia64 " Martin Schwidefsky 2011-05-10 8:10 ` Martin Schwidefsky 2011-05-16 18:58 ` Steven Rostedt 2011-05-16 19:17 ` Luck, Tony 2011-05-16 19:17 ` Luck, Tony 2011-05-16 20:41 ` Steven Rostedt 2011-05-17 8:04 ` Martin Schwidefsky 2011-05-17 11:20 ` Steven Rostedt 2011-05-10 8:10 ` [patch 4/4] s390 " Martin Schwidefsky 2011-05-10 8:10 ` Martin Schwidefsky 2011-05-11 17:23 ` [patch 0/4] [RFC] mcount address adjustment Rabin Vincent 2011-05-12 9:24 ` Martin Schwidefsky 2011-05-12 13:30 ` Rabin Vincent 2011-05-16 12:57 ` Dave Martin 2011-05-16 14:28 ` Steven Rostedt
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=20110510081103.049030384@de.ibm.com \ --to=schwidefsky@de.ibm.com \ --cc=fweisbec@gmail.com \ --cc=linux-arch@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: linkBe 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; as well as URLs for NNTP newsgroup(s).