2020-06-18 20:52:14

by Matt Helsley

[permalink] [raw]
Subject: [RFC][PATCH v5 37/51] objtool: mcount: Simplify mcount name matching

Setting altmcount only when processing ARM ELF files is
not necessary -- we can make the code easier to read
by always checking for the string.

Signed-off-by: Matt Helsley <[email protected]>
---
tools/objtool/mcount.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/objtool/mcount.c b/tools/objtool/mcount.c
index ff52697613b1..7e621769c488 100644
--- a/tools/objtool/mcount.c
+++ b/tools/objtool/mcount.c
@@ -44,7 +44,6 @@
#define R_ARM_THM_CALL 10

static char gpfx; /* prefix for global symbol name (sometimes '_') */
-static const char *altmcount; /* alternate mcount symbol name */
extern int warn_on_notrace_sect; /* warn when section has mcount not being recorded */

static struct elf *lf;
@@ -173,7 +172,7 @@ static struct symbol *get_mcount_sym(struct reloc *reloc)
if (symname[0] == '.')
++symname; /* ppc64 hack */
if (strcmp(mcount, symname) == 0 ||
- (altmcount && strcmp(altmcount, symname) == 0) ||
+ (strcmp("__gnu_mcount_nc", symname) == 0) ||
(strcmp(fentry, symname) == 0))
return sym;
return NULL;
@@ -567,7 +566,6 @@ static int do_file(char const *const fname)
break;
case EM_ARM:
reltype = R_ARM_ABS32;
- altmcount = "__gnu_mcount_nc";
make_nop = make_nop_arm;
rel_type_nop = R_ARM_NONE;
is_fake_mcount = arm_is_fake_mcount;
--
2.20.1