Share code updating gdb_target_obs
authorYao Qi <yao.qi@linaro.org>
Fri, 6 Oct 2017 10:18:48 +0000 (11:18 +0100)
committerYao Qi <yao.qi@linaro.org>
Fri, 6 Oct 2017 10:18:48 +0000 (11:18 +0100)
Nowadays, there are much duplications in configure.tgt to update
gdb_target_obs, some cpu specific object files are added to gdb_target_obs
to some different target triplets of the same cpu.  The same problem
exists for os specific object files too.  It is fragile to update them,
and build with all targets enabled doesn't find the problem.

This patch splits the gdb_target_obs update to three steps, cpu steps, os
steps, and the rest.

I tested this patch by build gdb for each different target triplets
respectively,

aarch64-elf aarch64-rtems aarch64-freebsd aarch64-linux alpha-elf
alpha-linux alpha-netbsd alpha-openbsd arm-elf arm-wince-pe arm-linux
arm-netbsd arm-symbianelf avr cris-elf frv-elf h8300-elf i386-elf
i386-darwin i386-dicos i386-freebsd i386-netbsdelf i386-openbsd
i386-nto i386-solaris i386-linux i386-gnu i386-cygwin i386-mingw32
i386-go32 ia64-linux-gnu ia64-vms lm32-elf m32c-elf m32r-elf m32r-linux
m68hc11-elf m68k-elf m68k-linux m68k-netbsd m68k-openbsd m88k-openbsd
mep-elf microblaze-xilinx-elf microblaze-linux-gnu mips-elf moxie-elf
ms1-elf nios2-elf nios2-linux-gnu hppa-elf hppa-linux hppa-netbsd
hppa-openbsd powerpc-eabi powerpc-freebsd powerpc-netbsd powerpc-openbsd
powerpc-linux powerpc-lynx178 rl78-elf rx-elf s390-linux-gnu score-elf
sh-elf sh-linux sh-openbsd sh64-elf sh64-linux sh64-openbsd sparc64-linux
sparc-linux sparc-freebsd sparc64-freebsd sparc-netbsd sparc64-netbsd
sparc-openbsd sparc64-openbsd spu-elf tic6x-elf tic6x-uclinux v850-elf
vax-netbsd vax-openbsd x86_64-linux-gnu x86_64-darwin x86_64-dicos
x86_64-elf x86_64-freebsd x86_64-mingw32 x86_64-netbsd x86_64-openbsd
x86_64-rtems xstormy16-elf xtensa-elf xtensa-linux

gdb:

2017-10-06  Yao Qi  <yao.qi@linaro.org>

* configure.tgt (i386_tobjs): New variable.
(amd64_tobjs): New variable.
Set $cpu_obs and $os_obs.

gdb/ChangeLog
gdb/configure.tgt

index 93389b2d9a02d4f93f9927ba0ed241a2672ee2b3..0f924390badb879bebf315b1e85a308aef054cb5 100644 (file)
@@ -1,3 +1,9 @@
+2017-10-06  Yao Qi  <yao.qi@linaro.org>
+
+       * configure.tgt (i386_tobjs): New variable.
+       (amd64_tobjs): New variable.
+       Set $cpu_obs and $os_obs.
+
 2017-10-06  Yao Qi  <yao.qi@linaro.org>
 
        * Makefile.in (CONFIG_SRC_SUBDIR): New.
index 40c44b7658cea183cc715ea9adfbe5178512264c..96cc7eedbe7c2d81ad4ca714c975b37cbba62078 100644 (file)
@@ -36,23 +36,85 @@ case $targ in
     ;;
 esac
 
