Changeset 609 for branches/GNU/src/binutils/bfd/ecoff.c
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/bfd/ecoff.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* Generic ECOFF (Extended-COFF) routines. 2 Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 3 Free Software Foundation, Inc.2 Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 3 2002, 2003 Free Software Foundation, Inc. 4 4 Original version by Per Bothner. 5 5 Full support added by Ian Lance Taylor, ian@cygnus.com. 6 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 modify10 it under the terms of the GNU General Public License as published by11 the Free Software Foundation; either version 2 of the License, or12 (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 of16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 GNU General Public License for more details.18 19 You should have received a copy of the GNU General Public License20 along with this program; if not, write to the Free Software21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */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 22 23 23 #include "bfd.h" … … 48 48 /* Prototypes for static functions. */ 49 49 50 static int ecoff_get_magic PARAMS ((bfd *abfd)); 51 static long ecoff_sec_to_styp_flags PARAMS ((const char *name, 52 flagword flags)); 53 static boolean ecoff_slurp_symbolic_header PARAMS ((bfd *abfd)); 54 static boolean ecoff_set_symbol_info PARAMS ((bfd *abfd, SYMR *ecoff_sym, 55 asymbol *asym, int ext, int weak)); 56 static void ecoff_emit_aggregate PARAMS ((bfd *abfd, FDR *fdr, 57 char *string, 58 RNDXR *rndx, long isym, 59 const char *which)); 60 static char *ecoff_type_to_string PARAMS ((bfd *abfd, FDR *fdr, 61 unsigned int indx)); 62 static boolean ecoff_slurp_reloc_table PARAMS ((bfd *abfd, asection *section, 63 asymbol **symbols)); 64 static int ecoff_sort_hdrs PARAMS ((const PTR, const PTR)); 65 static boolean ecoff_compute_section_file_positions PARAMS ((bfd *abfd)); 66 static bfd_size_type ecoff_compute_reloc_file_positions PARAMS ((bfd *abfd)); 67 static boolean ecoff_get_extr PARAMS ((asymbol *, EXTR *)); 68 static void ecoff_set_index PARAMS ((asymbol *, bfd_size_type)); 69 static unsigned int ecoff_armap_hash PARAMS ((CONST char *s, 70 unsigned int *rehash, 71 unsigned int size, 72 unsigned int hlog)); 50 static int ecoff_get_magic 51 PARAMS ((bfd *)); 52 static long ecoff_sec_to_styp_flags 53 PARAMS ((const char *, flagword)); 54 static bfd_boolean ecoff_slurp_symbolic_header 55 PARAMS ((bfd *)); 56 static bfd_boolean ecoff_set_symbol_info 57 PARAMS ((bfd *, SYMR *, asymbol *, int, int)); 58 static void ecoff_emit_aggregate 59 PARAMS ((bfd *, FDR *, char *, RNDXR *, long, const char *)); 60 static char *ecoff_type_to_string 61 PARAMS ((bfd *, FDR *, unsigned int)); 62 static bfd_boolean ecoff_slurp_reloc_table 63 PARAMS ((bfd *, asection *, asymbol **)); 64 static int ecoff_sort_hdrs 65 PARAMS ((const PTR, const PTR)); 66 static bfd_boolean ecoff_compute_section_file_positions 67 PARAMS ((bfd *)); 68 static bfd_size_type ecoff_compute_reloc_file_positions 69 PARAMS ((bfd *)); 70 static bfd_boolean ecoff_get_extr 71 PARAMS ((asymbol *, EXTR *)); 72 static void ecoff_set_index 73 PARAMS ((asymbol *, bfd_size_type)); 74 static unsigned int ecoff_armap_hash 75 PARAMS ((const char *, unsigned int *, unsigned int, unsigned int)); 73 76 74 77 … … 81 84 /* linker_mark, linker_has_input, gc_mark, segment_mark, */ 82 85 0, 0, 0, 0, 83 /* vma, lma, _cooked_size, _raw_size, */ 86 /* sec_info_type, use_rela_p, has_tls_reloc, flag11, flag12, */ 87 0, 0, 0, 0, 0, 88 /* flag13, flag14, flag15, flag16, flag20, flag24, */ 89 0, 0, 0, 0, 0, 0, 90 /* vma, lma, _cooked_size, _raw_size, */ 84 91 0, 0, 0, 0, 85 92 /* output_offset, output_section, alignment_power, */ … … 89 96 /* line_filepos, userdata, contents, lineno, lineno_count, */ 90 97 0, NULL, NULL, NULL, 0, 91 /* comdat, kept_section, moving_line_filepos,*/92 NULL, NULL,0,98 /* entsize, comdat, moving_line_filepos, */ 99 0, NULL, 0, 93 100 /* target_index, used_by_bfd, constructor_chain, owner, */ 94 101 0, NULL, NULL, NULL, … … 103 110 /* Create an ECOFF object. */ 104 111 105 b oolean112 bfd_boolean 106 113 _bfd_ecoff_mkobject (abfd) 107 114 bfd *abfd; 108 115 { 109 abfd->tdata.ecoff_obj_data = ((struct ecoff_tdata *) 110 bfd_zalloc (abfd, sizeof (ecoff_data_type))); 116 bfd_size_type amt = sizeof (ecoff_data_type); 117 118 abfd->tdata.ecoff_obj_data = (struct ecoff_tdata *) bfd_zalloc (abfd, amt); 111 119 if (abfd->tdata.ecoff_obj_data == NULL) 112 return false;113 114 return true;120 return FALSE; 121 122 return TRUE; 115 123 } 116 124 … … 128 136 ecoff_data_type *ecoff; 129 137 130 if ( _bfd_ecoff_mkobject (abfd) == false)138 if (! _bfd_ecoff_mkobject (abfd)) 131 139 return NULL; 132 140 … … 163 171 /* Initialize a new section. */ 164 172 165 b oolean173 bfd_boolean 166 174 _bfd_ecoff_new_section_hook (abfd, section) 167 175 bfd *abfd ATTRIBUTE_UNUSED; … … 187 195 section->flags |= SEC_ALLOC; 188 196 else if (strcmp (section->name, _LIB) == 0) 189 { 190 /* An Irix 4 shared libary. */ 191 section->flags |= SEC_COFF_SHARED_LIBRARY; 192 } 197 /* An Irix 4 shared libary. */ 198 section->flags |= SEC_COFF_SHARED_LIBRARY; 193 199 194 200 /* Probably any other section name is SEC_NEVER_LOAD, but I'm … … 196 202 libraries work. */ 197 203 198 return true;204 return TRUE; 199 205 } 200 206 … … 204 210 for each target, but there aren't all that many ECOFF targets. */ 205 211 206 b oolean212 bfd_boolean 207 213 _bfd_ecoff_set_arch_mach_hook (abfd, filehdr) 208 214 bfd *abfd; … … 219 225 case MIPS_MAGIC_BIG: 220 226 arch = bfd_arch_mips; 221 mach = 3000;227 mach = bfd_mach_mips3000; 222 228 break; 223 229 224 230 case MIPS_MAGIC_LITTLE2: 225 231 case MIPS_MAGIC_BIG2: 226 /* MIPS ISA level 2: the r6000 */232 /* MIPS ISA level 2: the r6000. */ 227 233 arch = bfd_arch_mips; 228 mach = 6000;234 mach = bfd_mach_mips6000; 229 235 break; 230 236 231 237 case MIPS_MAGIC_LITTLE3: 232 238 case MIPS_MAGIC_BIG3: 233 /* MIPS ISA level 3: the r4000 */239 /* MIPS ISA level 3: the r4000. */ 234 240 arch = bfd_arch_mips; 235 mach = 4000;241 mach = bfd_mach_mips4000; 236 242 break; 237 243 … … 266 272 default: 267 273 case 0: 268 case 3000:274 case bfd_mach_mips3000: 269 275 big = MIPS_MAGIC_BIG; 270 276 little = MIPS_MAGIC_LITTLE; 271 277 break; 272 278 273 case 6000:279 case bfd_mach_mips6000: 274 280 big = MIPS_MAGIC_BIG2; 275 281 little = MIPS_MAGIC_LITTLE2; 276 282 break; 277 283 278 case 4000:284 case bfd_mach_mips4000: 279 285 big = MIPS_MAGIC_BIG3; 280 286 little = MIPS_MAGIC_LITTLE3; … … 374 380 /* Get the BFD flags to use for a section. */ 375 381 376 flagword 377 _bfd_ecoff_styp_to_sec_flags (abfd, hdr, name, section )382 bfd_boolean 383 _bfd_ecoff_styp_to_sec_flags (abfd, hdr, name, section, flags_ptr) 378 384 bfd *abfd ATTRIBUTE_UNUSED; 379 385 PTR hdr; 380 386 const char *name ATTRIBUTE_UNUSED; 381 387 asection *section ATTRIBUTE_UNUSED; 388 flagword * flags_ptr; 382 389 { 383 390 struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr; 384 391 long styp_flags = internal_s->s_flags; 385 flagword sec_flags =0;392 flagword sec_flags = 0; 386 393 387 394 if (styp_flags & STYP_NOLOAD) … … 425 432 else if ((styp_flags & STYP_BSS) 426 433 || (styp_flags & STYP_SBSS)) 427 { 428 sec_flags |= SEC_ALLOC; 429 } 434 sec_flags |= SEC_ALLOC; 430 435 else if ((styp_flags & STYP_INFO) || styp_flags == STYP_COMMENT) 431 { 432 sec_flags |= SEC_NEVER_LOAD; 433 } 436 sec_flags |= SEC_NEVER_LOAD; 434 437 else if ((styp_flags & STYP_LITA) 435 438 || (styp_flags & STYP_LIT8) 436 439 || (styp_flags & STYP_LIT4)) 437 { 438 sec_flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC | SEC_READONLY; 439 } 440 sec_flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC | SEC_READONLY; 440 441 else if (styp_flags & STYP_ECOFF_LIB) 441 { 442 sec_flags |= SEC_COFF_SHARED_LIBRARY; 443 } 442 sec_flags |= SEC_COFF_SHARED_LIBRARY; 444 443 else 445 { 446 sec_flags |= SEC_ALLOC | SEC_LOAD; 447 } 448 449 return sec_flags; 444 sec_flags |= SEC_ALLOC | SEC_LOAD; 445 446 * flags_ptr = sec_flags; 447 return TRUE; 450 448 } 451 449 … … 453 451 /* Read in the symbolic header for an ECOFF object file. */ 454 452 455 static b oolean453 static bfd_boolean 456 454 ecoff_slurp_symbolic_header (abfd) 457 455 bfd *abfd; … … 465 463 if (ecoff_data (abfd)->debug_info.symbolic_header.magic == 466 464 backend->debug_swap.sym_magic) 467 return true;465 return TRUE; 468 466 469 467 /* See whether there is a symbolic header. */ … … 471 469 { 472 470 bfd_get_symcount (abfd) = 0; 473 return true;471 return TRUE; 474 472 } 475 473 … … 482 480 { 483 481 bfd_set_error (bfd_error_bad_value); 484 return false;482 return FALSE; 485 483 } 486 484 487 485 /* Read the symbolic information header. */ 488 raw = (PTR) bfd_malloc ( (size_t)external_hdr_size);486 raw = (PTR) bfd_malloc (external_hdr_size); 489 487 if (raw == NULL) 490 488 goto error_return; 491 489 492 if (bfd_seek (abfd, ecoff_data (abfd)->sym_filepos, SEEK_SET) == -1 493 || (bfd_read (raw, external_hdr_size, 1, abfd) 494 != external_hdr_size)) 490 if (bfd_seek (abfd, ecoff_data (abfd)->sym_filepos, SEEK_SET) != 0 491 || bfd_bread (raw, external_hdr_size, abfd) != external_hdr_size) 495 492 goto error_return; 496 493 internal_symhdr = &ecoff_data (abfd)->debug_info.symbolic_header; … … 509 506 if (raw != NULL) 510 507 free (raw); 511 return true;508 return TRUE; 512 509 error_return: 513 510 if (raw != NULL) 514 511 free (raw); 515 return false;512 return FALSE; 516 513 } 517 514 … … 520 517 point in the backend structure. */ 521 518 522 b oolean519 bfd_boolean 523 520 _bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug) 524 521 bfd *abfd; … … 537 534 bfd_size_type raw_end; 538 535 bfd_size_type cb_end; 536 bfd_size_type amt; 537 file_ptr pos; 539 538 540 539 BFD_ASSERT (debug == &ecoff_data (abfd)->debug_info); … … 543 542 get. */ 544 543 if (ecoff_data (abfd)->raw_syments != (PTR) NULL) 545 return true;544 return TRUE; 546 545 if (ecoff_data (abfd)->sym_filepos == 0) 547 546 { 548 547 bfd_get_symcount (abfd) = 0; 549 return true;548 return TRUE; 550 549 } 551 550 552 551 if (! ecoff_slurp_symbolic_header (abfd)) 553 return false;552 return FALSE; 554 553 555 554 internal_symhdr = &debug->symbolic_header; … … 564 563 statically and dynamically linked executables. 565 564 If bfd supports SEEK_END someday, this code could be simplified. */ 566 567 565 raw_end = 0; 568 566 … … 576 574 UPDATE_RAW_END (cbPdOffset, ipdMax, backend->debug_swap.external_pdr_size); 577 575 UPDATE_RAW_END (cbSymOffset, isymMax, backend->debug_swap.external_sym_size); 578 UPDATE_RAW_END (cbOptOffset, ioptMax, backend->debug_swap.external_opt_size); 576 /* eraxxon@alumni.rice.edu: ioptMax refers to the size of the 577 optimization symtab, not the number of entries */ 578 UPDATE_RAW_END (cbOptOffset, ioptMax, sizeof (char)); 579 579 UPDATE_RAW_END (cbAuxOffset, iauxMax, sizeof (union aux_ext)); 580 580 UPDATE_RAW_END (cbSsOffset, issMax, sizeof (char)); … … 590 590 { 591 591 ecoff_data (abfd)->sym_filepos = 0; 592 return true;592 return TRUE; 593 593 } 594 594 raw = (PTR) bfd_alloc (abfd, raw_size); 595 595 if (raw == NULL) 596 return false;597 if (bfd_seek (abfd, 598 (ecoff_data (abfd)->sym_filepos 599 + backend->debug_swap.external_hdr_size), 600 601 || bfd_ read (raw, raw_size, 1, abfd) != raw_size)596 return FALSE; 597 598 pos = ecoff_data (abfd)->sym_filepos; 599 pos += backend->debug_swap.external_hdr_size; 600 if (bfd_seek (abfd, pos, SEEK_SET) != 0 601 || bfd_bread (raw, raw_size, abfd) != raw_size) 602 602 { 603 603 bfd_release (abfd, raw); 604 return false;604 return FALSE; 605 605 } 606 606 … … 615 615 + (internal_symhdr->off1 \ 616 616 - raw_base)) 617 617 618 FIX (cbLineOffset, line, unsigned char *); 618 619 FIX (cbDnOffset, external_dnr, PTR); … … 636 637 We need to look at the fdr to deal with a lot of information in 637 638 the symbols, so we swap them here. */ 638 debug->fdr = (struct fdr *) bfd_alloc (abfd,639 (internal_symhdr->ifdMax * 640 sizeof (struct fdr)));639 amt = internal_symhdr->ifdMax; 640 amt *= sizeof (struct fdr); 641 debug->fdr = (struct fdr *) bfd_alloc (abfd, amt); 641 642 if (debug->fdr == NULL) 642 return false;643 return FALSE; 643 644 external_fdr_size = backend->debug_swap.external_fdr_size; 644 645 fdr_ptr = debug->fdr; … … 648 649 (*backend->debug_swap.swap_fdr_in) (abfd, (PTR) fraw_src, fdr_ptr); 649 650 650 return true;651 return TRUE; 651 652 } 652 653 … … 671 672 { 672 673 ecoff_symbol_type *new; 673 674 new = (ecoff_symbol_type *) bfd_alloc (abfd, sizeof (ecoff_symbol_type)); 674 bfd_size_type amt = sizeof (ecoff_symbol_type); 675 676 new = (ecoff_symbol_type *) bfd_zalloc (abfd, amt); 675 677 if (new == (ecoff_symbol_type *) NULL) 676 678 return (asymbol *) NULL; 677 memset ((PTR) new, 0, sizeof *new);678 679 new->symbol.section = (asection *) NULL; 679 680 new->fdr = (FDR *) NULL; 680 new->local = false;681 new->local = FALSE; 681 682 new->native = NULL; 682 683 new->symbol.the_bfd = abfd; … … 686 687 /* Set the BFD flags and section for an ECOFF symbol. */ 687 688 688 static b oolean689 static bfd_boolean 689 690 ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, weak) 690 691 bfd *abfd; … … 712 713 { 713 714 asym->flags = BSF_DEBUGGING; 714 return true;715 return TRUE; 715 716 } 716 717 break; 717 718 default: 718 719 asym->flags = BSF_DEBUGGING; 719 return true;720 return TRUE; 720 721 } 721 722 … … 738 739 asym->flags |= BSF_DEBUGGING; 739 740 } 741 742 if (ecoff_sym->st == stProc || ecoff_sym->st == stStaticProc) 743 asym->flags |= BSF_FUNCTION; 744 740 745 switch (ecoff_sym->sc) 741 746 { … … 871 876 arelent_chain *reloc_chain; 872 877 unsigned int bitsize; 878 bfd_size_type amt; 873 879 874 880 /* Get a section with the same name as the symbol (usually … … 890 896 char *copy; 891 897 892 copy = (char *) bfd_alloc (abfd, strlen (name) + 1); 898 amt = strlen (name) + 1; 899 copy = (char *) bfd_alloc (abfd, amt); 893 900 if (!copy) 894 return false;901 return FALSE; 895 902 strcpy (copy, name); 896 903 section = bfd_make_section (abfd, copy); … … 898 905 899 906 /* Build a reloc pointing to this constructor. */ 900 reloc_chain =901 (arelent_chain *) bfd_alloc (abfd, sizeof (arelent_chain));907 amt = sizeof (arelent_chain); 908 reloc_chain = (arelent_chain *) bfd_alloc (abfd, amt); 902 909 if (!reloc_chain) 903 return false;910 return FALSE; 904 911 reloc_chain->relent.sym_ptr_ptr = 905 912 bfd_get_section (asym)->symbol_ptr_ptr; … … 934 941 } 935 942 } 936 return true;943 return TRUE; 937 944 } 938 945 939 946 /* Read an ECOFF symbol table. */ 940 947 941 b oolean948 bfd_boolean 942 949 _bfd_ecoff_slurp_symbol_table (abfd) 943 950 bfd *abfd; … … 962 969 /* If we've already read in the symbol table, do nothing. */ 963 970 if (ecoff_data (abfd)->canonical_symbols != NULL) 964 return true;971 return TRUE; 965 972 966 973 /* Get the symbolic information. */ 967 974 if (! _bfd_ecoff_slurp_symbolic_info (abfd, (asection *) NULL, 968 975 &ecoff_data (abfd)->debug_info)) 969 return false;976 return FALSE; 970 977 if (bfd_get_symcount (abfd) == 0) 971 return true; 972 973 internal_size = bfd_get_symcount (abfd) * sizeof (ecoff_symbol_type); 978 return TRUE; 979 980 internal_size = bfd_get_symcount (abfd); 981 internal_size *= sizeof (ecoff_symbol_type); 974 982 internal = (ecoff_symbol_type *) bfd_alloc (abfd, internal_size); 975 983 if (internal == NULL) 976 return false;984 return FALSE; 977 985 978 986 internal_ptr = internal; … … 991 999 &internal_ptr->symbol, 1, 992 1000 internal_esym.weakext)) 993 return false;1001 return FALSE; 994 1002 /* The alpha uses a negative ifd field for section symbols. */ 995 1003 if (internal_esym.ifd >= 0) … … 998 1006 else 999 1007 internal_ptr->fdr = NULL; 1000 internal_ptr->local = false;1008 internal_ptr->local = FALSE; 1001 1009 internal_ptr->native = (PTR) eraw_src; 1002 1010 } … … 1026 1034 if (!ecoff_set_symbol_info (abfd, &internal_sym, 1027 1035 &internal_ptr->symbol, 0, 0)) 1028 return false;1036 return FALSE; 1029 1037 internal_ptr->fdr = fdr_ptr; 1030 internal_ptr->local = true;1038 internal_ptr->local = TRUE; 1031 1039 internal_ptr->native = (PTR) lraw_src; 1032 1040 } … … 1035 1043 ecoff_data (abfd)->canonical_symbols = internal; 1036 1044 1037 return true;1045 return TRUE; 1038 1046 } 1039 1047 … … 1065 1073 ecoff_symbol_type **location = (ecoff_symbol_type **) alocation; 1066 1074 1067 if ( _bfd_ecoff_slurp_symbol_table (abfd) == false)1075 if (! _bfd_ecoff_slurp_symbol_table (abfd)) 1068 1076 return -1; 1069 1077 if (bfd_get_symcount (abfd) == 0) … … 1195 1203 qualifiers[6].type = tqNil; 1196 1204 1197 /* 1198 * Go get the basic type. 1199 */ 1205 /* Go get the basic type. */ 1200 1206 switch (basic_type) 1201 1207 { 1202 case btNil: /* undefined*/1208 case btNil: /* Undefined. */ 1203 1209 strcpy (p1, "nil"); 1204 1210 break; 1205 1211 1206 case btAdr: /* address - integer same size as pointer*/1212 case btAdr: /* Address - integer same size as pointer. */ 1207 1213 strcpy (p1, "address"); 1208 1214 break; 1209 1215 1210 case btChar: /* character*/1216 case btChar: /* Character. */ 1211 1217 strcpy (p1, "char"); 1212 1218 break; 1213 1219 1214 case btUChar: /* unsigned character*/1220 case btUChar: /* Unsigned character. */ 1215 1221 strcpy (p1, "unsigned char"); 1216 1222 break; 1217 1223 1218 case btShort: /* short*/1224 case btShort: /* Short. */ 1219 1225 strcpy (p1, "short"); 1220 1226 break; 1221 1227 1222 case btUShort: /* unsigned short*/1228 case btUShort: /* Unsigned short. */ 1223 1229 strcpy (p1, "unsigned short"); 1224 1230 break; 1225 1231 1226 case btInt: /* int*/1232 case btInt: /* Int. */ 1227 1233 strcpy (p1, "int"); 1228 1234 break; 1229 1235 1230 case btUInt: /* unsigned int*/1236 case btUInt: /* Unsigned int. */ 1231 1237 strcpy (p1, "unsigned int"); 1232 1238 break; 1233 1239 1234 case btLong: /* long*/1240 case btLong: /* Long. */ 1235 1241 strcpy (p1, "long"); 1236 1242 break; 1237 1243 1238 case btULong: /* unsigned long*/1244 case btULong: /* Unsigned long. */ 1239 1245 strcpy (p1, "unsigned long"); 1240 1246 break; 1241 1247 1242 case btFloat: /* float (real)*/1248 case btFloat: /* Float (real). */ 1243 1249 strcpy (p1, "float"); 1244 1250 break; 1245 1251 1246 case btDouble: /* Double (real) */1252 case btDouble: /* Double (real). */ 1247 1253 strcpy (p1, "double"); 1248 1254 break; … … 1252 1258 2nd word is file index if 1st word rfd is ST_RFDESCAPE. */ 1253 1259 1254 case btStruct: /* Structure (Record) */1260 case btStruct: /* Structure (Record). */ 1255 1261 _bfd_ecoff_swap_rndx_in (bigendian, &aux_ptr[indx].a_rndx, &rndx); 1256 1262 ecoff_emit_aggregate (abfd, fdr, p1, &rndx, 1257 1263 (long) AUX_GET_ISYM (bigendian, &aux_ptr[indx+1]), 1258 1264 "struct"); 1259 indx++; /* skip aux words*/1265 indx++; /* Skip aux words. */ 1260 1266 break; 1261 1267 … … 1264 1270 2nd word is file index if 1st word rfd is ST_RFDESCAPE. */ 1265 1271 1266 case btUnion: /* Union */1272 case btUnion: /* Union. */ 1267 1273 _bfd_ecoff_swap_rndx_in (bigendian, &aux_ptr[indx].a_rndx, &rndx); 1268 1274 ecoff_emit_aggregate (abfd, fdr, p1, &rndx, 1269 1275 (long) AUX_GET_ISYM (bigendian, &aux_ptr[indx+1]), 1270 1276 "union"); 1271 indx++; /* skip aux words*/1277 indx++; /* Skip aux words. */ 1272 1278 break; 1273 1279 … … 1276 1282 2nd word is file index if 1st word rfd is ST_RFDESCAPE. */ 1277 1283 1278 case btEnum: /* Enumeration */1284 case btEnum: /* Enumeration. */ 1279 1285 _bfd_ecoff_swap_rndx_in (bigendian, &aux_ptr[indx].a_rndx, &rndx); 1280 1286 ecoff_emit_aggregate (abfd, fdr, p1, &rndx, 1281 1287 (long) AUX_GET_ISYM (bigendian, &aux_ptr[indx+1]), 1282 1288 "enum"); 1283 indx++; /* skip aux words*/1284 break; 1285 1286 case btTypedef: /* defined via a typedef, isymRef points*/1289 indx++; /* Skip aux words. */ 1290 break; 1291 1292 case btTypedef: /* Defined via a typedef, isymRef points. */ 1287 1293 strcpy (p1, "typedef"); 1288 1294 break; 1289 1295 1290 case btRange: /* subrange of int*/1296 case btRange: /* Subrange of int. */ 1291 1297 strcpy (p1, "subrange"); 1292 1298 break; 1293 1299 1294 case btSet: /* pascal sets*/1300 case btSet: /* Pascal sets. */ 1295 1301 strcpy (p1, "set"); 1296 1302 break; 1297 1303 1298 case btComplex: /* fortran complex*/1304 case btComplex: /* Fortran complex. */ 1299 1305 strcpy (p1, "complex"); 1300 1306 break; 1301 1307 1302 case btDComplex: /* fortran double complex*/1308 case btDComplex: /* Fortran double complex. */ 1303 1309 strcpy (p1, "double complex"); 1304 1310 break; 1305 1311 1306 case btIndirect: /* forward or unnamed typedef*/1312 case btIndirect: /* Forward or unnamed typedef. */ 1307 1313 strcpy (p1, "forward/unamed typedef"); 1308 1314 break; 1309 1315 1310 case btFixedDec: /* Fixed Decimal */1316 case btFixedDec: /* Fixed Decimal. */ 1311 1317 strcpy (p1, "fixed decimal"); 1312 1318 break; 1313 1319 1314 case btFloatDec: /* Float Decimal */1320 case btFloatDec: /* Float Decimal. */ 1315 1321 strcpy (p1, "float decimal"); 1316 1322 break; 1317 1323 1318 case btString: /* Varying Length Character String */1324 case btString: /* Varying Length Character String. */ 1319 1325 strcpy (p1, "string"); 1320 1326 break; 1321 1327 1322 case btBit: /* Aligned Bit String */1328 case btBit: /* Aligned Bit String. */ 1323 1329 strcpy (p1, "bit"); 1324 1330 break; 1325 1331 1326 case btPicture: /* Picture */1332 case btPicture: /* Picture. */ 1327 1333 strcpy (p1, "picture"); 1328 1334 break; 1329 1335 1330 case btVoid: /* Void */1336 case btVoid: /* Void. */ 1331 1337 strcpy (p1, "void"); 1332 1338 break; … … 1339 1345 p1 += strlen (buffer1); 1340 1346 1341 /* 1342 * If this is a bitfield, get the bitsize. 1343 */ 1347 /* If this is a bitfield, get the bitsize. */ 1344 1348 if (u.ti.fBitfield) 1345 1349 { … … 1351 1355 } 1352 1356 1353 /* 1354 * Deal with any qualifiers. 1355 */ 1357 /* Deal with any qualifiers. */ 1356 1358 if (qualifiers[0].type != tqNil) 1357 1359 { 1358 /* 1359 * Snarf up any array bounds in the correct order. Arrays 1360 * store 5 successive words in the aux. table: 1361 * word 0 RNDXR to type of the bounds (ie, int) 1362 * word 1 Current file descriptor index 1363 * word 2 low bound 1364 * word 3 high bound (or -1 if []) 1365 * word 4 stride size in bits 1366 */ 1360 /* Snarf up any array bounds in the correct order. Arrays 1361 store 5 successive words in the aux. table: 1362 word 0 RNDXR to type of the bounds (ie, int) 1363 word 1 Current file descriptor index 1364 word 2 low bound 1365 word 3 high bound (or -1 if []) 1366 word 4 stride size in bits. */ 1367 1367 for (i = 0; i < 7; i++) 1368 1368 { … … 1379 1379 } 1380 1380 1381 /* 1382 * Now print out the qualifiers. 1383 */ 1381 /* Now print out the qualifiers. */ 1384 1382 for (i = 0; i < 6; i++) 1385 1383 { … … 1417 1415 /* Print array bounds reversed (ie, in the order the C 1418 1416 programmer writes them). C is such a fun language.... */ 1419 1420 1417 while (i < 5 && qualifiers[i+1].type == tqArray) 1421 1418 i++; … … 1468 1465 /* Return whether this is a local label. */ 1469 1466 1470 b oolean1467 bfd_boolean 1471 1468 _bfd_ecoff_bfd_is_local_label_name (abfd, name) 1472 1469 bfd *abfd ATTRIBUTE_UNUSED; … … 1519 1516 break; 1520 1517 case bfd_print_symbol_all: 1521 /* Print out the symbols in a reasonable way */1518 /* Print out the symbols in a reasonable way. */ 1522 1519 { 1523 1520 char type; … … 1593 1590 bigendian = fdr->fBigendian; 1594 1591 1595 /* This switch is basically from gcc/mips-tdump.c */1592 /* This switch is basically from gcc/mips-tdump.c. */ 1596 1593 switch (ecoff_ext.asym.st) 1597 1594 { … … 1668 1665 /* Read in the relocs for a section. */ 1669 1666 1670 static b oolean1667 static bfd_boolean 1671 1668 ecoff_slurp_reloc_table (abfd, section, symbols) 1672 1669 bfd *abfd; … … 1677 1674 arelent *internal_relocs; 1678 1675 bfd_size_type external_reloc_size; 1679 bfd_size_type external_relocs_size;1676 bfd_size_type amt; 1680 1677 char *external_relocs; 1681 1678 arelent *rptr; … … 1685 1682 || section->reloc_count == 0 1686 1683 || (section->flags & SEC_CONSTRUCTOR) != 0) 1687 return true; 1688 1689 if (_bfd_ecoff_slurp_symbol_table (abfd) == false) 1690 return false; 1691 1692 internal_relocs = (arelent *) bfd_alloc (abfd, 1693 (sizeof (arelent) 1694 * section->reloc_count)); 1684 return TRUE; 1685 1686 if (! _bfd_ecoff_slurp_symbol_table (abfd)) 1687 return FALSE; 1688 1689 amt = section->reloc_count; 1690 amt *= sizeof (arelent); 1691 internal_relocs = (arelent *) bfd_alloc (abfd, amt); 1692 1695 1693 external_reloc_size = backend->external_reloc_size; 1696 external_relocs_size= external_reloc_size * section->reloc_count;1697 external_relocs = (char *) bfd_alloc (abfd, external_relocs_size);1694 amt = external_reloc_size * section->reloc_count; 1695 external_relocs = (char *) bfd_alloc (abfd, amt); 1698 1696 if (internal_relocs == (arelent *) NULL 1699 1697 || external_relocs == (char *) NULL) 1700 return false;1698 return FALSE; 1701 1699 if (bfd_seek (abfd, section->rel_filepos, SEEK_SET) != 0) 1702 return false; 1703 if (bfd_read (external_relocs, 1, external_relocs_size, abfd) 1704 != external_relocs_size) 1705 return false; 1700 return FALSE; 1701 if (bfd_bread (external_relocs, amt, abfd) != amt) 1702 return FALSE; 1706 1703 1707 1704 for (i = 0, rptr = internal_relocs; i < section->reloc_count; i++, rptr++) … … 1731 1728 else 1732 1729 { 1733 CONSTchar *sec_name;1730 const char *sec_name; 1734 1731 asection *sec; 1735 1732 … … 1773 1770 section->relocation = internal_relocs; 1774 1771 1775 return true;1772 return TRUE; 1776 1773 } 1777 1774 … … 1803 1800 arelent *tblptr; 1804 1801 1805 if ( ecoff_slurp_reloc_table (abfd, section, symbols) == false)1802 if (! ecoff_slurp_reloc_table (abfd, section, symbols)) 1806 1803 return -1; 1807 1804 … … 1822 1819 wanted location. */ 1823 1820 1824 b oolean1821 bfd_boolean 1825 1822 _bfd_ecoff_find_nearest_line (abfd, section, ignore_symbols, offset, 1826 1823 filename_ptr, functionname_ptr, retline_ptr) … … 1829 1826 asymbol **ignore_symbols ATTRIBUTE_UNUSED; 1830 1827 bfd_vma offset; 1831 CONSTchar **filename_ptr;1832 CONSTchar **functionname_ptr;1828 const char **filename_ptr; 1829 const char **functionname_ptr; 1833 1830 unsigned int *retline_ptr; 1834 1831 { … … 1841 1838 if (! _bfd_ecoff_slurp_symbolic_info (abfd, (asection *) NULL, debug_info) 1842 1839 || bfd_get_symcount (abfd) == 0) 1843 return false;1840 return FALSE; 1844 1841 1845 1842 if (ecoff_data (abfd)->find_line_info == NULL) 1846 1843 { 1847 ecoff_data (abfd)->find_line_info =1848 ((struct ecoff_find_line *) 1849 bfd_zalloc (abfd, sizeof (struct ecoff_find_line)));1844 bfd_size_type amt = sizeof (struct ecoff_find_line); 1845 ecoff_data (abfd)->find_line_info 1846 = (struct ecoff_find_line *) bfd_zalloc (abfd, amt); 1850 1847 if (ecoff_data (abfd)->find_line_info == NULL) 1851 return false;1848 return FALSE; 1852 1849 } 1853 1850 line_info = ecoff_data (abfd)->find_line_info; … … 1872 1869 information. */ 1873 1870 1874 b oolean1871 bfd_boolean 1875 1872 _bfd_ecoff_bfd_copy_private_bfd_data (ibfd, obfd) 1876 1873 bfd *ibfd; … … 1882 1879 asymbol **sym_ptr_ptr; 1883 1880 size_t c; 1884 b oolean local;1881 bfd_boolean local; 1885 1882 1886 1883 /* We only want to copy information over if both BFD's use ECOFF … … 1888 1885 if (bfd_get_flavour (ibfd) != bfd_target_ecoff_flavour 1889 1886 || bfd_get_flavour (obfd) != bfd_target_ecoff_flavour) 1890 return true;1887 return TRUE; 1891 1888 1892 1889 /* Copy the GP value and the register masks. */ … … 1904 1901 sym_ptr_ptr = bfd_get_outsymbols (obfd); 1905 1902 if (c == 0 || sym_ptr_ptr == (asymbol **) NULL) 1906 return true;1903 return TRUE; 1907 1904 1908 1905 /* See if there are any local symbols. */ 1909 local = false;1906 local = FALSE; 1910 1907 for (; c > 0; c--, sym_ptr_ptr++) 1911 1908 { 1912 1909 if (ecoffsymbol (*sym_ptr_ptr)->local) 1913 1910 { 1914 local = true;1911 local = TRUE; 1915 1912 break; 1916 1913 } … … 1975 1972 } 1976 1973 1977 return true;1974 return TRUE; 1978 1975 } 1979 1976 … … 1983 1980 callers ignore the return value. */ 1984 1981 1985 b oolean1982 bfd_boolean 1986 1983 _bfd_ecoff_set_arch_mach (abfd, arch, machine) 1987 1984 bfd *abfd; … … 1998 1995 _bfd_ecoff_sizeof_headers (abfd, reloc) 1999 1996 bfd *abfd; 2000 b oolean reloc ATTRIBUTE_UNUSED;1997 bfd_boolean reloc ATTRIBUTE_UNUSED; 2001 1998 { 2002 1999 asection *current; … … 2018 2015 /* Get the contents of a section. */ 2019 2016 2020 b oolean2017 bfd_boolean 2021 2018 _bfd_ecoff_get_section_contents (abfd, section, location, offset, count) 2022 2019 bfd *abfd; … … 2062 2059 reloc_filepos. */ 2063 2060 2064 static b oolean2061 static bfd_boolean 2065 2062 ecoff_compute_section_file_positions (abfd) 2066 2063 bfd *abfd; … … 2071 2068 unsigned int i; 2072 2069 file_ptr old_sofar; 2073 b oolean rdata_in_text;2074 b oolean first_data, first_nonalloc;2070 bfd_boolean rdata_in_text; 2071 bfd_boolean first_data, first_nonalloc; 2075 2072 const bfd_vma round = ecoff_backend (abfd)->round; 2076 2077 sofar = _bfd_ecoff_sizeof_headers (abfd, false); 2073 bfd_size_type amt; 2074 2075 sofar = _bfd_ecoff_sizeof_headers (abfd, FALSE); 2078 2076 file_sofar = sofar; 2079 2077 2080 2078 /* Sort the sections by VMA. */ 2081 sorted_hdrs = (asection **) bfd_malloc (abfd->section_count 2082 * sizeof (asection *)); 2079 amt = abfd->section_count; 2080 amt *= sizeof (asection *); 2081 sorted_hdrs = (asection **) bfd_malloc (amt); 2083 2082 if (sorted_hdrs == NULL) 2084 return false;2083 return FALSE; 2085 2084 for (current = abfd->sections, i = 0; 2086 2085 current != NULL; … … 2106 2105 && strcmp (current->name, _RCONST) != 0) 2107 2106 { 2108 rdata_in_text = false;2107 rdata_in_text = FALSE; 2109 2108 break; 2110 2109 } … … 2113 2112 ecoff_data (abfd)->rdata_in_text = rdata_in_text; 2114 2113 2115 first_data = true;2116 first_nonalloc = true;2114 first_data = TRUE; 2115 first_nonalloc = TRUE; 2117 2116 for (i = 0; i < abfd->section_count; i++) 2118 2117 { … … 2147 2146 sofar = (sofar + round - 1) &~ (round - 1); 2148 2147 file_sofar = (file_sofar + round - 1) &~ (round - 1); 2149 first_data = false;2148 first_data = FALSE; 2150 2149 } 2151 2150 else if (strcmp (current->name, _LIB) == 0) … … 2165 2164 as the .comment section on the Alpha. This leaves room 2166 2165 for the .bss section. */ 2167 first_nonalloc = false;2166 first_nonalloc = FALSE; 2168 2167 sofar = (sofar + round - 1) &~ (round - 1); 2169 2168 file_sofar = (file_sofar + round - 1) &~ (round - 1); … … 2191 2190 file_sofar += current->_raw_size; 2192 2191 2193 /* make sure that this section is of the right size too*/2192 /* Make sure that this section is of the right size too. */ 2194 2193 old_sofar = sofar; 2195 2194 sofar = BFD_ALIGN (sofar, 1 << alignment_power); … … 2204 2203 ecoff_data (abfd)->reloc_filepos = file_sofar; 2205 2204 2206 return true;2205 return TRUE; 2207 2206 } 2208 2207 … … 2226 2225 if (! ecoff_compute_section_file_positions (abfd)) 2227 2226 abort (); 2228 abfd->output_has_begun = true;2227 abfd->output_has_begun = TRUE; 2229 2228 } 2230 2229 … … 2266 2265 /* Set the contents of a section. */ 2267 2266 2268 b oolean2267 bfd_boolean 2269 2268 _bfd_ecoff_set_section_contents (abfd, section, location, offset, count) 2270 2269 bfd *abfd; … … 2274 2273 bfd_size_type count; 2275 2274 { 2275 file_ptr pos; 2276 2276 2277 /* This must be done first, because bfd_set_section_contents is 2277 going to set output_has_begun to true. */2278 if ( abfd->output_has_begun == false)2278 going to set output_has_begun to TRUE. */ 2279 if (! abfd->output_has_begun) 2279 2280 { 2280 2281 if (! ecoff_compute_section_file_positions (abfd)) 2281 return false;2282 return FALSE; 2282 2283 } 2283 2284 … … 2300 2301 2301 2302 if (count == 0) 2302 return true; 2303 2304 if (bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) != 0 2305 || bfd_write (location, 1, count, abfd) != count) 2306 return false; 2307 2308 return true; 2303 return TRUE; 2304 2305 pos = section->filepos + offset; 2306 if (bfd_seek (abfd, pos, SEEK_SET) != 0 2307 || bfd_bwrite (location, count, abfd) != count) 2308 return FALSE; 2309 2310 return TRUE; 2309 2311 } 2310 2312 … … 2329 2331 assembler. */ 2330 2332 2331 b oolean2333 bfd_boolean 2332 2334 bfd_ecoff_set_gp_value (abfd, gp_value) 2333 2335 bfd *abfd; … … 2338 2340 { 2339 2341 bfd_set_error (bfd_error_invalid_operation); 2340 return false;2342 return FALSE; 2341 2343 } 2342 2344 2343 2345 ecoff_data (abfd)->gp = gp_value; 2344 2346 2345 return true;2347 return TRUE; 2346 2348 } 2347 2349 … … 2349 2351 the assembler. */ 2350 2352 2351 b oolean2353 bfd_boolean 2352 2354 bfd_ecoff_set_regmasks (abfd, gprmask, fprmask, cprmask) 2353 2355 bfd *abfd; … … 2362 2364 { 2363 2365 bfd_set_error (bfd_error_invalid_operation); 2364 return false;2366 return FALSE; 2365 2367 } 2366 2368 … … 2370 2372 if (cprmask != (unsigned long *) NULL) 2371 2373 { 2372 registerint i;2374 int i; 2373 2375 2374 2376 for (i = 0; i < 3; i++) … … 2376 2378 } 2377 2379 2378 return true;2380 return TRUE; 2379 2381 } 2380 2382 … … 2382 2384 is passed to bfd_ecoff_debug_externals. */ 2383 2385 2384 static b oolean2386 static bfd_boolean 2385 2387 ecoff_get_extr (sym, esym) 2386 2388 asymbol *sym; … … 2397 2399 || (sym->flags & BSF_LOCAL) != 0 2398 2400 || (sym->flags & BSF_SECTION_SYM) != 0) 2399 return false;2401 return FALSE; 2400 2402 2401 2403 esym->jmptbl = 0; … … 2409 2411 esym->asym.reserved = 0; 2410 2412 esym->asym.index = indexNil; 2411 return true;2413 return TRUE; 2412 2414 } 2413 2415 … … 2415 2417 2416 2418 if (ecoff_sym_ptr->local) 2417 return false;2419 return FALSE; 2418 2420 2419 2421 input_bfd = bfd_asymbol_bfd (sym); … … 2441 2443 } 2442 2444 2443 return true;2445 return TRUE; 2444 2446 } 2445 2447 … … 2457 2459 /* Write out an ECOFF file. */ 2458 2460 2459 b oolean2461 bfd_boolean 2460 2462 _bfd_ecoff_write_object_contents (abfd) 2461 2463 bfd *abfd; … … 2469 2471 = backend->debug_swap.external_hdr_size; 2470 2472 const bfd_size_type external_reloc_size = backend->external_reloc_size; 2471 void (* const adjust_reloc_out) PARAMS ((bfd *, 2472 const arelent *, 2473 struct internal_reloc *)) 2473 void (* const adjust_reloc_out) 2474 PARAMS ((bfd *, const arelent *, struct internal_reloc *)) 2474 2475 = backend->adjust_reloc_out; 2475 void (* const swap_reloc_out) PARAMS ((bfd *, 2476 const struct internal_reloc *, 2477 PTR)) 2476 void (* const swap_reloc_out) 2477 PARAMS ((bfd *, const struct internal_reloc *, PTR)) 2478 2478 = backend->swap_reloc_out; 2479 2479 struct ecoff_debug_info * const debug = &ecoff_data (abfd)->debug_info; … … 2484 2484 bfd_size_type text_size; 2485 2485 bfd_vma text_start; 2486 b oolean set_text_start;2486 bfd_boolean set_text_start; 2487 2487 bfd_size_type data_size; 2488 2488 bfd_vma data_start; 2489 b oolean set_data_start;2489 bfd_boolean set_data_start; 2490 2490 bfd_size_type bss_size; 2491 2491 PTR buff = NULL; … … 2509 2509 2510 2510 if ((abfd->flags & D_PAGED) != 0) 2511 text_size = _bfd_ecoff_sizeof_headers (abfd, false);2511 text_size = _bfd_ecoff_sizeof_headers (abfd, FALSE); 2512 2512 else 2513 2513 text_size = 0; 2514 2514 text_start = 0; 2515 set_text_start = false;2515 set_text_start = FALSE; 2516 2516 data_size = 0; 2517 2517 data_start = 0; 2518 set_data_start = false;2518 set_data_start = FALSE; 2519 2519 bss_size = 0; 2520 2520 … … 2530 2530 if (siz < aoutsz) 2531 2531 siz = aoutsz; 2532 buff = (PTR) bfd_malloc ( (size_t)siz);2532 buff = (PTR) bfd_malloc (siz); 2533 2533 if (buff == NULL) 2534 2534 goto error_return; … … 2590 2590 2591 2591 if (bfd_coff_swap_scnhdr_out (abfd, (PTR) §ion, buff) == 0 2592 || bfd_ write (buff, 1, scnhsz, abfd) != scnhsz)2592 || bfd_bwrite (buff, scnhsz, abfd) != scnhsz) 2593 2593 goto error_return; 2594 2594 … … 2612 2612 { 2613 2613 text_start = vma; 2614 set_text_start = true;2614 set_text_start = TRUE; 2615 2615 } 2616 2616 } … … 2628 2628 { 2629 2629 data_start = vma; 2630 set_data_start = true;2630 set_data_start = TRUE; 2631 2631 } 2632 2632 } … … 2637 2637 || (section.s_flags & STYP_ECOFF_LIB) != 0 2638 2638 || section.s_flags == STYP_COMMENT) 2639 /* Do nothing */ ;2639 /* Do nothing. */ ; 2640 2640 else 2641 2641 abort (); … … 2643 2643 2644 2644 /* Set up the file header. */ 2645 2646 2645 internal_f.f_magic = ecoff_get_magic (abfd); 2647 2646 … … 2736 2735 2737 2736 /* Write out the file header and the optional header. */ 2738 2739 2737 if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) 2740 2738 goto error_return; 2741 2739 2742 2740 bfd_coff_swap_filehdr_out (abfd, (PTR) &internal_f, buff); 2743 if (bfd_ write (buff, 1, filhsz, abfd) != filhsz)2741 if (bfd_bwrite (buff, filhsz, abfd) != filhsz) 2744 2742 goto error_return; 2745 2743 2746 2744 bfd_coff_swap_aouthdr_out (abfd, (PTR) &internal_a, buff); 2747 if (bfd_ write (buff, 1, aoutsz, abfd) != aoutsz)2745 if (bfd_bwrite (buff, aoutsz, abfd) != aoutsz) 2748 2746 goto error_return; 2749 2747 … … 2758 2756 debug->external_ext = debug->external_ext_end = NULL; 2759 2757 debug->ssext = debug->ssext_end = NULL; 2760 if (bfd_ecoff_debug_externals (abfd, debug, &backend->debug_swap, 2761 (((abfd->flags & EXEC_P) == 0) 2762 ? true : false), 2763 ecoff_get_extr, ecoff_set_index) 2764 == false) 2758 if (! bfd_ecoff_debug_externals (abfd, debug, &backend->debug_swap, 2759 (abfd->flags & EXEC_P) == 0, 2760 ecoff_get_extr, ecoff_set_index)) 2765 2761 goto error_return; 2766 2762 … … 2773 2769 arelent **reloc_end; 2774 2770 char *out_ptr; 2771 bfd_size_type amt; 2775 2772 2776 2773 if (current->reloc_count == 0) 2777 2774 continue; 2778 2775 2779 reloc_buff =2780 bfd_alloc (abfd, current->reloc_count * external_reloc_size);2776 amt = current->reloc_count * external_reloc_size; 2777 reloc_buff = bfd_alloc (abfd, amt); 2781 2778 if (reloc_buff == NULL) 2782 2779 goto error_return; … … 2809 2806 else 2810 2807 { 2811 CONSTchar *name;2808 const char *name; 2812 2809 2813 2810 name = bfd_get_section_name (abfd, bfd_get_section (sym)); … … 2854 2851 if (bfd_seek (abfd, current->rel_filepos, SEEK_SET) != 0) 2855 2852 goto error_return; 2856 if (bfd_write (reloc_buff, 2857 external_reloc_size, current->reloc_count, abfd) 2858 != external_reloc_size * current->reloc_count) 2853 amt = current->reloc_count * external_reloc_size; 2854 if (bfd_bwrite (reloc_buff, amt, abfd) != amt) 2859 2855 goto error_return; 2860 2856 bfd_release (abfd, reloc_buff); … … 2866 2862 { 2867 2863 /* Write out the debugging information. */ 2868 if (bfd_ecoff_write_debug (abfd, debug, &backend->debug_swap, 2869 ecoff_data (abfd)->sym_filepos) 2870 == false) 2864 if (! bfd_ecoff_write_debug (abfd, debug, &backend->debug_swap, 2865 ecoff_data (abfd)->sym_filepos)) 2871 2866 goto error_return; 2872 2867 } … … 2886 2881 SEEK_SET) != 0) 2887 2882 goto error_return; 2888 if (bfd_ read (&c, 1,1, abfd) == 0)2883 if (bfd_bread (&c, (bfd_size_type) 1, abfd) == 0) 2889 2884 c = 0; 2890 2885 if (bfd_seek (abfd, (file_ptr) ecoff_data (abfd)->sym_filepos - 1, 2891 2886 SEEK_SET) != 0) 2892 2887 goto error_return; 2893 if (bfd_ write (&c, 1,1, abfd) != 1)2888 if (bfd_bwrite (&c, (bfd_size_type) 1, abfd) != 1) 2894 2889 goto error_return; 2895 2890 } … … 2899 2894 if (buff != NULL) 2900 2895 free (buff); 2901 return true;2896 return TRUE; 2902 2897 error_return: 2903 2898 if (reloc_buff != NULL) … … 2905 2900 if (buff != NULL) 2906 2901 free (buff); 2907 return false;2902 return FALSE; 2908 2903 } 2909 2904 … … 2960 2955 static unsigned int 2961 2956 ecoff_armap_hash (s, rehash, size, hlog) 2962 CONSTchar *s;2957 const char *s; 2963 2958 unsigned int *rehash; 2964 2959 unsigned int size; … … 2979 2974 /* Read in the armap. */ 2980 2975 2981 b oolean2976 bfd_boolean 2982 2977 _bfd_ecoff_slurp_armap (abfd) 2983 2978 bfd *abfd; … … 2993 2988 struct symdef *symdef_ptr; 2994 2989 char *stringbase; 2990 bfd_size_type amt; 2995 2991 2996 2992 /* Get the name of the first element. */ 2997 i = bfd_ read ((PTR) nextname, 1,16, abfd);2993 i = bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd); 2998 2994 if (i == 0) 2999 return true;2995 return TRUE; 3000 2996 if (i != 16) 3001 return false;2997 return FALSE; 3002 2998 3003 2999 if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0) 3004 return false;3000 return FALSE; 3005 3001 3006 3002 /* Irix 4.0.5F apparently can use either an ECOFF armap or a … … 3024 3020 ARMAP_END, sizeof ARMAP_END - 1) != 0) 3025 3021 { 3026 bfd_has_map (abfd) = false;3027 return true;3022 bfd_has_map (abfd) = FALSE; 3023 return TRUE; 3028 3024 } 3029 3025 … … 3035 3031 { 3036 3032 bfd_set_error (bfd_error_wrong_format); 3037 return false;3033 return FALSE; 3038 3034 } 3039 3035 … … 3042 3038 mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd); 3043 3039 if (mapdata == (struct areltdata *) NULL) 3044 return false;3040 return FALSE; 3045 3041 parsed_size = mapdata->parsed_size; 3046 3042 bfd_release (abfd, (PTR) mapdata); … … 3048 3044 raw_armap = (char *) bfd_alloc (abfd, parsed_size); 3049 3045 if (raw_armap == (char *) NULL) 3050 return false;3051 3052 if (bfd_ read ((PTR) raw_armap, 1, parsed_size, abfd) != parsed_size)3046 return FALSE; 3047 3048 if (bfd_bread ((PTR) raw_armap, parsed_size, abfd) != parsed_size) 3053 3049 { 3054 3050 if (bfd_get_error () != bfd_error_system_call) 3055 3051 bfd_set_error (bfd_error_malformed_archive); 3056 3052 bfd_release (abfd, (PTR) raw_armap); 3057 return false;3053 return FALSE; 3058 3054 } 3059 3055 3060 3056 ardata->tdata = (PTR) raw_armap; 3061 3057 3062 count = bfd_h_get_32 (abfd, (PTR)raw_armap);3058 count = H_GET_32 (abfd, raw_armap); 3063 3059 3064 3060 ardata->symdef_count = 0; … … 3067 3063 /* This code used to overlay the symdefs over the raw archive data, 3068 3064 but that doesn't work on a 64 bit host. */ 3069 3070 3065 stringbase = raw_armap + count * 8 + 8; 3071 3066 … … 3087 3082 unsigned int hash, rehash, srch; 3088 3083 3089 name_offset = bfd_h_get_32 (abfd, (PTR)raw_ptr);3090 file_offset = bfd_h_get_32 (abfd, (PTR)(raw_ptr + 4));3084 name_offset = H_GET_32 (abfd, raw_ptr); 3085 file_offset = H_GET_32 (abfd, (raw_ptr + 4)); 3091 3086 if (file_offset == 0) 3092 3087 continue; … … 3100 3095 srch != hash && srch != i; 3101 3096 srch = (srch + rehash) & (count - 1)) 3102 BFD_ASSERT (bfd_h_get_32 (abfd, (PTR) (raw_armap + 8 + srch * 8)) 3103 != 0); 3097 BFD_ASSERT (H_GET_32 (abfd, (raw_armap + 8 + srch * 8)) != 0); 3104 3098 BFD_ASSERT (srch == i); 3105 3099 } … … 3110 3104 raw_ptr = raw_armap + 4; 3111 3105 for (i = 0; i < count; i++, raw_ptr += 8) 3112 if ( bfd_h_get_32 (abfd, (PTR)(raw_ptr + 4)) != 0)3106 if (H_GET_32 (abfd, (raw_ptr + 4)) != 0) 3113 3107 ++ardata->symdef_count; 3114 3108 3115 symdef_ptr = ((struct symdef *)3116 bfd_alloc (abfd, 3117 ardata->symdef_count * sizeof (struct symdef)));3109 amt = ardata->symdef_count; 3110 amt *= sizeof (struct symdef); 3111 symdef_ptr = (struct symdef *) bfd_alloc (abfd, amt); 3118 3112 if (!symdef_ptr) 3119 return false;3113 return FALSE; 3120 3114 3121 3115 ardata->symdefs = (carsym *) symdef_ptr; … … 3126 3120 unsigned int name_offset, file_offset; 3127 3121 3128 file_offset = bfd_h_get_32 (abfd, (PTR)(raw_ptr + 4));3122 file_offset = H_GET_32 (abfd, (raw_ptr + 4)); 3129 3123 if (file_offset == 0) 3130 3124 continue; 3131 name_offset = bfd_h_get_32 (abfd, (PTR)raw_ptr);3125 name_offset = H_GET_32 (abfd, raw_ptr); 3132 3126 symdef_ptr->s.name = stringbase + name_offset; 3133 3127 symdef_ptr->file_offset = file_offset; … … 3139 3133 ardata->first_file_filepos += ardata->first_file_filepos % 2; 3140 3134 3141 bfd_has_map (abfd) = true;3142 3143 return true;3135 bfd_has_map (abfd) = TRUE; 3136 3137 return TRUE; 3144 3138 } 3145 3139 3146 3140 /* Write out an armap. */ 3147 3141 3148 b oolean3142 bfd_boolean 3149 3143 _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx) 3150 3144 bfd *abfd; … … 3155 3149 { 3156 3150 unsigned int hashsize, hashlog; 3157 unsigned intsymdefsize;3151 bfd_size_type symdefsize; 3158 3152 int padit; 3159 3153 unsigned int stringsize; … … 3228 3222 (((char *) (&hdr))[i]) = ' '; 3229 3223 3230 if (bfd_ write ((PTR) &hdr, 1,sizeof (struct ar_hdr), abfd)3224 if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), abfd) 3231 3225 != sizeof (struct ar_hdr)) 3232 return false;3233 3234 bfd_h_put_32 (abfd, (bfd_vma)hashsize, temp);3235 if (bfd_ write ((PTR) temp, 1,4, abfd) != 4)3236 return false;3226 return FALSE; 3227 3228 H_PUT_32 (abfd, hashsize, temp); 3229 if (bfd_bwrite ((PTR) temp, (bfd_size_type) 4, abfd) != 4) 3230 return FALSE; 3237 3231 3238 3232 hashtable = (bfd_byte *) bfd_zalloc (abfd, symdefsize); 3239 3233 if (!hashtable) 3240 return false;3234 return FALSE; 3241 3235 3242 3236 current = abfd->archive_head; … … 3248 3242 /* Advance firstreal to the file position of this archive 3249 3243 element. */ 3250 if ( ((bfd *) map[i].pos)!= last_elt)3244 if (map[i].u.abfd != last_elt) 3251 3245 { 3252 3246 do … … 3256 3250 current = current->next; 3257 3251 } 3258 while (current != (bfd *) map[i].pos);3252 while (current != map[i].u.abfd); 3259 3253 } 3260 3254 … … 3262 3256 3263 3257 hash = ecoff_armap_hash (*map[i].name, &rehash, hashsize, hashlog); 3264 if ( bfd_h_get_32 (abfd, (PTR)(hashtable + (hash * 8) + 4)) != 0)3258 if (H_GET_32 (abfd, (hashtable + (hash * 8) + 4)) != 0) 3265 3259 { 3266 3260 unsigned int srch; … … 3270 3264 srch != hash; 3271 3265 srch = (srch + rehash) & (hashsize - 1)) 3272 if ( bfd_h_get_32 (abfd, (PTR)(hashtable + (srch * 8) + 4)) == 0)3266 if (H_GET_32 (abfd, (hashtable + (srch * 8) + 4)) == 0) 3273 3267 break; 3274 3268 … … 3278 3272 } 3279 3273 3280 bfd_h_put_32 (abfd, (bfd_vma) map[i].namidx, 3281 (PTR) (hashtable + hash * 8)); 3282 bfd_h_put_32 (abfd, (bfd_vma) firstreal, 3283 (PTR) (hashtable + hash * 8 + 4)); 3284 } 3285 3286 if (bfd_write ((PTR) hashtable, 1, symdefsize, abfd) != symdefsize) 3287 return false; 3274 H_PUT_32 (abfd, map[i].namidx, (hashtable + hash * 8)); 3275 H_PUT_32 (abfd, firstreal, (hashtable + hash * 8 + 4)); 3276 } 3277 3278 if (bfd_bwrite ((PTR) hashtable, symdefsize, abfd) != symdefsize) 3279 return FALSE; 3288 3280 3289 3281 bfd_release (abfd, hashtable); 3290 3282 3291 3283 /* Now write the strings. */ 3292 bfd_h_put_32 (abfd, (bfd_vma)stringsize, temp);3293 if (bfd_ write ((PTR) temp, 1,4, abfd) != 4)3294 return false;3284 H_PUT_32 (abfd, stringsize, temp); 3285 if (bfd_bwrite ((PTR) temp, (bfd_size_type) 4, abfd) != 4) 3286 return FALSE; 3295 3287 for (i = 0; i < orl_count; i++) 3296 3288 { … … 3298 3290 3299 3291 len = strlen (*map[i].name) + 1; 3300 if (bfd_ write ((PTR) (*map[i].name), 1, len, abfd) != len)3301 return false;3292 if (bfd_bwrite ((PTR) (*map[i].name), len, abfd) != len) 3293 return FALSE; 3302 3294 } 3303 3295 … … 3306 3298 if (padit) 3307 3299 { 3308 if (bfd_ write ("", 1,1, abfd) != 1)3309 return false;3310 } 3311 3312 return true;3300 if (bfd_bwrite ("", (bfd_size_type) 1, abfd) != 1) 3301 return FALSE; 3302 } 3303 3304 return TRUE; 3313 3305 } 3314 3306 … … 3322 3314 struct artdata *tdata_hold; 3323 3315 char armag[SARMAG + 1]; 3324 3325 tdata_hold = abfd->tdata.aout_ar_data; 3326 3327 if (bfd_read ((PTR) armag, 1, SARMAG, abfd) != SARMAG) 3316 bfd_size_type amt; 3317 3318 if (bfd_bread ((PTR) armag, (bfd_size_type) SARMAG, abfd) != SARMAG) 3328 3319 { 3329 3320 if (bfd_get_error () != bfd_error_system_call) … … 3338 3329 } 3339 3330 3340 /* We are setting bfd_ardata(abfd) here, but since bfd_ardata 3341 involves a cast, we can't do it as the left operand of 3342 assignment. */ 3343 abfd->tdata.aout_ar_data = 3344 (struct artdata *) bfd_zalloc (abfd, sizeof (struct artdata)); 3345 3331 tdata_hold = bfd_ardata (abfd); 3332 3333 amt = sizeof (struct artdata); 3334 bfd_ardata (abfd) = (struct artdata *) bfd_zalloc (abfd, amt); 3346 3335 if (bfd_ardata (abfd) == (struct artdata *) NULL) 3347 3336 { 3348 abfd->tdata.aout_ar_data= tdata_hold;3337 bfd_ardata (abfd) = tdata_hold; 3349 3338 return (const bfd_target *) NULL; 3350 3339 } … … 3357 3346 bfd_ardata (abfd)->tdata = NULL; 3358 3347 3359 if ( _bfd_ecoff_slurp_armap (abfd) == false3360 || _bfd_ecoff_slurp_extended_name_table (abfd) == false)3348 if (! _bfd_ecoff_slurp_armap (abfd) 3349 || ! _bfd_ecoff_slurp_extended_name_table (abfd)) 3361 3350 { 3362 3351 bfd_release (abfd, bfd_ardata (abfd)); 3363 abfd->tdata.aout_ar_data= tdata_hold;3352 bfd_ardata (abfd) = tdata_hold; 3364 3353 return (const bfd_target *) NULL; 3365 3354 } … … 3379 3368 if (first != NULL) 3380 3369 { 3381 boolean fail; 3382 3383 first->target_defaulted = false; 3384 fail = false; 3370 first->target_defaulted = FALSE; 3385 3371 if (bfd_check_format (first, bfd_object) 3386 3372 && first->xvec != abfd->xvec) 3387 3373 { 3374 #if 0 3375 /* We ought to close `first' here, but we can't, because 3376 we have no way to remove it from the archive cache. 3377 It's close to impossible to figure out when we can 3378 release bfd_ardata. FIXME. */ 3388 3379 (void) bfd_close (first); 3389 3380 bfd_release (abfd, bfd_ardata (abfd)); 3390 abfd->tdata.aout_ar_data = tdata_hold; 3391 bfd_set_error (bfd_error_wrong_format); 3381 #endif 3382 bfd_set_error (bfd_error_wrong_object_format); 3383 bfd_ardata (abfd) = tdata_hold; 3392 3384 return NULL; 3393 3385 } 3394 3395 /* We ought to close first here, but we can't, because we 3396 have no way to remove it from the archive cache. FIXME. */ 3386 /* And we ought to close `first' here too. */ 3397 3387 } 3398 3388 } … … 3408 3398 struct bfd_hash_table *table, 3409 3399 const char *string)); 3410 static b oolean ecoff_link_add_archive_symbols3400 static bfd_boolean ecoff_link_add_archive_symbols 3411 3401 PARAMS ((bfd *, struct bfd_link_info *)); 3412 static b oolean ecoff_link_check_archive_element3413 PARAMS ((bfd *, struct bfd_link_info *, b oolean *pneeded));3414 static b oolean ecoff_link_add_object_symbols3402 static bfd_boolean ecoff_link_check_archive_element 3403 PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *pneeded)); 3404 static bfd_boolean ecoff_link_add_object_symbols 3415 3405 PARAMS ((bfd *, struct bfd_link_info *)); 3416 static b oolean ecoff_link_add_externals3406 static bfd_boolean ecoff_link_add_externals 3417 3407 PARAMS ((bfd *, struct bfd_link_info *, PTR, char *)); 3418 3408 … … 3460 3450 { 3461 3451 struct ecoff_link_hash_table *ret; 3462 3463 ret = ((struct ecoff_link_hash_table *) 3464 bfd_alloc (abfd, sizeof (struct ecoff_link_hash_table)));3452 bfd_size_type amt = sizeof (struct ecoff_link_hash_table); 3453 3454 ret = (struct ecoff_link_hash_table *) bfd_malloc (amt); 3465 3455 if (ret == NULL) 3466 3456 return NULL; … … 3485 3475 (bfd_link_hash_traverse \ 3486 3476 (&(table)->root, \ 3487 (b oolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func),\3477 (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \ 3488 3478 (info))) 3489 3479 … … 3496 3486 appropriate. */ 3497 3487 3498 b oolean3488 bfd_boolean 3499 3489 _bfd_ecoff_bfd_link_add_symbols (abfd, info) 3500 3490 bfd *abfd; … … 3509 3499 default: 3510 3500 bfd_set_error (bfd_error_wrong_format); 3511 return false;3501 return FALSE; 3512 3502 } 3513 3503 } … … 3520 3510 another one. */ 3521 3511 3522 static b oolean3512 static bfd_boolean 3523 3513 ecoff_link_add_archive_symbols (abfd, info) 3524 3514 bfd *abfd; … … 3538 3528 /* An empty archive is a special case. */ 3539 3529 if (bfd_openr_next_archived_file (abfd, (bfd *) NULL) == NULL) 3540 return true;3530 return TRUE; 3541 3531 bfd_set_error (bfd_error_no_armap); 3542 return false;3532 return FALSE; 3543 3533 } 3544 3534 … … 3552 3542 (abfd, info, ecoff_link_check_archive_element)); 3553 3543 3554 armap_count = bfd_h_get_32 (abfd, raw_armap);3544 armap_count = H_GET_32 (abfd, raw_armap); 3555 3545 3556 3546 armap_log = 0; … … 3605 3595 armap_log); 3606 3596 3607 file_offset = bfd_h_get_32 (abfd, hashtable + (hash * 8) + 4);3597 file_offset = H_GET_32 (abfd, hashtable + (hash * 8) + 4); 3608 3598 if (file_offset == 0) 3609 3599 { … … 3613 3603 } 3614 3604 3615 name = stringbase + bfd_h_get_32 (abfd, hashtable + (hash * 8));3605 name = stringbase + H_GET_32 (abfd, hashtable + (hash * 8)); 3616 3606 if (name[0] != h->root.string[0] 3617 3607 || strcmp (name, h->root.string) != 0) 3618 3608 { 3619 3609 unsigned int srch; 3620 b oolean found;3610 bfd_boolean found; 3621 3611 3622 3612 /* That was the wrong symbol. Try rehashing. */ 3623 found = false;3613 found = FALSE; 3624 3614 for (srch = (hash + rehash) & (armap_count - 1); 3625 3615 srch != hash; 3626 3616 srch = (srch + rehash) & (armap_count - 1)) 3627 3617 { 3628 file_offset = bfd_h_get_32 (abfd, hashtable + (srch * 8) + 4);3618 file_offset = H_GET_32 (abfd, hashtable + (srch * 8) + 4); 3629 3619 if (file_offset == 0) 3630 3620 break; 3631 name = stringbase + bfd_h_get_32 (abfd, hashtable + (srch * 8));3621 name = stringbase + H_GET_32 (abfd, hashtable + (srch * 8)); 3632 3622 if (name[0] == h->root.string[0] 3633 3623 && strcmp (name, h->root.string) == 0) 3634 3624 { 3635 found = true;3625 found = TRUE; 3636 3626 break; 3637 3627 } … … 3647 3637 } 3648 3638 3649 element = (*backend->get_elt_at_filepos) (abfd, file_offset);3639 element = (*backend->get_elt_at_filepos) (abfd, (file_ptr) file_offset); 3650 3640 if (element == (bfd *) NULL) 3651 return false;3641 return FALSE; 3652 3642 3653 3643 if (! bfd_check_format (element, bfd_object)) 3654 return false;3644 return FALSE; 3655 3645 3656 3646 /* Unlike the generic linker, we know that this element provides … … 3658 3648 to include it. We don't need to check anything. */ 3659 3649 if (! (*info->callbacks->add_archive_element) (info, element, name)) 3660 return false;3650 return FALSE; 3661 3651 if (! ecoff_link_add_object_symbols (element, info)) 3662 return false;3652 return FALSE; 3663 3653 3664 3654 pundef = &(*pundef)->next; 3665 3655 } 3666 3656 3667 return true;3657 return TRUE; 3668 3658 } 3669 3659 … … 3671 3661 because we were not dealing with an ECOFF archive. */ 3672 3662 3673 static b oolean3663 static bfd_boolean 3674 3664 ecoff_link_check_archive_element (abfd, info, pneeded) 3675 3665 bfd *abfd; 3676 3666 struct bfd_link_info *info; 3677 b oolean *pneeded;3667 bfd_boolean *pneeded; 3678 3668 { 3679 3669 const struct ecoff_backend_data * const backend = ecoff_backend (abfd); … … 3683 3673 bfd_size_type external_ext_size; 3684 3674 PTR external_ext = NULL; 3685 size_tesize;3675 bfd_size_type esize; 3686 3676 char *ssext = NULL; 3687 3677 char *ext_ptr; 3688 3678 char *ext_end; 3689 3679 3690 *pneeded = false;3680 *pneeded = FALSE; 3691 3681 3692 3682 if (! ecoff_slurp_symbolic_header (abfd)) … … 3706 3696 goto error_return; 3707 3697 3708 if (bfd_seek (abfd, symhdr->cbExtOffset, SEEK_SET) != 03709 || bfd_ read (external_ext, 1, esize, abfd) != esize)3698 if (bfd_seek (abfd, (file_ptr) symhdr->cbExtOffset, SEEK_SET) != 0 3699 || bfd_bread (external_ext, esize, abfd) != esize) 3710 3700 goto error_return; 3711 3701 3712 ssext = (char *) bfd_malloc ( symhdr->issExtMax);3702 ssext = (char *) bfd_malloc ((bfd_size_type) symhdr->issExtMax); 3713 3703 if (ssext == NULL && symhdr->issExtMax != 0) 3714 3704 goto error_return; 3715 3705 3716 if (bfd_seek (abfd, symhdr->cbSsExtOffset, SEEK_SET) != 03717 || (bfd_ read (ssext, 1, symhdr->issExtMax, abfd) !=3718 (bfd_size_type) symhdr->issExtMax))3706 if (bfd_seek (abfd, (file_ptr) symhdr->cbSsExtOffset, SEEK_SET) != 0 3707 || (bfd_bread (ssext, (bfd_size_type) symhdr->issExtMax, abfd) 3708 != (bfd_size_type) symhdr->issExtMax)) 3719 3709 goto error_return; 3720 3710 … … 3726 3716 { 3727 3717 EXTR esym; 3728 b oolean def;3718 bfd_boolean def; 3729 3719 const char *name; 3730 3720 struct bfd_link_hash_entry *h; … … 3752 3742 case scFini: 3753 3743 case scRConst: 3754 def = true;3744 def = TRUE; 3755 3745 break; 3756 3746 default: 3757 def = false;3747 def = FALSE; 3758 3748 break; 3759 3749 } … … 3763 3753 3764 3754 name = ssext + esym.asym.iss; 3765 h = bfd_link_hash_lookup (info->hash, name, false, false, true);3755 h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE); 3766 3756 3767 3757 /* Unlike the generic linker, we do not pull in elements because … … 3777 3767 goto error_return; 3778 3768 3779 *pneeded = true;3769 *pneeded = TRUE; 3780 3770 goto successful_return; 3781 3771 } … … 3786 3776 if (ssext != NULL) 3787 3777 free (ssext); 3788 return true;3778 return TRUE; 3789 3779 error_return: 3790 3780 if (external_ext != NULL) … … 3792 3782 if (ssext != NULL) 3793 3783 free (ssext); 3794 return false;3784 return FALSE; 3795 3785 } 3796 3786 … … 3798 3788 table. */ 3799 3789 3800 static b oolean3790 static bfd_boolean 3801 3791 ecoff_link_add_object_symbols (abfd, info) 3802 3792 bfd *abfd; … … 3806 3796 bfd_size_type external_ext_size; 3807 3797 PTR external_ext = NULL; 3808 size_tesize;3798 bfd_size_type esize; 3809 3799 char *ssext = NULL; 3810 b oolean result;3800 bfd_boolean result; 3811 3801 3812 3802 if (! ecoff_slurp_symbolic_header (abfd)) 3813 return false;3803 return FALSE; 3814 3804 3815 3805 /* If there are no symbols, we don't want it. */ 3816 3806 if (bfd_get_symcount (abfd) == 0) 3817 return true;3807 return TRUE; 3818 3808 3819 3809 symhdr = &ecoff_data (abfd)->debug_info.symbolic_header; … … 3826 3816 goto error_return; 3827 3817 3828 if (bfd_seek (abfd, symhdr->cbExtOffset, SEEK_SET) != 03829 || bfd_ read (external_ext, 1, esize, abfd) != esize)3818 if (bfd_seek (abfd, (file_ptr) symhdr->cbExtOffset, SEEK_SET) != 0 3819 || bfd_bread (external_ext, esize, abfd) != esize) 3830 3820 goto error_return; 3831 3821 3832 ssext = (char *) bfd_malloc ( symhdr->issExtMax);3822 ssext = (char *) bfd_malloc ((bfd_size_type) symhdr->issExtMax); 3833 3823 if (ssext == NULL && symhdr->issExtMax != 0) 3834 3824 goto error_return; 3835 3825 3836 if (bfd_seek (abfd, symhdr->cbSsExtOffset, SEEK_SET) != 03837 || (bfd_ read (ssext, 1,symhdr->issExtMax, abfd)3826 if (bfd_seek (abfd, (file_ptr) symhdr->cbSsExtOffset, SEEK_SET) != 0 3827 || (bfd_bread (ssext, (bfd_size_type) symhdr->issExtMax, abfd) 3838 3828 != (bfd_size_type) symhdr->issExtMax)) 3839 3829 goto error_return; … … 3852 3842 if (external_ext != NULL) 3853 3843 free (external_ext); 3854 return false;3844 return FALSE; 3855 3845 } 3856 3846 … … 3861 3851 We do not want to read the external symbol information again. */ 3862 3852 3863 static b oolean3853 static bfd_boolean 3864 3854 ecoff_link_add_externals (abfd, info, external_ext, ssext) 3865 3855 bfd *abfd; … … 3873 3863 bfd_size_type external_ext_size = backend->debug_swap.external_ext_size; 3874 3864 unsigned long ext_count; 3875 struct ecoff_link_hash_entry **sym_hash;3865 struct bfd_link_hash_entry **sym_hash; 3876 3866 char *ext_ptr; 3877 3867 char *ext_end; 3868 bfd_size_type amt; 3878 3869 3879 3870 ext_count = ecoff_data (abfd)->debug_info.symbolic_header.iextMax; 3880 3871 3881 sym_hash = ((struct ecoff_link_hash_entry **)3882 bfd_alloc (abfd, 3883 ext_count * sizeof (struct bfd_link_hash_entry *)));3872 amt = ext_count; 3873 amt *= sizeof (struct bfd_link_hash_entry *); 3874 sym_hash = (struct bfd_link_hash_entry **) bfd_alloc (abfd, amt); 3884 3875 if (!sym_hash) 3885 return false;3886 ecoff_data (abfd)->sym_hashes = sym_hash;3876 return FALSE; 3877 ecoff_data (abfd)->sym_hashes = (struct ecoff_link_hash_entry **) sym_hash; 3887 3878 3888 3879 ext_ptr = (char *) external_ext; … … 3891 3882 { 3892 3883 EXTR esym; 3893 b oolean skip;3884 bfd_boolean skip; 3894 3885 bfd_vma value; 3895 3886 asection *section; … … 3902 3893 3903 3894 /* Skip debugging symbols. */ 3904 skip = false;3895 skip = FALSE; 3905 3896 switch (esym.asym.st) 3906 3897 { … … 3912 3903 break; 3913 3904 default: 3914 skip = true;3905 skip = TRUE; 3915 3906 break; 3916 3907 } … … 4015 4006 name = ssext + esym.asym.iss; 4016 4007 4017 h = NULL;4018 4008 if (! (_bfd_generic_link_add_one_symbol 4019 4009 (info, abfd, name, 4020 esym.weakext ? BSF_WEAK : BSF_GLOBAL, 4021 section, value, (const char *) NULL, true, true, 4022 (struct bfd_link_hash_entry **) &h))) 4023 return false; 4024 4025 *sym_hash = h; 4010 (flagword) (esym.weakext ? BSF_WEAK : BSF_GLOBAL), 4011 section, value, (const char *) NULL, TRUE, TRUE, sym_hash))) 4012 return FALSE; 4013 4014 h = (struct ecoff_link_hash_entry *) *sym_hash; 4026 4015 4027 4016 /* If we are building an ECOFF hash table, save the external … … 4061 4050 } 4062 4051 4063 return true;4052 return TRUE; 4064 4053 } 4065 4054 … … 4067 4056 /* ECOFF final link routines. */ 4068 4057 4069 static b oolean ecoff_final_link_debug_accumulate4058 static bfd_boolean ecoff_final_link_debug_accumulate 4070 4059 PARAMS ((bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *, 4071 4060 PTR handle)); 4072 static b oolean ecoff_link_write_external4061 static bfd_boolean ecoff_link_write_external 4073 4062 PARAMS ((struct ecoff_link_hash_entry *, PTR)); 4074 static b oolean ecoff_indirect_link_order4063 static bfd_boolean ecoff_indirect_link_order 4075 4064 PARAMS ((bfd *, struct bfd_link_info *, asection *, 4076 4065 struct bfd_link_order *)); 4077 static b oolean ecoff_reloc_link_order4066 static bfd_boolean ecoff_reloc_link_order 4078 4067 PARAMS ((bfd *, struct bfd_link_info *, asection *, 4079 4068 struct bfd_link_order *)); … … 4092 4081 close and reopen some input BFDs; I'll see how bad this is. */ 4093 4082 4094 b oolean4083 bfd_boolean 4095 4084 _bfd_ecoff_bfd_final_link (abfd, info) 4096 4085 bfd *abfd; … … 4139 4128 handle = bfd_ecoff_debug_init (abfd, debug, &backend->debug_swap, info); 4140 4129 if (handle == (PTR) NULL) 4141 return false;4130 return FALSE; 4142 4131 4143 4132 /* Accumulate the debugging symbols from each input BFD. */ … … 4146 4135 input_bfd = input_bfd->link_next) 4147 4136 { 4148 b oolean ret;4137 bfd_boolean ret; 4149 4138 4150 4139 if (bfd_get_flavour (input_bfd) == bfd_target_ecoff_flavour) … … 4163 4152 input_bfd, info); 4164 4153 if (! ret) 4165 return false;4154 return FALSE; 4166 4155 4167 4156 /* Combine the register masks. */ … … 4207 4196 &backend->debug_swap, info, 4208 4197 ecoff_data (abfd)->sym_filepos)) 4209 return false;4198 return FALSE; 4210 4199 4211 4200 bfd_ecoff_debug_free (handle, abfd, debug, &backend->debug_swap, info); … … 4225 4214 struct bfd_link_hash_entry *h; 4226 4215 4227 h = bfd_link_hash_lookup (info->hash, "_gp", false, false, true);4216 h = bfd_link_hash_lookup (info->hash, "_gp", FALSE, FALSE, TRUE); 4228 4217 if (h != (struct bfd_link_hash_entry *) NULL 4229 4218 && h->type == bfd_link_hash_defined) … … 4268 4257 { 4269 4258 if (! ecoff_indirect_link_order (abfd, info, o, p)) 4270 return false;4259 return FALSE; 4271 4260 } 4272 4261 else if (p->type == bfd_section_reloc_link_order … … 4274 4263 { 4275 4264 if (! ecoff_reloc_link_order (abfd, info, o, p)) 4276 return false;4265 return FALSE; 4277 4266 } 4278 4267 else 4279 4268 { 4280 4269 if (! _bfd_default_link_order (abfd, info, o, p)) 4281 return false;4270 return FALSE; 4282 4271 } 4283 4272 } … … 4286 4275 bfd_get_symcount (abfd) = symhdr->iextMax + symhdr->isymMax; 4287 4276 4288 ecoff_data (abfd)->linker = true;4289 4290 return true;4277 ecoff_data (abfd)->linker = TRUE; 4278 4279 return TRUE; 4291 4280 } 4292 4281 … … 4295 4284 input BFD. */ 4296 4285 4297 static b oolean4286 static bfd_boolean 4298 4287 ecoff_final_link_debug_accumulate (output_bfd, input_bfd, info, handle) 4299 4288 bfd *output_bfd; … … 4306 4295 &ecoff_backend (input_bfd)->debug_swap; 4307 4296 HDRR *symhdr = &debug->symbolic_header; 4308 boolean ret; 4309 4310 #define READ(ptr, offset, count, size, type) \ 4311 if (symhdr->count == 0) \ 4312 debug->ptr = NULL; \ 4313 else \ 4314 { \ 4315 debug->ptr = (type) bfd_malloc ((size_t) (size * symhdr->count)); \ 4316 if (debug->ptr == NULL) \ 4317 { \ 4318 ret = false; \ 4319 goto return_something; \ 4320 } \ 4321 if ((bfd_seek (input_bfd, (file_ptr) symhdr->offset, SEEK_SET) \ 4322 != 0) \ 4323 || (bfd_read (debug->ptr, size, symhdr->count, \ 4324 input_bfd) != size * symhdr->count)) \ 4325 { \ 4326 ret = false; \ 4327 goto return_something; \ 4328 } \ 4297 bfd_boolean ret; 4298 4299 #define READ(ptr, offset, count, size, type) \ 4300 if (symhdr->count == 0) \ 4301 debug->ptr = NULL; \ 4302 else \ 4303 { \ 4304 bfd_size_type amt = (bfd_size_type) size * symhdr->count; \ 4305 debug->ptr = (type) bfd_malloc (amt); \ 4306 if (debug->ptr == NULL) \ 4307 { \ 4308 ret = FALSE; \ 4309 goto return_something; \ 4310 } \ 4311 if (bfd_seek (input_bfd, (file_ptr) symhdr->offset, SEEK_SET) != 0 \ 4312 || bfd_bread (debug->ptr, amt, input_bfd) != amt) \ 4313 { \ 4314 ret = FALSE; \ 4315 goto return_something; \ 4316 } \ 4329 4317 } 4330 4318 … … 4395 4383 the hash table. */ 4396 4384 4397 static b oolean4385 static bfd_boolean 4398 4386 ecoff_link_write_external (h, data) 4399 4387 struct ecoff_link_hash_entry *h; … … 4402 4390 struct extsym_info *einfo = (struct extsym_info *) data; 4403 4391 bfd *output_bfd = einfo->abfd; 4404 boolean strip; 4392 bfd_boolean strip; 4393 4394 if (h->root.type == bfd_link_hash_warning) 4395 { 4396 h = (struct ecoff_link_hash_entry *) h->root.u.i.link; 4397 if (h->root.type == bfd_link_hash_new) 4398 return TRUE; 4399 } 4405 4400 4406 4401 /* We need to check if this symbol is being stripped. */ 4407 4402 if (h->root.type == bfd_link_hash_undefined 4408 4403 || h->root.type == bfd_link_hash_undefweak) 4409 strip = false;4404 strip = FALSE; 4410 4405 else if (einfo->info->strip == strip_all 4411 4406 || (einfo->info->strip == strip_some 4412 4407 && bfd_hash_lookup (einfo->info->keep_hash, 4413 4408 h->root.root.string, 4414 false, false) == NULL))4415 strip = true;4409 FALSE, FALSE) == NULL)) 4410 strip = TRUE; 4416 4411 else 4417 strip = false;4412 strip = FALSE; 4418 4413 4419 4414 if (strip || h->written) 4420 return true;4415 return TRUE; 4421 4416 4422 4417 if (h->abfd == (bfd *) NULL) … … 4485 4480 { 4486 4481 default: 4482 case bfd_link_hash_warning: 4487 4483 case bfd_link_hash_new: 4488 4484 abort (); … … 4513 4509 break; 4514 4510 case bfd_link_hash_indirect: 4515 case bfd_link_hash_warning: 4516 /* FIXME: Ignore these for now. The circumstances under which 4517 they should be written out are not clear to me. */ 4518 return true; 4511 /* We ignore these symbols, since the indirected symbol is 4512 already in the hash table. */ 4513 return TRUE; 4519 4514 } 4520 4515 … … 4532 4527 /* Relocate and write an ECOFF section into an ECOFF output file. */ 4533 4528 4534 static b oolean4529 static bfd_boolean 4535 4530 ecoff_indirect_link_order (output_bfd, info, output_section, link_order) 4536 4531 bfd *output_bfd; … … 4548 4543 bfd_size_type external_relocs_size; 4549 4544 PTR external_relocs = NULL; 4545 bfd_size_type amt; 4550 4546 4551 4547 BFD_ASSERT ((output_section->flags & SEC_HAS_CONTENTS) != 0); 4552 4548 4553 4549 if (link_order->size == 0) 4554 return true;4550 return TRUE; 4555 4551 4556 4552 input_section = link_order->u.indirect.section; … … 4569 4565 /* Get the section contents. We allocate memory for the larger of 4570 4566 the size before relocating and the size after relocating. */ 4571 contents = (bfd_byte *) bfd_malloc (raw_size >= cooked_size 4572 ? (size_t) raw_size 4573 : (size_t) cooked_size); 4574 if (contents == NULL && raw_size != 0) 4567 amt = raw_size >= cooked_size ? raw_size : cooked_size; 4568 contents = (bfd_byte *) bfd_malloc (amt); 4569 if (contents == NULL && amt != 0) 4575 4570 goto error_return; 4576 4571 … … 4599 4594 else 4600 4595 { 4601 external_relocs = (PTR) bfd_malloc ( (size_t)external_relocs_size);4596 external_relocs = (PTR) bfd_malloc (external_relocs_size); 4602 4597 if (external_relocs == NULL && external_relocs_size != 0) 4603 4598 goto error_return; 4604 4599 4605 4600 if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0 4606 || (bfd_ read (external_relocs, 1, external_relocs_size, input_bfd)4601 || (bfd_bread (external_relocs, external_relocs_size, input_bfd) 4607 4602 != external_relocs_size)) 4608 4603 goto error_return; … … 4619 4614 output_section, 4620 4615 (PTR) contents, 4621 input_section->output_offset,4616 (file_ptr) input_section->output_offset, 4622 4617 cooked_size)) 4623 4618 goto error_return; … … 4629 4624 if (info->relocateable) 4630 4625 { 4631 if (bfd_seek (output_bfd, 4632 (output_section->rel_filepos + 4633 output_section->reloc_count * external_reloc_size), 4634 SEEK_SET) != 0 4635 || (bfd_write (external_relocs, 1, external_relocs_size, output_bfd) 4626 file_ptr pos = (output_section->rel_filepos 4627 + output_section->reloc_count * external_reloc_size); 4628 if (bfd_seek (output_bfd, pos, SEEK_SET) != 0 4629 || (bfd_bwrite (external_relocs, external_relocs_size, output_bfd) 4636 4630 != external_relocs_size)) 4637 4631 goto error_return; … … 4643 4637 if (external_relocs != NULL && section_tdata == NULL) 4644 4638 free (external_relocs); 4645 return true;4639 return TRUE; 4646 4640 4647 4641 error_return: … … 4650 4644 if (external_relocs != NULL && section_tdata == NULL) 4651 4645 free (external_relocs); 4652 return false;4646 return FALSE; 4653 4647 } 4654 4648 … … 4658 4652 with -Ur. */ 4659 4653 4660 static b oolean4654 static bfd_boolean 4661 4655 ecoff_reloc_link_order (output_bfd, info, output_section, link_order) 4662 4656 bfd *output_bfd; … … 4672 4666 bfd_size_type external_reloc_size; 4673 4667 bfd_byte *rbuf; 4674 boolean ok; 4668 bfd_boolean ok; 4669 file_ptr pos; 4675 4670 4676 4671 type = link_order->type; … … 4686 4681 { 4687 4682 bfd_set_error (bfd_error_bad_value); 4688 return false;4683 return FALSE; 4689 4684 } 4690 4685 … … 4702 4697 h = bfd_wrapped_link_hash_lookup (output_bfd, info, 4703 4698 link_order->u.reloc.p->u.name, 4704 false, false, false);4699 FALSE, FALSE, FALSE); 4705 4700 if (h != NULL 4706 4701 && (h->type == bfd_link_hash_defined … … 4732 4727 bfd_reloc_status_type rstat; 4733 4728 bfd_byte *buf; 4734 boolean ok;4735 4729 4736 4730 size = bfd_get_reloc_size (rel.howto); 4737 4731 buf = (bfd_byte *) bfd_zmalloc (size); 4738 4732 if (buf == (bfd_byte *) NULL) 4739 return false; 4740 rstat = _bfd_relocate_contents (rel.howto, output_bfd, addend, buf); 4733 return FALSE; 4734 rstat = _bfd_relocate_contents (rel.howto, output_bfd, 4735 (bfd_vma) addend, buf); 4741 4736 switch (rstat) 4742 4737 { … … 4756 4751 { 4757 4752 free (buf); 4758 return false;4753 return FALSE; 4759 4754 } 4760 4755 break; … … 4764 4759 free (buf); 4765 4760 if (! ok) 4766 return false;4761 return FALSE; 4767 4762 } 4768 4763 4769 4764 rel.addend = 0; 4770 4765 4771 /* Move the information into a internal_reloc structure. */4766 /* Move the information into an internal_reloc structure. */ 4772 4767 in.r_vaddr = (rel.address 4773 4768 + bfd_get_section_vma (output_bfd, output_section)); … … 4781 4776 bfd_wrapped_link_hash_lookup (output_bfd, info, 4782 4777 link_order->u.reloc.p->u.name, 4783 false, false, true));4778 FALSE, FALSE, TRUE)); 4784 4779 if (h != (struct ecoff_link_hash_entry *) NULL 4785 4780 && h->indx != -1) … … 4790 4785 (info, link_order->u.reloc.p->u.name, (bfd *) NULL, 4791 4786 (asection *) NULL, (bfd_vma) 0))) 4792 return false;4787 return FALSE; 4793 4788 in.r_symndx = 0; 4794 4789 } … … 4797 4792 else 4798 4793 { 4799 CONSTchar *name;4794 const char *name; 4800 4795 4801 4796 name = bfd_get_section_name (output_bfd, section); … … 4840 4835 /* Get some memory and swap out the reloc. */ 4841 4836 external_reloc_size = ecoff_backend (output_bfd)->external_reloc_size; 4842 rbuf = (bfd_byte *) bfd_malloc ( (size_t)external_reloc_size);4837 rbuf = (bfd_byte *) bfd_malloc (external_reloc_size); 4843 4838 if (rbuf == (bfd_byte *) NULL) 4844 return false;4839 return FALSE; 4845 4840 4846 4841 (*ecoff_backend (output_bfd)->swap_reloc_out) (output_bfd, &in, (PTR) rbuf); 4847 4842 4848 ok = (bfd_seek (output_bfd, 4849 (output_section->rel_filepos + 4850 output_section->reloc_count * external_reloc_size), 4851 SEEK_SET) == 0 4852 && (bfd_write ((PTR) rbuf, 1, external_reloc_size, output_bfd) 4843 pos = (output_section->rel_filepos 4844 + output_section->reloc_count * external_reloc_size); 4845 ok = (bfd_seek (output_bfd, pos, SEEK_SET) == 0 4846 && (bfd_bwrite ((PTR) rbuf, external_reloc_size, output_bfd) 4853 4847 == external_reloc_size)); 4854 4848 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.