1 /* BFD back-end for Intel 386 COFF files. 2 Copyright (C) 1990-2019 Free Software Foundation, Inc. 3 Written by Cygnus Support. 4 5 This file is part of BFD, the Binary File Descriptor library. 6 7 This program is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation; either version 3 of the License, or 10 (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program; if not, write to the Free Software 19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, 20 MA 02110-1301, USA. */ 21 22 #include "sysdep.h" 23 #include "bfd.h" 24 #include "libbfd.h" 25 26 #include "coff/i386.h" 27 28 #include "coff/internal.h" 29 30 #ifdef COFF_WITH_PE 31 #include "coff/pe.h" 32 #endif 33 34 #ifdef COFF_GO32_EXE 35 #include "coff/go32exe.h" 36 #endif 37 38 #ifndef bfd_pe_print_pdata 39 #define bfd_pe_print_pdata NULL 40 #endif 41 42 #include "libcoff.h" 43 44 static reloc_howto_type *coff_i386_rtype_to_howto 45 (bfd *, asection *, struct internal_reloc *, 46 struct coff_link_hash_entry *, struct internal_syment *, 47 bfd_vma *); 48 static reloc_howto_type *coff_i386_reloc_type_lookup 49 (bfd *, bfd_reloc_code_real_type); 50 51 #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2) 52 /* The page size is a guess based on ELF. */ 53 54 #define COFF_PAGE_SIZE 0x1000 55 56 /* For some reason when using i386 COFF the value stored in the .text 57 section for a reference to a common symbol is the value itself plus 58 any desired offset. Ian Taylor, Cygnus Support. */ 59 60 /* If we are producing relocatable output, we need to do some 61 adjustments to the object file that are not done by the 62 bfd_perform_relocation function. This function is called by every 63 reloc type to make any required adjustments. */ 64 65 static bfd_reloc_status_type 66 coff_i386_reloc (bfd *abfd, 67 arelent *reloc_entry, 68 asymbol *symbol, 69 void * data, 70 asection *input_section ATTRIBUTE_UNUSED, 71 bfd *output_bfd, 72 char **error_message ATTRIBUTE_UNUSED) 73 { 74 symvalue diff; 75 76 #ifndef COFF_WITH_PE 77 if (output_bfd == (bfd *) NULL) 78 return bfd_reloc_continue; 79 #endif 80 81 if (bfd_is_com_section (symbol->section)) 82 { 83 #ifndef COFF_WITH_PE 84 /* We are relocating a common symbol. The current value in the 85 object file is ORIG + OFFSET, where ORIG is the value of the 86 common symbol as seen by the object file when it was compiled 87 (this may be zero if the symbol was undefined) and OFFSET is 88 the offset into the common symbol (normally zero, but may be 89 non-zero when referring to a field in a common structure). 90 ORIG is the negative of reloc_entry->addend, which is set by 91 the CALC_ADDEND macro below. We want to replace the value in 92 the object file with NEW + OFFSET, where NEW is the value of 93 the common symbol which we are going to put in the final 94 object file. NEW is symbol->value. */ 95 diff = symbol->value + reloc_entry->addend; 96 #else 97 /* In PE mode, we do not offset the common symbol. */ 98 diff = reloc_entry->addend; 99 #endif 100 } 101 else 102 { 103 /* For some reason bfd_perform_relocation always effectively 104 ignores the addend for a COFF target when producing 105 relocatable output. This seems to be always wrong for 386 106 COFF, so we handle the addend here instead. */ 107 #ifdef COFF_WITH_PE 108 if (output_bfd == (bfd *) NULL) 109 { 110 reloc_howto_type *howto = reloc_entry->howto; 111 112 /* Although PC relative relocations are very similar between 113 PE and non-PE formats, but they are off by 1 << howto->size 114 bytes. For the external relocation, PE is very different 115 from others. See md_apply_fix3 () in gas/config/tc-i386.c. 116 When we link PE and non-PE object files together to 117 generate a non-PE executable, we have to compensate it 118 here. */ 119 if (howto->pc_relative && howto->pcrel_offset) 120 diff = -(1 << howto->size); 121 else if (symbol->flags & BSF_WEAK) 122 diff = reloc_entry->addend - symbol->value; 123 else 124 diff = -reloc_entry->addend; 125 } 126 else 127 #endif 128 diff = reloc_entry->addend; 129 } 130 131 #ifdef COFF_WITH_PE 132 /* FIXME: How should this case be handled? */ 133 if (reloc_entry->howto->type == R_IMAGEBASE 134 && output_bfd != NULL 135 && bfd_get_flavour(output_bfd) == bfd_target_coff_flavour) 136 diff -= pe_data (output_bfd)->pe_opthdr.ImageBase; 137 #endif 138 139 #define DOIT(x) \ 140 x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask)) 141 142 if (diff != 0) 143 { 144 reloc_howto_type *howto = reloc_entry->howto; 145 unsigned char *addr = (unsigned char *) data + reloc_entry->address; 146 147 if (! bfd_reloc_offset_in_range (howto, abfd, input_section, 148 reloc_entry->address 149 * bfd_octets_per_byte (abfd))) 150 return bfd_reloc_outofrange; 151 152 switch (howto->size) 153 { 154 case 0: 155 { 156 char x = bfd_get_8 (abfd, addr); 157 DOIT (x); 158 bfd_put_8 (abfd, x, addr); 159 } 160 break; 161 162 case 1: 163 { 164 short x = bfd_get_16 (abfd, addr); 165 DOIT (x); 166 bfd_put_16 (abfd, (bfd_vma) x, addr); 167 } 168 break; 169 170 case 2: 171 { 172 long x = bfd_get_32 (abfd, addr); 173 DOIT (x); 174 bfd_put_32 (abfd, (bfd_vma) x, addr); 175 } 176 break; 177 178 default: 179 abort (); 180 } 181 } 182 183 /* Now let bfd_perform_relocation finish everything up. */ 184 return bfd_reloc_continue; 185 } 186 187 #ifdef COFF_WITH_PE 188 /* Return TRUE if this relocation should appear in the output .reloc 189 section. */ 190 191 static bfd_boolean in_reloc_p (bfd * abfd ATTRIBUTE_UNUSED, 192 reloc_howto_type *howto) 193 { 194 return ! howto->pc_relative && howto->type != R_IMAGEBASE 195 && howto->type != R_SECREL32; 196 } 197 #endif /* COFF_WITH_PE */ 198 199 #ifndef PCRELOFFSET 200 #define PCRELOFFSET FALSE 201 #endif 202 203 static reloc_howto_type howto_table[] = 204 { 205 EMPTY_HOWTO (0), 206 EMPTY_HOWTO (1), 207 EMPTY_HOWTO (2), 208 EMPTY_HOWTO (3), 209 EMPTY_HOWTO (4), 210 EMPTY_HOWTO (5), 211 HOWTO (R_DIR32, /* type */ 212 0, /* rightshift */ 213 2, /* size (0 = byte, 1 = short, 2 = long) */ 214 32, /* bitsize */ 215 FALSE, /* pc_relative */ 216 0, /* bitpos */ 217 complain_overflow_bitfield, /* complain_on_overflow */ 218 coff_i386_reloc, /* special_function */ 219 "dir32", /* name */ 220 TRUE, /* partial_inplace */ 221 0xffffffff, /* src_mask */ 222 0xffffffff, /* dst_mask */ 223 TRUE), /* pcrel_offset */ 224 /* PE IMAGE_REL_I386_DIR32NB relocation (7). */ 225 HOWTO (R_IMAGEBASE, /* type */ 226 0, /* rightshift */ 227 2, /* size (0 = byte, 1 = short, 2 = long) */ 228 32, /* bitsize */ 229 FALSE, /* pc_relative */ 230 0, /* bitpos */ 231 complain_overflow_bitfield, /* complain_on_overflow */ 232 coff_i386_reloc, /* special_function */ 233 "rva32", /* name */ 234 TRUE, /* partial_inplace */ 235 0xffffffff, /* src_mask */ 236 0xffffffff, /* dst_mask */ 237 FALSE), /* pcrel_offset */ 238 EMPTY_HOWTO (010), 239 EMPTY_HOWTO (011), 240 EMPTY_HOWTO (012), 241 #ifdef COFF_WITH_PE 242 /* 32-bit longword section relative relocation (013). */ 243 HOWTO (R_SECREL32, /* type */ 244 0, /* rightshift */ 245 2, /* size (0 = byte, 1 = short, 2 = long) */ 246 32, /* bitsize */ 247 FALSE, /* pc_relative */ 248 0, /* bitpos */ 249 complain_overflow_bitfield, /* complain_on_overflow */ 250 coff_i386_reloc, /* special_function */ 251 "secrel32", /* name */ 252 TRUE, /* partial_inplace */ 253 0xffffffff, /* src_mask */ 254 0xffffffff, /* dst_mask */ 255 TRUE), /* pcrel_offset */ 256 #else 257 EMPTY_HOWTO (013), 258 #endif 259 EMPTY_HOWTO (014), 260 EMPTY_HOWTO (015), 261 EMPTY_HOWTO (016), 262 /* Byte relocation (017). */ 263 HOWTO (R_RELBYTE, /* type */ 264 0, /* rightshift */ 265 0, /* size (0 = byte, 1 = short, 2 = long) */ 266 8, /* bitsize */ 267 FALSE, /* pc_relative */ 268 0, /* bitpos */ 269 complain_overflow_bitfield, /* complain_on_overflow */ 270 coff_i386_reloc, /* special_function */ 271 "8", /* name */ 272 TRUE, /* partial_inplace */ 273 0x000000ff, /* src_mask */ 274 0x000000ff, /* dst_mask */ 275 PCRELOFFSET), /* pcrel_offset */ 276 /* 16-bit word relocation (020). */ 277 HOWTO (R_RELWORD, /* type */ 278 0, /* rightshift */ 279 1, /* size (0 = byte, 1 = short, 2 = long) */ 280 16, /* bitsize */ 281 FALSE, /* pc_relative */ 282 0, /* bitpos */ 283 complain_overflow_bitfield, /* complain_on_overflow */ 284 coff_i386_reloc, /* special_function */ 285 "16", /* name */ 286 TRUE, /* partial_inplace */ 287 0x0000ffff, /* src_mask */ 288 0x0000ffff, /* dst_mask */ 289 PCRELOFFSET), /* pcrel_offset */ 290 /* 32-bit longword relocation (021). */ 291 HOWTO (R_RELLONG, /* type */ 292 0, /* rightshift */ 293 2, /* size (0 = byte, 1 = short, 2 = long) */ 294 32, /* bitsize */ 295 FALSE, /* pc_relative */ 296 0, /* bitpos */ 297 complain_overflow_bitfield, /* complain_on_overflow */ 298 coff_i386_reloc, /* special_function */ 299 "32", /* name */ 300 TRUE, /* partial_inplace */ 301 0xffffffff, /* src_mask */ 302 0xffffffff, /* dst_mask */ 303 PCRELOFFSET), /* pcrel_offset */ 304 /* Byte PC relative relocation (022). */ 305 HOWTO (R_PCRBYTE, /* type */ 306 0, /* rightshift */ 307 0, /* size (0 = byte, 1 = short, 2 = long) */ 308 8, /* bitsize */ 309 TRUE, /* pc_relative */ 310 0, /* bitpos */ 311 complain_overflow_signed, /* complain_on_overflow */ 312 coff_i386_reloc, /* special_function */ 313 "DISP8", /* name */ 314 TRUE, /* partial_inplace */ 315 0x000000ff, /* src_mask */ 316 0x000000ff, /* dst_mask */ 317 PCRELOFFSET), /* pcrel_offset */ 318 /* 16-bit word PC relative relocation (023). */ 319 HOWTO (R_PCRWORD, /* type */ 320 0, /* rightshift */ 321 1, /* size (0 = byte, 1 = short, 2 = long) */ 322 16, /* bitsize */ 323 TRUE, /* pc_relative */ 324 0, /* bitpos */ 325 complain_overflow_signed, /* complain_on_overflow */ 326 coff_i386_reloc, /* special_function */ 327 "DISP16", /* name */ 328 TRUE, /* partial_inplace */ 329 0x0000ffff, /* src_mask */ 330 0x0000ffff, /* dst_mask */ 331 PCRELOFFSET), /* pcrel_offset */ 332 /* 32-bit longword PC relative relocation (024). */ 333 HOWTO (R_PCRLONG, /* type */ 334 0, /* rightshift */ 335 2, /* size (0 = byte, 1 = short, 2 = long) */ 336 32, /* bitsize */ 337 TRUE, /* pc_relative */ 338 0, /* bitpos */ 339 complain_overflow_signed, /* complain_on_overflow */ 340 coff_i386_reloc, /* special_function */ 341 "DISP32", /* name */ 342 TRUE, /* partial_inplace */ 343 0xffffffff, /* src_mask */ 344 0xffffffff, /* dst_mask */ 345 PCRELOFFSET) /* pcrel_offset */ 346 }; 347 348 #define NUM_HOWTOS (sizeof (howto_table) / sizeof (howto_table[0])) 349 350 /* Turn a howto into a reloc nunmber */ 351 352 #define SELECT_RELOC(x,howto) { x.r_type = howto->type; } 353 #define BADMAG(x) I386BADMAG(x) 354 #define I386 1 /* Customize coffcode.h */ 355 356 #define RTYPE2HOWTO(cache_ptr, dst) \ 357 ((cache_ptr)->howto = \ 358 ((dst)->r_type < NUM_HOWTOS \ 359 ? howto_table + (dst)->r_type \ 360 : NULL)) 361 362 /* For 386 COFF a STYP_NOLOAD | STYP_BSS section is part of a shared 363 library. On some other COFF targets STYP_BSS is normally 364 STYP_NOLOAD. */ 365 #define BSS_NOLOAD_IS_SHARED_LIBRARY 366 367 /* Compute the addend of a reloc. If the reloc is to a common symbol, 368 the object file contains the value of the common symbol. By the 369 time this is called, the linker may be using a different symbol 370 from a different object file with a different value. Therefore, we 371 hack wildly to locate the original symbol from this file so that we 372 can make the correct adjustment. This macro sets coffsym to the 373 symbol from the original file, and uses it to set the addend value 374 correctly. If this is not a common symbol, the usual addend 375 calculation is done, except that an additional tweak is needed for 376 PC relative relocs. 377 FIXME: This macro refers to symbols and asect; these are from the 378 calling function, not the macro arguments. */ 379 380 #define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \ 381 { \ 382 coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \ 383 if (ptr && bfd_asymbol_bfd (ptr) != abfd) \ 384 coffsym = (obj_symbols (abfd) \ 385 + (cache_ptr->sym_ptr_ptr - symbols)); \ 386 else if (ptr) \ 387 coffsym = coff_symbol_from (ptr); \ 388 if (coffsym != (coff_symbol_type *) NULL \ 389 && coffsym->native->u.syment.n_scnum == 0) \ 390 cache_ptr->addend = - coffsym->native->u.syment.n_value; \ 391 else if (ptr && bfd_asymbol_bfd (ptr) == abfd \ 392 && ptr->section != (asection *) NULL) \ 393 cache_ptr->addend = - (ptr->section->vma + ptr->value); \ 394 else \ 395 cache_ptr->addend = 0; \ 396 if (ptr && reloc.r_type < NUM_HOWTOS \ 397 && howto_table[reloc.r_type].pc_relative) \ 398 cache_ptr->addend += asect->vma; \ 399 } 400 401 /* We use the special COFF backend linker. For normal i386 COFF, we 402 can use the generic relocate_section routine. For PE, we need our 403 own routine. */ 404 405 #ifndef COFF_WITH_PE 406 407 #define coff_relocate_section _bfd_coff_generic_relocate_section 408 409 #else /* COFF_WITH_PE */ 410 411 /* The PE relocate section routine. The only difference between this 412 and the regular routine is that we don't want to do anything for a 413 relocatable link. */ 414 415 static bfd_boolean 416 coff_pe_i386_relocate_section (bfd *output_bfd, 417 struct bfd_link_info *info, 418 bfd *input_bfd, 419 asection *input_section, 420 bfd_byte *contents, 421 struct internal_reloc *relocs, 422 struct internal_syment *syms, 423 asection **sections) 424 { 425 if (bfd_link_relocatable (info)) 426 return TRUE; 427 428 return _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd, 429 input_section, contents, 430 relocs, syms, sections); 431 } 432 433 #define coff_relocate_section coff_pe_i386_relocate_section 434 435 #endif /* COFF_WITH_PE */ 436 437 /* Convert an rtype to howto for the COFF backend linker. */ 438 439 static reloc_howto_type * 440 coff_i386_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, 441 asection *sec, 442 struct internal_reloc *rel, 443 struct coff_link_hash_entry *h, 444 struct internal_syment *sym, 445 bfd_vma *addendp) 446 { 447 reloc_howto_type *howto; 448 449 if (rel->r_type >= NUM_HOWTOS) 450 { 451 bfd_set_error (bfd_error_bad_value); 452 return NULL; 453 } 454 455 howto = howto_table + rel->r_type; 456 457 #ifdef COFF_WITH_PE 458 /* Cancel out code in _bfd_coff_generic_relocate_section. */ 459 *addendp = 0; 460 #endif 461 462 if (howto->pc_relative) 463 *addendp += sec->vma; 464 465 if (sym != NULL && sym->n_scnum == 0 && sym->n_value != 0) 466 { 467 /* This is a common symbol. The section contents include the 468 size (sym->n_value) as an addend. The relocate_section 469 function will be adding in the final value of the symbol. We 470 need to subtract out the current size in order to get the 471 correct result. */ 472 473 BFD_ASSERT (h != NULL); 474 475 #ifndef COFF_WITH_PE 476 /* I think we *do* want to bypass this. If we don't, I have 477 seen some data parameters get the wrong relocation address. 478 If I link two versions with and without this section bypassed 479 and then do a binary comparison, the addresses which are 480 different can be looked up in the map. The case in which 481 this section has been bypassed has addresses which correspond 482 to values I can find in the map. */ 483 *addendp -= sym->n_value; 484 #endif 485 } 486 487 #ifndef COFF_WITH_PE 488 /* If the output symbol is common (in which case this must be a 489 relocatable link), we need to add in the final size of the 490 common symbol. */ 491 if (h != NULL && h->root.type == bfd_link_hash_common) 492 *addendp += h->root.u.c.size; 493 #endif 494 495 #ifdef COFF_WITH_PE 496 if (howto->pc_relative) 497 { 498 *addendp -= 4; 499 500 /* If the symbol is defined, then the generic code is going to 501 add back the symbol value in order to cancel out an 502 adjustment it made to the addend. However, we set the addend 503 to 0 at the start of this function. We need to adjust here, 504 to avoid the adjustment the generic code will make. FIXME: 505 This is getting a bit hackish. */ 506 if (sym != NULL && sym->n_scnum != 0) 507 *addendp -= sym->n_value; 508 } 509 510 if (rel->r_type == R_IMAGEBASE 511 && (bfd_get_flavour(sec->output_section->owner) 512 == bfd_target_coff_flavour)) 513 { 514 *addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase; 515 } 516 517 /* PR 17099 - Absolute R_PCRLONG relocations do not need a symbol. */ 518 if (rel->r_type == R_PCRLONG && sym == NULL) 519 *addendp -= rel->r_vaddr; 520 else 521 BFD_ASSERT (sym != NULL); 522 523 if (rel->r_type == R_SECREL32 && sym != NULL) 524 { 525 bfd_vma osect_vma; 526 527 if (h && (h->root.type == bfd_link_hash_defined 528 || h->root.type == bfd_link_hash_defweak)) 529 osect_vma = h->root.u.def.section->output_section->vma; 530 else 531 { 532 asection *s; 533 int i; 534 535 /* Sigh, the only way to get the section to offset against 536 is to find it the hard way. */ 537 538 for (s = abfd->sections, i = 1; i < sym->n_scnum; i++) 539 s = s->next; 540 541 osect_vma = s->output_section->vma; 542 } 543 544 *addendp -= osect_vma; 545 } 546 #endif 547 548 return howto; 549 } 550 551 #define coff_bfd_reloc_type_lookup coff_i386_reloc_type_lookup 552 #define coff_bfd_reloc_name_lookup coff_i386_reloc_name_lookup 553 554 static reloc_howto_type * 555 coff_i386_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, 556 bfd_reloc_code_real_type code) 557 { 558 switch (code) 559 { 560 case BFD_RELOC_RVA: 561 return howto_table + R_IMAGEBASE; 562 case BFD_RELOC_32: 563 return howto_table + R_DIR32; 564 case BFD_RELOC_32_PCREL: 565 return howto_table + R_PCRLONG; 566 case BFD_RELOC_16: 567 return howto_table + R_RELWORD; 568 case BFD_RELOC_16_PCREL: 569 return howto_table + R_PCRWORD; 570 case BFD_RELOC_8: 571 return howto_table + R_RELBYTE; 572 case BFD_RELOC_8_PCREL: 573 return howto_table + R_PCRBYTE; 574 #ifdef COFF_WITH_PE 575 case BFD_RELOC_32_SECREL: 576 return howto_table + R_SECREL32; 577 #endif 578 default: 579 BFD_FAIL (); 580 return 0; 581 } 582 } 583 584 static reloc_howto_type * 585 coff_i386_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, 586 const char *r_name) 587 { 588 unsigned int i; 589 590 for (i = 0; i < NUM_HOWTOS; i++) 591 if (howto_table[i].name != NULL 592 && strcasecmp (howto_table[i].name, r_name) == 0) 593 return &howto_table[i]; 594 595 return NULL; 596 } 597 598 #define coff_rtype_to_howto coff_i386_rtype_to_howto 599 600 #ifdef TARGET_UNDERSCORE 601 602 /* If i386 gcc uses underscores for symbol names, then it does not use 603 a leading dot for local labels, so if TARGET_UNDERSCORE is defined 604 we treat all symbols starting with L as local. */ 605 606 static bfd_boolean 607 coff_i386_is_local_label_name (bfd *abfd, const char *name) 608 { 609 if (name[0] == 'L') 610 return TRUE; 611 612 return _bfd_coff_is_local_label_name (abfd, name); 613 } 614 615 #define coff_bfd_is_local_label_name coff_i386_is_local_label_name 616 617 #endif /* TARGET_UNDERSCORE */ 618 619 #include "coffcode.h" 620 621 const bfd_target 622 #ifdef TARGET_SYM 623 TARGET_SYM = 624 #else 625 i386_coff_vec = 626 #endif 627 { 628 #ifdef TARGET_NAME 629 TARGET_NAME, 630 #else 631 "coff-i386", /* name */ 632 #endif 633 bfd_target_coff_flavour, 634 BFD_ENDIAN_LITTLE, /* data byte order is little */ 635 BFD_ENDIAN_LITTLE, /* header byte order is little */ 636 637 (HAS_RELOC | EXEC_P | /* object flags */ 638 HAS_LINENO | HAS_DEBUG | 639 HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED | BFD_COMPRESS | BFD_DECOMPRESS ), 640 641 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */ 642 #ifdef COFF_WITH_PE 643 | SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_READONLY | SEC_DEBUGGING 644 #endif 645 | SEC_CODE | SEC_DATA | SEC_EXCLUDE ), 646 647 #ifdef TARGET_UNDERSCORE 648 TARGET_UNDERSCORE, /* leading underscore */ 649 #else 650 0, /* leading underscore */ 651 #endif 652 '/', /* ar_pad_char */ 653 15, /* ar_max_namelen */ 654 0, /* match priority. */ 655 656 bfd_getl64, bfd_getl_signed_64, bfd_putl64, 657 bfd_getl32, bfd_getl_signed_32, bfd_putl32, 658 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ 659 bfd_getl64, bfd_getl_signed_64, bfd_putl64, 660 bfd_getl32, bfd_getl_signed_32, bfd_putl32, 661 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ 662 663 /* Note that we allow an object file to be treated as a core file as well. */ 664 665 #ifdef COFF_CHECK_FORMAT 666 { /* bfd_check_format */ 667 _bfd_dummy_target, 668 COFF_CHECK_FORMAT, 669 bfd_generic_archive_p, 670 COFF_CHECK_FORMAT 671 }, 672 #else 673 { 674 _bfd_dummy_target, 675 coff_object_p, 676 bfd_generic_archive_p, 677 coff_object_p 678 }, 679 #endif 680 { /* bfd_set_format */ 681 _bfd_bool_bfd_false_error, 682 coff_mkobject, 683 _bfd_generic_mkarchive, 684 _bfd_bool_bfd_false_error 685 }, 686 { /* bfd_write_contents */ 687 _bfd_bool_bfd_false_error, 688 coff_write_object_contents, 689 _bfd_write_archive_contents, 690 _bfd_bool_bfd_false_error 691 }, 692 693 BFD_JUMP_TABLE_GENERIC (coff), 694 BFD_JUMP_TABLE_COPY (coff), 695 BFD_JUMP_TABLE_CORE (_bfd_nocore), 696 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), 697 BFD_JUMP_TABLE_SYMBOLS (coff), 698 BFD_JUMP_TABLE_RELOCS (coff), 699 BFD_JUMP_TABLE_WRITE (coff), 700 BFD_JUMP_TABLE_LINK (coff), 701 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), 702 703 NULL, 704 705 COFF_SWAP_TABLE 706 }; 707