qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Brian Jackson" <iggy@theiggy.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Michael Tokarev" <mjt@tls.msk.ru>,
	"Andreas Färber" <andreas.faerber@web.de>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Bharata B Rao" <bharata.rao@gmail.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Richard Henderson" <rth@twiddle.net>
Subject: [Qemu-devel] [PATCH 1/3] rules.mak: Fix module build
Date: Mon, 12 Jan 2015 12:43:09 +0800	[thread overview]
Message-ID: <1421037791-32021-2-git-send-email-famz@redhat.com> (raw)
In-Reply-To: <1421037791-32021-1-git-send-email-famz@redhat.com>

Module build is broken since commit c261d774fb ( rules.mak: Fix DSO
build by pulling in archive symbols). That commit added .mo placeholders
of DSO to -y variables, in order to pull stub symbols to executable. But
the placeholders are unintentionally expanded in -y, rather than
filtered out while linking.

Fix it by moving the -objs expanding to before inserting .mo
placeholders.  Note that passing -cflags and -libs to member objects are
also moved to keep it happening before object expanding.

Reported-by: Bharata B Rao <bharata.rao@gmail.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
---
 rules.mak | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/rules.mak b/rules.mak
index f500fef..3a05627 100644
--- a/rules.mak
+++ b/rules.mak
@@ -326,7 +326,17 @@ define unnest-vars
     $(if $1,$(call fix-paths,$1/,,$2))
 
     # Descend and include every subdir Makefile.objs
-    $(foreach v, $2, $(call unnest-var-recursive,$1,$2,$v))
+    $(foreach v, $2,
+        $(call unnest-var-recursive,$1,$2,$v)
+        # Pass the .mo-cflags and .mo-libs along to its member objects
+        $(foreach o, $(filter %.mo,$($v)),
+            $(foreach p,$($o-objs),
+                $(if $($o-cflags), $(eval $p-cflags += $($o-cflags)))
+                $(if $($o-libs), $(eval $p-libs += $($o-libs))))))
+
+    # For all %.mo objects that are directly added into -y, just expand them
+    $(foreach v,$(filter %-y,$2),
+        $(eval $v := $(foreach o,$($v),$(if $($o-objs),$($o-objs),$o))))
 
     $(foreach v,$(filter %-m,$2),
         # All .o found in *-m variables are single object modules, create .mo
@@ -353,18 +363,9 @@ define unnest-vars
             # according to .mo-objs. Report error if not set
             $(if $($o-objs),
                 $(eval $(o:%.mo=%$(DSOSUF)): module-common.o $($o-objs)),
-                $(error $o added in $v but $o-objs is not set))
-            # Pass the .mo-cflags and .mo-libs along to member objects
-            $(foreach p,$($o-objs),
-                $(if $($o-cflags), $(eval $p-cflags += $($o-cflags)))
-                $(if $($o-libs), $(eval $p-libs += $($o-libs)))))
+                $(error $o added in $v but $o-objs is not set)))
         $(shell mkdir -p ./ $(sort $(dir $($v))))
         # Include all the .d files
         $(eval -include $(addsuffix *.d, $(sort $(dir $($v)))))
         $(eval $v := $(filter-out %/,$($v))))
-
-    # For all %.mo objects that are directly added into -y, expand them to %.mo-objs
-    $(foreach v,$2,
-        $(eval $v := $(foreach o,$($v),$(if $($o-objs),$($o-objs),$o))))
-
 endef
-- 
2.1.0

  reply	other threads:[~2015-01-12  4:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-12  4:43 [Qemu-devel] [PATCH 0/3] buildsys: Fix and enable module build Fam Zheng
2015-01-12  4:43 ` Fam Zheng [this message]
2015-01-12  4:43 ` [Qemu-devel] [PATCH 2/3] configure: Default to " Fam Zheng
2015-01-12 10:26   ` Andreas Färber
2015-01-13  8:49     ` Fam Zheng
2015-01-12  4:43 ` [Qemu-devel] [PATCH 3/3] .travis.yml: Add "--disable-modules" Fam Zheng
2015-01-12  6:04 ` [Qemu-devel] [PATCH 0/3] buildsys: Fix and enable module build Bharata B Rao
2015-01-12 10:30 ` Paolo Bonzini

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=1421037791-32021-2-git-send-email-famz@redhat.com \
    --to=famz@redhat.com \
    --cc=andreas.faerber@web.de \
    --cc=bharata.rao@gmail.com \
    --cc=iggy@theiggy.com \
    --cc=mjt@tls.msk.ru \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=stefanha@redhat.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 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).