Back to index

cell-binutils  2.17cvs20070401
cpu-mips.c
Go to the documentation of this file.
00001 /* bfd back-end for mips support
00002    Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001,
00003    2002, 2003, 2004 Free Software Foundation, Inc.
00004    Written by Steve Chamberlain of Cygnus Support.
00005 
00006 This file is part of BFD, the Binary File Descriptor library.
00007 
00008 This program is free software; you can redistribute it and/or modify
00009 it under the terms of the GNU General Public License as published by
00010 the Free Software Foundation; either version 2 of the License, or
00011 (at your option) any later version.
00012 
00013 This program is distributed in the hope that it will be useful,
00014 but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 GNU General Public License for more details.
00017 
00018 You should have received a copy of the GNU General Public License
00019 along with this program; if not, write to the Free Software
00020 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00021 
00022 #include "bfd.h"
00023 #include "sysdep.h"
00024 #include "libbfd.h"
00025 
00026 static const bfd_arch_info_type *mips_compatible
00027   (const bfd_arch_info_type *, const bfd_arch_info_type *);
00028 
00029 /* The default routine tests bits_per_word, which is wrong on mips as
00030    mips word size doesn't correlate with reloc size.  */
00031 
00032 static const bfd_arch_info_type *
00033 mips_compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b)
00034 {
00035   if (a->arch != b->arch)
00036     return NULL;
00037 
00038   /* Machine compatibility is checked in
00039      _bfd_mips_elf_merge_private_bfd_data.  */
00040 
00041   return a;
00042 }
00043 
00044 #define N(BITS_WORD, BITS_ADDR, NUMBER, PRINT, DEFAULT, NEXT)         \
00045   {                                              \
00046     BITS_WORD, /*  bits in a word */                    \
00047     BITS_ADDR, /* bits in an address */                 \
00048     8, /* 8 bits in a byte */                           \
00049     bfd_arch_mips,                               \
00050     NUMBER,                                      \
00051     "mips",                                      \
00052     PRINT,                                       \
00053     3,                                           \
00054     DEFAULT,                                     \
00055     mips_compatible,                             \
00056     bfd_default_scan,                                   \
00057     NEXT,                                        \
00058   }
00059 
00060 enum
00061 {
00062   I_mips3000,
00063   I_mips3900,
00064   I_mips4000,
00065   I_mips4010,
00066   I_mips4100,
00067   I_mips4111,
00068   I_mips4120,
00069   I_mips4300,
00070   I_mips4400,
00071   I_mips4600,
00072   I_mips4650,
00073   I_mips5000,
00074   I_mips5400,
00075   I_mips5500,
00076   I_mips6000,
00077   I_mips7000,
00078   I_mips8000,
00079   I_mips9000,
00080   I_mips10000,
00081   I_mips12000,
00082   I_mips16,
00083   I_mips5,
00084   I_mipsisa32,
00085   I_mipsisa32r2,
00086   I_mipsisa64,
00087   I_mipsisa64r2,
00088   I_sb1,
00089 };
00090 
00091 #define NN(index) (&arch_info_struct[(index) + 1])
00092 
00093 static const bfd_arch_info_type arch_info_struct[] =
00094 {
00095   N (32, 32, bfd_mach_mips3000, "mips:3000",      FALSE, NN(I_mips3000)),
00096   N (32, 32, bfd_mach_mips3900, "mips:3900",      FALSE, NN(I_mips3900)),
00097   N (64, 64, bfd_mach_mips4000, "mips:4000",      FALSE, NN(I_mips4000)),
00098   N (64, 64, bfd_mach_mips4010, "mips:4010",      FALSE, NN(I_mips4010)),
00099   N (64, 64, bfd_mach_mips4100, "mips:4100",      FALSE, NN(I_mips4100)),
00100   N (64, 64, bfd_mach_mips4111, "mips:4111",      FALSE, NN(I_mips4111)),
00101   N (64, 64, bfd_mach_mips4120, "mips:4120",      FALSE, NN(I_mips4120)),
00102   N (64, 64, bfd_mach_mips4300, "mips:4300",      FALSE, NN(I_mips4300)),
00103   N (64, 64, bfd_mach_mips4400, "mips:4400",      FALSE, NN(I_mips4400)),
00104   N (64, 64, bfd_mach_mips4600, "mips:4600",      FALSE, NN(I_mips4600)),
00105   N (64, 64, bfd_mach_mips4650, "mips:4650",      FALSE, NN(I_mips4650)),
00106   N (64, 64, bfd_mach_mips5000, "mips:5000",      FALSE, NN(I_mips5000)),
00107   N (64, 64, bfd_mach_mips5400, "mips:5400",      FALSE, NN(I_mips5400)),
00108   N (64, 64, bfd_mach_mips5500, "mips:5500",      FALSE, NN(I_mips5500)),
00109   N (32, 32, bfd_mach_mips6000, "mips:6000",      FALSE, NN(I_mips6000)),
00110   N (64, 64, bfd_mach_mips7000, "mips:7000",      FALSE, NN(I_mips7000)),
00111   N (64, 64, bfd_mach_mips8000, "mips:8000",      FALSE, NN(I_mips8000)),
00112   N (64, 64, bfd_mach_mips9000, "mips:9000",      FALSE, NN(I_mips9000)),
00113   N (64, 64, bfd_mach_mips10000,"mips:10000",     FALSE, NN(I_mips10000)),
00114   N (64, 64, bfd_mach_mips12000,"mips:12000",     FALSE, NN(I_mips12000)),
00115   N (64, 64, bfd_mach_mips16,   "mips:16",        FALSE, NN(I_mips16)),
00116   N (64, 64, bfd_mach_mips5,    "mips:mips5",     FALSE, NN(I_mips5)),
00117   N (32, 32, bfd_mach_mipsisa32,  "mips:isa32",   FALSE, NN(I_mipsisa32)),
00118   N (32, 32, bfd_mach_mipsisa32r2,"mips:isa32r2", FALSE, NN(I_mipsisa32r2)),
00119   N (64, 64, bfd_mach_mipsisa64,  "mips:isa64",   FALSE, NN(I_mipsisa64)),
00120   N (64, 64, bfd_mach_mipsisa64r2,"mips:isa64r2", FALSE, NN(I_mipsisa64r2)),
00121   N (64, 64, bfd_mach_mips_sb1, "mips:sb1",       FALSE, 0),
00122 };
00123 
00124 /* The default architecture is mips:3000, but with a machine number of
00125    zero.  This lets the linker distinguish between a default setting
00126    of mips, and an explicit setting of mips:3000.  */
00127 
00128 const bfd_arch_info_type bfd_mips_arch =
00129 N (32, 32, 0, "mips", TRUE, &arch_info_struct[0]);