qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] rules.mak: Force CFLAGS for all objects in DSO
@ 2015-05-06 13:46 Fam Zheng
  2015-05-06 14:07 ` Paolo Bonzini
  2015-05-06 23:25 ` Alexander Graf
  0 siblings, 2 replies; 7+ messages in thread
From: Fam Zheng @ 2015-05-06 13:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Fam Zheng, Stefan Weil, Michael Tokarev, agraf,
	Paolo Bonzini

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)
              $(eval modules: $($v:%.mo=%$(DSOSUF))),
              $(eval $(patsubst %-m,%-y,$v) += $(call expand-objs, $($v)))))
 
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-05-06 23:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).