This commit was generated by cvs2svn to compensate for changes in r179404,

which included commits to RCS files with non-trunk default branches.
This commit is contained in:
David E. O'Brien 2008-05-29 02:29:59 +00:00
commit de582f44b4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=179405
39 changed files with 31112 additions and 0 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,126 @@
/* MIPS ELF specific backend routines.
Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
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 "elf/common.h"
#include "elf/internal.h"
extern bfd_boolean _bfd_mips_elf_new_section_hook
(bfd *, asection *);
extern void _bfd_mips_elf_symbol_processing
(bfd *, asymbol *);
extern bfd_boolean _bfd_mips_elf_name_local_section_symbols
(bfd *);
extern bfd_boolean _bfd_mips_elf_section_processing
(bfd *, Elf_Internal_Shdr *);
extern bfd_boolean _bfd_mips_elf_section_from_shdr
(bfd *, Elf_Internal_Shdr *, const char *);
extern bfd_boolean _bfd_mips_elf_fake_sections
(bfd *, Elf_Internal_Shdr *, asection *);
extern bfd_boolean _bfd_mips_elf_section_from_bfd_section
(bfd *, asection *, int *);
extern bfd_boolean _bfd_mips_elf_add_symbol_hook
(bfd *, struct bfd_link_info *, Elf_Internal_Sym *,
const char **, flagword *, asection **, bfd_vma *);
extern bfd_boolean _bfd_mips_elf_link_output_symbol_hook
(struct bfd_link_info *, const char *, Elf_Internal_Sym *,
asection *, struct elf_link_hash_entry *);
extern bfd_boolean _bfd_mips_elf_create_dynamic_sections
(bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_mips_elf_check_relocs
(bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *);
extern bfd_boolean _bfd_mips_elf_adjust_dynamic_symbol
(struct bfd_link_info *, struct elf_link_hash_entry *);
extern bfd_boolean _bfd_mips_elf_always_size_sections
(bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_mips_elf_size_dynamic_sections
(bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_mips_elf_relocate_section
(bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **);
extern bfd_boolean _bfd_mips_elf_finish_dynamic_symbol
(bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
Elf_Internal_Sym *);
extern bfd_boolean _bfd_mips_elf_finish_dynamic_sections
(bfd *, struct bfd_link_info *);
extern void _bfd_mips_elf_final_write_processing
(bfd *, bfd_boolean);
extern int _bfd_mips_elf_additional_program_headers
(bfd *);
extern bfd_boolean _bfd_mips_elf_modify_segment_map
(bfd *, struct bfd_link_info *);
extern asection * _bfd_mips_elf_gc_mark_hook
(asection *, struct bfd_link_info *, Elf_Internal_Rela *,
struct elf_link_hash_entry *, Elf_Internal_Sym *);
extern bfd_boolean _bfd_mips_elf_gc_sweep_hook
(bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *);
extern void _bfd_mips_elf_copy_indirect_symbol
(const struct elf_backend_data *, struct elf_link_hash_entry *,
struct elf_link_hash_entry *);
extern void _bfd_mips_elf_hide_symbol
(struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean);
extern bfd_boolean _bfd_mips_elf_ignore_discarded_relocs
(asection *);
extern bfd_boolean _bfd_mips_elf_find_nearest_line
(bfd *, asection *, asymbol **, bfd_vma, const char **,
const char **, unsigned int *);
extern bfd_boolean _bfd_mips_elf_set_section_contents
(bfd *, asection *, const void *, file_ptr, bfd_size_type);
extern bfd_byte *_bfd_elf_mips_get_relocated_section_contents
(bfd *, struct bfd_link_info *, struct bfd_link_order *,
bfd_byte *, bfd_boolean, asymbol **);
extern struct bfd_link_hash_table *_bfd_mips_elf_link_hash_table_create
(bfd *);
extern bfd_boolean _bfd_mips_elf_final_link
(bfd *, struct bfd_link_info *);
extern bfd_boolean _bfd_mips_elf_merge_private_bfd_data
(bfd *, bfd *);
extern bfd_boolean _bfd_mips_elf_set_private_flags
(bfd *, flagword);
extern bfd_boolean _bfd_mips_elf_print_private_bfd_data
(bfd *, void *);
extern bfd_boolean _bfd_mips_elf_discard_info
(bfd *, struct elf_reloc_cookie *, struct bfd_link_info *);
extern bfd_boolean _bfd_mips_elf_write_section
(bfd *, asection *, bfd_byte *);
extern bfd_boolean _bfd_mips_elf_read_ecoff_info
(bfd *, asection *, struct ecoff_debug_info *);
extern bfd_reloc_status_type _bfd_mips_elf_gprel16_with_gp
(bfd *, asymbol *, arelent *, asection *, bfd_boolean, void *, bfd_vma);
extern bfd_reloc_status_type _bfd_mips_elf32_gprel16_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
extern bfd_reloc_status_type _bfd_mips_elf_hi16_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
extern bfd_reloc_status_type _bfd_mips_elf_got16_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
extern bfd_reloc_status_type _bfd_mips_elf_lo16_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
extern bfd_reloc_status_type _bfd_mips_elf_generic_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
extern unsigned long _bfd_elf_mips_mach
(flagword);
extern bfd_boolean _bfd_mips_relax_section
(bfd *, asection *, struct bfd_link_info *, bfd_boolean *);
extern bfd_vma _bfd_mips_elf_sign_extend
(bfd_vma, int);
extern struct bfd_elf_special_section const _bfd_mips_elf_special_sections[];
#define elf_backend_name_local_section_symbols \
_bfd_mips_elf_name_local_section_symbols
#define elf_backend_special_sections _bfd_mips_elf_special_sections

View File

@ -0,0 +1,12 @@
#include <machine/param.h>
#include <machine/vmparam.h>
#undef ALIGN
#define HOST_PAGE_SIZE NBPG
/* #define HOST_SEGMENT_SIZE NBPG -- we use HOST_DATA_START_ADDR */
#define HOST_MACHINE_ARCH bfd_arch_mips
/* #define HOST_MACHINE_MACHINE */
#define HOST_TEXT_START_ADDR USRTEXT
#define HOST_STACK_END_ADDR USRSTACK
#define NO_CORE_COMMAND

View File

@ -0,0 +1,10 @@
#include <machine/vmparam.h>
#include <machine/machparam.h>
#include <sys/param.h>
#define HOST_PAGE_SIZE NBPG
/* #define HOST_SEGMENT_SIZE NBPG */
#define HOST_MACHINE_ARCH bfd_arch_mips
#define HOST_TEXT_START_ADDR USRTEXT
#define HOST_DATA_START_ADDR USRDATA
#define HOST_STACK_END_ADDR USRSTACK

View File

@ -0,0 +1,12 @@
/* Sony News running NewsOS 3.2. */
#include <sys/param.h>
#include <machine/vmparam.h>
#define HOST_PAGE_SIZE NBPG
#define HOST_MACHINE_ARCH bfd_arch_mips
#define HOST_TEXT_START_ADDR USRTEXT
#define HOST_DATA_START_ADDR USRDATA
#define HOST_STACK_END_ADDR USRSTACK

View File

