[RFC][PATCH v5 27/51] objtool: mcount: Reduce usage of _size wrapper

From: Matt Helsley
Date: Thu Jun 18 2020 - 16:42:50 EST


Use a new loc_size parameter to append_func() rather than
use the wrapper's _size macro directly.

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

diff --git a/tools/objtool/recordmcount.h b/tools/objtool/recordmcount.h
index fcc4f1a74d60..a74a80b3356e 100644
--- a/tools/objtool/recordmcount.h
+++ b/tools/objtool/recordmcount.h
@@ -72,6 +72,7 @@ static int append_func(uint_t const *const mloc0,
uint_t const *const mlocp,
Elf_Rel const *const mrel0,
Elf_Rel const *const mrelp,
+ unsigned int const loc_size,
unsigned int const rel_entsize,
unsigned int const symsec_sh_link)
{
@@ -84,14 +85,14 @@ static int append_func(uint_t const *const mloc0,
/* add section: __mcount_loc */
mcount_loc_sec = elf_create_section(lf,
mc_name + (sizeof(Elf_Rela) == rel_entsize) + strlen(".rel"),
- _size, mlocp - mloc0);
+ loc_size, mlocp - mloc0);
if (!mcount_loc_sec)
return -1;
// created mcount_loc_sec->sh.sh_size = (void *)mlocp - (void *)mloc0;
mcount_loc_sec->sh.sh_link = 0;
mcount_loc_sec->sh.sh_info = 0;
- mcount_loc_sec->sh.sh_addralign = _size;
- // created mcount_loc_sec->sh.sh_entsize = _size;
+ mcount_loc_sec->sh.sh_addralign = loc_size;
+ // created mcount_loc_sec->sh.sh_entsize = loc_size;

// assert mcount_loc_sec->data->d_size == (void *)mlocp - (void *)mloc0
memcpy(mcount_loc_sec->data->d_buf, mloc0,
@@ -108,7 +109,7 @@ static int append_func(uint_t const *const mloc0,
reloc_sec->sh.sh_flags = 0; /* clear SHF_ALLOC */
reloc_sec->sh.sh_link = find_section_by_name(lf, ".symtab")->idx;
reloc_sec->sh.sh_info = mcount_loc_sec->idx;
- reloc_sec->sh.sh_addralign = _size;
+ reloc_sec->sh.sh_addralign = loc_size;

// assert reloc_sec->data->d_size == (void *)mrelp - (void *)mrel0
memcpy(reloc_sec->data->d_buf, mrel0, reloc_sec->data->d_size);
@@ -227,7 +228,7 @@ static int do_func(unsigned const reltype)
}
if (!result && mloc0 != mlocp)
result = append_func(mloc0, mlocp, mrel0, mrelp,
- rel_entsize, symsec_sh_link);
+ _size, rel_entsize, symsec_sh_link);
out:
free(mrel0);
free(mloc0);
--
2.20.1