[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC v2 03/34] Makefile.target: Introduce arch-obj
From: |
Peter Crosthwaite |
Subject: |
[Qemu-devel] [RFC v2 03/34] Makefile.target: Introduce arch-obj |
Date: |
Sat, 30 May 2015 23:11:36 -0700 |
Add a new *obj- category, arch-obj. arch-obj-y will be a subset of the
existing obj-y. The difference, is arch-obj components are usable by
multi-arch builds. That is, following the single-arch target builds, the
already-built arch_obj components for multiple targets can be linked
together to form a multi-arch build that supports multi CPU archs.
Such a link is likely to have high numbers of namespace collisions. So
if the target arch supports multi-arch build (CONFIG_ARCH_MULTI),
localise all symbols to a single pre-linked object. The object does
not need to export any APIs, as all APIs are made available via QOM CPU
hooks.
This forms a prerequisite for multi-arch support that there is no
definitions of symbols by arch-obj for use by core code.
For archs converted to multi, target-foo will be arch-obj. But
some CPUs may still need to export APIs to device land (hw/). An
example of this is the ARM co-processor register interface. Such fns
can be split off to new C files in target-foo/hw dir where they remain
obj-y for global visibility. This creates a clearer separation of which
functions are system global and which are private to the CPU.
Signed-off-by: Peter Crosthwaite <address@hidden>
---
Makefile.target | 21 +++++++++++++++++----
configure | 6 ++++++
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/Makefile.target b/Makefile.target
index ec5b92c..c20ca06 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -84,12 +84,16 @@ all: $(PROGS) stap
#########################################################
# cpu emulator library
-obj-y = exec.o translate-all.o cpu-exec.o
-obj-y += tcg/tcg.o tcg/tcg-op.o tcg/optimize.o
+obj-y += exec.o
+arch-obj-$(call lnot,$(TARGET_MULTI)) += translate-all.o
+arch-obj-$(call lnot,$(TARGET_MULTI)) += cpu-exec.o
+arch-obj-$(call lnot,$(TARGET_MULTI)) += tcg/tcg.o tcg/tcg-op.o tcg/optimize.o
obj-$(CONFIG_TCG_INTERPRETER) += tci.o
obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o
obj-y += fpu/softfloat.o
-obj-y += target-$(TARGET_BASE_ARCH)/
+obj-$(CONFIG_ARCH_SINGLE) += target-$(TARGET_BASE_ARCH)/
+arch-obj-$(CONFIG_ARCH_MULTI) += target-$(TARGET_BASE_ARCH)/
+obj-$(CONFIG_ARCH_MULTI) += target-$(TARGET_BASE_ARCH)/hw/
obj-y += disas.o
obj-$(call notempty,$(TARGET_XML_FILES)) += gdbstub-xml.o
obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
@@ -132,7 +136,8 @@ obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o
ioport.o numa.o
obj-y += qtest.o bootdevice.o
obj-y += hw/
obj-$(CONFIG_KVM) += kvm-all.o
-obj-y += memory.o savevm.o cputlb.o
+obj-y += memory.o savevm.o
+arch-obj-$(call lnot,$(TARGET_MULTI)) += cputlb.o
obj-y += memory_mapping.o
obj-y += dump.o
LIBS := $(libs_softmmu) $(LIBS)
@@ -158,6 +163,12 @@ endif # CONFIG_SOFTMMU
%/translate.o: QEMU_CFLAGS += $(TRANSLATE_OPT_CFLAGS)
dummy := $(call unnest-vars,,obj-y)
+dummy := $(call unnest-vars,,arch-obj-y)
+
+arch-obj.o: $(arch-obj-y)
+ $(call quiet-command,$(LD) $(filter-out %.mak, $^) -r -o $@,"LINK $@")
+ $(call quiet-command,$(OBJCOPY) -w -L "*" $@,"OBJCOPY $@")
+
all-obj-y := $(obj-y)
target-obj-y :=
@@ -174,6 +185,8 @@ dummy := $(call unnest-vars,.., \
target-obj-y := $(target-obj-y-save)
all-obj-y += $(common-obj-y)
all-obj-y += $(target-obj-y)
+all-obj-$(CONFIG_ARCH_SINGLE) += $(arch-obj-y)
+all-obj-$(CONFIG_ARCH_MULTI) += arch-obj.o
all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y)
$(QEMU_PROG_BUILD): config-devices.mak
diff --git a/configure b/configure
index 3145dd6..1acafcd 100755
--- a/configure
+++ b/configure
@@ -5480,6 +5480,12 @@ if test "$tcg_interpreter" = "yes" ; then
echo "CONFIG_TCI_DIS=y" >> config-all-disas.mak
fi
+case "$TARGET_BASE_ARCH" in
+*)
+ echo "CONFIG_ARCH_SINGLE=y" >> $config_target_mak
+;;
+esac
+
case "$ARCH" in
alpha)
# Ensure there's only a single GP
--
1.9.1
- [Qemu-devel] [RFC v2 00/34] Multi Architecture System Emulation, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 01/34] cpu-defs: Move CPU_TEMP_BUF_NLONGS to tcg, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 02/34] cpu-exec: Purge all uses of CPU_GET_ENV, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 03/34] Makefile.target: Introduce arch-obj,
Peter Crosthwaite <=
- [Qemu-devel] [RFC v2 04/34] cpu-exec: Migrate some generic fns to cpus.c, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 05/34] translate: Listify tcg_exec_init, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 06/34] cpu-common: Define tb_page_addr_t for everyone, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 07/34] exec-all: Move cpu_can_do_io to qom/cpu.h, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 08/34] translate-all: Move tcg_handle_interrupt to -common, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 09/34] include/exec: Move standard exceptions to cpu-all.h, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 10/34] include/exec: Split target_long def to new header, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 11/34] include/exec: Move cputlb exec.c defs out, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 12/34] include/exec: Move tb hash functions out, Peter Crosthwaite, 2015/05/31
- [Qemu-devel] [RFC v2 13/34] cpu-defs: Move out TB_JMP defines, Peter Crosthwaite, 2015/05/31