From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@redhat.com>,
linux-efi <linux-efi@vger.kernel.org>,
Kees Cook <keescook@chromium.org>,
Alistair Strachan <astrachan@google.com>,
Laura Abbott <labbott@redhat.com>,
Will Deacon <will.deacon@arm.com>, Ingo Molnar <mingo@kernel.org>,
Nathan Chancellor <natechancellor@gmail.com>
Subject: Re: [PATCH] efi/libstub: refactor cmd_stubcopy
Date: Tue, 12 Feb 2019 08:23:37 +0100 [thread overview]
Message-ID: <CAKv+Gu8yLY+c6jNmHYkvP3n=xiojF7dcKBHmeGibUW2FUrEczA@mail.gmail.com> (raw)
In-Reply-To: <1549943095-10956-1-git-send-email-yamada.masahiro@socionext.com>
On Tue, 12 Feb 2019 at 04:45, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> It took me a while to understand what is going on in the nested
> if-blocks.
>
> Simplify it by removing unneeded code.
>
> - if_changed automatically adds 'set -e', so any failure in the
> series of commands makes it immediately fail as a whole.
> So, the outer if block is entirely redundant.
>
> - Since commit 9c2af1c7377a ("kbuild: add .DELETE_ON_ERROR special
> target"), GNU Make automatically deletes the target on any failure
> in its recipe. The explicit 'rm -f $@' is redundant.
>
> - surrounding commands with ( ) will spawn a subshell to execute them
> in it, but it is rarely useful to do so.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Assuming that it still works as expected:
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
You can test this by adding a statically initialized global function
pointer to any of the libstub source files that get built for ARM.
Thanks!
> ---
>
> drivers/firmware/efi/libstub/Makefile | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
> index d984509..7788e8a 100644
> --- a/drivers/firmware/efi/libstub/Makefile
> +++ b/drivers/firmware/efi/libstub/Makefile
> @@ -86,12 +86,13 @@ $(obj)/%.stub.o: $(obj)/%.o FORCE
> # this time, use objcopy and leave all sections in place.
> #
> quiet_cmd_stubcopy = STUBCPY $@
> - cmd_stubcopy = if $(STRIP) --strip-debug $(STUBCOPY_RM-y) -o $@ $<; \
> - then if $(OBJDUMP) -r $@ | grep $(STUBCOPY_RELOC-y); \
> - then (echo >&2 "$@: absolute symbol references not allowed in the EFI stub"; \
> - rm -f $@; /bin/false); \
> - else $(OBJCOPY) $(STUBCOPY_FLAGS-y) $< $@; fi \
> - else /bin/false; fi
> + cmd_stubcopy = \
> + $(STRIP) --strip-debug $(STUBCOPY_RM-y) -o $@ $<; \
> + if $(OBJDUMP) -r $@ | grep $(STUBCOPY_RELOC-y); then \
> + echo "$@: absolute symbol references not allowed in the EFI stub" >&2; \
> + /bin/false; \
> + fi; \
> + $(OBJCOPY) $(STUBCOPY_FLAGS-y) $< $@
>
> #
> # ARM discards the .data section because it disallows r/w data in the
> --
> 2.7.4
>
next prev parent reply other threads:[~2019-02-12 7:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-12 3:44 [PATCH] efi/libstub: refactor cmd_stubcopy Masahiro Yamada
2019-02-12 7:23 ` Ard Biesheuvel [this message]
2019-02-15 5:48 ` Masahiro Yamada
2019-02-15 8:25 ` Ard Biesheuvel
2019-02-16 2:07 ` Masahiro Yamada
2019-03-26 6:05 ` Masahiro Yamada
2019-03-26 7:54 ` Ard Biesheuvel
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='CAKv+Gu8yLY+c6jNmHYkvP3n=xiojF7dcKBHmeGibUW2FUrEczA@mail.gmail.com' \
--to=ard.biesheuvel@linaro.org \
--cc=astrachan@google.com \
--cc=keescook@chromium.org \
--cc=labbott@redhat.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=natechancellor@gmail.com \
--cc=will.deacon@arm.com \
--cc=yamada.masahiro@socionext.com \
/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;
as well as URLs for NNTP newsgroup(s).