From patchwork Thu Aug 11 10:16:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 9274987 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EA72860CDC for ; Thu, 11 Aug 2016 10:17:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DAA1C284DE for ; Thu, 11 Aug 2016 10:17:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF44D285E9; Thu, 11 Aug 2016 10:17:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D1E52859A for ; Thu, 11 Aug 2016 10:17:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751335AbcHKKRZ (ORCPT ); Thu, 11 Aug 2016 06:17:25 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:33112 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752812AbcHKKRW (ORCPT ); Thu, 11 Aug 2016 06:17:22 -0400 Received: by mail-pf0-f194.google.com with SMTP id i6so4641777pfe.0; Thu, 11 Aug 2016 03:17:22 -0700 (PDT) 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=Vsb6qhq09LT7KHR6TCfUIPJ3hPc0nRptl9L4djhz/s8=; b=npOG1nT3XBRnaMfrC7E+E2bByr0eJuwarJAfs43n7uHjJXNQjQTrDjLZxLtI/ONODa N0Ba1rS0VWTVoBj3nImFqDHluEJi6LGi0gGwp/yOQnDtMF/9OFJE/FJbgizjYAsyWTP9 aESfXVzfGGvqkdRyXwn3h/M6e4/bcd8OBqlkjgOrQG64ClmlWExFY7oLxa01A8FK5AJI rpcGAplwVCRgSNct/oO1eG3ltpIb0exuRVVWlcvL3yl6ZtIASv+Ubq6ewpUZ3IHI8Ryb JT4EkXkVW1va8V53Rd4IjnWyfdi8mW8ZQodCvxVWxkvXEReH9BKcRAFb0+nRuF81Uz4Z b1lw== 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=Vsb6qhq09LT7KHR6TCfUIPJ3hPc0nRptl9L4djhz/s8=; b=Jew8qdK9taHtOHZJfHc0/WPl5rr5VQ2BWMx9N763EXMphpzt1/w+gI57me0hzc934e S9YJKbmK/LqY6tmnm/hQSjh1KY2Bc3MIrJXV+URSsTDVledL0nQWPVt4Y2RMlkbfx4qg RXWAEd+BIO3dvBwzf9umAEtj5qhT1HnjL1CmJuUkEnvPz2ktiodXyyboQt5SEo8ecof0 bMSXWKfuuQjA9sKRifdvyOEcflQOvBROstz8fVLm6rZ/aVoHKnx5gliBLWWtVnoRlNJh nYz97DqRK8PpgS22mYiI+t/ukT3Re4hzZJBi477V3+yFX9TA4KHMNPAPyRY5sHnWN16X kkWg== X-Gm-Message-State: AEkoouvn5rXj/2woI2h5m2DIPm72smYEOd8pNUoiIdicJM3MTsBkIjQhveCxkOaj/h56UQ== X-Received: by 10.98.157.12 with SMTP id i12mr15735237pfd.164.1470910641834; Thu, 11 Aug 2016 03:17:21 -0700 (PDT) Received: from roar.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id ao6sm4028351pac.8.2016.08.11.03.17.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Aug 2016 03:17:21 -0700 (PDT) From: Nicholas Piggin To: linux-kbuild@vger.kernel.org Cc: Nicholas Piggin , linux-arch@vger.kernel.org, Michal Marek , Sam Ravnborg , Stephen Rothwell , Arnd Bergmann , Nicolas Pitre , Segher Boessenkool , Alan Modra Subject: [PATCH 6/6] powerpc: use the new post-link pass to check relocations Date: Thu, 11 Aug 2016 20:16:20 +1000 Message-Id: <1470910580-18458-7-git-send-email-npiggin@gmail.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1470910580-18458-1-git-send-email-npiggin@gmail.com> References: <1470910580-18458-1-git-send-email-npiggin@gmail.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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/Kconfig | 1 + arch/powerpc/Makefile | 11 ----------- arch/powerpc/Makefile.postlink | 31 +++++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 11 deletions(-) create mode 100644 arch/powerpc/Makefile.postlink diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 927d2ab..74be094 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -85,6 +85,7 @@ config ARCH_HAS_DMA_SET_COHERENT_MASK config PPC bool default y + select BUILD_ARCH_POSTLINK select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO select BINFMT_ELF diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 04a1332..e7e0f5e 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..67a0864 --- /dev/null +++ b/arch/powerpc/Makefile.postlink @@ -0,0 +1,31 @@ +# =========================================================================== +# 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) arch/powerpc/relocs_check.sh "$(OBJDUMP)" "$@" + +# Prevent complainints about nothing to be done +vmlinux: FORCE + @echo -n +ifeq ($(CONFIG_RELOCATABLE),y) + $(call if_changed,relocs_check) +endif + +%.ko: FORCE + @echo -n + + +PHONY += FORCE + +FORCE: + +.PHONY: $(PHONY)