Changeset 609 for branches/GNU/src/binutils/bfd/m68klinux.c
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/bfd/m68klinux.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* BFD back-end for linux flavored m68k a.out binaries. 2 Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000 2 Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003 3 3 Free Software Foundation, Inc. 4 4 … … 24 24 #define TEXT_START_ADDR 0x0 25 25 #define N_SHARED_LIB(x) 0 26 #define BYTES_IN_WORD 427 26 28 27 #define MACHTYPE_OK(mtype) ((mtype) == M_68020 || (mtype) == M_UNKNOWN) … … 38 37 #define TARGET_IS_BIG_ENDIAN_P 39 38 #define DEFAULT_ARCH bfd_arch_m68k 40 #define MY(OP) CAT(m68klinux_,OP) 39 40 /* Do not "beautify" the CONCAT* macro args. Traditional C will not 41 remove whitespace added here, and thus will fail to concatenate 42 the tokens. */ 43 #define MY(OP) CONCAT2 (m68klinux_,OP) 41 44 #define TARGETNAME "a.out-m68k-linux" 42 45 … … 49 52 static void MY_final_link_callback 50 53 PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *)); 51 static b oolean m68klinux_bfd_final_link54 static bfd_boolean m68klinux_bfd_final_link 52 55 PARAMS ((bfd *, struct bfd_link_info *)); 53 static b oolean m68klinux_write_object_contents PARAMS ((bfd *));54 55 static b oolean56 static bfd_boolean m68klinux_write_object_contents PARAMS ((bfd *)); 57 58 static bfd_boolean 56 59 m68klinux_bfd_final_link (abfd, info) 57 60 bfd *abfd; … … 66 69 /* Set the machine type correctly. */ 67 70 68 static b oolean71 static bfd_boolean 69 72 m68klinux_write_object_contents (abfd) 70 73 bfd *abfd; … … 79 82 WRITE_HEADERS(abfd, execp); 80 83 81 return true;84 return TRUE; 82 85 } 83 86 … … 178 181 PARAMS ((struct bfd_link_info *, struct linux_link_hash_entry *, 179 182 bfd_vma, int)); 180 static b oolean linux_link_create_dynamic_sections183 static bfd_boolean linux_link_create_dynamic_sections 181 184 PARAMS ((bfd *, struct bfd_link_info *)); 182 static b oolean linux_add_one_symbol185 static bfd_boolean linux_add_one_symbol 183 186 PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, asection *, 184 bfd_vma, const char *, b oolean,boolean,187 bfd_vma, const char *, bfd_boolean, bfd_boolean, 185 188 struct bfd_link_hash_entry **)); 186 static b oolean linux_tally_symbols189 static bfd_boolean linux_tally_symbols 187 190 PARAMS ((struct linux_link_hash_entry *, PTR)); 188 static b oolean linux_finish_dynamic_link191 static bfd_boolean linux_finish_dynamic_link 189 192 PARAMS ((bfd *, struct bfd_link_info *)); 190 193 … … 226 229 { 227 230 struct linux_link_hash_table *ret; 228 229 ret = ((struct linux_link_hash_table *) 230 bfd_alloc (abfd, sizeof (struct linux_link_hash_table)));231 bfd_size_type amt = sizeof (struct linux_link_hash_table); 232 233 ret = (struct linux_link_hash_table *) bfd_malloc (amt); 231 234 if (ret == (struct linux_link_hash_table *) NULL) 232 235 { … … 261 264 (aout_link_hash_traverse \ 262 265 (&(table)->root, \ 263 (b oolean (*) PARAMS ((struct aout_link_hash_entry *, PTR))) (func), \266 (bfd_boolean (*) PARAMS ((struct aout_link_hash_entry *, PTR))) (func), \ 264 267 (info))) 265 268 … … 301 304 create it for now. */ 302 305 303 static b oolean306 static bfd_boolean 304 307 linux_link_create_dynamic_sections (abfd, info) 305 308 bfd *abfd; … … 318 321 || ! bfd_set_section_flags (abfd, s, flags) 319 322 || ! bfd_set_section_alignment (abfd, s, 2)) 320 return false;323 return FALSE; 321 324 s->_raw_size = 0; 322 325 s->contents = 0; 323 326 324 return true;327 return TRUE; 325 328 } 326 329 … … 329 332 tweaking needed for dynamic linking support. */ 330 333 331 static b oolean334 static bfd_boolean 332 335 linux_add_one_symbol (info, abfd, name, flags, section, value, string, 333 336 copy, collect, hashp) … … 339 342 bfd_vma value; 340 343 const char *string; 341 b oolean copy;342 b oolean collect;344 bfd_boolean copy; 345 bfd_boolean collect; 343 346 struct bfd_link_hash_entry **hashp; 344 347 { 345 348 struct linux_link_hash_entry *h; 346 b oolean insert;349 bfd_boolean insert; 347 350 348 351 /* Look up and see if we already have this symbol in the hash table. … … 354 357 confusion is possible. */ 355 358 356 insert = false;359 insert = FALSE; 357 360 358 361 if (! info->relocateable … … 363 366 { 364 367 if (! linux_link_create_dynamic_sections (abfd, info)) 365 return false;368 return FALSE; 366 369 linux_hash_table (info)->dynobj = abfd; 367 insert = true;370 insert = TRUE; 368 371 } 369 372 … … 371 374 && abfd->xvec == info->hash->creator) 372 375 { 373 h = linux_link_hash_lookup (linux_hash_table (info), name, false,374 false, false);376 h = linux_link_hash_lookup (linux_hash_table (info), name, FALSE, 377 FALSE, FALSE); 375 378 if (h != NULL 376 379 && (h->root.root.type == bfd_link_hash_defined … … 384 387 f = new_fixup (info, h, value, ! IS_PLT_SYM (name)); 385 388 if (f == NULL) 386 return false;389 return FALSE; 387 390 f->jump = IS_PLT_SYM (name); 388 391 389 return true;392 return TRUE; 390 393 } 391 394 } … … 395 398 value, string, copy, collect, 396 399 hashp)) 397 return false;400 return FALSE; 398 401 399 402 /* Insert a pointer to our table in the set vector. The dynamic … … 411 414 if (! (_bfd_generic_link_add_one_symbol 412 415 (info, linux_hash_table (info)->dynobj, SHARABLE_CONFLICTS, 413 BSF_GLOBAL | BSF_CONSTRUCTOR, s, 0, NULL, false, false, NULL))) 414 return false; 415 } 416 417 return true; 416 BSF_GLOBAL | BSF_CONSTRUCTOR, s, (bfd_vma) 0, NULL, 417 FALSE, FALSE, NULL))) 418 return FALSE; 419 } 420 421 return TRUE; 418 422 } 419 423 … … 428 432 This function is called via linux_link_hash_traverse. */ 429 433 430 static b oolean434 static bfd_boolean 431 435 linux_tally_symbols (h, data) 432 436 struct linux_link_hash_entry *h; … … 437 441 int is_plt; 438 442 struct linux_link_hash_entry *h1, *h2; 439 boolean exists; 443 bfd_boolean exists; 444 445 if (h->root.root.type == bfd_link_hash_warning) 446 h = (struct linux_link_hash_entry *) h->root.root.u.i.link; 440 447 441 448 if (h->root.root.type == bfd_link_hash_undefined … … 450 457 p = strrchr (name, '_'); 451 458 if (p != NULL) 452 alloc = (char *) bfd_malloc ( strlen (name) + 1);459 alloc = (char *) bfd_malloc ((bfd_size_type) strlen (name) + 1); 453 460 454 461 if (p == NULL || alloc == NULL) … … 480 487 (h->root.root.root.string 481 488 + sizeof PLT_REF_PREFIX - 1), 482 false, false, true);489 FALSE, FALSE, TRUE); 483 490 /* h2 does not follow indirect symbols. */ 484 491 h2 = linux_link_hash_lookup (linux_hash_table (info), 485 492 (h->root.root.root.string 486 493 + sizeof PLT_REF_PREFIX - 1), 487 false, false, false);494 FALSE, FALSE, FALSE); 488 495 489 496 /* The real symbol must exist but if it is also an ABS symbol, … … 503 510 fixup. In the end, this relaxes some of the requirements 504 511 about the order of performing fixups. */ 505 exists = false;512 exists = FALSE; 506 513 for (f1 = linux_hash_table (info)->fixup_list; 507 514 f1 != NULL; … … 512 519 continue; 513 520 if (f1->h == h1) 514 exists = true;521 exists = TRUE; 515 522 if (! exists 516 523 && bfd_is_abs_section (h->root.root.u.def.section)) … … 522 529 f1->jump = is_plt; 523 530 f1->builtin = 0; 524 exists = true;531 exists = TRUE; 525 532 } 526 533 if (! exists … … 540 547 symtab. */ 541 548 if (bfd_is_abs_section (h->root.root.u.def.section)) 542 h->root.written = true;543 } 544 545 return true;549 h->root.written = TRUE; 550 } 551 552 return TRUE; 546 553 } 547 554 … … 552 559 are required. */ 553 560 554 b oolean561 bfd_boolean 555 562 bfd_m68klinux_size_dynamic_sections (output_bfd, info) 556 563 bfd *output_bfd; … … 561 568 562 569 if (output_bfd->xvec != &MY(vec)) 563 return true;570 return TRUE; 564 571 565 572 /* First find the fixups... */ … … 585 592 if (linux_hash_table (info)->fixup_count > 0) 586 593 abort (); 587 return true;594 return TRUE; 588 595 } 589 596 … … 593 600 if (s != NULL) 594 601 { 595 s->_raw_size = 8 + linux_hash_table (info)->fixup_count * 8; 596 s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size); 602 s->_raw_size = linux_hash_table (info)->fixup_count + 1; 603 s->_raw_size *= 8; 604 s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size); 597 605 if (s->contents == NULL) 598 606 { 599 607 bfd_set_error (bfd_error_no_memory); 600 return false; 601 } 602 memset (s->contents, 0, (size_t) s->_raw_size); 603 } 604 605 return true; 608 return FALSE; 609 } 610 } 611 612 return TRUE; 606 613 } 607 614 … … 610 617 the stuff we need. */ 611 618 612 static b oolean619 static bfd_boolean 613 620 linux_finish_dynamic_link (output_bfd, info) 614 621 bfd *output_bfd; … … 624 631 625 632 if (linux_hash_table (info)->dynobj == NULL) 626 return true;633 return TRUE; 627 634 628 635 s = bfd_get_section_by_name (linux_hash_table (info)->dynobj, … … 639 646 640 647 fixup_table = s->contents; 641 bfd_put_32 (output_bfd, linux_hash_table (info)->fixup_count, fixup_table); 648 bfd_put_32 (output_bfd, (bfd_vma) linux_hash_table (info)->fixup_count, 649 fixup_table); 642 650 fixup_table += 4; 643 651 … … 668 676 if (f->jump) 669 677 { 670 bfd_put_32 (output_bfd, new_addr, fixup_table);678 bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table); 671 679 fixup_table += 4; 672 680 bfd_put_32 (output_bfd, f->value + 2, fixup_table); … … 675 683 else 676 684 { 677 bfd_put_32 (output_bfd, new_addr, fixup_table);685 bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table); 678 686 fixup_table += 4; 679 687 bfd_put_32 (output_bfd, f->value, fixup_table); … … 686 694 { 687 695 /* Special marker so we know to switch to the other type of fixup */ 688 bfd_put_32 (output_bfd, 0, fixup_table);696 bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); 689 697 fixup_table += 4; 690 bfd_put_32 (output_bfd, 0, fixup_table);698 bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); 691 699 fixup_table += 4; 692 700 ++fixups_written; … … 714 722 #endif 715 723 716 bfd_put_32 (output_bfd, new_addr, fixup_table);724 bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table); 717 725 fixup_table += 4; 718 726 bfd_put_32 (output_bfd, f->value, fixup_table); … … 727 735 while (linux_hash_table (info)->fixup_count > fixups_written) 728 736 { 729 bfd_put_32 (output_bfd, 0, fixup_table);737 bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); 730 738 fixup_table += 4; 731 bfd_put_32 (output_bfd, 0, fixup_table);739 bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); 732 740 fixup_table += 4; 733 741 ++fixups_written; … … 737 745 h = linux_link_hash_lookup (linux_hash_table (info), 738 746 "__BUILTIN_FIXUPS__", 739 false, false, false);747 FALSE, FALSE, FALSE); 740 748 741 749 if (h != NULL … … 751 759 #endif 752 760 753 bfd_put_32 (output_bfd, new_addr, fixup_table);761 bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table); 754 762 } 755 763 else 756 bfd_put_32 (output_bfd, 0, fixup_table);757 758 if (bfd_seek (output_bfd, os->filepos + s->output_offset, SEEK_SET) != 0)759 return false; 760 761 if (bfd_write ((PTR) s->contents, 1, s->_raw_size, output_bfd) 762 763 return false;764 765 return true;764 bfd_put_32 (output_bfd, (bfd_vma) 0, fixup_table); 765 766 if (bfd_seek (output_bfd, (file_ptr) (os->filepos + s->output_offset), 767 SEEK_SET) != 0) 768 return FALSE; 769 770 if (bfd_bwrite ((PTR) s->contents, s->_raw_size, output_bfd) != s->_raw_size) 771 return FALSE; 772 773 return TRUE; 766 774 } 767 775 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.