@ -0,0 +1,30 @@
/* BFD back-end for MIPS PE IMAGE COFF files.
Copyright 1995, 2000, 2001, 2002 Free Software Foundation, Inc.
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"
#define TARGET_SYM mipslpei_vec
#define TARGET_NAME "pei-mips"
#define COFF_IMAGE_WITH_PE
#define PCRELOFFSET TRUE
#define COFF_LONG_SECTION_NAMES
#include "pe-mips.c"

View File

@ -0,0 +1,37 @@
#include "as.h"
#include "emul.h"
static const char *mipsecoff_bfd_name PARAMS ((void));
static const char *
mipsecoff_bfd_name ()
{
abort ();
return NULL;
}
#define emul_bfd_name mipsecoff_bfd_name
#define emul_format &ecoff_format_ops
#define emul_name "mipsbecoff"
#define emul_struct_name mipsbecoff
#define emul_default_endian 1
#include "emul-target.h"
#undef emul_name
#undef emul_struct_name
#undef emul_default_endian
#define emul_name "mipslecoff"
#define emul_struct_name mipslecoff
#define emul_default_endian 0
#include "emul-target.h"
#undef emul_name
#undef emul_struct_name
#undef emul_default_endian
#define emul_name "mipsecoff"
#define emul_struct_name mipsecoff
#define emul_default_endian 2
#include "emul-target.h"

View File

@ -0,0 +1,37 @@
#include "as.h"
#include "emul.h"
static const char *mipself_bfd_name PARAMS ((void));
static const char *
mipself_bfd_name ()
{
abort ();
return NULL;
}
#define emul_bfd_name mipself_bfd_name
#define emul_format &elf_format_ops
#define emul_name "mipsbelf"
#define emul_struct_name mipsbelf
#define emul_default_endian 1
#include "emul-target.h"
#undef emul_name
#undef emul_struct_name
#undef emul_default_endian
#define emul_name "mipslelf"
#define emul_struct_name mipslelf
#define emul_default_endian 0
#include "emul-target.h"
#undef emul_name
#undef emul_struct_name
#undef emul_default_endian
#define emul_name "mipself"
#define emul_struct_name mipself
#define emul_default_endian 2
#include "emul-target.h"

View File

@ -0,0 +1,47 @@
/* itbl-mips.h
Copyright 1997 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
GAS 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, or (at your option)
any later version.
GAS 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 GAS; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* Defines for Mips itbl cop support */
#include "opcode/mips.h"
/* Values for processors will be from 0 to NUMBER_OF_PROCESSORS-1 */
#define NUMBER_OF_PROCESSORS 4
#define MAX_BITPOS 31
/* Mips specifics */
#define MIPS_OPCODE_COP0 (0x21) /* COPz+CO, bits 31-25: 0100zz1 */
#define MIPS_ENCODE_COP_NUM(z) ((MIPS_OPCODE_COP0|z<<1)<<25)
#define MIPS_IS_COP_INSN(insn) ((MIPS_OPCODE_COP0&(insn>>25)) \
== MIPS_OPCODE_COP0)
#define MIPS_DECODE_COP_NUM(insn) ((~MIPS_OPCODE_COP0&(insn>>25))>>1)
#define MIPS_DECODE_COP_COFUN(insn) ((~MIPS_ENCODE_COP_NUM(3))&(insn))
/* definitions required by generic code */
#define ITBL_IS_INSN(insn) MIPS_IS_COP_INSN(insn)
#define ITBL_DECODE_PNUM(insn) MIPS_DECODE_COP_NUM(insn)
#define ITBL_ENCODE_PNUM(pnum) MIPS_ENCODE_COP_NUM(pnum)
#define ITBL_OPCODE_STRUCT mips_opcode
#define ITBL_OPCODES mips_opcodes
#define ITBL_NUM_OPCODES NUMOPCODES
#define ITBL_NUM_MACROS M_NUM_MACROS

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,188 @@
/* tc-mips.h -- header file for tc-mips.c.
Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Contributed by the OSF and Ralph Campbell.
Written by Keith Knowles and Ralph Campbell, working independently.
Modified for ECOFF support by Ian Lance Taylor of Cygnus Support.
This file is part of GAS.
GAS 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, or (at your option)
any later version.
GAS 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 GAS; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#ifndef TC_MIPS
#define TC_MIPS
struct frag;
struct expressionS;
/* Default to big endian. */
#ifndef TARGET_BYTES_BIG_ENDIAN
#define TARGET_BYTES_BIG_ENDIAN 1
#endif
#define TARGET_ARCH bfd_arch_mips
#define WORKING_DOT_WORD 1
#define OLD_FLOAT_READS
#define REPEAT_CONS_EXPRESSIONS
#define RELOC_EXPANSION_POSSIBLE
#define MAX_RELOC_EXPANSION 3
#define LOCAL_LABELS_FB 1
/* Maximum symbol offset that can be encoded in a BFD_RELOC_GPREL16
relocation. */
#define MAX_GPREL_OFFSET (0x7FF0)
#define md_relax_frag(segment, fragp, stretch) \
mips_relax_frag(segment, fragp, stretch)
extern int mips_relax_frag (asection *, struct frag *, long);
#define md_undefined_symbol(name) (0)
#define md_operand(x)
extern void mips_handle_align (struct frag *);
#define HANDLE_ALIGN(fragp) mips_handle_align (fragp)
#define MAX_MEM_FOR_RS_ALIGN_CODE (1 + 2)
/* We permit PC relative difference expressions when generating
embedded PIC code. */
#define DIFF_EXPR_OK
/* Tell assembler that we have an itbl_mips.h header file to include. */
#define HAVE_ITBL_CPU
/* The endianness of the target format may change based on command
line arguments. */
#define TARGET_FORMAT mips_target_format()
extern const char *mips_target_format (void);
/* MIPS PIC level. */
enum mips_pic_level
{
/* Do not generate PIC code. */
NO_PIC,
/* Generate PIC code as in the SVR4 MIPS ABI. */
SVR4_PIC,
/* Generate PIC code without using a global offset table: the data
segment has a maximum size of 64K, all data references are off
the $gp register, and all text references are PC relative. This
is used on some embedded systems. */
EMBEDDED_PIC
};
extern enum mips_pic_level mips_pic;
struct mips_cl_insn
{
unsigned long insn_opcode;
const struct mips_opcode *insn_mo;
/* The next two fields are used when generating mips16 code. */
bfd_boolean use_extend;
unsigned short extend;
};
extern int tc_get_register (int frame);
#define md_after_parse_args() mips_after_parse_args()
extern void mips_after_parse_args (void);
#define tc_init_after_args() mips_init_after_args()
extern void mips_init_after_args (void);
#define md_parse_long_option(arg) mips_parse_long_option (arg)
extern int mips_parse_long_option (const char *);
#define tc_frob_label(sym) mips_define_label (sym)
extern void mips_define_label (symbolS *);
#define tc_frob_file_before_adjust() mips_frob_file_before_adjust ()
extern void mips_frob_file_before_adjust (void);
#define tc_frob_file_before_fix() mips_frob_file ()
extern void mips_frob_file (void);
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
#define tc_frob_file_after_relocs mips_frob_file_after_relocs
extern void mips_frob_file_after_relocs (void);
#endif
#define tc_fix_adjustable(fixp) mips_fix_adjustable (fixp)
extern int mips_fix_adjustable (struct fix *);
/* Values passed to md_apply_fix3 don't include symbol values. */
#define MD_APPLY_SYM_VALUE(FIX) 0
/* Global syms must not be resolved, to support ELF shared libraries.
When generating embedded code, we don't have shared libs. */
#define EXTERN_FORCE_RELOC \
(OUTPUT_FLAVOR == bfd_target_elf_flavour \
&& mips_pic != EMBEDDED_PIC)
/* When generating embedded PIC code we must keep PC relative
relocations. */
#define TC_FORCE_RELOCATION(FIX) mips_force_relocation (FIX)
extern int mips_force_relocation (struct fix *);
#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \
(! SEG_NORMAL (SEG) || mips_force_relocation (FIX))
/* We use this to turn branches to global symbols into branches to
local symbols, so that they can be simplified. */
#define TC_VALIDATE_FIX(fixp, this_segment, skip_label) \
do \
if (! mips_validate_fix ((fixp), (this_segment))) \
goto skip_label; \
while (0)
extern int mips_validate_fix (struct fix *, asection *);
/* Register mask variables. These are set by the MIPS assembly code
and used by ECOFF and possibly other object file formats. */
extern unsigned long mips_gprmask;
extern unsigned long mips_cprmask[4];
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
#define elf_tc_final_processing mips_elf_final_processing
extern void mips_elf_final_processing (void);
#endif
extern void md_mips_end (void);
#define md_end() md_mips_end()
#define USE_GLOBAL_POINTER_OPT (OUTPUT_FLAVOR == bfd_target_ecoff_flavour \
|| OUTPUT_FLAVOR == bfd_target_coff_flavour \
|| OUTPUT_FLAVOR == bfd_target_elf_flavour)
extern void mips_pop_insert (void);
#define md_pop_insert() mips_pop_insert()
extern void mips_flush_pending_output (void);
#define md_flush_pending_output mips_flush_pending_output
extern void mips_enable_auto_align (void);
#define md_elf_section_change_hook() mips_enable_auto_align()
extern enum dwarf2_format mips_dwarf2_format (void);
#define DWARF2_FORMAT() mips_dwarf2_format ()
#define DWARF2_ADDR_SIZE(bfd) mips_dwarf2_addr_size ()
#endif /* TC_MIPS */

View File

@ -0,0 +1,40 @@
/* Traditional MIPS targets
Copyright 2000 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
GAS 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, or (at your option)
any later version.
GAS 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 GAS; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* This file is te-tmips.h and is intended to provide support for
traditional mips targets like mips-dde-sysv4.2MP (Supermax ) ,
mips-sni-sysv4* (Sinix) etc. The base for this file is te-generic.h.
Created by Koundinya.K < kk@ddeorg.soft.net > with the help of
Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>. */
/* Added these, because if we don't know what we're targeting we may
need an assembler version of libgcc, and that will use local
labels. */
#define TE_TMIPS 1
#define LOCAL_LABELS_DOLLAR 1
#define LOCAL_LABELS_FB 1
/* these define interfaces */
#ifdef OBJ_HEADER
#include OBJ_HEADER
#else
#include "obj-format.h"
#endif

View File

