qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	agraf@suse.de, Michael Tokarev <mjt@tls.msk.ru>,
	qemu-devel@nongnu.org, Stefan Weil <sw@weilnetz.de>
Subject: Re: [Qemu-devel] [PATCH] rules.mak: Force CFLAGS for all objects in DSO
Date: Wed, 6 May 2015 22:23:15 +0800	[thread overview]
Message-ID: <20150506142315.GA1535@ad.nay.redhat.com> (raw)
In-Reply-To: <554A2012.2080109@redhat.com>

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 <agraf@suse.de>
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> > ---
> >  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

  reply	other threads:[~2015-05-06 14:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-06 13:46 [Qemu-devel] [PATCH] rules.mak: Force CFLAGS for all objects in DSO Fam Zheng
2015-05-06 14:07 ` Paolo Bonzini
2015-05-06 14:23   ` Fam Zheng [this message]
2015-05-06 14:36     ` Paolo Bonzini
2015-05-06 15:01       ` Fam Zheng
2015-05-06 15:03         ` Paolo Bonzini
2015-05-06 23:25 ` Alexander Graf

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=20150506142315.GA1535@ad.nay.redhat.com \
    --to=famz@redhat.com \
    --cc=agraf@suse.de \
    --cc=mjt@tls.msk.ru \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sw@weilnetz.de \
    /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).