From patchwork Thu Mar 28 19:34:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 161330 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1122401jan; Thu, 28 Mar 2019 12:34:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqxb6y7RW3XwUetFf9QcXPjCe/8hEhSsdF3twzCn6e8Rl22tRCf7pMszalomP18TTCJbYpgJ X-Received: by 2002:a63:3188:: with SMTP id x130mr40398745pgx.64.1553801684528; Thu, 28 Mar 2019 12:34:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553801684; cv=none; d=google.com; s=arc-20160816; b=JNxMVPEJiA1+9BHyxp25rmynMTkj6mlcSld7z0nCm6MSQghHDi7b+q53whsCaR0H3T MmPkY533jf7il9LplxCk0lVEwzWCoTBzZNAJkFPsOuPrrv/8m+n1z4EWfZByPTB0ZIwI iHmBwr6EqiLZiRvVwuJ5aEZ84ZpEGmmgHPRdyqYDMoTliZ8EIbzzf+ZToYk1FSkK2ZGZ 6O29Nj5G8K8WISZm19F6eVcV3KvKfVHPRZR68YS7ad2t+ASOEt/DExbLjTVLPavqDaWe CpLzO408iADBzIeNfw/b0jFKIcfG64DEjDIOL+Cy9MiQRe7byU/BOHcPOxX2stpdF/rf /tYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=veeM4ZlKnlch+gefwAyRK7UAExOJ9TXLKyPKjPAv7yU=; b=aD7JUBuCn1oRTyauASYWdGFw4ZV3antpx3FKtGxizUqriayGjLwL0+B6lJX1JzhDXB u3so/CrQDZoA582Dl+djR3ly4pSlQtECzjnhVDF+uM/8OpsZVqZRuLI8ndLj3hF4Knj9 0RPfNqocZicrj/YLPc1siG69qhmS+U3XCDIiXcKFh3xNJr5SzYMIpEs1CbSxLD1aa6DF iOG0EmPf9kwaDyNwI1DpRugekEv91Q/DcVgyt4v0EOjUXsL4Hj5QFAVyKRl1MYWMeICW 2ZD+CkR3hntIxJH18V58IPDkCdJpN5Ob1VEl2H1vaJ31iY6PdOahxUZXv79jgWH/PgS/ 2Sug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rM0vdUjU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f12si19606591plt.418.2019.03.28.12.34.44; Thu, 28 Mar 2019 12:34:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rM0vdUjU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726596AbfC1Ten (ORCPT + 31 others); Thu, 28 Mar 2019 15:34:43 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:37374 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726321AbfC1Tek (ORCPT ); Thu, 28 Mar 2019 15:34:40 -0400 Received: by mail-wr1-f65.google.com with SMTP id w10so24390134wrm.4 for ; Thu, 28 Mar 2019 12:34:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=veeM4ZlKnlch+gefwAyRK7UAExOJ9TXLKyPKjPAv7yU=; b=rM0vdUjUx1GHCMeG94p6laganR+8CegPEC1lTi+rY3QdBX3L38Ol187aSgEGgi9C1k AvjdjfknFY3Q71YzsQdxtKakLvKwdtKRSaU3oqQF+O4nyC8Nn6n0npZz52JPsYc9+TtQ bL2hhgTvg3CoUA6pSfMlAVWDMCF4WedoTLTzTcoPM2M9cOUu0EJntaRp3BxBD6U5x2hI pzZsySwqN6BiqFgoPa/L/a3K9LvJv8vaxUhpBjvSiB5OnfWOc5gMhauHq0bVUowfo2vy qgGa3cLZRz75W4t9XmThKajjXsZ4MdVsXo9e3rTDTHwhTYSALYG6O1tqyttOXxJ13Uo6 ah+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=veeM4ZlKnlch+gefwAyRK7UAExOJ9TXLKyPKjPAv7yU=; b=CYBW5B4XeE9tlPCdHpJYo3+NE/CpSqrQsVkbl0UvFj8enbih9pvos/XhUeSWKR+8El 7GU7jpkkR/fQ7BM1iQePVQEmQ6/c8LjjajQ/lT2z5P8eje+2jP5WLHzNL2tU40+sGRQp H/6fT0PT6umc7GChBHEwvNkPevk3Djlpb1qVgZCkUx64CrdakgBplcVPGcI1eROOKWaZ tcb/ouMYUs/fTZMbZj79XAoh4mK1Mtd5VtLCYAaMlaAPI0BY6OWTu0iD3LA+JEnZuTWi KMDIJ21aJiSm6L/5DBILDfs1doLoAsj4SPtVkHHuRv9UNgxgjCYgAvn5WO+tJ6C318tl 9Eug== X-Gm-Message-State: APjAAAV29GvqX8oxI8UnvgdqmqZb9R4xBuDKuNuqgw6t6nfBKA2v4drr IxchLqzw9idWCaG9/cUZXpWaAA== X-Received: by 2002:adf:afd0:: with SMTP id y16mr27436030wrd.328.1553801678526; Thu, 28 Mar 2019 12:34:38 -0700 (PDT) Received: from sudo.home ([2a01:cb1d:112:6f00:dd62:8a50:1468:989d]) by smtp.gmail.com with ESMTPSA id d6sm27739186wrx.62.2019.03.28.12.34.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Mar 2019 12:34:37 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Masahiro Yamada , Ard Biesheuvel , linux-kernel@vger.kernel.org Subject: [PATCH 1/5] efi/libstub: refactor cmd_stubcopy Date: Thu, 28 Mar 2019 20:34:25 +0100 Message-Id: <20190328193429.21373-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190328193429.21373-1-ard.biesheuvel@linaro.org> References: <20190328193429.21373-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Masahiro Yamada 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 Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/libstub/Makefile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) -- 2.20.1 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