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: 9265325 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 37F0160760 for ; Fri, 5 Aug 2016 12:13:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 296BE283E4 for ; Fri, 5 Aug 2016 12:13:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1DE9A28400; Fri, 5 Aug 2016 12:13:03 +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 B115E283E4 for ; Fri, 5 Aug 2016 12:13:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161248AbcHEMM7 (ORCPT ); Fri, 5 Aug 2016 08:12:59 -0400 Received: from mail-pa0-f65.google.com ([209.85.220.65]:34955 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935043AbcHEMM4 (ORCPT ); Fri, 5 Aug 2016 08:12:56 -0400 Received: by mail-pa0-f65.google.com with SMTP id cf3so19184669pad.2; Fri, 05 Aug 2016 05:12:56 -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=Z2VMOMTCPXrNkE723GVmiIXFcepLG62ZbFBT5NJ9dqWXx3fcfRB5WRtWMPYkHCuOfw AnG8A8X2iqZTUNrH2ObzITEauOuenQVhpeGmBarOmgjX809JXr/QI2mYnKf/8rCs2Old IzLWhSMbwvKxw7H9CTyiyQPHXS47K08bElPmOFQHQFFdsDtRCyp7Nb2sAB7WHo4336F5 nAgwt/duQ3APp3DDH2pO5yKdm5ha+EKXoAITxbAEAPg0VkqfH+m4JCMjm1iJuXGCuyqg /kUUDICq03ORdCCY/0vmMPIyDbJ3avVW2o5lW/GXwohhqYgSnM5BkCq1UQ6LhTqatPkd VK3Q== X-Gm-Message-State: AEkoousal28g1dr+qkVJi4nLrnbYJnfkeilR6h7BunWpq8kT/ExocXWPF0BPhe6UKrawoQ== 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 Cc: Nicholas Piggin , linux-arch@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Stephen Rothwell , Arnd Bergmann , Nicolas Pitre , Segher Boessenkool , Alan Modra 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> 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 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)