[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YFTCOGMfNkPknNDv@hirez.programming.kicks-ass.net>
Date: Fri, 19 Mar 2021 16:24:40 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: x86@...nel.org, jgross@...e.com, mbenes@...e.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 08/14] objtool: Add elf_create_reloc() helper
On Fri, Mar 19, 2021 at 10:12:59AM -0500, Josh Poimboeuf wrote:
> > -void elf_add_reloc(struct elf *elf, struct reloc *reloc)
> > +int elf_add_reloc(struct elf *elf, struct section *sec, unsigned long offset,
> > + unsigned int type, struct symbol *sym, int addend)
> > {
> > - struct section *sec = reloc->sec;
> > + struct reloc *reloc;
> > +
> > + reloc = malloc(sizeof(*reloc));
> > + if (!reloc) {
> > + perror("malloc");
> > + return -1;
> > + }
> > + memset(reloc, 0, sizeof(*reloc));
> > +
> > + reloc->sec = sec->reloc;
>
> Maybe elf_add_reloc() could create the reloc section if it doesn't
> already exist, that would help remove the multiple calls to
> elf_create_reloc_section().
I'll do that as yet another patch ;-)
> > + reloc->offset = offset;
> > + reloc->type = type;
> > + reloc->sym = sym;
> > + reloc->addend = addend;
> >
> > list_add_tail(&reloc->list, &sec->reloc_list);
>
> This should be sec->reloc->reloc_list?
Absolutely, there were a few other 'funnies' as well that I just fixed
whilst trying to make the whole new stack work again :-)
Powered by blists - more mailing lists