-# map target info into gdb names.
+i386_tobjs="i386-tdep.o i386.o i387-tdep.o"
+amd64_tobjs="amd64-tdep.o arch/amd64.o"
+
+# Here are three sections to get a list of target specific object
+# files according to target triplet $TARG.
+
+# 1. Get the objects per cpu in $TARG.
+
+case "${targ}" in
+aarch64*-*-*)
+       cpu_obs="aarch64-tdep.o aarch64-insn.o";;
+
+alpha*-*-*)
+       # Target: Alpha
+       cpu_obs="alpha-tdep.o"
+       ;;
+
+arc*-*-*)
+       # Target: Unidentified ARC target
+       cpu_obs="arc-tdep.o"
+       ;;
+
+arm*-*-*)
+       cpu_obs="arm.o arm-get-next-pcs.o arm-tdep.o";;
+
+hppa*-*-*)
+       # Target: HP PA-RISC
+       cpu_obs="hppa-tdep.o"
+       ;;
+
+i[34567]86-*-*)
+       cpu_obs="${i386_tobjs}"
+       if test "x$enable_64_bit_bfd" = "xyes"; then
+          cpu_obs="${amd64_tobjs} ${cpu_obs}"
+       fi
+       ;;
+
+ia64*-*-*)
+       # Target: Intel IA-64
+       cpu_obs="ia64-tdep.o"
+       ;;
+
+x86_64-*-*)
+       cpu_obs="${i386_tobjs} ${amd64_tobjs}";;
+
+xtensa*)
+       # Target: Tensilica Xtensa processors
+       cpu_obs="xtensa-tdep.o xtensa-config.o solib-svr4.o"
+       ;;
+
+esac
+
+# 2. Get the objects per os in $TARG.
+
+case "${targ}" in
+*-*-freebsd* | *-*-kfreebsd*-gnu)
+       os_obs="fbsd-tdep.o solib-svr4.o";;
+*-*-netbsd* | *-*-knetbsd*-gnu)
+       os_obs="nbsd-tdep.o solib-svr4.o";;
+*-*-openbsd*)
+       os_obs="obsd-tdep.o solib-svr4.o";;
+esac
+
+# 3. Get the rest of objects.
 
 case "${targ}" in
 aarch64*-*-elf | aarch64*-*-rtems*)
        # Target: AArch64 embedded system
-       gdb_target_obs="aarch64-tdep.o aarch64-newlib-tdep.o aarch64-insn.o"
+       gdb_target_obs="aarch64-newlib-tdep.o"
        ;;
 
 aarch64*-*-freebsd*)
        # Target: FreeBSD/aarch64
-       gdb_target_obs="aarch64-tdep.o aarch64-fbsd-tdep.o aarch64-insn.o \
-                       fbsd-tdep.o solib-svr4.o"
+       gdb_target_obs="aarch64-fbsd-tdep.o"
        ;;
 
 aarch64*-*-linux*)
        # Target: AArch64 linux
-       gdb_target_obs="aarch64-tdep.o aarch64-linux-tdep.o aarch64-insn.o \
+       gdb_target_obs="aarch64-linux-tdep.o \
                        arm.o arm-linux.o arm-get-next-pcs.o arm-tdep.o \
                        arm-linux-tdep.o \
                        glibc-tdep.o linux-tdep.o solib-svr4.o \
@@ -62,23 +124,18 @@ aarch64*-*-linux*)
 
 alpha*-*-linux*)
        # Target: Little-endian Alpha running Linux
-       gdb_target_obs="alpha-tdep.o alpha-mdebug-tdep.o alpha-linux-tdep.o \
+       gdb_target_obs="alpha-mdebug-tdep.o alpha-linux-tdep.o \
                        linux-tdep.o solib-svr4.o"
        ;;
 alpha*-*-netbsd* | alpha*-*-knetbsd*-gnu)
        # Target: NetBSD/alpha
-       gdb_target_obs="alpha-tdep.o alpha-mdebug-tdep.o alpha-bsd-tdep.o \
-                       alpha-nbsd-tdep.o nbsd-tdep.o solib-svr4.o"
+       gdb_target_obs="alpha-mdebug-tdep.o alpha-bsd-tdep.o \
+                       alpha-nbsd-tdep.o"
        ;;
 alpha*-*-openbsd*)
        # Target: OpenBSD/alpha
-       gdb_target_obs="alpha-tdep.o alpha-mdebug-tdep.o alpha-bsd-tdep.o \
-                       alpha-nbsd-tdep.o alpha-obsd-tdep.o nbsd-tdep.o \
-                       obsd-tdep.o solib-svr4.o"
-       ;;
-alpha*-*-*)
-       # Target: Alpha
-       gdb_target_obs="alpha-tdep.o"
+       gdb_target_obs="alpha-mdebug-tdep.o alpha-bsd-tdep.o \
+                       alpha-nbsd-tdep.o alpha-obsd-tdep.o nbsd-tdep.o"
        ;;
 
 am33_2.0*-*-linux*)