@ -0,0 +1,377 @@
@c Copyright 1991, 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001,
@c 2002, 2003, 2004
@c Free Software Foundation, Inc.
@c This is part of the GAS manual.
@c For copying conditions, see the file as.texinfo.
@ifset GENERIC
@page
@node MIPS-Dependent
@chapter MIPS Dependent Features
@end ifset
@ifclear GENERIC
@node Machine Dependencies
@chapter MIPS Dependent Features
@end ifclear
@cindex MIPS processor
@sc{gnu} @code{@value{AS}} for @sc{mips} architectures supports several
different @sc{mips} processors, and MIPS ISA levels I through V, MIPS32,
and MIPS64. For information about the @sc{mips} instruction set, see
@cite{MIPS RISC Architecture}, by Kane and Heindrich (Prentice-Hall).
For an overview of @sc{mips} assembly conventions, see ``Appendix D:
Assembly Language Programming'' in the same work.
@menu
* MIPS Opts:: Assembler options
* MIPS Object:: ECOFF object code
* MIPS Stabs:: Directives for debugging information
* MIPS ISA:: Directives to override the ISA level
* MIPS autoextend:: Directives for extending MIPS 16 bit instructions
* MIPS insn:: Directive to mark data as an instruction
* MIPS option stack:: Directives to save and restore options
* MIPS ASE instruction generation overrides:: Directives to control
generation of MIPS ASE instructions
@end menu
@node MIPS Opts
@section Assembler options
The @sc{mips} configurations of @sc{gnu} @code{@value{AS}} support these
special options:
@table @code
@cindex @code{-G} option (MIPS)
@item -G @var{num}
This option sets the largest size of an object that can be referenced
implicitly with the @code{gp} register. It is only accepted for targets
that use @sc{ecoff} format. The default value is 8.
@cindex @code{-EB} option (MIPS)
@cindex @code{-EL} option (MIPS)
@cindex MIPS big-endian output
@cindex MIPS little-endian output
@cindex big-endian output, MIPS
@cindex little-endian output, MIPS
@item -EB
@itemx -EL
Any @sc{mips} configuration of @code{@value{AS}} can select big-endian or
little-endian output at run time (unlike the other @sc{gnu} development
tools, which must be configured for one or the other). Use @samp{-EB}
to select big-endian output, and @samp{-EL} for little-endian.
@cindex MIPS architecture options
@item -mips1
@itemx -mips2
@itemx -mips3
@itemx -mips4
@itemx -mips5
@itemx -mips32
@itemx -mips32r2
@itemx -mips64
@itemx -mips64r2
Generate code for a particular MIPS Instruction Set Architecture level.
@samp{-mips1} corresponds to the @sc{r2000} and @sc{r3000} processors,
@samp{-mips2} to the @sc{r6000} processor, @samp{-mips3} to the
@sc{r4000} processor, and @samp{-mips4} to the @sc{r8000} and
@sc{r10000} processors. @samp{-mips5}, @samp{-mips32}, @samp{-mips32r2},
@samp{-mips64}, and @samp{-mips64r2}
correspond to generic
@sc{MIPS V}, @sc{MIPS32}, @sc{MIPS32 Release 2}, @sc{MIPS64},
and @sc{MIPS64 Release 2}
ISA processors, respectively. You can also switch
instruction sets during the assembly; see @ref{MIPS ISA, Directives to
override the ISA level}.
@item -mgp32
@itemx -mfp32
Some macros have different expansions for 32-bit and 64-bit registers.
The register sizes are normally inferred from the ISA and ABI, but these
flags force a certain group of registers to be treated as 32 bits wide at
all times. @samp{-mgp32} controls the size of general-purpose registers
and @samp{-mfp32} controls the size of floating-point registers.
On some MIPS variants there is a 32-bit mode flag; when this flag is
set, 64-bit instructions generate a trap. Also, some 32-bit OSes only
save the 32-bit registers on a context switch, so it is essential never
to use the 64-bit registers.
@item -mgp64
Assume that 64-bit general purpose registers are available. This is
provided in the interests of symmetry with -gp32.
@item -mips16
@itemx -no-mips16
Generate code for the MIPS 16 processor. This is equivalent to putting
@samp{.set mips16} at the start of the assembly file. @samp{-no-mips16}
turns off this option.
@item -mips3d
@itemx -no-mips3d
Generate code for the MIPS-3D Application Specific Extension.
This tells the assembler to accept MIPS-3D instructions.
@samp{-no-mips3d} turns off this option.
@item -mdmx
@itemx -no-mdmx
Generate code for the MDMX Application Specific Extension.
This tells the assembler to accept MDMX instructions.
@samp{-no-mdmx} turns off this option.
@item -mfix7000
@itemx -mno-fix7000
Cause nops to be inserted if the read of the destination register
of an mfhi or mflo instruction occurs in the following two instructions.
@item -mfix-vr4120
@itemx -no-mfix-vr4120
Insert nops to work around certain VR4120 errata. This option is
intended to be used on GCC-generated code: it is not designed to catch
all problems in hand-written assembler code.
@item -m4010
@itemx -no-m4010
Generate code for the LSI @sc{r4010} chip. This tells the assembler to
accept the @sc{r4010} specific instructions (@samp{addciu}, @samp{ffc},
etc.), and to not schedule @samp{nop} instructions around accesses to
the @samp{HI} and @samp{LO} registers. @samp{-no-m4010} turns off this
option.
@item -m4650
@itemx -no-m4650
Generate code for the MIPS @sc{r4650} chip. This tells the assembler to accept
the @samp{mad} and @samp{madu} instruction, and to not schedule @samp{nop}
instructions around accesses to the @samp{HI} and @samp{LO} registers.
@samp{-no-m4650} turns off this option.
@itemx -m3900
@itemx -no-m3900
@itemx -m4100
@itemx -no-m4100
For each option @samp{-m@var{nnnn}}, generate code for the MIPS
@sc{r@var{nnnn}} chip. This tells the assembler to accept instructions
specific to that chip, and to schedule for that chip's hazards.
@item -march=@var{cpu}
Generate code for a particular MIPS cpu. It is exactly equivalent to
@samp{-m@var{cpu}}, except that there are more value of @var{cpu}
understood. Valid @var{cpu} value are:
@quotation
2000,
3000,
3900,
4000,
4010,
4100,
4111,
vr4120,
vr4130,
vr4181,
4300,
4400,
4600,
4650,
5000,
rm5200,
rm5230,
rm5231,
rm5261,
rm5721,
vr5400,
vr5500,
6000,
rm7000,
8000,
rm9000,
10000,
12000,
mips32-4k,
sb1
@end quotation
@item -mtune=@var{cpu}
Schedule and tune for a particular MIPS cpu. Valid @var{cpu} values are
identical to @samp{-march=@var{cpu}}.
@item -mabi=@var{abi}
Record which ABI the source code uses. The recognized arguments
are: @samp{32}, @samp{n32}, @samp{o64}, @samp{64} and @samp{eabi}.
@cindex @code{-nocpp} ignored (MIPS)
@item -nocpp
This option is ignored. It is accepted for command-line compatibility with
other assemblers, which use it to turn off C style preprocessing. With
@sc{gnu} @code{@value{AS}}, there is no need for @samp{-nocpp}, because the
@sc{gnu} assembler itself never runs the C preprocessor.
@item --construct-floats
@itemx --no-construct-floats
@cindex --construct-floats
@cindex --no-construct-floats
The @code{--no-construct-floats} option disables the construction of
double width floating point constants by loading the two halves of the
value into the two single width floating point registers that make up
the double width register. This feature is useful if the processor
support the FR bit in its status register, and this bit is known (by
the programmer) to be set. This bit prevents the aliasing of the double
width register by the single width registers.
By default @code{--construct-floats} is selected, allowing construction
of these floating point constants.
@item --trap
@itemx --no-break
@c FIXME! (1) reflect these options (next item too) in option summaries;
@c (2) stop teasing, say _which_ instructions expanded _how_.
@code{@value{AS}} automatically macro expands certain division and
multiplication instructions to check for overflow and division by zero. This
option causes @code{@value{AS}} to generate code to take a trap exception
rather than a break exception when an error is detected. The trap instructions
are only supported at Instruction Set Architecture level 2 and higher.
@item --break
@itemx --no-trap
Generate code to take a break exception rather than a trap exception when an
error is detected. This is the default.
@item -mpdr
@itemx -mno-pdr
Control generation of @code{.pdr} sections. Off by default on IRIX, on
elsewhere.
@end table
@node MIPS Object
@section MIPS ECOFF object code
@cindex ECOFF sections
@cindex MIPS ECOFF sections
Assembling for a @sc{mips} @sc{ecoff} target supports some additional sections
besides the usual @code{.text}, @code{.data} and @code{.bss}. The
additional sections are @code{.rdata}, used for read-only data,
@code{.sdata}, used for small data, and @code{.sbss}, used for small
common objects.
@cindex small objects, MIPS ECOFF
@cindex @code{gp} register, MIPS
When assembling for @sc{ecoff}, the assembler uses the @code{$gp} (@code{$28})
register to form the address of a ``small object''. Any object in the
@code{.sdata} or @code{.sbss} sections is considered ``small'' in this sense.
For external objects, or for objects in the @code{.bss} section, you can use
the @code{@value{GCC}} @samp{-G} option to control the size of objects addressed via
@code{$gp}; the default value is 8, meaning that a reference to any object
eight bytes or smaller uses @code{$gp}. Passing @samp{-G 0} to
@code{@value{AS}} prevents it from using the @code{$gp} register on the basis
of object size (but the assembler uses @code{$gp} for objects in @code{.sdata}
or @code{sbss} in any case). The size of an object in the @code{.bss} section
is set by the @code{.comm} or @code{.lcomm} directive that defines it. The
size of an external object may be set with the @code{.extern} directive. For
example, @samp{.extern sym,4} declares that the object at @code{sym} is 4 bytes
in length, whie leaving @code{sym} otherwise undefined.
Using small @sc{ecoff} objects requires linker support, and assumes that the
@code{$gp} register is correctly initialized (normally done automatically by
the startup code). @sc{mips} @sc{ecoff} assembly code must not modify the
@code{$gp} register.
@node MIPS Stabs
@section Directives for debugging information
@cindex MIPS debugging directives
@sc{mips} @sc{ecoff} @code{@value{AS}} supports several directives used for
generating debugging information which are not support by traditional @sc{mips}
assemblers. These are @code{.def}, @code{.endef}, @code{.dim}, @code{.file},
@code{.scl}, @code{.size}, @code{.tag}, @code{.type}, @code{.val},
@code{.stabd}, @code{.stabn}, and @code{.stabs}. The debugging information
generated by the three @code{.stab} directives can only be read by @sc{gdb},
not by traditional @sc{mips} debuggers (this enhancement is required to fully
support C++ debugging). These directives are primarily used by compilers, not
assembly language programmers!
@node MIPS ISA
@section Directives to override the ISA level
@cindex MIPS ISA override
@kindex @code{.set mips@var{n}}
@sc{gnu} @code{@value{AS}} supports an additional directive to change
the @sc{mips} Instruction Set Architecture level on the fly: @code{.set
mips@var{n}}. @var{n} should be a number from 0 to 5, or 32, 32r2, 64
or 64r2.
The values other than 0 make the assembler accept instructions
for the corresponding @sc{isa} level, from that point on in the
assembly. @code{.set mips@var{n}} affects not only which instructions
are permitted, but also how certain macros are expanded. @code{.set
mips0} restores the @sc{isa} level to its original level: either the
level you selected with command line options, or the default for your
configuration. You can use this feature to permit specific @sc{r4000}
instructions while assembling in 32 bit mode. Use this directive with
care!
The directive @samp{.set mips16} puts the assembler into MIPS 16 mode,
in which it will assemble instructions for the MIPS 16 processor. Use
@samp{.set nomips16} to return to normal 32 bit mode.
Traditional @sc{mips} assemblers do not support this directive.
@node MIPS autoextend
@section Directives for extending MIPS 16 bit instructions
@kindex @code{.set autoextend}
@kindex @code{.set noautoextend}
By default, MIPS 16 instructions are automatically extended to 32 bits
when necessary. The directive @samp{.set noautoextend} will turn this
off. When @samp{.set noautoextend} is in effect, any 32 bit instruction
must be explicitly extended with the @samp{.e} modifier (e.g.,
@samp{li.e $4,1000}). The directive @samp{.set autoextend} may be used
to once again automatically extend instructions when necessary.
This directive is only meaningful when in MIPS 16 mode. Traditional
@sc{mips} assemblers do not support this directive.
@node MIPS insn
@section Directive to mark data as an instruction
@kindex @code{.insn}
The @code{.insn} directive tells @code{@value{AS}} that the following
data is actually instructions. This makes a difference in MIPS 16 mode:
when loading the address of a label which precedes instructions,
@code{@value{AS}} automatically adds 1 to the value, so that jumping to
the loaded address will do the right thing.
@node MIPS option stack
@section Directives to save and restore options
@cindex MIPS option stack
@kindex @code{.set push}
@kindex @code{.set pop}
The directives @code{.set push} and @code{.set pop} may be used to save
and restore the current settings for all the options which are
controlled by @code{.set}. The @code{.set push} directive saves the
current settings on a stack. The @code{.set pop} directive pops the
stack and restores the settings.
These directives can be useful inside an macro which must change an
option such as the ISA level or instruction reordering but does not want
to change the state of the code which invoked the macro.
Traditional @sc{mips} assemblers do not support these directives.
@node MIPS ASE instruction generation overrides
@section Directives to control generation of MIPS ASE instructions
@cindex MIPS MIPS-3D instruction generation override
@kindex @code{.set mips3d}
@kindex @code{.set nomips3d}
The directive @code{.set mips3d} makes the assembler accept instructions
from the MIPS-3D Application Specific Extension from that point on
in the assembly. The @code{.set nomips3d} directive prevents MIPS-3D
instructions from being accepted.
@cindex MIPS MDMX instruction generation override
@kindex @code{.set mdmx}
@kindex @code{.set nomdmx}
The directive @code{.set mdmx} makes the assembler accept instructions
from the MDMX Application Specific Extension from that point on
in the assembly. The @code{.set nomdmx} directive prevents MDMX
instructions from being accepted.
Traditional @sc{mips} assemblers do not support these directives.

View File

@ -0,0 +1,114 @@
/*
* Copyright (c) 1983, 1993, 1998
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "gprof.h"
#include "search_list.h"
#include "source.h"
#include "symtab.h"
#include "cg_arcs.h"
#include "corefile.h"
#include "hist.h"
static Sym indirect_child;
void mips_find_call PARAMS ((Sym *, bfd_vma, bfd_vma));
void
mips_find_call (parent, p_lowpc, p_highpc)
Sym *parent;
bfd_vma p_lowpc;
bfd_vma p_highpc;
{
bfd_vma pc, dest_pc;
unsigned int op;
int offset;
Sym *child;
static bfd_boolean inited = FALSE;
if (!inited)
{
inited = TRUE;
sym_init (&indirect_child);
indirect_child.name = _("<indirect child>");
indirect_child.cg.prop.fract = 1.0;
indirect_child.cg.cyc.head = &indirect_child;
}
if (!core_text_space)
{
return;
}
if (p_lowpc < s_lowpc)
{
p_lowpc = s_lowpc;
}
if (p_highpc > s_highpc)
{
p_highpc = s_highpc;
}
DBG (CALLDEBUG, printf (_("[find_call] %s: 0x%lx to 0x%lx\n"),
parent->name, (unsigned long) p_lowpc,
(unsigned long) p_highpc));
for (pc = p_lowpc; pc < p_highpc; pc += 4)
{
op = bfd_get_32 (core_bfd, &((char *)core_text_space)[pc - s_lowpc]);
if ((op & 0xfc000000) == 0x0c000000)
{
/* This is a "jal" instruction. Check that the destination
is the address of a function. */
DBG (CALLDEBUG,
printf (_("[find_call] 0x%lx: jal"), (unsigned long) pc));
offset = (op & 0x03ffffff) << 2;
dest_pc = (pc & ~(bfd_vma) 0xfffffff) | offset;
if (dest_pc >= s_lowpc && dest_pc <= s_highpc)
{
child = sym_lookup (&symtab, dest_pc);
DBG (CALLDEBUG,
printf (" 0x%lx\t; name=%s, addr=0x%lx",
(unsigned long) dest_pc, child->name,
(unsigned long) child->addr));
if (child->addr == dest_pc)
{
DBG (CALLDEBUG, printf ("\n"));
/* a hit: */
arc_add (parent, child, (unsigned long) 0);
continue;
}
}
/* Something funny going on. */
DBG (CALLDEBUG, printf ("\tbut it's a botch\n"));
}
else if ((op & 0xfc00f83f) == 0x0000f809)
{
/* This is a "jalr" instruction (indirect call). */
DBG (CALLDEBUG,
printf (_("[find_call] 0x%lx: jalr\n"), (unsigned long) pc));
arc_add (parent, &indirect_child, (unsigned long) 0);
}
}
}

