Skip to contentSkip to conversation

Simplify Makefile.objs some more

PATCH In review Paolo Bonzini 2 participants 14 messages Jan 19, 2013 – Jan 20, 2013 Kbuild

lore
Share & tools
lore
#0 lore raw

cover Simplify Makefile.objs some more

This small series makes some more simplifications to Makefile.objs, removing two more variables: universal-obj-y and extra-obj-y, all unified into common-obj-y. It also removes what remains of user-obj-y, unifying that into common-obj-y as well.

To achieve this, the CONFIG_SOFTMMU and CONFIG_USER_ONLY symbols are defined in the toplevel Makefile like we do with devices and disassemblers. Another symbol, CONFIG_ALL, is defined only in the toplevel Makefile and takes the place of extra-obj-y.

With this change the structure of Makefile.objs is finally reduced to only six recursive variables (stub-obj-y, util-obj-y, qga-obj-y, block-obj-y, common-obj-y, obj-y). More important, the simpler structure should help people modifying the build system, avoiding future proliferation of variables as well.

The patches are mostly mechanical substitutions, and there is no user-visible change---neither in total build time, nor in the files that are linked into the executables.

Please apply, thanks!

Paolo

Paolo Bonzini (4):
build: move around libcacard-y definition
build: use -$(CONFIG_SECCOMP) instead of ifeq
build: remove universal-obj-y
build: remove extra-obj-y

 Makefile             |    9 ++++-----
 Makefile.objs        |   43 ++++++++++++++++++-------------------------
 Makefile.target      |    3 +--
 disas/Makefile.objs  |   30 +++++++++++++++---------------
 fsdev/Makefile.objs  |    8 ++++----
 hw/Makefile.objs     |   10 +++++-----
 hw/pci/Makefile.objs |    2 +-
 qom/Makefile.objs    |    4 ++--
 8 files changed, 50 insertions(+), 59 deletions(-)
#1 lore raw

PATCH 1/4 build: move around libcacard-y definition

It is also needed if !CONFIG_SOFTMMU, unlike everything that surrounds it.

---
 Makefile.objs |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
Makefile.objs +9 -9
index d465a72..3548f9b 100644
@@ -34,6 +34,15 @@ CONFIG_REALLY_VIRTFS=y
 endif
 
 ######################################################################
+# smartcard
+
+libcacard-y += libcacard/cac.o libcacard/event.o
+libcacard-y += libcacard/vcard.o libcacard/vreader.o
+libcacard-y += libcacard/vcard_emul_nss.o
+libcacard-y += libcacard/vcard_emul_type.o
+libcacard-y += libcacard/card_7816.o
+
+######################################################################
 # Target independent part of system emulation. The long term path is to
 # suppress *all* target specific code in case of system emulation, i.e. a
 # single QEMU executable should support all CPUs and machines.
@@ -77,15 +86,6 @@ ifeq ($(CONFIG_SECCOMP),y)
 common-obj-y += qemu-seccomp.o
 endif
 
-######################################################################
-# smartcard
-
-libcacard-y += libcacard/cac.o libcacard/event.o
-libcacard-y += libcacard/vcard.o libcacard/vreader.o
-libcacard-y += libcacard/vcard_emul_nss.o
-libcacard-y += libcacard/vcard_emul_type.o
-libcacard-y += libcacard/card_7816.o
-
 common-obj-$(CONFIG_SMARTCARD_NSS) += $(libcacard-y)
 
 ######################################################################
Signature · 1 line
1.7.1
#2 lore raw

Re: [Qemu-devel] [PATCH 1/4] build: move around libcacard-y definition

Am 19.01.2013 11:06, schrieb Paolo Bonzini:

Quoted 1 line

It is also needed if !CONFIG_SOFTMMU, unlike everything that surrounds it.

Why? linux-user should not depend on it - bad wording only?

Andreas

Quoted 42 lines
---
 Makefile.objs |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