@@ -89,44 +146,34 @@ am33_2.0*-*-linux*)
 
 arc*-*-elf32)
        # Target: baremetal ARC elf32 (newlib) target
-       gdb_target_obs="arc-newlib-tdep.o arc-tdep.o"
-       ;;
-
-arc*-*-*)
-       # Target: Unidentified ARC target
-       gdb_target_obs="arc-tdep.o"
+       gdb_target_obs="arc-newlib-tdep.o"
        ;;
 
 arm*-wince-pe | arm*-*-mingw32ce*)
        # Target: ARM based machine running Windows CE (win32)
-       gdb_target_obs="arm.o arm-get-next-pcs.o arm-tdep.o \
-                       arm-wince-tdep.o windows-tdep.o"
+       gdb_target_obs="arm-wince-tdep.o windows-tdep.o"
        build_gdbserver=yes
        ;;
 arm*-*-linux*)
        # Target: ARM based machine running GNU/Linux
-       gdb_target_obs="arm.o arm-linux.o arm-get-next-pcs.o arm-tdep.o \
-                        arm-linux-tdep.o glibc-tdep.o \
+       gdb_target_obs="arm-linux.o arm-linux-tdep.o glibc-tdep.o \
                        solib-svr4.o symfile-mem.o linux-tdep.o linux-record.o"
        build_gdbserver=yes
        ;;
 arm*-*-netbsd* | arm*-*-knetbsd*-gnu)
        # Target: NetBSD/arm
-       gdb_target_obs="arm.o arm-get-next-pcs.o arm-tdep.o arm-nbsd-tdep.o \
-                       solib-svr4.o"
+       gdb_target_obs="arm-nbsd-tdep.o"
        ;;
 arm*-*-openbsd*)
        # Target: OpenBSD/arm
-       gdb_target_obs="arm.o arm-get-next-pcs.o arm-tdep.o arm-bsd-tdep.o \
-                       arm-obsd-tdep.o obsd-tdep.o solib-svr4.o"
+       gdb_target_obs="arm-bsd-tdep.o arm-obsd-tdep.o"
        ;;
 arm*-*-symbianelf*)
        # Target: SymbianOS/arm
-       gdb_target_obs="arm.o arm-get-next-pcs.o arm-tdep.o arm-symbian-tdep.o"
+       gdb_target_obs="arm-symbian-tdep.o"
        ;;
 arm*-*-*)
        # Target: ARM embedded system
-       gdb_target_obs="arm.o arm-get-next-pcs.o arm-tdep.o"
        gdb_sim=../sim/arm/libsim.a
        ;;
 
@@ -172,113 +219,94 @@ h8300-*-*)
 
 hppa*-*-linux*)
        # Target: HP PA-RISC running Linux
-       gdb_target_obs="hppa-tdep.o hppa-linux-tdep.o glibc-tdep.o \
+       gdb_target_obs="hppa-linux-tdep.o glibc-tdep.o \
                        linux-tdep.o solib-svr4.o symfile-mem.o"
        ;;
 hppa*-*-netbsd*)
        # Target: NetBSD/hppa
-       gdb_target_obs="hppa-tdep.o hppa-bsd-tdep.o hppa-nbsd-tdep.o solib-svr4.o"
+       gdb_target_obs="hppa-bsd-tdep.o hppa-nbsd-tdep.o solib-svr4.o"
        ;;
 hppa*-*-openbsd*)
        # Target: OpenBSD/hppa
-       gdb_target_obs="hppa-tdep.o hppa-bsd-tdep.o hppa-obsd-tdep.o solib-svr4.o"
-       ;;
-hppa*-*-*)
-       # Target: HP PA-RISC
-       gdb_target_obs="hppa-tdep.o"
+       gdb_target_obs="hppa-bsd-tdep.o hppa-obsd-tdep.o solib-svr4.o"
        ;;
 
 i[34567]86-*-darwin*)
        # Target: Darwin/i386
-       gdb_target_obs="i386-tdep.o i386.o i387-tdep.o \
-                       i386-darwin-tdep.o solib-darwin.o"
+       gdb_target_obs="i386-darwin-tdep.o solib-darwin.o"
        if test "x$enable_64_bit_bfd" = "xyes"; then
            # Target: GNU/Linux x86-64
