Changeset 609 for branches/GNU/src/binutils/bfd/coffcode.h
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/bfd/coffcode.h
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* Support for the generic parts of most COFF variants, for BFD. 2 2 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 3 2000, 2001 3 2000, 2001, 2002, 2003 4 4 Free Software Foundation, Inc. 5 5 Written by Cygnus Support. 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 /* … … 226 226 the offsets generated by the previous pass and the pointers 227 227 generated when the symbol table was read in to create the 228 structured hiera chy required by coff. It changes each pointer228 structured hierarchy required by coff. It changes each pointer 229 229 to a symbol into the index into the symbol table of the asymbol. 230 230 … … 249 249 .typedef struct coff_ptr_struct 250 250 .{ 251 . 252 . {* Remembers the offset from the first symbol in the file for 253 . this symbol. Generated by coff_renumber_symbols. *} 254 .unsigned int offset; 255 . 256 . {* Should the value of this symbol be renumbered. Used for 257 . XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. *} 258 .unsigned int fix_value : 1; 259 . 260 . {* Should the tag field of this symbol be renumbered. 261 . Created by coff_pointerize_aux. *} 262 .unsigned int fix_tag : 1; 263 . 264 . {* Should the endidx field of this symbol be renumbered. 265 . Created by coff_pointerize_aux. *} 266 .unsigned int fix_end : 1; 267 . 268 . {* Should the x_csect.x_scnlen field be renumbered. 269 . Created by coff_pointerize_aux. *} 270 .unsigned int fix_scnlen : 1; 271 . 272 . {* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the 273 . index into the line number entries. Set by 274 . coff_slurp_symbol_table. *} 275 .unsigned int fix_line : 1; 276 . 277 . {* The container for the symbol structure as read and translated 278 . from the file. *} 279 . 280 .union { 281 . union internal_auxent auxent; 282 . struct internal_syment syment; 283 . } u; 251 . {* Remembers the offset from the first symbol in the file for 252 . this symbol. Generated by coff_renumber_symbols. *} 253 . unsigned int offset; 254 . 255 . {* Should the value of this symbol be renumbered. Used for 256 . XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. *} 257 . unsigned int fix_value : 1; 258 . 259 . {* Should the tag field of this symbol be renumbered. 260 . Created by coff_pointerize_aux. *} 261 . unsigned int fix_tag : 1; 262 . 263 . {* Should the endidx field of this symbol be renumbered. 264 . Created by coff_pointerize_aux. *} 265 . unsigned int fix_end : 1; 266 . 267 . {* Should the x_csect.x_scnlen field be renumbered. 268 . Created by coff_pointerize_aux. *} 269 . unsigned int fix_scnlen : 1; 270 . 271 . {* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the 272 . index into the line number entries. Set by coff_slurp_symbol_table. *} 273 . unsigned int fix_line : 1; 274 . 275 . {* The container for the symbol structure as read and translated 276 . from the file. *} 277 . union 278 . { 279 . union internal_auxent auxent; 280 . struct internal_syment syment; 281 . } u; 284 282 .} combined_entry_type; 285 283 . … … 289 287 .typedef struct coff_symbol_struct 290 288 .{ 291 . 292 . asymbol symbol;293 . 294 . 295 . combined_entry_type *native;296 . 297 . 298 . struct lineno_cache_entry *lineno;299 . 300 . 301 . boolean done_lineno;289 . {* The actual symbol which the rest of BFD works with *} 290 . asymbol symbol; 291 . 292 . {* A pointer to the hidden information for this symbol *} 293 . combined_entry_type *native; 294 . 295 . {* A pointer to the linenumber information for this symbol *} 296 . struct lineno_cache_entry *lineno; 297 . 298 . {* Have the line numbers been relocated yet ? *} 299 . bfd_boolean done_lineno; 302 300 .} coff_symbol_type; 303 301 … … 312 310 #define STRING_SIZE_SIZE (4) 313 311 314 static long sec_to_styp_flags PARAMS ((const char *, flagword)); 315 static flagword styp_to_sec_flags 316 PARAMS ((bfd *, PTR, const char *, asection *)); 317 static boolean coff_bad_format_hook PARAMS ((bfd *, PTR)); 312 static long sec_to_styp_flags 313 PARAMS ((const char *, flagword)); 314 static bfd_boolean styp_to_sec_flags 315 PARAMS ((bfd *, PTR, const char *, asection *, flagword *)); 316 static bfd_boolean coff_bad_format_hook 317 PARAMS ((bfd *, PTR)); 318 318 static void coff_set_custom_section_alignment 319 319 PARAMS ((bfd *, asection *, const struct coff_section_alignment_entry *, 320 320 const unsigned int)); 321 static boolean coff_new_section_hook PARAMS ((bfd *, asection *)); 322 static boolean coff_set_arch_mach_hook PARAMS ((bfd *, PTR)); 323 static boolean coff_write_relocs PARAMS ((bfd *, int)); 324 static boolean coff_set_flags 321 static bfd_boolean coff_new_section_hook 322 PARAMS ((bfd *, asection *)); 323 static bfd_boolean coff_set_arch_mach_hook 324 PARAMS ((bfd *, PTR)); 325 static bfd_boolean coff_write_relocs 326 PARAMS ((bfd *, int)); 327 static bfd_boolean coff_set_flags 325 328 PARAMS ((bfd *, unsigned int *, unsigned short *)); 326 static boolean coff_set_arch_mach 327 PARAMS ((bfd *, enum bfd_architecture, unsigned long)); 328 static boolean coff_compute_section_file_positions PARAMS ((bfd *)); 329 static boolean coff_write_object_contents PARAMS ((bfd *)); 330 static boolean coff_set_section_contents 329 static bfd_boolean coff_set_arch_mach 330 PARAMS ((bfd *, enum bfd_architecture, unsigned long)) ATTRIBUTE_UNUSED; 331 static bfd_boolean coff_compute_section_file_positions 332 PARAMS ((bfd *)); 333 static bfd_boolean coff_write_object_contents 334 PARAMS ((bfd *)) ATTRIBUTE_UNUSED; 335 static bfd_boolean coff_set_section_contents 331 336 PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); 332 static PTR buy_and_read PARAMS ((bfd *, file_ptr, int, size_t)); 333 static boolean coff_slurp_line_table PARAMS ((bfd *, asection *)); 334 static boolean coff_slurp_symbol_table PARAMS ((bfd *)); 337 static PTR buy_and_read 338 PARAMS ((bfd *, file_ptr, bfd_size_type)); 339 static bfd_boolean coff_slurp_line_table 340 PARAMS ((bfd *, asection *)); 341 static bfd_boolean coff_slurp_symbol_table 342 PARAMS ((bfd *)); 335 343 static enum coff_symbol_classification coff_classify_symbol 336 344 PARAMS ((bfd *, struct internal_syment *)); 337 static boolean coff_slurp_reloc_table PARAMS ((bfd *, asection *, asymbol **)); 345 static bfd_boolean coff_slurp_reloc_table 346 PARAMS ((bfd *, asection *, asymbol **)); 338 347 static long coff_canonicalize_reloc 339 348 PARAMS ((bfd *, asection *, arelent **, asymbol **)); 340 349 #ifndef coff_mkobject_hook 341 static PTR coff_mkobject_hook PARAMS ((bfd *, PTR, PTR)); 350 static PTR coff_mkobject_hook 351 PARAMS ((bfd *, PTR, PTR)); 342 352 #endif 343 353 #ifdef COFF_WITH_PE 344 static flagword handle_COMDAT PARAMS ((bfd *, flagword, PTR, const char *, asection *)); 354 static flagword handle_COMDAT 355 PARAMS ((bfd *, flagword, PTR, const char *, asection *)); 356 #endif 357 #ifdef COFF_IMAGE_WITH_PE 358 static bfd_boolean coff_read_word 359 PARAMS ((bfd *, unsigned int *)); 360 static unsigned int coff_compute_checksum 361 PARAMS ((bfd *)); 362 static bfd_boolean coff_apply_checksum 363 PARAMS ((bfd *)); 345 364 #endif 346 365 … … 370 389 static long 371 390 sec_to_styp_flags (sec_name, sec_flags) 372 CONSTchar *sec_name;391 const char *sec_name; 373 392 flagword sec_flags; 374 393 { … … 431 450 { 432 451 styp_flags = STYP_LOADER; 452 } 453 else if (!strcmp (sec_name, _EXCEPT)) 454 { 455 styp_flags = STYP_EXCEPT; 456 } 457 else if (!strcmp (sec_name, _TYPCHK)) 458 { 459 styp_flags = STYP_TYPCHK; 433 460 } 434 461 #endif … … 510 537 styp_flags |= IMAGE_SCN_CNT_UNINITIALIZED_DATA; /* ==STYP_BSS */ 511 538 /* skip ROM */ 512 /* skip CONSTRUCTOR */539 /* skip constRUCTOR */ 513 540 /* skip CONTENTS */ 514 541 #ifdef STYP_NOLOAD … … 533 560 /* For now, the read/write bits are mapped onto SEC_READONLY, even 534 561 though the semantics don't quite match. The bits from the input 535 are retained in pei_section_data(abfd, section)->pe_flags */536 537 styp_flags |= IMAGE_SCN_MEM_READ; /* always readable. */562 are retained in pei_section_data(abfd, section)->pe_flags. */ 563 564 styp_flags |= IMAGE_SCN_MEM_READ; /* Always readable. */ 538 565 if ((sec_flags & SEC_READONLY) == 0) 539 styp_flags |= IMAGE_SCN_MEM_WRITE; /* Invert READONLY for write */566 styp_flags |= IMAGE_SCN_MEM_WRITE; /* Invert READONLY for write. */ 540 567 if (sec_flags & SEC_CODE) 541 styp_flags |= IMAGE_SCN_MEM_EXECUTE; /* CODE->EXECUTE */568 styp_flags |= IMAGE_SCN_MEM_EXECUTE; /* CODE->EXECUTE. */ 542 569 if (sec_flags & SEC_SHARED) 543 styp_flags |= IMAGE_SCN_MEM_SHARED; /* Shared remains meaningful */570 styp_flags |= IMAGE_SCN_MEM_SHARED; /* Shared remains meaningful. */ 544 571 545 572 return styp_flags; … … 555 582 #ifndef COFF_WITH_PE 556 583 557 static flagword558 styp_to_sec_flags (abfd, hdr, name, section )584 static bfd_boolean 585 styp_to_sec_flags (abfd, hdr, name, section, flags_ptr) 559 586 bfd *abfd ATTRIBUTE_UNUSED; 560 587 PTR hdr; 561 588 const char *name; 562 589 asection *section ATTRIBUTE_UNUSED; 590 flagword *flags_ptr; 563 591 { 564 592 struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr; … … 568 596 #ifdef STYP_BLOCK 569 597 if (styp_flags & STYP_BLOCK) 570 598 sec_flags |= SEC_BLOCK; 571 599 #endif 572 600 573 601 #ifdef STYP_CLINK 574 602 if (styp_flags & STYP_CLINK) 575 603 sec_flags |= SEC_CLINK; 576 604 #endif 577 605 578 606 #ifdef STYP_NOLOAD 579 607 if (styp_flags & STYP_NOLOAD) 580 { 581 sec_flags |= SEC_NEVER_LOAD; 582 } 608 sec_flags |= SEC_NEVER_LOAD; 583 609 #endif /* STYP_NOLOAD */ 584 610 … … 621 647 } 622 648 else if (styp_flags & STYP_PAD) 623 { 624 sec_flags = 0; 625 } 649 sec_flags = 0; 626 650 else if (strcmp (name, _TEXT) == 0) 627 651 { … … 666 690 #ifdef _LIT 667 691 else if (strcmp (name, _LIT) == 0) 668 { 669 sec_flags = SEC_LOAD | SEC_ALLOC | SEC_READONLY; 670 } 692 sec_flags = SEC_LOAD | SEC_ALLOC | SEC_READONLY; 671 693 #endif 672 694 else 673 { 674 sec_flags |= SEC_ALLOC | SEC_LOAD; 675 } 676 677 #ifdef STYP_LIT /* A29k readonly text/data section type */ 695 sec_flags |= SEC_ALLOC | SEC_LOAD; 696 697 #ifdef STYP_LIT /* A29k readonly text/data section type. */ 678 698 if ((styp_flags & STYP_LIT) == STYP_LIT) 679 { 680 sec_flags = (SEC_LOAD | SEC_ALLOC | SEC_READONLY); 681 } 699 sec_flags = (SEC_LOAD | SEC_ALLOC | SEC_READONLY); 682 700 #endif /* STYP_LIT */ 683 #ifdef STYP_OTHER_LOAD /* Other loaded sections */ 701 702 #ifdef STYP_OTHER_LOAD /* Other loaded sections. */ 684 703 if (styp_flags & STYP_OTHER_LOAD) 685 { 686 sec_flags = (SEC_LOAD | SEC_ALLOC); 687 } 704 sec_flags = (SEC_LOAD | SEC_ALLOC); 688 705 #endif /* STYP_SDATA */ 689 706 … … 699 716 #endif 700 717 701 return sec_flags; 718 if (flags_ptr == NULL) 719 return FALSE; 720 721 * flags_ptr = sec_flags; 722 return TRUE; 702 723 } 703 724 … … 738 759 if (! _bfd_coff_get_external_symbols (abfd)) 739 760 return sec_flags; 740 761 741 762 esymstart = esym = (bfd_byte *) obj_coff_external_syms (abfd); 742 763 esymend = esym + obj_raw_syment_count (abfd) * bfd_coff_symesz (abfd); … … 783 804 follows the $) as the comdat symbol. */ 784 805 785 /* All 3 branches use this */806 /* All 3 branches use this. */ 786 807 symname = _bfd_coff_internal_syment_name (abfd, &isym, buf); 787 808 … … 911 932 #define TARGET_UNDERSCORE 0 912 933 #endif 913 /* Is this the name we're looking for ?*/934 /* Is this the name we're looking for ? */ 914 935 if (strcmp (target_name, 915 936 symname + (TARGET_UNDERSCORE ? 1 : 0)) != 0) … … 925 946 { 926 947 char *newname; 927 928 /* This must the the second symbol with the 948 bfd_size_type amt; 949 950 /* This must the second symbol with the 929 951 section #. It is the actual symbol name. 930 952 Intel puts the two adjacent, but Alpha (at 931 953 least) spreads them out. */ 932 954 933 section->comdat =934 bfd_alloc (abfd, sizeof (struct bfd_comdat_info));955 amt = sizeof (struct bfd_comdat_info); 956 section->comdat = bfd_alloc (abfd, amt); 935 957 if (section->comdat == NULL) 936 958 abort (); … … 939 961 (esym - esymstart) / bfd_coff_symesz (abfd); 940 962 941 newname = bfd_alloc (abfd, strlen (symname) + 1); 963 amt = strlen (symname) + 1; 964 newname = bfd_alloc (abfd, amt); 942 965 if (newname == NULL) 943 966 abort (); … … 968 991 any purpose other than objdump? */ 969 992 970 static flagword971 styp_to_sec_flags (abfd, hdr, name, section )993 static bfd_boolean 994 styp_to_sec_flags (abfd, hdr, name, section, flags_ptr) 972 995 bfd *abfd; 973 996 PTR hdr; 974 997 const char *name; 975 998 asection *section; 999 flagword *flags_ptr; 976 1000 { 977 1001 struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr; 978 1002 long styp_flags = internal_s->s_flags; 979 1003 flagword sec_flags; 1004 bfd_boolean result = TRUE; 980 1005 981 1006 /* Assume read only unless IMAGE_SCN_MEM_WRITE is specified. */ … … 987 1012 long flag = styp_flags & - styp_flags; 988 1013 char * unhandled = NULL; 989 1014 990 1015 styp_flags &= ~ flag; 991 1016 … … 1012 1037 sec_flags |= SEC_NEVER_LOAD; 1013 1038 break; 1014 #endif 1039 #endif 1015 1040 case IMAGE_SCN_MEM_READ: 1016 1041 /* Ignored, assume it always to be true. */ … … 1069 1094 default: 1070 1095 /* Silently ignore for now. */ 1071 break; 1096 break; 1072 1097 } 1073 1098 1074 /* If the section flag was not handled, report it here. This will allow 1075 users of the BFD library to report a problem but continue executing. 1076 Tools which need to be aware of these problems (such as the linker) 1077 can override the default bfd_error_handler to intercept these reports. */ 1099 /* If the section flag was not handled, report it here. */ 1078 1100 if (unhandled != NULL) 1079 (*_bfd_error_handler) 1080 (_("%s (%s): Section flag %s (0x%x) ignored"), 1081 bfd_get_filename (abfd), name, unhandled, flag); 1101 { 1102 (*_bfd_error_handler) 1103 (_("%s (%s): Section flag %s (0x%x) ignored"), 1104 bfd_archive_filename (abfd), name, unhandled, flag); 1105 result = FALSE; 1106 } 1082 1107 } 1083 1108 … … 1093 1118 #endif 1094 1119 1095 return sec_flags; 1120 if (flags_ptr) 1121 * flags_ptr = sec_flags; 1122 1123 return result; 1096 1124 } 1097 1125 … … 1125 1153 .typedef struct 1126 1154 .{ 1127 . void (*_bfd_coff_swap_aux_in) PARAMS (( 1128 . bfd *abfd, 1129 . PTR ext, 1130 . int type, 1131 . int class, 1132 . int indaux, 1133 . int numaux, 1134 . PTR in)); 1135 . 1136 . void (*_bfd_coff_swap_sym_in) PARAMS (( 1137 . bfd *abfd , 1138 . PTR ext, 1139 . PTR in)); 1140 . 1141 . void (*_bfd_coff_swap_lineno_in) PARAMS (( 1142 . bfd *abfd, 1143 . PTR ext, 1144 . PTR in)); 1145 . 1146 1147 Special entry points for gas to swap out coff parts: 1148 1149 . unsigned int (*_bfd_coff_swap_aux_out) PARAMS (( 1150 . bfd *abfd, 1151 . PTR in, 1152 . int type, 1153 . int class, 1154 . int indaux, 1155 . int numaux, 1156 . PTR ext)); 1157 . 1158 . unsigned int (*_bfd_coff_swap_sym_out) PARAMS (( 1159 . bfd *abfd, 1160 . PTR in, 1161 . PTR ext)); 1162 . 1163 . unsigned int (*_bfd_coff_swap_lineno_out) PARAMS (( 1164 . bfd *abfd, 1165 . PTR in, 1166 . PTR ext)); 1167 . 1168 . unsigned int (*_bfd_coff_swap_reloc_out) PARAMS (( 1169 . bfd *abfd, 1170 . PTR src, 1171 . PTR dst)); 1172 . 1173 . unsigned int (*_bfd_coff_swap_filehdr_out) PARAMS (( 1174 . bfd *abfd, 1175 . PTR in, 1176 . PTR out)); 1177 . 1178 . unsigned int (*_bfd_coff_swap_aouthdr_out) PARAMS (( 1179 . bfd *abfd, 1180 . PTR in, 1181 . PTR out)); 1182 . 1183 . unsigned int (*_bfd_coff_swap_scnhdr_out) PARAMS (( 1184 . bfd *abfd, 1185 . PTR in, 1186 . PTR out)); 1187 . 1188 1189 Special entry points for generic COFF routines to call target 1190 dependent COFF routines: 1191 1192 . unsigned int _bfd_filhsz; 1193 . unsigned int _bfd_aoutsz; 1194 . unsigned int _bfd_scnhsz; 1195 . unsigned int _bfd_symesz; 1196 . unsigned int _bfd_auxesz; 1197 . unsigned int _bfd_relsz; 1198 . unsigned int _bfd_linesz; 1199 . unsigned int _bfd_filnmlen; 1200 . boolean _bfd_coff_long_filenames; 1201 . boolean _bfd_coff_long_section_names; 1202 . unsigned int _bfd_coff_default_section_alignment_power; 1203 . boolean _bfd_coff_force_symnames_in_strings; 1204 . unsigned int _bfd_coff_debug_string_prefix_length; 1205 . void (*_bfd_coff_swap_filehdr_in) PARAMS (( 1206 . bfd *abfd, 1207 . PTR ext, 1208 . PTR in)); 1209 . void (*_bfd_coff_swap_aouthdr_in) PARAMS (( 1210 . bfd *abfd, 1211 . PTR ext, 1212 . PTR in)); 1213 . void (*_bfd_coff_swap_scnhdr_in) PARAMS (( 1214 . bfd *abfd, 1215 . PTR ext, 1216 . PTR in)); 1217 . void (*_bfd_coff_swap_reloc_in) PARAMS (( 1218 . bfd *abfd, 1219 . PTR ext, 1220 . PTR in)); 1221 . boolean (*_bfd_coff_bad_format_hook) PARAMS (( 1222 . bfd *abfd, 1223 . PTR internal_filehdr)); 1224 . boolean (*_bfd_coff_set_arch_mach_hook) PARAMS (( 1225 . bfd *abfd, 1226 . PTR internal_filehdr)); 1227 . PTR (*_bfd_coff_mkobject_hook) PARAMS (( 1228 . bfd *abfd, 1229 . PTR internal_filehdr, 1230 . PTR internal_aouthdr)); 1231 . flagword (*_bfd_styp_to_sec_flags_hook) PARAMS (( 1232 . bfd *abfd, 1233 . PTR internal_scnhdr, 1234 . const char *name, 1235 . asection *section)); 1236 . void (*_bfd_set_alignment_hook) PARAMS (( 1237 . bfd *abfd, 1238 . asection *sec, 1239 . PTR internal_scnhdr)); 1240 . boolean (*_bfd_coff_slurp_symbol_table) PARAMS (( 1241 . bfd *abfd)); 1242 . boolean (*_bfd_coff_symname_in_debug) PARAMS (( 1243 . bfd *abfd, 1244 . struct internal_syment *sym)); 1245 . boolean (*_bfd_coff_pointerize_aux_hook) PARAMS (( 1246 . bfd *abfd, 1247 . combined_entry_type *table_base, 1248 . combined_entry_type *symbol, 1249 . unsigned int indaux, 1250 . combined_entry_type *aux)); 1251 . boolean (*_bfd_coff_print_aux) PARAMS (( 1252 . bfd *abfd, 1253 . FILE *file, 1254 . combined_entry_type *table_base, 1255 . combined_entry_type *symbol, 1256 . combined_entry_type *aux, 1257 . unsigned int indaux)); 1258 . void (*_bfd_coff_reloc16_extra_cases) PARAMS (( 1259 . bfd *abfd, 1260 . struct bfd_link_info *link_info, 1261 . struct bfd_link_order *link_order, 1262 . arelent *reloc, 1263 . bfd_byte *data, 1264 . unsigned int *src_ptr, 1265 . unsigned int *dst_ptr)); 1266 . int (*_bfd_coff_reloc16_estimate) PARAMS (( 1267 . bfd *abfd, 1268 . asection *input_section, 1269 . arelent *r, 1270 . unsigned int shrink, 1271 . struct bfd_link_info *link_info)); 1272 . enum coff_symbol_classification (*_bfd_coff_classify_symbol) PARAMS (( 1273 . bfd *abfd, 1274 . struct internal_syment *)); 1275 . boolean (*_bfd_coff_compute_section_file_positions) PARAMS (( 1276 . bfd *abfd)); 1277 . boolean (*_bfd_coff_start_final_link) PARAMS (( 1278 . bfd *output_bfd, 1279 . struct bfd_link_info *info)); 1280 . boolean (*_bfd_coff_relocate_section) PARAMS (( 1281 . bfd *output_bfd, 1282 . struct bfd_link_info *info, 1283 . bfd *input_bfd, 1284 . asection *input_section, 1285 . bfd_byte *contents, 1286 . struct internal_reloc *relocs, 1287 . struct internal_syment *syms, 1288 . asection **sections)); 1289 . reloc_howto_type *(*_bfd_coff_rtype_to_howto) PARAMS (( 1290 . bfd *abfd, 1291 . asection *sec, 1292 . struct internal_reloc *rel, 1293 . struct coff_link_hash_entry *h, 1294 . struct internal_syment *sym, 1295 . bfd_vma *addendp)); 1296 . boolean (*_bfd_coff_adjust_symndx) PARAMS (( 1297 . bfd *obfd, 1298 . struct bfd_link_info *info, 1299 . bfd *ibfd, 1300 . asection *sec, 1301 . struct internal_reloc *reloc, 1302 . boolean *adjustedp)); 1303 . boolean (*_bfd_coff_link_add_one_symbol) PARAMS (( 1304 . struct bfd_link_info *info, 1305 . bfd *abfd, 1306 . const char *name, 1307 . flagword flags, 1308 . asection *section, 1309 . bfd_vma value, 1310 . const char *string, 1311 . boolean copy, 1312 . boolean collect, 1313 . struct bfd_link_hash_entry **hashp)); 1314 . 1315 . boolean (*_bfd_coff_link_output_has_begun) PARAMS (( 1316 . bfd * abfd, 1317 . struct coff_final_link_info * pfinfo)); 1318 . boolean (*_bfd_coff_final_link_postscript) PARAMS (( 1319 . bfd * abfd, 1320 . struct coff_final_link_info * pfinfo)); 1155 . void (*_bfd_coff_swap_aux_in) 1156 . PARAMS ((bfd *, PTR, int, int, int, int, PTR)); 1157 . 1158 . void (*_bfd_coff_swap_sym_in) 1159 . PARAMS ((bfd *, PTR, PTR)); 1160 . 1161 . void (*_bfd_coff_swap_lineno_in) 1162 . PARAMS ((bfd *, PTR, PTR)); 1163 . 1164 . unsigned int (*_bfd_coff_swap_aux_out) 1165 . PARAMS ((bfd *, PTR, int, int, int, int, PTR)); 1166 . 1167 . unsigned int (*_bfd_coff_swap_sym_out) 1168 . PARAMS ((bfd *, PTR, PTR)); 1169 . 1170 . unsigned int (*_bfd_coff_swap_lineno_out) 1171 . PARAMS ((bfd *, PTR, PTR)); 1172 . 1173 . unsigned int (*_bfd_coff_swap_reloc_out) 1174 . PARAMS ((bfd *, PTR, PTR)); 1175 . 1176 . unsigned int (*_bfd_coff_swap_filehdr_out) 1177 . PARAMS ((bfd *, PTR, PTR)); 1178 . 1179 . unsigned int (*_bfd_coff_swap_aouthdr_out) 1180 . PARAMS ((bfd *, PTR, PTR)); 1181 . 1182 . unsigned int (*_bfd_coff_swap_scnhdr_out) 1183 . PARAMS ((bfd *, PTR, PTR)); 1184 . 1185 . unsigned int _bfd_filhsz; 1186 . unsigned int _bfd_aoutsz; 1187 . unsigned int _bfd_scnhsz; 1188 . unsigned int _bfd_symesz; 1189 . unsigned int _bfd_auxesz; 1190 . unsigned int _bfd_relsz; 1191 . unsigned int _bfd_linesz; 1192 . unsigned int _bfd_filnmlen; 1193 . bfd_boolean _bfd_coff_long_filenames; 1194 . bfd_boolean _bfd_coff_long_section_names; 1195 . unsigned int _bfd_coff_default_section_alignment_power; 1196 . bfd_boolean _bfd_coff_force_symnames_in_strings; 1197 . unsigned int _bfd_coff_debug_string_prefix_length; 1198 . 1199 . void (*_bfd_coff_swap_filehdr_in) 1200 . PARAMS ((bfd *, PTR, PTR)); 1201 . 1202 . void (*_bfd_coff_swap_aouthdr_in) 1203 . PARAMS ((bfd *, PTR, PTR)); 1204 . 1205 . void (*_bfd_coff_swap_scnhdr_in) 1206 . PARAMS ((bfd *, PTR, PTR)); 1207 . 1208 . void (*_bfd_coff_swap_reloc_in) 1209 . PARAMS ((bfd *abfd, PTR, PTR)); 1210 . 1211 . bfd_boolean (*_bfd_coff_bad_format_hook) 1212 . PARAMS ((bfd *, PTR)); 1213 . 1214 . bfd_boolean (*_bfd_coff_set_arch_mach_hook) 1215 . PARAMS ((bfd *, PTR)); 1216 . 1217 . PTR (*_bfd_coff_mkobject_hook) 1218 . PARAMS ((bfd *, PTR, PTR)); 1219 . 1220 . bfd_boolean (*_bfd_styp_to_sec_flags_hook) 1221 . PARAMS ((bfd *, PTR, const char *, asection *, flagword *)); 1222 . 1223 . void (*_bfd_set_alignment_hook) 1224 . PARAMS ((bfd *, asection *, PTR)); 1225 . 1226 . bfd_boolean (*_bfd_coff_slurp_symbol_table) 1227 . PARAMS ((bfd *)); 1228 . 1229 . bfd_boolean (*_bfd_coff_symname_in_debug) 1230 . PARAMS ((bfd *, struct internal_syment *)); 1231 . 1232 . bfd_boolean (*_bfd_coff_pointerize_aux_hook) 1233 . PARAMS ((bfd *, combined_entry_type *, combined_entry_type *, 1234 . unsigned int, combined_entry_type *)); 1235 . 1236 . bfd_boolean (*_bfd_coff_print_aux) 1237 . PARAMS ((bfd *, FILE *, combined_entry_type *, combined_entry_type *, 1238 . combined_entry_type *, unsigned int)); 1239 . 1240 . void (*_bfd_coff_reloc16_extra_cases) 1241 . PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, 1242 . bfd_byte *, unsigned int *, unsigned int *)); 1243 . 1244 . int (*_bfd_coff_reloc16_estimate) 1245 . PARAMS ((bfd *, asection *, arelent *, unsigned int, 1246 . struct bfd_link_info *)); 1247 . 1248 . enum coff_symbol_classification (*_bfd_coff_classify_symbol) 1249 . PARAMS ((bfd *, struct internal_syment *)); 1250 . 1251 . bfd_boolean (*_bfd_coff_compute_section_file_positions) 1252 . PARAMS ((bfd *)); 1253 . 1254 . bfd_boolean (*_bfd_coff_start_final_link) 1255 . PARAMS ((bfd *, struct bfd_link_info *)); 1256 . 1257 . bfd_boolean (*_bfd_coff_relocate_section) 1258 . PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, 1259 . struct internal_reloc *, struct internal_syment *, asection **)); 1260 . 1261 . reloc_howto_type *(*_bfd_coff_rtype_to_howto) 1262 . PARAMS ((bfd *, asection *, struct internal_reloc *, 1263 . struct coff_link_hash_entry *, struct internal_syment *, 1264 . bfd_vma *)); 1265 . 1266 . bfd_boolean (*_bfd_coff_adjust_symndx) 1267 . PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, 1268 . struct internal_reloc *, bfd_boolean *)); 1269 . 1270 . bfd_boolean (*_bfd_coff_link_add_one_symbol) 1271 . PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, 1272 . asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean, 1273 . struct bfd_link_hash_entry **)); 1274 . 1275 . bfd_boolean (*_bfd_coff_link_output_has_begun) 1276 . PARAMS ((bfd *, struct coff_final_link_info *)); 1277 . 1278 . bfd_boolean (*_bfd_coff_final_link_postscript) 1279 . PARAMS ((bfd *, struct coff_final_link_info *)); 1321 1280 . 1322 1281 .} bfd_coff_backend_data; 1323 1282 . 1324 .#define coff_backend_info(abfd) ((bfd_coff_backend_data *) (abfd)->xvec->backend_data) 1283 .#define coff_backend_info(abfd) \ 1284 . ((bfd_coff_backend_data *) (abfd)->xvec->backend_data) 1325 1285 . 1326 1286 .#define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \ 1327 . 1287 . ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i)) 1328 1288 . 1329 1289 .#define bfd_coff_swap_sym_in(a,e,i) \ 1330 . 1290 . ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i)) 1331 1291 . 1332 1292 .#define bfd_coff_swap_lineno_in(a,e,i) \ 1333 . 1293 . ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i)) 1334 1294 . 1335 1295 .#define bfd_coff_swap_reloc_out(abfd, i, o) \ 1336 . 1296 . ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o)) 1337 1297 . 1338 1298 .#define bfd_coff_swap_lineno_out(abfd, i, o) \ 1339 . 1299 . ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o)) 1340 1300 . 1341 1301 .#define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \ 1342 . 1302 . ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o)) 1343 1303 . 1344 1304 .#define bfd_coff_swap_sym_out(abfd, i,o) \ 1345 . 1305 . ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o)) 1346 1306 . 1347 1307 .#define bfd_coff_swap_scnhdr_out(abfd, i,o) \ 1348 . 1308 . ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o)) 1349 1309 . 1350 1310 .#define bfd_coff_swap_filehdr_out(abfd, i,o) \ 1351 . 1311 . ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o)) 1352 1312 . 1353 1313 .#define bfd_coff_swap_aouthdr_out(abfd, i,o) \ 1354 . 1314 . ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o)) 1355 1315 . 1356 1316 .#define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz) … … 1362 1322 .#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz) 1363 1323 .#define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen) 1364 .#define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames) 1324 .#define bfd_coff_long_filenames(abfd) \ 1325 . (coff_backend_info (abfd)->_bfd_coff_long_filenames) 1365 1326 .#define bfd_coff_long_section_names(abfd) \ 1366 . 1327 . (coff_backend_info (abfd)->_bfd_coff_long_section_names) 1367 1328 .#define bfd_coff_default_section_alignment_power(abfd) \ 1368 . 1329 . (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power) 1369 1330 .#define bfd_coff_swap_filehdr_in(abfd, i,o) \ 1370 . 1331 . ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o)) 1371 1332 . 1372 1333 .#define bfd_coff_swap_aouthdr_in(abfd, i,o) \ 1373 . 1334 . ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o)) 1374 1335 . 1375 1336 .#define bfd_coff_swap_scnhdr_in(abfd, i,o) \ 1376 . 1337 . ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o)) 1377 1338 . 1378 1339 .#define bfd_coff_swap_reloc_in(abfd, i, o) \ 1379 . 1340 . ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o)) 1380 1341 . 1381 1342 .#define bfd_coff_bad_format_hook(abfd, filehdr) \ 1382 . 1343 . ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr)) 1383 1344 . 1384 1345 .#define bfd_coff_set_arch_mach_hook(abfd, filehdr)\ 1385 . 1346 . ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr)) 1386 1347 .#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\ 1387 . ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr)) 1388 . 1389 .#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section)\ 1390 . ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\ 1391 . (abfd, scnhdr, name, section)) 1348 . ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook)\ 1349 . (abfd, filehdr, aouthdr)) 1350 . 1351 .#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section, flags_ptr)\ 1352 . ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\ 1353 . (abfd, scnhdr, name, section, flags_ptr)) 1392 1354 . 1393 1355 .#define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\ 1394 . 1356 . ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr)) 1395 1357 . 1396 1358 .#define bfd_coff_slurp_symbol_table(abfd)\ 1397 . 1359 . ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd)) 1398 1360 . 1399 1361 .#define bfd_coff_symname_in_debug(abfd, sym)\ 1400 . 1362 . ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym)) 1401 1363 . 1402 1364 .#define bfd_coff_force_symnames_in_strings(abfd)\ 1403 . 1365 . (coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings) 1404 1366 . 1405 1367 .#define bfd_coff_debug_string_prefix_length(abfd)\ 1406 . 1368 . (coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length) 1407 1369 . 1408 1370 .#define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\ 1409 . ((coff_backend_info (abfd)->_bfd_coff_print_aux)\ 1410 . (abfd, file, base, symbol, aux, indaux)) 1411 . 1412 .#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)\ 1413 . ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\ 1414 . (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)) 1371 . ((coff_backend_info (abfd)->_bfd_coff_print_aux)\ 1372 . (abfd, file, base, symbol, aux, indaux)) 1373 . 1374 .#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order,\ 1375 . reloc, data, src_ptr, dst_ptr)\ 1376 . ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\ 1377 . (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)) 1415 1378 . 1416 1379 .#define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\ 1417 . 1418 . 1380 . ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\ 1381 . (abfd, section, reloc, shrink, link_info)) 1419 1382 . 1420 1383 .#define bfd_coff_classify_symbol(abfd, sym)\ 1421 . 1422 . 1384 . ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\ 1385 . (abfd, sym)) 1423 1386 . 1424 1387 .#define bfd_coff_compute_section_file_positions(abfd)\ 1425 . 1426 . 1388 . ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\ 1389 . (abfd)) 1427 1390 . 1428 1391 .#define bfd_coff_start_final_link(obfd, info)\ 1429 . 1430 . 1392 . ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\ 1393 . (obfd, info)) 1431 1394 .#define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\ 1432 . 1433 . 1395 . ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\ 1396 . (obfd, info, ibfd, o, con, rel, isyms, secs)) 1434 1397 .#define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\ 1435 . 1436 . 1398 . ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\ 1399 . (abfd, sec, rel, h, sym, addendp)) 1437 1400 .#define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\ 1438 . ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\ 1439 . (obfd, info, ibfd, sec, rel, adjustedp)) 1440 .#define bfd_coff_link_add_one_symbol(info,abfd,name,flags,section,value,string,cp,coll,hashp)\ 1441 . ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\ 1442 . (info, abfd, name, flags, section, value, string, cp, coll, hashp)) 1401 . ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\ 1402 . (obfd, info, ibfd, sec, rel, adjustedp)) 1403 .#define bfd_coff_link_add_one_symbol(info, abfd, name, flags, section,\ 1404 . value, string, cp, coll, hashp)\ 1405 . ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\ 1406 . (info, abfd, name, flags, section, value, string, cp, coll, hashp)) 1443 1407 . 1444 1408 .#define bfd_coff_link_output_has_begun(a,p) \ 1445 . 1409 . ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p)) 1446 1410 .#define bfd_coff_final_link_postscript(a,p) \ 1447 . 1411 . ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p)) 1448 1412 . 1449 1413 */ … … 1451 1415 /* See whether the magic number matches. */ 1452 1416 1453 static b oolean1417 static bfd_boolean 1454 1418 coff_bad_format_hook (abfd, filehdr) 1455 1419 bfd * abfd ATTRIBUTE_UNUSED; … … 1459 1423 1460 1424 if (BADMAG (*internal_f)) 1461 return false;1462 1463 /* if the optional header is NULL or not the correct size then1425 return FALSE; 1426 1427 /* If the optional header is NULL or not the correct size then 1464 1428 quit; the only difference I can see between m88k dgux headers (MC88DMAGIC) 1465 1429 and Intel 960 readwrite headers (I960WRMAGIC) is that the … … 1467 1431 1468 1432 But the mips keeps extra stuff in it's opthdr, so dont check 1469 when doing that 1470 */ 1433 when doing that. */ 1471 1434 1472 1435 #if defined(M88) || defined(I960) 1473 1436 if (internal_f->f_opthdr != 0 && bfd_coff_aoutsz (abfd) != internal_f->f_opthdr) 1474 return false;1475 #endif 1476 1477 return true;1437 return FALSE; 1438 #endif 1439 1440 return TRUE; 1478 1441 } 1479 1442 … … 1494 1457 { 1495 1458 const char *secname = bfd_get_section_name (abfd, section); 1459 1496 1460 if (alignment_table[i].comparison_length == (unsigned int) -1 1497 1461 ? strcmp (alignment_table[i].name, secname) == 0 … … 1508 1472 1509 1473 if (alignment_table[i].default_alignment_max != COFF_ALIGNMENT_FIELD_EMPTY 1510 && default_alignment > alignment_table[i].default_alignment_max) 1474 #if COFF_DEFAULT_SECTION_ALIGNMENT_POWER != 0 1475 && default_alignment > alignment_table[i].default_alignment_max 1476 #endif 1477 ) 1511 1478 return; 1512 1479 … … 1541 1508 particular implementation of COFF. */ 1542 1509 1543 static b oolean1510 static bfd_boolean 1544 1511 coff_new_section_hook (abfd, section) 1545 1512 bfd * abfd; … … 1547 1514 { 1548 1515 combined_entry_type *native; 1516 bfd_size_type amt; 1549 1517 1550 1518 section->alignment_power = COFF_DEFAULT_SECTION_ALIGNMENT_POWER; 1551 1519 1552 1520 #ifdef RS6000COFF_C 1553 if ( xcoff_data (abfd)->text_align_power!= 01521 if (bfd_xcoff_text_align_power (abfd) != 0 1554 1522 && strcmp (bfd_get_section_name (abfd, section), ".text") == 0) 1555 section->alignment_power = xcoff_data (abfd)->text_align_power;1556 if ( xcoff_data (abfd)->data_align_power!= 01523 section->alignment_power = bfd_xcoff_text_align_power (abfd); 1524 if (bfd_xcoff_data_align_power (abfd) != 0 1557 1525 && strcmp (bfd_get_section_name (abfd, section), ".data") == 0) 1558 section->alignment_power = xcoff_data (abfd)->data_align_power;1526 section->alignment_power = bfd_xcoff_data_align_power (abfd); 1559 1527 #endif 1560 1528 … … 1564 1532 @@ The 10 is a guess at a plausible maximum number of aux entries 1565 1533 (but shouldn't be a constant). */ 1566 native = ((combined_entry_type *)1567 bfd_zalloc (abfd, sizeof (combined_entry_type) * 10));1534 amt = sizeof (combined_entry_type) * 10; 1535 native = (combined_entry_type *) bfd_zalloc (abfd, amt); 1568 1536 if (native == NULL) 1569 return false;1537 return FALSE; 1570 1538 1571 1539 /* We don't need to set up n_name, n_value, or n_scnum in the native … … 1584 1552 coff_section_alignment_table_size); 1585 1553 1586 return true;1554 return TRUE; 1587 1555 } 1588 1556 … … 1603 1571 1604 1572 #ifdef I960 1605 /* Extract ALIGN from 2**ALIGN stored in section header */1573 /* Extract ALIGN from 2**ALIGN stored in section header. */ 1606 1574 for (i = 0; i < 32; i++) 1607 1575 if ((1 << i) >= hdr->s_align) … … 1609 1577 #endif 1610 1578 #ifdef TIC80COFF 1611 /* TI tools puts the alignment power in bits 8-11 */1579 /* TI tools puts the alignment power in bits 8-11. */ 1612 1580 i = (hdr->s_flags >> 8) & 0xF ; 1613 1581 #endif … … 1625 1593 #ifdef COFF_WITH_PE 1626 1594 1627 /* a couple of macros to help setting the alignment power field*/1595 /* A couple of macros to help setting the alignment power field. */ 1628 1596 #define ALIGN_SET(field,x,y) \ 1629 1597 if (((field) & IMAGE_SCN_ALIGN_64BYTES) == x )\ … … 1647 1615 { 1648 1616 struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr; 1617 bfd_size_type amt; 1649 1618 1650 1619 ALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_64BYTES, 6) … … 1662 1631 if (coff_section_data (abfd, section) == NULL) 1663 1632 { 1664 section->used_by_bfd =1665 (PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata));1633 amt = sizeof (struct coff_section_tdata); 1634 section->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); 1666 1635 if (section->used_by_bfd == NULL) 1667 1636 { … … 1672 1641 if (pei_section_data (abfd, section) == NULL) 1673 1642 { 1674 coff_section_data (abfd, section)->tdata =1675 (PTR) bfd_zalloc (abfd, sizeof (struct pei_section_tdata));1643 amt = sizeof (struct pei_section_tdata); 1644 coff_section_data (abfd, section)->tdata = (PTR) bfd_zalloc (abfd, amt); 1676 1645 if (coff_section_data (abfd, section)->tdata == NULL) 1677 1646 { … … 1685 1654 section->lma = hdr->s_vaddr; 1686 1655 1687 /* check for extended relocs*/1656 /* Check for extended relocs. */ 1688 1657 if (hdr->s_flags & IMAGE_SCN_LNK_NRELOC_OVFL) 1689 1658 { 1690 1659 struct external_reloc dst; 1691 1660 struct internal_reloc n; 1692 intoldpos = bfd_tell (abfd);1693 bfd_seek (abfd, hdr->s_relptr, 0);1694 if (bfd_ read ((PTR) & dst, 1,bfd_coff_relsz (abfd), abfd)1661 file_ptr oldpos = bfd_tell (abfd); 1662 bfd_seek (abfd, (file_ptr) hdr->s_relptr, 0); 1663 if (bfd_bread ((PTR) &dst, (bfd_size_type) bfd_coff_relsz (abfd), abfd) 1695 1664 != bfd_coff_relsz (abfd)) 1696 1665 return; … … 1698 1667 coff_swap_reloc_in (abfd, &dst, &n); 1699 1668 bfd_seek (abfd, oldpos, 0); 1700 section->reloc_count = 1701 hdr->s_nreloc = n.r_vaddr; 1669 section->reloc_count = hdr->s_nreloc = n.r_vaddr; 1702 1670 } 1703 1671 } … … 1727 1695 return; 1728 1696 1729 real_sec = coff_section_from_bfd_index (abfd, hdr->s_nreloc);1697 real_sec = coff_section_from_bfd_index (abfd, (int) hdr->s_nreloc); 1730 1698 if (real_sec == NULL) 1731 1699 return; … … 1738 1706 if (*ps == section) 1739 1707 { 1740 *ps = (*ps)->next;1708 bfd_section_list_remove (abfd, ps); 1741 1709 --abfd->section_count; 1742 1710 break; … … 1756 1724 #ifndef coff_mkobject 1757 1725 1758 static b oolean coff_mkobject PARAMS ((bfd *));1759 1760 static b oolean1726 static bfd_boolean coff_mkobject PARAMS ((bfd *)); 1727 1728 static bfd_boolean 1761 1729 coff_mkobject (abfd) 1762 1730 bfd * abfd; 1763 1731 { 1764 1732 coff_data_type *coff; 1765 1766 abfd->tdata.coff_obj_data = (struct coff_tdata *) bfd_zalloc (abfd, sizeof (coff_data_type)); 1733 bfd_size_type amt = sizeof (coff_data_type); 1734 1735 abfd->tdata.coff_obj_data = (struct coff_tdata *) bfd_zalloc (abfd, amt); 1767 1736 if (abfd->tdata.coff_obj_data == 0) 1768 return false;1737 return FALSE; 1769 1738 coff = coff_data (abfd); 1770 1739 coff->symbols = (coff_symbol_type *) NULL; … … 1776 1745 /* make_abs_section(abfd);*/ 1777 1746 1778 return true;1747 return TRUE; 1779 1748 } 1780 1749 #endif 1781 1750 1782 1751 /* Create the COFF backend specific information. */ 1752 1783 1753 #ifndef coff_mkobject_hook 1784 1754 static PTR … … 1791 1761 coff_data_type *coff; 1792 1762 1793 if ( coff_mkobject (abfd) == false)1763 if (! coff_mkobject (abfd)) 1794 1764 return NULL; 1795 1765 … … 1830 1800 xcoff->xcoff64 = 0; 1831 1801 # endif 1832 xcoff->full_aouthdr = true;1802 xcoff->full_aouthdr = TRUE; 1833 1803 xcoff->toc = internal_a->o_toc; 1834 1804 xcoff->sntoc = internal_a->o_sntoc; 1835 1805 xcoff->snentry = internal_a->o_snentry; 1836 xcoff->text_align_power= internal_a->o_algntext;1837 xcoff->data_align_power= internal_a->o_algndata;1806 bfd_xcoff_text_align_power (abfd) = internal_a->o_algntext; 1807 bfd_xcoff_data_align_power (abfd) = internal_a->o_algndata; 1838 1808 xcoff->modtype = internal_a->o_modtype; 1839 1809 xcoff->cputype = internal_a->o_cputype; … … 1844 1814 1845 1815 #ifdef ARM 1846 /* Set the flags field from the COFF header read in */1816 /* Set the flags field from the COFF header read in. */ 1847 1817 if (! _bfd_coff_arm_set_private_flags (abfd, internal_f->f_flags)) 1848 1818 coff->flags = 0; … … 1867 1837 at linking together COFF files for different architectures. */ 1868 1838 1869 static b oolean1839 static bfd_boolean 1870 1840 coff_set_arch_mach_hook (abfd, filehdr) 1871 1841 bfd *abfd; 1872 1842 PTR filehdr; 1873 1843 { 1874 long machine;1844 unsigned long machine; 1875 1845 enum bfd_architecture arch; 1876 1846 struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; 1877 1847 1848 /* Zero selects the default machine for an arch. */ 1878 1849 machine = 0; 1879 1850 switch (internal_f->f_magic) 1880 1851 { 1852 #ifdef OR32_MAGIC_BIG 1853 case OR32_MAGIC_BIG: 1854 case OR32_MAGIC_LITTLE: 1855 arch = bfd_arch_or32; 1856 break; 1857 #endif 1881 1858 #ifdef PPCMAGIC 1882 1859 case PPCMAGIC: 1883 1860 arch = bfd_arch_powerpc; 1884 machine = 0; /* what does this mean? (krk) */1885 1861 break; 1886 1862 #endif … … 1891 1867 case LYNXCOFFMAGIC: /* shadows the m68k Lynx number below, sigh */ 1892 1868 arch = bfd_arch_i386; 1893 machine = 0;1894 1869 break; 1895 1870 #endif … … 1897 1872 case IA64MAGIC: 1898 1873 arch = bfd_arch_ia64; 1899 machine = 0;1900 1874 break; 1901 1875 #endif … … 1904 1878 case A29K_MAGIC_LITTLE: 1905 1879 arch = bfd_arch_a29k; 1906 machine = 0;1907 1880 break; 1908 1881 #endif … … 1912 1885 case THUMBPEMAGIC: 1913 1886 arch = bfd_arch_arm; 1914 switch (internal_f->f_flags & F_ARM_ARCHITECTURE_MASK) 1887 machine = bfd_arm_get_mach_from_notes (abfd, ARM_NOTE_SECTION); 1888 if (machine == bfd_mach_arm_unknown) 1915 1889 { 1916 case F_ARM_2: machine = bfd_mach_arm_2; break; 1917 case F_ARM_2a: machine = bfd_mach_arm_2a; break; 1918 case F_ARM_3: machine = bfd_mach_arm_3; break; 1919 default: 1920 case F_ARM_3M: machine = bfd_mach_arm_3M; break; 1921 case F_ARM_4: machine = bfd_mach_arm_4; break; 1922 case F_ARM_4T: machine = bfd_mach_arm_4T; break; 1923 case F_ARM_5: machine = bfd_mach_arm_5; break; 1890 switch (internal_f->f_flags & F_ARM_ARCHITECTURE_MASK) 1891 { 1892 case F_ARM_2: machine = bfd_mach_arm_2; break; 1893 case F_ARM_2a: machine = bfd_mach_arm_2a; break; 1894 case F_ARM_3: machine = bfd_mach_arm_3; break; 1895 default: 1896 case F_ARM_3M: machine = bfd_mach_arm_3M; break; 1897 case F_ARM_4: machine = bfd_mach_arm_4; break; 1898 case F_ARM_4T: machine = bfd_mach_arm_4T; break; 1899 /* The COFF header does not have enough bits available 1900 to cover all the different ARM architectures. So 1901 we interpret F_ARM_5, the highest flag value to mean 1902 "the highest ARM architecture known to BFD" which is 1903 currently the XScale. */ 1904 case F_ARM_5: machine = bfd_mach_arm_XScale; break; 1905 } 1924 1906 } 1925 1907 break; … … 1961 1943 break; 1962 1944 default: 1963 return false;1945 return FALSE; 1964 1946 } 1965 1947 break; … … 2009 1991 #ifdef RS6000COFF_C 2010 1992 #ifdef XCOFF64 1993 case U64_TOCMAGIC: 2011 1994 case U803XTOCMAGIC: 2012 1995 #else … … 2032 2015 bfd_byte *buf; 2033 2016 struct internal_syment sym; 2034 2035 buf = (bfd_byte *) bfd_malloc (bfd_coff_symesz (abfd)); 2017 bfd_size_type amt = bfd_coff_symesz (abfd); 2018 2019 buf = (bfd_byte *) bfd_malloc (amt); 2036 2020 if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 2037 || (bfd_read (buf, 1, bfd_coff_symesz (abfd), abfd) 2038 != bfd_coff_symesz (abfd))) 2021 || bfd_bread (buf, amt, abfd) != amt) 2039 2022 { 2040 2023 free (buf); 2041 return false;2024 return FALSE; 2042 2025 } 2043 2026 bfd_coff_swap_sym_in (abfd, (PTR) buf, (PTR) &sym); … … 2055 2038 default: 2056 2039 case 0: 2057 #ifdef POWERMAC 2058 /* PowerPC Macs use the same magic numbers as RS/6000 2059 (because that's how they were bootstrapped originally), 2060 but they are always PowerPC architecture. */ 2061 arch = bfd_arch_powerpc; 2062 machine = bfd_mach_ppc; 2063 #else 2064 #ifdef XCOFF64 2065 arch = bfd_arch_powerpc; 2066 machine = bfd_mach_ppc_620; 2067 #else 2068 arch = bfd_arch_rs6000; 2069 machine = bfd_mach_rs6k; 2070 #endif 2071 #endif /* POWERMAC */ 2040 arch = bfd_xcoff_architecture (abfd); 2041 machine = bfd_xcoff_machine (abfd); 2072 2042 break; 2073 2043 … … 2096 2066 case WE32KMAGIC: 2097 2067 arch = bfd_arch_we32k; 2098 machine = 0;2099 2068 break; 2100 2069 #endif … … 2104 2073 arch = bfd_arch_h8300; 2105 2074 machine = bfd_mach_h8300; 2106 /* !! FIXME this probably isn't the right place for this */2075 /* !! FIXME this probably isn't the right place for this. */ 2107 2076 abfd->flags |= BFD_IS_RELAXABLE; 2108 2077 break; … … 2113 2082 arch = bfd_arch_h8300; 2114 2083 machine = bfd_mach_h8300h; 2115 /* !! FIXME this probably isn't the right place for this */2084 /* !! FIXME this probably isn't the right place for this. */ 2116 2085 abfd->flags |= BFD_IS_RELAXABLE; 2117 2086 break; … … 2122 2091 arch = bfd_arch_h8300; 2123 2092 machine = bfd_mach_h8300s; 2124 /* !! FIXME this probably isn't the right place for this */ 2093 /* !! FIXME this probably isn't the right place for this. */ 2094 abfd->flags |= BFD_IS_RELAXABLE; 2095 break; 2096 #endif 2097 2098 #ifdef H8300HNMAGIC 2099 case H8300HNMAGIC: 2100 arch = bfd_arch_h8300; 2101 machine = bfd_mach_h8300hn; 2102 /* !! FIXME this probably isn't the right place for this. */ 2103 abfd->flags |= BFD_IS_RELAXABLE; 2104 break; 2105 #endif 2106 2107 #ifdef H8300SNMAGIC 2108 case H8300SNMAGIC: 2109 arch = bfd_arch_h8300; 2110 machine = bfd_mach_h8300sn; 2111 /* !! FIXME this probably isn't the right place for this. */ 2125 2112 abfd->flags |= BFD_IS_RELAXABLE; 2126 2113 break; … … 2134 2121 #endif 2135 2122 arch = bfd_arch_sh; 2136 machine = 0;2137 2123 break; 2138 2124 #endif … … 2141 2127 case MIPS_ARCH_MAGIC_WINCE: 2142 2128 arch = bfd_arch_mips; 2143 machine = 0;2144 2129 break; 2145 2130 #endif … … 2148 2133 case H8500MAGIC: 2149 2134 arch = bfd_arch_h8500; 2150 machine = 0;2151 2135 break; 2152 2136 #endif … … 2158 2142 #endif 2159 2143 arch = bfd_arch_sparc; 2160 machine = 0;2161 2144 break; 2162 2145 #endif … … 2170 2153 #ifdef TICOFF0MAGIC 2171 2154 #ifdef TICOFF_TARGET_ARCH 2172 /* this TI COFF section should be used by all new TI COFF v0 targets*/2155 /* This TI COFF section should be used by all new TI COFF v0 targets. */ 2173 2156 case TICOFF0MAGIC: 2174 2157 arch = TICOFF_TARGET_ARCH; 2158 machine = TICOFF_TARGET_MACHINE_GET (internal_f->f_flags); 2175 2159 break; 2176 2160 #endif … … 2178 2162 2179 2163 #ifdef TICOFF1MAGIC 2180 /* this TI COFF section should be used by all new TI COFF v1/2 targets*/2181 /* TI COFF1 and COFF2 use the target_id field to specify which arch */2164 /* This TI COFF section should be used by all new TI COFF v1/2 targets. */ 2165 /* TI COFF1 and COFF2 use the target_id field to specify which arch. */ 2182 2166 case TICOFF1MAGIC: 2183 2167 case TICOFF2MAGIC: … … 2187 2171 case TI_TARGET_ID: 2188 2172 arch = TICOFF_TARGET_ARCH; 2173 machine = TICOFF_TARGET_MACHINE_GET (internal_f->f_flags); 2189 2174 break; 2190 2175 #endif … … 2210 2195 break; 2211 2196 #endif 2212 default: /* Unreadable input file type */ 2197 2198 #ifdef W65MAGIC 2199 case W65MAGIC: 2200 arch = bfd_arch_w65; 2201 break; 2202 #endif 2203 2204 default: /* Unreadable input file type. */ 2213 2205 arch = bfd_arch_obscure; 2214 2206 break; … … 2216 2208 2217 2209 bfd_default_set_arch_mach (abfd, arch, machine); 2218 return true;2210 return TRUE; 2219 2211 } 2220 2212 2221 2213 #ifdef SYMNAME_IN_DEBUG 2222 2214 2223 static b oolean symname_in_debug_hook2215 static bfd_boolean symname_in_debug_hook 2224 2216 PARAMS ((bfd *, struct internal_syment *)); 2225 2217 2226 static b oolean2218 static bfd_boolean 2227 2219 symname_in_debug_hook (abfd, sym) 2228 2220 bfd * abfd ATTRIBUTE_UNUSED; 2229 2221 struct internal_syment *sym; 2230 2222 { 2231 return SYMNAME_IN_DEBUG (sym) ? true : false;2223 return SYMNAME_IN_DEBUG (sym) != 0; 2232 2224 } 2233 2225 … … 2235 2227 2236 2228 #define symname_in_debug_hook \ 2237 (b oolean (*) PARAMS ((bfd *, struct internal_syment *))) bfd_false2229 (bfd_boolean (*) PARAMS ((bfd *, struct internal_syment *))) bfd_false 2238 2230 2239 2231 #endif … … 2247 2239 /* Handle the csect auxent of a C_EXT or C_HIDEXT symbol. */ 2248 2240 2249 static b oolean coff_pointerize_aux_hook2241 static bfd_boolean coff_pointerize_aux_hook 2250 2242 PARAMS ((bfd *, combined_entry_type *, combined_entry_type *, 2251 2243 unsigned int, combined_entry_type *)); 2252 2244 2253 /*ARGSUSED*/ 2254 static boolean 2245 static bfd_boolean 2255 2246 coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux) 2256 2247 bfd *abfd ATTRIBUTE_UNUSED; … … 2272 2263 } 2273 2264 2274 /* Return trueto indicate that the caller should not do any2265 /* Return TRUE to indicate that the caller should not do any 2275 2266 further work on this auxent. */ 2276 return true;2277 } 2278 2279 /* Return falseto indicate that this auxent should be handled by2267 return TRUE; 2268 } 2269 2270 /* Return FALSE to indicate that this auxent should be handled by 2280 2271 the caller. */ 2281 return false;2272 return FALSE; 2282 2273 } 2283 2274 … … 2287 2278 /* We don't want to pointerize bal entries. */ 2288 2279 2289 static b oolean coff_pointerize_aux_hook2280 static bfd_boolean coff_pointerize_aux_hook 2290 2281 PARAMS ((bfd *, combined_entry_type *, combined_entry_type *, 2291 2282 unsigned int, combined_entry_type *)); 2292 2283 2293 /*ARGSUSED*/ 2294 static boolean 2284 static bfd_boolean 2295 2285 coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux) 2296 2286 bfd *abfd ATTRIBUTE_UNUSED; … … 2300 2290 combined_entry_type *aux ATTRIBUTE_UNUSED; 2301 2291 { 2302 /* Return trueif we don't want to pointerize this aux entry, which2292 /* Return TRUE if we don't want to pointerize this aux entry, which 2303 2293 is the case for the lastfirst aux entry for a C_LEAFPROC symbol. */ 2304 2294 return (indaux == 1 … … 2315 2305 #endif /* ! RS6000COFF_C */ 2316 2306 2317 /* Print an aux entry. This returns trueif it has printed it. */2318 2319 static b oolean coff_print_aux2307 /* Print an aux entry. This returns TRUE if it has printed it. */ 2308 2309 static bfd_boolean coff_print_aux 2320 2310 PARAMS ((bfd *, FILE *, combined_entry_type *, combined_entry_type *, 2321 2311 combined_entry_type *, unsigned int)); 2322 2312 2323 static b oolean2313 static bfd_boolean 2324 2314 coff_print_aux (abfd, file, table_base, symbol, aux, indaux) 2325 2315 bfd *abfd ATTRIBUTE_UNUSED; … … 2340 2330 { 2341 2331 BFD_ASSERT (! aux->fix_scnlen); 2342 fprintf (file, "val %5ld", aux->u.auxent.x_csect.x_scnlen.l); 2332 #ifdef XCOFF64 2333 fprintf (file, "val %5lld", aux->u.auxent.x_csect.x_scnlen.l); 2334 #else 2335 fprintf (file, "val %5ld", (long) aux->u.auxent.x_csect.x_scnlen.l); 2336 #endif 2343 2337 } 2344 2338 else … … 2346 2340 fprintf (file, "indx "); 2347 2341 if (! aux->fix_scnlen) 2348 fprintf (file, "%4ld", aux->u.auxent.x_csect.x_scnlen.l); 2342 #ifdef XCOFF64 2343 fprintf (file, "%4lld", aux->u.auxent.x_csect.x_scnlen.l); 2344 #else 2345 fprintf (file, "%4ld", (long) aux->u.auxent.x_csect.x_scnlen.l); 2346 #endif 2349 2347 else 2350 2348 fprintf (file, "%4ld", … … 2360 2358 aux->u.auxent.x_csect.x_stab, 2361 2359 (unsigned int) aux->u.auxent.x_csect.x_snstab); 2362 return true;2363 } 2364 #endif 2365 2366 /* Return falseto indicate that no special action was taken. */2367 return false;2360 return TRUE; 2361 } 2362 #endif 2363 2364 /* Return FALSE to indicate that no special action was taken. */ 2365 return FALSE; 2368 2366 } 2369 2367 … … 2388 2386 static int compare_arelent_ptr PARAMS ((const PTR, const PTR)); 2389 2387 2390 /* AUX's ld wants relocations to be sorted */2388 /* AUX's ld wants relocations to be sorted. */ 2391 2389 static int 2392 2390 compare_arelent_ptr (x, y) … … 2404 2402 #endif /* TARG_AUX */ 2405 2403 2406 static b oolean2404 static bfd_boolean 2407 2405 coff_write_relocs (abfd, first_undef) 2408 2406 bfd * abfd; … … 2420 2418 p = s->orelocation; 2421 2419 #else 2422 /* sort relocations before we write them out */ 2423 p = (arelent **) bfd_malloc (s->reloc_count * sizeof (arelent *)); 2424 if (p == NULL && s->reloc_count > 0) 2425 return false; 2426 memcpy (p, s->orelocation, s->reloc_count * sizeof (arelent *)); 2427 qsort (p, s->reloc_count, sizeof (arelent *), compare_arelent_ptr); 2420 { 2421 /* Sort relocations before we write them out. */ 2422 bfd_size_type amt; 2423 2424 amt = s->reloc_count; 2425 amt *= sizeof (arelent *); 2426 p = (arelent **) bfd_malloc (amt); 2427 if (p == NULL && s->reloc_count > 0) 2428 return FALSE; 2429 memcpy (p, s->orelocation, (size_t) amt); 2430 qsort (p, s->reloc_count, sizeof (arelent *), compare_arelent_ptr); 2431 } 2428 2432 #endif 2429 2433 2430 2434 if (bfd_seek (abfd, s->rel_filepos, SEEK_SET) != 0) 2431 return false;2435 return FALSE; 2432 2436 2433 2437 #ifdef COFF_WITH_PE 2434 if ( s->reloc_count >0xffff)2438 if (obj_pe (abfd) && s->reloc_count >= 0xffff) 2435 2439 { 2436 /* encode real count here as first reloc*/2440 /* Encode real count here as first reloc. */ 2437 2441 struct internal_reloc n; 2442 2438 2443 memset ((PTR) & n, 0, sizeof (n)); 2439 /* add one to count *this* reloc (grr)*/2444 /* Add one to count *this* reloc (grr). */ 2440 2445 n.r_vaddr = s->reloc_count + 1; 2441 2446 coff_swap_reloc_out (abfd, &n, &dst); 2442 if (bfd_ write ((PTR) & dst, 1, bfd_coff_relsz (abfd), abfd)2443 2444 return false;2447 if (bfd_bwrite ((PTR) & dst, (bfd_size_type) bfd_coff_relsz (abfd), 2448 abfd) != bfd_coff_relsz (abfd)) 2449 return FALSE; 2445 2450 } 2446 2451 #endif … … 2450 2455 struct internal_reloc n; 2451 2456 arelent *q = p[i]; 2457 2452 2458 memset ((PTR) & n, 0, sizeof (n)); 2453 2459 … … 2464 2470 if (q->sym_ptr_ptr[0]->the_bfd != abfd) 2465 2471 { 2466 int i;2472 int j; 2467 2473 const char *sname = q->sym_ptr_ptr[0]->name; 2468 2474 asymbol **outsyms = abfd->outsymbols; 2469 for (i = first_undef; outsyms[i]; i++) 2475 2476 for (j = first_undef; outsyms[j]; j++) 2470 2477 { 2471 const char *intable = outsyms[i]->name; 2478 const char *intable = outsyms[j]->name; 2479 2472 2480 if (strcmp (intable, sname) == 0) { 2473 /* got a hit, so repoint the reloc*/2474 q->sym_ptr_ptr = outsyms + i;2481 /* Got a hit, so repoint the reloc. */ 2482 q->sym_ptr_ptr = outsyms + j; 2475 2483 break; 2476 2484 } … … 2493 2501 if (SECTION_RELATIVE_ABSOLUTE_SYMBOL_P (q,s)) 2494 2502 #else 2495 if (q->sym_ptr_ptr == bfd_abs_section_ptr->symbol_ptr_ptr) 2503 if ((*q->sym_ptr_ptr)->section == bfd_abs_section_ptr 2504 && ((*q->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0) 2496 2505 #endif 2497 2506 /* This is a relocation relative to the absolute symbol. */ … … 2513 2522 2514 2523 #ifdef SELECT_RELOC 2515 /* Work out reloc type from what is required */2524 /* Work out reloc type from what is required. */ 2516 2525 SELECT_RELOC (n, q->howto); 2517 2526 #else … … 2519 2528 #endif 2520 2529 coff_swap_reloc_out (abfd, &n, &dst); 2521 if (bfd_write ((PTR) & dst, 1, bfd_coff_relsz (abfd), abfd) 2522 != bfd_coff_relsz (abfd)) 2523 return false; 2530 2531 if (bfd_bwrite ((PTR) & dst, (bfd_size_type) bfd_coff_relsz (abfd), 2532 abfd) != bfd_coff_relsz (abfd)) 2533 return FALSE; 2524 2534 } 2525 2535 … … 2530 2540 } 2531 2541 2532 return true;2542 return TRUE; 2533 2543 } 2534 2544 2535 2545 /* Set flags and magic number of a coff file from architecture and machine 2536 type. Result is true if we can represent the arch&type, falseif not. */2537 2538 static b oolean2546 type. Result is TRUE if we can represent the arch&type, FALSE if not. */ 2547 2548 static bfd_boolean 2539 2549 coff_set_flags (abfd, magicp, flagsp) 2540 2550 bfd * abfd; … … 2556 2566 break; 2557 2567 default: 2558 return false;2568 return FALSE; 2559 2569 } 2560 return true;2570 return TRUE; 2561 2571 #endif 2562 2572 #ifdef I960ROMAGIC … … 2598 2608 break; 2599 2609 default: 2600 return false;2610 return FALSE; 2601 2611 } 2602 2612 *flagsp = flags; 2603 return true;2613 return TRUE; 2604 2614 } 2605 2615 break; … … 2609 2619 case bfd_arch_tic30: 2610 2620 *magicp = TIC30MAGIC; 2611 return true;2621 return TRUE; 2612 2622 #endif 2613 2623 2614 2624 #ifdef TICOFF_DEFAULT_MAGIC 2615 2625 case TICOFF_TARGET_ARCH: 2616 /* if there's no indication of which version we want, use the default*/2626 /* If there's no indication of which version we want, use the default. */ 2617 2627 if (!abfd->xvec ) 2618 2628 *magicp = TICOFF_DEFAULT_MAGIC; 2619 2629 else 2620 2630 { 2621 /* we may want to output in a different COFF version*/2631 /* We may want to output in a different COFF version. */ 2622 2632 switch (abfd->xvec->name[4]) 2623 2633 { … … 2632 2642 break; 2633 2643 default: 2634 return false;2644 return FALSE; 2635 2645 } 2636 2646 } 2637 return true; 2647 TICOFF_TARGET_MACHINE_SET (flagsp, bfd_get_mach (abfd)); 2648 return TRUE; 2638 2649 #endif 2639 2650 … … 2641 2652 case bfd_arch_tic80: 2642 2653 *magicp = TIC80_ARCH_MAGIC; 2643 return true;2654 return TRUE; 2644 2655 #endif 2645 2656 #ifdef ARMMAGIC … … 2673 2684 case bfd_mach_arm_4T: * flagsp |= F_ARM_4T; break; 2674 2685 case bfd_mach_arm_5: * flagsp |= F_ARM_5; break; 2675 /* FIXME: we do not have F_ARM vaues greater than F_ARM_5. */ 2686 /* FIXME: we do not have F_ARM vaues greater than F_ARM_5. 2687 See also the comment in coff_set_arch_mach_hook(). */ 2676 2688 case bfd_mach_arm_5T: * flagsp |= F_ARM_5; break; 2677 2689 case bfd_mach_arm_5TE: * flagsp |= F_ARM_5; break; 2678 2690 case bfd_mach_arm_XScale: * flagsp |= F_ARM_5; break; 2679 2691 } 2680 return true;2692 return TRUE; 2681 2693 #endif 2682 2694 #ifdef PPCMAGIC 2683 2695 case bfd_arch_powerpc: 2684 2696 *magicp = PPCMAGIC; 2685 return true;2697 return TRUE; 2686 2698 break; 2687 2699 #endif … … 2693 2705 *magicp = LYNXCOFFMAGIC; 2694 2706 #endif 2695 return true;2707 return TRUE; 2696 2708 break; 2697 2709 #endif … … 2699 2711 case bfd_arch_i860: 2700 2712 *magicp = I860MAGIC; 2701 return true;2713 return TRUE; 2702 2714 break; 2703 2715 #endif … … 2705 2717 case bfd_arch_ia64: 2706 2718 *magicp = IA64MAGIC; 2707 return true;2719 return TRUE; 2708 2720 break; 2709 2721 #endif … … 2724 2736 *magicp = LYNXCOFFMAGIC; 2725 2737 #endif 2726 return true;2738 return TRUE; 2727 2739 break; 2728 2740 #endif … … 2731 2743 case bfd_arch_m88k: 2732 2744 *magicp = MC88OMAGIC; 2733 return true;2745 return TRUE; 2734 2746 break; 2735 2747 #endif … … 2740 2752 case bfd_mach_h8300: 2741 2753 *magicp = H8300MAGIC; 2742 return true;2754 return TRUE; 2743 2755 case bfd_mach_h8300h: 2744 2756 *magicp = H8300HMAGIC; 2745 return true;2757 return TRUE; 2746 2758 case bfd_mach_h8300s: 2747 2759 *magicp = H8300SMAGIC; 2748 return true; 2760 return TRUE; 2761 case bfd_mach_h8300hn: 2762 *magicp = H8300HNMAGIC; 2763 return TRUE; 2764 case bfd_mach_h8300sn: 2765 *magicp = H8300SNMAGIC; 2766 return TRUE; 2749 2767 } 2750 2768 break; … … 2761 2779 *magicp = SH_ARCH_MAGIC_LITTLE; 2762 2780 #endif 2763 return true;2781 return TRUE; 2764 2782 break; 2765 2783 #endif … … 2768 2786 case bfd_arch_mips: 2769 2787 *magicp = MIPS_ARCH_MAGIC_WINCE; 2770 return true;2788 return TRUE; 2771 2789 break; 2772 2790 #endif … … 2779 2797 *magicp = LYNXCOFFMAGIC; 2780 2798 #endif 2781 return true;2799 return TRUE; 2782 2800 break; 2783 2801 #endif … … 2786 2804 case bfd_arch_h8500: 2787 2805 *magicp = H8500MAGIC; 2788 return true;2806 return TRUE; 2789 2807 break; 2790 2808 #endif … … 2795 2813 else 2796 2814 *magicp = A29K_MAGIC_LITTLE; 2797 return true;2815 return TRUE; 2798 2816 break; 2799 2817 #endif … … 2802 2820 case bfd_arch_we32k: 2803 2821 *magicp = WE32KMAGIC; 2804 return true;2822 return TRUE; 2805 2823 break; 2806 2824 #endif … … 2811 2829 case bfd_arch_powerpc: 2812 2830 #endif 2813 #ifdef XCOFF64 2814 if (bfd_get_mach (abfd) == bfd_mach_ppc_620 2815 && !strncmp (abfd->xvec->name,"aix", 3)) 2816 *magicp = U803XTOCMAGIC; 2817 else 2818 #else 2819 *magicp = U802TOCMAGIC; 2820 #endif 2821 return true; 2831 BFD_ASSERT (bfd_get_flavour (abfd) == bfd_target_xcoff_flavour); 2832 *magicp = bfd_xcoff_magic_number (abfd); 2833 return TRUE; 2822 2834 break; 2823 2835 #endif … … 2826 2838 case bfd_arch_mcore: 2827 2839 * magicp = MCOREMAGIC; 2828 return true;2840 return TRUE; 2829 2841 #endif 2830 2842 … … 2832 2844 case bfd_arch_w65: 2833 2845 *magicp = W65MAGIC; 2834 return true; 2846 return TRUE; 2847 #endif 2848 2849 #ifdef OR32_MAGIC_BIG 2850 case bfd_arch_or32: 2851 if (bfd_big_endian (abfd)) 2852 * magicp = OR32_MAGIC_BIG; 2853 else 2854 * magicp = OR32_MAGIC_LITTLE; 2855 return TRUE; 2835 2856 #endif 2836 2857 2837 2858 default: /* Unknown architecture. */ 2838 /* Fall through to "return false" below, to avoid2859 /* Fall through to "return FALSE" below, to avoid 2839 2860 "statement never reached" errors on the one below. */ 2840 2861 break; 2841 2862 } 2842 2863 2843 return false;2864 return FALSE; 2844 2865 } 2845 2866 2846 static b oolean2867 static bfd_boolean 2847 2868 coff_set_arch_mach (abfd, arch, machine) 2848 2869 bfd * abfd; … … 2854 2875 2855 2876 if (! bfd_default_set_arch_mach (abfd, arch, machine)) 2856 return false;2857 2858 if (arch != bfd_arch_unknown &&2859 coff_set_flags (abfd, &dummy1, &dummy2) != true)2860 return false; /* We can't represent this type */2861 2862 return true; /* We're easy ... */2877 return FALSE; 2878 2879 if (arch != bfd_arch_unknown 2880 && ! coff_set_flags (abfd, &dummy1, &dummy2)) 2881 return FALSE; /* We can't represent this type */ 2882 2883 return TRUE; /* We're easy ... */ 2863 2884 } 2864 2885 … … 2897 2918 #endif 2898 2919 2899 static b oolean2920 static bfd_boolean 2900 2921 coff_compute_section_file_positions (abfd) 2901 2922 bfd * abfd; … … 2904 2925 asection *previous = (asection *) NULL; 2905 2926 file_ptr sofar = bfd_coff_filhsz (abfd); 2906 b oolean align_adjust;2927 bfd_boolean align_adjust; 2907 2928 #ifdef ALIGN_SECTIONS_IN_FILE 2908 2929 file_ptr old_sofar; … … 2996 3017 target_index values right. */ 2997 3018 2998 int count;3019 unsigned int count; 2999 3020 asection **section_list; 3000 int i;3021 unsigned int i; 3001 3022 int target_index; 3023 bfd_size_type amt; 3002 3024 3003 3025 count = 0; … … 3006 3028 3007 3029 /* We allocate an extra cell to simplify the final loop. */ 3008 section_list = bfd_malloc (sizeof (struct asection *) * (count + 1)); 3030 amt = sizeof (struct asection *) * (count + 1); 3031 section_list = bfd_malloc (amt); 3009 3032 if (section_list == NULL) 3010 return false;3033 return FALSE; 3011 3034 3012 3035 i = 0; … … 3046 3069 current->target_index = target_index++; 3047 3070 } 3071 abfd->section_tail = ¤t->next; 3048 3072 3049 3073 free (section_list); … … 3060 3084 #endif /* ! COFF_IMAGE_WITH_PE */ 3061 3085 3062 align_adjust = false;3086 align_adjust = FALSE; 3063 3087 for (current = abfd->sections; 3064 3088 current != (asection *) NULL; … … 3070 3094 if (coff_section_data (abfd, current) == NULL) 3071 3095 { 3072 current->used_by_bfd =3073 (PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata));3096 bfd_size_type amt = sizeof (struct coff_section_tdata); 3097 current->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); 3074 3098 if (current->used_by_bfd == NULL) 3075 return false;3099 return FALSE; 3076 3100 } 3077 3101 if (pei_section_data (abfd, current) == NULL) 3078 3102 { 3079 coff_section_data (abfd, current)->tdata = 3080 (PTR) bfd_zalloc (abfd, sizeof (struct pei_section_tdata)); 3103 bfd_size_type amt = sizeof (struct pei_section_tdata); 3104 coff_section_data (abfd, current)->tdata 3105 = (PTR) bfd_zalloc (abfd, amt); 3081 3106 if (coff_section_data (abfd, current)->tdata == NULL) 3082 return false;3107 return FALSE; 3083 3108 } 3084 3109 if (pei_section_data (abfd, current)->virt_size == 0) … … 3103 3128 if ((abfd->flags & EXEC_P) != 0) 3104 3129 { 3105 /* make sure this section is aligned on the right boundary - by3106 padding the previous section up if necessary */3130 /* Make sure this section is aligned on the right boundary - by 3131 padding the previous section up if necessary. */ 3107 3132 3108 3133 old_sofar = sofar; 3109 sofar = BFD_ALIGN (sofar, 1 << current->alignment_power); 3134 #ifdef RS6000COFF_C 3135 /* AIX loader checks the text section alignment of (vma - filepos) 3136 So even though the filepos may be aligned wrt the o_algntext, for 3137 AIX executables, this check fails. This shows up when a native 3138 AIX executable is stripped with gnu strip because the default vma 3139 of native is 0x10000150 but default for gnu is 0x10000140. Gnu 3140 stripped gnu excutable passes this check because the filepos is 3141 0x0140. This problem also show up with 64 bit shared objects. The 3142 data section must also be aligned. */ 3143 if (!strcmp (current->name, _TEXT) 3144 || !strcmp (current->name, _DATA)) 3145 { 3146 bfd_vma pad; 3147 bfd_vma align; 3148 3149 sofar = BFD_ALIGN (sofar, 1 << current->alignment_power); 3150 3151 align = 1 << current->alignment_power; 3152 pad = abs (current->vma - sofar) % align; 3153 3154 if (pad) 3155 { 3156 pad = align - pad; 3157 sofar += pad; 3158 } 3159 } 3160 else 3161 #else 3162 { 3163 sofar = BFD_ALIGN (sofar, 1 << current->alignment_power); 3164 } 3165 #endif 3110 3166 if (previous != (asection *) NULL) 3111 { 3112 previous->_raw_size += sofar - old_sofar; 3113 } 3167 previous->_raw_size += sofar - old_sofar; 3114 3168 } 3115 3169 … … 3133 3187 3134 3188 #ifdef ALIGN_SECTIONS_IN_FILE 3135 /* make sure that this section is of the right size too*/3189 /* Make sure that this section is of the right size too. */ 3136 3190 if ((abfd->flags & EXEC_P) == 0) 3137 3191 { … … 3158 3212 unaligned _raw_size. */ 3159 3213 if (pei_section_data (abfd, current)->virt_size < current->_raw_size) 3160 align_adjust = true;3214 align_adjust = TRUE; 3161 3215 #endif 3162 3216 … … 3183 3237 b = 0; 3184 3238 if (bfd_seek (abfd, sofar - 1, SEEK_SET) != 0 3185 || bfd_ write (&b, 1,1, abfd) != 1)3186 return false;3239 || bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1) 3240 return FALSE; 3187 3241 } 3188 3242 … … 3193 3247 3194 3248 obj_relocbase (abfd) = sofar; 3195 abfd->output_has_begun = true;3196 3197 return true;3249 abfd->output_has_begun = TRUE; 3250 3251 return TRUE; 3198 3252 } 3199 3253 … … 3207 3261 /* @@ Should we only be adding missing symbols, or overriding the aux 3208 3262 values for existing section symbols? */ 3209 static b oolean3263 static bfd_boolean 3210 3264 coff_add_missing_symbols (abfd) 3211 3265 bfd *abfd; … … 3216 3270 unsigned int i; 3217 3271 int need_text = 1, need_data = 1, need_bss = 1, need_file = 1; 3272 bfd_size_type amt; 3218 3273 3219 3274 for (i = 0; i < nsyms; i++) 3220 3275 { 3221 3276 coff_symbol_type *csym = coff_symbol_from (abfd, sympp[i]); 3222 CONST char *name; 3277 const char *name; 3278 3223 3279 if (csym) 3224 3280 { 3225 /* only do this if there is a coff representation of the input3226 symbol*/3281 /* Only do this if there is a coff representation of the input 3282 symbol. */ 3227 3283 if (csym->native && csym->native->u.syment.n_sclass == C_FILE) 3228 3284 { … … 3250 3306 3251 3307 if (!need_text && !need_data && !need_bss && !need_file) 3252 return true;3308 return TRUE; 3253 3309 nsyms += need_text + need_data + need_bss + need_file; 3254 sympp2 = (asymbol **) bfd_alloc (abfd, nsyms * sizeof (asymbol *)); 3310 amt = nsyms; 3311 amt *= sizeof (asymbol *); 3312 sympp2 = (asymbol **) bfd_alloc (abfd, amt); 3255 3313 if (!sympp2) 3256 return false;3314 return FALSE; 3257 3315 memcpy (sympp2, sympp, i * sizeof (asymbol *)); 3316 3258 3317 if (need_file) 3259 { 3260 /* @@ Generate fake .file symbol, in sympp2[i], and increment i. */ 3261 abort (); 3262 } 3318 /* @@ Generate fake .file symbol, in sympp2[i], and increment i. */ 3319 abort (); 3320 3263 3321 if (need_text) 3264 3322 sympp2[i++] = coff_section_symbol (abfd, _TEXT); … … 3269 3327 BFD_ASSERT (i == nsyms); 3270 3328 bfd_set_symtab (abfd, sympp2, nsyms); 3271 return true;3329 return TRUE; 3272 3330 } 3273 3331 3274 3332 #endif /* 0 */ 3333 3334 #ifdef COFF_IMAGE_WITH_PE 3335 3336 static unsigned int pelength; 3337 static unsigned int peheader; 3338 3339 static bfd_boolean 3340 coff_read_word (abfd, value) 3341 bfd *abfd; 3342 unsigned int *value; 3343 { 3344 unsigned char b[2]; 3345 int status; 3346 3347 status = bfd_bread (b, (bfd_size_type) 2, abfd); 3348 if (status < 1) 3349 { 3350 *value = 0; 3351 return FALSE; 3352 } 3353 3354 if (status == 1) 3355 *value = (unsigned int) b[0]; 3356 else 3357 *value = (unsigned int) (b[0] + (b[1] << 8)); 3358 3359 pelength += (unsigned int) status; 3360 3361 return TRUE; 3362 } 3363 3364 static unsigned int 3365 coff_compute_checksum (abfd) 3366 bfd *abfd; 3367 { 3368 bfd_boolean more_data; 3369 file_ptr filepos; 3370 unsigned int value; 3371 unsigned int total; 3372 3373 total = 0; 3374 pelength = 0; 3375 filepos = (file_ptr) 0; 3376 3377 do 3378 { 3379 if (bfd_seek (abfd, filepos, SEEK_SET) != 0) 3380 return 0; 3381 3382 more_data = coff_read_word (abfd, &value); 3383 total += value; 3384 total = 0xffff & (total + (total >> 0x10)); 3385 filepos += 2; 3386 } 3387 while (more_data); 3388 3389 return (0xffff & (total + (total >> 0x10))); 3390 } 3391 3392 static bfd_boolean 3393 coff_apply_checksum (abfd) 3394 bfd *abfd; 3395 { 3396 unsigned int computed; 3397 unsigned int checksum = 0; 3398 3399 if (bfd_seek (abfd, 0x3c, SEEK_SET) != 0) 3400 return FALSE; 3401 3402 if (!coff_read_word (abfd, &peheader)) 3403 return FALSE; 3404 3405 if (bfd_seek (abfd, peheader + 0x58, SEEK_SET) != 0) 3406 return FALSE; 3407 3408 checksum = 0; 3409 bfd_bwrite (&checksum, (bfd_size_type) 4, abfd); 3410 3411 if (bfd_seek (abfd, peheader, SEEK_SET) != 0) 3412 return FALSE; 3413 3414 computed = coff_compute_checksum (abfd); 3415 3416 checksum = computed + pelength; 3417 3418 if (bfd_seek (abfd, peheader + 0x58, SEEK_SET) != 0) 3419 return FALSE; 3420 3421 bfd_bwrite (&checksum, (bfd_size_type) 4, abfd); 3422 3423 return TRUE; 3424 } 3425 3426 #endif /* COFF_IMAGE_WITH_PE */ 3275 3427 3276 3428 /* SUPPRESS 558 */ 3277 3429 /* SUPPRESS 529 */ 3278 static b oolean3430 static bfd_boolean 3279 3431 coff_write_object_contents (abfd) 3280 3432 bfd * abfd; 3281 3433 { 3282 3434 asection *current; 3283 b oolean hasrelocs = false;3284 b oolean haslinno = false;3285 b oolean hasdebug = false;3435 bfd_boolean hasrelocs = FALSE; 3436 bfd_boolean haslinno = FALSE; 3437 bfd_boolean hasdebug = FALSE; 3286 3438 file_ptr scn_base; 3287 3439 file_ptr reloc_base; … … 3290 3442 unsigned long reloc_size = 0, reloc_count = 0; 3291 3443 unsigned long lnno_size = 0; 3292 b oolean long_section_names;3444 bfd_boolean long_section_names; 3293 3445 asection *text_sec = NULL; 3294 3446 asection *data_sec = NULL; … … 3303 3455 3304 3456 /* Make a pass through the symbol table to count line number entries and 3305 put them into the correct asections */3457 put them into the correct asections. */ 3306 3458 3307 3459 lnno_size = coff_count_linenumbers (abfd) * bfd_coff_linesz (abfd); 3308 3460 3309 if ( abfd->output_has_begun == false)3461 if (! abfd->output_has_begun) 3310 3462 { 3311 3463 if (! coff_compute_section_file_positions (abfd)) 3312 return false;3464 return FALSE; 3313 3465 } 3314 3466 3315 3467 reloc_base = obj_relocbase (abfd); 3316 3468 3317 /* Work out the size of the reloc and linno areas */3469 /* Work out the size of the reloc and linno areas. */ 3318 3470 3319 3471 for (current = abfd->sections; current != NULL; current = … … 3321 3473 { 3322 3474 #ifdef COFF_WITH_PE 3323 /* we store the actual reloc count in the first reloc's addr*/3324 if ( current->reloc_count >0xffff)3475 /* We store the actual reloc count in the first reloc's addr. */ 3476 if (obj_pe (abfd) && current->reloc_count >= 0xffff) 3325 3477 reloc_count ++; 3326 3478 #endif … … 3333 3485 sym_base = lineno_base + lnno_size; 3334 3486 3335 /* Indicate in each section->line_filepos its actual file address */3487 /* Indicate in each section->line_filepos its actual file address. */ 3336 3488 for (current = abfd->sections; current != NULL; current = 3337 3489 current->next) … … 3352 3504 reloc_base += current->reloc_count * bfd_coff_relsz (abfd); 3353 3505 #ifdef COFF_WITH_PE 3354 /* extra reloc to hold real count*/3355 if ( current->reloc_count >0xffff)3506 /* Extra reloc to hold real count. */ 3507 if (obj_pe (abfd) && current->reloc_count >= 0xffff) 3356 3508 reloc_base += bfd_coff_relsz (abfd); 3357 3509 #endif … … 3372 3524 scn_base = bfd_coff_filhsz (abfd); 3373 3525 #ifdef RS6000COFF_C 3526 #ifndef XCOFF64 3374 3527 if (xcoff_data (abfd)->full_aouthdr) 3375 3528 scn_base += bfd_coff_aoutsz (abfd); … … 3377 3530 scn_base += SMALL_AOUTSZ; 3378 3531 #endif 3532 #endif 3379 3533 } 3380 3534 3381 3535 if (bfd_seek (abfd, scn_base, SEEK_SET) != 0) 3382 return false;3383 3384 long_section_names = false;3536 return FALSE; 3537 3538 long_section_names = FALSE; 3385 3539 for (current = abfd->sections; 3386 3540 current != NULL; … … 3388 3542 { 3389 3543 struct internal_scnhdr section; 3390 b oolean is_reloc_section = false;3544 bfd_boolean is_reloc_section = FALSE; 3391 3545 3392 3546 #ifdef COFF_IMAGE_WITH_PE 3393 3547 if (strcmp (current->name, ".reloc") == 0) 3394 3548 { 3395 is_reloc_section = true;3396 hasrelocs = true;3549 is_reloc_section = TRUE; 3550 hasrelocs = TRUE; 3397 3551 pe_data (abfd)->has_reloc_section = 1; 3398 3552 } … … 3415 3569 sprintf (section.s_name, "/%lu", (unsigned long) string_size); 3416 3570 string_size += len + 1; 3417 long_section_names = true;3571 long_section_names = TRUE; 3418 3572 } 3419 3573 } … … 3446 3600 #endif 3447 3601 3448 /* 3449 If this section has no size or is unloadable then the scnptr 3450 will be 0 too 3451 */ 3602 /* If this section has no size or is unloadable then the scnptr 3603 will be 0 too. */ 3452 3604 if (current->_raw_size == 0 || 3453 3605 (current->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0) 3454 { 3455 section.s_scnptr = 0; 3456 } 3606 section.s_scnptr = 0; 3457 3607 else 3458 { 3459 section.s_scnptr = current->filepos; 3460 } 3608 section.s_scnptr = current->filepos; 3609 3461 3610 section.s_relptr = current->rel_filepos; 3462 3611 section.s_lnnoptr = current->line_filepos; … … 3466 3615 /* In PEI, relocs come in the .reloc section. */ 3467 3616 if (current->reloc_count != 0) 3468 hasrelocs = true;3617 hasrelocs = TRUE; 3469 3618 #endif 3470 3619 if (current->lineno_count != 0) 3471 haslinno = true;3620 haslinno = TRUE; 3472 3621 if ((current->flags & SEC_DEBUGGING) != 0 3473 3622 && ! is_reloc_section) 3474 hasdebug = true;3623 hasdebug = TRUE; 3475 3624 3476 3625 #ifdef RS6000COFF_C … … 3488 3637 3489 3638 if (!strcmp (current->name, _TEXT)) 3490 { 3491 text_sec = current; 3492 } 3639 text_sec = current; 3493 3640 else if (!strcmp (current->name, _DATA)) 3494 { 3495 data_sec = current; 3496 } 3641 data_sec = current; 3497 3642 else if (!strcmp (current->name, _BSS)) 3498 { 3499 bss_sec = current; 3500 } 3643 bss_sec = current; 3501 3644 3502 3645 #ifdef I960 … … 3506 3649 #endif 3507 3650 #ifdef TIC80COFF 3508 /* TI COFF puts the alignment power in bits 8-11 of the flags */3651 /* TI COFF puts the alignment power in bits 8-11 of the flags. */ 3509 3652 section.s_flags |= (current->alignment_power & 0xF) << 8; 3510 3653 #endif … … 3525 3668 { 3526 3669 SCNHDR buff; 3670 bfd_size_type amt = bfd_coff_scnhsz (abfd); 3671 3527 3672 if (coff_swap_scnhdr_out (abfd, §ion, &buff) == 0 3528 || bfd_write ((PTR) (&buff), 1, bfd_coff_scnhsz (abfd), abfd) 3529 != bfd_coff_scnhsz (abfd)) 3530 return false; 3673 || bfd_bwrite ((PTR) &buff, amt, abfd) != amt) 3674 return FALSE; 3531 3675 } 3532 3676 … … 3627 3771 3628 3772 #ifdef RS6000COFF_C 3773 #ifndef XCOFF64 3629 3774 /* XCOFF handles overflows in the reloc and line number count fields 3630 3775 by creating a new section header to hold the correct values. */ … … 3635 3780 struct internal_scnhdr scnhdr; 3636 3781 SCNHDR buff; 3782 bfd_size_type amt; 3637 3783 3638 3784 internal_f.f_nscns++; … … 3647 3793 scnhdr.s_nlnno = current->target_index; 3648 3794 scnhdr.s_flags = STYP_OVRFLO; 3795 amt = bfd_coff_scnhsz (abfd); 3649 3796 if (coff_swap_scnhdr_out (abfd, &scnhdr, &buff) == 0 3650 || bfd_write ((PTR) &buff, 1, bfd_coff_scnhsz (abfd), abfd) 3651 != bfd_coff_scnhsz (abfd)) 3652 return false; 3797 || bfd_bwrite ((PTR) &buff, amt, abfd) != amt) 3798 return FALSE; 3653 3799 } 3654 3800 } 3655 3801 #endif 3802 #endif 3656 3803 3657 3804 /* OK, now set up the filehdr... */ … … 3659 3806 /* Don't include the internal abs section in the section count */ 3660 3807 3661 /* 3662 We will NOT put a fucking timestamp in the header here. Every time you 3808 /* We will NOT put a fucking timestamp in the header here. Every time you 3663 3809 put it back, I will come in and take it out again. I'm sorry. This 3664 3810 field does not belong here. We fill it with a 0 so it compares the 3665 same but is not a reasonable time. -- gnu@cygnus.com 3666 */ 3811 same but is not a reasonable time. -- gnu@cygnus.com */ 3667 3812 internal_f.f_timdat = 0; 3668 3669 3813 internal_f.f_flags = 0; 3670 3814 … … 3675 3819 internal_f.f_opthdr = 0; 3676 3820 #ifdef RS6000COFF_C 3821 #ifndef XCOFF64 3677 3822 if (xcoff_data (abfd)->full_aouthdr) 3678 3823 internal_f.f_opthdr = bfd_coff_aoutsz (abfd); 3679 3824 else 3680 3825 internal_f.f_opthdr = SMALL_AOUTSZ; 3826 #endif 3681 3827 #endif 3682 3828 } … … 3701 3847 3702 3848 #ifdef TI_TARGET_ID 3703 /* target id is used in TI COFF v1 and later; COFF0 won't use this field,3704 but it doesn't hurt to set it internally */3849 /* Target id is used in TI COFF v1 and later; COFF0 won't use this field, 3850 but it doesn't hurt to set it internally. */ 3705 3851 internal_f.f_target_id = TI_TARGET_ID; 3706 3852 #endif … … 3709 3855 #endif 3710 3856 3711 /* 3712 FIXME, should do something about the other byte orders and 3713 architectures. 3714 */ 3857 /* FIXME, should do something about the other byte orders and 3858 architectures. */ 3715 3859 3716 3860 #ifdef RS6000COFF_C … … 3723 3867 memset (&internal_a, 0, sizeof internal_a); 3724 3868 3725 /* Set up architecture-dependent stuff */ 3726 3869 /* Set up architecture-dependent stuff. */ 3727 3870 { 3728 3871 unsigned int magic = 0; 3729 3872 unsigned short flags = 0; 3873 3730 3874 coff_set_flags (abfd, &magic, &flags); 3731 3875 internal_f.f_magic = magic; … … 3736 3880 #ifdef ULTRA3 /* NYU's machine */ 3737 3881 /* FIXME: This is a bogus check. I really want to see if there 3738 * is a .shbss or a .shdata section, if so then set the magic 3739 * number to indicate a shared data executable. 3740 */ 3882 is a .shbss or a .shdata section, if so then set the magic 3883 number to indicate a shared data executable. */ 3741 3884 if (internal_f.f_nscns >= 7) 3742 internal_a.magic = SHMAGIC; /* Shared magic */3885 internal_a.magic = SHMAGIC; /* Shared magic. */ 3743 3886 else 3744 3887 #endif /* ULTRA3 */ 3745 internal_a.magic = NMAGIC; /* Assume separate i/d */3888 internal_a.magic = NMAGIC; /* Assume separate i/d. */ 3746 3889 #define __A_MAGIC_SET__ 3747 3890 #endif /* A29K */ … … 3843 3986 #endif 3844 3987 3988 #ifdef OR32 3989 #define __A_MAGIC_SET__ 3990 internal_a.magic = NMAGIC; /* Assume separate i/d. */ 3991 #endif 3992 3845 3993 #ifndef __A_MAGIC_SET__ 3846 3994 #include "Your aouthdr magic number is not being set!" … … 3853 4001 internal_a.vstamp = 0; 3854 4002 3855 /* Now should write relocs, strings, syms */4003 /* Now should write relocs, strings, syms. */ 3856 4004 obj_sym_filepos (abfd) = sym_base; 3857 4005 … … 3861 4009 #if 0 3862 4010 if (!coff_add_missing_symbols (abfd)) 3863 return false;4011 return FALSE; 3864 4012 #endif 3865 4013 if (!coff_renumber_symbols (abfd, &firstundef)) 3866 return false;4014 return FALSE; 3867 4015 coff_mangle_symbols (abfd); 3868 4016 if (! coff_write_symbols (abfd)) 3869 return false;4017 return FALSE; 3870 4018 if (! coff_write_linenumbers (abfd)) 3871 return false;4019 return FALSE; 3872 4020 if (! coff_write_relocs (abfd, firstundef)) 3873 return false;4021 return FALSE; 3874 4022 } 3875 4023 #ifdef COFF_LONG_SECTION_NAMES … … 3879 4027 table even if there are no symbols. */ 3880 4028 if (! coff_write_symbols (abfd)) 3881 return false;4029 return FALSE; 3882 4030 } 3883 4031 #endif … … 3892 4040 b = 0; 3893 4041 if (bfd_seek (abfd, 3894 BFD_ALIGN (sym_base, COFF_PAGE_SIZE) - 1,4042 (file_ptr) BFD_ALIGN (sym_base, COFF_PAGE_SIZE) - 1, 3895 4043 SEEK_SET) != 0 3896 || bfd_ write (&b, 1,1, abfd) != 1)3897 return false;4044 || bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1) 4045 return FALSE; 3898 4046 } 3899 4047 #endif … … 3998 4146 break; 3999 4147 case bfd_arch_powerpc: 4000 if (bfd_get_mach (abfd) == 0)4148 if (bfd_get_mach (abfd) == bfd_mach_ppc) 4001 4149 internal_a.o_cputype = 3; 4002 4150 else … … 4014 4162 /* now write them */ 4015 4163 if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) 4016 return false;4164 return FALSE; 4017 4165 4018 4166 { 4019 4167 char * buff; 4020 bfd_size_type amount ;4021 4022 buff = bfd_malloc ( bfd_coff_filhsz (abfd));4168 bfd_size_type amount = bfd_coff_filhsz (abfd); 4169 4170 buff = bfd_malloc (amount); 4023 4171 if (buff == NULL) 4024 return false;4025 4026 bfd_coff_swap_filehdr_out (abfd, (PTR) & 4027 amount = bfd_ write ((PTR) buff, 1, bfd_coff_filhsz (abfd), abfd);4172 return FALSE; 4173 4174 bfd_coff_swap_filehdr_out (abfd, (PTR) &internal_f, (PTR) buff); 4175 amount = bfd_bwrite ((PTR) buff, amount, abfd); 4028 4176 4029 4177 free (buff); 4030 4178 4031 4179 if (amount != bfd_coff_filhsz (abfd)) 4032 return false;4180 return FALSE; 4033 4181 } 4034 4182 … … 4036 4184 { 4037 4185 /* Note that peicode.h fills in a PEAOUTHDR, not an AOUTHDR. 4038 include/coff/pe.h sets AOUTSZ == sizeof (PEAOUTHDR)) */4186 include/coff/pe.h sets AOUTSZ == sizeof (PEAOUTHDR)). */ 4039 4187 char * buff; 4040 bfd_size_type amount ;4041 4042 buff = bfd_malloc ( bfd_coff_aoutsz (abfd));4188 bfd_size_type amount = bfd_coff_aoutsz (abfd); 4189 4190 buff = bfd_malloc (amount); 4043 4191 if (buff == NULL) 4044 return false;4045 4046 coff_swap_aouthdr_out (abfd, (PTR) & 4047 amount = bfd_ write ((PTR) buff, 1, bfd_coff_aoutsz (abfd), abfd);4192 return FALSE; 4193 4194 coff_swap_aouthdr_out (abfd, (PTR) &internal_a, (PTR) buff); 4195 amount = bfd_bwrite ((PTR) buff, amount, abfd); 4048 4196 4049 4197 free (buff); 4050 4198 4051 4199 if (amount != bfd_coff_aoutsz (abfd)) 4052 return false; 4200 return FALSE; 4201 4202 #ifdef COFF_IMAGE_WITH_PE 4203 if (! coff_apply_checksum (abfd)) 4204 return FALSE; 4205 #endif 4053 4206 } 4054 4207 #ifdef RS6000COFF_C … … 4064 4217 else 4065 4218 size = SMALL_AOUTSZ; 4066 if (bfd_ write ((PTR) &buff, 1,size, abfd) != size)4067 return false;4068 } 4069 #endif 4070 4071 return true;4219 if (bfd_bwrite ((PTR) &buff, (bfd_size_type) size, abfd) != size) 4220 return FALSE; 4221 } 4222 #endif 4223 4224 return TRUE; 4072 4225 } 4073 4226 4074 static b oolean4227 static bfd_boolean 4075 4228 coff_set_section_contents (abfd, section, location, offset, count) 4076 4229 bfd * abfd; … … 4080 4233 bfd_size_type count; 4081 4234 { 4082 if ( abfd->output_has_begun == false) /* set by bfd.c handler*/4235 if (! abfd->output_has_begun) /* Set by bfd.c handler. */ 4083 4236 { 4084 4237 if (! coff_compute_section_file_positions (abfd)) 4085 return false;4238 return FALSE; 4086 4239 } 4087 4240 … … 4107 4260 <robertl@arnet.com> (Thanks!). 4108 4261 4109 Gvran Uddeborg <gvran@uddeborg.pp.se> */4262 Gvran Uddeborg <gvran@uddeborg.pp.se>. */ 4110 4263 4111 4264 if (strcmp (section->name, _LIB) == 0) … … 4129 4282 see if the filepos has not been set. */ 4130 4283 if (section->filepos == 0) 4131 return true; 4132 4133 if (bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) != 0) 4134 return false; 4135 4136 if (count != 0) 4137 { 4138 return (bfd_write (location, 1, count, abfd) == count) ? true : false; 4139 } 4140 return true; 4284 return TRUE; 4285 4286 if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0) 4287 return FALSE; 4288 4289 if (count == 0) 4290 return TRUE; 4291 4292 return bfd_bwrite (location, count, abfd) == count; 4141 4293 } 4142 4294 #if 0 4143 static b oolean4295 static bfd_boolean 4144 4296 coff_close_and_cleanup (abfd) 4145 4297 bfd *abfd; … … 4150 4302 case bfd_archive: 4151 4303 if (!_bfd_write_archive_contents (abfd)) 4152 return false;4304 return FALSE; 4153 4305 break; 4154 4306 case bfd_object: 4155 4307 if (!coff_write_object_contents (abfd)) 4156 return false;4308 return FALSE; 4157 4309 break; 4158 4310 default: 4159 4311 bfd_set_error (bfd_error_invalid_operation); 4160 return false;4312 return FALSE; 4161 4313 } 4162 4314 4163 4315 /* We depend on bfd_close to free all the memory on the objalloc. */ 4164 return true;4316 return TRUE; 4165 4317 } 4166 4318 … … 4168 4320 4169 4321 static PTR 4170 buy_and_read (abfd, where, s eek_direction, size)4322 buy_and_read (abfd, where, size) 4171 4323 bfd *abfd; 4172 4324 file_ptr where; 4173 int seek_direction; 4174 size_t size; 4325 bfd_size_type size; 4175 4326 { 4176 4327 PTR area = (PTR) bfd_alloc (abfd, size); 4177 4328 if (!area) 4178 4329 return (NULL); 4179 if (bfd_seek (abfd, where, seek_direction) != 04180 || bfd_ read (area, 1, size, abfd) != size)4330 if (bfd_seek (abfd, where, SEEK_SET) != 0 4331 || bfd_bread (area, size, abfd) != size) 4181 4332 return (NULL); 4182 4333 return (area); … … 4207 4358 */ 4208 4359 4209 static b oolean4360 static bfd_boolean 4210 4361 coff_slurp_line_table (abfd, asect) 4211 4362 bfd *abfd; … … 4214 4365 LINENO *native_lineno; 4215 4366 alent *lineno_cache; 4367 bfd_size_type amt; 4216 4368 4217 4369 BFD_ASSERT (asect->lineno == (alent *) NULL); 4218 4370 4219 native_lineno = (LINENO *) buy_and_read (abfd, 4220 asect->line_filepos, 4221 SEEK_SET, 4222 (size_t) (bfd_coff_linesz (abfd) * 4223 asect->lineno_count)); 4224 lineno_cache = 4225 (alent *) bfd_alloc (abfd, (size_t) ((asect->lineno_count + 1) * sizeof (alent))); 4371 amt = (bfd_size_type) bfd_coff_linesz (abfd) * asect->lineno_count; 4372 native_lineno = (LINENO *) buy_and_read (abfd, asect->line_filepos, amt); 4373 amt = ((bfd_size_type) asect->lineno_count + 1) * sizeof (alent); 4374 lineno_cache = (alent *) bfd_alloc (abfd, amt); 4226 4375 if (lineno_cache == NULL) 4227 return false;4376 return FALSE; 4228 4377 else 4229 4378 { … … 4235 4384 { 4236 4385 struct internal_lineno dst; 4386 4237 4387 bfd_coff_swap_lineno_in (abfd, src, &dst); 4238 4388 cache_ptr->line_number = dst.l_lnno; … … 4240 4390 if (cache_ptr->line_number == 0) 4241 4391 { 4242 b oolean warned;4243 longsymndx;4392 bfd_boolean warned; 4393 bfd_signed_vma symndx; 4244 4394 coff_symbol_type *sym; 4245 4395 4246 warned = false;4396 warned = FALSE; 4247 4397 symndx = dst.l_addr.l_symndx; 4248 4398 if (symndx < 0 4249 || ( unsigned long) symndx >= obj_raw_syment_count (abfd))4399 || (bfd_vma) symndx >= obj_raw_syment_count (abfd)) 4250 4400 { 4251 4401 (*_bfd_error_handler) 4252 4402 (_("%s: warning: illegal symbol index %ld in line numbers"), 4253 bfd_ get_filename (abfd), dst.l_addr.l_symndx);4403 bfd_archive_filename (abfd), dst.l_addr.l_symndx); 4254 4404 symndx = 0; 4255 warned = true;4405 warned = TRUE; 4256 4406 } 4257 4407 /* FIXME: We should not be casting between ints and … … 4265 4415 (*_bfd_error_handler) 4266 4416 (_("%s: warning: duplicate line number information for `%s'"), 4267 bfd_ get_filename (abfd),4417 bfd_archive_filename (abfd), 4268 4418 bfd_asymbol_name (&sym->symbol)); 4269 4419 } … … 4285 4435 asect->lineno = lineno_cache; 4286 4436 /* FIXME, free native_lineno here, or use alloca or something. */ 4287 return true;4437 return TRUE; 4288 4438 } 4289 4439 … … 4292 4442 symbols via coff_link_add_symbols, rather than via this routine. */ 4293 4443 4294 static b oolean4444 static bfd_boolean 4295 4445 coff_slurp_symbol_table (abfd) 4296 4446 bfd * abfd; … … 4299 4449 coff_symbol_type *cached_area; 4300 4450 unsigned int *table_ptr; 4301 4451 bfd_size_type amt; 4302 4452 unsigned int number_of_symbols = 0; 4303 4453 4304 4454 if (obj_symbols (abfd)) 4305 return true;4306 4307 /* Read in the symbol table */4455 return TRUE; 4456 4457 /* Read in the symbol table. */ 4308 4458 if ((native_symbols = coff_get_normalized_symtab (abfd)) == NULL) 4309 { 4310 return (false); 4311 } /* on error */ 4312 4313 /* Allocate enough room for all the symbols in cached form */ 4314 cached_area = ((coff_symbol_type *) 4315 bfd_alloc (abfd, 4316 (obj_raw_syment_count (abfd) 4317 * sizeof (coff_symbol_type)))); 4318 4459 return FALSE; 4460 4461 /* Allocate enough room for all the symbols in cached form. */ 4462 amt = obj_raw_syment_count (abfd); 4463 amt *= sizeof (coff_symbol_type); 4464 cached_area = (coff_symbol_type *) bfd_alloc (abfd, amt); 4319 4465 if (cached_area == NULL) 4320 return false;4321 table_ptr = ((unsigned int *) 4322 bfd_alloc (abfd, 4323 (obj_raw_syment_count (abfd) 4324 * sizeof (unsigned int))));4466 return FALSE; 4467 4468 amt = obj_raw_syment_count (abfd); 4469 amt *= sizeof (unsigned int); 4470 table_ptr = (unsigned int *) bfd_alloc (abfd, amt); 4325 4471 4326 4472 if (table_ptr == NULL) 4327 return false;4473 return FALSE; 4328 4474 else 4329 4475 { … … 4331 4477 unsigned int last_native_index = obj_raw_syment_count (abfd); 4332 4478 unsigned int this_index = 0; 4479 4333 4480 while (this_index < last_native_index) 4334 4481 { … … 4343 4490 src->u.syment.n_scnum); 4344 4491 dst->symbol.flags = 0; 4345 dst->done_lineno = false;4492 dst->done_lineno = FALSE; 4346 4493 4347 4494 switch (src->u.syment.n_sclass) … … 4354 4501 dst->symbol.flags |= BSF_NOT_AT_END | BSF_FUNCTION; 4355 4502 #endif 4356 /* Fall through to next case */ 4357 4503 /* Fall through to next case. */ 4358 4504 #endif 4359 4505 … … 4368 4514 #endif 4369 4515 #ifdef C_SYSTEM 4370 case C_SYSTEM: /* System Wide variable */4516 case C_SYSTEM: /* System Wide variable. */ 4371 4517 #endif 4372 4518 #ifdef COFF_WITH_PE 4373 /* In PE, 0x68 (104) denotes a section symbol */4519 /* In PE, 0x68 (104) denotes a section symbol. */ 4374 4520 case C_SECTION: 4375 4521 /* In PE, 0x69 (105) denotes a weak external symbol. */ … … 4434 4580 #ifdef COFF_WITH_PE 4435 4581 if (src->u.syment.n_sclass == C_NT_WEAK) 4436 dst->symbol.flags = BSF_WEAK; 4582 dst->symbol.flags |= BSF_WEAK; 4583 4437 4584 if (src->u.syment.n_sclass == C_SECTION 4438 4585 && src->u.syment.n_scnum > 0) 4439 { 4440 dst->symbol.flags = BSF_LOCAL; 4441 } 4442 #endif 4443 4586 dst->symbol.flags = BSF_LOCAL; 4587 #endif 4444 4588 if (src->u.syment.n_sclass == C_WEAKEXT) 4445 dst->symbol.flags = BSF_WEAK;4589 dst->symbol.flags |= BSF_WEAK; 4446 4590 4447 4591 break; 4448 4592 4449 case C_STAT: /* static*/4593 case C_STAT: /* Static. */ 4450 4594 #ifdef I960 4451 case C_LEAFSTAT: /* static leaf procedure*/4595 case C_LEAFSTAT: /* Static leaf procedure. */ 4452 4596 #endif 4453 4597 #if defined ARM 4454 case C_THUMBSTAT: /* Thumb static*/4455 case C_THUMBLABEL: /* Thumb label*/4456 case C_THUMBSTATFUNC:/* Thumb static function 4457 #endif 4458 case C_LABEL: /* label*/4598 case C_THUMBSTAT: /* Thumb static. */ 4599 case C_THUMBLABEL: /* Thumb label. */ 4600 case C_THUMBSTATFUNC:/* Thumb static function. */ 4601 #endif 4602 case C_LABEL: /* Label. */ 4459 4603 if (src->u.syment.n_scnum == N_DEBUG) 4460 4604 dst->symbol.flags = BSF_DEBUGGING; … … 4479 4623 break; 4480 4624 4481 case C_MOS: /* member of structure*/4482 case C_EOS: /* end of structure*/4483 #ifdef NOTDEF /* C_AUTOARG has the same value */4625 case C_MOS: /* Member of structure. */ 4626 case C_EOS: /* End of structure. */ 4627 #ifdef NOTDEF /* C_AUTOARG has the same value. */ 4484 4628 #ifdef C_GLBLREG 4485 case C_GLBLREG: /* A29k-specific storage class */4486 #endif 4487 #endif 4488 case C_REGPARM: /* register parameter*/4489 case C_REG: /* register variable*/4490 /* C_AUTOARG conflictes with TI COFF C_UEXT */4629 case C_GLBLREG: /* A29k-specific storage class. */ 4630 #endif 4631 #endif 4632 case C_REGPARM: /* Register parameter. */ 4633 case C_REG: /* register variable. */ 4634 /* C_AUTOARG conflictes with TI COFF C_UEXT. */ 4491 4635 #if !defined (TIC80COFF) && !defined (TICOFF) 4492 4636 #ifdef C_AUTOARG 4493 case C_AUTOARG: /* 960-specific storage class */4494 #endif 4495 #endif 4496 case C_TPDEF: /* type definition*/4637 case C_AUTOARG: /* 960-specific storage class. */ 4638 #endif 4639 #endif 4640 case C_TPDEF: /* Type definition. */ 4497 4641 case C_ARG: 4498 case C_AUTO: /* automatic variable*/4499 case C_FIELD: /* bit field*/4500 case C_ENTAG: /* enumeration tag*/4501 case C_MOE: /* member of enumeration*/4502 case C_MOU: /* member of union*/4503 case C_UNTAG: /* union tag*/4642 case C_AUTO: /* Automatic variable. */ 4643 case C_FIELD: /* Bit field. */ 4644 case C_ENTAG: /* Enumeration tag. */ 4645 case C_MOE: /* Member of enumeration. */ 4646 case C_MOU: /* Member of union. */ 4647 case C_UNTAG: /* Union tag. */ 4504 4648 dst->symbol.flags = BSF_DEBUGGING; 4505 4649 dst->symbol.value = (src->u.syment.n_value); 4506 4650 break; 4507 4651 4508 case C_FILE: /* file name*/4509 case C_STRTAG: /* structure tag*/4652 case C_FILE: /* File name. */ 4653 case C_STRTAG: /* Structure tag. */ 4510 4654 #ifdef RS6000COFF_C 4511 4655 case C_GSYM: … … 4527 4671 4528 4672 #ifdef RS6000COFF_C 4529 case C_BINCL: /* beginning of include file*/4530 case C_EINCL: /* ending of include file*/4673 case C_BINCL: /* Beginning of include file. */ 4674 case C_EINCL: /* Ending of include file. */ 4531 4675 /* The value is actually a pointer into the line numbers 4532 4676 of the file. We locate the line number entry, and … … 4569 4713 #endif 4570 4714 4571 case C_BLOCK: /* ".bb" or ".eb" 4572 case C_FCN: /* ".bf" or ".ef" (or PE ".lf") */4573 case C_EFCN: /* physical end of function*/4715 case C_BLOCK: /* ".bb" or ".eb". */ 4716 case C_FCN: /* ".bf" or ".ef" (or PE ".lf"). */ 4717 case C_EFCN: /* Physical end of function. */ 4574 4718 #if defined COFF_WITH_PE 4575 4719 /* PE sets the symbol to a value relative to the start … … 4593 4737 break; 4594 4738 4595 case C_STATLAB: /* Static load time label */4739 case C_STATLAB: /* Static load time label. */ 4596 4740 dst->symbol.value = src->u.syment.n_value; 4597 4741 dst->symbol.flags = BSF_GLOBAL; … … 4606 4750 break; 4607 4751 /* Fall through. */ 4608 case C_EXTDEF: /* external definition*/4609 case C_ULABEL: /* undefined label*/4610 case C_USTATIC: /* undefined static*/4752 case C_EXTDEF: /* External definition. */ 4753 case C_ULABEL: /* Undefined label. */ 4754 case C_USTATIC: /* Undefined static. */ 4611 4755 #ifndef COFF_WITH_PE 4612 4756 /* C_LINE in regular coff is 0x68. NT has taken over this storage 4613 class to represent a section symbol */4614 case C_LINE: /* line # reformatted as symbol table entry */4757 class to represent a section symbol. */ 4758 case C_LINE: /* line # reformatted as symbol table entry. */ 4615 4759 /* NT uses 0x67 for a weak symbol, not C_ALIAS. */ 4616 case C_ALIAS: /* duplicate tag*/4617 #endif 4618 /* New storage classes for TI COFF */4760 case C_ALIAS: /* Duplicate tag. */ 4761 #endif 4762 /* New storage classes for TI COFF. */ 4619 4763 #if defined(TIC80COFF) || defined(TICOFF) 4620 case C_UEXT: /* Tentative external definition */4621 #endif 4622 case C_EXTLAB: /* External load time label */4623 case C_HIDDEN: /* ext symbol in dmert public lib*/4764 case C_UEXT: /* Tentative external definition. */ 4765 #endif 4766 case C_EXTLAB: /* External load time label. */ 4767 case C_HIDDEN: /* Ext symbol in dmert public lib. */ 4624 4768 default: 4625 4769 (*_bfd_error_handler) 4626 4770 (_("%s: Unrecognized storage class %d for %s symbol `%s'"), 4627 bfd_ get_filename (abfd), src->u.syment.n_sclass,4771 bfd_archive_filename (abfd), src->u.syment.n_sclass, 4628 4772 dst->symbol.section->name, dst->symbol.name); 4629 4773 dst->symbol.flags = BSF_DEBUGGING; … … 4641 4785 dst++; 4642 4786 number_of_symbols++; 4643 } /* walk the native symtab */4644 } /* bfdize the native symtab */4787 } 4788 } 4645 4789 4646 4790 obj_symbols (abfd) = cached_area; … … 4649 4793 bfd_get_symcount (abfd) = number_of_symbols; 4650 4794 obj_convert (abfd) = table_ptr; 4651 /* Slurp the line tables for each section too */4795 /* Slurp the line tables for each section too. */ 4652 4796 { 4653 4797 asection *p; 4798 4654 4799 p = abfd->sections; 4655 4800 while (p) … … 4659 4804 } 4660 4805 } 4661 return true; 4806 4807 return TRUE; 4662 4808 } /* coff_slurp_symbol_table() */ 4663 4809 … … 4756 4902 (*_bfd_error_handler) 4757 4903 (_("warning: %s: local symbol `%s' has no section"), 4758 bfd_ get_filename (abfd),4904 bfd_archive_filename (abfd), 4759 4905 _bfd_coff_internal_syment_name (abfd, syment, buf)); 4760 4906 } … … 4811 4957 #endif 4812 4958 4813 static b oolean4959 static bfd_boolean 4814 4960 coff_slurp_reloc_table (abfd, asect, symbols) 4815 4961 bfd * abfd; … … 4820 4966 arelent *reloc_cache; 4821 4967 arelent *cache_ptr; 4822 4823 4968 unsigned int idx; 4969 bfd_size_type amt; 4824 4970 4825 4971 if (asect->relocation) 4826 return true;4972 return TRUE; 4827 4973 if (asect->reloc_count == 0) 4828 return true;4974 return TRUE; 4829 4975 if (asect->flags & SEC_CONSTRUCTOR) 4830 return true;4976 return TRUE; 4831 4977 if (!coff_slurp_symbol_table (abfd)) 4832 return false; 4833 native_relocs = 4834 (RELOC *) buy_and_read (abfd, 4835 asect->rel_filepos, 4836 SEEK_SET, 4837 (size_t) (bfd_coff_relsz (abfd) * 4838 asect->reloc_count)); 4839 reloc_cache = (arelent *) 4840 bfd_alloc (abfd, (size_t) (asect->reloc_count * sizeof (arelent))); 4978 return FALSE; 4979 amt = (bfd_size_type) bfd_coff_relsz (abfd) * asect->reloc_count; 4980 native_relocs = (RELOC *) buy_and_read (abfd, asect->rel_filepos, amt); 4981 amt = (bfd_size_type) asect->reloc_count * sizeof (arelent); 4982 reloc_cache = (arelent *) bfd_alloc (abfd, amt); 4841 4983 4842 4984 if (reloc_cache == NULL) 4843 return false;4985 return FALSE; 4844 4986 4845 4987 for (idx = 0; idx < asect->reloc_count; idx++) … … 4867 5009 (*_bfd_error_handler) 4868 5010 (_("%s: warning: illegal symbol index %ld in relocs"), 4869 bfd_ get_filename (abfd), dst.r_symndx);5011 bfd_archive_filename (abfd), dst.r_symndx); 4870 5012 cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; 4871 5013 ptr = NULL; … … 4889 5031 modified, so we have to have a negative addend to compensate. 4890 5032 4891 Note that symbols which used to be common must be left alone */4892 4893 /* Calculate any reloc addend by looking at the symbol */5033 Note that symbols which used to be common must be left alone. */ 5034 5035 /* Calculate any reloc addend by looking at the symbol. */ 4894 5036 CALC_ADDEND (abfd, ptr, dst, cache_ptr); 4895 5037 … … 4897 5039 /* !! cache_ptr->section = (asection *) NULL;*/ 4898 5040 4899 /* Fill in the cache_ptr->howto field from dst.r_type */5041 /* Fill in the cache_ptr->howto field from dst.r_type. */ 4900 5042 RTYPE2HOWTO (cache_ptr, &dst); 4901 5043 #endif /* RELOC_PROCESSING */ … … 4905 5047 (*_bfd_error_handler) 4906 5048 (_("%s: illegal relocation type %d at address 0x%lx"), 4907 bfd_ get_filename (abfd), dst.r_type, (long) dst.r_vaddr);5049 bfd_archive_filename (abfd), dst.r_type, (long) dst.r_vaddr); 4908 5050 bfd_set_error (bfd_error_bad_value); 4909 return false;5051 return FALSE; 4910 5052 } 4911 5053 } 4912 5054 4913 5055 asect->relocation = reloc_cache; 4914 return true;5056 return TRUE; 4915 5057 } 4916 5058 … … 4965 5107 if (section->flags & SEC_CONSTRUCTOR) 4966 5108 { 4967 /* this section has relocs made up by us, they are not in the4968 4969 the data area provided*/5109 /* This section has relocs made up by us, they are not in the 5110 file, so take them out of their chain and place them into 5111 the data area provided. */ 4970 5112 arelent_chain *chain = section->constructor_chain; 5113 4971 5114 for (count = 0; count < section->reloc_count; count++) 4972 5115 { … … 4974 5117 chain = chain->next; 4975 5118 } 4976 4977 5119 } 4978 5120 else … … 5045 5187 #endif 5046 5188 5189 #ifndef coff_bfd_link_hash_table_free 5190 #define coff_bfd_link_hash_table_free _bfd_generic_link_hash_table_free 5191 #endif 5192 5047 5193 /* If coff_relocate_section is defined, we can use the optimized COFF 5048 5194 backend linker. Otherwise we must continue to use the old linker. */ … … 5068 5214 #endif /* ! defined (coff_relocate_section) */ 5069 5215 5216 #define coff_bfd_link_just_syms _bfd_generic_link_just_syms 5070 5217 #define coff_bfd_link_split_section _bfd_generic_link_split_section 5071 5218 … … 5084 5231 #ifndef coff_link_output_has_begun 5085 5232 5086 static b oolean coff_link_output_has_begun5233 static bfd_boolean coff_link_output_has_begun 5087 5234 PARAMS ((bfd *, struct coff_final_link_info *)); 5088 5235 5089 static b oolean5236 static bfd_boolean 5090 5237 coff_link_output_has_begun (abfd, info) 5091 5238 bfd * abfd; … … 5098 5245 #ifndef coff_final_link_postscript 5099 5246 5100 static b oolean coff_final_link_postscript5247 static bfd_boolean coff_final_link_postscript 5101 5248 PARAMS ((bfd *, struct coff_final_link_info *)); 5102 5249 5103 static b oolean5250 static bfd_boolean 5104 5251 coff_final_link_postscript (abfd, pfinfo) 5105 5252 bfd * abfd ATTRIBUTE_UNUSED; 5106 5253 struct coff_final_link_info * pfinfo ATTRIBUTE_UNUSED; 5107 5254 { 5108 return true;5255 return TRUE; 5109 5256 } 5110 5257 #endif … … 5162 5309 FILHSZ, AOUTSZ, SCNHSZ, SYMESZ, AUXESZ, RELSZ, LINESZ, FILNMLEN, 5163 5310 #ifdef COFF_LONG_FILENAMES 5164 true,5311 TRUE, 5165 5312 #else 5166 false,5313 FALSE, 5167 5314 #endif 5168 5315 #ifdef COFF_LONG_SECTION_NAMES 5169 true,5316 TRUE, 5170 5317 #else 5171 false,5318 FALSE, 5172 5319 #endif 5173 5320 COFF_DEFAULT_SECTION_ALIGNMENT_POWER, 5174 5321 #ifdef COFF_FORCE_SYMBOLS_IN_STRINGS 5175 true,5322 TRUE, 5176 5323 #else 5177 false,5324 FALSE, 5178 5325 #endif 5179 5326 #ifdef COFF_DEBUG_STRING_WIDE_PREFIX … … 5258 5405 #ifndef coff_bfd_gc_sections 5259 5406 #define coff_bfd_gc_sections bfd_generic_gc_sections 5407 #endif 5408 5409 #ifndef coff_bfd_merge_sections 5410 #define coff_bfd_merge_sections bfd_generic_merge_sections 5411 #endif 5412 5413 #ifndef coff_bfd_discard_group 5414 #define coff_bfd_discard_group bfd_generic_discard_group 5260 5415 #endif 5261 5416 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.