All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yuri Frolov <yfrolov@ru.mvista.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: linux-kbuild@vger.kernel.org, rep.dot.nop@gmail.com
Subject: [patch] powerpc: build modules outside the kernel tree fails, if it was built using O=
Date: Thu, 24 Sep 2009 15:28:11 +0400	[thread overview]
Message-ID: <4ABB57CB.3000409@ru.mvista.com> (raw)

Hello,

here is a corresponding bug: http://bugzilla.kernel.org/show_bug.cgi?id=11143
This patch should correctly export crtsavres.o in order to make O= option working.
Please, consider to apply.


Fix linking modules against crtsavres.o

Previously we got
  CC      drivers/char/hw_random/rng-core.mod.o
  LD [M]  drivers/char/hw_random/rng-core.ko
/there/src/buildroot.git.ppc/build_powerpc_nofpu/staging_dir/usr/bin/powerpc-linux-uclibc-ld: arch/powerpc/lib/crtsavres.o: No such file: No such file or directory

	* Makefile (LDFLAGS_MODULE_PREREQ): New variable to hold prerequisite
          files for modules.
	* arch/powerpc/Makefile: add crtsavres.o to LDFLAGS_MODULE_PREREQ.
	* scripts/Makefile.modpost (cmd_as_o_S): Copy from Makefile.build.
	  (cmd_ld_ko_o): Also link LDFLAGS_MODULE_PREREQ.
	  Provide rule to build objects from assembler.

Signed-off-by:  Bernhard Reutner-Fischer  <rep.dot.nop@gmail.com>
Signed-off by:  Yuri Frolov <yfrolov@ru.mvista.com>

Makefile                 |    2 ++
arch/powerpc/Makefile    |    2 +-
scripts/Makefile.modpost |   12 ++++++++++--
3 files changed, 13 insertions(+), 3 deletions(-)

diff -urpN -X linux-2.6/Documentation/dontdiff linux-2.6/arch/powerpc/Makefile linux-2.6-powerpc-crtsavres/arch/powerpc/Makefile
--- linux-2.6/arch/powerpc/Makefile	2009-09-17 20:04:31.000000000 +0400
+++ linux-2.6-powerpc-crtsavres/arch/powerpc/Makefile	2009-09-23 22:08:03.000000000 +0400
@@ -93,7 +93,7 @@ else
 	KBUILD_CFLAGS += $(call cc-option,-mtune=power4)
 endif
 else
-LDFLAGS_MODULE	+= arch/powerpc/lib/crtsavres.o
+LDFLAGS_MODULE_PREREQ += arch/powerpc/lib/crtsavres.o
 endif
 
 ifeq ($(CONFIG_TUNE_CELL),y)
diff -urpN -X linux-2.6/Documentation/dontdiff linux-2.6/Makefile linux-2.6-powerpc-crtsavres/Makefile
--- linux-2.6/Makefile	2009-09-17 20:04:30.000000000 +0400
+++ linux-2.6-powerpc-crtsavres/Makefile	2009-09-23 21:41:16.000000000 +0400
@@ -326,6 +326,7 @@ MODFLAGS	= -DMODULE
 CFLAGS_MODULE   = $(MODFLAGS)
 AFLAGS_MODULE   = $(MODFLAGS)
 LDFLAGS_MODULE  = -T $(srctree)/scripts/module-common.lds
+LDFLAGS_MODULE_PREREQ  =
 CFLAGS_KERNEL	=
 AFLAGS_KERNEL	=
 CFLAGS_GCOV	= -fprofile-arcs -ftest-coverage
@@ -355,6 +356,7 @@ export VERSION PATCHLEVEL SUBLEVEL KERNE
 export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
 export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE
 export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
+export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE LDFLAGS_MODULE_PREREQ CHECK CHECKFLAGS
 
 export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
 export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV
diff -urpN -X linux-2.6/Documentation/dontdiff linux-2.6/scripts/Makefile.modpost linux-2.6-powerpc-crtsavres/scripts/Makefile.modpost
--- linux-2.6/scripts/Makefile.modpost	2009-09-17 20:04:42.000000000 +0400
+++ linux-2.6-powerpc-crtsavres/scripts/Makefile.modpost	2009-09-23 22:15:00.000000000 +0400
@@ -122,14 +122,22 @@ quiet_cmd_cc_o_c = CC      $@
       cmd_cc_o_c = $(CC) $(c_flags) $(CFLAGS_MODULE)	\
 		   -c -o $@ $<
 