Makefile.objs +9 -9
index d465a72..3548f9b 100644
@@ -34,6 +34,15 @@ CONFIG_REALLY_VIRTFS=y
 endif
 
 ######################################################################
+# smartcard
+
+libcacard-y += libcacard/cac.o libcacard/event.o
+libcacard-y += libcacard/vcard.o libcacard/vreader.o
+libcacard-y += libcacard/vcard_emul_nss.o
+libcacard-y += libcacard/vcard_emul_type.o
+libcacard-y += libcacard/card_7816.o
+
+######################################################################
 # Target independent part of system emulation. The long term path is to
 # suppress *all* target specific code in case of system emulation, i.e. a
 # single QEMU executable should support all CPUs and machines.
@@ -77,15 +86,6 @@ ifeq ($(CONFIG_SECCOMP),y)
 common-obj-y += qemu-seccomp.o
 endif
 
-######################################################################
-# smartcard
-
-libcacard-y += libcacard/cac.o libcacard/event.o
-libcacard-y += libcacard/vcard.o libcacard/vreader.o
-libcacard-y += libcacard/vcard_emul_nss.o
-libcacard-y += libcacard/vcard_emul_type.o
-libcacard-y += libcacard/card_7816.o
-
 common-obj-$(CONFIG_SMARTCARD_NSS) += $(libcacard-y)
 
 ######################################################################
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#3 lore raw

Re: [Qemu-devel] [PATCH 1/4] build: move around libcacard-y definition

Il 19/01/2013 19:05, Andreas Färber ha scritto:

Quoted 3 lines

Am 19.01.2013 11:06, schrieb Paolo Bonzini:

Quoted 1 line
Quoted 1 line

It is also needed if !CONFIG_SOFTMMU, unlike everything that surrounds it.

Why? linux-user should not depend on it - bad wording only?

It is needed by libcacard/Makefile. You can build it even if you do not configure any softmmu target.

Paolo

#4 lore raw

Re: [Qemu-devel] [PATCH 1/4] build: move around libcacard-y definition

Am 19.01.2013 23:01, schrieb Paolo Bonzini:

Quoted 7 lines

Il 19/01/2013 19:05, Andreas Färber ha scritto:

Quoted 3 lines

Am 19.01.2013 11:06, schrieb Paolo Bonzini:

Quoted 1 line
Quoted 1 line

It is also needed if !CONFIG_SOFTMMU, unlike everything that surrounds it.

Why? linux-user should not depend on it - bad wording only?

It is needed by libcacard/Makefile. You can build it even if you do not configure any softmmu target.

Suggest wording: "It is also valid to build libcacard if !CONFIG_SOFTMMU, unlike everything that surrounds it." or so (avoids "also *needed* if !CONFIG_SOFTMMU" which wrongly suggested to me !CONFIG_SOFTMMU == CONFIG_USER_ONLY)

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#5 lore raw

PATCH 2/4 build: use -$(CONFIG_SECCOMP) instead of ifeq

In reply to Paolo Bonzini
---
 Makefile.objs |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
Makefile.objs +1 -5
index 3548f9b..3bdb248 100644
@@ -80,11 +80,7 @@ common-obj-$(CONFIG_SLIRP) += slirp/
 
 common-obj-y += backends/
 
-######################################################################
-# libseccomp
-ifeq ($(CONFIG_SECCOMP),y)
-common-obj-y += qemu-seccomp.o
-endif
+common-obj-$(CONFIG_SECCOMP) += qemu-seccomp.o
 
 common-obj-$(CONFIG_SMARTCARD_NSS) += $(libcacard-y)
 
Signature · 1 line
1.7.1
#7 lore raw

PATCH 3/4 build: remove universal-obj-y

In reply to Paolo Bonzini

