Re: [PATCH 5/9] objtool: Rework rebuild_reloc logic

2021-03-19 Thread Josh Poimboeuf
On Fri, Mar 19, 2021 at 10:22:54AM +0100, Peter Zijlstra wrote: > @@ -814,6 +814,11 @@ struct section *elf_create_reloc_section > } > } > > +static inline bool is_reloc_section(struct section *reloc) > +{ > + return reloc->base && reloc->base->reloc == reloc; > +} I believe the 2nd

Re: [PATCH 5/9] objtool: Rework rebuild_reloc logic

2021-03-19 Thread Peter Zijlstra
On Thu, Mar 18, 2021 at 12:38:42PM -0500, Josh Poimboeuf wrote: > On Thu, Mar 18, 2021 at 06:04:25PM +0100, Peter Zijlstra wrote: > > On Thu, Mar 18, 2021 at 11:36:40AM -0500, Josh Poimboeuf wrote: > > > > I was thinking you could get a section changed without touching > > > > relocations, but

Re: [PATCH 5/9] objtool: Rework rebuild_reloc logic

2021-03-18 Thread Josh Poimboeuf
On Thu, Mar 18, 2021 at 12:38:42PM -0500, Josh Poimboeuf wrote: > On Thu, Mar 18, 2021 at 06:04:25PM +0100, Peter Zijlstra wrote: > > On Thu, Mar 18, 2021 at 11:36:40AM -0500, Josh Poimboeuf wrote: > > > > I was thinking you could get a section changed without touching > > > > relocations, but

Re: [PATCH 5/9] objtool: Rework rebuild_reloc logic

2021-03-18 Thread Josh Poimboeuf
On Thu, Mar 18, 2021 at 06:04:25PM +0100, Peter Zijlstra wrote: > On Thu, Mar 18, 2021 at 11:36:40AM -0500, Josh Poimboeuf wrote: > > > I was thinking you could get a section changed without touching > > > relocations, but while that is theoretically possible, it is exceedingly > > > unlikely (and

Re: [PATCH 5/9] objtool: Rework rebuild_reloc logic

2021-03-18 Thread Peter Zijlstra
On Thu, Mar 18, 2021 at 11:36:40AM -0500, Josh Poimboeuf wrote: > > I was thinking you could get a section changed without touching > > relocations, but while that is theoretically possible, it is exceedingly > > unlikely (and objtool doesn't do that). > > Hm? This is a *relocation* section, not

Re: [PATCH 5/9] objtool: Rework rebuild_reloc logic

2021-03-18 Thread Josh Poimboeuf
On Thu, Mar 18, 2021 at 01:57:03PM +0100, Peter Zijlstra wrote: > On Wed, Mar 17, 2021 at 07:49:17PM -0500, Josh Poimboeuf wrote: > > On Wed, Mar 17, 2021 at 09:12:15AM +0100, Peter Zijlstra wrote: > > > On Tue, Mar 16, 2021 at 10:34:17PM -0500, Josh Poimboeuf wrote: > > > > On Fri, Mar 12, 2021

Re: [PATCH 5/9] objtool: Rework rebuild_reloc logic

2021-03-18 Thread Peter Zijlstra
On Wed, Mar 17, 2021 at 07:49:17PM -0500, Josh Poimboeuf wrote: > On Wed, Mar 17, 2021 at 09:12:15AM +0100, Peter Zijlstra wrote: > > On Tue, Mar 16, 2021 at 10:34:17PM -0500, Josh Poimboeuf wrote: > > > On Fri, Mar 12, 2021 at 06:16:18PM +0100, Peter Zijlstra wrote: > > > > ---

Re: [PATCH 5/9] objtool: Rework rebuild_reloc logic

2021-03-17 Thread Josh Poimboeuf
On Wed, Mar 17, 2021 at 09:12:15AM +0100, Peter Zijlstra wrote: > On Tue, Mar 16, 2021 at 10:34:17PM -0500, Josh Poimboeuf wrote: > > On Fri, Mar 12, 2021 at 06:16:18PM +0100, Peter Zijlstra wrote: > > > --- a/tools/objtool/elf.c > > > +++ b/tools/objtool/elf.c > > > @@ -479,6 +479,8 @@ void

Re: [PATCH 5/9] objtool: Rework rebuild_reloc logic

2021-03-17 Thread Peter Zijlstra
On Tue, Mar 16, 2021 at 10:34:17PM -0500, Josh Poimboeuf wrote: > On Fri, Mar 12, 2021 at 06:16:18PM +0100, Peter Zijlstra wrote: > > --- a/tools/objtool/elf.c > > +++ b/tools/objtool/elf.c > > @@ -479,6 +479,8 @@ void elf_add_reloc(struct elf *elf, stru > > > > list_add_tail(>list,

Re: [PATCH 5/9] objtool: Rework rebuild_reloc logic

2021-03-16 Thread Josh Poimboeuf
On Fri, Mar 12, 2021 at 06:16:18PM +0100, Peter Zijlstra wrote: > --- a/tools/objtool/elf.c > +++ b/tools/objtool/elf.c > @@ -479,6 +479,8 @@ void elf_add_reloc(struct elf *elf, stru > > list_add_tail(>list, >reloc_list); > elf_hash_add(elf->reloc_hash, >hash, reloc_hash(reloc)); > +

[PATCH 5/9] objtool: Rework rebuild_reloc logic

2021-03-12 Thread Peter Zijlstra
Instead of manually calling elf_rebuild_reloc_section() on sections we've called elf_add_reloc() on, have elf_write() DTRT. This makes it easier to add random relocations in places without carefully tracking when we're done and need to flush what section. Signed-off-by: Peter Zijlstra (Intel)