Makefile: poison TARGET_xxx for compile once.
PATCH v2 1/1 Makefile: poison TARGET_xxx for compile once.
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.
---
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(-)
Makefile +5 -5
@@ -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 $@")
Makefile.objs +10 -1
@@ -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)
Makefile.target +1 -1
@@ -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))
poison.h +2 -0
@@ -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
Signature · 1 line
1.6.6.1
Quoted 10 lines · Isaku Yamahata
poison
TARGET_xxxfor 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.cdidn'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:
cpu-common.h +0 -4
@@ -11,10 +11,6 @@#include "targphys.h" #endif -#ifndef NEED_CPU_H -#include "poison.h" -#endif -#include "bswap.h" #include "qemu-queue.h"
qemu-common.h +1 -4
@@ -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