From 3142255c62f3e69a1fa75427426a3e64b6349fbd Mon Sep 17 00:00:00 2001 From: blueswir1 Date: Mon, 16 Apr 2007 18:27:06 +0000 Subject: [PATCH] Sparc host update (Ben Taylor, Martin Bochnig) git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2689 c046a42c-6fe2-441c-8c8c-71466251a162 --- Makefile | 7 +++---- Makefile.target | 44 +++++++++++++++++++++++-------------------- configure | 50 +++++++++++++++++++++++++++++++++++++++++++++++-- cpu-all.h | 2 +- 4 files changed, 76 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index 9249c7fea9..c547453d5f 100644 --- a/Makefile +++ b/Makefile @@ -8,10 +8,9 @@ include config-host.mak BASE_CFLAGS= BASE_LDFLAGS= -BASE_CFLAGS += $(OS_CFLAGS) -ifeq ($(ARCH),sparc) -BASE_CFLAGS += -mcpu=ultrasparc -endif +BASE_CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS) +BASE_LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS) + CPPFLAGS += -I. -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE LIBS= TOOLS=qemu-img$(EXESUF) diff --git a/Makefile.target b/Makefile.target index 0f6e21f38a..7129de0a42 100644 --- a/Makefile.target +++ b/Makefile.target @@ -132,25 +132,25 @@ BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld endif ifeq ($(ARCH),sparc) -ifeq ($(CONFIG_SOLARIS),yes) -BASE_CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g2 -ffixed-g3 -BASE_LDFLAGS+=-m32 -OP_CFLAGS+=-fno-delayed-branch -fno-omit-frame-pointer -ffixed-i0 -else -BASE_CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6 -BASE_LDFLAGS+=-m32 -OP_CFLAGS+=-fno-delayed-branch -ffixed-i0 -HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat -# -static is used to avoid g1/g3 usage by the dynamic linker -BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static -endif + BASE_CFLAGS+=-ffixed-g2 -ffixed-g3 + OP_CFLAGS+=-fno-delayed-branch -ffixed-i0 + ifeq ($(CONFIG_SOLARIS),yes) + OP_CFLAGS+=-fno-omit-frame-pointer + else + BASE_CFLAGS+=-ffixed-g1 -ffixed-g6 + HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat + # -static is used to avoid g1/g3 usage by the dynamic linker + BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static + endif endif ifeq ($(ARCH),sparc64) -BASE_CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7 -BASE_LDFLAGS+=-m64 -BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -OP_CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7 -fno-delayed-branch -ffixed-i0 + BASE_CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7 + OP_CFLAGS+=-mcpu=ultrasparc -m64 -fno-delayed-branch -ffixed-i0 + ifneq ($(CONFIG_SOLARIS),yes) + BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld + OP_CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7 + endif endif ifeq ($(ARCH),alpha) @@ -202,8 +202,10 @@ ifdef CONFIG_DARWIN_USER BASE_LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000 endif -BASE_CFLAGS+=$(OS_CFLAGS) -OP_CFLAGS+=$(OS_CFLAGS) +BASE_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS) +BASE_LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS) +OP_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS) +OP_LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS) ######################################################### @@ -500,8 +502,10 @@ VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld endif ifeq ($(ARCH),sparc64) -VL_LDFLAGS+=-m64 -VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc64.ld + VL_LDFLAGS+=-m64 + ifneq ($(CONFIG_SOLARIS),yes) + VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld + endif endif ifdef CONFIG_WIN32 diff --git a/configure b/configure index f8879dfc20..adfc268e4c 100755 --- a/configure +++ b/configure @@ -56,7 +56,7 @@ case "$cpu" in s390) cpu="s390" ;; - sparc|sun4[muv]) + sparc|sun4[cdmuv]) cpu="sparc" ;; sparc64) @@ -266,6 +266,18 @@ for opt do ;; --enable-uname-release=*) uname_release="$optarg" ;; + --sparc_cpu=*) + sparc_cpu="$optarg" + case $sparc_cpu in + v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32" + target_cpu="sparc"; cpu="sparc" ;; + v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32" + target_cpu="sparc"; cpu="sparc" ;; + v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64" + target_cpu="sparc64"; cpu="sparc64" ;; + *) echo "undefined SPARC architecture. Exiting";exit 1;; + esac + ;; esac done @@ -279,6 +291,29 @@ fi CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing" LDFLAGS="$LDFLAGS -g" +# +# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right +# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit) +# +case $cpu in + sparc) if test -z "$sparc_cpu" ; then + ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__" + ARCH_LDFLAGS="-m32" + else + ARCH_CFLAGS="${SP_CFLAGS}" + ARCH_LDFLAGS="${SP_LDFLAGS}" + fi + ;; + sparc64) if test -z "$sparc_cpu" ; then + ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__" + ARCH_LDFLAGS="-m64" + else + ARCH_CFLAGS="${SP_CFLAGS}" + ARCH_LDFLAGS="${SP_LDFLAGS}" + fi + ;; +esac + if test x"$show_help" = x"yes" ; then cat << EOF @@ -320,6 +355,7 @@ echo " --disable-darwin-user disable all darwin usermode emulation targets" echo " --fmod-lib path to FMOD library" echo " --fmod-inc path to FMOD includes" echo " --enable-uname-release=R Return R for uname -r in usermode emulation" +echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" echo "" echo "NOTE: The object files are built at the place where configure is launched" exit 1 @@ -635,6 +671,9 @@ else fmod_support="" fi echo "FMOD support $fmod $fmod_support" +if test -n "$sparc_cpu"; then + echo "Target Sparc Arch $sparc_cpu" +fi echo "kqemu support $kqemu" echo "Documentation $build_docs" [ ! -z "$uname_release" ] && \ @@ -668,6 +707,9 @@ echo "HOST_CC=$host_cc" >> $config_mak echo "AR=$ar" >> $config_mak echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak +echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak +echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak +echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak echo "CFLAGS=$CFLAGS" >> $config_mak echo "LDFLAGS=$LDFLAGS" >> $config_mak echo "EXESUF=$EXESUF" >> $config_mak @@ -712,7 +754,7 @@ elif test "$cpu" = "m68k" ; then echo "ARCH=m68k" >> $config_mak echo "#define HOST_M68K 1" >> $config_h else - echo "Unsupported CPU" + echo "Unsupported CPU = $cpu" exit 1 fi if test "$bigendian" = "yes" ; then @@ -744,6 +786,10 @@ if test "$solaris" = "yes" ; then echo "#define NEEDS_LIBSUNMATH 1" >> $config_h fi fi +if test -n "$sparc_cpu"; then + echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak + echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h +fi if test "$gdbstub" = "yes" ; then echo "CONFIG_GDBSTUB=yes" >> $config_mak echo "#define CONFIG_GDBSTUB 1" >> $config_h diff --git a/cpu-all.h b/cpu-all.h index 2fc2f9a99d..db1e947fec 100644 --- a/cpu-all.h +++ b/cpu-all.h @@ -1000,7 +1000,7 @@ static inline int64_t cpu_get_real_ticks(void) return val; } -#elif defined(__sparc_v9__) +#elif defined(__sparc_v8plus__) || defined(__sparc_v8plusa__) || defined(__sparc_v9__) static inline int64_t cpu_get_real_ticks (void) { -- GitLab