Message ID | 1470399123-8455-4-git-send-email-npiggin@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, 5 Aug 2016 22:12:01 +1000 Nicholas Piggin <npiggin@gmail.com> wrote: > Add an option for architectures to pass over modules after they are > linked. powerpc will use this to fix up alternate instruction patch > relocations. For that matter, now I think about it, I'd like to have this generic postmod pass for the vmlinux as well. And it would be to call into the arch Makefile rather than just supply a tool. Currently powerpc deals with it by adding dependencies on its zImage target, but it would be really nice to be able to fix that while we're here too. Is that going to work? Thanks, Nick -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, Aug 05, 2016 at 10:12:01PM +1000, Nicholas Piggin wrote: > 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. > + This needs documentation in kbuild.txt, where there is a nearly full lst of KBUILD_ variables. Sam -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Sat, 6 Aug 2016 22:16:29 +0200 Sam Ravnborg <sam@ravnborg.org> wrote: > On Fri, Aug 05, 2016 at 10:12:01PM +1000, Nicholas Piggin wrote: > > 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. > > + > > This needs documentation in kbuild.txt, where there is a > nearly full lst of KBUILD_ variables. Thanks, I missed that. Thanks, Nick -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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)
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(+)