View File

@ -0,0 +1,367 @@
/* ECOFF support on MIPS machines.
coff/ecoff.h must be included before this file.
Copyright 2001 Free Software Foundation, Inc.
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. */
#define DO_NOT_DEFINE_AOUTHDR
#define L_LNNO_SIZE 4
#include "coff/external.h"
/* Magic numbers are defined in coff/ecoff.h. */
#define MIPS_ECOFF_BADMAG(x) (((x).f_magic!=MIPS_MAGIC_1) && \
((x).f_magic!=MIPS_MAGIC_LITTLE) &&\
((x).f_magic!=MIPS_MAGIC_BIG) && \
((x).f_magic!=MIPS_MAGIC_LITTLE2) && \
((x).f_magic!=MIPS_MAGIC_BIG2) && \
((x).f_magic!=MIPS_MAGIC_LITTLE3) && \
((x).f_magic!=MIPS_MAGIC_BIG3))
/********************** AOUT "OPTIONAL HEADER" **********************/
typedef struct external_aouthdr
{
unsigned char magic[2]; /* type of file */
unsigned char vstamp[2]; /* version stamp */
unsigned char tsize[4]; /* text size in bytes, padded to FW bdry*/
unsigned char dsize[4]; /* initialized data " " */
unsigned char bsize[4]; /* uninitialized data " " */
unsigned char entry[4]; /* entry pt. */
unsigned char text_start[4]; /* base of text used for this file */
unsigned char data_start[4]; /* base of data used for this file */
unsigned char bss_start[4]; /* base of bss used for this file */
unsigned char gprmask[4]; /* ?? */
unsigned char cprmask[4][4]; /* ?? */
unsigned char gp_value[4]; /* value for gp register */
} AOUTHDR;
/* compute size of a header */
#define AOUTSZ 56
#define AOUTHDRSZ 56
/********************** RELOCATION DIRECTIVES **********************/
struct external_reloc
{
unsigned char r_vaddr[4];
unsigned char r_bits[4];
};
#define RELOC struct external_reloc
#define RELSZ 8
/* MIPS ECOFF uses a packed 8 byte format for relocs. These constants
are used to unpack the r_bits field. */
#define RELOC_BITS0_SYMNDX_SH_LEFT_BIG 16
#define RELOC_BITS0_SYMNDX_SH_LEFT_LITTLE 0
#define RELOC_BITS1_SYMNDX_SH_LEFT_BIG 8
#define RELOC_BITS1_SYMNDX_SH_LEFT_LITTLE 8
#define RELOC_BITS2_SYMNDX_SH_LEFT_BIG 0
#define RELOC_BITS2_SYMNDX_SH_LEFT_LITTLE 16
/* Originally, ECOFF used four bits for the reloc type and had three
reserved bits. Irix 4 added another bit for the reloc type, which
was easy because it was big endian and one of the spare bits became
the new most significant bit. To make this also work for little
endian ECOFF, we need to wrap one of the reserved bits around to
become the most significant bit of the reloc type. */
#define RELOC_BITS3_TYPE_BIG 0x3E
#define RELOC_BITS3_TYPE_SH_BIG 1
#define RELOC_BITS3_TYPE_LITTLE 0x78
#define RELOC_BITS3_TYPE_SH_LITTLE 3
#define RELOC_BITS3_TYPEHI_LITTLE 0x04
#define RELOC_BITS3_TYPEHI_SH_LITTLE 2
#define RELOC_BITS3_EXTERN_BIG 0x01
#define RELOC_BITS3_EXTERN_LITTLE 0x80
/* The r_type field in a reloc is one of the following values. I
don't know if any other values can appear. These seem to be all
that occur in the Ultrix 4.2 libraries. */
#define MIPS_R_IGNORE 0
#define MIPS_R_REFHALF 1
#define MIPS_R_REFWORD 2
#define MIPS_R_JMPADDR 3
#define MIPS_R_REFHI 4
#define MIPS_R_REFLO 5
#define MIPS_R_GPREL 6
#define MIPS_R_LITERAL 7
/* These reloc types are a Cygnus extension used when generating
position independent code for embedded systems. The numbers are
taken from Irix 4, but at least for internal relocs Irix 5 does not
give them the same meaning. For an internal reloc the symbol index
of RELHI and RELLO is modified as described below for
MIPS_R_SWITCH. */
#define MIPS_R_PCREL16 12
#define MIPS_R_RELHI 13
#define MIPS_R_RELLO 14
/* This reloc type is a Cygnus extension used when generating position
independent code for embedded systems. It is used for an entry in
a switch table, which looks like this:
.word $L3-$LS12
The object file will contain the correct difference, and does not
require adjustment. However, when the linker is relaxing PC
relative calls, it is possible for $L3 to move farther away. This
reloc always appears in the .text section, and is always against
the .text section. However, the symbol index is not
RELOC_SECTION_TEXT. It is, instead, the distance between this
switch table entry and $LS12. Thus, the original value of $L12 is
vaddr - symndx
and the original value of $L3 is
vaddr - symndx + addend
where addend is the value in the object file. Knowing this, the
linker can know whether the addend in the object file must be
adjusted. */
#define MIPS_R_SWITCH 22
/********************** STABS **********************/
#define MIPS_IS_STAB ECOFF_IS_STAB
#define MIPS_MARK_STAB ECOFF_MARK_STAB
#define MIPS_UNMARK_STAB ECOFF_UNMARK_STAB
/********************** SYMBOLIC INFORMATION **********************/
/* Written by John Gilmore. */
/* ECOFF uses COFF-like section structures, but its own symbol format.
This file defines the symbol format in fields whose size and alignment
will not vary on different host systems. */
/* File header as a set of bytes */
struct hdr_ext
{
unsigned char h_magic[2];
unsigned char h_vstamp[2];
unsigned char h_ilineMax[4];
unsigned char h_cbLine[4];
unsigned char h_cbLineOffset[4];
unsigned char h_idnMax[4];
unsigned char h_cbDnOffset[4];
unsigned char h_ipdMax[4];
unsigned char h_cbPdOffset[4];
unsigned char h_isymMax[4];
unsigned char h_cbSymOffset[4];
unsigned char h_ioptMax[4];
unsigned char h_cbOptOffset[4];
unsigned char h_iauxMax[4];
unsigned char h_cbAuxOffset[4];
unsigned char h_issMax[4];
unsigned char h_cbSsOffset[4];
unsigned char h_issExtMax[4];
unsigned char h_cbSsExtOffset[4];
unsigned char h_ifdMax[4];
unsigned char h_cbFdOffset[4];
unsigned char h_crfd[4];
unsigned char h_cbRfdOffset[4];
unsigned char h_iextMax[4];
unsigned char h_cbExtOffset[4];
};
/* File descriptor external record */
struct fdr_ext
{
unsigned char f_adr[4];
unsigned char f_rss[4];
unsigned char f_issBase[4];
unsigned char f_cbSs[4];
unsigned char f_isymBase[4];
unsigned char f_csym[4];
unsigned char f_ilineBase[4];
unsigned char f_cline[4];
unsigned char f_ioptBase[4];
unsigned char f_copt[4];
unsigned char f_ipdFirst[2];
unsigned char f_cpd[2];
unsigned char f_iauxBase[4];
unsigned char f_caux[4];
unsigned char f_rfdBase[4];
unsigned char f_crfd[4];
unsigned char f_bits1[1];
unsigned char f_bits2[3];
unsigned char f_cbLineOffset[4];
unsigned char f_cbLine[4];
};
#define FDR_BITS1_LANG_BIG 0xF8
#define FDR_BITS1_LANG_SH_BIG 3
#define FDR_BITS1_LANG_LITTLE 0x1F
#define FDR_BITS1_LANG_SH_LITTLE 0
#define FDR_BITS1_FMERGE_BIG 0x04
#define FDR_BITS1_FMERGE_LITTLE 0x20
#define FDR_BITS1_FREADIN_BIG 0x02
#define FDR_BITS1_FREADIN_LITTLE 0x40
#define FDR_BITS1_FBIGENDIAN_BIG 0x01
#define FDR_BITS1_FBIGENDIAN_LITTLE 0x80
#define FDR_BITS2_GLEVEL_BIG 0xC0
#define FDR_BITS2_GLEVEL_SH_BIG 6
#define FDR_BITS2_GLEVEL_LITTLE 0x03
#define FDR_BITS2_GLEVEL_SH_LITTLE 0
/* We ignore the `reserved' field in bits2. */
/* Procedure descriptor external record */
struct pdr_ext
{
unsigned char p_adr[4];
unsigned char p_isym[4];
unsigned char p_iline[4];
unsigned char p_regmask[4];
unsigned char p_regoffset[4];
unsigned char p_iopt[4];
unsigned char p_fregmask[4];
unsigned char p_fregoffset[4];
unsigned char p_frameoffset[4];
unsigned char p_framereg[2];
unsigned char p_pcreg[2];
unsigned char p_lnLow[4];
unsigned char p_lnHigh[4];
unsigned char p_cbLineOffset[4];
};
/* Runtime procedure table */
struct rpdr_ext
{
unsigned char p_adr[4];
unsigned char p_regmask[4];
unsigned char p_regoffset[4];
unsigned char p_fregmask[4];
unsigned char p_fregoffset[4];
unsigned char p_frameoffset[4];
unsigned char p_framereg[2];
unsigned char p_pcreg[2];
unsigned char p_irpss[4];
unsigned char p_reserved[4];
unsigned char p_exception_info[4];
};
/* Line numbers */
struct line_ext
{
unsigned char l_line[4];
};
/* Symbol external record */
struct sym_ext
{
unsigned char s_iss[4];
unsigned char s_value[4];
unsigned char s_bits1[1];
unsigned char s_bits2[1];
unsigned char s_bits3[1];
unsigned char s_bits4[1];
};
#define SYM_BITS1_ST_BIG 0xFC
#define SYM_BITS1_ST_SH_BIG 2
#define SYM_BITS1_ST_LITTLE 0x3F
#define SYM_BITS1_ST_SH_LITTLE 0
#define SYM_BITS1_SC_BIG 0x03
#define SYM_BITS1_SC_SH_LEFT_BIG 3
#define SYM_BITS1_SC_LITTLE 0xC0
#define SYM_BITS1_SC_SH_LITTLE 6
#define SYM_BITS2_SC_BIG 0xE0
#define SYM_BITS2_SC_SH_BIG 5
#define SYM_BITS2_SC_LITTLE 0x07
#define SYM_BITS2_SC_SH_LEFT_LITTLE 2
#define SYM_BITS2_RESERVED_BIG 0x10
#define SYM_BITS2_RESERVED_LITTLE 0x08
#define SYM_BITS2_INDEX_BIG 0x0F
#define SYM_BITS2_INDEX_SH_LEFT_BIG 16
#define SYM_BITS2_INDEX_LITTLE 0xF0
#define SYM_BITS2_INDEX_SH_LITTLE 4
#define SYM_BITS3_INDEX_SH_LEFT_BIG 8
#define SYM_BITS3_INDEX_SH_LEFT_LITTLE 4
#define SYM_BITS4_INDEX_SH_LEFT_BIG 0
#define SYM_BITS4_INDEX_SH_LEFT_LITTLE 12
/* External symbol external record */
struct ext_ext
{
unsigned char es_bits1[1];
unsigned char es_bits2[1];
unsigned char es_ifd[2];
struct sym_ext es_asym;
};
#define EXT_BITS1_JMPTBL_BIG 0x80
#define EXT_BITS1_JMPTBL_LITTLE 0x01
#define EXT_BITS1_COBOL_MAIN_BIG 0x40
#define EXT_BITS1_COBOL_MAIN_LITTLE 0x02
#define EXT_BITS1_WEAKEXT_BIG 0x20
#define EXT_BITS1_WEAKEXT_LITTLE 0x04
/* Dense numbers external record */
struct dnr_ext
{
unsigned char d_rfd[4];
unsigned char d_index[4];
};
/* Relative file descriptor */
struct rfd_ext
{
unsigned char rfd[4];
};
/* Optimizer symbol external record */
struct opt_ext
{
unsigned char o_bits1[1];
unsigned char o_bits2[1];
unsigned char o_bits3[1];
unsigned char o_bits4[1];
struct rndx_ext o_rndx;
unsigned char o_offset[4];
};
#define OPT_BITS2_VALUE_SH_LEFT_BIG 16
#define OPT_BITS2_VALUE_SH_LEFT_LITTLE 0
#define OPT_BITS3_VALUE_SH_LEFT_BIG 8
#define OPT_BITS3_VALUE_SH_LEFT_LITTLE 8
#define OPT_BITS4_VALUE_SH_LEFT_BIG 0
#define OPT_BITS4_VALUE_SH_LEFT_LITTLE 16

