Home | History | Annotate | Line # | Download | only in bfd
elf64-mips.c revision 1.10
      1   1.1  christos /* MIPS-specific support for 64-bit ELF
      2  1.10  christos    Copyright (C) 1996-2022 Free Software Foundation, Inc.
      3   1.1  christos    Ian Lance Taylor, Cygnus Support
      4   1.1  christos    Linker support added by Mark Mitchell, CodeSourcery, LLC.
      5   1.1  christos    <mark (at) codesourcery.com>
      6   1.1  christos 
      7   1.1  christos    This file is part of BFD, the Binary File Descriptor library.
      8   1.1  christos 
      9   1.1  christos    This program is free software; you can redistribute it and/or modify
     10   1.1  christos    it under the terms of the GNU General Public License as published by
     11   1.1  christos    the Free Software Foundation; either version 3 of the License, or
     12   1.1  christos    (at your option) any later version.
     13   1.1  christos 
     14   1.1  christos    This program is distributed in the hope that it will be useful,
     15   1.1  christos    but WITHOUT ANY WARRANTY; without even the implied warranty of
     16   1.1  christos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17   1.1  christos    GNU General Public License for more details.
     18   1.1  christos 
     19   1.1  christos    You should have received a copy of the GNU General Public License
     20   1.1  christos    along with this program; if not, write to the Free Software
     21   1.1  christos    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
     22   1.1  christos    MA 02110-1301, USA.  */
     23   1.1  christos 
     24   1.1  christos 
     25   1.1  christos /* This file supports the 64-bit MIPS ELF ABI.
     26   1.1  christos 
     27   1.1  christos    The MIPS 64-bit ELF ABI uses an unusual reloc format.  This file
     28   1.1  christos    overrides the usual ELF reloc handling, and handles reading and
     29   1.1  christos    writing the relocations here.  */
     30   1.1  christos 
     31   1.1  christos /* TODO: Many things are unsupported, even if there is some code for it
     32   1.1  christos  .       (which was mostly stolen from elf32-mips.c and slightly adapted).
     33   1.1  christos  .
     34   1.1  christos  .   - Relocation handling for REL relocs is wrong in many cases and
     35   1.1  christos  .     generally untested.
     36   1.1  christos  .   - Relocation handling for RELA relocs related to GOT support are
     37   1.1  christos  .     also likely to be wrong.
     38   1.1  christos  .   - Support for MIPS16 is untested.
     39   1.1  christos  .   - Combined relocs with RSS_* entries are unsupported.
     40   1.1  christos  .   - The whole GOT handling for NewABI is missing, some parts of
     41   1.1  christos  .     the OldABI version is still lying around and should be removed.
     42   1.1  christos  */
     43   1.1  christos 
     44   1.1  christos #include "sysdep.h"
     45   1.1  christos #include "bfd.h"
     46   1.1  christos #include "libbfd.h"
     47   1.1  christos #include "aout/ar.h"
     48   1.1  christos #include "bfdlink.h"
     49   1.1  christos #include "genlink.h"
     50   1.1  christos #include "elf-bfd.h"
     51   1.1  christos #include "elfxx-mips.h"
     52   1.1  christos #include "elf/mips.h"
     53   1.1  christos 
     54   1.1  christos /* Get the ECOFF swapping routines.  The 64-bit ABI is not supposed to
     55   1.1  christos    use ECOFF.  However, we support it anyhow for an easier changeover.  */
     56   1.1  christos #include "coff/sym.h"
     57   1.1  christos #include "coff/symconst.h"
     58   1.1  christos #include "coff/internal.h"
     59   1.1  christos #include "coff/ecoff.h"
     60   1.1  christos /* The 64 bit versions of the mdebug data structures are in alpha.h.  */
     61   1.1  christos #include "coff/alpha.h"
     62   1.1  christos #define ECOFF_SIGNED_64
     63   1.1  christos #include "ecoffswap.h"
     64   1.1  christos 
     65   1.1  christos static void mips_elf64_swap_reloc_in
     66   1.1  christos   (bfd *, const Elf64_Mips_External_Rel *, Elf64_Mips_Internal_Rela *);
     67   1.1  christos static void mips_elf64_swap_reloca_in
     68   1.1  christos   (bfd *, const Elf64_Mips_External_Rela *, Elf64_Mips_Internal_Rela *);
     69   1.1  christos static void mips_elf64_swap_reloc_out
     70   1.1  christos   (bfd *, const Elf64_Mips_Internal_Rela *, Elf64_Mips_External_Rel *);
     71   1.1  christos static void mips_elf64_swap_reloca_out
     72   1.1  christos   (bfd *, const Elf64_Mips_Internal_Rela *, Elf64_Mips_External_Rela *);
     73   1.1  christos static void mips_elf64_be_swap_reloc_in
     74   1.1  christos   (bfd *, const bfd_byte *, Elf_Internal_Rela *);
     75   1.1  christos static void mips_elf64_be_swap_reloc_out
     76   1.1  christos   (bfd *, const Elf_Internal_Rela *, bfd_byte *);
     77   1.1  christos static void mips_elf64_be_swap_reloca_in
     78   1.1  christos   (bfd *, const bfd_byte *, Elf_Internal_Rela *);
     79   1.1  christos static void mips_elf64_be_swap_reloca_out
     80   1.1  christos   (bfd *, const Elf_Internal_Rela *, bfd_byte *);
     81   1.1  christos static reloc_howto_type *bfd_elf64_bfd_reloc_type_lookup
     82   1.1  christos   (bfd *, bfd_reloc_code_real_type);
     83  1.10  christos static bool mips_elf64_info_to_howto_rela
     84   1.1  christos   (bfd *, arelent *, Elf_Internal_Rela *);
     85   1.1  christos static long mips_elf64_get_dynamic_reloc_upper_bound
     86   1.1  christos   (bfd *);
     87  1.10  christos static bool mips_elf64_slurp_one_reloc_table
     88   1.1  christos   (bfd *, asection *, Elf_Internal_Shdr *, bfd_size_type, arelent *,
     89  1.10  christos    asymbol **, bool);
     90  1.10  christos static bool mips_elf64_slurp_reloc_table
     91  1.10  christos   (bfd *, asection *, asymbol **, bool);
     92   1.1  christos static void mips_elf64_write_relocs
     93   1.1  christos   (bfd *, asection *, void *);
     94   1.1  christos static void mips_elf64_write_rel
     95   1.1  christos   (bfd *, asection *, Elf_Internal_Shdr *, int *, void *);
     96   1.1  christos static void mips_elf64_write_rela
     97   1.1  christos   (bfd *, asection *, Elf_Internal_Shdr *, int *, void *);
     98   1.1  christos static bfd_reloc_status_type mips_elf64_gprel16_reloc
     99   1.1  christos   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
    100   1.1  christos static bfd_reloc_status_type mips_elf64_literal_reloc
    101   1.1  christos   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
    102   1.1  christos static bfd_reloc_status_type mips_elf64_gprel32_reloc
    103   1.1  christos   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
    104   1.1  christos static bfd_reloc_status_type mips_elf64_shift6_reloc
    105   1.1  christos   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
    106   1.1  christos static bfd_reloc_status_type mips16_gprel_reloc
    107   1.1  christos   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
    108  1.10  christos static bool mips_elf64_assign_gp
    109   1.1  christos   (bfd *, bfd_vma *);
    110   1.1  christos static bfd_reloc_status_type mips_elf64_final_gp
    111  1.10  christos   (bfd *, asymbol *, bool, char **, bfd_vma *);
    112  1.10  christos static bool mips_elf64_object_p
    113   1.1  christos   (bfd *);
    114   1.1  christos static irix_compat_t elf64_mips_irix_compat
    115   1.1  christos   (bfd *);
    116  1.10  christos static bool elf64_mips_grok_prstatus
    117   1.1  christos   (bfd *, Elf_Internal_Note *);
    118  1.10  christos static bool elf64_mips_grok_psinfo
    119   1.1  christos   (bfd *, Elf_Internal_Note *);
    120   1.1  christos 
    121   1.3  christos extern const bfd_target mips_elf64_be_vec;
    122   1.3  christos extern const bfd_target mips_elf64_le_vec;
    123   1.1  christos 
    124   1.1  christos /* In case we're on a 32-bit machine, construct a 64-bit "-1" value
    125   1.1  christos    from smaller values.  Start with zero, widen, *then* decrement.  */
    126   1.1  christos #define MINUS_ONE	(((bfd_vma)0) - 1)
    127   1.1  christos 
    128   1.1  christos /* The number of local .got entries we reserve.  */
    129   1.1  christos #define MIPS_RESERVED_GOTNO (2)
    130   1.1  christos 
    131   1.1  christos /* The relocation table used for SHT_REL sections.  */
    133   1.1  christos 
    134   1.1  christos static reloc_howto_type mips_elf64_howto_table_rel[] =
    135   1.1  christos {
    136   1.1  christos   /* No relocation.  */
    137   1.1  christos   HOWTO (R_MIPS_NONE,		/* type */
    138  1.10  christos 	 0,			/* rightshift */
    139   1.1  christos 	 0,			/* size */
    140  1.10  christos 	 0,			/* bitsize */
    141   1.1  christos 	 false,			/* pc_relative */
    142   1.1  christos 	 0,			/* bitpos */
    143   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    144   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    145  1.10  christos 	 "R_MIPS_NONE",		/* name */
    146   1.1  christos 	 false,			/* partial_inplace */
    147   1.1  christos 	 0,			/* src_mask */
    148  1.10  christos 	 0,			/* dst_mask */
    149   1.1  christos 	 false),		/* pcrel_offset */
    150   1.1  christos 
    151   1.1  christos   /* 16 bit relocation.  */
    152   1.1  christos   HOWTO (R_MIPS_16,		/* type */
    153  1.10  christos 	 0,			/* rightshift */
    154   1.1  christos 	 4,			/* size */
    155  1.10  christos 	 16,			/* bitsize */
    156   1.1  christos 	 false,			/* pc_relative */
    157   1.1  christos 	 0,			/* bitpos */
    158   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    159   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    160  1.10  christos 	 "R_MIPS_16",		/* name */
    161   1.1  christos 	 true,			/* partial_inplace */
    162   1.1  christos 	 0x0000ffff,		/* src_mask */
    163  1.10  christos 	 0x0000ffff,		/* dst_mask */
    164   1.1  christos 	 false),		/* pcrel_offset */
    165   1.1  christos 
    166   1.1  christos   /* 32 bit relocation.  */
    167   1.1  christos   HOWTO (R_MIPS_32,		/* type */
    168  1.10  christos 	 0,			/* rightshift */
    169   1.1  christos 	 4,			/* size */
    170  1.10  christos 	 32,			/* bitsize */
    171   1.1  christos 	 false,			/* pc_relative */
    172   1.1  christos 	 0,			/* bitpos */
    173   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    174   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    175  1.10  christos 	 "R_MIPS_32",		/* name */
    176   1.1  christos 	 true,			/* partial_inplace */
    177   1.1  christos 	 0xffffffff,		/* src_mask */
    178  1.10  christos 	 0xffffffff,		/* dst_mask */
    179   1.1  christos 	 false),		/* pcrel_offset */
    180   1.1  christos 
    181   1.1  christos   /* 32 bit symbol relative relocation.  */
    182   1.1  christos   HOWTO (R_MIPS_REL32,		/* type */
    183  1.10  christos 	 0,			/* rightshift */
    184   1.1  christos 	 4,			/* size */
    185  1.10  christos 	 32,			/* bitsize */
    186   1.1  christos 	 false,			/* pc_relative */
    187   1.1  christos 	 0,			/* bitpos */
    188   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    189   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    190  1.10  christos 	 "R_MIPS_REL32",	/* name */
    191   1.1  christos 	 true,			/* partial_inplace */
    192   1.1  christos 	 0xffffffff,		/* src_mask */
    193  1.10  christos 	 0xffffffff,		/* dst_mask */
    194   1.1  christos 	 false),		/* pcrel_offset */
    195   1.1  christos 
    196   1.1  christos   /* 26 bit jump address.  */
    197   1.1  christos   HOWTO (R_MIPS_26,		/* type */
    198  1.10  christos 	 2,			/* rightshift */
    199   1.1  christos 	 4,			/* size */
    200  1.10  christos 	 26,			/* bitsize */
    201   1.1  christos 	 false,			/* pc_relative */
    202   1.1  christos 	 0,			/* bitpos */
    203   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    204   1.1  christos 				/* This needs complex overflow
    205   1.1  christos 				   detection, because the upper 36
    206   1.1  christos 				   bits must match the PC + 4.  */
    207   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    208  1.10  christos 	 "R_MIPS_26",		/* name */
    209   1.1  christos 	 true,			/* partial_inplace */
    210   1.1  christos 	 0x03ffffff,		/* src_mask */
    211  1.10  christos 	 0x03ffffff,		/* dst_mask */
    212   1.1  christos 	 false),		/* pcrel_offset */
    213   1.1  christos 
    214   1.1  christos   /* R_MIPS_HI16 and R_MIPS_LO16 are unsupported for NewABI REL.
    215   1.1  christos      However, the native IRIX6 tools use them, so we try our best. */
    216   1.1  christos 
    217   1.1  christos   /* High 16 bits of symbol value.  */
    218   1.1  christos   HOWTO (R_MIPS_HI16,		/* type */
    219  1.10  christos 	 16,			/* rightshift */
    220   1.1  christos 	 4,			/* size */
    221  1.10  christos 	 16,			/* bitsize */
    222   1.1  christos 	 false,			/* pc_relative */
    223   1.1  christos 	 0,			/* bitpos */
    224   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    225   1.1  christos 	 _bfd_mips_elf_hi16_reloc, /* special_function */
    226  1.10  christos 	 "R_MIPS_HI16",		/* name */
    227   1.1  christos 	 true,			/* partial_inplace */
    228   1.1  christos 	 0x0000ffff,		/* src_mask */
    229  1.10  christos 	 0x0000ffff,		/* dst_mask */
    230   1.1  christos 	 false),		/* pcrel_offset */
    231   1.1  christos 
    232   1.1  christos   /* Low 16 bits of symbol value.  */
    233   1.1  christos   HOWTO (R_MIPS_LO16,		/* type */
    234  1.10  christos 	 0,			/* rightshift */
    235   1.1  christos 	 4,			/* size */
    236  1.10  christos 	 16,			/* bitsize */
    237   1.1  christos 	 false,			/* pc_relative */
    238   1.1  christos 	 0,			/* bitpos */
    239   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    240   1.1  christos 	 _bfd_mips_elf_lo16_reloc, /* special_function */
    241  1.10  christos 	 "R_MIPS_LO16",		/* name */
    242   1.1  christos 	 true,			/* partial_inplace */
    243   1.1  christos 	 0x0000ffff,		/* src_mask */
    244  1.10  christos 	 0x0000ffff,		/* dst_mask */
    245   1.1  christos 	 false),		/* pcrel_offset */
    246   1.1  christos 
    247   1.1  christos   /* GP relative reference.  */
    248   1.1  christos   HOWTO (R_MIPS_GPREL16,	/* type */
    249  1.10  christos 	 0,			/* rightshift */
    250   1.1  christos 	 4,			/* size */
    251  1.10  christos 	 16,			/* bitsize */
    252   1.1  christos 	 false,			/* pc_relative */
    253   1.1  christos 	 0,			/* bitpos */
    254   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    255   1.1  christos 	 mips_elf64_gprel16_reloc, /* special_function */
    256  1.10  christos 	 "R_MIPS_GPREL16",	/* name */
    257   1.1  christos 	 true,			/* partial_inplace */
    258   1.1  christos 	 0x0000ffff,		/* src_mask */
    259  1.10  christos 	 0x0000ffff,		/* dst_mask */
    260   1.1  christos 	 false),		/* pcrel_offset */
    261   1.1  christos 
    262   1.1  christos   /* Reference to literal section.  */
    263   1.1  christos   HOWTO (R_MIPS_LITERAL,	/* type */
    264  1.10  christos 	 0,			/* rightshift */
    265   1.1  christos 	 4,			/* size */
    266  1.10  christos 	 16,			/* bitsize */
    267   1.1  christos 	 false,			/* pc_relative */
    268   1.1  christos 	 0,			/* bitpos */
    269   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    270   1.1  christos 	 mips_elf64_literal_reloc, /* special_function */
    271  1.10  christos 	 "R_MIPS_LITERAL",	/* name */
    272   1.1  christos 	 true,			/* partial_inplace */
    273   1.1  christos 	 0x0000ffff,		/* src_mask */
    274  1.10  christos 	 0x0000ffff,		/* dst_mask */
    275   1.1  christos 	 false),		/* pcrel_offset */
    276   1.1  christos 
    277   1.1  christos   /* Reference to global offset table.  */
    278   1.1  christos   HOWTO (R_MIPS_GOT16,		/* type */
    279  1.10  christos 	 0,			/* rightshift */
    280   1.1  christos 	 4,			/* size */
    281  1.10  christos 	 16,			/* bitsize */
    282   1.1  christos 	 false,			/* pc_relative */
    283   1.1  christos 	 0,			/* bitpos */
    284   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    285   1.1  christos 	 _bfd_mips_elf_got16_reloc, /* special_function */
    286  1.10  christos 	 "R_MIPS_GOT16",	/* name */
    287   1.1  christos 	 true,			/* partial_inplace */
    288   1.1  christos 	 0x0000ffff,		/* src_mask */
    289  1.10  christos 	 0x0000ffff,		/* dst_mask */
    290   1.1  christos 	 false),		/* pcrel_offset */
    291   1.1  christos 
    292   1.1  christos   /* 16 bit PC relative reference.  Note that the ABI document has a typo
    293   1.1  christos      and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
    294   1.1  christos      We do the right thing here.  */
    295   1.1  christos   HOWTO (R_MIPS_PC16,		/* type */
    296  1.10  christos 	 2,			/* rightshift */
    297   1.1  christos 	 4,			/* size */
    298  1.10  christos 	 16,			/* bitsize */
    299   1.1  christos 	 true,			/* pc_relative */
    300   1.1  christos 	 0,			/* bitpos */
    301   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    302   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    303  1.10  christos 	 "R_MIPS_PC16",		/* name */
    304   1.1  christos 	 true,			/* partial_inplace */
    305   1.1  christos 	 0x0000ffff,		/* src_mask */
    306  1.10  christos 	 0x0000ffff,		/* dst_mask */
    307   1.1  christos 	 true),			/* pcrel_offset */
    308   1.1  christos 
    309   1.1  christos   /* 16 bit call through global offset table.  */
    310   1.1  christos   HOWTO (R_MIPS_CALL16,		/* type */
    311  1.10  christos 	 0,			/* rightshift */
    312   1.1  christos 	 4,			/* size */
    313  1.10  christos 	 16,			/* bitsize */
    314   1.1  christos 	 false,			/* pc_relative */
    315   1.1  christos 	 0,			/* bitpos */
    316   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    317   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    318  1.10  christos 	 "R_MIPS_CALL16",	/* name */
    319   1.1  christos 	 true,			/* partial_inplace */
    320   1.1  christos 	 0x0000ffff,		/* src_mask */
    321  1.10  christos 	 0x0000ffff,		/* dst_mask */
    322   1.1  christos 	 false),		/* pcrel_offset */
    323   1.1  christos 
    324   1.1  christos   /* 32 bit GP relative reference.  */
    325   1.1  christos   HOWTO (R_MIPS_GPREL32,	/* type */
    326  1.10  christos 	 0,			/* rightshift */
    327   1.1  christos 	 4,			/* size */
    328  1.10  christos 	 32,			/* bitsize */
    329   1.1  christos 	 false,			/* pc_relative */
    330   1.1  christos 	 0,			/* bitpos */
    331   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    332   1.1  christos 	 mips_elf64_gprel32_reloc, /* special_function */
    333  1.10  christos 	 "R_MIPS_GPREL32",	/* name */
    334   1.1  christos 	 true,			/* partial_inplace */
    335   1.1  christos 	 0xffffffff,		/* src_mask */
    336  1.10  christos 	 0xffffffff,		/* dst_mask */
    337   1.1  christos 	 false),		/* pcrel_offset */
    338   1.1  christos 
    339   1.1  christos   EMPTY_HOWTO (13),
    340   1.1  christos   EMPTY_HOWTO (14),
    341   1.1  christos   EMPTY_HOWTO (15),
    342   1.1  christos 
    343   1.1  christos   /* A 5 bit shift field.  */
    344   1.1  christos   HOWTO (R_MIPS_SHIFT5,		/* type */
    345  1.10  christos 	 0,			/* rightshift */
    346   1.1  christos 	 4,			/* size */
    347  1.10  christos 	 5,			/* bitsize */
    348   1.1  christos 	 false,			/* pc_relative */
    349   1.1  christos 	 6,			/* bitpos */
    350   1.1  christos 	 complain_overflow_bitfield, /* complain_on_overflow */
    351   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    352  1.10  christos 	 "R_MIPS_SHIFT5",	/* name */
    353   1.1  christos 	 true,			/* partial_inplace */
    354   1.1  christos 	 0x000007c0,		/* src_mask */
    355  1.10  christos 	 0x000007c0,		/* dst_mask */
    356   1.1  christos 	 false),		/* pcrel_offset */
    357   1.1  christos 
    358   1.1  christos   /* A 6 bit shift field.  */
    359   1.1  christos   HOWTO (R_MIPS_SHIFT6,		/* type */
    360  1.10  christos 	 0,			/* rightshift */
    361   1.1  christos 	 4,			/* size */
    362  1.10  christos 	 6,			/* bitsize */
    363   1.1  christos 	 false,			/* pc_relative */
    364   1.1  christos 	 6,			/* bitpos */
    365   1.1  christos 	 complain_overflow_bitfield, /* complain_on_overflow */
    366   1.1  christos 	 mips_elf64_shift6_reloc, /* special_function */
    367  1.10  christos 	 "R_MIPS_SHIFT6",	/* name */
    368   1.1  christos 	 true,			/* partial_inplace */
    369   1.1  christos 	 0x000007c4,		/* src_mask */
    370  1.10  christos 	 0x000007c4,		/* dst_mask */
    371   1.1  christos 	 false),		/* pcrel_offset */
    372   1.1  christos 
    373   1.1  christos   /* 64 bit relocation.  */
    374   1.1  christos   HOWTO (R_MIPS_64,		/* type */
    375  1.10  christos 	 0,			/* rightshift */
    376   1.1  christos 	 8,			/* size */
    377  1.10  christos 	 64,			/* bitsize */
    378   1.1  christos 	 false,			/* pc_relative */
    379   1.1  christos 	 0,			/* bitpos */
    380   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    381   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    382  1.10  christos 	 "R_MIPS_64",		/* name */
    383   1.1  christos 	 true,			/* partial_inplace */
    384   1.1  christos 	 MINUS_ONE,		/* src_mask */
    385  1.10  christos 	 MINUS_ONE,		/* dst_mask */
    386   1.1  christos 	 false),		/* pcrel_offset */
    387   1.1  christos 
    388   1.1  christos   /* Displacement in the global offset table.  */
    389   1.1  christos   HOWTO (R_MIPS_GOT_DISP,	/* type */
    390  1.10  christos 	 0,			/* rightshift */
    391   1.1  christos 	 4,			/* size */
    392  1.10  christos 	 16,			/* bitsize */
    393   1.1  christos 	 false,			/* pc_relative */
    394   1.1  christos 	 0,			/* bitpos */
    395   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    396   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    397  1.10  christos 	 "R_MIPS_GOT_DISP",	/* name */
    398   1.1  christos 	 true,			/* partial_inplace */
    399   1.1  christos 	 0x0000ffff,		/* src_mask */
    400  1.10  christos 	 0x0000ffff,		/* dst_mask */
    401   1.1  christos 	 false),		/* pcrel_offset */
    402   1.1  christos 
    403   1.1  christos   /* Displacement to page pointer in the global offset table.  */
    404   1.1  christos   HOWTO (R_MIPS_GOT_PAGE,	/* type */
    405  1.10  christos 	 0,			/* rightshift */
    406   1.1  christos 	 4,			/* size */
    407  1.10  christos 	 16,			/* bitsize */
    408   1.1  christos 	 false,			/* pc_relative */
    409   1.1  christos 	 0,			/* bitpos */
    410   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    411   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    412  1.10  christos 	 "R_MIPS_GOT_PAGE",	/* name */
    413   1.1  christos 	 true,			/* partial_inplace */
    414   1.1  christos 	 0x0000ffff,		/* src_mask */
    415  1.10  christos 	 0x0000ffff,		/* dst_mask */
    416   1.1  christos 	 false),		/* pcrel_offset */
    417   1.1  christos 
    418   1.1  christos   /* Offset from page pointer in the global offset table.  */
    419   1.1  christos   HOWTO (R_MIPS_GOT_OFST,	/* type */
    420  1.10  christos 	 0,			/* rightshift */
    421   1.1  christos 	 4,			/* size */
    422  1.10  christos 	 16,			/* bitsize */
    423   1.1  christos 	 false,			/* pc_relative */
    424   1.1  christos 	 0,			/* bitpos */
    425   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    426   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    427  1.10  christos 	 "R_MIPS_GOT_OFST",	/* name */
    428   1.1  christos 	 true,			/* partial_inplace */
    429   1.1  christos 	 0x0000ffff,		/* src_mask */
    430  1.10  christos 	 0x0000ffff,		/* dst_mask */
    431   1.1  christos 	 false),		/* pcrel_offset */
    432   1.1  christos 
    433   1.1  christos   /* High 16 bits of displacement in global offset table.  */
    434   1.1  christos   HOWTO (R_MIPS_GOT_HI16,	/* type */
    435  1.10  christos 	 0,			/* rightshift */
    436   1.1  christos 	 4,			/* size */
    437  1.10  christos 	 16,			/* bitsize */
    438   1.1  christos 	 false,			/* pc_relative */
    439   1.1  christos 	 0,			/* bitpos */
    440   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    441   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    442  1.10  christos 	 "R_MIPS_GOT_HI16",	/* name */
    443   1.1  christos 	 true,			/* partial_inplace */
    444   1.1  christos 	 0x0000ffff,		/* src_mask */
    445  1.10  christos 	 0x0000ffff,		/* dst_mask */
    446   1.1  christos 	 false),		/* pcrel_offset */
    447   1.1  christos 
    448   1.1  christos   /* Low 16 bits of displacement in global offset table.  */
    449   1.1  christos   HOWTO (R_MIPS_GOT_LO16,	/* type */
    450  1.10  christos 	 0,			/* rightshift */
    451   1.1  christos 	 4,			/* size */
    452  1.10  christos 	 16,			/* bitsize */
    453   1.1  christos 	 false,			/* pc_relative */
    454   1.1  christos 	 0,			/* bitpos */
    455   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    456   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    457  1.10  christos 	 "R_MIPS_GOT_LO16",	/* name */
    458   1.1  christos 	 true,			/* partial_inplace */
    459   1.1  christos 	 0x0000ffff,		/* src_mask */
    460  1.10  christos 	 0x0000ffff,		/* dst_mask */
    461   1.1  christos 	 false),		/* pcrel_offset */
    462   1.1  christos 
    463   1.1  christos   /* 64 bit subtraction.  */
    464   1.1  christos   HOWTO (R_MIPS_SUB,		/* type */
    465  1.10  christos 	 0,			/* rightshift */
    466   1.1  christos 	 8,			/* size */
    467  1.10  christos 	 64,			/* bitsize */
    468   1.1  christos 	 false,			/* pc_relative */
    469   1.1  christos 	 0,			/* bitpos */
    470   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    471   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    472  1.10  christos 	 "R_MIPS_SUB",		/* name */
    473   1.1  christos 	 true,			/* partial_inplace */
    474   1.1  christos 	 MINUS_ONE,		/* src_mask */
    475  1.10  christos 	 MINUS_ONE,		/* dst_mask */
    476   1.1  christos 	 false),		/* pcrel_offset */
    477   1.1  christos 
    478   1.1  christos   /* Insert the addend as an instruction.  */
    479   1.1  christos   /* FIXME: Not handled correctly.  */
    480   1.1  christos   HOWTO (R_MIPS_INSERT_A,	/* type */
    481  1.10  christos 	 0,			/* rightshift */
    482   1.1  christos 	 4,			/* size */
    483  1.10  christos 	 32,			/* bitsize */
    484   1.1  christos 	 false,			/* pc_relative */
    485   1.1  christos 	 0,			/* bitpos */
    486   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    487   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    488  1.10  christos 	 "R_MIPS_INSERT_A",	/* name */
    489   1.1  christos 	 true,			/* partial_inplace */
    490   1.1  christos 	 0xffffffff,		/* src_mask */
    491  1.10  christos 	 0xffffffff,		/* dst_mask */
    492   1.1  christos 	 false),		/* pcrel_offset */
    493   1.1  christos 
    494   1.1  christos   /* Insert the addend as an instruction, and change all relocations
    495   1.1  christos      to refer to the old instruction at the address.  */
    496   1.1  christos   /* FIXME: Not handled correctly.  */
    497   1.1  christos   HOWTO (R_MIPS_INSERT_B,	/* type */
    498  1.10  christos 	 0,			/* rightshift */
    499   1.1  christos 	 4,			/* size */
    500  1.10  christos 	 32,			/* bitsize */
    501   1.1  christos 	 false,			/* pc_relative */
    502   1.1  christos 	 0,			/* bitpos */
    503   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    504   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    505  1.10  christos 	 "R_MIPS_INSERT_B",	/* name */
    506   1.1  christos 	 true,			/* partial_inplace */
    507   1.1  christos 	 0xffffffff,		/* src_mask */
    508  1.10  christos 	 0xffffffff,		/* dst_mask */
    509   1.1  christos 	 false),		/* pcrel_offset */
    510   1.1  christos 
    511   1.1  christos   /* Delete a 32 bit instruction.  */
    512   1.1  christos   /* FIXME: Not handled correctly.  */
    513   1.1  christos   HOWTO (R_MIPS_DELETE,		/* type */
    514  1.10  christos 	 0,			/* rightshift */
    515   1.1  christos 	 4,			/* size */
    516  1.10  christos 	 32,			/* bitsize */
    517   1.1  christos 	 false,			/* pc_relative */
    518   1.1  christos 	 0,			/* bitpos */
    519   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    520   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    521  1.10  christos 	 "R_MIPS_DELETE",	/* name */
    522   1.1  christos 	 true,			/* partial_inplace */
    523   1.1  christos 	 0xffffffff,		/* src_mask */
    524  1.10  christos 	 0xffffffff,		/* dst_mask */
    525   1.1  christos 	 false),		/* pcrel_offset */
    526   1.1  christos 
    527   1.1  christos   /* The MIPS ELF64 ABI Draft wants us to support these for REL relocations.
    528   1.1  christos      We don't, because
    529   1.1  christos        a) It means building the addend from a R_MIPS_HIGHEST/R_MIPS_HIGHER/
    530   1.1  christos 	  R_MIPS_HI16/R_MIPS_LO16 sequence with varying ordering, using
    531   1.1  christos 	  fallable heuristics.
    532   1.1  christos        b) No other NewABI toolchain actually emits such relocations.  */
    533   1.1  christos   EMPTY_HOWTO (R_MIPS_HIGHER),
    534   1.1  christos   EMPTY_HOWTO (R_MIPS_HIGHEST),
    535   1.1  christos 
    536   1.1  christos   /* High 16 bits of displacement in global offset table.  */
    537   1.1  christos   HOWTO (R_MIPS_CALL_HI16,	/* type */
    538  1.10  christos 	 0,			/* rightshift */
    539   1.1  christos 	 4,			/* size */
    540  1.10  christos 	 16,			/* bitsize */
    541   1.1  christos 	 false,			/* pc_relative */
    542   1.1  christos 	 0,			/* bitpos */
    543   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    544   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    545  1.10  christos 	 "R_MIPS_CALL_HI16",	/* name */
    546   1.1  christos 	 true,			/* partial_inplace */
    547   1.1  christos 	 0x0000ffff,		/* src_mask */
    548  1.10  christos 	 0x0000ffff,		/* dst_mask */
    549   1.1  christos 	 false),		/* pcrel_offset */
    550   1.1  christos 
    551   1.1  christos   /* Low 16 bits of displacement in global offset table.  */
    552   1.1  christos   HOWTO (R_MIPS_CALL_LO16,	/* type */
    553  1.10  christos 	 0,			/* rightshift */
    554   1.1  christos 	 4,			/* size */
    555  1.10  christos 	 16,			/* bitsize */
    556   1.1  christos 	 false,			/* pc_relative */
    557   1.1  christos 	 0,			/* bitpos */
    558   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    559   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    560  1.10  christos 	 "R_MIPS_CALL_LO16",	/* name */
    561   1.1  christos 	 true,			/* partial_inplace */
    562   1.1  christos 	 0x0000ffff,		/* src_mask */
    563  1.10  christos 	 0x0000ffff,		/* dst_mask */
    564   1.1  christos 	 false),		/* pcrel_offset */
    565   1.1  christos 
    566   1.1  christos   /* Section displacement, used by an associated event location section.  */
    567   1.1  christos   HOWTO (R_MIPS_SCN_DISP,	/* type */
    568  1.10  christos 	 0,			/* rightshift */
    569   1.1  christos 	 4,			/* size */
    570  1.10  christos 	 32,			/* bitsize */
    571   1.1  christos 	 false,			/* pc_relative */
    572   1.1  christos 	 0,			/* bitpos */
    573   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    574   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    575  1.10  christos 	 "R_MIPS_SCN_DISP",	/* name */
    576   1.1  christos 	 true,			/* partial_inplace */
    577   1.1  christos 	 0xffffffff,		/* src_mask */
    578  1.10  christos 	 0xffffffff,		/* dst_mask */
    579   1.1  christos 	 false),		/* pcrel_offset */
    580   1.1  christos 
    581   1.1  christos   HOWTO (R_MIPS_REL16,		/* type */
    582  1.10  christos 	 0,			/* rightshift */
    583   1.1  christos 	 2,			/* size */
    584  1.10  christos 	 16,			/* bitsize */
    585   1.1  christos 	 false,			/* pc_relative */
    586   1.1  christos 	 0,			/* bitpos */
    587   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    588   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    589  1.10  christos 	 "R_MIPS_REL16",	/* name */
    590   1.1  christos 	 true,			/* partial_inplace */
    591   1.1  christos 	 0xffff,		/* src_mask */
    592  1.10  christos 	 0xffff,		/* dst_mask */
    593   1.1  christos 	 false),		/* pcrel_offset */
    594   1.1  christos 
    595   1.1  christos   /* These two are obsolete.  */
    596   1.1  christos   EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
    597   1.1  christos   EMPTY_HOWTO (R_MIPS_PJUMP),
    598   1.1  christos 
    599   1.1  christos   /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
    600   1.1  christos      It must be used for multigot GOT's (and only there).  */
    601   1.1  christos   HOWTO (R_MIPS_RELGOT,		/* type */
    602  1.10  christos 	 0,			/* rightshift */
    603   1.1  christos 	 4,			/* size */
    604  1.10  christos 	 32,			/* bitsize */
    605   1.1  christos 	 false,			/* pc_relative */
    606   1.1  christos 	 0,			/* bitpos */
    607   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    608   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    609  1.10  christos 	 "R_MIPS_RELGOT",	/* name */
    610   1.1  christos 	 true,			/* partial_inplace */
    611   1.1  christos 	 0xffffffff,		/* src_mask */
    612  1.10  christos 	 0xffffffff,		/* dst_mask */
    613   1.1  christos 	 false),		/* pcrel_offset */
    614   1.1  christos 
    615   1.1  christos   /* Protected jump conversion.  This is an optimization hint.  No
    616   1.1  christos      relocation is required for correctness.  */
    617   1.1  christos   HOWTO (R_MIPS_JALR,		/* type */
    618  1.10  christos 	 0,			/* rightshift */
    619   1.1  christos 	 4,			/* size */
    620  1.10  christos 	 32,			/* bitsize */
    621   1.1  christos 	 false,			/* pc_relative */
    622   1.1  christos 	 0,			/* bitpos */
    623   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    624   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    625  1.10  christos 	 "R_MIPS_JALR",		/* name */
    626   1.1  christos 	 false,			/* partial_inplace */
    627   1.1  christos 	 0,			/* src_mask */
    628  1.10  christos 	 0x00000000,		/* dst_mask */
    629   1.1  christos 	 false),		/* pcrel_offset */
    630   1.1  christos 
    631   1.1  christos   /* TLS relocations.  */
    632   1.1  christos   EMPTY_HOWTO (R_MIPS_TLS_DTPMOD32),
    633   1.1  christos   EMPTY_HOWTO (R_MIPS_TLS_DTPREL32),
    634   1.1  christos 
    635   1.1  christos   HOWTO (R_MIPS_TLS_DTPMOD64,	/* type */
    636  1.10  christos 	 0,			/* rightshift */
    637   1.1  christos 	 8,			/* size */
    638  1.10  christos 	 64,			/* bitsize */
    639   1.1  christos 	 false,			/* pc_relative */
    640   1.1  christos 	 0,			/* bitpos */
    641   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    642   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    643  1.10  christos 	 "R_MIPS_TLS_DTPMOD64",	/* name */
    644   1.1  christos 	 true,			/* partial_inplace */
    645   1.1  christos 	 MINUS_ONE,		/* src_mask */
    646  1.10  christos 	 MINUS_ONE,		/* dst_mask */
    647   1.1  christos 	 false),		/* pcrel_offset */
    648   1.1  christos 
    649   1.1  christos   HOWTO (R_MIPS_TLS_DTPREL64,	/* type */
    650  1.10  christos 	 0,			/* rightshift */
    651   1.1  christos 	 8,			/* size */
    652  1.10  christos 	 64,			/* bitsize */
    653   1.1  christos 	 false,			/* pc_relative */
    654   1.1  christos 	 0,			/* bitpos */
    655   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    656   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    657  1.10  christos 	 "R_MIPS_TLS_DTPREL64",	/* name */
    658   1.1  christos 	 true,			/* partial_inplace */
    659   1.1  christos 	 MINUS_ONE,		/* src_mask */
    660  1.10  christos 	 MINUS_ONE,		/* dst_mask */
    661   1.1  christos 	 false),		/* pcrel_offset */
    662   1.1  christos 
    663   1.1  christos   /* TLS general dynamic variable reference.  */
    664   1.1  christos   HOWTO (R_MIPS_TLS_GD,		/* type */
    665  1.10  christos 	 0,			/* rightshift */
    666   1.1  christos 	 4,			/* size */
    667  1.10  christos 	 16,			/* bitsize */
    668   1.1  christos 	 false,			/* pc_relative */
    669   1.1  christos 	 0,			/* bitpos */
    670   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    671   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    672  1.10  christos 	 "R_MIPS_TLS_GD",	/* name */
    673   1.1  christos 	 true,			/* partial_inplace */
    674   1.1  christos 	 0x0000ffff,		/* src_mask */
    675  1.10  christos 	 0x0000ffff,		/* dst_mask */
    676   1.1  christos 	 false),		/* pcrel_offset */
    677   1.1  christos 
    678   1.1  christos   /* TLS local dynamic variable reference.  */
    679   1.1  christos   HOWTO (R_MIPS_TLS_LDM,	/* type */
    680  1.10  christos 	 0,			/* rightshift */
    681   1.1  christos 	 4,			/* size */
    682  1.10  christos 	 16,			/* bitsize */
    683   1.1  christos 	 false,			/* pc_relative */
    684   1.1  christos 	 0,			/* bitpos */
    685   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    686   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    687  1.10  christos 	 "R_MIPS_TLS_LDM",	/* name */
    688   1.1  christos 	 true,			/* partial_inplace */
    689   1.1  christos 	 0x0000ffff,		/* src_mask */
    690  1.10  christos 	 0x0000ffff,		/* dst_mask */
    691   1.1  christos 	 false),		/* pcrel_offset */
    692   1.1  christos 
    693   1.1  christos   /* TLS local dynamic offset.  */
    694   1.1  christos   HOWTO (R_MIPS_TLS_DTPREL_HI16,	/* type */
    695  1.10  christos 	 0,			/* rightshift */
    696   1.1  christos 	 4,			/* size */
    697  1.10  christos 	 16,			/* bitsize */
    698   1.1  christos 	 false,			/* pc_relative */
    699   1.1  christos 	 0,			/* bitpos */
    700   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    701   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    702  1.10  christos 	 "R_MIPS_TLS_DTPREL_HI16",	/* name */
    703   1.1  christos 	 true,			/* partial_inplace */
    704   1.1  christos 	 0x0000ffff,		/* src_mask */
    705  1.10  christos 	 0x0000ffff,		/* dst_mask */
    706   1.1  christos 	 false),		/* pcrel_offset */
    707   1.1  christos 
    708   1.1  christos   /* TLS local dynamic offset.  */
    709   1.1  christos   HOWTO (R_MIPS_TLS_DTPREL_LO16,	/* type */
    710  1.10  christos 	 0,			/* rightshift */
    711   1.1  christos 	 4,			/* size */
    712  1.10  christos 	 16,			/* bitsize */
    713   1.1  christos 	 false,			/* pc_relative */
    714   1.1  christos 	 0,			/* bitpos */
    715   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    716   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    717  1.10  christos 	 "R_MIPS_TLS_DTPREL_LO16",	/* name */
    718   1.1  christos 	 true,			/* partial_inplace */
    719   1.1  christos 	 0x0000ffff,		/* src_mask */
    720  1.10  christos 	 0x0000ffff,		/* dst_mask */
    721   1.1  christos 	 false),		/* pcrel_offset */
    722   1.1  christos 
    723   1.1  christos   /* TLS thread pointer offset.  */
    724   1.1  christos   HOWTO (R_MIPS_TLS_GOTTPREL,	/* type */
    725  1.10  christos 	 0,			/* rightshift */
    726   1.1  christos 	 4,			/* size */
    727  1.10  christos 	 16,			/* bitsize */
    728   1.1  christos 	 false,			/* pc_relative */
    729   1.1  christos 	 0,			/* bitpos */
    730   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    731   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    732  1.10  christos 	 "R_MIPS_TLS_GOTTPREL",	/* name */
    733   1.1  christos 	 true,			/* partial_inplace */
    734   1.1  christos 	 0x0000ffff,		/* src_mask */
    735  1.10  christos 	 0x0000ffff,		/* dst_mask */
    736   1.1  christos 	 false),		/* pcrel_offset */
    737   1.1  christos 
    738   1.1  christos   /* TLS IE dynamic relocations.  */
    739   1.1  christos   EMPTY_HOWTO (R_MIPS_TLS_TPREL32),
    740   1.1  christos 
    741   1.1  christos   HOWTO (R_MIPS_TLS_TPREL64,	/* type */
    742  1.10  christos 	 0,			/* rightshift */
    743   1.1  christos 	 8,			/* size */
    744  1.10  christos 	 64,			/* bitsize */
    745   1.1  christos 	 false,			/* pc_relative */
    746   1.1  christos 	 0,			/* bitpos */
    747   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    748   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    749  1.10  christos 	 "R_MIPS_TLS_TPREL64",	/* name */
    750   1.1  christos 	 true,			/* partial_inplace */
    751   1.1  christos 	 MINUS_ONE,		/* src_mask */
    752  1.10  christos 	 MINUS_ONE,		/* dst_mask */
    753   1.1  christos 	 false),		/* pcrel_offset */
    754   1.1  christos 
    755   1.1  christos   /* TLS thread pointer offset.  */
    756   1.1  christos   HOWTO (R_MIPS_TLS_TPREL_HI16,	/* type */
    757  1.10  christos 	 0,			/* rightshift */
    758   1.1  christos 	 4,			/* size */
    759  1.10  christos 	 16,			/* bitsize */
    760   1.1  christos 	 false,			/* pc_relative */
    761   1.1  christos 	 0,			/* bitpos */
    762   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    763   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    764  1.10  christos 	 "R_MIPS_TLS_TPREL_HI16", /* name */
    765   1.1  christos 	 true,			/* partial_inplace */
    766   1.1  christos 	 0x0000ffff,		/* src_mask */
    767  1.10  christos 	 0x0000ffff,		/* dst_mask */
    768   1.1  christos 	 false),		/* pcrel_offset */
    769   1.1  christos 
    770   1.1  christos   /* TLS thread pointer offset.  */
    771   1.1  christos   HOWTO (R_MIPS_TLS_TPREL_LO16,	/* type */
    772  1.10  christos 	 0,			/* rightshift */
    773   1.1  christos 	 4,			/* size */
    774  1.10  christos 	 16,			/* bitsize */
    775   1.1  christos 	 false,			/* pc_relative */
    776   1.1  christos 	 0,			/* bitpos */
    777   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    778   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    779  1.10  christos 	 "R_MIPS_TLS_TPREL_LO16", /* name */
    780   1.1  christos 	 true,			/* partial_inplace */
    781   1.1  christos 	 0x0000ffff,		/* src_mask */
    782  1.10  christos 	 0x0000ffff,		/* dst_mask */
    783   1.1  christos 	 false),		/* pcrel_offset */
    784   1.1  christos 
    785   1.1  christos   /* 32 bit relocation with no addend.  */
    786   1.1  christos   HOWTO (R_MIPS_GLOB_DAT,	/* type */
    787  1.10  christos 	 0,			/* rightshift */
    788   1.1  christos 	 4,			/* size */
    789  1.10  christos 	 32,			/* bitsize */
    790   1.1  christos 	 false,			/* pc_relative */
    791   1.1  christos 	 0,			/* bitpos */
    792   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    793   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    794  1.10  christos 	 "R_MIPS_GLOB_DAT",	/* name */
    795   1.1  christos 	 false,			/* partial_inplace */
    796   1.1  christos 	 0x0,			/* src_mask */
    797  1.10  christos 	 0xffffffff,		/* dst_mask */
    798   1.3  christos 	 false),		/* pcrel_offset */
    799   1.3  christos 
    800   1.3  christos   EMPTY_HOWTO (52),
    801   1.3  christos   EMPTY_HOWTO (53),
    802   1.3  christos   EMPTY_HOWTO (54),
    803   1.3  christos   EMPTY_HOWTO (55),
    804   1.3  christos   EMPTY_HOWTO (56),
    805   1.3  christos   EMPTY_HOWTO (57),
    806   1.3  christos   EMPTY_HOWTO (58),
    807   1.3  christos   EMPTY_HOWTO (59),
    808   1.3  christos 
    809   1.3  christos   HOWTO (R_MIPS_PC21_S2,	/* type */
    810  1.10  christos 	 2,			/* rightshift */
    811   1.3  christos 	 4,			/* size */
    812  1.10  christos 	 21,			/* bitsize */
    813   1.3  christos 	 true,			/* pc_relative */
    814   1.3  christos 	 0,			/* bitpos */
    815   1.3  christos 	 complain_overflow_signed, /* complain_on_overflow */
    816   1.3  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    817  1.10  christos 	 "R_MIPS_PC21_S2",	/* name */
    818   1.3  christos 	 true,			/* partial_inplace */
    819   1.3  christos 	 0x001fffff,		/* src_mask */
    820  1.10  christos 	 0x001fffff,		/* dst_mask */
    821   1.3  christos 	 true),			/* pcrel_offset */
    822   1.3  christos 
    823   1.3  christos   HOWTO (R_MIPS_PC26_S2,	/* type */
    824  1.10  christos 	 2,			/* rightshift */
    825   1.3  christos 	 4,			/* size */
    826  1.10  christos 	 26,			/* bitsize */
    827   1.3  christos 	 true,			/* pc_relative */
    828   1.3  christos 	 0,			/* bitpos */
    829   1.3  christos 	 complain_overflow_signed, /* complain_on_overflow */
    830   1.3  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    831  1.10  christos 	 "R_MIPS_PC26_S2",	/* name */
    832   1.3  christos 	 true,			/* partial_inplace */
    833   1.3  christos 	 0x03ffffff,		/* src_mask */
    834  1.10  christos 	 0x03ffffff,		/* dst_mask */
    835   1.3  christos 	 true),			/* pcrel_offset */
    836   1.3  christos 
    837   1.3  christos   HOWTO (R_MIPS_PC18_S3,	/* type */
    838  1.10  christos 	 3,			/* rightshift */
    839   1.3  christos 	 4,			/* size */
    840  1.10  christos 	 18,			/* bitsize */
    841   1.3  christos 	 true,			/* pc_relative */
    842   1.3  christos 	 0,			/* bitpos */
    843   1.3  christos 	 complain_overflow_signed, /* complain_on_overflow */
    844   1.3  christos 	 _bfd_mips_elf_generic_reloc,   /* special_function */
    845  1.10  christos 	 "R_MIPS_PC18_S3",	/* name */
    846   1.3  christos 	 true,			/* partial_inplace */
    847   1.3  christos 	 0x0003ffff,		/* src_mask */
    848  1.10  christos 	 0x0003ffff,		/* dst_mask */
    849   1.3  christos 	 true),			/* pcrel_offset */
    850   1.3  christos 
    851   1.3  christos   HOWTO (R_MIPS_PC19_S2,	/* type */
    852  1.10  christos 	 2,			/* rightshift */
    853   1.3  christos 	 4,			/* size */
    854  1.10  christos 	 19,			/* bitsize */
    855   1.3  christos 	 true,			/* pc_relative */
    856   1.3  christos 	 0,			/* bitpos */
    857   1.3  christos 	 complain_overflow_signed, /* complain_on_overflow */
    858   1.3  christos 	 _bfd_mips_elf_generic_reloc,   /* special_function */
    859  1.10  christos 	 "R_MIPS_PC19_S2",	/* name */
    860   1.3  christos 	 true,			/* partial_inplace */
    861   1.3  christos 	 0x0007ffff,		/* src_mask */
    862  1.10  christos 	 0x0007ffff,		/* dst_mask */
    863   1.3  christos 	 true),			/* pcrel_offset */
    864   1.3  christos 
    865   1.3  christos   HOWTO (R_MIPS_PCHI16,		/* type */
    866  1.10  christos 	 16,			/* rightshift */
    867   1.3  christos 	 4,			/* size */
    868  1.10  christos 	 16,			/* bitsize */
    869   1.3  christos 	 true,			/* pc_relative */
    870   1.3  christos 	 0,			/* bitpos */
    871   1.3  christos 	 complain_overflow_signed, /* complain_on_overflow */
    872   1.3  christos 	 _bfd_mips_elf_generic_reloc,   /* special_function */
    873  1.10  christos 	 "R_MIPS_PCHI16",	/* name */
    874   1.3  christos 	 true,			/* partial_inplace */
    875   1.3  christos 	 0x0000ffff,		/* src_mask */
    876  1.10  christos 	 0x0000ffff,		/* dst_mask */
    877   1.3  christos 	 true),			/* pcrel_offset */
    878   1.3  christos 
    879   1.3  christos   HOWTO (R_MIPS_PCLO16,		/* type */
    880  1.10  christos 	 0,			/* rightshift */
    881   1.3  christos 	 4,			/* size */
    882  1.10  christos 	 16,			/* bitsize */
    883   1.3  christos 	 true,			/* pc_relative */
    884   1.3  christos 	 0,			/* bitpos */
    885   1.3  christos 	 complain_overflow_dont, /* complain_on_overflow */
    886   1.3  christos 	 _bfd_mips_elf_generic_reloc,   /* special_function */
    887  1.10  christos 	 "R_MIPS_PCLO16",	/* name */
    888   1.3  christos 	 true,			/* partial_inplace */
    889   1.3  christos 	 0x0000ffff,		/* src_mask */
    890  1.10  christos 	 0x0000ffff,		/* dst_mask */
    891   1.3  christos 	 true),			/* pcrel_offset */
    892   1.1  christos 
    893   1.1  christos };
    894   1.1  christos 
    895   1.1  christos /* The relocation table used for SHT_RELA sections.  */
    896   1.1  christos 
    897   1.1  christos static reloc_howto_type mips_elf64_howto_table_rela[] =
    898   1.1  christos {
    899   1.1  christos   /* No relocation.  */
    900   1.1  christos   HOWTO (R_MIPS_NONE,		/* type */
    901  1.10  christos 	 0,			/* rightshift */
    902   1.1  christos 	 0,			/* size */
    903  1.10  christos 	 0,			/* bitsize */
    904   1.1  christos 	 false,			/* pc_relative */
    905   1.1  christos 	 0,			/* bitpos */
    906   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    907   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    908  1.10  christos 	 "R_MIPS_NONE",		/* name */
    909   1.1  christos 	 false,			/* partial_inplace */
    910   1.1  christos 	 0,			/* src_mask */
    911  1.10  christos 	 0,			/* dst_mask */
    912   1.1  christos 	 false),		/* pcrel_offset */
    913   1.1  christos 
    914   1.1  christos   /* 16 bit relocation.  */
    915   1.1  christos   HOWTO (R_MIPS_16,		/* type */
    916  1.10  christos 	 0,			/* rightshift */
    917   1.1  christos 	 4,			/* size */
    918  1.10  christos 	 16,			/* bitsize */
    919   1.1  christos 	 false,			/* pc_relative */
    920   1.1  christos 	 0,			/* bitpos */
    921   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    922   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    923  1.10  christos 	 "R_MIPS_16",		/* name */
    924   1.1  christos 	 false,			/* partial_inplace */
    925   1.1  christos 	 0,			/* src_mask */
    926  1.10  christos 	 0x0000ffff,		/* dst_mask */
    927   1.1  christos 	 false),		/* pcrel_offset */
    928   1.1  christos 
    929   1.1  christos   /* 32 bit relocation.  */
    930   1.1  christos   HOWTO (R_MIPS_32,		/* type */
    931  1.10  christos 	 0,			/* rightshift */
    932   1.1  christos 	 4,			/* size */
    933  1.10  christos 	 32,			/* bitsize */
    934   1.1  christos 	 false,			/* pc_relative */
    935   1.1  christos 	 0,			/* bitpos */
    936   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    937   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    938  1.10  christos 	 "R_MIPS_32",		/* name */
    939   1.1  christos 	 false,			/* partial_inplace */
    940   1.1  christos 	 0,			/* src_mask */
    941  1.10  christos 	 0xffffffff,		/* dst_mask */
    942   1.1  christos 	 false),		/* pcrel_offset */
    943   1.1  christos 
    944   1.1  christos   /* 32 bit symbol relative relocation.  */
    945   1.1  christos   HOWTO (R_MIPS_REL32,		/* type */
    946  1.10  christos 	 0,			/* rightshift */
    947   1.1  christos 	 4,			/* size */
    948  1.10  christos 	 32,			/* bitsize */
    949   1.1  christos 	 false,			/* pc_relative */
    950   1.1  christos 	 0,			/* bitpos */
    951   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    952   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    953  1.10  christos 	 "R_MIPS_REL32",	/* name */
    954   1.1  christos 	 false,			/* partial_inplace */
    955   1.1  christos 	 0,			/* src_mask */
    956  1.10  christos 	 0xffffffff,		/* dst_mask */
    957   1.1  christos 	 false),		/* pcrel_offset */
    958   1.1  christos 
    959   1.1  christos   /* 26 bit jump address.  */
    960   1.1  christos   HOWTO (R_MIPS_26,		/* type */
    961  1.10  christos 	 2,			/* rightshift */
    962   1.1  christos 	 4,			/* size */
    963  1.10  christos 	 26,			/* bitsize */
    964   1.1  christos 	 false,			/* pc_relative */
    965   1.1  christos 	 0,			/* bitpos */
    966   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    967   1.1  christos 				/* This needs complex overflow
    968   1.1  christos 				   detection, because the upper 36
    969   1.1  christos 				   bits must match the PC + 4.  */
    970   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    971  1.10  christos 	 "R_MIPS_26",		/* name */
    972   1.1  christos 	 false,			/* partial_inplace */
    973   1.1  christos 	 0,			/* src_mask */
    974  1.10  christos 	 0x03ffffff,		/* dst_mask */
    975   1.1  christos 	 false),		/* pcrel_offset */
    976   1.1  christos 
    977   1.1  christos   /* High 16 bits of symbol value.  */
    978   1.1  christos   HOWTO (R_MIPS_HI16,		/* type */
    979  1.10  christos 	 0,			/* rightshift */
    980   1.1  christos 	 4,			/* size */
    981  1.10  christos 	 16,			/* bitsize */
    982   1.1  christos 	 false,			/* pc_relative */
    983   1.1  christos 	 0,			/* bitpos */
    984   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    985   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
    986  1.10  christos 	 "R_MIPS_HI16",		/* name */
    987   1.1  christos 	 false,			/* partial_inplace */
    988   1.1  christos 	 0,			/* src_mask */
    989  1.10  christos 	 0x0000ffff,		/* dst_mask */
    990   1.1  christos 	 false),		/* pcrel_offset */
    991   1.1  christos 
    992   1.1  christos   /* Low 16 bits of symbol value.  */
    993   1.1  christos   HOWTO (R_MIPS_LO16,		/* type */
    994  1.10  christos 	 0,			/* rightshift */
    995   1.1  christos 	 4,			/* size */
    996  1.10  christos 	 16,			/* bitsize */
    997   1.1  christos 	 false,			/* pc_relative */
    998   1.1  christos 	 0,			/* bitpos */
    999   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1000   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
   1001  1.10  christos 	 "R_MIPS_LO16",		/* name */
   1002   1.1  christos 	 false,			/* partial_inplace */
   1003   1.1  christos 	 0,			/* src_mask */
   1004  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1005   1.1  christos 	 false),		/* pcrel_offset */
   1006   1.1  christos 
   1007   1.1  christos   /* GP relative reference.  */
   1008   1.1  christos   HOWTO (R_MIPS_GPREL16,	/* type */
   1009  1.10  christos 	 0,			/* rightshift */
   1010   1.1  christos 	 4,			/* size */
   1011  1.10  christos 	 16,			/* bitsize */
   1012   1.1  christos 	 false,			/* pc_relative */
   1013   1.1  christos 	 0,			/* bitpos */
   1014   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1015   1.1  christos 	 mips_elf64_gprel16_reloc, /* special_function */
   1016  1.10  christos 	 "R_MIPS_GPREL16",	/* name */
   1017   1.1  christos 	 false,			/* partial_inplace */
   1018   1.1  christos 	 0,			/* src_mask */
   1019  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1020   1.1  christos 	 false),		/* pcrel_offset */
   1021   1.1  christos 
   1022   1.1  christos   /* Reference to literal section.  */
   1023   1.1  christos   HOWTO (R_MIPS_LITERAL,	/* type */
   1024  1.10  christos 	 0,			/* rightshift */
   1025   1.1  christos 	 4,			/* size */
   1026  1.10  christos 	 16,			/* bitsize */
   1027   1.1  christos 	 false,			/* pc_relative */
   1028   1.1  christos 	 0,			/* bitpos */
   1029   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1030   1.1  christos 	 mips_elf64_literal_reloc, /* special_function */
   1031  1.10  christos 	 "R_MIPS_LITERAL",	/* name */
   1032   1.1  christos 	 false,			/* partial_inplace */
   1033   1.1  christos 	 0,			/* src_mask */
   1034  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1035   1.1  christos 	 false),		/* pcrel_offset */
   1036   1.1  christos 
   1037   1.1  christos   /* Reference to global offset table.  */
   1038   1.1  christos   HOWTO (R_MIPS_GOT16,		/* type */
   1039  1.10  christos 	 0,			/* rightshift */
   1040   1.1  christos 	 4,			/* size */
   1041  1.10  christos 	 16,			/* bitsize */
   1042   1.1  christos 	 false,			/* pc_relative */
   1043   1.1  christos 	 0,			/* bitpos */
   1044   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1045   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1046  1.10  christos 	 "R_MIPS_GOT16",	/* name */
   1047   1.1  christos 	 false,			/* partial_inplace */
   1048   1.1  christos 	 0,			/* src_mask */
   1049  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1050   1.1  christos 	 false),		/* pcrel_offset */
   1051   1.1  christos 
   1052   1.1  christos   /* 16 bit PC relative reference.  Note that the ABI document has a typo
   1053   1.1  christos      and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
   1054   1.1  christos      We do the right thing here.  */
   1055   1.1  christos   HOWTO (R_MIPS_PC16,		/* type */
   1056  1.10  christos 	 2,			/* rightshift */
   1057   1.1  christos 	 4,			/* size */
   1058  1.10  christos 	 16,			/* bitsize */
   1059   1.1  christos 	 true,			/* pc_relative */
   1060   1.1  christos 	 0,			/* bitpos */
   1061   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1062   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
   1063  1.10  christos 	 "R_MIPS_PC16",		/* name */
   1064   1.1  christos 	 false,			/* partial_inplace */
   1065   1.1  christos 	 0,			/* src_mask */
   1066  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1067   1.1  christos 	 true),			/* pcrel_offset */
   1068   1.1  christos 
   1069   1.1  christos   /* 16 bit call through global offset table.  */
   1070   1.1  christos   HOWTO (R_MIPS_CALL16,		/* type */
   1071  1.10  christos 	 0,			/* rightshift */
   1072   1.1  christos 	 4,			/* size */
   1073  1.10  christos 	 16,			/* bitsize */
   1074   1.1  christos 	 false,			/* pc_relative */
   1075   1.1  christos 	 0,			/* bitpos */
   1076   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1077   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
   1078  1.10  christos 	 "R_MIPS_CALL16",	/* name */
   1079   1.1  christos 	 false,			/* partial_inplace */
   1080   1.1  christos 	 0,			/* src_mask */
   1081  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1082   1.1  christos 	 false),		/* pcrel_offset */
   1083   1.1  christos 
   1084   1.1  christos   /* 32 bit GP relative reference.  */
   1085   1.1  christos   HOWTO (R_MIPS_GPREL32,	/* type */
   1086  1.10  christos 	 0,			/* rightshift */
   1087   1.1  christos 	 4,			/* size */
   1088  1.10  christos 	 32,			/* bitsize */
   1089   1.1  christos 	 false,			/* pc_relative */
   1090   1.1  christos 	 0,			/* bitpos */
   1091   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1092   1.1  christos 	 mips_elf64_gprel32_reloc, /* special_function */
   1093  1.10  christos 	 "R_MIPS_GPREL32",	/* name */
   1094   1.1  christos 	 false,			/* partial_inplace */
   1095   1.1  christos 	 0,			/* src_mask */
   1096  1.10  christos 	 0xffffffff,		/* dst_mask */
   1097   1.1  christos 	 false),		/* pcrel_offset */
   1098   1.1  christos 
   1099   1.1  christos   EMPTY_HOWTO (13),
   1100   1.1  christos   EMPTY_HOWTO (14),
   1101   1.1  christos   EMPTY_HOWTO (15),
   1102   1.1  christos 
   1103   1.1  christos   /* A 5 bit shift field.  */
   1104   1.1  christos   HOWTO (R_MIPS_SHIFT5,		/* type */
   1105  1.10  christos 	 0,			/* rightshift */
   1106   1.1  christos 	 4,			/* size */
   1107  1.10  christos 	 5,			/* bitsize */
   1108   1.1  christos 	 false,			/* pc_relative */
   1109   1.1  christos 	 6,			/* bitpos */
   1110   1.1  christos 	 complain_overflow_bitfield, /* complain_on_overflow */
   1111   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
   1112  1.10  christos 	 "R_MIPS_SHIFT5",	/* name */
   1113   1.1  christos 	 false,			/* partial_inplace */
   1114   1.1  christos 	 0,			/* src_mask */
   1115  1.10  christos 	 0x000007c0,		/* dst_mask */
   1116   1.1  christos 	 false),		/* pcrel_offset */
   1117   1.1  christos 
   1118   1.1  christos   /* A 6 bit shift field.  */
   1119   1.1  christos   HOWTO (R_MIPS_SHIFT6,		/* type */
   1120  1.10  christos 	 0,			/* rightshift */
   1121   1.1  christos 	 4,			/* size */
   1122  1.10  christos 	 6,			/* bitsize */
   1123   1.1  christos 	 false,			/* pc_relative */
   1124   1.1  christos 	 6,			/* bitpos */
   1125   1.1  christos 	 complain_overflow_bitfield, /* complain_on_overflow */
   1126   1.1  christos 	 mips_elf64_shift6_reloc, /* special_function */
   1127  1.10  christos 	 "R_MIPS_SHIFT6",	/* name */
   1128   1.1  christos 	 false,			/* partial_inplace */
   1129   1.1  christos 	 0,			/* src_mask */
   1130  1.10  christos 	 0x000007c4,		/* dst_mask */
   1131   1.1  christos 	 false),		/* pcrel_offset */
   1132   1.1  christos 
   1133   1.1  christos   /* 64 bit relocation.  */
   1134   1.1  christos   HOWTO (R_MIPS_64,		/* type */
   1135  1.10  christos 	 0,			/* rightshift */
   1136   1.1  christos 	 8,			/* size */
   1137  1.10  christos 	 64,			/* bitsize */
   1138   1.1  christos 	 false,			/* pc_relative */
   1139   1.1  christos 	 0,			/* bitpos */
   1140   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1141   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
   1142  1.10  christos 	 "R_MIPS_64",		/* name */
   1143   1.1  christos 	 false,			/* partial_inplace */
   1144   1.1  christos 	 0,			/* src_mask */
   1145  1.10  christos 	 MINUS_ONE,		/* dst_mask */
   1146   1.1  christos 	 false),		/* pcrel_offset */
   1147   1.1  christos 
   1148   1.1  christos   /* Displacement in the global offset table.  */
   1149   1.1  christos   HOWTO (R_MIPS_GOT_DISP,	/* type */
   1150  1.10  christos 	 0,			/* rightshift */
   1151   1.1  christos 	 4,			/* size */
   1152  1.10  christos 	 16,			/* bitsize */
   1153   1.1  christos 	 false,			/* pc_relative */
   1154   1.1  christos 	 0,			/* bitpos */
   1155   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1156   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
   1157  1.10  christos 	 "R_MIPS_GOT_DISP",	/* name */
   1158   1.1  christos 	 false,			/* partial_inplace */
   1159   1.1  christos 	 0,			/* src_mask */
   1160  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1161   1.1  christos 	 false),		/* pcrel_offset */
   1162   1.1  christos 
   1163   1.1  christos   /* Displacement to page pointer in the global offset table.  */
   1164   1.1  christos   HOWTO (R_MIPS_GOT_PAGE,	/* type */
   1165  1.10  christos 	 0,			/* rightshift */
   1166   1.1  christos 	 4,			/* size */
   1167  1.10  christos 	 16,			/* bitsize */
   1168   1.1  christos 	 false,			/* pc_relative */
   1169   1.1  christos 	 0,			/* bitpos */
   1170   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1171   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
   1172  1.10  christos 	 "R_MIPS_GOT_PAGE",	/* name */
   1173   1.1  christos 	 false,			/* partial_inplace */
   1174   1.1  christos 	 0,			/* src_mask */
   1175  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1176   1.1  christos 	 false),		/* pcrel_offset */
   1177   1.1  christos 
   1178   1.1  christos   /* Offset from page pointer in the global offset table.  */
   1179   1.1  christos   HOWTO (R_MIPS_GOT_OFST,	/* type */
   1180  1.10  christos 	 0,			/* rightshift */
   1181   1.1  christos 	 4,			/* size */
   1182  1.10  christos 	 16,			/* bitsize */
   1183   1.1  christos 	 false,			/* pc_relative */
   1184   1.1  christos 	 0,			/* bitpos */
   1185   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1186   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
   1187  1.10  christos 	 "R_MIPS_GOT_OFST",	/* name */
   1188   1.1  christos 	 false,			/* partial_inplace */
   1189   1.1  christos 	 0,			/* src_mask */
   1190  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1191   1.1  christos 	 false),		/* pcrel_offset */
   1192   1.1  christos 
   1193   1.1  christos   /* High 16 bits of displacement in global offset table.  */
   1194   1.1  christos   HOWTO (R_MIPS_GOT_HI16,	/* type */
   1195  1.10  christos 	 0,			/* rightshift */
   1196   1.1  christos 	 4,			/* size */
   1197  1.10  christos 	 16,			/* bitsize */
   1198   1.1  christos 	 false,			/* pc_relative */
   1199   1.1  christos 	 0,			/* bitpos */
   1200   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1201   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
   1202  1.10  christos 	 "R_MIPS_GOT_HI16",	/* name */
   1203   1.1  christos 	 false,			/* partial_inplace */
   1204   1.1  christos 	 0,			/* src_mask */
   1205  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1206   1.1  christos 	 false),		/* pcrel_offset */
   1207   1.1  christos 
   1208   1.1  christos   /* Low 16 bits of displacement in global offset table.  */
   1209   1.1  christos   HOWTO (R_MIPS_GOT_LO16,	/* type */
   1210  1.10  christos 	 0,			/* rightshift */
   1211   1.1  christos 	 4,			/* size */
   1212  1.10  christos 	 16,			/* bitsize */
   1213   1.1  christos 	 false,			/* pc_relative */
   1214   1.1  christos 	 0,			/* bitpos */
   1215   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1216   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
   1217  1.10  christos 	 "R_MIPS_GOT_LO16",	/* name */
   1218   1.1  christos 	 false,			/* partial_inplace */
   1219   1.1  christos 	 0,			/* src_mask */
   1220  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1221   1.1  christos 	 false),		/* pcrel_offset */
   1222   1.1  christos 
   1223   1.1  christos   /* 64 bit subtraction.  */
   1224   1.1  christos   HOWTO (R_MIPS_SUB,		/* type */
   1225  1.10  christos 	 0,			/* rightshift */
   1226   1.1  christos 	 8,			/* size */
   1227  1.10  christos 	 64,			/* bitsize */
   1228   1.1  christos 	 false,			/* pc_relative */
   1229   1.1  christos 	 0,			/* bitpos */
   1230   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1231   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
   1232  1.10  christos 	 "R_MIPS_SUB",		/* name */
   1233   1.1  christos 	 false,			/* partial_inplace */
   1234   1.1  christos 	 0,			/* src_mask */
   1235  1.10  christos 	 MINUS_ONE,		/* dst_mask */
   1236   1.1  christos 	 false),		/* pcrel_offset */
   1237   1.1  christos 
   1238   1.1  christos   /* Insert the addend as an instruction.  */
   1239   1.1  christos   /* FIXME: Not handled correctly.  */
   1240   1.1  christos   HOWTO (R_MIPS_INSERT_A,	/* type */
   1241  1.10  christos 	 0,			/* rightshift */
   1242   1.1  christos 	 4,			/* size */
   1243  1.10  christos 	 32,			/* bitsize */
   1244   1.1  christos 	 false,			/* pc_relative */
   1245   1.1  christos 	 0,			/* bitpos */
   1246   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1247   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
   1248  1.10  christos 	 "R_MIPS_INSERT_A",	/* name */
   1249   1.1  christos 	 false,			/* partial_inplace */
   1250   1.1  christos 	 0,			/* src_mask */
   1251  1.10  christos 	 0xffffffff,		/* dst_mask */
   1252   1.1  christos 	 false),		/* pcrel_offset */
   1253   1.1  christos 
   1254   1.1  christos   /* Insert the addend as an instruction, and change all relocations
   1255   1.1  christos      to refer to the old instruction at the address.  */
   1256   1.1  christos   /* FIXME: Not handled correctly.  */
   1257   1.1  christos   HOWTO (R_MIPS_INSERT_B,	/* type */
   1258  1.10  christos 	 0,			/* rightshift */
   1259   1.1  christos 	 4,			/* size */
   1260  1.10  christos 	 32,			/* bitsize */
   1261   1.1  christos 	 false,			/* pc_relative */
   1262   1.1  christos 	 0,			/* bitpos */
   1263   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1264   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
   1265  1.10  christos 	 "R_MIPS_INSERT_B",	/* name */
   1266   1.1  christos 	 false,			/* partial_inplace */
   1267   1.1  christos 	 0,			/* src_mask */
   1268  1.10  christos 	 0xffffffff,		/* dst_mask */
   1269   1.1  christos 	 false),		/* pcrel_offset */
   1270   1.1  christos 
   1271   1.1  christos   /* Delete a 32 bit instruction.  */
   1272   1.1  christos   /* FIXME: Not handled correctly.  */
   1273   1.1  christos   HOWTO (R_MIPS_DELETE,		/* type */
   1274  1.10  christos 	 0,			/* rightshift */
   1275   1.1  christos 	 4,			/* size */
   1276  1.10  christos 	 32,			/* bitsize */
   1277   1.1  christos 	 false,			/* pc_relative */
   1278   1.1  christos 	 0,			/* bitpos */
   1279   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1280   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
   1281  1.10  christos 	 "R_MIPS_DELETE",	/* name */
   1282   1.1  christos 	 false,			/* partial_inplace */
   1283   1.1  christos 	 0,			/* src_mask */
   1284  1.10  christos 	 0xffffffff,		/* dst_mask */
   1285   1.1  christos 	 false),		/* pcrel_offset */
   1286   1.1  christos 
   1287   1.1  christos   /* Get the higher value of a 64 bit addend.  */
   1288   1.1  christos   HOWTO (R_MIPS_HIGHER,		/* type */
   1289  1.10  christos 	 0,			/* rightshift */
   1290   1.1  christos 	 4,			/* size */
   1291  1.10  christos 	 16,			/* bitsize */
   1292   1.1  christos 	 false,			/* pc_relative */
   1293   1.1  christos 	 0,			/* bitpos */
   1294   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1295   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1296  1.10  christos 	 "R_MIPS_HIGHER",	/* name */
   1297   1.1  christos 	 false,			/* partial_inplace */
   1298   1.1  christos 	 0,			/* src_mask */
   1299  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1300   1.1  christos 	 false),		/* pcrel_offset */
   1301   1.1  christos 
   1302   1.1  christos   /* Get the highest value of a 64 bit addend.  */
   1303   1.1  christos   HOWTO (R_MIPS_HIGHEST,	/* type */
   1304  1.10  christos 	 0,			/* rightshift */
   1305   1.1  christos 	 4,			/* size */
   1306  1.10  christos 	 16,			/* bitsize */
   1307   1.1  christos 	 false,			/* pc_relative */
   1308   1.1  christos 	 0,			/* bitpos */
   1309   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1310   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1311  1.10  christos 	 "R_MIPS_HIGHEST",	/* name */
   1312   1.1  christos 	 false,			/* partial_inplace */
   1313   1.1  christos 	 0,			/* src_mask */
   1314  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1315   1.1  christos 	 false),		/* pcrel_offset */
   1316   1.1  christos 
   1317   1.1  christos   /* High 16 bits of displacement in global offset table.  */
   1318   1.1  christos   HOWTO (R_MIPS_CALL_HI16,	/* type */
   1319  1.10  christos 	 0,			/* rightshift */
   1320   1.1  christos 	 4,			/* size */
   1321  1.10  christos 	 16,			/* bitsize */
   1322   1.1  christos 	 false,			/* pc_relative */
   1323   1.1  christos 	 0,			/* bitpos */
   1324   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1325   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
   1326  1.10  christos 	 "R_MIPS_CALL_HI16",	/* name */
   1327   1.1  christos 	 false,			/* partial_inplace */
   1328   1.1  christos 	 0,			/* src_mask */
   1329  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1330   1.1  christos 	 false),		/* pcrel_offset */
   1331   1.1  christos 
   1332   1.1  christos   /* Low 16 bits of displacement in global offset table.  */
   1333   1.1  christos   HOWTO (R_MIPS_CALL_LO16,	/* type */
   1334  1.10  christos 	 0,			/* rightshift */
   1335   1.1  christos 	 4,			/* size */
   1336  1.10  christos 	 16,			/* bitsize */
   1337   1.1  christos 	 false,			/* pc_relative */
   1338   1.1  christos 	 0,			/* bitpos */
   1339   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1340   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
   1341  1.10  christos 	 "R_MIPS_CALL_LO16",	/* name */
   1342   1.1  christos 	 false,			/* partial_inplace */
   1343   1.1  christos 	 0,			/* src_mask */
   1344  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1345   1.1  christos 	 false),		/* pcrel_offset */
   1346   1.1  christos 
   1347   1.1  christos   /* Section displacement, used by an associated event location section.  */
   1348   1.1  christos   HOWTO (R_MIPS_SCN_DISP,	/* type */
   1349  1.10  christos 	 0,			/* rightshift */
   1350   1.1  christos 	 4,			/* size */
   1351  1.10  christos 	 32,			/* bitsize */
   1352   1.1  christos 	 false,			/* pc_relative */
   1353   1.1  christos 	 0,			/* bitpos */
   1354   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1355   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
   1356  1.10  christos 	 "R_MIPS_SCN_DISP",	/* name */
   1357   1.1  christos 	 false,			/* partial_inplace */
   1358   1.1  christos 	 0,			/* src_mask */
   1359  1.10  christos 	 0xffffffff,		/* dst_mask */
   1360   1.1  christos 	 false),		/* pcrel_offset */
   1361   1.1  christos 
   1362   1.1  christos   HOWTO (R_MIPS_REL16,		/* type */
   1363  1.10  christos 	 0,			/* rightshift */
   1364   1.1  christos 	 2,			/* size */
   1365  1.10  christos 	 16,			/* bitsize */
   1366   1.1  christos 	 false,			/* pc_relative */
   1367   1.1  christos 	 0,			/* bitpos */
   1368   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1369   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
   1370  1.10  christos 	 "R_MIPS_REL16",	/* name */
   1371   1.1  christos 	 false,			/* partial_inplace */
   1372   1.1  christos 	 0,			/* src_mask */
   1373  1.10  christos 	 0xffff,		/* dst_mask */
   1374   1.1  christos 	 false),		/* pcrel_offset */
   1375   1.1  christos 
   1376   1.1  christos   /* These two are obsolete.  */
   1377   1.1  christos   EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
   1378   1.1  christos   EMPTY_HOWTO (R_MIPS_PJUMP),
   1379   1.1  christos 
   1380   1.1  christos   /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
   1381   1.1  christos      It must be used for multigot GOT's (and only there).  */
   1382   1.1  christos   HOWTO (R_MIPS_RELGOT,		/* type */
   1383  1.10  christos 	 0,			/* rightshift */
   1384   1.1  christos 	 4,			/* size */
   1385  1.10  christos 	 32,			/* bitsize */
   1386   1.1  christos 	 false,			/* pc_relative */
   1387   1.1  christos 	 0,			/* bitpos */
   1388   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1389   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
   1390  1.10  christos 	 "R_MIPS_RELGOT",	/* name */
   1391   1.1  christos 	 false,			/* partial_inplace */
   1392   1.1  christos 	 0,			/* src_mask */
   1393  1.10  christos 	 0xffffffff,		/* dst_mask */
   1394   1.1  christos 	 false),		/* pcrel_offset */
   1395   1.1  christos 
   1396   1.1  christos   /* Protected jump conversion.  This is an optimization hint.  No
   1397   1.1  christos      relocation is required for correctness.  */
   1398   1.1  christos   HOWTO (R_MIPS_JALR,		/* type */
   1399  1.10  christos 	 0,			/* rightshift */
   1400   1.1  christos 	 4,			/* size */
   1401  1.10  christos 	 32,			/* bitsize */
   1402   1.1  christos 	 false,			/* pc_relative */
   1403   1.1  christos 	 0,			/* bitpos */
   1404   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1405   1.1  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
   1406  1.10  christos 	 "R_MIPS_JALR",		/* name */
   1407   1.1  christos 	 false,			/* partial_inplace */
   1408   1.1  christos 	 0,			/* src_mask */
   1409  1.10  christos 	 0x00000000,		/* dst_mask */
   1410   1.1  christos 	 false),		/* pcrel_offset */
   1411   1.1  christos 
   1412   1.1  christos   /* TLS relocations.  */
   1413   1.1  christos   EMPTY_HOWTO (R_MIPS_TLS_DTPMOD32),
   1414   1.1  christos   EMPTY_HOWTO (R_MIPS_TLS_DTPREL32),
   1415   1.1  christos 
   1416   1.1  christos   HOWTO (R_MIPS_TLS_DTPMOD64,	/* type */
   1417  1.10  christos 	 0,			/* rightshift */
   1418   1.1  christos 	 8,			/* size */
   1419  1.10  christos 	 64,			/* bitsize */
   1420   1.1  christos 	 false,			/* pc_relative */
   1421   1.1  christos 	 0,			/* bitpos */
   1422   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1423   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1424  1.10  christos 	 "R_MIPS_TLS_DTPMOD64", /* name */
   1425   1.1  christos 	 false,			/* partial_inplace */
   1426   1.1  christos 	 0,			/* src_mask */
   1427  1.10  christos 	 MINUS_ONE,		/* dst_mask */
   1428   1.1  christos 	 false),		/* pcrel_offset */
   1429   1.1  christos 
   1430   1.1  christos   HOWTO (R_MIPS_TLS_DTPREL64,	/* type */
   1431  1.10  christos 	 0,			/* rightshift */
   1432   1.1  christos 	 8,			/* size */
   1433  1.10  christos 	 64,			/* bitsize */
   1434   1.1  christos 	 false,			/* pc_relative */
   1435   1.1  christos 	 0,			/* bitpos */
   1436   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1437   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1438  1.10  christos 	 "R_MIPS_TLS_DTPREL64",	/* name */
   1439   1.1  christos 	 false,			/* partial_inplace */
   1440   1.1  christos 	 0,			/* src_mask */
   1441  1.10  christos 	 MINUS_ONE,		/* dst_mask */
   1442   1.1  christos 	 false),		/* pcrel_offset */
   1443   1.1  christos 
   1444   1.1  christos   /* TLS general dynamic variable reference.  */
   1445   1.1  christos   HOWTO (R_MIPS_TLS_GD,		/* type */
   1446  1.10  christos 	 0,			/* rightshift */
   1447   1.1  christos 	 4,			/* size */
   1448  1.10  christos 	 16,			/* bitsize */
   1449   1.1  christos 	 false,			/* pc_relative */
   1450   1.1  christos 	 0,			/* bitpos */
   1451   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1452   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1453  1.10  christos 	 "R_MIPS_TLS_GD",	/* name */
   1454   1.1  christos 	 false,			/* partial_inplace */
   1455   1.1  christos 	 0,			/* src_mask */
   1456  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1457   1.1  christos 	 false),		/* pcrel_offset */
   1458   1.1  christos 
   1459   1.1  christos   /* TLS local dynamic variable reference.  */
   1460   1.1  christos   HOWTO (R_MIPS_TLS_LDM,	/* type */
   1461  1.10  christos 	 0,			/* rightshift */
   1462   1.1  christos 	 4,			/* size */
   1463  1.10  christos 	 16,			/* bitsize */
   1464   1.1  christos 	 false,			/* pc_relative */
   1465   1.1  christos 	 0,			/* bitpos */
   1466   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1467   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1468  1.10  christos 	 "R_MIPS_TLS_LDM",	/* name */
   1469   1.1  christos 	 false,			/* partial_inplace */
   1470   1.1  christos 	 0,			/* src_mask */
   1471  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1472   1.1  christos 	 false),		/* pcrel_offset */
   1473   1.1  christos 
   1474   1.1  christos   /* TLS local dynamic offset.  */
   1475   1.1  christos   HOWTO (R_MIPS_TLS_DTPREL_HI16,	/* type */
   1476  1.10  christos 	 0,			/* rightshift */
   1477   1.1  christos 	 4,			/* size */
   1478  1.10  christos 	 16,			/* bitsize */
   1479   1.1  christos 	 false,			/* pc_relative */
   1480   1.1  christos 	 0,			/* bitpos */
   1481   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1482   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1483  1.10  christos 	 "R_MIPS_TLS_DTPREL_HI16",	/* name */
   1484   1.1  christos 	 false,			/* partial_inplace */
   1485   1.1  christos 	 0,			/* src_mask */
   1486  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1487   1.1  christos 	 false),		/* pcrel_offset */
   1488   1.1  christos 
   1489   1.1  christos   /* TLS local dynamic offset.  */
   1490   1.1  christos   HOWTO (R_MIPS_TLS_DTPREL_LO16,	/* type */
   1491  1.10  christos 	 0,			/* rightshift */
   1492   1.1  christos 	 4,			/* size */
   1493  1.10  christos 	 16,			/* bitsize */
   1494   1.1  christos 	 false,			/* pc_relative */
   1495   1.1  christos 	 0,			/* bitpos */
   1496   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1497   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1498  1.10  christos 	 "R_MIPS_TLS_DTPREL_LO16",	/* name */
   1499   1.1  christos 	 false,			/* partial_inplace */
   1500   1.1  christos 	 0,			/* src_mask */
   1501  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1502   1.1  christos 	 false),		/* pcrel_offset */
   1503   1.1  christos 
   1504   1.1  christos   /* TLS thread pointer offset.  */
   1505   1.1  christos   HOWTO (R_MIPS_TLS_GOTTPREL,	/* type */
   1506  1.10  christos 	 0,			/* rightshift */
   1507   1.1  christos 	 4,			/* size */
   1508  1.10  christos 	 16,			/* bitsize */
   1509   1.1  christos 	 false,			/* pc_relative */
   1510   1.1  christos 	 0,			/* bitpos */
   1511   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1512   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1513  1.10  christos 	 "R_MIPS_TLS_GOTTPREL",	/* name */
   1514   1.1  christos 	 false,			/* partial_inplace */
   1515   1.1  christos 	 0,			/* src_mask */
   1516  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1517   1.1  christos 	 false),		/* pcrel_offset */
   1518   1.1  christos 
   1519   1.1  christos   /* TLS IE dynamic relocations.  */
   1520   1.1  christos   EMPTY_HOWTO (R_MIPS_TLS_TPREL32),
   1521   1.1  christos 
   1522   1.1  christos   HOWTO (R_MIPS_TLS_TPREL64,	/* type */
   1523  1.10  christos 	 0,			/* rightshift */
   1524   1.1  christos 	 8,			/* size */
   1525  1.10  christos 	 64,			/* bitsize */
   1526   1.1  christos 	 false,			/* pc_relative */
   1527   1.1  christos 	 0,			/* bitpos */
   1528   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1529   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1530  1.10  christos 	 "R_MIPS_TLS_TPREL64",	/* name */
   1531   1.1  christos 	 false,			/* partial_inplace */
   1532   1.1  christos 	 0,			/* src_mask */
   1533  1.10  christos 	 MINUS_ONE,		/* dst_mask */
   1534   1.1  christos 	 false),		/* pcrel_offset */
   1535   1.1  christos 
   1536   1.1  christos   /* TLS thread pointer offset.  */
   1537   1.1  christos   HOWTO (R_MIPS_TLS_TPREL_HI16,	/* type */
   1538  1.10  christos 	 0,			/* rightshift */
   1539   1.1  christos 	 4,			/* size */
   1540  1.10  christos 	 16,			/* bitsize */
   1541   1.1  christos 	 false,			/* pc_relative */
   1542   1.1  christos 	 0,			/* bitpos */
   1543   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1544   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1545  1.10  christos 	 "R_MIPS_TLS_TPREL_HI16", /* name */
   1546   1.1  christos 	 false,			/* partial_inplace */
   1547   1.1  christos 	 0,			/* src_mask */
   1548  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1549   1.1  christos 	 false),		/* pcrel_offset */
   1550   1.1  christos 
   1551   1.1  christos   /* TLS thread pointer offset.  */
   1552   1.1  christos   HOWTO (R_MIPS_TLS_TPREL_LO16,	/* type */
   1553  1.10  christos 	 0,			/* rightshift */
   1554   1.1  christos 	 4,			/* size */
   1555  1.10  christos 	 16,			/* bitsize */
   1556   1.1  christos 	 false,			/* pc_relative */
   1557   1.1  christos 	 0,			/* bitpos */
   1558   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1559   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1560  1.10  christos 	 "R_MIPS_TLS_TPREL_LO16", /* name */
   1561   1.1  christos 	 false,			/* partial_inplace */
   1562   1.1  christos 	 0,			/* src_mask */
   1563  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1564   1.1  christos 	 false),		/* pcrel_offset */
   1565   1.1  christos 
   1566   1.1  christos   /* 32 bit relocation with no addend.  */
   1567   1.1  christos   HOWTO (R_MIPS_GLOB_DAT,	/* type */
   1568  1.10  christos 	 0,			/* rightshift */
   1569   1.1  christos 	 4,			/* size */
   1570  1.10  christos 	 32,			/* bitsize */
   1571   1.1  christos 	 false,			/* pc_relative */
   1572   1.1  christos 	 0,			/* bitpos */
   1573   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1574   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1575  1.10  christos 	 "R_MIPS_GLOB_DAT",	/* name */
   1576   1.1  christos 	 false,			/* partial_inplace */
   1577   1.1  christos 	 0x0,			/* src_mask */
   1578  1.10  christos 	 0xffffffff,		/* dst_mask */
   1579   1.3  christos 	 false),		/* pcrel_offset */
   1580   1.3  christos 
   1581   1.3  christos   EMPTY_HOWTO (52),
   1582   1.3  christos   EMPTY_HOWTO (53),
   1583   1.3  christos   EMPTY_HOWTO (54),
   1584   1.3  christos   EMPTY_HOWTO (55),
   1585   1.3  christos   EMPTY_HOWTO (56),
   1586   1.3  christos   EMPTY_HOWTO (57),
   1587   1.3  christos   EMPTY_HOWTO (58),
   1588   1.3  christos   EMPTY_HOWTO (59),
   1589   1.3  christos 
   1590   1.3  christos   HOWTO (R_MIPS_PC21_S2,	/* type */
   1591  1.10  christos 	 2,			/* rightshift */
   1592   1.3  christos 	 4,			/* size */
   1593  1.10  christos 	 21,			/* bitsize */
   1594   1.3  christos 	 true,			/* pc_relative */
   1595   1.3  christos 	 0,			/* bitpos */
   1596   1.3  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1597   1.3  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1598  1.10  christos 	 "R_MIPS_PC21_S2",	/* name */
   1599   1.3  christos 	 false,			/* partial_inplace */
   1600   1.3  christos 	 0,			/* src_mask */
   1601  1.10  christos 	 0x001fffff,		/* dst_mask */
   1602   1.3  christos 	 true),			/* pcrel_offset */
   1603   1.3  christos 
   1604   1.3  christos   HOWTO (R_MIPS_PC26_S2,	/* type */
   1605  1.10  christos 	 2,			/* rightshift */
   1606   1.3  christos 	 4,			/* size */
   1607  1.10  christos 	 26,			/* bitsize */
   1608   1.3  christos 	 true,			/* pc_relative */
   1609   1.3  christos 	 0,			/* bitpos */
   1610   1.3  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1611   1.3  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1612  1.10  christos 	 "R_MIPS_PC26_S2",	/* name */
   1613   1.3  christos 	 false,			/* partial_inplace */
   1614   1.3  christos 	 0,			/* src_mask */
   1615  1.10  christos 	 0x03ffffff,		/* dst_mask */
   1616   1.3  christos 	 true),			/* pcrel_offset */
   1617   1.3  christos 
   1618   1.3  christos   HOWTO (R_MIPS_PC18_S3,	/* type */
   1619  1.10  christos 	 3,			/* rightshift */
   1620   1.3  christos 	 4,			/* size */
   1621  1.10  christos 	 18,			/* bitsize */
   1622   1.3  christos 	 true,			/* pc_relative */
   1623   1.3  christos 	 0,			/* bitpos */
   1624   1.3  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1625   1.3  christos 	 _bfd_mips_elf_generic_reloc,   /* special_function */
   1626  1.10  christos 	 "R_MIPS_PC18_S3",	/* name */
   1627   1.3  christos 	 false,			/* partial_inplace */
   1628   1.3  christos 	 0,			/* src_mask */
   1629  1.10  christos 	 0x0003ffff,		/* dst_mask */
   1630   1.3  christos 	 true),			/* pcrel_offset */
   1631   1.3  christos 
   1632   1.3  christos   HOWTO (R_MIPS_PC19_S2,	/* type */
   1633  1.10  christos 	 2,			/* rightshift */
   1634   1.3  christos 	 4,			/* size */
   1635  1.10  christos 	 19,			/* bitsize */
   1636   1.3  christos 	 true,			/* pc_relative */
   1637   1.3  christos 	 0,			/* bitpos */
   1638   1.3  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1639   1.3  christos 	 _bfd_mips_elf_generic_reloc,   /* special_function */
   1640  1.10  christos 	 "R_MIPS_PC19_S2",	/* name */
   1641   1.3  christos 	 false,			/* partial_inplace */
   1642   1.3  christos 	 0,			/* src_mask */
   1643  1.10  christos 	 0x0007ffff,		/* dst_mask */
   1644   1.3  christos 	 true),			/* pcrel_offset */
   1645   1.3  christos 
   1646   1.3  christos   HOWTO (R_MIPS_PCHI16,		/* type */
   1647  1.10  christos 	 16,			/* rightshift */
   1648   1.3  christos 	 4,			/* size */
   1649  1.10  christos 	 16,			/* bitsize */
   1650   1.3  christos 	 true,			/* pc_relative */
   1651   1.3  christos 	 0,			/* bitpos */
   1652   1.3  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1653   1.3  christos 	 _bfd_mips_elf_generic_reloc,   /* special_function */
   1654  1.10  christos 	 "R_MIPS_PCHI16",	/* name */
   1655   1.3  christos 	 false,			/* partial_inplace */
   1656   1.3  christos 	 0,			/* src_mask */
   1657  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1658   1.3  christos 	 true),			/* pcrel_offset */
   1659   1.3  christos 
   1660   1.3  christos   HOWTO (R_MIPS_PCLO16,		/* type */
   1661  1.10  christos 	 0,			/* rightshift */
   1662   1.3  christos 	 4,			/* size */
   1663  1.10  christos 	 16,			/* bitsize */
   1664   1.3  christos 	 true,			/* pc_relative */
   1665   1.3  christos 	 0,			/* bitpos */
   1666   1.3  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1667   1.3  christos 	 _bfd_mips_elf_generic_reloc,   /* special_function */
   1668  1.10  christos 	 "R_MIPS_PCLO16",	/* name */
   1669   1.3  christos 	 false,			/* partial_inplace */
   1670   1.3  christos 	 0,			/* src_mask */
   1671  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1672   1.3  christos 	 true),			/* pcrel_offset */
   1673   1.1  christos 
   1674   1.1  christos };
   1675   1.1  christos 
   1676   1.1  christos static reloc_howto_type mips16_elf64_howto_table_rel[] =
   1677   1.1  christos {
   1678   1.1  christos   /* The reloc used for the mips16 jump instruction.  */
   1679   1.1  christos   HOWTO (R_MIPS16_26,		/* type */
   1680  1.10  christos 	 2,			/* rightshift */
   1681   1.1  christos 	 4,			/* size */
   1682  1.10  christos 	 26,			/* bitsize */
   1683   1.1  christos 	 false,			/* pc_relative */
   1684   1.1  christos 	 0,			/* bitpos */
   1685   1.8  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1686   1.1  christos 				/* This needs complex overflow
   1687   1.1  christos 				   detection, because the upper four
   1688   1.1  christos 				   bits must match the PC.  */
   1689   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1690  1.10  christos 	 "R_MIPS16_26",		/* name */
   1691   1.1  christos 	 true,			/* partial_inplace */
   1692   1.1  christos 	 0x3ffffff,		/* src_mask */
   1693  1.10  christos 	 0x3ffffff,		/* dst_mask */
   1694   1.1  christos 	 false),		/* pcrel_offset */
   1695   1.1  christos 
   1696   1.1  christos   /* The reloc used for the mips16 gprel instruction.  */
   1697   1.1  christos   HOWTO (R_MIPS16_GPREL,	/* type */
   1698  1.10  christos 	 0,			/* rightshift */
   1699   1.1  christos 	 4,			/* size */
   1700  1.10  christos 	 16,			/* bitsize */
   1701   1.1  christos 	 false,			/* pc_relative */
   1702   1.1  christos 	 0,			/* bitpos */
   1703   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1704   1.1  christos 	 mips16_gprel_reloc,	/* special_function */
   1705  1.10  christos 	 "R_MIPS16_GPREL",	/* name */
   1706   1.1  christos 	 true,			/* partial_inplace */
   1707   1.8  christos 	 0x0000ffff,		/* src_mask */
   1708  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1709   1.1  christos 	 false),		/* pcrel_offset */
   1710   1.1  christos 
   1711   1.1  christos   /* A MIPS16 reference to the global offset table.  */
   1712   1.1  christos   HOWTO (R_MIPS16_GOT16,	/* type */
   1713  1.10  christos 	 0,			/* rightshift */
   1714   1.1  christos 	 4,			/* size */
   1715  1.10  christos 	 16,			/* bitsize */
   1716   1.1  christos 	 false,			/* pc_relative */
   1717   1.1  christos 	 0,			/* bitpos */
   1718   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1719   1.1  christos 	 _bfd_mips_elf_got16_reloc, /* special_function */
   1720  1.10  christos 	 "R_MIPS16_GOT16",	/* name */
   1721   1.1  christos 	 true,			/* partial_inplace */
   1722   1.8  christos 	 0x0000ffff,		/* src_mask */
   1723  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1724   1.1  christos 	 false),		/* pcrel_offset */
   1725   1.1  christos 
   1726   1.1  christos   /* A MIPS16 call through the global offset table.  */
   1727   1.1  christos   HOWTO (R_MIPS16_CALL16,	/* type */
   1728  1.10  christos 	 0,			/* rightshift */
   1729   1.1  christos 	 4,			/* size */
   1730  1.10  christos 	 16,			/* bitsize */
   1731   1.1  christos 	 false,			/* pc_relative */
   1732   1.1  christos 	 0,			/* bitpos */
   1733   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1734   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1735  1.10  christos 	 "R_MIPS16_CALL16",	/* name */
   1736   1.1  christos 	 true,			/* partial_inplace */
   1737   1.8  christos 	 0x0000ffff,		/* src_mask */
   1738  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1739   1.1  christos 	 false),		/* pcrel_offset */
   1740   1.1  christos 
   1741   1.1  christos   /* MIPS16 high 16 bits of symbol value.  */
   1742   1.1  christos   HOWTO (R_MIPS16_HI16,		/* type */
   1743  1.10  christos 	 16,			/* rightshift */
   1744   1.1  christos 	 4,			/* size */
   1745  1.10  christos 	 16,			/* bitsize */
   1746   1.1  christos 	 false,			/* pc_relative */
   1747   1.1  christos 	 0,			/* bitpos */
   1748   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1749   1.1  christos 	 _bfd_mips_elf_hi16_reloc, /* special_function */
   1750  1.10  christos 	 "R_MIPS16_HI16",	/* name */
   1751   1.1  christos 	 true,			/* partial_inplace */
   1752   1.1  christos 	 0x0000ffff,		/* src_mask */
   1753  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1754   1.1  christos 	 false),		/* pcrel_offset */
   1755   1.1  christos 
   1756   1.1  christos   /* MIPS16 low 16 bits of symbol value.  */
   1757   1.1  christos   HOWTO (R_MIPS16_LO16,		/* type */
   1758  1.10  christos 	 0,			/* rightshift */
   1759   1.1  christos 	 4,			/* size */
   1760  1.10  christos 	 16,			/* bitsize */
   1761   1.1  christos 	 false,			/* pc_relative */
   1762   1.1  christos 	 0,			/* bitpos */
   1763   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1764   1.1  christos 	 _bfd_mips_elf_lo16_reloc, /* special_function */
   1765  1.10  christos 	 "R_MIPS16_LO16",	/* name */
   1766   1.1  christos 	 true,			/* partial_inplace */
   1767   1.1  christos 	 0x0000ffff,		/* src_mask */
   1768  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1769   1.1  christos 	 false),		/* pcrel_offset */
   1770   1.1  christos 
   1771   1.1  christos   /* MIPS16 TLS general dynamic variable reference.  */
   1772   1.1  christos   HOWTO (R_MIPS16_TLS_GD,	/* type */
   1773  1.10  christos 	 0,			/* rightshift */
   1774   1.1  christos 	 4,			/* size */
   1775  1.10  christos 	 16,			/* bitsize */
   1776   1.1  christos 	 false,			/* pc_relative */
   1777   1.1  christos 	 0,			/* bitpos */
   1778   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1779   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1780  1.10  christos 	 "R_MIPS16_TLS_GD",	/* name */
   1781   1.1  christos 	 true,			/* partial_inplace */
   1782   1.1  christos 	 0x0000ffff,		/* src_mask */
   1783  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1784   1.1  christos 	 false),		/* pcrel_offset */
   1785   1.1  christos 
   1786   1.1  christos   /* MIPS16 TLS local dynamic variable reference.  */
   1787   1.1  christos   HOWTO (R_MIPS16_TLS_LDM,	/* type */
   1788  1.10  christos 	 0,			/* rightshift */
   1789   1.1  christos 	 4,			/* size */
   1790  1.10  christos 	 16,			/* bitsize */
   1791   1.1  christos 	 false,			/* pc_relative */
   1792   1.1  christos 	 0,			/* bitpos */
   1793   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1794   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1795  1.10  christos 	 "R_MIPS16_TLS_LDM",	/* name */
   1796   1.1  christos 	 true,			/* partial_inplace */
   1797   1.1  christos 	 0x0000ffff,		/* src_mask */
   1798  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1799   1.1  christos 	 false),		/* pcrel_offset */
   1800   1.1  christos 
   1801   1.1  christos   /* MIPS16 TLS local dynamic offset.  */
   1802   1.1  christos   HOWTO (R_MIPS16_TLS_DTPREL_HI16,	/* type */
   1803  1.10  christos 	 0,			/* rightshift */
   1804   1.1  christos 	 4,			/* size */
   1805  1.10  christos 	 16,			/* bitsize */
   1806   1.1  christos 	 false,			/* pc_relative */
   1807   1.1  christos 	 0,			/* bitpos */
   1808   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1809   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1810  1.10  christos 	 "R_MIPS16_TLS_DTPREL_HI16",	/* name */
   1811   1.1  christos 	 true,			/* partial_inplace */
   1812   1.1  christos 	 0x0000ffff,		/* src_mask */
   1813  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1814   1.1  christos 	 false),		/* pcrel_offset */
   1815   1.1  christos 
   1816   1.1  christos   /* MIPS16 TLS local dynamic offset.  */
   1817   1.1  christos   HOWTO (R_MIPS16_TLS_DTPREL_LO16,	/* type */
   1818  1.10  christos 	 0,			/* rightshift */
   1819   1.1  christos 	 4,			/* size */
   1820  1.10  christos 	 16,			/* bitsize */
   1821   1.1  christos 	 false,			/* pc_relative */
   1822   1.1  christos 	 0,			/* bitpos */
   1823   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1824   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1825  1.10  christos 	 "R_MIPS16_TLS_DTPREL_LO16",	/* name */
   1826   1.1  christos 	 true,			/* partial_inplace */
   1827   1.1  christos 	 0x0000ffff,		/* src_mask */
   1828  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1829   1.1  christos 	 false),		/* pcrel_offset */
   1830   1.1  christos 
   1831   1.1  christos   /* MIPS16 TLS thread pointer offset.  */
   1832   1.1  christos   HOWTO (R_MIPS16_TLS_GOTTPREL,	/* type */
   1833  1.10  christos 	 0,			/* rightshift */
   1834   1.1  christos 	 4,			/* size */
   1835  1.10  christos 	 16,			/* bitsize */
   1836   1.1  christos 	 false,			/* pc_relative */
   1837   1.1  christos 	 0,			/* bitpos */
   1838   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1839   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1840  1.10  christos 	 "R_MIPS16_TLS_GOTTPREL",	/* name */
   1841   1.1  christos 	 true,			/* partial_inplace */
   1842   1.1  christos 	 0x0000ffff,		/* src_mask */
   1843  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1844   1.1  christos 	 false),		/* pcrel_offset */
   1845   1.1  christos 
   1846   1.1  christos   /* MIPS16 TLS thread pointer offset.  */
   1847   1.1  christos   HOWTO (R_MIPS16_TLS_TPREL_HI16,	/* type */
   1848  1.10  christos 	 0,			/* rightshift */
   1849   1.1  christos 	 4,			/* size */
   1850  1.10  christos 	 16,			/* bitsize */
   1851   1.1  christos 	 false,			/* pc_relative */
   1852   1.1  christos 	 0,			/* bitpos */
   1853   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1854   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1855  1.10  christos 	 "R_MIPS16_TLS_TPREL_HI16", /* name */
   1856   1.1  christos 	 true,			/* partial_inplace */
   1857   1.1  christos 	 0x0000ffff,		/* src_mask */
   1858  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1859   1.1  christos 	 false),		/* pcrel_offset */
   1860   1.1  christos 
   1861   1.1  christos   /* MIPS16 TLS thread pointer offset.  */
   1862   1.1  christos   HOWTO (R_MIPS16_TLS_TPREL_LO16,	/* type */
   1863  1.10  christos 	 0,			/* rightshift */
   1864   1.1  christos 	 4,			/* size */
   1865  1.10  christos 	 16,			/* bitsize */
   1866   1.1  christos 	 false,			/* pc_relative */
   1867   1.1  christos 	 0,			/* bitpos */
   1868   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1869   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1870  1.10  christos 	 "R_MIPS16_TLS_TPREL_LO16", /* name */
   1871   1.1  christos 	 true,			/* partial_inplace */
   1872   1.1  christos 	 0x0000ffff,		/* src_mask */
   1873  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1874   1.6  christos 	 false),		/* pcrel_offset */
   1875   1.6  christos 
   1876   1.6  christos   /* MIPS16 16-bit PC-relative branch offset.  */
   1877   1.6  christos   HOWTO (R_MIPS16_PC16_S1,	/* type */
   1878  1.10  christos 	 1,			/* rightshift */
   1879   1.6  christos 	 4,			/* size */
   1880  1.10  christos 	 16,			/* bitsize */
   1881   1.6  christos 	 true,			/* pc_relative */
   1882   1.6  christos 	 0,			/* bitpos */
   1883   1.6  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1884   1.6  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1885  1.10  christos 	 "R_MIPS16_PC16_S1",	/* name */
   1886   1.6  christos 	 true,			/* partial_inplace */
   1887   1.6  christos 	 0x0000ffff,		/* src_mask */
   1888  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1889   1.1  christos 	 true),			/* pcrel_offset */
   1890   1.1  christos };
   1891   1.1  christos 
   1892   1.1  christos static reloc_howto_type mips16_elf64_howto_table_rela[] =
   1893   1.1  christos {
   1894   1.1  christos   /* The reloc used for the mips16 jump instruction.  */
   1895   1.1  christos   HOWTO (R_MIPS16_26,		/* type */
   1896  1.10  christos 	 2,			/* rightshift */
   1897   1.1  christos 	 4,			/* size */
   1898  1.10  christos 	 26,			/* bitsize */
   1899   1.1  christos 	 false,			/* pc_relative */
   1900   1.1  christos 	 0,			/* bitpos */
   1901   1.8  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1902   1.1  christos 				/* This needs complex overflow
   1903   1.1  christos 				   detection, because the upper four
   1904   1.1  christos 				   bits must match the PC.  */
   1905   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1906  1.10  christos 	 "R_MIPS16_26",		/* name */
   1907   1.1  christos 	 false,			/* partial_inplace */
   1908   1.1  christos 	 0,			/* src_mask */
   1909  1.10  christos 	 0x3ffffff,		/* dst_mask */
   1910   1.1  christos 	 false),		/* pcrel_offset */
   1911   1.1  christos 
   1912   1.1  christos   /* The reloc used for the mips16 gprel instruction.  */
   1913   1.1  christos   HOWTO (R_MIPS16_GPREL,	/* type */
   1914  1.10  christos 	 0,			/* rightshift */
   1915   1.1  christos 	 4,			/* size */
   1916  1.10  christos 	 16,			/* bitsize */
   1917   1.1  christos 	 false,			/* pc_relative */
   1918   1.1  christos 	 0,			/* bitpos */
   1919   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1920   1.1  christos 	 mips16_gprel_reloc,	/* special_function */
   1921  1.10  christos 	 "R_MIPS16_GPREL",	/* name */
   1922   1.1  christos 	 false,			/* partial_inplace */
   1923   1.8  christos 	 0,			/* src_mask */
   1924  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1925   1.1  christos 	 false),		/* pcrel_offset */
   1926   1.1  christos 
   1927   1.1  christos   /* A MIPS16 reference to the global offset table.  */
   1928   1.1  christos   HOWTO (R_MIPS16_GOT16,	/* type */
   1929  1.10  christos 	 0,			/* rightshift */
   1930   1.1  christos 	 4,			/* size */
   1931  1.10  christos 	 16,			/* bitsize */
   1932   1.1  christos 	 false,			/* pc_relative */
   1933   1.1  christos 	 0,			/* bitpos */
   1934   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1935   1.1  christos 	 _bfd_mips_elf_got16_reloc, /* special_function */
   1936  1.10  christos 	 "R_MIPS16_GOT16",	/* name */
   1937   1.1  christos 	 false,			/* partial_inplace */
   1938   1.8  christos 	 0,			/* src_mask */
   1939  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1940   1.1  christos 	 false),		/* pcrel_offset */
   1941   1.1  christos 
   1942   1.1  christos   /* A MIPS16 call through the global offset table.  */
   1943   1.1  christos   HOWTO (R_MIPS16_CALL16,	/* type */
   1944  1.10  christos 	 0,			/* rightshift */
   1945   1.1  christos 	 4,			/* size */
   1946  1.10  christos 	 16,			/* bitsize */
   1947   1.1  christos 	 false,			/* pc_relative */
   1948   1.1  christos 	 0,			/* bitpos */
   1949   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1950   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1951  1.10  christos 	 "R_MIPS16_CALL16",	/* name */
   1952   1.1  christos 	 false,			/* partial_inplace */
   1953   1.8  christos 	 0,			/* src_mask */
   1954  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1955   1.1  christos 	 false),		/* pcrel_offset */
   1956   1.1  christos 
   1957   1.1  christos   /* MIPS16 high 16 bits of symbol value.  */
   1958   1.1  christos   HOWTO (R_MIPS16_HI16,		/* type */
   1959  1.10  christos 	 16,			/* rightshift */
   1960   1.1  christos 	 4,			/* size */
   1961  1.10  christos 	 16,			/* bitsize */
   1962   1.1  christos 	 false,			/* pc_relative */
   1963   1.1  christos 	 0,			/* bitpos */
   1964   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1965   1.1  christos 	 _bfd_mips_elf_hi16_reloc, /* special_function */
   1966  1.10  christos 	 "R_MIPS16_HI16",	/* name */
   1967   1.1  christos 	 false,			/* partial_inplace */
   1968   1.1  christos 	 0,			/* src_mask */
   1969  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1970   1.1  christos 	 false),		/* pcrel_offset */
   1971   1.1  christos 
   1972   1.1  christos   /* MIPS16 low 16 bits of symbol value.  */
   1973   1.1  christos   HOWTO (R_MIPS16_LO16,		/* type */
   1974  1.10  christos 	 0,			/* rightshift */
   1975   1.1  christos 	 4,			/* size */
   1976  1.10  christos 	 16,			/* bitsize */
   1977   1.1  christos 	 false,			/* pc_relative */
   1978   1.1  christos 	 0,			/* bitpos */
   1979   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1980   1.1  christos 	 _bfd_mips_elf_lo16_reloc, /* special_function */
   1981  1.10  christos 	 "R_MIPS16_LO16",	/* name */
   1982   1.1  christos 	 false,			/* partial_inplace */
   1983   1.1  christos 	 0,			/* src_mask */
   1984  1.10  christos 	 0x0000ffff,		/* dst_mask */
   1985   1.1  christos 	 false),		/* pcrel_offset */
   1986   1.1  christos 
   1987   1.1  christos   /* MIPS16 TLS general dynamic variable reference.  */
   1988   1.1  christos   HOWTO (R_MIPS16_TLS_GD,	/* type */
   1989  1.10  christos 	 0,			/* rightshift */
   1990   1.1  christos 	 4,			/* size */
   1991  1.10  christos 	 16,			/* bitsize */
   1992   1.1  christos 	 false,			/* pc_relative */
   1993   1.1  christos 	 0,			/* bitpos */
   1994   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1995   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1996  1.10  christos 	 "R_MIPS16_TLS_GD",	/* name */
   1997   1.1  christos 	 false,			/* partial_inplace */
   1998   1.1  christos 	 0,			/* src_mask */
   1999  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2000   1.1  christos 	 false),		/* pcrel_offset */
   2001   1.1  christos 
   2002   1.1  christos   /* MIPS16 TLS local dynamic variable reference.  */
   2003   1.1  christos   HOWTO (R_MIPS16_TLS_LDM,	/* type */
   2004  1.10  christos 	 0,			/* rightshift */
   2005   1.1  christos 	 4,			/* size */
   2006  1.10  christos 	 16,			/* bitsize */
   2007   1.1  christos 	 false,			/* pc_relative */
   2008   1.1  christos 	 0,			/* bitpos */
   2009   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2010   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2011  1.10  christos 	 "R_MIPS16_TLS_LDM",	/* name */
   2012   1.1  christos 	 false,			/* partial_inplace */
   2013   1.1  christos 	 0,			/* src_mask */
   2014  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2015   1.1  christos 	 false),		/* pcrel_offset */
   2016   1.1  christos 
   2017   1.1  christos   /* MIPS16 TLS local dynamic offset.  */
   2018   1.1  christos   HOWTO (R_MIPS16_TLS_DTPREL_HI16,	/* type */
   2019  1.10  christos 	 0,			/* rightshift */
   2020   1.1  christos 	 4,			/* size */
   2021  1.10  christos 	 16,			/* bitsize */
   2022   1.1  christos 	 false,			/* pc_relative */
   2023   1.1  christos 	 0,			/* bitpos */
   2024   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2025   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2026  1.10  christos 	 "R_MIPS16_TLS_DTPREL_HI16",	/* name */
   2027   1.1  christos 	 false,			/* partial_inplace */
   2028   1.1  christos 	 0,			/* src_mask */
   2029  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2030   1.1  christos 	 false),		/* pcrel_offset */
   2031   1.1  christos 
   2032   1.1  christos   /* MIPS16 TLS local dynamic offset.  */
   2033   1.1  christos   HOWTO (R_MIPS16_TLS_DTPREL_LO16,	/* type */
   2034  1.10  christos 	 0,			/* rightshift */
   2035   1.1  christos 	 4,			/* size */
   2036  1.10  christos 	 16,			/* bitsize */
   2037   1.1  christos 	 false,			/* pc_relative */
   2038   1.1  christos 	 0,			/* bitpos */
   2039   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2040   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2041  1.10  christos 	 "R_MIPS16_TLS_DTPREL_LO16",	/* name */
   2042   1.1  christos 	 false,			/* partial_inplace */
   2043   1.1  christos 	 0,			/* src_mask */
   2044  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2045   1.1  christos 	 false),		/* pcrel_offset */
   2046   1.1  christos 
   2047   1.1  christos   /* MIPS16 TLS thread pointer offset.  */
   2048   1.1  christos   HOWTO (R_MIPS16_TLS_GOTTPREL,	/* type */
   2049  1.10  christos 	 0,			/* rightshift */
   2050   1.1  christos 	 4,			/* size */
   2051  1.10  christos 	 16,			/* bitsize */
   2052   1.1  christos 	 false,			/* pc_relative */
   2053   1.1  christos 	 0,			/* bitpos */
   2054   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2055   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2056  1.10  christos 	 "R_MIPS16_TLS_GOTTPREL",	/* name */
   2057   1.1  christos 	 false,			/* partial_inplace */
   2058   1.1  christos 	 0,			/* src_mask */
   2059  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2060   1.1  christos 	 false),		/* pcrel_offset */
   2061   1.1  christos 
   2062   1.1  christos   /* MIPS16 TLS thread pointer offset.  */
   2063   1.1  christos   HOWTO (R_MIPS16_TLS_TPREL_HI16,	/* type */
   2064  1.10  christos 	 0,			/* rightshift */
   2065   1.1  christos 	 4,			/* size */
   2066  1.10  christos 	 16,			/* bitsize */
   2067   1.1  christos 	 false,			/* pc_relative */
   2068   1.1  christos 	 0,			/* bitpos */
   2069   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2070   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2071  1.10  christos 	 "R_MIPS16_TLS_TPREL_HI16", /* name */
   2072   1.1  christos 	 false,			/* partial_inplace */
   2073   1.1  christos 	 0,			/* src_mask */
   2074  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2075   1.1  christos 	 false),		/* pcrel_offset */
   2076   1.1  christos 
   2077   1.1  christos   /* MIPS16 TLS thread pointer offset.  */
   2078   1.1  christos   HOWTO (R_MIPS16_TLS_TPREL_LO16,	/* type */
   2079  1.10  christos 	 0,			/* rightshift */
   2080   1.1  christos 	 4,			/* size */
   2081  1.10  christos 	 16,			/* bitsize */
   2082   1.1  christos 	 false,			/* pc_relative */
   2083   1.1  christos 	 0,			/* bitpos */
   2084   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2085   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2086  1.10  christos 	 "R_MIPS16_TLS_TPREL_LO16", /* name */
   2087   1.1  christos 	 false,			/* partial_inplace */
   2088   1.1  christos 	 0,			/* src_mask */
   2089  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2090   1.6  christos 	 false),		/* pcrel_offset */
   2091   1.6  christos 
   2092   1.6  christos   /* MIPS16 16-bit PC-relative branch offset.  */
   2093   1.6  christos   HOWTO (R_MIPS16_PC16_S1,	/* type */
   2094  1.10  christos 	 1,			/* rightshift */
   2095   1.6  christos 	 4,			/* size */
   2096  1.10  christos 	 16,			/* bitsize */
   2097   1.6  christos 	 true,			/* pc_relative */
   2098   1.6  christos 	 0,			/* bitpos */
   2099   1.6  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2100   1.6  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2101  1.10  christos 	 "R_MIPS16_PC16_S1",	/* name */
   2102   1.6  christos 	 false,			/* partial_inplace */
   2103   1.6  christos 	 0,			/* src_mask */
   2104  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2105   1.1  christos 	 true),			/* pcrel_offset */
   2106   1.1  christos };
   2107   1.1  christos 
   2108   1.1  christos static reloc_howto_type micromips_elf64_howto_table_rel[] =
   2109   1.1  christos {
   2110   1.1  christos   EMPTY_HOWTO (130),
   2111   1.1  christos   EMPTY_HOWTO (131),
   2112   1.1  christos   EMPTY_HOWTO (132),
   2113   1.1  christos 
   2114   1.1  christos   /* 26 bit jump address.  */
   2115   1.1  christos   HOWTO (R_MICROMIPS_26_S1,	/* type */
   2116  1.10  christos 	 1,			/* rightshift */
   2117   1.1  christos 	 4,			/* size */
   2118  1.10  christos 	 26,			/* bitsize */
   2119   1.1  christos 	 false,			/* pc_relative */
   2120   1.1  christos 	 0,			/* bitpos */
   2121   1.8  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2122   1.1  christos 				/* This needs complex overflow
   2123   1.1  christos 				   detection, because the upper four
   2124   1.1  christos 				   bits must match the PC.  */
   2125   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2126  1.10  christos 	 "R_MICROMIPS_26_S1",	/* name */
   2127   1.1  christos 	 true,			/* partial_inplace */
   2128   1.1  christos 	 0x3ffffff,		/* src_mask */
   2129  1.10  christos 	 0x3ffffff,		/* dst_mask */
   2130   1.1  christos 	 false),		/* pcrel_offset */
   2131   1.1  christos 
   2132   1.1  christos   /* High 16 bits of symbol value.  */
   2133   1.1  christos   HOWTO (R_MICROMIPS_HI16,	/* type */
   2134  1.10  christos 	 16,			/* rightshift */
   2135   1.1  christos 	 4,			/* size */
   2136  1.10  christos 	 16,			/* bitsize */
   2137   1.1  christos 	 false,			/* pc_relative */
   2138   1.1  christos 	 0,			/* bitpos */
   2139   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2140   1.1  christos 	 _bfd_mips_elf_hi16_reloc, /* special_function */
   2141  1.10  christos 	 "R_MICROMIPS_HI16",	/* name */
   2142   1.1  christos 	 true,			/* partial_inplace */
   2143   1.1  christos 	 0x0000ffff,		/* src_mask */
   2144  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2145   1.1  christos 	 false),		/* pcrel_offset */
   2146   1.1  christos 
   2147   1.1  christos   /* Low 16 bits of symbol value.  */
   2148   1.1  christos   HOWTO (R_MICROMIPS_LO16,	/* type */
   2149  1.10  christos 	 0,			/* rightshift */
   2150   1.1  christos 	 4,			/* size */
   2151  1.10  christos 	 16,			/* bitsize */
   2152   1.1  christos 	 false,			/* pc_relative */
   2153   1.1  christos 	 0,			/* bitpos */
   2154   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2155   1.1  christos 	 _bfd_mips_elf_lo16_reloc, /* special_function */
   2156  1.10  christos 	 "R_MICROMIPS_LO16",	/* name */
   2157   1.1  christos 	 true,			/* partial_inplace */
   2158   1.1  christos 	 0x0000ffff,		/* src_mask */
   2159  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2160   1.1  christos 	 false),		/* pcrel_offset */
   2161   1.1  christos 
   2162   1.1  christos   /* GP relative reference.  */
   2163   1.1  christos   HOWTO (R_MICROMIPS_GPREL16,	/* type */
   2164  1.10  christos 	 0,			/* rightshift */
   2165   1.1  christos 	 4,			/* size */
   2166  1.10  christos 	 16,			/* bitsize */
   2167   1.1  christos 	 false,			/* pc_relative */
   2168   1.1  christos 	 0,			/* bitpos */
   2169   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2170   1.1  christos 	 _bfd_mips_elf32_gprel16_reloc, /* special_function */
   2171  1.10  christos 	 "R_MICROMIPS_GPREL16",	/* name */
   2172   1.1  christos 	 true,			/* partial_inplace */
   2173   1.1  christos 	 0x0000ffff,		/* src_mask */
   2174  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2175   1.1  christos 	 false),		/* pcrel_offset */
   2176   1.1  christos 
   2177   1.1  christos   /* Reference to literal section.  */
   2178   1.1  christos   HOWTO (R_MICROMIPS_LITERAL,	/* type */
   2179  1.10  christos 	 0,			/* rightshift */
   2180   1.1  christos 	 4,			/* size */
   2181  1.10  christos 	 16,			/* bitsize */
   2182   1.1  christos 	 false,			/* pc_relative */
   2183   1.1  christos 	 0,			/* bitpos */
   2184   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2185   1.1  christos 	 _bfd_mips_elf32_gprel16_reloc, /* special_function */
   2186  1.10  christos 	 "R_MICROMIPS_LITERAL",	/* name */
   2187   1.1  christos 	 true,			/* partial_inplace */
   2188   1.1  christos 	 0x0000ffff,		/* src_mask */
   2189  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2190   1.1  christos 	 false),		/* pcrel_offset */
   2191   1.1  christos 
   2192   1.1  christos   /* Reference to global offset table.  */
   2193   1.1  christos   HOWTO (R_MICROMIPS_GOT16,	/* type */
   2194  1.10  christos 	 0,			/* rightshift */
   2195   1.1  christos 	 4,			/* size */
   2196  1.10  christos 	 16,			/* bitsize */
   2197   1.1  christos 	 false,			/* pc_relative */
   2198   1.1  christos 	 0,			/* bitpos */
   2199   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2200   1.1  christos 	 _bfd_mips_elf_got16_reloc, /* special_function */
   2201  1.10  christos 	 "R_MICROMIPS_GOT16",	/* name */
   2202   1.1  christos 	 true,			/* partial_inplace */
   2203   1.1  christos 	 0x0000ffff,		/* src_mask */
   2204  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2205   1.1  christos 	 false),		/* pcrel_offset */
   2206   1.1  christos 
   2207   1.1  christos   /* This is for microMIPS branches.  */
   2208   1.1  christos   HOWTO (R_MICROMIPS_PC7_S1,	/* type */
   2209  1.10  christos 	 1,			/* rightshift */
   2210   1.1  christos 	 2,			/* size */
   2211  1.10  christos 	 7,			/* bitsize */
   2212   1.1  christos 	 true,			/* pc_relative */
   2213   1.1  christos 	 0,			/* bitpos */
   2214   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2215   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2216  1.10  christos 	 "R_MICROMIPS_PC7_S1",	/* name */
   2217   1.1  christos 	 true,			/* partial_inplace */
   2218   1.1  christos 	 0x0000007f,		/* src_mask */
   2219  1.10  christos 	 0x0000007f,		/* dst_mask */
   2220   1.1  christos 	 true),			/* pcrel_offset */
   2221   1.1  christos 
   2222   1.1  christos   HOWTO (R_MICROMIPS_PC10_S1,	/* type */
   2223  1.10  christos 	 1,			/* rightshift */
   2224   1.1  christos 	 2,			/* size */
   2225  1.10  christos 	 10,			/* bitsize */
   2226   1.1  christos 	 true,			/* pc_relative */
   2227   1.1  christos 	 0,			/* bitpos */
   2228   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2229   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2230  1.10  christos 	 "R_MICROMIPS_PC10_S1",	/* name */
   2231   1.1  christos 	 true,			/* partial_inplace */
   2232   1.1  christos 	 0x000003ff,		/* src_mask */
   2233  1.10  christos 	 0x000003ff,		/* dst_mask */
   2234   1.1  christos 	 true),			/* pcrel_offset */
   2235   1.1  christos 
   2236   1.1  christos   HOWTO (R_MICROMIPS_PC16_S1,	/* type */
   2237  1.10  christos 	 1,			/* rightshift */
   2238   1.1  christos 	 4,			/* size */
   2239  1.10  christos 	 16,			/* bitsize */
   2240   1.1  christos 	 true,			/* pc_relative */
   2241   1.1  christos 	 0,			/* bitpos */
   2242   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2243   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2244  1.10  christos 	 "R_MICROMIPS_PC16_S1",	/* name */
   2245   1.1  christos 	 true,			/* partial_inplace */
   2246   1.1  christos 	 0x0000ffff,		/* src_mask */
   2247  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2248   1.1  christos 	 true),			/* pcrel_offset */
   2249   1.1  christos 
   2250   1.1  christos   /* 16 bit call through global offset table.  */
   2251   1.1  christos   HOWTO (R_MICROMIPS_CALL16,	/* type */
   2252  1.10  christos 	 0,			/* rightshift */
   2253   1.1  christos 	 4,			/* size */
   2254  1.10  christos 	 16,			/* bitsize */
   2255   1.1  christos 	 false,			/* pc_relative */
   2256   1.1  christos 	 0,			/* bitpos */
   2257   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2258   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2259  1.10  christos 	 "R_MICROMIPS_CALL16",	/* name */
   2260   1.1  christos 	 true,			/* partial_inplace */
   2261   1.1  christos 	 0x0000ffff,		/* src_mask */
   2262  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2263   1.1  christos 	 false),		/* pcrel_offset */
   2264   1.1  christos 
   2265   1.1  christos   EMPTY_HOWTO (143),
   2266   1.1  christos   EMPTY_HOWTO (144),
   2267   1.1  christos 
   2268   1.1  christos   /* Displacement in the global offset table.  */
   2269   1.1  christos   HOWTO (R_MICROMIPS_GOT_DISP,	/* type */
   2270  1.10  christos 	 0,			/* rightshift */
   2271   1.1  christos 	 4,			/* size */
   2272  1.10  christos 	 16,			/* bitsize */
   2273   1.1  christos 	 false,			/* pc_relative */
   2274   1.1  christos 	 0,			/* bitpos */
   2275   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2276   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2277  1.10  christos 	 "R_MICROMIPS_GOT_DISP",/* name */
   2278   1.1  christos 	 true,			/* partial_inplace */
   2279   1.1  christos 	 0x0000ffff,		/* src_mask */
   2280  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2281   1.1  christos 	 false),		/* pcrel_offset */
   2282   1.1  christos 
   2283   1.1  christos   /* Displacement to page pointer in the global offset table.  */
   2284   1.1  christos   HOWTO (R_MICROMIPS_GOT_PAGE,	/* type */
   2285  1.10  christos 	 0,			/* rightshift */
   2286   1.1  christos 	 4,			/* size */
   2287  1.10  christos 	 16,			/* bitsize */
   2288   1.1  christos 	 false,			/* pc_relative */
   2289   1.1  christos 	 0,			/* bitpos */
   2290   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2291   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2292  1.10  christos 	 "R_MICROMIPS_GOT_PAGE",/* name */
   2293   1.1  christos 	 true,			/* partial_inplace */
   2294   1.1  christos 	 0x0000ffff,		/* src_mask */
   2295  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2296   1.1  christos 	 false),		/* pcrel_offset */
   2297   1.1  christos 
   2298   1.1  christos   /* Offset from page pointer in the global offset table.  */
   2299   1.1  christos   HOWTO (R_MICROMIPS_GOT_OFST,	/* type */
   2300  1.10  christos 	 0,			/* rightshift */
   2301   1.1  christos 	 4,			/* size */
   2302  1.10  christos 	 16,			/* bitsize */
   2303   1.1  christos 	 false,			/* pc_relative */
   2304   1.1  christos 	 0,			/* bitpos */
   2305   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2306   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2307  1.10  christos 	 "R_MICROMIPS_GOT_OFST",/* name */
   2308   1.1  christos 	 true,			/* partial_inplace */
   2309   1.1  christos 	 0x0000ffff,		/* src_mask */
   2310  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2311   1.1  christos 	 false),		/* pcrel_offset */
   2312   1.1  christos 
   2313   1.1  christos   /* High 16 bits of displacement in global offset table.  */
   2314   1.1  christos   HOWTO (R_MICROMIPS_GOT_HI16,	/* type */
   2315  1.10  christos 	 0,			/* rightshift */
   2316   1.1  christos 	 4,			/* size */
   2317  1.10  christos 	 16,			/* bitsize */
   2318   1.1  christos 	 false,			/* pc_relative */
   2319   1.1  christos 	 0,			/* bitpos */
   2320   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2321   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2322  1.10  christos 	 "R_MICROMIPS_GOT_HI16",/* name */
   2323   1.1  christos 	 true,			/* partial_inplace */
   2324   1.1  christos 	 0x0000ffff,		/* src_mask */
   2325  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2326   1.1  christos 	 false),		/* pcrel_offset */
   2327   1.1  christos 
   2328   1.1  christos   /* Low 16 bits of displacement in global offset table.  */
   2329   1.1  christos   HOWTO (R_MICROMIPS_GOT_LO16,	/* type */
   2330  1.10  christos 	 0,			/* rightshift */
   2331   1.1  christos 	 4,			/* size */
   2332  1.10  christos 	 16,			/* bitsize */
   2333   1.1  christos 	 false,			/* pc_relative */
   2334   1.1  christos 	 0,			/* bitpos */
   2335   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2336   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2337  1.10  christos 	 "R_MICROMIPS_GOT_LO16",/* name */
   2338   1.1  christos 	 true,			/* partial_inplace */
   2339   1.1  christos 	 0x0000ffff,		/* src_mask */
   2340  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2341   1.1  christos 	 false),		/* pcrel_offset */
   2342   1.1  christos 
   2343   1.1  christos   /* 64 bit subtraction.  Used in the N32 ABI.  */
   2344   1.1  christos   HOWTO (R_MICROMIPS_SUB,	/* type */
   2345  1.10  christos 	 0,			/* rightshift */
   2346   1.1  christos 	 8,			/* size */
   2347  1.10  christos 	 64,			/* bitsize */
   2348   1.1  christos 	 false,			/* pc_relative */
   2349   1.1  christos 	 0,			/* bitpos */
   2350   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2351   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2352  1.10  christos 	 "R_MICROMIPS_SUB",	/* name */
   2353   1.1  christos 	 true,			/* partial_inplace */
   2354   1.1  christos 	 MINUS_ONE,		/* src_mask */
   2355  1.10  christos 	 MINUS_ONE,		/* dst_mask */
   2356   1.1  christos 	 false),		/* pcrel_offset */
   2357   1.1  christos 
   2358   1.1  christos   /* We don't support these for REL relocations, because it means building
   2359   1.1  christos      the addend from a R_MICROMIPS_HIGHEST/R_MICROMIPS_HIGHER/
   2360   1.1  christos      R_MICROMIPS_HI16/R_MICROMIPS_LO16 sequence with varying ordering,
   2361   1.1  christos      using fallable heuristics.  */
   2362   1.1  christos   EMPTY_HOWTO (R_MICROMIPS_HIGHER),
   2363   1.1  christos   EMPTY_HOWTO (R_MICROMIPS_HIGHEST),
   2364   1.1  christos 
   2365   1.1  christos   /* High 16 bits of displacement in global offset table.  */
   2366   1.1  christos   HOWTO (R_MICROMIPS_CALL_HI16,	/* type */
   2367  1.10  christos 	 0,			/* rightshift */
   2368   1.1  christos 	 4,			/* size */
   2369  1.10  christos 	 16,			/* bitsize */
   2370   1.1  christos 	 false,			/* pc_relative */
   2371   1.1  christos 	 0,			/* bitpos */
   2372   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2373   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2374  1.10  christos 	 "R_MICROMIPS_CALL_HI16",/* name */
   2375   1.1  christos 	 true,			/* partial_inplace */
   2376   1.1  christos 	 0x0000ffff,		/* src_mask */
   2377  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2378   1.1  christos 	 false),		/* pcrel_offset */
   2379   1.1  christos 
   2380   1.1  christos   /* Low 16 bits of displacement in global offset table.  */
   2381   1.1  christos   HOWTO (R_MICROMIPS_CALL_LO16,	/* type */
   2382  1.10  christos 	 0,			/* rightshift */
   2383   1.1  christos 	 4,			/* size */
   2384  1.10  christos 	 16,			/* bitsize */
   2385   1.1  christos 	 false,			/* pc_relative */
   2386   1.1  christos 	 0,			/* bitpos */
   2387   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2388   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2389  1.10  christos 	 "R_MICROMIPS_CALL_LO16",/* name */
   2390   1.1  christos 	 true,			/* partial_inplace */
   2391   1.1  christos 	 0x0000ffff,		/* src_mask */
   2392  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2393   1.1  christos 	 false),		/* pcrel_offset */
   2394   1.1  christos 
   2395   1.1  christos   /* Section displacement.  */
   2396   1.1  christos   HOWTO (R_MICROMIPS_SCN_DISP,  /* type */
   2397  1.10  christos 	 0,			/* rightshift */
   2398   1.1  christos 	 4,			/* size */
   2399  1.10  christos 	 32,			/* bitsize */
   2400   1.1  christos 	 false,			/* pc_relative */
   2401   1.1  christos 	 0,			/* bitpos */
   2402   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2403   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2404  1.10  christos 	 "R_MICROMIPS_SCN_DISP", /* name */
   2405   1.1  christos 	 true,			/* partial_inplace */
   2406   1.1  christos 	 0xffffffff,		/* src_mask */
   2407  1.10  christos 	 0xffffffff,		/* dst_mask */
   2408   1.1  christos 	 false),		/* pcrel_offset */
   2409   1.1  christos 
   2410   1.1  christos   /* Protected jump conversion.  This is an optimization hint.  No
   2411   1.1  christos      relocation is required for correctness.  */
   2412   1.1  christos   HOWTO (R_MICROMIPS_JALR,	/* type */
   2413  1.10  christos 	 0,			/* rightshift */
   2414   1.1  christos 	 4,			/* size */
   2415  1.10  christos 	 32,			/* bitsize */
   2416   1.1  christos 	 false,			/* pc_relative */
   2417   1.1  christos 	 0,			/* bitpos */
   2418   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2419   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2420  1.10  christos 	 "R_MICROMIPS_JALR",	/* name */
   2421   1.1  christos 	 false,			/* partial_inplace */
   2422   1.1  christos 	 0,			/* src_mask */
   2423  1.10  christos 	 0x00000000,		/* dst_mask */
   2424   1.8  christos 	 false),		/* pcrel_offset */
   2425   1.8  christos 
   2426   1.8  christos   /* Low 16 bits of symbol value.  Note that the high 16 bits of symbol values
   2427   1.8  christos      must be zero.  This is used for relaxation.  */
   2428   1.8  christos   HOWTO (R_MICROMIPS_HI0_LO16,	/* type */
   2429  1.10  christos 	 0,			/* rightshift */
   2430   1.8  christos 	 4,			/* size */
   2431  1.10  christos 	 16,			/* bitsize */
   2432   1.8  christos 	 false,			/* pc_relative */
   2433   1.8  christos 	 0,			/* bitpos */
   2434   1.8  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2435   1.8  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2436  1.10  christos 	 "R_MICROMIPS_HI0_LO16",/* name */
   2437   1.8  christos 	 true,			/* partial_inplace */
   2438   1.8  christos 	 0x0000ffff,		/* src_mask */
   2439  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2440   1.8  christos 	 false),		/* pcrel_offset */
   2441   1.8  christos 
   2442   1.8  christos   EMPTY_HOWTO (158),
   2443   1.8  christos   EMPTY_HOWTO (159),
   2444   1.8  christos   EMPTY_HOWTO (160),
   2445   1.8  christos   EMPTY_HOWTO (161),
   2446   1.8  christos 
   2447   1.8  christos   /* TLS general dynamic variable reference.  */
   2448   1.8  christos   HOWTO (R_MICROMIPS_TLS_GD,		/* type */
   2449  1.10  christos 	 0,			/* rightshift */
   2450   1.8  christos 	 4,			/* size */
   2451  1.10  christos 	 16,			/* bitsize */
   2452   1.8  christos 	 false,			/* pc_relative */
   2453   1.8  christos 	 0,			/* bitpos */
   2454   1.8  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2455   1.8  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2456  1.10  christos 	 "R_MICROMIPS_TLS_GD",	/* name */
   2457   1.8  christos 	 true,			/* partial_inplace */
   2458   1.8  christos 	 0x0000ffff,		/* src_mask */
   2459  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2460   1.8  christos 	 false),		/* pcrel_offset */
   2461   1.8  christos 
   2462   1.8  christos   /* TLS local dynamic variable reference.  */
   2463   1.8  christos   HOWTO (R_MICROMIPS_TLS_LDM,	/* type */
   2464  1.10  christos 	 0,			/* rightshift */
   2465   1.8  christos 	 4,			/* size */
   2466  1.10  christos 	 16,			/* bitsize */
   2467   1.8  christos 	 false,			/* pc_relative */
   2468   1.8  christos 	 0,			/* bitpos */
   2469   1.8  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2470   1.8  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2471  1.10  christos 	 "R_MICROMIPS_TLS_LDM",	/* name */
   2472   1.8  christos 	 true,			/* partial_inplace */
   2473   1.8  christos 	 0x0000ffff,		/* src_mask */
   2474  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2475   1.8  christos 	 false),		/* pcrel_offset */
   2476   1.8  christos 
   2477   1.8  christos   /* TLS local dynamic offset.  */
   2478   1.8  christos   HOWTO (R_MICROMIPS_TLS_DTPREL_HI16,	/* type */
   2479  1.10  christos 	 0,			/* rightshift */
   2480   1.8  christos 	 4,			/* size */
   2481  1.10  christos 	 16,			/* bitsize */
   2482   1.8  christos 	 false,			/* pc_relative */
   2483   1.8  christos 	 0,			/* bitpos */
   2484   1.8  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2485   1.8  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2486  1.10  christos 	 "R_MICROMIPS_TLS_DTPREL_HI16",	/* name */
   2487   1.8  christos 	 true,			/* partial_inplace */
   2488   1.8  christos 	 0x0000ffff,		/* src_mask */
   2489  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2490   1.8  christos 	 false),		/* pcrel_offset */
   2491   1.8  christos 
   2492   1.8  christos   /* TLS local dynamic offset.  */
   2493   1.8  christos   HOWTO (R_MICROMIPS_TLS_DTPREL_LO16,	/* type */
   2494  1.10  christos 	 0,			/* rightshift */
   2495   1.8  christos 	 4,			/* size */
   2496  1.10  christos 	 16,			/* bitsize */
   2497   1.8  christos 	 false,			/* pc_relative */
   2498   1.8  christos 	 0,			/* bitpos */
   2499   1.8  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2500   1.8  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2501  1.10  christos 	 "R_MICROMIPS_TLS_DTPREL_LO16",	/* name */
   2502   1.8  christos 	 true,			/* partial_inplace */
   2503   1.8  christos 	 0x0000ffff,		/* src_mask */
   2504  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2505   1.8  christos 	 false),		/* pcrel_offset */
   2506   1.8  christos 
   2507   1.8  christos   /* TLS thread pointer offset.  */
   2508   1.8  christos   HOWTO (R_MICROMIPS_TLS_GOTTPREL,	/* type */
   2509  1.10  christos 	 0,			/* rightshift */
   2510   1.8  christos 	 4,			/* size */
   2511  1.10  christos 	 16,			/* bitsize */
   2512   1.8  christos 	 false,			/* pc_relative */
   2513   1.8  christos 	 0,			/* bitpos */
   2514   1.8  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2515   1.8  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2516  1.10  christos 	 "R_MICROMIPS_TLS_GOTTPREL",	/* name */
   2517   1.8  christos 	 true,			/* partial_inplace */
   2518   1.8  christos 	 0x0000ffff,		/* src_mask */
   2519  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2520   1.8  christos 	 false),		/* pcrel_offset */
   2521   1.8  christos 
   2522   1.8  christos   EMPTY_HOWTO (167),
   2523   1.8  christos   EMPTY_HOWTO (168),
   2524   1.8  christos 
   2525   1.8  christos   /* TLS thread pointer offset.  */
   2526   1.8  christos   HOWTO (R_MICROMIPS_TLS_TPREL_HI16,	/* type */
   2527  1.10  christos 	 0,			/* rightshift */
   2528   1.8  christos 	 4,			/* size */
   2529  1.10  christos 	 16,			/* bitsize */
   2530   1.8  christos 	 false,			/* pc_relative */
   2531   1.8  christos 	 0,			/* bitpos */
   2532   1.8  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2533   1.8  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2534  1.10  christos 	 "R_MICROMIPS_TLS_TPREL_HI16", /* name */
   2535   1.8  christos 	 true,			/* partial_inplace */
   2536   1.8  christos 	 0x0000ffff,		/* src_mask */
   2537  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2538   1.8  christos 	 false),		/* pcrel_offset */
   2539   1.8  christos 
   2540   1.8  christos   /* TLS thread pointer offset.  */
   2541   1.8  christos   HOWTO (R_MICROMIPS_TLS_TPREL_LO16,	/* type */
   2542  1.10  christos 	 0,			/* rightshift */
   2543   1.8  christos 	 4,			/* size */
   2544  1.10  christos 	 16,			/* bitsize */
   2545   1.8  christos 	 false,			/* pc_relative */
   2546   1.8  christos 	 0,			/* bitpos */
   2547   1.8  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2548   1.8  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2549  1.10  christos 	 "R_MICROMIPS_TLS_TPREL_LO16", /* name */
   2550   1.8  christos 	 true,			/* partial_inplace */
   2551   1.8  christos 	 0x0000ffff,		/* src_mask */
   2552  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2553   1.8  christos 	 false),		/* pcrel_offset */
   2554   1.8  christos 
   2555   1.8  christos   EMPTY_HOWTO (171),
   2556   1.8  christos 
   2557   1.8  christos   /* GP- and PC-relative relocations.  */
   2558   1.8  christos   HOWTO (R_MICROMIPS_GPREL7_S2,	/* type */
   2559  1.10  christos 	 2,			/* rightshift */
   2560   1.8  christos 	 2,			/* size */
   2561  1.10  christos 	 7,			/* bitsize */
   2562   1.8  christos 	 false,			/* pc_relative */
   2563   1.8  christos 	 0,			/* bitpos */
   2564   1.8  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2565   1.8  christos 	 _bfd_mips_elf32_gprel16_reloc, /* special_function */
   2566  1.10  christos 	 "R_MICROMIPS_GPREL7_S2",	/* name */
   2567   1.8  christos 	 true,			/* partial_inplace */
   2568   1.8  christos 	 0x0000007f,		/* src_mask */
   2569  1.10  christos 	 0x0000007f,		/* dst_mask */
   2570   1.8  christos 	 false),		/* pcrel_offset */
   2571   1.8  christos 
   2572   1.8  christos   HOWTO (R_MICROMIPS_PC23_S2,	/* type */
   2573  1.10  christos 	 2,			/* rightshift */
   2574   1.8  christos 	 4,			/* size */
   2575  1.10  christos 	 23,			/* bitsize */
   2576   1.8  christos 	 true,			/* pc_relative */
   2577   1.8  christos 	 0,			/* bitpos */
   2578   1.8  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2579   1.8  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2580  1.10  christos 	 "R_MICROMIPS_PC23_S2",	/* name */
   2581   1.8  christos 	 true,			/* partial_inplace */
   2582   1.8  christos 	 0x007fffff,		/* src_mask */
   2583  1.10  christos 	 0x007fffff,		/* dst_mask */
   2584   1.1  christos 	 true),			/* pcrel_offset */
   2585   1.1  christos };
   2586   1.1  christos 
   2587   1.1  christos static reloc_howto_type micromips_elf64_howto_table_rela[] =
   2588   1.1  christos {
   2589   1.1  christos   EMPTY_HOWTO (130),
   2590   1.1  christos   EMPTY_HOWTO (131),
   2591   1.1  christos   EMPTY_HOWTO (132),
   2592   1.1  christos 
   2593   1.1  christos   /* 26 bit jump address.  */
   2594   1.1  christos   HOWTO (R_MICROMIPS_26_S1,	/* type */
   2595  1.10  christos 	 1,			/* rightshift */
   2596   1.1  christos 	 4,			/* size */
   2597  1.10  christos 	 26,			/* bitsize */
   2598   1.1  christos 	 false,			/* pc_relative */
   2599   1.1  christos 	 0,			/* bitpos */
   2600   1.8  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2601   1.1  christos 				/* This needs complex overflow
   2602   1.1  christos 				   detection, because the upper four
   2603   1.1  christos 				   bits must match the PC.  */
   2604   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2605  1.10  christos 	 "R_MICROMIPS_26_S1",	/* name */
   2606   1.1  christos 	 false,			/* partial_inplace */
   2607   1.1  christos 	 0,			/* src_mask */
   2608  1.10  christos 	 0x3ffffff,		/* dst_mask */
   2609   1.1  christos 	 false),		/* pcrel_offset */
   2610   1.1  christos 
   2611   1.1  christos   /* High 16 bits of symbol value.  */
   2612   1.1  christos   HOWTO (R_MICROMIPS_HI16,	/* type */
   2613  1.10  christos 	 16,			/* rightshift */
   2614   1.1  christos 	 4,			/* size */
   2615  1.10  christos 	 16,			/* bitsize */
   2616   1.1  christos 	 false,			/* pc_relative */
   2617   1.1  christos 	 0,			/* bitpos */
   2618   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2619   1.1  christos 	 _bfd_mips_elf_hi16_reloc, /* special_function */
   2620  1.10  christos 	 "R_MICROMIPS_HI16",	/* name */
   2621   1.1  christos 	 false,			/* partial_inplace */
   2622   1.1  christos 	 0,			/* src_mask */
   2623  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2624   1.1  christos 	 false),		/* pcrel_offset */
   2625   1.1  christos 
   2626   1.1  christos   /* Low 16 bits of symbol value.  */
   2627   1.1  christos   HOWTO (R_MICROMIPS_LO16,	/* type */
   2628  1.10  christos 	 0,			/* rightshift */
   2629   1.1  christos 	 4,			/* size */
   2630  1.10  christos 	 16,			/* bitsize */
   2631   1.1  christos 	 false,			/* pc_relative */
   2632   1.1  christos 	 0,			/* bitpos */
   2633   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2634   1.1  christos 	 _bfd_mips_elf_lo16_reloc, /* special_function */
   2635  1.10  christos 	 "R_MICROMIPS_LO16",	/* name */
   2636   1.1  christos 	 false,			/* partial_inplace */
   2637   1.1  christos 	 0,			/* src_mask */
   2638  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2639   1.1  christos 	 false),		/* pcrel_offset */
   2640   1.1  christos 
   2641   1.1  christos   /* GP relative reference.  */
   2642   1.1  christos   HOWTO (R_MICROMIPS_GPREL16,	/* type */
   2643  1.10  christos 	 0,			/* rightshift */
   2644   1.1  christos 	 4,			/* size */
   2645  1.10  christos 	 16,			/* bitsize */
   2646   1.1  christos 	 false,			/* pc_relative */
   2647   1.1  christos 	 0,			/* bitpos */
   2648   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2649   1.1  christos 	 _bfd_mips_elf32_gprel16_reloc, /* special_function */
   2650  1.10  christos 	 "R_MICROMIPS_GPREL16",	/* name */
   2651   1.1  christos 	 false,			/* partial_inplace */
   2652   1.1  christos 	 0,			/* src_mask */
   2653  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2654   1.1  christos 	 false),		/* pcrel_offset */
   2655   1.1  christos 
   2656   1.1  christos   /* Reference to literal section.  */
   2657   1.1  christos   HOWTO (R_MICROMIPS_LITERAL,	/* type */
   2658  1.10  christos 	 0,			/* rightshift */
   2659   1.1  christos 	 4,			/* size */
   2660  1.10  christos 	 16,			/* bitsize */
   2661   1.1  christos 	 false,			/* pc_relative */
   2662   1.1  christos 	 0,			/* bitpos */
   2663   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2664   1.1  christos 	 _bfd_mips_elf32_gprel16_reloc, /* special_function */
   2665  1.10  christos 	 "R_MICROMIPS_LITERAL",	/* name */
   2666   1.1  christos 	 false,			/* partial_inplace */
   2667   1.1  christos 	 0,			/* src_mask */
   2668  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2669   1.1  christos 	 false),		/* pcrel_offset */
   2670   1.1  christos 
   2671   1.1  christos   /* Reference to global offset table.  */
   2672   1.1  christos   HOWTO (R_MICROMIPS_GOT16,	/* type */
   2673  1.10  christos 	 0,			/* rightshift */
   2674   1.1  christos 	 4,			/* size */
   2675  1.10  christos 	 16,			/* bitsize */
   2676   1.1  christos 	 false,			/* pc_relative */
   2677   1.1  christos 	 0,			/* bitpos */
   2678   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2679   1.1  christos 	 _bfd_mips_elf_got16_reloc, /* special_function */
   2680  1.10  christos 	 "R_MICROMIPS_GOT16",	/* name */
   2681   1.1  christos 	 false,			/* partial_inplace */
   2682   1.1  christos 	 0,			/* src_mask */
   2683  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2684   1.1  christos 	 false),		/* pcrel_offset */
   2685   1.1  christos 
   2686   1.1  christos   /* This is for microMIPS branches.  */
   2687   1.1  christos   HOWTO (R_MICROMIPS_PC7_S1,	/* type */
   2688  1.10  christos 	 1,			/* rightshift */
   2689   1.1  christos 	 2,			/* size */
   2690  1.10  christos 	 7,			/* bitsize */
   2691   1.1  christos 	 true,			/* pc_relative */
   2692   1.1  christos 	 0,			/* bitpos */
   2693   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2694   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2695  1.10  christos 	 "R_MICROMIPS_PC7_S1",	/* name */
   2696   1.1  christos 	 false,			/* partial_inplace */
   2697   1.1  christos 	 0,			/* src_mask */
   2698  1.10  christos 	 0x0000007f,		/* dst_mask */
   2699   1.1  christos 	 true),			/* pcrel_offset */
   2700   1.1  christos 
   2701   1.1  christos   HOWTO (R_MICROMIPS_PC10_S1,	/* type */
   2702  1.10  christos 	 1,			/* rightshift */
   2703   1.1  christos 	 2,			/* size */
   2704  1.10  christos 	 10,			/* bitsize */
   2705   1.1  christos 	 true,			/* pc_relative */
   2706   1.1  christos 	 0,			/* bitpos */
   2707   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2708   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2709  1.10  christos 	 "R_MICROMIPS_PC10_S1",	/* name */
   2710   1.1  christos 	 false,			/* partial_inplace */
   2711   1.1  christos 	 0,			/* src_mask */
   2712  1.10  christos 	 0x000003ff,		/* dst_mask */
   2713   1.1  christos 	 true),			/* pcrel_offset */
   2714   1.1  christos 
   2715   1.1  christos   HOWTO (R_MICROMIPS_PC16_S1,	/* type */
   2716  1.10  christos 	 1,			/* rightshift */
   2717   1.1  christos 	 4,			/* size */
   2718  1.10  christos 	 16,			/* bitsize */
   2719   1.1  christos 	 true,			/* pc_relative */
   2720   1.1  christos 	 0,			/* bitpos */
   2721   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2722   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2723  1.10  christos 	 "R_MICROMIPS_PC16_S1",	/* name */
   2724   1.1  christos 	 false,			/* partial_inplace */
   2725   1.1  christos 	 0,			/* src_mask */
   2726  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2727   1.1  christos 	 true),			/* pcrel_offset */
   2728   1.1  christos 
   2729   1.1  christos   /* 16 bit call through global offset table.  */
   2730   1.1  christos   HOWTO (R_MICROMIPS_CALL16,	/* type */
   2731  1.10  christos 	 0,			/* rightshift */
   2732   1.1  christos 	 4,			/* size */
   2733  1.10  christos 	 16,			/* bitsize */
   2734   1.1  christos 	 false,			/* pc_relative */
   2735   1.1  christos 	 0,			/* bitpos */
   2736   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2737   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2738  1.10  christos 	 "R_MICROMIPS_CALL16",	/* name */
   2739   1.1  christos 	 false,			/* partial_inplace */
   2740   1.1  christos 	 0,			/* src_mask */
   2741  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2742   1.1  christos 	 false),		/* pcrel_offset */
   2743   1.1  christos 
   2744   1.1  christos   EMPTY_HOWTO (143),
   2745   1.1  christos   EMPTY_HOWTO (144),
   2746   1.1  christos 
   2747   1.1  christos   /* Displacement in the global offset table.  */
   2748   1.1  christos   HOWTO (R_MICROMIPS_GOT_DISP,	/* type */
   2749  1.10  christos 	 0,			/* rightshift */
   2750   1.1  christos 	 4,			/* size */
   2751  1.10  christos 	 16,			/* bitsize */
   2752   1.1  christos 	 false,			/* pc_relative */
   2753   1.1  christos 	 0,			/* bitpos */
   2754   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2755   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2756  1.10  christos 	 "R_MICROMIPS_GOT_DISP",/* name */
   2757   1.1  christos 	 false,			/* partial_inplace */
   2758   1.1  christos 	 0,			/* src_mask */
   2759  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2760   1.1  christos 	 false),		/* pcrel_offset */
   2761   1.1  christos 
   2762   1.1  christos   /* Displacement to page pointer in the global offset table.  */
   2763   1.1  christos   HOWTO (R_MICROMIPS_GOT_PAGE,	/* type */
   2764  1.10  christos 	 0,			/* rightshift */
   2765   1.1  christos 	 4,			/* size */
   2766  1.10  christos 	 16,			/* bitsize */
   2767   1.1  christos 	 false,			/* pc_relative */
   2768   1.1  christos 	 0,			/* bitpos */
   2769   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2770   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2771  1.10  christos 	 "R_MICROMIPS_GOT_PAGE",/* name */
   2772   1.1  christos 	 false,			/* partial_inplace */
   2773   1.1  christos 	 0,			/* src_mask */
   2774  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2775   1.1  christos 	 false),		/* pcrel_offset */
   2776   1.1  christos 
   2777   1.1  christos   /* Offset from page pointer in the global offset table.  */
   2778   1.1  christos   HOWTO (R_MICROMIPS_GOT_OFST,	/* type */
   2779  1.10  christos 	 0,			/* rightshift */
   2780   1.1  christos 	 4,			/* size */
   2781  1.10  christos 	 16,			/* bitsize */
   2782   1.1  christos 	 false,			/* pc_relative */
   2783   1.1  christos 	 0,			/* bitpos */
   2784   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2785   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2786  1.10  christos 	 "R_MICROMIPS_GOT_OFST",/* name */
   2787   1.1  christos 	 false,			/* partial_inplace */
   2788   1.1  christos 	 0,			/* src_mask */
   2789  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2790   1.1  christos 	 false),		/* pcrel_offset */
   2791   1.1  christos 
   2792   1.1  christos   /* High 16 bits of displacement in global offset table.  */
   2793   1.1  christos   HOWTO (R_MICROMIPS_GOT_HI16,	/* type */
   2794  1.10  christos 	 0,			/* rightshift */
   2795   1.1  christos 	 4,			/* size */
   2796  1.10  christos 	 16,			/* bitsize */
   2797   1.1  christos 	 false,			/* pc_relative */
   2798   1.1  christos 	 0,			/* bitpos */
   2799   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2800   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2801  1.10  christos 	 "R_MICROMIPS_GOT_HI16",/* name */
   2802   1.1  christos 	 false,			/* partial_inplace */
   2803   1.1  christos 	 0,			/* src_mask */
   2804  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2805   1.1  christos 	 false),		/* pcrel_offset */
   2806   1.1  christos 
   2807   1.1  christos   /* Low 16 bits of displacement in global offset table.  */
   2808   1.1  christos   HOWTO (R_MICROMIPS_GOT_LO16,	/* type */
   2809  1.10  christos 	 0,			/* rightshift */
   2810   1.1  christos 	 4,			/* size */
   2811  1.10  christos 	 16,			/* bitsize */
   2812   1.1  christos 	 false,			/* pc_relative */
   2813   1.1  christos 	 0,			/* bitpos */
   2814   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2815   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2816  1.10  christos 	 "R_MICROMIPS_GOT_LO16",/* name */
   2817   1.1  christos 	 false,			/* partial_inplace */
   2818   1.1  christos 	 0,			/* src_mask */
   2819  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2820   1.1  christos 	 false),		/* pcrel_offset */
   2821   1.1  christos 
   2822   1.1  christos   /* 64 bit subtraction.  Used in the N32 ABI.  */
   2823   1.1  christos   HOWTO (R_MICROMIPS_SUB,	/* type */
   2824  1.10  christos 	 0,			/* rightshift */
   2825   1.1  christos 	 8,			/* size */
   2826  1.10  christos 	 64,			/* bitsize */
   2827   1.1  christos 	 false,			/* pc_relative */
   2828   1.1  christos 	 0,			/* bitpos */
   2829   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2830   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2831  1.10  christos 	 "R_MICROMIPS_SUB",	/* name */
   2832   1.1  christos 	 false,			/* partial_inplace */
   2833   1.1  christos 	 0,			/* src_mask */
   2834  1.10  christos 	 MINUS_ONE,		/* dst_mask */
   2835   1.1  christos 	 false),		/* pcrel_offset */
   2836   1.1  christos 
   2837   1.1  christos   /* Get the higher value of a 64 bit addend.  */
   2838   1.1  christos   HOWTO (R_MICROMIPS_HIGHER,	/* type */
   2839  1.10  christos 	 0,			/* rightshift */
   2840   1.1  christos 	 4,			/* size */
   2841  1.10  christos 	 16,			/* bitsize */
   2842   1.1  christos 	 false,			/* pc_relative */
   2843   1.1  christos 	 0,			/* bitpos */
   2844   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2845   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2846  1.10  christos 	 "R_MICROMIPS_HIGHER",	/* name */
   2847   1.1  christos 	 false,			/* partial_inplace */
   2848   1.1  christos 	 0,			/* src_mask */
   2849  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2850   1.1  christos 	 false),		/* pcrel_offset */
   2851   1.1  christos 
   2852   1.1  christos   /* Get the highest value of a 64 bit addend.  */
   2853   1.1  christos   HOWTO (R_MICROMIPS_HIGHEST,	/* type */
   2854  1.10  christos 	 0,			/* rightshift */
   2855   1.1  christos 	 4,			/* size */
   2856  1.10  christos 	 16,			/* bitsize */
   2857   1.1  christos 	 false,			/* pc_relative */
   2858   1.1  christos 	 0,			/* bitpos */
   2859   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2860   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2861  1.10  christos 	 "R_MICROMIPS_HIGHEST",	/* name */
   2862   1.1  christos 	 false,			/* partial_inplace */
   2863   1.1  christos 	 0,			/* src_mask */
   2864  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2865   1.1  christos 	 false),		/* pcrel_offset */
   2866   1.1  christos 
   2867   1.1  christos   /* High 16 bits of displacement in global offset table.  */
   2868   1.1  christos   HOWTO (R_MICROMIPS_CALL_HI16,	/* type */
   2869  1.10  christos 	 0,			/* rightshift */
   2870   1.1  christos 	 4,			/* size */
   2871  1.10  christos 	 16,			/* bitsize */
   2872   1.1  christos 	 false,			/* pc_relative */
   2873   1.1  christos 	 0,			/* bitpos */
   2874   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2875   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2876  1.10  christos 	 "R_MICROMIPS_CALL_HI16",/* name */
   2877   1.1  christos 	 false,			/* partial_inplace */
   2878   1.1  christos 	 0,			/* src_mask */
   2879  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2880   1.1  christos 	 false),		/* pcrel_offset */
   2881   1.1  christos 
   2882   1.1  christos   /* Low 16 bits of displacement in global offset table.  */
   2883   1.1  christos   HOWTO (R_MICROMIPS_CALL_LO16,	/* type */
   2884  1.10  christos 	 0,			/* rightshift */
   2885   1.1  christos 	 4,			/* size */
   2886  1.10  christos 	 16,			/* bitsize */
   2887   1.1  christos 	 false,			/* pc_relative */
   2888   1.1  christos 	 0,			/* bitpos */
   2889   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2890   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2891  1.10  christos 	 "R_MICROMIPS_CALL_LO16",/* name */
   2892   1.1  christos 	 false,			/* partial_inplace */
   2893   1.1  christos 	 0,			/* src_mask */
   2894  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2895   1.1  christos 	 false),		/* pcrel_offset */
   2896   1.1  christos 
   2897   1.1  christos   /* Section displacement.  */
   2898   1.1  christos   HOWTO (R_MICROMIPS_SCN_DISP,  /* type */
   2899  1.10  christos 	 0,			/* rightshift */
   2900   1.1  christos 	 4,			/* size */
   2901  1.10  christos 	 32,			/* bitsize */
   2902   1.1  christos 	 false,			/* pc_relative */
   2903   1.1  christos 	 0,			/* bitpos */
   2904   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2905   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2906  1.10  christos 	 "R_MICROMIPS_SCN_DISP", /* name */
   2907   1.1  christos 	 false,			/* partial_inplace */
   2908   1.1  christos 	 0,			/* src_mask */
   2909  1.10  christos 	 0xffffffff,		/* dst_mask */
   2910   1.1  christos 	 false),		/* pcrel_offset */
   2911   1.1  christos 
   2912   1.1  christos   /* Protected jump conversion.  This is an optimization hint.  No
   2913   1.1  christos      relocation is required for correctness.  */
   2914   1.1  christos   HOWTO (R_MICROMIPS_JALR,	/* type */
   2915  1.10  christos 	 0,			/* rightshift */
   2916   1.1  christos 	 4,			/* size */
   2917  1.10  christos 	 32,			/* bitsize */
   2918   1.1  christos 	 false,			/* pc_relative */
   2919   1.1  christos 	 0,			/* bitpos */
   2920   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2921   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2922  1.10  christos 	 "R_MICROMIPS_JALR",	/* name */
   2923   1.1  christos 	 false,			/* partial_inplace */
   2924   1.1  christos 	 0,			/* src_mask */
   2925  1.10  christos 	 0x00000000,		/* dst_mask */
   2926   1.8  christos 	 false),		/* pcrel_offset */
   2927   1.8  christos 
   2928   1.8  christos   /* Low 16 bits of symbol value.  Note that the high 16 bits of symbol values
   2929   1.8  christos      must be zero.  This is used for relaxation.  */
   2930   1.8  christos   HOWTO (R_MICROMIPS_HI0_LO16,	/* type */
   2931  1.10  christos 	 0,			/* rightshift */
   2932   1.8  christos 	 4,			/* size */
   2933  1.10  christos 	 16,			/* bitsize */
   2934   1.8  christos 	 false,			/* pc_relative */
   2935   1.8  christos 	 0,			/* bitpos */
   2936   1.8  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2937   1.8  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2938  1.10  christos 	 "R_MICROMIPS_HI0_LO16",/* name */
   2939   1.8  christos 	 false,			/* partial_inplace */
   2940   1.8  christos 	 0,			/* src_mask */
   2941  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2942   1.8  christos 	 false),		/* pcrel_offset */
   2943   1.8  christos 
   2944   1.8  christos   EMPTY_HOWTO (158),
   2945   1.8  christos   EMPTY_HOWTO (159),
   2946   1.8  christos   EMPTY_HOWTO (160),
   2947   1.8  christos   EMPTY_HOWTO (161),
   2948   1.8  christos 
   2949   1.8  christos   /* TLS general dynamic variable reference.  */
   2950   1.8  christos   HOWTO (R_MICROMIPS_TLS_GD,		/* type */
   2951  1.10  christos 	 0,			/* rightshift */
   2952   1.8  christos 	 4,			/* size */
   2953  1.10  christos 	 16,			/* bitsize */
   2954   1.8  christos 	 false,			/* pc_relative */
   2955   1.8  christos 	 0,			/* bitpos */
   2956   1.8  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2957   1.8  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2958  1.10  christos 	 "R_MICROMIPS_TLS_GD",	/* name */
   2959   1.8  christos 	 false,			/* partial_inplace */
   2960   1.8  christos 	 0,			/* src_mask */
   2961  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2962   1.8  christos 	 false),		/* pcrel_offset */
   2963   1.8  christos 
   2964   1.8  christos   /* TLS local dynamic variable reference.  */
   2965   1.8  christos   HOWTO (R_MICROMIPS_TLS_LDM,	/* type */
   2966  1.10  christos 	 0,			/* rightshift */
   2967   1.8  christos 	 4,			/* size */
   2968  1.10  christos 	 16,			/* bitsize */
   2969   1.8  christos 	 false,			/* pc_relative */
   2970   1.8  christos 	 0,			/* bitpos */
   2971   1.8  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2972   1.8  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2973  1.10  christos 	 "R_MICROMIPS_TLS_LDM",	/* name */
   2974   1.8  christos 	 false,			/* partial_inplace */
   2975   1.8  christos 	 0,			/* src_mask */
   2976  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2977   1.8  christos 	 false),		/* pcrel_offset */
   2978   1.8  christos 
   2979   1.8  christos   /* TLS local dynamic offset.  */
   2980   1.8  christos   HOWTO (R_MICROMIPS_TLS_DTPREL_HI16,	/* type */
   2981  1.10  christos 	 0,			/* rightshift */
   2982   1.8  christos 	 4,			/* size */
   2983  1.10  christos 	 16,			/* bitsize */
   2984   1.8  christos 	 false,			/* pc_relative */
   2985   1.8  christos 	 0,			/* bitpos */
   2986   1.8  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2987   1.8  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2988  1.10  christos 	 "R_MICROMIPS_TLS_DTPREL_HI16",	/* name */
   2989   1.8  christos 	 false,			/* partial_inplace */
   2990   1.8  christos 	 0,			/* src_mask */
   2991  1.10  christos 	 0x0000ffff,		/* dst_mask */
   2992   1.8  christos 	 false),		/* pcrel_offset */
   2993   1.8  christos 
   2994   1.8  christos   /* TLS local dynamic offset.  */
   2995   1.8  christos   HOWTO (R_MICROMIPS_TLS_DTPREL_LO16,	/* type */
   2996  1.10  christos 	 0,			/* rightshift */
   2997   1.8  christos 	 4,			/* size */
   2998  1.10  christos 	 16,			/* bitsize */
   2999   1.8  christos 	 false,			/* pc_relative */
   3000   1.8  christos 	 0,			/* bitpos */
   3001   1.8  christos 	 complain_overflow_signed, /* complain_on_overflow */
   3002   1.8  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   3003  1.10  christos 	 "R_MICROMIPS_TLS_DTPREL_LO16",	/* name */
   3004   1.8  christos 	 false,			/* partial_inplace */
   3005   1.8  christos 	 0,			/* src_mask */
   3006  1.10  christos 	 0x0000ffff,		/* dst_mask */
   3007   1.8  christos 	 false),		/* pcrel_offset */
   3008   1.8  christos 
   3009   1.8  christos   /* TLS thread pointer offset.  */
   3010   1.8  christos   HOWTO (R_MICROMIPS_TLS_GOTTPREL,	/* type */
   3011  1.10  christos 	 0,			/* rightshift */
   3012   1.8  christos 	 4,			/* size */
   3013  1.10  christos 	 16,			/* bitsize */
   3014   1.8  christos 	 false,			/* pc_relative */
   3015   1.8  christos 	 0,			/* bitpos */
   3016   1.8  christos 	 complain_overflow_signed, /* complain_on_overflow */
   3017   1.8  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   3018  1.10  christos 	 "R_MICROMIPS_TLS_GOTTPREL",	/* name */
   3019   1.8  christos 	 false,			/* partial_inplace */
   3020   1.8  christos 	 0,			/* src_mask */
   3021  1.10  christos 	 0x0000ffff,		/* dst_mask */
   3022   1.8  christos 	 false),		/* pcrel_offset */
   3023   1.8  christos 
   3024   1.8  christos   EMPTY_HOWTO (167),
   3025   1.8  christos   EMPTY_HOWTO (168),
   3026   1.8  christos 
   3027   1.8  christos   /* TLS thread pointer offset.  */
   3028   1.8  christos   HOWTO (R_MICROMIPS_TLS_TPREL_HI16,	/* type */
   3029  1.10  christos 	 0,			/* rightshift */
   3030   1.8  christos 	 4,			/* size */
   3031  1.10  christos 	 16,			/* bitsize */
   3032   1.8  christos 	 false,			/* pc_relative */
   3033   1.8  christos 	 0,			/* bitpos */
   3034   1.8  christos 	 complain_overflow_signed, /* complain_on_overflow */
   3035   1.8  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   3036  1.10  christos 	 "R_MICROMIPS_TLS_TPREL_HI16", /* name */
   3037   1.8  christos 	 false,			/* partial_inplace */
   3038   1.8  christos 	 0,			/* src_mask */
   3039  1.10  christos 	 0x0000ffff,		/* dst_mask */
   3040   1.8  christos 	 false),		/* pcrel_offset */
   3041   1.8  christos 
   3042   1.8  christos   /* TLS thread pointer offset.  */
   3043   1.8  christos   HOWTO (R_MICROMIPS_TLS_TPREL_LO16,	/* type */
   3044  1.10  christos 	 0,			/* rightshift */
   3045   1.8  christos 	 4,			/* size */
   3046  1.10  christos 	 16,			/* bitsize */
   3047   1.8  christos 	 false,			/* pc_relative */
   3048   1.8  christos 	 0,			/* bitpos */
   3049   1.8  christos 	 complain_overflow_signed, /* complain_on_overflow */
   3050   1.8  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   3051  1.10  christos 	 "R_MICROMIPS_TLS_TPREL_LO16", /* name */
   3052   1.8  christos 	 false,			/* partial_inplace */
   3053   1.8  christos 	 0,			/* src_mask */
   3054  1.10  christos 	 0x0000ffff,		/* dst_mask */
   3055   1.8  christos 	 false),		/* pcrel_offset */
   3056   1.8  christos 
   3057   1.8  christos   EMPTY_HOWTO (171),
   3058   1.8  christos 
   3059   1.8  christos   /* GP- and PC-relative relocations.  */
   3060   1.8  christos   HOWTO (R_MICROMIPS_GPREL7_S2,	/* type */
   3061  1.10  christos 	 2,			/* rightshift */
   3062   1.8  christos 	 2,			/* size */
   3063  1.10  christos 	 7,			/* bitsize */
   3064   1.8  christos 	 false,			/* pc_relative */
   3065   1.8  christos 	 0,			/* bitpos */
   3066   1.8  christos 	 complain_overflow_signed, /* complain_on_overflow */
   3067   1.8  christos 	 _bfd_mips_elf32_gprel16_reloc, /* special_function */
   3068  1.10  christos 	 "R_MICROMIPS_GPREL7_S2",	/* name */
   3069   1.8  christos 	 false,			/* partial_inplace */
   3070   1.8  christos 	 0,			/* src_mask */
   3071  1.10  christos 	 0x0000007f,		/* dst_mask */
   3072   1.8  christos 	 false),		/* pcrel_offset */
   3073   1.8  christos 
   3074   1.8  christos   HOWTO (R_MICROMIPS_PC23_S2,	/* type */
   3075  1.10  christos 	 2,			/* rightshift */
   3076   1.8  christos 	 4,			/* size */
   3077  1.10  christos 	 23,			/* bitsize */
   3078   1.8  christos 	 true,			/* pc_relative */
   3079   1.8  christos 	 0,			/* bitpos */
   3080   1.8  christos 	 complain_overflow_signed, /* complain_on_overflow */
   3081   1.8  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   3082  1.10  christos 	 "R_MICROMIPS_PC23_S2",	/* name */
   3083   1.8  christos 	 false,			/* partial_inplace */
   3084   1.8  christos 	 0,			/* src_mask */
   3085  1.10  christos 	 0x007fffff,		/* dst_mask */
   3086   1.1  christos 	 true),			/* pcrel_offset */
   3087   1.1  christos };
   3088   1.1  christos 
   3089   1.1  christos /* GNU extension to record C++ vtable hierarchy */
   3090   1.1  christos static reloc_howto_type elf_mips_gnu_vtinherit_howto =
   3091   1.1  christos   HOWTO (R_MIPS_GNU_VTINHERIT,	/* type */
   3092  1.10  christos 	 0,			/* rightshift */
   3093   1.1  christos 	 4,			/* size */
   3094  1.10  christos 	 0,			/* bitsize */
   3095   1.1  christos 	 false,			/* pc_relative */
   3096   1.1  christos 	 0,			/* bitpos */
   3097   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   3098   1.1  christos 	 NULL,			/* special_function */
   3099  1.10  christos 	 "R_MIPS_GNU_VTINHERIT", /* name */
   3100   1.1  christos 	 false,			/* partial_inplace */
   3101   1.1  christos 	 0,			/* src_mask */
   3102  1.10  christos 	 0,			/* dst_mask */
   3103   1.1  christos 	 false);		/* pcrel_offset */
   3104   1.1  christos 
   3105   1.1  christos /* GNU extension to record C++ vtable member usage */
   3106   1.1  christos static reloc_howto_type elf_mips_gnu_vtentry_howto =
   3107   1.1  christos   HOWTO (R_MIPS_GNU_VTENTRY,	/* type */
   3108  1.10  christos 	 0,			/* rightshift */
   3109   1.1  christos 	 4,			/* size */
   3110  1.10  christos 	 0,			/* bitsize */
   3111   1.1  christos 	 false,			/* pc_relative */
   3112   1.1  christos 	 0,			/* bitpos */
   3113   1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   3114   1.1  christos 	 _bfd_elf_rel_vtable_reloc_fn, /* special_function */
   3115  1.10  christos 	 "R_MIPS_GNU_VTENTRY",	/* name */
   3116   1.1  christos 	 false,			/* partial_inplace */
   3117   1.1  christos 	 0,			/* src_mask */
   3118  1.10  christos 	 0,			/* dst_mask */
   3119   1.1  christos 	 false);		/* pcrel_offset */
   3120   1.1  christos 
   3121   1.1  christos /* 16 bit offset for pc-relative branches.  */
   3123   1.1  christos static reloc_howto_type elf_mips_gnu_rel16_s2 =
   3124  1.10  christos   HOWTO (R_MIPS_GNU_REL16_S2,	/* type */
   3125   1.1  christos 	 2,			/* rightshift */
   3126  1.10  christos 	 4,			/* size */
   3127   1.1  christos 	 16,			/* bitsize */
   3128   1.1  christos 	 true,			/* pc_relative */
   3129   1.1  christos 	 0,			/* bitpos */
   3130   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   3131  1.10  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
   3132   1.1  christos 	 "R_MIPS_GNU_REL16_S2",	/* name */
   3133   1.1  christos 	 true,			/* partial_inplace */
   3134  1.10  christos 	 0x0000ffff,		/* src_mask */
   3135   1.1  christos 	 0x0000ffff,		/* dst_mask */
   3136   1.1  christos 	 true);			/* pcrel_offset */
   3137   1.1  christos 
   3138   1.1  christos /* 16 bit offset for pc-relative branches.  */
   3139   1.1  christos static reloc_howto_type elf_mips_gnu_rela16_s2 =
   3140  1.10  christos   HOWTO (R_MIPS_GNU_REL16_S2,	/* type */
   3141   1.1  christos 	 2,			/* rightshift */
   3142  1.10  christos 	 4,			/* size */
   3143   1.1  christos 	 16,			/* bitsize */
   3144   1.1  christos 	 true,			/* pc_relative */
   3145   1.1  christos 	 0,			/* bitpos */
   3146   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   3147  1.10  christos 	 _bfd_mips_elf_generic_reloc,	/* special_function */
   3148   1.1  christos 	 "R_MIPS_GNU_REL16_S2",	/* name */
   3149   1.1  christos 	 false,			/* partial_inplace */
   3150  1.10  christos 	 0,			/* src_mask */
   3151   1.1  christos 	 0x0000ffff,		/* dst_mask */
   3152   1.1  christos 	 true);			/* pcrel_offset */
   3153   1.1  christos 
   3154   1.1  christos /* 32 bit pc-relative.  Used for compact EH tables.  */
   3155   1.1  christos static reloc_howto_type elf_mips_gnu_pcrel32 =
   3156  1.10  christos   HOWTO (R_MIPS_PC32,		/* type */
   3157   1.1  christos 	 0,			/* rightshift */
   3158  1.10  christos 	 4,			/* size */
   3159   1.1  christos 	 32,			/* bitsize */
   3160   1.1  christos 	 true,			/* pc_relative */
   3161   1.1  christos 	 0,			/* bitpos */
   3162   1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   3163  1.10  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   3164   1.1  christos 	 "R_MIPS_PC32",		/* name */
   3165   1.1  christos 	 true,			/* partial_inplace */
   3166  1.10  christos 	 0xffffffff,		/* src_mask */
   3167   1.1  christos 	 0xffffffff,		/* dst_mask */
   3168   1.1  christos 	 true);			/* pcrel_offset */
   3169   1.1  christos 
   3170   1.1  christos 
   3171   1.1  christos /* Originally a VxWorks extension, but now used for other systems too.  */
   3173   1.1  christos static reloc_howto_type elf_mips_copy_howto =
   3174   1.1  christos   HOWTO (R_MIPS_COPY,		/* type */
   3175  1.10  christos 	 0,			/* rightshift */
   3176   1.1  christos 	 0,			/* this one is variable size */
   3177   1.1  christos 	 0,			/* bitsize */
   3178   1.1  christos 	 false,			/* pc_relative */
   3179   1.1  christos 	 0,			/* bitpos */
   3180  1.10  christos 	 complain_overflow_bitfield, /* complain_on_overflow */
   3181   1.8  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   3182   1.8  christos 	 "R_MIPS_COPY",		/* name */
   3183  1.10  christos 	 false,			/* partial_inplace */
   3184   1.1  christos 	 0x0,			/* src_mask */
   3185   1.1  christos 	 0x0,			/* dst_mask */
   3186   1.1  christos 	 false);		/* pcrel_offset */
   3187   1.1  christos 
   3188   1.1  christos /* Originally a VxWorks extension, but now used for other systems too.  */
   3189  1.10  christos static reloc_howto_type elf_mips_jump_slot_howto =
   3190   1.1  christos   HOWTO (R_MIPS_JUMP_SLOT,	/* type */
   3191  1.10  christos 	 0,			/* rightshift */
   3192   1.1  christos 	 8,			/* size */
   3193   1.1  christos 	 64,			/* bitsize */
   3194   1.1  christos 	 false,			/* pc_relative */
   3195   1.1  christos 	 0,			/* bitpos */
   3196  1.10  christos 	 complain_overflow_bitfield, /* complain_on_overflow */
   3197   1.8  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   3198   1.8  christos 	 "R_MIPS_JUMP_SLOT",	/* name */
   3199  1.10  christos 	 false,			/* partial_inplace */
   3200   1.1  christos 	 0x0,			/* src_mask */
   3201   1.1  christos 	 0x0,			/* dst_mask */
   3202   1.1  christos 	 false);		/* pcrel_offset */
   3203   1.1  christos 
   3204   1.1  christos /* Used in EH tables.  */
   3205  1.10  christos static reloc_howto_type elf_mips_eh_howto =
   3206   1.1  christos   HOWTO (R_MIPS_EH,		/* type */
   3207  1.10  christos 	 0,			/* rightshift */
   3208   1.1  christos 	 4,			/* size */
   3209   1.1  christos 	 32,			/* bitsize */
   3210   1.1  christos 	 false,			/* pc_relative */
   3211   1.1  christos 	 0,			/* bitpos */
   3212  1.10  christos 	 complain_overflow_signed, /* complain_on_overflow */
   3213   1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   3214   1.8  christos 	 "R_MIPS_EH",		/* name */
   3215  1.10  christos 	 true,			/* partial_inplace */
   3216   1.1  christos 	 0xffffffff,		/* src_mask */
   3217   1.1  christos 	 0xffffffff,		/* dst_mask */
   3218   1.1  christos 	 false);		/* pcrel_offset */
   3219   1.1  christos 
   3220   1.1  christos 
   3221   1.1  christos /* Swap in a MIPS 64-bit Rel reloc.  */
   3223   1.1  christos 
   3224   1.1  christos static void
   3225   1.1  christos mips_elf64_swap_reloc_in (bfd *abfd, const Elf64_Mips_External_Rel *src,
   3226   1.1  christos 			  Elf64_Mips_Internal_Rela *dst)
   3227   1.1  christos {
   3228   1.1  christos   dst->r_offset = H_GET_64 (abfd, src->r_offset);
   3229   1.1  christos   dst->r_sym = H_GET_32 (abfd, src->r_sym);
   3230   1.1  christos   dst->r_ssym = H_GET_8 (abfd, src->r_ssym);
   3231   1.1  christos   dst->r_type3 = H_GET_8 (abfd, src->r_type3);
   3232   1.1  christos   dst->r_type2 = H_GET_8 (abfd, src->r_type2);
   3233   1.1  christos   dst->r_type = H_GET_8 (abfd, src->r_type);
   3234   1.1  christos   dst->r_addend = 0;
   3235   1.1  christos }
   3236   1.1  christos 
   3237   1.1  christos /* Swap in a MIPS 64-bit Rela reloc.  */
   3238   1.1  christos 
   3239   1.1  christos static void
   3240   1.1  christos mips_elf64_swap_reloca_in (bfd *abfd, const Elf64_Mips_External_Rela *src,
   3241   1.1  christos 			   Elf64_Mips_Internal_Rela *dst)
   3242   1.1  christos {
   3243   1.1  christos   dst->r_offset = H_GET_64 (abfd, src->r_offset);
   3244   1.1  christos   dst->r_sym = H_GET_32 (abfd, src->r_sym);
   3245   1.1  christos   dst->r_ssym = H_GET_8 (abfd, src->r_ssym);
   3246   1.1  christos   dst->r_type3 = H_GET_8 (abfd, src->r_type3);
   3247   1.1  christos   dst->r_type2 = H_GET_8 (abfd, src->r_type2);
   3248   1.1  christos   dst->r_type = H_GET_8 (abfd, src->r_type);
   3249   1.1  christos   dst->r_addend = H_GET_S64 (abfd, src->r_addend);
   3250   1.1  christos }
   3251   1.1  christos 
   3252   1.1  christos /* Swap out a MIPS 64-bit Rel reloc.  */
   3253   1.1  christos 
   3254   1.1  christos static void
   3255   1.1  christos mips_elf64_swap_reloc_out (bfd *abfd, const Elf64_Mips_Internal_Rela *src,
   3256   1.1  christos 			   Elf64_Mips_External_Rel *dst)
   3257   1.1  christos {
   3258   1.1  christos   H_PUT_64 (abfd, src->r_offset, dst->r_offset);
   3259   1.1  christos   H_PUT_32 (abfd, src->r_sym, dst->r_sym);
   3260   1.1  christos   H_PUT_8 (abfd, src->r_ssym, dst->r_ssym);
   3261   1.1  christos   H_PUT_8 (abfd, src->r_type3, dst->r_type3);
   3262   1.1  christos   H_PUT_8 (abfd, src->r_type2, dst->r_type2);
   3263   1.1  christos   H_PUT_8 (abfd, src->r_type, dst->r_type);
   3264   1.1  christos }
   3265   1.1  christos 
   3266   1.1  christos /* Swap out a MIPS 64-bit Rela reloc.  */
   3267   1.1  christos 
   3268   1.1  christos static void
   3269   1.1  christos mips_elf64_swap_reloca_out (bfd *abfd, const Elf64_Mips_Internal_Rela *src,
   3270   1.1  christos 			    Elf64_Mips_External_Rela *dst)
   3271   1.1  christos {
   3272   1.1  christos   H_PUT_64 (abfd, src->r_offset, dst->r_offset);
   3273   1.1  christos   H_PUT_32 (abfd, src->r_sym, dst->r_sym);
   3274   1.1  christos   H_PUT_8 (abfd, src->r_ssym, dst->r_ssym);
   3275   1.1  christos   H_PUT_8 (abfd, src->r_type3, dst->r_type3);
   3276   1.1  christos   H_PUT_8 (abfd, src->r_type2, dst->r_type2);
   3277   1.1  christos   H_PUT_8 (abfd, src->r_type, dst->r_type);
   3278   1.1  christos   H_PUT_S64 (abfd, src->r_addend, dst->r_addend);
   3279   1.1  christos }
   3280   1.1  christos 
   3281   1.1  christos /* Swap in a MIPS 64-bit Rel reloc.  */
   3282   1.1  christos 
   3283   1.1  christos static void
   3284   1.1  christos mips_elf64_be_swap_reloc_in (bfd *abfd, const bfd_byte *src,
   3285   1.1  christos 			     Elf_Internal_Rela *dst)
   3286   1.1  christos {
   3287   1.1  christos   Elf64_Mips_Internal_Rela mirel;
   3288   1.1  christos 
   3289   1.1  christos   mips_elf64_swap_reloc_in (abfd,
   3290   1.1  christos 			    (const Elf64_Mips_External_Rel *) src,
   3291   1.1  christos 			    &mirel);
   3292   1.1  christos 
   3293   1.1  christos   dst[0].r_offset = mirel.r_offset;
   3294   1.1  christos   dst[0].r_info = ELF64_R_INFO (mirel.r_sym, mirel.r_type);
   3295   1.1  christos   dst[0].r_addend = 0;
   3296   1.1  christos   dst[1].r_offset = mirel.r_offset;
   3297   1.1  christos   dst[1].r_info = ELF64_R_INFO (mirel.r_ssym, mirel.r_type2);
   3298   1.1  christos   dst[1].r_addend = 0;
   3299   1.1  christos   dst[2].r_offset = mirel.r_offset;
   3300   1.1  christos   dst[2].r_info = ELF64_R_INFO (STN_UNDEF, mirel.r_type3);
   3301   1.1  christos   dst[2].r_addend = 0;
   3302   1.1  christos }
   3303   1.1  christos 
   3304   1.1  christos /* Swap in a MIPS 64-bit Rela reloc.  */
   3305   1.1  christos 
   3306   1.1  christos static void
   3307   1.1  christos mips_elf64_be_swap_reloca_in (bfd *abfd, const bfd_byte *src,
   3308   1.1  christos 			      Elf_Internal_Rela *dst)
   3309   1.1  christos {
   3310   1.1  christos   Elf64_Mips_Internal_Rela mirela;
   3311   1.1  christos 
   3312   1.1  christos   mips_elf64_swap_reloca_in (abfd,
   3313   1.1  christos 			     (const Elf64_Mips_External_Rela *) src,
   3314   1.1  christos 			     &mirela);
   3315   1.1  christos 
   3316   1.1  christos   dst[0].r_offset = mirela.r_offset;
   3317   1.1  christos   dst[0].r_info = ELF64_R_INFO (mirela.r_sym, mirela.r_type);
   3318   1.1  christos   dst[0].r_addend = mirela.r_addend;
   3319   1.1  christos   dst[1].r_offset = mirela.r_offset;
   3320   1.1  christos   dst[1].r_info = ELF64_R_INFO (mirela.r_ssym, mirela.r_type2);
   3321   1.1  christos   dst[1].r_addend = 0;
   3322   1.1  christos   dst[2].r_offset = mirela.r_offset;
   3323   1.1  christos   dst[2].r_info = ELF64_R_INFO (STN_UNDEF, mirela.r_type3);
   3324   1.1  christos   dst[2].r_addend = 0;
   3325   1.1  christos }
   3326   1.1  christos 
   3327   1.1  christos /* Swap out a MIPS 64-bit Rel reloc.  */
   3328   1.1  christos 
   3329   1.1  christos static void
   3330   1.1  christos mips_elf64_be_swap_reloc_out (bfd *abfd, const Elf_Internal_Rela *src,
   3331   1.1  christos 			      bfd_byte *dst)
   3332   1.1  christos {
   3333   1.1  christos   Elf64_Mips_Internal_Rela mirel;
   3334   1.1  christos 
   3335   1.1  christos   mirel.r_offset = src[0].r_offset;
   3336   1.1  christos   BFD_ASSERT(src[0].r_offset == src[1].r_offset);
   3337   1.1  christos   BFD_ASSERT(src[0].r_offset == src[2].r_offset);
   3338   1.1  christos 
   3339   1.1  christos   mirel.r_type = ELF64_MIPS_R_TYPE (src[0].r_info);
   3340   1.1  christos   mirel.r_sym = ELF64_R_SYM (src[0].r_info);
   3341   1.1  christos   mirel.r_type2 = ELF64_MIPS_R_TYPE (src[1].r_info);
   3342   1.1  christos   mirel.r_ssym = ELF64_MIPS_R_SSYM (src[1].r_info);
   3343   1.1  christos   mirel.r_type3 = ELF64_MIPS_R_TYPE (src[2].r_info);
   3344   1.1  christos 
   3345   1.1  christos   mips_elf64_swap_reloc_out (abfd, &mirel,
   3346   1.1  christos 			     (Elf64_Mips_External_Rel *) dst);
   3347   1.1  christos }
   3348   1.1  christos 
   3349   1.1  christos /* Swap out a MIPS 64-bit Rela reloc.  */
   3350   1.1  christos 
   3351   1.1  christos static void
   3352   1.1  christos mips_elf64_be_swap_reloca_out (bfd *abfd, const Elf_Internal_Rela *src,
   3353   1.1  christos 			       bfd_byte *dst)
   3354   1.1  christos {
   3355   1.1  christos   Elf64_Mips_Internal_Rela mirela;
   3356   1.1  christos 
   3357   1.1  christos   mirela.r_offset = src[0].r_offset;
   3358   1.1  christos   BFD_ASSERT(src[0].r_offset == src[1].r_offset);
   3359   1.1  christos   BFD_ASSERT(src[0].r_offset == src[2].r_offset);
   3360   1.1  christos 
   3361   1.1  christos   mirela.r_type = ELF64_MIPS_R_TYPE (src[0].r_info);
   3362   1.1  christos   mirela.r_sym = ELF64_R_SYM (src[0].r_info);
   3363   1.1  christos   mirela.r_addend = src[0].r_addend;
   3364   1.1  christos   BFD_ASSERT(src[1].r_addend == 0);
   3365   1.1  christos   BFD_ASSERT(src[2].r_addend == 0);
   3366   1.1  christos 
   3367   1.1  christos   mirela.r_type2 = ELF64_MIPS_R_TYPE (src[1].r_info);
   3368   1.1  christos   mirela.r_ssym = ELF64_MIPS_R_SSYM (src[1].r_info);
   3369   1.1  christos   mirela.r_type3 = ELF64_MIPS_R_TYPE (src[2].r_info);
   3370   1.1  christos 
   3371   1.1  christos   mips_elf64_swap_reloca_out (abfd, &mirela,
   3372   1.1  christos 			      (Elf64_Mips_External_Rela *) dst);
   3373   1.1  christos }
   3374  1.10  christos 
   3375   1.1  christos /* Set the GP value for OUTPUT_BFD.  Returns FALSE if this is a
   3377   1.1  christos    dangerous relocation.  */
   3378   1.1  christos 
   3379   1.1  christos static bool
   3380   1.1  christos mips_elf64_assign_gp (bfd *output_bfd, bfd_vma *pgp)
   3381   1.1  christos {
   3382   1.1  christos   unsigned int count;
   3383   1.1  christos   asymbol **sym;
   3384  1.10  christos   unsigned int i;
   3385   1.1  christos 
   3386   1.1  christos   /* If we've already figured out what GP will be, just return it.  */
   3387   1.1  christos   *pgp = _bfd_get_gp_value (output_bfd);
   3388   1.1  christos   if (*pgp)
   3389   1.1  christos     return true;
   3390   1.1  christos 
   3391   1.1  christos   count = bfd_get_symcount (output_bfd);
   3392   1.1  christos   sym = bfd_get_outsymbols (output_bfd);
   3393   1.1  christos 
   3394   1.1  christos   /* The linker script will have created a symbol named `_gp' with the
   3395   1.1  christos      appropriate value.  */
   3396   1.1  christos   if (sym == NULL)
   3397   1.1  christos     i = count;
   3398   1.1  christos   else
   3399   1.1  christos     {
   3400   1.1  christos       for (i = 0; i < count; i++, sym++)
   3401   1.1  christos 	{
   3402   1.1  christos 	  register const char *name;
   3403   1.1  christos 
   3404   1.1  christos 	  name = bfd_asymbol_name (*sym);
   3405   1.1  christos 	  if (*name == '_' && strcmp (name, "_gp") == 0)
   3406   1.1  christos 	    {
   3407   1.1  christos 	      *pgp = bfd_asymbol_value (*sym);
   3408   1.1  christos 	      _bfd_set_gp_value (output_bfd, *pgp);
   3409   1.1  christos 	      break;
   3410   1.1  christos 	    }
   3411   1.1  christos 	}
   3412   1.1  christos     }
   3413   1.1  christos 
   3414  1.10  christos   if (i >= count)
   3415   1.1  christos     {
   3416   1.1  christos       /* Only get the error once.  */
   3417  1.10  christos       *pgp = 4;
   3418   1.1  christos       _bfd_set_gp_value (output_bfd, *pgp);
   3419   1.1  christos       return false;
   3420   1.1  christos     }
   3421   1.1  christos 
   3422   1.1  christos   return true;
   3423   1.1  christos }
   3424   1.1  christos 
   3425   1.1  christos /* We have to figure out the gp value, so that we can adjust the
   3426   1.1  christos    symbol value correctly.  We look up the symbol _gp in the output
   3427  1.10  christos    BFD.  If we can't find it, we're stuck.  We cache it in the ELF
   3428   1.1  christos    target data.  We don't need to adjust the symbol value for an
   3429   1.1  christos    external symbol if we are producing relocatable output.  */
   3430  1.10  christos 
   3431   1.1  christos static bfd_reloc_status_type
   3432   1.1  christos mips_elf64_final_gp (bfd *output_bfd, asymbol *symbol, bool relocatable,
   3433   1.1  christos 		     char **error_message, bfd_vma *pgp)
   3434   1.1  christos {
   3435   1.1  christos   if (output_bfd == NULL)
   3436   1.1  christos     {
   3437   1.1  christos       *pgp = 0;
   3438   1.1  christos       return bfd_reloc_undefined;
   3439   1.1  christos     }
   3440   1.1  christos 
   3441   1.1  christos   *pgp = _bfd_get_gp_value (output_bfd);
   3442   1.1  christos   if (*pgp == 0
   3443   1.1  christos       && (! relocatable
   3444   1.1  christos 	  || (symbol->flags & BSF_SECTION_SYM) != 0))
   3445   1.1  christos     {
   3446   1.1  christos       if (relocatable)
   3447   1.1  christos 	{
   3448   1.1  christos 	  /* Make up a value.  */
   3449   1.1  christos 	  *pgp = symbol->section->output_section->vma /*+ 0x4000*/;
   3450   1.1  christos 	  _bfd_set_gp_value (output_bfd, *pgp);
   3451   1.1  christos 	}
   3452   1.1  christos       else if (!mips_elf64_assign_gp (output_bfd, pgp))
   3453   1.1  christos 	{
   3454   1.1  christos 	  *error_message =
   3455   1.1  christos 	    (char *) _("GP relative relocation when _gp not defined");
   3456   1.1  christos 	  return bfd_reloc_dangerous;
   3457   1.1  christos 	}
   3458   1.1  christos     }
   3459   1.1  christos 
   3460   1.1  christos   return bfd_reloc_ok;
   3461   1.1  christos }
   3462   1.1  christos 
   3463   1.1  christos /* Do a R_MIPS_GPREL16 relocation.  This is a 16 bit value which must
   3464   1.1  christos    become the offset from the gp register.  */
   3465   1.1  christos 
   3466  1.10  christos static bfd_reloc_status_type
   3467   1.1  christos mips_elf64_gprel16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
   3468   1.1  christos 			  void *data, asection *input_section, bfd *output_bfd,
   3469   1.1  christos 			  char **error_message)
   3470   1.1  christos {
   3471   1.1  christos   bool relocatable;
   3472   1.1  christos   bfd_reloc_status_type ret;
   3473   1.1  christos   bfd_vma gp;
   3474   1.1  christos 
   3475   1.1  christos   /* If we're relocating, and this is an external symbol, we don't want
   3476   1.1  christos      to change anything.  */
   3477   1.1  christos   if (output_bfd != NULL
   3478   1.1  christos       && (symbol->flags & BSF_SECTION_SYM) == 0
   3479   1.1  christos       && (symbol->flags & BSF_LOCAL) != 0)
   3480   1.1  christos     {
   3481  1.10  christos       reloc_entry->address += input_section->output_offset;
   3482   1.1  christos       return bfd_reloc_ok;
   3483   1.1  christos     }
   3484  1.10  christos 
   3485  1.10  christos   if (output_bfd != NULL)
   3486   1.1  christos     relocatable = true;
   3487   1.1  christos   else
   3488   1.1  christos     {
   3489   1.1  christos       relocatable = false;
   3490   1.1  christos       output_bfd = input_section->output_section->owner;
   3491   1.1  christos     }
   3492   1.1  christos 
   3493   1.1  christos   ret = mips_elf64_final_gp (output_bfd, symbol, relocatable, error_message,
   3494   1.1  christos 			     &gp);
   3495   1.1  christos   if (ret != bfd_reloc_ok)
   3496   1.1  christos     return ret;
   3497   1.1  christos 
   3498   1.1  christos   return _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
   3499   1.1  christos 					input_section, relocatable,
   3500   1.1  christos 					data, gp);
   3501   1.1  christos }
   3502   1.1  christos 
   3503   1.1  christos /* Do a R_MIPS_LITERAL relocation.  */
   3504   1.1  christos 
   3505  1.10  christos static bfd_reloc_status_type
   3506   1.1  christos mips_elf64_literal_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
   3507   1.1  christos 			  void *data, asection *input_section, bfd *output_bfd,
   3508   1.1  christos 			  char **error_message)
   3509   1.1  christos {
   3510   1.1  christos   bool relocatable;
   3511   1.1  christos   bfd_reloc_status_type ret;
   3512   1.1  christos   bfd_vma gp;
   3513   1.1  christos 
   3514   1.1  christos   /* R_MIPS_LITERAL relocations are defined for local symbols only.  */
   3515   1.1  christos   if (output_bfd != NULL
   3516   1.1  christos       && (symbol->flags & BSF_SECTION_SYM) == 0
   3517   1.1  christos       && (symbol->flags & BSF_LOCAL) != 0)
   3518   1.1  christos     {
   3519   1.1  christos       *error_message = (char *)
   3520   1.1  christos 	_("literal relocation occurs for an external symbol");
   3521  1.10  christos       return bfd_reloc_outofrange;
   3522   1.1  christos     }
   3523   1.1  christos 
   3524  1.10  christos   /* FIXME: The entries in the .lit8 and .lit4 sections should be merged.  */
   3525  1.10  christos   if (output_bfd != NULL)
   3526   1.1  christos     relocatable = true;
   3527   1.1  christos   else
   3528   1.1  christos     {
   3529   1.1  christos       relocatable = false;
   3530   1.1  christos       output_bfd = input_section->output_section->owner;
   3531   1.1  christos     }
   3532   1.1  christos 
   3533   1.1  christos   ret = mips_elf64_final_gp (output_bfd, symbol, relocatable, error_message,
   3534   1.1  christos 			     &gp);
   3535   1.1  christos   if (ret != bfd_reloc_ok)
   3536   1.1  christos     return ret;
   3537   1.1  christos 
   3538   1.1  christos   return _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
   3539   1.1  christos 					input_section, relocatable,
   3540   1.1  christos 					data, gp);
   3541   1.1  christos }
   3542   1.1  christos 
   3543   1.1  christos /* Do a R_MIPS_GPREL32 relocation.  This is a 32 bit value which must
   3544   1.1  christos    become the offset from the gp register.  */
   3545   1.1  christos 
   3546  1.10  christos static bfd_reloc_status_type
   3547   1.1  christos mips_elf64_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
   3548   1.1  christos 			  void *data, asection *input_section, bfd *output_bfd,
   3549   1.1  christos 			  char **error_message)
   3550   1.1  christos {
   3551   1.1  christos   bool relocatable;
   3552   1.1  christos   bfd_reloc_status_type ret;
   3553   1.1  christos   bfd_vma gp;
   3554   1.1  christos   bfd_vma relocation;
   3555   1.1  christos   bfd_vma val;
   3556   1.1  christos 
   3557   1.1  christos   /* R_MIPS_GPREL32 relocations are defined for local symbols only.  */
   3558   1.1  christos   if (output_bfd != NULL
   3559   1.1  christos       && (symbol->flags & BSF_SECTION_SYM) == 0
   3560   1.1  christos       && (symbol->flags & BSF_LOCAL) != 0)
   3561   1.1  christos     {
   3562   1.1  christos       *error_message = (char *)
   3563  1.10  christos 	_("32bits gp relative relocation occurs for an external symbol");
   3564   1.1  christos       return bfd_reloc_outofrange;
   3565   1.1  christos     }
   3566  1.10  christos 
   3567  1.10  christos   if (output_bfd != NULL)
   3568   1.1  christos     relocatable = true;
   3569   1.1  christos   else
   3570   1.1  christos     {
   3571   1.1  christos       relocatable = false;
   3572   1.1  christos       output_bfd = input_section->output_section->owner;
   3573   1.1  christos     }
   3574   1.1  christos 
   3575   1.1  christos   ret = mips_elf64_final_gp (output_bfd, symbol, relocatable,
   3576   1.1  christos 			     error_message, &gp);
   3577   1.1  christos   if (ret != bfd_reloc_ok)
   3578   1.1  christos     return ret;
   3579   1.1  christos 
   3580   1.1  christos   if (bfd_is_com_section (symbol->section))
   3581   1.1  christos     relocation = 0;
   3582   1.1  christos   else
   3583  1.10  christos     relocation = symbol->value;
   3584  1.10  christos 
   3585   1.1  christos   relocation += symbol->section->output_section->vma;
   3586   1.1  christos   relocation += symbol->section->output_offset;
   3587   1.1  christos 
   3588   1.1  christos   if (!_bfd_mips_reloc_offset_in_range (abfd, input_section, reloc_entry,
   3589   1.1  christos 					check_inplace))
   3590   1.1  christos     return bfd_reloc_outofrange;
   3591   1.1  christos 
   3592   1.1  christos   /* Set val to the offset into the section or symbol.  */
   3593   1.1  christos   val = reloc_entry->addend;
   3594   1.1  christos 
   3595   1.1  christos   if (reloc_entry->howto->partial_inplace)
   3596   1.1  christos     val += bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
   3597   1.1  christos 
   3598   1.1  christos   /* Adjust val for the final section location and GP value.  If we
   3599   1.1  christos      are producing relocatable output, we don't want to do this for
   3600   1.1  christos      an external symbol.  */
   3601   1.1  christos   if (! relocatable
   3602   1.1  christos       || (symbol->flags & BSF_SECTION_SYM) != 0)
   3603   1.1  christos     val += relocation - gp;
   3604   1.1  christos 
   3605   1.1  christos   if (reloc_entry->howto->partial_inplace)
   3606   1.1  christos     bfd_put_32 (abfd, val, (bfd_byte *) data + reloc_entry->address);
   3607   1.1  christos   else
   3608   1.1  christos     reloc_entry->addend = val;
   3609   1.1  christos 
   3610   1.1  christos   if (relocatable)
   3611   1.1  christos     reloc_entry->address += input_section->output_offset;
   3612   1.1  christos 
   3613   1.1  christos   return bfd_reloc_ok;
   3614   1.1  christos }
   3615   1.1  christos 
   3616   1.1  christos /* Do a R_MIPS_SHIFT6 relocation. The MSB of the shift is stored at bit 2,
   3617   1.1  christos    the rest is at bits 6-10. The bitpos already got right by the howto.  */
   3618   1.1  christos 
   3619   1.1  christos static bfd_reloc_status_type
   3620   1.1  christos mips_elf64_shift6_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
   3621   1.1  christos 			 void *data, asection *input_section, bfd *output_bfd,
   3622   1.1  christos 			 char **error_message)
   3623   1.1  christos {
   3624   1.1  christos   if (reloc_entry->howto->partial_inplace)
   3625   1.1  christos     {
   3626   1.1  christos       reloc_entry->addend = ((reloc_entry->addend & 0x00007c0)
   3627   1.1  christos 			     | (reloc_entry->addend & 0x00000800) >> 9);
   3628   1.1  christos     }
   3629   1.1  christos 
   3630   1.1  christos   return _bfd_mips_elf_generic_reloc (abfd, reloc_entry, symbol, data,
   3631   1.1  christos 				      input_section, output_bfd,
   3632   1.1  christos 				      error_message);
   3633   1.1  christos }
   3634   1.1  christos 
   3635   1.1  christos /* Handle a mips16 GP relative reloc.  */
   3636   1.1  christos 
   3637  1.10  christos static bfd_reloc_status_type
   3638   1.1  christos mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
   3639   1.1  christos 		    void *data, asection *input_section, bfd *output_bfd,
   3640   1.1  christos 		    char **error_message)
   3641   1.1  christos {
   3642   1.1  christos   bool relocatable;
   3643   1.1  christos   bfd_reloc_status_type ret;
   3644   1.1  christos   bfd_byte *location;
   3645   1.1  christos   bfd_vma gp;
   3646   1.1  christos 
   3647   1.1  christos   /* If we're relocating, and this is an external symbol, we don't want
   3648   1.1  christos      to change anything.  */
   3649   1.1  christos   if (output_bfd != NULL
   3650   1.1  christos       && (symbol->flags & BSF_SECTION_SYM) == 0
   3651   1.1  christos       && (symbol->flags & BSF_LOCAL) != 0)
   3652   1.1  christos     {
   3653  1.10  christos       reloc_entry->address += input_section->output_offset;
   3654   1.1  christos       return bfd_reloc_ok;
   3655   1.1  christos     }
   3656  1.10  christos 
   3657  1.10  christos   if (output_bfd != NULL)
   3658   1.1  christos     relocatable = true;
   3659   1.1  christos   else
   3660   1.1  christos     {
   3661   1.1  christos       relocatable = false;
   3662   1.1  christos       output_bfd = input_section->output_section->owner;
   3663   1.1  christos     }
   3664   1.1  christos 
   3665  1.10  christos   ret = mips_elf64_final_gp (output_bfd, symbol, relocatable, error_message,
   3666  1.10  christos 			     &gp);
   3667  1.10  christos   if (ret != bfd_reloc_ok)
   3668  1.10  christos     return ret;
   3669   1.1  christos 
   3670  1.10  christos   if (!_bfd_mips_reloc_offset_in_range (abfd, input_section, reloc_entry,
   3671   1.1  christos 					check_shuffle))
   3672   1.1  christos     return bfd_reloc_outofrange;
   3673   1.1  christos 
   3674   1.1  christos   location = (bfd_byte *) data + reloc_entry->address;
   3675   1.1  christos   _bfd_mips_elf_reloc_unshuffle (abfd, reloc_entry->howto->type, false,
   3676   1.1  christos 				 location);
   3677   1.1  christos   ret = _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
   3678   1.1  christos 				       input_section, relocatable,
   3679   1.1  christos 				       data, gp);
   3680   1.1  christos   _bfd_mips_elf_reloc_shuffle (abfd, reloc_entry->howto->type, !relocatable,
   3681   1.1  christos 			       location);
   3682   1.1  christos 
   3683   1.1  christos   return ret;
   3684   1.1  christos }
   3685   1.1  christos 
   3686   1.1  christos /* A mapping from BFD reloc types to MIPS ELF reloc types.  */
   3688   1.1  christos 
   3689   1.1  christos struct elf_reloc_map {
   3690   1.1  christos   bfd_reloc_code_real_type bfd_val;
   3691  1.10  christos   enum elf_mips_reloc_type elf_val;
   3692  1.10  christos };
   3693   1.1  christos 
   3694   1.1  christos static const struct elf_reloc_map mips_reloc_map[] =
   3695   1.1  christos {
   3696   1.1  christos   { BFD_RELOC_NONE, R_MIPS_NONE },
   3697   1.1  christos   { BFD_RELOC_MIPS_16, R_MIPS_16 },
   3698   1.1  christos   { BFD_RELOC_16, R_MIPS_REL16 },
   3699   1.1  christos   { BFD_RELOC_32, R_MIPS_32 },
   3700   1.1  christos   /* There is no BFD reloc for R_MIPS_REL32.  */
   3701   1.1  christos   { BFD_RELOC_64, R_MIPS_64 },
   3702   1.1  christos   { BFD_RELOC_CTOR, R_MIPS_64 },
   3703   1.1  christos   { BFD_RELOC_16_PCREL_S2, R_MIPS_PC16 },
   3704   1.1  christos   { BFD_RELOC_HI16_S, R_MIPS_HI16 },
   3705   1.1  christos   { BFD_RELOC_LO16, R_MIPS_LO16 },
   3706   1.1  christos   { BFD_RELOC_GPREL16, R_MIPS_GPREL16 },
   3707   1.1  christos   { BFD_RELOC_GPREL32, R_MIPS_GPREL32 },
   3708   1.1  christos   { BFD_RELOC_MIPS_JMP, R_MIPS_26 },
   3709   1.1  christos   { BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL },
   3710   1.1  christos   { BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 },
   3711   1.1  christos   { BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 },
   3712   1.1  christos   { BFD_RELOC_MIPS_SHIFT5, R_MIPS_SHIFT5 },
   3713   1.1  christos   { BFD_RELOC_MIPS_SHIFT6, R_MIPS_SHIFT6 },
   3714   1.1  christos   { BFD_RELOC_MIPS_GOT_DISP, R_MIPS_GOT_DISP },
   3715   1.1  christos   { BFD_RELOC_MIPS_GOT_PAGE, R_MIPS_GOT_PAGE },
   3716   1.1  christos   { BFD_RELOC_MIPS_GOT_OFST, R_MIPS_GOT_OFST },
   3717   1.1  christos   { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 },
   3718   1.1  christos   { BFD_RELOC_MIPS_GOT_LO16, R_MIPS_GOT_LO16 },
   3719   1.1  christos   { BFD_RELOC_MIPS_SUB, R_MIPS_SUB },
   3720   1.1  christos   { BFD_RELOC_MIPS_INSERT_A, R_MIPS_INSERT_A },
   3721   1.1  christos   { BFD_RELOC_MIPS_INSERT_B, R_MIPS_INSERT_B },
   3722   1.1  christos   { BFD_RELOC_MIPS_DELETE, R_MIPS_DELETE },
   3723   1.1  christos   { BFD_RELOC_MIPS_HIGHEST, R_MIPS_HIGHEST },
   3724   1.1  christos   { BFD_RELOC_MIPS_HIGHER, R_MIPS_HIGHER },
   3725   1.1  christos   { BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 },
   3726   1.1  christos   { BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 },
   3727   1.1  christos   { BFD_RELOC_MIPS_SCN_DISP, R_MIPS_SCN_DISP },
   3728   1.1  christos   /* Use of R_MIPS_ADD_IMMEDIATE and R_MIPS_PJUMP is deprecated.  */
   3729   1.1  christos   { BFD_RELOC_MIPS_RELGOT, R_MIPS_RELGOT },
   3730   1.1  christos   { BFD_RELOC_MIPS_JALR, R_MIPS_JALR },
   3731   1.1  christos   { BFD_RELOC_MIPS_TLS_DTPMOD32, R_MIPS_TLS_DTPMOD32 },
   3732   1.1  christos   { BFD_RELOC_MIPS_TLS_DTPREL32, R_MIPS_TLS_DTPREL32 },
   3733   1.1  christos   { BFD_RELOC_MIPS_TLS_DTPMOD64, R_MIPS_TLS_DTPMOD64 },
   3734   1.1  christos   { BFD_RELOC_MIPS_TLS_DTPREL64, R_MIPS_TLS_DTPREL64 },
   3735   1.1  christos   { BFD_RELOC_MIPS_TLS_GD, R_MIPS_TLS_GD },
   3736   1.1  christos   { BFD_RELOC_MIPS_TLS_LDM, R_MIPS_TLS_LDM },
   3737   1.3  christos   { BFD_RELOC_MIPS_TLS_DTPREL_HI16, R_MIPS_TLS_DTPREL_HI16 },
   3738   1.3  christos   { BFD_RELOC_MIPS_TLS_DTPREL_LO16, R_MIPS_TLS_DTPREL_LO16 },
   3739   1.3  christos   { BFD_RELOC_MIPS_TLS_GOTTPREL, R_MIPS_TLS_GOTTPREL },
   3740   1.3  christos   { BFD_RELOC_MIPS_TLS_TPREL32, R_MIPS_TLS_TPREL32 },
   3741   1.3  christos   { BFD_RELOC_MIPS_TLS_TPREL64, R_MIPS_TLS_TPREL64 },
   3742   1.3  christos   { BFD_RELOC_MIPS_TLS_TPREL_HI16, R_MIPS_TLS_TPREL_HI16 },
   3743   1.3  christos   { BFD_RELOC_MIPS_TLS_TPREL_LO16, R_MIPS_TLS_TPREL_LO16 },
   3744   1.1  christos   { BFD_RELOC_MIPS_21_PCREL_S2, R_MIPS_PC21_S2 },
   3745   1.1  christos   { BFD_RELOC_MIPS_26_PCREL_S2, R_MIPS_PC26_S2 },
   3746   1.1  christos   { BFD_RELOC_MIPS_18_PCREL_S3, R_MIPS_PC18_S3 },
   3747   1.1  christos   { BFD_RELOC_MIPS_19_PCREL_S2, R_MIPS_PC19_S2 },
   3748   1.1  christos   { BFD_RELOC_HI16_S_PCREL, R_MIPS_PCHI16 },
   3749   1.1  christos   { BFD_RELOC_LO16_PCREL, R_MIPS_PCLO16 }
   3750   1.1  christos };
   3751   1.1  christos 
   3752   1.1  christos static const struct elf_reloc_map mips16_reloc_map[] =
   3753   1.1  christos {
   3754   1.1  christos   { BFD_RELOC_MIPS16_JMP, R_MIPS16_26 - R_MIPS16_min },
   3755   1.1  christos   { BFD_RELOC_MIPS16_GPREL, R_MIPS16_GPREL - R_MIPS16_min },
   3756   1.1  christos   { BFD_RELOC_MIPS16_GOT16, R_MIPS16_GOT16 - R_MIPS16_min },
   3757   1.1  christos   { BFD_RELOC_MIPS16_CALL16, R_MIPS16_CALL16 - R_MIPS16_min },
   3758   1.1  christos   { BFD_RELOC_MIPS16_HI16_S, R_MIPS16_HI16 - R_MIPS16_min },
   3759   1.1  christos   { BFD_RELOC_MIPS16_LO16, R_MIPS16_LO16 - R_MIPS16_min },
   3760   1.1  christos   { BFD_RELOC_MIPS16_TLS_GD, R_MIPS16_TLS_GD - R_MIPS16_min },
   3761   1.1  christos   { BFD_RELOC_MIPS16_TLS_LDM, R_MIPS16_TLS_LDM - R_MIPS16_min },
   3762   1.6  christos   { BFD_RELOC_MIPS16_TLS_DTPREL_HI16,
   3763   1.6  christos     R_MIPS16_TLS_DTPREL_HI16 - R_MIPS16_min },
   3764   1.1  christos   { BFD_RELOC_MIPS16_TLS_DTPREL_LO16,
   3765   1.1  christos     R_MIPS16_TLS_DTPREL_LO16 - R_MIPS16_min },
   3766   1.1  christos   { BFD_RELOC_MIPS16_TLS_GOTTPREL, R_MIPS16_TLS_GOTTPREL - R_MIPS16_min },
   3767   1.1  christos   { BFD_RELOC_MIPS16_TLS_TPREL_HI16, R_MIPS16_TLS_TPREL_HI16 - R_MIPS16_min },
   3768   1.1  christos   { BFD_RELOC_MIPS16_TLS_TPREL_LO16, R_MIPS16_TLS_TPREL_LO16 - R_MIPS16_min },
   3769   1.1  christos   { BFD_RELOC_MIPS16_16_PCREL_S1, R_MIPS16_PC16_S1 - R_MIPS16_min }
   3770   1.1  christos };
   3771   1.1  christos 
   3772   1.1  christos static const struct elf_reloc_map micromips_reloc_map[] =
   3773   1.1  christos {
   3774   1.1  christos   { BFD_RELOC_MICROMIPS_JMP, R_MICROMIPS_26_S1 - R_MICROMIPS_min },
   3775   1.1  christos   { BFD_RELOC_MICROMIPS_HI16_S, R_MICROMIPS_HI16 - R_MICROMIPS_min },
   3776   1.1  christos   { BFD_RELOC_MICROMIPS_LO16, R_MICROMIPS_LO16 - R_MICROMIPS_min },
   3777   1.1  christos   { BFD_RELOC_MICROMIPS_GPREL16, R_MICROMIPS_GPREL16 - R_MICROMIPS_min },
   3778   1.1  christos   { BFD_RELOC_MICROMIPS_LITERAL, R_MICROMIPS_LITERAL - R_MICROMIPS_min },
   3779   1.1  christos   { BFD_RELOC_MICROMIPS_GOT16, R_MICROMIPS_GOT16 - R_MICROMIPS_min },
   3780   1.1  christos   { BFD_RELOC_MICROMIPS_7_PCREL_S1, R_MICROMIPS_PC7_S1 - R_MICROMIPS_min },
   3781   1.1  christos   { BFD_RELOC_MICROMIPS_10_PCREL_S1, R_MICROMIPS_PC10_S1 - R_MICROMIPS_min },
   3782   1.1  christos   { BFD_RELOC_MICROMIPS_16_PCREL_S1, R_MICROMIPS_PC16_S1 - R_MICROMIPS_min },
   3783   1.1  christos   { BFD_RELOC_MICROMIPS_CALL16, R_MICROMIPS_CALL16 - R_MICROMIPS_min },
   3784   1.1  christos   { BFD_RELOC_MICROMIPS_GOT_DISP, R_MICROMIPS_GOT_DISP - R_MICROMIPS_min },
   3785   1.1  christos   { BFD_RELOC_MICROMIPS_GOT_PAGE, R_MICROMIPS_GOT_PAGE - R_MICROMIPS_min },
   3786   1.1  christos   { BFD_RELOC_MICROMIPS_GOT_OFST, R_MICROMIPS_GOT_OFST - R_MICROMIPS_min },
   3787   1.1  christos   { BFD_RELOC_MICROMIPS_GOT_HI16, R_MICROMIPS_GOT_HI16 - R_MICROMIPS_min },
   3788   1.1  christos   { BFD_RELOC_MICROMIPS_GOT_LO16, R_MICROMIPS_GOT_LO16 - R_MICROMIPS_min },
   3789   1.1  christos   { BFD_RELOC_MICROMIPS_SUB, R_MICROMIPS_SUB - R_MICROMIPS_min },
   3790   1.8  christos   { BFD_RELOC_MICROMIPS_HIGHER, R_MICROMIPS_HIGHER - R_MICROMIPS_min },
   3791   1.8  christos   { BFD_RELOC_MICROMIPS_HIGHEST, R_MICROMIPS_HIGHEST - R_MICROMIPS_min },
   3792   1.8  christos   { BFD_RELOC_MICROMIPS_CALL_HI16, R_MICROMIPS_CALL_HI16 - R_MICROMIPS_min },
   3793   1.8  christos   { BFD_RELOC_MICROMIPS_CALL_LO16, R_MICROMIPS_CALL_LO16 - R_MICROMIPS_min },
   3794   1.8  christos   { BFD_RELOC_MICROMIPS_SCN_DISP, R_MICROMIPS_SCN_DISP - R_MICROMIPS_min },
   3795   1.8  christos   { BFD_RELOC_MICROMIPS_JALR, R_MICROMIPS_JALR - R_MICROMIPS_min },
   3796   1.8  christos   /* There is no BFD reloc for R_MICROMIPS_HI0_LO16.  */
   3797   1.8  christos   { BFD_RELOC_MICROMIPS_TLS_GD, R_MICROMIPS_TLS_GD - R_MICROMIPS_min },
   3798   1.8  christos   { BFD_RELOC_MICROMIPS_TLS_LDM, R_MICROMIPS_TLS_LDM - R_MICROMIPS_min },
   3799   1.8  christos   { BFD_RELOC_MICROMIPS_TLS_DTPREL_HI16,
   3800   1.8  christos     R_MICROMIPS_TLS_DTPREL_HI16 - R_MICROMIPS_min },
   3801   1.8  christos   { BFD_RELOC_MICROMIPS_TLS_DTPREL_LO16,
   3802   1.8  christos     R_MICROMIPS_TLS_DTPREL_LO16 - R_MICROMIPS_min },
   3803   1.8  christos   { BFD_RELOC_MICROMIPS_TLS_GOTTPREL,
   3804   1.8  christos     R_MICROMIPS_TLS_GOTTPREL - R_MICROMIPS_min },
   3805   1.1  christos   { BFD_RELOC_MICROMIPS_TLS_TPREL_HI16,
   3806   1.1  christos     R_MICROMIPS_TLS_TPREL_HI16 - R_MICROMIPS_min },
   3807   1.1  christos   { BFD_RELOC_MICROMIPS_TLS_TPREL_LO16,
   3808   1.1  christos     R_MICROMIPS_TLS_TPREL_LO16 - R_MICROMIPS_min },
   3809   1.1  christos   /* There is no BFD reloc for R_MICROMIPS_GPREL7_S2.  */
   3810   1.1  christos   /* There is no BFD reloc for R_MICROMIPS_PC23_S2.  */
   3811   1.1  christos };
   3812   1.1  christos /* Given a BFD reloc type, return a howto structure.  */
   3813   1.1  christos 
   3814   1.1  christos static reloc_howto_type *
   3815   1.1  christos bfd_elf64_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
   3816   1.1  christos 				 bfd_reloc_code_real_type code)
   3817   1.1  christos {
   3818   1.1  christos   unsigned int i;
   3819   1.1  christos   /* FIXME: We default to RELA here instead of choosing the right
   3820   1.1  christos      relocation variant.  */
   3821   1.1  christos   reloc_howto_type *howto_table = mips_elf64_howto_table_rela;
   3822   1.1  christos   reloc_howto_type *howto16_table = mips16_elf64_howto_table_rela;
   3823   1.1  christos   reloc_howto_type *howto_micromips_table = micromips_elf64_howto_table_rela;
   3824   1.1  christos 
   3825   1.1  christos   for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map);
   3826   1.1  christos        i++)
   3827   1.1  christos     {
   3828   1.1  christos       if (mips_reloc_map[i].bfd_val == code)
   3829   1.1  christos 	return &howto_table[(int) mips_reloc_map[i].elf_val];
   3830   1.1  christos     }
   3831   1.1  christos 
   3832   1.1  christos   for (i = 0; i < sizeof (mips16_reloc_map) / sizeof (struct elf_reloc_map);
   3833   1.1  christos        i++)
   3834   1.1  christos     {
   3835   1.1  christos       if (mips16_reloc_map[i].bfd_val == code)
   3836   1.1  christos 	return &howto16_table[(int) mips16_reloc_map[i].elf_val];
   3837   1.1  christos     }
   3838   1.1  christos 
   3839   1.1  christos   for (i = 0; i < sizeof (micromips_reloc_map) / sizeof (struct elf_reloc_map);
   3840   1.1  christos        i++)
   3841   1.1  christos     {
   3842   1.1  christos       if (micromips_reloc_map[i].bfd_val == code)
   3843   1.1  christos 	return &howto_micromips_table[(int) micromips_reloc_map[i].elf_val];
   3844   1.1  christos     }
   3845   1.1  christos 
   3846   1.1  christos   switch (code)
   3847   1.1  christos     {
   3848   1.1  christos     case BFD_RELOC_VTABLE_INHERIT:
   3849   1.1  christos       return &elf_mips_gnu_vtinherit_howto;
   3850   1.1  christos     case BFD_RELOC_VTABLE_ENTRY:
   3851   1.1  christos       return &elf_mips_gnu_vtentry_howto;
   3852   1.1  christos     case BFD_RELOC_32_PCREL:
   3853   1.1  christos       return &elf_mips_gnu_pcrel32;
   3854   1.1  christos     case BFD_RELOC_MIPS_EH:
   3855   1.1  christos       return &elf_mips_eh_howto;
   3856   1.1  christos     case BFD_RELOC_MIPS_COPY:
   3857   1.1  christos       return &elf_mips_copy_howto;
   3858   1.1  christos     case BFD_RELOC_MIPS_JUMP_SLOT:
   3859   1.1  christos       return &elf_mips_jump_slot_howto;
   3860   1.1  christos     default:
   3861   1.1  christos       bfd_set_error (bfd_error_bad_value);
   3862   1.1  christos       return NULL;
   3863   1.1  christos     }
   3864   1.1  christos }
   3865   1.1  christos 
   3866   1.1  christos static reloc_howto_type *
   3867   1.1  christos bfd_elf64_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
   3868   1.1  christos 				 const char *r_name)
   3869   1.1  christos {
   3870   1.1  christos   unsigned int i;
   3871   1.1  christos 
   3872   1.1  christos   for (i = 0;
   3873   1.1  christos        i < (sizeof (mips_elf64_howto_table_rela)
   3874   1.1  christos 	    / sizeof (mips_elf64_howto_table_rela[0])); i++)
   3875   1.1  christos     if (mips_elf64_howto_table_rela[i].name != NULL
   3876   1.1  christos 	&& strcasecmp (mips_elf64_howto_table_rela[i].name, r_name) == 0)
   3877   1.1  christos       return &mips_elf64_howto_table_rela[i];
   3878   1.1  christos 
   3879   1.1  christos   for (i = 0;
   3880   1.1  christos        i < (sizeof (mips16_elf64_howto_table_rela)
   3881   1.1  christos 	    / sizeof (mips16_elf64_howto_table_rela[0]));
   3882   1.1  christos        i++)
   3883   1.1  christos     if (mips16_elf64_howto_table_rela[i].name != NULL
   3884   1.1  christos 	&& strcasecmp (mips16_elf64_howto_table_rela[i].name, r_name) == 0)
   3885   1.1  christos       return &mips16_elf64_howto_table_rela[i];
   3886   1.1  christos 
   3887   1.1  christos   for (i = 0;
   3888   1.1  christos        i < (sizeof (micromips_elf64_howto_table_rela)
   3889   1.1  christos 	    / sizeof (micromips_elf64_howto_table_rela[0]));
   3890   1.1  christos        i++)
   3891   1.1  christos     if (micromips_elf64_howto_table_rela[i].name != NULL
   3892   1.1  christos 	&& strcasecmp (micromips_elf64_howto_table_rela[i].name, r_name) == 0)
   3893   1.1  christos       return &micromips_elf64_howto_table_rela[i];
   3894   1.1  christos 
   3895   1.1  christos   if (strcasecmp (elf_mips_gnu_vtinherit_howto.name, r_name) == 0)
   3896   1.1  christos     return &elf_mips_gnu_vtinherit_howto;
   3897   1.1  christos   if (strcasecmp (elf_mips_gnu_vtentry_howto.name, r_name) == 0)
   3898   1.1  christos     return &elf_mips_gnu_vtentry_howto;
   3899   1.1  christos   if (strcasecmp (elf_mips_gnu_rel16_s2.name, r_name) == 0)
   3900   1.1  christos     return &elf_mips_gnu_rel16_s2;
   3901   1.1  christos   if (strcasecmp (elf_mips_gnu_rela16_s2.name, r_name) == 0)
   3902   1.1  christos     return &elf_mips_gnu_rela16_s2;
   3903   1.1  christos   if (strcasecmp (elf_mips_gnu_pcrel32.name, r_name) == 0)
   3904   1.1  christos     return &elf_mips_gnu_pcrel32;
   3905   1.1  christos   if (strcasecmp (elf_mips_eh_howto.name, r_name) == 0)
   3906   1.1  christos     return &elf_mips_eh_howto;
   3907   1.1  christos   if (strcasecmp (elf_mips_copy_howto.name, r_name) == 0)
   3908   1.1  christos     return &elf_mips_copy_howto;
   3909   1.1  christos   if (strcasecmp (elf_mips_jump_slot_howto.name, r_name) == 0)
   3910   1.1  christos     return &elf_mips_jump_slot_howto;
   3911   1.1  christos 
   3912  1.10  christos   return NULL;
   3913   1.1  christos }
   3914   1.8  christos 
   3915   1.8  christos /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure.  */
   3916   1.1  christos 
   3917   1.1  christos static reloc_howto_type *
   3918   1.1  christos mips_elf64_rtype_to_howto (bfd *abfd, unsigned int r_type, bool rela_p)
   3919   1.1  christos {
   3920   1.1  christos   reloc_howto_type *howto = NULL;
   3921   1.1  christos 
   3922   1.1  christos   switch (r_type)
   3923   1.1  christos     {
   3924   1.1  christos     case R_MIPS_GNU_VTINHERIT:
   3925   1.1  christos       return &elf_mips_gnu_vtinherit_howto;
   3926   1.1  christos     case R_MIPS_GNU_VTENTRY:
   3927   1.1  christos       return &elf_mips_gnu_vtentry_howto;
   3928   1.1  christos     case R_MIPS_GNU_REL16_S2:
   3929   1.1  christos       if (rela_p)
   3930   1.1  christos 	return &elf_mips_gnu_rela16_s2;
   3931   1.1  christos       else
   3932   1.1  christos 	return &elf_mips_gnu_rel16_s2;
   3933   1.1  christos     case R_MIPS_PC32:
   3934   1.1  christos       return &elf_mips_gnu_pcrel32;
   3935   1.1  christos     case R_MIPS_EH:
   3936   1.1  christos       return &elf_mips_eh_howto;
   3937   1.1  christos     case R_MIPS_COPY:
   3938   1.1  christos       return &elf_mips_copy_howto;
   3939   1.8  christos     case R_MIPS_JUMP_SLOT:
   3940   1.8  christos       return &elf_mips_jump_slot_howto;
   3941   1.1  christos     default:
   3942   1.8  christos       if (r_type >= R_MICROMIPS_min && r_type < R_MICROMIPS_max)
   3943   1.8  christos 	{
   3944   1.1  christos 	  if (rela_p)
   3945   1.1  christos 	    howto
   3946   1.1  christos 	      = &micromips_elf64_howto_table_rela[r_type - R_MICROMIPS_min];
   3947   1.1  christos 	  else
   3948   1.8  christos 	    howto
   3949   1.1  christos 	      = &micromips_elf64_howto_table_rel[r_type - R_MICROMIPS_min];
   3950   1.8  christos 	}
   3951   1.1  christos       if (r_type >= R_MIPS16_min && r_type < R_MIPS16_max)
   3952   1.8  christos 	{
   3953   1.5  christos 	  if (rela_p)
   3954   1.8  christos 	    howto = &mips16_elf64_howto_table_rela[r_type - R_MIPS16_min];
   3955   1.8  christos 	  else
   3956   1.8  christos 	    howto = &mips16_elf64_howto_table_rel[r_type - R_MIPS16_min];
   3957   1.8  christos 	}
   3958   1.5  christos       if (r_type < R_MIPS_max)
   3959   1.8  christos 	{
   3960   1.8  christos 	  if (rela_p)
   3961   1.8  christos 	    howto = &mips_elf64_howto_table_rela[r_type];
   3962   1.8  christos 	  else
   3963   1.8  christos 	    howto = &mips_elf64_howto_table_rel[r_type];
   3964   1.8  christos 	}
   3965   1.8  christos       if (howto != NULL && howto->name != NULL)
   3966   1.1  christos 	return howto;
   3967   1.1  christos 
   3968   1.1  christos       _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
   3969   1.1  christos 			  abfd, r_type);
   3970   1.1  christos       bfd_set_error (bfd_error_bad_value);
   3971  1.10  christos       return NULL;
   3972   1.8  christos     }
   3973   1.1  christos }
   3974   1.8  christos 
   3975   1.1  christos /* Prevent relocation handling by bfd for MIPS ELF64.  */
   3976   1.8  christos 
   3977   1.8  christos static bool
   3978   1.8  christos mips_elf64_info_to_howto_rela (bfd *abfd,
   3979   1.8  christos 			       arelent *cache_ptr ATTRIBUTE_UNUSED,
   3980   1.8  christos 			       Elf_Internal_Rela *dst)
   3981  1.10  christos {
   3982   1.1  christos   unsigned int r_type = ELF32_R_TYPE (dst->r_info);
   3983   1.1  christos   /* xgettext:c-format */
   3984   1.1  christos   _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
   3985   1.1  christos 		      abfd, r_type);
   3986   1.1  christos   bfd_set_error (bfd_error_bad_value);
   3987   1.1  christos   return false;
   3988   1.1  christos }
   3989   1.1  christos 
   3990   1.1  christos /* Since each entry in an SHT_REL or SHT_RELA section can represent up
   3991   1.1  christos    to three relocs, we must tell the user to allocate more space.  */
   3992   1.1  christos 
   3993   1.1  christos static long
   3994   1.1  christos mips_elf64_get_dynamic_reloc_upper_bound (bfd *abfd)
   3995   1.8  christos {
   3996   1.8  christos   return _bfd_elf_get_dynamic_reloc_upper_bound (abfd) * 3;
   3997   1.8  christos }
   3998   1.8  christos 
   3999   1.8  christos /* Read the relocations from one reloc section.  This is mostly copied
   4000   1.8  christos    from elfcode.h, except for the changes to expand one external
   4001   1.1  christos    relocation to 3 internal ones.  To reduce processing effort we
   4002  1.10  christos    could discard those R_MIPS_NONE relocations that occupy the second
   4003   1.1  christos    and the third entry of a triplet, as `mips_elf64_write_rel' and
   4004   1.1  christos    `mips_elf64_write_rela' recreate them in output automagically,
   4005   1.1  christos    however that would also remove them from `objdump -r' output,
   4006   1.1  christos    breaking a long-established tradition and likely confusing people.  */
   4007  1.10  christos 
   4008   1.1  christos static bool
   4009   1.1  christos mips_elf64_slurp_one_reloc_table (bfd *abfd, asection *asect,
   4010   1.1  christos 				  Elf_Internal_Shdr *rel_hdr,
   4011   1.8  christos 				  bfd_size_type reloc_count,
   4012   1.1  christos 				  arelent *relents, asymbol **symbols,
   4013   1.1  christos 				  bool dynamic)
   4014   1.1  christos {
   4015  1.10  christos   void *allocated;
   4016   1.1  christos   bfd_byte *native_relocs;
   4017   1.9  christos   unsigned int symcount;
   4018  1.10  christos   arelent *relent;
   4019   1.9  christos   bfd_vma i;
   4020   1.1  christos   int entsize;
   4021  1.10  christos   bool rela_p;
   4022   1.1  christos 
   4023   1.1  christos   if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0)
   4024   1.1  christos     return false;
   4025   1.1  christos   allocated = _bfd_malloc_and_read (abfd, rel_hdr->sh_size, rel_hdr->sh_size);
   4026   1.1  christos   if (allocated == NULL)
   4027   1.1  christos     return false;
   4028   1.1  christos 
   4029   1.1  christos   native_relocs = allocated;
   4030  1.10  christos 
   4031   1.1  christos   entsize = rel_hdr->sh_entsize;
   4032  1.10  christos   BFD_ASSERT (entsize == sizeof (Elf64_Mips_External_Rel)
   4033   1.1  christos 	      || entsize == sizeof (Elf64_Mips_External_Rela));
   4034   1.8  christos 
   4035   1.8  christos   if (entsize == sizeof (Elf64_Mips_External_Rel))
   4036   1.8  christos     rela_p = false;
   4037   1.8  christos   else
   4038   1.8  christos     rela_p = true;
   4039   1.1  christos 
   4040   1.1  christos   if (dynamic)
   4041   1.1  christos     symcount = bfd_get_dynamic_symcount (abfd);
   4042   1.1  christos   else
   4043   1.1  christos     symcount = bfd_get_symcount (abfd);
   4044  1.10  christos 
   4045   1.1  christos   for (i = 0, relent = relents;
   4046   1.1  christos        i < reloc_count;
   4047   1.1  christos        i++, native_relocs += entsize)
   4048   1.1  christos     {
   4049   1.1  christos       Elf64_Mips_Internal_Rela rela;
   4050   1.1  christos       bool used_sym, used_ssym;
   4051   1.1  christos       int ir;
   4052   1.1  christos 
   4053   1.1  christos       if (entsize == sizeof (Elf64_Mips_External_Rela))
   4054   1.1  christos 	mips_elf64_swap_reloca_in (abfd,
   4055   1.1  christos 				   (Elf64_Mips_External_Rela *) native_relocs,
   4056   1.1  christos 				   &rela);
   4057   1.1  christos       else
   4058  1.10  christos 	mips_elf64_swap_reloc_in (abfd,
   4059  1.10  christos 				  (Elf64_Mips_External_Rel *) native_relocs,
   4060   1.1  christos 				  &rela);
   4061   1.1  christos 
   4062   1.1  christos       /* Each entry represents exactly three actual relocations.  */
   4063   1.1  christos 
   4064   1.1  christos       used_sym = false;
   4065   1.1  christos       used_ssym = false;
   4066   1.1  christos       for (ir = 0; ir < 3; ir++)
   4067   1.1  christos 	{
   4068   1.1  christos 	  enum elf_mips_reloc_type type;
   4069   1.1  christos 
   4070   1.1  christos 	  switch (ir)
   4071   1.1  christos 	    {
   4072   1.1  christos 	    default:
   4073   1.1  christos 	      abort ();
   4074   1.1  christos 	    case 0:
   4075   1.1  christos 	      type = (enum elf_mips_reloc_type) rela.r_type;
   4076   1.1  christos 	      break;
   4077   1.1  christos 	    case 1:
   4078   1.1  christos 	      type = (enum elf_mips_reloc_type) rela.r_type2;
   4079   1.1  christos 	      break;
   4080  1.10  christos 	    case 2:
   4081   1.1  christos 	      type = (enum elf_mips_reloc_type) rela.r_type3;
   4082   1.1  christos 	      break;
   4083   1.1  christos 	    }
   4084   1.1  christos 
   4085   1.1  christos 	  /* Some types require symbols, whereas some do not.  */
   4086   1.1  christos 	  relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
   4087   1.1  christos 	  switch (type)
   4088   1.1  christos 	    {
   4089   1.1  christos 	    case R_MIPS_NONE:
   4090   1.1  christos 	    case R_MIPS_LITERAL:
   4091   1.1  christos 	    case R_MIPS_INSERT_A:
   4092   1.1  christos 	    case R_MIPS_INSERT_B:
   4093   1.1  christos 	    case R_MIPS_DELETE:
   4094  1.10  christos 	      break;
   4095   1.8  christos 
   4096   1.8  christos 	    default:
   4097   1.8  christos 	      if (! used_sym)
   4098   1.8  christos 		{
   4099   1.8  christos 		  if (rela.r_sym == STN_UNDEF)
   4100   1.8  christos 		    ;
   4101   1.8  christos 		  else if (rela.r_sym > symcount)
   4102   1.8  christos 		    {
   4103   1.8  christos 		      _bfd_error_handler
   4104   1.1  christos 			/* xgettext:c-format */
   4105   1.1  christos 			(_("%pB(%pA): relocation %" PRIu64
   4106   1.1  christos 			   " has invalid symbol index %ld"),
   4107   1.1  christos 			 abfd, asect, (uint64_t) i, rela.r_sym);
   4108   1.1  christos 		      bfd_set_error (bfd_error_bad_value);
   4109   1.1  christos 		    }
   4110   1.1  christos 		  else
   4111   1.1  christos 		    {
   4112   1.1  christos 		      asymbol **ps, *s;
   4113   1.1  christos 
   4114   1.1  christos 		      ps = symbols + rela.r_sym - 1;
   4115   1.1  christos 		      s = *ps;
   4116  1.10  christos 		      if ((s->flags & BSF_SECTION_SYM) == 0)
   4117   1.1  christos 			relent->sym_ptr_ptr = ps;
   4118   1.1  christos 		      else
   4119   1.1  christos 			relent->sym_ptr_ptr = s->section->symbol_ptr_ptr;
   4120   1.1  christos 		    }
   4121   1.1  christos 
   4122   1.1  christos 		  used_sym = true;
   4123   1.1  christos 		}
   4124   1.1  christos 	      else if (! used_ssym)
   4125   1.1  christos 		{
   4126   1.1  christos 		  switch (rela.r_ssym)
   4127   1.1  christos 		    {
   4128   1.1  christos 		    case RSS_UNDEF:
   4129   1.1  christos 		      break;
   4130   1.1  christos 
   4131   1.1  christos 		    case RSS_GP:
   4132   1.1  christos 		    case RSS_GP0:
   4133   1.1  christos 		    case RSS_LOC:
   4134   1.1  christos 		      /* FIXME: I think these need to be handled using
   4135   1.1  christos 			 special howto structures.  */
   4136   1.1  christos 		      BFD_ASSERT (0);
   4137   1.1  christos 		      break;
   4138  1.10  christos 
   4139   1.1  christos 		    default:
   4140   1.1  christos 		      BFD_ASSERT (0);
   4141   1.1  christos 		      break;
   4142   1.1  christos 		    }
   4143   1.1  christos 
   4144   1.1  christos 		  used_ssym = true;
   4145   1.1  christos 		}
   4146   1.1  christos 	      break;
   4147   1.1  christos 	    }
   4148   1.1  christos 
   4149   1.1  christos 	  /* The address of an ELF reloc is section relative for an
   4150   1.1  christos 	     object file, and absolute for an executable file or
   4151   1.1  christos 	     shared library.  The address of a BFD reloc is always
   4152   1.1  christos 	     section relative.  */
   4153   1.1  christos 	  if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0 || dynamic)
   4154   1.8  christos 	    relent->address = rela.r_offset;
   4155   1.8  christos 	  else
   4156   1.8  christos 	    relent->address = rela.r_offset - asect->vma;
   4157   1.1  christos 
   4158   1.1  christos 	  relent->addend = rela.r_addend;
   4159   1.1  christos 
   4160   1.1  christos 	  relent->howto = mips_elf64_rtype_to_howto (abfd, type, rela_p);
   4161   1.1  christos 	  if (relent->howto == NULL)
   4162   1.9  christos 	    goto error_return;
   4163  1.10  christos 
   4164   1.1  christos 	  ++relent;
   4165   1.1  christos 	}
   4166   1.9  christos     }
   4167  1.10  christos 
   4168   1.1  christos   free (allocated);
   4169   1.1  christos   return true;
   4170   1.1  christos 
   4171   1.1  christos  error_return:
   4172   1.1  christos   free (allocated);
   4173   1.8  christos   return false;
   4174   1.1  christos }
   4175  1.10  christos 
   4176   1.1  christos /* Read the relocations.  On Irix 6, there can be two reloc sections
   4177  1.10  christos    associated with a single data section.  This is copied from
   4178   1.1  christos    elfcode.h as well, with changes as small as accounting for 3
   4179   1.1  christos    internal relocs per external reloc.  */
   4180   1.1  christos 
   4181   1.1  christos static bool
   4182   1.1  christos mips_elf64_slurp_reloc_table (bfd *abfd, asection *asect,
   4183   1.1  christos 			      asymbol **symbols, bool dynamic)
   4184   1.1  christos {
   4185   1.1  christos   struct bfd_elf_section_data * const d = elf_section_data (asect);
   4186   1.1  christos   Elf_Internal_Shdr *rel_hdr;
   4187   1.1  christos   Elf_Internal_Shdr *rel_hdr2;
   4188  1.10  christos   bfd_size_type reloc_count;
   4189   1.1  christos   bfd_size_type reloc_count2;
   4190   1.1  christos   arelent *relents;
   4191   1.1  christos   bfd_size_type amt;
   4192   1.1  christos 
   4193   1.1  christos   if (asect->relocation != NULL)
   4194  1.10  christos     return true;
   4195   1.1  christos 
   4196   1.1  christos   if (! dynamic)
   4197   1.1  christos     {
   4198   1.1  christos       if ((asect->flags & SEC_RELOC) == 0
   4199   1.1  christos 	  || asect->reloc_count == 0)
   4200   1.1  christos 	return true;
   4201   1.8  christos 
   4202   1.1  christos       rel_hdr = d->rel.hdr;
   4203   1.1  christos       reloc_count = rel_hdr ? NUM_SHDR_ENTRIES (rel_hdr) : 0;
   4204   1.1  christos       rel_hdr2 = d->rela.hdr;
   4205   1.1  christos       reloc_count2 = (rel_hdr2 ? NUM_SHDR_ENTRIES (rel_hdr2) : 0);
   4206   1.1  christos 
   4207   1.1  christos       BFD_ASSERT (asect->reloc_count == 3 * (reloc_count + reloc_count2));
   4208   1.1  christos       BFD_ASSERT ((rel_hdr && asect->rel_filepos == rel_hdr->sh_offset)
   4209   1.1  christos 		  || (rel_hdr2 && asect->rel_filepos == rel_hdr2->sh_offset));
   4210   1.1  christos 
   4211   1.1  christos     }
   4212   1.1  christos   else
   4213  1.10  christos     {
   4214   1.1  christos       /* Note that ASECT->RELOC_COUNT tends not to be accurate in this
   4215   1.1  christos 	 case because relocations against this section may use the
   4216   1.1  christos 	 dynamic symbol table, and in that case bfd_section_from_shdr
   4217   1.1  christos 	 in elf.c does not update the RELOC_COUNT.  */
   4218   1.1  christos       if (asect->size == 0)
   4219   1.1  christos 	return true;
   4220   1.1  christos 
   4221   1.1  christos       rel_hdr = &d->this_hdr;
   4222   1.1  christos       reloc_count = NUM_SHDR_ENTRIES (rel_hdr);
   4223   1.1  christos       rel_hdr2 = NULL;
   4224   1.1  christos       reloc_count2 = 0;
   4225  1.10  christos     }
   4226   1.1  christos 
   4227   1.1  christos   /* Allocate space for 3 arelent structures for each Rel structure.  */
   4228   1.1  christos   amt = (reloc_count + reloc_count2) * 3 * sizeof (arelent);
   4229   1.1  christos   relents = bfd_alloc (abfd, amt);
   4230   1.1  christos   if (relents == NULL)
   4231   1.1  christos     return false;
   4232  1.10  christos 
   4233   1.1  christos   if (rel_hdr != NULL
   4234   1.1  christos       && ! mips_elf64_slurp_one_reloc_table (abfd, asect,
   4235   1.1  christos 					     rel_hdr, reloc_count,
   4236   1.1  christos 					     relents,
   4237   1.1  christos 					     symbols, dynamic))
   4238  1.10  christos     return false;
   4239   1.1  christos   if (rel_hdr2 != NULL
   4240   1.1  christos       && ! mips_elf64_slurp_one_reloc_table (abfd, asect,
   4241  1.10  christos 					     rel_hdr2, reloc_count2,
   4242   1.1  christos 					     relents + reloc_count * 3,
   4243   1.1  christos 					     symbols, dynamic))
   4244   1.1  christos     return false;
   4245   1.1  christos 
   4246   1.1  christos   asect->relocation = relents;
   4247   1.1  christos   return true;
   4248   1.1  christos }
   4249  1.10  christos 
   4250   1.1  christos /* Write out the relocations.  */
   4251   1.1  christos 
   4252   1.1  christos static void
   4253   1.1  christos mips_elf64_write_relocs (bfd *abfd, asection *sec, void *data)
   4254   1.1  christos {
   4255   1.1  christos   bool *failedp = data;
   4256   1.1  christos   int count;
   4257   1.1  christos   Elf_Internal_Shdr *rel_hdr;
   4258   1.1  christos   unsigned int idx;
   4259   1.1  christos 
   4260   1.1  christos   /* If we have already failed, don't do anything.  */
   4261   1.1  christos   if (*failedp)
   4262   1.1  christos     return;
   4263   1.1  christos 
   4264   1.1  christos   if ((sec->flags & SEC_RELOC) == 0)
   4265   1.1  christos     return;
   4266   1.1  christos 
   4267   1.1  christos   /* The linker backend writes the relocs out itself, and sets the
   4268   1.1  christos      reloc_count field to zero to inhibit writing them here.  Also,
   4269   1.1  christos      sometimes the SEC_RELOC flag gets set even when there aren't any
   4270   1.1  christos      relocs.  */
   4271   1.1  christos   if (sec->reloc_count == 0)
   4272   1.1  christos     return;
   4273   1.1  christos 
   4274   1.1  christos   /* We can combine up to three relocs that refer to the same address
   4275   1.1  christos      if the latter relocs have no associated symbol.  */
   4276   1.1  christos   count = 0;
   4277   1.1  christos   for (idx = 0; idx < sec->reloc_count; idx++)
   4278   1.1  christos     {
   4279   1.1  christos       bfd_vma addr;
   4280   1.1  christos       unsigned int i;
   4281   1.1  christos 
   4282   1.1  christos       ++count;
   4283   1.1  christos 
   4284   1.1  christos       addr = sec->orelocation[idx]->address;
   4285   1.1  christos       for (i = 0; i < 2; i++)
   4286   1.1  christos 	{
   4287   1.1  christos 	  arelent *r;
   4288   1.1  christos 
   4289   1.1  christos 	  if (idx + 1 >= sec->reloc_count)
   4290   1.1  christos 	    break;
   4291   1.1  christos 	  r = sec->orelocation[idx + 1];
   4292   1.1  christos 	  if (r->address != addr
   4293   1.1  christos 	      || ! bfd_is_abs_section ((*r->sym_ptr_ptr)->section)
   4294   1.1  christos 	      || (*r->sym_ptr_ptr)->value != 0)
   4295   1.1  christos 	    break;
   4296   1.1  christos 
   4297   1.1  christos 	  /* We can merge the reloc at IDX + 1 with the reloc at IDX.  */
   4298   1.1  christos 
   4299   1.1  christos 	  ++idx;
   4300   1.1  christos 	}
   4301   1.1  christos     }
   4302   1.1  christos 
   4303   1.1  christos   rel_hdr = _bfd_elf_single_rel_hdr (sec);
   4304   1.1  christos 
   4305   1.1  christos   /* Do the actual relocation.  */
   4306   1.1  christos 
   4307   1.1  christos   if (rel_hdr->sh_entsize == sizeof(Elf64_Mips_External_Rel))
   4308   1.1  christos     mips_elf64_write_rel (abfd, sec, rel_hdr, &count, data);
   4309   1.1  christos   else if (rel_hdr->sh_entsize == sizeof(Elf64_Mips_External_Rela))
   4310   1.1  christos     mips_elf64_write_rela (abfd, sec, rel_hdr, &count, data);
   4311   1.1  christos   else
   4312   1.1  christos     BFD_ASSERT (0);
   4313   1.1  christos }
   4314  1.10  christos 
   4315   1.1  christos static void
   4316   1.1  christos mips_elf64_write_rel (bfd *abfd, asection *sec,
   4317   1.1  christos 		      Elf_Internal_Shdr *rel_hdr,
   4318   1.1  christos 		      int *count, void *data)
   4319   1.1  christos {
   4320   1.1  christos   bool *failedp = data;
   4321   1.1  christos   Elf64_Mips_External_Rel *ext_rel;
   4322   1.1  christos   unsigned int idx;
   4323   1.1  christos   asymbol *last_sym = 0;
   4324  1.10  christos   int last_sym_idx = 0;
   4325   1.1  christos 
   4326   1.1  christos   rel_hdr->sh_size = rel_hdr->sh_entsize * *count;
   4327   1.1  christos   rel_hdr->contents = bfd_alloc (abfd, rel_hdr->sh_size);
   4328   1.1  christos   if (rel_hdr->contents == NULL)
   4329   1.1  christos     {
   4330   1.1  christos       *failedp = true;
   4331   1.1  christos       return;
   4332   1.1  christos     }
   4333   1.1  christos 
   4334   1.1  christos   ext_rel = (Elf64_Mips_External_Rel *) rel_hdr->contents;
   4335   1.1  christos   for (idx = 0; idx < sec->reloc_count; idx++, ext_rel++)
   4336   1.1  christos     {
   4337   1.1  christos       arelent *ptr;
   4338   1.1  christos       Elf64_Mips_Internal_Rela int_rel;
   4339   1.1  christos       asymbol *sym;
   4340   1.1  christos       int n;
   4341   1.1  christos       unsigned int i;
   4342   1.1  christos 
   4343   1.1  christos       ptr = sec->orelocation[idx];
   4344   1.1  christos 
   4345   1.1  christos       /* The address of an ELF reloc is section relative for an object
   4346   1.1  christos 	 file, and absolute for an executable file or shared library.
   4347   1.1  christos 	 The address of a BFD reloc is always section relative.  */
   4348   1.1  christos       if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
   4349   1.1  christos 	int_rel.r_offset = ptr->address;
   4350   1.1  christos       else
   4351   1.1  christos 	int_rel.r_offset = ptr->address + sec->vma;
   4352   1.1  christos 
   4353   1.1  christos       sym = *ptr->sym_ptr_ptr;
   4354   1.1  christos       if (sym == last_sym)
   4355   1.1  christos 	n = last_sym_idx;
   4356   1.1  christos       else if (bfd_is_abs_section (sym->section) && sym->value == 0)
   4357   1.1  christos 	n = STN_UNDEF;
   4358  1.10  christos       else
   4359   1.1  christos 	{
   4360   1.1  christos 	  last_sym = sym;
   4361   1.1  christos 	  n = _bfd_elf_symbol_from_bfd_symbol (abfd, &sym);
   4362   1.1  christos 	  if (n < 0)
   4363   1.1  christos 	    {
   4364   1.1  christos 	      *failedp = true;
   4365   1.1  christos 	      return;
   4366   1.1  christos 	    }
   4367   1.8  christos 	  last_sym_idx = n;
   4368   1.8  christos 	}
   4369   1.1  christos 
   4370   1.1  christos       int_rel.r_sym = n;
   4371  1.10  christos       int_rel.r_ssym = RSS_UNDEF;
   4372   1.1  christos 
   4373   1.1  christos       if ((*ptr->sym_ptr_ptr)->the_bfd != NULL
   4374   1.1  christos 	  && (*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
   4375   1.1  christos 	  && ! _bfd_elf_validate_reloc (abfd, ptr))
   4376   1.1  christos 	{
   4377   1.1  christos 	  *failedp = true;
   4378   1.1  christos 	  return;
   4379   1.1  christos 	}
   4380   1.1  christos 
   4381   1.1  christos       int_rel.r_type = ptr->howto->type;
   4382   1.1  christos       int_rel.r_type2 = (int) R_MIPS_NONE;
   4383   1.1  christos       int_rel.r_type3 = (int) R_MIPS_NONE;
   4384   1.1  christos 
   4385   1.1  christos       for (i = 0; i < 2; i++)
   4386   1.1  christos 	{
   4387   1.1  christos 	  arelent *r;
   4388   1.1  christos 
   4389   1.1  christos 	  if (idx + 1 >= sec->reloc_count)
   4390   1.1  christos 	    break;
   4391   1.1  christos 	  r = sec->orelocation[idx + 1];
   4392   1.1  christos 	  if (r->address != ptr->address
   4393   1.1  christos 	      || ! bfd_is_abs_section ((*r->sym_ptr_ptr)->section)
   4394   1.1  christos 	      || (*r->sym_ptr_ptr)->value != 0)
   4395   1.1  christos 	    break;
   4396   1.1  christos 
   4397   1.1  christos 	  /* We can merge the reloc at IDX + 1 with the reloc at IDX.  */
   4398   1.1  christos 
   4399   1.1  christos 	  if (i == 0)
   4400   1.1  christos 	    int_rel.r_type2 = r->howto->type;
   4401   1.1  christos 	  else
   4402   1.1  christos 	    int_rel.r_type3 = r->howto->type;
   4403   1.1  christos 
   4404   1.1  christos 	  ++idx;
   4405   1.1  christos 	}
   4406   1.1  christos 
   4407   1.1  christos       mips_elf64_swap_reloc_out (abfd, &int_rel, ext_rel);
   4408   1.1  christos     }
   4409   1.1  christos 
   4410   1.1  christos   BFD_ASSERT (ext_rel - (Elf64_Mips_External_Rel *) rel_hdr->contents
   4411   1.1  christos 	      == *count);
   4412   1.1  christos }
   4413  1.10  christos 
   4414   1.1  christos static void
   4415   1.1  christos mips_elf64_write_rela (bfd *abfd, asection *sec,
   4416   1.1  christos 		       Elf_Internal_Shdr *rela_hdr,
   4417   1.1  christos 		       int *count, void *data)
   4418   1.1  christos {
   4419   1.1  christos   bool *failedp = data;
   4420   1.1  christos   Elf64_Mips_External_Rela *ext_rela;
   4421   1.1  christos   unsigned int idx;
   4422   1.1  christos   asymbol *last_sym = 0;
   4423  1.10  christos   int last_sym_idx = 0;
   4424   1.1  christos 
   4425   1.1  christos   rela_hdr->sh_size = rela_hdr->sh_entsize * *count;
   4426   1.1  christos   rela_hdr->contents = bfd_alloc (abfd, rela_hdr->sh_size);
   4427   1.1  christos   if (rela_hdr->contents == NULL)
   4428   1.1  christos     {
   4429   1.1  christos       *failedp = true;
   4430   1.1  christos       return;
   4431   1.1  christos     }
   4432   1.1  christos 
   4433   1.1  christos   ext_rela = (Elf64_Mips_External_Rela *) rela_hdr->contents;
   4434   1.1  christos   for (idx = 0; idx < sec->reloc_count; idx++, ext_rela++)
   4435   1.1  christos     {
   4436   1.1  christos       arelent *ptr;
   4437   1.1  christos       Elf64_Mips_Internal_Rela int_rela;
   4438   1.1  christos       asymbol *sym;
   4439   1.1  christos       int n;
   4440   1.1  christos       unsigned int i;
   4441   1.1  christos 
   4442   1.1  christos       ptr = sec->orelocation[idx];
   4443   1.1  christos 
   4444   1.1  christos       /* The address of an ELF reloc is section relative for an object
   4445   1.1  christos 	 file, and absolute for an executable file or shared library.
   4446   1.1  christos 	 The address of a BFD reloc is always section relative.  */
   4447   1.1  christos       if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
   4448   1.1  christos 	int_rela.r_offset = ptr->address;
   4449   1.1  christos       else
   4450   1.1  christos 	int_rela.r_offset = ptr->address + sec->vma;
   4451   1.1  christos 
   4452   1.1  christos       sym = *ptr->sym_ptr_ptr;
   4453   1.1  christos       if (sym == last_sym)
   4454   1.1  christos 	n = last_sym_idx;
   4455   1.1  christos       else if (bfd_is_abs_section (sym->section) && sym->value == 0)
   4456   1.1  christos 	n = STN_UNDEF;
   4457  1.10  christos       else
   4458   1.1  christos 	{
   4459   1.1  christos 	  last_sym = sym;
   4460   1.1  christos 	  n = _bfd_elf_symbol_from_bfd_symbol (abfd, &sym);
   4461   1.1  christos 	  if (n < 0)
   4462   1.1  christos 	    {
   4463   1.1  christos 	      *failedp = true;
   4464   1.1  christos 	      return;
   4465   1.1  christos 	    }
   4466   1.1  christos 	  last_sym_idx = n;
   4467   1.8  christos 	}
   4468   1.8  christos 
   4469   1.1  christos       int_rela.r_sym = n;
   4470   1.1  christos       int_rela.r_addend = ptr->addend;
   4471  1.10  christos       int_rela.r_ssym = RSS_UNDEF;
   4472   1.1  christos 
   4473   1.1  christos       if ((*ptr->sym_ptr_ptr)->the_bfd != NULL
   4474   1.1  christos 	  && (*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
   4475   1.1  christos 	  && ! _bfd_elf_validate_reloc (abfd, ptr))
   4476   1.1  christos 	{
   4477   1.1  christos 	  *failedp = true;
   4478   1.1  christos 	  return;
   4479   1.1  christos 	}
   4480   1.1  christos 
   4481   1.1  christos       int_rela.r_type = ptr->howto->type;
   4482   1.1  christos       int_rela.r_type2 = (int) R_MIPS_NONE;
   4483   1.1  christos       int_rela.r_type3 = (int) R_MIPS_NONE;
   4484   1.1  christos 
   4485   1.1  christos       for (i = 0; i < 2; i++)
   4486   1.1  christos 	{
   4487   1.1  christos 	  arelent *r;
   4488   1.1  christos 
   4489   1.1  christos 	  if (idx + 1 >= sec->reloc_count)
   4490   1.1  christos 	    break;
   4491   1.1  christos 	  r = sec->orelocation[idx + 1];
   4492   1.1  christos 	  if (r->address != ptr->address
   4493   1.1  christos 	      || ! bfd_is_abs_section ((*r->sym_ptr_ptr)->section)
   4494   1.1  christos 	      || (*r->sym_ptr_ptr)->value != 0)
   4495   1.1  christos 	    break;
   4496   1.1  christos 
   4497   1.1  christos 	  /* We can merge the reloc at IDX + 1 with the reloc at IDX.  */
   4498   1.1  christos 
   4499   1.1  christos 	  if (i == 0)
   4500   1.1  christos 	    int_rela.r_type2 = r->howto->type;
   4501   1.1  christos 	  else
   4502   1.1  christos 	    int_rela.r_type3 = r->howto->type;
   4503   1.1  christos 
   4504   1.1  christos 	  ++idx;
   4505   1.1  christos 	}
   4506   1.1  christos 
   4507   1.1  christos       mips_elf64_swap_reloca_out (abfd, &int_rela, ext_rela);
   4508   1.1  christos     }
   4509   1.1  christos 
   4510  1.10  christos   BFD_ASSERT (ext_rela - (Elf64_Mips_External_Rela *) rela_hdr->contents
   4511   1.1  christos 	      == *count);
   4512   1.1  christos }
   4513   1.1  christos 
   4514   1.1  christos /* Set the right machine number for a MIPS ELF file.  */
   4516   1.1  christos 
   4517   1.1  christos static bool
   4518   1.1  christos mips_elf64_object_p (bfd *abfd)
   4519  1.10  christos {
   4520   1.1  christos   unsigned long mach;
   4521   1.1  christos 
   4522   1.1  christos   /* Irix 6 is broken.  Object file symbol tables are not always
   4523  1.10  christos      sorted correctly such that local symbols precede global symbols,
   4524   1.1  christos      and the sh_info field in the symbol table is not always right.  */
   4525   1.1  christos   if (elf64_mips_irix_compat (abfd) != ict_none)
   4526   1.1  christos     elf_bad_symtab (abfd) = true;
   4527   1.1  christos 
   4528   1.1  christos   mach = _bfd_elf_mips_mach (elf_elfheader (abfd)->e_flags);
   4529   1.1  christos   bfd_default_set_arch_mach (abfd, bfd_arch_mips, mach);
   4530   1.1  christos   return true;
   4531   1.3  christos }
   4532   1.3  christos 
   4533   1.1  christos /* Depending on the target vector we generate some version of Irix
   4534   1.1  christos    executables or "normal" MIPS ELF ABI executables.  */
   4535   1.1  christos static irix_compat_t
   4536   1.1  christos elf64_mips_irix_compat (bfd *abfd)
   4537   1.1  christos {
   4538   1.1  christos   if ((abfd->xvec == &mips_elf64_be_vec)
   4539  1.10  christos       || (abfd->xvec == &mips_elf64_le_vec))
   4540   1.1  christos     return ict_irix6;
   4541   1.1  christos   else
   4542   1.1  christos     return ict_none;
   4543   1.1  christos }
   4544   1.1  christos 
   4545   1.1  christos /* Support for core dump NOTE sections.  */
   4547   1.1  christos static bool
   4548  1.10  christos elf64_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
   4549   1.1  christos {
   4550   1.1  christos   int offset;
   4551   1.1  christos   unsigned int size;
   4552   1.1  christos 
   4553   1.1  christos   switch (note->descsz)
   4554   1.1  christos     {
   4555   1.1  christos       default:
   4556   1.1  christos 	return false;
   4557   1.1  christos 
   4558   1.1  christos       case 480:		/* Linux/MIPS - N64 kernel */
   4559   1.1  christos 	/* pr_cursig */
   4560   1.1  christos 	elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
   4561   1.1  christos 
   4562   1.1  christos 	/* pr_pid */
   4563   1.1  christos 	elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 32);
   4564   1.1  christos 
   4565   1.1  christos 	/* pr_reg */
   4566   1.1  christos 	offset = 112;
   4567   1.1  christos 	size = 360;
   4568   1.1  christos 
   4569  1.10  christos 	break;
   4570   1.1  christos     }
   4571   1.1  christos 
   4572   1.1  christos   /* Make a ".reg/999" section.  */
   4573   1.1  christos   return _bfd_elfcore_make_pseudosection (abfd, ".reg",
   4574   1.1  christos 					  size, note->descpos + offset);
   4575  1.10  christos }
   4576   1.1  christos 
   4577   1.1  christos static bool
   4578   1.8  christos elf64_mips_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
   4579   1.8  christos {
   4580   1.1  christos   switch (note->descsz)
   4581   1.1  christos     {
   4582   1.1  christos       default:
   4583   1.1  christos 	return false;
   4584   1.1  christos 
   4585   1.1  christos       case 136:		/* Linux/MIPS - N64 kernel elf_prpsinfo */
   4586   1.1  christos 	elf_tdata (abfd)->core->pid
   4587   1.1  christos 	 = bfd_get_32 (abfd, note->descdata + 24);
   4588   1.1  christos 	elf_tdata (abfd)->core->program
   4589   1.1  christos 	 = _bfd_elfcore_strndup (abfd, note->descdata + 40, 16);
   4590   1.1  christos 	elf_tdata (abfd)->core->command
   4591   1.1  christos 	 = _bfd_elfcore_strndup (abfd, note->descdata + 56, 80);
   4592   1.1  christos     }
   4593   1.1  christos 
   4594   1.1  christos   /* Note that for some reason, a spurious space is tacked
   4595   1.1  christos      onto the end of the args in some (at least one anyway)
   4596   1.1  christos      implementations, so strip it off if it exists.  */
   4597   1.1  christos 
   4598  1.10  christos   {
   4599   1.1  christos     char *command = elf_tdata (abfd)->core->command;
   4600   1.8  christos     int n = strlen (command);
   4601   1.8  christos 
   4602   1.8  christos     if (0 < n && command[n - 1] == ' ')
   4603   1.8  christos       command[n - 1] = '\0';
   4604   1.8  christos   }
   4605   1.8  christos 
   4606   1.8  christos   return true;
   4607   1.8  christos }
   4608   1.8  christos 
   4609   1.8  christos /* Write Linux core PRSTATUS note into core file.  */
   4610   1.8  christos 
   4611   1.8  christos static char *
   4612   1.8  christos elf64_mips_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type,
   4613   1.8  christos 			     ...)
   4614   1.8  christos {
   4615   1.8  christos   switch (note_type)
   4616   1.8  christos     {
   4617   1.8  christos     default:
   4618   1.8  christos       return NULL;
   4619   1.8  christos 
   4620   1.8  christos     case NT_PRPSINFO:
   4621   1.8  christos       BFD_FAIL ();
   4622   1.8  christos       return NULL;
   4623   1.8  christos 
   4624   1.8  christos     case NT_PRSTATUS:
   4625   1.8  christos       {
   4626   1.8  christos 	char data[480];
   4627   1.8  christos 	va_list ap;
   4628   1.8  christos 	long pid;
   4629   1.8  christos 	int cursig;
   4630   1.8  christos 	const void *greg;
   4631   1.8  christos 
   4632   1.8  christos 	va_start (ap, note_type);
   4633   1.8  christos 	memset (data, 0, 112);
   4634   1.8  christos 	pid = va_arg (ap, long);
   4635   1.8  christos 	bfd_put_32 (abfd, pid, data + 32);
   4636   1.8  christos 	cursig = va_arg (ap, int);
   4637   1.8  christos 	bfd_put_16 (abfd, cursig, data + 12);
   4638   1.8  christos 	greg = va_arg (ap, const void *);
   4639   1.1  christos 	memcpy (data + 112, greg, 360);
   4640   1.1  christos 	memset (data + 472, 0, 8);
   4641   1.1  christos 	va_end (ap);
   4642   1.1  christos 	return elfcore_write_note (abfd, buf, bufsiz,
   4643   1.1  christos 				   "CORE", note_type, data, sizeof (data));
   4644   1.1  christos       }
   4645   1.1  christos     }
   4646   1.1  christos }
   4647   1.1  christos 
   4648   1.1  christos /* ECOFF swapping routines.  These are used when dealing with the
   4650   1.1  christos    .mdebug section, which is in the ECOFF debugging format.  */
   4651   1.1  christos static const struct ecoff_debug_swap mips_elf64_ecoff_debug_swap =
   4652   1.1  christos {
   4653   1.1  christos   /* Symbol table magic number.  */
   4654   1.1  christos   magicSym2,
   4655   1.1  christos   /* Alignment of debugging information.  E.g., 4.  */
   4656   1.1  christos   8,
   4657   1.1  christos   /* Sizes of external symbolic information.  */
   4658   1.1  christos   sizeof (struct hdr_ext),
   4659   1.1  christos   sizeof (struct dnr_ext),
   4660   1.1  christos   sizeof (struct pdr_ext),
   4661   1.1  christos   sizeof (struct sym_ext),
   4662   1.1  christos   sizeof (struct opt_ext),
   4663   1.1  christos   sizeof (struct fdr_ext),
   4664   1.1  christos   sizeof (struct rfd_ext),
   4665   1.1  christos   sizeof (struct ext_ext),
   4666   1.1  christos   /* Functions to swap in external symbolic data.  */
   4667   1.1  christos   ecoff_swap_hdr_in,
   4668   1.1  christos   ecoff_swap_dnr_in,
   4669   1.1  christos   ecoff_swap_pdr_in,
   4670   1.1  christos   ecoff_swap_sym_in,
   4671   1.1  christos   ecoff_swap_opt_in,
   4672   1.1  christos   ecoff_swap_fdr_in,
   4673   1.1  christos   ecoff_swap_rfd_in,
   4674   1.1  christos   ecoff_swap_ext_in,
   4675   1.1  christos   _bfd_ecoff_swap_tir_in,
   4676   1.1  christos   _bfd_ecoff_swap_rndx_in,
   4677   1.1  christos   /* Functions to swap out external symbolic data.  */
   4678   1.1  christos   ecoff_swap_hdr_out,
   4679   1.1  christos   ecoff_swap_dnr_out,
   4680   1.1  christos   ecoff_swap_pdr_out,
   4681   1.1  christos   ecoff_swap_sym_out,
   4682   1.1  christos   ecoff_swap_opt_out,
   4683   1.1  christos   ecoff_swap_fdr_out,
   4684   1.1  christos   ecoff_swap_rfd_out,
   4685   1.1  christos   ecoff_swap_ext_out,
   4686   1.1  christos   _bfd_ecoff_swap_tir_out,
   4687   1.1  christos   _bfd_ecoff_swap_rndx_out,
   4688   1.1  christos   /* Function to read in symbolic data.  */
   4689   1.1  christos   _bfd_mips_elf_read_ecoff_info
   4690   1.1  christos };
   4691   1.1  christos 
   4692   1.1  christos /* Relocations in the 64 bit MIPS ELF ABI are more complex than in
   4694   1.1  christos    standard ELF.  This structure is used to redirect the relocation
   4695   1.1  christos    handling routines.  */
   4696   1.1  christos 
   4697   1.1  christos const struct elf_size_info mips_elf64_size_info =
   4698   1.1  christos {
   4699   1.1  christos   sizeof (Elf64_External_Ehdr),
   4700   1.1  christos   sizeof (Elf64_External_Phdr),
   4701   1.1  christos   sizeof (Elf64_External_Shdr),
   4702   1.1  christos   sizeof (Elf64_Mips_External_Rel),
   4703   1.1  christos   sizeof (Elf64_Mips_External_Rela),
   4704   1.1  christos   sizeof (Elf64_External_Sym),
   4705   1.1  christos   sizeof (Elf64_External_Dyn),
   4706   1.1  christos   sizeof (Elf_External_Note),
   4707   1.1  christos   4,		/* hash-table entry size */
   4708   1.1  christos   3,		/* internal relocations per external relocations */
   4709   1.1  christos   64,		/* arch_size */
   4710   1.1  christos   3,		/* log_file_align */
   4711   1.1  christos   ELFCLASS64,
   4712   1.1  christos   EV_CURRENT,
   4713   1.1  christos   bfd_elf64_write_out_phdrs,
   4714   1.1  christos   bfd_elf64_write_shdrs_and_ehdr,
   4715   1.1  christos   bfd_elf64_checksum_contents,
   4716   1.1  christos   mips_elf64_write_relocs,
   4717   1.1  christos   bfd_elf64_swap_symbol_in,
   4718   1.1  christos   bfd_elf64_swap_symbol_out,
   4719   1.1  christos   mips_elf64_slurp_reloc_table,
   4720   1.1  christos   bfd_elf64_slurp_symbol_table,
   4721   1.1  christos   bfd_elf64_swap_dyn_in,
   4722   1.1  christos   bfd_elf64_swap_dyn_out,
   4723  1.10  christos   mips_elf64_be_swap_reloc_in,
   4724  1.10  christos   mips_elf64_be_swap_reloc_out,
   4725  1.10  christos   mips_elf64_be_swap_reloca_in,
   4726   1.3  christos   mips_elf64_be_swap_reloca_out
   4727   1.3  christos };
   4728   1.1  christos 
   4729   1.8  christos #define ELF_ARCH			bfd_arch_mips
   4730   1.1  christos #define ELF_TARGET_ID			MIPS_ELF_DATA
   4731   1.1  christos #define ELF_MACHINE_CODE		EM_MIPS
   4732   1.1  christos 
   4733   1.1  christos #define elf_backend_collect		true
   4734   1.1  christos #define elf_backend_type_change_ok	true
   4735   1.1  christos #define elf_backend_can_gc_sections	true
   4736   1.1  christos #define elf_backend_gc_mark_extra_sections \
   4737   1.1  christos 					_bfd_mips_elf_gc_mark_extra_sections
   4738   1.1  christos #define elf_info_to_howto		mips_elf64_info_to_howto_rela
   4739   1.1  christos #define elf_info_to_howto_rel		mips_elf64_info_to_howto_rela
   4740   1.1  christos #define elf_backend_object_p		mips_elf64_object_p
   4741   1.1  christos #define elf_backend_symbol_processing	_bfd_mips_elf_symbol_processing
   4742   1.1  christos #define elf_backend_section_processing	_bfd_mips_elf_section_processing
   4743   1.1  christos #define elf_backend_section_from_shdr	_bfd_mips_elf_section_from_shdr
   4744   1.1  christos #define elf_backend_fake_sections	_bfd_mips_elf_fake_sections
   4745   1.1  christos #define elf_backend_section_from_bfd_section \
   4746   1.1  christos 				_bfd_mips_elf_section_from_bfd_section
   4747   1.1  christos #define elf_backend_add_symbol_hook	_bfd_mips_elf_add_symbol_hook
   4748   1.1  christos #define elf_backend_link_output_symbol_hook \
   4749   1.1  christos 				_bfd_mips_elf_link_output_symbol_hook
   4750   1.1  christos #define elf_backend_create_dynamic_sections \
   4751   1.1  christos 				_bfd_mips_elf_create_dynamic_sections
   4752   1.1  christos #define elf_backend_check_relocs	_bfd_mips_elf_check_relocs
   4753   1.1  christos #define elf_backend_merge_symbol_attribute \
   4754   1.1  christos 				_bfd_mips_elf_merge_symbol_attribute
   4755   1.1  christos #define elf_backend_get_target_dtag	_bfd_mips_elf_get_target_dtag
   4756   1.1  christos #define elf_backend_adjust_dynamic_symbol \
   4757   1.1  christos 				_bfd_mips_elf_adjust_dynamic_symbol
   4758   1.1  christos #define elf_backend_always_size_sections \
   4759   1.1  christos 				_bfd_mips_elf_always_size_sections
   4760   1.1  christos #define elf_backend_size_dynamic_sections \
   4761   1.1  christos 				_bfd_mips_elf_size_dynamic_sections
   4762   1.1  christos #define elf_backend_init_index_section	_bfd_elf_init_1_index_section
   4763   1.1  christos #define elf_backend_relocate_section    _bfd_mips_elf_relocate_section
   4764   1.1  christos #define elf_backend_finish_dynamic_symbol \
   4765   1.1  christos 				_bfd_mips_elf_finish_dynamic_symbol
   4766   1.8  christos #define elf_backend_finish_dynamic_sections \
   4767   1.1  christos 				_bfd_mips_elf_finish_dynamic_sections
   4768   1.1  christos #define elf_backend_final_write_processing \
   4769   1.1  christos 				_bfd_mips_elf_final_write_processing
   4770   1.1  christos #define elf_backend_additional_program_headers \
   4771   1.1  christos 				_bfd_mips_elf_additional_program_headers
   4772   1.1  christos #define elf_backend_modify_segment_map	_bfd_mips_elf_modify_segment_map
   4773   1.1  christos #define elf_backend_gc_mark_hook	_bfd_mips_elf_gc_mark_hook
   4774   1.1  christos #define elf_backend_copy_indirect_symbol \
   4775   1.1  christos 					_bfd_mips_elf_copy_indirect_symbol
   4776   1.1  christos #define elf_backend_hide_symbol		_bfd_mips_elf_hide_symbol
   4777   1.1  christos #define elf_backend_ignore_discarded_relocs \
   4778   1.7  christos 					_bfd_mips_elf_ignore_discarded_relocs
   4779   1.1  christos #define elf_backend_mips_irix_compat	elf64_mips_irix_compat
   4780   1.1  christos #define elf_backend_mips_rtype_to_howto	mips_elf64_rtype_to_howto
   4781   1.1  christos #define elf_backend_ecoff_debug_swap	&mips_elf64_ecoff_debug_swap
   4782   1.1  christos #define elf_backend_size_info		mips_elf64_size_info
   4783   1.1  christos 
   4784   1.1  christos #define elf_backend_grok_prstatus	elf64_mips_grok_prstatus
   4785   1.1  christos #define elf_backend_grok_psinfo		elf64_mips_grok_psinfo
   4786   1.1  christos 
   4787   1.1  christos #define elf_backend_got_header_size	(8 * MIPS_RESERVED_GOTNO)
   4788   1.1  christos #define elf_backend_want_dynrelro	1
   4789  1.10  christos 
   4790   1.1  christos /* MIPS ELF64 can use a mixture of REL and RELA, but some Relocations
   4791   1.1  christos    work better/work only in RELA, so we default to this.  */
   4792   1.3  christos #define elf_backend_may_use_rel_p	1
   4793   1.1  christos #define elf_backend_may_use_rela_p	1
   4794   1.1  christos #define elf_backend_default_use_rela_p	1
   4795   1.1  christos #define elf_backend_rela_plts_and_copies_p 0
   4796   1.1  christos #define elf_backend_plt_readonly	1
   4797   1.1  christos #define elf_backend_plt_sym_val		_bfd_mips_elf_plt_sym_val
   4798   1.1  christos 
   4799   1.1  christos #define elf_backend_sign_extend_vma	true
   4800  1.10  christos 
   4801  1.10  christos #define elf_backend_write_section	_bfd_mips_elf_write_section
   4802   1.1  christos #define elf_backend_sort_relocs_p	_bfd_mips_elf_sort_relocs_p
   4803   1.1  christos 
   4804   1.1  christos /* We don't set bfd_elf64_bfd_is_local_label_name because the 32-bit
   4805   1.1  christos    MIPS-specific function only applies to IRIX5, which had no 64-bit
   4806   1.1  christos    ABI.  */
   4807   1.1  christos #define bfd_elf64_bfd_is_target_special_symbol \
   4808   1.1  christos 					_bfd_mips_elf_is_target_special_symbol
   4809   1.1  christos #define bfd_elf64_find_nearest_line	_bfd_mips_elf_find_nearest_line
   4810   1.1  christos #define bfd_elf64_find_nearest_line_with_alt \
   4811   1.1  christos 				_bfd_mips_elf_find_nearest_line_with_alt
   4812   1.1  christos #define bfd_elf64_find_inliner_info	_bfd_mips_elf_find_inliner_info
   4813   1.1  christos #define bfd_elf64_new_section_hook	_bfd_mips_elf_new_section_hook
   4814   1.1  christos #define bfd_elf64_set_section_contents	_bfd_mips_elf_set_section_contents
   4815   1.1  christos #define bfd_elf64_bfd_get_relocated_section_contents \
   4816   1.1  christos 				_bfd_elf_mips_get_relocated_section_contents
   4817   1.1  christos #define bfd_elf64_bfd_link_hash_table_create \
   4818  1.10  christos 				_bfd_mips_elf_link_hash_table_create
   4819   1.1  christos #define bfd_elf64_bfd_final_link	_bfd_mips_elf_final_link
   4820   1.1  christos #define bfd_elf64_bfd_merge_private_bfd_data \
   4821   1.3  christos 				_bfd_mips_elf_merge_private_bfd_data
   4822   1.1  christos #define bfd_elf64_bfd_set_private_flags	_bfd_mips_elf_set_private_flags
   4823   1.3  christos #define bfd_elf64_bfd_print_private_bfd_data \
   4824   1.1  christos 				_bfd_mips_elf_print_private_bfd_data
   4825   1.1  christos 
   4826   1.1  christos #define bfd_elf64_get_dynamic_reloc_upper_bound mips_elf64_get_dynamic_reloc_upper_bound
   4827   1.1  christos #define bfd_elf64_mkobject		_bfd_mips_elf_mkobject
   4828   1.1  christos #define bfd_elf64_close_and_cleanup	_bfd_mips_elf_close_and_cleanup
   4829   1.1  christos 
   4830   1.1  christos /* The SGI style (n)64 NewABI.  */
   4831   1.1  christos #define TARGET_LITTLE_SYM		mips_elf64_le_vec
   4832   1.1  christos #define TARGET_LITTLE_NAME		"elf64-littlemips"
   4833   1.1  christos #define TARGET_BIG_SYM			mips_elf64_be_vec
   4834   1.1  christos #define TARGET_BIG_NAME			"elf64-bigmips"
   4835   1.1  christos 
   4836   1.1  christos #define ELF_MAXPAGESIZE			0x10000
   4837   1.1  christos #define ELF_COMMONPAGESIZE		0x1000
   4838   1.1  christos 
   4839   1.1  christos #include "elf64-target.h"
   4840   1.3  christos 
   4841   1.1  christos /* The SYSV-style 'traditional' (n)64 NewABI.  */
   4842   1.3  christos #undef TARGET_LITTLE_SYM
   4843   1.1  christos #undef TARGET_LITTLE_NAME
   4844   1.1  christos #undef TARGET_BIG_SYM
   4845   1.1  christos #undef TARGET_BIG_NAME
   4846   1.1  christos 
   4847   1.1  christos #undef ELF_MAXPAGESIZE
   4848   1.1  christos #undef ELF_COMMONPAGESIZE
   4849   1.8  christos 
   4850   1.8  christos #define TARGET_LITTLE_SYM		mips_elf64_trad_le_vec
   4851   1.8  christos #define TARGET_LITTLE_NAME		"elf64-tradlittlemips"
   4852   1.1  christos #define TARGET_BIG_SYM			mips_elf64_trad_be_vec
   4853   1.1  christos #define TARGET_BIG_NAME			"elf64-tradbigmips"
   4854   1.1  christos 
   4855   1.1  christos #define ELF_MAXPAGESIZE			0x10000
   4856   1.1  christos #define ELF_COMMONPAGESIZE		0x1000
   4857   1.1  christos #define elf64_bed			elf64_tradbed
   4858   1.1  christos 
   4859   1.1  christos #undef elf_backend_write_core_note
   4860   1.1  christos #define elf_backend_write_core_note	elf64_mips_write_core_note
   4861   1.1  christos 
   4862   1.1  christos /* Include the target file again for this target.  */
   4863   1.3  christos #include "elf64-target.h"
   4864   1.1  christos 
   4865   1.3  christos 
   4866   1.1  christos /* FreeBSD support.  */
   4867   1.1  christos 
   4868   1.1  christos #undef TARGET_LITTLE_SYM
   4869   1.1  christos #undef TARGET_LITTLE_NAME
   4870   1.1  christos #undef TARGET_BIG_SYM
   4871   1.1  christos #undef TARGET_BIG_NAME
   4872   1.1  christos 
   4873   1.1  christos #define	TARGET_LITTLE_SYM		mips_elf64_tradfbsd_le_vec
   4874   1.8  christos #define	TARGET_LITTLE_NAME		"elf64-tradlittlemips-freebsd"
   4875   1.8  christos #define	TARGET_BIG_SYM			mips_elf64_tradfbsd_be_vec
   4876   1.1  christos #define	TARGET_BIG_NAME			"elf64-tradbigmips-freebsd"
   4877                 
   4878                 #undef	ELF_OSABI
   4879                 #define	ELF_OSABI			ELFOSABI_FREEBSD
   4880                 
   4881                 #undef	elf64_bed
   4882                 #define elf64_bed				elf64_fbsd_tradbed
   4883                 
   4884                 #undef elf64_mips_write_core_note
   4885                 
   4886                 #include "elf64-target.h"
   4887