1999-05-03 15:29:11 +08:00
|
|
|
/* bfd back-end for mips support
|
2002-03-14 18:38:31 +08:00
|
|
|
Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2002
|
2001-03-09 05:04:02 +08:00
|
|
|
Free Software Foundation, Inc.
|
1999-05-03 15:29:11 +08:00
|
|
|
Written by Steve Chamberlain of Cygnus Support.
|
|
|
|
|
|
|
|
This file is part of BFD, the Binary File Descriptor library.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|
|
|
|
|
|
|
#include "bfd.h"
|
|
|
|
#include "sysdep.h"
|
|
|
|
#include "libbfd.h"
|
|
|
|
|
2002-03-28 11:27:46 +08:00
|
|
|
static const bfd_arch_info_type *mips_compatible
|
|
|
|
PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
|
|
|
|
|
2002-03-14 18:38:31 +08:00
|
|
|
/* The default routine tests bits_per_word, which is wrong on mips as
|
|
|
|
mips word size doesn't correlate with reloc size. */
|
|
|
|
|
2002-03-28 11:27:46 +08:00
|
|
|
static const bfd_arch_info_type *
|
2002-03-14 18:38:31 +08:00
|
|
|
mips_compatible (a, b)
|
|
|
|
const bfd_arch_info_type *a;
|
|
|
|
const bfd_arch_info_type *b;
|
|
|
|
{
|
|
|
|
if (a->arch != b->arch)
|
|
|
|
return NULL;
|
|
|
|
|
2002-05-20 05:06:34 +08:00
|
|
|
/* Machine compatibility is checked in
|
|
|
|
_bfd_mips_elf_merge_private_bfd_data. */
|
2002-03-14 18:38:31 +08:00
|
|
|
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
#define N(BITS_WORD, BITS_ADDR, NUMBER, PRINT, DEFAULT, NEXT) \
|
|
|
|
{ \
|
|
|
|
BITS_WORD, /* bits in a word */ \
|
|
|
|
BITS_ADDR, /* bits in an address */ \
|
|
|
|
8, /* 8 bits in a byte */ \
|
|
|
|
bfd_arch_mips, \
|
|
|
|
NUMBER, \
|
|
|
|
"mips", \
|
|
|
|
PRINT, \
|
|
|
|
3, \
|
|
|
|
DEFAULT, \
|
2002-04-04 22:04:39 +08:00
|
|
|
mips_compatible, \
|
1999-05-03 15:29:11 +08:00
|
|
|
bfd_default_scan, \
|
|
|
|
NEXT, \
|
|
|
|
}
|
|
|
|
|
2000-12-02 05:35:38 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
I_mips3000,
|
|
|
|
I_mips3900,
|
|
|
|
I_mips4000,
|
|
|
|
I_mips4010,
|
|
|
|
I_mips4100,
|
|
|
|
I_mips4111,
|
2002-09-30 19:53:56 +08:00
|
|
|
I_mips4120,
|
2000-12-02 05:35:38 +08:00
|
|
|
I_mips4300,
|
|
|
|
I_mips4400,
|
|
|
|
I_mips4600,
|
|
|
|
I_mips4650,
|
|
|
|
I_mips5000,
|
2002-09-30 19:53:56 +08:00
|
|
|
I_mips5400,
|
|
|
|
I_mips5500,
|
2000-12-02 05:35:38 +08:00
|
|
|
I_mips6000,
|
2003-07-15 15:50:39 +08:00
|
|
|
I_mips7000,
|
2000-12-02 05:35:38 +08:00
|
|
|
I_mips8000,
|
|
|
|
I_mips10000,
|
2001-05-24 01:26:40 +08:00
|
|
|
I_mips12000,
|
2000-12-02 05:35:38 +08:00
|
|
|
I_mips16,
|
2000-12-02 08:55:22 +08:00
|
|
|
I_mips5,
|
2001-09-01 05:24:28 +08:00
|
|
|
I_mipsisa32,
|
[ bfd/ChangeLog ]
2002-12-30 Chris Demetriou <cgd@broadcom.com>
* aoutx.h (NAME(aout,machine_type)): Add bfd_mach_mipsisa32r2 case.
* archures.c (bfd_mach_mipsisa32r2): New define.
* bfd-in2.h: Regenerate.
* cpu-mips.c (I_mipsisa32r2): New enum value.
(arch_info_struct): Add entry for I_mipsisa32r2.
* elfxx-mips.c (elf_mips_isa, _bfd_elf_mips_mach)
(_bfd_mips_elf_print_private_bfd_data): Handle E_MIPS_ARCH_32R2.
(_bfd_mips_elf_final_write_processing): Add
bfd_mach_mipsisa32r2 case.
(_bfd_mips_elf_merge_private_bfd_data): Handle merging of
binaries marked as using MIPS32 Release 2.
[ binutils/ChangeLog ]
2002-12-30 Chris Demetriou <cgd@broadcom.com>
* doc/binutils.texi (objdump): Note MIPS HWR (Hardware Register)
changes in MIPS -M options.
[ gas/ChangeLog ]
2002-12-30 Chris Demetriou <cgd@broadcom.com>
* configure.in: Recognize mipsisa32r2, mipsisa32r2el, and
CPU variants.
* configure: Regenerate.
* config/tc-mips.c (ISA_HAS_DROR, ISA_HAS_ROR): New defines.
(macro_build): Handle "K" operand.
(macro2): Use ISA_HAS_DROR and ISA_HAS_ROR in the places where
CPU_HAS_DROR and CPU_HAS_ROR are currently used.
(mips_ip): New variable "lastpos", and implement "+A", "+B",
and "+C" operands for MIPS32 Release 2 ins/ext instructions.
Implement "K" operand for MIPS32 Release 2 rdhwr instruction.
(validate_mips_insn): Implement "+" as a way to extend the
allowed operands, and implement "K", "+A", "+B", and "+C"
operands.
(OPTION_MIPS32R2): New define.
(md_longopts): Add entry for OPTION_MIPS32R2.
(OPTION_ELF_BASE): Adjust to accomodate OPTIONS_MIPS32R2.
(md_parse_option): Handle OPTION_MIPS32R2.
(s_mipsset): Reimplement handling of ".set mipsN" options
and add support for ".set mips32r2".
(mips_cpu_info_table): Add entry for "mips32r2" (MIPS32 Release 2).
(md_show_usage): Document "-mips32r2" option.
* doc/as.texinfo: Document "-mips32r2" option.
* doc/c-mips.texi: Likewise.
[ gas/testsuite/ChangeLog ]
2002-12-30 Chris Demetriou <cgd@broadcom.com>
* gas/mips/cp0-names-mips32r2.d: New test.
* gas/mips/hwr-names-mips32r2.d: New test.
* gas/mips/hwr-names-numeric.d: New test.
* gas/mips/hwr-names.s: New test source file.
* gas/mips/mips32r2.d: New test.
* gas/mips/mips32r2.s: New test source file.
* gas/mips/mips32r2-ill.l: New test.
* gas/mips/mips32r2-ill.s: New test source file.
* gas/mips/mips.exp: Add mips32r2 architecture data array
entry. Run new tests mentioned above.
[ include/elf/ChangeLog ]
2002-12-30 Chris Demetriou <cgd@broadcom.com>
* mips.h (E_MIPS_ARCH_32R2): New define.
[ include/opcode/ChangeLog ]
2002-12-30 Chris Demetriou <cgd@broadcom.com>
* mips.h: Document "+" as the start of two-character operand
type names, and add new "K", "+A", "+B", and "+C" operand types.
(OP_MASK_INSMSB, OP_SH_INSMSB, OP_MASK_EXTMSB)
(OP_SH_EXTMSB, INSN_ISA32R2, ISA_MIPS32R2, CPU_MIPS32R2): New
defines.
[ opcodes/ChangeLog ]
2002-12-30 Chris Demetriou <cgd@broadcom.com>
* mips-dis.c (mips_cp0_names_mips3264r2, mips_hwr_names_numeric)
(mips_hwr_names_mips3264r2): New arrays.
(mips_arch_choice): New "hwr_names" member.
(mips_arch_choices): Adjust for structure change, and add a new
entry for "mips32r2" ISA.
(mips_hwr_names): New variable.
(set_default_mips_dis_options): Set mips_hwr_names.
(parse_mips_dis_option): New "hwr-names" option which sets
mips_hwr_names, and adjust "reg-names=ARCH" to set mips_hwr_names.
(print_insn_arg): Change return type to "int"
and use that to indicate number of characters consumed.
Add support for "+" operand extension character, "+A", "+B",
"+C", and "K" operands.
(print_insn_mips): Adjust for changes to print_insn_arg.
(print_mips_disassembler_options): Adjust for "hwr-names"
addition and "reg-names" change.
* mips-opc (I33): New define (shorthand for INSN_ISA32R2).
(mips_builtin_opcodes): Note that "nop" and "ssnop" are special
forms of "sll". Add new MIPS32 Release 2 instructions: ehb,
di, ei, ext, ins, jr.hb, jalr.hb, mfhc1, mfhc2, mthc1, mthc2,
rdhwr, rdpgpr, seb, seh, synci, wrpgpr, wsbh.
Note that hardware rotate instructions (ror, rorv) can be
used on MIPS32 Release 2, and add the official mnemonics
for them (rotr, rotrv) and the similar "rotl" mnemonic for
left-rotate.
2002-12-31 15:29:29 +08:00
|
|
|
I_mipsisa32r2,
|
2001-09-01 05:24:28 +08:00
|
|
|
I_mipsisa64,
|
2000-12-02 09:10:33 +08:00
|
|
|
I_sb1,
|
1999-05-03 15:29:11 +08:00
|
|
|
};
|
|
|
|
|
2000-12-02 05:35:38 +08:00
|
|
|
#define NN(index) (&arch_info_struct[(index) + 1])
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2000-11-17 04:48:09 +08:00
|
|
|
static const bfd_arch_info_type arch_info_struct[] =
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2002-11-30 16:39:46 +08:00
|
|
|
N (32, 32, bfd_mach_mips3000, "mips:3000", FALSE, NN(I_mips3000)),
|
|
|
|
N (32, 32, bfd_mach_mips3900, "mips:3900", FALSE, NN(I_mips3900)),
|
|
|
|
N (64, 64, bfd_mach_mips4000, "mips:4000", FALSE, NN(I_mips4000)),
|
|
|
|
N (64, 64, bfd_mach_mips4010, "mips:4010", FALSE, NN(I_mips4010)),
|
|
|
|
N (64, 64, bfd_mach_mips4100, "mips:4100", FALSE, NN(I_mips4100)),
|
|
|
|
N (64, 64, bfd_mach_mips4111, "mips:4111", FALSE, NN(I_mips4111)),
|
|
|
|
N (64, 64, bfd_mach_mips4120, "mips:4120", FALSE, NN(I_mips4120)),
|
|
|
|
N (64, 64, bfd_mach_mips4300, "mips:4300", FALSE, NN(I_mips4300)),
|
|
|
|
N (64, 64, bfd_mach_mips4400, "mips:4400", FALSE, NN(I_mips4400)),
|
|
|
|
N (64, 64, bfd_mach_mips4600, "mips:4600", FALSE, NN(I_mips4600)),
|
|
|
|
N (64, 64, bfd_mach_mips4650, "mips:4650", FALSE, NN(I_mips4650)),
|
|
|
|
N (64, 64, bfd_mach_mips5000, "mips:5000", FALSE, NN(I_mips5000)),
|
|
|
|
N (64, 64, bfd_mach_mips5400, "mips:5400", FALSE, NN(I_mips5400)),
|
|
|
|
N (64, 64, bfd_mach_mips5500, "mips:5500", FALSE, NN(I_mips5500)),
|
|
|
|
N (32, 32, bfd_mach_mips6000, "mips:6000", FALSE, NN(I_mips6000)),
|
2003-07-15 15:50:39 +08:00
|
|
|
N (64, 64, bfd_mach_mips7000, "mips:7000", FALSE, NN(I_mips7000)),
|
2002-11-30 16:39:46 +08:00
|
|
|
N (64, 64, bfd_mach_mips8000, "mips:8000", FALSE, NN(I_mips8000)),
|
|
|
|
N (64, 64, bfd_mach_mips10000,"mips:10000", FALSE, NN(I_mips10000)),
|
|
|
|
N (64, 64, bfd_mach_mips12000,"mips:12000", FALSE, NN(I_mips12000)),
|
|
|
|
N (64, 64, bfd_mach_mips16, "mips:16", FALSE, NN(I_mips16)),
|
|
|
|
N (64, 64, bfd_mach_mips5, "mips:mips5", FALSE, NN(I_mips5)),
|
|
|
|
N (32, 32, bfd_mach_mipsisa32, "mips:isa32", FALSE, NN(I_mipsisa32)),
|
[ bfd/ChangeLog ]
2002-12-30 Chris Demetriou <cgd@broadcom.com>
* aoutx.h (NAME(aout,machine_type)): Add bfd_mach_mipsisa32r2 case.
* archures.c (bfd_mach_mipsisa32r2): New define.
* bfd-in2.h: Regenerate.
* cpu-mips.c (I_mipsisa32r2): New enum value.
(arch_info_struct): Add entry for I_mipsisa32r2.
* elfxx-mips.c (elf_mips_isa, _bfd_elf_mips_mach)
(_bfd_mips_elf_print_private_bfd_data): Handle E_MIPS_ARCH_32R2.
(_bfd_mips_elf_final_write_processing): Add
bfd_mach_mipsisa32r2 case.
(_bfd_mips_elf_merge_private_bfd_data): Handle merging of
binaries marked as using MIPS32 Release 2.
[ binutils/ChangeLog ]
2002-12-30 Chris Demetriou <cgd@broadcom.com>
* doc/binutils.texi (objdump): Note MIPS HWR (Hardware Register)
changes in MIPS -M options.
[ gas/ChangeLog ]
2002-12-30 Chris Demetriou <cgd@broadcom.com>
* configure.in: Recognize mipsisa32r2, mipsisa32r2el, and
CPU variants.
* configure: Regenerate.
* config/tc-mips.c (ISA_HAS_DROR, ISA_HAS_ROR): New defines.
(macro_build): Handle "K" operand.
(macro2): Use ISA_HAS_DROR and ISA_HAS_ROR in the places where
CPU_HAS_DROR and CPU_HAS_ROR are currently used.
(mips_ip): New variable "lastpos", and implement "+A", "+B",
and "+C" operands for MIPS32 Release 2 ins/ext instructions.
Implement "K" operand for MIPS32 Release 2 rdhwr instruction.
(validate_mips_insn): Implement "+" as a way to extend the
allowed operands, and implement "K", "+A", "+B", and "+C"
operands.
(OPTION_MIPS32R2): New define.
(md_longopts): Add entry for OPTION_MIPS32R2.
(OPTION_ELF_BASE): Adjust to accomodate OPTIONS_MIPS32R2.
(md_parse_option): Handle OPTION_MIPS32R2.
(s_mipsset): Reimplement handling of ".set mipsN" options
and add support for ".set mips32r2".
(mips_cpu_info_table): Add entry for "mips32r2" (MIPS32 Release 2).
(md_show_usage): Document "-mips32r2" option.
* doc/as.texinfo: Document "-mips32r2" option.
* doc/c-mips.texi: Likewise.
[ gas/testsuite/ChangeLog ]
2002-12-30 Chris Demetriou <cgd@broadcom.com>
* gas/mips/cp0-names-mips32r2.d: New test.
* gas/mips/hwr-names-mips32r2.d: New test.
* gas/mips/hwr-names-numeric.d: New test.
* gas/mips/hwr-names.s: New test source file.
* gas/mips/mips32r2.d: New test.
* gas/mips/mips32r2.s: New test source file.
* gas/mips/mips32r2-ill.l: New test.
* gas/mips/mips32r2-ill.s: New test source file.
* gas/mips/mips.exp: Add mips32r2 architecture data array
entry. Run new tests mentioned above.
[ include/elf/ChangeLog ]
2002-12-30 Chris Demetriou <cgd@broadcom.com>
* mips.h (E_MIPS_ARCH_32R2): New define.
[ include/opcode/ChangeLog ]
2002-12-30 Chris Demetriou <cgd@broadcom.com>
* mips.h: Document "+" as the start of two-character operand
type names, and add new "K", "+A", "+B", and "+C" operand types.
(OP_MASK_INSMSB, OP_SH_INSMSB, OP_MASK_EXTMSB)
(OP_SH_EXTMSB, INSN_ISA32R2, ISA_MIPS32R2, CPU_MIPS32R2): New
defines.
[ opcodes/ChangeLog ]
2002-12-30 Chris Demetriou <cgd@broadcom.com>
* mips-dis.c (mips_cp0_names_mips3264r2, mips_hwr_names_numeric)
(mips_hwr_names_mips3264r2): New arrays.
(mips_arch_choice): New "hwr_names" member.
(mips_arch_choices): Adjust for structure change, and add a new
entry for "mips32r2" ISA.
(mips_hwr_names): New variable.
(set_default_mips_dis_options): Set mips_hwr_names.
(parse_mips_dis_option): New "hwr-names" option which sets
mips_hwr_names, and adjust "reg-names=ARCH" to set mips_hwr_names.
(print_insn_arg): Change return type to "int"
and use that to indicate number of characters consumed.
Add support for "+" operand extension character, "+A", "+B",
"+C", and "K" operands.
(print_insn_mips): Adjust for changes to print_insn_arg.
(print_mips_disassembler_options): Adjust for "hwr-names"
addition and "reg-names" change.
* mips-opc (I33): New define (shorthand for INSN_ISA32R2).
(mips_builtin_opcodes): Note that "nop" and "ssnop" are special
forms of "sll". Add new MIPS32 Release 2 instructions: ehb,
di, ei, ext, ins, jr.hb, jalr.hb, mfhc1, mfhc2, mthc1, mthc2,
rdhwr, rdpgpr, seb, seh, synci, wrpgpr, wsbh.
Note that hardware rotate instructions (ror, rorv) can be
used on MIPS32 Release 2, and add the official mnemonics
for them (rotr, rotrv) and the similar "rotl" mnemonic for
left-rotate.
2002-12-31 15:29:29 +08:00
|
|
|
N (32, 32, bfd_mach_mipsisa32r2,"mips:isa32r2", FALSE, NN(I_mipsisa32r2)),
|
2002-11-30 16:39:46 +08:00
|
|
|
N (64, 64, bfd_mach_mipsisa64, "mips:isa64", FALSE, NN(I_mipsisa64)),
|
|
|
|
N (64, 64, bfd_mach_mips_sb1, "mips:sb1", FALSE, 0),
|
1999-05-03 15:29:11 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* The default architecture is mips:3000, but with a machine number of
|
|
|
|
zero. This lets the linker distinguish between a default setting
|
|
|
|
of mips, and an explicit setting of mips:3000. */
|
|
|
|
|
|
|
|
const bfd_arch_info_type bfd_mips_arch =
|
2002-11-30 16:39:46 +08:00
|
|
|
N (32, 32, 0, "mips", TRUE, &arch_info_struct[0]);
|