]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
This commit was manufactured by cvs2svn to create branch
authornobody <>
Fri, 9 Aug 2002 15:39:20 +0000 (15:39 +0000)
committernobody <>
Fri, 9 Aug 2002 15:39:20 +0000 (15:39 +0000)
'kseitz_interps-20020528-branch'.

Cherrypick from master 2002-08-09 15:39:19 UTC Nick Clifton <nickc@redhat.com> 'Oops - omitted from previous delta':
    bfd/elf32-ppcqnx.c
    bfd/elf32-qnx.h
    bfd/elfarmqnx-nabi.c
    bfd/elfn32-mips.c
    gdb/config/powerpc/aix432.mh
    gdb/gdb_obstack.h
    gdb/mips-irix-tdep.c
    gdb/solib-irix.c
    include/gdb/sim-h8300.h
    opcodes/po/pt_BR.po

bfd/elf32-ppcqnx.c [new file with mode: 0644]
bfd/elf32-qnx.h [new file with mode: 0644]
bfd/elfarmqnx-nabi.c [new file with mode: 0644]
bfd/elfn32-mips.c [new file with mode: 0644]
gdb/config/powerpc/aix432.mh [new file with mode: 0644]
gdb/gdb_obstack.h [new file with mode: 0644]
gdb/mips-irix-tdep.c [new file with mode: 0644]
gdb/solib-irix.c [new file with mode: 0644]
include/gdb/sim-h8300.h [new file with mode: 0644]
opcodes/po/pt_BR.po [new file with mode: 0644]

