[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-e8d368ad20f514dce86a64931fe4a6f06a0a6703@git.kernel.org>
Date: Thu, 28 Mar 2019 23:43:24 -0700
From: tip-bot for Masahiro Yamada <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: torvalds@...ux-foundation.org, ard.biesheuvel@...aro.org,
linux-kernel@...r.kernel.org, peterz@...radead.org,
mingo@...nel.org, tglx@...utronix.de,
yamada.masahiro@...ionext.com, matt@...eblueprint.co.uk,
hpa@...or.com
Subject: [tip:efi/core] efi/libstub: Refactor the cmd_stubcopy Makefile
command
Commit-ID: e8d368ad20f514dce86a64931fe4a6f06a0a6703
Gitweb: https://git.kernel.org/tip/e8d368ad20f514dce86a64931fe4a6f06a0a6703
Author: Masahiro Yamada <yamada.masahiro@...ionext.com>
AuthorDate: Thu, 28 Mar 2019 20:34:25 +0100
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Fri, 29 Mar 2019 07:34:59 +0100
efi/libstub: Refactor the cmd_stubcopy Makefile command
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@...ionext.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@...aro.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Matt Fleming <matt@...eblueprint.co.uk>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: linux-efi@...r.kernel.org
Link: http://lkml.kernel.org/r/20190328193429.21373-2-ard.biesheuvel@linaro.org
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
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 b0103e16fc1b..ae9081988c88 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
Powered by blists - more mailing lists