All of universal-obj-y, user-obj-y (right now unused) and common-obj-y can be unified into common-obj-y if we take care of defining CONFIG_SOFTMMU and CONFIG_USER_ONLY in the toplevel makefile. This is similar to how we define symbols for hardware components.

---
 Makefile            |    8 +++-----
 Makefile.objs       |   14 +++++++-------
 Makefile.target     |    3 +--
 disas/Makefile.objs |   30 +++++++++++++++---------------
 hw/Makefile.objs    |    8 +++++---
 qom/Makefile.objs   |    4 ++--
 6 files changed, 33 insertions(+), 34 deletions(-)
Makefile +3 -5
index 73adf42..55b5d36 100644
@@ -103,6 +103,8 @@ defconfig:
 
 -include config-all-devices.mak
 -include config-all-disas.mak
+CONFIG_SOFTMMU := $(if $(filter %-softmmu,$(TARGET_DIRS)),y)
+CONFIG_USER_ONLY := $(if $(filter %-user,$(TARGET_DIRS)),y)
 
 ifneq ($(wildcard config-host.mak),)
 include $(SRC_PATH)/Makefile.objs
@@ -133,11 +135,7 @@ pixman/Makefile: $(SRC_PATH)/pixman/configure
 $(SRC_PATH)/pixman/configure:
 	(cd $(SRC_PATH)/pixman; autoreconf -v --install)
 
-$(SUBDIR_RULES): libqemuutil.a libqemustub.a
-
-$(filter %-softmmu,$(SUBDIR_RULES)): $(universal-obj-y) $(common-obj-y) $(extra-obj-y)
-
-$(filter %-user,$(SUBDIR_RULES)): $(universal-obj-y) $(user-obj-y)
+$(SUBDIR_RULES): libqemuutil.a libqemustub.a $(common-obj-y) $(extra-obj-y)
 
 ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
 romsubdir-%:
Makefile.objs +7 -7
index 3bdb248..63ddaaf 100644
@@ -47,6 +47,7 @@ libcacard-y += libcacard/card_7816.o
 # suppress *all* target specific code in case of system emulation, i.e. a
 # single QEMU executable should support all CPUs and machines.
 
+ifeq ($(CONFIG_SOFTMMU),y)
 common-obj-y = $(block-obj-y) blockdev.o blockdev-nbd.o block/
 common-obj-y += net/
 common-obj-y += readline.o
@@ -89,15 +90,15 @@ common-obj-$(CONFIG_SMARTCARD_NSS) += $(libcacard-y)
 
 common-obj-y += qmp-marshal.o qapi-visit.o qapi-types.o
 common-obj-y += qmp.o hmp.o
+endif
 
 #######################################################################
 # Target-independent parts used in system and user emulation
-universal-obj-y =
-universal-obj-y += qemu-log.o
-universal-obj-y += tcg-runtime.o
-universal-obj-y += hw/
-universal-obj-y += qom/
-universal-obj-y += disas/
+common-obj-y += qemu-log.o
+common-obj-y += tcg-runtime.o
+common-obj-y += hw/
+common-obj-y += qom/
+common-obj-y += disas/
 
 ######################################################################
 # guest agent
@@ -118,6 +119,5 @@ nested-vars += \
 	qga-obj-y \
 	block-obj-y \
 	common-obj-y \
-	universal-obj-y \
 	extra-obj-y
 dummy := $(call unnest-vars)
Makefile.target +1 -2
index eb84b1f..760da1e 100644
@@ -145,8 +145,7 @@ nested-vars += obj-y
 include $(SRC_PATH)/Makefile.objs
 
 all-obj-y = $(obj-y)
-all-obj-y += $(addprefix ../, $(universal-obj-y))
-all-obj-$(CONFIG_SOFTMMU) += $(addprefix ../, $(common-obj-y))
+all-obj-y += $(addprefix ../, $(common-obj-y))
 
 ifdef QEMU_PROGW
 # The linker builds a windows executable. Make also a console executable.
