1 /* BFD back-end for VERSAdos-E objects. 2 Copyright 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. 3 Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>. 4 5 Versados is a Motorola trademark. 6 7 This file is part of BFD, the Binary File Descriptor library. 8 9 This program is free software; you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation; either version 2 of the License, or 12 (at your option) any later version. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program; if not, write to the Free Software 21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 22 23 /* 24 SUBSECTION 25 VERSAdos-E relocateable object file format 26 27 DESCRIPTION 28 29 This module supports reading of VERSAdos relocateable 30 object files. 31 32 A VERSAdos file looks like contains 33 34 o Indentification Record 35 o External Symbol Definition Record 36 o Object Text Recrod 37 o End Record 38 39 40 */ 41 42 #include "bfd.h" 43 #include "sysdep.h" 44 #include "libbfd.h" 45 #include "libiberty.h" 46 47 48 static boolean versados_mkobject PARAMS ((bfd *)); 49 static boolean versados_scan PARAMS ((bfd *)); 50 static const bfd_target *versados_object_p PARAMS ((bfd *)); 51 52 53 #define VHEADER '1' 54 #define VESTDEF '2' 55 #define VOTR '3' 56 #define VEND '4' 57 58 59 #define ES_BASE 17 /* first symbol has esdid 17 */ 60 61 /* Per file target dependent information */ 62 63 /* one for each section */ 64 struct esdid 65 { 66 asection *section; /* ptr to bfd version */ 67 unsigned char *contents; /* used to build image */ 68 int pc; 69 int relocs; /* reloc count, valid end of pass 1 */ 70 int donerel; /* have relocs been translated */ 71 }; 72 73 typedef struct versados_data_struct 74 { 75 int es_done; /* count of symbol index, starts at ES_BASE */ 76 asymbol *symbols; /* pointer to local symbols */ 77 char *strings; /* strings of all the above */ 78 int stringlen; /* len of string table (valid end of pass1) */ 79 int nsecsyms; /* number of sections */ 80 81 int ndefs; /* number of exported symbols (they dont get esdids) */ 82 int nrefs; /* number of imported symbols (valid end of pass1) */ 83 84 int ref_idx; /* current processed value of the above */ 85 int def_idx; 86 87 int pass_2_done; 88 89 struct esdid e[16]; /* per section info */ 90 int alert; /* to see if we're trampling */ 91 asymbol *rest[256 - 16]; /* per symbol info */ 92 93 } 94 tdata_type; 95 96 #define VDATA(abfd) (abfd->tdata.versados_data) 97 #define EDATA(abfd, n) (abfd->tdata.versados_data->e[n]) 98 #define RDATA(abfd, n) (abfd->tdata.versados_data->rest[n]) 99 100 struct ext_otr 101 { 102 unsigned char size; 103 char type; 104 unsigned char map[4]; 105 unsigned char esdid; 106 unsigned char data[200]; 107 }; 108 109 struct ext_vheader 110 { 111 unsigned char size; 112 char type; /* record type */ 113 char name[10]; /* module name */ 114 char rev; /* module rev number */ 115 char lang; 116 char vol[4]; 117 char user[2]; 118 char cat[8]; 119 char fname[8]; 120 char ext[2]; 121 char time[3]; 122 char date[3]; 123 char rest[211]; 124 }; 125 126 struct ext_esd 127 { 128 unsigned char size; 129 char type; 130 unsigned char esd_entries[1]; 131 }; 132 #define ESD_ABS 0 133 #define ESD_COMMON 1 134 #define ESD_STD_REL_SEC 2 135 #define ESD_SHRT_REL_SEC 3 136 #define ESD_XDEF_IN_SEC 4 137 #define ESD_XREF_SYM 7 138 #define ESD_XREF_SEC 6 139 #define ESD_XDEF_IN_ABS 5 140 union ext_any 141 { 142 unsigned char size; 143 struct ext_vheader header; 144 struct ext_esd esd; 145 struct ext_otr otr; 146 }; 147 148 /* Initialize by filling in the hex conversion array. */ 149 150 151 152 153 154 /* Set up the tdata information. */ 155 156 static boolean 157 versados_mkobject (abfd) 158 bfd *abfd; 159 { 160 if (abfd->tdata.versados_data == NULL) 161 { 162 tdata_type *tdata = (tdata_type *) bfd_alloc (abfd, sizeof (tdata_type)); 163 if (tdata == NULL) 164 return false; 165 abfd->tdata.versados_data = tdata; 166 tdata->symbols = NULL; 167 VDATA (abfd)->alert = 0x12345678; 168 } 169 170 bfd_default_set_arch_mach (abfd, bfd_arch_m68k, 0); 171 return true; 172 } 173 174 175 /* Report a problem in an S record file. FIXME: This probably should 176 not call fprintf, but we really do need some mechanism for printing 177 error messages. */ 178 179 180 181 static asymbol * 182 versados_new_symbol (abfd, snum, name, val, sec) 183 bfd *abfd; 184 int snum; 185 const char *name; 186 bfd_vma val; 187 asection *sec; 188 { 189 asymbol *n = VDATA (abfd)->symbols + snum; 190 n->name = name; 191 n->value = val; 192 n->section = sec; 193 n->the_bfd = abfd; 194 n->flags = 0; 195 return n; 196 } 197 198 199 static int 200 get_record (abfd, ptr) 201 bfd *abfd; 202 union ext_any *ptr; 203 { 204 bfd_read (&ptr->size, 1, 1, abfd); 205 if (bfd_read ((char *) ptr + 1, 1, ptr->size, abfd) != ptr->size) 206 return 0; 207 return 1; 208 } 209 210 int 211 get_4 (pp) 212 unsigned char **pp; 213 { 214 unsigned char *p = *pp; 215 *pp += 4; 216 return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3] << 0); 217 } 218 219 void 220 get_10 (pp, name) 221 unsigned char **pp; 222 char *name; 223 { 224 char *p = (char *) *pp; 225 int len = 10; 226 *pp += len; 227 while (*p != ' ' 228 && len) 229 { 230 *name++ = *p++; 231 len--; 232 } 233 *name = 0; 234 } 235 236 static char * 237 new_symbol_string (abfd, name) 238 bfd *abfd; 239 char *name; 240 { 241 char *n = VDATA (abfd)->strings; 242 strcpy (VDATA (abfd)->strings, name); 243 VDATA (abfd)->strings += strlen (VDATA (abfd)->strings) + 1; 244 return n; 245 } 246 247 248 static void 249 process_esd (abfd, esd, pass) 250 bfd *abfd; 251 struct ext_esd *esd; 252 int pass; 253 { 254 /* Read through the ext def for the est entries */ 255 int togo = esd->size - 2; 256 bfd_vma size; 257 bfd_vma start; 258 asection *sec; 259 char name[11]; 260 unsigned char *ptr = esd->esd_entries; 261 unsigned char *end = ptr + togo; 262 while (ptr < end) 263 { 264 int scn = *ptr & 0xf; 265 int typ = (*ptr >> 4) & 0xf; 266 267 /* Declare this section */ 268 sprintf (name, "%d", scn); 269 sec = bfd_make_section_old_way (abfd, strdup (name)); 270 sec->target_index = scn; 271 EDATA (abfd, scn).section = sec; 272 ptr++; 273 switch (typ) 274 { 275 default: 276 abort (); 277 case ESD_XREF_SEC: 278 case ESD_XREF_SYM: 279 { 280 int snum = VDATA (abfd)->ref_idx++; 281 get_10 (&ptr, name); 282 if (pass == 1) 283 { 284 VDATA (abfd)->stringlen += strlen (name) + 1; 285 } 286 else 287 { 288 int esidx; 289 asymbol *s; 290 char *n = new_symbol_string (abfd, name); 291 s = versados_new_symbol (abfd, snum, n, 0, 292 &bfd_und_section, scn); 293 esidx = VDATA (abfd)->es_done++; 294 RDATA (abfd, esidx - ES_BASE) = s; 295 } 296 } 297 break; 298 299 300 case ESD_ABS: 301 size = get_4 (&ptr); 302 start = get_4 (&ptr); 303 break; 304 case ESD_STD_REL_SEC: 305 case ESD_SHRT_REL_SEC: 306 { 307 sec->_raw_size = get_4 (&ptr); 308 sec->flags |= SEC_ALLOC; 309 } 310 break; 311 case ESD_XDEF_IN_ABS: 312 sec = (asection *) & bfd_abs_section; 313 case ESD_XDEF_IN_SEC: 314 { 315 int snum = VDATA (abfd)->def_idx++; 316 long val; 317 get_10 (&ptr, name); 318 val = get_4 (&ptr); 319 if (pass == 1) 320 { 321 /* Just remember the symbol */ 322 VDATA (abfd)->stringlen += strlen (name) + 1; 323 } 324 else 325 { 326 asymbol *s; 327 char *n = new_symbol_string (abfd, name); 328 s = versados_new_symbol (abfd, snum + VDATA (abfd)->nrefs, n, val, sec, scn); 329 s->flags |= BSF_GLOBAL; 330 } 331 } 332 break; 333 } 334 } 335 } 336 337 #define R_RELWORD 1 338 #define R_RELLONG 2 339 #define R_RELWORD_NEG 3 340 #define R_RELLONG_NEG 4 341 342 reloc_howto_type versados_howto_table[] = 343 { 344 HOWTO (R_RELWORD, 0, 1, 16, false, 345 0, complain_overflow_dont, 0, 346 "+v16", true, 0x0000ffff, 0x0000ffff, false), 347 HOWTO (R_RELLONG, 0, 2, 32, false, 348 0, complain_overflow_dont, 0, 349 "+v32", true, 0xffffffff, 0xffffffff, false), 350 351 HOWTO (R_RELWORD_NEG, 0, -1, 16, false, 352 0, complain_overflow_dont, 0, 353 "-v16", true, 0x0000ffff, 0x0000ffff, false), 354 HOWTO (R_RELLONG_NEG, 0, -2, 32, false, 355 0, complain_overflow_dont, 0, 356 "-v32", true, 0xffffffff, 0xffffffff, false), 357 }; 358 359 360 static int 361 get_offset (len, ptr) 362 int len; 363 unsigned char *ptr; 364 { 365 int val = 0; 366 if (len) 367 { 368 int i; 369 val = *ptr++; 370 if (val & 0x80) 371 val |= ~0xff; 372 for (i = 1; i < len; i++) 373 val = (val << 8) | *ptr++; 374 } 375 376 return val; 377 } 378 379 static void 380 process_otr (abfd, otr, pass) 381 bfd *abfd; 382 struct ext_otr *otr; 383 int pass; 384 { 385 unsigned long shift; 386 unsigned char *srcp = otr->data; 387 unsigned char *endp = (unsigned char *) otr + otr->size; 388 unsigned int bits = (otr->map[0] << 24) 389 | (otr->map[1] << 16) 390 | (otr->map[2] << 8) 391 | (otr->map[3] << 0); 392 393 struct esdid *esdid = &EDATA (abfd, otr->esdid - 1); 394 unsigned char *contents = esdid->contents; 395 int need_contents = 0; 396 unsigned int dst_idx = esdid->pc; 397 398 for (shift = (1 << 31); shift && srcp < endp; shift >>= 1) 399 { 400 if (bits & shift) 401 { 402 int flag = *srcp++; 403 int esdids = (flag >> 5) & 0x7; 404 int sizeinwords = ((flag >> 3) & 1) ? 2 : 1; 405 int offsetlen = flag & 0x7; 406 int j; 407 408 409 if (esdids == 0) 410 { 411 /* A zero esdid means the new pc is the offset given */ 412 dst_idx += get_offset (offsetlen, srcp); 413 srcp += offsetlen; 414 } 415 else 416 { 417 int val = get_offset (offsetlen, srcp + esdids); 418 if (pass == 1) 419 need_contents = 1; 420 else 421 for (j = 0; j < sizeinwords * 2; j++) 422 { 423 contents[dst_idx + (sizeinwords * 2) - j - 1] = val; 424 val >>= 8; 425 } 426 427 for (j = 0; j < esdids; j++) 428 { 429 int esdid = *srcp++; 430 431 if (esdid) 432 { 433 int rn = EDATA (abfd, otr->esdid - 1).relocs++; 434 if (pass == 1) 435 { 436 /* this is the first pass over the data, 437 just remember that we need a reloc */ 438 } 439 else 440 { 441 arelent *n = 442 EDATA (abfd, otr->esdid - 1).section->relocation + rn; 443 n->address = dst_idx; 444 445 n->sym_ptr_ptr = (asymbol **) esdid; 446 n->addend = 0; 447 n->howto = versados_howto_table + ((j & 1) * 2) + (sizeinwords - 1); 448 } 449 } 450 } 451 srcp += offsetlen; 452 dst_idx += sizeinwords * 2; 453 } 454 } 455 else 456 { 457 need_contents = 1; 458 if (dst_idx < esdid->section->_raw_size) 459 if (pass == 2) 460 { 461 /* absolute code, comes in 16 bit lumps */ 462 contents[dst_idx] = srcp[0]; 463 contents[dst_idx + 1] = srcp[1]; 464 } 465 dst_idx += 2; 466 srcp += 2; 467 } 468 } 469 EDATA (abfd, otr->esdid - 1).pc = dst_idx; 470 471 if (!contents && need_contents) 472 esdid->contents = (unsigned char *) bfd_alloc (abfd, esdid->section->_raw_size); 473 474 475 } 476 477 static boolean 478 versados_scan (abfd) 479 bfd *abfd; 480 { 481 int loop = 1; 482 int i; 483 int j; 484 int nsecs = 0; 485 486 VDATA (abfd)->stringlen = 0; 487 VDATA (abfd)->nrefs = 0; 488 VDATA (abfd)->ndefs = 0; 489 VDATA (abfd)->ref_idx = 0; 490 VDATA (abfd)->def_idx = 0; 491 VDATA (abfd)->pass_2_done = 0; 492 493 while (loop) 494 { 495 union ext_any any; 496 if (!get_record (abfd, &any)) 497 return true; 498 switch (any.header.type) 499 { 500 case VHEADER: 501 break; 502 case VEND: 503 loop = 0; 504 break; 505 case VESTDEF: 506 process_esd (abfd, &any.esd, 1); 507 break; 508 case VOTR: 509 process_otr (abfd, &any.otr, 1); 510 break; 511 } 512 } 513 514 /* Now allocate space for the relocs and sections */ 515 516 VDATA (abfd)->nrefs = VDATA (abfd)->ref_idx; 517 VDATA (abfd)->ndefs = VDATA (abfd)->def_idx; 518 VDATA (abfd)->ref_idx = 0; 519 VDATA (abfd)->def_idx = 0; 520 521 abfd->symcount = VDATA (abfd)->nrefs + VDATA (abfd)->ndefs; 522 523 for (i = 0; i < 16; i++) 524 { 525 struct esdid *esdid = &EDATA (abfd, i); 526 if (esdid->section) 527 { 528 esdid->section->relocation 529 = (arelent *) bfd_alloc (abfd, sizeof (arelent) * esdid->relocs); 530 531 esdid->pc = 0; 532 533 if (esdid->contents) 534 esdid->section->flags |= SEC_HAS_CONTENTS | SEC_LOAD; 535 536 esdid->section->reloc_count = esdid->relocs; 537 if (esdid->relocs) 538 esdid->section->flags |= SEC_RELOC; 539 540 esdid->relocs = 0; 541 542 /* Add an entry into the symbol table for it */ 543 nsecs++; 544 VDATA (abfd)->stringlen += strlen (esdid->section->name) + 1; 545 } 546 } 547 548 abfd->symcount += nsecs; 549 550 VDATA (abfd)->symbols = (asymbol *) bfd_alloc (abfd, 551 sizeof (asymbol) * (abfd->symcount)); 552 553 VDATA (abfd)->strings = bfd_alloc (abfd, VDATA (abfd)->stringlen); 554 555 if ((VDATA (abfd)->symbols == NULL && abfd->symcount > 0) 556 || (VDATA (abfd)->strings == NULL && VDATA (abfd)->stringlen > 0)) 557 return false; 558 559 /* Actually fill in the section symbols, 560 we stick them at the end of the table */ 561 562 for (j = VDATA (abfd)->nrefs + VDATA (abfd)->ndefs, i = 0; i < 16; i++) 563 { 564 struct esdid *esdid = &EDATA (abfd, i); 565 asection *sec = esdid->section; 566 if (sec) 567 { 568 asymbol *s = VDATA (abfd)->symbols + j; 569 s->name = new_symbol_string (abfd, sec->name); 570 s->section = sec; 571 s->flags = BSF_LOCAL; 572 s->value = 0; 573 s->the_bfd = abfd; 574 j++; 575 } 576 } 577 if (abfd->symcount) 578 abfd->flags |= HAS_SYMS; 579 580 /* Set this to nsecs - since we've already planted the section 581 symbols */ 582 VDATA (abfd)->nsecsyms = nsecs; 583 584 VDATA (abfd)->ref_idx = 0; 585 586 return 1; 587 } 588 589 590 591 /* Check whether an existing file is a versados file. */ 592 593 static const bfd_target * 594 versados_object_p (abfd) 595 bfd *abfd; 596 { 597 struct ext_vheader ext; 598 unsigned char len; 599 600 if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) 601 return NULL; 602 603 if (bfd_read (&len, 1, 1, abfd) != 1) 604 { 605 if (bfd_get_error () != bfd_error_system_call) 606 bfd_set_error (bfd_error_wrong_format); 607 return NULL; 608 } 609 610 if (bfd_read (&ext.type, 1, len, abfd) != len) 611 { 612 if (bfd_get_error () != bfd_error_system_call) 613 bfd_set_error (bfd_error_wrong_format); 614 return NULL; 615 } 616 617 /* We guess that the language field will never be larger than 10. 618 In sample files, it is always either 0 or 1. Checking for this 619 prevents confusion with Intel Hex files. */ 620 if (ext.type != VHEADER 621 || ext.lang > 10) 622 { 623 bfd_set_error (bfd_error_wrong_format); 624 return NULL; 625 } 626 627 /* OK, looks like a record, build the tdata and read in. */ 628 629 if (!versados_mkobject (abfd) 630 || !versados_scan (abfd)) 631 return NULL; 632 633 return abfd->xvec; 634 } 635 636 637 static boolean 638 versados_pass_2 (abfd) 639 bfd *abfd; 640 { 641 union ext_any any; 642 643 if (VDATA (abfd)->pass_2_done) 644 return 1; 645 646 if (bfd_seek (abfd, 0, SEEK_SET) != 0) 647 return 0; 648 649 VDATA (abfd)->es_done = ES_BASE; 650 651 652 /* read records till we get to where we want to be */ 653 654 while (1) 655 { 656 get_record (abfd, &any); 657 switch (any.header.type) 658 { 659 case VEND: 660 VDATA (abfd)->pass_2_done = 1; 661 return 1; 662 case VESTDEF: 663 process_esd (abfd, &any.esd, 2); 664 break; 665 case VOTR: 666 process_otr (abfd, &any.otr, 2); 667 break; 668 } 669 } 670 } 671 672 static boolean 673 versados_get_section_contents (abfd, section, location, offset, count) 674 bfd *abfd; 675 asection *section; 676 PTR location; 677 file_ptr offset; 678 bfd_size_type count; 679 { 680 if (!versados_pass_2 (abfd)) 681 return false; 682 683 memcpy (location, 684 EDATA (abfd, section->target_index).contents + offset, 685 (size_t) count); 686 687 return true; 688 } 689 690 #define versados_get_section_contents_in_window \ 691 _bfd_generic_get_section_contents_in_window 692 693 static boolean 694 versados_set_section_contents (abfd, section, location, offset, bytes_to_do) 695 bfd *abfd ATTRIBUTE_UNUSED; 696 sec_ptr section ATTRIBUTE_UNUSED; 697 PTR location ATTRIBUTE_UNUSED; 698 file_ptr offset ATTRIBUTE_UNUSED; 699 bfd_size_type bytes_to_do ATTRIBUTE_UNUSED; 700 { 701 return false; 702 } 703 704 705 /*ARGSUSED */ 706 static int 707 versados_sizeof_headers (abfd, exec) 708 bfd *abfd ATTRIBUTE_UNUSED; 709 boolean exec ATTRIBUTE_UNUSED; 710 { 711 return 0; 712 } 713 714 static asymbol * 715 versados_make_empty_symbol (abfd) 716 bfd *abfd; 717 { 718 asymbol *new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol)); 719 if (new) 720 new->the_bfd = abfd; 721 return new; 722 } 723 724 /* Return the amount of memory needed to read the symbol table. */ 725 726 static long 727 versados_get_symtab_upper_bound (abfd) 728 bfd *abfd; 729 { 730 return (bfd_get_symcount (abfd) + 1) * sizeof (asymbol *); 731 } 732 733 /* Return the symbol table. */ 734 735 static long 736 versados_get_symtab (abfd, alocation) 737 bfd *abfd; 738 asymbol **alocation; 739 { 740 unsigned int symcount = bfd_get_symcount (abfd); 741 unsigned int i; 742 asymbol *s; 743 744 versados_pass_2 (abfd); 745 746 for (i = 0, s = VDATA (abfd)->symbols; 747 i < symcount; 748 s++, i++) 749 { 750 *alocation++ = s; 751 } 752 753 *alocation = NULL; 754 755 return symcount; 756 } 757 758 /*ARGSUSED */ 759 void 760 versados_get_symbol_info (ignore_abfd, symbol, ret) 761 bfd *ignore_abfd ATTRIBUTE_UNUSED; 762 asymbol *symbol; 763 symbol_info *ret; 764 { 765 bfd_symbol_info (symbol, ret); 766 } 767 768 /*ARGSUSED */ 769 void 770 versados_print_symbol (ignore_abfd, afile, symbol, how) 771 bfd *ignore_abfd ATTRIBUTE_UNUSED; 772 PTR afile; 773 asymbol *symbol; 774 bfd_print_symbol_type how; 775 { 776 FILE *file = (FILE *) afile; 777 switch (how) 778 { 779 case bfd_print_symbol_name: 780 fprintf (file, "%s", symbol->name); 781 break; 782 default: 783 bfd_print_symbol_vandf ((PTR) file, symbol); 784 fprintf (file, " %-5s %s", 785 symbol->section->name, 786 symbol->name); 787 788 } 789 } 790 791 long 792 versados_get_reloc_upper_bound (abfd, asect) 793 bfd *abfd ATTRIBUTE_UNUSED; 794 sec_ptr asect; 795 { 796 return (asect->reloc_count + 1) * sizeof (arelent *); 797 } 798 799 800 long 801 versados_canonicalize_reloc (abfd, section, relptr, symbols) 802 bfd *abfd; 803 sec_ptr section; 804 arelent **relptr; 805 asymbol **symbols; 806 { 807 unsigned int count; 808 arelent *src; 809 810 versados_pass_2 (abfd); 811 src = section->relocation; 812 if (!EDATA (abfd, section->target_index).donerel) 813 { 814 EDATA (abfd, section->target_index).donerel = 1; 815 /* translate from indexes to symptr ptrs */ 816 for (count = 0; count < section->reloc_count; count++) 817 { 818 int esdid = (int) src[count].sym_ptr_ptr; 819 820 if (esdid == 0) 821 { 822 src[count].sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr; 823 } 824 else if (esdid < ES_BASE) /* Section relative thing */ 825 { 826 struct esdid *e = &EDATA (abfd, esdid - 1); 827 if (!section) 828 { 829 /** relocation relative to section which was 830 never declared ! */ 831 } 832 src[count].sym_ptr_ptr = e->section->symbol_ptr_ptr; 833 } 834 else 835 { 836 src[count].sym_ptr_ptr = symbols + esdid - ES_BASE; 837 } 838 839 } 840 } 841 842 for (count = 0; count < section->reloc_count; count++) 843 { 844 *relptr++ = src++; 845 } 846 *relptr = 0; 847 return section->reloc_count; 848 } 849 850 #define versados_close_and_cleanup _bfd_generic_close_and_cleanup 851 #define versados_bfd_free_cached_info _bfd_generic_bfd_free_cached_info 852 #define versados_new_section_hook _bfd_generic_new_section_hook 853 854 #define versados_bfd_is_local_label_name bfd_generic_is_local_label_name 855 #define versados_get_lineno _bfd_nosymbols_get_lineno 856 #define versados_find_nearest_line _bfd_nosymbols_find_nearest_line 857 #define versados_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol 858 #define versados_read_minisymbols _bfd_generic_read_minisymbols 859 #define versados_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol 860 861 #define versados_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup 862 863 #define versados_set_arch_mach bfd_default_set_arch_mach 864 865 #define versados_bfd_get_relocated_section_contents \ 866 bfd_generic_get_relocated_section_contents 867 #define versados_bfd_relax_section bfd_generic_relax_section 868 #define versados_bfd_gc_sections bfd_generic_gc_sections 869 #define versados_bfd_link_hash_table_create _bfd_generic_link_hash_table_create 870 #define versados_bfd_link_add_symbols _bfd_generic_link_add_symbols 871 #define versados_bfd_final_link _bfd_generic_final_link 872 #define versados_bfd_link_split_section _bfd_generic_link_split_section 873 874 const bfd_target versados_vec = 875 { 876 "versados", /* name */ 877 bfd_target_versados_flavour, 878 BFD_ENDIAN_BIG, /* target byte order */ 879 BFD_ENDIAN_BIG, /* target headers byte order */ 880 (HAS_RELOC | EXEC_P | /* object flags */ 881 HAS_LINENO | HAS_DEBUG | 882 HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), 883 (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS 884 | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ 885 0, /* leading underscore */ 886 ' ', /* ar_pad_char */ 887 16, /* ar_max_namelen */ 888 bfd_getb64, bfd_getb_signed_64, bfd_putb64, 889 bfd_getb32, bfd_getb_signed_32, bfd_putb32, 890 bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ 891 bfd_getb64, bfd_getb_signed_64, bfd_putb64, 892 bfd_getb32, bfd_getb_signed_32, bfd_putb32, 893 bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ 894 895 { 896 _bfd_dummy_target, 897 versados_object_p, /* bfd_check_format */ 898 _bfd_dummy_target, 899 _bfd_dummy_target, 900 }, 901 { 902 bfd_false, 903 versados_mkobject, 904 _bfd_generic_mkarchive, 905 bfd_false, 906 }, 907 { /* bfd_write_contents */ 908 bfd_false, 909 bfd_false, 910 _bfd_write_archive_contents, 911 bfd_false, 912 }, 913 914 BFD_JUMP_TABLE_GENERIC (versados), 915 BFD_JUMP_TABLE_COPY (_bfd_generic), 916 BFD_JUMP_TABLE_CORE (_bfd_nocore), 917 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), 918 BFD_JUMP_TABLE_SYMBOLS (versados), 919 BFD_JUMP_TABLE_RELOCS (versados), 920 BFD_JUMP_TABLE_WRITE (versados), 921 BFD_JUMP_TABLE_LINK (versados), 922 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), 923 924 NULL, 925 926 (PTR) 0 927 }; 928