Use config.bfd to determine the default architecture and byte order.
Flush all BYTE_ORDER_DEFAULT macros from mips. Can rely on BFD's value.
This commit is contained in:
parent
e28d556f6b
commit
1ba607adba
10 changed files with 492 additions and 345 deletions
|
@ -1,3 +1,21 @@
|
||||||
|
Wed Jun 7 18:27:51 2000 Andrew Cagney <cagney@b1.cygnus.com>
|
||||||
|
|
||||||
|
* configure.in (DEFAULT_BFD_ARCH, DEFAULT_BFD_VEC): Use config.bfd
|
||||||
|
to determine the default architecture / target.
|
||||||
|
* acconfig (DEFAULT_BFD_ARCH, DEFAULT_BFD_VEC): Add.
|
||||||
|
* configure, config.in: Regenerate.
|
||||||
|
|
||||||
|
* arch-utils.c (set_endian): Better separate multi-arch and non-
|
||||||
|
multi-arch cases.
|
||||||
|
(set_endian_from_file): Call internal_error when multi-arch.
|
||||||
|
(initialize_current_architecture): Rewrite logic selecting a byte
|
||||||
|
order. Use DEFAULT_BFD_ARCH DEFAULT_BFD_VEC.
|
||||||
|
(version.h): Include.
|
||||||
|
|
||||||
|
* config/mips/tm-mips.h, config/mips/tm-bigmips64.h,
|
||||||
|
config/mips/tm-bigmips.h: Delete definition of
|
||||||
|
TARGET_BYTE_ORDER_DEFAULT.
|
||||||
|
|
||||||
Thu Jun 8 11:41:41 2000 Andrew Cagney <cagney@b1.cygnus.com>
|
Thu Jun 8 11:41:41 2000 Andrew Cagney <cagney@b1.cygnus.com>
|
||||||
|
|
||||||
* infrun.c (follow_inferior_fork): Bad merge from below. Compare
|
* infrun.c (follow_inferior_fork): Bad merge from below. Compare
|
||||||
|
|
10
gdb/TODO
10
gdb/TODO
|
@ -107,6 +107,16 @@ Turns out that ``1998-2000'' isn't considered valid :-(
|
||||||
|
|
||||||
http://sourceware.cygnus.com/ml/gdb-patches/2000-05/msg00467.html
|
http://sourceware.cygnus.com/ml/gdb-patches/2000-05/msg00467.html
|
||||||
|
|
||||||
|
--
|
||||||
|
|
||||||
|
Find something better than DEFAULT_BFD_ARCH, DEFAULT_BFD_VEC to
|
||||||
|
determine the default isa/byte-order.
|
||||||
|
|
||||||
|
--
|
||||||
|
|
||||||
|
Rely on BFD_BIG_ENDIAN and BFD_LITTLE_ENDIAN instead of host dependant
|
||||||
|
BIG_ENDIAN and LITTLE_ENDIAN.
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
||||||
Code Cleanups: General
|
Code Cleanups: General
|
||||||
|
|
|
@ -115,3 +115,9 @@
|
||||||
|
|
||||||
/* Define if gnu-regex.c included with GDB should be used. */
|
/* Define if gnu-regex.c included with GDB should be used. */
|
||||||
#undef USE_INCLUDED_REGEX
|
#undef USE_INCLUDED_REGEX
|
||||||
|
|
||||||
|
/* BFD's default architecture. */
|
||||||
|
#undef DEFAULT_BFD_ARCH
|
||||||
|
|
||||||
|
/* BFD's default target vector. */
|
||||||
|
#undef DEFAULT_BFD_VEC
|
||||||
|
|
|
@ -41,6 +41,8 @@
|
||||||
#include "symfile.h" /* for overlay functions */
|
#include "symfile.h" /* for overlay functions */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
#include "floatformat.h"
|
#include "floatformat.h"
|
||||||
|
|
||||||
/* Convenience macro for allocting typesafe memory. */
|
/* Convenience macro for allocting typesafe memory. */
|
||||||
|
@ -246,6 +248,9 @@ generic_register_convertible_not (num)
|
||||||
#ifndef TARGET_BYTE_ORDER_DEFAULT
|
#ifndef TARGET_BYTE_ORDER_DEFAULT
|
||||||
#define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN /* arbitrary */
|
#define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN /* arbitrary */
|
||||||
#endif
|
#endif
|
||||||
|
/* ``target_byte_order'' is only used when non- multi-arch.
|
||||||
|
Multi-arch targets obtain the current byte order using
|
||||||
|
TARGET_BYTE_ORDER which is controlled by gdbarch.*. */
|
||||||
int target_byte_order = TARGET_BYTE_ORDER_DEFAULT;
|
int target_byte_order = TARGET_BYTE_ORDER_DEFAULT;
|
||||||
int target_byte_order_auto = 1;
|
int target_byte_order_auto = 1;
|
||||||
|
|
||||||
|
@ -287,7 +292,6 @@ set_endian (char *ignore_args, int from_tty, struct cmd_list_element *c)
|
||||||
}
|
}
|
||||||
else if (set_endian_string == endian_little)
|
else if (set_endian_string == endian_little)
|
||||||
{
|
{
|
||||||
target_byte_order = LITTLE_ENDIAN;
|
|
||||||
target_byte_order_auto = 0;
|
target_byte_order_auto = 0;
|
||||||
if (GDB_MULTI_ARCH)
|
if (GDB_MULTI_ARCH)
|
||||||
{
|
{
|
||||||
|
@ -296,10 +300,13 @@ set_endian (char *ignore_args, int from_tty, struct cmd_list_element *c)
|
||||||
info.byte_order = LITTLE_ENDIAN;
|
info.byte_order = LITTLE_ENDIAN;
|
||||||
gdbarch_update (info);
|
gdbarch_update (info);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
target_byte_order = LITTLE_ENDIAN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (set_endian_string == endian_big)
|
else if (set_endian_string == endian_big)
|
||||||
{
|
{
|
||||||
target_byte_order = BIG_ENDIAN;
|
|
||||||
target_byte_order_auto = 0;
|
target_byte_order_auto = 0;
|
||||||
if (GDB_MULTI_ARCH)
|
if (GDB_MULTI_ARCH)
|
||||||
{
|
{
|
||||||
|
@ -308,6 +315,10 @@ set_endian (char *ignore_args, int from_tty, struct cmd_list_element *c)
|
||||||
info.byte_order = BIG_ENDIAN;
|
info.byte_order = BIG_ENDIAN;
|
||||||
gdbarch_update (info);
|
gdbarch_update (info);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
target_byte_order = BIG_ENDIAN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
internal_error ("set_endian: bad value");
|
internal_error ("set_endian: bad value");
|
||||||
|
@ -319,6 +330,8 @@ set_endian (char *ignore_args, int from_tty, struct cmd_list_element *c)
|
||||||
static void
|
static void
|
||||||
set_endian_from_file (bfd *abfd)
|
set_endian_from_file (bfd *abfd)
|
||||||
{
|
{
|
||||||
|
if (GDB_MULTI_ARCH)
|
||||||
|
internal_error ("set_endian_from_file: not for multi-arch");
|
||||||
if (TARGET_BYTE_ORDER_SELECTABLE_P)
|
if (TARGET_BYTE_ORDER_SELECTABLE_P)
|
||||||
{
|
{
|
||||||
int want;
|
int want;
|
||||||
|
@ -547,32 +560,93 @@ set_gdbarch_from_file (abfd)
|
||||||
architecture'' command so that it specifies a list of valid
|
architecture'' command so that it specifies a list of valid
|
||||||
architectures. */
|
architectures. */
|
||||||
|
|
||||||
|
#ifdef DEFAULT_BFD_ARCH
|
||||||
|
extern const bfd_arch_info_type DEFAULT_BFD_ARCH;
|
||||||
|
static const bfd_arch_info_type *default_bfd_arch = &DEFAULT_BFD_ARCH;
|
||||||
|
#else
|
||||||
|
static const bfd_arch_info_type *default_bfd_arch
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEFAULT_BFD_VEC
|
||||||
|
extern const bfd_target DEFAULT_BFD_VEC;
|
||||||
|
static const bfd_target *default_bfd_vec = &DEFAULT_BFD_VEC;
|
||||||
|
#else
|
||||||
|
static const bfd_target *default_bfd_vec;
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
initialize_current_architecture (void)
|
initialize_current_architecture (void)
|
||||||
{
|
{
|
||||||
const char **arches = gdbarch_printable_names ();
|
const char **arches = gdbarch_printable_names ();
|
||||||
const char *chosen = arches[0];
|
|
||||||
|
|
||||||
if (GDB_MULTI_ARCH)
|
/* determine a default architecture and byte order. */
|
||||||
{
|
|
||||||
const char **arch;
|
|
||||||
struct gdbarch_info info;
|
struct gdbarch_info info;
|
||||||
|
memset (&info, 0, sizeof (info));
|
||||||
|
|
||||||
|
/* Find a default architecture. */
|
||||||
|
if (info.bfd_arch_info == NULL
|
||||||
|
&& default_bfd_arch != NULL)
|
||||||
|
info.bfd_arch_info = default_bfd_arch;
|
||||||
|
if (info.bfd_arch_info == NULL)
|
||||||
|
{
|
||||||
|
/* Choose the architecture by taking the first one
|
||||||
|
alphabetically. */
|
||||||
|
const char *chosen = arches[0];
|
||||||
|
const char **arch;
|
||||||
for (arch = arches; *arch != NULL; arch++)
|
for (arch = arches; *arch != NULL; arch++)
|
||||||
{
|
{
|
||||||
/* Choose the first architecture alphabetically. */
|
|
||||||
if (strcmp (*arch, chosen) < 0)
|
if (strcmp (*arch, chosen) < 0)
|
||||||
chosen = *arch;
|
chosen = *arch;
|
||||||
}
|
}
|
||||||
if (chosen == NULL)
|
if (chosen == NULL)
|
||||||
internal_error ("initialize_current_architecture: No arch");
|
internal_error ("initialize_current_architecture: No arch");
|
||||||
memset (&info, 0, sizeof info);
|
|
||||||
info.bfd_arch_info = bfd_scan_arch (chosen);
|
info.bfd_arch_info = bfd_scan_arch (chosen);
|
||||||
if (info.bfd_arch_info == NULL)
|
if (info.bfd_arch_info == NULL)
|
||||||
internal_error ("initialize_current_architecture: Arch not found");
|
internal_error ("initialize_current_architecture: Arch not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* take several guesses at a byte order. */
|
||||||
|
/* NB: can't use TARGET_BYTE_ORDER_DEFAULT as its definition is
|
||||||
|
forced above. */
|
||||||
|
if (info.byte_order == 0
|
||||||
|
&& default_bfd_vec != NULL)
|
||||||
|
{
|
||||||
|
/* Extract BFD's default vector's byte order. */
|
||||||
|
switch (default_bfd_vec->byteorder)
|
||||||
|
{
|
||||||
|
case BFD_ENDIAN_BIG:
|
||||||
|
info.byte_order = BIG_ENDIAN;
|
||||||
|
break;
|
||||||
|
case BFD_ENDIAN_LITTLE:
|
||||||
|
info.byte_order = LITTLE_ENDIAN;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (info.byte_order == 0)
|
||||||
|
{
|
||||||
|
/* look for ``*el-*'' in the target name. */
|
||||||
|
const char *chp;
|
||||||
|
chp = strchr (target_name, '-');
|
||||||
|
if (chp != NULL
|
||||||
|
&& chp - 2 >= target_name
|
||||||
|
&& strncmp (chp - 2, "el", 2) == 0)
|
||||||
|
info.byte_order = LITTLE_ENDIAN;
|
||||||
|
}
|
||||||
|
if (info.byte_order == 0)
|
||||||
|
{
|
||||||
|
/* Wire it to big-endian!!! */
|
||||||
|
info.byte_order = BIG_ENDIAN;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GDB_MULTI_ARCH)
|
||||||
|
{
|
||||||
gdbarch_update (info);
|
gdbarch_update (info);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the ``set architecture'' command prepending ``auto''. */
|
/* Create the ``set architecture'' command appending ``auto'' to the
|
||||||
|
list of architectures. */
|
||||||
{
|
{
|
||||||
struct cmd_list_element *c;
|
struct cmd_list_element *c;
|
||||||
/* Append ``auto''. */
|
/* Append ``auto''. */
|
||||||
|
|
|
@ -135,6 +135,12 @@
|
||||||
/* Define if gnu-regex.c included with GDB should be used. */
|
/* Define if gnu-regex.c included with GDB should be used. */
|
||||||
#undef USE_INCLUDED_REGEX
|
#undef USE_INCLUDED_REGEX
|
||||||
|
|
||||||
|
/* BFD's default architecture. */
|
||||||
|
#undef DEFAULT_BFD_ARCH
|
||||||
|
|
||||||
|
/* BFD's default target vector. */
|
||||||
|
#undef DEFAULT_BFD_VEC
|
||||||
|
|
||||||
/* Define if you have the __argz_count function. */
|
/* Define if you have the __argz_count function. */
|
||||||
#undef HAVE___ARGZ_COUNT
|
#undef HAVE___ARGZ_COUNT
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1990 Free Software Foundation, Inc.
|
/* Copyright (C) 1990, 2000 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
|
|
||||||
|
@ -17,6 +17,4 @@
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN
|
|
||||||
|
|
||||||
#include "mips/tm-mips.h"
|
#include "mips/tm-mips.h"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Target machine parameters for MIPS r4000
|
/* Target machine parameters for MIPS r4000
|
||||||
Copyright 1994 Free Software Foundation, Inc.
|
Copyright 1994, 2000 Free Software Foundation, Inc.
|
||||||
Contributed by Ian Lance Taylor (ian@cygnus.com)
|
Contributed by Ian Lance Taylor (ian@cygnus.com)
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
|
@ -19,6 +19,4 @@
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#define TARGET_BYTE_ORDER_DEFAULT BIG_ENDIAN
|
|
||||||
|
|
||||||
#include "mips/tm-mips64.h"
|
#include "mips/tm-mips64.h"
|
||||||
|
|
|
@ -33,10 +33,6 @@ struct value;
|
||||||
#include "coff/sym.h" /* Needed for PDR below. */
|
#include "coff/sym.h" /* Needed for PDR below. */
|
||||||
#include "coff/symconst.h"
|
#include "coff/symconst.h"
|
||||||
|
|
||||||
#if !defined (TARGET_BYTE_ORDER_DEFAULT)
|
|
||||||
#define TARGET_BYTE_ORDER_DEFAULT LITTLE_ENDIAN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined (GDB_TARGET_IS_MIPS64)
|
#if !defined (GDB_TARGET_IS_MIPS64)
|
||||||
#define GDB_TARGET_IS_MIPS64 0
|
#define GDB_TARGET_IS_MIPS64 0
|
||||||
#endif
|
#endif
|
||||||
|
|
672
gdb/configure
vendored
672
gdb/configure
vendored
File diff suppressed because it is too large
Load diff
|
@ -71,9 +71,22 @@ changequote(,)dnl
|
||||||
|
|
||||||
. ${srcdir}/configure.tgt
|
. ${srcdir}/configure.tgt
|
||||||
|
|
||||||
|
targ=${target} ; . ${srcdir}/../bfd/config.bfd
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
changequote([,])dnl
|
changequote([,])dnl
|
||||||
|
|
||||||
|
dnl use BFD to determine the default architecture and byte order
|
||||||
|
dnl (bfd_vec->byteorder provides the latter).
|
||||||
|
targ=${target}
|
||||||
|
. ${srcdir}/../bfd/config.bfd
|
||||||
|
if test x"${targ_archs}" != x ; then
|
||||||
|
AC_DEFINE_UNQUOTED(DEFAULT_BFD_ARCH, ${targ_archs})
|
||||||
|
fi
|
||||||
|
if test x"${targ_defvec}" != x ; then
|
||||||
|
AC_DEFINE_UNQUOTED(DEFAULT_BFD_VEC, ${targ_defvec})
|
||||||
|
fi
|
||||||
|
|
||||||
AC_PROG_AWK
|
AC_PROG_AWK
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
AC_CHECK_TOOL(AR, ar)
|
AC_CHECK_TOOL(AR, ar)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue