Re: [RFC][PATCH 00/36] objtool: Make recordmcount a subcommand

From: Julien Thierry
Date: Tue Apr 14 2020 - 03:24:30 EST


Hi Matt,

On 4/10/20 8:35 PM, Matt Helsley wrote:
recordmcount has its own ELF wrapper code and could utilize
objtool's ELF code to more-portably handle architecture variations.
This series makes recordmcount a subcommand of objtool.

The initial 5 patches make objtool compilable for more than x86.
Unlike recordmcount the check command and orc tools are not currently
checking other architectures so we need a way to cleanly build
objtool for those architectures that don't support check / orc. I
went with using weak symbols and added a "missing" architecture
which can be used to indicate the tool is not implemented while
avoiding the need for every architecture to explicitly specify
which subcommands / features are not implemented. I'm curious if
there are better approaches folks recommend though -- this is the
one I landed on. The patches do not add HAVE_OBJTOOL to all
architectures.


If all you need from objtool it the elf parsing code, wouldn't it make more sense to move that out of objtool, as a utility library that both objtool and recordmcount could use (and perhaps other tools in the future?)

In patch 3 you seem to mention that other tools already have their own code to parse elf. So instead of converting everything as an objtool subcommand, maybe just have the library with the required functionality.

Any opinions on the above? What do people prefer?

Cheers,

--
Julien Thierry