disas/Makefile.objs +15 -15
index 3f5c5b9..ed75f9a 100644
@@ -1,18 +1,18 @@
-universal-obj-$(CONFIG_ALPHA_DIS) += alpha.o
-universal-obj-$(CONFIG_ARM_DIS) += arm.o
-universal-obj-$(CONFIG_CRIS_DIS) += cris.o
-universal-obj-$(CONFIG_HPPA_DIS) += hppa.o
-universal-obj-$(CONFIG_I386_DIS) += i386.o
-universal-obj-$(CONFIG_IA64_DIS) += ia64.o
-universal-obj-$(CONFIG_M68K_DIS) += m68k.o
-universal-obj-$(CONFIG_MICROBLAZE_DIS) += microblaze.o
-universal-obj-$(CONFIG_MIPS_DIS) += mips.o
-universal-obj-$(CONFIG_PPC_DIS) += ppc.o
-universal-obj-$(CONFIG_S390_DIS) += s390.o
-universal-obj-$(CONFIG_SH4_DIS) += sh4.o
-universal-obj-$(CONFIG_SPARC_DIS) += sparc.o
-universal-obj-$(CONFIG_LM32_DIS) += lm32.o
+common-obj-$(CONFIG_ALPHA_DIS) += alpha.o
+common-obj-$(CONFIG_ARM_DIS) += arm.o
+common-obj-$(CONFIG_CRIS_DIS) += cris.o
+common-obj-$(CONFIG_HPPA_DIS) += hppa.o
+common-obj-$(CONFIG_I386_DIS) += i386.o
+common-obj-$(CONFIG_IA64_DIS) += ia64.o
+common-obj-$(CONFIG_M68K_DIS) += m68k.o
+common-obj-$(CONFIG_MICROBLAZE_DIS) += microblaze.o
+common-obj-$(CONFIG_MIPS_DIS) += mips.o
+common-obj-$(CONFIG_PPC_DIS) += ppc.o
+common-obj-$(CONFIG_S390_DIS) += s390.o
+common-obj-$(CONFIG_SH4_DIS) += sh4.o
+common-obj-$(CONFIG_SPARC_DIS) += sparc.o
+common-obj-$(CONFIG_LM32_DIS) += lm32.o
 
 # TODO: As long as the TCG interpreter and its generated code depend
 # on the QEMU target, we cannot compile the disassembler here.
-#universal-obj-$(CONFIG_TCI_DIS) += tci.o
+#common-obj-$(CONFIG_TCI_DIS) += tci.o
hw/Makefile.objs +5 -3
index 74b07a7..0e245c8 100644
@@ -1,9 +1,10 @@
 # core qdev-related obj files, also used by *-user:
-universal-obj-y += qdev.o qdev-properties.o
+common-obj-y += qdev.o qdev-properties.o
 # irq.o needed for qdev GPIO handling:
-universal-obj-y += irq.o
+common-obj-y += irq.o
 
-common-obj-y = usb/ ide/ pci/
+ifeq ($(CONFIG_SOFTMMU),y)
+common-obj-y += usb/ ide/ pci/
 common-obj-y += loader.o
 common-obj-$(CONFIG_VIRTIO) += virtio-console.o
 common-obj-$(CONFIG_VIRTIO) += virtio-rng.o
@@ -216,3 +217,4 @@ obj-$(CONFIG_LINUX) += vfio_pci.o
 endif
 
 $(obj)/baum.o: QEMU_CFLAGS += $(SDL_CFLAGS) 
+endif
qom/Makefile.objs +2 -2
index 1899a4c..6a93ac7 100644
@@ -1,2 +1,2 @@
-universal-obj-y = object.o container.o qom-qobject.o
-universal-obj-y += cpu.o
+common-obj-y = object.o container.o qom-qobject.o
+common-obj-y += cpu.o
Signature · 1 line
1.7.1
#8 lore raw

PATCH 4/4 build: remove extra-obj-y

