[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <531409b6dbb2df74056ba03269e311b8248ba7ae.1586468801.git.mhelsley@vmware.com>
Date: Fri, 10 Apr 2020 12:35:53 -0700
From: Matt Helsley <mhelsley@...are.com>
To: <linux-kernel@...r.kernel.org>
CC: Josh Poimboeuf <jpoimboe@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Julien Thierry <jthierry@...hat.com>,
Ingo Molnar <mingo@...hat.com>,
Steven Rostedt <rostedt@...dmis.org>,
Miroslav Benes <mbenes@...e.cz>,
Matt Helsley <mhelsley@...are.com>
Subject: [RFC][PATCH 30/36] objtool: mcount: Move mcount_adjust out of wrapper
The mcount_adjust variable defines how many bytes to move back
from the relocation address in order to be able to get to the
start of the function call instruction(s) needed to turn it
into a no-op. The values are very small and signed so we don't
need to worry about changing the size of the variable's type
inside the wrapper -- we can just use a regular int.
Signed-off-by: Matt Helsley <mhelsley@...are.com>
---
tools/objtool/recordmcount.c | 12 +++++++++---
tools/objtool/recordmcount.h | 5 -----
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/tools/objtool/recordmcount.c b/tools/objtool/recordmcount.c
index 5fdef8b2ac28..52d8d9800bf9 100644
--- a/tools/objtool/recordmcount.c
+++ b/tools/objtool/recordmcount.c
@@ -385,6 +385,12 @@ static unsigned tot_relsize(unsigned int *rel_entsize)
}
return totrelsz;
}
+
+/* zero or a small negative offset added to get the start of the call
+ * instruction
+ */
+static int mcount_adjust = 0;
+
/* 32 bit and 64 bit are very similar */
#include "recordmcount.h"
#define RECORD_MCOUNT_64
@@ -495,7 +501,7 @@ static int do_file(char const *const fname)
rel_type_nop = R_386_NONE;
make_nop = make_nop_x86;
ideal_nop = ideal_nop5_x86_32;
- mcount_adjust_32 = -1;
+ mcount_adjust = -1;
gpfx = 0;
break;
case EM_ARM:
@@ -524,7 +530,7 @@ static int do_file(char const *const fname)
ideal_nop = ideal_nop5_x86_64;
reltype = R_X86_64_64;
rel_type_nop = R_X86_64_NONE;
- mcount_adjust_64 = -1;
+ mcount_adjust = -1;
gpfx = 0;
break;
} /* end switch */
@@ -556,7 +562,7 @@ static int do_file(char const *const fname)
}
if (lf->ehdr.e_machine == EM_S390) {
reltype = R_390_64;
- mcount_adjust_64 = -14;
+ mcount_adjust = -14;
}
if (lf->ehdr.e_machine == EM_MIPS) {
reltype = R_MIPS_64;
diff --git a/tools/objtool/recordmcount.h b/tools/objtool/recordmcount.h
index 353c7d082631..b4d3c55f2c9c 100644
--- a/tools/objtool/recordmcount.h
+++ b/tools/objtool/recordmcount.h
@@ -18,7 +18,6 @@
* Copyright 2010 Steven Rostedt <srostedt@...hat.com>, Red Hat Inc.
*/
#undef append_func
-#undef mcount_adjust
#undef sift_rel_mcount
#undef do_func
#undef Elf_Shdr
@@ -35,7 +34,6 @@
# define append_func append64
# define sift_rel_mcount sift64_rel_mcount
# define do_func do64
-# define mcount_adjust mcount_adjust_64
# define Elf_Rel Elf64_Rel
# define Elf_Rela Elf64_Rela
# define ELF_R_INFO ELF64_R_INFO
@@ -48,7 +46,6 @@
# define append_func append32
# define sift_rel_mcount sift32_rel_mcount
# define do_func do32
-# define mcount_adjust mcount_adjust_32
# define Elf_Rel Elf32_Rel
# define Elf_Rela Elf32_Rela
# define ELF_R_INFO ELF32_R_INFO
@@ -65,8 +62,6 @@ 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;
-
/* Append the new __mcount_loc and its relocations. */
static int append_func(uint_t const *const mloc0,
uint_t const *const mlocp,
--
2.20.1
Powered by blists - more mailing lists