View File

@ -0,0 +1,66 @@
/* coff information for Windows CE with MIPS VR4111
Copyright 2001 Free Software Foundation, Inc.
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. */
#define L_LNNO_SIZE 2
#define INCLUDE_COMDAT_FIELDS_IN_AUXENT
#include "coff/external.h"
#define MIPS_ARCH_MAGIC_WINCE 0x0166 /* Windows CE - little endian */
#define MIPS_PE_MAGIC 0x010b
#define MIPSBADMAG(x) ((x).f_magic != MIPS_ARCH_MAGIC_WINCE)
/* define some NT default values */
/* #define NT_IMAGE_BASE 0x400000 moved to internal.h */
#define NT_SECTION_ALIGNMENT 0x1000
#define NT_FILE_ALIGNMENT 0x200
#define NT_DEF_RESERVE 0x100000
#define NT_DEF_COMMIT 0x1000
/********************** RELOCATION DIRECTIVES **********************/
/* The external reloc has an offset field, because some of the reloc
types on the h8 don't have room in the instruction for the entire
offset - eg the strange jump and high page addressing modes. */
struct external_reloc
{
char r_vaddr[4];
char r_symndx[4];
char r_type[2];
};
#define RELOC struct external_reloc
#define RELSZ 10
/* MIPS PE relocation types. */
#define MIPS_R_ABSOLUTE 0 /* ignored */
#define MIPS_R_REFHALF 1
#define MIPS_R_REFWORD 2
#define MIPS_R_JMPADDR 3
#define MIPS_R_REFHI 4 /* PAIR follows */
#define MIPS_R_REFLO 5
#define MIPS_R_GPREL 6
#define MIPS_R_LITERAL 7 /* same as GPREL */
#define MIPS_R_SECTION 10
#define MIPS_R_SECREL 11
#define MIPS_R_SECRELLO 12
#define MIPS_R_SECRELHI 13 /* PAIR follows */
#define MIPS_R_RVA 34 /* 0x22 */
#define MIPS_R_PAIR 37 /* 0x25 - symndx is really a signed 16-bit addend */

View File

@ -0,0 +1,58 @@
# If you change this file, please also look at files which source this one:
# elf64bmip.sh elf64btsmip.sh elf32btsmipn32.sh elf32bmipn32.sh
# This is an ELF platform.
SCRIPT_NAME=elf
# Handle both big- and little-ended 32-bit MIPS objects.
ARCH=mips
OUTPUT_FORMAT="elf32-bigmips"
BIG_OUTPUT_FORMAT="elf32-bigmips"
LITTLE_OUTPUT_FORMAT="elf32-littlemips"
TEMPLATE_NAME=elf32
case "$EMULATION_NAME" in
elf32*n32*) ELFSIZE=32 ;;
elf64*) ELFSIZE=64 ;;
*) echo $0: unhandled emulation $EMULATION_NAME >&2; exit 1 ;;
esac
if test `echo "$host" | sed -e s/64//` = `echo "$target" | sed -e s/64//`; then
case " $EMULATION_LIBPATH " in
*" ${EMULATION_NAME} "*)
NATIVE=yes
;;
esac
fi
# Look for 64 bit target libraries in /lib64, /usr/lib64 etc., first.
LIBPATH_SUFFIX=$ELFSIZE
GENERATE_SHLIB_SCRIPT=yes
TEXT_START_ADDR=0x10000000
MAXPAGESIZE=0x100000
ENTRY=__start
# GOT-related settings.
OTHER_GOT_SYMBOLS='
_gp = ALIGN(16) + 0x7ff0;
'
OTHER_SDATA_SECTIONS="
.lit8 ${RELOCATING-0} : { *(.lit8) }
.lit4 ${RELOCATING-0} : { *(.lit4) }
.srdata ${RELOCATING-0} : { *(.srdata) }
"
# Magic symbols.
TEXT_START_SYMBOLS='_ftext = . ;'
DATA_START_SYMBOLS='_fdata = . ;'
OTHER_BSS_SYMBOLS='_fbss = .;'
INITIAL_READONLY_SECTIONS=".MIPS.options : { *(.MIPS.options) }"
# Discard any .MIPS.content* or .MIPS.events* sections. The linker
# doesn't know how to adjust them.
OTHER_SECTIONS="/DISCARD/ : { *(.MIPS.content*) *(.MIPS.events*) }"
TEXT_DYNAMIC=

View File

@ -0,0 +1,9 @@
# If you change this file, please also look at files which source this one:
# elf32ltsmip.sh
. ${srcdir}/emulparams/elf32bmip.sh
OUTPUT_FORMAT="elf32-tradbigmips"
BIG_OUTPUT_FORMAT="elf32-tradbigmips"
LITTLE_OUTPUT_FORMAT="elf32-tradlittlemips"
SHLIB_TEXT_START_ADDR=0
ENTRY=__start

View File

@ -0,0 +1,15 @@
# If you change this file, please also look at files which source this one:
# elf32ltsmipn32.sh
. ${srcdir}/emulparams/elf32bmipn32-defs.sh
OUTPUT_FORMAT="elf32-ntradbigmips"
BIG_OUTPUT_FORMAT="elf32-ntradbigmips"
LITTLE_OUTPUT_FORMAT="elf32-ntradlittlemips"
COMMONPAGESIZE=0x1000
# Magic sections.
OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'
OTHER_SECTIONS='
.gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
.gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
'

View File

@ -0,0 +1,2 @@
. ${srcdir}/emulparams/elf32btsmip.sh
OUTPUT_FORMAT="elf32-tradlittlemips"

View File

@ -0,0 +1,4 @@
. ${srcdir}/emulparams/elf32btsmipn32.sh
OUTPUT_FORMAT="elf32-ntradlittlemips"
BIG_OUTPUT_FORMAT="elf32-ntradbigmips"
LITTLE_OUTPUT_FORMAT="elf32-ntradlittlemips"

View File

@ -0,0 +1,27 @@
TEMPLATE_NAME=elf32
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-bigmips"
BIG_OUTPUT_FORMAT="elf32-bigmips"
LITTLE_OUTPUT_FORMAT="elf32-littlemips"
ARCH=mips
MACHINE=
EMBEDDED=yes
MAXPAGESIZE=0x40000
# The data below is taken from the windiss.dld linker script that comes with
# the Diab linker.
TEXT_START_ADDR=0x100000
DATA_START_SYMBOLS='__DATA_ROM = .; __DATA_RAM = .;'
SDATA_START_SYMBOLS='_SDA_BASE_ = .; _gp = . + 0x7ff0;'
SDATA2_START_SYMBOLS='_SDA2_BASE_ = .;'
EXECUTABLE_SYMBOLS='__HEAP_START = .; __SP_INIT = 0x800000; __SP_END = __SP_INIT - 0x20000; __HEAP_END = __SP_END; __DATA_END = _edata; __BSS_START = __bss_start; __BSS_END = _end; __HEAP_START = _end;'
# The Diab tools use a different init/fini convention. Initialization code
# is place in sections named ".init$NN". These sections are then concatenated
# into the .init section. It is important that .init$00 be first and .init$99
# be last. The other sections should be sorted, but the current linker script
# parse does not seem to allow that with the SORT keyword in this context.
INIT_START='*(.init$00); *(.init$0[1-9]); *(.init$[1-8][0-9]); *(.init$9[0-8])'
INIT_END='*(.init$99)'
FINI_START='*(.fini$00); *(.fini$0[1-9]); *(.fini$[1-8][0-9]); *(.fini$9[0-8])'
FINI_END='*(.fini$99)'

View File

@ -0,0 +1,16 @@
# If you change this file, please also look at files which source this one:
# elf64ltsmip.sh
. ${srcdir}/emulparams/elf32bmipn32-defs.sh
OUTPUT_FORMAT="elf64-tradbigmips"
BIG_OUTPUT_FORMAT="elf64-tradbigmips"
LITTLE_OUTPUT_FORMAT="elf64-tradlittlemips"
# Magic sections.
OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'
OTHER_SECTIONS='
.gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
.gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
'
TEXT_START_ADDR="0x120000000"

View File

@ -0,0 +1,4 @@
. ${srcdir}/emulparams/elf64btsmip.sh
OUTPUT_FORMAT="elf64-tradlittlemips"
BIG_OUTPUT_FORMAT="elf64-tradbigmips"
LITTLE_OUTPUT_FORMAT="elf64-tradlittlemips"

View File

@ -0,0 +1,6 @@
SCRIPT_NAME=mips
OUTPUT_FORMAT="ecoff-bigmips"
BIG_OUTPUT_FORMAT="ecoff-bigmips"
LITTLE_OUTPUT_FORMAT="ecoff-littlemips"
TARGET_PAGE_SIZE=0x1000000
ARCH=mips

View File

@ -0,0 +1,7 @@
SCRIPT_NAME=mipsbsd
OUTPUT_FORMAT="a.out-mips-little"
BIG_OUTPUT_FORMAT="a.out-mips-big"
LITTLE_OUTPUT_FORMAT="a.out-mips-little"
TEXT_START_ADDR=0x1020
TARGET_PAGE_SIZE=4096
ARCH=mips

View File

@ -0,0 +1,11 @@
SCRIPT_NAME=mips
OUTPUT_FORMAT="ecoff-bigmips"
BIG_OUTPUT_FORMAT="ecoff-bigmips"
LITTLE_OUTPUT_FORMAT="ecoff-littlemips"
TARGET_PAGE_SIZE=0x1000000
ARCH=mips
ENTRY=start
TEXT_START_ADDR=0xa0012000
DATA_ADDR=.
TEMPLATE_NAME=mipsecoff
EMBEDDED=yes

