From d0c678e6de1230671406e8b9fde61d1d471769c7 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Sat, 17 Nov 2007 01:02:01 +0000 Subject: [PATCH] * configure.ac (--enable-targets): New configure option. Collect gdb_target_obs of multiple targets into TARGET_OBS. Call configure.tgt multiple times, using $targ as operand. * configure.tgt: Operate on $targ instead of $target. * configure: Regenerate. * Makefile.in (ALL_TARGET_OBS): Define. * NEWS: Mention --enable-targets option. --- gdb/ChangeLog | 11 +++++++++ gdb/Makefile.in | 56 ++++++++++++++++++++++++++++++++++++++++++ gdb/NEWS | 5 ++++ gdb/configure | 62 ++++++++++++++++++++++++++++++++++++++++++++--- gdb/configure.ac | 57 ++++++++++++++++++++++++++++++++++++++++--- gdb/configure.tgt | 8 +++--- 6 files changed, 187 insertions(+), 12 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7489ddeab15..edba5453a2f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +2007-11-16 Ulrich Weigand + + * configure.ac (--enable-targets): New configure option. + Collect gdb_target_obs of multiple targets into TARGET_OBS. + Call configure.tgt multiple times, using $targ as operand. + * configure.tgt: Operate on $targ instead of $target. + * configure: Regenerate. + * Makefile.in (ALL_TARGET_OBS): Define. + + * NEWS: Mention --enable-targets option. + 2007-11-16 Ulrich Weigand * mips-tdep.c (show_mipsfpu_command): Do not crash if called when diff --git a/gdb/Makefile.in b/gdb/Makefile.in index e4011fc659a..95b79d03b98 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -431,6 +431,62 @@ SIM_OBS = @SIM_OBS@ # Target-dependent object files. TARGET_OBS = @TARGET_OBS@ +# All target-dependent objects files (used with --enable-targets=all). +ALL_TARGET_OBS = \ + alphabsd-tdep.o alphafbsd-tdep.o alpha-linux-tdep.o alpha-mdebug-tdep.o \ + alphanbsd-tdep.o alphaobsd-tdep.o alpha-osf1-tdep.o alpha-tdep.o \ + amd64fbsd-tdep.o amd64-linux-tdep.o amd64nbsd-tdep.o amd64obsd-tdep.o \ + amd64-sol2-tdep.o amd64-tdep.o \ + armbsd-tdep.o arm-linux-tdep.o armnbsd-tdep.o armobsd-tdep.o \ + arm-tdep.o arm-wince-tdep.o \ + avr-tdep.o \ + cris-tdep.o \ + frv-linux-tdep.o frv-tdep.o \ + h8300-tdep.o \ + hppabsd-tdep.o hppa-hpux-tdep.o hppa-linux-tdep.o hppa-tdep.o \ + i386bsd-tdep.o i386-cygwin-tdep.o i386fbsd-tdep.o i386gnu-tdep.o \ + i386-linux-tdep.o i386nbsd-tdep.o i386-nto-tdep.o i386obsd-tdep.o \ + i386-sol2-tdep.o i386-tdep.o i387-tdep.o \ + ia64-linux-tdep.o ia64-tdep.o \ + iq2000-tdep.o \ + m32c-tdep.o \ + m32r-linux-tdep.o m32r-tdep.o \ + m68hc11-tdep.o \ + m68kbsd-tdep.o m68klinux-tdep.o m68k-tdep.o \ + m88k-tdep.o \ + mep-tdep.o \ + mips64obsd-tdep.o mips-irix-tdep.o mips-linux-tdep.o \ + mipsnbsd-tdep.o mips-tdep.o \ + mn10300-linux-tdep.o mn10300-tdep.o \ + mt-tdep.o \ + nto-tdep.o \ + ppc-linux-tdep.o ppcnbsd-tdep.o ppcobsd-tdep.o ppc-sysv-tdep.o \ + rs6000-aix-tdep.o rs6000-tdep.o \ + s390-tdep.o \ + score-tdep.o \ + sh64-tdep.o sh-linux-tdep.o shnbsd-tdep.o sh-tdep.o \ + sparc64fbsd-tdep.o sparc64-linux-tdep.o sparc64nbsd-tdep.o \ + sparc64obsd-tdep.o sparc64-sol2-tdep.o sparc64-tdep.o \ + sparc-linux-tdep.o sparcnbsd-tdep.o sparcobsd-tdep.o \ + sparc-sol2-tdep.o sparc-tdep.o \ + spu-tdep.o \ + v850-tdep.o \ + vaxnbsd-tdep.o vaxobsd-tdep.o vax-tdep.o \ + xstormy16-tdep.o \ + xtensa-config.o xtensa-tdep.o \ + glibc-tdep.o \ + bsd-uthread.o \ + nbsd-tdep.o obsd-tdep.o \ + sol2-tdep.o \ + solib.o solib-frv.o solib-irix.o solib-svr4.o solib-target.o \ + solib-som.o solib-pa64.o \ + dbug-rom.o dink32-rom.o ppcbug-rom.o m32r-rom.o dsrec.o monitor.o \ + remote-m32r-sdi.o \ + xcoffread.o \ + prologue-value.o \ + symfile-mem.o \ + corelow.o + # Host-dependent makefile fragment comes in here. @host_makefile_frag@ # End of host-dependent makefile fragment diff --git a/gdb/NEWS b/gdb/NEWS index 26a658b0940..22283fd72fe 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -33,6 +33,11 @@ targets even when the libthread_db library is not available. error: "Error trying to get information about dynamic linker". The gdb-6.7 release is also affected. +* GDB now supports the --enable-targets= configure option to allow +building a single GDB executable that supports multiple remote +target architectures. + + *** Changes in GDB 6.7 * Resolved 101 resource leaks, null pointer dereferences, etc. in gdb, diff --git a/gdb/configure b/gdb/configure index d1abf1c6306..ea3e14a13dc 100755 --- a/gdb/configure +++ b/gdb/configure @@ -860,6 +860,7 @@ Optional Features: --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer + --enable-targets alternative target configurations --disable-gdbcli disable command-line interface (CLI) --disable-gdbmi disable machine-interface (MI) --enable-tui enable full-screen terminal user interface (TUI) @@ -3080,6 +3081,20 @@ esac subdirs="$subdirs doc testsuite" +# Check whether to support alternative target configurations +# Check whether --enable-targets or --disable-targets was given. +if test "${enable_targets+set}" = set; then + enableval="$enable_targets" + case "${enableval}" in + yes | "") { { echo "$as_me:$LINENO: error: enable-targets option must specify target names or 'all'" >&5 +echo "$as_me: error: enable-targets option must specify target names or 'all'" >&2;} + { (exit 1); exit 1; }; } + ;; + no) enable_targets= ;; + *) enable_targets=$enableval ;; +esac +fi; + # Provide defaults for some variables set by the per-host and per-target # configuration. gdb_host_obs=posix-hdep.o @@ -3092,7 +3107,49 @@ fi . $srcdir/configure.host -. $srcdir/configure.tgt +# Accumulate some settings from configure.tgt over all enabled targets + +TARGET_OBS= +all_targets= + +for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'` +do + if test "$targ_alias" = "all"; then + all_targets=true + else + # Canonicalize the secondary target names. + result=`$ac_config_sub $targ_alias 2>/dev/null` + if test -n "$result"; then + targ=$result + else + targ=$targ_alias + fi + + . ${srcdir}/configure.tgt + + # Target-specific object files + for i in ${gdb_target_obs}; do + case " $TARGET_OBS " in + *" ${i} "*) ;; + *) + TARGET_OBS="$TARGET_OBS ${i}" + ;; + esac + done + fi +done + +if test x${all_targets} = xtrue; then + TARGET_OBS='$(ALL_TARGET_OBS)' +fi + + + +# For other settings, only the main target counts. +gdb_sim= +gdb_osabi= +build_gdbserver= +targ=$target; . ${srcdir}/configure.tgt # Fetch the default architecture and default target vector from BFD. targ=$target; . $srcdir/../bfd/config.bfd @@ -3116,9 +3173,6 @@ _ACEOF fi -TARGET_OBS="${gdb_target_obs}" - - test "$program_prefix" != NONE && program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. diff --git a/gdb/configure.ac b/gdb/configure.ac index 30df02ed9f2..0f1a3d85e0b 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -91,6 +91,16 @@ esac AC_CONFIG_SUBDIRS(doc testsuite) +# Check whether to support alternative target configurations +AC_ARG_ENABLE(targets, +[ --enable-targets alternative target configurations], +[case "${enableval}" in + yes | "") AC_ERROR(enable-targets option must specify target names or 'all') + ;; + no) enable_targets= ;; + *) enable_targets=$enableval ;; +esac]) + # Provide defaults for some variables set by the per-host and per-target # configuration. gdb_host_obs=posix-hdep.o @@ -103,7 +113,49 @@ fi . $srcdir/configure.host -. $srcdir/configure.tgt +# Accumulate some settings from configure.tgt over all enabled targets + +TARGET_OBS= +all_targets= + +for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'` +do + if test "$targ_alias" = "all"; then + all_targets=true + else + # Canonicalize the secondary target names. + result=`$ac_config_sub $targ_alias 2>/dev/null` + if test -n "$result"; then + targ=$result + else + targ=$targ_alias + fi + + . ${srcdir}/configure.tgt + + # Target-specific object files + for i in ${gdb_target_obs}; do + case " $TARGET_OBS " in + *" ${i} "*) ;; + *) + TARGET_OBS="$TARGET_OBS ${i}" + ;; + esac + done + fi +done + +if test x${all_targets} = xtrue; then + TARGET_OBS='$(ALL_TARGET_OBS)' +fi + +AC_SUBST(TARGET_OBS) + +# For other settings, only the main target counts. +gdb_sim= +gdb_osabi= +build_gdbserver= +targ=$target; . ${srcdir}/configure.tgt # Fetch the default architecture and default target vector from BFD. targ=$target; . $srcdir/../bfd/config.bfd @@ -121,9 +173,6 @@ if test "x$targ_defvec" != x; then [Define to BFD's default target vector. ]) fi -TARGET_OBS="${gdb_target_obs}" -AC_SUBST(TARGET_OBS) - AC_ARG_PROGRAM # The CLI cannot be disabled yet, but may be in the future. diff --git a/gdb/configure.tgt b/gdb/configure.tgt index 69e0b0ebf70..1448f19bf11 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt @@ -7,7 +7,7 @@ # gdb_osabi default OS ABI to use with target # build_gdbserver set to "yes" if gdbserver supports target -case $target in +case $targ in d10v-*-* | \ hppa*-*-hiux* | \ i[34567]86-ncr-* | \ @@ -19,7 +19,7 @@ case $target in rs6000-*-lynxos* | \ sh*-*-pe | \ null) - echo "*** Configuration $target is obsolete." >&2 + echo "*** Configuration $targ is obsolete." >&2 echo "*** Support has been REMOVED." >&2 exit 1 ;; @@ -27,7 +27,7 @@ esac # map target info into gdb names. -case "${target}" in +case "${targ}" in alpha*-*-osf*) # Target: Little-endian Alpha running OSF/1 @@ -521,7 +521,7 @@ esac # map target onto default OS ABI -case "${target}" in +case "${targ}" in *-*-freebsd*) gdb_osabi=GDB_OSABI_FREEBSD_ELF ;; *-*-linux*) gdb_osabi=GDB_OSABI_LINUX ;; *-*-nto*) gdb_osabi=GDB_OSABI_QNXNTO ;; -- 2.30.2