-           gdb_target_obs="amd64-tdep.o arch/amd64.o amd64-darwin-tdep.o ${gdb_target_obs}"
+           gdb_target_obs="amd64-darwin-tdep.o ${gdb_target_obs}"
        fi
        ;;
 i[34567]86-*-dicos*)
        # Target: DICOS/i386
-       gdb_target_obs="i386-tdep.o i386.o i387-tdep.o dicos-tdep.o i386-dicos-tdep.o"
+       gdb_target_obs="dicos-tdep.o i386-dicos-tdep.o"
        ;;
 i[34567]86-*-freebsd* | i[34567]86-*-kfreebsd*-gnu)
        # Target: FreeBSD/i386
-       gdb_target_obs="i386-tdep.o i386.o i387-tdep.o i386-bsd-tdep.o \
-                       i386-fbsd-tdep.o fbsd-tdep.o solib-svr4.o"
+       gdb_target_obs="i386-bsd-tdep.o i386-fbsd-tdep.o "
        ;;
 i[34567]86-*-netbsd* | i[34567]86-*-knetbsd*-gnu)
        # Target: NetBSD/i386
-       gdb_target_obs="i386-tdep.o i386.o i387-tdep.o i386-bsd-tdep.o \
-                       i386-nbsd-tdep.o nbsd-tdep.o solib-svr4.o"
+       gdb_target_obs="i386-bsd-tdep.o i386-nbsd-tdep.o "
        ;;
 i[34567]86-*-openbsd*)
        # Target: OpenBSD/i386
-       gdb_target_obs="i386-tdep.o i386.o i387-tdep.o i386-bsd-tdep.o \
-                       i386-obsd-tdep.o obsd-tdep.o bsd-uthread.o \
-                       solib-svr4.o"
+       gdb_target_obs="i386-bsd-tdep.o i386-obsd-tdep.o bsd-uthread.o"
        ;;
 i[34567]86-*-nto*)
        # Target: Intel 386 running qnx6.
-       gdb_target_obs="i386-tdep.o i386.o i387-tdep.o solib-svr4.o \
+       gdb_target_obs="solib-svr4.o \
                        i386-nto-tdep.o nto-tdep.o"
        build_gdbserver=yes
        ;;
 i[34567]86-*-solaris2* | x86_64-*-solaris2*)
        # Target: Solaris x86_64
-       gdb_target_obs="i386-tdep.o i386.o i387-tdep.o amd64-tdep.o arch/amd64.o \
+       gdb_target_obs="${i386_tobjs} ${amd64_tobjs} \
                         amd64-sol2-tdep.o i386-sol2-tdep.o sol2-tdep.o \
                         solib-svr4.o"
        ;;
 i[34567]86-*-linux*)
        # Target: Intel 386 running GNU/Linux
-       gdb_target_obs="i386-tdep.o i386.o i386-linux-tdep.o \
-                       glibc-tdep.o i387-tdep.o \
+       gdb_target_obs="i386-linux-tdep.o \
+                       glibc-tdep.o \
                        solib-svr4.o symfile-mem.o \
                        linux-tdep.o linux-record.o"
        if test "x$enable_64_bit_bfd" = "xyes"; then
            # Target: GNU/Linux x86-64
-           gdb_target_obs="amd64-tdep.o arch/amd64.o amd64-linux-tdep.o ${gdb_target_obs}"
+           gdb_target_obs="amd64-linux-tdep.o ${gdb_target_obs}"
        fi
        build_gdbserver=yes
        ;;
 i[34567]86-*-gnu*)
        # Target: Intel 386 running the GNU Hurd
-       gdb_target_obs="i386-tdep.o i386.o i387-tdep.o i386-gnu-tdep.o solib-svr4.o"
+       gdb_target_obs="i386-gnu-tdep.o solib-svr4.o"
        ;;
 i[34567]86-*-cygwin*)
        # Target: Intel 386 running win32
-       gdb_target_obs="i386-tdep.o i386.o i386-cygwin-tdep.o i387-tdep.o \
-                       windows-tdep.o"
+       gdb_target_obs="i386-cygwin-tdep.o windows-tdep.o"
        build_gdbserver=yes
        ;;
 i[34567]86-*-mingw32*)
        # Target: Intel 386 running win32
