From: Julien Thierry <jthierry@redhat.com>
To: Matt Helsley <mhelsley@vmware.com>, linux-kernel@vger.kernel.org
Cc: Josh Poimboeuf <jpoimboe@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Miroslav Benes <mbenes@suse.cz>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH 3/3] objtool: Enable compilation of objtool for all architectures
Date: Wed, 20 May 2020 09:31:46 +0100 [thread overview]
Message-ID: <b27ee658-2886-107c-a367-632467ec6929@redhat.com> (raw)
In-Reply-To: <96252a8eee50710f4fe115ca516f0e6058b9f66b.1589913349.git.mhelsley@vmware.com>
On 5/19/20 9:55 PM, Matt Helsley wrote:
> objtool currently only compiles for x86 architectures. This is
> fine as it presently does not support tooling for other
> architectures. However, we would like to be able to convert other
> kernel tools to run as objtool sub commands because they too
> process ELF object files. This will allow us to convert tools
> such as recordmcount to use objtool's ELF code.
>
> Since much of recordmcount's ELF code is copy-paste code to/from
> a variety of other kernel tools (look at modpost for example) this
> means that if we can convert recordmcount we can convert more.
>
> We define "missing" weak definitions for subcommand entry functions
> and other weak definitions for shared functions critical to
> building existing subcommands. These return 127 when the command is
> missing which signify tools that do not exist on all architectures.
> In this case the "check" and "orc" tools do not exist on all
> architectures so we only add them for x86. Future changes adding
> support for "check", to arm64 for example, can then modify the
> SUBCMD_CHECK variable when building for arm64.
>
> objtool is not currently wired in to KConfig to be built for other
> architectures because it's not needed for those architectures and
> there are no commands it supports other than those for x86. As more
> command support is enabled on various architectures the necessary
> KConfig changes can be made (e.g. adding "STACK_VALIDATION") to
> trigger building objtool.
>
> Signed-off-by: Matt Helsley <mhelsley@vmware.com>
> Cc: Julien Thierry <jthierry@redhat.com>
> ---
> tools/objtool/Build | 13 +++++++++----
> tools/objtool/Makefile | 11 ++++++++++-
> tools/objtool/arch.h | 4 +++-
> tools/objtool/builtin-check.c | 2 +-
> tools/objtool/builtin-orc.c | 3 +--
> tools/objtool/check.c | 4 ++--
> tools/objtool/check.h | 4 ----
> tools/objtool/objtool.h | 14 ++++++++++++++
> tools/objtool/orc.h | 18 ------------------
> tools/objtool/orc_dump.c | 3 ++-
> tools/objtool/orc_gen.c | 1 -
> tools/objtool/weak.c | 35 +++++++++++++++++++++++++++++++++++
> 12 files changed, 77 insertions(+), 35 deletions(-)
> delete mode 100644 tools/objtool/orc.h
> create mode 100644 tools/objtool/weak.c
>
> diff --git a/tools/objtool/Build b/tools/objtool/Build
> index 66f44f5cd2a6..b7222d5cc7bc 100644
> --- a/tools/objtool/Build
> +++ b/tools/objtool/Build
> @@ -1,11 +1,16 @@
> objtool-y += arch/$(SRCARCH)/
> +
> +objtool-y += weak.o
> +
> +objtool-$(SUBCMD_CHECK) += check.o
> +objtool-$(SUBCMD_CHECK) += special.o
> +objtool-$(SUBCMD_ORC) += check.o
> +objtool-$(SUBCMD_ORC) += orc_gen.o
> +objtool-$(SUBCMD_ORC) += orc_dump.o
> +
> objtool-y += builtin-check.o
> objtool-y += builtin-orc.o
> -objtool-y += check.o
> -objtool-y += orc_gen.o
> -objtool-y += orc_dump.o
> objtool-y += elf.o
> -objtool-y += special.o
> objtool-y += objtool.o
>
> objtool-y += libstring.o
> diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
> index 6b91388aecbb..12686e2f1a56 100644
> --- a/tools/objtool/Makefile
> +++ b/tools/objtool/Makefile
> @@ -46,7 +46,16 @@ elfshdr := $(shell echo '$(pound)include <libelf.h>' | $(CC) $(CFLAGS) -x c -E -
> CFLAGS += $(if $(elfshdr),,-DLIBELF_USE_DEPRECATED)
>
> AWK = awk
> -export srctree OUTPUT CFLAGS SRCARCH AWK
> +
> +SUBCMD_CHECK := n
> +SUBCMD_ORC := n
> +
> +ifeq ($(SRCARCH),x86)
> + SUBCMD_CHECK := y
> + SUBCMD_ORC := y
> +endif
> +
> +export srctree OUTPUT CFLAGS SRCARCH AWK SUBCMD_CHECK SUBCMD_ORC
Nit: I was thinking, since the list of SUBCMD_* is only going to grow
maybe it would be nicer to have a single export line for the SUBCMD_*
variables and leave the export line of [srctree..AWK] untouched.
Just a suggestion, and only in case you respin this taking into account
Josh's comment.
Otherwise things look good to me.
Cheers,
--
Julien Thierry
next prev parent reply other threads:[~2020-05-20 8:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 20:55 [PATCH 0/3] Enable objtool multiarch build Matt Helsley
2020-05-19 20:55 ` [PATCH 1/3] objtool: Exit successfully when requesting help Matt Helsley
2020-05-27 14:44 ` Kamalesh Babulal
2020-05-19 20:55 ` [PATCH 2/3] objtool: Move struct objtool_file into arch-independent header Matt Helsley
2020-05-20 8:04 ` Julien Thierry
2020-05-27 14:43 ` Kamalesh Babulal
2020-05-19 20:55 ` [PATCH 3/3] objtool: Enable compilation of objtool for all architectures Matt Helsley
2020-05-19 21:18 ` Josh Poimboeuf
2020-05-19 21:46 ` Matt Helsley
2020-05-20 14:16 ` Josh Poimboeuf
2020-05-20 16:38 ` Matt Helsley
2020-05-27 14:42 ` Kamalesh Babulal
2020-05-20 8:31 ` Julien Thierry [this message]
2020-05-20 16:41 ` Matt Helsley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b27ee658-2886-107c-a367-632467ec6929@redhat.com \
--to=jthierry@redhat.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=mhelsley@vmware.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®