In reply to Paolo Bonzini

extra-obj-y is somewhat complicated to understand. Replace it with a special CONFIG_ALL symbol that is defined only at toplevel. This limits the case of directories defining more than one *-obj-y target.

---
 Makefile             |    3 ++-
 Makefile.objs        |    5 +----
 fsdev/Makefile.objs  |    8 ++++----
 hw/Makefile.objs     |    2 --
 hw/pci/Makefile.objs |    2 +-
 5 files changed, 8 insertions(+), 12 deletions(-)
Makefile +2 -1
index 55b5d36..bd885ca 100644
@@ -105,6 +105,7 @@ defconfig:
 -include config-all-disas.mak
 CONFIG_SOFTMMU := $(if $(filter %-softmmu,$(TARGET_DIRS)),y)
 CONFIG_USER_ONLY := $(if $(filter %-user,$(TARGET_DIRS)),y)
+CONFIG_ALL=y
 
 ifneq ($(wildcard config-host.mak),)
 include $(SRC_PATH)/Makefile.objs
@@ -135,7 +136,7 @@ pixman/Makefile: $(SRC_PATH)/pixman/configure
 $(SRC_PATH)/pixman/configure:
 	(cd $(SRC_PATH)/pixman; autoreconf -v --install)
 
-$(SUBDIR_RULES): libqemuutil.a libqemustub.a $(common-obj-y) $(extra-obj-y)
+$(SUBDIR_RULES): libqemuutil.a libqemustub.a $(common-obj-y)
 
 ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
 romsubdir-%:
Makefile.objs +1 -4
index 63ddaaf..68eb0ce 100644
@@ -55,7 +55,6 @@ common-obj-$(CONFIG_WIN32) += os-win32.o
 common-obj-$(CONFIG_POSIX) += os-posix.o
 
 common-obj-$(CONFIG_LINUX) += fsdev/
-extra-obj-$(CONFIG_LINUX) += fsdev/
 
 common-obj-y += migration.o migration-tcp.o
 common-obj-y += qemu-char.o #aio.o
@@ -68,7 +67,6 @@ common-obj-$(CONFIG_SPICE) += spice-qemu-char.o
 
 common-obj-y += audio/
 common-obj-y += hw/
-extra-obj-y += hw/
 
 common-obj-y += ui/
 common-obj-y += bt-host.o bt-vhci.o
@@ -118,6 +116,5 @@ nested-vars += \
 	util-obj-y \
 	qga-obj-y \
 	block-obj-y \
-	common-obj-y \
-	extra-obj-y
+	common-obj-y
 dummy := $(call unnest-vars)
fsdev/Makefile.objs +4 -4
index ee16ca6..206289c 100644
@@ -1,10 +1,10 @@
 ifeq ($(CONFIG_REALLY_VIRTFS),y)
 common-obj-y = qemu-fsdev.o virtio-9p-marshal.o
-
-# Toplevel always builds this; targets without virtio will put it in
-# common-obj-y
-extra-obj-y = qemu-fsdev-dummy.o
 else
 common-obj-y = qemu-fsdev-dummy.o
 endif
 common-obj-y += qemu-fsdev-opts.o
+
+# Toplevel always builds this; targets without virtio will put it in
+# common-obj-y
+common-obj-$(CONFIG_ALL) += qemu-fsdev-dummy.o
hw/Makefile.objs +0 -2
index 0e245c8..c02c856 100644
@@ -43,8 +43,6 @@ common-obj-$(CONFIG_I8259) += i8259_common.o i8259.o
 common-obj-y += fifo.o
 common-obj-y += pam.o
 
-extra-obj-y += pci/
-
 # PPC devices
 common-obj-$(CONFIG_PREP_PCI) += prep_pci.o
 common-obj-$(CONFIG_I82378) += i82378.o