-       gdb_target_obs="i386-tdep.o i386.o i386-cygwin-tdep.o i387-tdep.o \
-                       windows-tdep.o"
+       gdb_target_obs="i386-cygwin-tdep.o windows-tdep.o"
        build_gdbserver=yes
        ;;
 i[34567]86-*-go32* | i[34567]86-*-msdosdjgpp*)
        # Target: i386 running DJGPP/go32.
-       gdb_target_obs="i386-tdep.o i386.o i387-tdep.o i386-go32-tdep.o"
-       ;;
-i[34567]86-*-*)
-       # Target: i386
-       gdb_target_obs="i386-tdep.o i386.o i387-tdep.o"
+       gdb_target_obs="i386-go32-tdep.o"
        ;;
 
 ia64-*-linux*)
        # Target: Intel IA-64 running GNU/Linux
-       gdb_target_obs="ia64-tdep.o ia64-linux-tdep.o linux-tdep.o \
+       gdb_target_obs="ia64-linux-tdep.o linux-tdep.o \
                        solib-svr4.o symfile-mem.o"
        build_gdbserver=yes
        ;;
 ia64-*-*vms*)
        # Target: Intel IA-64 running OpenVMS
-       gdb_target_obs="ia64-tdep.o ia64-vms-tdep.o"
-       ;;
-ia64*-*-*)
-       # Target: Intel IA-64
-       gdb_target_obs="ia64-tdep.o"
+       gdb_target_obs="ia64-vms-tdep.o"
        ;;
 
 iq2000-*-*)
@@ -332,11 +360,11 @@ m68*-*-linux*)
        ;;
 m68*-*-netbsd* | m68*-*-knetbsd*-gnu)
        # Target: NetBSD/m68k
-       gdb_target_obs="m68k-tdep.o m68k-bsd-tdep.o solib-svr4.o"
+       gdb_target_obs="m68k-tdep.o m68k-bsd-tdep.o"
        ;;
 m68*-*-openbsd*)
        # Target: OpenBSD/m68k
-       gdb_target_obs="m68k-tdep.o m68k-bsd-tdep.o solib-svr4.o"
+       gdb_target_obs="m68k-tdep.o m68k-bsd-tdep.o"
        ;;
 
 m88*-*-openbsd*)
@@ -371,17 +399,17 @@ mips*-*-linux*)
        ;;
 mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
        # Target: MIPS running NetBSD
-       gdb_target_obs="mips-tdep.o mips-nbsd-tdep.o solib-svr4.o nbsd-tdep.o"
+       gdb_target_obs="mips-tdep.o mips-nbsd-tdep.o"
        gdb_sim=../sim/mips/libsim.a
        ;;
 mips*-*-freebsd*)
        # Target: MIPS running FreeBSD
-       gdb_target_obs="mips-tdep.o mips-fbsd-tdep.o solib-svr4.o fbsd-tdep.o"
+       gdb_target_obs="mips-tdep.o mips-fbsd-tdep.o"
        gdb_sim=../sim/mips/libsim.a
        ;;
 mips64*-*-openbsd*)
        # Target: OpenBSD/mips64
-       gdb_target_obs="mips-tdep.o mips64-obsd-tdep.o obsd-tdep.o solib-svr4.o"
+       gdb_target_obs="mips-tdep.o mips64-obsd-tdep.o"
        ;;
 mips*-sde*-elf*)
        # Target: MIPS SDE
@@ -434,21 +462,19 @@ nios2*-*-*)
 powerpc*-*-freebsd*)
        # Target: FreeBSD/powerpc
        gdb_target_obs="rs6000-tdep.o ppc-sysv-tdep.o ppc64-tdep.o \
-                       ppc-fbsd-tdep.o fbsd-tdep.o solib-svr4.o \
+                       ppc-fbsd-tdep.o \
                        ravenscar-thread.o ppc-ravenscar-thread.o"
        ;;
 
 powerpc-*-netbsd* | powerpc-*-knetbsd*-gnu)
        # Target: NetBSD/powerpc
        gdb_target_obs="rs6000-tdep.o ppc-sysv-tdep.o ppc-nbsd-tdep.o \
-                       solib-svr4.o \
                        ravenscar-thread.o ppc-ravenscar-thread.o"
        gdb_sim=../sim/ppc/libsim.a
        ;;
 powerpc-*-openbsd*)
        # Target: OpenBSD/powerpc
        gdb_target_obs="rs6000-tdep.o ppc-sysv-tdep.o ppc-obsd-tdep.o \
-                       solib-svr4.o \
                        ravenscar-thread.o ppc-ravenscar-thread.o"
        ;;
 powerpc-*-aix* | rs6000-*-* | powerpc64-*-aix*)
