aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/recordmcount.h
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2011-05-10 04:10:40 -0400
committerSteven Rostedt <rostedt@goodmis.org>2011-05-16 14:53:22 -0400
commit07d8b595f367f4604e6027ad4cba33cbe3f55e10 (patch)
tree236cd6b56ea2d116002f6c722b86155185860f1c /scripts/recordmcount.h
parent41b402a201a12efdff4acc990e023a89a409cd41 (diff)
ftrace/recordmcount: mcount address adjustment
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>
Diffstat (limited to 'scripts/recordmcount.h')
-rw-r--r--scripts/recordmcount.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
index 3c00faba745..4be60364a40 100644
--- a/scripts/recordmcount.h
+++ b/scripts/recordmcount.h
@@ -22,6 +22,7 @@
22#undef is_fake_mcount 22#undef is_fake_mcount
23#undef fn_is_fake_mcount 23#undef fn_is_fake_mcount
24#undef MIPS_is_fake_mcount 24#undef MIPS_is_fake_mcount
25#undef mcount_adjust
25#undef sift_rel_mcount 26#undef sift_rel_mcount
26#undef nop_mcount 27#undef nop_mcount
27#undef find_secsym_ndx 28#undef find_secsym_ndx
@@ -63,6 +64,7 @@
63# define is_fake_mcount is_fake_mcount64 64# define is_fake_mcount is_fake_mcount64
64# define fn_is_fake_mcount fn_is_fake_mcount64 65# define fn_is_fake_mcount fn_is_fake_mcount64
65# define MIPS_is_fake_mcount MIPS64_is_fake_mcount 66# define MIPS_is_fake_mcount MIPS64_is_fake_mcount
67# define mcount_adjust mcount_adjust_64
66# define Elf_Addr Elf64_Addr 68# define Elf_Addr Elf64_Addr
67# define Elf_Ehdr Elf64_Ehdr 69# define Elf_Ehdr Elf64_Ehdr
68# define Elf_Shdr Elf64_Shdr 70# define Elf_Shdr Elf64_Shdr
@@ -94,6 +96,7 @@
94# define is_fake_mcount is_fake_mcount32 96# define is_fake_mcount is_fake_mcount32
95# define fn_is_fake_mcount fn_is_fake_mcount32 97# define fn_is_fake_mcount fn_is_fake_mcount32
96# define MIPS_is_fake_mcount MIPS32_is_fake_mcount 98# define MIPS_is_fake_mcount MIPS32_is_fake_mcount
99# define mcount_adjust mcount_adjust_32
97# define Elf_Addr Elf32_Addr 100# define Elf_Addr Elf32_Addr
98# define Elf_Ehdr Elf32_Ehdr 101# define Elf_Ehdr Elf32_Ehdr
99# define Elf_Shdr Elf32_Shdr 102# define Elf_Shdr Elf32_Shdr
@@ -132,6 +135,8 @@ static void fn_ELF_R_INFO(Elf_Rel *const rp, unsigned sym, unsigned type)
132} 135}
133static void (*Elf_r_info)(Elf_Rel *const rp, unsigned sym, unsigned type) = fn_ELF_R_INFO; 136static void (*Elf_r_info)(Elf_Rel *const rp, unsigned sym, unsigned type) = fn_ELF_R_INFO;
134 137
138static int mcount_adjust = 0;
139
135/* 140/*
136 * MIPS mcount long call has 2 _mcount symbols, only the position of the 1st 141 * MIPS mcount long call has 2 _mcount symbols, only the position of the 1st
137 * _mcount symbol is needed for dynamic function tracer, with it, to disable 142 * _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,
317 mcountsym = get_mcountsym(sym0, relp, str0); 322 mcountsym = get_mcountsym(sym0, relp, str0);
318 323
319 if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) { 324 if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) {
320 uint_t const addend = _w(_w(relp->r_offset) - recval); 325 uint_t const addend =
321 326 _w(_w(relp->r_offset) - recval + mcount_adjust);
322 mrelp->r_offset = _w(offbase 327 mrelp->r_offset = _w(offbase
323 + ((void *)mlocp - (void *)mloc0)); 328 + ((void *)mlocp - (void *)mloc0));
324 Elf_r_info(mrelp, recsym, reltype); 329 Elf_r_info(mrelp, recsym, reltype);