View File

@ -0,0 +1,11 @@
SCRIPT_NAME=mips
OUTPUT_FORMAT="ecoff-littlemips"
BIG_OUTPUT_FORMAT="ecoff-bigmips"
LITTLE_OUTPUT_FORMAT="ecoff-littlemips"
TARGET_PAGE_SIZE=0x1000000
ARCH=mips
ENTRY=start
TEXT_START_ADDR=0xa0012000
DATA_ADDR=.
TEMPLATE_NAME=mipsecoff
EMBEDDED=yes

View File

@ -0,0 +1,6 @@
SCRIPT_NAME=mips
OUTPUT_FORMAT="ecoff-littlemips"
BIG_OUTPUT_FORMAT="ecoff-bigmips"
LITTLE_OUTPUT_FORMAT="ecoff-littlemips"
TARGET_PAGE_SIZE=0x1000000
ARCH=mips

View File

@ -0,0 +1,9 @@
SCRIPT_NAME=mips
OUTPUT_FORMAT="ecoff-littlemips"
BIG_OUTPUT_FORMAT="ecoff-bigmips"
LITTLE_OUTPUT_FORMAT="ecoff-littlemips"
TARGET_PAGE_SIZE=0x1000000
ARCH=mips
TEXT_START_ADDR=0x80080000
DATA_ADDR=.
EMBEDDED=yes

View File

@ -0,0 +1,9 @@
ARCH=mips
SCRIPT_NAME=pe
OUTPUT_FORMAT="pei-mips"
OUTPUT_ARCH="mips"
RELOCATEABLE_OUTPUT_FORMAT="ecoff-littlemips"
TEMPLATE_NAME=pe
SUBSYSTEM=PE_DEF_SUBSYSTEM
INITIAL_SYMBOL_CHAR=\"_\"
ENTRY="_mainCRTStartup"

View File

@ -0,0 +1,248 @@
# This shell script emits a C file. -*- C -*-
# It does some substitutions.
if [ -z "$MACHINE" ]; then
OUTPUT_ARCH=${ARCH}
else
OUTPUT_ARCH=${ARCH}:${MACHINE}
fi
cat >e${EMULATION_NAME}.c <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */
/* Handle embedded relocs for MIPS.
Copyright 1994, 1995, 1997, 2000, 2002, 2003, 2004
Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com> based on generic.em.
This file is part of GLD, the Gnu Linker.
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. */
#define TARGET_IS_${EMULATION_NAME}
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
#include "ld.h"
#include "ldmain.h"
#include "ldmisc.h"
#include "ldexp.h"
#include "ldlang.h"
#include "ldfile.h"
#include "ldemul.h"
static void check_sections (bfd *, asection *, void *);
static void
gld${EMULATION_NAME}_before_parse (void)
{
#ifndef TARGET_ /* I.e., if not generic. */
ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
#endif /* not TARGET_ */
}
/* This function is run after all the input files have been opened.
We create a .rel.sdata section for each input file with a non zero
.sdata section. The BFD backend will fill in these sections with
magic numbers which can be used to relocate the data section at run
time. This will only do the right thing if all the input files
have been compiled using -membedded-pic. */
static void
gld${EMULATION_NAME}_after_open (void)
{
bfd *abfd;
if (! command_line.embedded_relocs
|| link_info.relocatable)
return;
for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link_next)
{
asection *datasec;
/* As first-order business, make sure that each input BFD is ECOFF. It
better be, as we are directly calling an ECOFF backend function. */
if (bfd_get_flavour (abfd) != bfd_target_ecoff_flavour)
einfo ("%F%B: all input objects must be ECOFF for --embedded-relocs\n");
datasec = bfd_get_section_by_name (abfd, ".sdata");
/* Note that we assume that the reloc_count field has already
been set up. We could call bfd_get_reloc_upper_bound, but
that returns the size of a memory buffer rather than a reloc
count. We do not want to call bfd_canonicalize_reloc,
because although it would always work it would force us to
read in the relocs into BFD canonical form, which would waste
a significant amount of time and memory. */
if (datasec != NULL && datasec->reloc_count > 0)
{
asection *relsec;
relsec = bfd_make_section (abfd, ".rel.sdata");
if (relsec == NULL
|| ! bfd_set_section_flags (abfd, relsec,
(SEC_ALLOC
| SEC_LOAD
| SEC_HAS_CONTENTS
| SEC_IN_MEMORY))
|| ! bfd_set_section_alignment (abfd, relsec, 2)
|| ! bfd_set_section_size (abfd, relsec,
datasec->reloc_count * 4))
einfo ("%F%B: can not create .rel.sdata section: %E\n");
}
/* Double check that all other data sections are empty, as is
required for embedded PIC code. */
bfd_map_over_sections (abfd, check_sections, datasec);
}
}
/* Check that of the data sections, only the .sdata section has
relocs. This is called via bfd_map_over_sections. */
static void
check_sections (bfd *abfd, asection *sec, void *sdatasec)
{
if ((bfd_get_section_flags (abfd, sec) & SEC_CODE) == 0
&& sec != sdatasec
&& sec->reloc_count != 0)
einfo ("%B%X: section %s has relocs; can not use --embedded-relocs\n",
abfd, bfd_get_section_name (abfd, sec));
}
/* This function is called after the section sizes and offsets have
been set. If we are generating embedded relocs, it calls a special
BFD backend routine to do the work. */
static void
gld${EMULATION_NAME}_after_allocation (void)
{
bfd *abfd;
if (! command_line.embedded_relocs
|| link_info.relocatable)
return;
for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link_next)
{
asection *datasec, *relsec;
char *errmsg;
datasec = bfd_get_section_by_name (abfd, ".sdata");
if (datasec == NULL || datasec->reloc_count == 0)
continue;
relsec = bfd_get_section_by_name (abfd, ".rel.sdata");
ASSERT (relsec != NULL);
if (! bfd_mips_ecoff_create_embedded_relocs (abfd, &link_info,
datasec, relsec,
&errmsg))
{
if (errmsg == NULL)
einfo ("%B%X: can not create runtime reloc information: %E\n",
abfd);
else
einfo ("%X%B: can not create runtime reloc information: %s\n",
abfd, errmsg);
}
}
}
static char *
gld${EMULATION_NAME}_get_script (int *isfile)
EOF
if test -n "$COMPILE_IN"
then
# Scripts compiled in.
# sed commands to quote an ld script as a C string.
sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF
{
*isfile = 0;
if (link_info.relocatable && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c
echo ' ; else return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c
echo '; }' >> e${EMULATION_NAME}.c
else
# Scripts read from the filesystem.
cat >>e${EMULATION_NAME}.c <<EOF
{
*isfile = 1;
if (link_info.relocatable && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
else if (link_info.relocatable)
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
else if (!config.magic_demand_paged)
return "ldscripts/${EMULATION_NAME}.xn";
else
return "ldscripts/${EMULATION_NAME}.x";
}
EOF
fi
cat >>e${EMULATION_NAME}.c <<EOF
struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
{
gld${EMULATION_NAME}_before_parse,
syslib_default,
hll_default,
after_parse_default,
gld${EMULATION_NAME}_after_open,
gld${EMULATION_NAME}_after_allocation,
set_output_arch_default,
ldemul_default_target,
before_allocation_default,
gld${EMULATION_NAME}_get_script,
"${EMULATION_NAME}",
"${OUTPUT_FORMAT}",
NULL, /* finish */
NULL, /* create output section statements */
NULL, /* open dynamic archive */
NULL, /* place orphan */
NULL, /* set symbols */
NULL, /* parse args */
NULL, /* add_options */
NULL, /* handle_option */
NULL, /* unrecognized file */
NULL, /* list options */
NULL, /* recognized file */
NULL, /* find_potential_libraries */
NULL /* new_vers_pattern */
};
EOF

View File

@ -0,0 +1,177 @@
# This shell script emits a C file. -*- C -*-
# Copyright 2002, 2003 Free Software Foundation, Inc.
# Written by Mitch Lichtenberg <mpl@broadcom.com> and
# Chris Demetriou <cgd@broadcom.com> based on m68kelf.em and mipsecoff.em.
#
# This file is part of GLD, the Gnu Linker.
#
# 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.
# This file is sourced from elf32.em, and defines some extra routines for m68k
# embedded systems using ELF and for some other systems using m68k ELF. While
# it is sourced from elf32.em for all m68k ELF configurations, here we include
# only the features we want depending on the configuration.
case ${target} in
mips*-*-elf)
echo "#define SUPPORT_EMBEDDED_RELOCS" >>e${EMULATION_NAME}.c
;;
esac
cat >>e${EMULATION_NAME}.c <<EOF
#ifdef SUPPORT_EMBEDDED_RELOCS
static void mips_elf${ELFSIZE}_check_sections (bfd *, asection *, void *);
#endif
/* This function is run after all the input files have been opened. */
static void
mips_elf${ELFSIZE}_after_open (void)
{
/* Call the standard elf routine. */
gld${EMULATION_NAME}_after_open ();
#ifdef SUPPORT_EMBEDDED_RELOCS
if (command_line.embedded_relocs && (! link_info.relocatable))
{
bfd *abfd;
/* In the embedded relocs mode we create a .rel.sdata section for
each input file with a .sdata section which has has
relocations. The BFD backend will fill in these sections
with magic numbers which can be used to relocate the data
section at run time. */
for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link_next)
{
asection *datasec;
/* As first-order business, make sure that each input BFD is
ELF. We need to call a special BFD backend function to
generate the embedded relocs, and we have that function
only for ELF */
if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
einfo ("%F%B: all input objects must be ELF for --embedded-relocs\n");
if (bfd_get_arch_size (abfd) != ${ELFSIZE})
einfo ("%F%B: all input objects must be ${ELFSIZE}-bit ELF for --embedded-relocs\n");
datasec = bfd_get_section_by_name (abfd, ".sdata");
/* Note that we assume that the reloc_count field has already
been set up. We could call bfd_get_reloc_upper_bound, but
that returns the size of a memory buffer rather than a reloc
count. We do not want to call bfd_canonicalize_reloc,
because although it would always work it would force us to
read in the relocs into BFD canonical form, which would waste
a significant amount of time and memory. */
if (datasec != NULL && datasec->reloc_count > 0)
{
asection *relsec;
relsec = bfd_make_section (abfd, ".rel.sdata");
if (relsec == NULL
|| ! bfd_set_section_flags (abfd, relsec,
(SEC_ALLOC
| SEC_LOAD
| SEC_HAS_CONTENTS
| SEC_IN_MEMORY))
|| ! bfd_set_section_alignment (abfd, relsec,
(${ELFSIZE} == 32) ? 2 : 3)
|| ! bfd_set_section_size (abfd, relsec,
datasec->reloc_count
* ((${ELFSIZE} / 8) + 8)))
einfo ("%F%B: cannot create .rel.sdata section: %E\n");
}
/* Double check that all other data sections have no relocs,
as is required for embedded PIC code. */
bfd_map_over_sections (abfd, mips_elf${ELFSIZE}_check_sections,
datasec);
}
}
#endif /* SUPPORT_EMBEDDED_RELOCS */
}
#ifdef SUPPORT_EMBEDDED_RELOCS
/* Check that of the data sections, only the .sdata section has
relocs. This is called via bfd_map_over_sections. */
static void
mips_elf${ELFSIZE}_check_sections (bfd *abfd, asection *sec, void *sdatasec)
{
if ((bfd_get_section_flags (abfd, sec) & SEC_DATA)
&& sec != sdatasec
&& sec->reloc_count != 0)
einfo ("%B%X: section %s has relocs; cannot use --embedded-relocs\n",
abfd, bfd_get_section_name (abfd, sec));
}
#endif /* SUPPORT_EMBEDDED_RELOCS */
/* This function is called after the section sizes and offsets have
been set. If we are generating embedded relocs, it calls a special
BFD backend routine to do the work. */
static void
mips_elf${ELFSIZE}_after_allocation (void)
{
/* Call the standard elf routine. */
after_allocation_default ();
#ifdef SUPPORT_EMBEDDED_RELOCS
if (command_line.embedded_relocs && (! link_info.relocatable))
{
bfd *abfd;
for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link_next)
{
asection *datasec, *relsec;
char *errmsg;
datasec = bfd_get_section_by_name (abfd, ".sdata");
if (datasec == NULL || datasec->reloc_count == 0)
continue;
relsec = bfd_get_section_by_name (abfd, ".rel.sdata");
ASSERT (relsec != NULL);
if (! bfd_mips_elf${ELFSIZE}_create_embedded_relocs (abfd,
&link_info,
datasec,
relsec,
&errmsg))
{
if (errmsg == NULL)
einfo ("%B%X: can not create runtime reloc information: %E\n",
abfd);
else
einfo ("%X%B: can not create runtime reloc information: %s\n",
abfd, errmsg);
}
}
}
#endif /* SUPPORT_EMBEDDED_RELOCS */
}
EOF
# We have our own after_open and after_allocation functions, but they call
# the standard routines, so give them a different name.
LDEMUL_AFTER_OPEN=mips_elf${ELFSIZE}_after_open
LDEMUL_AFTER_ALLOCATION=mips_elf${ELFSIZE}_after_allocation