diff --git a/bfd/elf32-ppcqnx.c b/bfd/elf32-ppcqnx.c
new file mode 100644 (file)
index 0000000..35fbe37
--- /dev/null
@@ -0,0 +1,32 @@
+/* PowerPC QNX specific support for 32-bit ELF
+   Copyright 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.  */
+
+#define ELF32_PPC_C_INCLUDED
+#include "elf32-ppc.c"
+
+#include "elf32-qnx.h"
+
+#undef  TARGET_LITTLE_SYM 
+#define TARGET_LITTLE_SYM       bfd_elf32_powerpcleqnx_vec
+#undef  TARGET_BIG_SYM
+#define TARGET_BIG_SYM          bfd_elf32_powerpcqnx_vec
+
+#include "elf32-target.h"
+
diff --git a/bfd/elf32-qnx.h b/bfd/elf32-qnx.h
new file mode 100644 (file)
index 0000000..454c2b4
--- /dev/null
@@ -0,0 +1,111 @@
+/* QNX specific support for 32-bit ELF
+   Copyright 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.  */
+
+  /* Returns the end address of the segment + 1.  */
+#define SEGMENT_END(segment, start)                     \
+  (start + (segment->p_memsz > segment->p_filesz        \
+   ? segment->p_memsz : segment->p_filesz))
+
+static boolean elf_i386qnx_copy_private_bfd_data_p
+  PARAMS ((bfd *, asection *, bfd *, asection *));
+static boolean elf_i386qnx_is_contained_by_filepos
+  PARAMS ((asection *, Elf_Internal_Phdr *));
+static void elf_i386qnx_set_nonloadable_filepos
+  PARAMS ((bfd *, Elf_Internal_Phdr *));
+
+static boolean
+elf_qnx_copy_private_bfd_data_p (ibfd, isec, obfd, osec)
+     bfd *ibfd;
+     asection *isec;
+     bfd *obfd;
+     asection *osec;
+{
+  /* We don't use these parameters, but another target might.  */
+  ibfd = ibfd;
+  obfd = obfd;
+  osec = osec;
+
+  return isec->next == NULL;
+}
+
+static boolean
+elf_qnx_is_contained_by_filepos (section, segment)
+     asection *section;
+     Elf_Internal_Phdr *segment;
+{
+  return ((bfd_vma) section->filepos >= segment->p_offset
+          && ((bfd_vma) section->filepos + section->_raw_size
+             <= SEGMENT_END (segment, segment->p_offset)));
+}
+
+static void
+elf_qnx_set_nonloadable_filepos (abfd, phdrs)
+     bfd *abfd;
+     Elf_Internal_Phdr *phdrs;
+{
+  struct elf_segment_map *m;
+  Elf_Internal_Phdr *p;
+  file_ptr off = 0;
+
+  for (m = elf_tdata (abfd)->segment_map, p = phdrs;
+       m != NULL;
+       m = m->next, p++)
+    {
+      unsigned int i;
+      asection **secpp;
+
+      for (i = 0, secpp = m->sections; i < m->count; i++, secpp++)
+        {
+          asection *sec;
+
+          sec = *secpp;
+
+          if (p->p_type == PT_LOAD)
+           off = sec->filepos;
+          else
+            {
+              if (i == 0)
+                {
+                  if (sec->filepos)
+                    p->p_offset = sec->filepos;
+                  else
+                    p->p_offset = off;
+                }
+              if (!sec->filepos)
+                {
+                  off += sec->_raw_size;
+                  p->p_filesz += sec->_raw_size;
+                }
+            }
+        }
+    }
+  return;
+}
+
+#ifndef elf_backend_set_nonloadable_filepos
+#define elf_backend_set_nonloadable_filepos elf_qnx_set_nonloadable_filepos
+#endif
+
+#ifndef elf_backend_is_contained_by_filepos
+#define elf_backend_is_contained_by_filepos elf_qnx_is_contained_by_filepos
+#endif
+
+#ifndef elf_backend_copy_private_bfd_data_p
+#define elf_backend_copy_private_bfd_data_p elf_qnx_copy_private_bfd_data_p
+#endif
diff --git a/bfd/elfarmqnx-nabi.c b/bfd/elfarmqnx-nabi.c
new file mode 100644 (file)
index 0000000..7647b3d
--- /dev/null
@@ -0,0 +1,34 @@
+/* ARM new abi QNX specific support for 32-bit ELF
+   Copyright 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.  */
+
+#define ELFARM_NABI_C_INCLUDED
+#include "elfarm-nabi.c"
+
+#include "elf32-qnx.h"
+
+#undef  TARGET_LITTLE_SYM 
+#define TARGET_LITTLE_SYM       bfd_elf32_littlearmqnx_vec
+#undef  TARGET_BIG_SYM
+#define TARGET_BIG_SYM          bfd_elf32_bigarmqnx_vec
+
+/* QNX Neutrino for ARM has a max pagesize of 0x1000.  */
+#undef  ELF_MAXPAGESIZE
+#define ELF_MAXPAGESIZE        0x1000
+
+#include "elf32-arm.h"
diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c
new file mode 100644 (file)
index 0000000..040fddf
--- /dev/null
@@ -0,0 +1,2230 @@
+/* MIPS-specific support for 32-bit ELF
+   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+   Free Software Foundation, Inc.
+
+   Most of the information added by Ian Lance Taylor, Cygnus Support,
+   <ian@cygnus.com>.
+   N32/64 ABI support added by Mark Mitchell, CodeSourcery, LLC.
+   <mark@codesourcery.com>
+   Traditional MIPS targets support added by Koundinya.K, Dansk Data
+   Elektronik & Operations Research Group. <kk@ddeorg.soft.net>
+
+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.  */
+
+/* This file handles MIPS ELF targets.  SGI Irix 5 uses a slightly
+   different MIPS ELF from other targets.  This matters when linking.
+   This file supports both, switching at runtime.  */
+
+#include "bfd.h"
+#include "sysdep.h"
+#include "libbfd.h"
+#include "bfdlink.h"
+#include "genlink.h"
+#include "elf-bfd.h"
+#include "elfxx-mips.h"
+#include "elf/mips.h"
+
+/* Get the ECOFF swapping routines.  */
+#include "coff/sym.h"
+#include "coff/symconst.h"
+#include "coff/internal.h"
+#include "coff/ecoff.h"
+#include "coff/mips.h"
+#define ECOFF_SIGNED_32
+#include "ecoffswap.h"
+
+static bfd_reloc_status_type mips_elf_generic_reloc
+  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static bfd_reloc_status_type mips_elf_hi16_reloc
+  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static bfd_reloc_status_type mips_elf_lo16_reloc
+  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static bfd_reloc_status_type mips_elf_got16_reloc
+  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static boolean mips_elf_assign_gp PARAMS ((bfd *, bfd_vma *));
+static bfd_reloc_status_type mips_elf_final_gp
+  PARAMS ((bfd *, asymbol *, boolean, char **, bfd_vma *));
+static bfd_reloc_status_type mips_elf_gprel16_reloc
+  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static bfd_reloc_status_type mips_elf_literal_reloc
+  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static bfd_reloc_status_type mips_elf_gprel32_reloc
+  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static bfd_reloc_status_type gprel32_with_gp
+  PARAMS ((bfd *, asymbol *, arelent *, asection *, boolean, PTR, bfd_vma));
+static bfd_reloc_status_type mips_elf_shift6_reloc
+  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static bfd_reloc_status_type mips16_jump_reloc
+  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static bfd_reloc_status_type mips16_gprel_reloc
+  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
+  PARAMS ((bfd *, bfd_reloc_code_real_type));
+static reloc_howto_type *mips_elf_n32_rtype_to_howto
+  PARAMS ((unsigned int, boolean));
+static void mips_info_to_howto_rel
+  PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
+static void mips_info_to_howto_rela
+  PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+static boolean mips_elf_sym_is_global PARAMS ((bfd *, asymbol *));
+static boolean mips_elf_n32_object_p PARAMS ((bfd *));
+static boolean elf32_mips_grok_prstatus
+  PARAMS ((bfd *, Elf_Internal_Note *));
+static boolean elf32_mips_grok_psinfo
+  PARAMS ((bfd *, Elf_Internal_Note *));
+static irix_compat_t elf_n32_mips_irix_compat
+  PARAMS ((bfd *));
+
+extern const bfd_target bfd_elf32_nbigmips_vec;
+extern const bfd_target bfd_elf32_nlittlemips_vec;
+
+static bfd_vma prev_reloc_address = -1;
+static bfd_vma prev_reloc_addend = 0;
+
+/* Nonzero if ABFD is using the N32 ABI.  */
+#define ABI_N32_P(abfd) \
+  ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0)
+
+/* Whether we are trying to be compatible with IRIX at all.  */
+#define SGI_COMPAT(abfd) \
+  (elf_n32_mips_irix_compat (abfd) != ict_none)
+
+/* The number of local .got entries we reserve.  */
+#define MIPS_RESERVED_GOTNO (2)
+
+/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
+   from smaller values.  Start with zero, widen, *then* decrement.  */
+#define MINUS_ONE      (((bfd_vma)0) - 1)
+
+/* The relocation table used for SHT_REL sections.  */
+
+static reloc_howto_type elf_mips_howto_table_rel[] =
+{
+  /* No relocation.  */
+  HOWTO (R_MIPS_NONE,          /* type */
+        0,                     /* rightshift */
+        0,                     /* size (0 = byte, 1 = short, 2 = long) */
+        0,                     /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_NONE",         /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0,                     /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* 16 bit relocation.  */
+  HOWTO (R_MIPS_16,            /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_16",           /* name */
+        true,                  /* partial_inplace */
+        0x0000ffff,            /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* 32 bit relocation.  */
+  HOWTO (R_MIPS_32,            /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_32",           /* name */
+        true,                  /* partial_inplace */
+        0xffffffff,            /* src_mask */
+        0xffffffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* 32 bit symbol relative relocation.  */
+  HOWTO (R_MIPS_REL32,         /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_REL32",        /* name */
+        true,                  /* partial_inplace */
+        0xffffffff,            /* src_mask */
+        0xffffffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* 26 bit jump address.  */
+  HOWTO (R_MIPS_26,            /* type */
+        2,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        26,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+                               /* This needs complex overflow
+                                  detection, because the upper four
+                                  bits must match the PC + 4.  */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_26",           /* name */
+        true,                  /* partial_inplace */
+        0x03ffffff,            /* src_mask */
+        0x03ffffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* R_MIPS_HI16 and R_MIPS_LO16 are unsupported for NewABI REL.
+     However, the native IRIX6 tools use them, so we try our best. */
+
+  /* High 16 bits of symbol value.  */
+  HOWTO (R_MIPS_HI16,          /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_hi16_reloc,   /* special_function */
+        "R_MIPS_HI16",         /* name */
+        true,                  /* partial_inplace */
+        0x0000ffff,            /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Low 16 bits of symbol value.  */
+  HOWTO (R_MIPS_LO16,          /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_lo16_reloc,   /* special_function */
+        "R_MIPS_LO16",         /* name */
+        true,                  /* partial_inplace */
+        0x0000ffff,            /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* GP relative reference.  */
+  HOWTO (R_MIPS_GPREL16,       /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        mips_elf_gprel16_reloc, /* special_function */
+        "R_MIPS_GPREL16",      /* name */
+        true,                  /* partial_inplace */
+        0x0000ffff,            /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Reference to literal section.  */
+  HOWTO (R_MIPS_LITERAL,       /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        mips_elf_literal_reloc, /* special_function */
+        "R_MIPS_LITERAL",      /* name */
+        true,                  /* partial_inplace */
+        0x0000ffff,            /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Reference to global offset table.  */
+  HOWTO (R_MIPS_GOT16,         /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        mips_elf_got16_reloc,  /* special_function */
+        "R_MIPS_GOT16",        /* name */
+        true,                  /* partial_inplace */
+        0x0000ffff,            /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* 16 bit PC relative reference.  */
+  HOWTO (R_MIPS_PC16,          /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        true,                  /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_PC16",         /* name */
+        true,                  /* partial_inplace */
+        0x0000ffff,            /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        true),                 /* pcrel_offset */
+
+  /* 16 bit call through global offset table.  */
+  HOWTO (R_MIPS_CALL16,                /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_CALL16",       /* name */
+        true,                  /* partial_inplace */
+        0x0000ffff,            /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* 32 bit GP relative reference.  */
+  HOWTO (R_MIPS_GPREL32,       /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_gprel32_reloc, /* special_function */
+        "R_MIPS_GPREL32",      /* name */
+        true,                  /* partial_inplace */
+        0xffffffff,            /* src_mask */
+        0xffffffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* The remaining relocs are defined on Irix 5, although they are
+     not defined by the ABI.  */
+  EMPTY_HOWTO (13),
+  EMPTY_HOWTO (14),
+  EMPTY_HOWTO (15),
+
+  /* A 5 bit shift field.  */
+  HOWTO (R_MIPS_SHIFT5,                /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        5,                     /* bitsize */
+        false,                 /* pc_relative */
+        6,                     /* bitpos */
+        complain_overflow_bitfield, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_SHIFT5",       /* name */
+        true,                  /* partial_inplace */
+        0x000007c0,            /* src_mask */
+        0x000007c0,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* A 6 bit shift field.  */
+  HOWTO (R_MIPS_SHIFT6,                /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        6,                     /* bitsize */
+        false,                 /* pc_relative */
+        6,                     /* bitpos */
+        complain_overflow_bitfield, /* complain_on_overflow */
+        mips_elf_shift6_reloc, /* special_function */
+        "R_MIPS_SHIFT6",       /* name */
+        true,                  /* partial_inplace */
+        0x000007c4,            /* src_mask */
+        0x000007c4,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* A 64 bit relocation.  */
+  HOWTO (R_MIPS_64,            /* type */
+        0,                     /* rightshift */
+        4,                     /* size (0 = byte, 1 = short, 2 = long) */
+        64,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_64",           /* name */
+        true,                  /* partial_inplace */
+        MINUS_ONE,             /* src_mask */
+        MINUS_ONE,             /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Displacement in the global offset table.  */
+  HOWTO (R_MIPS_GOT_DISP,      /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_GOT_DISP",     /* name */
+        true,                  /* partial_inplace */
+        0x0000ffff,            /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Displacement to page pointer in the global offset table.  */
+  HOWTO (R_MIPS_GOT_PAGE,      /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_GOT_PAGE",     /* name */
+        true,                  /* partial_inplace */
+        0x0000ffff,            /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Offset from page pointer in the global offset table.  */
+  HOWTO (R_MIPS_GOT_OFST,      /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_GOT_OFST",     /* name */
+        true,                  /* partial_inplace */
+        0x0000ffff,            /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* High 16 bits of displacement in global offset table.  */
+  HOWTO (R_MIPS_GOT_HI16,      /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_GOT_HI16",     /* name */
+        true,                  /* partial_inplace */
+        0x0000ffff,            /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Low 16 bits of displacement in global offset table.  */
+  HOWTO (R_MIPS_GOT_LO16,      /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_GOT_LO16",     /* name */
+        true,                  /* partial_inplace */
+        0x0000ffff,            /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* 64 bit subtraction.  */
+  HOWTO (R_MIPS_SUB,           /* type */
+        0,                     /* rightshift */
+        4,                     /* size (0 = byte, 1 = short, 2 = long) */
+        64,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_SUB",          /* name */
+        true,                  /* partial_inplace */
+        MINUS_ONE,             /* src_mask */
+        MINUS_ONE,             /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Insert the addend as an instruction.  */
+  /* FIXME: Not handled correctly.  */
+  HOWTO (R_MIPS_INSERT_A,      /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_INSERT_A",     /* name */
+        true,                  /* partial_inplace */
+        0xffffffff,            /* src_mask */
+        0xffffffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Insert the addend as an instruction, and change all relocations
+     to refer to the old instruction at the address.  */
+  /* FIXME: Not handled correctly.  */
+  HOWTO (R_MIPS_INSERT_B,      /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_INSERT_B",     /* name */
+        true,                  /* partial_inplace */
+        0xffffffff,            /* src_mask */
+        0xffffffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Delete a 32 bit instruction.  */
+  /* FIXME: Not handled correctly.  */
+  HOWTO (R_MIPS_DELETE,                /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_DELETE",       /* name */
+        true,                  /* partial_inplace */
+        0xffffffff,            /* src_mask */
+        0xffffffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* The MIPS ELF64 ABI Draft wants us to support these for REL relocations.
+     We don't, because
+       a) It means building the addend from a R_MIPS_HIGHEST/R_MIPS_HIGHER/
+         R_MIPS_HI16/R_MIPS_LO16 sequence with varying ordering, using
+         fallable heuristics.
+       b) No other NEwABI toolchain actually emits such relocations.  */
+  EMPTY_HOWTO (R_MIPS_HIGHER),
+  EMPTY_HOWTO (R_MIPS_HIGHEST),
+
+  /* High 16 bits of displacement in global offset table.  */
+  HOWTO (R_MIPS_CALL_HI16,     /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_CALL_HI16",    /* name */
+        true,                  /* partial_inplace */
+        0x0000ffff,            /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Low 16 bits of displacement in global offset table.  */
+  HOWTO (R_MIPS_CALL_LO16,     /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_CALL_LO16",    /* name */
+        true,                  /* partial_inplace */
+        0x0000ffff,            /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Section displacement.  */
+  HOWTO (R_MIPS_SCN_DISP,       /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_SCN_DISP",     /* name */
+        true,                  /* partial_inplace */
+        0xffffffff,            /* src_mask */
+        0xffffffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  HOWTO (R_MIPS_REL16,         /* type */
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_REL16",        /* name */
+        true,                  /* partial_inplace */
+        0xffff,                /* src_mask */
+        0xffff,                /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* These two are obsolete.  */
+  EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
+  EMPTY_HOWTO (R_MIPS_PJUMP),
+
+  /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
+     It must be used for multigot GOT's (and only there).  */
+  HOWTO (R_MIPS_RELGOT,                /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_RELGOT",       /* name */
+        true,                  /* partial_inplace */
+        0xffffffff,            /* src_mask */
+        0xffffffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Protected jump conversion.  This is an optimization hint.  No
+     relocation is required for correctness.  */
+  HOWTO (R_MIPS_JALR,          /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_JALR",         /* name */
+        false,                 /* partial_inplace */
+        0x00000000,            /* src_mask */
+        0x00000000,            /* dst_mask */
+        false),                /* pcrel_offset */
+};
+
+/* The relocation table used for SHT_RELA sections.  */
+
+static reloc_howto_type elf_mips_howto_table_rela[] =
+{
+  /* No relocation.  */
+  HOWTO (R_MIPS_NONE,          /* type */
+        0,                     /* rightshift */
+        0,                     /* size (0 = byte, 1 = short, 2 = long) */
+        0,                     /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_NONE",         /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0,                     /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* 16 bit relocation.  */
+  HOWTO (R_MIPS_16,            /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_16",           /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0x0000,                /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* 32 bit relocation.  */
+  HOWTO (R_MIPS_32,            /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_32",           /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffffffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* 32 bit symbol relative relocation.  */
+  HOWTO (R_MIPS_REL32,         /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_REL32",        /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffffffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* 26 bit jump address.  */
+  HOWTO (R_MIPS_26,            /* type */
+        2,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        26,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+                               /* This needs complex overflow
+                                  detection, because the upper 36
+                                  bits must match the PC + 4.  */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_26",           /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0x03ffffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* High 16 bits of symbol value.  */
+  HOWTO (R_MIPS_HI16,          /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_HI16",         /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Low 16 bits of symbol value.  */
+  HOWTO (R_MIPS_LO16,          /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_LO16",         /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* GP relative reference.  */
+  HOWTO (R_MIPS_GPREL16,       /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        mips_elf_gprel16_reloc, /* special_function */
+        "R_MIPS_GPREL16",      /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Reference to literal section.  */
+  HOWTO (R_MIPS_LITERAL,       /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        mips_elf_literal_reloc, /* special_function */
+        "R_MIPS_LITERAL",      /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Reference to global offset table.  */
+  HOWTO (R_MIPS_GOT16,         /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        mips_elf_got16_reloc,  /* special_function */
+        "R_MIPS_GOT16",        /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* 16 bit PC relative reference.  */
+  HOWTO (R_MIPS_PC16,          /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        true,                  /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_PC16",         /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        true),                 /* pcrel_offset */
+
+  /* 16 bit call through global offset table.  */
+  HOWTO (R_MIPS_CALL16,                /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_CALL16",       /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* 32 bit GP relative reference.  */
+  HOWTO (R_MIPS_GPREL32,       /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_gprel32_reloc, /* special_function */
+        "R_MIPS_GPREL32",      /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffffffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  EMPTY_HOWTO (13),
+  EMPTY_HOWTO (14),
+  EMPTY_HOWTO (15),
+
+  /* A 5 bit shift field.  */
+  HOWTO (R_MIPS_SHIFT5,                /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        5,                     /* bitsize */
+        false,                 /* pc_relative */
+        6,                     /* bitpos */
+        complain_overflow_bitfield, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_SHIFT5",       /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0x000007c0,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* A 6 bit shift field.  */
+  HOWTO (R_MIPS_SHIFT6,                /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        6,                     /* bitsize */
+        false,                 /* pc_relative */
+        6,                     /* bitpos */
+        complain_overflow_bitfield, /* complain_on_overflow */
+        mips_elf_shift6_reloc, /* special_function */
+        "R_MIPS_SHIFT6",       /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0x000007c4,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* 64 bit relocation.  */
+  HOWTO (R_MIPS_64,            /* type */
+        0,                     /* rightshift */
+        4,                     /* size (0 = byte, 1 = short, 2 = long) */
+        64,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_64",           /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        MINUS_ONE,             /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Displacement in the global offset table.  */
+  HOWTO (R_MIPS_GOT_DISP,      /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_GOT_DISP",     /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Displacement to page pointer in the global offset table.  */
+  HOWTO (R_MIPS_GOT_PAGE,      /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_GOT_PAGE",     /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Offset from page pointer in the global offset table.  */
+  HOWTO (R_MIPS_GOT_OFST,      /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_GOT_OFST",     /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* High 16 bits of displacement in global offset table.  */
+  HOWTO (R_MIPS_GOT_HI16,      /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_GOT_HI16",     /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Low 16 bits of displacement in global offset table.  */
+  HOWTO (R_MIPS_GOT_LO16,      /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_GOT_LO16",     /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* 64 bit substraction.  */
+  HOWTO (R_MIPS_SUB,           /* type */
+        0,                     /* rightshift */
+        4,                     /* size (0 = byte, 1 = short, 2 = long) */
+        64,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_SUB",          /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        MINUS_ONE,             /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Insert the addend as an instruction.  */
+  /* FIXME: Not handled correctly.  */
+  HOWTO (R_MIPS_INSERT_A,      /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_INSERT_A",     /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffffffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Insert the addend as an instruction, and change all relocations
+     to refer to the old instruction at the address.  */
+  /* FIXME: Not handled correctly.  */
+  HOWTO (R_MIPS_INSERT_B,      /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_INSERT_B",     /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffffffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Delete a 32 bit instruction.  */
+  /* FIXME: Not handled correctly.  */
+  HOWTO (R_MIPS_DELETE,                /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_DELETE",       /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffffffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Get the higher value of a 64 bit addend.  */
+  HOWTO (R_MIPS_HIGHER,                /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_HIGHER",       /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Get the highest value of a 64 bit addend.  */
+  HOWTO (R_MIPS_HIGHEST,       /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_HIGHEST",      /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* High 16 bits of displacement in global offset table.  */
+  HOWTO (R_MIPS_CALL_HI16,     /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_CALL_HI16",    /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Low 16 bits of displacement in global offset table.  */
+  HOWTO (R_MIPS_CALL_LO16,     /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_CALL_LO16",    /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0x0000ffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Section displacement, used by an associated event location section.  */
+  HOWTO (R_MIPS_SCN_DISP,      /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_SCN_DISP",     /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffffffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* 16 bit relocation.  */
+  HOWTO (R_MIPS_REL16,         /* type */
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_REL16",        /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffff,                /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* These two are obsolete.  */
+  EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
+  EMPTY_HOWTO (R_MIPS_PJUMP),
+
+  /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
+     It must be used for multigot GOT's (and only there).  */
+  HOWTO (R_MIPS_RELGOT,                /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_RELGOT",       /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffffffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+
+  /* Protected jump conversion.  This is an optimization hint.  No
+     relocation is required for correctness.  */
+  HOWTO (R_MIPS_JALR,          /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        mips_elf_generic_reloc, /* special_function */
+        "R_MIPS_JALR",         /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0xffffffff,            /* dst_mask */
+        false),                /* pcrel_offset */
+};
+
+/* The reloc used for the mips16 jump instruction.  */
+static reloc_howto_type elf_mips16_jump_howto =
+  HOWTO (R_MIPS16_26,          /* type */
+        2,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        26,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+                               /* This needs complex overflow
+                                  detection, because the upper four
+                                  bits must match the PC.  */
+        mips16_jump_reloc,     /* special_function */
+        "R_MIPS16_26",         /* name */
+        true,                  /* partial_inplace */
+        0x3ffffff,             /* src_mask */
+        0x3ffffff,             /* dst_mask */
+        false);                /* pcrel_offset */
+
+/* The reloc used for the mips16 gprel instruction.  */
+static reloc_howto_type elf_mips16_gprel_howto =
+  HOWTO (R_MIPS16_GPREL,       /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_signed, /* complain_on_overflow */
+        mips16_gprel_reloc,    /* special_function */
+        "R_MIPS16_GPREL",      /* name */
+        true,                  /* partial_inplace */
+        0x07ff001f,            /* src_mask */
+        0x07ff001f,            /* dst_mask */
+        false);                /* pcrel_offset */
+
+/* GNU extension to record C++ vtable hierarchy */
+static reloc_howto_type elf_mips_gnu_vtinherit_howto =
+  HOWTO (R_MIPS_GNU_VTINHERIT, /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        0,                     /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        NULL,                  /* special_function */
+        "R_MIPS_GNU_VTINHERIT", /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0,                     /* dst_mask */
+        false);                /* pcrel_offset */
+
+/* GNU extension to record C++ vtable member usage */
+static reloc_howto_type elf_mips_gnu_vtentry_howto =
+  HOWTO (R_MIPS_GNU_VTENTRY,   /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        0,                     /* bitsize */
+        false,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont, /* complain_on_overflow */
+        _bfd_elf_rel_vtable_reloc_fn, /* special_function */
+        "R_MIPS_GNU_VTENTRY",  /* name */
+        false,                 /* partial_inplace */
+        0,                     /* src_mask */
+        0,                     /* dst_mask */
+        false);                /* pcrel_offset */
+\f
+/* This is derived from bfd_elf_generic_reloc.  NewABI allows us to have
+   several relocations against the same address.  The addend is derived
+   from the addends of preceding relocations.  If we don't need to
+   do something special,  we simply keep track of the addend.  */
+
+#define GET_RELOC_ADDEND(obfd, sym, entry, sec)                                \
+{                                                                      \
+  /* If we're relocating, and this is an external symbol, we don't     \
+     want to change anything.  */                                      \
+    if (obfd != (bfd *) NULL                                           \
+       && (sym->flags & BSF_SECTION_SYM) == 0                          \
+       && (! entry->howto->partial_inplace                             \
+           || entry->addend == 0))                                     \
+      {                                                                        \
+        entry->address += sec->output_offset;                          \
+        return bfd_reloc_ok;                                           \
+      }                                                                        \
+                                                                       \
+    /* The addend of combined relocs is remembered and left for                \
+       subsequent relocs.  */                                          \
+    if (prev_reloc_address != reloc_entry->address)                    \
+      {                                                                        \
+        prev_reloc_address = reloc_entry->address;                     \
+        prev_reloc_addend = reloc_entry->addend;                       \
+      }                                                                        \
+    else                                                               \
+      reloc_entry->addend = prev_reloc_addend;                         \
+}
+
+#define SET_RELOC_ADDEND(entry)                                                \
+{                                                                      \
+  prev_reloc_addend = entry->addend;                                   \
+}
+
+static bfd_reloc_status_type
+mips_elf_generic_reloc (abfd, reloc_entry, symbol, data, input_section,
+                       output_bfd, error_message)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *reloc_entry;
+     asymbol *symbol;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *input_section;
+     bfd *output_bfd;
+     char **error_message ATTRIBUTE_UNUSED;
+{
+  GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section)
+
+  return bfd_reloc_continue;
+}
+\f
+/* Do a R_MIPS_HI16 relocation.  This has to be done in combination
+   with a R_MIPS_LO16 reloc, because there is a carry from the LO16 to
+   the HI16.  Here we just save the information we need; we do the
+   actual relocation when we see the LO16.
+
+   MIPS ELF requires that the LO16 immediately follow the HI16.  As a
+   GNU extension, for non-pc-relative relocations, we permit an
+   arbitrary number of HI16 relocs to be associated with a single LO16
+   reloc.  This extension permits gcc to output the HI and LO relocs
+   itself.
+
+   This cannot be done for PC-relative relocations because both the HI16
+   and LO16 parts of the relocations must be done relative to the LO16
+   part, and there can be carry to or borrow from the HI16 part.  */
+
+struct mips_hi16
+{
+  struct mips_hi16 *next;
+  bfd_byte *addr;
+  bfd_vma addend;
+};
+
+/* FIXME: This should not be a static variable.  */
+
+static struct mips_hi16 *mips_hi16_list;
+
+static bfd_reloc_status_type
+mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data, input_section,
+                    output_bfd, error_message)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *reloc_entry;
+     asymbol *symbol;
+     PTR data;
+     asection *input_section;
+     bfd *output_bfd;
+     char **error_message ATTRIBUTE_UNUSED;
+{
+  bfd_reloc_status_type ret;
+  bfd_vma relocation;
+  struct mips_hi16 *n;
+
+  GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section)
+
+  ret = bfd_reloc_ok;
+
+  if (bfd_is_und_section (symbol->section) && output_bfd == (bfd *) NULL)
+    ret = bfd_reloc_undefined;
+
+  if (bfd_is_com_section (symbol->section))
+    relocation = 0;
+  else
+    relocation = symbol->value;
+
+  relocation += symbol->section->output_section->vma;
+  relocation += symbol->section->output_offset;
+  relocation += reloc_entry->addend;
+
+  if (reloc_entry->address > input_section->_cooked_size)
+    return bfd_reloc_outofrange;
+
+  /* Save the information, and let LO16 do the actual relocation.  */
+  n = (struct mips_hi16 *) bfd_malloc ((bfd_size_type) sizeof *n);
+  if (n == NULL)
+    return bfd_reloc_outofrange;
+  n->addr = (bfd_byte *) data + reloc_entry->address;
+  n->addend = relocation;
+  n->next = mips_hi16_list;
+  mips_hi16_list = n;
+
+  if (output_bfd != (bfd *) NULL)
+    reloc_entry->address += input_section->output_offset;
+
+  return ret;
+}
+
+/* Do a R_MIPS_LO16 relocation.  This is a straightforward 16 bit
+   inplace relocation; this function exists in order to do the
+   R_MIPS_HI16 relocation described above.  */
+
+static bfd_reloc_status_type
+mips_elf_lo16_reloc (abfd, reloc_entry, symbol, data, input_section,
+                    output_bfd, error_message)
+     bfd *abfd;
+     arelent *reloc_entry;
+     asymbol *symbol;
+     PTR data;
+     asection *input_section;
+     bfd *output_bfd;
+     char **error_message;
+{
+  if (mips_hi16_list != NULL)
+    {
+      struct mips_hi16 *l;
+
+      l = mips_hi16_list;
+      while (l != NULL)
+       {
+         unsigned long insn;
+         unsigned long val;
+         unsigned long vallo;
+         struct mips_hi16 *next;
+
+         /* Do the HI16 relocation.  Note that we actually don't need
+            to know anything about the LO16 itself, except where to
+            find the low 16 bits of the addend needed by the LO16.  */
+         insn = bfd_get_32 (abfd, l->addr);
+         vallo = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
+
+         /* The low order 16 bits are always treated as a signed
+            value.  */
+         vallo = ((vallo & 0xffff) ^ 0x8000) - 0x8000;
+         val = ((insn & 0xffff) << 16) + vallo;
+         val += l->addend;
+
+         /* If PC-relative, we need to subtract out the address of the LO
+            half of the HI/LO.  (The actual relocation is relative
+            to that instruction.)  */
+         if (reloc_entry->howto->pc_relative)
+           val -= reloc_entry->address;
+
+         /* At this point, "val" has the value of the combined HI/LO
+            pair.  If the low order 16 bits (which will be used for
+            the LO16 insn) are negative, then we will need an
+            adjustment for the high order 16 bits.  */
+         val += 0x8000;
+         val = (val >> 16) & 0xffff;
+
+         insn &= ~ (bfd_vma) 0xffff;
+         insn |= val;
+         bfd_put_32 (abfd, (bfd_vma) insn, l->addr);
+
+         next = l->next;
+         free (l);
+         l = next;
+       }
+
+      mips_hi16_list = NULL;
+    }
+
+  /* Now do the LO16 reloc in the usual way.  */
+  return mips_elf_generic_reloc (abfd, reloc_entry, symbol, data,
+                                input_section, output_bfd, error_message);
+}
+
+/* Do a R_MIPS_GOT16 reloc.  This is a reloc against the global offset
+   table used for PIC code.  If the symbol is an external symbol, the
+   instruction is modified to contain the offset of the appropriate
+   entry in the global offset table.  If the symbol is a section
+   symbol, the next reloc is a R_MIPS_LO16 reloc.  The two 16 bit
+   addends are combined to form the real addend against the section
+   symbol; the GOT16 is modified to contain the offset of an entry in
+   the global offset table, and the LO16 is modified to offset it
+   appropriately.  Thus an offset larger than 16 bits requires a
+   modified value in the global offset table.
+
+   This implementation suffices for the assembler, but the linker does
+   not yet know how to create global offset tables.  */
+
+static bfd_reloc_status_type
+mips_elf_got16_reloc (abfd, reloc_entry, symbol, data, input_section,
+                     output_bfd, error_message)
+     bfd *abfd;
+     arelent *reloc_entry;
+     asymbol *symbol;
+     PTR data;
+     asection *input_section;
+     bfd *output_bfd;
+     char **error_message;
+{
+  /* If we're relocating, and this is a local symbol, we can handle it
+     just like HI16.  */
+  if (output_bfd != (bfd *) NULL
+      && (symbol->flags & BSF_SECTION_SYM) != 0)
+    return mips_elf_hi16_reloc (abfd, reloc_entry, symbol, data,
+                               input_section, output_bfd, error_message);
+
+  /* Otherwise we try to handle it as R_MIPS_GOT_DISP.  */
+  return mips_elf_generic_reloc (abfd, reloc_entry, symbol, data,
+                                input_section, output_bfd, error_message);
+}
+
+/* Set the GP value for OUTPUT_BFD.  Returns false if this is a
+   dangerous relocation.  */
+
+static boolean
+mips_elf_assign_gp (output_bfd, pgp)
+     bfd *output_bfd;
+     bfd_vma *pgp;
+{
+  unsigned int count;
+  asymbol **sym;
+  unsigned int i;
+
+  /* If we've already figured out what GP will be, just return it.  */
+  *pgp = _bfd_get_gp_value (output_bfd);
+  if (*pgp)
+    return true;
+
+  count = bfd_get_symcount (output_bfd);
+  sym = bfd_get_outsymbols (output_bfd);
+
+  /* The linker script will have created a symbol named `_gp' with the
+     appropriate value.  */
+  if (sym == (asymbol **) NULL)
+    i = count;
+  else
+    {
+      for (i = 0; i < count; i++, sym++)
+       {
+         register const char *name;
+
+         name = bfd_asymbol_name (*sym);
+         if (*name == '_' && strcmp (name, "_gp") == 0)
+           {
+             *pgp = bfd_asymbol_value (*sym);
+             _bfd_set_gp_value (output_bfd, *pgp);
+             break;
+           }
+       }
+    }
+
+  if (i >= count)
+    {
+      /* Only get the error once.  */
+      *pgp = 4;
+      _bfd_set_gp_value (output_bfd, *pgp);
+      return false;
+    }
+
+  return true;
+}
+
+/* We have to figure out the gp value, so that we can adjust the
+   symbol value correctly.  We look up the symbol _gp in the output
+   BFD.  If we can't find it, we're stuck.  We cache it in the ELF
+   target data.  We don't need to adjust the symbol value for an
+   external symbol if we are producing relocateable output.  */
+
+static bfd_reloc_status_type
+mips_elf_final_gp (output_bfd, symbol, relocateable, error_message, pgp)
+     bfd *output_bfd;
+     asymbol *symbol;
+     boolean relocateable;
+     char **error_message;
+     bfd_vma *pgp;
+{
+  if (bfd_is_und_section (symbol->section)
+      && ! relocateable)
+    {
+      *pgp = 0;
+      return bfd_reloc_undefined;
+    }
+
+  *pgp = _bfd_get_gp_value (output_bfd);
+  if (*pgp == 0
+      && (! relocateable
+         || (symbol->flags & BSF_SECTION_SYM) != 0))
+    {
+      if (relocateable)
+       {
+         /* Make up a value.  */
+         *pgp = symbol->section->output_section->vma + 0x4000;
+         _bfd_set_gp_value (output_bfd, *pgp);
+       }
+      else if (!mips_elf_assign_gp (output_bfd, pgp))
+       {
+         *error_message =
+           (char *) _("GP relative relocation when _gp not defined");
+         return bfd_reloc_dangerous;
+       }
+    }
+
+  return bfd_reloc_ok;
+}
+
+/* Do a R_MIPS_GPREL16 relocation.  This is a 16 bit value which must
+   become the offset from the gp register.  */
+
+static bfd_reloc_status_type
+mips_elf_gprel16_reloc (abfd, reloc_entry, symbol, data, input_section,
+                       output_bfd, error_message)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *reloc_entry;
+     asymbol *symbol;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *input_section;
+     bfd *output_bfd;
+     char **error_message ATTRIBUTE_UNUSED;
+{
+  boolean relocateable;
+  bfd_reloc_status_type ret;
+  bfd_vma gp;
+
+  GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section)
+
+  if (output_bfd != (bfd *) NULL)
+    relocateable = true;
+  else
+    {
+      relocateable = false;
+      output_bfd = symbol->section->output_section->owner;
+    }
+
+  ret = mips_elf_final_gp (output_bfd, symbol, relocateable, error_message,
+                          &gp);
+  if (ret != bfd_reloc_ok)
+    return ret;
+
+  return _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
+                                       input_section, relocateable,
+                                       data, gp);
+}
+
+/* Do a R_MIPS_LITERAL relocation.  */
+
+static bfd_reloc_status_type
+mips_elf_literal_reloc (abfd, reloc_entry, symbol, data, input_section,
+                       output_bfd, error_message)
+     bfd *abfd;
+     arelent *reloc_entry;
+     asymbol *symbol;
+     PTR data;
+     asection *input_section;
+     bfd *output_bfd;
+     char **error_message;
+{
+  boolean relocateable;
+  bfd_reloc_status_type ret;
+  bfd_vma gp;
+
+  GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section)
+
+  /* FIXME: The entries in the .lit8 and .lit4 sections should be merged.  */
+  if (output_bfd != (bfd *) NULL)
+    relocateable = true;
+  else
+    {
+      relocateable = false;
+      output_bfd = symbol->section->output_section->owner;
+    }
+
+  ret = mips_elf_final_gp (output_bfd, symbol, relocateable, error_message,
+                          &gp);
+  if (ret != bfd_reloc_ok)
+    return ret;
+
+  return _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
+                                       input_section, relocateable,
+                                       data, gp);
+}
+
+/* Do a R_MIPS_GPREL32 relocation.  This is a 32 bit value which must
+   become the offset from the gp register.  */
+
+static bfd_reloc_status_type
+mips_elf_gprel32_reloc (abfd, reloc_entry, symbol, data, input_section,
+                       output_bfd, error_message)
+     bfd *abfd;
+     arelent *reloc_entry;
+     asymbol *symbol;
+     PTR data;
+     asection *input_section;
+     bfd *output_bfd;
+     char **error_message;
+{
+  boolean relocateable;
+  bfd_reloc_status_type ret;
+  bfd_vma gp;
+
+  GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section)
+
+  /* R_MIPS_GPREL32 relocations are defined for local symbols only.
+     We will only have an addend if this is a newly created reloc,
+     not read from an ELF file.  */
+  if (output_bfd != (bfd *) NULL
+      && (symbol->flags & BSF_SECTION_SYM) == 0
+      && reloc_entry->addend == 0)
+    {
+      *error_message = (char *)
+       _("32bits gp relative relocation occurs for an external symbol");
+      return bfd_reloc_outofrange;
+    }
+
+  if (output_bfd != (bfd *) NULL)
+    {
+      relocateable = true;
+      gp = _bfd_get_gp_value (output_bfd);
+    }
+  else
+    {
+      relocateable = false;
+      output_bfd = symbol->section->output_section->owner;
+
+      ret = mips_elf_final_gp (output_bfd, symbol, relocateable,
+                              error_message, &gp);
+      if (ret != bfd_reloc_ok)
+       return ret;
+    }
+
+  return gprel32_with_gp (abfd, symbol, reloc_entry, input_section,
+                         relocateable, data, gp);
+}
+
+static bfd_reloc_status_type
+gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocateable, data,
+                gp)
+     bfd *abfd;
+     asymbol *symbol;
+     arelent *reloc_entry;
+     asection *input_section;
+     boolean relocateable;
+     PTR data;
+     bfd_vma gp;
+{
+  bfd_vma relocation;
+  unsigned long val;
+
+  if (bfd_is_com_section (symbol->section))
+    relocation = 0;
+  else
+    relocation = symbol->value;
+
+  relocation += symbol->section->output_section->vma;
+  relocation += symbol->section->output_offset;
+
+  if (reloc_entry->address > input_section->_cooked_size)
+    return bfd_reloc_outofrange;
+
+  if (reloc_entry->howto->src_mask == 0)
+    val = 0;
+  else
+    val = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
+
+  /* Set val to the offset into the section or symbol.  */
+  val += reloc_entry->addend;
+
+  /* Adjust val for the final section location and GP value.  If we
+     are producing relocateable output, we don't want to do this for
+     an external symbol.  */
+  if (! relocateable
+      || (symbol->flags & BSF_SECTION_SYM) != 0)
+    val += relocation - gp;
+
+  bfd_put_32 (abfd, (bfd_vma) val, (bfd_byte *) data + reloc_entry->address);
+
+  if (relocateable)
+    reloc_entry->address += input_section->output_offset;
+
+  return bfd_reloc_ok;
+}
+
+/* Do a R_MIPS_SHIFT6 relocation. The MSB of the shift is stored at bit 2,
+   the rest is at bits 6-10. The bitpos already got right by the howto.  */
+
+static bfd_reloc_status_type
+mips_elf_shift6_reloc (abfd, reloc_entry, symbol, data, input_section,
+                      output_bfd, error_message)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *reloc_entry;
+     asymbol *symbol;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *input_section;
+     bfd *output_bfd;
+     char **error_message ATTRIBUTE_UNUSED;
+{
+  GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section)
+
+  reloc_entry->addend = (reloc_entry->addend & 0x00007c0)
+                       | (reloc_entry->addend & 0x00000800) >> 9;
+
+  SET_RELOC_ADDEND (reloc_entry)
+
+  return bfd_reloc_continue;
+}
+\f
+/* Handle a mips16 jump.  */
+
+static bfd_reloc_status_type
+mips16_jump_reloc (abfd, reloc_entry, symbol, data, input_section,
+                  output_bfd, error_message)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *reloc_entry;
+     asymbol *symbol;
+     PTR data ATTRIBUTE_UNUSED;
+     asection *input_section;
+     bfd *output_bfd;
+     char **error_message ATTRIBUTE_UNUSED;
+{
+  static boolean warned = false;
+
+  GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section)
+
+  /* FIXME.  */
+  if (! warned)
+    (*_bfd_error_handler)
+      (_("Linking mips16 objects into %s format is not supported"),
+       bfd_get_target (input_section->output_section->owner));
+  warned = true;
+
+  return bfd_reloc_undefined;
+}
+
+/* Handle a mips16 GP relative reloc.  */
+
+static bfd_reloc_status_type
+mips16_gprel_reloc (abfd, reloc_entry, symbol, data, input_section,
+                   output_bfd, error_message)
+     bfd *abfd;
+     arelent *reloc_entry;
+     asymbol *symbol;
+     PTR data;
+     asection *input_section;
+     bfd *output_bfd;
+     char **error_message;
+{
+  boolean relocateable;
+  bfd_reloc_status_type ret;
+  bfd_vma gp;
+  unsigned short extend, insn;
+  unsigned long final;
+
+  GET_RELOC_ADDEND (output_bfd, symbol, reloc_entry, input_section)
+
+  if (output_bfd != NULL)
+    relocateable = true;
+  else
+    {
+      relocateable = false;
+      output_bfd = symbol->section->output_section->owner;
+    }
+
+  ret = mips_elf_final_gp (output_bfd, symbol, relocateable, error_message,
+                          &gp);
+  if (ret != bfd_reloc_ok)
+    return ret;
+
+  if (reloc_entry->address > input_section->_cooked_size)
+    return bfd_reloc_outofrange;
+
+  /* Pick up the mips16 extend instruction and the real instruction.  */
+  extend = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address);
+  insn = bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address + 2);
+
+  /* Stuff the current addend back as a 32 bit value, do the usual
+     relocation, and then clean up.  */
+  bfd_put_32 (abfd,
+             (bfd_vma) (((extend & 0x1f) << 11)
+                        | (extend & 0x7e0)
+                        | (insn & 0x1f)),
+             (bfd_byte *) data + reloc_entry->address);
+
+  ret = _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
+                                      input_section, relocateable, data, gp);
+
+  final = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
+  bfd_put_16 (abfd,
+             (bfd_vma) ((extend & 0xf800)
+                        | ((final >> 11) & 0x1f)
+                        | (final & 0x7e0)),
+             (bfd_byte *) data + reloc_entry->address);
+  bfd_put_16 (abfd,
+             (bfd_vma) ((insn & 0xffe0)
+                        | (final & 0x1f)),
+             (bfd_byte *) data + reloc_entry->address + 2);
+
+  return ret;
+}
+
+#undef GET_RELOC_ADDEND
+#undef SET_RELOC_ADDEND
+\f
+/* A mapping from BFD reloc types to MIPS ELF reloc types.  */
+
+struct elf_reloc_map {
+  bfd_reloc_code_real_type bfd_val;
+  enum elf_mips_reloc_type elf_val;
+};
+
+static const struct elf_reloc_map mips_reloc_map[] =
+{
+  { BFD_RELOC_NONE, R_MIPS_NONE },
+  { BFD_RELOC_16, R_MIPS_16 },
+  { BFD_RELOC_32, R_MIPS_32 },
+  /* There is no BFD reloc for R_MIPS_REL32.  */
+  { BFD_RELOC_CTOR, R_MIPS_32 },
+  { BFD_RELOC_64, R_MIPS_64 },
+  { BFD_RELOC_16_PCREL, R_MIPS_PC16 },
+  { BFD_RELOC_HI16_S, R_MIPS_HI16 },
+  { BFD_RELOC_LO16, R_MIPS_LO16 },
+  { BFD_RELOC_GPREL16, R_MIPS_GPREL16 },
+  { BFD_RELOC_GPREL32, R_MIPS_GPREL32 },
+  { BFD_RELOC_MIPS_JMP, R_MIPS_26 },
+  { BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL },
+  { BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 },
+  { BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 },
+  { BFD_RELOC_MIPS_SHIFT5, R_MIPS_SHIFT5 },
+  { BFD_RELOC_MIPS_SHIFT6, R_MIPS_SHIFT6 },
+  { BFD_RELOC_MIPS_GOT_DISP, R_MIPS_GOT_DISP },
+  { BFD_RELOC_MIPS_GOT_PAGE, R_MIPS_GOT_PAGE },
+  { BFD_RELOC_MIPS_GOT_OFST, R_MIPS_GOT_OFST },
+  { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 },
+  { BFD_RELOC_MIPS_GOT_LO16, R_MIPS_GOT_LO16 },
+  { BFD_RELOC_MIPS_SUB, R_MIPS_SUB },
+  { BFD_RELOC_MIPS_INSERT_A, R_MIPS_INSERT_A },
+  { BFD_RELOC_MIPS_INSERT_B, R_MIPS_INSERT_B },
+  { BFD_RELOC_MIPS_DELETE, R_MIPS_DELETE },
+  { BFD_RELOC_MIPS_HIGHEST, R_MIPS_HIGHEST },
+  { BFD_RELOC_MIPS_HIGHER, R_MIPS_HIGHER },
+  { BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 },
+  { BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 },
+  { BFD_RELOC_MIPS_SCN_DISP, R_MIPS_SCN_DISP },
+  { BFD_RELOC_MIPS_REL16, R_MIPS_REL16 },
+  /* Use of R_MIPS_ADD_IMMEDIATE and R_MIPS_PJUMP is deprecated.  */
+  { BFD_RELOC_MIPS_RELGOT, R_MIPS_RELGOT },
+  { BFD_RELOC_MIPS_JALR, R_MIPS_JALR }
+};
+
+/* Given a BFD reloc type, return a howto structure.  */
+
+static reloc_howto_type *
+bfd_elf32_bfd_reloc_type_lookup (abfd, code)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     bfd_reloc_code_real_type code;
+{
+  unsigned int i;
+  /* FIXME: We default to RELA here instead of choosing the right
+     relocation variant.  */
+  reloc_howto_type *howto_table = elf_mips_howto_table_rela;
+
+  for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map);
+       i++)
+    {
+      if (mips_reloc_map[i].bfd_val == code)
+       return &howto_table[(int) mips_reloc_map[i].elf_val];
+    }
+
+  switch (code)
+    {
+    case BFD_RELOC_MIPS16_JMP:
+      return &elf_mips16_jump_howto;
+    case BFD_RELOC_MIPS16_GPREL:
+      return &elf_mips16_gprel_howto;
+    case BFD_RELOC_VTABLE_INHERIT:
+      return &elf_mips_gnu_vtinherit_howto;
+    case BFD_RELOC_VTABLE_ENTRY:
+      return &elf_mips_gnu_vtentry_howto;
+    default:
+      bfd_set_error (bfd_error_bad_value);
+      return NULL;
+    }
+}
+
+/* Given a MIPS Elf32_Internal_Rel, fill in an arelent structure.  */
+
+static reloc_howto_type *
+mips_elf_n32_rtype_to_howto (r_type, rela_p)
+     unsigned int r_type;
+     boolean rela_p;
+{
+  switch (r_type)
+    {
+    case R_MIPS16_26:
+      return &elf_mips16_jump_howto;
+    case R_MIPS16_GPREL:
+      return &elf_mips16_gprel_howto;
+    case R_MIPS_GNU_VTINHERIT:
+      return &elf_mips_gnu_vtinherit_howto;
+    case R_MIPS_GNU_VTENTRY:
+      return &elf_mips_gnu_vtentry_howto;
+    default:
+      BFD_ASSERT (r_type < (unsigned int) R_MIPS_max);
+      if (rela_p)
+       return &elf_mips_howto_table_rela[r_type];
+      else
+       return &elf_mips_howto_table_rel[r_type];
+      break;
+    }
+}
+
+/* Given a MIPS Elf32_Internal_Rel, fill in an arelent structure.  */
+
+static void
+mips_info_to_howto_rel (abfd, cache_ptr, dst)
+     bfd *abfd;
+     arelent *cache_ptr;
+     Elf32_Internal_Rel *dst;
+{
+  unsigned int r_type;
+
+  r_type = ELF32_R_TYPE (dst->r_info);
+  cache_ptr->howto = mips_elf_n32_rtype_to_howto (r_type, false);
+
+  /* The addend for a GPREL16 or LITERAL relocation comes from the GP
+     value for the object file.  We get the addend now, rather than
+     when we do the relocation, because the symbol manipulations done
+     by the linker may cause us to lose track of the input BFD.  */
+  if (((*cache_ptr->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0
+      && (r_type == (unsigned int) R_MIPS_GPREL16
+         || r_type == (unsigned int) R_MIPS_LITERAL))
+    cache_ptr->addend = elf_gp (abfd);
+}
+
+/* Given a MIPS Elf32_Internal_Rela, fill in an arelent structure.  */
+
+static void
+mips_info_to_howto_rela (abfd, cache_ptr, dst)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     arelent *cache_ptr;
+     Elf32_Internal_Rela *dst;
+{
+  unsigned int r_type;
+
+  r_type = ELF32_R_TYPE (dst->r_info);
+  cache_ptr->howto = mips_elf_n32_rtype_to_howto (r_type, true);
+  cache_ptr->addend = dst->r_addend;
+}
+\f
+/* Determine whether a symbol is global for the purposes of splitting
+   the symbol table into global symbols and local symbols.  At least
+   on Irix 5, this split must be between section symbols and all other
+   symbols.  On most ELF targets the split is between static symbols
+   and externally visible symbols.  */
+
+static boolean
+mips_elf_sym_is_global (abfd, sym)
+     bfd *abfd ATTRIBUTE_UNUSED;
+     asymbol *sym;
+{
+  if (SGI_COMPAT (abfd))
+    return (sym->flags & BSF_SECTION_SYM) == 0;
+  else
+    return ((sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0
+           || bfd_is_und_section (bfd_get_section (sym))
+           || bfd_is_com_section (bfd_get_section (sym)));
+}
+\f
+/* Set the right machine number for a MIPS ELF file.  */
+
+static boolean
+mips_elf_n32_object_p (abfd)
+     bfd *abfd;
+{
+  unsigned long mach;
+
+  /* Irix 5 and 6 are broken.  Object file symbol tables are not always
+     sorted correctly such that local symbols precede global symbols,
+     and the sh_info field in the symbol table is not always right.  */
+  if (SGI_COMPAT (abfd))
+    elf_bad_symtab (abfd) = true;
+
+  mach = _bfd_elf_mips_mach (elf_elfheader (abfd)->e_flags);
+  bfd_default_set_arch_mach (abfd, bfd_arch_mips, mach);
+
+  if (! ABI_N32_P(abfd))
+    return false;
+
+  return true;
+}
+\f
+/* Support for core dump NOTE sections.  */
+static boolean
+elf32_mips_grok_prstatus (abfd, note)
+     bfd *abfd;
+     Elf_Internal_Note *note;
+{
+  int offset;
+  unsigned int raw_size;
+
+  switch (note->descsz)
+    {
+      default:
+       return false;
+
+      case 256:                /* Linux/MIPS */
+       /* pr_cursig */
+       elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+
+       /* pr_pid */
+       elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
+
+       /* pr_reg */
+       offset = 72;
+       raw_size = 180;
+
+       break;
+    }
+
+  /* Make a ".reg/999" section.  */
+  return _bfd_elfcore_make_pseudosection (abfd, ".reg", raw_size,
+                                         note->descpos + offset);
+}
+
+static boolean
+elf32_mips_grok_psinfo (abfd, note)
+     bfd *abfd;
+     Elf_Internal_Note *note;
+{
+  switch (note->descsz)
+    {
+      default:
+       return false;
+
+      case 128:                /* Linux/MIPS elf_prpsinfo */
+       elf_tdata (abfd)->core_program
+        = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
+       elf_tdata (abfd)->core_command
+        = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
+    }
+
+  /* Note that for some reason, a spurious space is tacked
+     onto the end of the args in some (at least one anyway)
+     implementations, so strip it off if it exists.  */
+
+  {
+    char *command = elf_tdata (abfd)->core_command;
+    int n = strlen (command);
+
+    if (0 < n && command[n - 1] == ' ')
+      command[n - 1] = '\0';
+  }
+
+  return true;
+}
+\f
+/* Depending on the target vector we generate some version of Irix
+   executables or "normal" MIPS ELF ABI executables.  */
+static irix_compat_t
+elf_n32_mips_irix_compat (abfd)
+     bfd *abfd;
+{
+  if ((abfd->xvec == &bfd_elf32_nbigmips_vec)
+      || (abfd->xvec == &bfd_elf32_nlittlemips_vec))
+    return ict_irix6;
+  else
+    return ict_none;
+}
+\f
+/* ECOFF swapping routines.  These are used when dealing with the
+   .mdebug section, which is in the ECOFF debugging format.  */
+static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
+  /* Symbol table magic number.  */
+  magicSym,
+  /* Alignment of debugging information.  E.g., 4.  */
+  4,
+  /* Sizes of external symbolic information.  */
+  sizeof (struct hdr_ext),
+  sizeof (struct dnr_ext),
+  sizeof (struct pdr_ext),
+  sizeof (struct sym_ext),
+  sizeof (struct opt_ext),
+  sizeof (struct fdr_ext),
+  sizeof (struct rfd_ext),
+  sizeof (struct ext_ext),
+  /* Functions to swap in external symbolic data.  */
+  ecoff_swap_hdr_in,
+  ecoff_swap_dnr_in,
+  ecoff_swap_pdr_in,
+  ecoff_swap_sym_in,
+  ecoff_swap_opt_in,
+  ecoff_swap_fdr_in,
+  ecoff_swap_rfd_in,
+  ecoff_swap_ext_in,
+  _bfd_ecoff_swap_tir_in,
+  _bfd_ecoff_swap_rndx_in,
+  /* Functions to swap out external symbolic data.  */
+  ecoff_swap_hdr_out,
+  ecoff_swap_dnr_out,
+  ecoff_swap_pdr_out,
+  ecoff_swap_sym_out,
+  ecoff_swap_opt_out,
+  ecoff_swap_fdr_out,
+  ecoff_swap_rfd_out,
+  ecoff_swap_ext_out,
+  _bfd_ecoff_swap_tir_out,
+  _bfd_ecoff_swap_rndx_out,
+  /* Function to read in symbolic data.  */
+  _bfd_mips_elf_read_ecoff_info
+};
+\f
+#define ELF_ARCH                       bfd_arch_mips
+#define ELF_MACHINE_CODE               EM_MIPS
+
+/* The SVR4 MIPS ABI says that this should be 0x10000, but Irix 5 uses
+   a value of 0x1000, and we are compatible.
+   FIXME: How does this affect NewABI?  */
+#define ELF_MAXPAGESIZE                        0x1000
+
+#define elf_backend_collect            true
+#define elf_backend_type_change_ok     true
+#define elf_backend_can_gc_sections    true
+#define elf_info_to_howto              mips_info_to_howto_rela
+#define elf_info_to_howto_rel          mips_info_to_howto_rel
+#define elf_backend_sym_is_global      mips_elf_sym_is_global
+#define elf_backend_object_p           mips_elf_n32_object_p
+#define elf_backend_symbol_processing  _bfd_mips_elf_symbol_processing
+#define elf_backend_section_processing _bfd_mips_elf_section_processing
+#define elf_backend_section_from_shdr  _bfd_mips_elf_section_from_shdr
+#define elf_backend_fake_sections      _bfd_mips_elf_fake_sections
+#define elf_backend_section_from_bfd_section \
+                                       _bfd_mips_elf_section_from_bfd_section
+#define elf_backend_add_symbol_hook    _bfd_mips_elf_add_symbol_hook
+#define elf_backend_link_output_symbol_hook \
+                                       _bfd_mips_elf_link_output_symbol_hook
+#define elf_backend_create_dynamic_sections \
+                                       _bfd_mips_elf_create_dynamic_sections
+#define elf_backend_check_relocs       _bfd_mips_elf_check_relocs
+#define elf_backend_adjust_dynamic_symbol \
+                                       _bfd_mips_elf_adjust_dynamic_symbol
+#define elf_backend_always_size_sections \
+                                       _bfd_mips_elf_always_size_sections
+#define elf_backend_size_dynamic_sections \
+                                       _bfd_mips_elf_size_dynamic_sections
+#define elf_backend_relocate_section   _bfd_mips_elf_relocate_section
+#define elf_backend_finish_dynamic_symbol \
+                                       _bfd_mips_elf_finish_dynamic_symbol
+#define elf_backend_finish_dynamic_sections \
+                                       _bfd_mips_elf_finish_dynamic_sections
+#define elf_backend_final_write_processing \
+                                       _bfd_mips_elf_final_write_processing
+#define elf_backend_additional_program_headers \
+                                       _bfd_mips_elf_additional_program_headers
+#define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map
+#define elf_backend_gc_mark_hook       _bfd_mips_elf_gc_mark_hook
+#define elf_backend_gc_sweep_hook      _bfd_mips_elf_gc_sweep_hook
+#define elf_backend_copy_indirect_symbol \
+                                       _bfd_mips_elf_copy_indirect_symbol
+#define elf_backend_hide_symbol                _bfd_mips_elf_hide_symbol
+#define elf_backend_grok_prstatus      elf32_mips_grok_prstatus
+#define elf_backend_grok_psinfo                elf32_mips_grok_psinfo
+#define elf_backend_ecoff_debug_swap   &mips_elf32_ecoff_debug_swap
+
+#define elf_backend_got_header_size    (4 * MIPS_RESERVED_GOTNO)
+#define elf_backend_plt_header_size    0
+
+/* MIPS n32 ELF can use a mixture of REL and RELA, but some Relocations
+   work better/work only in RELA, so we default to this.  */
+#define elf_backend_may_use_rel_p      1
+#define elf_backend_may_use_rela_p     1
+#define elf_backend_default_use_rela_p 1
+#define elf_backend_sign_extend_vma    true
+
+#define elf_backend_discard_info       _bfd_mips_elf_discard_info
+#define elf_backend_ignore_discarded_relocs \
+                                       _bfd_mips_elf_ignore_discarded_relocs
+#define elf_backend_write_section      _bfd_mips_elf_write_section
+#define elf_backend_mips_irix_compat   elf_n32_mips_irix_compat
+#define elf_backend_mips_rtype_to_howto        mips_elf_n32_rtype_to_howto
+#define bfd_elf32_find_nearest_line    _bfd_mips_elf_find_nearest_line
+#define bfd_elf32_set_section_contents _bfd_mips_elf_set_section_contents
+#define bfd_elf32_bfd_get_relocated_section_contents \
+                               _bfd_elf_mips_get_relocated_section_contents
+#define bfd_elf32_bfd_link_hash_table_create \
+                                       _bfd_mips_elf_link_hash_table_create
+#define bfd_elf32_bfd_final_link       _bfd_mips_elf_final_link
+#define bfd_elf32_bfd_merge_private_bfd_data \
+                                       _bfd_mips_elf_merge_private_bfd_data
+#define bfd_elf32_bfd_set_private_flags        _bfd_mips_elf_set_private_flags
+#define bfd_elf32_bfd_print_private_bfd_data \
+                                       _bfd_mips_elf_print_private_bfd_data
+
+/* Support for SGI-ish mips targets using n32 ABI.  */
+
+#define TARGET_LITTLE_SYM               bfd_elf32_nlittlemips_vec
+#define TARGET_LITTLE_NAME              "elf32-nlittlemips"
+#define TARGET_BIG_SYM                  bfd_elf32_nbigmips_vec
+#define TARGET_BIG_NAME                 "elf32-nbigmips"
+
+#include "elf32-target.h"
+
+/* Support for traditional mips targets using n32 ABI.  */
+#define INCLUDED_TARGET_FILE            /* More a type of flag.  */
+
+#undef TARGET_LITTLE_SYM
+#undef TARGET_LITTLE_NAME
+#undef TARGET_BIG_SYM
+#undef TARGET_BIG_NAME
+
+#define TARGET_LITTLE_SYM               bfd_elf32_ntradlittlemips_vec
+#define TARGET_LITTLE_NAME              "elf32-ntradlittlemips"
+#define TARGET_BIG_SYM                  bfd_elf32_ntradbigmips_vec
+#define TARGET_BIG_NAME                 "elf32-ntradbigmips"
+
+/* Include the target file again for this target.  */
+#include "elf32-target.h"
diff --git a/gdb/config/powerpc/aix432.mh b/gdb/config/powerpc/aix432.mh
new file mode 100644 (file)
index 0000000..fc74eb7
--- /dev/null
@@ -0,0 +1,19 @@
+# Host: IBM PowerPC running AIX 4.3.2+
+
+XM_FILE= xm-aix.h
+
+NAT_FILE= nm-aix.h
+NATDEPFILES= aix-thread.o fork-child.o infptrace.o inftarg.o corelow.o \
+            rs6000-nat.o xcoffread.o xcoffsolib.o
+
+# When compiled with cc, for debugging, this argument should be passed.
+# We have no idea who our current compiler is though, so we skip it.
+# MH_CFLAGS = -bnodelcsect
+
+# gdb is too big for all of its external symbols to fit in a small TOC
+# It looks like the GNU linker doesn't understand the -bbigtoc switch.
+# This switch may be needed for some vendor compilers.
+# MH_LDFLAGS = -Wl,-bbigtoc
+
+# pthread debugging support
+NAT_CLIBS = -lpthdebug
diff --git a/gdb/gdb_obstack.h b/gdb/gdb_obstack.h
new file mode 100644 (file)
index 0000000..237830e
--- /dev/null
@@ -0,0 +1,32 @@
+/* Obstack wrapper for GDB.
+
+   Copyright 2002 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   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.  */
+
+#if !defined (GDB_OBSTACK_H)
+#define GDB_OBSTACK_H 1
+
+#include "obstack.h"
+
+/* Unless explicitly specified, GDB obstacks always use xmalloc() and
+   xfree().  */
+#define obstack_chunk_alloc xmalloc
+#define obstack_chunk_free xfree
+
+#endif
diff --git a/gdb/mips-irix-tdep.c b/gdb/mips-irix-tdep.c
new file mode 100644 (file)
index 0000000..73183ca
--- /dev/null
@@ -0,0 +1,95 @@
+/* Target-dependent code for the MIPS architecture running on IRIX,
+   for GDB, the GNU Debugger.
+
+   Copyright 2002 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   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 "defs.h"
+#include "osabi.h"
+
+#include "elf-bfd.h"
+
+static void
+mips_irix_elf_osabi_sniff_abi_tag_sections (bfd *abfd, asection *sect,
+                                            void *obj)
+{
+  enum gdb_osabi *os_ident_ptr = obj;
+  const char *name;
+  unsigned int sectsize;
+
+  name = bfd_get_section_name (abfd, sect);
+  sectsize = bfd_section_size (abfd, sect);
+
+  if (strncmp (name, ".MIPS.", 6) == 0 && sectsize > 0)
+    {
+      /* The presence of a section named with a ".MIPS." prefix is
+         indicative of an IRIX binary.  */
+      *os_ident_ptr = GDB_OSABI_IRIX;
+    }
+}
+
+static enum gdb_osabi
+mips_irix_elf_osabi_sniffer (bfd *abfd)
+{
+  unsigned int elfosabi;
+  enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
+
+  /* If the generic sniffer gets a hit, return and let other sniffers
+     get a crack at it.  */
+  bfd_map_over_sections (abfd,
+                        generic_elf_osabi_sniff_abi_tag_sections,
+                        &osabi);
+  if (osabi != GDB_OSABI_UNKNOWN)
+    return GDB_OSABI_UNKNOWN;
+
+  elfosabi = elf_elfheader (abfd)->e_ident[EI_OSABI];
+
+  if (elfosabi == ELFOSABI_NONE)
+    {
+      /* When elfosabi is ELFOSABI_NONE (0), then the ELF structures in the
+        file are conforming to the base specification for that machine 
+        (there are no OS-specific extensions).  In order to determine the 
+        real OS in use we must look for OS notes that have been added.  
+        
+        For IRIX, we simply look for sections named with .MIPS. as
+        prefixes.  */
+      bfd_map_over_sections (abfd,
+                            mips_irix_elf_osabi_sniff_abi_tag_sections, 
+                            &osabi);
+    }
+  return osabi;
+}
+
+static void
+mips_irix_init_abi (struct gdbarch_info info,
+                    struct gdbarch *gdbarch)
+{
+}
+
+void
+_initialize_mips_irix_tdep (void)
+{
+  /* Register an ELF OS ABI sniffer for IRIX binaries.  */
+  gdbarch_register_osabi_sniffer (bfd_arch_mips,
+                                 bfd_target_elf_flavour,
+                                 mips_irix_elf_osabi_sniffer);
+
+  gdbarch_register_osabi (bfd_arch_mips, GDB_OSABI_IRIX,
+                         mips_irix_init_abi);
+}
diff --git a/gdb/solib-irix.c b/gdb/solib-irix.c
new file mode 100644 (file)
index 0000000..1cfa452
--- /dev/null
@@ -0,0 +1,725 @@
+/* Shared library support for IRIX.
+   Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
+   Free Software Foundation, Inc.
+
+   This file was created using portions of irix5-nat.c originally
+   contributed to GDB by Ian Lance Taylor.
+
+   This file is part of GDB.
+
+   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 "defs.h"
+
+#include "symtab.h"
+#include "bfd.h"
+#include "symfile.h"
+#include "objfiles.h"
+#include "gdbcore.h"
+#include "target.h"
+#include "inferior.h"
+
+#include "solist.h"
+
+/* Link map info to include in an allocate so_list entry.  Unlike some
+   of the other solib backends, this (Irix) backend chooses to decode
+   the link map info obtained from the target and store it as (mostly)
+   CORE_ADDRs which need no further decoding.  This is more convenient
+   because there are three different link map formats to worry about.
+   We use a single routine (fetch_lm_info) to read (and decode) the target
+   specific link map data.  */
+
+struct lm_info
+{
+  CORE_ADDR addr;              /* address of obj_info or obj_list
+                                  struct on target (from which the
+                                  following information is obtained).  */
+  CORE_ADDR next;              /* address of next item in list.  */
+  CORE_ADDR reloc_offset;      /* amount to relocate by  */
+  CORE_ADDR pathname_addr;     /* address of pathname  */
+  int pathname_len;            /* length of pathname */
+};
+
+/* It's not desirable to use the system header files to obtain the
+   structure of the obj_list or obj_info structs.  Therefore, we use a
+   platform neutral representation which has been derived from the IRIX
+   header files.  */
+
+typedef struct
+{
+  char b[4];
+}
+gdb_int32_bytes;
+typedef struct
+{
+  char b[8];
+}
+gdb_int64_bytes;
+
+/* The "old" obj_list struct.  This is used with old (o32) binaries.
+   The ``data'' member points at a much larger and more complicated
+   struct which we will only refer to by offsets.  See
+   fetch_lm_info().  */
+
+struct irix_obj_list
+{
+  gdb_int32_bytes data;
+  gdb_int32_bytes next;
+  gdb_int32_bytes prev;
+};
+
+/* The ELF32 and ELF64 versions of the above struct.  The oi_magic value
+   corresponds to the ``data'' value in the "old" struct.  When this value
+   is 0xffffffff, the data will be in one of the following formats.  The
+   ``oi_size'' field is used to decide which one we actually have.  */
+
+struct irix_elf32_obj_info
+{
+  gdb_int32_bytes oi_magic;
+  gdb_int32_bytes oi_size;
+  gdb_int32_bytes oi_next;
+  gdb_int32_bytes oi_prev;
+  gdb_int32_bytes oi_ehdr;
+  gdb_int32_bytes oi_orig_ehdr;
+  gdb_int32_bytes oi_pathname;
+  gdb_int32_bytes oi_pathname_len;
+};
+
+struct irix_elf64_obj_info
+{
+  gdb_int32_bytes oi_magic;
+  gdb_int32_bytes oi_size;
+  gdb_int64_bytes oi_next;
+  gdb_int64_bytes oi_prev;
+  gdb_int64_bytes oi_ehdr;
+  gdb_int64_bytes oi_orig_ehdr;
+  gdb_int64_bytes oi_pathname;
+  gdb_int32_bytes oi_pathname_len;
+  gdb_int32_bytes padding;
+};
+
+/* Union of all of the above (plus a split out magic field).  */
+
+union irix_obj_info
+{
+  gdb_int32_bytes magic;
+  struct irix_obj_list ol32;
+  struct irix_elf32_obj_info oi32;
+  struct irix_elf64_obj_info oi64;
+};
+
+/* MIPS sign extends its 32 bit addresses.  We could conceivably use
+   extract_typed_address here, but to do so, we'd have to construct an
+   appropriate type.  Calling extract_signed_integer or
+   extract_address seems simpler.  */
+
+static CORE_ADDR
+extract_mips_address (void *addr, int len)
+{
+  if (len <= 32)
+    return extract_signed_integer (addr, len);
+  else
+    return extract_address (addr, len);
+}
+
+/* Fetch and return the link map data associated with ADDR.  Note that
+   this routine automatically determines which (of three) link map
+   formats is in use by the target.  */
+
+struct lm_info
+fetch_lm_info (CORE_ADDR addr)
+{
+  struct lm_info li;
+  union irix_obj_info buf;
+
+  li.addr = addr;
+
+  /* The smallest region that we'll need is for buf.ol32.  We'll read
+     that first.  We'll read more of the buffer later if we have to deal
+     with one of the other cases.  (We don't want to incur a memory error
+     if we were to read a larger region that generates an error due to
+     being at the end of a page or the like.)  */
+  read_memory (addr, (char *) &buf, sizeof (buf.ol32));
+
+  if (extract_unsigned_integer (&buf.magic, sizeof (buf.magic)) != 0xffffffff)
+    {
+      /* Use buf.ol32... */
+      char obj_buf[432];
+      CORE_ADDR obj_addr = extract_mips_address (&buf.ol32.data,
+                                                sizeof (buf.ol32.data));
+      li.next = extract_mips_address (&buf.ol32.next, sizeof (buf.ol32.next));
+
+      read_memory (obj_addr, obj_buf, sizeof (obj_buf));
+
+      li.pathname_addr = extract_mips_address (&obj_buf[236], 4);
+      li.pathname_len = 0;     /* unknown */
+      li.reloc_offset = extract_mips_address (&obj_buf[196], 4)
+       - extract_mips_address (&obj_buf[248], 4);
+
+    }
+  else if (extract_unsigned_integer (&buf.oi32.oi_size,
+                                    sizeof (buf.oi32.oi_size))
+          == sizeof (buf.oi32))
+    {
+      /* Use buf.oi32...  */
+
+      /* Read rest of buffer.  */
+      read_memory (addr + sizeof (buf.ol32),
+                  ((char *) &buf) + sizeof (buf.ol32),
+                  sizeof (buf.oi32) - sizeof (buf.ol32));
+
+      /* Fill in fields using buffer contents.  */
+      li.next = extract_mips_address (&buf.oi32.oi_next,
+                                     sizeof (buf.oi32.oi_next));
+      li.reloc_offset = extract_mips_address (&buf.oi32.oi_ehdr,
+                                             sizeof (buf.oi32.oi_ehdr))
+       - extract_mips_address (&buf.oi32.oi_orig_ehdr,
+                               sizeof (buf.oi32.oi_orig_ehdr));
+      li.pathname_addr = extract_mips_address (&buf.oi32.oi_pathname,
+                                              sizeof (buf.oi32.oi_pathname));
+      li.pathname_len = extract_unsigned_integer (&buf.oi32.oi_pathname_len,
+                                                 sizeof (buf.oi32.
+                                                         oi_pathname_len));
+    }
+  else if (extract_unsigned_integer (&buf.oi64.oi_size,
+                                    sizeof (buf.oi64.oi_size))
+          == sizeof (buf.oi64))
+    {
+      /* Use buf.oi64...  */
+
+      /* Read rest of buffer.  */
+      read_memory (addr + sizeof (buf.ol32),
+                  ((char *) &buf) + sizeof (buf.ol32),
+                  sizeof (buf.oi64) - sizeof (buf.ol32));
+
+      /* Fill in fields using buffer contents.  */
+      li.next = extract_mips_address (&buf.oi64.oi_next,
+                                     sizeof (buf.oi64.oi_next));
+      li.reloc_offset = extract_mips_address (&buf.oi64.oi_ehdr,
+                                             sizeof (buf.oi64.oi_ehdr))
+       - extract_mips_address (&buf.oi64.oi_orig_ehdr,
+                               sizeof (buf.oi64.oi_orig_ehdr));
+      li.pathname_addr = extract_mips_address (&buf.oi64.oi_pathname,
+                                              sizeof (buf.oi64.oi_pathname));
+      li.pathname_len = extract_unsigned_integer (&buf.oi64.oi_pathname_len,
+                                                 sizeof (buf.oi64.
+                                                         oi_pathname_len));
+    }
+  else
+    {
+      error ("Unable to fetch shared library obj_info or obj_list info.");
+    }
+
+  return li;
+}
+
+/* The symbol which starts off the list of shared libraries.  */
+#define DEBUG_BASE "__rld_obj_head"
+
+char shadow_contents[BREAKPOINT_MAX];  /* Stash old bkpt addr contents */
+
+static CORE_ADDR debug_base;   /* Base of dynamic linker structures */
+static CORE_ADDR breakpoint_addr;      /* Address where end bkpt is set */
+
+/*
+
+   LOCAL FUNCTION
+
+   locate_base -- locate the base address of dynamic linker structs
+
+   SYNOPSIS
+
+   CORE_ADDR locate_base (void)
+
+   DESCRIPTION
+
+   For both the SunOS and SVR4 shared library implementations, if the
+   inferior executable has been linked dynamically, there is a single
+   address somewhere in the inferior's data space which is the key to
+   locating all of the dynamic linker's runtime structures.  This
+   address is the value of the symbol defined by the macro DEBUG_BASE.
+   The job of this function is to find and return that address, or to
+   return 0 if there is no such address (the executable is statically
+   linked for example).
+
+   For SunOS, the job is almost trivial, since the dynamic linker and
+   all of it's structures are statically linked to the executable at
+   link time.  Thus the symbol for the address we are looking for has
+   already been added to the minimal symbol table for the executable's
+   objfile at the time the symbol file's symbols were read, and all we
+   have to do is look it up there.  Note that we explicitly do NOT want
+   to find the copies in the shared library.
+
+   The SVR4 version is much more complicated because the dynamic linker
+   and it's structures are located in the shared C library, which gets
+   run as the executable's "interpreter" by the kernel.  We have to go
+   to a lot more work to discover the address of DEBUG_BASE.  Because
+   of this complexity, we cache the value we find and return that value
+   on subsequent invocations.  Note there is no copy in the executable
+   symbol tables.
+
+   Irix 5 is basically like SunOS.
+
+   Note that we can assume nothing about the process state at the time
+   we need to find this address.  We may be stopped on the first instruc-
+   tion of the interpreter (C shared library), the first instruction of
+   the executable itself, or somewhere else entirely (if we attached
+   to the process for example).
+
+ */
+
+static CORE_ADDR
+locate_base (void)
+{
+  struct minimal_symbol *msymbol;
+  CORE_ADDR address = 0;
+
+  msymbol = lookup_minimal_symbol (DEBUG_BASE, NULL, symfile_objfile);
+  if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
+    {
+      address = SYMBOL_VALUE_ADDRESS (msymbol);
+    }
+  return (address);
+}
+
+/*
+
+   LOCAL FUNCTION
+
+   disable_break -- remove the "mapping changed" breakpoint
+
+   SYNOPSIS
+
+   static int disable_break ()
+
+   DESCRIPTION
+
+   Removes the breakpoint that gets hit when the dynamic linker
+   completes a mapping change.
+
+ */
+
+static int
+disable_break (void)
+{
+  int status = 1;
+
+
+  /* Note that breakpoint address and original contents are in our address
+     space, so we just need to write the original contents back. */
+
+  if (memory_remove_breakpoint (breakpoint_addr, shadow_contents) != 0)
+    {
+      status = 0;
+    }
+
+  /* For the SVR4 version, we always know the breakpoint address.  For the
+     SunOS version we don't know it until the above code is executed.
+     Grumble if we are stopped anywhere besides the breakpoint address. */
+
+  if (stop_pc != breakpoint_addr)
+    {
+      warning
+       ("stopped at unknown breakpoint while handling shared libraries");
+    }
+
+  return (status);
+}
+
+/*
+
+   LOCAL FUNCTION
+
+   enable_break -- arrange for dynamic linker to hit breakpoint
+
+   SYNOPSIS
+
+   int enable_break (void)
+
+   DESCRIPTION
+
+   This functions inserts a breakpoint at the entry point of the
+   main executable, where all shared libraries are mapped in.
+ */
+
+static int
+enable_break (void)
+{
+  if (symfile_objfile != NULL
+      && target_insert_breakpoint (symfile_objfile->ei.entry_point,
+                                  shadow_contents) == 0)
+    {
+      breakpoint_addr = symfile_objfile->ei.entry_point;
+      return 1;
+    }
+
+  return 0;
+}
+
+/*
+
+   LOCAL FUNCTION
+
+   irix_solib_create_inferior_hook -- shared library startup support
+
+   SYNOPSIS
+
+   void solib_create_inferior_hook()
+
+   DESCRIPTION
+
+   When gdb starts up the inferior, it nurses it along (through the
+   shell) until it is ready to execute it's first instruction.  At this
+   point, this function gets called via expansion of the macro
+   SOLIB_CREATE_INFERIOR_HOOK.
+
+   For SunOS executables, this first instruction is typically the
+   one at "_start", or a similar text label, regardless of whether
+   the executable is statically or dynamically linked.  The runtime
+   startup code takes care of dynamically linking in any shared
+   libraries, once gdb allows the inferior to continue.
+
+   For SVR4 executables, this first instruction is either the first
+   instruction in the dynamic linker (for dynamically linked
+   executables) or the instruction at "start" for statically linked
+   executables.  For dynamically linked executables, the system
+   first exec's /lib/libc.so.N, which contains the dynamic linker,
+   and starts it running.  The dynamic linker maps in any needed
+   shared libraries, maps in the actual user executable, and then
+   jumps to "start" in the user executable.
+
+   For both SunOS shared libraries, and SVR4 shared libraries, we
+   can arrange to cooperate with the dynamic linker to discover the
+   names of shared libraries that are dynamically linked, and the
+   base addresses to which they are linked.
+
+   This function is responsible for discovering those names and
+   addresses, and saving sufficient information about them to allow
+   their symbols to be read at a later time.
+
+   FIXME
+
+   Between enable_break() and disable_break(), this code does not
+   properly handle hitting breakpoints which the user might have
+   set in the startup code or in the dynamic linker itself.  Proper
+   handling will probably have to wait until the implementation is
+   changed to use the "breakpoint handler function" method.
+
+   Also, what if child has exit()ed?  Must exit loop somehow.
+ */
+
+static void
+irix_solib_create_inferior_hook (void)
+{
+  if (!enable_break ())
+    {
+      warning ("shared library handler failed to enable breakpoint");
+      return;
+    }
+
+  /* Now run the target.  It will eventually hit the breakpoint, at
+     which point all of the libraries will have been mapped in and we
+     can go groveling around in the dynamic linker structures to find
+     out what we need to know about them. */
+
+  clear_proceed_status ();
+  stop_soon_quietly = 1;
+  stop_signal = TARGET_SIGNAL_0;
+  do
+    {
+      target_resume (pid_to_ptid (-1), 0, stop_signal);
+      wait_for_inferior ();
+    }
+  while (stop_signal != TARGET_SIGNAL_TRAP);
+
+  /* We are now either at the "mapping complete" breakpoint (or somewhere
+     else, a condition we aren't prepared to deal with anyway), so adjust
+     the PC as necessary after a breakpoint, disable the breakpoint, and
+     add any shared libraries that were mapped in. */
+
+  if (!disable_break ())
+    {
+      warning ("shared library handler failed to disable breakpoint");
+    }
+
+  /* solib_add will call reinit_frame_cache.
+     But we are stopped in the startup code and we might not have symbols
+     for the startup code, so heuristic_proc_start could be called
+     and will put out an annoying warning.
+     Delaying the resetting of stop_soon_quietly until after symbol loading
+     suppresses the warning.  */
+  solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add);
+  stop_soon_quietly = 0;
+  re_enable_breakpoints_in_shlibs ();
+}
+
+/* LOCAL FUNCTION
+
+   current_sos -- build a list of currently loaded shared objects
+
+   SYNOPSIS
+
+   struct so_list *current_sos ()
+
+   DESCRIPTION
+
+   Build a list of `struct so_list' objects describing the shared
+   objects currently loaded in the inferior.  This list does not
+   include an entry for the main executable file.
+
+   Note that we only gather information directly available from the
+   inferior --- we don't examine any of the shared library files
+   themselves.  The declaration of `struct so_list' says which fields
+   we provide values for.  */
+
+static struct so_list *
+irix_current_sos (void)
+{
+  CORE_ADDR lma;
+  char addr_buf[8];
+  struct so_list *head = 0;
+  struct so_list **link_ptr = &head;
+  int is_first = 1;
+  struct lm_info lm;
+
+  /* Make sure we've looked up the inferior's dynamic linker's base
+     structure.  */
+  if (!debug_base)
+    {
+      debug_base = locate_base ();
+
+      /* If we can't find the dynamic linker's base structure, this
+         must not be a dynamically linked executable.  Hmm.  */
+      if (!debug_base)
+       return 0;
+    }
+
+  read_memory (debug_base, addr_buf, TARGET_ADDR_BIT / TARGET_CHAR_BIT);
+  lma = extract_mips_address (addr_buf, TARGET_ADDR_BIT / TARGET_CHAR_BIT);
+
+  while (lma)
+    {
+      lm = fetch_lm_info (lma);
+      if (!is_first)
+       {
+         int errcode;
+         char *name_buf;
+         int name_size;
+         struct so_list *new
+           = (struct so_list *) xmalloc (sizeof (struct so_list));
+         struct cleanup *old_chain = make_cleanup (xfree, new);
+
+         memset (new, 0, sizeof (*new));
+
+         new->lm_info = xmalloc (sizeof (struct lm_info));
+         make_cleanup (xfree, new->lm_info);
+
+         *new->lm_info = lm;
+
+         /* Extract this shared object's name.  */
+         name_size = lm.pathname_len;
+         if (name_size == 0)
+           name_size = SO_NAME_MAX_PATH_SIZE - 1;
+
+         if (name_size >= SO_NAME_MAX_PATH_SIZE)
+           {
+             name_size = SO_NAME_MAX_PATH_SIZE - 1;
+             warning
+               ("current_sos: truncating name of %d characters to only %d characters",
+                lm.pathname_len, name_size);
+           }
+
+         target_read_string (lm.pathname_addr, &name_buf,
+                             name_size, &errcode);
+         if (errcode != 0)
+           {
+             warning ("current_sos: Can't read pathname for load map: %s\n",
+                      safe_strerror (errcode));
+           }
+         else
+           {
+             strncpy (new->so_name, name_buf, name_size);
+             new->so_name[name_size] = '\0';
+             xfree (name_buf);
+             strcpy (new->so_original_name, new->so_name);
+           }
+
+         new->next = 0;
+         *link_ptr = new;
+         link_ptr = &new->next;
+
+         discard_cleanups (old_chain);
+       }
+      is_first = 0;
+      lma = lm.next;
+    }
+
+  return head;
+}
+
+/*
+
+  LOCAL FUNCTION
+
+  irix_open_symbol_file_object
+
+  SYNOPSIS
+
+  void irix_open_symbol_file_object (void *from_tty)
+
+  DESCRIPTION
+
+  If no open symbol file, attempt to locate and open the main symbol
+  file.  On IRIX, this is the first link map entry.  If its name is
+  here, we can open it.  Useful when attaching to a process without
+  first loading its symbol file.
+
+  If FROM_TTYP dereferences to a non-zero integer, allow messages to
+  be printed.  This parameter is a pointer rather than an int because
+  open_symbol_file_object() is called via catch_errors() and
+  catch_errors() requires a pointer argument. */
+
+static int
+irix_open_symbol_file_object (void *from_ttyp)
+{
+  CORE_ADDR lma;
+  char addr_buf[8];
+  struct lm_info lm;
+  struct cleanup *cleanups;
+  int errcode;
+  int from_tty = *(int *) from_ttyp;
+  char *filename;
+
+  if (symfile_objfile)
+    if (!query ("Attempt to reload symbols from process? "))
+      return 0;
+
+  if ((debug_base = locate_base ()) == 0)
+    return 0;                  /* failed somehow...  */
+
+  /* First link map member should be the executable.  */
+  read_memory (debug_base, addr_buf, TARGET_ADDR_BIT / TARGET_CHAR_BIT);
+  lma = extract_mips_address (addr_buf, TARGET_ADDR_BIT / TARGET_CHAR_BIT);
+  if (lma == 0)
+    return 0;                  /* failed somehow...  */
+
+  lm = fetch_lm_info (lma);
+
+  if (lm.pathname_addr == 0)
+    return 0;                  /* No filename.  */
+
+  /* Now fetch the filename from target memory.  */
+  target_read_string (lm.pathname_addr, &filename, SO_NAME_MAX_PATH_SIZE - 1,
+                     &errcode);
+
+  if (errcode)
+    {
+      warning ("failed to read exec filename from attached file: %s",
+              safe_strerror (errcode));
+      return 0;
+    }
+
+  cleanups = make_cleanup (xfree, filename);
+  /* Have a pathname: read the symbol file.  */
+  symbol_file_add_main (filename, from_tty);
+
+  do_cleanups (cleanups);
+
+  return 1;
+}
+
+
+/*
+
+   LOCAL FUNCTION
+
+   irix_special_symbol_handling -- additional shared library symbol handling
+
+   SYNOPSIS
+
+   void irix_special_symbol_handling ()
+
+   DESCRIPTION
+
+   Once the symbols from a shared object have been loaded in the usual
+   way, we are called to do any system specific symbol handling that 
+   is needed.
+
+   For SunOS4, this consisted of grunging around in the dynamic
+   linkers structures to find symbol definitions for "common" symbols
+   and adding them to the minimal symbol table for the runtime common
+   objfile.
+
+   However, for IRIX, there's nothing to do.
+
+ */
+
+static void
+irix_special_symbol_handling (void)
+{
+}
+
+/* Using the solist entry SO, relocate the addresses in SEC.  */
+
+static void
+irix_relocate_section_addresses (struct so_list *so,
+                                struct section_table *sec)
+{
+  sec->addr += so->lm_info->reloc_offset;
+  sec->endaddr += so->lm_info->reloc_offset;
+}
+
+/* Free the lm_info struct.  */
+
+static void
+irix_free_so (struct so_list *so)
+{
+  xfree (so->lm_info);
+}
+
+/* Clear backend specific state.  */
+
+static void
+irix_clear_solib (void)
+{
+  debug_base = 0;
+}
+
+/* Return 1 if PC lies in the dynamic symbol resolution code of the
+   run time loader.  */
+static int
+irix_in_dynsym_resolve_code (CORE_ADDR pc)
+{
+  return 0;
+}
+
+static struct target_so_ops irix_so_ops;
+
+void
+_initialize_irix_solib (void)
+{
+  irix_so_ops.relocate_section_addresses = irix_relocate_section_addresses;
+  irix_so_ops.free_so = irix_free_so;
+  irix_so_ops.clear_solib = irix_clear_solib;
+  irix_so_ops.solib_create_inferior_hook = irix_solib_create_inferior_hook;
+  irix_so_ops.special_symbol_handling = irix_special_symbol_handling;
+  irix_so_ops.current_sos = irix_current_sos;
+  irix_so_ops.open_symbol_file_object = irix_open_symbol_file_object;
+  irix_so_ops.in_dynsym_resolve_code = irix_in_dynsym_resolve_code;
+
+  /* FIXME: Don't do this here.  *_gdbarch_init() should set so_ops. */
+  current_target_so_ops = &irix_so_ops;
+}
diff --git a/include/gdb/sim-h8300.h b/include/gdb/sim-h8300.h
new file mode 100644 (file)
index 0000000..ecc6883
--- /dev/null
@@ -0,0 +1,78 @@
+/* This file defines the interface between the h8300 simulator and gdb.\r
+   Copyright (C) 2002 Free Software Foundation, Inc.\r
+\r
+This file is part of GDB.\r
+\r
+This program is free software; you can redistribute it and/or modify\r
+it under the terms of the GNU General Public License as published by\r
+the Free Software Foundation; either version 2 of the License, or\r
+(at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#if !defined (SIM_H8300_H)\r
+#define SIM_H8300_H\r
+\r
+#ifdef __cplusplus\r
+extern "C" { //}
+#endif
+  \r
+/* The simulator makes use of the following register information. */ \r
+  \r
+  enum sim_h8300_regs
+  {
+    /* Registers common to all the H8 variants. */
+    /* Start here: */
+    SIM_H8300_R0_REGNUM,    
+    SIM_H8300_R1_REGNUM,
+    SIM_H8300_R2_REGNUM,
+    SIM_H8300_R3_REGNUM,
+    SIM_H8300_R4_REGNUM,
+    SIM_H8300_R5_REGNUM,
+    SIM_H8300_R6_REGNUM,
+    SIM_H8300_R7_REGNUM,
+
+    SIM_H8300_CCR_REGNUM,  /* Contains processor status */
+    SIM_H8300_PC_REGNUM,   /* Contains program counter */
+    /* End here */
+    
+    SIM_H8300_EXR_REGNUM,  /* Contains extended processor status 
+                              H8S and higher */
+    SIM_H8300_MACL_REGNUM, /* Lower part of MAC register (26xx only)*/
+    SIM_H8300_MACH_REGNUM, /* High part of MAC register (26xx only) */
+
+    SIM_H8300_CYCLE_REGNUM,
+    SIM_H8300_INST_REGNUM,
+    SIM_H8300_TICK_REGNUM
+  };
+
+  enum
+  {
+    SIM_H8300_ARG_FIRST_REGNUM = SIM_H8300_R0_REGNUM, /* first reg in which an arg 
+                                                         may be passed */    
+    SIM_H8300_ARG_LAST_REGNUM = SIM_H8300_R3_REGNUM,  /* last  reg in which an arg 
+                                                         may be passed */
+    SIM_H8300_FP_REGNUM = SIM_H8300_R6_REGNUM, /* Contain address of executing 
+                                                  stack frame */
+    SIM_H8300_SP_REGNUM = SIM_H8300_R7_REGNUM  /* Contains address of top of stack */
+  };
+
+  enum
+  {
+    SIM_H8300_NUM_COMMON_REGS = 10,
+    SIM_H8300_S_NUM_REGS = 13,
+    SIM_H8300_NUM_REGS = 16
+  };
+
+#ifdef __cplusplus\r
+}
+#endif
\r
+#endif                         /* SIM_H8300_H */
diff --git a/opcodes/po/pt_BR.po b/opcodes/po/pt_BR.po
new file mode 100644 (file)
index 0000000..c2663d3
--- /dev/null
@@ -0,0 +1,445 @@
+# opcodes: translation to Brazilian Portuguese (pt_BR)
+# Copyright (C) 2002 Free Software Foundation, Inc.
+# Alexandre Folle de Menezes <afmenez@terra.com.br>, 2002.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: opcodes 2.12.91\n"
+"POT-Creation-Date: 2002-07-23 15:55-0400\n"
+"PO-Revision-Date: 2002-07-24 04:00-0300\n"
+"Last-Translator: Alexandre Folle de Menezes <afmenez@terra.com.br>\n"
+"Language-Team: Brazilian Portuguese <ldp-br@bazar.conectiva.com.br>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ISO-8859-1\n"
+"Content-Transfer-Encoding: 8-bit\n"
+
+#: alpha-opc.c:335
+msgid "branch operand unaligned"
+msgstr "operando de desvio desalinhado"
+
+#: alpha-opc.c:358 alpha-opc.c:380
+msgid "jump hint unaligned"
+msgstr "dica de salto desalinhada"
+
+#: arc-dis.c:52
+msgid "Illegal limm reference in last instruction!\n"
+msgstr "Referência limm ilegal na última instrução!\n"
+
+#: arm-dis.c:507
+msgid "<illegal precision>"
+msgstr "<precisão ilegal>"
+
+#: arm-dis.c:1010
+#, c-format
+msgid "Unrecognised register name set: %s\n"
+msgstr "Conjunto de nomes de registrador desconhecido: %s\n"
+
+#: arm-dis.c:1017
+#, c-format
+msgid "Unrecognised disassembler option: %s\n"
+msgstr "Opção do desmontador desconhecida: %s\n"
+
+#: arm-dis.c:1191
+msgid ""
+"\n"
+"The following ARM specific disassembler options are supported for use with\n"
+"the -M switch:\n"
+msgstr ""
+"\n"
+"As opções do desmontador espcíficas para ARM a seguir não são suportadas para\n"
+"uso com a opção -M:\n"
+
+#: avr-dis.c:118 avr-dis.c:128
+msgid "undefined"
+msgstr "indefinido"
+
+#: avr-dis.c:180
+msgid "Internal disassembler error"
+msgstr "Erro interno do desmontador"
+
+#: avr-dis.c:228
+#, c-format
+msgid "unknown constraint `%c'"
+msgstr "restrição `%c' desconhecida"
+
+#: cgen-asm.c:346 fr30-ibld.c:195 frv-ibld.c:195 m32r-ibld.c:195
+#: openrisc-ibld.c:195 xstormy16-ibld.c:195
+#, c-format
+msgid "operand out of range (%ld not between %ld and %ld)"
+msgstr "operando fora de faixa (%ld não está entre %ld e %ld)"
+
+#: cgen-asm.c:367
+#, c-format
+msgid "operand out of range (%lu not between %lu and %lu)"
+msgstr "operando fora de faixa (%lu não está entre %lu e %lu)"
+
+#: d30v-dis.c:312
+#, c-format
+msgid "<unknown register %d>"
+msgstr "<registrador %d desconhecido>"
+
+#. Can't happen.
+#: dis-buf.c:57
+#, c-format
+msgid "Unknown error %d\n"
+msgstr "Erro %d desconhecido\n"
+
+#: dis-buf.c:62
+#, c-format
+msgid "Address 0x%x is out of bounds.\n"
+msgstr "Endereço 0x%x está fora dos limites.\n"
+
+#: fr30-asm.c:323 frv-asm.c:595 m32r-asm.c:325 openrisc-asm.c:244
+#: xstormy16-asm.c:231
+#, c-format
+msgid "Unrecognized field %d while parsing.\n"
+msgstr "Campo %d desconhecido durante análise.\n"
+
+#: fr30-asm.c:373 frv-asm.c:645 m32r-asm.c:375 openrisc-asm.c:294
+#: xstormy16-asm.c:281
+msgid "missing mnemonic in syntax string"
+msgstr "mnemônico faltando na string de sintaxe"
+
+#. We couldn't parse it.
+#: fr30-asm.c:509 fr30-asm.c:513 fr30-asm.c:600 fr30-asm.c:702 frv-asm.c:781
+#: frv-asm.c:785 frv-asm.c:872 frv-asm.c:974 m32r-asm.c:511 m32r-asm.c:515
+#: m32r-asm.c:602 m32r-asm.c:704 openrisc-asm.c:430 openrisc-asm.c:434
+#: openrisc-asm.c:521 openrisc-asm.c:623 xstormy16-asm.c:417
+#: xstormy16-asm.c:421 xstormy16-asm.c:508 xstormy16-asm.c:610
+msgid "unrecognized instruction"
+msgstr "instrução não reconhecida"
+
+#: fr30-asm.c:556 frv-asm.c:828 m32r-asm.c:558 openrisc-asm.c:477
+#: xstormy16-asm.c:464
+#, c-format
+msgid "syntax error (expected char `%c', found `%c')"
+msgstr "erro de sintaxe (esperado char `%c', encontrado `%c')"
+
+#: fr30-asm.c:566 frv-asm.c:838 m32r-asm.c:568 openrisc-asm.c:487
+#: xstormy16-asm.c:474
+#, c-format
+msgid "syntax error (expected char `%c', found end of instruction)"
+msgstr "erro de sintaxe (esperado char `%c', encontrado fim de instrução)"
+
+#: fr30-asm.c:594 frv-asm.c:866 m32r-asm.c:596 openrisc-asm.c:515
+#: xstormy16-asm.c:502
+msgid "junk at end of line"
+msgstr "lixo no final do arquivo"
+
+#: fr30-asm.c:701 frv-asm.c:973 m32r-asm.c:703 openrisc-asm.c:622
+#: xstormy16-asm.c:609
+msgid "unrecognized form of instruction"
+msgstr "forma de instrução não reconhecida"
+
+#: fr30-asm.c:713 frv-asm.c:985 m32r-asm.c:715 openrisc-asm.c:634
+#: xstormy16-asm.c:621
+#, c-format
+msgid "bad instruction `%.50s...'"
+msgstr "instrução `%.50s...' errada"
+
+#: fr30-asm.c:716 frv-asm.c:988 m32r-asm.c:718 openrisc-asm.c:637
+#: xstormy16-asm.c:624
+#, c-format
+msgid "bad instruction `%.50s'"
+msgstr "instrução `%.50s' errada"
+
+#. Default text to print if an instruction isn't recognized.
+#: fr30-dis.c:39 frv-dis.c:39 m32r-dis.c:39 mmix-dis.c:282 openrisc-dis.c:39
+#: xstormy16-dis.c:39
+msgid "*unknown*"
+msgstr "*desconecida*"
+
+#: fr30-dis.c:318 frv-dis.c:360 m32r-dis.c:249 openrisc-dis.c:136
+#: xstormy16-dis.c:169
+#, c-format
+msgid "Unrecognized field %d while printing insn.\n"
+msgstr "Campo %d não reconhecido durante impressão de insn.\n"
+
+#: fr30-ibld.c:166 frv-ibld.c:166 m32r-ibld.c:166 openrisc-ibld.c:166
+#: xstormy16-ibld.c:166
+#, c-format
+msgid "operand out of range (%ld not between %ld and %lu)"
+msgstr "operando fora de faixa (%ld não está entre %ld e %lu)"
+
+#: fr30-ibld.c:179 frv-ibld.c:179 m32r-ibld.c:179 openrisc-ibld.c:179
+#: xstormy16-ibld.c:179
+#, c-format
+msgid "operand out of range (%lu not between 0 and %lu)"
+msgstr "operando fora de faixa (%lu não está entre 0 e %lu)"
+
+#: fr30-ibld.c:730 frv-ibld.c:820 m32r-ibld.c:659 openrisc-ibld.c:633
+#: xstormy16-ibld.c:678
+#, c-format
+msgid "Unrecognized field %d while building insn.\n"
+msgstr "Campo %d não reconhecido durante construção de insn.\n"
+
+#: fr30-ibld.c:937 frv-ibld.c:1103 m32r-ibld.c:792 openrisc-ibld.c:735
+#: xstormy16-ibld.c:826
+#, c-format
+msgid "Unrecognized field %d while decoding insn.\n"
+msgstr "Campo %d não reconhecido durante decodificação de insn.\n"
+
+#: fr30-ibld.c:1086 frv-ibld.c:1348 m32r-ibld.c:902 openrisc-ibld.c:815
+#: xstormy16-ibld.c:939
+#, c-format
+msgid "Unrecognized field %d while getting int operand.\n"
+msgstr "Campo %d não reconhecido ao obter operando int.\n"
+
+#: fr30-ibld.c:1215 frv-ibld.c:1573 m32r-ibld.c:992 openrisc-ibld.c:875
+#: xstormy16-ibld.c:1032
+#, c-format
+msgid "Unrecognized field %d while getting vma operand.\n"
+msgstr "Campo %d não reconhecido ao obter operando vma.\n"
+
+#: fr30-ibld.c:1349 frv-ibld.c:1807 m32r-ibld.c:1090 openrisc-ibld.c:944
+#: xstormy16-ibld.c:1134
+#, c-format
+msgid "Unrecognized field %d while setting int operand.\n"
+msgstr "Campo %d não reconhecido ao definir operando int.\n"
+
+#: fr30-ibld.c:1471 frv-ibld.c:2029 m32r-ibld.c:1176 openrisc-ibld.c:1001
+#: xstormy16-ibld.c:1224
+#, c-format
+msgid "Unrecognized field %d while setting vma operand.\n"
+msgstr "Campo %d não reconhecido ao definir operando vma.\n"
+
+#: h8300-dis.c:385
+#, c-format
+msgid "Hmmmm %x"
+msgstr "Hmmmm %x"
+
+#: h8300-dis.c:396
+#, c-format
+msgid "Don't understand %x \n"
+msgstr "Não entendo %x \n"
+
+#: h8500-dis.c:143
+#, c-format
+msgid "can't cope with insert %d\n"
+msgstr "impossível lidar com insert %d\n"
+
+#. Couldn't understand anything.
+#: h8500-dis.c:350
+#, c-format
+msgid "%02x\t\t*unknown*"
+msgstr "%02x\t\t*desconhecido*"
+
+#: i386-dis.c:1649
+msgid "<internal disassembler error>"
+msgstr "<erro interno do desmontador>"
+
+#: m10200-dis.c:199
+#, c-format
+msgid "unknown\t0x%02x"
+msgstr "desconhecido\t0x%02x"
+
+#: m10200-dis.c:339
+#, c-format
+msgid "unknown\t0x%04lx"
+msgstr "desconhecido\t0x%04lx"
+
+#: m10300-dis.c:685
+#, c-format
+msgid "unknown\t0x%04x"
+msgstr "desconhecido\t0x%04x"
+
+#: m68k-dis.c:429
+#, c-format
+msgid "<internal error in opcode table: %s %s>\n"
+msgstr "<erro interno na tabela de códigos de operação: %s %s>\n"
+
+#: m68k-dis.c:1007
+#, c-format
+msgid "<function code %d>"
+msgstr "<código de função %d>"
+
+#: m88k-dis.c:255
+#, c-format
+msgid "# <dis error: %08x>"
+msgstr "# <erro de desmontador: %08x>"
+
+#: mips-dis.c:337
+#, c-format
+msgid "# internal error, undefined modifier(%c)"
+msgstr "# erro interno, modificador (%c) indefinido"
+
+#: mips-dis.c:1209
+#, c-format
+msgid "# internal disassembler error, unrecognised modifier (%c)"
+msgstr "# erro interno do desmontador, modificador (%c) não reconhecido"
+
+#: mmix-dis.c:34
+#, c-format
+msgid "Bad case %d (%s) in %s:%d\n"
+msgstr "Case %d errado (%s) em %s:%d\n"
+
+#: mmix-dis.c:44
+#, c-format
+msgid "Internal: Non-debugged code (test-case missing): %s:%d"
+msgstr "Interno: Código não depurado (test-case faltando): %s:%d"
+
+#: mmix-dis.c:53
+msgid "(unknown)"
+msgstr "(desconhecido)"
+
+#: mmix-dis.c:517
+#, c-format
+msgid "*unknown operands type: %d*"
+msgstr "*tipo de operandos desconhecidos: %d*"
+
+#. I and Z are output operands and can`t be immediate
+#. * A is an address and we can`t have the address of
+#. * an immediate either. We don't know how much to increase
+#. * aoffsetp by since whatever generated this is broken
+#. * anyway!
+#.
+#: ns32k-dis.c:628
+msgid "$<undefined>"
+msgstr "$<indefinido>"
+
+#: ppc-opc.c:777 ppc-opc.c:810
+msgid "invalid conditional option"
+msgstr "opção condicional inválida"
+
+#: ppc-opc.c:812
+msgid "attempt to set y bit when using + or - modifier"
+msgstr "tentativa de setar bit y ao usar modificador + ou -"
+
+#: ppc-opc.c:844 ppc-opc.c:896
+msgid "offset not a multiple of 4"
+msgstr "deslocamento não é um múltiplo de 4"
+
+#: ppc-opc.c:869
+msgid "offset not between -2048 and 2047"
+msgstr "deslocamento não está entre -2048 and 2047"
+
+#: ppc-opc.c:894
+msgid "offset not between -8192 and 8191"
+msgstr "deslocamento não está entre -8192 and 8191"
+
+#: ppc-opc.c:922
+msgid "ignoring least significant bits in branch offset"
+msgstr "ignorando os bits menos significatiovs no deslocamento do desvio"
+
+#: ppc-opc.c:956 ppc-opc.c:993
+msgid "illegal bitmask"
+msgstr "máscara de bits ilegal"
+
+#: ppc-opc.c:1066
+msgid "value out of range"
+msgstr "valor fora de faixa"
+
+#: ppc-opc.c:1142
+msgid "index register in load range"
+msgstr "registrador de índice na faixa de carregamento"
+
+#: ppc-opc.c:1158
+msgid "invalid register operand when updating"
+msgstr "operando de registro inválido durante atualização"
+
+#. Mark as non-valid instruction
+#: sparc-dis.c:750
+msgid "unknown"
+msgstr "desconhecido"
+
+#: sparc-dis.c:825
+#, c-format
+msgid "Internal error:  bad sparc-opcode.h: \"%s\", %#.8lx, %#.8lx\n"
+msgstr "Erro interno:  sparc-opcode.h errado: \"%s\", %#.8lx, %#.8lx\n"
+
+#: sparc-dis.c:836
+#, c-format
+msgid "Internal error: bad sparc-opcode.h: \"%s\", %#.8lx, %#.8lx\n"
+msgstr "Erro interno: sparc-opcode.h errado: \"%s\", %#.8lx, %#.8lx\n"
+
+#: sparc-dis.c:885
+#, c-format
+msgid "Internal error: bad sparc-opcode.h: \"%s\" == \"%s\"\n"
+msgstr "Erro interno: sparc-opcode.h errado: \"%s\" == \"%s\"\n"
+
+#: v850-dis.c:224
+#, c-format
+msgid "unknown operand shift: %x\n"
+msgstr "deslocamento de operando desconhecido: %x\n"
+
+#: v850-dis.c:236
+#, c-format
+msgid "unknown pop reg: %d\n"
+msgstr "registrador pop desconhecido: %d\n"
+
+#. The functions used to insert and extract complicated operands.
+#. Note: There is a conspiracy between these functions and
+#. v850_insert_operand() in gas/config/tc-v850.c.  Error messages
+#. containing the string 'out of range' will be ignored unless a
+#. specific command line option is given to GAS.
+#: v850-opc.c:68
+msgid "displacement value is not in range and is not aligned"
+msgstr "valor do deslocamento está fora da faixa e não está alinhado"
+
+#: v850-opc.c:69
+msgid "displacement value is out of range"
+msgstr "valor do deslocamento está fora da faixa"
+
+#: v850-opc.c:70
+msgid "displacement value is not aligned"
+msgstr "valor do deslocamento não está alinhado"
+
+#: v850-opc.c:72
+msgid "immediate value is out of range"
+msgstr "valor imediato está fora da faixa"
+
+#: v850-opc.c:83
+msgid "branch value not in range and to odd offset"
+msgstr "valor do desvio fora da faixa e para deslocamento ímpar"
+
+#: v850-opc.c:85 v850-opc.c:117
+msgid "branch value out of range"
+msgstr "valor do desvio fora da faixa"
+
+#: v850-opc.c:88 v850-opc.c:120
+msgid "branch to odd offset"
+msgstr "desvio para um deslocamento ímpar"
+
+#: v850-opc.c:115
+msgid "branch value not in range and to an odd offset"
+msgstr "valor do desvio fora da faixa e para um deslocamento ímpar"
+
+#: v850-opc.c:346
+msgid "invalid register for stack adjustment"
+msgstr "registrador inválido para ajuste da pilha"
+
+#: v850-opc.c:370
+msgid "immediate value not in range and not even"
+msgstr "valor imediato fora da faixa e não é par"
+
+#: v850-opc.c:375
+msgid "immediate value must be even"
+msgstr "o valor imediato deve ser par"
+
+#: xstormy16-asm.c:74
+msgid "Bad register in preincrement"
+msgstr "Registrador errado no pré-incremento"
+
+#: xstormy16-asm.c:79
+msgid "Bad register in postincrement"
+msgstr "Registrador errado no pós-incremento"
+
+#: xstormy16-asm.c:81
+msgid "Bad register name"
+msgstr "Nome de registrador errado"
+
+#: xstormy16-asm.c:85
+msgid "Label conflicts with register name"
+msgstr "O rótulo conflita com nome de registrador"
+
+#: xstormy16-asm.c:89
+msgid "Label conflicts with `Rx'"
+msgstr "O rótulo conflita com `Rx'"
+
+#: xstormy16-asm.c:91
+msgid "Bad immediate expression"
+msgstr "Expressão imediata errada"
+
+#: xstormy16-asm.c:120
+msgid "Small operand was not an immediate number"
+msgstr "O operando pequeno não era um número imediato"