-$(modules:.ko=.mod.o): %.mod.o: %.mod.c FORCE
+quiet_cmd_as_o_S = AS $(quiet_modtag)  $@
+cmd_as_o_S       = $(CC) $(a_flags) $(AFLAGS_MODULE) -c -o $@ $<
+
+$(LDFLAGS_MODULE_PREREQ): %.o: %.S FORCE
+	$(Q)mkdir -p $(dir $@)
+	$(call if_changed_dep,as_o_S)
+
+$(modules:.ko=.mod.o): %.mod.o: %.mod.c $(LDFLAGS_MODULE_PREREQ) FORCE
 	$(call if_changed_dep,cc_o_c)
 
 targets += $(modules:.ko=.mod.o)
 
 # Step 6), final link of the modules
 quiet_cmd_ld_ko_o = LD [M]  $@
-      cmd_ld_ko_o = $(LD) -r $(LDFLAGS) $(LDFLAGS_MODULE) -o $@		\
+      cmd_ld_ko_o = $(LD) -r $(LDFLAGS) $(LDFLAGS_MODULE_PREREQ)	\
+			  $(LDFLAGS_MODULE) -o $@			\
 			  $(filter-out FORCE,$^)
 
 $(modules): %.ko :%.o %.mod.o FORCE

WARNING: multiple messages have this Message-ID (diff)
From: Yuri Frolov <yfrolov@ru.mvista.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: rep.dot.nop@gmail.com, linux-kbuild@vger.kernel.org
Subject: [patch] powerpc: build modules outside the kernel tree fails, if it was built using O=
Date: Thu, 24 Sep 2009 15:28:11 +0400	[thread overview]
Message-ID: <4ABB57CB.3000409@ru.mvista.com> (raw)

Hello,

here is a corresponding bug: http://bugzilla.kernel.org/show_bug.cgi?id=11143
This patch should correctly export crtsavres.o in order to make O= option working.
Please, consider to apply.


Fix linking modules against crtsavres.o

Previously we got
  CC      drivers/char/hw_random/rng-core.mod.o
  LD [M]  drivers/char/hw_random/rng-core.ko
/there/src/buildroot.git.ppc/build_powerpc_nofpu/staging_dir/usr/bin/powerpc-linux-uclibc-ld: arch/powerpc/lib/crtsavres.o: No such file: No such file or directory

	* Makefile (LDFLAGS_MODULE_PREREQ): New variable to hold prerequisite
          files for modules.
	* arch/powerpc/Makefile: add crtsavres.o to LDFLAGS_MODULE_PREREQ.
	* scripts/Makefile.modpost (cmd_as_o_S): Copy from Makefile.build.
	  (cmd_ld_ko_o): Also link LDFLAGS_MODULE_PREREQ.
	  Provide rule to build objects from assembler.

Signed-off-by:  Bernhard Reutner-Fischer  <rep.dot.nop@gmail.com>
Signed-off by:  Yuri Frolov <yfrolov@ru.mvista.com>

Makefile                 |    2 ++
arch/powerpc/Makefile    |    2 +-
scripts/Makefile.modpost |   12 ++++++++++--
3 files changed, 13 insertions(+), 3 deletions(-)

diff -urpN -X linux-2.6/Documentation/dontdiff linux-2.6/arch/powerpc/Makefile linux-2.6-powerpc-crtsavres/arch/powerpc/Makefile
--- linux-2.6/arch/powerpc/Makefile	2009-09-17 20:04:31.000000000 +0400
+++ linux-2.6-powerpc-crtsavres/arch/powerpc/Makefile	2009-09-23 22:08:03.000000000 +0400
@@ -93,7 +93,7 @@ else
 	KBUILD_CFLAGS += $(call cc-option,-mtune=power4)
 endif
 else
-LDFLAGS_MODULE	+= arch/powerpc/lib/crtsavres.o
+LDFLAGS_MODULE_PREREQ += arch/powerpc/lib/crtsavres.o
 endif
 
 ifeq ($(CONFIG_TUNE_CELL),y)
