Home | History | Annotate | Line # | Download | only in bfd
      1      1.1  christos /* LoongArch-specific support for ELF.
      2  1.1.1.2  christos    Copyright (C) 2021-2024 Free Software Foundation, Inc.
      3      1.1  christos    Contributed by Loongson Ltd.
      4      1.1  christos 
      5      1.1  christos    Based on RISC-V target.
      6      1.1  christos 
      7      1.1  christos    This file is part of BFD, the Binary File Descriptor library.
      8      1.1  christos 
      9      1.1  christos    This program is free software; you can redistribute it and/or modify
     10      1.1  christos    it under the terms of the GNU General Public License as published by
     11      1.1  christos    the Free Software Foundation; either version 3 of the License, or
     12      1.1  christos    (at your option) any later version.
     13      1.1  christos 
     14      1.1  christos    This program is distributed in the hope that it will be useful,
     15      1.1  christos    but WITHOUT ANY WARRANTY; without even the implied warranty of
     16      1.1  christos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17      1.1  christos    GNU General Public License for more details.
     18      1.1  christos 
     19      1.1  christos    You should have received a copy of the GNU General Public License
     20      1.1  christos    along with this program; see the file COPYING3.  If not,
     21      1.1  christos    see <http://www.gnu.org/licenses/>.  */
     22      1.1  christos 
     23      1.1  christos #include "sysdep.h"
     24      1.1  christos #include "bfd.h"
     25      1.1  christos #include "libbfd.h"
     26      1.1  christos #include "elf-bfd.h"
     27      1.1  christos #include "elf/loongarch.h"
     28      1.1  christos #include "elfxx-loongarch.h"
     29      1.1  christos 
     30      1.1  christos #define ALL_ONES (~ (bfd_vma) 0)
     31      1.1  christos 
     32      1.1  christos typedef struct loongarch_reloc_howto_type_struct
     33      1.1  christos {
     34      1.1  christos   /* The first must be reloc_howto_type!  */
     35      1.1  christos   reloc_howto_type howto;
     36      1.1  christos   bfd_reloc_code_real_type bfd_type;
     37  1.1.1.2  christos   bool (*adjust_reloc_bits)(bfd *, reloc_howto_type *, bfd_vma *);
     38      1.1  christos   const char *larch_reloc_type_name;
     39      1.1  christos } loongarch_reloc_howto_type;
     40      1.1  christos 
     41      1.1  christos #define LOONGARCH_DEFAULT_HOWTO(r_name)					    \
     42      1.1  christos   { HOWTO (R_LARCH_##r_name, 0, 4, 32, false, 0, complain_overflow_signed,  \
     43      1.1  christos 	bfd_elf_generic_reloc, "R_LARCH_" #r_name, false, 0, ALL_ONES,	    \
     44      1.1  christos 	false), BFD_RELOC_LARCH_##r_name, NULL, NULL }
     45      1.1  christos 
     46      1.1  christos #define LOONGARCH_HOWTO(type, right, size, bits, pcrel, left, ovf, func,  \
     47      1.1  christos 	    name, inplace, src_mask, dst_mask, pcrel_off, btype, afunc,lname) \
     48      1.1  christos   { HOWTO(type, right, size, bits, pcrel, left, ovf, func, name,	  \
     49      1.1  christos 	  inplace, src_mask, dst_mask, pcrel_off), btype, afunc, lname }
     50      1.1  christos 
     51      1.1  christos #define LOONGARCH_EMPTY_HOWTO(C) \
     52      1.1  christos   { EMPTY_HOWTO (C), BFD_RELOC_NONE, NULL, NULL }
     53      1.1  christos 
     54      1.1  christos static bool
     55  1.1.1.2  christos reloc_bits (bfd *abfd, reloc_howto_type *howto, bfd_vma *val);
     56      1.1  christos static bool
     57  1.1.1.2  christos reloc_sign_bits (bfd *abfd, reloc_howto_type *howto, bfd_vma *fix_val);
     58      1.1  christos static bool
     59  1.1.1.2  christos reloc_unsign_bits (bfd *abfd, reloc_howto_type *howto, bfd_vma *fix_val);
     60  1.1.1.2  christos 
     61  1.1.1.2  christos static bfd_reloc_status_type
     62  1.1.1.2  christos loongarch_elf_add_sub_reloc (bfd *, arelent *, asymbol *, void *,
     63  1.1.1.2  christos 			      asection *, bfd *, char **);
     64  1.1.1.2  christos 
     65  1.1.1.2  christos static bfd_reloc_status_type
     66  1.1.1.2  christos loongarch_elf_add_sub_reloc_uleb128 (bfd *, arelent *, asymbol *, void *,
     67  1.1.1.2  christos 				      asection *, bfd *, char **);
     68      1.1  christos 
     69      1.1  christos /* This does not include any relocation information, but should be
     70      1.1  christos    good enough for GDB or objdump to read the file.  */
     71      1.1  christos static loongarch_reloc_howto_type loongarch_howto_table[] =
     72      1.1  christos {
     73      1.1  christos   /* No relocation.  */
     74      1.1  christos     LOONGARCH_HOWTO (R_LARCH_NONE,	  /* type (0).  */
     75      1.1  christos 	 0,				  /* rightshift */
     76      1.1  christos 	 0,				  /* size */
     77      1.1  christos 	 0,				  /* bitsize */
     78      1.1  christos 	 false,				  /* pc_relative */
     79      1.1  christos 	 0,				  /* bitpos */
     80      1.1  christos 	 complain_overflow_dont,	  /* complain_on_overflow */
     81      1.1  christos 	 bfd_elf_generic_reloc,		  /* special_function */
     82      1.1  christos 	 "R_LARCH_NONE",		  /* name */
     83      1.1  christos 	 false,				  /* partial_inplace */
     84      1.1  christos 	 0,				  /* src_mask */
     85      1.1  christos 	 0,				  /* dst_mask */
     86      1.1  christos 	 false,				  /* pcrel_offset */
     87      1.1  christos 	 BFD_RELOC_NONE,		  /* bfd_reloc_code_real_type */
     88      1.1  christos 	 NULL,				  /* adjust_reloc_bits */
     89      1.1  christos 	 NULL),				  /* larch_reloc_type_name */
     90      1.1  christos 
     91      1.1  christos   /* 32 bit relocation.  */
     92      1.1  christos   LOONGARCH_HOWTO (R_LARCH_32,		  /* type (1).  */
     93      1.1  christos 	 0,				  /* rightshift */
     94      1.1  christos 	 4,				  /* size */
     95      1.1  christos 	 32,				  /* bitsize */
     96      1.1  christos 	 false,				  /* pc_relative */
     97      1.1  christos 	 0,				  /* bitpos */
     98      1.1  christos 	 complain_overflow_dont,	  /* complain_on_overflow */
     99      1.1  christos 	 bfd_elf_generic_reloc,		  /* special_function */
    100      1.1  christos 	 "R_LARCH_32",			  /* name */
    101      1.1  christos 	 false,				  /* partial_inplace */
    102      1.1  christos 	 0,				  /* src_mask */
    103      1.1  christos 	 ALL_ONES,			  /* dst_mask */
    104      1.1  christos 	 false,				  /* pcrel_offset */
    105      1.1  christos 	 BFD_RELOC_32,			  /* bfd_reloc_code_real_type */
    106      1.1  christos 	 NULL,				  /* adjust_reloc_bits */
    107      1.1  christos 	 NULL),				  /* larch_reloc_type_name */
    108      1.1  christos 
    109      1.1  christos   /* 64 bit relocation.  */
    110      1.1  christos   LOONGARCH_HOWTO (R_LARCH_64,		  /* type (2).  */
    111      1.1  christos 	 0,				  /* rightshift */
    112      1.1  christos 	 8,				  /* size */
    113      1.1  christos 	 64,				  /* bitsize */
    114      1.1  christos 	 false,				  /* pc_relative */
    115      1.1  christos 	 0,				  /* bitpos */
    116      1.1  christos 	 complain_overflow_dont,	  /* complain_on_overflow */
    117      1.1  christos 	 bfd_elf_generic_reloc,		  /* special_function */
    118      1.1  christos 	 "R_LARCH_64",			  /* name */
    119      1.1  christos 	 false,				  /* partial_inplace */
    120      1.1  christos 	 0,				  /* src_mask */
    121      1.1  christos 	 ALL_ONES,			  /* dst_mask */
    122      1.1  christos 	 false,				  /* pcrel_offset */
    123      1.1  christos 	 BFD_RELOC_64,			  /* bfd_reloc_code_real_type */
    124      1.1  christos 	 NULL,				  /* adjust_reloc_bits */
    125      1.1  christos 	 NULL),				  /* larch_reloc_type_name */
    126      1.1  christos 
    127      1.1  christos   LOONGARCH_HOWTO (R_LARCH_RELATIVE,	  /* type (3).  */
    128      1.1  christos 	 0,				  /* rightshift */
    129      1.1  christos 	 4,				  /* size */
    130      1.1  christos 	 32,				  /* bitsize */
    131      1.1  christos 	 false,				  /* pc_relative */
    132      1.1  christos 	 0,				  /* bitpos */
    133      1.1  christos 	 complain_overflow_dont,	  /* complain_on_overflow */
    134      1.1  christos 	 bfd_elf_generic_reloc,		  /* special_function */
    135      1.1  christos 	 "R_LARCH_RELATIVE",		  /* name */
    136      1.1  christos 	 false,				  /* partial_inplace */
    137      1.1  christos 	 0,				  /* src_mask */
    138      1.1  christos 	 ALL_ONES,			  /* dst_mask */
    139      1.1  christos 	 false,				  /* pcrel_offset */
    140      1.1  christos 	 BFD_RELOC_NONE,		  /* undefined?  */
    141      1.1  christos 	 NULL,				  /* adjust_reloc_bits */
    142      1.1  christos 	 NULL),				  /* larch_reloc_type_name */
    143      1.1  christos 
    144      1.1  christos   LOONGARCH_HOWTO (R_LARCH_COPY,	  /* type (4).  */
    145      1.1  christos 	 0,				  /* rightshift */
    146      1.1  christos 	 0,				  /* this one is variable size */
    147      1.1  christos 	 0,				  /* bitsize */
    148      1.1  christos 	 false,				  /* pc_relative */
    149      1.1  christos 	 0,				  /* bitpos */
    150      1.1  christos 	 complain_overflow_bitfield,	  /* complain_on_overflow */
    151      1.1  christos 	 bfd_elf_generic_reloc,		  /* special_function */
    152      1.1  christos 	 "R_LARCH_COPY",		  /* name */
    153      1.1  christos 	 false,				  /* partial_inplace */
    154      1.1  christos 	 0,				  /* src_mask */
    155      1.1  christos 	 0,				  /* dst_mask */
    156      1.1  christos 	 false,				  /* pcrel_offset */
    157      1.1  christos 	 BFD_RELOC_NONE,		  /* undefined?  */
    158      1.1  christos 	 NULL,				  /* adjust_reloc_bits */
    159      1.1  christos 	 NULL),				  /* larch_reloc_type_name */
    160      1.1  christos 
    161      1.1  christos   LOONGARCH_HOWTO (R_LARCH_JUMP_SLOT,	  /* type (5).  */
    162      1.1  christos 	 0,				  /* rightshift */
    163      1.1  christos 	 8,				  /* size */
    164      1.1  christos 	 64,				  /* bitsize */
    165      1.1  christos 	 false,				  /* pc_relative */
    166      1.1  christos 	 0,				  /* bitpos */
    167      1.1  christos 	 complain_overflow_bitfield,	  /* complain_on_overflow */
    168      1.1  christos 	 bfd_elf_generic_reloc,		  /* special_function */
    169      1.1  christos 	 "R_LARCH_JUMP_SLOT",		  /* name */
    170      1.1  christos 	 false,				  /* partial_inplace */
    171      1.1  christos 	 0,				  /* src_mask */
    172      1.1  christos 	 0,				  /* dst_mask */
    173      1.1  christos 	 false,				  /* pcrel_offset */
    174      1.1  christos 	 BFD_RELOC_NONE,		  /* undefined?  */
    175      1.1  christos 	 NULL,				  /* adjust_reloc_bits */
    176      1.1  christos 	 NULL),				  /* larch_reloc_type_name */
    177      1.1  christos 
    178      1.1  christos   /* Dynamic TLS relocations.  */
    179      1.1  christos   LOONGARCH_HOWTO (R_LARCH_TLS_DTPMOD32,  /* type (6).  */
    180      1.1  christos 	 0,				  /* rightshift */
    181      1.1  christos 	 4,				  /* size */
    182      1.1  christos 	 32,				  /* bitsize */
    183      1.1  christos 	 false,				  /* pc_relative */
    184      1.1  christos 	 0,				  /* bitpos */
    185      1.1  christos 	 complain_overflow_dont,	  /* complain_on_overflow */
    186      1.1  christos 	 bfd_elf_generic_reloc,		  /* special_function */
    187      1.1  christos 	 "R_LARCH_TLS_DTPMOD32",	  /* name */
    188      1.1  christos 	 false,				  /* partial_inplace */
    189      1.1  christos 	 0,				  /* src_mask */
    190      1.1  christos 	 ALL_ONES,			  /* dst_mask */
    191      1.1  christos 	 false,				  /* pcrel_offset */
    192      1.1  christos 	 BFD_RELOC_LARCH_TLS_DTPMOD32,	  /* bfd_reloc_code_real_type */
    193      1.1  christos 	 NULL,				  /* adjust_reloc_bits */
    194      1.1  christos 	 NULL),				  /* larch_reloc_type_name */
    195      1.1  christos 
    196      1.1  christos   LOONGARCH_HOWTO (R_LARCH_TLS_DTPMOD64,  /* type (7).  */
    197      1.1  christos 	 0,				  /* rightshift */
    198      1.1  christos 	 8,				  /* size */
    199      1.1  christos 	 64,				  /* bitsize */
    200      1.1  christos 	 false,				  /* pc_relative */
    201      1.1  christos 	 0,				  /* bitpos */
    202      1.1  christos 	 complain_overflow_dont,	  /* complain_on_overflow */
    203      1.1  christos 	 bfd_elf_generic_reloc,		  /* special_function */
    204      1.1  christos 	 "R_LARCH_TLS_DTPMOD64",	  /* name */
    205      1.1  christos 	 false,				  /* partial_inplace */
    206      1.1  christos 	 0,				  /* src_mask */
    207      1.1  christos 	 ALL_ONES,			  /* dst_mask */
    208      1.1  christos 	 false,				  /* pcrel_offset */
    209      1.1  christos 	 BFD_RELOC_LARCH_TLS_DTPMOD64,	  /* bfd_reloc_code_real_type */
    210      1.1  christos 	 NULL,				  /* adjust_reloc_bits */
    211      1.1  christos 	 NULL),				  /* larch_reloc_type_name */
    212      1.1  christos 
    213      1.1  christos   LOONGARCH_HOWTO (R_LARCH_TLS_DTPREL32,  /* type (8). */
    214      1.1  christos 	 0,				  /* rightshift */
    215      1.1  christos 	 4,				  /* size */
    216      1.1  christos 	 32,				  /* bitsize */
    217      1.1  christos 	 false,				  /* pc_relative */
    218      1.1  christos 	 0,				  /* bitpos */
    219      1.1  christos 	 complain_overflow_dont,	  /* complain_on_overflow */
    220      1.1  christos 	 bfd_elf_generic_reloc,		  /* special_function */
    221      1.1  christos 	 "R_LARCH_TLS_DTPREL32",	  /* name */
    222      1.1  christos 	 true,				  /* partial_inplace */
    223      1.1  christos 	 0,				  /* src_mask */
    224      1.1  christos 	 ALL_ONES,			  /* dst_mask */
    225      1.1  christos 	 false,				  /* pcrel_offset */
    226      1.1  christos 	 BFD_RELOC_LARCH_TLS_DTPREL32,	  /* bfd_reloc_code_real_type */
    227      1.1  christos 	 NULL,				  /* adjust_reloc_bits */
    228      1.1  christos 	 NULL),				  /* larch_reloc_type_name */
    229      1.1  christos 
    230      1.1  christos   LOONGARCH_HOWTO (R_LARCH_TLS_DTPREL64,  /* type (9).  */
    231      1.1  christos 	 0,				  /* rightshift */
    232      1.1  christos 	 8,				  /* size */
    233      1.1  christos 	 64,				  /* bitsize */
    234      1.1  christos 	 false,				  /* pc_relative */
    235      1.1  christos 	 0,				  /* bitpos */
    236      1.1  christos 	 complain_overflow_dont,	  /* complain_on_overflow */
    237      1.1  christos 	 bfd_elf_generic_reloc,		  /* special_function */
    238      1.1  christos 	 "R_LARCH_TLS_DTPREL64",	  /* name */
    239      1.1  christos 	 true,				  /* partial_inplace */
    240      1.1  christos 	 0,				  /* src_mask */
    241      1.1  christos 	 ALL_ONES,			  /* dst_mask */
    242      1.1  christos 	 false,				  /* pcrel_offset */
    243      1.1  christos 	 BFD_RELOC_LARCH_TLS_DTPREL64,	  /* bfd_reloc_code_real_type */
    244      1.1  christos 	 NULL,				  /* adjust_reloc_bits */
    245      1.1  christos 	 NULL),				  /* larch_reloc_type_name */
    246      1.1  christos 
    247      1.1  christos   LOONGARCH_HOWTO (R_LARCH_TLS_TPREL32,	  /* type (10).  */
    248      1.1  christos 	 0,				  /* rightshift */
    249      1.1  christos 	 4,				  /* size */
    250      1.1  christos 	 32,				  /* bitsize */
    251      1.1  christos 	 false,				  /* pc_relative */
    252      1.1  christos 	 0,				  /* bitpos */
    253      1.1  christos 	 complain_overflow_dont,	  /* complain_on_overflow */
    254      1.1  christos 	 bfd_elf_generic_reloc,		  /* special_function */
    255      1.1  christos 	 "R_LARCH_TLS_TPREL32",		  /* name */
    256      1.1  christos 	 false,				  /* partial_inplace */
    257      1.1  christos 	 0,				  /* src_mask */
    258      1.1  christos 	 ALL_ONES,			  /* dst_mask */
    259      1.1  christos 	 false,				  /* pcrel_offset */
    260      1.1  christos 	 BFD_RELOC_LARCH_TLS_TPREL32,	  /* bfd_reloc_code_real_type */
    261      1.1  christos 	 NULL,				  /* adjust_reloc_bits */
    262      1.1  christos 	 NULL),				  /* larch_reloc_type_name */
    263      1.1  christos 
    264      1.1  christos   LOONGARCH_HOWTO (R_LARCH_TLS_TPREL64,	  /* type (11).  */
    265      1.1  christos 	 0,				  /* rightshift */
    266      1.1  christos 	 8,				  /* size */
    267      1.1  christos 	 64,				  /* bitsize */
    268      1.1  christos 	 false,				  /* pc_relative */
    269      1.1  christos 	 0,				  /* bitpos */
    270      1.1  christos 	 complain_overflow_dont,	  /* complain_on_overflow */
    271      1.1  christos 	 bfd_elf_generic_reloc,		  /* special_function */
    272      1.1  christos 	 "R_LARCH_TLS_TPREL64",		  /* name */
    273      1.1  christos 	 false,				  /* partial_inplace */
    274      1.1  christos 	 0,				  /* src_mask */
    275      1.1  christos 	 ALL_ONES,			  /* dst_mask */
    276      1.1  christos 	 false,				  /* pcrel_offset */
    277      1.1  christos 	 BFD_RELOC_LARCH_TLS_TPREL64,	  /* bfd_reloc_code_real_type */
    278      1.1  christos 	 NULL,				  /* adjust_reloc_bits */
    279      1.1  christos 	 NULL),				  /* larch_reloc_type_name */
    280      1.1  christos 
    281      1.1  christos   LOONGARCH_HOWTO (R_LARCH_IRELATIVE,	  /* type (12).  */
    282      1.1  christos 	 0,				  /* rightshift */
    283  1.1.1.2  christos 	 8,				  /* size */
    284  1.1.1.2  christos 	 64,				  /* bitsize */
    285      1.1  christos 	 false,				  /* pc_relative */
    286      1.1  christos 	 0,				  /* bitpos */
    287      1.1  christos 	 complain_overflow_dont,	  /* complain_on_overflow */
    288      1.1  christos 	 bfd_elf_generic_reloc,		  /* special_function */
    289      1.1  christos 	 "R_LARCH_IRELATIVE",		  /* name */
    290      1.1  christos 	 false,				  /* partial_inplace */
    291      1.1  christos 	 0,				  /* src_mask */
    292      1.1  christos 	 ALL_ONES,			  /* dst_mask */
    293      1.1  christos 	 false,				  /* pcrel_offset */
    294      1.1  christos 	 BFD_RELOC_NONE,		  /* undefined?  */
    295      1.1  christos 	 NULL,				  /* adjust_reloc_bits */
    296      1.1  christos 	 NULL),				  /* larch_reloc_type_name */
    297      1.1  christos 
    298  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_TLS_DESC32,	  /* type (13).  */
    299  1.1.1.2  christos 	 0,				  /* rightshift.  */
    300  1.1.1.2  christos 	 4,				  /* size.  */
    301  1.1.1.2  christos 	 32,				  /* bitsize.  */
    302  1.1.1.2  christos 	 false,				  /* pc_relative.  */
    303  1.1.1.2  christos 	 0,				  /* bitpos.  */
    304  1.1.1.2  christos 	 complain_overflow_dont,	  /* complain_on_overflow.  */
    305  1.1.1.2  christos 	 bfd_elf_generic_reloc,		  /* special_function.  */
    306  1.1.1.2  christos 	 "R_LARCH_TLS_DESC32",		  /* name.  */
    307  1.1.1.2  christos 	 false,				  /* partial_inplace.  */
    308  1.1.1.2  christos 	 0,				  /* src_mask.  */
    309  1.1.1.2  christos 	 ALL_ONES,		  	  /* dst_mask.  */
    310  1.1.1.2  christos 	 false,				  /* pcrel_offset.  */
    311  1.1.1.2  christos 	 BFD_RELOC_LARCH_TLS_DESC32,	  /* bfd_reloc_code_real_type.  */
    312  1.1.1.2  christos 	 NULL,				  /* adjust_reloc_bits.  */
    313  1.1.1.2  christos 	 NULL),				  /* larch_reloc_type_name.  */
    314  1.1.1.2  christos 
    315  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_TLS_DESC64,	  /* type (14).  */
    316  1.1.1.2  christos 	 0,				  /* rightshift.  */
    317  1.1.1.2  christos 	 8,				  /* size.  */
    318  1.1.1.2  christos 	 64,				  /* bitsize.  */
    319  1.1.1.2  christos 	 false,				  /* pc_relative.  */
    320  1.1.1.2  christos 	 0,				  /* bitpos.  */
    321  1.1.1.2  christos 	 complain_overflow_dont,	  /* complain_on_overflow.  */
    322  1.1.1.2  christos 	 bfd_elf_generic_reloc,		  /* special_function.  */
    323  1.1.1.2  christos 	 "R_LARCH_TLS_DESC64",		  /* name.  */
    324  1.1.1.2  christos 	 false,				  /* partial_inplace.  */
    325  1.1.1.2  christos 	 0,				  /* src_mask.  */
    326  1.1.1.2  christos 	 ALL_ONES,			  /* dst_mask.  */
    327  1.1.1.2  christos 	 false,				  /* pcrel_offset.  */
    328  1.1.1.2  christos 	 BFD_RELOC_LARCH_TLS_DESC64,	  /* bfd_reloc_code_real_type.  */
    329  1.1.1.2  christos 	 NULL,				  /* adjust_reloc_bits.  */
    330  1.1.1.2  christos 	 NULL),				  /* larch_reloc_type_name.  */
    331  1.1.1.2  christos 
    332      1.1  christos   LOONGARCH_EMPTY_HOWTO (15),
    333      1.1  christos   LOONGARCH_EMPTY_HOWTO (16),
    334      1.1  christos   LOONGARCH_EMPTY_HOWTO (17),
    335      1.1  christos   LOONGARCH_EMPTY_HOWTO (18),
    336      1.1  christos   LOONGARCH_EMPTY_HOWTO (19),
    337      1.1  christos 
    338      1.1  christos   LOONGARCH_HOWTO (R_LARCH_MARK_LA,		/* type (20).  */
    339      1.1  christos 	 0,					/* rightshift.  */
    340      1.1  christos 	 0,					/* size.  */
    341      1.1  christos 	 0,					/* bitsize.  */
    342      1.1  christos 	 false,					/* pc_relative.  */
    343      1.1  christos 	 0,					/* bitpos.  */
    344      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
    345      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
    346      1.1  christos 	 "R_LARCH_MARK_LA",			/* name.  */
    347      1.1  christos 	 false,					/* partial_inplace.  */
    348      1.1  christos 	 0,					/* src_mask.  */
    349      1.1  christos 	 0,					/* dst_mask.  */
    350      1.1  christos 	 false,					/* pcrel_offset */
    351      1.1  christos 	 BFD_RELOC_LARCH_MARK_LA,		/* bfd_reloc_code_real_type */
    352      1.1  christos 	 NULL,					/* adjust_reloc_bits */
    353      1.1  christos 	 NULL),					/* larch_reloc_type_name */
    354      1.1  christos 
    355      1.1  christos   LOONGARCH_HOWTO (R_LARCH_MARK_PCREL,		/* type (21).  */
    356      1.1  christos 	 0,					/* rightshift.  */
    357      1.1  christos 	 0,					/* size.  */
    358      1.1  christos 	 0,					/* bitsize.  */
    359      1.1  christos 	 false,					/* pc_relative.  */
    360      1.1  christos 	 0,					/* bitpos.  */
    361      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
    362      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
    363      1.1  christos 	 "R_LARCH_MARK_PCREL",			/* name.  */
    364      1.1  christos 	 false,					/* partial_inplace.  */
    365      1.1  christos 	 0,					/* src_mask.  */
    366      1.1  christos 	 0,					/* dst_mask.  */
    367      1.1  christos 	 false,					/* pcrel_offset */
    368      1.1  christos 	 BFD_RELOC_LARCH_MARK_PCREL,		/* bfd_reloc_code_real_type */
    369      1.1  christos 	 NULL,					/* adjust_reloc_bits */
    370      1.1  christos 	 NULL),					/* larch_reloc_type_name */
    371      1.1  christos 
    372      1.1  christos   LOONGARCH_HOWTO (R_LARCH_SOP_PUSH_PCREL,	/* type (22).  */
    373      1.1  christos 	 2,					/* rightshift.  */
    374      1.1  christos 	 4,					/* size.  */
    375      1.1  christos 	 32,					/* bitsize.  */
    376      1.1  christos 	 true /* FIXME: somewhat use this.  */,	/* pc_relative.  */
    377      1.1  christos 	 0,					/* bitpos.  */
    378      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
    379      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
    380      1.1  christos 	 "R_LARCH_SOP_PUSH_PCREL",		/* name.  */
    381      1.1  christos 	 false,					/* partial_inplace.  */
    382      1.1  christos 	 0x03ffffff,				/* src_mask.  */
    383      1.1  christos 	 0x03ffffff,				/* dst_mask.  */
    384      1.1  christos 	 false,					/* pcrel_offset */
    385      1.1  christos 	 BFD_RELOC_LARCH_SOP_PUSH_PCREL,	/* bfd_reloc_code_real_type */
    386      1.1  christos 	 NULL,					/* adjust_reloc_bits */
    387      1.1  christos 	 NULL),					/* larch_reloc_type_name */
    388      1.1  christos 
    389      1.1  christos   /* type 23-37.  */
    390      1.1  christos   LOONGARCH_DEFAULT_HOWTO (SOP_PUSH_ABSOLUTE),
    391      1.1  christos   LOONGARCH_DEFAULT_HOWTO (SOP_PUSH_DUP),
    392      1.1  christos   LOONGARCH_DEFAULT_HOWTO (SOP_PUSH_GPREL),
    393      1.1  christos   LOONGARCH_DEFAULT_HOWTO (SOP_PUSH_TLS_TPREL),
    394      1.1  christos   LOONGARCH_DEFAULT_HOWTO (SOP_PUSH_TLS_GOT),
    395      1.1  christos   LOONGARCH_DEFAULT_HOWTO (SOP_PUSH_TLS_GD),
    396      1.1  christos   LOONGARCH_DEFAULT_HOWTO (SOP_PUSH_PLT_PCREL),
    397      1.1  christos   LOONGARCH_DEFAULT_HOWTO (SOP_ASSERT),
    398      1.1  christos   LOONGARCH_DEFAULT_HOWTO (SOP_NOT),
    399      1.1  christos   LOONGARCH_DEFAULT_HOWTO (SOP_SUB),
    400      1.1  christos   LOONGARCH_DEFAULT_HOWTO (SOP_SL),
    401      1.1  christos   LOONGARCH_DEFAULT_HOWTO (SOP_SR),
    402      1.1  christos   LOONGARCH_DEFAULT_HOWTO (SOP_ADD),
    403      1.1  christos   LOONGARCH_DEFAULT_HOWTO (SOP_AND),
    404      1.1  christos   LOONGARCH_DEFAULT_HOWTO (SOP_IF_ELSE),
    405      1.1  christos 
    406      1.1  christos   LOONGARCH_HOWTO (R_LARCH_SOP_POP_32_S_10_5,	  /* type (38).  */
    407      1.1  christos 	 0,					  /* rightshift.  */
    408      1.1  christos 	 4,					  /* size.  */
    409      1.1  christos 	 5,					  /* bitsize.  */
    410      1.1  christos 	 false,					  /* pc_relative.  */
    411      1.1  christos 	 10,					  /* bitpos.  */
    412      1.1  christos 	 complain_overflow_signed,		  /* complain_on_overflow.  */
    413      1.1  christos 	 bfd_elf_generic_reloc,			  /* special_function.  */
    414      1.1  christos 	 "R_LARCH_SOP_POP_32_S_10_5",		  /* name.  */
    415      1.1  christos 	 false,					  /* partial_inplace.  */
    416      1.1  christos 	 0,					  /* src_mask */
    417      1.1  christos 	 0x7c00,				  /* dst_mask */
    418      1.1  christos 	 false,					  /* pcrel_offset */
    419      1.1  christos 	 BFD_RELOC_LARCH_SOP_POP_32_S_10_5,	  /* bfd_reloc_code_real_type */
    420  1.1.1.2  christos 	 reloc_sign_bits,			  /* adjust_reloc_bits */
    421      1.1  christos 	 NULL),					  /* larch_reloc_type_name */
    422      1.1  christos 
    423      1.1  christos   LOONGARCH_HOWTO (R_LARCH_SOP_POP_32_U_10_12,	  /* type (39).  */
    424      1.1  christos 	 0,					  /* rightshift.  */
    425      1.1  christos 	 4,					  /* size.  */
    426      1.1  christos 	 12,					  /* bitsize.  */
    427      1.1  christos 	 false,					  /* pc_relative.  */
    428      1.1  christos 	 10,					  /* bitpos.  */
    429      1.1  christos 	 complain_overflow_unsigned,		  /* complain_on_overflow.  */
    430      1.1  christos 	 bfd_elf_generic_reloc,			  /* special_function.  */
    431      1.1  christos 	 "R_LARCH_SOP_POP_32_U_10_12",		  /* name.  */
    432      1.1  christos 	 false,					  /* partial_inplace.  */
    433      1.1  christos 	 0,					  /* src_mask */
    434      1.1  christos 	 0x3ffc00,				  /* dst_mask */
    435      1.1  christos 	 false,					  /* pcrel_offset */
    436      1.1  christos 	 BFD_RELOC_LARCH_SOP_POP_32_U_10_12,	  /* bfd_reloc_code_real_type */
    437  1.1.1.2  christos 	 reloc_unsign_bits,			  /* adjust_reloc_bits */
    438      1.1  christos 	 NULL),					  /* larch_reloc_type_name */
    439      1.1  christos 
    440      1.1  christos   LOONGARCH_HOWTO (R_LARCH_SOP_POP_32_S_10_12,	  /* type (40).  */
    441      1.1  christos 	 0,					  /* rightshift.  */
    442      1.1  christos 	 4,					  /* size.  */
    443      1.1  christos 	 12,					  /* bitsize.  */
    444      1.1  christos 	 false,					  /* pc_relative.  */
    445      1.1  christos 	 10,					  /* bitpos.  */
    446      1.1  christos 	 complain_overflow_signed,		  /* complain_on_overflow.  */
    447      1.1  christos 	 bfd_elf_generic_reloc,			  /* special_function.  */
    448      1.1  christos 	 "R_LARCH_SOP_POP_32_S_10_12",		  /* name.  */
    449      1.1  christos 	 false,					  /* partial_inplace.  */
    450      1.1  christos 	 0,					  /* src_mask */
    451      1.1  christos 	 0x3ffc00,				  /* dst_mask */
    452      1.1  christos 	 false,					  /* pcrel_offset */
    453      1.1  christos 	 BFD_RELOC_LARCH_SOP_POP_32_S_10_12,	  /* bfd_reloc_code_real_type */
    454  1.1.1.2  christos 	 reloc_sign_bits,			  /* adjust_reloc_bits */
    455      1.1  christos 	 NULL),					  /* larch_reloc_type_name */
    456      1.1  christos 
    457      1.1  christos   LOONGARCH_HOWTO (R_LARCH_SOP_POP_32_S_10_16,	  /* type (41).  */
    458      1.1  christos 	 0,					  /* rightshift.  */
    459      1.1  christos 	 4,					  /* size.  */
    460      1.1  christos 	 16,					  /* bitsize.  */
    461      1.1  christos 	 false,					  /* pc_relative.  */
    462      1.1  christos 	 10,					  /* bitpos.  */
    463      1.1  christos 	 complain_overflow_signed,		  /* complain_on_overflow.  */
    464      1.1  christos 	 bfd_elf_generic_reloc,			  /* special_function.  */
    465      1.1  christos 	 "R_LARCH_SOP_POP_32_S_10_16",		  /* name.  */
    466      1.1  christos 	 false,					  /* partial_inplace.  */
    467      1.1  christos 	 0,					  /* src_mask */
    468      1.1  christos 	 0x3fffc00,				  /* dst_mask */
    469      1.1  christos 	 false,					  /* pcrel_offset */
    470      1.1  christos 	 BFD_RELOC_LARCH_SOP_POP_32_S_10_16,	  /* bfd_reloc_code_real_type */
    471  1.1.1.2  christos 	 reloc_sign_bits,			  /* adjust_reloc_bits */
    472      1.1  christos 	 NULL),					  /* larch_reloc_type_name */
    473      1.1  christos 
    474      1.1  christos   LOONGARCH_HOWTO (R_LARCH_SOP_POP_32_S_10_16_S2, /* type (42).  */
    475      1.1  christos 	 2,					  /* rightshift.  */
    476      1.1  christos 	 4,					  /* size.  */
    477      1.1  christos 	 16,					  /* bitsize.  */
    478      1.1  christos 	 false,					  /* pc_relative.  */
    479      1.1  christos 	 10,					  /* bitpos.  */
    480      1.1  christos 	 complain_overflow_signed,		  /* complain_on_overflow.  */
    481      1.1  christos 	 bfd_elf_generic_reloc,			  /* special_function.  */
    482      1.1  christos 	 "R_LARCH_SOP_POP_32_S_10_16_S2",	  /* name.  */
    483      1.1  christos 	 false,					  /* partial_inplace.  */
    484      1.1  christos 	 0,					  /* src_mask */
    485      1.1  christos 	 0x3fffc00,				  /* dst_mask */
    486      1.1  christos 	 false,					  /* pcrel_offset */
    487      1.1  christos 	 BFD_RELOC_LARCH_SOP_POP_32_S_10_16_S2,	  /* bfd_reloc_code_real_type */
    488  1.1.1.2  christos 	 reloc_sign_bits,			  /* adjust_reloc_bits */
    489      1.1  christos 	 NULL),					  /* larch_reloc_type_name */
    490      1.1  christos 
    491      1.1  christos   LOONGARCH_HOWTO (R_LARCH_SOP_POP_32_S_5_20,	  /* type (43).  */
    492      1.1  christos 	 0,					  /* rightshift.  */
    493      1.1  christos 	 4,					  /* size.  */
    494      1.1  christos 	 20,					  /* bitsize.  */
    495      1.1  christos 	 false,					  /* pc_relative.  */
    496      1.1  christos 	 5,					  /* bitpos.  */
    497      1.1  christos 	 complain_overflow_signed,		  /* complain_on_overflow.  */
    498      1.1  christos 	 bfd_elf_generic_reloc,			  /* special_function.  */
    499      1.1  christos 	 "R_LARCH_SOP_POP_32_S_5_20",		  /* name.  */
    500      1.1  christos 	 false,					  /* partial_inplace.  */
    501      1.1  christos 	 0,					  /* src_mask */
    502      1.1  christos 	 0x1ffffe0,				  /* dst_mask */
    503      1.1  christos 	 false,					  /* pcrel_offset */
    504      1.1  christos 	 BFD_RELOC_LARCH_SOP_POP_32_S_5_20,	  /* bfd_reloc_code_real_type */
    505  1.1.1.2  christos 	 reloc_sign_bits,			  /* adjust_reloc_bits */
    506      1.1  christos 	 NULL),					  /* larch_reloc_type_name */
    507      1.1  christos 
    508      1.1  christos   LOONGARCH_HOWTO (R_LARCH_SOP_POP_32_S_0_5_10_16_S2,
    509      1.1  christos 						  /* type (44).  */
    510      1.1  christos 	 2,					  /* rightshift.  */
    511      1.1  christos 	 4,					  /* size.  */
    512      1.1  christos 	 21,					  /* bitsize.  */
    513      1.1  christos 	 false,					  /* pc_relative.  */
    514      1.1  christos 	 0,					  /* bitpos.  */
    515      1.1  christos 	 complain_overflow_signed,		  /* complain_on_overflow.  */
    516      1.1  christos 	 bfd_elf_generic_reloc,			  /* special_function.  */
    517      1.1  christos 	 "R_LARCH_SOP_POP_32_S_0_5_10_16_S2",	  /* name.  */
    518      1.1  christos 	 false,					  /* partial_inplace.  */
    519  1.1.1.2  christos 	 0x0,					  /* src_mask */
    520  1.1.1.2  christos 	 0x03fffc1f,				  /* dst_mask */
    521      1.1  christos 	 false,					  /* pcrel_offset */
    522      1.1  christos 	 BFD_RELOC_LARCH_SOP_POP_32_S_0_5_10_16_S2,
    523      1.1  christos 						  /* bfd_reloc_code_real_type */
    524  1.1.1.2  christos 	 reloc_sign_bits,			  /* adjust_reloc_bits */
    525      1.1  christos 	 NULL),					  /* larch_reloc_type_name */
    526      1.1  christos 
    527      1.1  christos   LOONGARCH_HOWTO (R_LARCH_SOP_POP_32_S_0_10_10_16_S2,	/* type (45).  */
    528      1.1  christos 	 2,					/* rightshift.  */
    529      1.1  christos 	 4,					/* size.  */
    530      1.1  christos 	 26,					/* bitsize.  */
    531      1.1  christos 	 false,					/* pc_relative.  */
    532      1.1  christos 	 0,					/* bitpos.  */
    533      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
    534      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
    535      1.1  christos 	 "R_LARCH_SOP_POP_32_S_0_10_10_16_S2",	/* name.  */
    536      1.1  christos 	 false,					/* partial_inplace.  */
    537      1.1  christos 	 0,					/* src_mask */
    538      1.1  christos 	 0x03ffffff,				/* dst_mask */
    539      1.1  christos 	 false,					/* pcrel_offset */
    540      1.1  christos 	 BFD_RELOC_LARCH_SOP_POP_32_S_0_10_10_16_S2,
    541      1.1  christos 						/* bfd_reloc_code_real_type */
    542  1.1.1.2  christos 	 reloc_sign_bits,			/* adjust_reloc_bits */
    543      1.1  christos 	 NULL),					/* larch_reloc_type_name */
    544      1.1  christos 
    545      1.1  christos   LOONGARCH_HOWTO (R_LARCH_SOP_POP_32_U,	/* type (46).  */
    546      1.1  christos 	 0,					/* rightshift.  */
    547      1.1  christos 	 4,					/* size.  */
    548      1.1  christos 	 32,					/* bitsize.  */
    549      1.1  christos 	 false,					/* pc_relative.  */
    550      1.1  christos 	 0,					/* bitpos.  */
    551      1.1  christos 	 complain_overflow_unsigned,		/* complain_on_overflow.  */
    552      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
    553  1.1.1.2  christos 	 "R_LARCH_SOP_POP_32_U",		/* name.  */
    554      1.1  christos 	 false,					/* partial_inplace.  */
    555      1.1  christos 	 0xffffffff00000000,			/* src_mask */
    556      1.1  christos 	 0x00000000ffffffff,			/* dst_mask */
    557      1.1  christos 	 false,					/* pcrel_offset */
    558      1.1  christos 	 BFD_RELOC_LARCH_SOP_POP_32_U,		/* bfd_reloc_code_real_type */
    559  1.1.1.2  christos 	 reloc_unsign_bits,			/* adjust_reloc_bits */
    560      1.1  christos 	 NULL),					/* larch_reloc_type_name */
    561      1.1  christos 
    562  1.1.1.2  christos   /* 8-bit in-place addition, for local label subtraction.  */
    563      1.1  christos   LOONGARCH_HOWTO (R_LARCH_ADD8,		/* type (47).  */
    564      1.1  christos 	 0,					/* rightshift.  */
    565  1.1.1.2  christos 	 1,					/* size.  */
    566      1.1  christos 	 8,					/* bitsize.  */
    567      1.1  christos 	 false,					/* pc_relative.  */
    568      1.1  christos 	 0,					/* bitpos.  */
    569  1.1.1.2  christos 	 complain_overflow_dont,		/* complain_on_overflow.  */
    570  1.1.1.2  christos 	 loongarch_elf_add_sub_reloc,		/* special_function.  */
    571      1.1  christos 	 "R_LARCH_ADD8",			/* name.  */
    572      1.1  christos 	 false,					/* partial_inplace.  */
    573  1.1.1.2  christos 	 0,					/* src_mask.  */
    574  1.1.1.2  christos 	 0xff,					/* dst_mask.  */
    575  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
    576  1.1.1.2  christos 	 BFD_RELOC_LARCH_ADD8,			/* bfd_reloc_code_real_type.  */
    577  1.1.1.2  christos 	 NULL,					/* adjust_reloc_bits.  */
    578  1.1.1.2  christos 	 NULL),					/* larch_reloc_type_name.  */
    579      1.1  christos 
    580  1.1.1.2  christos   /* 16-bit in-place addition, for local label subtraction.  */
    581      1.1  christos   LOONGARCH_HOWTO (R_LARCH_ADD16,		/* type (48).  */
    582      1.1  christos 	 0,					/* rightshift.  */
    583  1.1.1.2  christos 	 2,					/* size.  */
    584      1.1  christos 	 16,					/* bitsize.  */
    585      1.1  christos 	 false,					/* pc_relative.  */
    586      1.1  christos 	 0,					/* bitpos.  */
    587  1.1.1.2  christos 	 complain_overflow_dont,		/* complain_on_overflow.  */
    588  1.1.1.2  christos 	 loongarch_elf_add_sub_reloc,		/* special_function.  */
    589      1.1  christos 	 "R_LARCH_ADD16",			/* name.  */
    590      1.1  christos 	 false,					/* partial_inplace.  */
    591  1.1.1.2  christos 	 0,					/* src_mask.  */
    592  1.1.1.2  christos 	 0xffff,				/* dst_mask.  */
    593  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
    594  1.1.1.2  christos 	 BFD_RELOC_LARCH_ADD16,			/* bfd_reloc_code_real_type.  */
    595  1.1.1.2  christos 	 NULL,					/* adjust_reloc_bits.  */
    596  1.1.1.2  christos 	 NULL),					/* larch_reloc_type_name.  */
    597      1.1  christos 
    598  1.1.1.2  christos   /* 24-bit in-place addition, for local label subtraction.  */
    599      1.1  christos   LOONGARCH_HOWTO (R_LARCH_ADD24,		/* type (49).  */
    600      1.1  christos 	 0,					/* rightshift.  */
    601  1.1.1.2  christos 	 3,					/* size.  */
    602      1.1  christos 	 24,					/* bitsize.  */
    603      1.1  christos 	 false,					/* pc_relative.  */
    604      1.1  christos 	 0,					/* bitpos.  */
    605  1.1.1.2  christos 	 complain_overflow_dont,		/* complain_on_overflow.  */
    606  1.1.1.2  christos 	 loongarch_elf_add_sub_reloc,		/* special_function.  */
    607      1.1  christos 	 "R_LARCH_ADD24",			/* name.  */
    608      1.1  christos 	 false,					/* partial_inplace.  */
    609  1.1.1.2  christos 	 0,					/* src_mask.  */
    610  1.1.1.2  christos 	 0xffffff,				/* dst_mask.  */
    611  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
    612  1.1.1.2  christos 	 BFD_RELOC_LARCH_ADD24,			/* bfd_reloc_code_real_type.  */
    613  1.1.1.2  christos 	 NULL,					/* adjust_reloc_bits.  */
    614  1.1.1.2  christos 	 NULL),					/* larch_reloc_type_name.  */
    615      1.1  christos 
    616  1.1.1.2  christos   /* 32-bit in-place addition, for local label subtraction.  */
    617      1.1  christos   LOONGARCH_HOWTO (R_LARCH_ADD32,		/* type (50).  */
    618      1.1  christos 	 0,					/* rightshift.  */
    619      1.1  christos 	 4,					/* size.  */
    620      1.1  christos 	 32,					/* bitsize.  */
    621      1.1  christos 	 false,					/* pc_relative.  */
    622      1.1  christos 	 0,					/* bitpos.  */
    623  1.1.1.2  christos 	 complain_overflow_dont,		/* complain_on_overflow.  */
    624  1.1.1.2  christos 	 loongarch_elf_add_sub_reloc,		/* special_function.  */
    625      1.1  christos 	 "R_LARCH_ADD32",			/* name.  */
    626      1.1  christos 	 false,					/* partial_inplace.  */
    627  1.1.1.2  christos 	 0,					/* src_mask.  */
    628  1.1.1.2  christos 	 0xffffffff,				/* dst_mask.  */
    629  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
    630  1.1.1.2  christos 	 BFD_RELOC_LARCH_ADD32,			/* bfd_reloc_code_real_type.  */
    631  1.1.1.2  christos 	 NULL,					/* adjust_reloc_bits.  */
    632  1.1.1.2  christos 	 NULL),					/* larch_reloc_type_name.  */
    633      1.1  christos 
    634  1.1.1.2  christos   /* 64-bit in-place addition, for local label subtraction.  */
    635      1.1  christos   LOONGARCH_HOWTO (R_LARCH_ADD64,		/* type (51).  */
    636      1.1  christos 	 0,					/* rightshift.  */
    637      1.1  christos 	 8,					/* size.  */
    638      1.1  christos 	 64,					/* bitsize.  */
    639      1.1  christos 	 false,					/* pc_relative.  */
    640      1.1  christos 	 0,					/* bitpos.  */
    641  1.1.1.2  christos 	 complain_overflow_dont,		/* complain_on_overflow.  */
    642  1.1.1.2  christos 	 loongarch_elf_add_sub_reloc,		/* special_function.  */
    643      1.1  christos 	 "R_LARCH_ADD64",			/* name.  */
    644      1.1  christos 	 false,					/* partial_inplace.  */
    645  1.1.1.2  christos 	 0,					/* src_mask.  */
    646  1.1.1.2  christos 	 ALL_ONES,				/* dst_mask.  */
    647  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
    648  1.1.1.2  christos 	 BFD_RELOC_LARCH_ADD64,			/* bfd_reloc_code_real_type.  */
    649  1.1.1.2  christos 	 NULL,					/* adjust_reloc_bits.  */
    650  1.1.1.2  christos 	 NULL),					/* larch_reloc_type_name.  */
    651      1.1  christos 
    652  1.1.1.2  christos   /* 8-bit in-place subtraction, for local label subtraction.  */
    653      1.1  christos   LOONGARCH_HOWTO (R_LARCH_SUB8,		/* type (52).  */
    654      1.1  christos 	 0,					/* rightshift.  */
    655  1.1.1.2  christos 	 1,					/* size.  */
    656      1.1  christos 	 8,					/* bitsize.  */
    657      1.1  christos 	 false,					/* pc_relative.  */
    658      1.1  christos 	 0,					/* bitpos.  */
    659  1.1.1.2  christos 	 complain_overflow_dont,		/* complain_on_overflow.  */
    660  1.1.1.2  christos 	 loongarch_elf_add_sub_reloc,		/* special_function.  */
    661      1.1  christos 	 "R_LARCH_SUB8",			/* name.  */
    662      1.1  christos 	 false,					/* partial_inplace.  */
    663  1.1.1.2  christos 	 0,					/* src_mask.  */
    664  1.1.1.2  christos 	 0xff,					/* dst_mask.  */
    665  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
    666  1.1.1.2  christos 	 BFD_RELOC_LARCH_SUB8,			/* bfd_reloc_code_real_type.  */
    667  1.1.1.2  christos 	 NULL,					/* adjust_reloc_bits.  */
    668  1.1.1.2  christos 	 NULL),					/* larch_reloc_type_name.  */
    669      1.1  christos 
    670  1.1.1.2  christos   /* 16-bit in-place subtraction, for local label subtraction.  */
    671      1.1  christos   LOONGARCH_HOWTO (R_LARCH_SUB16,		/* type (53).  */
    672      1.1  christos 	 0,					/* rightshift.  */
    673  1.1.1.2  christos 	 2,					/* size.  */
    674      1.1  christos 	 16,					/* bitsize.  */
    675      1.1  christos 	 false,					/* pc_relative.  */
    676      1.1  christos 	 0,					/* bitpos.  */
    677  1.1.1.2  christos 	 complain_overflow_dont,		/* complain_on_overflow.  */
    678  1.1.1.2  christos 	 loongarch_elf_add_sub_reloc,		/* special_function.  */
    679      1.1  christos 	 "R_LARCH_SUB16",			/* name.  */
    680      1.1  christos 	 false,					/* partial_inplace.  */
    681  1.1.1.2  christos 	 0,					/* src_mask.  */
    682  1.1.1.2  christos 	 0xffff,				/* dst_mask.  */
    683  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
    684  1.1.1.2  christos 	 BFD_RELOC_LARCH_SUB16,			/* bfd_reloc_code_real_type.  */
    685  1.1.1.2  christos 	 NULL,					/* adjust_reloc_bits.  */
    686  1.1.1.2  christos 	 NULL),					/* larch_reloc_type_name.  */
    687      1.1  christos 
    688  1.1.1.2  christos   /* 24-bit in-place subtraction, for local label subtraction.  */
    689      1.1  christos   LOONGARCH_HOWTO (R_LARCH_SUB24,		/* type (54).  */
    690      1.1  christos 	 0,					/* rightshift.  */
    691  1.1.1.2  christos 	 3,					/* size.  */
    692      1.1  christos 	 24,					/* bitsize.  */
    693      1.1  christos 	 false,					/* pc_relative.  */
    694      1.1  christos 	 0,					/* bitpos.  */
    695  1.1.1.2  christos 	 complain_overflow_dont,		/* complain_on_overflow.  */
    696  1.1.1.2  christos 	 loongarch_elf_add_sub_reloc,		/* special_function.  */
    697      1.1  christos 	 "R_LARCH_SUB24",			/* name.  */
    698      1.1  christos 	 false,					/* partial_inplace.  */
    699  1.1.1.2  christos 	 0,					/* src_mask.  */
    700  1.1.1.2  christos 	 0xffffff,				/* dst_mask.  */
    701  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
    702  1.1.1.2  christos 	 BFD_RELOC_LARCH_SUB24,			/* bfd_reloc_code_real_type.  */
    703  1.1.1.2  christos 	 NULL,					/* adjust_reloc_bits.  */
    704  1.1.1.2  christos 	 NULL),					/* larch_reloc_type_name.  */
    705      1.1  christos 
    706  1.1.1.2  christos   /* 32-bit in-place subtraction, for local label subtraction.  */
    707      1.1  christos   LOONGARCH_HOWTO (R_LARCH_SUB32,		/* type (55).  */
    708      1.1  christos 	 0,					/* rightshift.  */
    709      1.1  christos 	 4,					/* size.  */
    710      1.1  christos 	 32,					/* bitsize.  */
    711      1.1  christos 	 false,					/* pc_relative.  */
    712      1.1  christos 	 0,					/* bitpos.  */
    713  1.1.1.2  christos 	 complain_overflow_dont,		/* complain_on_overflow.  */
    714  1.1.1.2  christos 	 loongarch_elf_add_sub_reloc,		/* special_function.  */
    715      1.1  christos 	 "R_LARCH_SUB32",			/* name.  */
    716      1.1  christos 	 false,					/* partial_inplace.  */
    717  1.1.1.2  christos 	 0,					/* src_mask.  */
    718  1.1.1.2  christos 	 0xffffffff,				/* dst_mask.  */
    719  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
    720  1.1.1.2  christos 	 BFD_RELOC_LARCH_SUB32,			/* bfd_reloc_code_real_type.  */
    721  1.1.1.2  christos 	 NULL,					/* adjust_reloc_bits.  */
    722  1.1.1.2  christos 	 NULL),					/* larch_reloc_type_name.  */
    723      1.1  christos 
    724  1.1.1.2  christos   /* 64-bit in-place subtraction, for local label subtraction.  */
    725      1.1  christos   LOONGARCH_HOWTO (R_LARCH_SUB64,		/* type (56).  */
    726      1.1  christos 	 0,					/* rightshift.  */
    727      1.1  christos 	 8,					/* size.  */
    728      1.1  christos 	 64,					/* bitsize.  */
    729      1.1  christos 	 false,					/* pc_relative.  */
    730      1.1  christos 	 0,					/* bitpos.  */
    731  1.1.1.2  christos 	 complain_overflow_dont,		/* complain_on_overflow.  */
    732  1.1.1.2  christos 	 loongarch_elf_add_sub_reloc,		/* special_function.  */
    733      1.1  christos 	 "R_LARCH_SUB64",			/* name.  */
    734      1.1  christos 	 false,					/* partial_inplace.  */
    735  1.1.1.2  christos 	 0,					/* src_mask.  */
    736  1.1.1.2  christos 	 ALL_ONES,				/* dst_mask.  */
    737  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
    738  1.1.1.2  christos 	 BFD_RELOC_LARCH_SUB64,			/* bfd_reloc_code_real_type.  */
    739  1.1.1.2  christos 	 NULL,					/* adjust_reloc_bits.  */
    740  1.1.1.2  christos 	 NULL),					/* larch_reloc_type_name.  */
    741      1.1  christos 
    742      1.1  christos   LOONGARCH_HOWTO (R_LARCH_GNU_VTINHERIT,	/* type (57).  */
    743      1.1  christos 	 0,					/* rightshift.  */
    744      1.1  christos 	 0,					/* size.  */
    745      1.1  christos 	 0,					/* bitsize.  */
    746      1.1  christos 	 false,					/* pc_relative.  */
    747      1.1  christos 	 0,					/* bitpos.  */
    748      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
    749      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
    750      1.1  christos 	 "R_LARCH_GNU_VTINHERIT",		/* name.  */
    751      1.1  christos 	 false,					/* partial_inplace.  */
    752      1.1  christos 	 0,					/* src_mask */
    753      1.1  christos 	 0,					/* dst_mask */
    754      1.1  christos 	 false,					/* pcrel_offset */
    755      1.1  christos 	 BFD_RELOC_NONE,			/* bfd_reloc_code_real_type */
    756      1.1  christos 	 NULL,					/* adjust_reloc_bits */
    757      1.1  christos 	 NULL),					/* larch_reloc_type_name */
    758      1.1  christos 
    759      1.1  christos   LOONGARCH_HOWTO (R_LARCH_GNU_VTENTRY,		/* type (58).  */
    760      1.1  christos 	 0,					/* rightshift.  */
    761      1.1  christos 	 0,					/* size.  */
    762      1.1  christos 	 0,					/* bitsize.  */
    763      1.1  christos 	 false,					/* pc_relative.  */
    764      1.1  christos 	 0,					/* bitpos.  */
    765      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
    766      1.1  christos 	 NULL,					/* special_function.  */
    767      1.1  christos 	 "R_LARCH_GNU_VTENTRY",			/* name.  */
    768      1.1  christos 	 false,					/* partial_inplace.  */
    769      1.1  christos 	 0,					/* src_mask */
    770      1.1  christos 	 0,					/* dst_mask */
    771      1.1  christos 	 false,					/* pcrel_offset */
    772      1.1  christos 	 BFD_RELOC_NONE,			/* bfd_reloc_code_real_type */
    773      1.1  christos 	 NULL,					/* adjust_reloc_bits */
    774      1.1  christos 	 NULL),					/* larch_reloc_type_name */
    775      1.1  christos 
    776      1.1  christos   LOONGARCH_EMPTY_HOWTO (59),
    777      1.1  christos   LOONGARCH_EMPTY_HOWTO (60),
    778      1.1  christos   LOONGARCH_EMPTY_HOWTO (61),
    779      1.1  christos   LOONGARCH_EMPTY_HOWTO (62),
    780      1.1  christos   LOONGARCH_EMPTY_HOWTO (63),
    781      1.1  christos 
    782      1.1  christos   /* New reloc types.  */
    783      1.1  christos   LOONGARCH_HOWTO (R_LARCH_B16,			/* type (64).  */
    784      1.1  christos 	 2,					/* rightshift.  */
    785      1.1  christos 	 4,					/* size.  */
    786      1.1  christos 	 16,					/* bitsize.  */
    787      1.1  christos 	 false,					/* pc_relative.  */
    788      1.1  christos 	 10,					/* bitpos.  */
    789      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
    790      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
    791      1.1  christos 	 "R_LARCH_B16",				/* name.  */
    792      1.1  christos 	 false,					/* partial_inplace.  */
    793  1.1.1.2  christos 	 0,					/* src_mask.  */
    794  1.1.1.2  christos 	 0x3fffc00,				/* dst_mask.  */
    795  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
    796  1.1.1.2  christos 	 BFD_RELOC_LARCH_B16,			/* bfd_reloc_code_real_type.  */
    797  1.1.1.2  christos 	 reloc_sign_bits,			/* adjust_reloc_bits.  */
    798  1.1.1.2  christos 	 "b16"),				/* larch_reloc_type_name.  */
    799      1.1  christos 
    800      1.1  christos   LOONGARCH_HOWTO (R_LARCH_B21,			/* type (65).  */
    801      1.1  christos 	 2,					/* rightshift.  */
    802      1.1  christos 	 4,					/* size.  */
    803      1.1  christos 	 21,					/* bitsize.  */
    804      1.1  christos 	 false,					/* pc_relative.  */
    805      1.1  christos 	 0,					/* bitpos.  */
    806      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
    807      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
    808      1.1  christos 	 "R_LARCH_B21",				/* name.  */
    809      1.1  christos 	 false,					/* partial_inplace.  */
    810  1.1.1.2  christos 	 0,					/* src_mask.  */
    811  1.1.1.2  christos 	 0x3fffc1f,				/* dst_mask.  */
    812  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
    813  1.1.1.2  christos 	 BFD_RELOC_LARCH_B21,			/* bfd_reloc_code_real_type.  */
    814  1.1.1.2  christos 	 reloc_sign_bits,			/* adjust_reloc_bits.  */
    815  1.1.1.2  christos 	 "b21"),				/* larch_reloc_type_name.  */
    816      1.1  christos 
    817      1.1  christos   LOONGARCH_HOWTO (R_LARCH_B26,			/* type (66).  */
    818      1.1  christos 	 2,					/* rightshift.  */
    819      1.1  christos 	 4,					/* size.  */
    820      1.1  christos 	 26,					/* bitsize.  */
    821      1.1  christos 	 false,					/* pc_relative.  */
    822      1.1  christos 	 0,					/* bitpos.  */
    823      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
    824      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
    825      1.1  christos 	 "R_LARCH_B26",				/* name.  */
    826      1.1  christos 	 false,					/* partial_inplace.  */
    827  1.1.1.2  christos 	 0,					/* src_mask.  */
    828  1.1.1.2  christos 	 0x03ffffff,				/* dst_mask.  */
    829  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
    830  1.1.1.2  christos 	 BFD_RELOC_LARCH_B26,			/* bfd_reloc_code_real_type.  */
    831  1.1.1.2  christos 	 reloc_sign_bits,			/* adjust_reloc_bits.  */
    832  1.1.1.2  christos 	 "b26"),				/* larch_reloc_type_name.  */
    833      1.1  christos 
    834      1.1  christos   LOONGARCH_HOWTO (R_LARCH_ABS_HI20,		/* type (67).  */
    835      1.1  christos 	 12,					/* rightshift.  */
    836      1.1  christos 	 4,					/* size.  */
    837      1.1  christos 	 20,					/* bitsize.  */
    838      1.1  christos 	 false,					/* pc_relative.  */
    839      1.1  christos 	 5,					/* bitpos.  */
    840      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
    841      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
    842      1.1  christos 	 "R_LARCH_ABS_HI20",			/* name.  */
    843      1.1  christos 	 false,					/* partial_inplace.  */
    844      1.1  christos 	 0,					/* src_mask */
    845      1.1  christos 	 0x1ffffe0,				/* dst_mask */
    846      1.1  christos 	 false,					/* pcrel_offset */
    847      1.1  christos 	 BFD_RELOC_LARCH_ABS_HI20,		/* bfd_reloc_code_real_type */
    848      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
    849      1.1  christos 	 "abs_hi20"),				/* larch_reloc_type_name */
    850      1.1  christos 
    851      1.1  christos   LOONGARCH_HOWTO (R_LARCH_ABS_LO12,		/* type (68).  */
    852      1.1  christos 	 0,					/* rightshift.  */
    853      1.1  christos 	 4,					/* size.  */
    854      1.1  christos 	 12,					/* bitsize.  */
    855      1.1  christos 	 false,					/* pc_relative.  */
    856      1.1  christos 	 10,					/* bitpos.  */
    857      1.1  christos 	 complain_overflow_unsigned,		/* complain_on_overflow.  */
    858      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
    859      1.1  christos 	 "R_LARCH_ABS_LO12",			/* name.  */
    860      1.1  christos 	 false,					/* partial_inplace.  */
    861      1.1  christos 	 0,					/* src_mask */
    862      1.1  christos 	 0x3ffc00,				/* dst_mask */
    863      1.1  christos 	 false,					/* pcrel_offset */
    864      1.1  christos 	 BFD_RELOC_LARCH_ABS_LO12,		/* bfd_reloc_code_real_type */
    865      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
    866      1.1  christos 	 "abs_lo12"),				/* larch_reloc_type_name */
    867      1.1  christos 
    868      1.1  christos   LOONGARCH_HOWTO (R_LARCH_ABS64_LO20,		/* type (69).  */
    869      1.1  christos 	 32,					/* rightshift.  */
    870      1.1  christos 	 4,					/* size.  */
    871      1.1  christos 	 20,					/* bitsize.  */
    872      1.1  christos 	 false,					/* pc_relative.  */
    873      1.1  christos 	 5,					/* bitpos.  */
    874      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
    875      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
    876      1.1  christos 	 "R_LARCH_ABS64_LO20",			/* name.  */
    877      1.1  christos 	 false,					/* partial_inplace.  */
    878      1.1  christos 	 0,					/* src_mask */
    879      1.1  christos 	 0x1ffffe0,				/* dst_mask */
    880      1.1  christos 	 false,					/* pcrel_offset */
    881      1.1  christos 	 BFD_RELOC_LARCH_ABS64_LO20,		/* bfd_reloc_code_real_type */
    882      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
    883      1.1  christos 	 "abs64_lo20"),				/* larch_reloc_type_name */
    884      1.1  christos 
    885      1.1  christos   LOONGARCH_HOWTO (R_LARCH_ABS64_HI12,		/* type (70).  */
    886      1.1  christos 	 52,					/* rightshift.  */
    887      1.1  christos 	 4,					/* size.  */
    888      1.1  christos 	 12,					/* bitsize.  */
    889      1.1  christos 	 false,					/* pc_relative.  */
    890      1.1  christos 	 10,					/* bitpos.  */
    891      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
    892      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
    893      1.1  christos 	 "R_LARCH_ABS64_HI12",			/* name.  */
    894      1.1  christos 	 false,					/* partial_inplace.  */
    895      1.1  christos 	 0,					/* src_mask */
    896      1.1  christos 	 0x3ffc00,				/* dst_mask */
    897      1.1  christos 	 false,					/* pcrel_offset */
    898      1.1  christos 	 BFD_RELOC_LARCH_ABS64_HI12,		/* bfd_reloc_code_real_type */
    899      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
    900      1.1  christos 	 "abs64_hi12"),				/* larch_reloc_type_name */
    901      1.1  christos 
    902      1.1  christos   LOONGARCH_HOWTO (R_LARCH_PCALA_HI20,		/* type (71).  */
    903      1.1  christos 	 12,					/* rightshift.  */
    904      1.1  christos 	 4,					/* size.  */
    905      1.1  christos 	 20,					/* bitsize.  */
    906      1.1  christos 	 false,					/* pc_relative.  */
    907      1.1  christos 	 5,					/* bitpos.  */
    908      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
    909      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
    910      1.1  christos 	 "R_LARCH_PCALA_HI20",			/* name.  */
    911      1.1  christos 	 false,					/* partial_inplace.  */
    912      1.1  christos 	 0,					/* src_mask */
    913      1.1  christos 	 0x1ffffe0,				/* dst_mask */
    914      1.1  christos 	 false,					/* pcrel_offset */
    915      1.1  christos 	 BFD_RELOC_LARCH_PCALA_HI20,		/* bfd_reloc_code_real_type */
    916      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
    917      1.1  christos 	 "pc_hi20"),				/* larch_reloc_type_name */
    918      1.1  christos 
    919      1.1  christos   LOONGARCH_HOWTO (R_LARCH_PCALA_LO12,		/* type (72).  */
    920      1.1  christos 	 0,					/* rightshift.  */
    921      1.1  christos 	 4,					/* size.  */
    922      1.1  christos 	 12,					/* bitsize.  */
    923      1.1  christos 	 false,					/* pc_relative.  */
    924      1.1  christos 	 10,					/* bitpos.  */
    925      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
    926      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
    927      1.1  christos 	 "R_LARCH_PCALA_LO12",			/* name.  */
    928      1.1  christos 	 false,					/* partial_inplace.  */
    929      1.1  christos 	 0,					/* src_mask */
    930      1.1  christos 	 0x3ffc00,				/* dst_mask */
    931      1.1  christos 	 false,					/* pcrel_offset */
    932      1.1  christos 	 BFD_RELOC_LARCH_PCALA_LO12,		/* bfd_reloc_code_real_type */
    933      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
    934      1.1  christos 	 "pc_lo12"),				/* larch_reloc_type_name */
    935      1.1  christos 
    936      1.1  christos   LOONGARCH_HOWTO (R_LARCH_PCALA64_LO20,	/* type (73).  */
    937      1.1  christos 	 32,					/* rightshift.  */
    938      1.1  christos 	 4,					/* size.  */
    939      1.1  christos 	 20,					/* bitsize.  */
    940      1.1  christos 	 false,					/* pc_relative.  */
    941      1.1  christos 	 5,					/* bitpos.  */
    942      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
    943      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
    944      1.1  christos 	 "R_LARCH_PCALA64_LO20",		/* name.  */
    945      1.1  christos 	 false,					/* partial_inplace.  */
    946      1.1  christos 	 0,					/* src_mask */
    947      1.1  christos 	 0x1ffffe0,				/* dst_mask */
    948      1.1  christos 	 false,					/* pcrel_offset */
    949      1.1  christos 	 BFD_RELOC_LARCH_PCALA64_LO20,		/* bfd_reloc_code_real_type */
    950      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
    951      1.1  christos 	 "pc64_lo20"),				/* larch_reloc_type_name */
    952      1.1  christos 
    953      1.1  christos   LOONGARCH_HOWTO (R_LARCH_PCALA64_HI12,	/* type (74).  */
    954      1.1  christos 	 52,					/* rightshift.  */
    955      1.1  christos 	 4,					/* size.  */
    956      1.1  christos 	 12,					/* bitsize.  */
    957      1.1  christos 	 false,					/* pc_relative.  */
    958      1.1  christos 	 10,					/* bitpos.  */
    959      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
    960      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
    961      1.1  christos 	 "R_LARCH_PCALA64_HI12",		/* name.  */
    962      1.1  christos 	 false,					/* partial_inplace.  */
    963      1.1  christos 	 0,					/* src_mask */
    964      1.1  christos 	 0x3ffc00,				/* dst_mask */
    965      1.1  christos 	 false,					/* pcrel_offset */
    966      1.1  christos 	 BFD_RELOC_LARCH_PCALA64_HI12,		/* bfd_reloc_code_real_type */
    967      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
    968      1.1  christos 	 "pc64_hi12"),				/* larch_reloc_type_name */
    969      1.1  christos 
    970      1.1  christos   LOONGARCH_HOWTO (R_LARCH_GOT_PC_HI20,		/* type (75).  */
    971      1.1  christos 	 12,					/* rightshift.  */
    972      1.1  christos 	 4,					/* size.  */
    973      1.1  christos 	 20,					/* bitsize.  */
    974      1.1  christos 	 false,					/* pc_relative.  */
    975      1.1  christos 	 5,					/* bitpos.  */
    976      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
    977      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
    978      1.1  christos 	 "R_LARCH_GOT_PC_HI20",			/* name.  */
    979      1.1  christos 	 false,					/* partial_inplace.  */
    980      1.1  christos 	 0,					/* src_mask */
    981      1.1  christos 	 0x1ffffe0,				/* dst_mask */
    982      1.1  christos 	 false,					/* pcrel_offset */
    983      1.1  christos 	 BFD_RELOC_LARCH_GOT_PC_HI20,		/* bfd_reloc_code_real_type */
    984      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
    985      1.1  christos 	 "got_pc_hi20"),			/* larch_reloc_type_name */
    986      1.1  christos 
    987      1.1  christos   LOONGARCH_HOWTO (R_LARCH_GOT_PC_LO12,		/* type (76).  */
    988      1.1  christos 	 0,					/* rightshift.  */
    989      1.1  christos 	 4,					/* size.  */
    990      1.1  christos 	 12,					/* bitsize.  */
    991      1.1  christos 	 false,					/* pc_relative.  */
    992      1.1  christos 	 10,					/* bitpos.  */
    993      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
    994      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
    995      1.1  christos 	 "R_LARCH_GOT_PC_LO12",			/* name.  */
    996      1.1  christos 	 false,					/* partial_inplace.  */
    997      1.1  christos 	 0,					/* src_mask */
    998      1.1  christos 	 0x3ffc00,				/* dst_mask */
    999      1.1  christos 	 false,					/* pcrel_offset */
   1000      1.1  christos 	 BFD_RELOC_LARCH_GOT_PC_LO12,		/* bfd_reloc_code_real_type */
   1001      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
   1002      1.1  christos 	 "got_pc_lo12"),			/* larch_reloc_type_name */
   1003      1.1  christos 
   1004      1.1  christos   LOONGARCH_HOWTO (R_LARCH_GOT64_PC_LO20,	/* type (77).  */
   1005      1.1  christos 	 32,					/* rightshift.  */
   1006      1.1  christos 	 4,					/* size.  */
   1007      1.1  christos 	 20,					/* bitsize.  */
   1008      1.1  christos 	 false,					/* pc_relative.  */
   1009      1.1  christos 	 5,					/* bitpos.  */
   1010      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1011      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1012      1.1  christos 	 "R_LARCH_GOT64_PC_LO20",		/* name.  */
   1013      1.1  christos 	 false,					/* partial_inplace.  */
   1014      1.1  christos 	 0,					/* src_mask */
   1015      1.1  christos 	 0x1ffffe0,				/* dst_mask */
   1016      1.1  christos 	 false,					/* pcrel_offset */
   1017      1.1  christos 	 BFD_RELOC_LARCH_GOT64_PC_LO20,		/* bfd_reloc_code_real_type */
   1018      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
   1019      1.1  christos 	 "got64_pc_lo20"),			/* larch_reloc_type_name */
   1020      1.1  christos 
   1021      1.1  christos   LOONGARCH_HOWTO (R_LARCH_GOT64_PC_HI12,	/* type (78).  */
   1022      1.1  christos 	 52,					/* rightshift.  */
   1023      1.1  christos 	 4,					/* size.  */
   1024      1.1  christos 	 12,					/* bitsize.  */
   1025      1.1  christos 	 false,					/* pc_relative.  */
   1026      1.1  christos 	 10,					/* bitpos.  */
   1027      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1028      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1029      1.1  christos 	 "R_LARCH_GOT64_PC_HI12",		/* name.  */
   1030      1.1  christos 	 false,					/* partial_inplace.  */
   1031      1.1  christos 	 0,					/* src_mask */
   1032      1.1  christos 	 0x3ffc00,				/* dst_mask */
   1033      1.1  christos 	 false,					/* pcrel_offset */
   1034      1.1  christos 	 BFD_RELOC_LARCH_GOT64_PC_HI12,		/* bfd_reloc_code_real_type */
   1035      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
   1036      1.1  christos 	 "got64_pc_hi12"),			/* larch_reloc_type_name */
   1037      1.1  christos 
   1038      1.1  christos   LOONGARCH_HOWTO (R_LARCH_GOT_HI20,		/* type (79).  */
   1039      1.1  christos 	 12,					/* rightshift.  */
   1040      1.1  christos 	 4,					/* size.  */
   1041      1.1  christos 	 20,					/* bitsize.  */
   1042      1.1  christos 	 false,					/* pc_relative.  */
   1043      1.1  christos 	 5,					/* bitpos.  */
   1044      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1045      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1046      1.1  christos 	 "R_LARCH_GOT_HI20",			/* name.  */
   1047      1.1  christos 	 false,					/* partial_inplace.  */
   1048      1.1  christos 	 0,					/* src_mask */
   1049      1.1  christos 	 0x1ffffe0,				/* dst_mask */
   1050      1.1  christos 	 false,					/* pcrel_offset */
   1051      1.1  christos 	 BFD_RELOC_LARCH_GOT_HI20,		/* bfd_reloc_code_real_type */
   1052      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
   1053      1.1  christos 	 "got_hi20"),				/* larch_reloc_type_name */
   1054      1.1  christos 
   1055      1.1  christos   LOONGARCH_HOWTO (R_LARCH_GOT_LO12,		/* type (80).  */
   1056      1.1  christos 	 0,					/* rightshift.  */
   1057      1.1  christos 	 4,					/* size.  */
   1058      1.1  christos 	 12,					/* bitsize.  */
   1059      1.1  christos 	 false,					/* pc_relative.  */
   1060      1.1  christos 	 10,					/* bitpos.  */
   1061      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1062      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1063      1.1  christos 	 "R_LARCH_GOT_LO12",			/* name.  */
   1064      1.1  christos 	 false,					/* partial_inplace.  */
   1065      1.1  christos 	 0,					/* src_mask */
   1066      1.1  christos 	 0x3ffc00,				/* dst_mask */
   1067      1.1  christos 	 false,					/* pcrel_offset */
   1068      1.1  christos 	 BFD_RELOC_LARCH_GOT_LO12,		/* bfd_reloc_code_real_type */
   1069      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
   1070      1.1  christos 	 "got_lo12"),				/* larch_reloc_type_name */
   1071      1.1  christos 
   1072      1.1  christos   LOONGARCH_HOWTO (R_LARCH_GOT64_LO20,		/* type (81).  */
   1073      1.1  christos 	 32,					/* rightshift.  */
   1074      1.1  christos 	 4,					/* size.  */
   1075      1.1  christos 	 20,					/* bitsize.  */
   1076      1.1  christos 	 false,					/* pc_relative.  */
   1077      1.1  christos 	 5,					/* bitpos.  */
   1078      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1079      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1080      1.1  christos 	 "R_LARCH_GOT64_LO20",			/* name.  */
   1081      1.1  christos 	 false,					/* partial_inplace.  */
   1082      1.1  christos 	 0,					/* src_mask */
   1083      1.1  christos 	 0x1ffffe0,				/* dst_mask */
   1084      1.1  christos 	 false,					/* pcrel_offset */
   1085      1.1  christos 	 BFD_RELOC_LARCH_GOT64_LO20,		/* bfd_reloc_code_real_type */
   1086      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
   1087      1.1  christos 	 "got64_lo20"),				/* larch_reloc_type_name */
   1088      1.1  christos 
   1089      1.1  christos   LOONGARCH_HOWTO (R_LARCH_GOT64_HI12,		/* type (82).  */
   1090      1.1  christos 	 52,					/* rightshift.  */
   1091      1.1  christos 	 4,					/* size.  */
   1092      1.1  christos 	 12,					/* bitsize.  */
   1093      1.1  christos 	 false,					/* pc_relative.  */
   1094      1.1  christos 	 10,					/* bitpos.  */
   1095      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1096      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1097      1.1  christos 	 "R_LARCH_GOT64_HI12",			/* name.  */
   1098      1.1  christos 	 false,					/* partial_inplace.  */
   1099      1.1  christos 	 0,					/* src_mask */
   1100      1.1  christos 	 0x3ffc00,				/* dst_mask */
   1101      1.1  christos 	 false,					/* pcrel_offset */
   1102      1.1  christos 	 BFD_RELOC_LARCH_GOT64_HI12,		/* bfd_reloc_code_real_type */
   1103      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
   1104      1.1  christos 	 "got64_hi12"),				/* larch_reloc_type_name */
   1105      1.1  christos 
   1106      1.1  christos   LOONGARCH_HOWTO (R_LARCH_TLS_LE_HI20,		/* type (83).  */
   1107      1.1  christos 	 12,					/* rightshift.  */
   1108      1.1  christos 	 4,					/* size.  */
   1109      1.1  christos 	 20,					/* bitsize.  */
   1110      1.1  christos 	 false,					/* pc_relative.  */
   1111      1.1  christos 	 5,					/* bitpos.  */
   1112      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1113      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1114      1.1  christos 	 "R_LARCH_TLS_LE_HI20",			/* name.  */
   1115      1.1  christos 	 false,					/* partial_inplace.  */
   1116      1.1  christos 	 0,					/* src_mask */
   1117      1.1  christos 	 0x1ffffe0,				/* dst_mask */
   1118      1.1  christos 	 false,					/* pcrel_offset */
   1119      1.1  christos 	 BFD_RELOC_LARCH_TLS_LE_HI20,		/* bfd_reloc_code_real_type */
   1120      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
   1121      1.1  christos 	 "le_hi20"),				/* larch_reloc_type_name */
   1122      1.1  christos 
   1123      1.1  christos   LOONGARCH_HOWTO (R_LARCH_TLS_LE_LO12,		/* type (84).  */
   1124      1.1  christos 	 0,					/* rightshift.  */
   1125      1.1  christos 	 4,					/* size.  */
   1126      1.1  christos 	 12,					/* bitsize.  */
   1127      1.1  christos 	 false,					/* pc_relative.  */
   1128      1.1  christos 	 10,					/* bitpos.  */
   1129  1.1.1.2  christos 	 complain_overflow_unsigned,		/* complain_on_overflow.  */
   1130      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1131      1.1  christos 	 "R_LARCH_TLS_LE_LO12",			/* name.  */
   1132      1.1  christos 	 false,					/* partial_inplace.  */
   1133      1.1  christos 	 0,					/* src_mask */
   1134      1.1  christos 	 0x3ffc00,				/* dst_mask */
   1135      1.1  christos 	 false,					/* pcrel_offset */
   1136      1.1  christos 	 BFD_RELOC_LARCH_TLS_LE_LO12,		/* bfd_reloc_code_real_type */
   1137      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
   1138      1.1  christos 	 "le_lo12"),				/* larch_reloc_type_name */
   1139      1.1  christos 
   1140      1.1  christos   LOONGARCH_HOWTO (R_LARCH_TLS_LE64_LO20,	/* type (85).  */
   1141      1.1  christos 	 32,					/* rightshift.  */
   1142      1.1  christos 	 4,					/* size.  */
   1143      1.1  christos 	 20,					/* bitsize.  */
   1144      1.1  christos 	 false,					/* pc_relative.  */
   1145      1.1  christos 	 5,					/* bitpos.  */
   1146      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1147      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1148      1.1  christos 	 "R_LARCH_TLS_LE64_LO20",		/* name.  */
   1149      1.1  christos 	 false,					/* partial_inplace.  */
   1150      1.1  christos 	 0,					/* src_mask */
   1151      1.1  christos 	 0x1ffffe0,				/* dst_mask */
   1152      1.1  christos 	 false,					/* pcrel_offset */
   1153      1.1  christos 	 BFD_RELOC_LARCH_TLS_LE64_LO20,		/* bfd_reloc_code_real_type */
   1154      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
   1155      1.1  christos 	 "le64_lo20"),				/* larch_reloc_type_name */
   1156      1.1  christos 
   1157      1.1  christos   LOONGARCH_HOWTO (R_LARCH_TLS_LE64_HI12,	/* type (86).  */
   1158      1.1  christos 	 52,					/* rightshift.  */
   1159      1.1  christos 	 4,					/* size.  */
   1160      1.1  christos 	 12,					/* bitsize.  */
   1161      1.1  christos 	 false,					/* pc_relative.  */
   1162      1.1  christos 	 10,					/* bitpos.  */
   1163      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1164      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1165      1.1  christos 	 "R_LARCH_TLS_LE64_HI12",		/* name.  */
   1166      1.1  christos 	 false,					/* partial_inplace.  */
   1167      1.1  christos 	 0,					/* src_mask */
   1168      1.1  christos 	 0x3ffc00,				/* dst_mask */
   1169      1.1  christos 	 false,					/* pcrel_offset */
   1170      1.1  christos 	 BFD_RELOC_LARCH_TLS_LE64_HI12,		/* bfd_reloc_code_real_type */
   1171      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
   1172      1.1  christos 	 "le64_hi12"),				/* larch_reloc_type_name */
   1173      1.1  christos 
   1174      1.1  christos   LOONGARCH_HOWTO (R_LARCH_TLS_IE_PC_HI20,	/* type (87).  */
   1175      1.1  christos 	 12,					/* rightshift.  */
   1176      1.1  christos 	 4,					/* size.  */
   1177      1.1  christos 	 20,					/* bitsize.  */
   1178      1.1  christos 	 false,					/* pc_relative.  */
   1179      1.1  christos 	 5,					/* bitpos.  */
   1180      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1181      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1182      1.1  christos 	 "R_LARCH_TLS_IE_PC_HI20",		/* name.  */
   1183      1.1  christos 	 false,					/* partial_inplace.  */
   1184      1.1  christos 	 0,					/* src_mask */
   1185      1.1  christos 	 0x1ffffe0,				/* dst_mask */
   1186      1.1  christos 	 false,					/* pcrel_offset */
   1187      1.1  christos 	 BFD_RELOC_LARCH_TLS_IE_PC_HI20,	/* bfd_reloc_code_real_type */
   1188      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
   1189      1.1  christos 	 "ie_pc_hi20"),				/* larch_reloc_type_name */
   1190      1.1  christos 
   1191      1.1  christos   LOONGARCH_HOWTO (R_LARCH_TLS_IE_PC_LO12,	/* type (88).  */
   1192      1.1  christos 	 0,					/* rightshift.  */
   1193      1.1  christos 	 4,					/* size.  */
   1194      1.1  christos 	 12,					/* bitsize.  */
   1195      1.1  christos 	 false,					/* pc_relative.  */
   1196      1.1  christos 	 10,					/* bitpos.  */
   1197  1.1.1.2  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1198      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1199      1.1  christos 	 "R_LARCH_TLS_IE_PC_LO12",		/* name.  */
   1200      1.1  christos 	 false,					/* partial_inplace.  */
   1201      1.1  christos 	 0,					/* src_mask */
   1202      1.1  christos 	 0x3ffc00,				/* dst_mask */
   1203      1.1  christos 	 false,					/* pcrel_offset */
   1204      1.1  christos 	 BFD_RELOC_LARCH_TLS_IE_PC_LO12,	/* bfd_reloc_code_real_type */
   1205      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
   1206      1.1  christos 	 "ie_pc_lo12"),				/* larch_reloc_type_name */
   1207      1.1  christos 
   1208      1.1  christos   LOONGARCH_HOWTO (R_LARCH_TLS_IE64_PC_LO20,	/* type (89).  */
   1209      1.1  christos 	 32,					/* rightshift.  */
   1210      1.1  christos 	 4,					/* size.  */
   1211      1.1  christos 	 20,					/* bitsize.  */
   1212      1.1  christos 	 false,					/* pc_relative.  */
   1213      1.1  christos 	 5,					/* bitpos.  */
   1214      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1215      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1216      1.1  christos 	 "R_LARCH_TLS_IE64_PC_LO20",		/* name.  */
   1217      1.1  christos 	 false,					/* partial_inplace.  */
   1218      1.1  christos 	 0,					/* src_mask */
   1219      1.1  christos 	 0x1ffffe0,				/* dst_mask */
   1220      1.1  christos 	 false,					/* pcrel_offset */
   1221      1.1  christos 	 BFD_RELOC_LARCH_TLS_IE64_PC_LO20,	/* bfd_reloc_code_real_type */
   1222      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
   1223      1.1  christos 	 "ie64_pc_lo20"),			/* larch_reloc_type_name */
   1224      1.1  christos 
   1225      1.1  christos   LOONGARCH_HOWTO (R_LARCH_TLS_IE64_PC_HI12,	/* type (90).  */
   1226      1.1  christos 	 52,					/* rightshift.  */
   1227      1.1  christos 	 4,					/* size.  */
   1228      1.1  christos 	 12,					/* bitsize.  */
   1229      1.1  christos 	 false,					/* pc_relative.  */
   1230      1.1  christos 	 10,					/* bitpos.  */
   1231      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1232      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1233      1.1  christos 	 "R_LARCH_TLS_IE64_PC_HI12",		/* name.  */
   1234      1.1  christos 	 false,					/* partial_inplace.  */
   1235      1.1  christos 	 0,					/* src_mask */
   1236      1.1  christos 	 0x3ffc00,				/* dst_mask */
   1237      1.1  christos 	 false,					/* pcrel_offset */
   1238      1.1  christos 	 BFD_RELOC_LARCH_TLS_IE64_PC_HI12,	/* bfd_reloc_code_real_type */
   1239      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
   1240      1.1  christos 	 "ie64_pc_hi12"),			/* larch_reloc_type_name */
   1241      1.1  christos 
   1242  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_TLS_IE_HI20,		/* type (91).  */
   1243      1.1  christos 	 12,					/* rightshift.  */
   1244      1.1  christos 	 4,					/* size.  */
   1245      1.1  christos 	 20,					/* bitsize.  */
   1246      1.1  christos 	 false,					/* pc_relative.  */
   1247      1.1  christos 	 5,					/* bitpos.  */
   1248      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1249      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1250      1.1  christos 	 "R_LARCH_TLS_IE_HI20",			/* name.  */
   1251      1.1  christos 	 false,					/* partial_inplace.  */
   1252      1.1  christos 	 0,					/* src_mask */
   1253      1.1  christos 	 0x1ffffe0,				/* dst_mask */
   1254      1.1  christos 	 false,					/* pcrel_offset */
   1255      1.1  christos 	 BFD_RELOC_LARCH_TLS_IE_HI20,		/* bfd_reloc_code_real_type */
   1256      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
   1257      1.1  christos 	 "ie_hi20"),				/* larch_reloc_type_name */
   1258      1.1  christos 
   1259      1.1  christos   LOONGARCH_HOWTO (R_LARCH_TLS_IE_LO12,		/* type (92).  */
   1260      1.1  christos 	 0,					/* rightshift.  */
   1261      1.1  christos 	 4,					/* size.  */
   1262      1.1  christos 	 12,					/* bitsize.  */
   1263      1.1  christos 	 false,					/* pc_relative.  */
   1264      1.1  christos 	 10,					/* bitpos.  */
   1265      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1266      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1267      1.1  christos 	 "R_LARCH_TLS_IE_LO12",			/* name.  */
   1268      1.1  christos 	 false,					/* partial_inplace.  */
   1269      1.1  christos 	 0,					/* src_mask */
   1270      1.1  christos 	 0x3ffc00,				/* dst_mask */
   1271      1.1  christos 	 false,					/* pcrel_offset */
   1272      1.1  christos 	 BFD_RELOC_LARCH_TLS_IE_LO12,		/* bfd_reloc_code_real_type */
   1273      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
   1274      1.1  christos 	 "ie_lo12"),				/* larch_reloc_type_name */
   1275      1.1  christos 
   1276      1.1  christos   LOONGARCH_HOWTO (R_LARCH_TLS_IE64_LO20,	/* type (93).  */
   1277      1.1  christos 	 32,					/* rightshift.  */
   1278      1.1  christos 	 4,					/* size.  */
   1279      1.1  christos 	 20,					/* bitsize.  */
   1280      1.1  christos 	 false,					/* pc_relative.  */
   1281      1.1  christos 	 5,					/* bitpos.  */
   1282      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1283      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1284      1.1  christos 	 "R_LARCH_TLS_IE64_LO20",		/* name.  */
   1285      1.1  christos 	 false,					/* partial_inplace.  */
   1286      1.1  christos 	 0,					/* src_mask */
   1287      1.1  christos 	 0x1ffffe0,				/* dst_mask */
   1288      1.1  christos 	 false,					/* pcrel_offset */
   1289      1.1  christos 	 BFD_RELOC_LARCH_TLS_IE64_LO20,		/* bfd_reloc_code_real_type */
   1290      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
   1291      1.1  christos 	 "ie64_lo20"),				/* larch_reloc_type_name */
   1292      1.1  christos 
   1293      1.1  christos   LOONGARCH_HOWTO (R_LARCH_TLS_IE64_HI12,	/* type (94).  */
   1294      1.1  christos 	 52,					/* rightshift.  */
   1295      1.1  christos 	 4,					/* size.  */
   1296      1.1  christos 	 12,					/* bitsize.  */
   1297      1.1  christos 	 false,					/* pc_relative.  */
   1298      1.1  christos 	 10,					/* bitpos.  */
   1299      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1300      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1301      1.1  christos 	 "R_LARCH_TLS_IE64_HI12",		/* name.  */
   1302      1.1  christos 	 false,					/* partial_inplace.  */
   1303      1.1  christos 	 0,					/* src_mask */
   1304      1.1  christos 	 0x3ffc00,				/* dst_mask */
   1305      1.1  christos 	 false,					/* pcrel_offset */
   1306      1.1  christos 	 BFD_RELOC_LARCH_TLS_IE64_HI12,		/* bfd_reloc_code_real_type */
   1307      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
   1308      1.1  christos 	 "ie64_hi12"),				/* larch_reloc_type_name */
   1309      1.1  christos 
   1310      1.1  christos   LOONGARCH_HOWTO (R_LARCH_TLS_LD_PC_HI20,	/* type (95).  */
   1311      1.1  christos 	 12,					/* rightshift.  */
   1312      1.1  christos 	 4,					/* size.  */
   1313      1.1  christos 	 20,					/* bitsize.  */
   1314      1.1  christos 	 false,					/* pc_relative.  */
   1315      1.1  christos 	 5,					/* bitpos.  */
   1316      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1317      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1318      1.1  christos 	 "R_LARCH_TLS_LD_PC_HI20",		/* name.  */
   1319      1.1  christos 	 false,					/* partial_inplace.  */
   1320      1.1  christos 	 0,					/* src_mask */
   1321      1.1  christos 	 0x1ffffe0,				/* dst_mask */
   1322      1.1  christos 	 false,					/* pcrel_offset */
   1323      1.1  christos 	 BFD_RELOC_LARCH_TLS_LD_PC_HI20,	/* bfd_reloc_code_real_type */
   1324      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
   1325      1.1  christos 	 "ld_pc_hi20"),				/* larch_reloc_type_name */
   1326      1.1  christos 
   1327      1.1  christos   LOONGARCH_HOWTO (R_LARCH_TLS_LD_HI20,		/* type (96).  */
   1328      1.1  christos 	 12,					/* rightshift.  */
   1329      1.1  christos 	 4,					/* size.  */
   1330      1.1  christos 	 20,					/* bitsize.  */
   1331      1.1  christos 	 false,					/* pc_relative.  */
   1332      1.1  christos 	 5,					/* bitpos.  */
   1333      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1334      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1335      1.1  christos 	 "R_LARCH_TLS_LD_HI20",			/* name.  */
   1336      1.1  christos 	 false,					/* partial_inplace.  */
   1337      1.1  christos 	 0,					/* src_mask */
   1338      1.1  christos 	 0x1ffffe0,				/* dst_mask */
   1339      1.1  christos 	 false,					/* pcrel_offset */
   1340      1.1  christos 	 BFD_RELOC_LARCH_TLS_LD_HI20,		/* bfd_reloc_code_real_type */
   1341      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
   1342      1.1  christos 	 "ld_hi20"),				/* larch_reloc_type_name */
   1343      1.1  christos 
   1344      1.1  christos   LOONGARCH_HOWTO (R_LARCH_TLS_GD_PC_HI20,	/* type (97).  */
   1345      1.1  christos 	 12,					/* rightshift.  */
   1346      1.1  christos 	 4,					/* size.  */
   1347      1.1  christos 	 20,					/* bitsize.  */
   1348      1.1  christos 	 false,					/* pc_relative.  */
   1349      1.1  christos 	 5,					/* bitpos.  */
   1350      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1351      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1352      1.1  christos 	 "R_LARCH_TLS_GD_PC_HI20",		/* name.  */
   1353      1.1  christos 	 false,					/* partial_inplace.  */
   1354      1.1  christos 	 0,					/* src_mask */
   1355      1.1  christos 	 0x1ffffe0,				/* dst_mask */
   1356      1.1  christos 	 false,					/* pcrel_offset */
   1357      1.1  christos 	 BFD_RELOC_LARCH_TLS_GD_PC_HI20,	/* bfd_reloc_code_real_type */
   1358      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
   1359      1.1  christos 	 "gd_pc_hi20"),				/* larch_reloc_type_name */
   1360      1.1  christos 
   1361      1.1  christos   LOONGARCH_HOWTO (R_LARCH_TLS_GD_HI20,		/* type (98).  */
   1362      1.1  christos 	 12,					/* rightshift.  */
   1363      1.1  christos 	 4,					/* size.  */
   1364      1.1  christos 	 20,					/* bitsize.  */
   1365      1.1  christos 	 false,					/* pc_relative.  */
   1366      1.1  christos 	 5,					/* bitpos.  */
   1367      1.1  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1368      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1369      1.1  christos 	 "R_LARCH_TLS_GD_HI20",			/* name.  */
   1370      1.1  christos 	 false,					/* partial_inplace.  */
   1371      1.1  christos 	 0,					/* src_mask */
   1372      1.1  christos 	 0x1ffffe0,				/* dst_mask */
   1373      1.1  christos 	 false,					/* pcrel_offset */
   1374      1.1  christos 	 BFD_RELOC_LARCH_TLS_GD_HI20,		/* bfd_reloc_code_real_type */
   1375      1.1  christos 	 reloc_bits,				/* adjust_reloc_bits */
   1376      1.1  christos 	 "gd_hi20"),				/* larch_reloc_type_name */
   1377      1.1  christos 
   1378  1.1.1.2  christos   /* 32-bit PC relative.  */
   1379      1.1  christos   LOONGARCH_HOWTO (R_LARCH_32_PCREL,		/* type (99).  */
   1380      1.1  christos 	 0,					/* rightshift.  */
   1381      1.1  christos 	 4,					/* size.  */
   1382      1.1  christos 	 32,					/* bitsize.  */
   1383      1.1  christos 	 true,					/* pc_relative.  */
   1384      1.1  christos 	 0,					/* bitpos.  */
   1385  1.1.1.2  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1386      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1387      1.1  christos 	 "R_LARCH_32_PCREL",			/* name.  */
   1388      1.1  christos 	 false,					/* partial_inplace.  */
   1389      1.1  christos 	 0,					/* src_mask */
   1390      1.1  christos 	 0xffffffff,				/* dst_mask */
   1391      1.1  christos 	 false,					/* pcrel_offset */
   1392      1.1  christos 	 BFD_RELOC_LARCH_32_PCREL,		/* bfd_reloc_code_real_type */
   1393      1.1  christos 	 NULL,					/* adjust_reloc_bits */
   1394      1.1  christos 	 NULL),					/* larch_reloc_type_name */
   1395      1.1  christos 
   1396  1.1.1.2  christos   /* The paired relocation may be relaxed.  */
   1397      1.1  christos   LOONGARCH_HOWTO (R_LARCH_RELAX,		/* type (100).  */
   1398      1.1  christos 	 0,					/* rightshift */
   1399      1.1  christos 	 1,					/* size */
   1400      1.1  christos 	 0,					/* bitsize */
   1401      1.1  christos 	 false,					/* pc_relative */
   1402      1.1  christos 	 0,					/* bitpos */
   1403      1.1  christos 	 complain_overflow_dont,		/* complain_on_overflow */
   1404      1.1  christos 	 bfd_elf_generic_reloc,			/* special_function */
   1405      1.1  christos 	 "R_LARCH_RELAX",			/* name */
   1406      1.1  christos 	 false,					/* partial_inplace */
   1407      1.1  christos 	 0,					/* src_mask */
   1408      1.1  christos 	 0,					/* dst_mask */
   1409      1.1  christos 	 false,					/* pcrel_offset */
   1410      1.1  christos 	 BFD_RELOC_LARCH_RELAX,			/* bfd_reloc_code_real_type */
   1411      1.1  christos 	 NULL,					/* adjust_reloc_bits */
   1412      1.1  christos 	 NULL),					/* larch_reloc_type_name */
   1413      1.1  christos 
   1414  1.1.1.2  christos   /* Delete relaxed instruction.  */
   1415  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_DELETE,		/* type (101).  */
   1416  1.1.1.2  christos 	 0,					/* rightshift.  */
   1417  1.1.1.2  christos 	 0,					/* size.  */
   1418  1.1.1.2  christos 	 0,					/* bitsize.  */
   1419  1.1.1.2  christos 	 false,					/* pc_relative.  */
   1420  1.1.1.2  christos 	 0,					/* bitpos.  */
   1421  1.1.1.2  christos 	 complain_overflow_dont,		/* complain_on_overflow.  */
   1422  1.1.1.2  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1423  1.1.1.2  christos 	 "R_LARCH_DELETE",			/* name.  */
   1424  1.1.1.2  christos 	 false,					/* partial_inplace.  */
   1425  1.1.1.2  christos 	 0,					/* src_mask.  */
   1426  1.1.1.2  christos 	 0,					/* dst_mask.  */
   1427  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
   1428  1.1.1.2  christos 	 BFD_RELOC_LARCH_DELETE,		/* bfd_reloc_code_real_type.  */
   1429  1.1.1.2  christos 	 NULL,					/* adjust_reloc_bits.  */
   1430  1.1.1.2  christos 	 NULL),					/* larch_reloc_type_name.  */
   1431  1.1.1.2  christos 
   1432  1.1.1.2  christos   /* Indicates an alignment statement. f the symbol index is 0,
   1433  1.1.1.2  christos      the addend indicates the number of bytes occupied by nop instructions
   1434  1.1.1.2  christos      at the relocation offset. The alignment boundary is specified by the
   1435  1.1.1.2  christos      addend rounded up to the next power of two.
   1436  1.1.1.2  christos      If the symbol index is not 0, the addend indicates the first and third
   1437  1.1.1.2  christos      expressions of .align. The lowest 8 bits are used to represent the first
   1438  1.1.1.2  christos      expression, other bits are used to represent the third expression.  */
   1439  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_ALIGN,		/* type (102).  */
   1440  1.1.1.2  christos 	 0,					/* rightshift.  */
   1441  1.1.1.2  christos 	 0,					/* size.  */
   1442  1.1.1.2  christos 	 0,					/* bitsize.  */
   1443  1.1.1.2  christos 	 false,					/* pc_relative.  */
   1444  1.1.1.2  christos 	 0,					/* bitpos.  */
   1445  1.1.1.2  christos 	 complain_overflow_dont,		/* complain_on_overflow.  */
   1446  1.1.1.2  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1447  1.1.1.2  christos 	 "R_LARCH_ALIGN",			/* name.  */
   1448  1.1.1.2  christos 	 false,					/* partial_inplace.  */
   1449  1.1.1.2  christos 	 0,					/* src_mask.  */
   1450  1.1.1.2  christos 	 0,					/* dst_mask.  */
   1451  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
   1452  1.1.1.2  christos 	 BFD_RELOC_LARCH_ALIGN,			/* bfd_reloc_code_real_type.  */
   1453  1.1.1.2  christos 	 NULL,					/* adjust_reloc_bits.  */
   1454  1.1.1.2  christos 	 NULL),					/* larch_reloc_type_name.  */
   1455  1.1.1.2  christos 
   1456  1.1.1.2  christos   /* For pcaddi and pcala_hi20 + pcala_lo12 can relax to pcrel_20.  */
   1457  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_PCREL20_S2,		/* type (103).  */
   1458  1.1.1.2  christos 	 2,					/* rightshift.  */
   1459  1.1.1.2  christos 	 4,					/* size.  */
   1460  1.1.1.2  christos 	 20,					/* bitsize.  */
   1461  1.1.1.2  christos 	 false,					/* pc_relative.  */
   1462  1.1.1.2  christos 	 5,					/* bitpos.  */
   1463  1.1.1.2  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1464  1.1.1.2  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1465  1.1.1.2  christos 	 "R_LARCH_PCREL20_S2",			/* name.  */
   1466  1.1.1.2  christos 	 false,					/* partial_inplace.  */
   1467  1.1.1.2  christos 	 0,					/* src_mask.  */
   1468  1.1.1.2  christos 	 0x1ffffe0,				/* dst_mask.  */
   1469  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
   1470  1.1.1.2  christos 	 BFD_RELOC_LARCH_PCREL20_S2,		/* bfd_reloc_code_real_type.  */
   1471  1.1.1.2  christos 	 reloc_sign_bits,			/* adjust_reloc_bits.  */
   1472  1.1.1.2  christos 	 "pcrel_20"),				/* larch_reloc_type_name.  */
   1473  1.1.1.2  christos 
   1474  1.1.1.2  christos   /* Canonical Frame Address.  */
   1475  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_CFA,			/* type (104).  */
   1476  1.1.1.2  christos 	 0,					/* rightshift.  */
   1477  1.1.1.2  christos 	 0,					/* size.  */
   1478  1.1.1.2  christos 	 0,					/* bitsize.  */
   1479  1.1.1.2  christos 	 false,					/* pc_relative.  */
   1480  1.1.1.2  christos 	 0,					/* bitpos.  */
   1481  1.1.1.2  christos 	 complain_overflow_dont,		/* complain_on_overflow.  */
   1482  1.1.1.2  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1483  1.1.1.2  christos 	 "R_LARCH_CFA",				/* name.  */
   1484  1.1.1.2  christos 	 false,					/* partial_inplace.  */
   1485  1.1.1.2  christos 	 0,					/* src_mask.  */
   1486  1.1.1.2  christos 	 0,					/* dst_mask.  */
   1487  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
   1488  1.1.1.2  christos 	 BFD_RELOC_LARCH_CFA,			/* bfd_reloc_code_real_type.  */
   1489  1.1.1.2  christos 	 NULL,					/* adjust_reloc_bits.  */
   1490  1.1.1.2  christos 	 NULL),					/* larch_reloc_type_name.  */
   1491  1.1.1.2  christos 
   1492  1.1.1.2  christos   /* 6-bit in-place addition, for local label subtraction
   1493  1.1.1.2  christos      to calculate DW_CFA_advance_loc.  */
   1494  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_ADD6,		/* type (105).  */
   1495  1.1.1.2  christos 	 0,					/* rightshift.  */
   1496  1.1.1.2  christos 	 1,					/* size.  */
   1497  1.1.1.2  christos 	 8,					/* bitsize.  */
   1498  1.1.1.2  christos 	 false,					/* pc_relative.  */
   1499  1.1.1.2  christos 	 0,					/* bitpos.  */
   1500  1.1.1.2  christos 	 complain_overflow_dont,		/* complain_on_overflow.  */
   1501  1.1.1.2  christos 	 loongarch_elf_add_sub_reloc,		/* special_function.  */
   1502  1.1.1.2  christos 	 "R_LARCH_ADD6",			/* name.  */
   1503  1.1.1.2  christos 	 false,					/* partial_inplace.  */
   1504  1.1.1.2  christos 	 0,					/* src_mask.  */
   1505  1.1.1.2  christos 	 0x3f,					/* dst_mask.  */
   1506  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
   1507  1.1.1.2  christos 	 BFD_RELOC_LARCH_ADD6,			/* bfd_reloc_code_real_type.  */
   1508  1.1.1.2  christos 	 reloc_bits,				/* adjust_reloc_bits.  */
   1509  1.1.1.2  christos 	 NULL),					/* larch_reloc_type_name.  */
   1510  1.1.1.2  christos 
   1511  1.1.1.2  christos   /* 6-bit in-place subtraction, for local label subtraction
   1512  1.1.1.2  christos      to calculate DW_CFA_advance_loc.  */
   1513  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_SUB6,		/* type (106).  */
   1514  1.1.1.2  christos 	 0,					/* rightshift.  */
   1515  1.1.1.2  christos 	 1,					/* size.  */
   1516  1.1.1.2  christos 	 8,					/* bitsize.  */
   1517  1.1.1.2  christos 	 false,					/* pc_relative.  */
   1518  1.1.1.2  christos 	 0,					/* bitpos.  */
   1519  1.1.1.2  christos 	 complain_overflow_dont,		/* complain_on_overflow.  */
   1520  1.1.1.2  christos 	 loongarch_elf_add_sub_reloc,		/* special_function.  */
   1521  1.1.1.2  christos 	 "R_LARCH_SUB6",			/* name.  */
   1522  1.1.1.2  christos 	 false,					/* partial_inplace.  */
   1523  1.1.1.2  christos 	 0,					/* src_mask.  */
   1524  1.1.1.2  christos 	 0x3f,					/* dst_mask.  */
   1525  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
   1526  1.1.1.2  christos 	 BFD_RELOC_LARCH_SUB6,			/* bfd_reloc_code_real_type.  */
   1527  1.1.1.2  christos 	 reloc_bits,				/* adjust_reloc_bits.  */
   1528  1.1.1.2  christos 	 NULL),					/* larch_reloc_type_name.  */
   1529  1.1.1.2  christos 
   1530  1.1.1.2  christos   /* The length of unsigned-leb128 is variable, just assume the
   1531  1.1.1.2  christos      size is one byte here.
   1532  1.1.1.2  christos      uleb128 in-place addition, for local label subtraction.  */
   1533  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_ADD_ULEB128,		/* type (107).  */
   1534  1.1.1.2  christos 	 0,					/* rightshift.  */
   1535  1.1.1.2  christos 	 1,					/* size.  */
   1536  1.1.1.2  christos 	 0,					/* bitsize.  */
   1537  1.1.1.2  christos 	 false,					/* pc_relative.  */
   1538  1.1.1.2  christos 	 0,					/* bitpos.  */
   1539  1.1.1.2  christos 	 complain_overflow_dont,		/* complain_on_overflow.  */
   1540  1.1.1.2  christos 	 loongarch_elf_add_sub_reloc_uleb128,	/* special_function.  */
   1541  1.1.1.2  christos 	 "R_LARCH_ADD_ULEB128",			/* name.  */
   1542  1.1.1.2  christos 	 false,					/* partial_inplace.  */
   1543  1.1.1.2  christos 	 0,					/* src_mask.  */
   1544  1.1.1.2  christos 	 0,					/* dst_mask.  */
   1545  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
   1546  1.1.1.2  christos 	 BFD_RELOC_LARCH_ADD_ULEB128,		/* bfd_reloc_code_real_type.  */
   1547  1.1.1.2  christos 	 NULL,					/* adjust_reloc_bits.  */
   1548  1.1.1.2  christos 	 NULL),					/* larch_reloc_type_name.  */
   1549  1.1.1.2  christos 
   1550  1.1.1.2  christos   /* The length of unsigned-leb128 is variable, just assume the
   1551  1.1.1.2  christos      size is one byte here.
   1552  1.1.1.2  christos      uleb128 in-place subtraction, for local label subtraction.  */
   1553  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_SUB_ULEB128,		/* type (108).  */
   1554  1.1.1.2  christos 	 0,					/* rightshift.  */
   1555  1.1.1.2  christos 	 1,					/* size.  */
   1556  1.1.1.2  christos 	 0,					/* bitsize.  */
   1557  1.1.1.2  christos 	 false,					/* pc_relative.  */
   1558  1.1.1.2  christos 	 0,					/* bitpos.  */
   1559  1.1.1.2  christos 	 complain_overflow_dont,		/* complain_on_overflow.  */
   1560  1.1.1.2  christos 	 loongarch_elf_add_sub_reloc_uleb128,	/* special_function.  */
   1561  1.1.1.2  christos 	 "R_LARCH_SUB_ULEB128",			/* name.  */
   1562  1.1.1.2  christos 	 false,					/* partial_inplace.  */
   1563  1.1.1.2  christos 	 0,					/* src_mask.  */
   1564  1.1.1.2  christos 	 0,					/* dst_mask.  */
   1565  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
   1566  1.1.1.2  christos 	 BFD_RELOC_LARCH_SUB_ULEB128,		/* bfd_reloc_code_real_type.  */
   1567  1.1.1.2  christos 	 NULL,					/* adjust_reloc_bits.  */
   1568  1.1.1.2  christos 	 NULL),					/* larch_reloc_type_name.  */
   1569  1.1.1.2  christos 
   1570  1.1.1.2  christos   /* 64-bit PC relative.  */
   1571  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_64_PCREL,		/* type (109).  */
   1572  1.1.1.2  christos 	 0,					/* rightshift.  */
   1573  1.1.1.2  christos 	 8,					/* size.  */
   1574  1.1.1.2  christos 	 64,					/* bitsize.  */
   1575  1.1.1.2  christos 	 true,					/* pc_relative.  */
   1576  1.1.1.2  christos 	 0,					/* bitpos.  */
   1577  1.1.1.2  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1578  1.1.1.2  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1579  1.1.1.2  christos 	 "R_LARCH_64_PCREL",			/* name.  */
   1580  1.1.1.2  christos 	 false,					/* partial_inplace.  */
   1581  1.1.1.2  christos 	 0,					/* src_mask */
   1582  1.1.1.2  christos 	 0xffffffffffffffff,			/* dst_mask */
   1583  1.1.1.2  christos 	 false,					/* pcrel_offset */
   1584  1.1.1.2  christos 	 BFD_RELOC_LARCH_64_PCREL,		/* bfd_reloc_code_real_type */
   1585  1.1.1.2  christos 	 NULL,					/* adjust_reloc_bits */
   1586  1.1.1.2  christos 	 NULL),					/* larch_reloc_type_name */
   1587  1.1.1.2  christos 
   1588  1.1.1.2  christos   /* Used for medium code model function call pcaddu18i+jirl,
   1589  1.1.1.2  christos      these two instructions must adjacent.  */
   1590  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_CALL36,		/* type (110).  */
   1591  1.1.1.2  christos 	 2,					/* rightshift.  */
   1592  1.1.1.2  christos 	 8,					/* size.  */
   1593  1.1.1.2  christos 	 36,					/* bitsize.  */
   1594  1.1.1.2  christos 	 true,					/* pc_relative.  */
   1595  1.1.1.2  christos 	 0,					/* bitpos.  */
   1596  1.1.1.2  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1597  1.1.1.2  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1598  1.1.1.2  christos 	 "R_LARCH_CALL36",			/* name.  */
   1599  1.1.1.2  christos 	 false,					/* partial_inplace.  */
   1600  1.1.1.2  christos 	 0,					/* src_mask.  */
   1601  1.1.1.2  christos 	 0x03fffc0001ffffe0,			/* dst_mask.  */
   1602  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
   1603  1.1.1.2  christos 	 BFD_RELOC_LARCH_CALL36,		/* bfd_reloc_code_real_type.  */
   1604  1.1.1.2  christos 	 reloc_sign_bits,			/* adjust_reloc_bits.  */
   1605  1.1.1.2  christos 	 "call36"),				/* larch_reloc_type_name.  */
   1606  1.1.1.2  christos 
   1607  1.1.1.2  christos   /* TLS_DESC PCREL.  */
   1608  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_TLS_DESC_PC_HI20,	/* type (111).  */
   1609  1.1.1.2  christos 	 12,					/* rightshift.  */
   1610  1.1.1.2  christos 	 4,					/* size.  */
   1611  1.1.1.2  christos 	 20,					/* bitsize.  */
   1612  1.1.1.2  christos 	 true,					/* pc_relative.  */
   1613  1.1.1.2  christos 	 5,					/* bitpos.  */
   1614  1.1.1.2  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1615  1.1.1.2  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1616  1.1.1.2  christos 	 "R_LARCH_TLS_DESC_PC_HI20",		/* name.  */
   1617  1.1.1.2  christos 	 false,					/* partial_inplace.  */
   1618  1.1.1.2  christos 	 0,					/* src_mask.  */
   1619  1.1.1.2  christos 	 0x1ffffe0,				/* dst_mask.  */
   1620  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
   1621  1.1.1.2  christos 	 BFD_RELOC_LARCH_TLS_DESC_PC_HI20,	/* bfd_reloc_code_real_type.  */
   1622  1.1.1.2  christos 	 reloc_bits,				/* adjust_reloc_bits.  */
   1623  1.1.1.2  christos 	 "desc_pc_hi20"),			/* larch_reloc_type_name.  */
   1624  1.1.1.2  christos 
   1625  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_TLS_DESC_PC_LO12,	/* type (112).  */
   1626  1.1.1.2  christos 	 0,					/* rightshift.  */
   1627  1.1.1.2  christos 	 4,					/* size.  */
   1628  1.1.1.2  christos 	 12,					/* bitsize.  */
   1629  1.1.1.2  christos 	 true,					/* pc_relative.  */
   1630  1.1.1.2  christos 	 10,					/* bitpos.  */
   1631  1.1.1.2  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1632  1.1.1.2  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1633  1.1.1.2  christos 	 "R_LARCH_TLS_DESC_PC_LO12",		/* name.  */
   1634  1.1.1.2  christos 	 false,					/* partial_inplace.  */
   1635  1.1.1.2  christos 	 0,					/* src_mask.  */
   1636  1.1.1.2  christos 	 0x3ffc00,				/* dst_mask.  */
   1637  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
   1638  1.1.1.2  christos 	 BFD_RELOC_LARCH_TLS_DESC_PC_LO12,	/* bfd_reloc_code_real_type.  */
   1639  1.1.1.2  christos 	 reloc_bits,				/* adjust_reloc_bits.  */
   1640  1.1.1.2  christos 	 "desc_pc_lo12"),			/* larch_reloc_type_name.  */
   1641  1.1.1.2  christos 
   1642  1.1.1.2  christos   /* TLS_DESC64 LARGE PCREL.  */
   1643  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_TLS_DESC64_PC_LO20, /* type (113).  */
   1644  1.1.1.2  christos 	32,				       /* rightshift.  */
   1645  1.1.1.2  christos 	8,				       /* size.  */
   1646  1.1.1.2  christos 	20,				       /* bitsize.  */
   1647  1.1.1.2  christos 	true,				       /* pc_relative.  */
   1648  1.1.1.2  christos 	5,				       /* bitpos.  */
   1649  1.1.1.2  christos 	complain_overflow_signed,	       /* complain_on_overflow.  */
   1650  1.1.1.2  christos 	bfd_elf_generic_reloc,		       /* special_function.  */
   1651  1.1.1.2  christos 	"R_LARCH_TLS_DESC64_PC_LO20",	       /* name.  */
   1652  1.1.1.2  christos 	false,				       /* partial_inplace.  */
   1653  1.1.1.2  christos 	0,				       /* src_mask.  */
   1654  1.1.1.2  christos 	0x1ffffe0,			       /* dst_mask.  */
   1655  1.1.1.2  christos 	false,				       /* pcrel_offset.  */
   1656  1.1.1.2  christos 	BFD_RELOC_LARCH_TLS_DESC64_PC_LO20,    /* bfd_reloc_code_real_type.  */
   1657  1.1.1.2  christos 	reloc_bits,			       /* adjust_reloc_bits.  */
   1658  1.1.1.2  christos 	"desc64_pc_lo20"),		       /* larch_reloc_type_name.  */
   1659  1.1.1.2  christos 
   1660  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_TLS_DESC64_PC_HI12, /* type (114).  */
   1661  1.1.1.2  christos 	52,				       /* rightshift.  */
   1662  1.1.1.2  christos 	8,				       /* size.  */
   1663  1.1.1.2  christos 	12,				       /* bitsize.  */
   1664  1.1.1.2  christos 	true,				       /* pc_relative.  */
   1665  1.1.1.2  christos 	10,				       /* bitpos.  */
   1666  1.1.1.2  christos 	complain_overflow_signed,	       /* complain_on_overflow.  */
   1667  1.1.1.2  christos 	bfd_elf_generic_reloc,		       /* special_function.  */
   1668  1.1.1.2  christos 	"R_LARCH_TLS_DESC64_PC_HI12",	       /* name.  */
   1669  1.1.1.2  christos 	false,				       /* partial_inplace.  */
   1670  1.1.1.2  christos 	0,				       /* src_mask.  */
   1671  1.1.1.2  christos 	0x3ffc00,			       /* dst_mask.  */
   1672  1.1.1.2  christos 	false,				       /* pcrel_offset.  */
   1673  1.1.1.2  christos 	BFD_RELOC_LARCH_TLS_DESC64_PC_HI12,    /* bfd_reloc_code_real_type.  */
   1674  1.1.1.2  christos 	reloc_bits,			       /* adjust_reloc_bits.  */
   1675  1.1.1.2  christos 	"desc64_pc_hi12"),		       /* larch_reloc_type_name.  */
   1676  1.1.1.2  christos 
   1677  1.1.1.2  christos   /* TLS_DESC ABS.  */
   1678  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_TLS_DESC_HI20,	/* type (115).  */
   1679  1.1.1.2  christos 	 12,					/* rightshift.  */
   1680  1.1.1.2  christos 	 4,					/* size.  */
   1681  1.1.1.2  christos 	 20,					/* bitsize.  */
   1682  1.1.1.2  christos 	 false,					/* pc_relative.  */
   1683  1.1.1.2  christos 	 5,					/* bitpos.  */
   1684  1.1.1.2  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1685  1.1.1.2  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1686  1.1.1.2  christos 	 "R_LARCH_TLS_DESC_HI20",		/* name.  */
   1687  1.1.1.2  christos 	 false,					/* partial_inplace.  */
   1688  1.1.1.2  christos 	 0,					/* src_mask.  */
   1689  1.1.1.2  christos 	 0x1ffffe0,				/* dst_mask.  */
   1690  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
   1691  1.1.1.2  christos 	 BFD_RELOC_LARCH_TLS_DESC_HI20,		/* bfd_reloc_code_real_type.  */
   1692  1.1.1.2  christos 	 reloc_bits,				/* adjust_reloc_bits.  */
   1693  1.1.1.2  christos 	 "desc_hi20"),				/* larch_reloc_type_name.  */
   1694  1.1.1.2  christos 
   1695  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_TLS_DESC_LO12,	/* type (116).  */
   1696  1.1.1.2  christos 	 0,					/* rightshift.  */
   1697  1.1.1.2  christos 	 4,					/* size.  */
   1698  1.1.1.2  christos 	 12,					/* bitsize.  */
   1699  1.1.1.2  christos 	 false,					/* pc_relative.  */
   1700  1.1.1.2  christos 	 10,					/* bitpos.  */
   1701  1.1.1.2  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1702  1.1.1.2  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1703  1.1.1.2  christos 	 "R_LARCH_TLS_DESC_LO12",		/* name.  */
   1704  1.1.1.2  christos 	 false,					/* partial_inplace.  */
   1705  1.1.1.2  christos 	 0,					/* src_mask.  */
   1706  1.1.1.2  christos 	 0x3ffc00,				/* dst_mask.  */
   1707  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
   1708  1.1.1.2  christos 	 BFD_RELOC_LARCH_TLS_DESC_LO12,		/* bfd_reloc_code_real_type.  */
   1709  1.1.1.2  christos 	 reloc_bits,				/* adjust_reloc_bits.  */
   1710  1.1.1.2  christos 	 "desc_lo12"),				/* larch_reloc_type_name.  */
   1711  1.1.1.2  christos 
   1712  1.1.1.2  christos   /* TLS_DESC64 LARGE ABS.  */
   1713  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_TLS_DESC64_LO20,    /* type (117).  */
   1714  1.1.1.2  christos 	32,				       /* rightshift.  */
   1715  1.1.1.2  christos 	8,				       /* size.  */
   1716  1.1.1.2  christos 	20,				       /* bitsize.  */
   1717  1.1.1.2  christos 	false,				       /* pc_relative.  */
   1718  1.1.1.2  christos 	5,				       /* bitpos.  */
   1719  1.1.1.2  christos 	complain_overflow_signed,	       /* complain_on_overflow.  */
   1720  1.1.1.2  christos 	bfd_elf_generic_reloc,		       /* special_function.  */
   1721  1.1.1.2  christos 	"R_LARCH_TLS_DESC64_LO20",	       /* name.  */
   1722  1.1.1.2  christos 	false,				       /* partial_inplace.  */
   1723  1.1.1.2  christos 	0,				       /* src_mask.  */
   1724  1.1.1.2  christos 	0x1ffffe0,			       /* dst_mask.  */
   1725  1.1.1.2  christos 	false,				       /* pcrel_offset.  */
   1726  1.1.1.2  christos 	BFD_RELOC_LARCH_TLS_DESC64_LO20,       /* bfd_reloc_code_real_type.  */
   1727  1.1.1.2  christos 	reloc_bits,			       /* adjust_reloc_bits.  */
   1728  1.1.1.2  christos 	"desc64_lo20"),			       /* larch_reloc_type_name.  */
   1729  1.1.1.2  christos 
   1730  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_TLS_DESC64_HI12,    /* type (118).  */
   1731  1.1.1.2  christos 	52,				       /* rightshift.  */
   1732  1.1.1.2  christos 	8,				       /* size.  */
   1733  1.1.1.2  christos 	12,				       /* bitsize.  */
   1734  1.1.1.2  christos 	false,				       /* pc_relative.  */
   1735  1.1.1.2  christos 	10,				       /* bitpos.  */
   1736  1.1.1.2  christos 	complain_overflow_signed,	       /* complain_on_overflow.  */
   1737  1.1.1.2  christos 	bfd_elf_generic_reloc,		       /* special_function.  */
   1738  1.1.1.2  christos 	"R_LARCH_TLS_DESC64_HI12",	       /* name.  */
   1739  1.1.1.2  christos 	false,				       /* partial_inplace.  */
   1740  1.1.1.2  christos 	0,				       /* src_mask.  */
   1741  1.1.1.2  christos 	0x3ffc00,			       /* dst_mask.  */
   1742  1.1.1.2  christos 	false,				       /* pcrel_offset.  */
   1743  1.1.1.2  christos 	BFD_RELOC_LARCH_TLS_DESC64_HI12,       /* bfd_reloc_code_real_type.  */
   1744  1.1.1.2  christos 	reloc_bits,			       /* adjust_reloc_bits.  */
   1745  1.1.1.2  christos 	"desc64_hi12"),			       /* larch_reloc_type_name.  */
   1746  1.1.1.2  christos 
   1747  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_TLS_DESC_LD,		/* type (119).  */
   1748  1.1.1.2  christos 	 0,					/* rightshift.  */
   1749  1.1.1.2  christos 	 4,					/* size.  */
   1750  1.1.1.2  christos 	 0,					/* bitsize.  */
   1751  1.1.1.2  christos 	 true,					/* pc_relative.  */
   1752  1.1.1.2  christos 	 0,					/* bitpos.  */
   1753  1.1.1.2  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1754  1.1.1.2  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1755  1.1.1.2  christos 	 "R_LARCH_TLS_DESC_LD",			/* name.  */
   1756  1.1.1.2  christos 	 false,					/* partial_inplace.  */
   1757  1.1.1.2  christos 	 0,					/* src_mask.  */
   1758  1.1.1.2  christos 	 0,					/* dst_mask.  */
   1759  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
   1760  1.1.1.2  christos 	 BFD_RELOC_LARCH_TLS_DESC_LD,		/* bfd_reloc_code_real_type.  */
   1761  1.1.1.2  christos 	 NULL,					/* adjust_reloc_bits.  */
   1762  1.1.1.2  christos 	 "desc_ld"),				/* larch_reloc_type_name.  */
   1763  1.1.1.2  christos 
   1764  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_TLS_DESC_CALL,	/* type (120).  */
   1765  1.1.1.2  christos 	 0,					/* rightshift.  */
   1766  1.1.1.2  christos 	 4,					/* size.  */
   1767  1.1.1.2  christos 	 0,					/* bitsize.  */
   1768  1.1.1.2  christos 	 false,					/* pc_relative.  */
   1769  1.1.1.2  christos 	 0,					/* bitpos.  */
   1770  1.1.1.2  christos 	 complain_overflow_dont,		/* complain_on_overflow.  */
   1771  1.1.1.2  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1772  1.1.1.2  christos 	 "R_LARCH_TLS_DESC_CALL",		/* name.  */
   1773  1.1.1.2  christos 	 false,					/* partial_inplace.  */
   1774  1.1.1.2  christos 	 0,					/* src_mask.  */
   1775  1.1.1.2  christos 	 0,					/* dst_mask.  */
   1776  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
   1777  1.1.1.2  christos 	 BFD_RELOC_LARCH_TLS_DESC_CALL,		/* bfd_reloc_code_real_type.  */
   1778  1.1.1.2  christos 	 NULL,					/* adjust_reloc_bits.  */
   1779  1.1.1.2  christos 	 "desc_call"),				/* larch_reloc_type_name.  */
   1780  1.1.1.2  christos 
   1781  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_TLS_LE_HI20_R,	/* type (121).  */
   1782  1.1.1.2  christos 	 12,					/* rightshift.  */
   1783  1.1.1.2  christos 	 4,					/* size.  */
   1784  1.1.1.2  christos 	 20,					/* bitsize.  */
   1785  1.1.1.2  christos 	 false,					/* pc_relative.  */
   1786  1.1.1.2  christos 	 5,					/* bitpos.  */
   1787  1.1.1.2  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1788  1.1.1.2  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1789  1.1.1.2  christos 	 "R_LARCH_TLS_LE_HI20_R",		/* name.  */
   1790  1.1.1.2  christos 	 false,					/* partial_inplace.  */
   1791  1.1.1.2  christos 	 0,					/* src_mask.  */
   1792  1.1.1.2  christos 	 0x1ffffe0,				/* dst_mask.  */
   1793  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
   1794  1.1.1.2  christos 	 BFD_RELOC_LARCH_TLS_LE_HI20_R,		/* bfd_reloc_code_real_type.  */
   1795  1.1.1.2  christos 	 reloc_bits,				/* adjust_reloc_bits.  */
   1796  1.1.1.2  christos 	 "le_hi20_r"),				/* larch_reloc_type_name.  */
   1797  1.1.1.2  christos 
   1798  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_TLS_LE_ADD_R,	/* type (122).  */
   1799  1.1.1.2  christos 	 0,					/* rightshift.  */
   1800  1.1.1.2  christos 	 0,					/* size.  */
   1801  1.1.1.2  christos 	 0,					/* bitsize.  */
   1802  1.1.1.2  christos 	 false,					/* pc_relative.  */
   1803  1.1.1.2  christos 	 0,					/* bitpos.  */
   1804  1.1.1.2  christos 	 complain_overflow_dont,		/* complain_on_overflow.  */
   1805  1.1.1.2  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1806  1.1.1.2  christos 	 "R_LARCH_TLS_LE_ADD_R",		/* name.  */
   1807  1.1.1.2  christos 	 false,					/* partial_inplace.  */
   1808  1.1.1.2  christos 	 0,					/* src_mask.  */
   1809  1.1.1.2  christos 	 0,					/* dst_mask.  */
   1810  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
   1811  1.1.1.2  christos 	 BFD_RELOC_LARCH_TLS_LE_ADD_R,		/* bfd_reloc_code_real_type.  */
   1812  1.1.1.2  christos 	 NULL,					/* adjust_reloc_bits.  */
   1813  1.1.1.2  christos 	 "le_add_r"),				/* larch_reloc_type_name.  */
   1814  1.1.1.2  christos 
   1815  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_TLS_LE_LO12_R,	/* type (123).  */
   1816  1.1.1.2  christos 	 0,					/* rightshift.  */
   1817  1.1.1.2  christos 	 4,					/* size.  */
   1818  1.1.1.2  christos 	 12,					/* bitsize.  */
   1819  1.1.1.2  christos 	 false,					/* pc_relative.  */
   1820  1.1.1.2  christos 	 10,					/* bitpos.  */
   1821  1.1.1.2  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1822  1.1.1.2  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1823  1.1.1.2  christos 	 "R_LARCH_TLS_LE_LO12_R",		/* name.  */
   1824  1.1.1.2  christos 	 false,					/* partial_inplace.  */
   1825  1.1.1.2  christos 	 0,					/* src_mask.  */
   1826  1.1.1.2  christos 	 0x3ffc00,				/* dst_mask.  */
   1827  1.1.1.2  christos 	 false,					/* pcrel_offset.  */
   1828  1.1.1.2  christos 	 BFD_RELOC_LARCH_TLS_LE_LO12_R,		/* bfd_reloc_code_real_type.  */
   1829  1.1.1.2  christos 	 reloc_bits,				/* adjust_reloc_bits.  */
   1830  1.1.1.2  christos 	 "le_lo12_r"),				/* larch_reloc_type_name.  */
   1831  1.1.1.2  christos 
   1832  1.1.1.2  christos   /* For pcaddi, ld_pc_hi20 + ld_pc_lo12 can relax to ld_pcrel20_s2.  */
   1833  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_TLS_LD_PCREL20_S2,	/* type (124).  */
   1834  1.1.1.2  christos 	 2,					/* rightshift.  */
   1835  1.1.1.2  christos 	 4,					/* size.  */
   1836  1.1.1.2  christos 	 20,					/* bitsize.  */
   1837  1.1.1.2  christos 	 false,					/* pc_relative.  */
   1838  1.1.1.2  christos 	 5,					/* bitpos.  */
   1839  1.1.1.2  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1840  1.1.1.2  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1841  1.1.1.2  christos 	 "R_LARCH_TLS_LD_PCREL20_S2",		/* name.  */
   1842  1.1.1.2  christos 	 false,					/* partial_inplace.  */
   1843  1.1.1.2  christos 	 0,					/* src_mask.  */
   1844  1.1.1.2  christos 	 0x1ffffe0,				/* dst_mask.  */
   1845  1.1.1.2  christos 	 true,					/* pcrel_offset.  */
   1846  1.1.1.2  christos 	 BFD_RELOC_LARCH_TLS_LD_PCREL20_S2,	/* bfd_reloc_code_real_type.  */
   1847  1.1.1.2  christos 	 reloc_sign_bits,			/* adjust_reloc_bits.  */
   1848  1.1.1.2  christos 	 "ld_pcrel_20"),			/* larch_reloc_type_name.  */
   1849  1.1.1.2  christos 
   1850  1.1.1.2  christos   /* For pcaddi, gd_pc_hi20 + gd_pc_lo12 can relax to gd_pcrel20_s2.  */
   1851  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_TLS_GD_PCREL20_S2,	/* type (125).  */
   1852  1.1.1.2  christos 	 2,					/* rightshift.  */
   1853  1.1.1.2  christos 	 4,					/* size.  */
   1854  1.1.1.2  christos 	 20,					/* bitsize.  */
   1855  1.1.1.2  christos 	 false,					/* pc_relative.  */
   1856  1.1.1.2  christos 	 5,					/* bitpos.  */
   1857  1.1.1.2  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1858  1.1.1.2  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1859  1.1.1.2  christos 	 "R_LARCH_TLS_GD_PCREL20_S2",		/* name.  */
   1860  1.1.1.2  christos 	 false,					/* partial_inplace.  */
   1861  1.1.1.2  christos 	 0,					/* src_mask.  */
   1862  1.1.1.2  christos 	 0x1ffffe0,				/* dst_mask.  */
   1863  1.1.1.2  christos 	 true,					/* pcrel_offset.  */
   1864  1.1.1.2  christos 	 BFD_RELOC_LARCH_TLS_GD_PCREL20_S2,	/* bfd_reloc_code_real_type.  */
   1865  1.1.1.2  christos 	 reloc_sign_bits,			/* adjust_reloc_bits.  */
   1866  1.1.1.2  christos 	 "gd_pcrel_20"),			/* larch_reloc_type_name.  */
   1867  1.1.1.2  christos 
   1868  1.1.1.2  christos   /* For pcaddi, desc_pc_hi20 + desc_pc_lo12 can relax to desc_pcrel20_s2.  */
   1869  1.1.1.2  christos   LOONGARCH_HOWTO (R_LARCH_TLS_DESC_PCREL20_S2,	/* type (126).  */
   1870  1.1.1.2  christos 	 2,					/* rightshift.  */
   1871  1.1.1.2  christos 	 4,					/* size.  */
   1872  1.1.1.2  christos 	 20,					/* bitsize.  */
   1873  1.1.1.2  christos 	 false,					/* pc_relative.  */
   1874  1.1.1.2  christos 	 5,					/* bitpos.  */
   1875  1.1.1.2  christos 	 complain_overflow_signed,		/* complain_on_overflow.  */
   1876  1.1.1.2  christos 	 bfd_elf_generic_reloc,			/* special_function.  */
   1877  1.1.1.2  christos 	 "R_LARCH_TLS_DESC_PCREL20_S2",		/* name.  */
   1878  1.1.1.2  christos 	 false,					/* partial_inplace.  */
   1879  1.1.1.2  christos 	 0,					/* src_mask.  */
   1880  1.1.1.2  christos 	 0x1ffffe0,				/* dst_mask.  */
   1881  1.1.1.2  christos 	 true,					/* pcrel_offset.  */
   1882  1.1.1.2  christos 	 BFD_RELOC_LARCH_TLS_DESC_PCREL20_S2,	/* bfd_reloc_code_real_type.  */
   1883  1.1.1.2  christos 	 reloc_sign_bits,			/* adjust_reloc_bits.  */
   1884  1.1.1.2  christos 	 "desc_pcrel_20"),			/* larch_reloc_type_name.  */
   1885      1.1  christos };
   1886      1.1  christos 
   1887      1.1  christos reloc_howto_type *
   1888      1.1  christos loongarch_elf_rtype_to_howto (bfd *abfd, unsigned int r_type)
   1889      1.1  christos {
   1890  1.1.1.2  christos   if (r_type < R_LARCH_count)
   1891      1.1  christos     {
   1892      1.1  christos       BFD_ASSERT (ARRAY_SIZE (loongarch_howto_table) == R_LARCH_count);
   1893  1.1.1.2  christos       BFD_ASSERT (loongarch_howto_table[r_type].howto.type == r_type);
   1894  1.1.1.2  christos       return &loongarch_howto_table[r_type].howto;
   1895      1.1  christos     }
   1896      1.1  christos 
   1897      1.1  christos   (*_bfd_error_handler) (_("%pB: unsupported relocation type %#x"),
   1898      1.1  christos 			 abfd, r_type);
   1899      1.1  christos   bfd_set_error (bfd_error_bad_value);
   1900      1.1  christos   return NULL;
   1901      1.1  christos }
   1902      1.1  christos 
   1903      1.1  christos reloc_howto_type *
   1904      1.1  christos loongarch_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name)
   1905      1.1  christos {
   1906      1.1  christos   for (size_t i = 0; i < ARRAY_SIZE (loongarch_howto_table); i++)
   1907      1.1  christos     if (loongarch_howto_table[i].howto.name
   1908      1.1  christos 	&& strcasecmp (loongarch_howto_table[i].howto.name, r_name) == 0)
   1909  1.1.1.2  christos       return &loongarch_howto_table[i].howto;
   1910      1.1  christos 
   1911      1.1  christos   (*_bfd_error_handler) (_("%pB: unsupported relocation type %s"),
   1912      1.1  christos 			 abfd, r_name);
   1913      1.1  christos   bfd_set_error (bfd_error_bad_value);
   1914      1.1  christos   return NULL;
   1915      1.1  christos }
   1916      1.1  christos 
   1917      1.1  christos /* Cost so much.  */
   1918      1.1  christos reloc_howto_type *
   1919      1.1  christos loongarch_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
   1920      1.1  christos 			     bfd_reloc_code_real_type code)
   1921      1.1  christos {
   1922      1.1  christos   BFD_ASSERT (ARRAY_SIZE (loongarch_howto_table) == R_LARCH_count);
   1923      1.1  christos 
   1924      1.1  christos   /* Fast search for new reloc types.  */
   1925      1.1  christos   if (BFD_RELOC_LARCH_B16 <= code && code < BFD_RELOC_LARCH_RELAX)
   1926      1.1  christos     {
   1927      1.1  christos       BFD_ASSERT (BFD_RELOC_LARCH_RELAX - BFD_RELOC_LARCH_B16
   1928      1.1  christos 		  == R_LARCH_RELAX - R_LARCH_B16);
   1929  1.1.1.2  christos       loongarch_reloc_howto_type *ht;
   1930      1.1  christos       ht = &loongarch_howto_table[code - BFD_RELOC_LARCH_B16 + R_LARCH_B16];
   1931      1.1  christos       BFD_ASSERT (ht->bfd_type == code);
   1932  1.1.1.2  christos       return &ht->howto;
   1933      1.1  christos     }
   1934      1.1  christos 
   1935      1.1  christos   for (size_t i = 0; i < ARRAY_SIZE (loongarch_howto_table); i++)
   1936      1.1  christos     if (loongarch_howto_table[i].bfd_type == code)
   1937  1.1.1.2  christos       return &loongarch_howto_table[i].howto;
   1938      1.1  christos 
   1939      1.1  christos   (*_bfd_error_handler) (_("%pB: unsupported bfd relocation type %#x"),
   1940      1.1  christos 			 abfd, code);
   1941      1.1  christos   bfd_set_error (bfd_error_bad_value);
   1942      1.1  christos   return NULL;
   1943      1.1  christos }
   1944      1.1  christos 
   1945      1.1  christos bfd_reloc_code_real_type
   1946      1.1  christos loongarch_larch_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
   1947      1.1  christos 				   const char *l_r_name)
   1948      1.1  christos {
   1949      1.1  christos   for (size_t i = 0; i < ARRAY_SIZE (loongarch_howto_table); i++)
   1950      1.1  christos     {
   1951      1.1  christos       loongarch_reloc_howto_type *lht = &loongarch_howto_table[i];
   1952      1.1  christos       if ((NULL != lht->larch_reloc_type_name)
   1953      1.1  christos 	  && (0 == strcmp (lht->larch_reloc_type_name, l_r_name)))
   1954      1.1  christos 	return lht->bfd_type;
   1955      1.1  christos     }
   1956      1.1  christos 
   1957      1.1  christos   return BFD_RELOC_NONE;
   1958      1.1  christos }
   1959      1.1  christos 
   1960      1.1  christos 
   1961      1.1  christos /* Functions for reloc bits field.
   1962      1.1  christos    1.  Signed extend *fix_val.
   1963      1.1  christos    2.  Return false if overflow.  */
   1964      1.1  christos 
   1965      1.1  christos #define LARCH_RELOC_BFD_VMA_BIT_MASK(bitsize) \
   1966      1.1  christos   (~((((bfd_vma)0x1) << (bitsize)) - 1))
   1967      1.1  christos 
   1968      1.1  christos /* Adjust val to perform insn
   1969      1.1  christos    BFD_RELOC_LARCH_SOP_POP_32_S_10_5
   1970      1.1  christos    BFD_RELOC_LARCH_SOP_POP_32_S_10_12
   1971      1.1  christos    BFD_RELOC_LARCH_SOP_POP_32_U_10_12
   1972      1.1  christos    BFD_RELOC_LARCH_SOP_POP_32_S_10_16
   1973      1.1  christos    BFD_RELOC_LARCH_SOP_POP_32_S_5_20
   1974      1.1  christos    BFD_RELOC_LARCH_SOP_POP_32_U.  */
   1975  1.1.1.2  christos 
   1976      1.1  christos static bool
   1977  1.1.1.2  christos reloc_bits (bfd *abfd ATTRIBUTE_UNUSED,
   1978  1.1.1.2  christos 	    reloc_howto_type *howto,
   1979  1.1.1.2  christos 	    bfd_vma *fix_val)
   1980      1.1  christos {
   1981  1.1.1.2  christos   bfd_signed_vma val = (bfd_signed_vma)(*fix_val);
   1982  1.1.1.2  christos   bfd_signed_vma mask = ((bfd_signed_vma)0x1 << howto->bitsize) - 1;
   1983  1.1.1.2  christos 
   1984  1.1.1.2  christos   val = val >> howto->rightshift;
   1985      1.1  christos 
   1986      1.1  christos   /* Perform insn bits field.  */
   1987  1.1.1.2  christos   val = val & mask;
   1988      1.1  christos   val <<= howto->bitpos;
   1989      1.1  christos 
   1990      1.1  christos   *fix_val = (bfd_vma)val;
   1991      1.1  christos 
   1992      1.1  christos   return true;
   1993      1.1  christos }
   1994      1.1  christos 
   1995      1.1  christos static bool
   1996  1.1.1.2  christos reloc_bits_sanity (bfd *abfd, reloc_howto_type *howto, bfd_vma *fix_val,
   1997  1.1.1.2  christos 		   unsigned int sign)
   1998      1.1  christos {
   1999  1.1.1.2  christos   if ((sign && howto->complain_on_overflow != complain_overflow_signed)
   2000  1.1.1.2  christos       || (!sign && howto->complain_on_overflow != complain_overflow_unsigned))
   2001      1.1  christos     return false;
   2002      1.1  christos 
   2003  1.1.1.2  christos   bfd_signed_vma val = (bfd_signed_vma)(*fix_val);
   2004      1.1  christos 
   2005  1.1.1.2  christos   /* Check alignment. FIXME: if rightshift is not alingment.  */
   2006  1.1.1.2  christos   if (howto->rightshift
   2007  1.1.1.2  christos       && (val & ((((bfd_signed_vma) 1) << howto->rightshift) - 1)))
   2008  1.1.1.2  christos     {
   2009  1.1.1.2  christos       /* The as passes NULL casued internal error, so it can not use _bfd_error_handler
   2010  1.1.1.2  christos 	 output details, ld is not affected.  */
   2011  1.1.1.2  christos       if (abfd != NULL)
   2012  1.1.1.2  christos 	{
   2013  1.1.1.2  christos 	  (*_bfd_error_handler) (_("%pB: relocation %s right shift %d error 0x%lx"),
   2014  1.1.1.2  christos 				 abfd, howto->name, howto->rightshift, (long) val);
   2015  1.1.1.2  christos 	  bfd_set_error (bfd_error_bad_value);
   2016  1.1.1.2  christos 	}
   2017  1.1.1.2  christos       return false;
   2018  1.1.1.2  christos     }
   2019      1.1  christos 
   2020  1.1.1.2  christos   bfd_signed_vma mask = ((bfd_signed_vma)0x1 << (howto->bitsize
   2021  1.1.1.2  christos 			  + howto->rightshift - sign)) - 1;
   2022      1.1  christos 
   2023  1.1.1.2  christos   /* Positive number: high part is all 0;
   2024  1.1.1.2  christos      Negative number: if high part is not all 0, high part must be all 1.
   2025  1.1.1.2  christos      high part: from sign bit to highest bit.  */
   2026  1.1.1.2  christos   if ((val & ~mask) && ((val & ~mask) != ~mask))
   2027      1.1  christos     {
   2028  1.1.1.2  christos       /* The as passes NULL casued internal error, so it can not use _bfd_error_handler
   2029  1.1.1.2  christos 	 output details, ld is not affected.  */
   2030  1.1.1.2  christos       if (abfd != NULL)
   2031  1.1.1.2  christos 	{
   2032  1.1.1.2  christos 	  (*_bfd_error_handler) (_("%pB: relocation %s overflow 0x%lx"),
   2033  1.1.1.2  christos 				 abfd, howto->name, (long) val);
   2034  1.1.1.2  christos 	  bfd_set_error (bfd_error_bad_value);
   2035  1.1.1.2  christos 	}
   2036  1.1.1.2  christos       return false;
   2037      1.1  christos     }
   2038  1.1.1.2  christos 
   2039  1.1.1.2  christos   val = val >> howto->rightshift;
   2040  1.1.1.2  christos   /* can delete? */
   2041  1.1.1.2  christos   mask = ((bfd_signed_vma)0x1 << howto->bitsize) - 1;
   2042  1.1.1.2  christos   val = val & mask;
   2043  1.1.1.2  christos 
   2044  1.1.1.2  christos   switch (howto->type)
   2045      1.1  christos     {
   2046  1.1.1.2  christos     case R_LARCH_SOP_POP_32_S_0_10_10_16_S2:
   2047  1.1.1.2  christos     case R_LARCH_B26:
   2048  1.1.1.2  christos       /* Perform insn bits field. 15:0<<10, 25:16>>16.  */
   2049  1.1.1.2  christos       val = ((val & 0xffff) << 10) | ((val >> 16) & 0x3ff);
   2050  1.1.1.2  christos       break;
   2051  1.1.1.2  christos     case R_LARCH_SOP_POP_32_S_0_5_10_16_S2:
   2052  1.1.1.2  christos     case R_LARCH_B21:
   2053  1.1.1.2  christos       /* Perform insn bits field. 15:0<<10, 20:16>>16.  */
   2054  1.1.1.2  christos       val = ((val & 0xffff) << 10) | ((val >> 16) & 0x1f);
   2055  1.1.1.2  christos       break;
   2056  1.1.1.2  christos     case R_LARCH_CALL36:
   2057  1.1.1.2  christos       /* 0x8000: If low 16-bit immediate greater than 0x7fff,
   2058  1.1.1.2  christos 	 it become to a negative number due to sign-extended,
   2059  1.1.1.2  christos 	 so the high part need to add 0x8000.  */
   2060  1.1.1.2  christos       val = (((val + 0x8000) >> 16) << 5) | (((val & 0xffff) << 10) << 32);
   2061  1.1.1.2  christos       break;
   2062  1.1.1.2  christos     default:
   2063  1.1.1.2  christos       val <<= howto->bitpos;
   2064  1.1.1.2  christos       break;
   2065      1.1  christos     }
   2066      1.1  christos 
   2067      1.1  christos   *fix_val = val;
   2068      1.1  christos   return true;
   2069      1.1  christos }
   2070      1.1  christos 
   2071      1.1  christos static bool
   2072  1.1.1.2  christos reloc_sign_bits (bfd *abfd, reloc_howto_type *howto, bfd_vma *fix_val)
   2073      1.1  christos {
   2074  1.1.1.2  christos   return reloc_bits_sanity (abfd, howto, fix_val, 1);
   2075  1.1.1.2  christos }
   2076      1.1  christos 
   2077  1.1.1.2  christos static bool
   2078  1.1.1.2  christos reloc_unsign_bits (bfd *abfd, reloc_howto_type *howto, bfd_vma *fix_val)
   2079  1.1.1.2  christos {
   2080  1.1.1.2  christos   return reloc_bits_sanity (abfd, howto, fix_val, 0);
   2081  1.1.1.2  christos }
   2082      1.1  christos 
   2083  1.1.1.2  christos bool
   2084  1.1.1.2  christos loongarch_adjust_reloc_bitsfield (bfd *abfd, reloc_howto_type *howto,
   2085  1.1.1.2  christos 				  bfd_vma *fix_val)
   2086  1.1.1.2  christos {
   2087  1.1.1.2  christos   BFD_ASSERT (((loongarch_reloc_howto_type *)howto)->adjust_reloc_bits);
   2088  1.1.1.2  christos   return ((loongarch_reloc_howto_type *)
   2089  1.1.1.2  christos 	  howto)->adjust_reloc_bits (abfd, howto, fix_val);
   2090  1.1.1.2  christos }
   2091      1.1  christos 
   2092  1.1.1.2  christos static bfd_reloc_status_type
   2093  1.1.1.2  christos loongarch_elf_add_sub_reloc (bfd *abfd,
   2094  1.1.1.2  christos 	       arelent *reloc_entry,
   2095  1.1.1.2  christos 	       asymbol *symbol,
   2096  1.1.1.2  christos 	       void *data,
   2097  1.1.1.2  christos 	       asection *input_section,
   2098  1.1.1.2  christos 	       bfd *output_bfd,
   2099  1.1.1.2  christos 	       char **error_message ATTRIBUTE_UNUSED)
   2100  1.1.1.2  christos {
   2101  1.1.1.2  christos   reloc_howto_type *howto = reloc_entry->howto;
   2102  1.1.1.2  christos   bfd_vma relocation;
   2103      1.1  christos 
   2104  1.1.1.2  christos   if (output_bfd != NULL
   2105  1.1.1.2  christos       && (symbol->flags & BSF_SECTION_SYM) == 0
   2106  1.1.1.2  christos       && (!reloc_entry->howto->partial_inplace || reloc_entry->addend == 0))
   2107      1.1  christos     {
   2108  1.1.1.2  christos       reloc_entry->address += input_section->output_offset;
   2109  1.1.1.2  christos       return bfd_reloc_ok;
   2110      1.1  christos     }
   2111      1.1  christos 
   2112  1.1.1.2  christos   if (output_bfd != NULL)
   2113  1.1.1.2  christos     return bfd_reloc_continue;
   2114      1.1  christos 
   2115  1.1.1.2  christos   relocation = symbol->value + symbol->section->output_section->vma
   2116  1.1.1.2  christos     + symbol->section->output_offset + reloc_entry->addend;
   2117      1.1  christos 
   2118  1.1.1.2  christos   bfd_size_type octets = reloc_entry->address
   2119  1.1.1.2  christos     * bfd_octets_per_byte (abfd, input_section);
   2120  1.1.1.2  christos   if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd,
   2121  1.1.1.2  christos 				  input_section, octets))
   2122  1.1.1.2  christos     return bfd_reloc_outofrange;
   2123      1.1  christos 
   2124  1.1.1.2  christos   bfd_vma old_value = bfd_get (howto->bitsize, abfd,
   2125  1.1.1.2  christos 			       data + reloc_entry->address);
   2126      1.1  christos 
   2127  1.1.1.2  christos   switch (howto->type)
   2128  1.1.1.2  christos     {
   2129  1.1.1.2  christos     case R_LARCH_ADD6:
   2130  1.1.1.2  christos     case R_LARCH_ADD8:
   2131  1.1.1.2  christos     case R_LARCH_ADD16:
   2132  1.1.1.2  christos     case R_LARCH_ADD32:
   2133  1.1.1.2  christos     case R_LARCH_ADD64:
   2134  1.1.1.2  christos       relocation = old_value + relocation;
   2135  1.1.1.2  christos       break;
   2136  1.1.1.2  christos 
   2137  1.1.1.2  christos     case R_LARCH_SUB6:
   2138  1.1.1.2  christos     case R_LARCH_SUB8:
   2139  1.1.1.2  christos     case R_LARCH_SUB16:
   2140  1.1.1.2  christos     case R_LARCH_SUB32:
   2141  1.1.1.2  christos     case R_LARCH_SUB64:
   2142  1.1.1.2  christos       relocation = old_value - relocation;
   2143  1.1.1.2  christos       break;
   2144  1.1.1.2  christos     }
   2145      1.1  christos 
   2146  1.1.1.2  christos   bfd_put (howto->bitsize, abfd, relocation, data + reloc_entry->address);
   2147      1.1  christos 
   2148  1.1.1.2  christos   return bfd_reloc_ok;
   2149  1.1.1.2  christos }
   2150      1.1  christos 
   2151  1.1.1.2  christos static bfd_reloc_status_type
   2152  1.1.1.2  christos loongarch_elf_add_sub_reloc_uleb128 (bfd *abfd,
   2153  1.1.1.2  christos 	       arelent *reloc_entry,
   2154  1.1.1.2  christos 	       asymbol *symbol,
   2155  1.1.1.2  christos 	       void *data,
   2156  1.1.1.2  christos 	       asection *input_section,
   2157  1.1.1.2  christos 	       bfd *output_bfd,
   2158  1.1.1.2  christos 	       char **error_message ATTRIBUTE_UNUSED)
   2159  1.1.1.2  christos {
   2160  1.1.1.2  christos   reloc_howto_type *howto = reloc_entry->howto;
   2161  1.1.1.2  christos   bfd_vma relocation;
   2162      1.1  christos 
   2163  1.1.1.2  christos  if (output_bfd != NULL
   2164  1.1.1.2  christos      && (symbol->flags & BSF_SECTION_SYM) == 0
   2165  1.1.1.2  christos      && (!reloc_entry->howto->partial_inplace || reloc_entry->addend == 0))
   2166  1.1.1.2  christos    {
   2167  1.1.1.2  christos      reloc_entry->address += input_section->output_offset;
   2168  1.1.1.2  christos      return bfd_reloc_ok;
   2169  1.1.1.2  christos    }
   2170  1.1.1.2  christos 
   2171  1.1.1.2  christos   if (output_bfd != NULL)
   2172  1.1.1.2  christos     return bfd_reloc_continue;
   2173  1.1.1.2  christos 
   2174  1.1.1.2  christos   relocation = symbol->value + symbol->section->output_section->vma
   2175  1.1.1.2  christos     + symbol->section->output_offset + reloc_entry->addend;
   2176  1.1.1.2  christos 
   2177  1.1.1.2  christos   bfd_size_type octets = reloc_entry->address
   2178  1.1.1.2  christos     * bfd_octets_per_byte (abfd, input_section);
   2179  1.1.1.2  christos   if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd,
   2180  1.1.1.2  christos 				  input_section, octets))
   2181  1.1.1.2  christos     return bfd_reloc_outofrange;
   2182  1.1.1.2  christos 
   2183  1.1.1.2  christos   unsigned int len = 0;
   2184  1.1.1.2  christos   bfd_byte *p = data + reloc_entry->address;
   2185  1.1.1.2  christos   bfd_vma old_value = _bfd_read_unsigned_leb128 (abfd, p, &len);
   2186  1.1.1.2  christos 
   2187  1.1.1.2  christos   switch (howto->type)
   2188      1.1  christos     {
   2189  1.1.1.2  christos     case R_LARCH_ADD_ULEB128:
   2190  1.1.1.2  christos       relocation = old_value + relocation;
   2191  1.1.1.2  christos       break;
   2192  1.1.1.2  christos 
   2193  1.1.1.2  christos     case R_LARCH_SUB_ULEB128:
   2194  1.1.1.2  christos       relocation = old_value - relocation;
   2195  1.1.1.2  christos       break;
   2196      1.1  christos     }
   2197      1.1  christos 
   2198  1.1.1.2  christos   bfd_vma mask = (1 << (7 * len)) - 1;
   2199  1.1.1.2  christos   relocation = relocation & mask;
   2200  1.1.1.2  christos   loongarch_write_unsigned_leb128 (p, len, relocation);
   2201  1.1.1.2  christos   return bfd_reloc_ok;
   2202  1.1.1.2  christos }
   2203      1.1  christos 
   2204  1.1.1.2  christos /* Write VALUE in uleb128 format to P.
   2205  1.1.1.2  christos    LEN is the uleb128 value length.
   2206  1.1.1.2  christos    Return a pointer to the byte following the last byte that was written.  */
   2207  1.1.1.2  christos bfd_byte *
   2208  1.1.1.2  christos loongarch_write_unsigned_leb128 (bfd_byte *p, unsigned int len, bfd_vma value)
   2209  1.1.1.2  christos {
   2210  1.1.1.2  christos   bfd_byte c;
   2211  1.1.1.2  christos   do
   2212  1.1.1.2  christos     {
   2213  1.1.1.2  christos       c = value & 0x7f;
   2214  1.1.1.2  christos       if (len > 1)
   2215  1.1.1.2  christos 	c |= 0x80;
   2216  1.1.1.2  christos       *(p++) = c;
   2217  1.1.1.2  christos       value >>= 7;
   2218  1.1.1.2  christos       len--;
   2219  1.1.1.2  christos     }
   2220  1.1.1.2  christos   while (len);
   2221  1.1.1.2  christos   return p;
   2222      1.1  christos }
   2223      1.1  christos 
   2224  1.1.1.2  christos int loongarch_get_uleb128_length (bfd_byte *buf)
   2225      1.1  christos {
   2226  1.1.1.2  christos   unsigned int len = 0;
   2227  1.1.1.2  christos   _bfd_read_unsigned_leb128 (NULL, buf, &len);
   2228  1.1.1.2  christos   return len;
   2229      1.1  christos }
   2230