* [Qemu-devel] [PATCH v2] Makefile: poison TARGET_xxx for compile once.
@ 2010-06-25 3:02 Isaku Yamahata
2010-06-25 8:01 ` [Qemu-devel] " Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Isaku Yamahata @ 2010-06-25 3:02 UTC (permalink / raw)
To: qemu-devel; +Cc: amit.shah, pbonzini, blauwirbel, rth
poison TARGET_xxx for compile once object
to prevent those ifdef from creeping in again.
didn't poison env which is used as function argument as void *env.
Although it would be possible to sort it out, for now just not poison it.
qemu-malloc.c didn't compile, so I make it non compile-once for now.
It is linked via block-obj-y in Makefile.obj and common-obj-y in
Makefile.objs through block-obj-y. So qemu-malloc.o is explicitly
added to rules.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
Changes v1 -> v2:
- tried to poison not only TARGET_<ARCH> but also TARGET_xxx.
- fix link breakage.
---
Makefile | 10 +++++-----
Makefile.objs | 11 ++++++++++-
Makefile.target | 2 +-
poison.h | 2 ++
4 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
index 221fbd8..233b2b1 100644
--- a/Makefile
+++ b/Makefile
@@ -79,8 +79,8 @@ ifneq ($(wildcard config-host.mak),)
include $(SRC_PATH)/Makefile.objs
endif
-$(common-obj-y): $(GENERATED_HEADERS)
-$(filter %-softmmu,$(SUBDIR_RULES)): $(common-obj-y) subdir-libdis
+$(common-obj-y) qemu-malloc.o: $(GENERATED_HEADERS)
+$(filter %-softmmu,$(SUBDIR_RULES)): $(common-obj-y) qemu-malloc.o subdir-libdis
$(filter %-user,$(SUBDIR_RULES)): $(GENERATED_HEADERS) subdir-libdis-user subdir-libuser
@@ -137,11 +137,11 @@ iov.o: iov.c iov.h
qemu-img.o: qemu-img-cmds.h
qemu-img.o qemu-tool.o qemu-nbd.o qemu-io.o: $(GENERATED_HEADERS)
-qemu-img$(EXESUF): qemu-img.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y)
+qemu-img$(EXESUF): qemu-img.o qemu-tool.o qemu-error.o qemu-malloc.o $(block-obj-y) $(qobject-obj-y)
-qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y)
+qemu-nbd$(EXESUF): qemu-nbd.o qemu-tool.o qemu-error.o qemu-malloc.o $(block-obj-y) $(qobject-obj-y)
-qemu-io$(EXESUF): qemu-io.o cmd.o qemu-tool.o qemu-error.o $(block-obj-y) $(qobject-obj-y)
+qemu-io$(EXESUF): qemu-io.o cmd.o qemu-tool.o qemu-error.o qemu-malloc.o $(block-obj-y) $(qobject-obj-y)
qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
$(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@," GEN $@")
diff --git a/Makefile.objs b/Makefile.objs
index 53fb68e..15764c4 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -7,7 +7,7 @@ qobject-obj-y += qerror.o
#######################################################################
# block-obj-y is code used by both qemu system emulation and qemu-img
-block-obj-y = cutils.o cache-utils.o qemu-malloc.o qemu-option.o module.o
+block-obj-y = cutils.o cache-utils.o qemu-option.o module.o
block-obj-y += nbd.o block.o aio.o aes.o osdep.o qemu-config.o
block-obj-$(CONFIG_POSIX) += posix-aio-compat.o
block-obj-$(CONFIG_LINUX_AIO) += linux-aio.o
@@ -265,3 +265,12 @@ os-win32.o: qemu-options.def
qemu-options.def: $(SRC_PATH)/qemu-options.hx
$(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@")
+
+######################################################################
+# poison TARGET_arch to prevent from creeping those defines again.
+
+POISON_CFLAGS = -include poison.h -DDONT_POISON_ENV
+$(qobject-obj-y) $(block-obj-y) $(block-nested-y) $(block-obj-y) \
+$(net-obj-y) $(net-nested-y) $(fsdev-nested-y) $(fsdev-obj-y) \
+$(common-obj-y) $(audio-obj-y) $(slirp-obj-y) $(user-obj-y) \
+$(hw-obj-y) $(sound-obj-y) $(libdis-y) vl.o: QEMU_CFLAGS += $(POISON_CFLAGS)
diff --git a/Makefile.target b/Makefile.target
index f64702b..91160b6 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -295,7 +295,7 @@ monitor.o: qemu-monitor.h
$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS)
-obj-y += $(addprefix ../, $(common-obj-y))
+obj-y += $(addprefix ../, $(common-obj-y) qemu-malloc.o)
obj-y += $(addprefix ../libdis/, $(libdis-y))
obj-y += $(libobj-y)
obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y))
diff --git a/poison.h b/poison.h
index d7db7f4..43af79a 100644
--- a/poison.h
+++ b/poison.h
@@ -34,7 +34,9 @@
#pragma GCC poison TARGET_PAGE_ALIGN
#pragma GCC poison CPUState
+#ifndef DONT_POISON_ENV
#pragma GCC poison env
+#endif
#pragma GCC poison CPU_INTERRUPT_HARD
#pragma GCC poison CPU_INTERRUPT_EXITTB
--
1.6.6.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Qemu-devel] Re: [PATCH v2] Makefile: poison TARGET_xxx for compile once.
2010-06-25 3:02 [Qemu-devel] [PATCH v2] Makefile: poison TARGET_xxx for compile once Isaku Yamahata
@ 2010-06-25 8:01 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2010-06-25 8:01 UTC (permalink / raw)
To: Isaku Yamahata; +Cc: amit.shah, blauwirbel, qemu-devel, rth
On 06/25/2010 05:02 AM, Isaku Yamahata wrote:
> poison TARGET_xxx for compile once object
> to prevent those ifdef from creeping in again.
>
> didn't poison env which is used as function argument as void *env.
> Although it would be possible to sort it out, for now just not poison it.
>
> qemu-malloc.c didn't compile, so I make it non compile-once for now.
> It is linked via block-obj-y in Makefile.obj and common-obj-y in
> Makefile.objs through block-obj-y. So qemu-malloc.o is explicitly
> added to rules.
I'm still skeptical, not about the goal but about the means.
I'm going to push again for my patch to make CPUState opaque for
non-per-target files.
I haven't heard good reasons against it. The main objection was that hw
files would have no reason for accessing CPUState. But this makes no
sense if CPUState is opaque, and on the other hand we have now a
proliferation of void* arguments and fields (e.g. in qemu_cpu_kick).
Which I am taught is a very bad thing.
If that patch was accepted, we'd just need this to implement your proposal:
diff --git a/cpu-common.h b/cpu-common.h
index f325e60..78f8b12 100644
--- a/cpu-common.h
+++ b/cpu-common.h
@@ -11,10 +11,6 @@
#include "targphys.h"
#endif
-#ifndef NEED_CPU_H
-#include "poison.h"
-#endif
-
#include "bswap.h"
#include "qemu-queue.h"
diff --git a/qemu-common.h b/qemu-common.h
index 3fb2f0b..3f92d40 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -90,15 +90,12 @@ static inline char *realpath(const char *path, char
*resolved_path)
/* FIXME: Remove NEED_CPU_H. */
#ifndef NEED_CPU_H
-
#include <setjmp.h>
#include "osdep.h"
#include "bswap.h"
-
+#include "poison.h"
#else
-
#include "cpu.h"
-
#endif /* !defined(NEED_CPU_H) */
/* bottom halves */
I'll put this together in a complete patch series and post.
Paolo
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-06-25 17:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-25 3:02 [Qemu-devel] [PATCH v2] Makefile: poison TARGET_xxx for compile once Isaku Yamahata
2010-06-25 8:01 ` [Qemu-devel] " Paolo Bonzini
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).