Re: [RFC][PATCH 00/13] Cleanup recordmcount and begin objtool conversion

From: Josh Poimboeuf
Date: Fri May 31 2019 - 14:38:37 EST


On Thu, May 30, 2019 at 04:52:19PM -0700, Matt Helsley wrote:
> > > objtool orc+mcount ?
> > >
> > > That is, have '+' be a separator for cmd thingies. That would of course
> > > require all other arguments to be shared between all commands, which is
> > > currently already so, but I've not checked the mcount patches.
> >
> > The problem is that you have to combine "orc generate" with "mcount
> > record". Because even the subcommands have subcommands ;-)
> >
> > And also sharing arguments between all subcommands isn't ideal.
> >
> > Maybe could do:
> >
> > objtool orc generate [orc options] + mcount record [mcount options]
>
> I think that makes more sense; it'll be easier to construct
> Make recipes this way. I was thinking '+' would be something like the
> getopt handling of the '--' argument where it stops argument parsing so
> someting else can consume the remainder.
>
> The really interesting part is deciding which file to operate on is
> specified by the arguments to the first subcommand and subsequent subcmds
> would then operate on the same object file. For example:
>
> objtool orc generate [orc opts] foo.o + mcount record [mcount opts]
>
> Would it be clearer what's going on if the object file(s) were specified
> first and then the passes to run and their arguments came afterwards?
> I'm thinking it'd go somewhat like this:
>
> objtool foo.o [bar.o] -- check [check opts] + \
> orc generate [orc opts] + \
> mcount record [mcount opts]
>
> Then objtool would iterate over the object file(s) to open,
> hand off the ELF data structures into each successive pass, and
> finally write any accumulated changes back.

Yeah, I forgot about the .o file. Something like that would probably
work. The ordering seems a bit funny to me. Another possibly more
readable variation would be:

objtool check [check opts] + orc generate [orc opts] + mcount record [mcount opts] -- foo.o [bar.o]

or, just use '--' as a generic separator which can be used to separate
subcommands or file names.

objtool check [check opts] -- orc generate [orc opts] -- mcount record [mcount opts] -- foo.o [bar.o]

I kind of like that. But I think any of these variations would probably
work.

--
Josh