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 #define COFF_WITH_PE
00027 #define COFF_LONG_SECTION_NAMES
00028 #define PCRELOFFSET TRUE
00029
00030 #include "bfd.h"
00031 #include "sysdep.h"
00032 #include "libbfd.h"
00033
00034 #include "coff/mipspe.h"
00035
00036 #include "coff/internal.h"
00037
00038 #include "coff/pe.h"
00039
00040 #include "libcoff.h"
00041
00042 static bfd_reloc_status_type coff_mips_reloc
00043 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
00044 static reloc_howto_type *coff_mips_rtype_to_howto
00045 PARAMS ((bfd *, asection *, struct internal_reloc *,
00046 struct coff_link_hash_entry *, struct internal_syment *,
00047 bfd_vma *));
00048
00049 static bfd_boolean in_reloc_p
00050 PARAMS ((bfd *, reloc_howto_type *));
00051 static reloc_howto_type * coff_mips_reloc_type_lookup
00052 PARAMS ((bfd *, bfd_reloc_code_real_type));
00053 static void mips_swap_reloc_in
00054 PARAMS ((bfd *, PTR, PTR));
00055 static unsigned int mips_swap_reloc_out
00056 PARAMS ((bfd *, PTR, PTR));
00057 static bfd_boolean coff_pe_mips_relocate_section
00058 PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
00059 struct internal_reloc *, struct internal_syment *, asection **));
00060
00061 #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
00062
00063
00064 #define COFF_PAGE_SIZE 0x1000
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075 static bfd_reloc_status_type
00076 coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
00077 error_message)
00078 bfd *abfd;
00079 arelent *reloc_entry;
00080 asymbol *symbol;
00081 PTR data;
00082 asection *input_section ATTRIBUTE_UNUSED;
00083 bfd *output_bfd;
00084 char **error_message ATTRIBUTE_UNUSED;
00085 {
00086 symvalue diff;
00087
00088 if (output_bfd == (bfd *) NULL)
00089 return bfd_reloc_continue;
00090
00091 if (bfd_is_com_section (symbol->section))
00092 {
00093 #ifndef COFF_WITH_PE
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105 diff = symbol->value + reloc_entry->addend;
00106 #else
00107
00108 diff = reloc_entry->addend;
00109 #endif
00110 }
00111 else
00112 {
00113
00114
00115
00116
00117 diff = reloc_entry->addend;
00118 }
00119
00120 #define DOIT(x) \
00121 x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + (diff >> howto->rightshift)) & howto->dst_mask))
00122
00123 if (diff != 0)
00124 {
00125 reloc_howto_type *howto = reloc_entry->howto;
00126 unsigned char *addr = (unsigned char *) data + reloc_entry->address;
00127
00128 switch (howto->size)
00129 {
00130 case 0:
00131 {
00132 char x = bfd_get_8 (abfd, addr);
00133 DOIT (x);
00134 bfd_put_8 (abfd, x, addr);
00135 }
00136 break;
00137
00138 case 1:
00139 {
00140 short x = bfd_get_16 (abfd, addr);
00141 DOIT (x);
00142 bfd_put_16 (abfd, (bfd_vma) x, addr);
00143 }
00144 break;
00145
00146 case 2:
00147 {
00148 long x = bfd_get_32 (abfd, addr);
00149 DOIT (x);
00150 bfd_put_32 (abfd, (bfd_vma) x, addr);
00151 }
00152 break;
00153
00154 default:
00155 abort ();
00156 }
00157 }
00158
00159
00160 return bfd_reloc_continue;
00161 }
00162
00163 #ifdef COFF_WITH_PE
00164
00165
00166
00167 static bfd_boolean
00168 in_reloc_p (abfd, howto)
00169 bfd * abfd ATTRIBUTE_UNUSED;
00170 reloc_howto_type *howto;
00171 {
00172 return ! howto->pc_relative && howto->type != MIPS_R_RVA;
00173 }
00174 #endif
00175
00176 #ifndef PCRELOFFSET
00177 #define PCRELOFFSET FALSE
00178 #endif
00179
00180 static reloc_howto_type howto_table[] =
00181 {
00182
00183
00184
00185 HOWTO (MIPS_R_ABSOLUTE,
00186 0,
00187 0,
00188 8,
00189 FALSE,
00190 0,
00191 complain_overflow_dont,
00192 0,
00193 "IGNORE",
00194 FALSE,
00195 0,
00196 0,
00197 FALSE),
00198
00199
00200 HOWTO (MIPS_R_REFHALF,
00201 0,
00202 1,
00203 16,
00204 FALSE,
00205 0,
00206 complain_overflow_bitfield,
00207 coff_mips_reloc,
00208 "REFHALF",
00209 TRUE,
00210 0xffff,
00211 0xffff,
00212 FALSE),
00213
00214
00215 HOWTO (MIPS_R_REFWORD,
00216 0,
00217 2,
00218 32,
00219 FALSE,
00220 0,
00221 complain_overflow_bitfield,
00222 coff_mips_reloc,
00223 "REFWORD",
00224 TRUE,
00225 0xffffffff,
00226 0xffffffff,
00227 FALSE),
00228
00229
00230 HOWTO (MIPS_R_JMPADDR,
00231 2,
00232 2,
00233 26,
00234 FALSE,
00235 0,
00236 complain_overflow_dont,
00237
00238
00239
00240 coff_mips_reloc,
00241 "JMPADDR",
00242 TRUE,
00243 0x3ffffff,
00244 0x3ffffff,
00245 FALSE),
00246
00247
00248
00249 HOWTO (MIPS_R_REFHI,
00250 16,
00251 2,
00252 16,
00253 FALSE,
00254 0,
00255 complain_overflow_bitfield,
00256 coff_mips_reloc,
00257 "REFHI",
00258 TRUE,
00259 0xffff,
00260 0xffff,
00261 FALSE),
00262
00263
00264 HOWTO (MIPS_R_REFLO,
00265 0,
00266 2,
00267 16,
00268 FALSE,
00269 0,
00270 complain_overflow_dont,
00271 coff_mips_reloc,
00272 "REFLO",
00273 TRUE,
00274 0xffff,
00275 0xffff,
00276 FALSE),
00277
00278
00279
00280 HOWTO (MIPS_R_GPREL,
00281 0,
00282 2,
00283 16,
00284 FALSE,
00285 0,
00286 complain_overflow_signed,
00287 coff_mips_reloc,
00288 "GPREL",
00289 TRUE,
00290 0xffff,
00291 0xffff,
00292 FALSE),
00293
00294
00295
00296 HOWTO (MIPS_R_LITERAL,
00297 0,
00298 2,
00299 16,
00300 FALSE,
00301 0,
00302 complain_overflow_signed,
00303 coff_mips_reloc,
00304 "LITERAL",
00305 TRUE,
00306 0xffff,
00307 0xffff,
00308 FALSE),
00309
00310 EMPTY_HOWTO (8),
00311 EMPTY_HOWTO (9),
00312 EMPTY_HOWTO (10),
00313 EMPTY_HOWTO (11),
00314 EMPTY_HOWTO (12),
00315 EMPTY_HOWTO (13),
00316 EMPTY_HOWTO (14),
00317 EMPTY_HOWTO (15),
00318 EMPTY_HOWTO (16),
00319 EMPTY_HOWTO (17),
00320 EMPTY_HOWTO (18),
00321 EMPTY_HOWTO (19),
00322 EMPTY_HOWTO (20),
00323 EMPTY_HOWTO (21),
00324 EMPTY_HOWTO (22),
00325 EMPTY_HOWTO (23),
00326 EMPTY_HOWTO (24),
00327 EMPTY_HOWTO (25),
00328 EMPTY_HOWTO (26),
00329 EMPTY_HOWTO (27),
00330 EMPTY_HOWTO (28),
00331 EMPTY_HOWTO (29),
00332 EMPTY_HOWTO (30),
00333 EMPTY_HOWTO (31),
00334 EMPTY_HOWTO (32),
00335 EMPTY_HOWTO (33),
00336 HOWTO (MIPS_R_RVA,
00337 0,
00338 2,
00339 32,
00340 FALSE,
00341 0,
00342 complain_overflow_bitfield,
00343 coff_mips_reloc,
00344 "rva32",
00345 TRUE,
00346 0xffffffff,
00347 0xffffffff,
00348 FALSE),
00349 EMPTY_HOWTO (35),
00350 EMPTY_HOWTO (36),
00351 HOWTO (MIPS_R_PAIR,
00352 0,
00353 2,
00354 32,
00355 FALSE,
00356 0,
00357 complain_overflow_bitfield,
00358 coff_mips_reloc,
00359 "PAIR",
00360 TRUE,
00361 0xffffffff,
00362 0xffffffff,
00363 FALSE),
00364 };
00365
00366
00367
00368 #define SELECT_RELOC(x,howto) { x.r_type = howto->type; }
00369 #define BADMAG(x) MIPSBADMAG(x)
00370 #define MIPS 1
00371
00372 #define RTYPE2HOWTO(cache_ptr, dst) \
00373 (cache_ptr)->howto = howto_table + (dst)->r_type;
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388 #define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \
00389 { \
00390 coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \
00391 if (ptr && bfd_asymbol_bfd (ptr) != abfd) \
00392 coffsym = (obj_symbols (abfd) \
00393 + (cache_ptr->sym_ptr_ptr - symbols)); \
00394 else if (ptr) \
00395 coffsym = coff_symbol_from (abfd, ptr); \
00396 if (coffsym != (coff_symbol_type *) NULL \
00397 && coffsym->native->u.syment.n_scnum == 0) \
00398 cache_ptr->addend = - coffsym->native->u.syment.n_value; \
00399 else if (ptr && bfd_asymbol_bfd (ptr) == abfd \
00400 && ptr->section != (asection *) NULL) \
00401 cache_ptr->addend = - (ptr->section->vma + ptr->value); \
00402 else \
00403 cache_ptr->addend = 0; \
00404 if (ptr && howto_table[reloc.r_type].pc_relative) \
00405 cache_ptr->addend += asect->vma; \
00406 }
00407
00408
00409
00410 static reloc_howto_type *
00411 coff_mips_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
00412 bfd *abfd ATTRIBUTE_UNUSED;
00413 asection *sec;
00414 struct internal_reloc *rel;
00415 struct coff_link_hash_entry *h;
00416 struct internal_syment *sym;
00417 bfd_vma *addendp;
00418 {
00419
00420 reloc_howto_type *howto;
00421
00422 howto = howto_table + rel->r_type;
00423
00424 #ifdef COFF_WITH_PE
00425 *addendp = 0;
00426 #endif
00427
00428 if (howto->pc_relative)
00429 *addendp += sec->vma;
00430
00431 if (sym != NULL && sym->n_scnum == 0 && sym->n_value != 0)
00432 {
00433
00434
00435
00436
00437
00438
00439 BFD_ASSERT (h != NULL);
00440
00441 #ifndef COFF_WITH_PE
00442
00443
00444
00445
00446
00447
00448
00449 *addendp -= sym->n_value;
00450 #endif
00451 }
00452
00453 #ifndef COFF_WITH_PE
00454
00455
00456
00457 if (h != NULL && h->root.type == bfd_link_hash_common)
00458 *addendp += h->root.u.c.size;
00459 #endif
00460
00461 #ifdef COFF_WITH_PE
00462 if (howto->pc_relative)
00463 {
00464 *addendp -= 4;
00465
00466
00467
00468
00469
00470
00471
00472 if (sym != NULL && sym->n_scnum != 0)
00473 *addendp -= sym->n_value;
00474 }
00475
00476 if (rel->r_type == MIPS_R_RVA)
00477 {
00478 *addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase;
00479 }
00480 #endif
00481
00482 return howto;
00483 }
00484
00485 #define coff_rtype_to_howto coff_mips_rtype_to_howto
00486
00487 #define coff_bfd_reloc_type_lookup coff_mips_reloc_type_lookup
00488
00489
00490
00491 static reloc_howto_type *
00492 coff_mips_reloc_type_lookup (abfd, code)
00493 bfd *abfd ATTRIBUTE_UNUSED;
00494 bfd_reloc_code_real_type code;
00495 {
00496 int mips_type;
00497
00498 switch (code)
00499 {
00500 case BFD_RELOC_16:
00501 mips_type = MIPS_R_REFHALF;
00502 break;
00503 case BFD_RELOC_32:
00504 case BFD_RELOC_CTOR:
00505 mips_type = MIPS_R_REFWORD;
00506 break;
00507 case BFD_RELOC_MIPS_JMP:
00508 mips_type = MIPS_R_JMPADDR;
00509 break;
00510 case BFD_RELOC_HI16_S:
00511 mips_type = MIPS_R_REFHI;
00512 break;
00513 case BFD_RELOC_LO16:
00514 mips_type = MIPS_R_REFLO;
00515 break;
00516 case BFD_RELOC_GPREL16:
00517 mips_type = MIPS_R_GPREL;
00518 break;
00519 case BFD_RELOC_MIPS_LITERAL:
00520 mips_type = MIPS_R_LITERAL;
00521 break;
00522 case BFD_RELOC_RVA:
00523 mips_type = MIPS_R_RVA;
00524 break;
00525 default:
00526 return (reloc_howto_type *) NULL;
00527 }
00528
00529 return &howto_table[mips_type];
00530 }
00531
00532 static void
00533 mips_swap_reloc_in (abfd, src, dst)
00534 bfd *abfd;
00535 PTR src;
00536 PTR dst;
00537 {
00538 static struct internal_reloc pair_prev;
00539 RELOC *reloc_src = (RELOC *) src;
00540 struct internal_reloc *reloc_dst = (struct internal_reloc *) dst;
00541
00542 reloc_dst->r_vaddr = H_GET_32 (abfd, reloc_src->r_vaddr);
00543 reloc_dst->r_symndx = H_GET_S32 (abfd, reloc_src->r_symndx);
00544 reloc_dst->r_type = H_GET_16 (abfd, reloc_src->r_type);
00545 reloc_dst->r_size = 0;
00546 reloc_dst->r_extern = 0;
00547 reloc_dst->r_offset = 0;
00548
00549 switch (reloc_dst->r_type)
00550 {
00551 case MIPS_R_REFHI:
00552 pair_prev = *reloc_dst;
00553 break;
00554 case MIPS_R_PAIR:
00555 reloc_dst->r_offset = reloc_dst->r_symndx;
00556 if (reloc_dst->r_offset & 0x8000)
00557 reloc_dst->r_offset -= 0x10000;
00558
00559 reloc_dst->r_symndx = pair_prev.r_symndx;
00560 break;
00561 }
00562 }
00563
00564 static unsigned int
00565 mips_swap_reloc_out (abfd, src, dst)
00566 bfd *abfd;
00567 PTR src;
00568 PTR dst;
00569 {
00570 static int prev_offset = 1;
00571 static bfd_vma prev_addr = 0;
00572 struct internal_reloc *reloc_src = (struct internal_reloc *)src;
00573 struct external_reloc *reloc_dst = (struct external_reloc *)dst;
00574
00575 switch (reloc_src->r_type)
00576 {
00577 case MIPS_R_REFHI:
00578 prev_addr = reloc_src->r_vaddr;
00579 prev_offset = reloc_src->r_offset;
00580 break;
00581 case MIPS_R_REFLO:
00582 if (reloc_src->r_vaddr == prev_addr)
00583 {
00584
00585
00586
00587
00588 H_PUT_32 (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr);
00589 H_PUT_32 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx);
00590 H_PUT_16 (abfd, MIPS_R_PAIR, reloc_dst->r_type);
00591 return RELSZ;
00592 }
00593 break;
00594 }
00595
00596 H_PUT_32 (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr);
00597 H_PUT_32 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx);
00598
00599 H_PUT_16 (abfd, reloc_src->r_type, reloc_dst->r_type);
00600 return RELSZ;
00601 }
00602
00603 #define coff_swap_reloc_in mips_swap_reloc_in
00604 #define coff_swap_reloc_out mips_swap_reloc_out
00605 #define NO_COFF_RELOCS
00606
00607 static bfd_boolean
00608 coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
00609 input_section, contents, relocs, syms,
00610 sections)
00611 bfd *output_bfd;
00612 struct bfd_link_info *info;
00613 bfd *input_bfd;
00614 asection *input_section;
00615 bfd_byte *contents;
00616 struct internal_reloc *relocs;
00617 struct internal_syment *syms;
00618 asection **sections;
00619 {
00620 bfd_vma gp;
00621 bfd_boolean gp_undefined;
00622 size_t adjust;
00623 struct internal_reloc *rel;
00624 struct internal_reloc *rel_end;
00625 unsigned int i;
00626 bfd_boolean got_lo;
00627
00628 if (info->relocatable)
00629 {
00630 (*_bfd_error_handler)
00631 (_("%B: `ld -r' not supported with PE MIPS objects\n"), input_bfd);
00632 bfd_set_error (bfd_error_bad_value);
00633 return FALSE;
00634 }
00635
00636 BFD_ASSERT (input_bfd->xvec->byteorder
00637 == output_bfd->xvec->byteorder);
00638
00639 gp = _bfd_get_gp_value (output_bfd);
00640 if (gp == 0)
00641 gp_undefined = TRUE;
00642 else
00643 gp_undefined = FALSE;
00644
00645 got_lo = FALSE;
00646
00647 adjust = 0;
00648
00649 rel = relocs;
00650 rel_end = rel + input_section->reloc_count;
00651 for (i = 0; rel < rel_end; rel++, i++)
00652 {
00653 long symndx;
00654 struct coff_link_hash_entry *h;
00655 struct internal_syment *sym;
00656 bfd_vma addend = 0;
00657 bfd_vma val, tmp, targ, src, low;
00658 reloc_howto_type *howto;
00659 unsigned char *mem = contents + rel->r_vaddr;
00660
00661 symndx = rel->r_symndx;
00662
00663 if (symndx == -1)
00664 {
00665 h = NULL;
00666 sym = NULL;
00667 }
00668 else
00669 {
00670 h = obj_coff_sym_hashes (input_bfd)[symndx];
00671 sym = syms + symndx;
00672 }
00673
00674
00675
00676
00677
00678
00679 if (sym != NULL && sym->n_scnum != 0)
00680 addend = - sym->n_value;
00681 else
00682 addend = 0;
00683
00684 howto = bfd_coff_rtype_to_howto (input_bfd, input_section, rel, h,
00685 sym, &addend);
00686 if (howto == NULL)
00687 return FALSE;
00688
00689
00690
00691
00692
00693 if (howto->pc_relative && howto->pcrel_offset)
00694 {
00695 if (info->relocatable)
00696 continue;
00697 if (sym != NULL && sym->n_scnum != 0)
00698 addend += sym->n_value;
00699 }
00700
00701 val = 0;
00702
00703 if (h == NULL)
00704 {
00705 asection *sec;
00706
00707 if (symndx == -1)
00708 {
00709 sec = bfd_abs_section_ptr;
00710 val = 0;
00711 }
00712 else
00713 {
00714 sec = sections[symndx];
00715 val = (sec->output_section->vma
00716 + sec->output_offset
00717 + sym->n_value);
00718 if (! obj_pe (input_bfd))
00719 val -= sec->vma;
00720 }
00721 }
00722 else
00723 {
00724 if (h->root.type == bfd_link_hash_defined
00725 || h->root.type == bfd_link_hash_defweak)
00726 {
00727 asection *sec;
00728
00729 sec = h->root.u.def.section;
00730 val = (h->root.u.def.value
00731 + sec->output_section->vma
00732 + sec->output_offset);
00733 }
00734
00735 else if (! info->relocatable)
00736 {
00737 if (! ((*info->callbacks->undefined_symbol)
00738 (info, h->root.root.string, input_bfd, input_section,
00739 rel->r_vaddr - input_section->vma, TRUE)))
00740 return FALSE;
00741 }
00742 }
00743
00744 src = rel->r_vaddr + input_section->output_section->vma
00745 + input_section->output_offset;
00746
00747
00748
00749
00750
00751
00752
00753 #define UI(x) (*_bfd_error_handler) (_("%B: unimplemented %s\n"), \
00754 input_bfd, x); \
00755 bfd_set_error (bfd_error_bad_value);
00756
00757 switch (rel->r_type)
00758 {
00759 case MIPS_R_ABSOLUTE:
00760
00761 break;
00762
00763 case MIPS_R_REFHALF:
00764 UI("refhalf");
00765 break;
00766
00767 case MIPS_R_REFWORD:
00768 tmp = bfd_get_32(input_bfd, mem);
00769
00770 tmp += val;
00771 bfd_put_32(input_bfd, tmp, mem);
00772 break;
00773
00774 case MIPS_R_JMPADDR:
00775 tmp = bfd_get_32(input_bfd, mem);
00776 targ = val + (tmp&0x03ffffff)*4;
00777 if ((src & 0xf0000000) != (targ & 0xf0000000))
00778 {
00779 (*_bfd_error_handler) (_("%B: jump too far away\n"), input_bfd);
00780 bfd_set_error (bfd_error_bad_value);
00781 return FALSE;
00782 }
00783 tmp &= 0xfc000000;
00784 tmp |= (targ/4) & 0x3ffffff;
00785 bfd_put_32(input_bfd, tmp, mem);
00786 break;
00787
00788 case MIPS_R_REFHI:
00789 tmp = bfd_get_32(input_bfd, mem);
00790 switch (rel[1].r_type)
00791 {
00792 case MIPS_R_PAIR:
00793
00794 targ = val + rel[1].r_offset + ((tmp & 0xffff) << 16);
00795 break;
00796 case MIPS_R_REFLO:
00797
00798 low = bfd_get_32(input_bfd, contents + rel[1].r_vaddr);
00799 low &= 0xffff;
00800 if (low & 0x8000)
00801 low -= 0x10000;
00802 targ = val + low + ((tmp & 0xffff) << 16);
00803 break;
00804 default:
00805 (*_bfd_error_handler) (_("%B: bad pair/reflo after refhi\n"),
00806 input_bfd);
00807 bfd_set_error (bfd_error_bad_value);
00808 return FALSE;
00809 }
00810 tmp &= 0xffff0000;
00811 tmp |= (targ >> 16) & 0xffff;
00812 bfd_put_32(input_bfd, tmp, mem);
00813 break;
00814
00815 case MIPS_R_REFLO:
00816 tmp = bfd_get_32(input_bfd, mem);
00817 targ = val + (tmp & 0xffff);
00818
00819 tmp &= 0xffff0000;
00820 tmp |= targ & 0xffff;
00821 bfd_put_32(input_bfd, tmp, mem);
00822 break;
00823
00824 case MIPS_R_GPREL:
00825 case MIPS_R_LITERAL:
00826 UI("gprel");
00827 break;
00828
00829 case MIPS_R_SECTION:
00830 UI("section");
00831 break;
00832
00833 case MIPS_R_SECREL:
00834 UI("secrel");
00835 break;
00836
00837 case MIPS_R_SECRELLO:
00838 UI("secrello");
00839 break;
00840
00841 case MIPS_R_SECRELHI:
00842 UI("secrelhi");
00843 break;
00844
00845 case MIPS_R_RVA:
00846 tmp = bfd_get_32 (input_bfd, mem);
00847
00848 tmp += val
00849 - pe_data (input_section->output_section->owner)->pe_opthdr.ImageBase;
00850 bfd_put_32 (input_bfd, tmp, mem);
00851 break;
00852
00853 case MIPS_R_PAIR:
00854
00855 break;
00856 }
00857 }
00858
00859 return TRUE;
00860 }
00861
00862 #define coff_relocate_section coff_pe_mips_relocate_section
00863
00864 #ifdef TARGET_UNDERSCORE
00865
00866
00867
00868
00869
00870 static bfd_boolean coff_mips_is_local_label_name
00871 PARAMS ((bfd *, const char *));
00872
00873 static bfd_boolean
00874 coff_mips_is_local_label_name (abfd, name)
00875 bfd *abfd;
00876 const char *name;
00877 {
00878 if (name[0] == 'L')
00879 return TRUE;
00880
00881 return _bfd_coff_is_local_label_name (abfd, name);
00882 }
00883
00884 #define coff_bfd_is_local_label_name coff_mips_is_local_label_name
00885
00886 #endif
00887
00888 #define COFF_NO_HACK_SCNHDR_SIZE
00889
00890 #include "coffcode.h"
00891
00892 const bfd_target
00893 #ifdef TARGET_SYM
00894 TARGET_SYM =
00895 #else
00896 mipslpe_vec =
00897 #endif
00898 {
00899 #ifdef TARGET_NAME
00900 TARGET_NAME,
00901 #else
00902 "pe-mips",
00903 #endif
00904 bfd_target_coff_flavour,
00905 BFD_ENDIAN_LITTLE,
00906 BFD_ENDIAN_LITTLE,
00907
00908 (HAS_RELOC | EXEC_P |
00909 HAS_LINENO | HAS_DEBUG |
00910 HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
00911
00912 #ifndef COFF_WITH_PE
00913 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC
00914 | SEC_CODE | SEC_DATA),
00915 #else
00916 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC
00917 | SEC_CODE | SEC_DATA
00918 | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
00919 #endif
00920
00921 #ifdef TARGET_UNDERSCORE
00922 TARGET_UNDERSCORE,
00923 #else
00924 0,
00925 #endif
00926 '/',
00927 15,
00928
00929 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
00930 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
00931 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
00932 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
00933 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
00934 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
00935
00936
00937 {_bfd_dummy_target, coff_object_p,
00938 bfd_generic_archive_p, coff_object_p},
00939 {bfd_false, coff_mkobject, _bfd_generic_mkarchive,
00940 bfd_false},
00941 {bfd_false, coff_write_object_contents,
00942 _bfd_write_archive_contents, bfd_false},
00943
00944 BFD_JUMP_TABLE_GENERIC (coff),
00945 BFD_JUMP_TABLE_COPY (coff),
00946 BFD_JUMP_TABLE_CORE (_bfd_nocore),
00947 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
00948 BFD_JUMP_TABLE_SYMBOLS (coff),
00949 BFD_JUMP_TABLE_RELOCS (coff),
00950 BFD_JUMP_TABLE_WRITE (coff),
00951 BFD_JUMP_TABLE_LINK (coff),
00952 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
00953
00954 NULL,
00955
00956 COFF_SWAP_TABLE
00957 };