Commit e8d368ad authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Ingo Molnar

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 9c2af1c7 ("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: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/20190328193429.21373-2-ard.biesheuvel@linaro.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 1a9df9e2
...@@ -86,12 +86,13 @@ $(obj)/%.stub.o: $(obj)/%.o FORCE ...@@ -86,12 +86,13 @@ $(obj)/%.stub.o: $(obj)/%.o FORCE
# this time, use objcopy and leave all sections in place. # this time, use objcopy and leave all sections in place.
# #
quiet_cmd_stubcopy = STUBCPY $@ quiet_cmd_stubcopy = STUBCPY $@
cmd_stubcopy = if $(STRIP) --strip-debug $(STUBCOPY_RM-y) -o $@ $<; \ cmd_stubcopy = \
then if $(OBJDUMP) -r $@ | grep $(STUBCOPY_RELOC-y); \ $(STRIP) --strip-debug $(STUBCOPY_RM-y) -o $@ $<; \
then (echo >&2 "$@: absolute symbol references not allowed in the EFI stub"; \ if $(OBJDUMP) -r $@ | grep $(STUBCOPY_RELOC-y); then \
rm -f $@; /bin/false); \ echo "$@: absolute symbol references not allowed in the EFI stub" >&2; \
else $(OBJCOPY) $(STUBCOPY_FLAGS-y) $< $@; fi \ /bin/false; \
else /bin/false; fi fi; \
$(OBJCOPY) $(STUBCOPY_FLAGS-y) $< $@
# #
# ARM discards the .data section because it disallows r/w data in the # ARM discards the .data section because it disallows r/w data in the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment