Re: [PATCH v3 2/4] objtool: Move orc outside of check

From: Julien Thierry
Date: Fri Jul 31 2020 - 04:19:38 EST




On 7/31/20 8:56 AM, Miroslav Benes wrote:
On Thu, 30 Jul 2020, Julien Thierry wrote:



On 7/30/20 3:15 PM, Josh Poimboeuf wrote:
On Thu, Jul 30, 2020 at 02:29:20PM +0100, Julien Thierry wrote:


On 7/30/20 2:22 PM, peterz@xxxxxxxxxxxxx wrote:
On Thu, Jul 30, 2020 at 01:40:42PM +0100, Julien Thierry wrote:


On 7/30/20 10:57 AM, peterz@xxxxxxxxxxxxx wrote:
On Thu, Jul 30, 2020 at 10:41:41AM +0100, Julien Thierry wrote:
+ if (file->elf->changed)
+ return elf_write(file->elf);
+ else
+ return 0;
}

I think we can do without that else :-)


I did wonder and was not 100% confident about it, but the orc gen will
always change the file, correct?

Not if it already has orc, iirc.

But what I was trying to say is that:

if (file->elf->changed)
return elf_write(file->elf)

return 0;

is identical code and, IMO, easier to read.


Much easier yes, I'll change it.

But I think file->elf->changed can be assumed at this point anyway, so
it could just be an unconditional

return elf_write(file->elf);


I'll triple check whether that's the case and remove the if if possible.

I think it is the case. And even if not, it would only cause a pointless
call to elf_update() in the end and that should not do any harm anyway if
I am not mistaken.

However, I think there is a problem with the rebase on top of the current
code. The patch moves elf_write() call to orc_gen.c which was ok before
Peterz introduced elf_write_insn() et al. We need to keep elf_write() in
check.c for this case too.


Yes, you're right. Looks like I messed things up with the rebase. That means I might have to move the elf_write() to builtin-check.c.

Thanks for pointing it out.

--
Julien Thierry