Changeset 609 for branches/GNU/src/binutils/bfd/binary.c
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/bfd/binary.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* BFD back-end for binary objects. 2 Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000 2 Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 3 3 Free Software Foundation, Inc. 4 4 Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com> … … 33 33 address to zero by default. */ 34 34 35 #include <ctype.h>36 37 35 #include "bfd.h" 38 36 #include "sysdep.h" 37 #include "safe-ctype.h" 39 38 #include "libbfd.h" 40 39 … … 43 42 #define BIN_SYMS 3 44 43 45 static b oolean binary_mkobject PARAMS ((bfd *));44 static bfd_boolean binary_mkobject PARAMS ((bfd *)); 46 45 static const bfd_target *binary_object_p PARAMS ((bfd *)); 47 static b oolean binary_get_section_contents46 static bfd_boolean binary_get_section_contents 48 47 PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); 49 48 static long binary_get_symtab_upper_bound PARAMS ((bfd *)); 50 49 static char *mangle_name PARAMS ((bfd *, char *)); 51 50 static long binary_get_symtab PARAMS ((bfd *, asymbol **)); 52 static asymbol *binary_make_empty_symbol PARAMS ((bfd *));53 51 static void binary_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); 54 static b oolean binary_set_section_contents52 static bfd_boolean binary_set_section_contents 55 53 PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); 56 static int binary_sizeof_headers PARAMS ((bfd *, boolean)); 54 static int binary_sizeof_headers PARAMS ((bfd *, bfd_boolean)); 55 56 /* Set by external programs - specifies the BFD architecture 57 to use when creating binary BFDs. */ 58 enum bfd_architecture bfd_external_binary_architecture = bfd_arch_unknown; 57 59 58 60 /* Create a binary object. Invoked via bfd_set_format. */ 59 61 60 static b oolean62 static bfd_boolean 61 63 binary_mkobject (abfd) 62 64 bfd *abfd ATTRIBUTE_UNUSED; 63 65 { 64 return true;66 return TRUE; 65 67 } 66 68 … … 102 104 abfd->tdata.any = (PTR) sec; 103 105 106 if (bfd_get_arch_info (abfd) != NULL) 107 { 108 if ((bfd_get_arch_info (abfd)->arch == bfd_arch_unknown) 109 && (bfd_external_binary_architecture != bfd_arch_unknown)) 110 bfd_set_arch_info (abfd, bfd_lookup_arch (bfd_external_binary_architecture, 0)); 111 } 112 104 113 return abfd->xvec; 105 114 } … … 111 120 /* Get contents of the only section. */ 112 121 113 static b oolean122 static bfd_boolean 114 123 binary_get_section_contents (abfd, section, location, offset, count) 115 124 bfd *abfd; … … 120 129 { 121 130 if (bfd_seek (abfd, offset, SEEK_SET) != 0 122 || bfd_ read (location, 1, count, abfd) != count)123 return false;124 return true;131 || bfd_bread (location, count, abfd) != count) 132 return FALSE; 133 return TRUE; 125 134 } 126 135 … … 141 150 char *suffix; 142 151 { 143 intsize;152 bfd_size_type size; 144 153 char *buf; 145 154 char *p; … … 157 166 /* Change any non-alphanumeric characters to underscores. */ 158 167 for (p = buf; *p; p++) 159 if (! isalnum ((unsigned char)*p))168 if (! ISALNUM (*p)) 160 169 *p = '_'; 161 170 … … 173 182 asymbol *syms; 174 183 unsigned int i; 175 176 syms = (asymbol *) bfd_alloc (abfd, BIN_SYMS * sizeof (asymbol)); 184 bfd_size_type amt = BIN_SYMS * sizeof (asymbol); 185 186 syms = (asymbol *) bfd_alloc (abfd, amt); 177 187 if (syms == NULL) 178 return false;188 return 0; 179 189 180 190 /* Start symbol. */ … … 209 219 } 210 220 211 /* Make an empty symbol. */ 212 213 static asymbol * 214 binary_make_empty_symbol (abfd) 215 bfd *abfd; 216 { 217 return (asymbol *) bfd_alloc (abfd, sizeof (asymbol)); 218 } 219 221 #define binary_make_empty_symbol _bfd_generic_make_empty_symbol 220 222 #define binary_print_symbol _bfd_nosymbols_print_symbol 221 223 … … 249 251 /* Write section contents of a binary file. */ 250 252 251 static b oolean253 static bfd_boolean 252 254 binary_set_section_contents (abfd, sec, data, offset, size) 253 255 bfd *abfd; … … 258 260 { 259 261 if (size == 0) 260 return true;262 return TRUE; 261 263 262 264 if (! abfd->output_has_begun) 263 265 { 264 b oolean found_low;266 bfd_boolean found_low; 265 267 bfd_vma low; 266 268 asection *s; … … 269 271 of the file. We use this to set the file position of all the 270 272 sections. */ 271 found_low = false;273 found_low = FALSE; 272 274 low = 0; 273 275 for (s = abfd->sections; s != NULL; s = s->next) … … 279 281 { 280 282 low = s->lma; 281 found_low = true;283 found_low = TRUE; 282 284 } 283 285 … … 307 309 } 308 310 309 abfd->output_has_begun = true;311 abfd->output_has_begun = TRUE; 310 312 } 311 313 … … 314 316 meaningful in the binary format. */ 315 317 if ((sec->flags & (SEC_LOAD | SEC_ALLOC)) == 0) 316 return true;318 return TRUE; 317 319 if ((sec->flags & SEC_NEVER_LOAD) != 0) 318 return true;320 return TRUE; 319 321 320 322 return _bfd_generic_set_section_contents (abfd, sec, data, offset, size); … … 326 328 binary_sizeof_headers (abfd, exec) 327 329 bfd *abfd ATTRIBUTE_UNUSED; 328 b oolean exec ATTRIBUTE_UNUSED;330 bfd_boolean exec ATTRIBUTE_UNUSED; 329 331 { 330 332 return 0; … … 335 337 #define binary_bfd_relax_section bfd_generic_relax_section 336 338 #define binary_bfd_gc_sections bfd_generic_gc_sections 339 #define binary_bfd_merge_sections bfd_generic_merge_sections 340 #define binary_bfd_discard_group bfd_generic_discard_group 337 341 #define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create 342 #define binary_bfd_link_hash_table_free _bfd_generic_link_hash_table_free 343 #define binary_bfd_link_just_syms _bfd_generic_link_just_syms 338 344 #define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols 339 345 #define binary_bfd_final_link _bfd_generic_final_link -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.