diff mbox

[v3,22/35] core: Introduce multi-arch build

Message ID 57ec913300ac8e7bbf16ba9519f6117ccf724f3a.1437212383.git.crosthwaite.peter@gmail.com
State New
Headers show

Commit Message

Peter Crosthwaite July 18, 2015, 9:40 a.m. UTC
Create the multi-softmmu build target. The multi-arch build will be
a combination of all softmmu targets that are:

1: also configured for build (as --target-list items)
2: support multi-arch

target-multi will define TARGET_FOO for each supported target. This is
to allow access to these defs from common code as needed (even though
the multiple #ifs are mutually exclusive).

Multi-arch must provide a cpu.h header. This cpu.h has no cpu-defs.h
inclusion (core code no longer requires it). It will define
target_[u]long as that is needed by core code. It is 64b. ENV_GET_CPU
is not defined (woot!).

the arch-obj.o builds for all the component architectures are linked
in all-obj-y. These are built as a dependency using a sub-make of the
relevant peer foo-softmmu target subdir.

There are no arch-obj-y objects for the multi-arch build itself.

Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---
The default-config needs work. I don't like listing out all the
supported archs like this so configure and Makefile should be able
to autogenerate or combine existing ones as needed.

Changed since RFCv2:
Remove Makefile.target change (moved to arch-obj patch)
Misc simplifications
---
 arch_init.c                       |  4 +++-
 configure                         | 29 +++++++++++++++++++++++++++--
 default-configs/multi-softmmu.mak |  2 ++
 include/sysemu/arch_init.h        |  1 +
 target-multi/cpu.h                | 16 ++++++++++++++++
 target-multi/helper.h             |  0
 6 files changed, 49 insertions(+), 3 deletions(-)
 create mode 100644 default-configs/multi-softmmu.mak
 create mode 100644 target-multi/cpu.h
 create mode 100644 target-multi/helper.h

diff --git a/target-multi/helper.h b/target-multi/helper.h
new file mode 100644
index 0000000..e69de29
diff mbox

Patch

diff --git a/arch_init.c b/arch_init.c
index 725c638..4ca77b8 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -43,7 +43,9 @@  int graphic_depth = 32;
 #endif
 
 
-#if defined(TARGET_ALPHA)
+#if defined(TARGET_MULTI)
+#define QEMU_ARCH QEMU_ARCH_MULTI
+#elif defined(TARGET_ALPHA)
 #define QEMU_ARCH QEMU_ARCH_ALPHA
 #elif defined(TARGET_ARM)
 #define QEMU_ARCH QEMU_ARCH_ARM
diff --git a/configure b/configure
index 096977b..f954131 100755
--- a/configure
+++ b/configure
@@ -5221,6 +5221,16 @@  if test "$linux" = "yes" ; then
     fi
 fi
 
+target_multi_dir="multi-softmmu"
+config_target_multi_mak=$target_multi_dir/config-target.mak
+
+for target in $target_list; do
+target_dir="$target"
+config_target_mak=$target_dir/config-target.mak
+mkdir -p $target_dir
+echo "# Automatically generated by configure - do not modify" > $config_target_mak
+done
+
 for target in $target_list; do
 target_dir="$target"
 config_target_mak=$target_dir/config-target.mak
@@ -5236,6 +5246,7 @@  target_softmmu="no"
 target_user_only="no"
 target_linux_user="no"
 target_bsd_user="no"
+target_multi="no"
 case "$target" in
   ${target_name}-softmmu)
     target_softmmu="yes"
@@ -5260,8 +5271,6 @@  case "$target" in
     ;;
 esac
 
-mkdir -p $target_dir
-echo "# Automatically generated by configure - do not modify" > $config_target_mak
 
 bflt="no"
 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_name/g"`
@@ -5318,6 +5327,8 @@  case "$target_name" in
   ;;
   moxie)
   ;;
+  multi)
+  ;;
   or32)
     TARGET_ARCH=openrisc
     TARGET_BASE_ARCH=openrisc
@@ -5384,12 +5395,23 @@  fi
 
 symlink "$source_path/Makefile.target" "$target_dir/Makefile"
 
+if test -e $source_path/multi-support/$target_name -a \
+        -e $config_target_multi_mak -a \
+        "$target_softmmu" = "yes" ; then
+    target_multi="yes"
+fi
+
 upper() {
     echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
 }
 
 target_arch_name="`upper $TARGET_ARCH`"
 echo "TARGET_$target_arch_name=y" >> $config_target_mak
+if [ "$target_multi" = "yes" ]; then
+  echo "TARGET_$target_arch_name=y" >> $config_target_multi_mak
+  echo "MULTI_BASE_TARGETS+= $TARGET_BASE_ARCH" >> $config_target_multi_mak
+  echo "MULTI_TARGETS+= $target" >> $config_target_multi_mak
+fi
 echo "TARGET_NAME=$target_name" >> $config_target_mak
 echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
 if [ "$TARGET_ABI_DIR" = "" ]; then
@@ -5469,6 +5491,9 @@  ldflags=""
 disas_config() {
   echo "$@" >> $config_target_mak
   echo "$@" >> config-all-disas.mak
+  if test "$target_multi" = "yes" ; then
+    echo "$@" >> $config_target_multi_mak
+  fi
 }
 
 for i in $ARCH $TARGET_BASE_ARCH ; do
diff --git a/default-configs/multi-softmmu.mak b/default-configs/multi-softmmu.mak
new file mode 100644
index 0000000..db7e598
--- /dev/null
+++ b/default-configs/multi-softmmu.mak
@@ -0,0 +1,2 @@ 
+include aarch64-softmmu.mak
+include microblazeel-softmmu.mak
diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
index c38892f..041db56 100644
--- a/include/sysemu/arch_init.h
+++ b/include/sysemu/arch_init.h
@@ -23,6 +23,7 @@  enum {
     QEMU_ARCH_UNICORE32 = (1 << 14),
     QEMU_ARCH_MOXIE = (1 << 15),
     QEMU_ARCH_TRICORE = (1 << 16),
+    QEMU_ARCH_MULTI = (1 << 17),
 };
 
 extern const uint32_t arch_type;
diff --git a/target-multi/cpu.h b/target-multi/cpu.h
new file mode 100644
index 0000000..70a1d6b
--- /dev/null
+++ b/target-multi/cpu.h
@@ -0,0 +1,16 @@ 
+#ifndef MULTI_CPU_H
+#define MULTI_CPU_H
+
+#include "config.h"
+
+#define TARGET_LONG_BITS 64
+#define TARGET_PAGE_BITS 12 /* Thou shalt still use 4k pages only! */
+
+#define CPUArchState void
+
+#include "exec/target-long.h"
+#include "exec/cpu-all.h"
+#include "exec/exec-all.h"
+#include "qom/cpu.h"
+
+#endif