View File

@ -0,0 +1,72 @@
# Linker script for MIPS systems.
# Ian Lance Taylor <ian@cygnus.com>.
# These variables may be overridden by the emulation file. The
# defaults are appropriate for a DECstation running Ultrix.
test -z "$ENTRY" && ENTRY=__start
if [ -z "$EMBEDDED" ]; then
test -z "$TEXT_START_ADDR" && TEXT_START_ADDR="0x400000 + SIZEOF_HEADERS"
else
test -z "$TEXT_START_ADDR" && TEXT_START_ADDR="0x400000"
fi
if test "x$LD_FLAG" = "xn" -o "x$LD_FLAG" = "xN"; then
DATA_ADDR=.
else
test -z "$DATA_ADDR" && DATA_ADDR=0x10000000
fi
cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
"${LITTLE_OUTPUT_FORMAT}")
${LIB_SEARCH_DIRS}
ENTRY(${ENTRY})
SECTIONS
{
${RELOCATING+. = ${TEXT_START_ADDR};}
.text : {
${RELOCATING+ _ftext = . };
*(.init)
${RELOCATING+ eprol = .};
*(.text)
${RELOCATING+PROVIDE (__runtime_reloc_start = .);}
*(.rel.sdata)
${RELOCATING+PROVIDE (__runtime_reloc_stop = .);}
*(.fini)
${RELOCATING+ etext = .};
${RELOCATING+ _etext = .};
}
${RELOCATING+. = ${DATA_ADDR};}
.rdata : {
*(.rdata)
}
${RELOCATING+ _fdata = ALIGN(16);}
.data : {
*(.data)
${CONSTRUCTING+CONSTRUCTORS}
}
${RELOCATING+ _gp = ALIGN(16) + 0x8000;}
.lit8 : {
*(.lit8)
}
.lit4 : {
*(.lit4)
}
.sdata : {
*(.sdata)
}
${RELOCATING+ edata = .;}
${RELOCATING+ _edata = .;}
${RELOCATING+ _fbss = .;}
.sbss : {
*(.sbss)
*(.scommon)
}
.bss : {
*(.bss)
*(COMMON)
}
${RELOCATING+ end = .;}
${RELOCATING+ _end = .;}
}
EOF

View File

