Home | History | Annotate | Line # | Download | only in bfd
elfn32-mips.c revision 1.3
      1  1.1  christos /* MIPS-specific support for 32-bit ELF
      2  1.3  christos    Copyright (C) 1993-2015 Free Software Foundation, Inc.
      3  1.1  christos 
      4  1.1  christos    Most of the information added by Ian Lance Taylor, Cygnus Support,
      5  1.1  christos    <ian (at) cygnus.com>.
      6  1.1  christos    N32/64 ABI support added by Mark Mitchell, CodeSourcery, LLC.
      7  1.1  christos    <mark (at) codesourcery.com>
      8  1.1  christos    Traditional MIPS targets support added by Koundinya.K, Dansk Data
      9  1.1  christos    Elektronik & Operations Research Group. <kk (at) ddeorg.soft.net>
     10  1.1  christos 
     11  1.1  christos    This file is part of BFD, the Binary File Descriptor library.
     12  1.1  christos 
     13  1.1  christos    This program is free software; you can redistribute it and/or modify
     14  1.1  christos    it under the terms of the GNU General Public License as published by
     15  1.1  christos    the Free Software Foundation; either version 3 of the License, or
     16  1.1  christos    (at your option) any later version.
     17  1.1  christos 
     18  1.1  christos    This program is distributed in the hope that it will be useful,
     19  1.1  christos    but WITHOUT ANY WARRANTY; without even the implied warranty of
     20  1.1  christos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     21  1.1  christos    GNU General Public License for more details.
     22  1.1  christos 
     23  1.1  christos    You should have received a copy of the GNU General Public License
     24  1.1  christos    along with this program; if not, write to the Free Software
     25  1.1  christos    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
     26  1.1  christos    MA 02110-1301, USA.  */
     27  1.1  christos 
     28  1.1  christos 
     29  1.1  christos /* This file handles MIPS ELF targets.  SGI Irix 5 uses a slightly
     30  1.1  christos    different MIPS ELF from other targets.  This matters when linking.
     31  1.1  christos    This file supports both, switching at runtime.  */
     32  1.1  christos 
     33  1.1  christos #include "sysdep.h"
     34  1.1  christos #include "bfd.h"
     35  1.1  christos #include "libbfd.h"
     36  1.1  christos #include "bfdlink.h"
     37  1.1  christos #include "genlink.h"
     38  1.1  christos #include "elf-bfd.h"
     39  1.1  christos #include "elfxx-mips.h"
     40  1.1  christos #include "elf/mips.h"
     41  1.1  christos 
     42  1.1  christos /* Get the ECOFF swapping routines.  */
     43  1.1  christos #include "coff/sym.h"
     44  1.1  christos #include "coff/symconst.h"
     45  1.1  christos #include "coff/internal.h"
     46  1.1  christos #include "coff/ecoff.h"
     47  1.1  christos #include "coff/mips.h"
     48  1.1  christos #define ECOFF_SIGNED_32
     49  1.1  christos #include "ecoffswap.h"
     50  1.1  christos 
     51  1.1  christos static bfd_boolean mips_elf_assign_gp
     52  1.1  christos   (bfd *, bfd_vma *);
     53  1.1  christos static bfd_reloc_status_type mips_elf_final_gp
     54  1.1  christos   (bfd *, asymbol *, bfd_boolean, char **, bfd_vma *);
     55  1.1  christos static bfd_reloc_status_type mips_elf_gprel16_reloc
     56  1.1  christos   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
     57  1.1  christos static bfd_reloc_status_type mips_elf_literal_reloc
     58  1.1  christos   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
     59  1.1  christos static bfd_reloc_status_type mips_elf_gprel32_reloc
     60  1.1  christos   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
     61  1.1  christos static bfd_reloc_status_type gprel32_with_gp
     62  1.1  christos   (bfd *, asymbol *, arelent *, asection *, bfd_boolean, void *, bfd_vma);
     63  1.1  christos static bfd_reloc_status_type mips_elf_shift6_reloc
     64  1.1  christos   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
     65  1.1  christos static bfd_reloc_status_type mips16_gprel_reloc
     66  1.1  christos   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
     67  1.1  christos static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
     68  1.1  christos   (bfd *, bfd_reloc_code_real_type);
     69  1.1  christos static reloc_howto_type *mips_elf_n32_rtype_to_howto
     70  1.1  christos   (unsigned int, bfd_boolean);
     71  1.1  christos static void mips_info_to_howto_rel
     72  1.1  christos   (bfd *, arelent *, Elf_Internal_Rela *);
     73  1.1  christos static void mips_info_to_howto_rela
     74  1.1  christos   (bfd *, arelent *, Elf_Internal_Rela *);
     75  1.1  christos static bfd_boolean mips_elf_sym_is_global
     76  1.1  christos   (bfd *, asymbol *);
     77  1.1  christos static bfd_boolean mips_elf_n32_object_p
     78  1.1  christos   (bfd *);
     79  1.1  christos static bfd_boolean elf32_mips_grok_prstatus
     80  1.1  christos   (bfd *, Elf_Internal_Note *);
     81  1.1  christos static bfd_boolean elf32_mips_grok_psinfo
     82  1.1  christos   (bfd *, Elf_Internal_Note *);
     83  1.1  christos static bfd_boolean mips_elf_n32_is_local_label_name
     84  1.1  christos   (bfd *, const char *);
     85  1.1  christos static irix_compat_t elf_n32_mips_irix_compat
     86  1.1  christos   (bfd *);
     87  1.1  christos 
     88  1.3  christos extern const bfd_target mips_elf32_n_be_vec;
     89  1.3  christos extern const bfd_target mips_elf32_n_le_vec;
     90  1.1  christos 
     91  1.1  christos /* Nonzero if ABFD is using the N32 ABI.  */
     92  1.1  christos #define ABI_N32_P(abfd) \
     93  1.1  christos   ((elf_elfheader (abfd)->e_flags & EF_MIPS_ABI2) != 0)
     94  1.1  christos 
     95  1.1  christos /* Whether we are trying to be compatible with IRIX at all.  */
     96  1.1  christos #define SGI_COMPAT(abfd) \
     97  1.1  christos   (elf_n32_mips_irix_compat (abfd) != ict_none)
     98  1.1  christos 
     99  1.1  christos /* The number of local .got entries we reserve.  */
    100  1.1  christos #define MIPS_RESERVED_GOTNO (2)
    101  1.1  christos 
    102  1.1  christos /* In case we're on a 32-bit machine, construct a 64-bit "-1" value
    103  1.1  christos    from smaller values.  Start with zero, widen, *then* decrement.  */
    104  1.1  christos #define MINUS_ONE	(((bfd_vma)0) - 1)
    105  1.1  christos 
    106  1.1  christos /* The relocation table used for SHT_REL sections.  */
    107  1.1  christos 
    108  1.1  christos static reloc_howto_type elf_mips_howto_table_rel[] =
    109  1.1  christos {
    110  1.1  christos   /* No relocation.  */
    111  1.1  christos   HOWTO (R_MIPS_NONE,		/* type */
    112  1.1  christos 	 0,			/* rightshift */
    113  1.3  christos 	 3,			/* size (0 = byte, 1 = short, 2 = long) */
    114  1.1  christos 	 0,			/* bitsize */
    115  1.1  christos 	 FALSE,			/* pc_relative */
    116  1.1  christos 	 0,			/* bitpos */
    117  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    118  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    119  1.1  christos 	 "R_MIPS_NONE",		/* name */
    120  1.1  christos 	 FALSE,			/* partial_inplace */
    121  1.1  christos 	 0,			/* src_mask */
    122  1.1  christos 	 0,			/* dst_mask */
    123  1.1  christos 	 FALSE),		/* pcrel_offset */
    124  1.1  christos 
    125  1.1  christos   /* 16 bit relocation.  */
    126  1.1  christos   HOWTO (R_MIPS_16,		/* type */
    127  1.1  christos 	 0,			/* rightshift */
    128  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    129  1.1  christos 	 16,			/* bitsize */
    130  1.1  christos 	 FALSE,			/* pc_relative */
    131  1.1  christos 	 0,			/* bitpos */
    132  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    133  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    134  1.1  christos 	 "R_MIPS_16",		/* name */
    135  1.1  christos 	 TRUE,			/* partial_inplace */
    136  1.1  christos 	 0x0000ffff,		/* src_mask */
    137  1.1  christos 	 0x0000ffff,		/* dst_mask */
    138  1.1  christos 	 FALSE),		/* pcrel_offset */
    139  1.1  christos 
    140  1.1  christos   /* 32 bit relocation.  */
    141  1.1  christos   HOWTO (R_MIPS_32,		/* type */
    142  1.1  christos 	 0,			/* rightshift */
    143  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    144  1.1  christos 	 32,			/* bitsize */
    145  1.1  christos 	 FALSE,			/* pc_relative */
    146  1.1  christos 	 0,			/* bitpos */
    147  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    148  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    149  1.1  christos 	 "R_MIPS_32",		/* name */
    150  1.1  christos 	 TRUE,			/* partial_inplace */
    151  1.1  christos 	 0xffffffff,		/* src_mask */
    152  1.1  christos 	 0xffffffff,		/* dst_mask */
    153  1.1  christos 	 FALSE),		/* pcrel_offset */
    154  1.1  christos 
    155  1.1  christos   /* 32 bit symbol relative relocation.  */
    156  1.1  christos   HOWTO (R_MIPS_REL32,		/* type */
    157  1.1  christos 	 0,			/* rightshift */
    158  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    159  1.1  christos 	 32,			/* bitsize */
    160  1.1  christos 	 FALSE,			/* pc_relative */
    161  1.1  christos 	 0,			/* bitpos */
    162  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    163  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    164  1.1  christos 	 "R_MIPS_REL32",	/* name */
    165  1.1  christos 	 TRUE,			/* partial_inplace */
    166  1.1  christos 	 0xffffffff,		/* src_mask */
    167  1.1  christos 	 0xffffffff,		/* dst_mask */
    168  1.1  christos 	 FALSE),		/* pcrel_offset */
    169  1.1  christos 
    170  1.1  christos   /* 26 bit jump address.  */
    171  1.1  christos   HOWTO (R_MIPS_26,		/* type */
    172  1.1  christos 	 2,			/* rightshift */
    173  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    174  1.1  christos 	 26,			/* bitsize */
    175  1.1  christos 	 FALSE,			/* pc_relative */
    176  1.1  christos 	 0,			/* bitpos */
    177  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    178  1.1  christos 	 			/* This needs complex overflow
    179  1.1  christos 				   detection, because the upper four
    180  1.1  christos 				   bits must match the PC + 4.  */
    181  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    182  1.1  christos 	 "R_MIPS_26",		/* name */
    183  1.1  christos 	 TRUE,			/* partial_inplace */
    184  1.1  christos 	 0x03ffffff,		/* src_mask */
    185  1.1  christos 	 0x03ffffff,		/* dst_mask */
    186  1.1  christos 	 FALSE),		/* pcrel_offset */
    187  1.1  christos 
    188  1.1  christos   /* R_MIPS_HI16 and R_MIPS_LO16 are unsupported for NewABI REL.
    189  1.1  christos      However, the native IRIX6 tools use them, so we try our best. */
    190  1.1  christos 
    191  1.1  christos   /* High 16 bits of symbol value.  */
    192  1.1  christos   HOWTO (R_MIPS_HI16,		/* type */
    193  1.1  christos 	 16,			/* rightshift */
    194  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    195  1.1  christos 	 16,			/* bitsize */
    196  1.1  christos 	 FALSE,			/* pc_relative */
    197  1.1  christos 	 0,			/* bitpos */
    198  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    199  1.1  christos 	 _bfd_mips_elf_hi16_reloc, /* special_function */
    200  1.1  christos 	 "R_MIPS_HI16",		/* name */
    201  1.1  christos 	 TRUE,			/* partial_inplace */
    202  1.1  christos 	 0x0000ffff,		/* src_mask */
    203  1.1  christos 	 0x0000ffff,		/* dst_mask */
    204  1.1  christos 	 FALSE),		/* pcrel_offset */
    205  1.1  christos 
    206  1.1  christos   /* Low 16 bits of symbol value.  */
    207  1.1  christos   HOWTO (R_MIPS_LO16,		/* type */
    208  1.1  christos 	 0,			/* rightshift */
    209  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    210  1.1  christos 	 16,			/* bitsize */
    211  1.1  christos 	 FALSE,			/* pc_relative */
    212  1.1  christos 	 0,			/* bitpos */
    213  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    214  1.1  christos 	 _bfd_mips_elf_lo16_reloc, /* special_function */
    215  1.1  christos 	 "R_MIPS_LO16",		/* name */
    216  1.1  christos 	 TRUE,			/* partial_inplace */
    217  1.1  christos 	 0x0000ffff,		/* src_mask */
    218  1.1  christos 	 0x0000ffff,		/* dst_mask */
    219  1.1  christos 	 FALSE),		/* pcrel_offset */
    220  1.1  christos 
    221  1.1  christos   /* GP relative reference.  */
    222  1.1  christos   HOWTO (R_MIPS_GPREL16,	/* type */
    223  1.1  christos 	 0,			/* rightshift */
    224  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    225  1.1  christos 	 16,			/* bitsize */
    226  1.1  christos 	 FALSE,			/* pc_relative */
    227  1.1  christos 	 0,			/* bitpos */
    228  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    229  1.1  christos 	 mips_elf_gprel16_reloc, /* special_function */
    230  1.1  christos 	 "R_MIPS_GPREL16",	/* name */
    231  1.1  christos 	 TRUE,			/* partial_inplace */
    232  1.1  christos 	 0x0000ffff,		/* src_mask */
    233  1.1  christos 	 0x0000ffff,		/* dst_mask */
    234  1.1  christos 	 FALSE),		/* pcrel_offset */
    235  1.1  christos 
    236  1.1  christos   /* Reference to literal section.  */
    237  1.1  christos   HOWTO (R_MIPS_LITERAL,	/* type */
    238  1.1  christos 	 0,			/* rightshift */
    239  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    240  1.1  christos 	 16,			/* bitsize */
    241  1.1  christos 	 FALSE,			/* pc_relative */
    242  1.1  christos 	 0,			/* bitpos */
    243  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    244  1.1  christos 	 mips_elf_literal_reloc, /* special_function */
    245  1.1  christos 	 "R_MIPS_LITERAL",	/* name */
    246  1.1  christos 	 TRUE,			/* partial_inplace */
    247  1.1  christos 	 0x0000ffff,		/* src_mask */
    248  1.1  christos 	 0x0000ffff,		/* dst_mask */
    249  1.1  christos 	 FALSE),		/* pcrel_offset */
    250  1.1  christos 
    251  1.1  christos   /* Reference to global offset table.  */
    252  1.1  christos   HOWTO (R_MIPS_GOT16,		/* type */
    253  1.1  christos 	 0,			/* rightshift */
    254  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    255  1.1  christos 	 16,			/* bitsize */
    256  1.1  christos 	 FALSE,			/* pc_relative */
    257  1.1  christos 	 0,			/* bitpos */
    258  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    259  1.1  christos 	 _bfd_mips_elf_got16_reloc, /* special_function */
    260  1.1  christos 	 "R_MIPS_GOT16",	/* name */
    261  1.1  christos 	 TRUE,			/* partial_inplace */
    262  1.1  christos 	 0x0000ffff,		/* src_mask */
    263  1.1  christos 	 0x0000ffff,		/* dst_mask */
    264  1.1  christos 	 FALSE),		/* pcrel_offset */
    265  1.1  christos 
    266  1.1  christos   /* 16 bit PC relative reference.  Note that the ABI document has a typo
    267  1.1  christos      and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
    268  1.1  christos      We do the right thing here.  */
    269  1.1  christos   HOWTO (R_MIPS_PC16,		/* type */
    270  1.1  christos 	 2,			/* rightshift */
    271  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    272  1.1  christos 	 16,			/* bitsize */
    273  1.1  christos 	 TRUE,			/* pc_relative */
    274  1.1  christos 	 0,			/* bitpos */
    275  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    276  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    277  1.1  christos 	 "R_MIPS_PC16",		/* name */
    278  1.1  christos 	 TRUE,			/* partial_inplace */
    279  1.1  christos 	 0x0000ffff,		/* src_mask */
    280  1.1  christos 	 0x0000ffff,		/* dst_mask */
    281  1.1  christos 	 TRUE),			/* pcrel_offset */
    282  1.1  christos 
    283  1.1  christos   /* 16 bit call through global offset table.  */
    284  1.1  christos   HOWTO (R_MIPS_CALL16,		/* type */
    285  1.1  christos 	 0,			/* rightshift */
    286  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    287  1.1  christos 	 16,			/* bitsize */
    288  1.1  christos 	 FALSE,			/* pc_relative */
    289  1.1  christos 	 0,			/* bitpos */
    290  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    291  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    292  1.1  christos 	 "R_MIPS_CALL16",	/* name */
    293  1.1  christos 	 TRUE,			/* partial_inplace */
    294  1.1  christos 	 0x0000ffff,		/* src_mask */
    295  1.1  christos 	 0x0000ffff,		/* dst_mask */
    296  1.1  christos 	 FALSE),		/* pcrel_offset */
    297  1.1  christos 
    298  1.1  christos   /* 32 bit GP relative reference.  */
    299  1.1  christos   HOWTO (R_MIPS_GPREL32,	/* type */
    300  1.1  christos 	 0,			/* rightshift */
    301  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    302  1.1  christos 	 32,			/* bitsize */
    303  1.1  christos 	 FALSE,			/* pc_relative */
    304  1.1  christos 	 0,			/* bitpos */
    305  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    306  1.1  christos 	 mips_elf_gprel32_reloc, /* special_function */
    307  1.1  christos 	 "R_MIPS_GPREL32",	/* name */
    308  1.1  christos 	 TRUE,			/* partial_inplace */
    309  1.1  christos 	 0xffffffff,		/* src_mask */
    310  1.1  christos 	 0xffffffff,		/* dst_mask */
    311  1.1  christos 	 FALSE),		/* pcrel_offset */
    312  1.1  christos 
    313  1.1  christos   /* The remaining relocs are defined on Irix 5, although they are
    314  1.1  christos      not defined by the ABI.  */
    315  1.1  christos   EMPTY_HOWTO (13),
    316  1.1  christos   EMPTY_HOWTO (14),
    317  1.1  christos   EMPTY_HOWTO (15),
    318  1.1  christos 
    319  1.1  christos   /* A 5 bit shift field.  */
    320  1.1  christos   HOWTO (R_MIPS_SHIFT5,		/* type */
    321  1.1  christos 	 0,			/* rightshift */
    322  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    323  1.1  christos 	 5,			/* bitsize */
    324  1.1  christos 	 FALSE,			/* pc_relative */
    325  1.1  christos 	 6,			/* bitpos */
    326  1.1  christos 	 complain_overflow_bitfield, /* complain_on_overflow */
    327  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    328  1.1  christos 	 "R_MIPS_SHIFT5",	/* name */
    329  1.1  christos 	 TRUE,			/* partial_inplace */
    330  1.1  christos 	 0x000007c0,		/* src_mask */
    331  1.1  christos 	 0x000007c0,		/* dst_mask */
    332  1.1  christos 	 FALSE),		/* pcrel_offset */
    333  1.1  christos 
    334  1.1  christos   /* A 6 bit shift field.  */
    335  1.1  christos   HOWTO (R_MIPS_SHIFT6,		/* type */
    336  1.1  christos 	 0,			/* rightshift */
    337  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    338  1.1  christos 	 6,			/* bitsize */
    339  1.1  christos 	 FALSE,			/* pc_relative */
    340  1.1  christos 	 6,			/* bitpos */
    341  1.1  christos 	 complain_overflow_bitfield, /* complain_on_overflow */
    342  1.1  christos 	 mips_elf_shift6_reloc,	/* special_function */
    343  1.1  christos 	 "R_MIPS_SHIFT6",	/* name */
    344  1.1  christos 	 TRUE,			/* partial_inplace */
    345  1.1  christos 	 0x000007c4,		/* src_mask */
    346  1.1  christos 	 0x000007c4,		/* dst_mask */
    347  1.1  christos 	 FALSE),		/* pcrel_offset */
    348  1.1  christos 
    349  1.1  christos   /* A 64 bit relocation.  */
    350  1.1  christos   HOWTO (R_MIPS_64,		/* type */
    351  1.1  christos 	 0,			/* rightshift */
    352  1.1  christos 	 4,			/* size (0 = byte, 1 = short, 2 = long) */
    353  1.1  christos 	 64,			/* bitsize */
    354  1.1  christos 	 FALSE,			/* pc_relative */
    355  1.1  christos 	 0,			/* bitpos */
    356  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    357  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    358  1.1  christos 	 "R_MIPS_64",		/* name */
    359  1.1  christos 	 TRUE,			/* partial_inplace */
    360  1.1  christos 	 MINUS_ONE,		/* src_mask */
    361  1.1  christos 	 MINUS_ONE,		/* dst_mask */
    362  1.1  christos 	 FALSE),		/* pcrel_offset */
    363  1.1  christos 
    364  1.1  christos   /* Displacement in the global offset table.  */
    365  1.1  christos   HOWTO (R_MIPS_GOT_DISP,	/* type */
    366  1.1  christos 	 0,			/* rightshift */
    367  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    368  1.1  christos 	 16,			/* bitsize */
    369  1.1  christos 	 FALSE,			/* pc_relative */
    370  1.1  christos 	 0,			/* bitpos */
    371  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    372  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    373  1.1  christos 	 "R_MIPS_GOT_DISP",	/* name */
    374  1.1  christos 	 TRUE,			/* partial_inplace */
    375  1.1  christos 	 0x0000ffff,		/* src_mask */
    376  1.1  christos 	 0x0000ffff,		/* dst_mask */
    377  1.1  christos 	 FALSE),		/* pcrel_offset */
    378  1.1  christos 
    379  1.1  christos   /* Displacement to page pointer in the global offset table.  */
    380  1.1  christos   HOWTO (R_MIPS_GOT_PAGE,	/* type */
    381  1.1  christos 	 0,			/* rightshift */
    382  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    383  1.1  christos 	 16,			/* bitsize */
    384  1.1  christos 	 FALSE,			/* pc_relative */
    385  1.1  christos 	 0,			/* bitpos */
    386  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    387  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    388  1.1  christos 	 "R_MIPS_GOT_PAGE",	/* name */
    389  1.1  christos 	 TRUE,			/* partial_inplace */
    390  1.1  christos 	 0x0000ffff,		/* src_mask */
    391  1.1  christos 	 0x0000ffff,		/* dst_mask */
    392  1.1  christos 	 FALSE),		/* pcrel_offset */
    393  1.1  christos 
    394  1.1  christos   /* Offset from page pointer in the global offset table.  */
    395  1.1  christos   HOWTO (R_MIPS_GOT_OFST,	/* type */
    396  1.1  christos 	 0,			/* rightshift */
    397  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    398  1.1  christos 	 16,			/* bitsize */
    399  1.1  christos 	 FALSE,			/* pc_relative */
    400  1.1  christos 	 0,			/* bitpos */
    401  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    402  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    403  1.1  christos 	 "R_MIPS_GOT_OFST",	/* name */
    404  1.1  christos 	 TRUE,			/* partial_inplace */
    405  1.1  christos 	 0x0000ffff,		/* src_mask */
    406  1.1  christos 	 0x0000ffff,		/* dst_mask */
    407  1.1  christos 	 FALSE),		/* pcrel_offset */
    408  1.1  christos 
    409  1.1  christos   /* High 16 bits of displacement in global offset table.  */
    410  1.1  christos   HOWTO (R_MIPS_GOT_HI16,	/* type */
    411  1.1  christos 	 0,			/* rightshift */
    412  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    413  1.1  christos 	 16,			/* bitsize */
    414  1.1  christos 	 FALSE,			/* pc_relative */
    415  1.1  christos 	 0,			/* bitpos */
    416  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    417  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    418  1.1  christos 	 "R_MIPS_GOT_HI16",	/* name */
    419  1.1  christos 	 TRUE,			/* partial_inplace */
    420  1.1  christos 	 0x0000ffff,		/* src_mask */
    421  1.1  christos 	 0x0000ffff,		/* dst_mask */
    422  1.1  christos 	 FALSE),		/* pcrel_offset */
    423  1.1  christos 
    424  1.1  christos   /* Low 16 bits of displacement in global offset table.  */
    425  1.1  christos   HOWTO (R_MIPS_GOT_LO16,	/* type */
    426  1.1  christos 	 0,			/* rightshift */
    427  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    428  1.1  christos 	 16,			/* bitsize */
    429  1.1  christos 	 FALSE,			/* pc_relative */
    430  1.1  christos 	 0,			/* bitpos */
    431  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    432  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    433  1.1  christos 	 "R_MIPS_GOT_LO16",	/* name */
    434  1.1  christos 	 TRUE,			/* partial_inplace */
    435  1.1  christos 	 0x0000ffff,		/* src_mask */
    436  1.1  christos 	 0x0000ffff,		/* dst_mask */
    437  1.1  christos 	 FALSE),		/* pcrel_offset */
    438  1.1  christos 
    439  1.1  christos   /* 64 bit subtraction.  */
    440  1.1  christos   HOWTO (R_MIPS_SUB,		/* type */
    441  1.1  christos 	 0,			/* rightshift */
    442  1.1  christos 	 4,			/* size (0 = byte, 1 = short, 2 = long) */
    443  1.1  christos 	 64,			/* bitsize */
    444  1.1  christos 	 FALSE,			/* pc_relative */
    445  1.1  christos 	 0,			/* bitpos */
    446  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    447  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    448  1.1  christos 	 "R_MIPS_SUB",		/* name */
    449  1.1  christos 	 TRUE,			/* partial_inplace */
    450  1.1  christos 	 MINUS_ONE,		/* src_mask */
    451  1.1  christos 	 MINUS_ONE,		/* dst_mask */
    452  1.1  christos 	 FALSE),		/* pcrel_offset */
    453  1.1  christos 
    454  1.1  christos   /* Insert the addend as an instruction.  */
    455  1.1  christos   /* FIXME: Not handled correctly.  */
    456  1.1  christos   HOWTO (R_MIPS_INSERT_A,	/* type */
    457  1.1  christos 	 0,			/* rightshift */
    458  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    459  1.1  christos 	 32,			/* bitsize */
    460  1.1  christos 	 FALSE,			/* pc_relative */
    461  1.1  christos 	 0,			/* bitpos */
    462  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    463  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    464  1.1  christos 	 "R_MIPS_INSERT_A",	/* name */
    465  1.1  christos 	 TRUE,			/* partial_inplace */
    466  1.1  christos 	 0xffffffff,		/* src_mask */
    467  1.1  christos 	 0xffffffff,		/* dst_mask */
    468  1.1  christos 	 FALSE),		/* pcrel_offset */
    469  1.1  christos 
    470  1.1  christos   /* Insert the addend as an instruction, and change all relocations
    471  1.1  christos      to refer to the old instruction at the address.  */
    472  1.1  christos   /* FIXME: Not handled correctly.  */
    473  1.1  christos   HOWTO (R_MIPS_INSERT_B,	/* type */
    474  1.1  christos 	 0,			/* rightshift */
    475  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    476  1.1  christos 	 32,			/* bitsize */
    477  1.1  christos 	 FALSE,			/* pc_relative */
    478  1.1  christos 	 0,			/* bitpos */
    479  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    480  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    481  1.1  christos 	 "R_MIPS_INSERT_B",	/* name */
    482  1.1  christos 	 TRUE,			/* partial_inplace */
    483  1.1  christos 	 0xffffffff,		/* src_mask */
    484  1.1  christos 	 0xffffffff,		/* dst_mask */
    485  1.1  christos 	 FALSE),		/* pcrel_offset */
    486  1.1  christos 
    487  1.1  christos   /* Delete a 32 bit instruction.  */
    488  1.1  christos   /* FIXME: Not handled correctly.  */
    489  1.1  christos   HOWTO (R_MIPS_DELETE,		/* type */
    490  1.1  christos 	 0,			/* rightshift */
    491  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    492  1.1  christos 	 32,			/* bitsize */
    493  1.1  christos 	 FALSE,			/* pc_relative */
    494  1.1  christos 	 0,			/* bitpos */
    495  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    496  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    497  1.1  christos 	 "R_MIPS_DELETE",	/* name */
    498  1.1  christos 	 TRUE,			/* partial_inplace */
    499  1.1  christos 	 0xffffffff,		/* src_mask */
    500  1.1  christos 	 0xffffffff,		/* dst_mask */
    501  1.1  christos 	 FALSE),		/* pcrel_offset */
    502  1.1  christos 
    503  1.1  christos   /* The MIPS ELF64 ABI Draft wants us to support these for REL relocations.
    504  1.1  christos      We don't, because
    505  1.1  christos        a) It means building the addend from a R_MIPS_HIGHEST/R_MIPS_HIGHER/
    506  1.1  christos 	  R_MIPS_HI16/R_MIPS_LO16 sequence with varying ordering, using
    507  1.1  christos 	  fallable heuristics.
    508  1.1  christos        b) No other NewABI toolchain actually emits such relocations.  */
    509  1.1  christos   EMPTY_HOWTO (R_MIPS_HIGHER),
    510  1.1  christos   EMPTY_HOWTO (R_MIPS_HIGHEST),
    511  1.1  christos 
    512  1.1  christos   /* High 16 bits of displacement in global offset table.  */
    513  1.1  christos   HOWTO (R_MIPS_CALL_HI16,	/* type */
    514  1.1  christos 	 0,			/* rightshift */
    515  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    516  1.1  christos 	 16,			/* 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.1  christos 	 "R_MIPS_CALL_HI16",	/* name */
    522  1.1  christos 	 TRUE,			/* partial_inplace */
    523  1.1  christos 	 0x0000ffff,		/* src_mask */
    524  1.1  christos 	 0x0000ffff,		/* dst_mask */
    525  1.1  christos 	 FALSE),		/* pcrel_offset */
    526  1.1  christos 
    527  1.1  christos   /* Low 16 bits of displacement in global offset table.  */
    528  1.1  christos   HOWTO (R_MIPS_CALL_LO16,	/* type */
    529  1.1  christos 	 0,			/* rightshift */
    530  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    531  1.1  christos 	 16,			/* bitsize */
    532  1.1  christos 	 FALSE,			/* pc_relative */
    533  1.1  christos 	 0,			/* bitpos */
    534  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    535  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    536  1.1  christos 	 "R_MIPS_CALL_LO16",	/* name */
    537  1.1  christos 	 TRUE,			/* partial_inplace */
    538  1.1  christos 	 0x0000ffff,		/* src_mask */
    539  1.1  christos 	 0x0000ffff,		/* dst_mask */
    540  1.1  christos 	 FALSE),		/* pcrel_offset */
    541  1.1  christos 
    542  1.1  christos   /* Section displacement.  */
    543  1.1  christos   HOWTO (R_MIPS_SCN_DISP,       /* type */
    544  1.1  christos 	 0,			/* rightshift */
    545  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    546  1.1  christos 	 32,			/* bitsize */
    547  1.1  christos 	 FALSE,			/* pc_relative */
    548  1.1  christos 	 0,			/* bitpos */
    549  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    550  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    551  1.1  christos 	 "R_MIPS_SCN_DISP",     /* name */
    552  1.1  christos 	 TRUE,			/* partial_inplace */
    553  1.1  christos 	 0xffffffff,		/* src_mask */
    554  1.1  christos 	 0xffffffff,		/* dst_mask */
    555  1.1  christos 	 FALSE),		/* pcrel_offset */
    556  1.1  christos 
    557  1.1  christos   HOWTO (R_MIPS_REL16,		/* type */
    558  1.1  christos 	 0,			/* rightshift */
    559  1.1  christos 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
    560  1.1  christos 	 16,			/* bitsize */
    561  1.1  christos 	 FALSE,			/* pc_relative */
    562  1.1  christos 	 0,			/* bitpos */
    563  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    564  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    565  1.1  christos 	 "R_MIPS_REL16",	/* name */
    566  1.1  christos 	 TRUE,			/* partial_inplace */
    567  1.1  christos 	 0xffff,		/* src_mask */
    568  1.1  christos 	 0xffff,		/* dst_mask */
    569  1.1  christos 	 FALSE),		/* pcrel_offset */
    570  1.1  christos 
    571  1.1  christos   /* These two are obsolete.  */
    572  1.1  christos   EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
    573  1.1  christos   EMPTY_HOWTO (R_MIPS_PJUMP),
    574  1.1  christos 
    575  1.1  christos   /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
    576  1.1  christos      It must be used for multigot GOT's (and only there).  */
    577  1.1  christos   HOWTO (R_MIPS_RELGOT,		/* type */
    578  1.1  christos 	 0,			/* rightshift */
    579  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    580  1.1  christos 	 32,			/* bitsize */
    581  1.1  christos 	 FALSE,			/* pc_relative */
    582  1.1  christos 	 0,			/* bitpos */
    583  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    584  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    585  1.1  christos 	 "R_MIPS_RELGOT",	/* name */
    586  1.1  christos 	 TRUE,			/* partial_inplace */
    587  1.1  christos 	 0xffffffff,		/* src_mask */
    588  1.1  christos 	 0xffffffff,		/* dst_mask */
    589  1.1  christos 	 FALSE),		/* pcrel_offset */
    590  1.1  christos 
    591  1.1  christos   /* Protected jump conversion.  This is an optimization hint.  No
    592  1.1  christos      relocation is required for correctness.  */
    593  1.1  christos   HOWTO (R_MIPS_JALR,	        /* type */
    594  1.1  christos 	 0,			/* rightshift */
    595  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    596  1.1  christos 	 32,			/* bitsize */
    597  1.1  christos 	 FALSE,			/* pc_relative */
    598  1.1  christos 	 0,			/* bitpos */
    599  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    600  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    601  1.1  christos 	 "R_MIPS_JALR",	        /* name */
    602  1.1  christos 	 FALSE,			/* partial_inplace */
    603  1.1  christos 	 0x00000000,		/* src_mask */
    604  1.1  christos 	 0x00000000,		/* dst_mask */
    605  1.1  christos 	 FALSE),		/* pcrel_offset */
    606  1.1  christos 
    607  1.1  christos   /* TLS GD/LD dynamic relocations.  */
    608  1.1  christos   HOWTO (R_MIPS_TLS_DTPMOD32,	/* type */
    609  1.1  christos 	 0,			/* rightshift */
    610  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    611  1.1  christos 	 32,			/* bitsize */
    612  1.1  christos 	 FALSE,			/* pc_relative */
    613  1.1  christos 	 0,			/* bitpos */
    614  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    615  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    616  1.1  christos 	 "R_MIPS_TLS_DTPMOD32",	/* name */
    617  1.1  christos 	 TRUE,			/* partial_inplace */
    618  1.1  christos 	 0xffffffff,		/* src_mask */
    619  1.1  christos 	 0xffffffff,		/* dst_mask */
    620  1.1  christos 	 FALSE),		/* pcrel_offset */
    621  1.1  christos 
    622  1.1  christos   HOWTO (R_MIPS_TLS_DTPREL32,	/* type */
    623  1.1  christos 	 0,			/* rightshift */
    624  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    625  1.1  christos 	 32,			/* bitsize */
    626  1.1  christos 	 FALSE,			/* pc_relative */
    627  1.1  christos 	 0,			/* bitpos */
    628  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    629  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    630  1.1  christos 	 "R_MIPS_TLS_DTPREL32",	/* name */
    631  1.1  christos 	 TRUE,			/* partial_inplace */
    632  1.1  christos 	 0xffffffff,		/* src_mask */
    633  1.1  christos 	 0xffffffff,		/* dst_mask */
    634  1.1  christos 	 FALSE),		/* pcrel_offset */
    635  1.1  christos 
    636  1.1  christos   EMPTY_HOWTO (R_MIPS_TLS_DTPMOD64),
    637  1.1  christos   EMPTY_HOWTO (R_MIPS_TLS_DTPREL64),
    638  1.1  christos 
    639  1.1  christos   /* TLS general dynamic variable reference.  */
    640  1.1  christos   HOWTO (R_MIPS_TLS_GD,		/* type */
    641  1.1  christos 	 0,			/* rightshift */
    642  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    643  1.1  christos 	 16,			/* bitsize */
    644  1.1  christos 	 FALSE,			/* pc_relative */
    645  1.1  christos 	 0,			/* bitpos */
    646  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    647  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    648  1.1  christos 	 "R_MIPS_TLS_GD",	/* name */
    649  1.1  christos 	 TRUE,			/* partial_inplace */
    650  1.1  christos 	 0x0000ffff,		/* src_mask */
    651  1.1  christos 	 0x0000ffff,		/* dst_mask */
    652  1.1  christos 	 FALSE),		/* pcrel_offset */
    653  1.1  christos 
    654  1.1  christos   /* TLS local dynamic variable reference.  */
    655  1.1  christos   HOWTO (R_MIPS_TLS_LDM,	/* type */
    656  1.1  christos 	 0,			/* rightshift */
    657  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    658  1.1  christos 	 16,			/* bitsize */
    659  1.1  christos 	 FALSE,			/* pc_relative */
    660  1.1  christos 	 0,			/* bitpos */
    661  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    662  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    663  1.1  christos 	 "R_MIPS_TLS_LDM",	/* name */
    664  1.1  christos 	 TRUE,			/* partial_inplace */
    665  1.1  christos 	 0x0000ffff,		/* src_mask */
    666  1.1  christos 	 0x0000ffff,		/* dst_mask */
    667  1.1  christos 	 FALSE),		/* pcrel_offset */
    668  1.1  christos 
    669  1.1  christos   /* TLS local dynamic offset.  */
    670  1.1  christos   HOWTO (R_MIPS_TLS_DTPREL_HI16,	/* type */
    671  1.1  christos 	 0,			/* rightshift */
    672  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    673  1.1  christos 	 16,			/* bitsize */
    674  1.1  christos 	 FALSE,			/* pc_relative */
    675  1.1  christos 	 0,			/* bitpos */
    676  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    677  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    678  1.1  christos 	 "R_MIPS_TLS_DTPREL_HI16",	/* name */
    679  1.1  christos 	 TRUE,			/* partial_inplace */
    680  1.1  christos 	 0x0000ffff,		/* src_mask */
    681  1.1  christos 	 0x0000ffff,		/* dst_mask */
    682  1.1  christos 	 FALSE),		/* pcrel_offset */
    683  1.1  christos 
    684  1.1  christos   /* TLS local dynamic offset.  */
    685  1.1  christos   HOWTO (R_MIPS_TLS_DTPREL_LO16,	/* type */
    686  1.1  christos 	 0,			/* rightshift */
    687  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    688  1.1  christos 	 16,			/* bitsize */
    689  1.1  christos 	 FALSE,			/* pc_relative */
    690  1.1  christos 	 0,			/* bitpos */
    691  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    692  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    693  1.1  christos 	 "R_MIPS_TLS_DTPREL_LO16",	/* name */
    694  1.1  christos 	 TRUE,			/* partial_inplace */
    695  1.1  christos 	 0x0000ffff,		/* src_mask */
    696  1.1  christos 	 0x0000ffff,		/* dst_mask */
    697  1.1  christos 	 FALSE),		/* pcrel_offset */
    698  1.1  christos 
    699  1.1  christos   /* TLS thread pointer offset.  */
    700  1.1  christos   HOWTO (R_MIPS_TLS_GOTTPREL,	/* type */
    701  1.1  christos 	 0,			/* rightshift */
    702  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    703  1.1  christos 	 16,			/* bitsize */
    704  1.1  christos 	 FALSE,			/* pc_relative */
    705  1.1  christos 	 0,			/* bitpos */
    706  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    707  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    708  1.1  christos 	 "R_MIPS_TLS_GOTTPREL",	/* name */
    709  1.1  christos 	 TRUE,			/* partial_inplace */
    710  1.1  christos 	 0x0000ffff,		/* src_mask */
    711  1.1  christos 	 0x0000ffff,		/* dst_mask */
    712  1.1  christos 	 FALSE),		/* pcrel_offset */
    713  1.1  christos 
    714  1.1  christos   /* TLS IE dynamic relocations.  */
    715  1.1  christos   HOWTO (R_MIPS_TLS_TPREL32,	/* type */
    716  1.1  christos 	 0,			/* rightshift */
    717  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    718  1.1  christos 	 32,			/* bitsize */
    719  1.1  christos 	 FALSE,			/* pc_relative */
    720  1.1  christos 	 0,			/* bitpos */
    721  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    722  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    723  1.1  christos 	 "R_MIPS_TLS_TPREL32",	/* name */
    724  1.1  christos 	 TRUE,			/* partial_inplace */
    725  1.1  christos 	 0xffffffff,		/* src_mask */
    726  1.1  christos 	 0xffffffff,		/* dst_mask */
    727  1.1  christos 	 FALSE),		/* pcrel_offset */
    728  1.1  christos 
    729  1.1  christos   EMPTY_HOWTO (R_MIPS_TLS_TPREL64),
    730  1.1  christos 
    731  1.1  christos   /* TLS thread pointer offset.  */
    732  1.1  christos   HOWTO (R_MIPS_TLS_TPREL_HI16,	/* type */
    733  1.1  christos 	 0,			/* rightshift */
    734  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    735  1.1  christos 	 16,			/* bitsize */
    736  1.1  christos 	 FALSE,			/* pc_relative */
    737  1.1  christos 	 0,			/* bitpos */
    738  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    739  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    740  1.1  christos 	 "R_MIPS_TLS_TPREL_HI16", /* name */
    741  1.1  christos 	 TRUE,			/* partial_inplace */
    742  1.1  christos 	 0x0000ffff,		/* src_mask */
    743  1.1  christos 	 0x0000ffff,		/* dst_mask */
    744  1.1  christos 	 FALSE),		/* pcrel_offset */
    745  1.1  christos 
    746  1.1  christos   /* TLS thread pointer offset.  */
    747  1.1  christos   HOWTO (R_MIPS_TLS_TPREL_LO16,	/* type */
    748  1.1  christos 	 0,			/* rightshift */
    749  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    750  1.1  christos 	 16,			/* bitsize */
    751  1.1  christos 	 FALSE,			/* pc_relative */
    752  1.1  christos 	 0,			/* bitpos */
    753  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    754  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    755  1.1  christos 	 "R_MIPS_TLS_TPREL_LO16", /* name */
    756  1.1  christos 	 TRUE,			/* partial_inplace */
    757  1.1  christos 	 0x0000ffff,		/* src_mask */
    758  1.1  christos 	 0x0000ffff,		/* dst_mask */
    759  1.1  christos 	 FALSE),		/* pcrel_offset */
    760  1.1  christos 
    761  1.1  christos   /* 32 bit relocation with no addend.  */
    762  1.1  christos   HOWTO (R_MIPS_GLOB_DAT,	/* type */
    763  1.1  christos 	 0,			/* rightshift */
    764  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    765  1.1  christos 	 32,			/* bitsize */
    766  1.1  christos 	 FALSE,			/* pc_relative */
    767  1.1  christos 	 0,			/* bitpos */
    768  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    769  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    770  1.1  christos 	 "R_MIPS_GLOB_DAT",	/* name */
    771  1.1  christos 	 FALSE,			/* partial_inplace */
    772  1.1  christos 	 0x0,			/* src_mask */
    773  1.1  christos 	 0xffffffff,		/* dst_mask */
    774  1.1  christos 	 FALSE),		/* pcrel_offset */
    775  1.3  christos 
    776  1.3  christos   EMPTY_HOWTO (52),
    777  1.3  christos   EMPTY_HOWTO (53),
    778  1.3  christos   EMPTY_HOWTO (54),
    779  1.3  christos   EMPTY_HOWTO (55),
    780  1.3  christos   EMPTY_HOWTO (56),
    781  1.3  christos   EMPTY_HOWTO (57),
    782  1.3  christos   EMPTY_HOWTO (58),
    783  1.3  christos   EMPTY_HOWTO (59),
    784  1.3  christos 
    785  1.3  christos   HOWTO (R_MIPS_PC21_S2,	/* type */
    786  1.3  christos 	 2,			/* rightshift */
    787  1.3  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    788  1.3  christos 	 21,			/* bitsize */
    789  1.3  christos 	 TRUE,			/* pc_relative */
    790  1.3  christos 	 0,			/* bitpos */
    791  1.3  christos 	 complain_overflow_signed, /* complain_on_overflow */
    792  1.3  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    793  1.3  christos 	 "R_MIPS_PC21_S2",	/* name */
    794  1.3  christos 	 TRUE,			/* partial_inplace */
    795  1.3  christos 	 0x001fffff,		/* src_mask */
    796  1.3  christos 	 0x001fffff,		/* dst_mask */
    797  1.3  christos 	 TRUE),			/* pcrel_offset */
    798  1.3  christos 
    799  1.3  christos   HOWTO (R_MIPS_PC26_S2,	/* type */
    800  1.3  christos 	 2,			/* rightshift */
    801  1.3  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    802  1.3  christos 	 26,			/* bitsize */
    803  1.3  christos 	 TRUE,			/* pc_relative */
    804  1.3  christos 	 0,			/* bitpos */
    805  1.3  christos 	 complain_overflow_signed, /* complain_on_overflow */
    806  1.3  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    807  1.3  christos 	 "R_MIPS_PC26_S2",	/* name */
    808  1.3  christos 	 TRUE,			/* partial_inplace */
    809  1.3  christos 	 0x03ffffff,		/* src_mask */
    810  1.3  christos 	 0x03ffffff,		/* dst_mask */
    811  1.3  christos 	 TRUE),			/* pcrel_offset */
    812  1.3  christos 
    813  1.3  christos   HOWTO (R_MIPS_PC18_S3,	/* type */
    814  1.3  christos 	 3,			/* rightshift */
    815  1.3  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    816  1.3  christos 	 18,			/* bitsize */
    817  1.3  christos 	 TRUE,			/* pc_relative */
    818  1.3  christos 	 0,			/* bitpos */
    819  1.3  christos 	 complain_overflow_signed, /* complain_on_overflow */
    820  1.3  christos 	 _bfd_mips_elf_generic_reloc,   /* special_function */
    821  1.3  christos 	 "R_MIPS_PC18_S3",	/* name */
    822  1.3  christos 	 TRUE,			/* partial_inplace */
    823  1.3  christos 	 0x0003ffff,		/* src_mask */
    824  1.3  christos 	 0x0003ffff,		/* dst_mask */
    825  1.3  christos 	 TRUE),			/* pcrel_offset */
    826  1.3  christos 
    827  1.3  christos   HOWTO (R_MIPS_PC19_S2,	/* type */
    828  1.3  christos 	 2,			/* rightshift */
    829  1.3  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    830  1.3  christos 	 19,			/* bitsize */
    831  1.3  christos 	 TRUE,			/* pc_relative */
    832  1.3  christos 	 0,			/* bitpos */
    833  1.3  christos 	 complain_overflow_signed, /* complain_on_overflow */
    834  1.3  christos 	 _bfd_mips_elf_generic_reloc,   /* special_function */
    835  1.3  christos 	 "R_MIPS_PC19_S2",	/* name */
    836  1.3  christos 	 TRUE,			/* partial_inplace */
    837  1.3  christos 	 0x0007ffff,		/* src_mask */
    838  1.3  christos 	 0x0007ffff,		/* dst_mask */
    839  1.3  christos 	 TRUE),			/* pcrel_offset */
    840  1.3  christos 
    841  1.3  christos   HOWTO (R_MIPS_PCHI16,		/* type */
    842  1.3  christos 	 16,			/* rightshift */
    843  1.3  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    844  1.3  christos 	 16,			/* bitsize */
    845  1.3  christos 	 TRUE,			/* pc_relative */
    846  1.3  christos 	 0,			/* bitpos */
    847  1.3  christos 	 complain_overflow_signed, /* complain_on_overflow */
    848  1.3  christos 	 _bfd_mips_elf_generic_reloc,   /* special_function */
    849  1.3  christos 	 "R_MIPS_PCHI16",	/* name */
    850  1.3  christos 	 TRUE,			/* partial_inplace */
    851  1.3  christos 	 0x0000ffff,		/* src_mask */
    852  1.3  christos 	 0x0000ffff,		/* dst_mask */
    853  1.3  christos 	 TRUE),			/* pcrel_offset */
    854  1.3  christos 
    855  1.3  christos   HOWTO (R_MIPS_PCLO16,		/* type */
    856  1.3  christos 	 0,			/* rightshift */
    857  1.3  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    858  1.3  christos 	 16,			/* bitsize */
    859  1.3  christos 	 TRUE,			/* pc_relative */
    860  1.3  christos 	 0,			/* bitpos */
    861  1.3  christos 	 complain_overflow_dont, /* complain_on_overflow */
    862  1.3  christos 	 _bfd_mips_elf_generic_reloc,   /* special_function */
    863  1.3  christos 	 "R_MIPS_PCLO16",	/* name */
    864  1.3  christos 	 TRUE,			/* partial_inplace */
    865  1.3  christos 	 0x0000ffff,		/* src_mask */
    866  1.3  christos 	 0x0000ffff,		/* dst_mask */
    867  1.3  christos 	 TRUE),			/* pcrel_offset */
    868  1.3  christos 
    869  1.1  christos };
    870  1.1  christos 
    871  1.1  christos /* The relocation table used for SHT_RELA sections.  */
    872  1.1  christos 
    873  1.1  christos static reloc_howto_type elf_mips_howto_table_rela[] =
    874  1.1  christos {
    875  1.1  christos   /* No relocation.  */
    876  1.1  christos   HOWTO (R_MIPS_NONE,		/* type */
    877  1.1  christos 	 0,			/* rightshift */
    878  1.1  christos 	 0,			/* size (0 = byte, 1 = short, 2 = long) */
    879  1.1  christos 	 0,			/* bitsize */
    880  1.1  christos 	 FALSE,			/* pc_relative */
    881  1.1  christos 	 0,			/* bitpos */
    882  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    883  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    884  1.1  christos 	 "R_MIPS_NONE",		/* name */
    885  1.1  christos 	 FALSE,			/* partial_inplace */
    886  1.1  christos 	 0,			/* src_mask */
    887  1.1  christos 	 0,			/* dst_mask */
    888  1.1  christos 	 FALSE),		/* pcrel_offset */
    889  1.1  christos 
    890  1.1  christos   /* 16 bit relocation.  */
    891  1.1  christos   HOWTO (R_MIPS_16,		/* type */
    892  1.1  christos 	 0,			/* rightshift */
    893  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    894  1.1  christos 	 16,			/* bitsize */
    895  1.1  christos 	 FALSE,			/* pc_relative */
    896  1.1  christos 	 0,			/* bitpos */
    897  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    898  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    899  1.1  christos 	 "R_MIPS_16",		/* name */
    900  1.1  christos 	 FALSE,			/* partial_inplace */
    901  1.1  christos 	 0,			/* src_mask */
    902  1.1  christos 	 0x0000,		/* dst_mask */
    903  1.1  christos 	 FALSE),		/* pcrel_offset */
    904  1.1  christos 
    905  1.1  christos   /* 32 bit relocation.  */
    906  1.1  christos   HOWTO (R_MIPS_32,		/* type */
    907  1.1  christos 	 0,			/* rightshift */
    908  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    909  1.1  christos 	 32,			/* bitsize */
    910  1.1  christos 	 FALSE,			/* pc_relative */
    911  1.1  christos 	 0,			/* bitpos */
    912  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    913  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    914  1.1  christos 	 "R_MIPS_32",		/* name */
    915  1.1  christos 	 FALSE,			/* partial_inplace */
    916  1.1  christos 	 0,			/* src_mask */
    917  1.1  christos 	 0xffffffff,		/* dst_mask */
    918  1.1  christos 	 FALSE),		/* pcrel_offset */
    919  1.1  christos 
    920  1.1  christos   /* 32 bit symbol relative relocation.  */
    921  1.1  christos   HOWTO (R_MIPS_REL32,		/* type */
    922  1.1  christos 	 0,			/* rightshift */
    923  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    924  1.1  christos 	 32,			/* bitsize */
    925  1.1  christos 	 FALSE,			/* pc_relative */
    926  1.1  christos 	 0,			/* bitpos */
    927  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    928  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    929  1.1  christos 	 "R_MIPS_REL32",	/* name */
    930  1.1  christos 	 FALSE,			/* partial_inplace */
    931  1.1  christos 	 0,			/* src_mask */
    932  1.1  christos 	 0xffffffff,		/* dst_mask */
    933  1.1  christos 	 FALSE),		/* pcrel_offset */
    934  1.1  christos 
    935  1.1  christos   /* 26 bit jump address.  */
    936  1.1  christos   HOWTO (R_MIPS_26,		/* type */
    937  1.1  christos 	 2,			/* rightshift */
    938  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    939  1.1  christos 	 26,			/* bitsize */
    940  1.1  christos 	 FALSE,			/* pc_relative */
    941  1.1  christos 	 0,			/* bitpos */
    942  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    943  1.1  christos 				/* This needs complex overflow
    944  1.1  christos 				   detection, because the upper 36
    945  1.1  christos 				   bits must match the PC + 4.  */
    946  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    947  1.1  christos 	 "R_MIPS_26",		/* name */
    948  1.1  christos 	 FALSE,			/* partial_inplace */
    949  1.1  christos 	 0,			/* src_mask */
    950  1.1  christos 	 0x03ffffff,		/* dst_mask */
    951  1.1  christos 	 FALSE),		/* pcrel_offset */
    952  1.1  christos 
    953  1.1  christos   /* High 16 bits of symbol value.  */
    954  1.1  christos   HOWTO (R_MIPS_HI16,		/* type */
    955  1.1  christos 	 0,			/* rightshift */
    956  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    957  1.1  christos 	 16,			/* bitsize */
    958  1.1  christos 	 FALSE,			/* pc_relative */
    959  1.1  christos 	 0,			/* bitpos */
    960  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    961  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    962  1.1  christos 	 "R_MIPS_HI16",		/* name */
    963  1.1  christos 	 FALSE,			/* partial_inplace */
    964  1.1  christos 	 0,			/* src_mask */
    965  1.1  christos 	 0x0000ffff,		/* dst_mask */
    966  1.1  christos 	 FALSE),		/* pcrel_offset */
    967  1.1  christos 
    968  1.1  christos   /* Low 16 bits of symbol value.  */
    969  1.1  christos   HOWTO (R_MIPS_LO16,		/* type */
    970  1.1  christos 	 0,			/* rightshift */
    971  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    972  1.1  christos 	 16,			/* bitsize */
    973  1.1  christos 	 FALSE,			/* pc_relative */
    974  1.1  christos 	 0,			/* bitpos */
    975  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
    976  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
    977  1.1  christos 	 "R_MIPS_LO16",		/* name */
    978  1.1  christos 	 FALSE,			/* partial_inplace */
    979  1.1  christos 	 0,			/* src_mask */
    980  1.1  christos 	 0x0000ffff,		/* dst_mask */
    981  1.1  christos 	 FALSE),		/* pcrel_offset */
    982  1.1  christos 
    983  1.1  christos   /* GP relative reference.  */
    984  1.1  christos   HOWTO (R_MIPS_GPREL16,	/* type */
    985  1.1  christos 	 0,			/* rightshift */
    986  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
    987  1.1  christos 	 16,			/* bitsize */
    988  1.1  christos 	 FALSE,			/* pc_relative */
    989  1.1  christos 	 0,			/* bitpos */
    990  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
    991  1.1  christos 	 mips_elf_gprel16_reloc, /* special_function */
    992  1.1  christos 	 "R_MIPS_GPREL16",	/* name */
    993  1.1  christos 	 FALSE,			/* partial_inplace */
    994  1.1  christos 	 0,			/* src_mask */
    995  1.1  christos 	 0x0000ffff,		/* dst_mask */
    996  1.1  christos 	 FALSE),		/* pcrel_offset */
    997  1.1  christos 
    998  1.1  christos   /* Reference to literal section.  */
    999  1.1  christos   HOWTO (R_MIPS_LITERAL,	/* type */
   1000  1.1  christos 	 0,			/* rightshift */
   1001  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1002  1.1  christos 	 16,			/* bitsize */
   1003  1.1  christos 	 FALSE,			/* pc_relative */
   1004  1.1  christos 	 0,			/* bitpos */
   1005  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1006  1.1  christos 	 mips_elf_literal_reloc, /* special_function */
   1007  1.1  christos 	 "R_MIPS_LITERAL",	/* name */
   1008  1.1  christos 	 FALSE,			/* partial_inplace */
   1009  1.1  christos 	 0,			/* src_mask */
   1010  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1011  1.1  christos 	 FALSE),		/* pcrel_offset */
   1012  1.1  christos 
   1013  1.1  christos   /* Reference to global offset table.  */
   1014  1.1  christos   HOWTO (R_MIPS_GOT16,		/* type */
   1015  1.1  christos 	 0,			/* rightshift */
   1016  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1017  1.1  christos 	 16,			/* bitsize */
   1018  1.1  christos 	 FALSE,			/* pc_relative */
   1019  1.1  christos 	 0,			/* bitpos */
   1020  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1021  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1022  1.1  christos 	 "R_MIPS_GOT16",	/* name */
   1023  1.1  christos 	 FALSE,			/* partial_inplace */
   1024  1.1  christos 	 0,			/* src_mask */
   1025  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1026  1.1  christos 	 FALSE),		/* pcrel_offset */
   1027  1.1  christos 
   1028  1.1  christos   /* 16 bit PC relative reference.  Note that the ABI document has a typo
   1029  1.1  christos      and claims R_MIPS_PC16 to be not rightshifted, rendering it useless.
   1030  1.1  christos      We do the right thing here.  */
   1031  1.1  christos   HOWTO (R_MIPS_PC16,		/* type */
   1032  1.1  christos 	 2,			/* rightshift */
   1033  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1034  1.1  christos 	 16,			/* bitsize */
   1035  1.1  christos 	 TRUE,			/* pc_relative */
   1036  1.1  christos 	 0,			/* bitpos */
   1037  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1038  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1039  1.1  christos 	 "R_MIPS_PC16",		/* name */
   1040  1.1  christos 	 FALSE,			/* partial_inplace */
   1041  1.1  christos 	 0,			/* src_mask */
   1042  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1043  1.1  christos 	 TRUE),			/* pcrel_offset */
   1044  1.1  christos 
   1045  1.1  christos   /* 16 bit call through global offset table.  */
   1046  1.1  christos   HOWTO (R_MIPS_CALL16,		/* type */
   1047  1.1  christos 	 0,			/* rightshift */
   1048  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1049  1.1  christos 	 16,			/* bitsize */
   1050  1.1  christos 	 FALSE,			/* pc_relative */
   1051  1.1  christos 	 0,			/* bitpos */
   1052  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1053  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1054  1.1  christos 	 "R_MIPS_CALL16",	/* name */
   1055  1.1  christos 	 FALSE,			/* partial_inplace */
   1056  1.1  christos 	 0,			/* src_mask */
   1057  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1058  1.1  christos 	 FALSE),		/* pcrel_offset */
   1059  1.1  christos 
   1060  1.1  christos   /* 32 bit GP relative reference.  */
   1061  1.1  christos   HOWTO (R_MIPS_GPREL32,	/* type */
   1062  1.1  christos 	 0,			/* rightshift */
   1063  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1064  1.1  christos 	 32,			/* bitsize */
   1065  1.1  christos 	 FALSE,			/* pc_relative */
   1066  1.1  christos 	 0,			/* bitpos */
   1067  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1068  1.1  christos 	 mips_elf_gprel32_reloc, /* special_function */
   1069  1.1  christos 	 "R_MIPS_GPREL32",	/* name */
   1070  1.1  christos 	 FALSE,			/* partial_inplace */
   1071  1.1  christos 	 0,			/* src_mask */
   1072  1.1  christos 	 0xffffffff,		/* dst_mask */
   1073  1.1  christos 	 FALSE),		/* pcrel_offset */
   1074  1.1  christos 
   1075  1.1  christos   EMPTY_HOWTO (13),
   1076  1.1  christos   EMPTY_HOWTO (14),
   1077  1.1  christos   EMPTY_HOWTO (15),
   1078  1.1  christos 
   1079  1.1  christos   /* A 5 bit shift field.  */
   1080  1.1  christos   HOWTO (R_MIPS_SHIFT5,		/* type */
   1081  1.1  christos 	 0,			/* rightshift */
   1082  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1083  1.1  christos 	 5,			/* bitsize */
   1084  1.1  christos 	 FALSE,			/* pc_relative */
   1085  1.1  christos 	 6,			/* bitpos */
   1086  1.1  christos 	 complain_overflow_bitfield, /* complain_on_overflow */
   1087  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1088  1.1  christos 	 "R_MIPS_SHIFT5",	/* name */
   1089  1.1  christos 	 FALSE,			/* partial_inplace */
   1090  1.1  christos 	 0,			/* src_mask */
   1091  1.1  christos 	 0x000007c0,		/* dst_mask */
   1092  1.1  christos 	 FALSE),		/* pcrel_offset */
   1093  1.1  christos 
   1094  1.1  christos   /* A 6 bit shift field.  */
   1095  1.1  christos   HOWTO (R_MIPS_SHIFT6,		/* type */
   1096  1.1  christos 	 0,			/* rightshift */
   1097  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1098  1.1  christos 	 6,			/* bitsize */
   1099  1.1  christos 	 FALSE,			/* pc_relative */
   1100  1.1  christos 	 6,			/* bitpos */
   1101  1.1  christos 	 complain_overflow_bitfield, /* complain_on_overflow */
   1102  1.1  christos 	 mips_elf_shift6_reloc,	/* special_function */
   1103  1.1  christos 	 "R_MIPS_SHIFT6",	/* name */
   1104  1.1  christos 	 FALSE,			/* partial_inplace */
   1105  1.1  christos 	 0,			/* src_mask */
   1106  1.1  christos 	 0x000007c4,		/* dst_mask */
   1107  1.1  christos 	 FALSE),		/* pcrel_offset */
   1108  1.1  christos 
   1109  1.1  christos   /* 64 bit relocation.  */
   1110  1.1  christos   HOWTO (R_MIPS_64,		/* type */
   1111  1.1  christos 	 0,			/* rightshift */
   1112  1.1  christos 	 4,			/* size (0 = byte, 1 = short, 2 = long) */
   1113  1.1  christos 	 64,			/* bitsize */
   1114  1.1  christos 	 FALSE,			/* pc_relative */
   1115  1.1  christos 	 0,			/* bitpos */
   1116  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1117  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1118  1.1  christos 	 "R_MIPS_64",		/* name */
   1119  1.1  christos 	 FALSE,			/* partial_inplace */
   1120  1.1  christos 	 0,			/* src_mask */
   1121  1.1  christos 	 MINUS_ONE,		/* dst_mask */
   1122  1.1  christos 	 FALSE),		/* pcrel_offset */
   1123  1.1  christos 
   1124  1.1  christos   /* Displacement in the global offset table.  */
   1125  1.1  christos   HOWTO (R_MIPS_GOT_DISP,	/* type */
   1126  1.1  christos 	 0,			/* rightshift */
   1127  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1128  1.1  christos 	 16,			/* bitsize */
   1129  1.1  christos 	 FALSE,			/* pc_relative */
   1130  1.1  christos 	 0,			/* bitpos */
   1131  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1132  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1133  1.1  christos 	 "R_MIPS_GOT_DISP",	/* name */
   1134  1.1  christos 	 FALSE,			/* partial_inplace */
   1135  1.1  christos 	 0,			/* src_mask */
   1136  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1137  1.1  christos 	 FALSE),		/* pcrel_offset */
   1138  1.1  christos 
   1139  1.1  christos   /* Displacement to page pointer in the global offset table.  */
   1140  1.1  christos   HOWTO (R_MIPS_GOT_PAGE,	/* type */
   1141  1.1  christos 	 0,			/* rightshift */
   1142  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1143  1.1  christos 	 16,			/* bitsize */
   1144  1.1  christos 	 FALSE,			/* pc_relative */
   1145  1.1  christos 	 0,			/* bitpos */
   1146  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1147  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1148  1.1  christos 	 "R_MIPS_GOT_PAGE",	/* name */
   1149  1.1  christos 	 FALSE,			/* partial_inplace */
   1150  1.1  christos 	 0,			/* src_mask */
   1151  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1152  1.1  christos 	 FALSE),		/* pcrel_offset */
   1153  1.1  christos 
   1154  1.1  christos   /* Offset from page pointer in the global offset table.  */
   1155  1.1  christos   HOWTO (R_MIPS_GOT_OFST,	/* type */
   1156  1.1  christos 	 0,			/* rightshift */
   1157  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1158  1.1  christos 	 16,			/* bitsize */
   1159  1.1  christos 	 FALSE,			/* pc_relative */
   1160  1.1  christos 	 0,			/* bitpos */
   1161  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1162  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1163  1.1  christos 	 "R_MIPS_GOT_OFST",	/* name */
   1164  1.1  christos 	 FALSE,			/* partial_inplace */
   1165  1.1  christos 	 0,			/* src_mask */
   1166  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1167  1.1  christos 	 FALSE),		/* pcrel_offset */
   1168  1.1  christos 
   1169  1.1  christos   /* High 16 bits of displacement in global offset table.  */
   1170  1.1  christos   HOWTO (R_MIPS_GOT_HI16,	/* type */
   1171  1.1  christos 	 0,			/* rightshift */
   1172  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1173  1.1  christos 	 16,			/* bitsize */
   1174  1.1  christos 	 FALSE,			/* pc_relative */
   1175  1.1  christos 	 0,			/* bitpos */
   1176  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1177  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1178  1.1  christos 	 "R_MIPS_GOT_HI16",	/* name */
   1179  1.1  christos 	 FALSE,			/* partial_inplace */
   1180  1.1  christos 	 0,			/* src_mask */
   1181  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1182  1.1  christos 	 FALSE),		/* pcrel_offset */
   1183  1.1  christos 
   1184  1.1  christos   /* Low 16 bits of displacement in global offset table.  */
   1185  1.1  christos   HOWTO (R_MIPS_GOT_LO16,	/* type */
   1186  1.1  christos 	 0,			/* rightshift */
   1187  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1188  1.1  christos 	 16,			/* bitsize */
   1189  1.1  christos 	 FALSE,			/* pc_relative */
   1190  1.1  christos 	 0,			/* bitpos */
   1191  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1192  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1193  1.1  christos 	 "R_MIPS_GOT_LO16",	/* name */
   1194  1.1  christos 	 FALSE,			/* partial_inplace */
   1195  1.1  christos 	 0,			/* src_mask */
   1196  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1197  1.1  christos 	 FALSE),		/* pcrel_offset */
   1198  1.1  christos 
   1199  1.1  christos   /* 64 bit subtraction.  */
   1200  1.1  christos   HOWTO (R_MIPS_SUB,		/* type */
   1201  1.1  christos 	 0,			/* rightshift */
   1202  1.1  christos 	 4,			/* size (0 = byte, 1 = short, 2 = long) */
   1203  1.1  christos 	 64,			/* bitsize */
   1204  1.1  christos 	 FALSE,			/* pc_relative */
   1205  1.1  christos 	 0,			/* bitpos */
   1206  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1207  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1208  1.1  christos 	 "R_MIPS_SUB",		/* name */
   1209  1.1  christos 	 FALSE,			/* partial_inplace */
   1210  1.1  christos 	 0,			/* src_mask */
   1211  1.1  christos 	 MINUS_ONE,		/* dst_mask */
   1212  1.1  christos 	 FALSE),		/* pcrel_offset */
   1213  1.1  christos 
   1214  1.1  christos   /* Insert the addend as an instruction.  */
   1215  1.1  christos   /* FIXME: Not handled correctly.  */
   1216  1.1  christos   HOWTO (R_MIPS_INSERT_A,	/* type */
   1217  1.1  christos 	 0,			/* rightshift */
   1218  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1219  1.1  christos 	 32,			/* bitsize */
   1220  1.1  christos 	 FALSE,			/* pc_relative */
   1221  1.1  christos 	 0,			/* bitpos */
   1222  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1223  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1224  1.1  christos 	 "R_MIPS_INSERT_A",	/* name */
   1225  1.1  christos 	 FALSE,			/* partial_inplace */
   1226  1.1  christos 	 0,			/* src_mask */
   1227  1.1  christos 	 0xffffffff,		/* dst_mask */
   1228  1.1  christos 	 FALSE),		/* pcrel_offset */
   1229  1.1  christos 
   1230  1.1  christos   /* Insert the addend as an instruction, and change all relocations
   1231  1.1  christos      to refer to the old instruction at the address.  */
   1232  1.1  christos   /* FIXME: Not handled correctly.  */
   1233  1.1  christos   HOWTO (R_MIPS_INSERT_B,	/* type */
   1234  1.1  christos 	 0,			/* rightshift */
   1235  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1236  1.1  christos 	 32,			/* bitsize */
   1237  1.1  christos 	 FALSE,			/* pc_relative */
   1238  1.1  christos 	 0,			/* bitpos */
   1239  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1240  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1241  1.1  christos 	 "R_MIPS_INSERT_B",	/* name */
   1242  1.1  christos 	 FALSE,			/* partial_inplace */
   1243  1.1  christos 	 0,			/* src_mask */
   1244  1.1  christos 	 0xffffffff,		/* dst_mask */
   1245  1.1  christos 	 FALSE),		/* pcrel_offset */
   1246  1.1  christos 
   1247  1.1  christos   /* Delete a 32 bit instruction.  */
   1248  1.1  christos   /* FIXME: Not handled correctly.  */
   1249  1.1  christos   HOWTO (R_MIPS_DELETE,		/* type */
   1250  1.1  christos 	 0,			/* rightshift */
   1251  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1252  1.1  christos 	 32,			/* bitsize */
   1253  1.1  christos 	 FALSE,			/* pc_relative */
   1254  1.1  christos 	 0,			/* bitpos */
   1255  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1256  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1257  1.1  christos 	 "R_MIPS_DELETE",	/* name */
   1258  1.1  christos 	 FALSE,			/* partial_inplace */
   1259  1.1  christos 	 0,			/* src_mask */
   1260  1.1  christos 	 0xffffffff,		/* dst_mask */
   1261  1.1  christos 	 FALSE),		/* pcrel_offset */
   1262  1.1  christos 
   1263  1.1  christos   /* Get the higher value of a 64 bit addend.  */
   1264  1.1  christos   HOWTO (R_MIPS_HIGHER,		/* type */
   1265  1.1  christos 	 0,			/* rightshift */
   1266  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1267  1.1  christos 	 16,			/* bitsize */
   1268  1.1  christos 	 FALSE,			/* pc_relative */
   1269  1.1  christos 	 0,			/* bitpos */
   1270  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1271  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1272  1.1  christos 	 "R_MIPS_HIGHER",	/* name */
   1273  1.1  christos 	 FALSE,			/* partial_inplace */
   1274  1.1  christos 	 0,			/* src_mask */
   1275  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1276  1.1  christos 	 FALSE),		/* pcrel_offset */
   1277  1.1  christos 
   1278  1.1  christos   /* Get the highest value of a 64 bit addend.  */
   1279  1.1  christos   HOWTO (R_MIPS_HIGHEST,	/* type */
   1280  1.1  christos 	 0,			/* rightshift */
   1281  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1282  1.1  christos 	 16,			/* bitsize */
   1283  1.1  christos 	 FALSE,			/* pc_relative */
   1284  1.1  christos 	 0,			/* bitpos */
   1285  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1286  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1287  1.1  christos 	 "R_MIPS_HIGHEST",	/* name */
   1288  1.1  christos 	 FALSE,			/* partial_inplace */
   1289  1.1  christos 	 0,			/* src_mask */
   1290  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1291  1.1  christos 	 FALSE),		/* pcrel_offset */
   1292  1.1  christos 
   1293  1.1  christos   /* High 16 bits of displacement in global offset table.  */
   1294  1.1  christos   HOWTO (R_MIPS_CALL_HI16,	/* type */
   1295  1.1  christos 	 0,			/* rightshift */
   1296  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1297  1.1  christos 	 16,			/* bitsize */
   1298  1.1  christos 	 FALSE,			/* pc_relative */
   1299  1.1  christos 	 0,			/* bitpos */
   1300  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1301  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1302  1.1  christos 	 "R_MIPS_CALL_HI16",	/* name */
   1303  1.1  christos 	 FALSE,			/* partial_inplace */
   1304  1.1  christos 	 0,			/* src_mask */
   1305  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1306  1.1  christos 	 FALSE),		/* pcrel_offset */
   1307  1.1  christos 
   1308  1.1  christos   /* Low 16 bits of displacement in global offset table.  */
   1309  1.1  christos   HOWTO (R_MIPS_CALL_LO16,	/* type */
   1310  1.1  christos 	 0,			/* rightshift */
   1311  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1312  1.1  christos 	 16,			/* bitsize */
   1313  1.1  christos 	 FALSE,			/* pc_relative */
   1314  1.1  christos 	 0,			/* bitpos */
   1315  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1316  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1317  1.1  christos 	 "R_MIPS_CALL_LO16",	/* name */
   1318  1.1  christos 	 FALSE,			/* partial_inplace */
   1319  1.1  christos 	 0,			/* src_mask */
   1320  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1321  1.1  christos 	 FALSE),		/* pcrel_offset */
   1322  1.1  christos 
   1323  1.1  christos   /* Section displacement, used by an associated event location section.  */
   1324  1.1  christos   HOWTO (R_MIPS_SCN_DISP,	/* type */
   1325  1.1  christos 	 0,			/* rightshift */
   1326  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1327  1.1  christos 	 32,			/* bitsize */
   1328  1.1  christos 	 FALSE,			/* pc_relative */
   1329  1.1  christos 	 0,			/* bitpos */
   1330  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1331  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1332  1.1  christos 	 "R_MIPS_SCN_DISP",	/* name */
   1333  1.1  christos 	 FALSE,			/* partial_inplace */
   1334  1.1  christos 	 0,			/* src_mask */
   1335  1.1  christos 	 0xffffffff,		/* dst_mask */
   1336  1.1  christos 	 FALSE),		/* pcrel_offset */
   1337  1.1  christos 
   1338  1.1  christos   /* 16 bit relocation.  */
   1339  1.1  christos   HOWTO (R_MIPS_REL16,		/* type */
   1340  1.1  christos 	 0,			/* rightshift */
   1341  1.1  christos 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
   1342  1.1  christos 	 16,			/* bitsize */
   1343  1.1  christos 	 FALSE,			/* pc_relative */
   1344  1.1  christos 	 0,			/* bitpos */
   1345  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1346  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1347  1.1  christos 	 "R_MIPS_REL16",	/* name */
   1348  1.1  christos 	 FALSE,			/* partial_inplace */
   1349  1.1  christos 	 0,			/* src_mask */
   1350  1.1  christos 	 0xffff,		/* dst_mask */
   1351  1.1  christos 	 FALSE),		/* pcrel_offset */
   1352  1.1  christos 
   1353  1.1  christos   /* These two are obsolete.  */
   1354  1.1  christos   EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
   1355  1.1  christos   EMPTY_HOWTO (R_MIPS_PJUMP),
   1356  1.1  christos 
   1357  1.1  christos   /* Similiar to R_MIPS_REL32, but used for relocations in a GOT section.
   1358  1.1  christos      It must be used for multigot GOT's (and only there).  */
   1359  1.1  christos   HOWTO (R_MIPS_RELGOT,		/* type */
   1360  1.1  christos 	 0,			/* rightshift */
   1361  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1362  1.1  christos 	 32,			/* bitsize */
   1363  1.1  christos 	 FALSE,			/* pc_relative */
   1364  1.1  christos 	 0,			/* bitpos */
   1365  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1366  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1367  1.1  christos 	 "R_MIPS_RELGOT",	/* name */
   1368  1.1  christos 	 FALSE,			/* partial_inplace */
   1369  1.1  christos 	 0,			/* src_mask */
   1370  1.1  christos 	 0xffffffff,		/* dst_mask */
   1371  1.1  christos 	 FALSE),		/* pcrel_offset */
   1372  1.1  christos 
   1373  1.1  christos   /* Protected jump conversion.  This is an optimization hint.  No
   1374  1.1  christos      relocation is required for correctness.  */
   1375  1.1  christos   HOWTO (R_MIPS_JALR,	        /* type */
   1376  1.1  christos 	 0,			/* rightshift */
   1377  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1378  1.1  christos 	 32,			/* bitsize */
   1379  1.1  christos 	 FALSE,			/* pc_relative */
   1380  1.1  christos 	 0,			/* bitpos */
   1381  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1382  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1383  1.1  christos 	 "R_MIPS_JALR",	        /* name */
   1384  1.1  christos 	 FALSE,			/* partial_inplace */
   1385  1.1  christos 	 0,			/* src_mask */
   1386  1.1  christos 	 0,			/* dst_mask */
   1387  1.1  christos 	 FALSE),		/* pcrel_offset */
   1388  1.1  christos 
   1389  1.1  christos   /* TLS GD/LD dynamic relocations.  */
   1390  1.1  christos   HOWTO (R_MIPS_TLS_DTPMOD32,	/* type */
   1391  1.1  christos 	 0,			/* rightshift */
   1392  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1393  1.1  christos 	 32,			/* bitsize */
   1394  1.1  christos 	 FALSE,			/* pc_relative */
   1395  1.1  christos 	 0,			/* bitpos */
   1396  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1397  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1398  1.1  christos 	 "R_MIPS_TLS_DTPMOD32",	/* name */
   1399  1.1  christos 	 FALSE,			/* partial_inplace */
   1400  1.1  christos 	 0,			/* src_mask */
   1401  1.1  christos 	 0xffffffff,		/* dst_mask */
   1402  1.1  christos 	 FALSE),		/* pcrel_offset */
   1403  1.1  christos 
   1404  1.1  christos   HOWTO (R_MIPS_TLS_DTPREL32,	/* type */
   1405  1.1  christos 	 0,			/* rightshift */
   1406  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1407  1.1  christos 	 32,			/* bitsize */
   1408  1.1  christos 	 FALSE,			/* pc_relative */
   1409  1.1  christos 	 0,			/* bitpos */
   1410  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1411  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1412  1.1  christos 	 "R_MIPS_TLS_DTPREL32",	/* name */
   1413  1.1  christos 	 FALSE,			/* partial_inplace */
   1414  1.1  christos 	 0,			/* src_mask */
   1415  1.1  christos 	 0xffffffff,		/* dst_mask */
   1416  1.1  christos 	 FALSE),		/* pcrel_offset */
   1417  1.1  christos 
   1418  1.1  christos   EMPTY_HOWTO (R_MIPS_TLS_DTPMOD64),
   1419  1.1  christos   EMPTY_HOWTO (R_MIPS_TLS_DTPREL64),
   1420  1.1  christos 
   1421  1.1  christos   /* TLS general dynamic variable reference.  */
   1422  1.1  christos   HOWTO (R_MIPS_TLS_GD,		/* type */
   1423  1.1  christos 	 0,			/* rightshift */
   1424  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1425  1.1  christos 	 16,			/* bitsize */
   1426  1.1  christos 	 FALSE,			/* pc_relative */
   1427  1.1  christos 	 0,			/* bitpos */
   1428  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1429  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1430  1.1  christos 	 "R_MIPS_TLS_GD",	/* name */
   1431  1.1  christos 	 FALSE,			/* partial_inplace */
   1432  1.1  christos 	 0,			/* src_mask */
   1433  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1434  1.1  christos 	 FALSE),		/* pcrel_offset */
   1435  1.1  christos 
   1436  1.1  christos   /* TLS local dynamic variable reference.  */
   1437  1.1  christos   HOWTO (R_MIPS_TLS_LDM,	/* type */
   1438  1.1  christos 	 0,			/* rightshift */
   1439  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1440  1.1  christos 	 16,			/* bitsize */
   1441  1.1  christos 	 FALSE,			/* pc_relative */
   1442  1.1  christos 	 0,			/* bitpos */
   1443  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1444  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1445  1.1  christos 	 "R_MIPS_TLS_LDM",	/* name */
   1446  1.1  christos 	 FALSE,			/* partial_inplace */
   1447  1.1  christos 	 0,			/* src_mask */
   1448  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1449  1.1  christos 	 FALSE),		/* pcrel_offset */
   1450  1.1  christos 
   1451  1.1  christos   /* TLS local dynamic offset.  */
   1452  1.1  christos   HOWTO (R_MIPS_TLS_DTPREL_HI16,	/* type */
   1453  1.1  christos 	 0,			/* rightshift */
   1454  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1455  1.1  christos 	 16,			/* bitsize */
   1456  1.1  christos 	 FALSE,			/* pc_relative */
   1457  1.1  christos 	 0,			/* bitpos */
   1458  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1459  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1460  1.1  christos 	 "R_MIPS_TLS_DTPREL_HI16",	/* name */
   1461  1.1  christos 	 FALSE,			/* partial_inplace */
   1462  1.1  christos 	 0,			/* src_mask */
   1463  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1464  1.1  christos 	 FALSE),		/* pcrel_offset */
   1465  1.1  christos 
   1466  1.1  christos   /* TLS local dynamic offset.  */
   1467  1.1  christos   HOWTO (R_MIPS_TLS_DTPREL_LO16,	/* type */
   1468  1.1  christos 	 0,			/* rightshift */
   1469  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1470  1.1  christos 	 16,			/* bitsize */
   1471  1.1  christos 	 FALSE,			/* pc_relative */
   1472  1.1  christos 	 0,			/* bitpos */
   1473  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1474  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1475  1.1  christos 	 "R_MIPS_TLS_DTPREL_LO16",	/* name */
   1476  1.1  christos 	 FALSE,			/* partial_inplace */
   1477  1.1  christos 	 0,			/* src_mask */
   1478  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1479  1.1  christos 	 FALSE),		/* pcrel_offset */
   1480  1.1  christos 
   1481  1.1  christos   /* TLS thread pointer offset.  */
   1482  1.1  christos   HOWTO (R_MIPS_TLS_GOTTPREL,	/* type */
   1483  1.1  christos 	 0,			/* rightshift */
   1484  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1485  1.1  christos 	 16,			/* bitsize */
   1486  1.1  christos 	 FALSE,			/* pc_relative */
   1487  1.1  christos 	 0,			/* bitpos */
   1488  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1489  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1490  1.1  christos 	 "R_MIPS_TLS_GOTTPREL",	/* name */
   1491  1.1  christos 	 FALSE,			/* partial_inplace */
   1492  1.1  christos 	 0,			/* src_mask */
   1493  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1494  1.1  christos 	 FALSE),		/* pcrel_offset */
   1495  1.1  christos 
   1496  1.1  christos   /* TLS IE dynamic relocations.  */
   1497  1.1  christos   HOWTO (R_MIPS_TLS_TPREL32,	/* type */
   1498  1.1  christos 	 0,			/* rightshift */
   1499  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1500  1.1  christos 	 32,			/* bitsize */
   1501  1.1  christos 	 FALSE,			/* pc_relative */
   1502  1.1  christos 	 0,			/* bitpos */
   1503  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1504  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1505  1.1  christos 	 "R_MIPS_TLS_TPREL32",	/* name */
   1506  1.1  christos 	 FALSE,			/* partial_inplace */
   1507  1.1  christos 	 0,			/* src_mask */
   1508  1.1  christos 	 0xffffffff,		/* dst_mask */
   1509  1.1  christos 	 FALSE),		/* pcrel_offset */
   1510  1.1  christos 
   1511  1.1  christos   EMPTY_HOWTO (R_MIPS_TLS_TPREL64),
   1512  1.1  christos 
   1513  1.1  christos   /* TLS thread pointer offset.  */
   1514  1.1  christos   HOWTO (R_MIPS_TLS_TPREL_HI16,	/* type */
   1515  1.1  christos 	 0,			/* rightshift */
   1516  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1517  1.1  christos 	 16,			/* bitsize */
   1518  1.1  christos 	 FALSE,			/* pc_relative */
   1519  1.1  christos 	 0,			/* bitpos */
   1520  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1521  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1522  1.1  christos 	 "R_MIPS_TLS_TPREL_HI16", /* name */
   1523  1.1  christos 	 FALSE,			/* partial_inplace */
   1524  1.1  christos 	 0,			/* src_mask */
   1525  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1526  1.1  christos 	 FALSE),		/* pcrel_offset */
   1527  1.1  christos 
   1528  1.1  christos   /* TLS thread pointer offset.  */
   1529  1.1  christos   HOWTO (R_MIPS_TLS_TPREL_LO16,	/* type */
   1530  1.1  christos 	 0,			/* rightshift */
   1531  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1532  1.1  christos 	 16,			/* bitsize */
   1533  1.1  christos 	 FALSE,			/* pc_relative */
   1534  1.1  christos 	 0,			/* bitpos */
   1535  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1536  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1537  1.1  christos 	 "R_MIPS_TLS_TPREL_LO16", /* name */
   1538  1.1  christos 	 FALSE,			/* partial_inplace */
   1539  1.1  christos 	 0,			/* src_mask */
   1540  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1541  1.1  christos 	 FALSE),		/* pcrel_offset */
   1542  1.1  christos 
   1543  1.1  christos   /* 32 bit relocation with no addend.  */
   1544  1.1  christos   HOWTO (R_MIPS_GLOB_DAT,	/* type */
   1545  1.1  christos 	 0,			/* rightshift */
   1546  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1547  1.1  christos 	 32,			/* bitsize */
   1548  1.1  christos 	 FALSE,			/* pc_relative */
   1549  1.1  christos 	 0,			/* bitpos */
   1550  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1551  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1552  1.1  christos 	 "R_MIPS_GLOB_DAT",	/* name */
   1553  1.1  christos 	 FALSE,			/* partial_inplace */
   1554  1.1  christos 	 0x0,			/* src_mask */
   1555  1.1  christos 	 0xffffffff,		/* dst_mask */
   1556  1.1  christos 	 FALSE),		/* pcrel_offset */
   1557  1.3  christos 
   1558  1.3  christos   EMPTY_HOWTO (52),
   1559  1.3  christos   EMPTY_HOWTO (53),
   1560  1.3  christos   EMPTY_HOWTO (54),
   1561  1.3  christos   EMPTY_HOWTO (55),
   1562  1.3  christos   EMPTY_HOWTO (56),
   1563  1.3  christos   EMPTY_HOWTO (57),
   1564  1.3  christos   EMPTY_HOWTO (58),
   1565  1.3  christos   EMPTY_HOWTO (59),
   1566  1.3  christos 
   1567  1.3  christos   HOWTO (R_MIPS_PC21_S2,	/* type */
   1568  1.3  christos 	 2,			/* rightshift */
   1569  1.3  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1570  1.3  christos 	 21,			/* bitsize */
   1571  1.3  christos 	 TRUE,			/* pc_relative */
   1572  1.3  christos 	 0,			/* bitpos */
   1573  1.3  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1574  1.3  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1575  1.3  christos 	 "R_MIPS_PC21_S2",	/* name */
   1576  1.3  christos 	 FALSE,			/* partial_inplace */
   1577  1.3  christos 	 0,			/* src_mask */
   1578  1.3  christos 	 0x001fffff,		/* dst_mask */
   1579  1.3  christos 	 TRUE),			/* pcrel_offset */
   1580  1.3  christos 
   1581  1.3  christos   HOWTO (R_MIPS_PC26_S2,	/* type */
   1582  1.3  christos 	 2,			/* rightshift */
   1583  1.3  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1584  1.3  christos 	 26,			/* bitsize */
   1585  1.3  christos 	 TRUE,			/* pc_relative */
   1586  1.3  christos 	 0,			/* bitpos */
   1587  1.3  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1588  1.3  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1589  1.3  christos 	 "R_MIPS_PC26_S2",	/* name */
   1590  1.3  christos 	 FALSE,			/* partial_inplace */
   1591  1.3  christos 	 0,			/* src_mask */
   1592  1.3  christos 	 0x03ffffff,		/* dst_mask */
   1593  1.3  christos 	 TRUE),			/* pcrel_offset */
   1594  1.3  christos 
   1595  1.3  christos   HOWTO (R_MIPS_PC18_S3,	/* type */
   1596  1.3  christos 	 3,			/* rightshift */
   1597  1.3  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1598  1.3  christos 	 18,			/* bitsize */
   1599  1.3  christos 	 TRUE,			/* pc_relative */
   1600  1.3  christos 	 0,			/* bitpos */
   1601  1.3  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1602  1.3  christos 	 _bfd_mips_elf_generic_reloc,   /* special_function */
   1603  1.3  christos 	 "R_MIPS_PC18_S3",	/* name */
   1604  1.3  christos 	 FALSE,			/* partial_inplace */
   1605  1.3  christos 	 0,			/* src_mask */
   1606  1.3  christos 	 0x0003ffff,		/* dst_mask */
   1607  1.3  christos 	 TRUE),			/* pcrel_offset */
   1608  1.3  christos 
   1609  1.3  christos   HOWTO (R_MIPS_PC19_S2,	/* type */
   1610  1.3  christos 	 2,			/* rightshift */
   1611  1.3  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1612  1.3  christos 	 19,			/* bitsize */
   1613  1.3  christos 	 TRUE,			/* pc_relative */
   1614  1.3  christos 	 0,			/* bitpos */
   1615  1.3  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1616  1.3  christos 	 _bfd_mips_elf_generic_reloc,   /* special_function */
   1617  1.3  christos 	 "R_MIPS_PC19_S2",	/* name */
   1618  1.3  christos 	 FALSE,			/* partial_inplace */
   1619  1.3  christos 	 0,			/* src_mask */
   1620  1.3  christos 	 0x0007ffff,		/* dst_mask */
   1621  1.3  christos 	 TRUE),			/* pcrel_offset */
   1622  1.3  christos 
   1623  1.3  christos   HOWTO (R_MIPS_PCHI16,		/* type */
   1624  1.3  christos 	 16,			/* rightshift */
   1625  1.3  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1626  1.3  christos 	 16,			/* bitsize */
   1627  1.3  christos 	 TRUE,			/* pc_relative */
   1628  1.3  christos 	 0,			/* bitpos */
   1629  1.3  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1630  1.3  christos 	 _bfd_mips_elf_generic_reloc,   /* special_function */
   1631  1.3  christos 	 "R_MIPS_PCHI16",	/* name */
   1632  1.3  christos 	 FALSE,			/* partial_inplace */
   1633  1.3  christos 	 0,			/* src_mask */
   1634  1.3  christos 	 0x0000ffff,		/* dst_mask */
   1635  1.3  christos 	 TRUE),			/* pcrel_offset */
   1636  1.3  christos 
   1637  1.3  christos   HOWTO (R_MIPS_PCLO16,		/* type */
   1638  1.3  christos 	 0,			/* rightshift */
   1639  1.3  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1640  1.3  christos 	 16,			/* bitsize */
   1641  1.3  christos 	 TRUE,			/* pc_relative */
   1642  1.3  christos 	 0,			/* bitpos */
   1643  1.3  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1644  1.3  christos 	 _bfd_mips_elf_generic_reloc,   /* special_function */
   1645  1.3  christos 	 "R_MIPS_PCLO16",	/* name */
   1646  1.3  christos 	 FALSE,			/* partial_inplace */
   1647  1.3  christos 	 0,			/* src_mask */
   1648  1.3  christos 	 0x0000ffff,		/* dst_mask */
   1649  1.3  christos 	 TRUE),			/* pcrel_offset */
   1650  1.3  christos 
   1651  1.1  christos };
   1652  1.1  christos 
   1653  1.1  christos static reloc_howto_type elf_mips16_howto_table_rel[] =
   1654  1.1  christos {
   1655  1.1  christos   /* The reloc used for the mips16 jump instruction.  */
   1656  1.1  christos   HOWTO (R_MIPS16_26,		/* type */
   1657  1.1  christos 	 2,			/* rightshift */
   1658  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1659  1.1  christos 	 26,			/* bitsize */
   1660  1.1  christos 	 FALSE,			/* pc_relative */
   1661  1.1  christos 	 0,			/* bitpos */
   1662  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1663  1.1  christos 	 			/* This needs complex overflow
   1664  1.1  christos 				   detection, because the upper four
   1665  1.1  christos 				   bits must match the PC.  */
   1666  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1667  1.1  christos 	 "R_MIPS16_26",		/* name */
   1668  1.1  christos 	 TRUE,			/* partial_inplace */
   1669  1.1  christos 	 0x3ffffff,		/* src_mask */
   1670  1.1  christos 	 0x3ffffff,		/* dst_mask */
   1671  1.1  christos 	 FALSE),		/* pcrel_offset */
   1672  1.1  christos 
   1673  1.1  christos   /* The reloc used for the mips16 gprel instruction.  */
   1674  1.1  christos   HOWTO (R_MIPS16_GPREL,	/* type */
   1675  1.1  christos 	 0,			/* rightshift */
   1676  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1677  1.1  christos 	 16,			/* bitsize */
   1678  1.1  christos 	 FALSE,			/* pc_relative */
   1679  1.1  christos 	 0,			/* bitpos */
   1680  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1681  1.1  christos 	 mips16_gprel_reloc,	/* special_function */
   1682  1.1  christos 	 "R_MIPS16_GPREL",	/* name */
   1683  1.1  christos 	 TRUE,			/* partial_inplace */
   1684  1.1  christos 	 0x0000ffff,		/* src_mask */
   1685  1.1  christos 	 0x0000ffff,	        /* dst_mask */
   1686  1.1  christos 	 FALSE),		/* pcrel_offset */
   1687  1.1  christos 
   1688  1.1  christos   /* A MIPS16 reference to the global offset table.  */
   1689  1.1  christos   HOWTO (R_MIPS16_GOT16,	/* type */
   1690  1.1  christos 	 0,			/* rightshift */
   1691  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1692  1.1  christos 	 16,			/* bitsize */
   1693  1.1  christos 	 FALSE,			/* pc_relative */
   1694  1.1  christos 	 0,			/* bitpos */
   1695  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1696  1.1  christos 	 _bfd_mips_elf_got16_reloc, /* special_function */
   1697  1.1  christos 	 "R_MIPS16_GOT16",	/* name */
   1698  1.1  christos 	 TRUE,			/* partial_inplace */
   1699  1.1  christos 	 0x0000ffff,		/* src_mask */
   1700  1.1  christos 	 0x0000ffff,	        /* dst_mask */
   1701  1.1  christos 	 FALSE),		/* pcrel_offset */
   1702  1.1  christos 
   1703  1.1  christos   /* A MIPS16 call through the global offset table.  */
   1704  1.1  christos   HOWTO (R_MIPS16_CALL16,	/* type */
   1705  1.1  christos 	 0,			/* rightshift */
   1706  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1707  1.1  christos 	 16,			/* bitsize */
   1708  1.1  christos 	 FALSE,			/* pc_relative */
   1709  1.1  christos 	 0,			/* bitpos */
   1710  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1711  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1712  1.1  christos 	 "R_MIPS16_CALL16",	/* name */
   1713  1.1  christos 	 TRUE,			/* partial_inplace */
   1714  1.1  christos 	 0x0000ffff,		/* src_mask */
   1715  1.1  christos 	 0x0000ffff,	        /* dst_mask */
   1716  1.1  christos 	 FALSE),		/* pcrel_offset */
   1717  1.1  christos 
   1718  1.1  christos   /* MIPS16 high 16 bits of symbol value.  */
   1719  1.1  christos   HOWTO (R_MIPS16_HI16,		/* type */
   1720  1.1  christos 	 16,			/* rightshift */
   1721  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1722  1.1  christos 	 16,			/* bitsize */
   1723  1.1  christos 	 FALSE,			/* pc_relative */
   1724  1.1  christos 	 0,			/* bitpos */
   1725  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1726  1.1  christos 	 _bfd_mips_elf_hi16_reloc, /* special_function */
   1727  1.1  christos 	 "R_MIPS16_HI16",	/* name */
   1728  1.1  christos 	 TRUE,			/* partial_inplace */
   1729  1.1  christos 	 0x0000ffff,		/* src_mask */
   1730  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1731  1.1  christos 	 FALSE),		/* pcrel_offset */
   1732  1.1  christos 
   1733  1.1  christos   /* MIPS16 low 16 bits of symbol value.  */
   1734  1.1  christos   HOWTO (R_MIPS16_LO16,		/* type */
   1735  1.1  christos 	 0,			/* rightshift */
   1736  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1737  1.1  christos 	 16,			/* bitsize */
   1738  1.1  christos 	 FALSE,			/* pc_relative */
   1739  1.1  christos 	 0,			/* bitpos */
   1740  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1741  1.1  christos 	 _bfd_mips_elf_lo16_reloc, /* special_function */
   1742  1.1  christos 	 "R_MIPS16_LO16",	/* name */
   1743  1.1  christos 	 TRUE,			/* partial_inplace */
   1744  1.1  christos 	 0x0000ffff,		/* src_mask */
   1745  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1746  1.1  christos 	 FALSE),		/* pcrel_offset */
   1747  1.1  christos 
   1748  1.1  christos   /* MIPS16 TLS general dynamic variable reference.  */
   1749  1.1  christos   HOWTO (R_MIPS16_TLS_GD,	/* type */
   1750  1.1  christos 	 0,			/* rightshift */
   1751  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1752  1.1  christos 	 16,			/* bitsize */
   1753  1.1  christos 	 FALSE,			/* pc_relative */
   1754  1.1  christos 	 0,			/* bitpos */
   1755  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1756  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1757  1.1  christos 	 "R_MIPS16_TLS_GD",	/* name */
   1758  1.1  christos 	 TRUE,			/* partial_inplace */
   1759  1.1  christos 	 0x0000ffff,		/* src_mask */
   1760  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1761  1.1  christos 	 FALSE),		/* pcrel_offset */
   1762  1.1  christos 
   1763  1.1  christos   /* MIPS16 TLS local dynamic variable reference.  */
   1764  1.1  christos   HOWTO (R_MIPS16_TLS_LDM,	/* type */
   1765  1.1  christos 	 0,			/* rightshift */
   1766  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1767  1.1  christos 	 16,			/* bitsize */
   1768  1.1  christos 	 FALSE,			/* pc_relative */
   1769  1.1  christos 	 0,			/* bitpos */
   1770  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1771  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1772  1.1  christos 	 "R_MIPS16_TLS_LDM",	/* name */
   1773  1.1  christos 	 TRUE,			/* partial_inplace */
   1774  1.1  christos 	 0x0000ffff,		/* src_mask */
   1775  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1776  1.1  christos 	 FALSE),		/* pcrel_offset */
   1777  1.1  christos 
   1778  1.1  christos   /* MIPS16 TLS local dynamic offset.  */
   1779  1.1  christos   HOWTO (R_MIPS16_TLS_DTPREL_HI16,	/* type */
   1780  1.1  christos 	 0,			/* rightshift */
   1781  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1782  1.1  christos 	 16,			/* bitsize */
   1783  1.1  christos 	 FALSE,			/* pc_relative */
   1784  1.1  christos 	 0,			/* bitpos */
   1785  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1786  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1787  1.1  christos 	 "R_MIPS16_TLS_DTPREL_HI16",	/* name */
   1788  1.1  christos 	 TRUE,			/* partial_inplace */
   1789  1.1  christos 	 0x0000ffff,		/* src_mask */
   1790  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1791  1.1  christos 	 FALSE),		/* pcrel_offset */
   1792  1.1  christos 
   1793  1.1  christos   /* MIPS16 TLS local dynamic offset.  */
   1794  1.1  christos   HOWTO (R_MIPS16_TLS_DTPREL_LO16,	/* type */
   1795  1.1  christos 	 0,			/* rightshift */
   1796  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1797  1.1  christos 	 16,			/* bitsize */
   1798  1.1  christos 	 FALSE,			/* pc_relative */
   1799  1.1  christos 	 0,			/* bitpos */
   1800  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1801  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1802  1.1  christos 	 "R_MIPS16_TLS_DTPREL_LO16",	/* name */
   1803  1.1  christos 	 TRUE,			/* partial_inplace */
   1804  1.1  christos 	 0x0000ffff,		/* src_mask */
   1805  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1806  1.1  christos 	 FALSE),		/* pcrel_offset */
   1807  1.1  christos 
   1808  1.1  christos   /* MIPS16 TLS thread pointer offset.  */
   1809  1.1  christos   HOWTO (R_MIPS16_TLS_GOTTPREL,	/* type */
   1810  1.1  christos 	 0,			/* rightshift */
   1811  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1812  1.1  christos 	 16,			/* bitsize */
   1813  1.1  christos 	 FALSE,			/* pc_relative */
   1814  1.1  christos 	 0,			/* bitpos */
   1815  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1816  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1817  1.1  christos 	 "R_MIPS16_TLS_GOTTPREL",	/* name */
   1818  1.1  christos 	 TRUE,			/* partial_inplace */
   1819  1.1  christos 	 0x0000ffff,		/* src_mask */
   1820  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1821  1.1  christos 	 FALSE),		/* pcrel_offset */
   1822  1.1  christos 
   1823  1.1  christos   /* MIPS16 TLS thread pointer offset.  */
   1824  1.1  christos   HOWTO (R_MIPS16_TLS_TPREL_HI16,	/* type */
   1825  1.1  christos 	 0,			/* rightshift */
   1826  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1827  1.1  christos 	 16,			/* bitsize */
   1828  1.1  christos 	 FALSE,			/* pc_relative */
   1829  1.1  christos 	 0,			/* bitpos */
   1830  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1831  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1832  1.1  christos 	 "R_MIPS16_TLS_TPREL_HI16", /* name */
   1833  1.1  christos 	 TRUE,			/* partial_inplace */
   1834  1.1  christos 	 0x0000ffff,		/* src_mask */
   1835  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1836  1.1  christos 	 FALSE),		/* pcrel_offset */
   1837  1.1  christos 
   1838  1.1  christos   /* MIPS16 TLS thread pointer offset.  */
   1839  1.1  christos   HOWTO (R_MIPS16_TLS_TPREL_LO16,	/* type */
   1840  1.1  christos 	 0,			/* rightshift */
   1841  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1842  1.1  christos 	 16,			/* bitsize */
   1843  1.1  christos 	 FALSE,			/* pc_relative */
   1844  1.1  christos 	 0,			/* bitpos */
   1845  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1846  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1847  1.1  christos 	 "R_MIPS16_TLS_TPREL_LO16", /* name */
   1848  1.1  christos 	 TRUE,			/* partial_inplace */
   1849  1.1  christos 	 0x0000ffff,		/* src_mask */
   1850  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1851  1.1  christos 	 FALSE),		/* pcrel_offset */
   1852  1.1  christos };
   1853  1.1  christos 
   1854  1.1  christos static reloc_howto_type elf_mips16_howto_table_rela[] =
   1855  1.1  christos {
   1856  1.1  christos   /* The reloc used for the mips16 jump instruction.  */
   1857  1.1  christos   HOWTO (R_MIPS16_26,		/* type */
   1858  1.1  christos 	 2,			/* rightshift */
   1859  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1860  1.1  christos 	 26,			/* bitsize */
   1861  1.1  christos 	 FALSE,			/* pc_relative */
   1862  1.1  christos 	 0,			/* bitpos */
   1863  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1864  1.1  christos 	 			/* This needs complex overflow
   1865  1.1  christos 				   detection, because the upper four
   1866  1.1  christos 				   bits must match the PC.  */
   1867  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1868  1.1  christos 	 "R_MIPS16_26",		/* name */
   1869  1.1  christos 	 FALSE,			/* partial_inplace */
   1870  1.1  christos 	 0,			/* src_mask */
   1871  1.1  christos 	 0x3ffffff,		/* dst_mask */
   1872  1.1  christos 	 FALSE),		/* pcrel_offset */
   1873  1.1  christos 
   1874  1.1  christos   /* The reloc used for the mips16 gprel instruction.  */
   1875  1.1  christos   HOWTO (R_MIPS16_GPREL,	/* type */
   1876  1.1  christos 	 0,			/* rightshift */
   1877  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1878  1.1  christos 	 16,			/* bitsize */
   1879  1.1  christos 	 FALSE,			/* pc_relative */
   1880  1.1  christos 	 0,			/* bitpos */
   1881  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1882  1.1  christos 	 mips16_gprel_reloc,	/* special_function */
   1883  1.1  christos 	 "R_MIPS16_GPREL",	/* name */
   1884  1.1  christos 	 FALSE,			/* partial_inplace */
   1885  1.1  christos 	 0,			/* src_mask */
   1886  1.1  christos 	 0x0000ffff,	        /* dst_mask */
   1887  1.1  christos 	 FALSE),		/* pcrel_offset */
   1888  1.1  christos 
   1889  1.1  christos   /* A MIPS16 reference to the global offset table.  */
   1890  1.1  christos   HOWTO (R_MIPS16_GOT16,	/* type */
   1891  1.1  christos 	 0,			/* rightshift */
   1892  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1893  1.1  christos 	 16,			/* bitsize */
   1894  1.1  christos 	 FALSE,			/* pc_relative */
   1895  1.1  christos 	 0,			/* bitpos */
   1896  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1897  1.1  christos 	 _bfd_mips_elf_got16_reloc, /* special_function */
   1898  1.1  christos 	 "R_MIPS16_GOT16",	/* name */
   1899  1.1  christos 	 FALSE,			/* partial_inplace */
   1900  1.1  christos 	 0,			/* src_mask */
   1901  1.1  christos 	 0x0000ffff,	        /* dst_mask */
   1902  1.1  christos 	 FALSE),		/* pcrel_offset */
   1903  1.1  christos 
   1904  1.1  christos   /* A MIPS16 call through the global offset table.  */
   1905  1.1  christos   HOWTO (R_MIPS16_CALL16,	/* type */
   1906  1.1  christos 	 0,			/* rightshift */
   1907  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1908  1.1  christos 	 16,			/* bitsize */
   1909  1.1  christos 	 FALSE,			/* pc_relative */
   1910  1.1  christos 	 0,			/* bitpos */
   1911  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1912  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1913  1.1  christos 	 "R_MIPS16_CALL16",	/* name */
   1914  1.1  christos 	 FALSE,			/* partial_inplace */
   1915  1.1  christos 	 0,			/* src_mask */
   1916  1.1  christos 	 0x0000ffff,	        /* dst_mask */
   1917  1.1  christos 	 FALSE),		/* pcrel_offset */
   1918  1.1  christos 
   1919  1.1  christos   /* MIPS16 high 16 bits of symbol value.  */
   1920  1.1  christos   HOWTO (R_MIPS16_HI16,		/* type */
   1921  1.1  christos 	 16,			/* rightshift */
   1922  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1923  1.1  christos 	 16,			/* bitsize */
   1924  1.1  christos 	 FALSE,			/* pc_relative */
   1925  1.1  christos 	 0,			/* bitpos */
   1926  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1927  1.1  christos 	 _bfd_mips_elf_hi16_reloc, /* special_function */
   1928  1.1  christos 	 "R_MIPS16_HI16",	/* name */
   1929  1.1  christos 	 FALSE,			/* partial_inplace */
   1930  1.1  christos 	 0,			/* src_mask */
   1931  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1932  1.1  christos 	 FALSE),		/* pcrel_offset */
   1933  1.1  christos 
   1934  1.1  christos   /* MIPS16 low 16 bits of symbol value.  */
   1935  1.1  christos   HOWTO (R_MIPS16_LO16,		/* type */
   1936  1.1  christos 	 0,			/* rightshift */
   1937  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1938  1.1  christos 	 16,			/* bitsize */
   1939  1.1  christos 	 FALSE,			/* pc_relative */
   1940  1.1  christos 	 0,			/* bitpos */
   1941  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   1942  1.1  christos 	 _bfd_mips_elf_lo16_reloc, /* special_function */
   1943  1.1  christos 	 "R_MIPS16_LO16",	/* name */
   1944  1.1  christos 	 FALSE,			/* partial_inplace */
   1945  1.1  christos 	 0,			/* src_mask */
   1946  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1947  1.1  christos 	 FALSE),		/* pcrel_offset */
   1948  1.1  christos 
   1949  1.1  christos   /* MIPS16 TLS general dynamic variable reference.  */
   1950  1.1  christos   HOWTO (R_MIPS16_TLS_GD,	/* type */
   1951  1.1  christos 	 0,			/* rightshift */
   1952  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1953  1.1  christos 	 16,			/* bitsize */
   1954  1.1  christos 	 FALSE,			/* pc_relative */
   1955  1.1  christos 	 0,			/* bitpos */
   1956  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1957  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1958  1.1  christos 	 "R_MIPS16_TLS_GD",	/* name */
   1959  1.1  christos 	 FALSE,			/* partial_inplace */
   1960  1.1  christos 	 0,			/* src_mask */
   1961  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1962  1.1  christos 	 FALSE),		/* pcrel_offset */
   1963  1.1  christos 
   1964  1.1  christos   /* MIPS16 TLS local dynamic variable reference.  */
   1965  1.1  christos   HOWTO (R_MIPS16_TLS_LDM,	/* type */
   1966  1.1  christos 	 0,			/* rightshift */
   1967  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1968  1.1  christos 	 16,			/* bitsize */
   1969  1.1  christos 	 FALSE,			/* pc_relative */
   1970  1.1  christos 	 0,			/* bitpos */
   1971  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1972  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1973  1.1  christos 	 "R_MIPS16_TLS_LDM",	/* name */
   1974  1.1  christos 	 FALSE,			/* partial_inplace */
   1975  1.1  christos 	 0,			/* src_mask */
   1976  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1977  1.1  christos 	 FALSE),		/* pcrel_offset */
   1978  1.1  christos 
   1979  1.1  christos   /* MIPS16 TLS local dynamic offset.  */
   1980  1.1  christos   HOWTO (R_MIPS16_TLS_DTPREL_HI16,	/* type */
   1981  1.1  christos 	 0,			/* rightshift */
   1982  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1983  1.1  christos 	 16,			/* bitsize */
   1984  1.1  christos 	 FALSE,			/* pc_relative */
   1985  1.1  christos 	 0,			/* bitpos */
   1986  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   1987  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   1988  1.1  christos 	 "R_MIPS16_TLS_DTPREL_HI16",	/* name */
   1989  1.1  christos 	 FALSE,			/* partial_inplace */
   1990  1.1  christos 	 0,			/* src_mask */
   1991  1.1  christos 	 0x0000ffff,		/* dst_mask */
   1992  1.1  christos 	 FALSE),		/* pcrel_offset */
   1993  1.1  christos 
   1994  1.1  christos   /* MIPS16 TLS local dynamic offset.  */
   1995  1.1  christos   HOWTO (R_MIPS16_TLS_DTPREL_LO16,	/* type */
   1996  1.1  christos 	 0,			/* rightshift */
   1997  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   1998  1.1  christos 	 16,			/* bitsize */
   1999  1.1  christos 	 FALSE,			/* pc_relative */
   2000  1.1  christos 	 0,			/* bitpos */
   2001  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2002  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2003  1.1  christos 	 "R_MIPS16_TLS_DTPREL_LO16",	/* name */
   2004  1.1  christos 	 FALSE,			/* partial_inplace */
   2005  1.1  christos 	 0,			/* src_mask */
   2006  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2007  1.1  christos 	 FALSE),		/* pcrel_offset */
   2008  1.1  christos 
   2009  1.1  christos   /* MIPS16 TLS thread pointer offset.  */
   2010  1.1  christos   HOWTO (R_MIPS16_TLS_GOTTPREL,	/* type */
   2011  1.1  christos 	 0,			/* rightshift */
   2012  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2013  1.1  christos 	 16,			/* bitsize */
   2014  1.1  christos 	 FALSE,			/* pc_relative */
   2015  1.1  christos 	 0,			/* bitpos */
   2016  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2017  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2018  1.1  christos 	 "R_MIPS16_TLS_GOTTPREL",	/* name */
   2019  1.1  christos 	 FALSE,			/* partial_inplace */
   2020  1.1  christos 	 0,			/* src_mask */
   2021  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2022  1.1  christos 	 FALSE),		/* pcrel_offset */
   2023  1.1  christos 
   2024  1.1  christos   /* MIPS16 TLS thread pointer offset.  */
   2025  1.1  christos   HOWTO (R_MIPS16_TLS_TPREL_HI16,	/* type */
   2026  1.1  christos 	 0,			/* rightshift */
   2027  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2028  1.1  christos 	 16,			/* bitsize */
   2029  1.1  christos 	 FALSE,			/* pc_relative */
   2030  1.1  christos 	 0,			/* bitpos */
   2031  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2032  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2033  1.1  christos 	 "R_MIPS16_TLS_TPREL_HI16", /* name */
   2034  1.1  christos 	 FALSE,			/* partial_inplace */
   2035  1.1  christos 	 0,			/* src_mask */
   2036  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2037  1.1  christos 	 FALSE),		/* pcrel_offset */
   2038  1.1  christos 
   2039  1.1  christos   /* MIPS16 TLS thread pointer offset.  */
   2040  1.1  christos   HOWTO (R_MIPS16_TLS_TPREL_LO16,	/* type */
   2041  1.1  christos 	 0,			/* rightshift */
   2042  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2043  1.1  christos 	 16,			/* bitsize */
   2044  1.1  christos 	 FALSE,			/* pc_relative */
   2045  1.1  christos 	 0,			/* bitpos */
   2046  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2047  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2048  1.1  christos 	 "R_MIPS16_TLS_TPREL_LO16", /* name */
   2049  1.1  christos 	 FALSE,			/* partial_inplace */
   2050  1.1  christos 	 0,			/* src_mask */
   2051  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2052  1.1  christos 	 FALSE),		/* pcrel_offset */
   2053  1.1  christos };
   2054  1.1  christos 
   2055  1.1  christos static reloc_howto_type elf_micromips_howto_table_rel[] =
   2056  1.1  christos {
   2057  1.1  christos   EMPTY_HOWTO (130),
   2058  1.1  christos   EMPTY_HOWTO (131),
   2059  1.1  christos   EMPTY_HOWTO (132),
   2060  1.1  christos 
   2061  1.1  christos   /* 26 bit jump address.  */
   2062  1.1  christos   HOWTO (R_MICROMIPS_26_S1,	/* type */
   2063  1.1  christos 	 1,			/* rightshift */
   2064  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2065  1.1  christos 	 26,			/* bitsize */
   2066  1.1  christos 	 FALSE,			/* pc_relative */
   2067  1.1  christos 	 0,			/* bitpos */
   2068  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2069  1.1  christos 	 			/* This needs complex overflow
   2070  1.1  christos 				   detection, because the upper four
   2071  1.1  christos 				   bits must match the PC.  */
   2072  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2073  1.1  christos 	 "R_MICROMIPS_26_S1",	/* name */
   2074  1.1  christos 	 TRUE,			/* partial_inplace */
   2075  1.1  christos 	 0x3ffffff,		/* src_mask */
   2076  1.1  christos 	 0x3ffffff,		/* dst_mask */
   2077  1.1  christos 	 FALSE),		/* pcrel_offset */
   2078  1.1  christos 
   2079  1.1  christos   /* High 16 bits of symbol value.  */
   2080  1.1  christos   HOWTO (R_MICROMIPS_HI16,	/* type */
   2081  1.1  christos 	 16,			/* rightshift */
   2082  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2083  1.1  christos 	 16,			/* bitsize */
   2084  1.1  christos 	 FALSE,			/* pc_relative */
   2085  1.1  christos 	 0,			/* bitpos */
   2086  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2087  1.1  christos 	 _bfd_mips_elf_hi16_reloc, /* special_function */
   2088  1.1  christos 	 "R_MICROMIPS_HI16",	/* name */
   2089  1.1  christos 	 TRUE,			/* partial_inplace */
   2090  1.1  christos 	 0x0000ffff,		/* src_mask */
   2091  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2092  1.1  christos 	 FALSE),		/* pcrel_offset */
   2093  1.1  christos 
   2094  1.1  christos   /* Low 16 bits of symbol value.  */
   2095  1.1  christos   HOWTO (R_MICROMIPS_LO16,	/* type */
   2096  1.1  christos 	 0,			/* rightshift */
   2097  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2098  1.1  christos 	 16,			/* bitsize */
   2099  1.1  christos 	 FALSE,			/* pc_relative */
   2100  1.1  christos 	 0,			/* bitpos */
   2101  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2102  1.1  christos 	 _bfd_mips_elf_lo16_reloc, /* special_function */
   2103  1.1  christos 	 "R_MICROMIPS_LO16",	/* name */
   2104  1.1  christos 	 TRUE,			/* partial_inplace */
   2105  1.1  christos 	 0x0000ffff,		/* src_mask */
   2106  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2107  1.1  christos 	 FALSE),		/* pcrel_offset */
   2108  1.1  christos 
   2109  1.1  christos   /* GP relative reference.  */
   2110  1.1  christos   HOWTO (R_MICROMIPS_GPREL16,	/* type */
   2111  1.1  christos 	 0,			/* rightshift */
   2112  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2113  1.1  christos 	 16,			/* bitsize */
   2114  1.1  christos 	 FALSE,			/* pc_relative */
   2115  1.1  christos 	 0,			/* bitpos */
   2116  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2117  1.1  christos 	 _bfd_mips_elf32_gprel16_reloc, /* special_function */
   2118  1.1  christos 	 "R_MICROMIPS_GPREL16",	/* name */
   2119  1.1  christos 	 TRUE,			/* partial_inplace */
   2120  1.1  christos 	 0x0000ffff,		/* src_mask */
   2121  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2122  1.1  christos 	 FALSE),		/* pcrel_offset */
   2123  1.1  christos 
   2124  1.1  christos   /* Reference to literal section.  */
   2125  1.1  christos   HOWTO (R_MICROMIPS_LITERAL,	/* type */
   2126  1.1  christos 	 0,			/* rightshift */
   2127  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2128  1.1  christos 	 16,			/* bitsize */
   2129  1.1  christos 	 FALSE,			/* pc_relative */
   2130  1.1  christos 	 0,			/* bitpos */
   2131  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2132  1.1  christos 	 _bfd_mips_elf32_gprel16_reloc, /* special_function */
   2133  1.1  christos 	 "R_MICROMIPS_LITERAL",	/* name */
   2134  1.1  christos 	 TRUE,			/* partial_inplace */
   2135  1.1  christos 	 0x0000ffff,		/* src_mask */
   2136  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2137  1.1  christos 	 FALSE),		/* pcrel_offset */
   2138  1.1  christos 
   2139  1.1  christos   /* Reference to global offset table.  */
   2140  1.1  christos   HOWTO (R_MICROMIPS_GOT16,	/* type */
   2141  1.1  christos 	 0,			/* rightshift */
   2142  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2143  1.1  christos 	 16,			/* bitsize */
   2144  1.1  christos 	 FALSE,			/* pc_relative */
   2145  1.1  christos 	 0,			/* bitpos */
   2146  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2147  1.1  christos 	 _bfd_mips_elf_got16_reloc, /* special_function */
   2148  1.1  christos 	 "R_MICROMIPS_GOT16",	/* name */
   2149  1.1  christos 	 TRUE,			/* partial_inplace */
   2150  1.1  christos 	 0x0000ffff,		/* src_mask */
   2151  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2152  1.1  christos 	 FALSE),		/* pcrel_offset */
   2153  1.1  christos 
   2154  1.1  christos   /* This is for microMIPS branches.  */
   2155  1.1  christos   HOWTO (R_MICROMIPS_PC7_S1,	/* type */
   2156  1.1  christos 	 1,			/* rightshift */
   2157  1.1  christos 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
   2158  1.1  christos 	 7,			/* bitsize */
   2159  1.1  christos 	 TRUE,			/* pc_relative */
   2160  1.1  christos 	 0,			/* bitpos */
   2161  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2162  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2163  1.1  christos 	 "R_MICROMIPS_PC7_S1",	/* name */
   2164  1.1  christos 	 TRUE,			/* partial_inplace */
   2165  1.1  christos 	 0x0000007f,		/* src_mask */
   2166  1.1  christos 	 0x0000007f,		/* dst_mask */
   2167  1.1  christos 	 TRUE),			/* pcrel_offset */
   2168  1.1  christos 
   2169  1.1  christos   HOWTO (R_MICROMIPS_PC10_S1,	/* type */
   2170  1.1  christos 	 1,			/* rightshift */
   2171  1.1  christos 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
   2172  1.1  christos 	 10,			/* bitsize */
   2173  1.1  christos 	 TRUE,			/* pc_relative */
   2174  1.1  christos 	 0,			/* bitpos */
   2175  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2176  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2177  1.1  christos 	 "R_MICROMIPS_PC10_S1",	/* name */
   2178  1.1  christos 	 TRUE,			/* partial_inplace */
   2179  1.1  christos 	 0x000003ff,		/* src_mask */
   2180  1.1  christos 	 0x000003ff,		/* dst_mask */
   2181  1.1  christos 	 TRUE),			/* pcrel_offset */
   2182  1.1  christos 
   2183  1.1  christos   HOWTO (R_MICROMIPS_PC16_S1,	/* type */
   2184  1.1  christos 	 1,			/* rightshift */
   2185  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2186  1.1  christos 	 16,			/* bitsize */
   2187  1.1  christos 	 TRUE,			/* pc_relative */
   2188  1.1  christos 	 0,			/* bitpos */
   2189  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2190  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2191  1.1  christos 	 "R_MICROMIPS_PC16_S1",	/* name */
   2192  1.1  christos 	 TRUE,			/* partial_inplace */
   2193  1.1  christos 	 0x0000ffff,		/* src_mask */
   2194  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2195  1.1  christos 	 TRUE),			/* pcrel_offset */
   2196  1.1  christos 
   2197  1.1  christos   /* 16 bit call through global offset table.  */
   2198  1.1  christos   HOWTO (R_MICROMIPS_CALL16,	/* type */
   2199  1.1  christos 	 0,			/* rightshift */
   2200  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2201  1.1  christos 	 16,			/* bitsize */
   2202  1.1  christos 	 FALSE,			/* pc_relative */
   2203  1.1  christos 	 0,			/* bitpos */
   2204  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2205  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2206  1.1  christos 	 "R_MICROMIPS_CALL16",	/* name */
   2207  1.1  christos 	 TRUE,			/* partial_inplace */
   2208  1.1  christos 	 0x0000ffff,		/* src_mask */
   2209  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2210  1.1  christos 	 FALSE),		/* pcrel_offset */
   2211  1.1  christos 
   2212  1.1  christos   EMPTY_HOWTO (143),
   2213  1.1  christos   EMPTY_HOWTO (144),
   2214  1.1  christos 
   2215  1.1  christos   /* Displacement in the global offset table.  */
   2216  1.1  christos   HOWTO (R_MICROMIPS_GOT_DISP,	/* type */
   2217  1.1  christos 	 0,			/* rightshift */
   2218  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2219  1.1  christos 	 16,			/* bitsize */
   2220  1.1  christos 	 FALSE,			/* pc_relative */
   2221  1.1  christos 	 0,			/* bitpos */
   2222  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2223  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2224  1.1  christos 	 "R_MICROMIPS_GOT_DISP",/* name */
   2225  1.1  christos 	 TRUE,			/* partial_inplace */
   2226  1.1  christos 	 0x0000ffff,		/* src_mask */
   2227  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2228  1.1  christos 	 FALSE),		/* pcrel_offset */
   2229  1.1  christos 
   2230  1.1  christos   /* Displacement to page pointer in the global offset table.  */
   2231  1.1  christos   HOWTO (R_MICROMIPS_GOT_PAGE,	/* type */
   2232  1.1  christos 	 0,			/* rightshift */
   2233  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2234  1.1  christos 	 16,			/* bitsize */
   2235  1.1  christos 	 FALSE,			/* pc_relative */
   2236  1.1  christos 	 0,			/* bitpos */
   2237  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2238  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2239  1.1  christos 	 "R_MICROMIPS_GOT_PAGE",/* name */
   2240  1.1  christos 	 TRUE,			/* partial_inplace */
   2241  1.1  christos 	 0x0000ffff,		/* src_mask */
   2242  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2243  1.1  christos 	 FALSE),		/* pcrel_offset */
   2244  1.1  christos 
   2245  1.1  christos   /* Offset from page pointer in the global offset table.  */
   2246  1.1  christos   HOWTO (R_MICROMIPS_GOT_OFST,	/* type */
   2247  1.1  christos 	 0,			/* rightshift */
   2248  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2249  1.1  christos 	 16,			/* bitsize */
   2250  1.1  christos 	 FALSE,			/* pc_relative */
   2251  1.1  christos 	 0,			/* bitpos */
   2252  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2253  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2254  1.1  christos 	 "R_MICROMIPS_GOT_OFST",/* name */
   2255  1.1  christos 	 TRUE,			/* partial_inplace */
   2256  1.1  christos 	 0x0000ffff,		/* src_mask */
   2257  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2258  1.1  christos 	 FALSE),		/* pcrel_offset */
   2259  1.1  christos 
   2260  1.1  christos   /* High 16 bits of displacement in global offset table.  */
   2261  1.1  christos   HOWTO (R_MICROMIPS_GOT_HI16,	/* type */
   2262  1.1  christos 	 0,			/* rightshift */
   2263  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2264  1.1  christos 	 16,			/* bitsize */
   2265  1.1  christos 	 FALSE,			/* pc_relative */
   2266  1.1  christos 	 0,			/* bitpos */
   2267  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2268  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2269  1.1  christos 	 "R_MICROMIPS_GOT_HI16",/* name */
   2270  1.1  christos 	 TRUE,			/* partial_inplace */
   2271  1.1  christos 	 0x0000ffff,		/* src_mask */
   2272  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2273  1.1  christos 	 FALSE),		/* pcrel_offset */
   2274  1.1  christos 
   2275  1.1  christos   /* Low 16 bits of displacement in global offset table.  */
   2276  1.1  christos   HOWTO (R_MICROMIPS_GOT_LO16,	/* type */
   2277  1.1  christos 	 0,			/* rightshift */
   2278  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2279  1.1  christos 	 16,			/* bitsize */
   2280  1.1  christos 	 FALSE,			/* pc_relative */
   2281  1.1  christos 	 0,			/* bitpos */
   2282  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2283  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2284  1.1  christos 	 "R_MICROMIPS_GOT_LO16",/* name */
   2285  1.1  christos 	 TRUE,			/* partial_inplace */
   2286  1.1  christos 	 0x0000ffff,		/* src_mask */
   2287  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2288  1.1  christos 	 FALSE),		/* pcrel_offset */
   2289  1.1  christos 
   2290  1.1  christos   /* 64 bit subtraction.  Used in the N32 ABI.  */
   2291  1.1  christos   HOWTO (R_MICROMIPS_SUB,	/* type */
   2292  1.1  christos 	 0,			/* rightshift */
   2293  1.1  christos 	 4,			/* size (0 = byte, 1 = short, 2 = long) */
   2294  1.1  christos 	 64,			/* bitsize */
   2295  1.1  christos 	 FALSE,			/* pc_relative */
   2296  1.1  christos 	 0,			/* bitpos */
   2297  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2298  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2299  1.1  christos 	 "R_MICROMIPS_SUB",	/* name */
   2300  1.1  christos 	 TRUE,			/* partial_inplace */
   2301  1.1  christos 	 MINUS_ONE,		/* src_mask */
   2302  1.1  christos 	 MINUS_ONE,		/* dst_mask */
   2303  1.1  christos 	 FALSE),		/* pcrel_offset */
   2304  1.1  christos 
   2305  1.1  christos   /* We don't support these for REL relocations, because it means building
   2306  1.1  christos      the addend from a R_MICROMIPS_HIGHEST/R_MICROMIPS_HIGHER/
   2307  1.1  christos      R_MICROMIPS_HI16/R_MICROMIPS_LO16 sequence with varying ordering,
   2308  1.1  christos      using fallable heuristics.  */
   2309  1.1  christos   EMPTY_HOWTO (R_MICROMIPS_HIGHER),
   2310  1.1  christos   EMPTY_HOWTO (R_MICROMIPS_HIGHEST),
   2311  1.1  christos 
   2312  1.1  christos   /* High 16 bits of displacement in global offset table.  */
   2313  1.1  christos   HOWTO (R_MICROMIPS_CALL_HI16,	/* type */
   2314  1.1  christos 	 0,			/* rightshift */
   2315  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2316  1.1  christos 	 16,			/* bitsize */
   2317  1.1  christos 	 FALSE,			/* pc_relative */
   2318  1.1  christos 	 0,			/* bitpos */
   2319  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2320  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2321  1.1  christos 	 "R_MICROMIPS_CALL_HI16",/* name */
   2322  1.1  christos 	 TRUE,			/* partial_inplace */
   2323  1.1  christos 	 0x0000ffff,		/* src_mask */
   2324  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2325  1.1  christos 	 FALSE),		/* pcrel_offset */
   2326  1.1  christos 
   2327  1.1  christos   /* Low 16 bits of displacement in global offset table.  */
   2328  1.1  christos   HOWTO (R_MICROMIPS_CALL_LO16,	/* type */
   2329  1.1  christos 	 0,			/* rightshift */
   2330  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2331  1.1  christos 	 16,			/* bitsize */
   2332  1.1  christos 	 FALSE,			/* pc_relative */
   2333  1.1  christos 	 0,			/* bitpos */
   2334  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2335  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2336  1.1  christos 	 "R_MICROMIPS_CALL_LO16",/* name */
   2337  1.1  christos 	 TRUE,			/* partial_inplace */
   2338  1.1  christos 	 0x0000ffff,		/* src_mask */
   2339  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2340  1.1  christos 	 FALSE),		/* pcrel_offset */
   2341  1.3  christos 
   2342  1.3  christos   /* Section displacement.  */
   2343  1.3  christos   HOWTO (R_MICROMIPS_SCN_DISP,  /* type */
   2344  1.3  christos 	 0,			/* rightshift */
   2345  1.3  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2346  1.3  christos 	 32,			/* bitsize */
   2347  1.3  christos 	 FALSE,			/* pc_relative */
   2348  1.3  christos 	 0,			/* bitpos */
   2349  1.3  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2350  1.3  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2351  1.3  christos 	 "R_MICROMIPS_SCN_DISP", /* name */
   2352  1.3  christos 	 TRUE,			/* partial_inplace */
   2353  1.3  christos 	 0xffffffff,		/* src_mask */
   2354  1.3  christos 	 0xffffffff,		/* dst_mask */
   2355  1.3  christos 	 FALSE),		/* pcrel_offset */
   2356  1.3  christos 
   2357  1.3  christos   /* Protected jump conversion.  This is an optimization hint.  No
   2358  1.3  christos      relocation is required for correctness.  */
   2359  1.3  christos   HOWTO (R_MICROMIPS_JALR,	/* type */
   2360  1.3  christos 	 0,			/* rightshift */
   2361  1.3  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2362  1.3  christos 	 32,			/* bitsize */
   2363  1.3  christos 	 FALSE,			/* pc_relative */
   2364  1.3  christos 	 0,			/* bitpos */
   2365  1.3  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2366  1.3  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2367  1.3  christos 	 "R_MICROMIPS_JALR",	/* name */
   2368  1.3  christos 	 FALSE,			/* partial_inplace */
   2369  1.3  christos 	 0,			/* src_mask */
   2370  1.3  christos 	 0x00000000,		/* dst_mask */
   2371  1.3  christos 	 FALSE),		/* pcrel_offset */
   2372  1.1  christos };
   2373  1.1  christos 
   2374  1.1  christos static reloc_howto_type elf_micromips_howto_table_rela[] =
   2375  1.1  christos {
   2376  1.1  christos   EMPTY_HOWTO (130),
   2377  1.1  christos   EMPTY_HOWTO (131),
   2378  1.1  christos   EMPTY_HOWTO (132),
   2379  1.1  christos 
   2380  1.1  christos   /* 26 bit jump address.  */
   2381  1.1  christos   HOWTO (R_MICROMIPS_26_S1,	/* type */
   2382  1.1  christos 	 1,			/* rightshift */
   2383  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2384  1.1  christos 	 26,			/* 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 	 			/* This needs complex overflow
   2389  1.1  christos 				   detection, because the upper four
   2390  1.1  christos 				   bits must match the PC.  */
   2391  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2392  1.1  christos 	 "R_MICROMIPS_26_S1",	/* name */
   2393  1.1  christos 	 FALSE,			/* partial_inplace */
   2394  1.1  christos 	 0,			/* src_mask */
   2395  1.1  christos 	 0x3ffffff,		/* dst_mask */
   2396  1.1  christos 	 FALSE),		/* pcrel_offset */
   2397  1.1  christos 
   2398  1.1  christos   /* High 16 bits of symbol value.  */
   2399  1.1  christos   HOWTO (R_MICROMIPS_HI16,	/* type */
   2400  1.1  christos 	 16,			/* rightshift */
   2401  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2402  1.1  christos 	 16,			/* bitsize */
   2403  1.1  christos 	 FALSE,			/* pc_relative */
   2404  1.1  christos 	 0,			/* bitpos */
   2405  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2406  1.1  christos 	 _bfd_mips_elf_hi16_reloc, /* special_function */
   2407  1.1  christos 	 "R_MICROMIPS_HI16",	/* name */
   2408  1.1  christos 	 FALSE,			/* partial_inplace */
   2409  1.1  christos 	 0,			/* src_mask */
   2410  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2411  1.1  christos 	 FALSE),		/* pcrel_offset */
   2412  1.1  christos 
   2413  1.1  christos   /* Low 16 bits of symbol value.  */
   2414  1.1  christos   HOWTO (R_MICROMIPS_LO16,	/* type */
   2415  1.1  christos 	 0,			/* rightshift */
   2416  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2417  1.1  christos 	 16,			/* bitsize */
   2418  1.1  christos 	 FALSE,			/* pc_relative */
   2419  1.1  christos 	 0,			/* bitpos */
   2420  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2421  1.1  christos 	 _bfd_mips_elf_lo16_reloc, /* special_function */
   2422  1.1  christos 	 "R_MICROMIPS_LO16",	/* name */
   2423  1.1  christos 	 FALSE,			/* partial_inplace */
   2424  1.1  christos 	 0,			/* src_mask */
   2425  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2426  1.1  christos 	 FALSE),		/* pcrel_offset */
   2427  1.1  christos 
   2428  1.1  christos   /* GP relative reference.  */
   2429  1.1  christos   HOWTO (R_MICROMIPS_GPREL16,	/* type */
   2430  1.1  christos 	 0,			/* rightshift */
   2431  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2432  1.1  christos 	 16,			/* bitsize */
   2433  1.1  christos 	 FALSE,			/* pc_relative */
   2434  1.1  christos 	 0,			/* bitpos */
   2435  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2436  1.1  christos 	 _bfd_mips_elf32_gprel16_reloc, /* special_function */
   2437  1.1  christos 	 "R_MICROMIPS_GPREL16",	/* name */
   2438  1.1  christos 	 FALSE,			/* partial_inplace */
   2439  1.1  christos 	 0,			/* src_mask */
   2440  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2441  1.1  christos 	 FALSE),		/* pcrel_offset */
   2442  1.1  christos 
   2443  1.1  christos   /* Reference to literal section.  */
   2444  1.1  christos   HOWTO (R_MICROMIPS_LITERAL,	/* type */
   2445  1.1  christos 	 0,			/* rightshift */
   2446  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2447  1.1  christos 	 16,			/* bitsize */
   2448  1.1  christos 	 FALSE,			/* pc_relative */
   2449  1.1  christos 	 0,			/* bitpos */
   2450  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2451  1.1  christos 	 _bfd_mips_elf32_gprel16_reloc, /* special_function */
   2452  1.1  christos 	 "R_MICROMIPS_LITERAL",	/* name */
   2453  1.1  christos 	 FALSE,			/* partial_inplace */
   2454  1.1  christos 	 0,			/* src_mask */
   2455  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2456  1.1  christos 	 FALSE),		/* pcrel_offset */
   2457  1.1  christos 
   2458  1.1  christos   /* Reference to global offset table.  */
   2459  1.1  christos   HOWTO (R_MICROMIPS_GOT16,	/* type */
   2460  1.1  christos 	 0,			/* rightshift */
   2461  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2462  1.1  christos 	 16,			/* bitsize */
   2463  1.1  christos 	 FALSE,			/* pc_relative */
   2464  1.1  christos 	 0,			/* bitpos */
   2465  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2466  1.1  christos 	 _bfd_mips_elf_got16_reloc, /* special_function */
   2467  1.1  christos 	 "R_MICROMIPS_GOT16",	/* name */
   2468  1.1  christos 	 FALSE,			/* partial_inplace */
   2469  1.1  christos 	 0,			/* src_mask */
   2470  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2471  1.1  christos 	 FALSE),		/* pcrel_offset */
   2472  1.1  christos 
   2473  1.1  christos   /* This is for microMIPS branches.  */
   2474  1.1  christos   HOWTO (R_MICROMIPS_PC7_S1,	/* type */
   2475  1.1  christos 	 1,			/* rightshift */
   2476  1.1  christos 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
   2477  1.1  christos 	 7,			/* bitsize */
   2478  1.1  christos 	 TRUE,			/* pc_relative */
   2479  1.1  christos 	 0,			/* bitpos */
   2480  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2481  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2482  1.1  christos 	 "R_MICROMIPS_PC7_S1",	/* name */
   2483  1.1  christos 	 FALSE,			/* partial_inplace */
   2484  1.1  christos 	 0,			/* src_mask */
   2485  1.1  christos 	 0x0000007f,		/* dst_mask */
   2486  1.1  christos 	 TRUE),			/* pcrel_offset */
   2487  1.1  christos 
   2488  1.1  christos   HOWTO (R_MICROMIPS_PC10_S1,	/* type */
   2489  1.1  christos 	 1,			/* rightshift */
   2490  1.1  christos 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
   2491  1.1  christos 	 10,			/* bitsize */
   2492  1.1  christos 	 TRUE,			/* pc_relative */
   2493  1.1  christos 	 0,			/* bitpos */
   2494  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2495  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2496  1.1  christos 	 "R_MICROMIPS_PC10_S1",	/* name */
   2497  1.1  christos 	 FALSE,			/* partial_inplace */
   2498  1.1  christos 	 0,			/* src_mask */
   2499  1.1  christos 	 0x000003ff,		/* dst_mask */
   2500  1.1  christos 	 TRUE),			/* pcrel_offset */
   2501  1.1  christos 
   2502  1.1  christos   HOWTO (R_MICROMIPS_PC16_S1,	/* type */
   2503  1.1  christos 	 1,			/* rightshift */
   2504  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2505  1.1  christos 	 16,			/* bitsize */
   2506  1.1  christos 	 TRUE,			/* pc_relative */
   2507  1.1  christos 	 0,			/* bitpos */
   2508  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2509  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2510  1.1  christos 	 "R_MICROMIPS_PC16_S1",	/* name */
   2511  1.1  christos 	 FALSE,			/* partial_inplace */
   2512  1.1  christos 	 0,			/* src_mask */
   2513  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2514  1.1  christos 	 TRUE),			/* pcrel_offset */
   2515  1.1  christos 
   2516  1.1  christos   /* 16 bit call through global offset table.  */
   2517  1.1  christos   HOWTO (R_MICROMIPS_CALL16,	/* type */
   2518  1.1  christos 	 0,			/* rightshift */
   2519  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2520  1.1  christos 	 16,			/* bitsize */
   2521  1.1  christos 	 FALSE,			/* pc_relative */
   2522  1.1  christos 	 0,			/* bitpos */
   2523  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2524  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2525  1.1  christos 	 "R_MICROMIPS_CALL16",	/* name */
   2526  1.1  christos 	 FALSE,			/* partial_inplace */
   2527  1.1  christos 	 0,			/* src_mask */
   2528  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2529  1.1  christos 	 FALSE),		/* pcrel_offset */
   2530  1.1  christos 
   2531  1.1  christos   EMPTY_HOWTO (143),
   2532  1.1  christos   EMPTY_HOWTO (144),
   2533  1.1  christos 
   2534  1.1  christos   /* Displacement in the global offset table.  */
   2535  1.1  christos   HOWTO (R_MICROMIPS_GOT_DISP,	/* type */
   2536  1.1  christos 	 0,			/* rightshift */
   2537  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2538  1.1  christos 	 16,			/* bitsize */
   2539  1.1  christos 	 FALSE,			/* pc_relative */
   2540  1.1  christos 	 0,			/* bitpos */
   2541  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2542  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2543  1.1  christos 	 "R_MICROMIPS_GOT_DISP",/* name */
   2544  1.1  christos 	 FALSE,			/* partial_inplace */
   2545  1.1  christos 	 0,			/* src_mask */
   2546  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2547  1.1  christos 	 FALSE),		/* pcrel_offset */
   2548  1.1  christos 
   2549  1.1  christos   /* Displacement to page pointer in the global offset table.  */
   2550  1.1  christos   HOWTO (R_MICROMIPS_GOT_PAGE,	/* type */
   2551  1.1  christos 	 0,			/* rightshift */
   2552  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2553  1.1  christos 	 16,			/* bitsize */
   2554  1.1  christos 	 FALSE,			/* pc_relative */
   2555  1.1  christos 	 0,			/* bitpos */
   2556  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2557  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2558  1.1  christos 	 "R_MICROMIPS_GOT_PAGE",/* name */
   2559  1.1  christos 	 FALSE,			/* partial_inplace */
   2560  1.1  christos 	 0,			/* src_mask */
   2561  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2562  1.1  christos 	 FALSE),		/* pcrel_offset */
   2563  1.1  christos 
   2564  1.1  christos   /* Offset from page pointer in the global offset table.  */
   2565  1.1  christos   HOWTO (R_MICROMIPS_GOT_OFST,	/* type */
   2566  1.1  christos 	 0,			/* rightshift */
   2567  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2568  1.1  christos 	 16,			/* bitsize */
   2569  1.1  christos 	 FALSE,			/* pc_relative */
   2570  1.1  christos 	 0,			/* bitpos */
   2571  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2572  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2573  1.1  christos 	 "R_MICROMIPS_GOT_OFST",/* name */
   2574  1.1  christos 	 FALSE,			/* partial_inplace */
   2575  1.1  christos 	 0,			/* src_mask */
   2576  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2577  1.1  christos 	 FALSE),		/* pcrel_offset */
   2578  1.1  christos 
   2579  1.1  christos   /* High 16 bits of displacement in global offset table.  */
   2580  1.1  christos   HOWTO (R_MICROMIPS_GOT_HI16,	/* type */
   2581  1.1  christos 	 0,			/* rightshift */
   2582  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2583  1.1  christos 	 16,			/* bitsize */
   2584  1.1  christos 	 FALSE,			/* pc_relative */
   2585  1.1  christos 	 0,			/* bitpos */
   2586  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2587  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2588  1.1  christos 	 "R_MICROMIPS_GOT_HI16",/* name */
   2589  1.1  christos 	 FALSE,			/* partial_inplace */
   2590  1.1  christos 	 0,			/* src_mask */
   2591  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2592  1.1  christos 	 FALSE),		/* pcrel_offset */
   2593  1.1  christos 
   2594  1.1  christos   /* Low 16 bits of displacement in global offset table.  */
   2595  1.1  christos   HOWTO (R_MICROMIPS_GOT_LO16,	/* type */
   2596  1.1  christos 	 0,			/* rightshift */
   2597  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2598  1.1  christos 	 16,			/* bitsize */
   2599  1.1  christos 	 FALSE,			/* pc_relative */
   2600  1.1  christos 	 0,			/* bitpos */
   2601  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2602  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2603  1.1  christos 	 "R_MICROMIPS_GOT_LO16",/* name */
   2604  1.1  christos 	 FALSE,			/* partial_inplace */
   2605  1.1  christos 	 0,			/* src_mask */
   2606  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2607  1.1  christos 	 FALSE),		/* pcrel_offset */
   2608  1.1  christos 
   2609  1.1  christos   /* 64 bit subtraction.  Used in the N32 ABI.  */
   2610  1.1  christos   HOWTO (R_MICROMIPS_SUB,	/* type */
   2611  1.1  christos 	 0,			/* rightshift */
   2612  1.1  christos 	 4,			/* size (0 = byte, 1 = short, 2 = long) */
   2613  1.1  christos 	 64,			/* bitsize */
   2614  1.1  christos 	 FALSE,			/* pc_relative */
   2615  1.1  christos 	 0,			/* bitpos */
   2616  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2617  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2618  1.1  christos 	 "R_MICROMIPS_SUB",	/* name */
   2619  1.1  christos 	 FALSE,			/* partial_inplace */
   2620  1.1  christos 	 0,			/* src_mask */
   2621  1.1  christos 	 MINUS_ONE,		/* dst_mask */
   2622  1.1  christos 	 FALSE),		/* pcrel_offset */
   2623  1.1  christos 
   2624  1.1  christos   /* Get the higher value of a 64 bit addend.  */
   2625  1.1  christos   HOWTO (R_MICROMIPS_HIGHER,	/* type */
   2626  1.1  christos 	 0,			/* rightshift */
   2627  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2628  1.1  christos 	 16,			/* bitsize */
   2629  1.1  christos 	 FALSE,			/* pc_relative */
   2630  1.1  christos 	 0,			/* bitpos */
   2631  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2632  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2633  1.1  christos 	 "R_MICROMIPS_HIGHER",	/* name */
   2634  1.1  christos 	 FALSE,			/* partial_inplace */
   2635  1.1  christos 	 0,			/* src_mask */
   2636  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2637  1.1  christos 	 FALSE),		/* pcrel_offset */
   2638  1.1  christos 
   2639  1.1  christos   /* Get the highest value of a 64 bit addend.  */
   2640  1.1  christos   HOWTO (R_MICROMIPS_HIGHEST,	/* type */
   2641  1.1  christos 	 0,			/* rightshift */
   2642  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2643  1.1  christos 	 16,			/* bitsize */
   2644  1.1  christos 	 FALSE,			/* pc_relative */
   2645  1.1  christos 	 0,			/* bitpos */
   2646  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2647  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2648  1.1  christos 	 "R_MICROMIPS_HIGHEST",	/* name */
   2649  1.1  christos 	 FALSE,			/* partial_inplace */
   2650  1.1  christos 	 0,			/* src_mask */
   2651  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2652  1.1  christos 	 FALSE),		/* pcrel_offset */
   2653  1.1  christos 
   2654  1.1  christos   /* High 16 bits of displacement in global offset table.  */
   2655  1.1  christos   HOWTO (R_MICROMIPS_CALL_HI16,	/* type */
   2656  1.1  christos 	 0,			/* rightshift */
   2657  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2658  1.1  christos 	 16,			/* bitsize */
   2659  1.1  christos 	 FALSE,			/* pc_relative */
   2660  1.1  christos 	 0,			/* bitpos */
   2661  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2662  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2663  1.1  christos 	 "R_MICROMIPS_CALL_HI16",/* name */
   2664  1.1  christos 	 FALSE,			/* partial_inplace */
   2665  1.1  christos 	 0,			/* src_mask */
   2666  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2667  1.1  christos 	 FALSE),		/* pcrel_offset */
   2668  1.1  christos 
   2669  1.1  christos   /* Low 16 bits of displacement in global offset table.  */
   2670  1.1  christos   HOWTO (R_MICROMIPS_CALL_LO16,	/* type */
   2671  1.1  christos 	 0,			/* rightshift */
   2672  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2673  1.1  christos 	 16,			/* bitsize */
   2674  1.1  christos 	 FALSE,			/* pc_relative */
   2675  1.1  christos 	 0,			/* bitpos */
   2676  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2677  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2678  1.1  christos 	 "R_MICROMIPS_CALL_LO16",/* name */
   2679  1.1  christos 	 FALSE,			/* partial_inplace */
   2680  1.1  christos 	 0,			/* src_mask */
   2681  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2682  1.1  christos 	 FALSE),		/* pcrel_offset */
   2683  1.3  christos 
   2684  1.3  christos   /* Section displacement.  */
   2685  1.3  christos   HOWTO (R_MICROMIPS_SCN_DISP,  /* type */
   2686  1.3  christos 	 0,			/* rightshift */
   2687  1.3  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2688  1.3  christos 	 32,			/* bitsize */
   2689  1.3  christos 	 FALSE,			/* pc_relative */
   2690  1.3  christos 	 0,			/* bitpos */
   2691  1.3  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2692  1.3  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2693  1.3  christos 	 "R_MICROMIPS_SCN_DISP", /* name */
   2694  1.3  christos 	 FALSE,			/* partial_inplace */
   2695  1.3  christos 	 0,			/* src_mask */
   2696  1.3  christos 	 0xffffffff,		/* dst_mask */
   2697  1.3  christos 	 FALSE),		/* pcrel_offset */
   2698  1.3  christos 
   2699  1.3  christos   /* Protected jump conversion.  This is an optimization hint.  No
   2700  1.3  christos      relocation is required for correctness.  */
   2701  1.3  christos   HOWTO (R_MICROMIPS_JALR,	/* type */
   2702  1.3  christos 	 0,			/* rightshift */
   2703  1.3  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2704  1.3  christos 	 32,			/* bitsize */
   2705  1.3  christos 	 FALSE,			/* pc_relative */
   2706  1.3  christos 	 0,			/* bitpos */
   2707  1.3  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2708  1.3  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2709  1.3  christos 	 "R_MICROMIPS_JALR",	/* name */
   2710  1.3  christos 	 FALSE,			/* partial_inplace */
   2711  1.3  christos 	 0,			/* src_mask */
   2712  1.3  christos 	 0x00000000,		/* dst_mask */
   2713  1.3  christos 	 FALSE),		/* pcrel_offset */
   2714  1.1  christos };
   2715  1.1  christos 
   2716  1.1  christos /* GNU extension to record C++ vtable hierarchy */
   2717  1.1  christos static reloc_howto_type elf_mips_gnu_vtinherit_howto =
   2718  1.1  christos   HOWTO (R_MIPS_GNU_VTINHERIT,	/* type */
   2719  1.1  christos 	 0,			/* rightshift */
   2720  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2721  1.1  christos 	 0,			/* bitsize */
   2722  1.1  christos 	 FALSE,			/* pc_relative */
   2723  1.1  christos 	 0,			/* bitpos */
   2724  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2725  1.1  christos 	 NULL,			/* special_function */
   2726  1.1  christos 	 "R_MIPS_GNU_VTINHERIT", /* name */
   2727  1.1  christos 	 FALSE,			/* partial_inplace */
   2728  1.1  christos 	 0,			/* src_mask */
   2729  1.1  christos 	 0,			/* dst_mask */
   2730  1.1  christos 	 FALSE);		/* pcrel_offset */
   2731  1.1  christos 
   2732  1.1  christos /* GNU extension to record C++ vtable member usage */
   2733  1.1  christos static reloc_howto_type elf_mips_gnu_vtentry_howto =
   2734  1.1  christos   HOWTO (R_MIPS_GNU_VTENTRY,	/* type */
   2735  1.1  christos 	 0,			/* rightshift */
   2736  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2737  1.1  christos 	 0,			/* bitsize */
   2738  1.1  christos 	 FALSE,			/* pc_relative */
   2739  1.1  christos 	 0,			/* bitpos */
   2740  1.1  christos 	 complain_overflow_dont, /* complain_on_overflow */
   2741  1.1  christos 	 _bfd_elf_rel_vtable_reloc_fn, /* special_function */
   2742  1.1  christos 	 "R_MIPS_GNU_VTENTRY",	/* name */
   2743  1.1  christos 	 FALSE,			/* partial_inplace */
   2744  1.1  christos 	 0,			/* src_mask */
   2745  1.1  christos 	 0,			/* dst_mask */
   2746  1.1  christos 	 FALSE);		/* pcrel_offset */
   2747  1.1  christos 
   2748  1.1  christos /* 16 bit offset for pc-relative branches.  */
   2750  1.1  christos static reloc_howto_type elf_mips_gnu_rel16_s2 =
   2751  1.1  christos   HOWTO (R_MIPS_GNU_REL16_S2,	/* type */
   2752  1.1  christos 	 2,			/* rightshift */
   2753  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2754  1.1  christos 	 16,			/* bitsize */
   2755  1.1  christos 	 TRUE,			/* pc_relative */
   2756  1.1  christos 	 0,			/* bitpos */
   2757  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2758  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2759  1.1  christos 	 "R_MIPS_GNU_REL16_S2",	/* name */
   2760  1.1  christos 	 TRUE,			/* partial_inplace */
   2761  1.1  christos 	 0x0000ffff,		/* src_mask */
   2762  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2763  1.1  christos 	 TRUE);			/* pcrel_offset */
   2764  1.1  christos 
   2765  1.1  christos /* 16 bit offset for pc-relative branches.  */
   2766  1.1  christos static reloc_howto_type elf_mips_gnu_rela16_s2 =
   2767  1.1  christos   HOWTO (R_MIPS_GNU_REL16_S2,	/* type */
   2768  1.1  christos 	 2,			/* rightshift */
   2769  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2770  1.1  christos 	 16,			/* bitsize */
   2771  1.1  christos 	 TRUE,			/* pc_relative */
   2772  1.1  christos 	 0,			/* bitpos */
   2773  1.1  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2774  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2775  1.1  christos 	 "R_MIPS_GNU_REL16_S2",	/* name */
   2776  1.1  christos 	 FALSE,			/* partial_inplace */
   2777  1.1  christos 	 0,			/* src_mask */
   2778  1.1  christos 	 0x0000ffff,		/* dst_mask */
   2779  1.3  christos 	 TRUE);			/* pcrel_offset */
   2780  1.3  christos 
   2781  1.3  christos /* 32 bit pc-relative.  Used for compact EH tables.  */
   2782  1.3  christos static reloc_howto_type elf_mips_gnu_pcrel32 =
   2783  1.3  christos   HOWTO (R_MIPS_PC32,		/* type */
   2784  1.3  christos 	 0,			/* rightshift */
   2785  1.3  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2786  1.3  christos 	 32,			/* bitsize */
   2787  1.3  christos 	 TRUE,			/* pc_relative */
   2788  1.3  christos 	 0,			/* bitpos */
   2789  1.3  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2790  1.3  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2791  1.3  christos 	 "R_MIPS_PC32",		/* name */
   2792  1.3  christos 	 TRUE,			/* partial_inplace */
   2793  1.3  christos 	 0xffffffff,		/* src_mask */
   2794  1.3  christos 	 0xffffffff,		/* dst_mask */
   2795  1.3  christos 	 TRUE);			/* pcrel_offset */
   2796  1.1  christos 
   2797  1.1  christos 
   2798  1.1  christos /* Originally a VxWorks extension, but now used for other systems too.  */
   2800  1.1  christos static reloc_howto_type elf_mips_copy_howto =
   2801  1.1  christos   HOWTO (R_MIPS_COPY,		/* type */
   2802  1.1  christos 	 0,			/* rightshift */
   2803  1.1  christos 	 0,			/* this one is variable size */
   2804  1.1  christos 	 0,			/* bitsize */
   2805  1.1  christos 	 FALSE,			/* pc_relative */
   2806  1.3  christos 	 0,			/* bitpos */
   2807  1.1  christos 	 complain_overflow_bitfield, /* complain_on_overflow */
   2808  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2809  1.1  christos 	 "R_MIPS_COPY",		/* name */
   2810  1.1  christos 	 FALSE,			/* partial_inplace */
   2811  1.1  christos 	 0x0,         		/* src_mask */
   2812  1.1  christos 	 0x0,		        /* dst_mask */
   2813  1.1  christos 	 FALSE);		/* pcrel_offset */
   2814  1.1  christos 
   2815  1.1  christos /* Originally a VxWorks extension, but now used for other systems too.  */
   2816  1.1  christos static reloc_howto_type elf_mips_jump_slot_howto =
   2817  1.1  christos   HOWTO (R_MIPS_JUMP_SLOT,	/* type */
   2818  1.1  christos 	 0,			/* rightshift */
   2819  1.1  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2820  1.1  christos 	 32,			/* bitsize */
   2821  1.1  christos 	 FALSE,			/* pc_relative */
   2822  1.3  christos 	 0,			/* bitpos */
   2823  1.1  christos 	 complain_overflow_bitfield, /* complain_on_overflow */
   2824  1.1  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2825  1.1  christos 	 "R_MIPS_JUMP_SLOT",	/* name */
   2826  1.1  christos 	 FALSE,			/* partial_inplace */
   2827  1.1  christos 	 0x0,         		/* src_mask */
   2828  1.3  christos 	 0x0,		        /* dst_mask */
   2829  1.3  christos 	 FALSE);		/* pcrel_offset */
   2830  1.3  christos 
   2831  1.3  christos /* Used in EH tables.  */
   2832  1.3  christos static reloc_howto_type elf_mips_eh_howto =
   2833  1.3  christos   HOWTO (R_MIPS_EH,		/* type */
   2834  1.3  christos 	 0,			/* rightshift */
   2835  1.3  christos 	 2,			/* size (0 = byte, 1 = short, 2 = long) */
   2836  1.3  christos 	 32,			/* bitsize */
   2837  1.3  christos 	 FALSE,			/* pc_relative */
   2838  1.3  christos 	 0,			/* bitpos */
   2839  1.3  christos 	 complain_overflow_signed, /* complain_on_overflow */
   2840  1.3  christos 	 _bfd_mips_elf_generic_reloc, /* special_function */
   2841  1.3  christos 	 "R_MIPS_EH",		/* name */
   2842  1.3  christos 	 TRUE,			/* partial_inplace */
   2843  1.3  christos 	 0xffffffff,		/* src_mask */
   2844  1.3  christos 	 0xffffffff,	        /* dst_mask */
   2845  1.1  christos 	 FALSE);		/* pcrel_offset */
   2846  1.1  christos 
   2847  1.1  christos 
   2848  1.1  christos /* Set the GP value for OUTPUT_BFD.  Returns FALSE if this is a
   2850  1.1  christos    dangerous relocation.  */
   2851  1.1  christos 
   2852  1.1  christos static bfd_boolean
   2853  1.1  christos mips_elf_assign_gp (bfd *output_bfd, bfd_vma *pgp)
   2854  1.1  christos {
   2855  1.1  christos   unsigned int count;
   2856  1.1  christos   asymbol **sym;
   2857  1.1  christos   unsigned int i;
   2858  1.1  christos 
   2859  1.1  christos   /* If we've already figured out what GP will be, just return it.  */
   2860  1.1  christos   *pgp = _bfd_get_gp_value (output_bfd);
   2861  1.1  christos   if (*pgp)
   2862  1.1  christos     return TRUE;
   2863  1.1  christos 
   2864  1.1  christos   count = bfd_get_symcount (output_bfd);
   2865  1.1  christos   sym = bfd_get_outsymbols (output_bfd);
   2866  1.1  christos 
   2867  1.1  christos   /* The linker script will have created a symbol named `_gp' with the
   2868  1.1  christos      appropriate value.  */
   2869  1.1  christos   if (sym == NULL)
   2870  1.1  christos     i = count;
   2871  1.1  christos   else
   2872  1.1  christos     {
   2873  1.1  christos       for (i = 0; i < count; i++, sym++)
   2874  1.1  christos 	{
   2875  1.1  christos 	  register const char *name;
   2876  1.1  christos 
   2877  1.1  christos 	  name = bfd_asymbol_name (*sym);
   2878  1.1  christos 	  if (*name == '_' && strcmp (name, "_gp") == 0)
   2879  1.1  christos 	    {
   2880  1.1  christos 	      *pgp = bfd_asymbol_value (*sym);
   2881  1.1  christos 	      _bfd_set_gp_value (output_bfd, *pgp);
   2882  1.1  christos 	      break;
   2883  1.1  christos 	    }
   2884  1.1  christos 	}
   2885  1.1  christos     }
   2886  1.1  christos 
   2887  1.1  christos   if (i >= count)
   2888  1.1  christos     {
   2889  1.1  christos       /* Only get the error once.  */
   2890  1.1  christos       *pgp = 4;
   2891  1.1  christos       _bfd_set_gp_value (output_bfd, *pgp);
   2892  1.1  christos       return FALSE;
   2893  1.1  christos     }
   2894  1.1  christos 
   2895  1.1  christos   return TRUE;
   2896  1.1  christos }
   2897  1.1  christos 
   2898  1.1  christos /* We have to figure out the gp value, so that we can adjust the
   2899  1.1  christos    symbol value correctly.  We look up the symbol _gp in the output
   2900  1.1  christos    BFD.  If we can't find it, we're stuck.  We cache it in the ELF
   2901  1.1  christos    target data.  We don't need to adjust the symbol value for an
   2902  1.1  christos    external symbol if we are producing relocatable output.  */
   2903  1.1  christos 
   2904  1.1  christos static bfd_reloc_status_type
   2905  1.1  christos mips_elf_final_gp (bfd *output_bfd, asymbol *symbol, bfd_boolean relocatable,
   2906  1.1  christos 		   char **error_message, bfd_vma *pgp)
   2907  1.1  christos {
   2908  1.1  christos   if (bfd_is_und_section (symbol->section)
   2909  1.1  christos       && ! relocatable)
   2910  1.1  christos     {
   2911  1.1  christos       *pgp = 0;
   2912  1.1  christos       return bfd_reloc_undefined;
   2913  1.1  christos     }
   2914  1.1  christos 
   2915  1.1  christos   *pgp = _bfd_get_gp_value (output_bfd);
   2916  1.1  christos   if (*pgp == 0
   2917  1.1  christos       && (! relocatable
   2918  1.1  christos 	  || (symbol->flags & BSF_SECTION_SYM) != 0))
   2919  1.1  christos     {
   2920  1.1  christos       if (relocatable)
   2921  1.1  christos 	{
   2922  1.1  christos 	  /* Make up a value.  */
   2923  1.1  christos 	  *pgp = symbol->section->output_section->vma /*+ 0x4000*/;
   2924  1.1  christos 	  _bfd_set_gp_value (output_bfd, *pgp);
   2925  1.1  christos 	}
   2926  1.1  christos       else if (!mips_elf_assign_gp (output_bfd, pgp))
   2927  1.1  christos 	{
   2928  1.1  christos 	  *error_message =
   2929  1.1  christos 	    (char *) _("GP relative relocation when _gp not defined");
   2930  1.1  christos 	  return bfd_reloc_dangerous;
   2931  1.1  christos 	}
   2932  1.1  christos     }
   2933  1.1  christos 
   2934  1.1  christos   return bfd_reloc_ok;
   2935  1.1  christos }
   2936  1.1  christos 
   2937  1.1  christos /* Do a R_MIPS_GPREL16 relocation.  This is a 16 bit value which must
   2938  1.1  christos    become the offset from the gp register.  */
   2939  1.1  christos 
   2940  1.1  christos static bfd_reloc_status_type
   2941  1.1  christos mips_elf_gprel16_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
   2942  1.1  christos 			asymbol *symbol, void *data ATTRIBUTE_UNUSED,
   2943  1.1  christos 			asection *input_section, bfd *output_bfd,
   2944  1.1  christos 			char **error_message ATTRIBUTE_UNUSED)
   2945  1.1  christos {
   2946  1.1  christos   bfd_boolean relocatable;
   2947  1.1  christos   bfd_reloc_status_type ret;
   2948  1.1  christos   bfd_vma gp;
   2949  1.1  christos 
   2950  1.1  christos   if (output_bfd != NULL)
   2951  1.1  christos     relocatable = TRUE;
   2952  1.1  christos   else
   2953  1.1  christos     {
   2954  1.1  christos       relocatable = FALSE;
   2955  1.1  christos       output_bfd = symbol->section->output_section->owner;
   2956  1.1  christos     }
   2957  1.1  christos 
   2958  1.1  christos   ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message,
   2959  1.1  christos 			   &gp);
   2960  1.1  christos   if (ret != bfd_reloc_ok)
   2961  1.1  christos     return ret;
   2962  1.1  christos 
   2963  1.1  christos   return _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
   2964  1.1  christos 					input_section, relocatable,
   2965  1.1  christos 					data, gp);
   2966  1.1  christos }
   2967  1.1  christos 
   2968  1.1  christos /* Do a R_MIPS_LITERAL relocation.  */
   2969  1.1  christos 
   2970  1.1  christos static bfd_reloc_status_type
   2971  1.1  christos mips_elf_literal_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
   2972  1.1  christos 			void *data, asection *input_section, bfd *output_bfd,
   2973  1.1  christos 			char **error_message)
   2974  1.1  christos {
   2975  1.1  christos   bfd_boolean relocatable;
   2976  1.1  christos   bfd_reloc_status_type ret;
   2977  1.1  christos   bfd_vma gp;
   2978  1.1  christos 
   2979  1.1  christos   /* R_MIPS_LITERAL relocations are defined for local symbols only.  */
   2980  1.1  christos   if (output_bfd != NULL
   2981  1.1  christos       && (symbol->flags & BSF_SECTION_SYM) == 0
   2982  1.1  christos       && (symbol->flags & BSF_LOCAL) != 0)
   2983  1.1  christos     {
   2984  1.1  christos       *error_message = (char *)
   2985  1.1  christos 	_("literal relocation occurs for an external symbol");
   2986  1.1  christos       return bfd_reloc_outofrange;
   2987  1.1  christos     }
   2988  1.1  christos 
   2989  1.1  christos   /* FIXME: The entries in the .lit8 and .lit4 sections should be merged.  */
   2990  1.1  christos   if (output_bfd != NULL)
   2991  1.1  christos     relocatable = TRUE;
   2992  1.1  christos   else
   2993  1.1  christos     {
   2994  1.1  christos       relocatable = FALSE;
   2995  1.1  christos       output_bfd = symbol->section->output_section->owner;
   2996  1.1  christos     }
   2997  1.1  christos 
   2998  1.1  christos   ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message,
   2999  1.1  christos 			   &gp);
   3000  1.1  christos   if (ret != bfd_reloc_ok)
   3001  1.1  christos     return ret;
   3002  1.1  christos 
   3003  1.1  christos   return _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
   3004  1.1  christos 					input_section, relocatable,
   3005  1.1  christos 					data, gp);
   3006  1.1  christos }
   3007  1.1  christos 
   3008  1.1  christos /* Do a R_MIPS_GPREL32 relocation.  This is a 32 bit value which must
   3009  1.1  christos    become the offset from the gp register.  */
   3010  1.1  christos 
   3011  1.1  christos static bfd_reloc_status_type
   3012  1.1  christos mips_elf_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
   3013  1.1  christos 			void *data, asection *input_section, bfd *output_bfd,
   3014  1.1  christos 			char **error_message)
   3015  1.1  christos {
   3016  1.1  christos   bfd_boolean relocatable;
   3017  1.1  christos   bfd_reloc_status_type ret;
   3018  1.1  christos   bfd_vma gp;
   3019  1.1  christos 
   3020  1.1  christos   /* R_MIPS_GPREL32 relocations are defined for local symbols only.  */
   3021  1.1  christos   if (output_bfd != NULL
   3022  1.1  christos       && (symbol->flags & BSF_SECTION_SYM) == 0
   3023  1.1  christos       && (symbol->flags & BSF_LOCAL) != 0)
   3024  1.1  christos     {
   3025  1.1  christos       *error_message = (char *)
   3026  1.1  christos 	_("32bits gp relative relocation occurs for an external symbol");
   3027  1.1  christos       return bfd_reloc_outofrange;
   3028  1.1  christos     }
   3029  1.1  christos 
   3030  1.1  christos   if (output_bfd != NULL)
   3031  1.1  christos     {
   3032  1.1  christos       relocatable = TRUE;
   3033  1.1  christos       gp = _bfd_get_gp_value (output_bfd);
   3034  1.1  christos     }
   3035  1.1  christos   else
   3036  1.1  christos     {
   3037  1.1  christos       relocatable = FALSE;
   3038  1.1  christos       output_bfd = symbol->section->output_section->owner;
   3039  1.1  christos 
   3040  1.1  christos       ret = mips_elf_final_gp (output_bfd, symbol, relocatable,
   3041  1.1  christos 			       error_message, &gp);
   3042  1.1  christos       if (ret != bfd_reloc_ok)
   3043  1.1  christos 	return ret;
   3044  1.1  christos     }
   3045  1.1  christos 
   3046  1.1  christos   return gprel32_with_gp (abfd, symbol, reloc_entry, input_section,
   3047  1.1  christos 			  relocatable, data, gp);
   3048  1.1  christos }
   3049  1.1  christos 
   3050  1.1  christos static bfd_reloc_status_type
   3051  1.1  christos gprel32_with_gp (bfd *abfd, asymbol *symbol, arelent *reloc_entry,
   3052  1.1  christos 		 asection *input_section, bfd_boolean relocatable,
   3053  1.1  christos 		 void *data, bfd_vma gp)
   3054  1.1  christos {
   3055  1.1  christos   bfd_vma relocation;
   3056  1.1  christos   unsigned long val;
   3057  1.1  christos 
   3058  1.1  christos   if (bfd_is_com_section (symbol->section))
   3059  1.1  christos     relocation = 0;
   3060  1.1  christos   else
   3061  1.1  christos     relocation = symbol->value;
   3062  1.1  christos 
   3063  1.1  christos   relocation += symbol->section->output_section->vma;
   3064  1.1  christos   relocation += symbol->section->output_offset;
   3065  1.1  christos 
   3066  1.1  christos   if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
   3067  1.1  christos     return bfd_reloc_outofrange;
   3068  1.1  christos 
   3069  1.1  christos   if (reloc_entry->howto->src_mask == 0)
   3070  1.1  christos     val = 0;
   3071  1.1  christos   else
   3072  1.1  christos     val = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
   3073  1.1  christos 
   3074  1.1  christos   /* Set val to the offset into the section or symbol.  */
   3075  1.1  christos   val += reloc_entry->addend;
   3076  1.1  christos 
   3077  1.1  christos   /* Adjust val for the final section location and GP value.  If we
   3078  1.1  christos      are producing relocatable output, we don't want to do this for
   3079  1.1  christos      an external symbol.  */
   3080  1.1  christos   if (! relocatable
   3081  1.1  christos       || (symbol->flags & BSF_SECTION_SYM) != 0)
   3082  1.1  christos     val += relocation - gp;
   3083  1.1  christos 
   3084  1.1  christos   bfd_put_32 (abfd, val, (bfd_byte *) data + reloc_entry->address);
   3085  1.1  christos 
   3086  1.1  christos   if (relocatable)
   3087  1.1  christos     reloc_entry->address += input_section->output_offset;
   3088  1.1  christos 
   3089  1.1  christos   return bfd_reloc_ok;
   3090  1.1  christos }
   3091  1.1  christos 
   3092  1.1  christos /* Do a R_MIPS_SHIFT6 relocation. The MSB of the shift is stored at bit 2,
   3093  1.1  christos    the rest is at bits 6-10. The bitpos already got right by the howto.  */
   3094  1.1  christos 
   3095  1.1  christos static bfd_reloc_status_type
   3096  1.1  christos mips_elf_shift6_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
   3097  1.1  christos 		       void *data, asection *input_section, bfd *output_bfd,
   3098  1.1  christos 		       char **error_message)
   3099  1.1  christos {
   3100  1.1  christos   if (reloc_entry->howto->partial_inplace)
   3101  1.1  christos     {
   3102  1.1  christos       reloc_entry->addend = ((reloc_entry->addend & 0x00007c0)
   3103  1.1  christos 			     | (reloc_entry->addend & 0x00000800) >> 9);
   3104  1.1  christos     }
   3105  1.1  christos 
   3106  1.1  christos   return _bfd_mips_elf_generic_reloc (abfd, reloc_entry, symbol, data,
   3107  1.1  christos 				      input_section, output_bfd,
   3108  1.1  christos 				      error_message);
   3109  1.1  christos }
   3110  1.1  christos 
   3111  1.1  christos /* Handle a mips16 GP relative reloc.  */
   3113  1.1  christos 
   3114  1.1  christos static bfd_reloc_status_type
   3115  1.1  christos mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
   3116  1.1  christos 		    void *data, asection *input_section, bfd *output_bfd,
   3117  1.1  christos 		    char **error_message)
   3118  1.1  christos {
   3119  1.1  christos   bfd_boolean relocatable;
   3120  1.1  christos   bfd_reloc_status_type ret;
   3121  1.1  christos   bfd_byte *location;
   3122  1.1  christos   bfd_vma gp;
   3123  1.1  christos 
   3124  1.1  christos   /* If we're relocating, and this is an external symbol, we don't want
   3125  1.1  christos      to change anything.  */
   3126  1.1  christos   if (output_bfd != NULL
   3127  1.1  christos       && (symbol->flags & BSF_SECTION_SYM) == 0
   3128  1.1  christos       && (symbol->flags & BSF_LOCAL) != 0)
   3129  1.1  christos     {
   3130  1.1  christos       reloc_entry->address += input_section->output_offset;
   3131  1.1  christos       return bfd_reloc_ok;
   3132  1.1  christos     }
   3133  1.1  christos 
   3134  1.1  christos   if (output_bfd != NULL)
   3135  1.1  christos     relocatable = TRUE;
   3136  1.1  christos   else
   3137  1.1  christos     {
   3138  1.1  christos       relocatable = FALSE;
   3139  1.1  christos       output_bfd = symbol->section->output_section->owner;
   3140  1.1  christos     }
   3141  1.1  christos 
   3142  1.1  christos   ret = mips_elf_final_gp (output_bfd, symbol, relocatable, error_message,
   3143  1.1  christos 			   &gp);
   3144  1.1  christos   if (ret != bfd_reloc_ok)
   3145  1.1  christos     return ret;
   3146  1.1  christos 
   3147  1.1  christos   location = (bfd_byte *) data + reloc_entry->address;
   3148  1.1  christos   _bfd_mips_elf_reloc_unshuffle (abfd, reloc_entry->howto->type, FALSE,
   3149  1.1  christos 				 location);
   3150  1.1  christos   ret = _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
   3151  1.1  christos 				       input_section, relocatable,
   3152  1.1  christos 				       data, gp);
   3153  1.1  christos   _bfd_mips_elf_reloc_shuffle (abfd, reloc_entry->howto->type, !relocatable,
   3154  1.1  christos 			       location);
   3155  1.1  christos 
   3156  1.1  christos   return ret;
   3157  1.1  christos }
   3158  1.1  christos 
   3159  1.1  christos /* A mapping from BFD reloc types to MIPS ELF reloc types.  */
   3161  1.1  christos 
   3162  1.1  christos struct elf_reloc_map {
   3163  1.1  christos   bfd_reloc_code_real_type bfd_val;
   3164  1.1  christos   enum elf_mips_reloc_type elf_val;
   3165  1.1  christos };
   3166  1.1  christos 
   3167  1.1  christos static const struct elf_reloc_map mips_reloc_map[] =
   3168  1.1  christos {
   3169  1.1  christos   { BFD_RELOC_NONE, R_MIPS_NONE },
   3170  1.1  christos   { BFD_RELOC_16, R_MIPS_16 },
   3171  1.1  christos   { BFD_RELOC_32, R_MIPS_32 },
   3172  1.1  christos   /* There is no BFD reloc for R_MIPS_REL32.  */
   3173  1.1  christos   { BFD_RELOC_CTOR, R_MIPS_32 },
   3174  1.1  christos   { BFD_RELOC_64, R_MIPS_64 },
   3175  1.1  christos   { BFD_RELOC_16_PCREL_S2, R_MIPS_PC16 },
   3176  1.1  christos   { BFD_RELOC_HI16_S, R_MIPS_HI16 },
   3177  1.1  christos   { BFD_RELOC_LO16, R_MIPS_LO16 },
   3178  1.1  christos   { BFD_RELOC_GPREL16, R_MIPS_GPREL16 },
   3179  1.1  christos   { BFD_RELOC_GPREL32, R_MIPS_GPREL32 },
   3180  1.1  christos   { BFD_RELOC_MIPS_JMP, R_MIPS_26 },
   3181  1.1  christos   { BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL },
   3182  1.1  christos   { BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 },
   3183  1.1  christos   { BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 },
   3184  1.1  christos   { BFD_RELOC_MIPS_SHIFT5, R_MIPS_SHIFT5 },
   3185  1.1  christos   { BFD_RELOC_MIPS_SHIFT6, R_MIPS_SHIFT6 },
   3186  1.1  christos   { BFD_RELOC_MIPS_GOT_DISP, R_MIPS_GOT_DISP },
   3187  1.1  christos   { BFD_RELOC_MIPS_GOT_PAGE, R_MIPS_GOT_PAGE },
   3188  1.1  christos   { BFD_RELOC_MIPS_GOT_OFST, R_MIPS_GOT_OFST },
   3189  1.1  christos   { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 },
   3190  1.1  christos   { BFD_RELOC_MIPS_GOT_LO16, R_MIPS_GOT_LO16 },
   3191  1.1  christos   { BFD_RELOC_MIPS_SUB, R_MIPS_SUB },
   3192  1.1  christos   { BFD_RELOC_MIPS_INSERT_A, R_MIPS_INSERT_A },
   3193  1.1  christos   { BFD_RELOC_MIPS_INSERT_B, R_MIPS_INSERT_B },
   3194  1.1  christos   { BFD_RELOC_MIPS_DELETE, R_MIPS_DELETE },
   3195  1.1  christos   { BFD_RELOC_MIPS_HIGHEST, R_MIPS_HIGHEST },
   3196  1.1  christos   { BFD_RELOC_MIPS_HIGHER, R_MIPS_HIGHER },
   3197  1.1  christos   { BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 },
   3198  1.1  christos   { BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 },
   3199  1.1  christos   { BFD_RELOC_MIPS_SCN_DISP, R_MIPS_SCN_DISP },
   3200  1.1  christos   { BFD_RELOC_MIPS_REL16, R_MIPS_REL16 },
   3201  1.1  christos   /* Use of R_MIPS_ADD_IMMEDIATE and R_MIPS_PJUMP is deprecated.  */
   3202  1.1  christos   { BFD_RELOC_MIPS_RELGOT, R_MIPS_RELGOT },
   3203  1.1  christos   { BFD_RELOC_MIPS_JALR, R_MIPS_JALR },
   3204  1.1  christos   { BFD_RELOC_MIPS_TLS_DTPMOD32, R_MIPS_TLS_DTPMOD32 },
   3205  1.1  christos   { BFD_RELOC_MIPS_TLS_DTPREL32, R_MIPS_TLS_DTPREL32 },
   3206  1.1  christos   { BFD_RELOC_MIPS_TLS_DTPMOD64, R_MIPS_TLS_DTPMOD64 },
   3207  1.1  christos   { BFD_RELOC_MIPS_TLS_DTPREL64, R_MIPS_TLS_DTPREL64 },
   3208  1.1  christos   { BFD_RELOC_MIPS_TLS_GD, R_MIPS_TLS_GD },
   3209  1.1  christos   { BFD_RELOC_MIPS_TLS_LDM, R_MIPS_TLS_LDM },
   3210  1.1  christos   { BFD_RELOC_MIPS_TLS_DTPREL_HI16, R_MIPS_TLS_DTPREL_HI16 },
   3211  1.3  christos   { BFD_RELOC_MIPS_TLS_DTPREL_LO16, R_MIPS_TLS_DTPREL_LO16 },
   3212  1.3  christos   { BFD_RELOC_MIPS_TLS_GOTTPREL, R_MIPS_TLS_GOTTPREL },
   3213  1.3  christos   { BFD_RELOC_MIPS_TLS_TPREL32, R_MIPS_TLS_TPREL32 },
   3214  1.3  christos   { BFD_RELOC_MIPS_TLS_TPREL64, R_MIPS_TLS_TPREL64 },
   3215  1.3  christos   { BFD_RELOC_MIPS_TLS_TPREL_HI16, R_MIPS_TLS_TPREL_HI16 },
   3216  1.3  christos   { BFD_RELOC_MIPS_TLS_TPREL_LO16, R_MIPS_TLS_TPREL_LO16 },
   3217  1.3  christos   { BFD_RELOC_MIPS_21_PCREL_S2, R_MIPS_PC21_S2 },
   3218  1.1  christos   { BFD_RELOC_MIPS_26_PCREL_S2, R_MIPS_PC26_S2 },
   3219  1.1  christos   { BFD_RELOC_MIPS_18_PCREL_S3, R_MIPS_PC18_S3 },
   3220  1.1  christos   { BFD_RELOC_MIPS_19_PCREL_S2, R_MIPS_PC19_S2 },
   3221  1.1  christos   { BFD_RELOC_HI16_S_PCREL, R_MIPS_PCHI16 },
   3222  1.1  christos   { BFD_RELOC_LO16_PCREL, R_MIPS_PCLO16 }
   3223  1.1  christos };
   3224  1.1  christos 
   3225  1.1  christos static const struct elf_reloc_map mips16_reloc_map[] =
   3226  1.1  christos {
   3227  1.1  christos   { BFD_RELOC_MIPS16_JMP, R_MIPS16_26 - R_MIPS16_min },
   3228  1.1  christos   { BFD_RELOC_MIPS16_GPREL, R_MIPS16_GPREL - R_MIPS16_min },
   3229  1.1  christos   { BFD_RELOC_MIPS16_GOT16, R_MIPS16_GOT16 - R_MIPS16_min },
   3230  1.1  christos   { BFD_RELOC_MIPS16_CALL16, R_MIPS16_CALL16 - R_MIPS16_min },
   3231  1.1  christos   { BFD_RELOC_MIPS16_HI16_S, R_MIPS16_HI16 - R_MIPS16_min },
   3232  1.1  christos   { BFD_RELOC_MIPS16_LO16, R_MIPS16_LO16 - R_MIPS16_min },
   3233  1.1  christos   { BFD_RELOC_MIPS16_TLS_GD, R_MIPS16_TLS_GD - R_MIPS16_min },
   3234  1.1  christos   { BFD_RELOC_MIPS16_TLS_LDM, R_MIPS16_TLS_LDM - R_MIPS16_min },
   3235  1.1  christos   { BFD_RELOC_MIPS16_TLS_DTPREL_HI16,
   3236  1.1  christos     R_MIPS16_TLS_DTPREL_HI16 - R_MIPS16_min },
   3237  1.1  christos   { BFD_RELOC_MIPS16_TLS_DTPREL_LO16,
   3238  1.1  christos     R_MIPS16_TLS_DTPREL_LO16 - R_MIPS16_min },
   3239  1.1  christos   { BFD_RELOC_MIPS16_TLS_GOTTPREL, R_MIPS16_TLS_GOTTPREL - R_MIPS16_min },
   3240  1.1  christos   { BFD_RELOC_MIPS16_TLS_TPREL_HI16, R_MIPS16_TLS_TPREL_HI16 - R_MIPS16_min },
   3241  1.1  christos   { BFD_RELOC_MIPS16_TLS_TPREL_LO16, R_MIPS16_TLS_TPREL_LO16 - R_MIPS16_min }
   3242  1.1  christos };
   3243  1.1  christos 
   3244  1.1  christos static const struct elf_reloc_map micromips_reloc_map[] =
   3245  1.1  christos {
   3246  1.1  christos   { BFD_RELOC_MICROMIPS_JMP, R_MICROMIPS_26_S1 - R_MICROMIPS_min },
   3247  1.1  christos   { BFD_RELOC_MICROMIPS_HI16_S, R_MICROMIPS_HI16 - R_MICROMIPS_min },
   3248  1.1  christos   { BFD_RELOC_MICROMIPS_LO16, R_MICROMIPS_LO16 - R_MICROMIPS_min },
   3249  1.1  christos   { BFD_RELOC_MICROMIPS_GPREL16, R_MICROMIPS_GPREL16 - R_MICROMIPS_min },
   3250  1.1  christos   { BFD_RELOC_MICROMIPS_LITERAL, R_MICROMIPS_LITERAL - R_MICROMIPS_min },
   3251  1.1  christos   { BFD_RELOC_MICROMIPS_GOT16, R_MICROMIPS_GOT16 - R_MICROMIPS_min },
   3252  1.1  christos   { BFD_RELOC_MICROMIPS_7_PCREL_S1, R_MICROMIPS_PC7_S1 - R_MICROMIPS_min },
   3253  1.1  christos   { BFD_RELOC_MICROMIPS_10_PCREL_S1, R_MICROMIPS_PC10_S1 - R_MICROMIPS_min },
   3254  1.1  christos   { BFD_RELOC_MICROMIPS_16_PCREL_S1, R_MICROMIPS_PC16_S1 - R_MICROMIPS_min },
   3255  1.1  christos   { BFD_RELOC_MICROMIPS_CALL16, R_MICROMIPS_CALL16 - R_MICROMIPS_min },
   3256  1.1  christos   { BFD_RELOC_MICROMIPS_GOT_DISP, R_MICROMIPS_GOT_DISP - R_MICROMIPS_min },
   3257  1.1  christos   { BFD_RELOC_MICROMIPS_GOT_PAGE, R_MICROMIPS_GOT_PAGE - R_MICROMIPS_min },
   3258  1.1  christos   { BFD_RELOC_MICROMIPS_GOT_OFST, R_MICROMIPS_GOT_OFST - R_MICROMIPS_min },
   3259  1.1  christos   { BFD_RELOC_MICROMIPS_GOT_HI16, R_MICROMIPS_GOT_HI16 - R_MICROMIPS_min },
   3260  1.1  christos   { BFD_RELOC_MICROMIPS_GOT_LO16, R_MICROMIPS_GOT_LO16 - R_MICROMIPS_min },
   3261  1.3  christos   { BFD_RELOC_MICROMIPS_SUB, R_MICROMIPS_SUB - R_MICROMIPS_min },
   3262  1.3  christos   { BFD_RELOC_MICROMIPS_HIGHER, R_MICROMIPS_HIGHER - R_MICROMIPS_min },
   3263  1.1  christos   { BFD_RELOC_MICROMIPS_HIGHEST, R_MICROMIPS_HIGHEST - R_MICROMIPS_min },
   3264  1.1  christos   { BFD_RELOC_MICROMIPS_CALL_HI16, R_MICROMIPS_CALL_HI16 - R_MICROMIPS_min },
   3265  1.1  christos   { BFD_RELOC_MICROMIPS_CALL_LO16, R_MICROMIPS_CALL_LO16 - R_MICROMIPS_min },
   3266  1.1  christos   { BFD_RELOC_MICROMIPS_SCN_DISP, R_MICROMIPS_SCN_DISP - R_MICROMIPS_min },
   3267  1.1  christos   { BFD_RELOC_MICROMIPS_JALR, R_MICROMIPS_JALR - R_MICROMIPS_min },
   3268  1.1  christos };
   3269  1.1  christos 
   3270  1.1  christos /* Given a BFD reloc type, return a howto structure.  */
   3271  1.1  christos 
   3272  1.1  christos static reloc_howto_type *
   3273  1.1  christos bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
   3274  1.1  christos 				 bfd_reloc_code_real_type code)
   3275  1.1  christos {
   3276  1.1  christos   unsigned int i;
   3277  1.1  christos   /* FIXME: We default to RELA here instead of choosing the right
   3278  1.1  christos      relocation variant.  */
   3279  1.1  christos   reloc_howto_type *howto_table = elf_mips_howto_table_rela;
   3280  1.1  christos   reloc_howto_type *howto16_table = elf_mips16_howto_table_rela;
   3281  1.1  christos   reloc_howto_type *howto_micromips_table = elf_micromips_howto_table_rela;
   3282  1.1  christos 
   3283  1.1  christos   for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map);
   3284  1.1  christos        i++)
   3285  1.1  christos     {
   3286  1.1  christos       if (mips_reloc_map[i].bfd_val == code)
   3287  1.1  christos 	return &howto_table[(int) mips_reloc_map[i].elf_val];
   3288  1.1  christos     }
   3289  1.1  christos 
   3290  1.1  christos   for (i = 0; i < sizeof (mips16_reloc_map) / sizeof (struct elf_reloc_map);
   3291  1.1  christos        i++)
   3292  1.1  christos     {
   3293  1.1  christos       if (mips16_reloc_map[i].bfd_val == code)
   3294  1.1  christos 	return &howto16_table[(int) mips16_reloc_map[i].elf_val];
   3295  1.1  christos     }
   3296  1.1  christos 
   3297  1.1  christos   for (i = 0; i < sizeof (micromips_reloc_map) / sizeof (struct elf_reloc_map);
   3298  1.1  christos        i++)
   3299  1.1  christos     {
   3300  1.1  christos       if (micromips_reloc_map[i].bfd_val == code)
   3301  1.1  christos 	return &howto_micromips_table[(int) micromips_reloc_map[i].elf_val];
   3302  1.1  christos     }
   3303  1.1  christos 
   3304  1.1  christos   switch (code)
   3305  1.3  christos     {
   3306  1.3  christos     case BFD_RELOC_VTABLE_INHERIT:
   3307  1.3  christos       return &elf_mips_gnu_vtinherit_howto;
   3308  1.3  christos     case BFD_RELOC_VTABLE_ENTRY:
   3309  1.1  christos       return &elf_mips_gnu_vtentry_howto;
   3310  1.1  christos     case BFD_RELOC_32_PCREL:
   3311  1.1  christos       return &elf_mips_gnu_pcrel32;
   3312  1.1  christos     case BFD_RELOC_MIPS_EH:
   3313  1.1  christos       return &elf_mips_eh_howto;
   3314  1.1  christos     case BFD_RELOC_MIPS_COPY:
   3315  1.1  christos       return &elf_mips_copy_howto;
   3316  1.1  christos     case BFD_RELOC_MIPS_JUMP_SLOT:
   3317  1.1  christos       return &elf_mips_jump_slot_howto;
   3318  1.1  christos     default:
   3319  1.1  christos       bfd_set_error (bfd_error_bad_value);
   3320  1.1  christos       return NULL;
   3321  1.1  christos     }
   3322  1.1  christos }
   3323  1.1  christos 
   3324  1.1  christos static reloc_howto_type *
   3325  1.1  christos bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
   3326  1.1  christos 				 const char *r_name)
   3327  1.1  christos {
   3328  1.1  christos   unsigned int i;
   3329  1.1  christos 
   3330  1.1  christos   for (i = 0;
   3331  1.1  christos        i < (sizeof (elf_mips_howto_table_rela)
   3332  1.1  christos 	    / sizeof (elf_mips_howto_table_rela[0]));
   3333  1.1  christos        i++)
   3334  1.1  christos     if (elf_mips_howto_table_rela[i].name != NULL
   3335  1.1  christos 	&& strcasecmp (elf_mips_howto_table_rela[i].name, r_name) == 0)
   3336  1.1  christos       return &elf_mips_howto_table_rela[i];
   3337  1.1  christos 
   3338  1.1  christos   for (i = 0;
   3339  1.1  christos        i < (sizeof (elf_mips16_howto_table_rela)
   3340  1.1  christos 	    / sizeof (elf_mips16_howto_table_rela[0]));
   3341  1.1  christos        i++)
   3342  1.1  christos     if (elf_mips16_howto_table_rela[i].name != NULL
   3343  1.1  christos 	&& strcasecmp (elf_mips16_howto_table_rela[i].name, r_name) == 0)
   3344  1.1  christos       return &elf_mips16_howto_table_rela[i];
   3345  1.1  christos 
   3346  1.1  christos   for (i = 0;
   3347  1.1  christos        i < (sizeof (elf_micromips_howto_table_rela)
   3348  1.1  christos 	    / sizeof (elf_micromips_howto_table_rela[0]));
   3349  1.1  christos        i++)
   3350  1.1  christos     if (elf_micromips_howto_table_rela[i].name != NULL
   3351  1.1  christos 	&& strcasecmp (elf_micromips_howto_table_rela[i].name, r_name) == 0)
   3352  1.1  christos       return &elf_micromips_howto_table_rela[i];
   3353  1.1  christos 
   3354  1.1  christos   if (strcasecmp (elf_mips_gnu_vtinherit_howto.name, r_name) == 0)
   3355  1.1  christos     return &elf_mips_gnu_vtinherit_howto;
   3356  1.1  christos   if (strcasecmp (elf_mips_gnu_vtentry_howto.name, r_name) == 0)
   3357  1.3  christos     return &elf_mips_gnu_vtentry_howto;
   3358  1.3  christos   if (strcasecmp (elf_mips_gnu_rel16_s2.name, r_name) == 0)
   3359  1.3  christos     return &elf_mips_gnu_rel16_s2;
   3360  1.3  christos   if (strcasecmp (elf_mips_gnu_rela16_s2.name, r_name) == 0)
   3361  1.1  christos     return &elf_mips_gnu_rela16_s2;
   3362  1.1  christos   if (strcasecmp (elf_mips_gnu_pcrel32.name, r_name) == 0)
   3363  1.1  christos     return &elf_mips_gnu_pcrel32;
   3364  1.1  christos   if (strcasecmp (elf_mips_eh_howto.name, r_name) == 0)
   3365  1.1  christos     return &elf_mips_eh_howto;
   3366  1.1  christos   if (strcasecmp (elf_mips_copy_howto.name, r_name) == 0)
   3367  1.1  christos     return &elf_mips_copy_howto;
   3368  1.1  christos   if (strcasecmp (elf_mips_jump_slot_howto.name, r_name) == 0)
   3369  1.1  christos     return &elf_mips_jump_slot_howto;
   3370  1.1  christos 
   3371  1.1  christos   return NULL;
   3372  1.1  christos }
   3373  1.1  christos 
   3374  1.1  christos /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure.  */
   3375  1.1  christos 
   3376  1.1  christos static reloc_howto_type *
   3377  1.1  christos mips_elf_n32_rtype_to_howto (unsigned int r_type, bfd_boolean rela_p)
   3378  1.1  christos {
   3379  1.1  christos   switch (r_type)
   3380  1.1  christos     {
   3381  1.1  christos     case R_MIPS_GNU_VTINHERIT:
   3382  1.1  christos       return &elf_mips_gnu_vtinherit_howto;
   3383  1.1  christos     case R_MIPS_GNU_VTENTRY:
   3384  1.1  christos       return &elf_mips_gnu_vtentry_howto;
   3385  1.3  christos     case R_MIPS_GNU_REL16_S2:
   3386  1.3  christos       if (rela_p)
   3387  1.3  christos 	return &elf_mips_gnu_rela16_s2;
   3388  1.3  christos       else
   3389  1.1  christos 	return &elf_mips_gnu_rel16_s2;
   3390  1.1  christos     case R_MIPS_PC32:
   3391  1.1  christos       return &elf_mips_gnu_pcrel32;
   3392  1.1  christos     case R_MIPS_EH:
   3393  1.1  christos       return &elf_mips_eh_howto;
   3394  1.1  christos     case R_MIPS_COPY:
   3395  1.1  christos       return &elf_mips_copy_howto;
   3396  1.1  christos     case R_MIPS_JUMP_SLOT:
   3397  1.1  christos       return &elf_mips_jump_slot_howto;
   3398  1.1  christos     default:
   3399  1.1  christos       if (r_type >= R_MICROMIPS_min && r_type < R_MICROMIPS_max)
   3400  1.1  christos 	{
   3401  1.1  christos 	  if (rela_p)
   3402  1.1  christos 	    return &elf_micromips_howto_table_rela[r_type - R_MICROMIPS_min];
   3403  1.1  christos 	  else
   3404  1.1  christos 	    return &elf_micromips_howto_table_rel[r_type - R_MICROMIPS_min];
   3405  1.1  christos 	}
   3406  1.1  christos       if (r_type >= R_MIPS16_min && r_type < R_MIPS16_max)
   3407  1.1  christos 	{
   3408  1.3  christos 	  if (rela_p)
   3409  1.3  christos 	    return &elf_mips16_howto_table_rela[r_type - R_MIPS16_min];
   3410  1.3  christos 	  else
   3411  1.3  christos 	    return &elf_mips16_howto_table_rel[r_type - R_MIPS16_min];
   3412  1.3  christos 	}
   3413  1.3  christos       if (r_type >= R_MIPS_max)
   3414  1.1  christos 	{
   3415  1.1  christos 	  (*_bfd_error_handler) (_("unrecognised MIPS reloc number: %d"), r_type);
   3416  1.1  christos 	  bfd_set_error (bfd_error_bad_value);
   3417  1.1  christos 	  r_type = R_MIPS_NONE;
   3418  1.1  christos 	}
   3419  1.1  christos       if (rela_p)
   3420  1.1  christos 	return &elf_mips_howto_table_rela[r_type];
   3421  1.1  christos       else
   3422  1.1  christos 	return &elf_mips_howto_table_rel[r_type];
   3423  1.1  christos       break;
   3424  1.1  christos     }
   3425  1.1  christos }
   3426  1.1  christos 
   3427  1.1  christos /* Given a MIPS Elf_Internal_Rel, fill in an arelent structure.  */
   3428  1.1  christos 
   3429  1.1  christos static void
   3430  1.1  christos mips_info_to_howto_rel (bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst)
   3431  1.1  christos {
   3432  1.1  christos   unsigned int r_type;
   3433  1.1  christos 
   3434  1.1  christos   r_type = ELF32_R_TYPE (dst->r_info);
   3435  1.1  christos   cache_ptr->howto = mips_elf_n32_rtype_to_howto (r_type, FALSE);
   3436  1.1  christos 
   3437  1.1  christos   /* The addend for a GPREL16 or LITERAL relocation comes from the GP
   3438  1.1  christos      value for the object file.  We get the addend now, rather than
   3439  1.1  christos      when we do the relocation, because the symbol manipulations done
   3440  1.1  christos      by the linker may cause us to lose track of the input BFD.  */
   3441  1.1  christos   if (((*cache_ptr->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0
   3442  1.1  christos       && (gprel16_reloc_p (r_type) || r_type == (unsigned int) R_MIPS_LITERAL))
   3443  1.1  christos     cache_ptr->addend = elf_gp (abfd);
   3444  1.1  christos }
   3445  1.1  christos 
   3446  1.1  christos /* Given a MIPS Elf_Internal_Rela, fill in an arelent structure.  */
   3447  1.1  christos 
   3448  1.1  christos static void
   3449  1.1  christos mips_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED,
   3450  1.1  christos 			 arelent *cache_ptr, Elf_Internal_Rela *dst)
   3451  1.1  christos {
   3452  1.1  christos   unsigned int r_type;
   3453  1.1  christos 
   3454  1.1  christos   r_type = ELF32_R_TYPE (dst->r_info);
   3455  1.1  christos   cache_ptr->howto = mips_elf_n32_rtype_to_howto (r_type, TRUE);
   3456  1.1  christos   cache_ptr->addend = dst->r_addend;
   3457  1.1  christos }
   3458  1.1  christos 
   3459  1.1  christos /* Determine whether a symbol is global for the purposes of splitting
   3461  1.1  christos    the symbol table into global symbols and local symbols.  At least
   3462  1.1  christos    on Irix 5, this split must be between section symbols and all other
   3463  1.1  christos    symbols.  On most ELF targets the split is between static symbols
   3464  1.1  christos    and externally visible symbols.  */
   3465  1.1  christos 
   3466  1.1  christos static bfd_boolean
   3467  1.1  christos mips_elf_sym_is_global (bfd *abfd ATTRIBUTE_UNUSED, asymbol *sym)
   3468  1.1  christos {
   3469  1.1  christos   if (SGI_COMPAT (abfd))
   3470  1.1  christos     return (sym->flags & BSF_SECTION_SYM) == 0;
   3471  1.1  christos   else
   3472  1.1  christos     return ((sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE)) != 0
   3473  1.1  christos 	    || bfd_is_und_section (bfd_get_section (sym))
   3474  1.1  christos 	    || bfd_is_com_section (bfd_get_section (sym)));
   3475  1.1  christos }
   3476  1.1  christos 
   3477  1.1  christos /* Set the right machine number for a MIPS ELF file.  */
   3479  1.3  christos 
   3480  1.3  christos static bfd_boolean
   3481  1.1  christos mips_elf_n32_object_p (bfd *abfd)
   3482  1.1  christos {
   3483  1.1  christos   unsigned long mach;
   3484  1.1  christos 
   3485  1.1  christos   if (!ABI_N32_P (abfd))
   3486  1.1  christos     return FALSE;
   3487  1.1  christos 
   3488  1.1  christos   /* Irix 5 and 6 are broken.  Object file symbol tables are not always
   3489  1.1  christos      sorted correctly such that local symbols precede global symbols,
   3490  1.1  christos      and the sh_info field in the symbol table is not always right.  */
   3491  1.1  christos   if (SGI_COMPAT (abfd))
   3492  1.1  christos     elf_bad_symtab (abfd) = TRUE;
   3493  1.1  christos 
   3494  1.1  christos   mach = _bfd_elf_mips_mach (elf_elfheader (abfd)->e_flags);
   3495  1.1  christos   bfd_default_set_arch_mach (abfd, bfd_arch_mips, mach);
   3496  1.1  christos   return TRUE;
   3497  1.1  christos }
   3498  1.1  christos 
   3499  1.1  christos /* Support for core dump NOTE sections.  */
   3501  1.1  christos static bfd_boolean
   3502  1.1  christos elf32_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
   3503  1.1  christos {
   3504  1.1  christos   int offset;
   3505  1.1  christos   unsigned int size;
   3506  1.3  christos 
   3507  1.1  christos   switch (note->descsz)
   3508  1.1  christos     {
   3509  1.3  christos       default:
   3510  1.1  christos 	return FALSE;
   3511  1.1  christos 
   3512  1.1  christos       case 440:		/* Linux/MIPS N32 */
   3513  1.1  christos 	/* pr_cursig */
   3514  1.1  christos 	elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
   3515  1.1  christos 
   3516  1.1  christos 	/* pr_pid */
   3517  1.1  christos 	elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 24);
   3518  1.1  christos 
   3519  1.1  christos 	/* pr_reg */
   3520  1.1  christos 	offset = 72;
   3521  1.1  christos 	size = 360;
   3522  1.1  christos 
   3523  1.1  christos 	break;
   3524  1.1  christos     }
   3525  1.1  christos 
   3526  1.1  christos   /* Make a ".reg/999" section.  */
   3527  1.1  christos   return _bfd_elfcore_make_pseudosection (abfd, ".reg", size,
   3528  1.1  christos 					  note->descpos + offset);
   3529  1.1  christos }
   3530  1.1  christos 
   3531  1.1  christos static bfd_boolean
   3532  1.3  christos elf32_mips_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
   3533  1.1  christos {
   3534  1.3  christos   switch (note->descsz)
   3535  1.1  christos     {
   3536  1.1  christos       default:
   3537  1.1  christos 	return FALSE;
   3538  1.1  christos 
   3539  1.1  christos       case 128:		/* Linux/MIPS elf_prpsinfo */
   3540  1.1  christos 	elf_tdata (abfd)->core->program
   3541  1.1  christos 	 = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
   3542  1.1  christos 	elf_tdata (abfd)->core->command
   3543  1.3  christos 	 = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
   3544  1.1  christos     }
   3545  1.1  christos 
   3546  1.1  christos   /* Note that for some reason, a spurious space is tacked
   3547  1.1  christos      onto the end of the args in some (at least one anyway)
   3548  1.1  christos      implementations, so strip it off if it exists.  */
   3549  1.1  christos 
   3550  1.1  christos   {
   3551  1.1  christos     char *command = elf_tdata (abfd)->core->command;
   3552  1.1  christos     int n = strlen (command);
   3553  1.1  christos 
   3554  1.1  christos     if (0 < n && command[n - 1] == ' ')
   3555  1.1  christos       command[n - 1] = '\0';
   3556  1.1  christos   }
   3557  1.1  christos 
   3558  1.1  christos   return TRUE;
   3559  1.1  christos }
   3560  1.1  christos 
   3561  1.1  christos /* MIPS ELF local labels start with "$L".  */
   3563  1.1  christos static bfd_boolean
   3564  1.1  christos mips_elf_n32_is_local_label_name (bfd *abfd, const char *name)
   3565  1.1  christos {
   3566  1.1  christos   if (name[0] == '$' && name[1] == 'L')
   3567  1.1  christos     return TRUE;
   3568  1.1  christos 
   3569  1.3  christos   /* We accept the generic ELF local label syntax as well.  */
   3570  1.3  christos   return _bfd_elf_is_local_label_name (abfd, name);
   3571  1.1  christos }
   3572  1.1  christos 
   3573  1.1  christos /* Depending on the target vector we generate some version of Irix
   3575  1.1  christos    executables or "normal" MIPS ELF ABI executables.  */
   3576  1.1  christos static irix_compat_t
   3577  1.1  christos elf_n32_mips_irix_compat (bfd *abfd)
   3578  1.1  christos {
   3579  1.1  christos   if ((abfd->xvec == &mips_elf32_n_be_vec)
   3580  1.1  christos       || (abfd->xvec == &mips_elf32_n_le_vec))
   3581  1.1  christos     return ict_irix6;
   3582  1.1  christos   else
   3583  1.1  christos     return ict_none;
   3584  1.1  christos }
   3585  1.1  christos 
   3586  1.1  christos /* ECOFF swapping routines.  These are used when dealing with the
   3588  1.1  christos    .mdebug section, which is in the ECOFF debugging format.  */
   3589  1.1  christos static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
   3590  1.1  christos   /* Symbol table magic number.  */
   3591  1.1  christos   magicSym,
   3592  1.1  christos   /* Alignment of debugging information.  E.g., 4.  */
   3593  1.1  christos   4,
   3594  1.1  christos   /* Sizes of external symbolic information.  */
   3595  1.1  christos   sizeof (struct hdr_ext),
   3596  1.1  christos   sizeof (struct dnr_ext),
   3597  1.1  christos   sizeof (struct pdr_ext),
   3598  1.1  christos   sizeof (struct sym_ext),
   3599  1.1  christos   sizeof (struct opt_ext),
   3600  1.1  christos   sizeof (struct fdr_ext),
   3601  1.1  christos   sizeof (struct rfd_ext),
   3602  1.1  christos   sizeof (struct ext_ext),
   3603  1.1  christos   /* Functions to swap in external symbolic data.  */
   3604  1.1  christos   ecoff_swap_hdr_in,
   3605  1.1  christos   ecoff_swap_dnr_in,
   3606  1.1  christos   ecoff_swap_pdr_in,
   3607  1.1  christos   ecoff_swap_sym_in,
   3608  1.1  christos   ecoff_swap_opt_in,
   3609  1.1  christos   ecoff_swap_fdr_in,
   3610  1.1  christos   ecoff_swap_rfd_in,
   3611  1.1  christos   ecoff_swap_ext_in,
   3612  1.1  christos   _bfd_ecoff_swap_tir_in,
   3613  1.1  christos   _bfd_ecoff_swap_rndx_in,
   3614  1.1  christos   /* Functions to swap out external symbolic data.  */
   3615  1.1  christos   ecoff_swap_hdr_out,
   3616  1.1  christos   ecoff_swap_dnr_out,
   3617  1.1  christos   ecoff_swap_pdr_out,
   3618  1.1  christos   ecoff_swap_sym_out,
   3619  1.1  christos   ecoff_swap_opt_out,
   3620  1.1  christos   ecoff_swap_fdr_out,
   3621  1.1  christos   ecoff_swap_rfd_out,
   3622  1.1  christos   ecoff_swap_ext_out,
   3623  1.1  christos   _bfd_ecoff_swap_tir_out,
   3624  1.1  christos   _bfd_ecoff_swap_rndx_out,
   3625  1.3  christos   /* Function to read in symbolic data.  */
   3626  1.3  christos   _bfd_mips_elf_read_ecoff_info
   3627  1.1  christos };
   3628  1.1  christos 
   3629  1.1  christos #define ELF_ARCH			bfd_arch_mips
   3631  1.1  christos #define ELF_TARGET_ID			MIPS_ELF_DATA
   3632  1.1  christos #define ELF_MACHINE_CODE		EM_MIPS
   3633  1.1  christos 
   3634  1.1  christos #define elf_backend_collect		TRUE
   3635  1.1  christos #define elf_backend_type_change_ok	TRUE
   3636  1.1  christos #define elf_backend_can_gc_sections	TRUE
   3637  1.1  christos #define elf_backend_gc_mark_extra_sections \
   3638  1.1  christos 					_bfd_mips_elf_gc_mark_extra_sections
   3639  1.1  christos #define elf_info_to_howto		mips_info_to_howto_rela
   3640  1.1  christos #define elf_info_to_howto_rel		mips_info_to_howto_rel
   3641  1.1  christos #define elf_backend_sym_is_global	mips_elf_sym_is_global
   3642  1.1  christos #define elf_backend_object_p		mips_elf_n32_object_p
   3643  1.1  christos #define elf_backend_symbol_processing	_bfd_mips_elf_symbol_processing
   3644  1.1  christos #define elf_backend_section_processing	_bfd_mips_elf_section_processing
   3645  1.1  christos #define elf_backend_section_from_shdr	_bfd_mips_elf_section_from_shdr
   3646  1.1  christos #define elf_backend_fake_sections	_bfd_mips_elf_fake_sections
   3647  1.1  christos #define elf_backend_section_from_bfd_section \
   3648  1.1  christos 					_bfd_mips_elf_section_from_bfd_section
   3649  1.1  christos #define elf_backend_add_symbol_hook	_bfd_mips_elf_add_symbol_hook
   3650  1.1  christos #define elf_backend_link_output_symbol_hook \
   3651  1.1  christos 					_bfd_mips_elf_link_output_symbol_hook
   3652  1.1  christos #define elf_backend_create_dynamic_sections \
   3653  1.1  christos 					_bfd_mips_elf_create_dynamic_sections
   3654  1.1  christos #define elf_backend_check_relocs	_bfd_mips_elf_check_relocs
   3655  1.1  christos #define elf_backend_merge_symbol_attribute \
   3656  1.1  christos 					_bfd_mips_elf_merge_symbol_attribute
   3657  1.1  christos #define elf_backend_get_target_dtag	_bfd_mips_elf_get_target_dtag
   3658  1.1  christos #define elf_backend_adjust_dynamic_symbol \
   3659  1.1  christos 					_bfd_mips_elf_adjust_dynamic_symbol
   3660  1.1  christos #define elf_backend_always_size_sections \
   3661  1.1  christos 					_bfd_mips_elf_always_size_sections
   3662  1.1  christos #define elf_backend_size_dynamic_sections \
   3663  1.1  christos 					_bfd_mips_elf_size_dynamic_sections
   3664  1.1  christos #define elf_backend_init_index_section	_bfd_elf_init_1_index_section
   3665  1.1  christos #define elf_backend_relocate_section	_bfd_mips_elf_relocate_section
   3666  1.1  christos #define elf_backend_finish_dynamic_symbol \
   3667  1.1  christos 					_bfd_mips_elf_finish_dynamic_symbol
   3668  1.1  christos #define elf_backend_finish_dynamic_sections \
   3669  1.1  christos 					_bfd_mips_elf_finish_dynamic_sections
   3670  1.1  christos #define elf_backend_final_write_processing \
   3671  1.1  christos 					_bfd_mips_elf_final_write_processing
   3672  1.1  christos #define elf_backend_additional_program_headers \
   3673  1.1  christos 					_bfd_mips_elf_additional_program_headers
   3674  1.1  christos #define elf_backend_modify_segment_map	_bfd_mips_elf_modify_segment_map
   3675  1.1  christos #define elf_backend_gc_mark_hook	_bfd_mips_elf_gc_mark_hook
   3676  1.1  christos #define elf_backend_gc_sweep_hook	_bfd_mips_elf_gc_sweep_hook
   3677  1.1  christos #define elf_backend_copy_indirect_symbol \
   3678  1.1  christos 					_bfd_mips_elf_copy_indirect_symbol
   3679  1.1  christos #define elf_backend_grok_prstatus	elf32_mips_grok_prstatus
   3680  1.1  christos #define elf_backend_grok_psinfo		elf32_mips_grok_psinfo
   3681  1.1  christos #define elf_backend_ecoff_debug_swap	&mips_elf32_ecoff_debug_swap
   3682  1.1  christos 
   3683  1.1  christos #define elf_backend_got_header_size	(4 * MIPS_RESERVED_GOTNO)
   3684  1.1  christos 
   3685  1.1  christos /* MIPS n32 ELF can use a mixture of REL and RELA, but some Relocations
   3686  1.1  christos    work better/work only in RELA, so we default to this.  */
   3687  1.1  christos #define elf_backend_may_use_rel_p	1
   3688  1.1  christos #define elf_backend_may_use_rela_p	1
   3689  1.1  christos #define elf_backend_default_use_rela_p	1
   3690  1.1  christos #define elf_backend_rela_plts_and_copies_p 0
   3691  1.1  christos #define elf_backend_sign_extend_vma	TRUE
   3692  1.1  christos #define elf_backend_plt_readonly	1
   3693  1.1  christos #define elf_backend_plt_sym_val		_bfd_mips_elf_plt_sym_val
   3694  1.1  christos 
   3695  1.1  christos #define elf_backend_discard_info	_bfd_mips_elf_discard_info
   3696  1.1  christos #define elf_backend_ignore_discarded_relocs \
   3697  1.1  christos 					_bfd_mips_elf_ignore_discarded_relocs
   3698  1.1  christos #define elf_backend_write_section	_bfd_mips_elf_write_section
   3699  1.1  christos #define elf_backend_mips_irix_compat	elf_n32_mips_irix_compat
   3700  1.1  christos #define elf_backend_mips_rtype_to_howto	mips_elf_n32_rtype_to_howto
   3701  1.1  christos 
   3702  1.1  christos #define bfd_elf32_bfd_is_local_label_name \
   3703  1.1  christos 					mips_elf_n32_is_local_label_name
   3704  1.1  christos #define bfd_elf32_bfd_is_target_special_symbol \
   3705  1.1  christos 					_bfd_mips_elf_is_target_special_symbol
   3706  1.1  christos #define bfd_elf32_find_nearest_line	_bfd_mips_elf_find_nearest_line
   3707  1.1  christos #define bfd_elf32_find_inliner_info	_bfd_mips_elf_find_inliner_info
   3708  1.1  christos #define bfd_elf32_new_section_hook	_bfd_mips_elf_new_section_hook
   3709  1.3  christos #define bfd_elf32_set_section_contents	_bfd_mips_elf_set_section_contents
   3710  1.1  christos #define bfd_elf32_bfd_get_relocated_section_contents \
   3711  1.1  christos 				_bfd_elf_mips_get_relocated_section_contents
   3712  1.1  christos #define bfd_elf32_bfd_link_hash_table_create \
   3713  1.3  christos 					_bfd_mips_elf_link_hash_table_create
   3714  1.1  christos #define bfd_elf32_bfd_final_link	_bfd_mips_elf_final_link
   3715  1.3  christos #define bfd_elf32_bfd_merge_private_bfd_data \
   3716  1.1  christos 					_bfd_mips_elf_merge_private_bfd_data
   3717  1.1  christos #define bfd_elf32_bfd_set_private_flags	_bfd_mips_elf_set_private_flags
   3718  1.1  christos #define bfd_elf32_bfd_print_private_bfd_data \
   3719  1.1  christos 					_bfd_mips_elf_print_private_bfd_data
   3720  1.1  christos #define bfd_elf32_bfd_relax_section     _bfd_mips_relax_section
   3721  1.1  christos #define bfd_elf32_mkobject		_bfd_mips_elf_mkobject
   3722  1.1  christos 
   3723  1.1  christos /* Support for SGI-ish mips targets using n32 ABI.  */
   3724  1.1  christos 
   3725  1.1  christos #define TARGET_LITTLE_SYM               mips_elf32_n_le_vec
   3726  1.1  christos #define TARGET_LITTLE_NAME              "elf32-nlittlemips"
   3727  1.1  christos #define TARGET_BIG_SYM                  mips_elf32_n_be_vec
   3728  1.1  christos #define TARGET_BIG_NAME                 "elf32-nbigmips"
   3729  1.1  christos 
   3730  1.1  christos #define ELF_MAXPAGESIZE			0x10000
   3731  1.1  christos #define ELF_COMMONPAGESIZE		0x1000
   3732  1.3  christos 
   3733  1.1  christos #include "elf32-target.h"
   3734  1.3  christos 
   3735  1.1  christos /* Support for traditional mips targets using n32 ABI.  */
   3736  1.1  christos #undef TARGET_LITTLE_SYM
   3737  1.1  christos #undef TARGET_LITTLE_NAME
   3738  1.1  christos #undef TARGET_BIG_SYM
   3739  1.1  christos #undef TARGET_BIG_NAME
   3740  1.1  christos 
   3741  1.1  christos #undef ELF_MAXPAGESIZE
   3742  1.1  christos #undef ELF_COMMONPAGESIZE
   3743  1.1  christos 
   3744  1.1  christos #define TARGET_LITTLE_SYM               mips_elf32_ntrad_le_vec
   3745  1.1  christos #define TARGET_LITTLE_NAME              "elf32-ntradlittlemips"
   3746  1.1  christos #define TARGET_BIG_SYM                  mips_elf32_ntrad_be_vec
   3747  1.1  christos #define TARGET_BIG_NAME                 "elf32-ntradbigmips"
   3748  1.1  christos 
   3749  1.1  christos #define ELF_MAXPAGESIZE			0x10000
   3750  1.1  christos #define ELF_COMMONPAGESIZE		0x1000
   3751  1.1  christos #define elf32_bed			elf32_tradbed
   3752  1.3  christos 
   3753  1.1  christos /* Include the target file again for this target.  */
   3754  1.3  christos #include "elf32-target.h"
   3755  1.1  christos 
   3756  1.1  christos 
   3757  1.1  christos /* FreeBSD support.  */
   3758  1.1  christos 
   3759  1.1  christos #undef TARGET_LITTLE_SYM
   3760  1.1  christos #undef TARGET_LITTLE_NAME
   3761  1.1  christos #undef TARGET_BIG_SYM
   3762  1.1  christos #undef TARGET_BIG_NAME
   3763  1.1  christos 
   3764                #define	TARGET_LITTLE_SYM		mips_elf32_ntradfbsd_le_vec
   3765                #define	TARGET_LITTLE_NAME		"elf32-ntradlittlemips-freebsd"
   3766                #define	TARGET_BIG_SYM			mips_elf32_ntradfbsd_be_vec
   3767                #define	TARGET_BIG_NAME			"elf32-ntradbigmips-freebsd"
   3768                
   3769                #undef	ELF_OSABI
   3770                #define	ELF_OSABI			ELFOSABI_FREEBSD
   3771                
   3772                #undef	elf32_bed
   3773                #define elf32_bed				elf32_fbsd_tradbed
   3774                
   3775                #include "elf32-target.h"
   3776