hw/pci/Makefile.objs +1 -1
index fe965fe..1cd6cde 100644
@@ -6,4 +6,4 @@ common-obj-$(CONFIG_PCI) += pci_host.o pcie_host.o
 common-obj-$(CONFIG_PCI) += pcie.o pcie_aer.o pcie_port.o
 common-obj-$(CONFIG_NO_PCI) += pci-stub.o
 
-extra-obj-y += pci-stub.o
+common-obj-$(CONFIG_ALL) += pci-stub.o
Signature · 1 line
1.7.1
#9 lore raw
In reply to Paolo Bonzini

Am 19.01.2013 11:06, schrieb Paolo Bonzini:

Quoted 16 lines

This small series makes some more simplifications to Makefile.objs, removing two more variables: universal-obj-y and extra-obj-y, all unified into common-obj-y. It also removes what remains of user-obj-y, unifying that into common-obj-y as well.

To achieve this, the CONFIG_SOFTMMU and CONFIG_USER_ONLY symbols are defined in the toplevel Makefile like we do with devices and disassemblers. Another symbol, CONFIG_ALL, is defined only in the toplevel Makefile and takes the place of extra-obj-y.

With this change the structure of Makefile.objs is finally reduced to only six recursive variables (stub-obj-y, util-obj-y, qga-obj-y, block-obj-y, common-obj-y, obj-y). More important, the simpler structure should help people modifying the build system, avoiding future proliferation of variables as well.

Quoted 3 lines

The patches are mostly mechanical substitutions, and there is no user-visible change---neither in total build time, nor in the files that are linked into the executables.

Without having tested this yet I want to remind that it is necessary for qom/cpu.c to be built twice, to not run into similar issues like util/oslib-posix.c.

Andreas

Quoted 22 lines

Please apply, thanks!

Paolo

Paolo Bonzini (4):
build: move around libcacard-y definition
build: use -$(CONFIG_SECCOMP) instead of ifeq
build: remove universal-obj-y
build: remove extra-obj-y

 Makefile             |    9 ++++-----
 Makefile.objs        |   43 ++++++++++++++++++-------------------------
 Makefile.target      |    3 +--
 disas/Makefile.objs  |   30 +++++++++++++++---------------
 fsdev/Makefile.objs  |    8 ++++----
 hw/Makefile.objs     |   10 +++++-----
 hw/pci/Makefile.objs |    2 +-
 qom/Makefile.objs    |    4 ++--
 8 files changed, 50 insertions(+), 59 deletions(-)
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#10 lore raw

Il 19/01/2013 19:11, Andreas Färber ha scritto:

Quoted 5 lines
Quoted 3 lines
Quoted 3 lines

The patches are mostly mechanical substitutions, and there is no user-visible change---neither in total build time, nor in the files that are linked into the executables.

Without having tested this yet I want to remind that it is necessary for qom/cpu.c to be built twice

Hmm, it's not anymore actually (since libuser was removed). It hasn't been built twice for a month and apparently nothing broke.

Quoted 2 lines

, to not run into similar issues like
util/oslib-posix.c.

The only dependency is

#if !defined(CONFIG_USER_ONLY)
    int kvm_fd;
    bool kvm_vcpu_dirty;
#endif
    struct KVMState *kvm_state;
    struct kvm_run *kvm_run;

Plenty of other fields are meaningless for !CONFIG_USER_ONLY but are unconditionally present in struct CPUState. Given this inconsistency, why is it still useful to build it twice?

Paolo

#11 lore raw

Il 19/01/2013 23:06, Paolo Bonzini ha scritto:

Quoted 11 lines

The only dependency is

#if !defined(CONFIG_USER_ONLY)
    int kvm_fd;
    bool kvm_vcpu_dirty;
#endif
    struct KVMState *kvm_state;
    struct kvm_run *kvm_run;

Plenty of other fields are meaningless for !CONFIG_USER_ONLY but are unconditionally present in struct CPUState.

