From patchwork Fri Aug 5 12:12:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 656185 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3s5Qpk2Mkbz9snm for ; Fri, 5 Aug 2016 22:19:26 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=CLvgxEJe; dkim-atps=neutral Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3s5Qpk0RGlzDqwH for ; Fri, 5 Aug 2016 22:19:26 +1000 (AEST) 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=CLvgxEJe; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pa0-x241.google.com (mail-pa0-x241.google.com [IPv6:2607:f8b0:400e:c03::241]) (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 3s5QgF13b0zDqWT for ; Fri, 5 Aug 2016 22:12:57 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=CLvgxEJe; dkim-atps=neutral Received: by mail-pa0-x241.google.com with SMTP id cf3so19184668pad.2 for ; Fri, 05 Aug 2016 05:12:57 -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=gkDXa6Q4hSgqFkGc+84MhR/Tuy5zgOIFIl3E2x2Vj+s=; b=CLvgxEJeXj6xPtaUOvMiTfBUi5gtD7G2Dph4nXYzF0eqloxPiPYDMAgmFmadbIH1tl e+JrTUQ+r2AlswX9v8Qsy+SNa6lT73a48TsSqQgcs4AYYQywvAOe5RLtiaKnhINKtqPO yap8reR83hNVjkDStdbjg1GQveJ1iC7mRHvih55ShQZtfTPavNqDVFwErCtR5a0Rv5z7 yqSpQW75UOdBErAjF6R1WTKNbcOl/jypgnmnjSQkBOyCgfXZUCd3RK5QUmTsSu6sktF5 dfs6Y3qGyOr/ap9t6o10dphBMjyfxA7PPvI1Vfqosrri2irlJDA7veDuWEl+CvhCg9qU sSEQ== 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=gkDXa6Q4hSgqFkGc+84MhR/Tuy5zgOIFIl3E2x2Vj+s=; b=KGtWksLhq7gvXgWiq7XMnCcCShIPt3IJ6HGdIhp120GL4bzY/5aVk7DoP3bxWoNaJX wUB2IXE1dMuPxJ5Ps3Qgt128+LRtfw4vaxOjyx/6vD62B9PF9kagOkYFPRHjIoSKeWjC maI41FsR4bmSpv6915ZTF06WRqTpIbm5v0d5RpnT2HkcL0ImDe54apdnkM5AKcLPe84w U9iizDcTQ7gCjkAHV8qQ0zFXAykbuK9j1SldNm0UoRkwXArbpgSV3Z7UmNP9VJJDdr3m fLwCYqkXst9WREpH5fozYSrkmEl77nCrV2ikExyBbga6gweQMNRlxq7Y+Rp+4qLYAf7W G4GA== X-Gm-Message-State: AEkoout5yvIfUicQQ//4lPClFnNdOmcgEjp/HVO4RlH2Ieu5GdWJAKTYjiICwYuLYgKPyQ== X-Received: by 10.66.134.20 with SMTP id pg20mr133626521pab.98.1470399175462; Fri, 05 Aug 2016 05:12:55 -0700 (PDT) Received: from roar.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id m65sm27669685pfg.79.2016.08.05.05.12.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Aug 2016 05:12:54 -0700 (PDT) From: Nicholas Piggin To: linux-kbuild@vger.kernel.org Subject: [PATCH 3/5] kbuild: add arch specific post-module-link pass Date: Fri, 5 Aug 2016 22:12:01 +1000 Message-Id: <1470399123-8455-4-git-send-email-npiggin@gmail.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1470399123-8455-1-git-send-email-npiggin@gmail.com> References: <1470399123-8455-1-git-send-email-npiggin@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Stephen Rothwell , Arnd Bergmann , Nicolas Pitre , Alan Modra , Nicholas Piggin , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Add an option for architectures to pass over modules after they are linked. powerpc will use this to fix up alternate instruction patch relocations. Signed-off-by: Nicholas Piggin --- Documentation/kbuild/makefiles.txt | 6 ++++++ Makefile | 1 + scripts/Makefile.modpost | 8 ++++++++ 3 files changed, 15 insertions(+) diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index 13f888a..f6c065b 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt @@ -952,6 +952,12 @@ When kbuild executes, the following steps are followed (roughly): $(KBUILD_ARFLAGS) set by the top level Makefile to "D" (deterministic mode) if this option is supported by $(AR). + KBUILD_MODPOST_TOOL Arch-specific command to run after module link + + $(KBUILD_MODPOST_TOOL) is used to add an arch-specific pass over + modules after their final link. E.g., powerpc uses this to adjust + relative branches of "alternate code patching" sections. + ARCH_CPPFLAGS, ARCH_AFLAGS, ARCH_CFLAGS Overrides the kbuild defaults These variables are appended to the KBUILD_CPPFLAGS, diff --git a/Makefile b/Makefile index d5ef31a..99ab8eb 100644 --- a/Makefile +++ b/Makefile @@ -421,6 +421,7 @@ export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL export KBUILD_ARFLAGS +export KBUILD_MODPOST_TOOL # When compiling out-of-tree modules, put MODVERDIR in the module # tree rather than in the kernel tree. The kernel tree might diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 1366a94..19f8481 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -121,8 +121,16 @@ quiet_cmd_ld_ko_o = LD [M] $@ $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \ -o $@ $(filter-out FORCE,$^) +ifdef KBUILD_MODPOST_TOOL +quiet_cmd_arch_modpost = ARCH $@ + cmd_arch_modpost = $(KBUILD_MODPOST_TOOL) $@ +endif + $(modules): %.ko :%.o %.mod.o FORCE $(call if_changed,ld_ko_o) +ifdef KBUILD_MODPOST_TOOL + $(call if_changed,arch_modpost) +endif targets += $(modules)