[RFC][PATCH v5 07/51] objtool: mcount: Move nhdr into find_symtab()

From: Matt Helsley
Date: Thu Jun 18 2020 - 16:39:29 EST


Since it's no longer needed in the rest of do_func() we can move
it to where it's needed rather than pass it as a parameter.

Signed-off-by: Matt Helsley <mhelsley@xxxxxxxxxx>
---
tools/objtool/recordmcount.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/objtool/recordmcount.h b/tools/objtool/recordmcount.h
index b46e855d32bf..4bd61c9d1fd5 100644
--- a/tools/objtool/recordmcount.h
+++ b/tools/objtool/recordmcount.h
@@ -229,9 +229,10 @@ static int get_shstrndx(Elf_Ehdr const *ehdr, Elf_Shdr const *shdr0)
}

static void find_symtab(Elf_Ehdr *const ehdr, Elf_Shdr const *shdr0,
- unsigned const nhdr, Elf32_Word **symtab,
+ Elf32_Word **symtab,
Elf32_Word **symtab_shndx)
{
+ unsigned const nhdr = get_shnum(ehdr, shdr0);
Elf_Shdr const *relhdr;
unsigned k;

@@ -593,7 +594,6 @@ static int do_func(Elf_Ehdr *const ehdr, char const *const fname,
{
Elf_Shdr *const shdr0 = (Elf_Shdr *)(_w(ehdr->e_shoff)
+ (void *)ehdr);
- unsigned const nhdr = get_shnum(ehdr, shdr0);
Elf_Shdr *const shstr = &shdr0[get_shstrndx(ehdr, shdr0)];
char const *const shstrtab = (char const *)(_w(shstr->sh_offset)
+ (void *)ehdr);
@@ -638,7 +638,7 @@ static int do_func(Elf_Ehdr *const ehdr, char const *const fname,
return -1;
}

- find_symtab(ehdr, shdr0, nhdr, &symtab, &symtab_shndx);
+ find_symtab(ehdr, shdr0, &symtab, &symtab_shndx);

list_for_each_entry(sec, &lf->sections, list) {
char const *txtname;
--
2.20.1