qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/3] generate LDFLAGS for *-linux-user and *-bsd-use


From: Juan Quintela
Subject: [Qemu-devel] [PATCH 2/3] generate LDFLAGS for *-linux-user and *-bsd-user in a single place in configure
Date: Wed, 22 Jul 2009 22:37:39 +0200

Remove lots of duplicate code in the process

Signed-off-by: Juan Quintela <address@hidden>
---
 Makefile.target |  132 -------------------------------------------------------
 configure       |   39 ++++++++++++++++
 2 files changed, 39 insertions(+), 132 deletions(-)

diff --git a/Makefile.target b/Makefile.target
index f47d534..912ac62 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -179,72 +179,6 @@ ifdef CONFIG_STATIC
 LDFLAGS+=-static
 endif

-ifeq ($(ARCH),i386)
-ifdef TARGET_GPROF
-USE_I386_LD=y
-endif
-ifdef CONFIG_STATIC
-USE_I386_LD=y
-endif
-ifdef USE_I386_LD
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-else
-# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
-# that the kernel ELF loader considers as an executable. I think this
-# is the simplest way to make it self virtualizable!
-LDFLAGS+=-Wl,-shared
-endif
-endif
-
-ifeq ($(ARCH),x86_64)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),ppc)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),ppc64)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),s390)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),sparc)
-# -static is used to avoid g1/g3 usage by the dynamic linker   
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
-endif
-
-ifeq ($(ARCH),sparc64)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),alpha)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),ia64)
-LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),arm)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),m68k)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),mips)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),mips64)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
 # profiling code
 ifdef TARGET_GPROF
 LDFLAGS+=-p
@@ -318,72 +252,6 @@ ifdef CONFIG_STATIC
 LDFLAGS+=-static
 endif

-ifeq ($(ARCH),i386)
-ifdef TARGET_GPROF
-USE_I386_LD=y
-endif
-ifdef CONFIG_STATIC
-USE_I386_LD=y
-endif
-ifdef USE_I386_LD
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-else
-# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
-# that the kernel ELF loader considers as an executable. I think this
-# is the simplest way to make it self virtualizable!
-LDFLAGS+=-Wl,-shared
-endif
-endif
-
-ifeq ($(ARCH),x86_64)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),ppc)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),ppc64)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),s390)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),sparc)
-# -static is used to avoid g1/g3 usage by the dynamic linker
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
-endif
-
-ifeq ($(ARCH),sparc64)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),alpha)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),ia64)
-LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),arm)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),m68k)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),mips)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
-ifeq ($(ARCH),mips64)
-LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
-endif
-
 obj-y = main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o \
         gdbstub.o gdbstub-xml.o ioport-user.o
 obj-y += uaccess.o
diff --git a/configure b/configure
index e9ed09d..81c855d 100755
--- a/configure
+++ b/configure
@@ -2098,6 +2098,45 @@ if test "$target_bsd_user" = "yes" ; then
   echo "CONFIG_BSD_USER=y" >> $config_mak
 fi

+# generate LDFLAGS for targets
+
+ldflags=""
+if test "$target_linux_user" = "yes" -o "$target_linux_user" = "yes" ; then
+  case "$ARCH" in
+  i386)
+    if test "$gprof" = "yes" -o "$static" = "yes" ; then
+      ldflags='-Wl,-T,$(SRC_PATH)/$(ARCH).ld'
+    else
+      # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
+      # that the kernel ELF loader considers as an executable. I think this
+      # is the simplest way to make it self virtualizable!
+      ldflags='-Wl,-shared'
+    fi
+    ;;
+  sparc)
+    # -static is used to avoid g1/g3 usage by the dynamic linker
+    ldflags='-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
+    ;;
+  ia64)
+    ldflags='-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
+    ;;
+  x86_64|ppc|ppc64|s390|sparc64|alpha|arm|m68k|mips|mips64)
+    ldflags='-Wl,-T,$(SRC_PATH)/$(ARCH).ld'
+    ;;
+  esac
+fi
+if test "$target_softmmu" = "yes" ; then
+  case "$ARCH" in
+  ia64)
+    ldflags='-Wl,-G0 -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
+    ;;
+  esac
+fi
+
+if test "$ldflags" != "" ; then
+  echo "LDFLAGS+=$ldflags" >> $config_mak
+fi
+
 $source_path/create_config < $config_mak > $config_h

 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ 
$config_h
-- 
1.6.2.5





reply via email to

[Prev in Thread] Current Thread [Next in Thread]