Sorry, plenty of other fields are meaningless for CONFIG_USER_ONLY.

Paolo

#12 lore raw
In reply to Paolo Bonzini

Am 19.01.2013 23:06, schrieb Paolo Bonzini:

Quoted 9 lines

Il 19/01/2013 19:11, Andreas Färber ha scritto:

Quoted 5 lines
Quoted 3 lines
Quoted 3 lines

The patches are mostly mechanical substitutions, and there is no user-visible change---neither in total build time, nor in the files that are linked into the executables.

Without having tested this yet I want to remind that it is necessary for qom/cpu.c to be built twice

Hmm, it's not anymore actually (since libuser was removed). It hasn't been built twice for a month and apparently nothing broke.

I surely didn't ack that. Have you actually tested linux-user to verify it works? It might lead to unexpected CPUState field accesses.

Quoted 12 lines
Quoted 2 lines

, to not run into similar issues like
util/oslib-posix.c.

The only dependency is

#if !defined(CONFIG_USER_ONLY)
    int kvm_fd;
    bool kvm_vcpu_dirty;
#endif
    struct KVMState *kvm_state;
    struct kvm_run *kvm_run;
Quoted 3 lines

Plenty of other fields are meaningless for !CONFIG_USER_ONLY but are unconditionally present in struct CPUState. Given this inconsistency, why is it still useful to build it twice?

You are judging based on master. I have some more code movements queued (qom-cpu-8) and I believe it was Anthony who insisted on suppressing those unneeded user-only fields even if they were unconditional in CPU_COMMON before.

qom/cpu.c is not intended to remain so small forever - any cpu_* code that does not depend on CPUArchState can find a new home there. cpu_interrupt() is being moved to qom/cpu.h and cpu_reset_interrupt() to qom/cpu.c for instance. And I'm working on refactoring CPU VMState, that either requires #ifdef'ery or lots of new stubs beyond what Eduardo added.

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#13 lore raw

Il 20/01/2013 00:22, Andreas Färber ha scritto:

Quoted 5 lines

Am 19.01.2013 23:06, schrieb Paolo Bonzini:

Quoted 4 lines

Il 19/01/2013 19:11, Andreas Färber ha scritto:

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

The patches are mostly mechanical substitutions, and there is no user-visible change---neither in total build time, nor in the files that are linked into the executables.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Without having tested this yet I want to remind that it is necessary for qom/cpu.c to be built twice

Hmm, it's not anymore actually (since libuser was removed). It hasn't been built twice for a month and apparently nothing broke.

I surely didn't ack that.

At the time I did the move, there was no conditional CPUState field (commit 8e98e2e80b92e08e79e27a0c20a172906cfa12d2). The only difference between the user and softmmu qom/cpu.c was that the user version ended up in libuser. ISTR I asked around about libuser, and the conclusion was that it was only needed for --enable-user-pie.

Quoted 2 lines

Have you actually tested linux-user to verify
it works? It might lead to unexpected CPUState field accesses.

As I said, at the time I did the move there was no difference between the two. Now, I am indeed quite surprised that it works, but yes---it does, at least trivial /bin/ls.

Quoted 10 lines

You are judging based on master. I have some more code movements queued (qom-cpu-8) and I believe it was Anthony who insisted on suppressing those unneeded user-only fields even if they were unconditional in CPU_COMMON before.

qom/cpu.c is not intended to remain so small forever - any cpu_* code that does not depend on CPUArchState can find a new home there. cpu_interrupt() is being moved to qom/cpu.h and cpu_reset_interrupt() to qom/cpu.c for instance. And I'm working on refactoring CPU VMState, that either requires #ifdef'ery or lots of new stubs beyond what Eduardo added.

You can place those in a qom/cpu-softmmu.c.

What I care about is having an understandable build system. At some point we had 12 recursive -obj-y variables and a few other non-recursive ones. The interactions and inclusions were completely impossible to understand.

Paolo