diff -urpN -X linux-2.6/Documentation/dontdiff linux-2.6/Makefile linux-2.6-powerpc-crtsavres/Makefile
--- linux-2.6/Makefile	2009-09-17 20:04:30.000000000 +0400
+++ linux-2.6-powerpc-crtsavres/Makefile	2009-09-23 21:41:16.000000000 +0400
@@ -326,6 +326,7 @@ MODFLAGS	= -DMODULE
 CFLAGS_MODULE   = $(MODFLAGS)
 AFLAGS_MODULE   = $(MODFLAGS)
 LDFLAGS_MODULE  = -T $(srctree)/scripts/module-common.lds
+LDFLAGS_MODULE_PREREQ  =
 CFLAGS_KERNEL	=
 AFLAGS_KERNEL	=
 CFLAGS_GCOV	= -fprofile-arcs -ftest-coverage
@@ -355,6 +356,7 @@ export VERSION PATCHLEVEL SUBLEVEL KERNE
 export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
 export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE
 export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
+export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE LDFLAGS_MODULE_PREREQ CHECK CHECKFLAGS
 
 export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
 export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV
diff -urpN -X linux-2.6/Documentation/dontdiff linux-2.6/scripts/Makefile.modpost linux-2.6-powerpc-crtsavres/scripts/Makefile.modpost
--- linux-2.6/scripts/Makefile.modpost	2009-09-17 20:04:42.000000000 +0400
+++ linux-2.6-powerpc-crtsavres/scripts/Makefile.modpost	2009-09-23 22:15:00.000000000 +0400
@@ -122,14 +122,22 @@ quiet_cmd_cc_o_c = CC      $@
       cmd_cc_o_c = $(CC) $(c_flags) $(CFLAGS_MODULE)	\
 		   -c -o $@ $<
 
-$(modules:.ko=.mod.o): %.mod.o: %.mod.c FORCE
+quiet_cmd_as_o_S = AS $(quiet_modtag)  $@
+cmd_as_o_S       = $(CC) $(a_flags) $(AFLAGS_MODULE) -c -o $@ $<
+
+$(LDFLAGS_MODULE_PREREQ): %.o: %.S FORCE
+	$(Q)mkdir -p $(dir $@)
+	$(call if_changed_dep,as_o_S)
+
+$(modules:.ko=.mod.o): %.mod.o: %.mod.c $(LDFLAGS_MODULE_PREREQ) FORCE
 	$(call if_changed_dep,cc_o_c)
 
 targets += $(modules:.ko=.mod.o)
 
 # Step 6), final link of the modules
 quiet_cmd_ld_ko_o = LD [M]  $@
-      cmd_ld_ko_o = $(LD) -r $(LDFLAGS) $(LDFLAGS_MODULE) -o $@		\
+      cmd_ld_ko_o = $(LD) -r $(LDFLAGS) $(LDFLAGS_MODULE_PREREQ)	\
+			  $(LDFLAGS_MODULE) -o $@			\
 			  $(filter-out FORCE,$^)
 
 $(modules): %.ko :%.o %.mod.o FORCE

             reply	other threads:[~2009-09-24 11:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-24 11:28 Yuri Frolov [this message]
2009-09-24 11:28 ` [patch] powerpc: build modules outside the kernel tree fails, if it was built using O= Yuri Frolov
2009-09-25  1:12 ` Benjamin Herrenschmidt
2009-09-25  1:12   ` Benjamin Herrenschmidt
2009-09-25  4:39   ` Sam Ravnborg
2009-09-25  4:39     ` Sam Ravnborg
2009-09-25  9:39     ` Yuri Frolov
2009-09-25  9:39       ` Yuri Frolov
2009-09-25 19:45 ` Sam Ravnborg
2009-09-25 19:45   ` Sam Ravnborg
2009-09-25 21:57   ` Benjamin Herrenschmidt
2009-09-25 21:57     ` Benjamin Herrenschmidt
2009-09-25 22:01     ` Sam Ravnborg
2009-09-25 22:01       ` Sam Ravnborg
2009-09-26 12:45   ` Yuri Frolov
2009-09-26 12:45     ` Yuri Frolov
2009-09-30 13:50     ` Yuri Frolov
2009-09-30 13:50       ` Yuri Frolov

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=4ABB57CB.3000409@ru.mvista.com \
    --to=yfrolov@ru.mvista.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=rep.dot.nop@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.