lkml.org 
[lkml]   [2021]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 09/14] objtool: Extract elf_strtab_concat()
On Thu, Mar 18, 2021 at 09:10:38PM -0500, Josh Poimboeuf wrote:
> On Thu, Mar 18, 2021 at 06:11:12PM +0100, Peter Zijlstra wrote:
> > Create a common helper to append strings to a strtab.
> >
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> > ---
> > tools/objtool/elf.c | 73 +++++++++++++++++++++++++++++-----------------------
> > 1 file changed, 42 insertions(+), 31 deletions(-)
> >
> > --- a/tools/objtool/elf.c
> > +++ b/tools/objtool/elf.c
> > @@ -676,13 +676,51 @@ struct elf *elf_open_read(const char *na
> > return NULL;
> > }
> >
> > +static int elf_strtab_concat(struct elf *elf, char *name, const char *strtab_name)
> > +{
> > + struct section *strtab = NULL;
> > + Elf_Data *data;
> > + Elf_Scn *s;
> > + int len;
> > +
> > + if (strtab_name)
> > + strtab = find_section_by_name(elf, strtab_name);
> > + if (!strtab)
> > + strtab = find_section_by_name(elf, ".strtab");
> > + if (!strtab) {
> > + WARN("can't find %s or .strtab section", strtab_name);
> > + return -1;
> > + }
>
> This part's a bit mysterious (and it loses the Clang comment). Maybe we
> can leave the section finding logic in elf_create_section()?

Sure, made it compile too ;-)

\
 
 \ /
  Last update: 2021-03-19 10:53    [W:0.102 / U:0.760 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site