aboutsummaryrefslogtreecommitdiff
path: root/bfd/archures.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1995-09-06 22:53:43 +0000
committerIan Lance Taylor <ian@airs.com>1995-09-06 22:53:43 +0000
commitb7577823b60110d3b33ac7753e68a0291f0b132a (patch)
tree2889e39d803567e04add5e03ef7fcf6302651c52 /bfd/archures.c
parentdd6ed5ab2ddcf5b307b5b847ff336ff51e9d3974 (diff)
downloadgdb-b7577823b60110d3b33ac7753e68a0291f0b132a.zip
gdb-b7577823b60110d3b33ac7753e68a0291f0b132a.tar.gz
gdb-b7577823b60110d3b33ac7753e68a0291f0b132a.tar.bz2
* configure.in: Call AC_CONFIG_HEADER. Substitute
HOST_64BIT_LONG. Check that various header files exist. Check that fcntl exists. Call BFD_BINARY_FOPEN. Check whether malloc and/or free need to be declared. Don't make a link to sysdep.h. Define TRAD_HEADER for various hosts. * configure: Rebuild. * configure.host: Don't set my_host. Add definitions taken from host header files for various entries. Remove entries which now do nothing. * acconfig.h: New file. * config.h.in: New file, built by autoheader. * sysdep.h: New file. * Makefile.in (do_distclean): Don't remove sysdep.h. (RECONFIG): Remove. (LOCAL_H_DEPS): New variable. ($(BFD_LIBS)): Use $(LOCAL_H_DEPS) rather than libbfd.h and $(RECONFIG). ($(BFD_MACHINES), $(BFD_BACKENDS)): Likewise. ($(OPTIONAL_BACKENDS)): Likewise. (stmp-bfd.h): Just substitute for BFD_HOST_64BIT_LONG, rather than looking through sysdep.h. * bfd-in.h (BFD_HOST_64BIT_LONG): Define; set by Makefile. (BFD_HOST_64_BIT): Define based on BFD_HOST_64BIT_LONG. (fprintf_vma, sprintf_vma): Likewise. (int64_type, uint64_type): Don't define. * bfd-in2.h: Rebuild. * archures.c, bfd.c, srec.c: Include <ctype.h>. * elfcore.h: Check HAVE_SYS_PROCFS_H rather than HAVE_PROCFS. * lynx-core.c: Include stuff from old hosts/lynx.h. * opncls.c (bfd_fdopenr): Check HAVE_FNCTL and defined (F_GETFL), rather than NO_FCNTL. * targets.c (bfd_target_list): Check HOST_HPPAHPUX and ! __STDC__ rather than NATIVE_HPPAHPUX_COMPILER. * trad-core.c: Don't include <errno.h>. Include TRAD_HEADER if it is defined. * hosts/*.h: Remove all header files which merely include, declare, and define things. Leave header files which define information needed by trad-core.c.
Diffstat (limited to 'bfd/archures.c')
-rw-r--r--bfd/archures.c188
1 files changed, 105 insertions, 83 deletions
diff --git a/bfd/archures.c b/bfd/archures.c
index a249ad0..1b8f58e 100644
--- a/bfd/archures.c
+++ b/bfd/archures.c
@@ -1,5 +1,5 @@
/* BFD library support routines for architectures.
- Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc.
+ Copyright (C) 1990, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
Hacked by John Gilmore and Steve Chamberlain of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -16,7 +16,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/*
@@ -87,6 +87,8 @@ DESCRIPTION
.
. bfd_arch_a29k, {* AMD 29000 *}
. bfd_arch_sparc, {* SPARC *}
+.#define bfd_mach_sparc 1
+.#define bfd_mach_sparc64 2
. bfd_arch_mips, {* MIPS Rxxxx *}
. bfd_arch_i386, {* Intel 386 *}
. bfd_arch_we32k, {* AT&T WE32xxx *}
@@ -111,11 +113,16 @@ DESCRIPTION
. bfd_arch_alpha, {* Dec Alpha *}
. bfd_arch_arm, {* Advanced Risc Machines ARM *}
. bfd_arch_ns32k, {* National Semiconductors ns32000 *}
+. bfd_arch_w65, {* WDC 65816 *}
. {* start-sanitize-rce *}
. bfd_arch_rce, {* Motorola RCE *}
. {* end-sanitize-rce *}
. {* start-sanitize-arc *}
. bfd_arch_arc, {* Argonaut RISC Core *}
+.#define bfd_mach_arc_base 0
+.#define bfd_mach_arc_host 1
+.#define bfd_mach_arc_graphics 2
+.#define bfd_mach_arc_audio 3
. {* end-sanitize-arc *}
. bfd_arch_last
. };
@@ -126,6 +133,7 @@ DESCRIPTION
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
+#include <ctype.h>
/*
@@ -246,6 +254,14 @@ bfd_arch_get_compatible (abfd, bbfd)
CONST bfd *abfd;
CONST bfd *bbfd;
{
+ /* If either architecture is unknown, then all we can do is assume
+ the user knows what he's doing. */
+ if (abfd->arch_info->arch == bfd_arch_unknown)
+ return bbfd->arch_info;
+ if (bbfd->arch_info->arch == bfd_arch_unknown)
+ return abfd->arch_info;
+
+ /* Otherwise architecture-specific code has to decide. */
return abfd->arch_info->compatible(abfd->arch_info,bbfd->arch_info);
}
@@ -452,6 +468,7 @@ extern void bfd_vax_arch PARAMS ((void));
extern void bfd_we32k_arch PARAMS ((void));
extern void bfd_z8k_arch PARAMS ((void));
extern void bfd_ns32k_arch PARAMS ((void));
+extern void bfd_w65_arch PARAMS ((void));
static void (*const archures_init_table[]) PARAMS ((void)) =
{
@@ -483,6 +500,7 @@ static void (*const archures_init_table[]) PARAMS ((void)) =
bfd_we32k_arch,
bfd_z8k_arch,
bfd_ns32k_arch,
+ bfd_w65_arch,
#endif
0
};
@@ -578,108 +596,112 @@ bfd_default_scan (info, string)
CONST struct bfd_arch_info *info;
CONST char *string;
{
- CONST char *ptr_src;
- CONST char *ptr_tst;
- unsigned long number;
- enum bfd_architecture arch;
- /* First test for an exact match */
- if (strcmp(string, info->printable_name) == 0) return true;
-
- /* See how much of the supplied string matches with the
- architecture, eg the string m68k:68020 would match the 68k entry
- up to the :, then we get left with the machine number */
-
- for (ptr_src = string,
- ptr_tst = info->arch_name;
- *ptr_src && *ptr_tst;
- ptr_src++,
- ptr_tst++)
+ CONST char *ptr_src;
+ CONST char *ptr_tst;
+ unsigned long number;
+ enum bfd_architecture arch;
+ /* First test for an exact match */
+ if (strcmp(string, info->printable_name) == 0) return true;
+
+ /* See how much of the supplied string matches with the
+ architecture, eg the string m68k:68020 would match the 68k entry
+ up to the :, then we get left with the machine number */
+
+ for (ptr_src = string,
+ ptr_tst = info->arch_name;
+ *ptr_src && *ptr_tst;
+ ptr_src++,
+ ptr_tst++)
{
- if (*ptr_src != *ptr_tst) break;
+ if (*ptr_src != *ptr_tst) break;
}
- /* Chewed up as much of the architecture as will match, skip any
- colons */
- if (*ptr_src == ':') ptr_src++;
+ /* Chewed up as much of the architecture as will match, skip any
+ colons */
+ if (*ptr_src == ':') ptr_src++;
- if (*ptr_src == 0) {
- /* nothing more, then only keep this one if it is the default
- machine for this architecture */
- return info->the_default;
- }
- number = 0;
- while (isdigit(*ptr_src)) {
- number = number * 10 + *ptr_src - '0';
- ptr_src++;
- }
+ if (*ptr_src == 0) {
+ /* nothing more, then only keep this one if it is the default
+ machine for this architecture */
+ return info->the_default;
+ }
+ number = 0;
+ while (isdigit(*ptr_src)) {
+ number = number * 10 + *ptr_src - '0';
+ ptr_src++;
+ }
- switch (number)
+ switch (number)
{
- case 300:
+ case 65:
+ arch = bfd_arch_w65;
+ break;
+
+ case 300:
arch = bfd_arch_h8300;
break;
- case 500:
+ case 500:
arch = bfd_arch_h8500;
break;
- case 68010:
- case 68020:
- case 68030:
- case 68040:
- case 68332:
- case 68050:
- case 68000:
- arch = bfd_arch_m68k;
- break;
- case 386:
- case 80386:
- case 486:
- case 80486:
- arch = bfd_arch_i386;
- break;
- case 29000:
- arch = bfd_arch_a29k;
- break;
+ case 68010:
+ case 68020:
+ case 68030:
+ case 68040:
+ case 68332:
+ case 68050:
+ case 68000:
+ arch = bfd_arch_m68k;
+ break;
+ case 386:
+ case 80386:
+ case 486:
+ case 80486:
+ arch = bfd_arch_i386;
+ break;
+ case 29000:
+ arch = bfd_arch_a29k;
+ break;
- case 8000:
- arch = bfd_arch_z8k;
- break;
+ case 8000:
+ arch = bfd_arch_z8k;
+ break;
- case 32000:
- arch = bfd_arch_we32k;
- break;
+ case 32000:
+ arch = bfd_arch_we32k;
+ break;
- case 860:
- case 80860:
- arch = bfd_arch_i860;
- break;
- case 960:
- case 80960:
- arch = bfd_arch_i960;
- break;
+ case 860:
+ case 80860:
+ arch = bfd_arch_i860;
+ break;
+ case 960:
+ case 80960:
+ arch = bfd_arch_i960;
+ break;
- case 2000:
- case 3000:
- case 4000:
- case 4400:
- arch = bfd_arch_mips;
- break;
+ case 2000:
+ case 3000:
+ case 4000:
+ case 4400:
+ arch = bfd_arch_mips;
+ break;
- case 6000:
- arch = bfd_arch_rs6000;
- break;
+ case 6000:
+ arch = bfd_arch_rs6000;
+ break;
- default:
- return false;
+ default:
+ return false;
}
- if (arch != info->arch)
- return false;
+ if (arch != info->arch)
+ return false;
- if (number != info->mach)
- return false;
+ if (number != info->mach)
+ return false;
- return true;
+ return true;
}