From: Nicholas Piggin <npiggin@gmail.com>
To: linux-kbuild@vger.kernel.org
Cc: Nicholas Piggin <npiggin@gmail.com>,
linux-arch@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
Stephen Rothwell <sfr@canb.auug.org.au>,
Arnd Bergmann <arnd@arndb.de>, Nicolas Pitre <nico@linaro.org>,
Segher Boessenkool <segher@kernel.crashing.org>,
Alan Modra <amodra@gmail.com>
Subject: [PATCH 3/5] kbuild: add arch specific post-module-link pass
Date: Fri, 5 Aug 2016 22:12:01 +1000 [thread overview]
Message-ID: <1470399123-8455-4-git-send-email-npiggin@gmail.com> (raw)
In-Reply-To: <1470399123-8455-1-git-send-email-npiggin@gmail.com>
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 <npiggin@gmail.com>
---
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)
--
2.8.1
next prev parent reply other threads:[~2016-08-05 12:12 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-05 12:11 [RFC][PATCH 0/5] kbuild changes, thin archives, --gc-sections Nicholas Piggin
2016-08-05 12:11 ` [PATCH 1/5] kbuild: allow architectures to use thin archives instead of ld -r Nicholas Piggin
2016-08-06 3:50 ` kbuild test robot
2016-08-06 20:10 ` Sam Ravnborg
2016-08-07 1:49 ` Stephen Rothwell
2016-08-07 3:34 ` Alan Modra
2016-08-07 4:17 ` Nicolas Pitre
2016-08-07 14:40 ` Sam Ravnborg
2016-08-08 3:19 ` Nicholas Piggin
2016-08-08 4:46 ` Sam Ravnborg
2016-08-08 3:25 ` Nicholas Piggin
2016-08-08 9:18 ` Arnd Bergmann
2016-08-05 12:12 ` [PATCH 2/5] kbuild: allow archs to select build for link dead code/data elimination Nicholas Piggin
2016-08-06 20:14 ` Sam Ravnborg
2016-08-08 3:29 ` Nicholas Piggin
2016-08-08 4:49 ` Sam Ravnborg
2016-08-07 5:33 ` Nicolas Pitre
2016-08-08 3:42 ` Nicholas Piggin
2016-08-08 4:12 ` Nicolas Pitre
2016-08-08 4:27 ` Nicholas Piggin
2016-08-07 9:57 ` Alan Modra
2016-08-07 11:35 ` Andreas Schwab
2016-08-07 20:26 ` Arnd Bergmann
2016-08-07 23:49 ` Alan Modra
2016-08-08 15:14 ` Arnd Bergmann
2016-08-08 23:50 ` Alan Modra
2016-08-09 22:10 ` Arnd Bergmann
2016-08-09 3:16 ` Andi Kleen
2016-08-09 22:29 ` Arnd Bergmann
2016-08-09 23:08 ` Andi Kleen
2016-08-10 0:37 ` Andi Kleen
2016-08-05 12:12 ` Nicholas Piggin [this message]
2016-08-05 13:56 ` [PATCH 3/5] kbuild: add arch specific post-module-link pass Nicholas Piggin
2016-08-06 20:16 ` Sam Ravnborg
2016-08-08 3:30 ` Nicholas Piggin
2016-08-05 12:12 ` [PATCH 4/5] powerpc: switch to using thin archives Nicholas Piggin
2016-08-05 12:12 ` [PATCH 5/5] powerpc/64: use linker dce Nicholas Piggin
2016-08-05 13:32 ` [RFC][PATCH 0/5] kbuild changes, thin archives, --gc-sections Nicholas Piggin
2016-08-07 20:23 ` Arnd Bergmann
2016-08-08 3:53 ` Nicholas Piggin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1470399123-8455-4-git-send-email-npiggin@gmail.com \
--to=npiggin@gmail.com \
--cc=amodra@gmail.com \
--cc=arnd@arndb.de \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=nico@linaro.org \
--cc=segher@kernel.crashing.org \
--cc=sfr@canb.auug.org.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).