@@ -516,12 +542,12 @@ sh*-*-linux*)
        ;;
 sh*-*-netbsdelf* | sh*-*-knetbsd*-gnu)
        # Target: NetBSD/sh
-       gdb_target_obs="sh-tdep.o sh-nbsd-tdep.o solib-svr4.o"
+       gdb_target_obs="sh-tdep.o sh-nbsd-tdep.o"
        gdb_sim=../sim/sh/libsim.a
        ;;
 sh*-*-openbsd*)
        # Target: OpenBSD/sh
-       gdb_target_obs="sh-tdep.o sh64-tdep.o sh-nbsd-tdep.o solib-svr4.o"
+       gdb_target_obs="sh-tdep.o sh64-tdep.o sh-nbsd-tdep.o"
        ;;
 sh64-*-elf*)
        # Target: Renesas/Super-H 64 bit with simulator
@@ -558,32 +584,30 @@ sparc64-*-linux*)
 sparc*-*-freebsd* | sparc*-*-kfreebsd*-gnu)
        # Target: FreeBSD/sparc64
        gdb_target_obs="sparc-tdep.o sparc64-tdep.o sparc64-fbsd-tdep.o \
-                       fbsd-tdep.o solib-svr4.o \
                        ravenscar-thread.o sparc-ravenscar-thread.o"
        ;;
 sparc-*-netbsd* | sparc-*-knetbsd*-gnu)
        # Target: NetBSD/sparc
-       gdb_target_obs="sparc-tdep.o sparc-nbsd-tdep.o nbsd-tdep.o \
-                       solib-svr4.o \
+       gdb_target_obs="sparc-tdep.o sparc-nbsd-tdep.o \
                        ravenscar-thread.o sparc-ravenscar-thread.o"
        ;;
 sparc64-*-netbsd* | sparc64-*-knetbsd*-gnu)
        # Target: NetBSD/sparc64
        gdb_target_obs="sparc64-tdep.o sparc64-nbsd-tdep.o sparc-tdep.o \
-                       sparc-nbsd-tdep.o nbsd-tdep.o solib-svr4.o \
+                       sparc-nbsd-tdep.o \
                        ravenscar-thread.o sparc-ravenscar-thread.o"
        ;;
 sparc-*-openbsd*)
        # Target: OpenBSD/sparc
        gdb_target_obs="sparc-tdep.o sparc-nbsd-tdep.o sparc-obsd-tdep.o \
-                       nbsd-tdep.o obsd-tdep.o bsd-uthread.o solib-svr4.o \
+                       nbsd-tdep.o bsd-uthread.o \
                        ravenscar-thread.o sparc-ravenscar-thread.o"
        ;;
 sparc64-*-openbsd*)
        # Target: OpenBSD/sparc64
        gdb_target_obs="sparc64-tdep.o sparc64-nbsd-tdep.o sparc64-obsd-tdep.o \
                        sparc-tdep.o sparc-nbsd-tdep.o sparc-obsd-tdep.o \
-                       nbsd-tdep.o obsd-tdep.o bsd-uthread.o solib-svr4.o \
+                       nbsd-tdep.o bsd-uthread.o \
                        ravenscar-thread.o sparc-ravenscar-thread.o"
        ;;
 sparc-*-solaris2* | sparcv9-*-solaris2* | sparc64-*-solaris2*)
@@ -660,67 +684,63 @@ vax-*-*)
 
 x86_64-*-darwin*)
        # Target: Darwin/x86-64
-       gdb_target_obs="amd64-tdep.o arch/amd64.o i386-tdep.o i386.o i387-tdep.o \
+       gdb_target_obs="${i386_tobjs} \
                        i386-darwin-tdep.o amd64-darwin-tdep.o \
                         solib-darwin.o"
        ;;
 
 x86_64-*-dicos*)
        # Target: DICOS/x86-64
