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