@ -0,0 +1,30 @@
cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
"${LITTLE_OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
${RELOCATING+${LIB_SEARCH_DIRS}}
SECTIONS
{
${RELOCATING+. = ${TEXT_START_ADDR};}
.text :
{
CREATE_OBJECT_SYMBOLS
*(.text)
${RELOCATING+etext = ${DATA_ALIGNMENT};}
}
${RELOCATING+. = ${DATA_ALIGNMENT};}
.data :
{
*(.data)
${CONSTRUCTING+CONSTRUCTORS}
${RELOCATING+edata = .;}
}
.bss :
{
*(.bss)
*(COMMON)
${RELOCATING+end = . };
}
}
EOF

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,227 @@
/* mips16-opc.c. Mips16 opcode table.
Copyright 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
Contributed by Ian Lance Taylor, Cygnus Support
This file is part of GDB, GAS, and the GNU binutils.
GDB, GAS, and the GNU binutils are free software; you can redistribute
them and/or modify them under the terms of the GNU General Public
License as published by the Free Software Foundation; either version
1, or (at your option) any later version.
GDB, GAS, and the GNU binutils are distributed in the hope that they
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 file; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#include <stdio.h>
#include "sysdep.h"
#include "opcode/mips.h"
/* This is the opcodes table for the mips16 processor. The format of
this table is intentionally identical to the one in mips-opc.c.
However, the special letters that appear in the argument string are
different, and the table uses some different flags. */
/* Use some short hand macros to keep down the length of the lines in
the opcodes table. */
#define UBD INSN_UNCOND_BRANCH_DELAY
#define BR MIPS16_INSN_BRANCH
#define WR_x MIPS16_INSN_WRITE_X
#define WR_y MIPS16_INSN_WRITE_Y
#define WR_z MIPS16_INSN_WRITE_Z
#define WR_T MIPS16_INSN_WRITE_T
#define WR_SP MIPS16_INSN_WRITE_SP
#define WR_31 MIPS16_INSN_WRITE_31
#define WR_Y MIPS16_INSN_WRITE_GPR_Y
#define RD_x MIPS16_INSN_READ_X
#define RD_y MIPS16_INSN_READ_Y
#define RD_Z MIPS16_INSN_READ_Z
#define RD_T MIPS16_INSN_READ_T
#define RD_SP MIPS16_INSN_READ_SP
#define RD_31 MIPS16_INSN_READ_31
#define RD_PC MIPS16_INSN_READ_PC
#define RD_X MIPS16_INSN_READ_GPR_X
#define WR_HI INSN_WRITE_HI
#define WR_LO INSN_WRITE_LO
#define RD_HI INSN_READ_HI
#define RD_LO INSN_READ_LO
#define TRAP INSN_TRAP
#define I3 INSN_ISA3
#define T3 INSN_3900
const struct mips_opcode mips16_opcodes[] =
{
{"nop", "", 0x6500, 0xffff, RD_Z, 0 }, /* move $0,$Z */
{"la", "x,A", 0x0800, 0xf800, WR_x|RD_PC, 0 },
{"abs", "x,w", 0, (int) M_ABS, INSN_MACRO, 0 },
{"addiu", "y,x,4", 0x4000, 0xf810, WR_y|RD_x, 0 },
{"addiu", "x,k", 0x4800, 0xf800, WR_x|RD_x, 0 },
{"addiu", "S,K", 0x6300, 0xff00, WR_SP|RD_SP, 0 },
{"addiu", "S,S,K", 0x6300, 0xff00, WR_SP|RD_SP, 0 },
{"addiu", "x,P,V", 0x0800, 0xf800, WR_x|RD_PC, 0 },
{"addiu", "x,S,V", 0x0000, 0xf800, WR_x|RD_SP, 0 },
{"addu", "z,v,y", 0xe001, 0xf803, WR_z|RD_x|RD_y, 0 },
{"addu", "y,x,4", 0x4000, 0xf810, WR_y|RD_x, 0 },
{"addu", "x,k", 0x4800, 0xf800, WR_x|RD_x, 0 },
{"addu", "S,K", 0x6300, 0xff00, WR_SP|RD_SP, 0 },
{"addu", "S,S,K", 0x6300, 0xff00, WR_SP|RD_SP, 0 },
{"addu", "x,P,V", 0x0800, 0xf800, WR_x|RD_PC, 0 },
{"addu", "x,S,V", 0x0000, 0xf800, WR_x|RD_SP, 0 },
{"and", "x,y", 0xe80c, 0xf81f, WR_x|RD_x|RD_y, 0 },
{"b", "q", 0x1000, 0xf800, BR, 0 },
{"beq", "x,y,p", 0, (int) M_BEQ, INSN_MACRO, 0 },
{"beq", "x,U,p", 0, (int) M_BEQ_I, INSN_MACRO, 0 },
{"beqz", "x,p", 0x2000, 0xf800, BR|RD_x, 0 },
{"bge", "x,y,p", 0, (int) M_BGE, INSN_MACRO, 0 },
{"bge", "x,8,p", 0, (int) M_BGE_I, INSN_MACRO, 0 },
{"bgeu", "x,y,p", 0, (int) M_BGEU, INSN_MACRO, 0 },
{"bgeu", "x,8,p", 0, (int) M_BGEU_I, INSN_MACRO, 0 },
{"bgt", "x,y,p", 0, (int) M_BGT, INSN_MACRO, 0 },
{"bgt", "x,8,p", 0, (int) M_BGT_I, INSN_MACRO, 0 },
{"bgtu", "x,y,p", 0, (int) M_BGTU, INSN_MACRO, 0 },
{"bgtu", "x,8,p", 0, (int) M_BGTU_I, INSN_MACRO, 0 },
{"ble", "x,y,p", 0, (int) M_BLE, INSN_MACRO, 0 },
{"ble", "x,8,p", 0, (int) M_BLE_I, INSN_MACRO, 0 },
{"bleu", "x,y,p", 0, (int) M_BLEU, INSN_MACRO, 0 },
{"bleu", "x,8,p", 0, (int) M_BLEU_I, INSN_MACRO, 0 },
{"blt", "x,y,p", 0, (int) M_BLT, INSN_MACRO, 0 },
{"blt", "x,8,p", 0, (int) M_BLT_I, INSN_MACRO, 0 },
{"bltu", "x,y,p", 0, (int) M_BLTU, INSN_MACRO, 0 },
{"bltu", "x,8,p", 0, (int) M_BLTU_I, INSN_MACRO, 0 },
{"bne", "x,y,p", 0, (int) M_BNE, INSN_MACRO, 0 },
{"bne", "x,U,p", 0, (int) M_BNE_I, INSN_MACRO, 0 },
{"bnez", "x,p", 0x2800, 0xf800, BR|RD_x, 0 },
{"break", "6", 0xe805, 0xf81f, TRAP, 0 },
{"bteqz", "p", 0x6000, 0xff00, BR|RD_T, 0 },
{"btnez", "p", 0x6100, 0xff00, BR|RD_T, 0 },
{"cmpi", "x,U", 0x7000, 0xf800, WR_T|RD_x, 0 },
{"cmp", "x,y", 0xe80a, 0xf81f, WR_T|RD_x|RD_y, 0 },
{"cmp", "x,U", 0x7000, 0xf800, WR_T|RD_x, 0 },
{"dla", "y,E", 0xfe00, 0xff00, WR_y|RD_PC, I3 },
{"daddiu", "y,x,4", 0x4010, 0xf810, WR_y|RD_x, I3 },
{"daddiu", "y,j", 0xfd00, 0xff00, WR_y|RD_y, I3 },
{"daddiu", "S,K", 0xfb00, 0xff00, WR_SP|RD_SP, I3 },
{"daddiu", "S,S,K", 0xfb00, 0xff00, WR_SP|RD_SP, I3 },
{"daddiu", "y,P,W", 0xfe00, 0xff00, WR_y|RD_PC, I3 },
{"daddiu", "y,S,W", 0xff00, 0xff00, WR_y|RD_SP, I3 },
{"daddu", "z,v,y", 0xe000, 0xf803, WR_z|RD_x|RD_y, I3 },
{"daddu", "y,x,4", 0x4010, 0xf810, WR_y|RD_x, I3 },
{"daddu", "y,j", 0xfd00, 0xff00, WR_y|RD_y, I3 },
{"daddu", "S,K", 0xfb00, 0xff00, WR_SP|RD_SP, I3 },
{"daddu", "S,S,K", 0xfb00, 0xff00, WR_SP|RD_SP, I3 },
{"daddu", "y,P,W", 0xfe00, 0xff00, WR_y|RD_PC, I3 },
{"daddu", "y,S,W", 0xff00, 0xff00, WR_y|RD_SP, I3 },
{"ddiv", "0,x,y", 0xe81e, 0xf81f, RD_x|RD_y|WR_HI|WR_LO, I3 },
{"ddiv", "z,v,y", 0, (int) M_DDIV_3, INSN_MACRO, 0 },
{"ddivu", "0,x,y", 0xe81f, 0xf81f, RD_x|RD_y|WR_HI|WR_LO, I3 },
{"ddivu", "z,v,y", 0, (int) M_DDIVU_3, INSN_MACRO, 0 },
{"div", "0,x,y", 0xe81a, 0xf81f, RD_x|RD_y|WR_HI|WR_LO, 0 },
{"div", "z,v,y", 0, (int) M_DIV_3, INSN_MACRO, 0 },
{"divu", "0,x,y", 0xe81b, 0xf81f, RD_x|RD_y|WR_HI|WR_LO, 0 },
{"divu", "z,v,y", 0, (int) M_DIVU_3, INSN_MACRO, 0 },
{"dmul", "z,v,y", 0, (int) M_DMUL, INSN_MACRO, I3 },
{"dmult", "x,y", 0xe81c, 0xf81f, RD_x|RD_y|WR_HI|WR_LO, I3 },
{"dmultu", "x,y", 0xe81d, 0xf81f, RD_x|RD_y|WR_HI|WR_LO, I3 },
{"drem", "0,x,y", 0xe81e, 0xf81f, RD_x|RD_y|WR_HI|WR_LO, I3 },
{"drem", "z,v,y", 0, (int) M_DREM_3, INSN_MACRO, 0 },
{"dremu", "0,x,y", 0xe81f, 0xf81f, RD_x|RD_y|WR_HI|WR_LO, I3 },
{"dremu", "z,v,y", 0, (int) M_DREMU_3, INSN_MACRO, 0 },
{"dsllv", "y,x", 0xe814, 0xf81f, WR_y|RD_y|RD_x, I3 },
{"dsll", "x,w,[", 0x3001, 0xf803, WR_x|RD_y, I3 },
{"dsll", "y,x", 0xe814, 0xf81f, WR_y|RD_y|RD_x, I3 },
{"dsrav", "y,x", 0xe817, 0xf81f, WR_y|RD_y|RD_x, I3 },
{"dsra", "y,]", 0xe813, 0xf81f, WR_y|RD_y, I3 },
{"dsra", "y,x", 0xe817, 0xf81f, WR_y|RD_y|RD_x, I3 },
{"dsrlv", "y,x", 0xe816, 0xf81f, WR_y|RD_y|RD_x, I3 },
{"dsrl", "y,]", 0xe808, 0xf81f, WR_y|RD_y, I3 },
{"dsrl", "y,x", 0xe816, 0xf81f, WR_y|RD_y|RD_x, I3 },
{"dsubu", "z,v,y", 0xe002, 0xf803, WR_z|RD_x|RD_y, I3 },
{"dsubu", "y,x,4", 0, (int) M_DSUBU_I, INSN_MACRO, 0 },
{"dsubu", "y,j", 0, (int) M_DSUBU_I_2, INSN_MACRO, 0 },
{"exit", "L", 0xed09, 0xff1f, TRAP, 0 },
{"exit", "L", 0xee09, 0xff1f, TRAP, 0 },
{"exit", "L", 0xef09, 0xff1f, TRAP, 0 },
{"entry", "l", 0xe809, 0xf81f, TRAP, 0 },
{"extend", "e", 0xf000, 0xf800, 0, 0 },
{"jalr", "x", 0xe840, 0xf8ff, UBD|WR_31|RD_x, 0 },
{"jalr", "R,x", 0xe840, 0xf8ff, UBD|WR_31|RD_x, 0 },
{"jal", "x", 0xe840, 0xf8ff, UBD|WR_31|RD_x, 0 },
{"jal", "R,x", 0xe840, 0xf8ff, UBD|WR_31|RD_x, 0 },
{"jal", "a", 0x1800, 0xfc00, UBD|WR_31, 0 },
{"jalx", "a", 0x1c00, 0xfc00, UBD|WR_31, 0 },
{"jr", "x", 0xe800, 0xf8ff, UBD|RD_x, 0 },
{"jr", "R", 0xe820, 0xffff, UBD|RD_31, 0 },
{"j", "x", 0xe800, 0xf8ff, UBD|RD_x, 0 },
{"j", "R", 0xe820, 0xffff, UBD|RD_31, 0 },
{"lb", "y,5(x)", 0x8000, 0xf800, WR_y|RD_x, 0 },
{"lbu", "y,5(x)", 0xa000, 0xf800, WR_y|RD_x, 0 },
{"ld", "y,D(x)", 0x3800, 0xf800, WR_y|RD_x, I3 },
{"ld", "y,B", 0xfc00, 0xff00, WR_y|RD_PC, I3 },
{"ld", "y,D(P)", 0xfc00, 0xff00, WR_y|RD_PC, I3 },
{"ld", "y,D(S)", 0xf800, 0xff00, WR_y|RD_SP, I3 },
{"lh", "y,H(x)", 0x8800, 0xf800, WR_y|RD_x, 0 },
{"lhu", "y,H(x)", 0xa800, 0xf800, WR_y|RD_x, 0 },
{"li", "x,U", 0x6800, 0xf800, WR_x, 0 },
{"lw", "y,W(x)", 0x9800, 0xf800, WR_y|RD_x, 0 },
{"lw", "x,A", 0xb000, 0xf800, WR_x|RD_PC, 0 },
{"lw", "x,V(P)", 0xb000, 0xf800, WR_x|RD_PC, 0 },
{"lw", "x,V(S)", 0x9000, 0xf800, WR_x|RD_SP, 0 },
{"lwu", "y,W(x)", 0xb800, 0xf800, WR_y|RD_x, I3 },
{"mfhi", "x", 0xe810, 0xf8ff, WR_x|RD_HI, 0 },
{"mflo", "x", 0xe812, 0xf8ff, WR_x|RD_LO, 0 },
{"move", "y,X", 0x6700, 0xff00, WR_y|RD_X, 0 },
{"move", "Y,Z", 0x6500, 0xff00, WR_Y|RD_Z, 0 },
{"mul", "z,v,y", 0, (int) M_MUL, INSN_MACRO, 0 },
{"mult", "x,y", 0xe818, 0xf81f, RD_x|RD_y|WR_HI|WR_LO, 0 },
{"multu", "x,y", 0xe819, 0xf81f, RD_x|RD_y|WR_HI|WR_LO, 0 },
{"neg", "x,w", 0xe80b, 0xf81f, WR_x|RD_y, 0 },
{"not", "x,w", 0xe80f, 0xf81f, WR_x|RD_y, 0 },
{"or", "x,y", 0xe80d, 0xf81f, WR_x|RD_x|RD_y, 0 },
{"rem", "0,x,y", 0xe81a, 0xf81f, RD_x|RD_y|WR_HI|WR_LO, 0 },
{"rem", "z,v,y", 0, (int) M_REM_3, INSN_MACRO, 0 },
{"remu", "0,x,y", 0xe81b, 0xf81f, RD_x|RD_y|WR_HI|WR_LO, 0 },
{"remu", "z,v,y", 0, (int) M_REMU_3, INSN_MACRO, 0 },
{"sb", "y,5(x)", 0xc000, 0xf800, RD_y|RD_x, 0 },
{"sd", "y,D(x)", 0x7800, 0xf800, RD_y|RD_x, I3 },
{"sd", "y,D(S)", 0xf900, 0xff00, RD_y|RD_PC, I3 },
{"sd", "R,C(S)", 0xfa00, 0xff00, RD_31|RD_PC, 0 },
{"sh", "y,H(x)", 0xc800, 0xf800, RD_y|RD_x, 0 },
{"sllv", "y,x", 0xe804, 0xf81f, WR_y|RD_y|RD_x, 0 },
{"sll", "x,w,<", 0x3000, 0xf803, WR_x|RD_y, 0 },
{"sll", "y,x", 0xe804, 0xf81f, WR_y|RD_y|RD_x, 0 },
{"slti", "x,8", 0x5000, 0xf800, WR_T|RD_x, 0 },
{"slt", "x,y", 0xe802, 0xf81f, WR_T|RD_x|RD_y, 0 },
{"slt", "x,8", 0x5000, 0xf800, WR_T|RD_x, 0 },
{"sltiu", "x,8", 0x5800, 0xf800, WR_T|RD_x, 0 },
{"sltu", "x,y", 0xe803, 0xf81f, WR_T|RD_x|RD_y, 0 },
{"sltu", "x,8", 0x5800, 0xf800, WR_T|RD_x, 0 },
{"srav", "y,x", 0xe807, 0xf81f, WR_y|RD_y|RD_x, 0 },
{"sra", "x,w,<", 0x3003, 0xf803, WR_x|RD_y, 0 },
{"sra", "y,x", 0xe807, 0xf81f, WR_y|RD_y|RD_x, 0 },
{"srlv", "y,x", 0xe806, 0xf81f, WR_y|RD_y|RD_x, 0 },
{"srl", "x,w,<", 0x3002, 0xf803, WR_x|RD_y, 0 },
{"srl", "y,x", 0xe806, 0xf81f, WR_y|RD_y|RD_x, 0 },
{"subu", "z,v,y", 0xe003, 0xf803, WR_z|RD_x|RD_y, 0 },
{"subu", "y,x,4", 0, (int) M_SUBU_I, INSN_MACRO, 0 },
{"subu", "x,k", 0, (int) M_SUBU_I_2, INSN_MACRO,0 },
{"sw", "y,W(x)", 0xd800, 0xf800, RD_y|RD_x, 0 },
{"sw", "x,V(S)", 0xd000, 0xf800, RD_x|RD_SP, 0 },
{"sw", "R,V(S)", 0x6200, 0xff00, RD_31|RD_SP, 0 },
{"xor", "x,y", 0xe80e, 0xf81f, WR_x|RD_x|RD_y, 0 },
};
const int bfd_mips16_num_opcodes =
((sizeof mips16_opcodes) / (sizeof (mips16_opcodes[0])));