-       gdb_target_obs="amd64-tdep.o arch/amd64.o i386-tdep.o i386.o i387-tdep.o \
+       gdb_target_obs="${i386_tobjs} \
                        dicos-tdep.o i386-dicos-tdep.o amd64-dicos-tdep.o"
        ;;
 x86_64-*-elf*)
-       gdb_target_obs="amd64-tdep.o arch/amd64.o i386-tdep.o i386.o i387-tdep.o"
+       gdb_target_obs="${i386_tobjs}"
        ;;
 x86_64-*-linux*)
        # Target: GNU/Linux x86-64
-       gdb_target_obs="amd64-tdep.o amd64-linux-tdep.o arch/amd64.o i386-tdep.o \
-                       i387-tdep.o i386.o i386-linux-tdep.o glibc-tdep.o \
+       gdb_target_obs="amd64-linux-tdep.o ${i386_tobjs}  \
+                       i386-linux-tdep.o glibc-tdep.o \
                        solib-svr4.o symfile-mem.o linux-tdep.o linux-record.o"
        build_gdbserver=yes
        ;;
 x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
        # Target: FreeBSD/amd64
-       gdb_target_obs="amd64-tdep.o arch/amd64.o amd64-fbsd-tdep.o i386-tdep.o \
-                       i386.o i387-tdep.o i386-bsd-tdep.o i386-fbsd-tdep.o \
-                       fbsd-tdep.o solib-svr4.o"
+       gdb_target_obs="amd64-fbsd-tdep.o ${i386_tobjs} \
+                       i386-bsd-tdep.o i386-fbsd-tdep.o"
        ;;
 x86_64-*-mingw* | x86_64-*-cygwin*)
         # Target: MingW/amd64
-       gdb_target_obs="amd64-tdep.o arch/amd64.o amd64-windows-tdep.o \
-                        i386-tdep.o i386.o i386-cygwin-tdep.o i387-tdep.o \
+       gdb_target_obs="amd64-windows-tdep.o \
+                        ${i386_tobjs} i386-cygwin-tdep.o \
                         windows-tdep.o"
        build_gdbserver=yes
         ;;
 x86_64-*-netbsd* | x86_64-*-knetbsd*-gnu)
        # Target: NetBSD/amd64
-       gdb_target_obs="amd64-tdep.o arch/amd64.o amd64-nbsd-tdep.o i386-tdep.o \
-                       i386.o i387-tdep.o nbsd-tdep.o solib-svr4.o"
+       gdb_target_obs="amd64-nbsd-tdep.o ${i386_tobjs}"
        ;;
 x86_64-*-openbsd*)
        # Target: OpenBSD/amd64
-       gdb_target_obs="amd64-tdep.o arch/amd64.o amd64-obsd-tdep.o i386-tdep.o \
-                       i387-tdep.o i386-bsd-tdep.o i386-obsd-tdep.o \
-                       i386.o obsd-tdep.o bsd-uthread.o solib-svr4.o"
+       gdb_target_obs="amd64-obsd-tdep.o ${i386_tobjs} \
+                       i386-bsd-tdep.o i386-obsd-tdep.o \
+                       bsd-uthread.o"
        ;;
 x86_64-*-rtems*)
-       gdb_target_obs="amd64-tdep.o arch/amd64.o i386-tdep.o i386.o i387-tdep.o \
-                       i386-bsd-tdep.o"
+       gdb_target_obs="${amd64_tobjs} ${i386_tobjs} i386-bsd-tdep.o"
        ;;
 xtensa*-*-linux*)      gdb_target=linux
        # Target: GNU/Linux Xtensa
-       gdb_target_obs="xtensa-tdep.o xtensa-config.o xtensa-linux-tdep.o \
-                       solib-svr4.o symfile-mem.o linux-tdep.o"
+       gdb_target_obs="xtensa-linux-tdep.o symfile-mem.o linux-tdep.o"
        build_gdbserver=yes
        ;;
-xtensa*)
-       # Target: Tensilica Xtensa processors
-       gdb_target_obs="xtensa-tdep.o xtensa-config.o solib-svr4.o"
-       ;;
 
 esac
 
+# Put them together.
+
+gdb_target_obs="${cpu_obs} ${os_obs} ${gdb_target_obs}"
+
 # map target onto default OS ABI
 
 case "${targ}" in