From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53806) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yq0EO-0006d3-II for qemu-devel@nongnu.org; Wed, 06 May 2015 10:23:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yq0EI-0001D9-PO for qemu-devel@nongnu.org; Wed, 06 May 2015 10:23:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46346) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yq0EI-0001D4-Kp for qemu-devel@nongnu.org; Wed, 06 May 2015 10:23:18 -0400 Date: Wed, 6 May 2015 22:23:15 +0800 From: Fam Zheng Message-ID: <20150506142315.GA1535@ad.nay.redhat.com> References: <1430920000-31229-1-git-send-email-famz@redhat.com> <554A2012.2080109@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <554A2012.2080109@redhat.com> Subject: Re: [Qemu-devel] [PATCH] rules.mak: Force CFLAGS for all objects in DSO List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Peter Maydell , agraf@suse.de, Michael Tokarev , qemu-devel@nongnu.org, Stefan Weil On Wed, 05/06 16:07, Paolo Bonzini wrote: > > > On 06/05/2015 15:46, Fam Zheng wrote: > > Because of the trick of process-archive-undefs, all .mo objects, even > > with --enable-modules, are dependencies of executables. > > > > This breaks CFLAGS propogation because the compiling of module object > > will happen too early before building for DSO. > > > > With GCC 5, the linking would fail because .o doesn't have -fPIC. Also, > > BUILD_DSO will be missed. (module-common.o will have it, so the stamp > > symbol was still liked in .so). > > > > Fix the problem by forcing the CFLAGS during unnest-vars. > > > > Reported-by: Alexander Graf > > Signed-off-by: Fam Zheng > > --- > > rules.mak | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/rules.mak b/rules.mak > > index 3a05627..6c0caf3 100644 > > --- a/rules.mak > > +++ b/rules.mak > > @@ -102,7 +102,6 @@ endif > > %.o: %.dtrace > > $(call quiet-command,dtrace -o $@ -G -s $<, " GEN $(TARGET_DIR)$@") > > > > -%$(DSOSUF): CFLAGS += -fPIC -DBUILD_DSO > > %$(DSOSUF): LDFLAGS += $(LDFLAGS_SHARED) > > %$(DSOSUF): %.mo > > $(call LINK,$^) > > @@ -353,6 +352,7 @@ define unnest-vars > > $(foreach o,$($v), > > $(eval $o: $($o-objs))) > > $(eval $(patsubst %-m,%-y,$v) += $($v)) > > + $(eval $($v:%.mo=%$(DSOSUF)) $($v) $(foreach o,$($v),$($o-objs)) .PHONY: CFLAGS += -fPIC -DBUILD_DSO) ^ ^ ^ ^ | | | | | | | `- In case all others are empty. | | | | | `- Expansion of all %.mo-objs so it's a %.o list. | | For $v=block-obj-m, this will contain curl.o, iscsi.o, ... | | | `- %.mo list | For $v=block-obj-m, this will contain curl.mo, iscsi.mo, ... | `- %.so list For $v=block-obj-m, this will contain curl.so, iscsi.so, ... > > Can you explain the various parts to the left of the colon? Context: - The line is inside "$(if $(CONFIG_MODULES),...)" - $v is one of "block-job-m common-obj-m ..." - So, $($v) is the module object list "foo.mo bar.mo ..." Do you want a respin to include the ascii art? :) Fam