00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #include "bfd.h"
00048 #include "sysdep.h"
00049 #include "libbfd.h"
00050 #include "aout/ar.h"
00051 #include "bfdlink.h"
00052 #include "genlink.h"
00053 #include "elf-bfd.h"
00054 #include "elfxx-mips.h"
00055 #include "elf/mips.h"
00056
00057
00058
00059 #include "coff/sym.h"
00060 #include "coff/symconst.h"
00061 #include "coff/internal.h"
00062 #include "coff/ecoff.h"
00063
00064 #include "coff/alpha.h"
00065 #define ECOFF_SIGNED_64
00066 #include "ecoffswap.h"
00067
00068 static void mips_elf64_swap_reloc_in
00069 (bfd *, const Elf64_Mips_External_Rel *, Elf64_Mips_Internal_Rela *);
00070 static void mips_elf64_swap_reloca_in
00071 (bfd *, const Elf64_Mips_External_Rela *, Elf64_Mips_Internal_Rela *);
00072 static void mips_elf64_swap_reloc_out
00073 (bfd *, const Elf64_Mips_Internal_Rela *, Elf64_Mips_External_Rel *);
00074 static void mips_elf64_swap_reloca_out
00075 (bfd *, const Elf64_Mips_Internal_Rela *, Elf64_Mips_External_Rela *);
00076 static void mips_elf64_be_swap_reloc_in
00077 (bfd *, const bfd_byte *, Elf_Internal_Rela *);
00078 static void mips_elf64_be_swap_reloc_out
00079 (bfd *, const Elf_Internal_Rela *, bfd_byte *);
00080 static void mips_elf64_be_swap_reloca_in
00081 (bfd *, const bfd_byte *, Elf_Internal_Rela *);
00082 static void mips_elf64_be_swap_reloca_out
00083 (bfd *, const Elf_Internal_Rela *, bfd_byte *);
00084 static reloc_howto_type *bfd_elf64_bfd_reloc_type_lookup
00085 (bfd *, bfd_reloc_code_real_type);
00086 static reloc_howto_type *mips_elf64_rtype_to_howto
00087 (unsigned int, bfd_boolean);
00088 static void mips_elf64_info_to_howto_rel
00089 (bfd *, arelent *, Elf_Internal_Rela *);
00090 static void mips_elf64_info_to_howto_rela
00091 (bfd *, arelent *, Elf_Internal_Rela *);
00092 static long mips_elf64_get_reloc_upper_bound
00093 (bfd *, asection *);
00094 static long mips_elf64_canonicalize_reloc
00095 (bfd *, asection *, arelent **, asymbol **);
00096 static long mips_elf64_get_dynamic_reloc_upper_bound
00097 (bfd *);
00098 static long mips_elf64_canonicalize_dynamic_reloc
00099 (bfd *, arelent **, asymbol **);
00100 static bfd_boolean mips_elf64_slurp_one_reloc_table
00101 (bfd *, asection *, Elf_Internal_Shdr *, bfd_size_type, arelent *,
00102 asymbol **, bfd_boolean);
00103 static bfd_boolean mips_elf64_slurp_reloc_table
00104 (bfd *, asection *, asymbol **, bfd_boolean);
00105 static void mips_elf64_write_relocs
00106 (bfd *, asection *, void *);
00107 static void mips_elf64_write_rel
00108 (bfd *, asection *, Elf_Internal_Shdr *, int *, void *);
00109 static void mips_elf64_write_rela
00110 (bfd *, asection *, Elf_Internal_Shdr *, int *, void *);
00111 static bfd_reloc_status_type mips_elf64_gprel16_reloc
00112 (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
00113 static bfd_reloc_status_type mips_elf64_literal_reloc
00114 (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
00115 static bfd_reloc_status_type mips_elf64_gprel32_reloc
00116 (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
00117 static bfd_reloc_status_type mips_elf64_shift6_reloc
00118 (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
00119 static bfd_reloc_status_type mips16_jump_reloc
00120 (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
00121 static bfd_reloc_status_type mips16_gprel_reloc
00122 (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
00123 static bfd_boolean mips_elf64_assign_gp
00124 (bfd *, bfd_vma *);
00125 static bfd_reloc_status_type mips_elf64_final_gp
00126 (bfd *, asymbol *, bfd_boolean, char **, bfd_vma *);
00127 static bfd_boolean mips_elf64_object_p
00128 (bfd *);
00129 static irix_compat_t elf64_mips_irix_compat
00130 (bfd *);
00131 static bfd_boolean elf64_mips_grok_prstatus
00132 (bfd *, Elf_Internal_Note *);
00133 static bfd_boolean elf64_mips_grok_psinfo
00134 (bfd *, Elf_Internal_Note *);
00135
00136 extern const bfd_target bfd_elf64_bigmips_vec;
00137 extern const bfd_target bfd_elf64_littlemips_vec;
00138
00139
00140
00141 #define MINUS_ONE (((bfd_vma)0) - 1)
00142
00143
00144 #define MIPS_RESERVED_GOTNO (2)
00145
00146
00147
00148 static reloc_howto_type mips_elf64_howto_table_rel[] =
00149 {
00150
00151 HOWTO (R_MIPS_NONE,
00152 0,
00153 0,
00154 0,
00155 FALSE,
00156 0,
00157 complain_overflow_dont,
00158 _bfd_mips_elf_generic_reloc,
00159 "R_MIPS_NONE",
00160 FALSE,
00161 0,
00162 0,
00163 FALSE),
00164
00165
00166 HOWTO (R_MIPS_16,
00167 0,
00168 2,
00169 16,
00170 FALSE,
00171 0,
00172 complain_overflow_signed,
00173 _bfd_mips_elf_generic_reloc,
00174 "R_MIPS_16",
00175 TRUE,
00176 0x0000ffff,
00177 0x0000ffff,
00178 FALSE),
00179
00180
00181 HOWTO (R_MIPS_32,
00182 0,
00183 2,
00184 32,
00185 FALSE,
00186 0,
00187 complain_overflow_dont,
00188 _bfd_mips_elf_generic_reloc,
00189 "R_MIPS_32",
00190 TRUE,
00191 0xffffffff,
00192 0xffffffff,
00193 FALSE),
00194
00195
00196 HOWTO (R_MIPS_REL32,
00197 0,
00198 2,
00199 32,
00200 FALSE,
00201 0,
00202 complain_overflow_dont,
00203 _bfd_mips_elf_generic_reloc,
00204 "R_MIPS_REL32",
00205 TRUE,
00206 0xffffffff,
00207 0xffffffff,
00208 FALSE),
00209
00210
00211 HOWTO (R_MIPS_26,
00212 2,
00213 2,
00214 26,
00215 FALSE,
00216 0,
00217 complain_overflow_dont,
00218
00219
00220
00221 _bfd_mips_elf_generic_reloc,
00222 "R_MIPS_26",
00223 TRUE,
00224 0x03ffffff,
00225 0x03ffffff,
00226 FALSE),
00227
00228
00229
00230
00231
00232 HOWTO (R_MIPS_HI16,
00233 16,
00234 2,
00235 16,
00236 FALSE,
00237 0,
00238 complain_overflow_dont,
00239 _bfd_mips_elf_hi16_reloc,
00240 "R_MIPS_HI16",
00241 TRUE,
00242 0x0000ffff,
00243 0x0000ffff,
00244 FALSE),
00245
00246
00247 HOWTO (R_MIPS_LO16,
00248 0,
00249 2,
00250 16,
00251 FALSE,
00252 0,
00253 complain_overflow_dont,
00254 _bfd_mips_elf_lo16_reloc,
00255 "R_MIPS_LO16",
00256 TRUE,
00257 0x0000ffff,
00258 0x0000ffff,
00259 FALSE),
00260
00261
00262 HOWTO (R_MIPS_GPREL16,
00263 0,
00264 2,
00265 16,
00266 FALSE,
00267 0,
00268 complain_overflow_signed,
00269 mips_elf64_gprel16_reloc,
00270 "R_MIPS_GPREL16",
00271 TRUE,
00272 0x0000ffff,
00273 0x0000ffff,
00274 FALSE),
00275
00276
00277 HOWTO (R_MIPS_LITERAL,
00278 0,
00279 2,
00280 16,
00281 FALSE,
00282 0,
00283 complain_overflow_signed,
00284 mips_elf64_literal_reloc,
00285 "R_MIPS_LITERAL",
00286 TRUE,
00287 0x0000ffff,
00288 0x0000ffff,
00289 FALSE),
00290
00291
00292 HOWTO (R_MIPS_GOT16,
00293 0,
00294 2,
00295 16,
00296 FALSE,
00297 0,
00298 complain_overflow_signed,
00299 _bfd_mips_elf_got16_reloc,
00300 "R_MIPS_GOT16",
00301 TRUE,
00302 0x0000ffff,
00303 0x0000ffff,
00304 FALSE),
00305
00306
00307 HOWTO (R_MIPS_PC16,
00308 0,
00309 2,
00310 16,
00311 TRUE,
00312 0,
00313 complain_overflow_signed,
00314 _bfd_mips_elf_generic_reloc,
00315 "R_MIPS_PC16",
00316 TRUE,
00317 0x0000ffff,
00318 0x0000ffff,
00319 TRUE),
00320
00321
00322 HOWTO (R_MIPS_CALL16,
00323 0,
00324 2,
00325 16,
00326 FALSE,
00327 0,
00328 complain_overflow_signed,
00329 _bfd_mips_elf_generic_reloc,
00330 "R_MIPS_CALL16",
00331 TRUE,
00332 0x0000ffff,
00333 0x0000ffff,
00334 FALSE),
00335
00336
00337 HOWTO (R_MIPS_GPREL32,
00338 0,
00339 2,
00340 32,
00341 FALSE,
00342 0,
00343 complain_overflow_dont,
00344 mips_elf64_gprel32_reloc,
00345 "R_MIPS_GPREL32",
00346 TRUE,
00347 0xffffffff,
00348 0xffffffff,
00349 FALSE),
00350
00351 EMPTY_HOWTO (13),
00352 EMPTY_HOWTO (14),
00353 EMPTY_HOWTO (15),
00354
00355
00356 HOWTO (R_MIPS_SHIFT5,
00357 0,
00358 2,
00359 5,
00360 FALSE,
00361 6,
00362 complain_overflow_bitfield,
00363 _bfd_mips_elf_generic_reloc,
00364 "R_MIPS_SHIFT5",
00365 TRUE,
00366 0x000007c0,
00367 0x000007c0,
00368 FALSE),
00369
00370
00371 HOWTO (R_MIPS_SHIFT6,
00372 0,
00373 2,
00374 6,
00375 FALSE,
00376 6,
00377 complain_overflow_bitfield,
00378 mips_elf64_shift6_reloc,
00379 "R_MIPS_SHIFT6",
00380 TRUE,
00381 0x000007c4,
00382 0x000007c4,
00383 FALSE),
00384
00385
00386 HOWTO (R_MIPS_64,
00387 0,
00388 4,
00389 64,
00390 FALSE,
00391 0,
00392 complain_overflow_dont,
00393 _bfd_mips_elf_generic_reloc,
00394 "R_MIPS_64",
00395 TRUE,
00396 MINUS_ONE,
00397 MINUS_ONE,
00398 FALSE),
00399
00400
00401 HOWTO (R_MIPS_GOT_DISP,
00402 0,
00403 2,
00404 16,
00405 FALSE,
00406 0,
00407 complain_overflow_signed,
00408 _bfd_mips_elf_generic_reloc,
00409 "R_MIPS_GOT_DISP",
00410 TRUE,
00411 0x0000ffff,
00412 0x0000ffff,
00413 FALSE),
00414
00415
00416 HOWTO (R_MIPS_GOT_PAGE,
00417 0,
00418 2,
00419 16,
00420 FALSE,
00421 0,
00422 complain_overflow_signed,
00423 _bfd_mips_elf_generic_reloc,
00424 "R_MIPS_GOT_PAGE",
00425 TRUE,
00426 0x0000ffff,
00427 0x0000ffff,
00428 FALSE),
00429
00430
00431 HOWTO (R_MIPS_GOT_OFST,
00432 0,
00433 2,
00434 16,
00435 FALSE,
00436 0,
00437 complain_overflow_signed,
00438 _bfd_mips_elf_generic_reloc,
00439 "R_MIPS_GOT_OFST",
00440 TRUE,
00441 0x0000ffff,
00442 0x0000ffff,
00443 FALSE),
00444
00445
00446 HOWTO (R_MIPS_GOT_HI16,
00447 0,
00448 2,
00449 16,
00450 FALSE,
00451 0,
00452 complain_overflow_dont,
00453 _bfd_mips_elf_generic_reloc,
00454 "R_MIPS_GOT_HI16",
00455 TRUE,
00456 0x0000ffff,
00457 0x0000ffff,
00458 FALSE),
00459
00460
00461 HOWTO (R_MIPS_GOT_LO16,
00462 0,
00463 2,
00464 16,
00465 FALSE,
00466 0,
00467 complain_overflow_dont,
00468 _bfd_mips_elf_generic_reloc,
00469 "R_MIPS_GOT_LO16",
00470 TRUE,
00471 0x0000ffff,
00472 0x0000ffff,
00473 FALSE),
00474
00475
00476 HOWTO (R_MIPS_SUB,
00477 0,
00478 4,
00479 64,
00480 FALSE,
00481 0,
00482 complain_overflow_dont,
00483 _bfd_mips_elf_generic_reloc,
00484 "R_MIPS_SUB",
00485 TRUE,
00486 MINUS_ONE,
00487 MINUS_ONE,
00488 FALSE),
00489
00490
00491
00492 HOWTO (R_MIPS_INSERT_A,
00493 0,
00494 2,
00495 32,
00496 FALSE,
00497 0,
00498 complain_overflow_dont,
00499 _bfd_mips_elf_generic_reloc,
00500 "R_MIPS_INSERT_A",
00501 TRUE,
00502 0xffffffff,
00503 0xffffffff,
00504 FALSE),
00505
00506
00507
00508
00509 HOWTO (R_MIPS_INSERT_B,
00510 0,
00511 2,
00512 32,
00513 FALSE,
00514 0,
00515 complain_overflow_dont,
00516 _bfd_mips_elf_generic_reloc,
00517 "R_MIPS_INSERT_B",
00518 TRUE,
00519 0xffffffff,
00520 0xffffffff,
00521 FALSE),
00522
00523
00524
00525 HOWTO (R_MIPS_DELETE,
00526 0,
00527 2,
00528 32,
00529 FALSE,
00530 0,
00531 complain_overflow_dont,
00532 _bfd_mips_elf_generic_reloc,
00533 "R_MIPS_DELETE",
00534 TRUE,
00535 0xffffffff,
00536 0xffffffff,
00537 FALSE),
00538
00539
00540
00541
00542
00543
00544
00545 EMPTY_HOWTO (R_MIPS_HIGHER),
00546 EMPTY_HOWTO (R_MIPS_HIGHEST),
00547
00548
00549 HOWTO (R_MIPS_CALL_HI16,
00550 0,
00551 2,
00552 16,
00553 FALSE,
00554 0,
00555 complain_overflow_dont,
00556 _bfd_mips_elf_generic_reloc,
00557 "R_MIPS_CALL_HI16",
00558 TRUE,
00559 0x0000ffff,
00560 0x0000ffff,
00561 FALSE),
00562
00563
00564 HOWTO (R_MIPS_CALL_LO16,
00565 0,
00566 2,
00567 16,
00568 FALSE,
00569 0,
00570 complain_overflow_dont,
00571 _bfd_mips_elf_generic_reloc,
00572 "R_MIPS_CALL_LO16",
00573 TRUE,
00574 0x0000ffff,
00575 0x0000ffff,
00576 FALSE),
00577
00578
00579 HOWTO (R_MIPS_SCN_DISP,
00580 0,
00581 2,
00582 32,
00583 FALSE,
00584 0,
00585 complain_overflow_dont,
00586 _bfd_mips_elf_generic_reloc,
00587 "R_MIPS_SCN_DISP",
00588 TRUE,
00589 0xffffffff,
00590 0xffffffff,
00591 FALSE),
00592
00593 HOWTO (R_MIPS_REL16,
00594 0,
00595 1,
00596 16,
00597 FALSE,
00598 0,
00599 complain_overflow_signed,
00600 _bfd_mips_elf_generic_reloc,
00601 "R_MIPS_REL16",
00602 TRUE,
00603 0xffff,
00604 0xffff,
00605 FALSE),
00606
00607
00608 EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
00609 EMPTY_HOWTO (R_MIPS_PJUMP),
00610
00611
00612
00613 HOWTO (R_MIPS_RELGOT,
00614 0,
00615 2,
00616 32,
00617 FALSE,
00618 0,
00619 complain_overflow_dont,
00620 _bfd_mips_elf_generic_reloc,
00621 "R_MIPS_RELGOT",
00622 TRUE,
00623 0xffffffff,
00624 0xffffffff,
00625 FALSE),
00626
00627
00628
00629 HOWTO (R_MIPS_JALR,
00630 0,
00631 2,
00632 32,
00633 FALSE,
00634 0,
00635 complain_overflow_dont,
00636 _bfd_mips_elf_generic_reloc,
00637 "R_MIPS_JALR",
00638 FALSE,
00639 0,
00640 0x00000000,
00641 FALSE),
00642
00643
00644 EMPTY_HOWTO (R_MIPS_TLS_DTPMOD32),
00645 EMPTY_HOWTO (R_MIPS_TLS_DTPREL32),
00646
00647 HOWTO (R_MIPS_TLS_DTPMOD64,
00648 0,
00649 4,
00650 64,
00651 FALSE,
00652 0,
00653 complain_overflow_dont,
00654 _bfd_mips_elf_generic_reloc,
00655 "R_MIPS_TLS_DTPMOD64",
00656 TRUE,
00657 MINUS_ONE,
00658 MINUS_ONE,
00659 FALSE),
00660
00661 HOWTO (R_MIPS_TLS_DTPREL64,
00662 0,
00663 4,
00664 64,
00665 FALSE,
00666 0,
00667 complain_overflow_dont,
00668 _bfd_mips_elf_generic_reloc,
00669 "R_MIPS_TLS_DTPREL64",
00670 TRUE,
00671 MINUS_ONE,
00672 MINUS_ONE,
00673 FALSE),
00674
00675
00676 HOWTO (R_MIPS_TLS_GD,
00677 0,
00678 2,
00679 16,
00680 FALSE,
00681 0,
00682 complain_overflow_signed,
00683 _bfd_mips_elf_generic_reloc,
00684 "R_MIPS_TLS_GD",
00685 TRUE,
00686 0x0000ffff,
00687 0x0000ffff,
00688 FALSE),
00689
00690
00691 HOWTO (R_MIPS_TLS_LDM,
00692 0,
00693 2,
00694 16,
00695 FALSE,
00696 0,
00697 complain_overflow_signed,
00698 _bfd_mips_elf_generic_reloc,
00699 "R_MIPS_TLS_LDM",
00700 TRUE,
00701 0x0000ffff,
00702 0x0000ffff,
00703 FALSE),
00704
00705
00706 HOWTO (R_MIPS_TLS_DTPREL_HI16,
00707 0,
00708 2,
00709 16,
00710 FALSE,
00711 0,
00712 complain_overflow_signed,
00713 _bfd_mips_elf_generic_reloc,
00714 "R_MIPS_TLS_DTPREL_HI16",
00715 TRUE,
00716 0x0000ffff,
00717 0x0000ffff,
00718 FALSE),
00719
00720
00721 HOWTO (R_MIPS_TLS_DTPREL_LO16,
00722 0,
00723 2,
00724 16,
00725 FALSE,
00726 0,
00727 complain_overflow_signed,
00728 _bfd_mips_elf_generic_reloc,
00729 "R_MIPS_TLS_DTPREL_LO16",
00730 TRUE,
00731 0x0000ffff,
00732 0x0000ffff,
00733 FALSE),
00734
00735
00736 HOWTO (R_MIPS_TLS_GOTTPREL,
00737 0,
00738 2,
00739 16,
00740 FALSE,
00741 0,
00742 complain_overflow_signed,
00743 _bfd_mips_elf_generic_reloc,
00744 "R_MIPS_TLS_GOTTPREL",
00745 TRUE,
00746 0x0000ffff,
00747 0x0000ffff,
00748 FALSE),
00749
00750
00751 EMPTY_HOWTO (R_MIPS_TLS_TPREL32),
00752
00753 HOWTO (R_MIPS_TLS_TPREL64,
00754 0,
00755 4,
00756 64,
00757 FALSE,
00758 0,
00759 complain_overflow_dont,
00760 _bfd_mips_elf_generic_reloc,
00761 "R_MIPS_TLS_TPREL64",
00762 TRUE,
00763 MINUS_ONE,
00764 MINUS_ONE,
00765 FALSE),
00766
00767
00768 HOWTO (R_MIPS_TLS_TPREL_HI16,
00769 0,
00770 2,
00771 16,
00772 FALSE,
00773 0,
00774 complain_overflow_signed,
00775 _bfd_mips_elf_generic_reloc,
00776 "R_MIPS_TLS_TPREL_HI16",
00777 TRUE,
00778 0x0000ffff,
00779 0x0000ffff,
00780 FALSE),
00781
00782
00783 HOWTO (R_MIPS_TLS_TPREL_LO16,
00784 0,
00785 2,
00786 16,
00787 FALSE,
00788 0,
00789 complain_overflow_signed,
00790 _bfd_mips_elf_generic_reloc,
00791 "R_MIPS_TLS_TPREL_LO16",
00792 TRUE,
00793 0x0000ffff,
00794 0x0000ffff,
00795 FALSE),
00796 };
00797
00798
00799
00800 static reloc_howto_type mips_elf64_howto_table_rela[] =
00801 {
00802
00803 HOWTO (R_MIPS_NONE,
00804 0,
00805 0,
00806 0,
00807 FALSE,
00808 0,
00809 complain_overflow_dont,
00810 _bfd_mips_elf_generic_reloc,
00811 "R_MIPS_NONE",
00812 FALSE,
00813 0,
00814 0,
00815 FALSE),
00816
00817
00818 HOWTO (R_MIPS_16,
00819 0,
00820 2,
00821 16,
00822 FALSE,
00823 0,
00824 complain_overflow_signed,
00825 _bfd_mips_elf_generic_reloc,
00826 "R_MIPS_16",
00827 FALSE,
00828 0,
00829 0x0000ffff,
00830 FALSE),
00831
00832
00833 HOWTO (R_MIPS_32,
00834 0,
00835 2,
00836 32,
00837 FALSE,
00838 0,
00839 complain_overflow_dont,
00840 _bfd_mips_elf_generic_reloc,
00841 "R_MIPS_32",
00842 FALSE,
00843 0,
00844 0xffffffff,
00845 FALSE),
00846
00847
00848 HOWTO (R_MIPS_REL32,
00849 0,
00850 2,
00851 32,
00852 FALSE,
00853 0,
00854 complain_overflow_dont,
00855 _bfd_mips_elf_generic_reloc,
00856 "R_MIPS_REL32",
00857 FALSE,
00858 0,
00859 0xffffffff,
00860 FALSE),
00861
00862
00863 HOWTO (R_MIPS_26,
00864 2,
00865 2,
00866 26,
00867 FALSE,
00868 0,
00869 complain_overflow_dont,
00870
00871
00872
00873 _bfd_mips_elf_generic_reloc,
00874 "R_MIPS_26",
00875 FALSE,
00876 0,
00877 0x03ffffff,
00878 FALSE),
00879
00880
00881 HOWTO (R_MIPS_HI16,
00882 0,
00883 2,
00884 16,
00885 FALSE,
00886 0,
00887 complain_overflow_dont,
00888 _bfd_mips_elf_generic_reloc,
00889 "R_MIPS_HI16",
00890 FALSE,
00891 0,
00892 0x0000ffff,
00893 FALSE),
00894
00895
00896 HOWTO (R_MIPS_LO16,
00897 0,
00898 2,
00899 16,
00900 FALSE,
00901 0,
00902 complain_overflow_dont,
00903 _bfd_mips_elf_generic_reloc,
00904 "R_MIPS_LO16",
00905 FALSE,
00906 0,
00907 0x0000ffff,
00908 FALSE),
00909
00910
00911 HOWTO (R_MIPS_GPREL16,
00912 0,
00913 2,
00914 16,
00915 FALSE,
00916 0,
00917 complain_overflow_signed,
00918 mips_elf64_gprel16_reloc,
00919 "R_MIPS_GPREL16",
00920 FALSE,
00921 0,
00922 0x0000ffff,
00923 FALSE),
00924
00925
00926 HOWTO (R_MIPS_LITERAL,
00927 0,
00928 2,
00929 16,
00930 FALSE,
00931 0,
00932 complain_overflow_signed,
00933 mips_elf64_literal_reloc,
00934 "R_MIPS_LITERAL",
00935 FALSE,
00936 0,
00937 0x0000ffff,
00938 FALSE),
00939
00940
00941 HOWTO (R_MIPS_GOT16,
00942 0,
00943 2,
00944 16,
00945 FALSE,
00946 0,
00947 complain_overflow_signed,
00948 _bfd_mips_elf_generic_reloc,
00949 "R_MIPS_GOT16",
00950 FALSE,
00951 0,
00952 0x0000ffff,
00953 FALSE),
00954
00955
00956 HOWTO (R_MIPS_PC16,
00957 0,
00958 2,
00959 16,
00960 TRUE,
00961 0,
00962 complain_overflow_signed,
00963 _bfd_mips_elf_generic_reloc,
00964 "R_MIPS_PC16",
00965 FALSE,
00966 0,
00967 0x0000ffff,
00968 TRUE),
00969
00970
00971 HOWTO (R_MIPS_CALL16,
00972 0,
00973 2,
00974 16,
00975 FALSE,
00976 0,
00977 complain_overflow_signed,
00978 _bfd_mips_elf_generic_reloc,
00979 "R_MIPS_CALL16",
00980 FALSE,
00981 0,
00982 0x0000ffff,
00983 FALSE),
00984
00985
00986 HOWTO (R_MIPS_GPREL32,
00987 0,
00988 2,
00989 32,
00990 FALSE,
00991 0,
00992 complain_overflow_dont,
00993 mips_elf64_gprel32_reloc,
00994 "R_MIPS_GPREL32",
00995 FALSE,
00996 0,
00997 0xffffffff,
00998 FALSE),
00999
01000 EMPTY_HOWTO (13),
01001 EMPTY_HOWTO (14),
01002 EMPTY_HOWTO (15),
01003
01004
01005 HOWTO (R_MIPS_SHIFT5,
01006 0,
01007 2,
01008 5,
01009 FALSE,
01010 6,
01011 complain_overflow_bitfield,
01012 _bfd_mips_elf_generic_reloc,
01013 "R_MIPS_SHIFT5",
01014 FALSE,
01015 0,
01016 0x000007c0,
01017 FALSE),
01018
01019
01020 HOWTO (R_MIPS_SHIFT6,
01021 0,
01022 2,
01023 6,
01024 FALSE,
01025 6,
01026 complain_overflow_bitfield,
01027 mips_elf64_shift6_reloc,
01028 "R_MIPS_SHIFT6",
01029 FALSE,
01030 0,
01031 0x000007c4,
01032 FALSE),
01033
01034
01035 HOWTO (R_MIPS_64,
01036 0,
01037 4,
01038 64,
01039 FALSE,
01040 0,
01041 complain_overflow_dont,
01042 _bfd_mips_elf_generic_reloc,
01043 "R_MIPS_64",
01044 FALSE,
01045 0,
01046 MINUS_ONE,
01047 FALSE),
01048
01049
01050 HOWTO (R_MIPS_GOT_DISP,
01051 0,
01052 2,
01053 16,
01054 FALSE,
01055 0,
01056 complain_overflow_signed,
01057 _bfd_mips_elf_generic_reloc,
01058 "R_MIPS_GOT_DISP",
01059 FALSE,
01060 0,
01061 0x0000ffff,
01062 FALSE),
01063
01064
01065 HOWTO (R_MIPS_GOT_PAGE,
01066 0,
01067 2,
01068 16,
01069 FALSE,
01070 0,
01071 complain_overflow_signed,
01072 _bfd_mips_elf_generic_reloc,
01073 "R_MIPS_GOT_PAGE",
01074 FALSE,
01075 0,
01076 0x0000ffff,
01077 FALSE),
01078
01079
01080 HOWTO (R_MIPS_GOT_OFST,
01081 0,
01082 2,
01083 16,
01084 FALSE,
01085 0,
01086 complain_overflow_signed,
01087 _bfd_mips_elf_generic_reloc,
01088 "R_MIPS_GOT_OFST",
01089 FALSE,
01090 0,
01091 0x0000ffff,
01092 FALSE),
01093
01094
01095 HOWTO (R_MIPS_GOT_HI16,
01096 0,
01097 2,
01098 16,
01099 FALSE,
01100 0,
01101 complain_overflow_dont,
01102 _bfd_mips_elf_generic_reloc,
01103 "R_MIPS_GOT_HI16",
01104 FALSE,
01105 0,
01106 0x0000ffff,
01107 FALSE),
01108
01109
01110 HOWTO (R_MIPS_GOT_LO16,
01111 0,
01112 2,
01113 16,
01114 FALSE,
01115 0,
01116 complain_overflow_dont,
01117 _bfd_mips_elf_generic_reloc,
01118 "R_MIPS_GOT_LO16",
01119 FALSE,
01120 0,
01121 0x0000ffff,
01122 FALSE),
01123
01124
01125 HOWTO (R_MIPS_SUB,
01126 0,
01127 4,
01128 64,
01129 FALSE,
01130 0,
01131 complain_overflow_dont,
01132 _bfd_mips_elf_generic_reloc,
01133 "R_MIPS_SUB",
01134 FALSE,
01135 0,
01136 MINUS_ONE,
01137 FALSE),
01138
01139
01140
01141 HOWTO (R_MIPS_INSERT_A,
01142 0,
01143 2,
01144 32,
01145 FALSE,
01146 0,
01147 complain_overflow_dont,
01148 _bfd_mips_elf_generic_reloc,
01149 "R_MIPS_INSERT_A",
01150 FALSE,
01151 0,
01152 0xffffffff,
01153 FALSE),
01154
01155
01156
01157
01158 HOWTO (R_MIPS_INSERT_B,
01159 0,
01160 2,
01161 32,
01162 FALSE,
01163 0,
01164 complain_overflow_dont,
01165 _bfd_mips_elf_generic_reloc,
01166 "R_MIPS_INSERT_B",
01167 FALSE,
01168 0,
01169 0xffffffff,
01170 FALSE),
01171
01172
01173
01174 HOWTO (R_MIPS_DELETE,
01175 0,
01176 2,
01177 32,
01178 FALSE,
01179 0,
01180 complain_overflow_dont,
01181 _bfd_mips_elf_generic_reloc,
01182 "R_MIPS_DELETE",
01183 FALSE,
01184 0,
01185 0xffffffff,
01186 FALSE),
01187
01188
01189 HOWTO (R_MIPS_HIGHER,
01190 0,
01191 2,
01192 16,
01193 FALSE,
01194 0,
01195 complain_overflow_dont,
01196 _bfd_mips_elf_generic_reloc,
01197 "R_MIPS_HIGHER",
01198 FALSE,
01199 0,
01200 0x0000ffff,
01201 FALSE),
01202
01203
01204 HOWTO (R_MIPS_HIGHEST,
01205 0,
01206 2,
01207 16,
01208 FALSE,
01209 0,
01210 complain_overflow_dont,
01211 _bfd_mips_elf_generic_reloc,
01212 "R_MIPS_HIGHEST",
01213 FALSE,
01214 0,
01215 0x0000ffff,
01216 FALSE),
01217
01218
01219 HOWTO (R_MIPS_CALL_HI16,
01220 0,
01221 2,
01222 16,
01223 FALSE,
01224 0,
01225 complain_overflow_dont,
01226 _bfd_mips_elf_generic_reloc,
01227 "R_MIPS_CALL_HI16",
01228 FALSE,
01229 0,
01230 0x0000ffff,
01231 FALSE),
01232
01233
01234 HOWTO (R_MIPS_CALL_LO16,
01235 0,
01236 2,
01237 16,
01238 FALSE,
01239 0,
01240 complain_overflow_dont,
01241 _bfd_mips_elf_generic_reloc,
01242 "R_MIPS_CALL_LO16",
01243 FALSE,
01244 0,
01245 0x0000ffff,
01246 FALSE),
01247
01248
01249 HOWTO (R_MIPS_SCN_DISP,
01250 0,
01251 2,
01252 32,
01253 FALSE,
01254 0,
01255 complain_overflow_dont,
01256 _bfd_mips_elf_generic_reloc,
01257 "R_MIPS_SCN_DISP",
01258 FALSE,
01259 0,
01260 0xffffffff,
01261 FALSE),
01262
01263 HOWTO (R_MIPS_REL16,
01264 0,
01265 1,
01266 16,
01267 FALSE,
01268 0,
01269 complain_overflow_signed,
01270 _bfd_mips_elf_generic_reloc,
01271 "R_MIPS_REL16",
01272 FALSE,
01273 0,
01274 0xffff,
01275 FALSE),
01276
01277
01278 EMPTY_HOWTO (R_MIPS_ADD_IMMEDIATE),
01279 EMPTY_HOWTO (R_MIPS_PJUMP),
01280
01281
01282
01283 HOWTO (R_MIPS_RELGOT,
01284 0,
01285 2,
01286 32,
01287 FALSE,
01288 0,
01289 complain_overflow_dont,
01290 _bfd_mips_elf_generic_reloc,
01291 "R_MIPS_RELGOT",
01292 FALSE,
01293 0,
01294 0xffffffff,
01295 FALSE),
01296
01297
01298
01299 HOWTO (R_MIPS_JALR,
01300 0,
01301 2,
01302 32,
01303 FALSE,
01304 0,
01305 complain_overflow_dont,
01306 _bfd_mips_elf_generic_reloc,
01307 "R_MIPS_JALR",
01308 FALSE,
01309 0,
01310 0x00000000,
01311 FALSE),
01312
01313
01314 EMPTY_HOWTO (R_MIPS_TLS_DTPMOD32),
01315 EMPTY_HOWTO (R_MIPS_TLS_DTPREL32),
01316 EMPTY_HOWTO (R_MIPS_TLS_DTPMOD64),
01317 EMPTY_HOWTO (R_MIPS_TLS_DTPREL64),
01318
01319
01320 HOWTO (R_MIPS_TLS_GD,
01321 0,
01322 2,
01323 16,
01324 FALSE,
01325 0,
01326 complain_overflow_signed,
01327 _bfd_mips_elf_generic_reloc,
01328 "R_MIPS_TLS_GD",
01329 TRUE,
01330 0x0000ffff,
01331 0x0000ffff,
01332 FALSE),
01333
01334
01335 HOWTO (R_MIPS_TLS_LDM,
01336 0,
01337 2,
01338 16,
01339 FALSE,
01340 0,
01341 complain_overflow_signed,
01342 _bfd_mips_elf_generic_reloc,
01343 "R_MIPS_TLS_LDM",
01344 TRUE,
01345 0x0000ffff,
01346 0x0000ffff,
01347 FALSE),
01348
01349
01350 HOWTO (R_MIPS_TLS_DTPREL_HI16,
01351 0,
01352 2,
01353 16,
01354 FALSE,
01355 0,
01356 complain_overflow_signed,
01357 _bfd_mips_elf_generic_reloc,
01358 "R_MIPS_TLS_DTPREL_HI16",
01359 TRUE,
01360 0x0000ffff,
01361 0x0000ffff,
01362 FALSE),
01363
01364
01365 HOWTO (R_MIPS_TLS_DTPREL_LO16,
01366 0,
01367 2,
01368 16,
01369 FALSE,
01370 0,
01371 complain_overflow_signed,
01372 _bfd_mips_elf_generic_reloc,
01373 "R_MIPS_TLS_DTPREL_LO16",
01374 TRUE,
01375 0x0000ffff,
01376 0x0000ffff,
01377 FALSE),
01378
01379
01380 HOWTO (R_MIPS_TLS_GOTTPREL,
01381 0,
01382 2,
01383 16,
01384 FALSE,
01385 0,
01386 complain_overflow_signed,
01387 _bfd_mips_elf_generic_reloc,
01388 "R_MIPS_TLS_GOTTPREL",
01389 TRUE,
01390 0x0000ffff,
01391 0x0000ffff,
01392 FALSE),
01393
01394 EMPTY_HOWTO (R_MIPS_TLS_TPREL32),
01395 EMPTY_HOWTO (R_MIPS_TLS_TPREL64),
01396
01397
01398 HOWTO (R_MIPS_TLS_TPREL_HI16,
01399 0,
01400 2,
01401 16,
01402 FALSE,
01403 0,
01404 complain_overflow_signed,
01405 _bfd_mips_elf_generic_reloc,
01406 "R_MIPS_TLS_TPREL_HI16",
01407 TRUE,
01408 0x0000ffff,
01409 0x0000ffff,
01410 FALSE),
01411
01412
01413 HOWTO (R_MIPS_TLS_TPREL_LO16,
01414 0,
01415 2,
01416 16,
01417 FALSE,
01418 0,
01419 complain_overflow_signed,
01420 _bfd_mips_elf_generic_reloc,
01421 "R_MIPS_TLS_TPREL_LO16",
01422 TRUE,
01423 0x0000ffff,
01424 0x0000ffff,
01425 FALSE),
01426 };
01427
01428 static reloc_howto_type mips16_elf64_howto_table_rel[] =
01429 {
01430
01431 HOWTO (R_MIPS16_26,
01432 2,
01433 2,
01434 26,
01435 FALSE,
01436 0,
01437 complain_overflow_dont,
01438
01439
01440
01441 mips16_jump_reloc,
01442 "R_MIPS16_26",
01443 TRUE,
01444 0x3ffffff,
01445 0x3ffffff,
01446 FALSE),
01447
01448
01449 HOWTO (R_MIPS16_GPREL,
01450 0,
01451 2,
01452 16,
01453 FALSE,
01454 0,
01455 complain_overflow_signed,
01456 mips16_gprel_reloc,
01457 "R_MIPS16_GPREL",
01458 TRUE,
01459 0x0000ffff,
01460 0x0000ffff,
01461 FALSE),
01462
01463
01464 EMPTY_HOWTO (R_MIPS16_GOT16),
01465
01466
01467 EMPTY_HOWTO (R_MIPS16_CALL16),
01468
01469
01470 HOWTO (R_MIPS16_HI16,
01471 16,
01472 2,
01473 16,
01474 FALSE,
01475 0,
01476 complain_overflow_dont,
01477 _bfd_mips_elf_hi16_reloc,
01478 "R_MIPS16_HI16",
01479 TRUE,
01480 0x0000ffff,
01481 0x0000ffff,
01482 FALSE),
01483
01484
01485 HOWTO (R_MIPS16_LO16,
01486 0,
01487 2,
01488 16,
01489 FALSE,
01490 0,
01491 complain_overflow_dont,
01492 _bfd_mips_elf_lo16_reloc,
01493 "R_MIPS16_LO16",
01494 TRUE,
01495 0x0000ffff,
01496 0x0000ffff,
01497 FALSE),
01498 };
01499
01500 static reloc_howto_type mips16_elf64_howto_table_rela[] =
01501 {
01502
01503 HOWTO (R_MIPS16_26,
01504 2,
01505 2,
01506 26,
01507 FALSE,
01508 0,
01509 complain_overflow_dont,
01510
01511
01512
01513 mips16_jump_reloc,
01514 "R_MIPS16_26",
01515 FALSE,
01516 0x3ffffff,
01517 0x3ffffff,
01518 FALSE),
01519
01520
01521 HOWTO (R_MIPS16_GPREL,
01522 0,
01523 2,
01524 16,
01525 FALSE,
01526 0,
01527 complain_overflow_signed,
01528 mips16_gprel_reloc,
01529 "R_MIPS16_GPREL",
01530 FALSE,
01531 0x0000ffff,
01532 0x0000ffff,
01533 FALSE),
01534
01535
01536 EMPTY_HOWTO (R_MIPS16_GOT16),
01537
01538
01539 EMPTY_HOWTO (R_MIPS16_CALL16),
01540
01541
01542 HOWTO (R_MIPS16_HI16,
01543 16,
01544 2,
01545 16,
01546 FALSE,
01547 0,
01548 complain_overflow_dont,
01549 _bfd_mips_elf_hi16_reloc,
01550 "R_MIPS16_HI16",
01551 FALSE,
01552 0x0000ffff,
01553 0x0000ffff,
01554 FALSE),
01555
01556
01557 HOWTO (R_MIPS16_LO16,
01558 0,
01559 2,
01560 16,
01561 FALSE,
01562 0,
01563 complain_overflow_dont,
01564 _bfd_mips_elf_lo16_reloc,
01565 "R_MIPS16_LO16",
01566 FALSE,
01567 0x0000ffff,
01568 0x0000ffff,
01569 FALSE),
01570 };
01571
01572
01573 static reloc_howto_type elf_mips_gnu_vtinherit_howto =
01574 HOWTO (R_MIPS_GNU_VTINHERIT,
01575 0,
01576 2,
01577 0,
01578 FALSE,
01579 0,
01580 complain_overflow_dont,
01581 NULL,
01582 "R_MIPS_GNU_VTINHERIT",
01583 FALSE,
01584 0,
01585 0,
01586 FALSE);
01587
01588
01589 static reloc_howto_type elf_mips_gnu_vtentry_howto =
01590 HOWTO (R_MIPS_GNU_VTENTRY,
01591 0,
01592 2,
01593 0,
01594 FALSE,
01595 0,
01596 complain_overflow_dont,
01597 _bfd_elf_rel_vtable_reloc_fn,
01598 "R_MIPS_GNU_VTENTRY",
01599 FALSE,
01600 0,
01601 0,
01602 FALSE);
01603
01604
01605 static reloc_howto_type elf_mips_gnu_rel16_s2 =
01606 HOWTO (R_MIPS_GNU_REL16_S2,
01607 2,
01608 2,
01609 16,
01610 TRUE,
01611 0,
01612 complain_overflow_signed,
01613 _bfd_mips_elf_generic_reloc,
01614 "R_MIPS_GNU_REL16_S2",
01615 TRUE,
01616 0x0000ffff,
01617 0x0000ffff,
01618 TRUE);
01619
01620
01621 static reloc_howto_type elf_mips_gnu_rela16_s2 =
01622 HOWTO (R_MIPS_GNU_REL16_S2,
01623 2,
01624 2,
01625 16,
01626 TRUE,
01627 0,
01628 complain_overflow_signed,
01629 _bfd_mips_elf_generic_reloc,
01630 "R_MIPS_GNU_REL16_S2",
01631 FALSE,
01632 0,
01633 0x0000ffff,
01634 TRUE);
01635
01636
01637
01638 static void
01639 mips_elf64_swap_reloc_in (bfd *abfd, const Elf64_Mips_External_Rel *src,
01640 Elf64_Mips_Internal_Rela *dst)
01641 {
01642 dst->r_offset = H_GET_64 (abfd, src->r_offset);
01643 dst->r_sym = H_GET_32 (abfd, src->r_sym);
01644 dst->r_ssym = H_GET_8 (abfd, src->r_ssym);
01645 dst->r_type3 = H_GET_8 (abfd, src->r_type3);
01646 dst->r_type2 = H_GET_8 (abfd, src->r_type2);
01647 dst->r_type = H_GET_8 (abfd, src->r_type);
01648 dst->r_addend = 0;
01649 }
01650
01651
01652
01653 static void
01654 mips_elf64_swap_reloca_in (bfd *abfd, const Elf64_Mips_External_Rela *src,
01655 Elf64_Mips_Internal_Rela *dst)
01656 {
01657 dst->r_offset = H_GET_64 (abfd, src->r_offset);
01658 dst->r_sym = H_GET_32 (abfd, src->r_sym);
01659 dst->r_ssym = H_GET_8 (abfd, src->r_ssym);
01660 dst->r_type3 = H_GET_8 (abfd, src->r_type3);
01661 dst->r_type2 = H_GET_8 (abfd, src->r_type2);
01662 dst->r_type = H_GET_8 (abfd, src->r_type);
01663 dst->r_addend = H_GET_S64 (abfd, src->r_addend);
01664 }
01665
01666
01667
01668 static void
01669 mips_elf64_swap_reloc_out (bfd *abfd, const Elf64_Mips_Internal_Rela *src,
01670 Elf64_Mips_External_Rel *dst)
01671 {
01672 H_PUT_64 (abfd, src->r_offset, dst->r_offset);
01673 H_PUT_32 (abfd, src->r_sym, dst->r_sym);
01674 H_PUT_8 (abfd, src->r_ssym, dst->r_ssym);
01675 H_PUT_8 (abfd, src->r_type3, dst->r_type3);
01676 H_PUT_8 (abfd, src->r_type2, dst->r_type2);
01677 H_PUT_8 (abfd, src->r_type, dst->r_type);
01678 }
01679
01680
01681
01682 static void
01683 mips_elf64_swap_reloca_out (bfd *abfd, const Elf64_Mips_Internal_Rela *src,
01684 Elf64_Mips_External_Rela *dst)
01685 {
01686 H_PUT_64 (abfd, src->r_offset, dst->r_offset);
01687 H_PUT_32 (abfd, src->r_sym, dst->r_sym);
01688 H_PUT_8 (abfd, src->r_ssym, dst->r_ssym);
01689 H_PUT_8 (abfd, src->r_type3, dst->r_type3);
01690 H_PUT_8 (abfd, src->r_type2, dst->r_type2);
01691 H_PUT_8 (abfd, src->r_type, dst->r_type);
01692 H_PUT_S64 (abfd, src->r_addend, dst->r_addend);
01693 }
01694
01695
01696
01697 static void
01698 mips_elf64_be_swap_reloc_in (bfd *abfd, const bfd_byte *src,
01699 Elf_Internal_Rela *dst)
01700 {
01701 Elf64_Mips_Internal_Rela mirel;
01702
01703 mips_elf64_swap_reloc_in (abfd,
01704 (const Elf64_Mips_External_Rel *) src,
01705 &mirel);
01706
01707 dst[0].r_offset = mirel.r_offset;
01708 dst[0].r_info = ELF64_R_INFO (mirel.r_sym, mirel.r_type);
01709 dst[0].r_addend = 0;
01710 dst[1].r_offset = mirel.r_offset;
01711 dst[1].r_info = ELF64_R_INFO (mirel.r_ssym, mirel.r_type2);
01712 dst[1].r_addend = 0;
01713 dst[2].r_offset = mirel.r_offset;
01714 dst[2].r_info = ELF64_R_INFO (STN_UNDEF, mirel.r_type3);
01715 dst[2].r_addend = 0;
01716 }
01717
01718
01719
01720 static void
01721 mips_elf64_be_swap_reloca_in (bfd *abfd, const bfd_byte *src,
01722 Elf_Internal_Rela *dst)
01723 {
01724 Elf64_Mips_Internal_Rela mirela;
01725
01726 mips_elf64_swap_reloca_in (abfd,
01727 (const Elf64_Mips_External_Rela *) src,
01728 &mirela);
01729
01730 dst[0].r_offset = mirela.r_offset;
01731 dst[0].r_info = ELF64_R_INFO (mirela.r_sym, mirela.r_type);
01732 dst[0].r_addend = mirela.r_addend;
01733 dst[1].r_offset = mirela.r_offset;
01734 dst[1].r_info = ELF64_R_INFO (mirela.r_ssym, mirela.r_type2);
01735 dst[1].r_addend = 0;
01736 dst[2].r_offset = mirela.r_offset;
01737 dst[2].r_info = ELF64_R_INFO (STN_UNDEF, mirela.r_type3);
01738 dst[2].r_addend = 0;
01739 }
01740
01741
01742
01743 static void
01744 mips_elf64_be_swap_reloc_out (bfd *abfd, const Elf_Internal_Rela *src,
01745 bfd_byte *dst)
01746 {
01747 Elf64_Mips_Internal_Rela mirel;
01748
01749 mirel.r_offset = src[0].r_offset;
01750 BFD_ASSERT(src[0].r_offset == src[1].r_offset);
01751
01752 mirel.r_type = ELF64_MIPS_R_TYPE (src[0].r_info);
01753 mirel.r_sym = ELF64_R_SYM (src[0].r_info);
01754 mirel.r_type2 = ELF64_MIPS_R_TYPE (src[1].r_info);
01755 mirel.r_ssym = ELF64_MIPS_R_SSYM (src[1].r_info);
01756 mirel.r_type3 = ELF64_MIPS_R_TYPE (src[2].r_info);
01757
01758 mips_elf64_swap_reloc_out (abfd, &mirel,
01759 (Elf64_Mips_External_Rel *) dst);
01760 }
01761
01762
01763
01764 static void
01765 mips_elf64_be_swap_reloca_out (bfd *abfd, const Elf_Internal_Rela *src,
01766 bfd_byte *dst)
01767 {
01768 Elf64_Mips_Internal_Rela mirela;
01769
01770 mirela.r_offset = src[0].r_offset;
01771 BFD_ASSERT(src[0].r_offset == src[1].r_offset);
01772 BFD_ASSERT(src[0].r_offset == src[2].r_offset);
01773
01774 mirela.r_type = ELF64_MIPS_R_TYPE (src[0].r_info);
01775 mirela.r_sym = ELF64_R_SYM (src[0].r_info);
01776 mirela.r_addend = src[0].r_addend;
01777 BFD_ASSERT(src[1].r_addend == 0);
01778 BFD_ASSERT(src[2].r_addend == 0);
01779
01780 mirela.r_type2 = ELF64_MIPS_R_TYPE (src[1].r_info);
01781 mirela.r_ssym = ELF64_MIPS_R_SSYM (src[1].r_info);
01782 mirela.r_type3 = ELF64_MIPS_R_TYPE (src[2].r_info);
01783
01784 mips_elf64_swap_reloca_out (abfd, &mirela,
01785 (Elf64_Mips_External_Rela *) dst);
01786 }
01787
01788
01789
01790
01791 static bfd_boolean
01792 mips_elf64_assign_gp (bfd *output_bfd, bfd_vma *pgp)
01793 {
01794 unsigned int count;
01795 asymbol **sym;
01796 unsigned int i;
01797
01798
01799 *pgp = _bfd_get_gp_value (output_bfd);
01800 if (*pgp)
01801 return TRUE;
01802
01803 count = bfd_get_symcount (output_bfd);
01804 sym = bfd_get_outsymbols (output_bfd);
01805
01806
01807
01808 if (sym == NULL)
01809 i = count;
01810 else
01811 {
01812 for (i = 0; i < count; i++, sym++)
01813 {
01814 register const char *name;
01815
01816 name = bfd_asymbol_name (*sym);
01817 if (*name == '_' && strcmp (name, "_gp") == 0)
01818 {
01819 *pgp = bfd_asymbol_value (*sym);
01820 _bfd_set_gp_value (output_bfd, *pgp);
01821 break;
01822 }
01823 }
01824 }
01825
01826 if (i >= count)
01827 {
01828
01829 *pgp = 4;
01830 _bfd_set_gp_value (output_bfd, *pgp);
01831 return FALSE;
01832 }
01833
01834 return TRUE;
01835 }
01836
01837
01838
01839
01840
01841
01842
01843 static bfd_reloc_status_type
01844 mips_elf64_final_gp (bfd *output_bfd, asymbol *symbol, bfd_boolean relocatable,
01845 char **error_message, bfd_vma *pgp)
01846 {
01847 if (bfd_is_und_section (symbol->section)
01848 && ! relocatable)
01849 {
01850 *pgp = 0;
01851 return bfd_reloc_undefined;
01852 }
01853
01854 *pgp = _bfd_get_gp_value (output_bfd);
01855 if (*pgp == 0
01856 && (! relocatable
01857 || (symbol->flags & BSF_SECTION_SYM) != 0))
01858 {
01859 if (relocatable)
01860 {
01861
01862 *pgp = symbol->section->output_section->vma ;
01863 _bfd_set_gp_value (output_bfd, *pgp);
01864 }
01865 else if (!mips_elf64_assign_gp (output_bfd, pgp))
01866 {
01867 *error_message =
01868 (char *) _("GP relative relocation when _gp not defined");
01869 return bfd_reloc_dangerous;
01870 }
01871 }
01872
01873 return bfd_reloc_ok;
01874 }
01875
01876
01877
01878
01879 static bfd_reloc_status_type
01880 mips_elf64_gprel16_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
01881 void *data, asection *input_section, bfd *output_bfd,
01882 char **error_message)
01883 {
01884 bfd_boolean relocatable;
01885 bfd_reloc_status_type ret;
01886 bfd_vma gp;
01887
01888
01889
01890 if (output_bfd != NULL
01891 && (symbol->flags & BSF_SECTION_SYM) == 0
01892 && (symbol->flags & BSF_LOCAL) != 0)
01893 {
01894 reloc_entry->address += input_section->output_offset;
01895 return bfd_reloc_ok;
01896 }
01897
01898 if (output_bfd != NULL)
01899 relocatable = TRUE;
01900 else
01901 {
01902 relocatable = FALSE;
01903 output_bfd = symbol->section->output_section->owner;
01904 }
01905
01906 ret = mips_elf64_final_gp (output_bfd, symbol, relocatable, error_message,
01907 &gp);
01908 if (ret != bfd_reloc_ok)
01909 return ret;
01910
01911 return _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
01912 input_section, relocatable,
01913 data, gp);
01914 }
01915
01916
01917
01918 static bfd_reloc_status_type
01919 mips_elf64_literal_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
01920 void *data, asection *input_section, bfd *output_bfd,
01921 char **error_message)
01922 {
01923 bfd_boolean relocatable;
01924 bfd_reloc_status_type ret;
01925 bfd_vma gp;
01926
01927
01928 if (output_bfd != NULL
01929 && (symbol->flags & BSF_SECTION_SYM) == 0
01930 && (symbol->flags & BSF_LOCAL) != 0)
01931 {
01932 *error_message = (char *)
01933 _("literal relocation occurs for an external symbol");
01934 return bfd_reloc_outofrange;
01935 }
01936
01937
01938 if (output_bfd != NULL)
01939 relocatable = TRUE;
01940 else
01941 {
01942 relocatable = FALSE;
01943 output_bfd = symbol->section->output_section->owner;
01944 }
01945
01946 ret = mips_elf64_final_gp (output_bfd, symbol, relocatable, error_message,
01947 &gp);
01948 if (ret != bfd_reloc_ok)
01949 return ret;
01950
01951 return _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
01952 input_section, relocatable,
01953 data, gp);
01954 }
01955
01956
01957
01958
01959 static bfd_reloc_status_type
01960 mips_elf64_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
01961 void *data, asection *input_section, bfd *output_bfd,
01962 char **error_message)
01963 {
01964 bfd_boolean relocatable;
01965 bfd_reloc_status_type ret;
01966 bfd_vma gp;
01967 bfd_vma relocation;
01968 bfd_vma val;
01969
01970
01971 if (output_bfd != NULL
01972 && (symbol->flags & BSF_SECTION_SYM) == 0
01973 && (symbol->flags & BSF_LOCAL) != 0)
01974 {
01975 *error_message = (char *)
01976 _("32bits gp relative relocation occurs for an external symbol");
01977 return bfd_reloc_outofrange;
01978 }
01979
01980 if (output_bfd != NULL)
01981 relocatable = TRUE;
01982 else
01983 {
01984 relocatable = FALSE;
01985 output_bfd = symbol->section->output_section->owner;
01986 }
01987
01988 ret = mips_elf64_final_gp (output_bfd, symbol, relocatable,
01989 error_message, &gp);
01990 if (ret != bfd_reloc_ok)
01991 return ret;
01992
01993 if (bfd_is_com_section (symbol->section))
01994 relocation = 0;
01995 else
01996 relocation = symbol->value;
01997
01998 relocation += symbol->section->output_section->vma;
01999 relocation += symbol->section->output_offset;
02000
02001 if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
02002 return bfd_reloc_outofrange;
02003
02004
02005 val = reloc_entry->addend;
02006
02007 if (reloc_entry->howto->partial_inplace)
02008 val += bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
02009
02010
02011
02012
02013 if (! relocatable
02014 || (symbol->flags & BSF_SECTION_SYM) != 0)
02015 val += relocation - gp;
02016
02017 if (reloc_entry->howto->partial_inplace)
02018 bfd_put_32 (abfd, val, (bfd_byte *) data + reloc_entry->address);
02019 else
02020 reloc_entry->addend = val;
02021
02022 if (relocatable)
02023 reloc_entry->address += input_section->output_offset;
02024
02025 return bfd_reloc_ok;
02026 }
02027
02028
02029
02030
02031 static bfd_reloc_status_type
02032 mips_elf64_shift6_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
02033 void *data, asection *input_section, bfd *output_bfd,
02034 char **error_message)
02035 {
02036 if (reloc_entry->howto->partial_inplace)
02037 {
02038 reloc_entry->addend = ((reloc_entry->addend & 0x00007c0)
02039 | (reloc_entry->addend & 0x00000800) >> 9);
02040 }
02041
02042 return _bfd_mips_elf_generic_reloc (abfd, reloc_entry, symbol, data,
02043 input_section, output_bfd,
02044 error_message);
02045 }
02046
02047
02048
02049 static bfd_reloc_status_type
02050 mips16_jump_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
02051 asymbol *symbol, void *data ATTRIBUTE_UNUSED,
02052 asection *input_section, bfd *output_bfd,
02053 char **error_message ATTRIBUTE_UNUSED)
02054 {
02055 if (output_bfd != NULL
02056 && (symbol->flags & BSF_SECTION_SYM) == 0
02057 && (! reloc_entry->howto->partial_inplace
02058 || reloc_entry->addend == 0))
02059 {
02060 reloc_entry->address += input_section->output_offset;
02061 return bfd_reloc_ok;
02062 }
02063
02064
02065 {
02066 static bfd_boolean warned;
02067
02068 if (! warned)
02069 (*_bfd_error_handler)
02070 (_("Linking mips16 objects into %s format is not supported"),
02071 bfd_get_target (input_section->output_section->owner));
02072 warned = TRUE;
02073 }
02074
02075 return bfd_reloc_undefined;
02076 }
02077
02078
02079
02080 static bfd_reloc_status_type
02081 mips16_gprel_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
02082 void *data, asection *input_section, bfd *output_bfd,
02083 char **error_message)
02084 {
02085 bfd_boolean relocatable;
02086 bfd_reloc_status_type ret;
02087 bfd_byte *location;
02088 bfd_vma gp;
02089
02090
02091
02092 if (output_bfd != NULL
02093 && (symbol->flags & BSF_SECTION_SYM) == 0
02094 && (symbol->flags & BSF_LOCAL) != 0)
02095 {
02096 reloc_entry->address += input_section->output_offset;
02097 return bfd_reloc_ok;
02098 }
02099
02100 if (output_bfd != NULL)
02101 relocatable = TRUE;
02102 else
02103 {
02104 relocatable = FALSE;
02105 output_bfd = symbol->section->output_section->owner;
02106 }
02107
02108 ret = mips_elf64_final_gp (output_bfd, symbol, relocatable, error_message,
02109 &gp);
02110 if (ret != bfd_reloc_ok)
02111 return ret;
02112
02113 location = (bfd_byte *) data + reloc_entry->address;
02114 _bfd_mips16_elf_reloc_unshuffle (abfd, reloc_entry->howto->type, FALSE,
02115 location);
02116 ret = _bfd_mips_elf_gprel16_with_gp (abfd, symbol, reloc_entry,
02117 input_section, relocatable,
02118 data, gp);
02119 _bfd_mips16_elf_reloc_shuffle (abfd, reloc_entry->howto->type, !relocatable,
02120 location);
02121
02122 return ret;
02123 }
02124
02125
02126
02127 struct elf_reloc_map {
02128 bfd_reloc_code_real_type bfd_val;
02129 enum elf_mips_reloc_type elf_val;
02130 };
02131
02132 static const struct elf_reloc_map mips_reloc_map[] =
02133 {
02134 { BFD_RELOC_NONE, R_MIPS_NONE },
02135 { BFD_RELOC_16, R_MIPS_16 },
02136 { BFD_RELOC_32, R_MIPS_32 },
02137
02138 { BFD_RELOC_64, R_MIPS_64 },
02139 { BFD_RELOC_CTOR, R_MIPS_64 },
02140 { BFD_RELOC_16_PCREL, R_MIPS_PC16 },
02141 { BFD_RELOC_HI16_S, R_MIPS_HI16 },
02142 { BFD_RELOC_LO16, R_MIPS_LO16 },
02143 { BFD_RELOC_GPREL16, R_MIPS_GPREL16 },
02144 { BFD_RELOC_GPREL32, R_MIPS_GPREL32 },
02145 { BFD_RELOC_MIPS_JMP, R_MIPS_26 },
02146 { BFD_RELOC_MIPS_LITERAL, R_MIPS_LITERAL },
02147 { BFD_RELOC_MIPS_GOT16, R_MIPS_GOT16 },
02148 { BFD_RELOC_MIPS_CALL16, R_MIPS_CALL16 },
02149 { BFD_RELOC_MIPS_SHIFT5, R_MIPS_SHIFT5 },
02150 { BFD_RELOC_MIPS_SHIFT6, R_MIPS_SHIFT6 },
02151 { BFD_RELOC_MIPS_GOT_DISP, R_MIPS_GOT_DISP },
02152 { BFD_RELOC_MIPS_GOT_PAGE, R_MIPS_GOT_PAGE },
02153 { BFD_RELOC_MIPS_GOT_OFST, R_MIPS_GOT_OFST },
02154 { BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 },
02155 { BFD_RELOC_MIPS_GOT_LO16, R_MIPS_GOT_LO16 },
02156 { BFD_RELOC_MIPS_SUB, R_MIPS_SUB },
02157 { BFD_RELOC_MIPS_INSERT_A, R_MIPS_INSERT_A },
02158 { BFD_RELOC_MIPS_INSERT_B, R_MIPS_INSERT_B },
02159 { BFD_RELOC_MIPS_DELETE, R_MIPS_DELETE },
02160 { BFD_RELOC_MIPS_HIGHEST, R_MIPS_HIGHEST },
02161 { BFD_RELOC_MIPS_HIGHER, R_MIPS_HIGHER },
02162 { BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 },
02163 { BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 },
02164 { BFD_RELOC_MIPS_SCN_DISP, R_MIPS_SCN_DISP },
02165 { BFD_RELOC_MIPS_REL16, R_MIPS_REL16 },
02166
02167 { BFD_RELOC_MIPS_RELGOT, R_MIPS_RELGOT },
02168 { BFD_RELOC_MIPS_JALR, R_MIPS_JALR },
02169 { BFD_RELOC_MIPS_TLS_DTPMOD32, R_MIPS_TLS_DTPMOD32 },
02170 { BFD_RELOC_MIPS_TLS_DTPREL32, R_MIPS_TLS_DTPREL32 },
02171 { BFD_RELOC_MIPS_TLS_DTPMOD64, R_MIPS_TLS_DTPMOD64 },
02172 { BFD_RELOC_MIPS_TLS_DTPREL64, R_MIPS_TLS_DTPREL64 },
02173 { BFD_RELOC_MIPS_TLS_GD, R_MIPS_TLS_GD },
02174 { BFD_RELOC_MIPS_TLS_LDM, R_MIPS_TLS_LDM },
02175 { BFD_RELOC_MIPS_TLS_DTPREL_HI16, R_MIPS_TLS_DTPREL_HI16 },
02176 { BFD_RELOC_MIPS_TLS_DTPREL_LO16, R_MIPS_TLS_DTPREL_LO16 },
02177 { BFD_RELOC_MIPS_TLS_GOTTPREL, R_MIPS_TLS_GOTTPREL },
02178 { BFD_RELOC_MIPS_TLS_TPREL32, R_MIPS_TLS_TPREL32 },
02179 { BFD_RELOC_MIPS_TLS_TPREL64, R_MIPS_TLS_TPREL64 },
02180 { BFD_RELOC_MIPS_TLS_TPREL_HI16, R_MIPS_TLS_TPREL_HI16 },
02181 { BFD_RELOC_MIPS_TLS_TPREL_LO16, R_MIPS_TLS_TPREL_LO16 }
02182 };
02183
02184 static const struct elf_reloc_map mips16_reloc_map[] =
02185 {
02186 { BFD_RELOC_MIPS16_JMP, R_MIPS16_26 - R_MIPS16_min },
02187 { BFD_RELOC_MIPS16_GPREL, R_MIPS16_GPREL - R_MIPS16_min },
02188 { BFD_RELOC_MIPS16_HI16_S, R_MIPS16_HI16 - R_MIPS16_min },
02189 { BFD_RELOC_MIPS16_LO16, R_MIPS16_LO16 - R_MIPS16_min },
02190 };
02191
02192
02193
02194 static reloc_howto_type *
02195 bfd_elf64_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
02196 bfd_reloc_code_real_type code)
02197 {
02198 unsigned int i;
02199
02200
02201 reloc_howto_type *howto_table = mips_elf64_howto_table_rela;
02202 reloc_howto_type *howto16_table = mips16_elf64_howto_table_rela;
02203
02204 for (i = 0; i < sizeof (mips_reloc_map) / sizeof (struct elf_reloc_map);
02205 i++)
02206 {
02207 if (mips_reloc_map[i].bfd_val == code)
02208 return &howto_table[(int) mips_reloc_map[i].elf_val];
02209 }
02210
02211 for (i = 0; i < sizeof (mips16_reloc_map) / sizeof (struct elf_reloc_map);
02212 i++)
02213 {
02214 if (mips16_reloc_map[i].bfd_val == code)
02215 return &howto16_table[(int) mips16_reloc_map[i].elf_val];
02216 }
02217
02218 switch (code)
02219 {
02220 case BFD_RELOC_VTABLE_INHERIT:
02221 return &elf_mips_gnu_vtinherit_howto;
02222 case BFD_RELOC_VTABLE_ENTRY:
02223 return &elf_mips_gnu_vtentry_howto;
02224 case BFD_RELOC_16_PCREL_S2:
02225 return &elf_mips_gnu_rela16_s2;
02226 default:
02227 bfd_set_error (bfd_error_bad_value);
02228 return NULL;
02229 }
02230 }
02231
02232
02233
02234 static reloc_howto_type *
02235 mips_elf64_rtype_to_howto (unsigned int r_type, bfd_boolean rela_p)
02236 {
02237 switch (r_type)
02238 {
02239 case R_MIPS_GNU_VTINHERIT:
02240 return &elf_mips_gnu_vtinherit_howto;
02241 case R_MIPS_GNU_VTENTRY:
02242 return &elf_mips_gnu_vtentry_howto;
02243 case R_MIPS_GNU_REL16_S2:
02244 if (rela_p)
02245 return &elf_mips_gnu_rela16_s2;
02246 else
02247 return &elf_mips_gnu_rel16_s2;
02248 default:
02249 if (r_type >= R_MIPS16_min && r_type < R_MIPS16_max)
02250 {
02251 if (rela_p)
02252 return &mips16_elf64_howto_table_rela[r_type - R_MIPS16_min];
02253 else
02254 return &mips16_elf64_howto_table_rel[r_type - R_MIPS16_min];
02255 }
02256 BFD_ASSERT (r_type < (unsigned int) R_MIPS_max);
02257 if (rela_p)
02258 return &mips_elf64_howto_table_rela[r_type];
02259 else
02260 return &mips_elf64_howto_table_rel[r_type];
02261 break;
02262 }
02263 }
02264
02265
02266
02267 static void
02268 mips_elf64_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED,
02269 arelent *cache_ptr ATTRIBUTE_UNUSED,
02270 Elf_Internal_Rela *dst ATTRIBUTE_UNUSED)
02271 {
02272 BFD_ASSERT (0);
02273 }
02274
02275 static void
02276 mips_elf64_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED,
02277 arelent *cache_ptr ATTRIBUTE_UNUSED,
02278 Elf_Internal_Rela *dst ATTRIBUTE_UNUSED)
02279 {
02280 BFD_ASSERT (0);
02281 }
02282
02283
02284
02285
02286 static long
02287 mips_elf64_get_reloc_upper_bound (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
02288 {
02289 return (sec->reloc_count * 3 + 1) * sizeof (arelent *);
02290 }
02291
02292 static long
02293 mips_elf64_get_dynamic_reloc_upper_bound (bfd *abfd)
02294 {
02295 return _bfd_elf_get_dynamic_reloc_upper_bound (abfd) * 3;
02296 }
02297
02298
02299
02300
02301
02302
02303 static long
02304 mips_elf64_canonicalize_reloc (bfd *abfd, sec_ptr section,
02305 arelent **relptr, asymbol **symbols)
02306 {
02307 arelent *tblptr;
02308 unsigned int i;
02309 const struct elf_backend_data *bed = get_elf_backend_data (abfd);
02310
02311 if (! bed->s->slurp_reloc_table (abfd, section, symbols, FALSE))
02312 return -1;
02313
02314 tblptr = section->relocation;
02315 for (i = 0; i < section->reloc_count * 3; i++)
02316 *relptr++ = tblptr++;
02317
02318 *relptr = NULL;
02319
02320 return section->reloc_count * 3;
02321 }
02322
02323 static long
02324 mips_elf64_canonicalize_dynamic_reloc (bfd *abfd, arelent **storage,
02325 asymbol **syms)
02326 {
02327 bfd_boolean (*slurp_relocs) (bfd *, asection *, asymbol **, bfd_boolean);
02328 asection *s;
02329 long ret;
02330
02331 if (elf_dynsymtab (abfd) == 0)
02332 {
02333 bfd_set_error (bfd_error_invalid_operation);
02334 return -1;
02335 }
02336
02337 slurp_relocs = get_elf_backend_data (abfd)->s->slurp_reloc_table;
02338 ret = 0;
02339 for (s = abfd->sections; s != NULL; s = s->next)
02340 {
02341 if (elf_section_data (s)->this_hdr.sh_link == elf_dynsymtab (abfd)
02342 && (elf_section_data (s)->this_hdr.sh_type == SHT_REL
02343 || elf_section_data (s)->this_hdr.sh_type == SHT_RELA))
02344 {
02345 arelent *p;
02346 long count, i;
02347
02348 if (! (*slurp_relocs) (abfd, s, syms, TRUE))
02349 return -1;
02350 count = s->size / elf_section_data (s)->this_hdr.sh_entsize * 3;
02351 p = s->relocation;
02352 for (i = 0; i < count; i++)
02353 *storage++ = p++;
02354 ret += count;
02355 }
02356 }
02357
02358 *storage = NULL;
02359
02360 return ret;
02361 }
02362
02363
02364
02365
02366
02367
02368
02369 static bfd_boolean
02370 mips_elf64_slurp_one_reloc_table (bfd *abfd, asection *asect,
02371 Elf_Internal_Shdr *rel_hdr,
02372 bfd_size_type reloc_count,
02373 arelent *relents, asymbol **symbols,
02374 bfd_boolean dynamic)
02375 {
02376 void *allocated;
02377 bfd_byte *native_relocs;
02378 arelent *relent;
02379 bfd_vma i;
02380 int entsize;
02381 bfd_boolean rela_p;
02382
02383 allocated = bfd_malloc (rel_hdr->sh_size);
02384 if (allocated == NULL)
02385 return FALSE;
02386
02387 if (bfd_seek (abfd, rel_hdr->sh_offset, SEEK_SET) != 0
02388 || (bfd_bread (allocated, rel_hdr->sh_size, abfd)
02389 != rel_hdr->sh_size))
02390 goto error_return;
02391
02392 native_relocs = allocated;
02393
02394 entsize = rel_hdr->sh_entsize;
02395 BFD_ASSERT (entsize == sizeof (Elf64_Mips_External_Rel)
02396 || entsize == sizeof (Elf64_Mips_External_Rela));
02397
02398 if (entsize == sizeof (Elf64_Mips_External_Rel))
02399 rela_p = FALSE;
02400 else
02401 rela_p = TRUE;
02402
02403 for (i = 0, relent = relents;
02404 i < reloc_count;
02405 i++, native_relocs += entsize)
02406 {
02407 Elf64_Mips_Internal_Rela rela;
02408 bfd_boolean used_sym, used_ssym;
02409 int ir;
02410
02411 if (entsize == sizeof (Elf64_Mips_External_Rela))
02412 mips_elf64_swap_reloca_in (abfd,
02413 (Elf64_Mips_External_Rela *) native_relocs,
02414 &rela);
02415 else
02416 mips_elf64_swap_reloc_in (abfd,
02417 (Elf64_Mips_External_Rel *) native_relocs,
02418 &rela);
02419
02420
02421
02422 used_sym = FALSE;
02423 used_ssym = FALSE;
02424 for (ir = 0; ir < 3; ir++)
02425 {
02426 enum elf_mips_reloc_type type;
02427
02428 switch (ir)
02429 {
02430 default:
02431 abort ();
02432 case 0:
02433 type = (enum elf_mips_reloc_type) rela.r_type;
02434 break;
02435 case 1:
02436 type = (enum elf_mips_reloc_type) rela.r_type2;
02437 break;
02438 case 2:
02439 type = (enum elf_mips_reloc_type) rela.r_type3;
02440 break;
02441 }
02442
02443
02444 switch (type)
02445 {
02446 case R_MIPS_NONE:
02447 case R_MIPS_LITERAL:
02448 case R_MIPS_INSERT_A:
02449 case R_MIPS_INSERT_B:
02450 case R_MIPS_DELETE:
02451 relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
02452 break;
02453
02454 default:
02455 if (! used_sym)
02456 {
02457 if (rela.r_sym == 0)
02458 relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
02459 else
02460 {
02461 asymbol **ps, *s;
02462
02463 ps = symbols + rela.r_sym - 1;
02464 s = *ps;
02465 if ((s->flags & BSF_SECTION_SYM) == 0)
02466 relent->sym_ptr_ptr = ps;
02467 else
02468 relent->sym_ptr_ptr = s->section->symbol_ptr_ptr;
02469 }
02470
02471 used_sym = TRUE;
02472 }
02473 else if (! used_ssym)
02474 {
02475 switch (rela.r_ssym)
02476 {
02477 case RSS_UNDEF:
02478 relent->sym_ptr_ptr =
02479 bfd_abs_section_ptr->symbol_ptr_ptr;
02480 break;
02481
02482 case RSS_GP:
02483 case RSS_GP0:
02484 case RSS_LOC:
02485
02486
02487 BFD_ASSERT (0);
02488 break;
02489
02490 default:
02491 BFD_ASSERT (0);
02492 break;
02493 }
02494
02495 used_ssym = TRUE;
02496 }
02497 else
02498 relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
02499
02500 break;
02501 }
02502
02503
02504
02505
02506
02507 if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0 || dynamic)
02508 relent->address = rela.r_offset;
02509 else
02510 relent->address = rela.r_offset - asect->vma;
02511
02512 relent->addend = rela.r_addend;
02513
02514 relent->howto = mips_elf64_rtype_to_howto (type, rela_p);
02515
02516 ++relent;
02517 }
02518 }
02519
02520 asect->reloc_count += (relent - relents) / 3;
02521
02522 if (allocated != NULL)
02523 free (allocated);
02524
02525 return TRUE;
02526
02527 error_return:
02528 if (allocated != NULL)
02529 free (allocated);
02530 return FALSE;
02531 }
02532
02533
02534
02535
02536
02537
02538
02539 static bfd_boolean
02540 mips_elf64_slurp_reloc_table (bfd *abfd, asection *asect,
02541 asymbol **symbols, bfd_boolean dynamic)
02542 {
02543 struct bfd_elf_section_data * const d = elf_section_data (asect);
02544 Elf_Internal_Shdr *rel_hdr;
02545 Elf_Internal_Shdr *rel_hdr2;
02546 bfd_size_type reloc_count;
02547 bfd_size_type reloc_count2;
02548 arelent *relents;
02549 bfd_size_type amt;
02550
02551 if (asect->relocation != NULL)
02552 return TRUE;
02553
02554 if (! dynamic)
02555 {
02556 if ((asect->flags & SEC_RELOC) == 0
02557 || asect->reloc_count == 0)
02558 return TRUE;
02559
02560 rel_hdr = &d->rel_hdr;
02561 reloc_count = NUM_SHDR_ENTRIES (rel_hdr);
02562 rel_hdr2 = d->rel_hdr2;
02563 reloc_count2 = (rel_hdr2 ? NUM_SHDR_ENTRIES (rel_hdr2) : 0);
02564
02565 BFD_ASSERT (asect->reloc_count == reloc_count + reloc_count2);
02566 BFD_ASSERT (asect->rel_filepos == rel_hdr->sh_offset
02567 || (rel_hdr2 && asect->rel_filepos == rel_hdr2->sh_offset));
02568
02569 }
02570 else
02571 {
02572
02573
02574
02575
02576 if (asect->size == 0)
02577 return TRUE;
02578
02579 rel_hdr = &d->this_hdr;
02580 reloc_count = NUM_SHDR_ENTRIES (rel_hdr);
02581 rel_hdr2 = NULL;
02582 reloc_count2 = 0;
02583 }
02584
02585
02586 amt = (reloc_count + reloc_count2) * 3 * sizeof (arelent);
02587 relents = bfd_alloc (abfd, amt);
02588 if (relents == NULL)
02589 return FALSE;
02590
02591
02592 asect->reloc_count = 0;
02593
02594 if (! mips_elf64_slurp_one_reloc_table (abfd, asect,
02595 rel_hdr, reloc_count,
02596 relents,
02597 symbols, dynamic))
02598 return FALSE;
02599 if (d->rel_hdr2 != NULL)
02600 {
02601 if (! mips_elf64_slurp_one_reloc_table (abfd, asect,
02602 rel_hdr2, reloc_count2,
02603 relents + reloc_count * 3,
02604 symbols, dynamic))
02605 return FALSE;
02606 }
02607
02608 asect->relocation = relents;
02609 return TRUE;
02610 }
02611
02612
02613
02614 static void
02615 mips_elf64_write_relocs (bfd *abfd, asection *sec, void *data)
02616 {
02617 bfd_boolean *failedp = data;
02618 int count;
02619 Elf_Internal_Shdr *rel_hdr;
02620 unsigned int idx;
02621
02622
02623 if (*failedp)
02624 return;
02625
02626 if ((sec->flags & SEC_RELOC) == 0)
02627 return;
02628
02629
02630
02631
02632
02633 if (sec->reloc_count == 0)
02634 return;
02635
02636
02637
02638 count = 0;
02639 for (idx = 0; idx < sec->reloc_count; idx++)
02640 {
02641 bfd_vma addr;
02642 unsigned int i;
02643
02644 ++count;
02645
02646 addr = sec->orelocation[idx]->address;
02647 for (i = 0; i < 2; i++)
02648 {
02649 arelent *r;
02650
02651 if (idx + 1 >= sec->reloc_count)
02652 break;
02653 r = sec->orelocation[idx + 1];
02654 if (r->address != addr
02655 || ! bfd_is_abs_section ((*r->sym_ptr_ptr)->section)
02656 || (*r->sym_ptr_ptr)->value != 0)
02657 break;
02658
02659
02660
02661 ++idx;
02662 }
02663 }
02664
02665 rel_hdr = &elf_section_data (sec)->rel_hdr;
02666
02667
02668
02669 if (rel_hdr->sh_entsize == sizeof(Elf64_Mips_External_Rel))
02670 mips_elf64_write_rel (abfd, sec, rel_hdr, &count, data);
02671 else if (rel_hdr->sh_entsize == sizeof(Elf64_Mips_External_Rela))
02672 mips_elf64_write_rela (abfd, sec, rel_hdr, &count, data);
02673 else
02674 BFD_ASSERT (0);
02675 }
02676
02677 static void
02678 mips_elf64_write_rel (bfd *abfd, asection *sec,
02679 Elf_Internal_Shdr *rel_hdr,
02680 int *count, void *data)
02681 {
02682 bfd_boolean *failedp = data;
02683 Elf64_Mips_External_Rel *ext_rel;
02684 unsigned int idx;
02685 asymbol *last_sym = 0;
02686 int last_sym_idx = 0;
02687
02688 rel_hdr->sh_size = rel_hdr->sh_entsize * *count;
02689 rel_hdr->contents = bfd_alloc (abfd, rel_hdr->sh_size);
02690 if (rel_hdr->contents == NULL)
02691 {
02692 *failedp = TRUE;
02693 return;
02694 }
02695
02696 ext_rel = (Elf64_Mips_External_Rel *) rel_hdr->contents;
02697 for (idx = 0; idx < sec->reloc_count; idx++, ext_rel++)
02698 {
02699 arelent *ptr;
02700 Elf64_Mips_Internal_Rela int_rel;
02701 asymbol *sym;
02702 int n;
02703 unsigned int i;
02704
02705 ptr = sec->orelocation[idx];
02706
02707
02708
02709
02710 if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
02711 int_rel.r_offset = ptr->address;
02712 else
02713 int_rel.r_offset = ptr->address + sec->vma;
02714
02715 sym = *ptr->sym_ptr_ptr;
02716 if (sym == last_sym)
02717 n = last_sym_idx;
02718 else if (bfd_is_abs_section (sym->section) && sym->value == 0)
02719 n = STN_UNDEF;
02720 else
02721 {
02722 last_sym = sym;
02723 n = _bfd_elf_symbol_from_bfd_symbol (abfd, &sym);
02724 if (n < 0)
02725 {
02726 *failedp = TRUE;
02727 return;
02728 }
02729 last_sym_idx = n;
02730 }
02731
02732 int_rel.r_sym = n;
02733 int_rel.r_ssym = RSS_UNDEF;
02734
02735 if ((*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
02736 && ! _bfd_elf_validate_reloc (abfd, ptr))
02737 {
02738 *failedp = TRUE;
02739 return;
02740 }
02741
02742 int_rel.r_type = ptr->howto->type;
02743 int_rel.r_type2 = (int) R_MIPS_NONE;
02744 int_rel.r_type3 = (int) R_MIPS_NONE;
02745
02746 for (i = 0; i < 2; i++)
02747 {
02748 arelent *r;
02749
02750 if (idx + 1 >= sec->reloc_count)
02751 break;
02752 r = sec->orelocation[idx + 1];
02753 if (r->address != ptr->address
02754 || ! bfd_is_abs_section ((*r->sym_ptr_ptr)->section)
02755 || (*r->sym_ptr_ptr)->value != 0)
02756 break;
02757
02758
02759
02760 if (i == 0)
02761 int_rel.r_type2 = r->howto->type;
02762 else
02763 int_rel.r_type3 = r->howto->type;
02764
02765 ++idx;
02766 }
02767
02768 mips_elf64_swap_reloc_out (abfd, &int_rel, ext_rel);
02769 }
02770
02771 BFD_ASSERT (ext_rel - (Elf64_Mips_External_Rel *) rel_hdr->contents
02772 == *count);
02773 }
02774
02775 static void
02776 mips_elf64_write_rela (bfd *abfd, asection *sec,
02777 Elf_Internal_Shdr *rela_hdr,
02778 int *count, void *data)
02779 {
02780 bfd_boolean *failedp = data;
02781 Elf64_Mips_External_Rela *ext_rela;
02782 unsigned int idx;
02783 asymbol *last_sym = 0;
02784 int last_sym_idx = 0;
02785
02786 rela_hdr->sh_size = rela_hdr->sh_entsize * *count;
02787 rela_hdr->contents = bfd_alloc (abfd, rela_hdr->sh_size);
02788 if (rela_hdr->contents == NULL)
02789 {
02790 *failedp = TRUE;
02791 return;
02792 }
02793
02794 ext_rela = (Elf64_Mips_External_Rela *) rela_hdr->contents;
02795 for (idx = 0; idx < sec->reloc_count; idx++, ext_rela++)
02796 {
02797 arelent *ptr;
02798 Elf64_Mips_Internal_Rela int_rela;
02799 asymbol *sym;
02800 int n;
02801 unsigned int i;
02802
02803 ptr = sec->orelocation[idx];
02804
02805
02806
02807
02808 if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
02809 int_rela.r_offset = ptr->address;
02810 else
02811 int_rela.r_offset = ptr->address + sec->vma;
02812
02813 sym = *ptr->sym_ptr_ptr;
02814 if (sym == last_sym)
02815 n = last_sym_idx;
02816 else if (bfd_is_abs_section (sym->section) && sym->value == 0)
02817 n = STN_UNDEF;
02818 else
02819 {
02820 last_sym = sym;
02821 n = _bfd_elf_symbol_from_bfd_symbol (abfd, &sym);
02822 if (n < 0)
02823 {
02824 *failedp = TRUE;
02825 return;
02826 }
02827 last_sym_idx = n;
02828 }
02829
02830 int_rela.r_sym = n;
02831 int_rela.r_addend = ptr->addend;
02832 int_rela.r_ssym = RSS_UNDEF;
02833
02834 if ((*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
02835 && ! _bfd_elf_validate_reloc (abfd, ptr))
02836 {
02837 *failedp = TRUE;
02838 return;
02839 }
02840
02841 int_rela.r_type = ptr->howto->type;
02842 int_rela.r_type2 = (int) R_MIPS_NONE;
02843 int_rela.r_type3 = (int) R_MIPS_NONE;
02844
02845 for (i = 0; i < 2; i++)
02846 {
02847 arelent *r;
02848
02849 if (idx + 1 >= sec->reloc_count)
02850 break;
02851 r = sec->orelocation[idx + 1];
02852 if (r->address != ptr->address
02853 || ! bfd_is_abs_section ((*r->sym_ptr_ptr)->section)
02854 || (*r->sym_ptr_ptr)->value != 0)
02855 break;
02856
02857
02858
02859 if (i == 0)
02860 int_rela.r_type2 = r->howto->type;
02861 else
02862 int_rela.r_type3 = r->howto->type;
02863
02864 ++idx;
02865 }
02866
02867 mips_elf64_swap_reloca_out (abfd, &int_rela, ext_rela);
02868 }
02869
02870 BFD_ASSERT (ext_rela - (Elf64_Mips_External_Rela *) rela_hdr->contents
02871 == *count);
02872 }
02873
02874
02875
02876 static bfd_boolean
02877 mips_elf64_object_p (bfd *abfd)
02878 {
02879 unsigned long mach;
02880
02881
02882
02883
02884 if (elf64_mips_irix_compat (abfd) != ict_none)
02885 elf_bad_symtab (abfd) = TRUE;
02886
02887 mach = _bfd_elf_mips_mach (elf_elfheader (abfd)->e_flags);
02888 bfd_default_set_arch_mach (abfd, bfd_arch_mips, mach);
02889 return TRUE;
02890 }
02891
02892
02893
02894 static irix_compat_t
02895 elf64_mips_irix_compat (bfd *abfd)
02896 {
02897 if ((abfd->xvec == &bfd_elf64_bigmips_vec)
02898 || (abfd->xvec == &bfd_elf64_littlemips_vec))
02899 return ict_irix6;
02900 else
02901 return ict_none;
02902 }
02903
02904
02905 static bfd_boolean
02906 elf64_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
02907 {
02908 int offset;
02909 unsigned int size;
02910
02911 switch (note->descsz)
02912 {
02913 default:
02914 return FALSE;
02915
02916 case 480:
02917
02918 elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
02919
02920
02921 elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 32);
02922
02923
02924 offset = 112;
02925 size = 360;
02926
02927 break;
02928 }
02929
02930
02931 return _bfd_elfcore_make_pseudosection (abfd, ".reg",
02932 size, note->descpos + offset);
02933 }
02934
02935 static bfd_boolean
02936 elf64_mips_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
02937 {
02938 switch (note->descsz)
02939 {
02940 default:
02941 return FALSE;
02942
02943 case 136:
02944 elf_tdata (abfd)->core_program
02945 = _bfd_elfcore_strndup (abfd, note->descdata + 40, 16);
02946 elf_tdata (abfd)->core_command
02947 = _bfd_elfcore_strndup (abfd, note->descdata + 56, 80);
02948 }
02949
02950
02951
02952
02953
02954 {
02955 char *command = elf_tdata (abfd)->core_command;
02956 int n = strlen (command);
02957
02958 if (0 < n && command[n - 1] == ' ')
02959 command[n - 1] = '\0';
02960 }
02961
02962 return TRUE;
02963 }
02964
02965
02966
02967 static const struct ecoff_debug_swap mips_elf64_ecoff_debug_swap =
02968 {
02969
02970 magicSym2,
02971
02972 8,
02973
02974 sizeof (struct hdr_ext),
02975 sizeof (struct dnr_ext),
02976 sizeof (struct pdr_ext),
02977 sizeof (struct sym_ext),
02978 sizeof (struct opt_ext),
02979 sizeof (struct fdr_ext),
02980 sizeof (struct rfd_ext),
02981 sizeof (struct ext_ext),
02982
02983 ecoff_swap_hdr_in,
02984 ecoff_swap_dnr_in,
02985 ecoff_swap_pdr_in,
02986 ecoff_swap_sym_in,
02987 ecoff_swap_opt_in,
02988 ecoff_swap_fdr_in,
02989 ecoff_swap_rfd_in,
02990 ecoff_swap_ext_in,
02991 _bfd_ecoff_swap_tir_in,
02992 _bfd_ecoff_swap_rndx_in,
02993
02994 ecoff_swap_hdr_out,
02995 ecoff_swap_dnr_out,
02996 ecoff_swap_pdr_out,
02997 ecoff_swap_sym_out,
02998 ecoff_swap_opt_out,
02999 ecoff_swap_fdr_out,
03000 ecoff_swap_rfd_out,
03001 ecoff_swap_ext_out,
03002 _bfd_ecoff_swap_tir_out,
03003 _bfd_ecoff_swap_rndx_out,
03004
03005 _bfd_mips_elf_read_ecoff_info
03006 };
03007
03008
03009
03010
03011
03012 const struct elf_size_info mips_elf64_size_info =
03013 {
03014 sizeof (Elf64_External_Ehdr),
03015 sizeof (Elf64_External_Phdr),
03016 sizeof (Elf64_External_Shdr),
03017 sizeof (Elf64_Mips_External_Rel),
03018 sizeof (Elf64_Mips_External_Rela),
03019 sizeof (Elf64_External_Sym),
03020 sizeof (Elf64_External_Dyn),
03021 sizeof (Elf_External_Note),
03022 4,
03023 3,
03024 64,
03025 3,
03026 ELFCLASS64,
03027 EV_CURRENT,
03028 bfd_elf64_write_out_phdrs,
03029 bfd_elf64_write_shdrs_and_ehdr,
03030 mips_elf64_write_relocs,
03031 bfd_elf64_swap_symbol_in,
03032 bfd_elf64_swap_symbol_out,
03033 mips_elf64_slurp_reloc_table,
03034 bfd_elf64_slurp_symbol_table,
03035 bfd_elf64_swap_dyn_in,
03036 bfd_elf64_swap_dyn_out,
03037 mips_elf64_be_swap_reloc_in,
03038 mips_elf64_be_swap_reloc_out,
03039 mips_elf64_be_swap_reloca_in,
03040 mips_elf64_be_swap_reloca_out
03041 };
03042
03043 #define ELF_ARCH bfd_arch_mips
03044 #define ELF_MACHINE_CODE EM_MIPS
03045
03046 #define elf_backend_collect TRUE
03047 #define elf_backend_type_change_ok TRUE
03048 #define elf_backend_can_gc_sections TRUE
03049 #define elf_info_to_howto mips_elf64_info_to_howto_rela
03050 #define elf_info_to_howto_rel mips_elf64_info_to_howto_rel
03051 #define elf_backend_object_p mips_elf64_object_p
03052 #define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing
03053 #define elf_backend_section_processing _bfd_mips_elf_section_processing
03054 #define elf_backend_section_from_shdr _bfd_mips_elf_section_from_shdr
03055 #define elf_backend_fake_sections _bfd_mips_elf_fake_sections
03056 #define elf_backend_section_from_bfd_section \
03057 _bfd_mips_elf_section_from_bfd_section
03058 #define elf_backend_add_symbol_hook _bfd_mips_elf_add_symbol_hook
03059 #define elf_backend_link_output_symbol_hook \
03060 _bfd_mips_elf_link_output_symbol_hook
03061 #define elf_backend_create_dynamic_sections \
03062 _bfd_mips_elf_create_dynamic_sections
03063 #define elf_backend_check_relocs _bfd_mips_elf_check_relocs
03064 #define elf_backend_adjust_dynamic_symbol \
03065 _bfd_mips_elf_adjust_dynamic_symbol
03066 #define elf_backend_always_size_sections \
03067 _bfd_mips_elf_always_size_sections
03068 #define elf_backend_size_dynamic_sections \
03069 _bfd_mips_elf_size_dynamic_sections
03070 #define elf_backend_relocate_section _bfd_mips_elf_relocate_section
03071 #define elf_backend_finish_dynamic_symbol \
03072 _bfd_mips_elf_finish_dynamic_symbol
03073 #define elf_backend_finish_dynamic_sections \
03074 _bfd_mips_elf_finish_dynamic_sections
03075 #define elf_backend_final_write_processing \
03076 _bfd_mips_elf_final_write_processing
03077 #define elf_backend_additional_program_headers \
03078 _bfd_mips_elf_additional_program_headers
03079 #define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map
03080 #define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook
03081 #define elf_backend_gc_sweep_hook _bfd_mips_elf_gc_sweep_hook
03082 #define elf_backend_copy_indirect_symbol \
03083 _bfd_mips_elf_copy_indirect_symbol
03084 #define elf_backend_hide_symbol _bfd_mips_elf_hide_symbol
03085 #define elf_backend_ignore_discarded_relocs \
03086 _bfd_mips_elf_ignore_discarded_relocs
03087 #define elf_backend_mips_irix_compat elf64_mips_irix_compat
03088 #define elf_backend_mips_rtype_to_howto mips_elf64_rtype_to_howto
03089 #define elf_backend_ecoff_debug_swap &mips_elf64_ecoff_debug_swap
03090 #define elf_backend_size_info mips_elf64_size_info
03091
03092 #define elf_backend_grok_prstatus elf64_mips_grok_prstatus
03093 #define elf_backend_grok_psinfo elf64_mips_grok_psinfo
03094
03095 #define elf_backend_got_header_size (4 * MIPS_RESERVED_GOTNO)
03096
03097
03098
03099 #define elf_backend_may_use_rel_p 1
03100 #define elf_backend_may_use_rela_p 1
03101 #define elf_backend_default_use_rela_p 1
03102
03103 #define elf_backend_write_section _bfd_mips_elf_write_section
03104
03105
03106
03107
03108 #define bfd_elf64_find_nearest_line _bfd_mips_elf_find_nearest_line
03109 #define bfd_elf64_new_section_hook _bfd_mips_elf_new_section_hook
03110 #define bfd_elf64_set_section_contents _bfd_mips_elf_set_section_contents
03111 #define bfd_elf64_bfd_get_relocated_section_contents \
03112 _bfd_elf_mips_get_relocated_section_contents
03113 #define bfd_elf64_bfd_link_hash_table_create \
03114 _bfd_mips_elf_link_hash_table_create
03115 #define bfd_elf64_bfd_final_link _bfd_mips_elf_final_link
03116 #define bfd_elf64_bfd_merge_private_bfd_data \
03117 _bfd_mips_elf_merge_private_bfd_data
03118 #define bfd_elf64_bfd_set_private_flags _bfd_mips_elf_set_private_flags
03119 #define bfd_elf64_bfd_print_private_bfd_data \
03120 _bfd_mips_elf_print_private_bfd_data
03121
03122 #define bfd_elf64_get_reloc_upper_bound mips_elf64_get_reloc_upper_bound
03123 #define bfd_elf64_canonicalize_reloc mips_elf64_canonicalize_reloc
03124 #define bfd_elf64_get_dynamic_reloc_upper_bound mips_elf64_get_dynamic_reloc_upper_bound
03125 #define bfd_elf64_canonicalize_dynamic_reloc mips_elf64_canonicalize_dynamic_reloc
03126 #define bfd_elf64_bfd_relax_section _bfd_mips_relax_section
03127
03128
03129 #define bfd_elf64_archive_functions
03130 extern bfd_boolean bfd_elf64_archive_slurp_armap
03131 (bfd *);
03132 extern bfd_boolean bfd_elf64_archive_write_armap
03133 (bfd *, unsigned int, struct orl *, unsigned int, int);
03134 #define bfd_elf64_archive_slurp_extended_name_table \
03135 _bfd_archive_coff_slurp_extended_name_table
03136 #define bfd_elf64_archive_construct_extended_name_table \
03137 _bfd_archive_coff_construct_extended_name_table
03138 #define bfd_elf64_archive_truncate_arname \
03139 _bfd_archive_coff_truncate_arname
03140 #define bfd_elf64_archive_read_ar_hdr _bfd_archive_coff_read_ar_hdr
03141 #define bfd_elf64_archive_openr_next_archived_file \
03142 _bfd_archive_coff_openr_next_archived_file
03143 #define bfd_elf64_archive_get_elt_at_index \
03144 _bfd_archive_coff_get_elt_at_index
03145 #define bfd_elf64_archive_generic_stat_arch_elt \
03146 _bfd_archive_coff_generic_stat_arch_elt
03147 #define bfd_elf64_archive_update_armap_timestamp \
03148 _bfd_archive_coff_update_armap_timestamp
03149
03150
03151 #define TARGET_LITTLE_SYM bfd_elf64_littlemips_vec
03152 #define TARGET_LITTLE_NAME "elf64-littlemips"
03153 #define TARGET_BIG_SYM bfd_elf64_bigmips_vec
03154 #define TARGET_BIG_NAME "elf64-bigmips"
03155
03156
03157
03158
03159 #define ELF_MAXPAGESIZE 0x1000
03160
03161 #include "elf64-target.h"
03162
03163
03164 #undef TARGET_LITTLE_SYM
03165 #undef TARGET_LITTLE_NAME
03166 #undef TARGET_BIG_SYM
03167 #undef TARGET_BIG_NAME
03168
03169 #undef ELF_MAXPAGESIZE
03170
03171 #define TARGET_LITTLE_SYM bfd_elf64_tradlittlemips_vec
03172 #define TARGET_LITTLE_NAME "elf64-tradlittlemips"
03173 #define TARGET_BIG_SYM bfd_elf64_tradbigmips_vec
03174 #define TARGET_BIG_NAME "elf64-tradbigmips"
03175
03176
03177
03178 #define ELF_MAXPAGESIZE 0x10000
03179 #define elf64_bed elf64_tradbed
03180
03181
03182 #include "elf64-target.h"