lkml.org 
[lkml]   [2020]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC][PATCH 29/36] objtool: mcount: Reduce usage of _size wrapper
Date
Use loc_size, which will be passed in from outside the wrapper, rather
than the _size wrapper since the location size is determined outside
the wrapper anyway.

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

diff --git a/tools/objtool/recordmcount.h b/tools/objtool/recordmcount.h
index 9ce2d74df89a..353c7d082631 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)
{
@@ -83,14 +84,14 @@ static int append_func(uint_t const *const mloc0,
unsigned const old_shnum = lf->ehdr.e_shnum;

/* add section: __mcount_loc */
- sec = elf_create_section(lf, mc_name + (sizeof(Elf_Rela) == rel_entsize) + strlen(".rel"), _size, mlocp - mloc0);
+ sec = elf_create_section(lf, mc_name + (sizeof(Elf_Rela) == rel_entsize) + strlen(".rel"), loc_size, mlocp - mloc0);
if (!sec)
return -1;

// created sec->sh.sh_size = (void *)mlocp - (void *)mloc0;
sec->sh.sh_link = 0;/* TODO objtool uses this? */
sec->sh.sh_info = 0;/* TODO objtool uses this? */
- sec->sh.sh_addralign = _size;
+ sec->sh.sh_addralign = loc_size;
// created sec->sh.sh_entsize = _size;

// assert sec->data->d_size == (void *)mlocp - (void *)mloc0
@@ -109,7 +110,7 @@ static int append_func(uint_t const *const mloc0,
sec->sh.sh_flags = 0;
sec->sh.sh_link = find_section_by_name(lf, ".symtab")->idx;
sec->sh.sh_info = old_shnum;
- sec->sh.sh_addralign = _size;
+ sec->sh.sh_addralign = loc_size;

// assert sec->data->d_size == (void *)mrelp - (void *)mrel0
memcpy(sec->data->d_buf, mrel0, sec->data->d_size);
@@ -231,7 +232,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
\
 
 \ /
  Last update: 2020-04-10 21:40    [W:0.171 / U:0.616 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site