Changeset 609 for branches/GNU/src/binutils/bfd/cofflink.c
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/bfd/cofflink.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* COFF specific linker code. 2 Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 2 Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 3 3 Free Software Foundation, Inc. 4 4 Written by Ian Lance Taylor, Cygnus Support. … … 29 29 #include "libcoff.h" 30 30 31 static b oolean coff_link_add_object_symbols31 static bfd_boolean coff_link_add_object_symbols 32 32 PARAMS ((bfd *, struct bfd_link_info *)); 33 static boolean coff_link_check_archive_element 34 PARAMS ((bfd *, struct bfd_link_info *, boolean *)); 35 static boolean coff_link_check_ar_symbols 36 PARAMS ((bfd *, struct bfd_link_info *, boolean *)); 37 static boolean coff_link_add_symbols PARAMS ((bfd *, struct bfd_link_info *)); 38 static char *dores_com PARAMS ((char *, bfd *, int)); 39 static char *get_name PARAMS ((char *, char **)); 33 static bfd_boolean coff_link_check_archive_element 34 PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *)); 35 static bfd_boolean coff_link_check_ar_symbols 36 PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *)); 37 static bfd_boolean coff_link_add_symbols 38 PARAMS ((bfd *, struct bfd_link_info *)); 39 static char *dores_com 40 PARAMS ((char *, bfd *, int)); 41 static char *get_name 42 PARAMS ((char *, char **)); 40 43 static int process_embedded_commands 41 44 PARAMS ((bfd *, struct bfd_link_info *, bfd *)); 42 static void mark_relocs PARAMS ((struct coff_final_link_info *, bfd *)); 43 44 /* Return true if SYM is a weak, external symbol. */ 45 static void mark_relocs 46 PARAMS ((struct coff_final_link_info *, bfd *)); 47 48 /* Return TRUE if SYM is a weak, external symbol. */ 45 49 #define IS_WEAK_EXTERNAL(abfd, sym) \ 46 50 ((sym).n_sclass == C_WEAKEXT \ 47 51 || (obj_pe (abfd) && (sym).n_sclass == C_NT_WEAK)) 48 52 49 /* Return trueif SYM is an external symbol. */53 /* Return TRUE if SYM is an external symbol. */ 50 54 #define IS_EXTERNAL(abfd, sym) \ 51 55 ((sym).n_sclass == C_EXT || IS_WEAK_EXTERNAL (abfd, sym)) … … 99 103 /* Initialize a COFF linker hash table. */ 100 104 101 b oolean105 bfd_boolean 102 106 _bfd_coff_link_hash_table_init (table, abfd, newfunc) 103 107 struct coff_link_hash_table *table; … … 118 122 { 119 123 struct coff_link_hash_table *ret; 120 121 ret = ((struct coff_link_hash_table *) 122 bfd_alloc (abfd, sizeof (struct coff_link_hash_table)));124 bfd_size_type amt = sizeof (struct coff_link_hash_table); 125 126 ret = (struct coff_link_hash_table *) bfd_malloc (amt); 123 127 if (ret == NULL) 124 128 return NULL; … … 126 130 _bfd_coff_link_hash_newfunc)) 127 131 { 128 bfd_release (abfd,ret);132 free (ret); 129 133 return (struct bfd_link_hash_table *) NULL; 130 134 } … … 167 171 appropriate. */ 168 172 169 b oolean173 bfd_boolean 170 174 _bfd_coff_link_add_symbols (abfd, info) 171 175 bfd *abfd; … … 181 185 default: 182 186 bfd_set_error (bfd_error_wrong_format); 183 return false;187 return FALSE; 184 188 } 185 189 } … … 187 191 /* Add symbols from a COFF object file. */ 188 192 189 static b oolean193 static bfd_boolean 190 194 coff_link_add_object_symbols (abfd, info) 191 195 bfd *abfd; … … 193 197 { 194 198 if (! _bfd_coff_get_external_symbols (abfd)) 195 return false;199 return FALSE; 196 200 if (! coff_link_add_symbols (abfd, info)) 197 return false;201 return FALSE; 198 202 199 203 if (! info->keep_memory) 200 204 { 201 205 if (! _bfd_coff_free_symbols (abfd)) 202 return false;203 } 204 return true;206 return FALSE; 207 } 208 return TRUE; 205 209 } 206 210 … … 210 214 _bfd_generic_link_add_archive_symbols. */ 211 215 212 static b oolean216 static bfd_boolean 213 217 coff_link_check_archive_element (abfd, info, pneeded) 214 218 bfd *abfd; 215 219 struct bfd_link_info *info; 216 b oolean *pneeded;220 bfd_boolean *pneeded; 217 221 { 218 222 if (! _bfd_coff_get_external_symbols (abfd)) 219 return false;223 return FALSE; 220 224 221 225 if (! coff_link_check_ar_symbols (abfd, info, pneeded)) 222 return false;226 return FALSE; 223 227 224 228 if (*pneeded) 225 229 { 226 230 if (! coff_link_add_symbols (abfd, info)) 227 return false;231 return FALSE; 228 232 } 229 233 … … 231 235 { 232 236 if (! _bfd_coff_free_symbols (abfd)) 233 return false;234 } 235 236 return true;237 return FALSE; 238 } 239 240 return TRUE; 237 241 } 238 242 … … 240 244 included in the link. */ 241 245 242 static b oolean246 static bfd_boolean 243 247 coff_link_check_ar_symbols (abfd, info, pneeded) 244 248 bfd *abfd; 245 249 struct bfd_link_info *info; 246 b oolean *pneeded;250 bfd_boolean *pneeded; 247 251 { 248 252 bfd_size_type symesz; … … 250 254 bfd_byte *esym_end; 251 255 252 *pneeded = false;256 *pneeded = FALSE; 253 257 254 258 symesz = bfd_coff_symesz (abfd); … … 275 279 name = _bfd_coff_internal_syment_name (abfd, &sym, buf); 276 280 if (name == NULL) 277 return false; 278 h = bfd_link_hash_lookup (info->hash, name, false, false, true); 279 281 return FALSE; 282 h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE); 283 284 /* auto import */ 285 if (!h && info->pei386_auto_import) 286 { 287 if (!strncmp (name,"__imp_", 6)) 288 { 289 h = 290 bfd_link_hash_lookup (info->hash, name + 6, FALSE, FALSE, 291 TRUE); 292 } 293 } 280 294 /* We are only interested in symbols that are currently 281 295 undefined. If a symbol is currently known to be common, … … 286 300 { 287 301 if (! (*info->callbacks->add_archive_element) (info, abfd, name)) 288 return false;289 *pneeded = true;290 return true;302 return FALSE; 303 *pneeded = TRUE; 304 return TRUE; 291 305 } 292 306 } … … 296 310 297 311 /* We do not need this object file. */ 298 return true;312 return TRUE; 299 313 } 300 314 301 315 /* Add all the symbols from an object file to the hash table. */ 302 316 303 static b oolean317 static bfd_boolean 304 318 coff_link_add_symbols (abfd, info) 305 319 bfd *abfd; … … 309 323 unsigned int n_btshft = coff_data (abfd)->local_n_btshft; 310 324 unsigned int n_btmask = coff_data (abfd)->local_n_btmask; 311 b oolean keep_syms;312 b oolean default_copy;325 bfd_boolean keep_syms; 326 bfd_boolean default_copy; 313 327 bfd_size_type symcount; 314 328 struct coff_link_hash_entry **sym_hash; … … 316 330 bfd_byte *esym; 317 331 bfd_byte *esym_end; 332 bfd_size_type amt; 318 333 319 334 /* Keep the symbols during this function, in case the linker needs 320 335 to read the generic symbols in order to report an error message. */ 321 336 keep_syms = obj_coff_keep_syms (abfd); 322 obj_coff_keep_syms (abfd) = true;337 obj_coff_keep_syms (abfd) = TRUE; 323 338 324 339 if (info->keep_memory) 325 default_copy = false;340 default_copy = FALSE; 326 341 else 327 default_copy = true;342 default_copy = TRUE; 328 343 329 344 symcount = obj_raw_syment_count (abfd); … … 331 346 /* We keep a list of the linker hash table entries that correspond 332 347 to particular symbols. */ 333 sym_hash = ((struct coff_link_hash_entry **) 334 bfd_alloc (abfd, 335 ((size_t) symcount 336 * sizeof (struct coff_link_hash_entry *)))); 348 amt = symcount * sizeof (struct coff_link_hash_entry *); 349 sym_hash = (struct coff_link_hash_entry **) bfd_zalloc (abfd, amt); 337 350 if (sym_hash == NULL && symcount != 0) 338 351 goto error_return; 339 352 obj_coff_sym_hashes (abfd) = sym_hash; 340 memset (sym_hash, 0,341 (size_t) symcount * sizeof (struct coff_link_hash_entry *));342 353 343 354 symesz = bfd_coff_symesz (abfd); … … 349 360 struct internal_syment sym; 350 361 enum coff_symbol_classification classification; 351 b oolean copy;362 bfd_boolean copy; 352 363 353 364 bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &sym); … … 361 372 asection *section; 362 373 bfd_vma value; 363 b oolean addit;374 bfd_boolean addit; 364 375 365 376 /* This symbol is externally visible. */ … … 374 385 if (sym._n._n_n._n_zeroes != 0 375 386 || sym._n._n_n._n_offset == 0) 376 copy = true;387 copy = TRUE; 377 388 378 389 value = sym.n_value; … … 409 420 flags = BSF_WEAK; 410 421 411 addit = true;422 addit = TRUE; 412 423 413 424 /* In the PE format, section symbols actually refer to the … … 417 428 { 418 429 *sym_hash = coff_link_hash_lookup (coff_hash_table (info), 419 name, false, copy, false);430 name, FALSE, copy, FALSE); 420 431 if (*sym_hash != NULL) 421 432 { … … 428 439 name); 429 440 430 addit = false;441 addit = FALSE; 431 442 } 432 443 } … … 434 445 /* The Microsoft Visual C compiler does string pooling by 435 446 hashing the constants to an internal symbol name, and 436 relying on the thelinker comdat support to discard447 relying on the linker comdat support to discard 437 448 duplicate names. However, if one string is a literal and 438 449 one is a data initializer, one will end up in the .data … … 463 474 if (*sym_hash == NULL) 464 475 *sym_hash = coff_link_hash_lookup (coff_hash_table (info), 465 name, false, copy, false);476 name, FALSE, copy, FALSE); 466 477 if (*sym_hash != NULL 467 478 && (*sym_hash)->root.type == bfd_link_hash_defined … … 469 480 && strcmp ((*sym_hash)->root.u.def.section->comdat->name, 470 481 section->comdat->name) == 0) 471 addit = false;482 addit = FALSE; 472 483 } 473 484 … … 476 487 if (! (bfd_coff_link_add_one_symbol 477 488 (info, abfd, name, flags, section, value, 478 (const char *) NULL, copy, false,489 (const char *) NULL, copy, FALSE, 479 490 (struct bfd_link_hash_entry **) sym_hash))) 480 491 goto error_return; … … 527 538 (_("Warning: type of symbol `%s' changed from %d to %d in %s"), 528 539 name, (*sym_hash)->type, sym.n_type, 529 bfd_ get_filename (abfd));540 bfd_archive_filename (abfd)); 530 541 531 542 /* We don't want to change from a meaningful … … 555 566 i++, eaux += symesz, iaux++) 556 567 bfd_coff_swap_aux_in (abfd, (PTR) eaux, sym.n_type, 557 sym.n_sclass, i, sym.n_numaux,558 (PTR) iaux);568 sym.n_sclass, (int) i, 569 sym.n_numaux, (PTR) iaux); 559 570 (*sym_hash)->aux = alloc; 560 571 } … … 609 620 if (secdata == NULL) 610 621 { 611 stab->used_by_bfd = 612 (PTR) bfd_zalloc (abfd, 613 sizeof (struct coff_section_tdata)); 622 amt = sizeof (struct coff_section_tdata); 623 stab->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); 614 624 if (stab->used_by_bfd == NULL) 615 625 goto error_return; … … 629 639 obj_coff_keep_syms (abfd) = keep_syms; 630 640 631 return true;641 return TRUE; 632 642 633 643 error_return: 634 644 obj_coff_keep_syms (abfd) = keep_syms; 635 return false;645 return FALSE; 636 646 } 637 647 … … 639 649 /* Do the final link step. */ 640 650 641 b oolean651 bfd_boolean 642 652 _bfd_coff_final_link (abfd, info) 643 653 bfd *abfd; … … 646 656 bfd_size_type symesz; 647 657 struct coff_final_link_info finfo; 648 b oolean debug_merge_allocated;649 b oolean long_section_names;658 bfd_boolean debug_merge_allocated; 659 bfd_boolean long_section_names; 650 660 asection *o; 651 661 struct bfd_link_order *p; 652 size_tmax_sym_count;653 size_tmax_lineno_count;654 size_tmax_reloc_count;655 size_tmax_output_reloc_count;656 size_tmax_contents_size;662 bfd_size_type max_sym_count; 663 bfd_size_type max_lineno_count; 664 bfd_size_type max_reloc_count; 665 bfd_size_type max_output_reloc_count; 666 bfd_size_type max_contents_size; 657 667 file_ptr rel_filepos; 658 668 unsigned int relsz; … … 662 672 bfd_byte *external_relocs = NULL; 663 673 char strbuf[STRING_SIZE_SIZE]; 674 bfd_size_type amt; 664 675 665 676 symesz = bfd_coff_symesz (abfd); … … 679 690 finfo.external_relocs = NULL; 680 691 finfo.internal_relocs = NULL; 681 finfo.global_to_static = false;682 debug_merge_allocated = false;692 finfo.global_to_static = FALSE; 693 debug_merge_allocated = FALSE; 683 694 684 695 coff_data (abfd)->link_info = info; … … 690 701 if (! coff_debug_merge_hash_table_init (&finfo.debug_merge)) 691 702 goto error_return; 692 debug_merge_allocated = true;703 debug_merge_allocated = TRUE; 693 704 694 705 /* Compute the file positions for all the sections. */ … … 707 718 max_reloc_count = 0; 708 719 709 long_section_names = false;720 long_section_names = FALSE; 710 721 for (o = abfd->sections; o != NULL; o = o->next) 711 722 { … … 724 735 to do this so that we can identify any sections which 725 736 the linker has decided to not include. */ 726 sec->linker_mark = true;737 sec->linker_mark = TRUE; 727 738 728 739 if (info->strip == strip_none … … 752 763 o->rel_filepos = rel_filepos; 753 764 rel_filepos += o->reloc_count * relsz; 765 /* In PE COFF, if there are at least 0xffff relocations an 766 extra relocation will be written out to encode the count. */ 767 if (obj_pe (abfd) && o->reloc_count >= 0xffff) 768 rel_filepos += relsz; 754 769 } 755 770 … … 761 776 coff_write_object_contents which puts the string index 762 777 into the s_name field of the section header. That is why 763 we pass hash as false. */764 if (_bfd_stringtab_add (finfo.strtab, o->name, false, false)778 we pass hash as FALSE. */ 779 if (_bfd_stringtab_add (finfo.strtab, o->name, FALSE, FALSE) 765 780 == (bfd_size_type) -1) 766 781 goto error_return; 767 long_section_names = true;782 long_section_names = TRUE; 768 783 } 769 784 } … … 777 792 /* We use section_count + 1, rather than section_count, because 778 793 the target_index fields are 1 based. */ 779 finfo.section_info = 780 ((struct coff_link_section_info *) 781 bfd_malloc ((abfd->section_count + 1) 782 * sizeof (struct coff_link_section_info))); 794 amt = abfd->section_count + 1; 795 amt *= sizeof (struct coff_link_section_info); 796 finfo.section_info = (struct coff_link_section_info *) bfd_malloc (amt); 783 797 if (finfo.section_info == NULL) 784 798 goto error_return; … … 821 835 common case. */ 822 836 BFD_ASSERT (info->relocateable); 837 amt = o->reloc_count; 838 amt *= sizeof (struct internal_reloc); 823 839 finfo.section_info[o->target_index].relocs = 824 ((struct internal_reloc *) 825 bfd_malloc (o->reloc_count * sizeof (struct internal_reloc))); 840 (struct internal_reloc *) bfd_malloc (amt); 841 amt = o->reloc_count; 842 amt *= sizeof (struct coff_link_hash_entry *); 826 843 finfo.section_info[o->target_index].rel_hashes = 827 ((struct coff_link_hash_entry **) 828 bfd_malloc (o->reloc_count 829 * sizeof (struct coff_link_hash_entry *))); 844 (struct coff_link_hash_entry **) bfd_malloc (amt); 830 845 if (finfo.section_info[o->target_index].relocs == NULL 831 846 || finfo.section_info[o->target_index].rel_hashes == NULL) … … 852 867 size_t sz; 853 868 854 sub->output_has_begun = false;869 sub->output_has_begun = FALSE; 855 870 sz = obj_raw_syment_count (sub); 856 871 if (sz > max_sym_count) … … 859 874 860 875 /* Allocate some buffers used while linking. */ 861 finfo.internal_syms = ((struct internal_syment *) 862 bfd_malloc (max_sym_count 863 * sizeof (struct internal_syment))); 864 finfo.sec_ptrs = (asection **) bfd_malloc (max_sym_count 865 * sizeof (asection *)); 866 finfo.sym_indices = (long *) bfd_malloc (max_sym_count * sizeof (long)); 867 finfo.outsyms = ((bfd_byte *) 868 bfd_malloc ((size_t) ((max_sym_count + 1) * symesz))); 869 finfo.linenos = (bfd_byte *) bfd_malloc (max_lineno_count 870 * bfd_coff_linesz (abfd)); 876 amt = max_sym_count * sizeof (struct internal_syment); 877 finfo.internal_syms = (struct internal_syment *) bfd_malloc (amt); 878 amt = max_sym_count * sizeof (asection *); 879 finfo.sec_ptrs = (asection **) bfd_malloc (amt); 880 amt = max_sym_count * sizeof (long); 881 finfo.sym_indices = (long *) bfd_malloc (amt); 882 finfo.outsyms = (bfd_byte *) bfd_malloc ((max_sym_count + 1) * symesz); 883 amt = max_lineno_count * bfd_coff_linesz (abfd); 884 finfo.linenos = (bfd_byte *) bfd_malloc (amt); 871 885 finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size); 872 finfo.external_relocs = (bfd_byte *) bfd_malloc (max_reloc_count * relsz); 886 amt = max_reloc_count * relsz; 887 finfo.external_relocs = (bfd_byte *) bfd_malloc (amt); 873 888 if (! info->relocateable) 874 finfo.internal_relocs = ((struct internal_reloc *) 875 bfd_malloc (max_reloc_count 876 * sizeof (struct internal_reloc))); 889 { 890 amt = max_reloc_count * sizeof (struct internal_reloc); 891 finfo.internal_relocs = (struct internal_reloc *) bfd_malloc (amt); 892 } 877 893 if ((finfo.internal_syms == NULL && max_sym_count > 0) 878 894 || (finfo.sec_ptrs == NULL && max_sym_count > 0) … … 912 928 if (! _bfd_coff_link_input_bfd (&finfo, sub)) 913 929 goto error_return; 914 sub->output_has_begun = true;930 sub->output_has_begun = TRUE; 915 931 } 916 932 } … … 935 951 936 952 coff_debug_merge_hash_table_free (&finfo.debug_merge); 937 debug_merge_allocated = false;953 debug_merge_allocated = FALSE; 938 954 939 955 if (finfo.internal_syms != NULL) … … 979 995 && (unsigned int) finfo.last_file.n_value != obj_raw_syment_count (abfd)) 980 996 { 997 file_ptr pos; 998 981 999 finfo.last_file.n_value = obj_raw_syment_count (abfd); 982 1000 bfd_coff_swap_sym_out (abfd, (PTR) &finfo.last_file, 983 1001 (PTR) finfo.outsyms); 984 if (bfd_seek (abfd, 985 (obj_sym_filepos (abfd) 986 + finfo.last_file_index * symesz), 987 SEEK_SET) != 0 988 || bfd_write (finfo.outsyms, symesz, 1, abfd) != symesz) 989 return false; 1002 1003 pos = obj_sym_filepos (abfd) + finfo.last_file_index * symesz; 1004 if (bfd_seek (abfd, pos, SEEK_SET) != 0 1005 || bfd_bwrite (finfo.outsyms, symesz, abfd) != symesz) 1006 return FALSE; 990 1007 } 991 1008 … … 995 1012 if (info->task_link) 996 1013 { 997 finfo.failed = false; 998 coff_link_hash_traverse (coff_hash_table (info), _bfd_coff_write_task_globals, 1014 finfo.failed = FALSE; 1015 coff_link_hash_traverse (coff_hash_table (info), 1016 _bfd_coff_write_task_globals, 999 1017 (PTR) &finfo); 1000 1018 if (finfo.failed) … … 1003 1021 1004 1022 /* Write out the global symbols. */ 1005 finfo.failed = false; 1006 coff_link_hash_traverse (coff_hash_table (info), _bfd_coff_write_global_sym, 1023 finfo.failed = FALSE; 1024 coff_link_hash_traverse (coff_hash_table (info), 1025 _bfd_coff_write_global_sym, 1007 1026 (PTR) &finfo); 1008 1027 if (finfo.failed) … … 1021 1040 the symbol indices to use for relocs against them, and we can 1022 1041 finally write out the relocs. */ 1023 external_relocs = ((bfd_byte *)1024 bfd_malloc (max_output_reloc_count * relsz));1042 amt = max_output_reloc_count * relsz; 1043 external_relocs = (bfd_byte *) bfd_malloc (amt); 1025 1044 if (external_relocs == NULL) 1026 1045 goto error_return; … … 1051 1070 1052 1071 if (bfd_seek (abfd, o->rel_filepos, SEEK_SET) != 0 1053 || bfd_write ((PTR) external_relocs, relsz, o->reloc_count, 1054 abfd) != relsz * o->reloc_count) 1072 || (bfd_bwrite ((PTR) external_relocs, 1073 (bfd_size_type) relsz * o->reloc_count, abfd) 1074 != (bfd_size_type) relsz * o->reloc_count)) 1055 1075 goto error_return; 1056 1076 } … … 1080 1100 { 1081 1101 if (! _bfd_write_stab_strings (abfd, &coff_hash_table (info)->stab_info)) 1082 return false;1102 return FALSE; 1083 1103 } 1084 1104 … … 1086 1106 if (obj_raw_syment_count (abfd) != 0 || long_section_names) 1087 1107 { 1088 if (bfd_seek (abfd,1089 (obj_sym_filepos (abfd) 1090 + obj_raw_syment_count (abfd) * symesz), 1091 1092 return false;1108 file_ptr pos; 1109 1110 pos = obj_sym_filepos (abfd) + obj_raw_syment_count (abfd) * symesz; 1111 if (bfd_seek (abfd, pos, SEEK_SET) != 0) 1112 return FALSE; 1093 1113 1094 1114 #if STRING_SIZE_SIZE == 4 1095 bfd_h_put_32 (abfd,1096 1097 (bfd_byte *)strbuf);1115 H_PUT_32 (abfd, 1116 _bfd_stringtab_size (finfo.strtab) + STRING_SIZE_SIZE, 1117 strbuf); 1098 1118 #else 1099 #error Change bfd_h_put_321119 #error Change H_PUT_32 above 1100 1120 #endif 1101 1121 1102 if (bfd_write (strbuf, 1, STRING_SIZE_SIZE, abfd) != STRING_SIZE_SIZE) 1103 return false; 1122 if (bfd_bwrite (strbuf, (bfd_size_type) STRING_SIZE_SIZE, abfd) 1123 != STRING_SIZE_SIZE) 1124 return FALSE; 1104 1125 1105 1126 if (! _bfd_stringtab_emit (abfd, finfo.strtab)) 1106 return false;1107 1108 obj_coff_strings_written (abfd) = true;1127 return FALSE; 1128 1129 obj_coff_strings_written (abfd) = TRUE; 1109 1130 } 1110 1131 … … 1115 1136 bfd_get_symcount (abfd) = 0; 1116 1137 1117 return true;1138 return TRUE; 1118 1139 1119 1140 error_return: … … 1153 1174 if (external_relocs != NULL) 1154 1175 free (external_relocs); 1155 return false;1176 return FALSE; 1156 1177 } 1157 1178 … … 1168 1189 int val = strtoul (ptr, &ptr, 0); 1169 1190 if (heap) 1170 pe_data(output_bfd)->pe_opthdr.SizeOfHeapReserve = val;1191 pe_data(output_bfd)->pe_opthdr.SizeOfHeapReserve = val; 1171 1192 else 1172 pe_data(output_bfd)->pe_opthdr.SizeOfStackReserve = val;1193 pe_data(output_bfd)->pe_opthdr.SizeOfStackReserve = val; 1173 1194 1174 1195 if (ptr[0] == ',') 1175 1196 { 1176 intval = strtoul (ptr+1, &ptr, 0);1197 val = strtoul (ptr+1, &ptr, 0); 1177 1198 if (heap) 1178 pe_data(output_bfd)->pe_opthdr.SizeOfHeapCommit = val;1199 pe_data(output_bfd)->pe_opthdr.SizeOfHeapCommit = val; 1179 1200 else 1180 pe_data(output_bfd)->pe_opthdr.SizeOfStackCommit = val;1201 pe_data(output_bfd)->pe_opthdr.SizeOfStackCommit = val; 1181 1202 } 1182 1203 } … … 1212 1233 return 1; 1213 1234 1214 copy = bfd_malloc ( (size_t)sec->_raw_size);1235 copy = bfd_malloc (sec->_raw_size); 1215 1236 if (!copy) 1216 1237 return 0; 1217 if (! bfd_get_section_contents(abfd, sec, copy, 0, sec->_raw_size))1238 if (! bfd_get_section_contents(abfd, sec, copy, (bfd_vma) 0, sec->_raw_size)) 1218 1239 { 1219 1240 free (copy); … … 1307 1328 if ((a->flags & SEC_RELOC) == 0 || a->reloc_count < 1) 1308 1329 continue; 1330 /* Don't mark relocs in excluded sections. */ 1331 if (a->output_section == bfd_abs_section_ptr) 1332 continue; 1309 1333 1310 1334 /* Read in the relocs. */ 1311 1335 internal_relocs = _bfd_coff_read_internal_relocs 1312 (input_bfd, a, false,1336 (input_bfd, a, FALSE, 1313 1337 finfo->external_relocs, 1314 1338 finfo->info->relocateable, … … 1339 1363 handles all the sections and relocations of the input file at once. */ 1340 1364 1341 b oolean1365 bfd_boolean 1342 1366 _bfd_coff_link_input_bfd (finfo, input_bfd) 1343 1367 struct coff_final_link_info *finfo; … … 1349 1373 unsigned int n_btmask = coff_data (input_bfd)->local_n_btmask; 1350 1374 #endif 1351 b oolean (*adjust_symndx) PARAMS ((bfd *, struct bfd_link_info *, bfd *,1352 asection *, struct internal_reloc*,1353 1375 bfd_boolean (*adjust_symndx) 1376 PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, 1377 struct internal_reloc *, bfd_boolean *)); 1354 1378 bfd *output_bfd; 1355 1379 const char *strings; 1356 1380 bfd_size_type syment_base; 1357 b oolean copy, hash;1381 bfd_boolean copy, hash; 1358 1382 bfd_size_type isymesz; 1359 1383 bfd_size_type osymesz; … … 1379 1403 BFD_ASSERT (linesz == bfd_coff_linesz (output_bfd)); 1380 1404 1381 copy = false;1405 copy = FALSE; 1382 1406 if (! finfo->info->keep_memory) 1383 copy = true;1384 hash = true;1407 copy = TRUE; 1408 hash = TRUE; 1385 1409 if ((output_bfd->flags & BFD_TRADITIONAL_FORMAT) != 0) 1386 hash = false;1410 hash = FALSE; 1387 1411 1388 1412 if (! _bfd_coff_get_external_symbols (input_bfd)) 1389 return false;1413 return FALSE; 1390 1414 1391 1415 esym = (bfd_byte *) obj_coff_external_syms (input_bfd); … … 1400 1424 { 1401 1425 if (! process_embedded_commands (output_bfd, finfo->info, input_bfd)) 1402 return false;1426 return FALSE; 1403 1427 } 1404 1428 … … 1420 1444 struct internal_syment isym; 1421 1445 enum coff_symbol_classification classification; 1422 b oolean skip;1423 b oolean global;1424 b oolean dont_skip_symbol;1446 bfd_boolean skip; 1447 bfd_boolean global; 1448 bfd_boolean dont_skip_symbol; 1425 1449 int add; 1426 1450 … … 1458 1482 dont_skip_symbol = *indexp; 1459 1483 else 1460 dont_skip_symbol = false;1484 dont_skip_symbol = FALSE; 1461 1485 1462 1486 *indexp = -1; 1463 1487 1464 skip = false;1465 global = false;1488 skip = FALSE; 1489 global = FALSE; 1466 1490 add = 1 + isym.n_numaux; 1467 1491 1468 1492 /* If we are stripping all symbols, we want to skip this one. */ 1469 1493 if (finfo->info->strip == strip_all && ! dont_skip_symbol) 1470 skip = true;1494 skip = TRUE; 1471 1495 1472 1496 if (! skip) … … 1483 1507 Locally defined function symbols, however, are an 1484 1508 exception, and are not moved to the end. */ 1485 global = true;1509 global = TRUE; 1486 1510 if (! ISFCN (isym.n_type)) 1487 skip = true;1511 skip = TRUE; 1488 1512 break; 1489 1513 1490 1514 case COFF_SYMBOL_UNDEFINED: 1491 1515 /* Undefined symbols are left for the end. */ 1492 global = true;1493 skip = true;1516 global = TRUE; 1517 skip = TRUE; 1494 1518 break; 1495 1519 … … 1498 1522 local symbols. */ 1499 1523 if (finfo->info->discard == discard_all && ! dont_skip_symbol) 1500 skip = true;1524 skip = TRUE; 1501 1525 break; 1502 1526 } 1503 1527 } 1528 1529 #ifndef COFF_WITH_PE 1530 /* Skip section symbols for sections which are not going to be 1531 emitted. */ 1532 if (!skip 1533 && isym.n_sclass == C_STAT 1534 && isym.n_type == T_NULL 1535 && isym.n_numaux > 0) 1536 { 1537 if ((*secpp)->output_section == bfd_abs_section_ptr) 1538 skip = TRUE; 1539 } 1540 #endif 1504 1541 1505 1542 /* If we stripping debugging symbols, and this is a debugging … … 1521 1558 || isym.n_sclass == C_FIELD 1522 1559 || isym.n_sclass == C_EOS)))) 1523 skip = true;1560 skip = TRUE; 1524 1561 1525 1562 /* If some symbols are stripped based on the name, work out the … … 1534 1571 name = _bfd_coff_internal_syment_name (input_bfd, &isym, buf); 1535 1572 if (name == NULL) 1536 return false;1573 return FALSE; 1537 1574 1538 1575 if (! dont_skip_symbol 1539 1576 && ((finfo->info->strip == strip_some 1540 && (bfd_hash_lookup (finfo->info->keep_hash, name, false,1541 false) == NULL))1577 && (bfd_hash_lookup (finfo->info->keep_hash, name, FALSE, 1578 FALSE) == NULL)) 1542 1579 || (! global 1543 1580 && finfo->info->discard == discard_l 1544 1581 && bfd_is_local_label_name (input_bfd, name)))) 1545 skip = true;1582 skip = TRUE; 1546 1583 } 1547 1584 … … 1563 1600 bfd_byte *esl, *eslend; 1564 1601 struct internal_syment *islp; 1602 bfd_size_type amt; 1565 1603 1566 1604 name = _bfd_coff_internal_syment_name (input_bfd, &isym, buf); 1567 1605 if (name == NULL) 1568 return false;1606 return FALSE; 1569 1607 1570 1608 /* Ignore fake names invented by compiler; treat them all as … … 1576 1614 1577 1615 mh = coff_debug_merge_hash_lookup (&finfo->debug_merge, name, 1578 true, true);1616 TRUE, TRUE); 1579 1617 if (mh == NULL) 1580 return false;1618 return FALSE; 1581 1619 1582 1620 /* Allocate memory to hold type information. If this turns 1583 1621 out to be a duplicate, we pass this address to 1584 1622 bfd_release. */ 1585 mt = ((struct coff_debug_merge_type *) 1586 bfd_alloc (input_bfd, 1587 sizeof (struct coff_debug_merge_type))); 1623 amt = sizeof (struct coff_debug_merge_type); 1624 mt = (struct coff_debug_merge_type *) bfd_alloc (input_bfd, amt); 1588 1625 if (mt == NULL) 1589 return false;1626 return FALSE; 1590 1627 mt->class = isym.n_sclass; 1591 1628 … … 1611 1648 bfd_coff_swap_sym_in (input_bfd, (PTR) esl, (PTR) islp); 1612 1649 1650 amt = sizeof (struct coff_debug_merge_element); 1613 1651 *epp = ((struct coff_debug_merge_element *) 1614 bfd_alloc (input_bfd, 1615 sizeof (struct coff_debug_merge_element))); 1652 bfd_alloc (input_bfd, amt)); 1616 1653 if (*epp == NULL) 1617 return false;1654 return FALSE; 1618 1655 1619 1656 elename = _bfd_coff_internal_syment_name (input_bfd, islp, 1620 1657 elebuf); 1621 1658 if (elename == NULL) 1622 return false;1623 1624 name_copy = (char *) bfd_alloc (input_bfd,1625 strlen (elename) + 1);1659 return FALSE; 1660 1661 amt = strlen (elename) + 1; 1662 name_copy = (char *) bfd_alloc (input_bfd, amt); 1626 1663 if (name_copy == NULL) 1627 return false;1664 return FALSE; 1628 1665 strcpy (name_copy, elename); 1629 1666 … … 1709 1746 *indexp = mtl->indx; 1710 1747 add = (eslend - esym) / isymesz; 1711 skip = true;1748 skip = TRUE; 1712 1749 } 1713 1750 } … … 1733 1770 (char *) NULL); 1734 1771 if (name == NULL) 1735 return false;1772 return FALSE; 1736 1773 indx = _bfd_stringtab_add (finfo->strtab, name, hash, copy); 1737 1774 if (indx == (bfd_size_type) -1) 1738 return false;1775 return FALSE; 1739 1776 isym._n._n_n._n_offset = STRING_SIZE_SIZE + indx; 1740 1777 } … … 1806 1843 1807 1844 if (finfo->last_file_index != -1 1808 && finfo->last_file.n_value != ( long) output_index)1845 && finfo->last_file.n_value != (bfd_vma) output_index) 1809 1846 { 1810 1847 /* We must correct the value of the last C_FILE … … 1823 1860 else 1824 1861 { 1862 file_ptr pos; 1863 1825 1864 /* We have already written out the last C_FILE 1826 1865 symbol. We need to write it out again. We … … 1829 1868 (PTR) &finfo->last_file, 1830 1869 (PTR) outsym); 1831 if (bfd_seek (output_bfd, 1832 (obj_sym_filepos (output_bfd) 1833 + finfo->last_file_index * osymesz), 1834 SEEK_SET) != 0 1835 || (bfd_write (outsym, osymesz, 1, output_bfd) 1836 != osymesz)) 1837 return false; 1870 pos = obj_sym_filepos (output_bfd); 1871 pos += finfo->last_file_index * osymesz; 1872 if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 1873 || bfd_bwrite (outsym, osymesz, output_bfd) != osymesz) 1874 return FALSE; 1838 1875 } 1839 1876 } … … 1868 1905 the link. */ 1869 1906 bfd_set_error (bfd_error_bad_value); 1870 return false;1907 return FALSE; 1871 1908 } 1872 1909 h->indx = output_index; … … 1964 2001 strings = _bfd_coff_read_string_table (input_bfd); 1965 2002 if (strings == NULL) 1966 return false;2003 return FALSE; 1967 2004 } 1968 2005 filename = strings + auxp->x_file.x_n.x_offset; … … 1970 2007 hash, copy); 1971 2008 if (indx == (bfd_size_type) -1) 1972 return false;2009 return FALSE; 1973 2010 auxp->x_file.x_n.x_offset = STRING_SIZE_SIZE + indx; 1974 2011 } … … 2056 2093 else 2057 2094 { 2095 file_ptr pos; 2096 2058 2097 /* We have already written out the last 2059 2098 .bf aux entry. We need to write it … … 2067 2106 0, isymp->n_numaux, 2068 2107 (PTR) outsym); 2069 if (bfd_seek (output_bfd, 2070 (obj_sym_filepos (output_bfd) 2071 + finfo->last_bf_index * osymesz), 2072 SEEK_SET) != 0 2073 || bfd_write (outsym, osymesz, 1, 2074 output_bfd) != osymesz) 2075 return false; 2108 pos = obj_sym_filepos (output_bfd); 2109 pos += finfo->last_bf_index * osymesz; 2110 if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 2111 || (bfd_bwrite (outsym, osymesz, output_bfd) 2112 != osymesz)) 2113 return FALSE; 2076 2114 } 2077 2115 } … … 2119 2157 bfd_byte *elineend; 2120 2158 bfd_byte *oeline; 2121 boolean skipping; 2159 bfd_boolean skipping; 2160 file_ptr pos; 2161 bfd_size_type amt; 2122 2162 2123 2163 /* FIXME: If SEC_HAS_CONTENTS is not for the section, then … … 2135 2175 2136 2176 if (bfd_seek (input_bfd, o->line_filepos, SEEK_SET) != 0 2137 || bfd_ read (finfo->linenos, linesz,o->lineno_count,2177 || bfd_bread (finfo->linenos, linesz * o->lineno_count, 2138 2178 input_bfd) != linesz * o->lineno_count) 2139 return false;2179 return FALSE; 2140 2180 2141 2181 offset = o->output_section->vma + o->output_offset - o->vma; … … 2143 2183 oeline = finfo->linenos; 2144 2184 elineend = eline + linesz * o->lineno_count; 2145 skipping = false;2185 skipping = FALSE; 2146 2186 for (; eline < elineend; eline += linesz) 2147 2187 { … … 2169 2209 the space in the output file, but at least 2170 2210 they're dense. */ 2171 skipping = true;2211 skipping = TRUE; 2172 2212 } 2173 2213 else … … 2209 2249 } 2210 2250 2211 skipping = false;2251 skipping = FALSE; 2212 2252 } 2213 2253 … … 2223 2263 } 2224 2264 2225 if (bfd_seek (output_bfd, 2226 (o->output_section->line_filepos 2227 + o->output_section->lineno_count * linesz), 2228 SEEK_SET) != 0 2229 || (bfd_write (finfo->linenos, 1, oeline - finfo->linenos, 2230 output_bfd) 2231 != (bfd_size_type) (oeline - finfo->linenos))) 2232 return false; 2233 2234 o->output_section->lineno_count += 2235 (oeline - finfo->linenos) / linesz; 2265 pos = o->output_section->line_filepos; 2266 pos += o->output_section->lineno_count * linesz; 2267 amt = oeline - finfo->linenos; 2268 if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 2269 || bfd_bwrite (finfo->linenos, amt, output_bfd) != amt) 2270 return FALSE; 2271 2272 o->output_section->lineno_count += amt / linesz; 2236 2273 } 2237 2274 } … … 2254 2291 if (outsym > finfo->outsyms) 2255 2292 { 2256 if (bfd_seek (output_bfd, 2257 obj_sym_filepos (output_bfd) + syment_base * osymesz, 2258 SEEK_SET) != 0 2259 || (bfd_write (finfo->outsyms, outsym - finfo->outsyms, 1, 2260 output_bfd) 2261 != (bfd_size_type) (outsym - finfo->outsyms))) 2262 return false; 2293 file_ptr pos; 2294 bfd_size_type amt; 2295 2296 pos = obj_sym_filepos (output_bfd) + syment_base * osymesz; 2297 amt = outsym - finfo->outsyms; 2298 if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 2299 || bfd_bwrite (finfo->outsyms, amt, output_bfd) != amt) 2300 return FALSE; 2263 2301 2264 2302 BFD_ASSERT ((obj_raw_syment_count (output_bfd) … … 2290 2328 ((*_bfd_error_handler) 2291 2329 (_("%s: relocs in section `%s', but it has no contents"), 2292 bfd_ get_filename (input_bfd),2330 bfd_archive_filename (input_bfd), 2293 2331 bfd_get_section_name (input_bfd, o))); 2294 2332 bfd_set_error (bfd_error_no_contents); 2295 return false;2333 return FALSE; 2296 2334 } 2297 2335 … … 2306 2344 if (! bfd_get_section_contents (input_bfd, o, finfo->contents, 2307 2345 (file_ptr) 0, o->_raw_size)) 2308 return false;2346 return FALSE; 2309 2347 contents = finfo->contents; 2310 2348 } … … 2319 2357 target_index = o->output_section->target_index; 2320 2358 internal_relocs = (_bfd_coff_read_internal_relocs 2321 (input_bfd, o, false, finfo->external_relocs,2359 (input_bfd, o, FALSE, finfo->external_relocs, 2322 2360 finfo->info->relocateable, 2323 2361 (finfo->info->relocateable … … 2326 2364 : finfo->internal_relocs))); 2327 2365 if (internal_relocs == NULL) 2328 return false;2366 return FALSE; 2329 2367 2330 2368 /* Call processor specific code to relocate the section … … 2336 2374 finfo->internal_syms, 2337 2375 finfo->sec_ptrs)) 2338 return false;2376 return FALSE; 2339 2377 2340 2378 if (finfo->info->relocateable) … … 2352 2390 { 2353 2391 struct coff_link_hash_entry *h; 2354 b oolean adjusted;2392 bfd_boolean adjusted; 2355 2393 2356 2394 *rel_hash = NULL; … … 2368 2406 input_bfd, o, irel, 2369 2407 &adjusted)) 2370 return false;2408 return FALSE; 2371 2409 if (adjusted) 2372 2410 continue; … … 2414 2452 (input_bfd, is, buf)); 2415 2453 if (name == NULL) 2416 return false;2454 return FALSE; 2417 2455 2418 2456 if (! ((*finfo->info->callbacks->unattached_reloc) 2419 2457 (finfo->info, name, input_bfd, o, 2420 2458 irel->r_vaddr))) 2421 return false;2459 return FALSE; 2422 2460 } 2423 2461 } … … 2431 2469 if (secdata == NULL || secdata->stab_info == NULL) 2432 2470 { 2471 file_ptr loc = o->output_offset * bfd_octets_per_byte (output_bfd); 2472 bfd_size_type amt = (o->_cooked_size != 0 2473 ? o->_cooked_size : o->_raw_size); 2433 2474 if (! bfd_set_section_contents (output_bfd, o->output_section, 2434 contents, 2435 (file_ptr) 2436 (o->output_offset * 2437 bfd_octets_per_byte (output_bfd)), 2438 (o->_cooked_size != 0 2439 ? o->_cooked_size 2440 : o->_raw_size))) 2441 return false; 2475 contents, loc, amt)) 2476 return FALSE; 2442 2477 } 2443 2478 else … … 2446 2481 (output_bfd, &coff_hash_table (finfo->info)->stab_info, 2447 2482 o, &secdata->stab_info, contents))) 2448 return false;2483 return FALSE; 2449 2484 } 2450 2485 } … … 2453 2488 { 2454 2489 if (! _bfd_coff_free_symbols (input_bfd)) 2455 return false;2456 } 2457 2458 return true;2490 return FALSE; 2491 } 2492 2493 return TRUE; 2459 2494 } 2460 2495 2461 2496 /* Write out a global symbol. Called via coff_link_hash_traverse. */ 2462 2497 2463 b oolean2498 bfd_boolean 2464 2499 _bfd_coff_write_global_sym (h, data) 2465 2500 struct coff_link_hash_entry *h; … … 2471 2506 bfd_size_type symesz; 2472 2507 unsigned int i; 2508 file_ptr pos; 2473 2509 2474 2510 output_bfd = finfo->output_bfd; 2475 2511 2512 if (h->root.type == bfd_link_hash_warning) 2513 { 2514 h = (struct coff_link_hash_entry *) h->root.u.i.link; 2515 if (h->root.type == bfd_link_hash_new) 2516 return TRUE; 2517 } 2518 2476 2519 if (h->indx >= 0) 2477 return true;2520 return TRUE; 2478 2521 2479 2522 if (h->indx != -2 … … 2481 2524 || (finfo->info->strip == strip_some 2482 2525 && (bfd_hash_lookup (finfo->info->keep_hash, 2483 h->root.root.string, false, false)2526 h->root.root.string, FALSE, FALSE) 2484 2527 == NULL)))) 2485 return true;2528 return TRUE; 2486 2529 2487 2530 switch (h->root.type) … … 2489 2532 default: 2490 2533 case bfd_link_hash_new: 2534 case bfd_link_hash_warning: 2491 2535 abort (); 2492 return false;2536 return FALSE; 2493 2537 2494 2538 case bfd_link_hash_undefined: … … 2521 2565 2522 2566 case bfd_link_hash_indirect: 2523 case bfd_link_hash_warning:2524 2567 /* Just ignore these. They can't be handled anyhow. */ 2525 return true;2568 return TRUE; 2526 2569 } 2527 2570 … … 2530 2573 else 2531 2574 { 2532 b oolean hash;2575 bfd_boolean hash; 2533 2576 bfd_size_type indx; 2534 2577 2535 hash = true;2578 hash = TRUE; 2536 2579 if ((output_bfd->flags & BFD_TRADITIONAL_FORMAT) != 0) 2537 hash = false;2580 hash = FALSE; 2538 2581 indx = _bfd_stringtab_add (finfo->strtab, h->root.root.string, hash, 2539 false);2582 FALSE); 2540 2583 if (indx == (bfd_size_type) -1) 2541 2584 { 2542 finfo->failed = true;2543 return false;2585 finfo->failed = TRUE; 2586 return FALSE; 2544 2587 } 2545 2588 isym._n._n_n._n_zeroes = 0; … … 2560 2603 { 2561 2604 if (! IS_EXTERNAL (output_bfd, isym)) 2562 return true;2605 return TRUE; 2563 2606 2564 2607 isym.n_sclass = C_STAT; … … 2579 2622 symesz = bfd_coff_symesz (output_bfd); 2580 2623 2581 if (bfd_seek (output_bfd, 2582 (obj_sym_filepos (output_bfd) 2583 + obj_raw_syment_count (output_bfd) * symesz), 2584 SEEK_SET) != 0 2585 || bfd_write (finfo->outsyms, symesz, 1, output_bfd) != symesz) 2586 { 2587 finfo->failed = true; 2588 return false; 2624 pos = obj_sym_filepos (output_bfd); 2625 pos += obj_raw_syment_count (output_bfd) * symesz; 2626 if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 2627 || bfd_bwrite (finfo->outsyms, symesz, output_bfd) != symesz) 2628 { 2629 finfo->failed = TRUE; 2630 return FALSE; 2589 2631 } 2590 2632 … … 2651 2693 2652 2694 bfd_coff_swap_aux_out (output_bfd, (PTR) auxp, isym.n_type, 2653 isym.n_sclass, i, isym.n_numaux,2695 isym.n_sclass, (int) i, isym.n_numaux, 2654 2696 (PTR) finfo->outsyms); 2655 if (bfd_ write (finfo->outsyms, symesz, 1, output_bfd) != symesz)2656 { 2657 finfo->failed = true;2658 return false;2697 if (bfd_bwrite (finfo->outsyms, symesz, output_bfd) != symesz) 2698 { 2699 finfo->failed = TRUE; 2700 return FALSE; 2659 2701 } 2660 2702 ++obj_raw_syment_count (output_bfd); 2661 2703 } 2662 2704 2663 return true;2705 return TRUE; 2664 2706 } 2665 2707 … … 2668 2710 the dirty work, if the symbol we are processing needs conversion. */ 2669 2711 2670 b oolean2712 bfd_boolean 2671 2713 _bfd_coff_write_task_globals (h, data) 2672 2714 struct coff_link_hash_entry *h; … … 2674 2716 { 2675 2717 struct coff_final_link_info *finfo = (struct coff_final_link_info *) data; 2676 boolean rtnval = true; 2677 boolean save_global_to_static; 2718 bfd_boolean rtnval = TRUE; 2719 bfd_boolean save_global_to_static; 2720 2721 if (h->root.type == bfd_link_hash_warning) 2722 h = (struct coff_link_hash_entry *) h->root.u.i.link; 2678 2723 2679 2724 if (h->indx < 0) … … 2684 2729 case bfd_link_hash_defweak: 2685 2730 save_global_to_static = finfo->global_to_static; 2686 finfo->global_to_static = true;2731 finfo->global_to_static = TRUE; 2687 2732 rtnval = _bfd_coff_write_global_sym (h, data); 2688 2733 finfo->global_to_static = save_global_to_static; … … 2697 2742 /* Handle a link order which is supposed to generate a reloc. */ 2698 2743 2699 b oolean2744 bfd_boolean 2700 2745 _bfd_coff_reloc_link_order (output_bfd, finfo, output_section, link_order) 2701 2746 bfd *output_bfd; … … 2712 2757 { 2713 2758 bfd_set_error (bfd_error_bad_value); 2714 return false;2759 return FALSE; 2715 2760 } 2716 2761 … … 2720 2765 bfd_byte *buf; 2721 2766 bfd_reloc_status_type rstat; 2722 boolean ok; 2767 bfd_boolean ok; 2768 file_ptr loc; 2723 2769 2724 2770 size = bfd_get_reloc_size (howto); 2725 2771 buf = (bfd_byte *) bfd_zmalloc (size); 2726 2772 if (buf == NULL) 2727 return false;2773 return FALSE; 2728 2774 2729 2775 rstat = _bfd_relocate_contents (howto, output_bfd, 2730 link_order->u.reloc.p->addend, buf); 2776 (bfd_vma) link_order->u.reloc.p->addend,\ 2777 buf); 2731 2778 switch (rstat) 2732 2779 { … … 2747 2794 { 2748 2795 free (buf); 2749 return false;2796 return FALSE; 2750 2797 } 2751 2798 break; 2752 2799 } 2800 loc = link_order->offset * bfd_octets_per_byte (output_bfd); 2753 2801 ok = bfd_set_section_contents (output_bfd, output_section, (PTR) buf, 2754 (file_ptr) 2755 (link_order->offset * 2756 bfd_octets_per_byte (output_bfd)), size); 2802 loc, size); 2757 2803 free (buf); 2758 2804 if (! ok) 2759 return false;2805 return FALSE; 2760 2806 } 2761 2807 … … 2790 2836 bfd_wrapped_link_hash_lookup (output_bfd, finfo->info, 2791 2837 link_order->u.reloc.p->u.name, 2792 false, false, true));2838 FALSE, FALSE, TRUE)); 2793 2839 if (h != NULL) 2794 2840 { … … 2809 2855 (finfo->info, link_order->u.reloc.p->u.name, (bfd *) NULL, 2810 2856 (asection *) NULL, (bfd_vma) 0))) 2811 return false;2857 return FALSE; 2812 2858 irel->r_symndx = 0; 2813 2859 } … … 2824 2870 ++output_section->reloc_count; 2825 2871 2826 return true;2872 return TRUE; 2827 2873 } 2828 2874 … … 2830 2876 simple relocs. */ 2831 2877 2832 b oolean2878 bfd_boolean 2833 2879 _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd, 2834 2880 input_section, contents, relocs, syms, … … 2870 2916 (*_bfd_error_handler) 2871 2917 ("%s: illegal symbol index %ld in relocs", 2872 bfd_ get_filename (input_bfd), symndx);2873 return false;2918 bfd_archive_filename (input_bfd), symndx); 2919 return FALSE; 2874 2920 } 2875 2921 else … … 2892 2938 sym, &addend); 2893 2939 if (howto == NULL) 2894 return false;2940 return FALSE; 2895 2941 2896 2942 /* If we are doing a relocateable link, then we can just ignore … … 2947 2993 if (! ((*info->callbacks->undefined_symbol) 2948 2994 (info, h->root.root.string, input_bfd, input_section, 2949 rel->r_vaddr - input_section->vma, true)))2950 return false;2995 rel->r_vaddr - input_section->vma, TRUE))) 2996 return FALSE; 2951 2997 } 2952 2998 } … … 2973 3019 { 2974 3020 bfd_set_error (bfd_error_system_call); 2975 return false;3021 return FALSE; 2976 3022 } 2977 3023 } … … 2992 3038 (*_bfd_error_handler) 2993 3039 (_("%s: bad reloc address 0x%lx in section `%s'"), 2994 bfd_ get_filename (input_bfd),3040 bfd_archive_filename (input_bfd), 2995 3041 (unsigned long) rel->r_vaddr, 2996 3042 bfd_get_section_name (input_bfd, input_section)); 2997 return false;3043 return FALSE; 2998 3044 case bfd_reloc_overflow: 2999 3045 { … … 3009 3055 name = _bfd_coff_internal_syment_name (input_bfd, sym, buf); 3010 3056 if (name == NULL) 3011 return false;3057 return FALSE; 3012 3058 } 3013 3059 … … 3015 3061 (info, name, howto->name, (bfd_vma) 0, input_bfd, 3016 3062 input_section, rel->r_vaddr - input_section->vma))) 3017 return false;3063 return FALSE; 3018 3064 } 3019 3065 } 3020 3066 } 3021 return true;3067 return TRUE; 3022 3068 } -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.