提交 d24697e1 编写于 作者: F Fam Zheng 提交者: Paolo Bonzini

rules.mak: Force CFLAGS for all objects in DSO

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 on individual .o-cflags during
unnest-vars.
Reported-by: NAlexander Graf <agraf@suse.de>
Signed-off-by: NFam Zheng <famz@redhat.com>
Cc: qemu-stable@nongnu.org # 2.3
Message-Id: <1430981715-31465-1-git-send-email-famz@redhat.com>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 768b7855
...@@ -102,7 +102,8 @@ endif ...@@ -102,7 +102,8 @@ endif
%.o: %.dtrace %.o: %.dtrace
$(call quiet-command,dtrace -o $@ -G -s $<, " GEN $(TARGET_DIR)$@") $(call quiet-command,dtrace -o $@ -G -s $<, " GEN $(TARGET_DIR)$@")
%$(DSOSUF): CFLAGS += -fPIC -DBUILD_DSO DSO_OBJ_CFLAGS := -fPIC -DBUILD_DSO
module-common.o: CFLAGS += $(DSO_OBJ_CFLAGS)
%$(DSOSUF): LDFLAGS += $(LDFLAGS_SHARED) %$(DSOSUF): LDFLAGS += $(LDFLAGS_SHARED)
%$(DSOSUF): %.mo %$(DSOSUF): %.mo
$(call LINK,$^) $(call LINK,$^)
...@@ -351,6 +352,7 @@ define unnest-vars ...@@ -351,6 +352,7 @@ define unnest-vars
# For non-module build, add -m to -y # For non-module build, add -m to -y
$(if $(CONFIG_MODULES), $(if $(CONFIG_MODULES),
$(foreach o,$($v), $(foreach o,$($v),
$(eval $($o-objs): CFLAGS += $(DSO_OBJ_CFLAGS))
$(eval $o: $($o-objs))) $(eval $o: $($o-objs)))
$(eval $(patsubst %-m,%-y,$v) += $($v)) $(eval $(patsubst %-m,%-y,$v) += $($v))
$(eval modules: $($v:%.mo=%$(DSOSUF))), $(eval modules: $($v:%.mo=%$(DSOSUF))),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册