From patchwork Sat Nov 26 03:26:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 699459 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tQdhz0S5Kz9tlB for ; Sat, 26 Nov 2016 14:29:23 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="vheqoj/g"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3tQdhy6ZrFzDw3T for ; Sat, 26 Nov 2016 14:29:22 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="vheqoj/g"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pf0-x242.google.com (mail-pf0-x242.google.com [IPv6:2607:f8b0:400e:c00::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3tQddc0pSzzDvM9 for ; Sat, 26 Nov 2016 14:26:28 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="vheqoj/g"; dkim-atps=neutral Received: by mail-pf0-x242.google.com with SMTP id c4so3600644pfb.3 for ; Fri, 25 Nov 2016 19:26:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qvKnM+t1l74+3T1rpExzhu3G1Sxnc5+C+r6omDh2K6U=; b=vheqoj/gbnUpy4H3t7bVxxKqo/+3PmuYjhK1WeWDNkpc7jzEzQ3bNrBjUhZ4P4ZnJh j0HhOJIctZzt2WLe4Ree4YsECYgcXQUapzNOs9SA4C2x8WiZ6xISKls+GqfMYRaEvmOf zOf90Rcyo20/pPCZJv/FXwJ8eZhKlWCFKkfPDzLNEpQA5flC+/xrFxEfCBTorh6hgMQG 6++TOhNjDILWcnGHeCJRIu4qb3I+xuJAiikXM8CmIGqGWADwlEJL997fLgaQzOlJGBcQ QHM9Dw8bAG5SvGZHIUWZxu8xQOwDCc+xopv2BXDREGX4cuI9wAL5klbRNFu+nTDMifex DVhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qvKnM+t1l74+3T1rpExzhu3G1Sxnc5+C+r6omDh2K6U=; b=RNv6OPrGAp/7h1WdjjRxwqthlYZBBnYlqNeeHOVPn1F5+OOJvWgkjXrEfddvMOMUg1 ws5Lq6rrhkjypqvPrJ+NIXK0cgYw+FqPdENnqfqR53vptNn6gtz/GZ5eeyZjrMc0zmcu 2h+0ehzXHhplWnBc7GzGCjgcwByy5u8NmkaF5em+2wRgvcfGpKWV1ydfftXa1o/RXdAx jtBZP+owI9JBghA9BjnHKXwbZUWd/cU1bc7MPkbBns4W01p10H8vaoNUkNN3nlvoRvp6 0vtCq1rs4RIyrIsXp0g+CyyrMIjlJNC2f2zwJek0i10WEg3fgG0GswEn7AKx4Ro/DpK7 fHvQ== X-Gm-Message-State: AKaTC01FGY8/FZQl6kEPWpuvwn+/yPHs5ts6JAxh/EhN1kw0qqGizbLR8BS9XY6GnXWQPA== X-Received: by 10.84.211.144 with SMTP id c16mr24552537pli.37.1480130786255; Fri, 25 Nov 2016 19:26:26 -0800 (PST) Received: from roar.local0.net (27-33-21-189.tpgi.com.au. [27.33.21.189]) by smtp.gmail.com with ESMTPSA id e11sm52802937pgp.10.2016.11.25.19.26.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Nov 2016 19:26:25 -0800 (PST) From: Nicholas Piggin To: Michael Ellerman Subject: [PATCH 1/4] powerpc: use the new post-link pass to check relocations Date: Sat, 26 Nov 2016 14:26:09 +1100 Message-Id: <20161126032612.13559-2-npiggin@gmail.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161126032612.13559-1-npiggin@gmail.com> References: <20161126032612.13559-1-npiggin@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Currently powerpc has to introduce a dependency on its default build target zImage in order to run a relocation check pass over the linked vmlinux. This is deficient because the check is not run if the plain vmlinux target is built, or if one of the other boot targets is built. Switch to using the kbuild post-link pass in order to run this check. In future powerpc will use this to do more complicated operations, but initially using it for something simple is a good first step. Signed-off-by: Nicholas Piggin --- arch/powerpc/Makefile | 11 ----------- arch/powerpc/Makefile.postlink | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 11 deletions(-) create mode 100644 arch/powerpc/Makefile.postlink diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 8828807..868b9ec 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -270,17 +270,6 @@ PHONY += $(BOOT_TARGETS1) $(BOOT_TARGETS2) boot := arch/$(ARCH)/boot -ifeq ($(CONFIG_RELOCATABLE),y) -quiet_cmd_relocs_check = CALL $< - cmd_relocs_check = $(CONFIG_SHELL) $< "$(OBJDUMP)" "$(obj)/vmlinux" - -PHONY += relocs_check -relocs_check: arch/powerpc/relocs_check.sh vmlinux - $(call cmd,relocs_check) - -zImage: relocs_check -endif - $(BOOT_TARGETS1): vmlinux $(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@) $(BOOT_TARGETS2): vmlinux diff --git a/arch/powerpc/Makefile.postlink b/arch/powerpc/Makefile.postlink new file mode 100644 index 0000000..8c0170e --- /dev/null +++ b/arch/powerpc/Makefile.postlink @@ -0,0 +1,34 @@ +# =========================================================================== +# Post-link powerpc pass +# =========================================================================== +# +# 1. Check that vmlinux relocations look sane + +PHONY := __archpost +__archpost: + +include include/config/auto.conf +include scripts/Kbuild.include + +quiet_cmd_relocs_check = CHKREL $@ + cmd_relocs_check = $(CONFIG_SHELL) $(srctree)/arch/powerpc/relocs_check.sh "$(OBJDUMP)" "$@" + +# `@true` prevents complaint when there is nothing to be done + +vmlinux: FORCE + @true +ifdef CONFIG_RELOCATABLE + $(call if_changed,relocs_check) +endif + +%.ko: FORCE + @true + +clean: + @true + +PHONY += FORCE clean + +FORCE: + +.PHONY: $(PHONY)