Changeset 609 for branches/GNU/src/binutils/bfd/som.c
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/bfd/som.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* bfd back-end for HP PA-RISC SOM objects. 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 … … 32 32 #include "libbfd.h" 33 33 #include "som.h" 34 #include "safe-ctype.h" 34 35 35 36 #include <sys/param.h> … … 37 38 #include <machine/reg.h> 38 39 #include <sys/file.h> 39 #include <ctype.h> 40 41 /* Magic not defined in standard HP-UX header files until 8.0 */ 40 41 /* Magic not defined in standard HP-UX header files until 8.0. */ 42 42 43 43 #ifndef CPU_PA_RISC1_0 … … 103 103 /* Generic alignment macro. */ 104 104 #define SOM_ALIGN(val, alignment) \ 105 (((val) + (alignment) - 1) & ~((alignment) - 1))105 (((val) + (alignment) - 1) &~ ((unsigned long) (alignment) - 1)) 106 106 107 107 /* SOM allows any one of the four previous relocations to be reused … … 149 149 }; 150 150 151 /* Forward declarations */ 152 153 static boolean som_mkobject PARAMS ((bfd *)); 154 static const bfd_target * som_object_setup PARAMS ((bfd *, 155 struct header *, 156 struct som_exec_auxhdr *, 157 unsigned long)); 158 static boolean setup_sections PARAMS ((bfd *, struct header *, unsigned long)); 159 static const bfd_target * som_object_p PARAMS ((bfd *)); 160 static boolean som_write_object_contents PARAMS ((bfd *)); 161 static boolean som_slurp_string_table PARAMS ((bfd *)); 162 static unsigned int som_slurp_symbol_table PARAMS ((bfd *)); 163 static long som_get_symtab_upper_bound PARAMS ((bfd *)); 164 static long som_canonicalize_reloc PARAMS ((bfd *, sec_ptr, 165 arelent **, asymbol **)); 166 static long som_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr)); 167 static unsigned int som_set_reloc_info PARAMS ((unsigned char *, unsigned int, 168 arelent *, asection *, 169 asymbol **, boolean)); 170 static boolean som_slurp_reloc_table PARAMS ((bfd *, asection *, 171 asymbol **, boolean)); 172 static long som_get_symtab PARAMS ((bfd *, asymbol **)); 173 static asymbol * som_make_empty_symbol PARAMS ((bfd *)); 174 static void som_print_symbol PARAMS ((bfd *, PTR, 175 asymbol *, bfd_print_symbol_type)); 176 static boolean som_new_section_hook PARAMS ((bfd *, asection *)); 177 static boolean som_bfd_copy_private_symbol_data PARAMS ((bfd *, asymbol *, 178 bfd *, asymbol *)); 179 static boolean som_bfd_copy_private_section_data PARAMS ((bfd *, asection *, 180 bfd *, asection *)); 181 static boolean som_bfd_copy_private_bfd_data PARAMS ((bfd *, bfd *)); 151 /* Forward declarations. */ 152 153 static bfd_boolean som_mkobject 154 PARAMS ((bfd *)); 155 static const bfd_target * som_object_setup 156 PARAMS ((bfd *, struct header *, struct som_exec_auxhdr *, unsigned long)); 157 static bfd_boolean setup_sections 158 PARAMS ((bfd *, struct header *, unsigned long)); 159 static const bfd_target * som_object_p 160 PARAMS ((bfd *)); 161 static bfd_boolean som_write_object_contents 162 PARAMS ((bfd *)); 163 static bfd_boolean som_slurp_string_table 164 PARAMS ((bfd *)); 165 static unsigned int som_slurp_symbol_table 166 PARAMS ((bfd *)); 167 static long som_get_symtab_upper_bound 168 PARAMS ((bfd *)); 169 static long som_canonicalize_reloc 170 PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); 171 static long som_get_reloc_upper_bound 172 PARAMS ((bfd *, sec_ptr)); 173 static unsigned int som_set_reloc_info 174 PARAMS ((unsigned char *, unsigned int, arelent *, asection *, 175 asymbol **, bfd_boolean)); 176 static bfd_boolean som_slurp_reloc_table 177 PARAMS ((bfd *, asection *, asymbol **, bfd_boolean)); 178 static long som_get_symtab 179 PARAMS ((bfd *, asymbol **)); 180 static asymbol * som_make_empty_symbol 181 PARAMS ((bfd *)); 182 static void som_print_symbol 183 PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type)); 184 static bfd_boolean som_new_section_hook 185 PARAMS ((bfd *, asection *)); 186 static bfd_boolean som_bfd_copy_private_symbol_data 187 PARAMS ((bfd *, asymbol *, bfd *, asymbol *)); 188 static bfd_boolean som_bfd_copy_private_section_data 189 PARAMS ((bfd *, asection *, bfd *, asection *)); 190 static bfd_boolean som_bfd_copy_private_bfd_data 191 PARAMS ((bfd *, bfd *)); 182 192 #define som_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data 183 193 #define som_bfd_set_private_flags _bfd_generic_bfd_set_private_flags 184 static boolean som_bfd_is_local_label_name PARAMS ((bfd *, const char *)); 185 static boolean som_set_section_contents PARAMS ((bfd *, sec_ptr, PTR, 186 file_ptr, bfd_size_type)); 187 static boolean som_get_section_contents PARAMS ((bfd *, sec_ptr, PTR, 188 file_ptr, bfd_size_type)); 189 static boolean som_set_arch_mach PARAMS ((bfd *, enum bfd_architecture, 190 unsigned long)); 191 static boolean som_find_nearest_line PARAMS ((bfd *, asection *, 192 asymbol **, bfd_vma, 193 CONST char **, 194 CONST char **, 195 unsigned int *)); 196 static void som_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); 197 static asection * bfd_section_from_som_symbol PARAMS ((bfd *, 198 struct symbol_dictionary_record *)); 199 static int log2 PARAMS ((unsigned int)); 200 static bfd_reloc_status_type hppa_som_reloc PARAMS ((bfd *, arelent *, 201 asymbol *, PTR, 202 asection *, bfd *, 203 char **)); 204 static void som_initialize_reloc_queue PARAMS ((struct reloc_queue *)); 205 static void som_reloc_queue_insert PARAMS ((unsigned char *, unsigned int, 206 struct reloc_queue *)); 207 static void som_reloc_queue_fix PARAMS ((struct reloc_queue *, unsigned int)); 208 static int som_reloc_queue_find PARAMS ((unsigned char *, unsigned int, 209 struct reloc_queue *)); 210 static unsigned char * try_prev_fixup PARAMS ((bfd *, int *, unsigned char *, 211 unsigned int, 212 struct reloc_queue *)); 213 214 static unsigned char * som_reloc_skip PARAMS ((bfd *, unsigned int, 215 unsigned char *, unsigned int *, 216 struct reloc_queue *)); 217 static unsigned char * som_reloc_addend PARAMS ((bfd *, int, unsigned char *, 218 unsigned int *, 219 struct reloc_queue *)); 220 static unsigned char * som_reloc_call PARAMS ((bfd *, unsigned char *, 221 unsigned int *, 222 arelent *, int, 223 struct reloc_queue *)); 224 static unsigned long som_count_spaces PARAMS ((bfd *)); 225 static unsigned long som_count_subspaces PARAMS ((bfd *)); 226 static int compare_syms PARAMS ((const void *, const void *)); 227 static int compare_subspaces PARAMS ((const void *, const void *)); 228 static unsigned long som_compute_checksum PARAMS ((bfd *)); 229 static boolean som_prep_headers PARAMS ((bfd *)); 230 static int som_sizeof_headers PARAMS ((bfd *, boolean)); 231 static boolean som_finish_writing PARAMS ((bfd *)); 232 static boolean som_build_and_write_symbol_table PARAMS ((bfd *)); 233 static void som_prep_for_fixups PARAMS ((bfd *, asymbol **, unsigned long)); 234 static boolean som_write_fixups PARAMS ((bfd *, unsigned long, unsigned int *)); 235 static boolean som_write_space_strings PARAMS ((bfd *, unsigned long, 236 unsigned int *)); 237 static boolean som_write_symbol_strings PARAMS ((bfd *, unsigned long, 238 asymbol **, unsigned int, 239 unsigned *, 240 COMPUNIT *)); 241 static boolean som_begin_writing PARAMS ((bfd *)); 194 static bfd_boolean som_bfd_is_local_label_name 195 PARAMS ((bfd *, const char *)); 196 static bfd_boolean som_set_section_contents 197 PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); 198 static bfd_boolean som_get_section_contents 199 PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); 200 static bfd_boolean som_set_arch_mach 201 PARAMS ((bfd *, enum bfd_architecture, unsigned long)); 202 static bfd_boolean som_find_nearest_line 203 PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, 204 const char **, unsigned int *)); 205 static void som_get_symbol_info 206 PARAMS ((bfd *, asymbol *, symbol_info *)); 207 static asection * bfd_section_from_som_symbol 208 PARAMS ((bfd *, struct symbol_dictionary_record *)); 209 static int log2 210 PARAMS ((unsigned int)); 211 static bfd_reloc_status_type hppa_som_reloc 212 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); 213 static void som_initialize_reloc_queue 214 PARAMS ((struct reloc_queue *)); 215 static void som_reloc_queue_insert 216 PARAMS ((unsigned char *, unsigned int, struct reloc_queue *)); 217 static void som_reloc_queue_fix 218 PARAMS ((struct reloc_queue *, unsigned int)); 219 static int som_reloc_queue_find 220 PARAMS ((unsigned char *, unsigned int, struct reloc_queue *)); 221 static unsigned char * try_prev_fixup 222 PARAMS ((bfd *, int *, unsigned char *, unsigned int, struct reloc_queue *)); 223 static unsigned char * som_reloc_skip 224 PARAMS ((bfd *, unsigned int, unsigned char *, unsigned int *, 225 struct reloc_queue *)); 226 static unsigned char * som_reloc_addend 227 PARAMS ((bfd *, bfd_vma, unsigned char *, unsigned int *, 228 struct reloc_queue *)); 229 static unsigned char * som_reloc_call 230 PARAMS ((bfd *, unsigned char *, unsigned int *, arelent *, int, 231 struct reloc_queue *)); 232 static unsigned long som_count_spaces 233 PARAMS ((bfd *)); 234 static unsigned long som_count_subspaces 235 PARAMS ((bfd *)); 236 static int compare_syms 237 PARAMS ((const void *, const void *)); 238 static int compare_subspaces 239 PARAMS ((const void *, const void *)); 240 static unsigned long som_compute_checksum 241 PARAMS ((bfd *)); 242 static bfd_boolean som_prep_headers 243 PARAMS ((bfd *)); 244 static int som_sizeof_headers 245 PARAMS ((bfd *, bfd_boolean)); 246 static bfd_boolean som_finish_writing 247 PARAMS ((bfd *)); 248 static bfd_boolean som_build_and_write_symbol_table 249 PARAMS ((bfd *)); 250 static void som_prep_for_fixups 251 PARAMS ((bfd *, asymbol **, unsigned long)); 252 static bfd_boolean som_write_fixups 253 PARAMS ((bfd *, unsigned long, unsigned int *)); 254 static bfd_boolean som_write_space_strings 255 PARAMS ((bfd *, unsigned long, unsigned int *)); 256 static bfd_boolean som_write_symbol_strings 257 PARAMS ((bfd *, unsigned long, asymbol **, unsigned int, unsigned *, 258 COMPUNIT *)); 259 static bfd_boolean som_begin_writing 260 PARAMS ((bfd *)); 242 261 static reloc_howto_type * som_bfd_reloc_type_lookup 243 PARAMS ((bfd *, bfd_reloc_code_real_type)); 244 static char som_section_type PARAMS ((const char *)); 245 static int som_decode_symclass PARAMS ((asymbol *)); 246 static boolean som_bfd_count_ar_symbols PARAMS ((bfd *, struct lst_header *, 247 symindex *)); 248 249 static boolean som_bfd_fill_in_ar_symbols PARAMS ((bfd *, struct lst_header *, 250 carsym **syms)); 251 static boolean som_slurp_armap PARAMS ((bfd *)); 252 static boolean som_write_armap PARAMS ((bfd *, unsigned int, struct orl *, 253 unsigned int, int)); 254 static void som_bfd_derive_misc_symbol_info PARAMS ((bfd *, asymbol *, 255 struct som_misc_symbol_info *)); 256 static boolean som_bfd_prep_for_ar_write PARAMS ((bfd *, unsigned int *, 257 unsigned int *)); 258 static unsigned int som_bfd_ar_symbol_hash PARAMS ((asymbol *)); 259 static boolean som_bfd_ar_write_symbol_stuff PARAMS ((bfd *, unsigned int, 260 unsigned int, 261 struct lst_header, 262 unsigned int)); 263 static boolean som_is_space PARAMS ((asection *)); 264 static boolean som_is_subspace PARAMS ((asection *)); 265 static boolean som_is_container PARAMS ((asection *, asection *)); 266 static boolean som_bfd_free_cached_info PARAMS ((bfd *)); 267 static boolean som_bfd_link_split_section PARAMS ((bfd *, asection *)); 262 PARAMS ((bfd *, bfd_reloc_code_real_type)); 263 static char som_section_type 264 PARAMS ((const char *)); 265 static int som_decode_symclass 266 PARAMS ((asymbol *)); 267 static bfd_boolean som_bfd_count_ar_symbols 268 PARAMS ((bfd *, struct lst_header *, symindex *)); 269 static bfd_boolean som_bfd_fill_in_ar_symbols 270 PARAMS ((bfd *, struct lst_header *, carsym **)); 271 static bfd_boolean som_slurp_armap 272 PARAMS ((bfd *)); 273 static bfd_boolean som_write_armap 274 PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); 275 static void som_bfd_derive_misc_symbol_info 276 PARAMS ((bfd *, asymbol *, struct som_misc_symbol_info *)); 277 static bfd_boolean som_bfd_prep_for_ar_write 278 PARAMS ((bfd *, unsigned int *, unsigned int *)); 279 static unsigned int som_bfd_ar_symbol_hash 280 PARAMS ((asymbol *)); 281 static bfd_boolean som_bfd_ar_write_symbol_stuff 282 PARAMS ((bfd *, unsigned int, unsigned int, struct lst_header, 283 unsigned int)); 284 static bfd_boolean som_is_space 285 PARAMS ((asection *)); 286 static bfd_boolean som_is_subspace 287 PARAMS ((asection *)); 288 static bfd_boolean som_is_container 289 PARAMS ((asection *, asection *)); 290 static bfd_boolean som_bfd_free_cached_info 291 PARAMS ((bfd *)); 292 static bfd_boolean som_bfd_link_split_section 293 PARAMS ((bfd *, asection *)); 268 294 269 295 /* Map SOM section names to POSIX/BSD single-character symbol types. … … 384 410 static const struct fixup_format som_fixup_formats[256] = { 385 411 /* R_NO_RELOCATION */ 386 0, "LD1+4*=",/* 0x00 */387 1, "LD1+4*=",/* 0x01 */388 2, "LD1+4*=",/* 0x02 */389 3, "LD1+4*=",/* 0x03 */390 4, "LD1+4*=",/* 0x04 */391 5, "LD1+4*=",/* 0x05 */392 6, "LD1+4*=",/* 0x06 */393 7, "LD1+4*=",/* 0x07 */394 8, "LD1+4*=",/* 0x08 */395 9, "LD1+4*=",/* 0x09 */396 10, "LD1+4*=",/* 0x0a */397 11, "LD1+4*=",/* 0x0b */398 12, "LD1+4*=",/* 0x0c */399 13, "LD1+4*=",/* 0x0d */400 14, "LD1+4*=",/* 0x0e */401 15, "LD1+4*=",/* 0x0f */402 16, "LD1+4*=",/* 0x10 */403 17, "LD1+4*=",/* 0x11 */404 18, "LD1+4*=",/* 0x12 */405 19, "LD1+4*=",/* 0x13 */406 20, "LD1+4*=",/* 0x14 */407 21, "LD1+4*=",/* 0x15 */408 22, "LD1+4*=",/* 0x16 */409 23, "LD1+4*=",/* 0x17 */410 0, "LD8<b+1+4*=", /* 0x18 */411 1, "LD8<b+1+4*=", /* 0x19 */412 2, "LD8<b+1+4*=", /* 0x1a */413 3, "LD8<b+1+4*=", /* 0x1b */414 0, "LD16<c+1+4*=", /* 0x1c */415 1, "LD16<c+1+4*=", /* 0x1d */416 2, "LD16<c+1+4*=", /* 0x1e */417 0, "Ld1+=",/* 0x1f */412 { 0, "LD1+4*=" }, /* 0x00 */ 413 { 1, "LD1+4*=" }, /* 0x01 */ 414 { 2, "LD1+4*=" }, /* 0x02 */ 415 { 3, "LD1+4*=" }, /* 0x03 */ 416 { 4, "LD1+4*=" }, /* 0x04 */ 417 { 5, "LD1+4*=" }, /* 0x05 */ 418 { 6, "LD1+4*=" }, /* 0x06 */ 419 { 7, "LD1+4*=" }, /* 0x07 */ 420 { 8, "LD1+4*=" }, /* 0x08 */ 421 { 9, "LD1+4*=" }, /* 0x09 */ 422 { 10, "LD1+4*=" }, /* 0x0a */ 423 { 11, "LD1+4*=" }, /* 0x0b */ 424 { 12, "LD1+4*=" }, /* 0x0c */ 425 { 13, "LD1+4*=" }, /* 0x0d */ 426 { 14, "LD1+4*=" }, /* 0x0e */ 427 { 15, "LD1+4*=" }, /* 0x0f */ 428 { 16, "LD1+4*=" }, /* 0x10 */ 429 { 17, "LD1+4*=" }, /* 0x11 */ 430 { 18, "LD1+4*=" }, /* 0x12 */ 431 { 19, "LD1+4*=" }, /* 0x13 */ 432 { 20, "LD1+4*=" }, /* 0x14 */ 433 { 21, "LD1+4*=" }, /* 0x15 */ 434 { 22, "LD1+4*=" }, /* 0x16 */ 435 { 23, "LD1+4*=" }, /* 0x17 */ 436 { 0, "LD8<b+1+4*=" }, /* 0x18 */ 437 { 1, "LD8<b+1+4*=" }, /* 0x19 */ 438 { 2, "LD8<b+1+4*=" }, /* 0x1a */ 439 { 3, "LD8<b+1+4*=" }, /* 0x1b */ 440 { 0, "LD16<c+1+4*=" }, /* 0x1c */ 441 { 1, "LD16<c+1+4*=" }, /* 0x1d */ 442 { 2, "LD16<c+1+4*=" }, /* 0x1e */ 443 { 0, "Ld1+=" }, /* 0x1f */ 418 444 /* R_ZEROES */ 419 0, "Lb1+4*=",/* 0x20 */420 1, "Ld1+=",/* 0x21 */445 { 0, "Lb1+4*=" }, /* 0x20 */ 446 { 1, "Ld1+=" }, /* 0x21 */ 421 447 /* R_UNINIT */ 422 0, "Lb1+4*=",/* 0x22 */423 1, "Ld1+=",/* 0x23 */448 { 0, "Lb1+4*=" }, /* 0x22 */ 449 { 1, "Ld1+=" }, /* 0x23 */ 424 450 /* R_RELOCATION */ 425 0, "L4=",/* 0x24 */451 { 0, "L4=" }, /* 0x24 */ 426 452 /* R_DATA_ONE_SYMBOL */ 427 0, "L4=Sb=",/* 0x25 */428 1, "L4=Sd=",/* 0x26 */453 { 0, "L4=Sb=" }, /* 0x25 */ 454 { 1, "L4=Sd=" }, /* 0x26 */ 429 455 /* R_DATA_PLEBEL */ 430 0, "L4=Sb=",/* 0x27 */431 1, "L4=Sd=",/* 0x28 */456 { 0, "L4=Sb=" }, /* 0x27 */ 457 { 1, "L4=Sd=" }, /* 0x28 */ 432 458 /* R_SPACE_REF */ 433 0, "L4=",/* 0x29 */459 { 0, "L4=" }, /* 0x29 */ 434 460 /* R_REPEATED_INIT */ 435 0, "L4=Mb1+4*=",/* 0x2a */436 1, "Lb4*=Mb1+L*=", /* 0x2b */437 2, "Lb4*=Md1+4*=", /* 0x2c */438 3, "Ld1+=Me1+=",/* 0x2d */439 0, "",/* 0x2e */440 0, "",/* 0x2f */461 { 0, "L4=Mb1+4*=" }, /* 0x2a */ 462 { 1, "Lb4*=Mb1+L*=" }, /* 0x2b */ 463 { 2, "Lb4*=Md1+4*=" }, /* 0x2c */ 464 { 3, "Ld1+=Me1+=" }, /* 0x2d */ 465 { 0, "" }, /* 0x2e */ 466 { 0, "" }, /* 0x2f */ 441 467 /* R_PCREL_CALL */ 442 0, "L4=RD=Sb=",/* 0x30 */443 1, "L4=RD=Sb=",/* 0x31 */444 2, "L4=RD=Sb=",/* 0x32 */445 3, "L4=RD=Sb=",/* 0x33 */446 4, "L4=RD=Sb=",/* 0x34 */447 5, "L4=RD=Sb=",/* 0x35 */448 6, "L4=RD=Sb=",/* 0x36 */449 7, "L4=RD=Sb=",/* 0x37 */450 8, "L4=RD=Sb=",/* 0x38 */451 9, "L4=RD=Sb=",/* 0x39 */452 0, "L4=RD8<b+=Sb=",/* 0x3a */453 1, "L4=RD8<b+=Sb=",/* 0x3b */454 0, "L4=RD8<b+=Sd=",/* 0x3c */455 1, "L4=RD8<b+=Sd=",/* 0x3d */468 { 0, "L4=RD=Sb=" }, /* 0x30 */ 469 { 1, "L4=RD=Sb=" }, /* 0x31 */ 470 { 2, "L4=RD=Sb=" }, /* 0x32 */ 471 { 3, "L4=RD=Sb=" }, /* 0x33 */ 472 { 4, "L4=RD=Sb=" }, /* 0x34 */ 473 { 5, "L4=RD=Sb=" }, /* 0x35 */ 474 { 6, "L4=RD=Sb=" }, /* 0x36 */ 475 { 7, "L4=RD=Sb=" }, /* 0x37 */ 476 { 8, "L4=RD=Sb=" }, /* 0x38 */ 477 { 9, "L4=RD=Sb=" }, /* 0x39 */ 478 { 0, "L4=RD8<b+=Sb=" }, /* 0x3a */ 479 { 1, "L4=RD8<b+=Sb=" }, /* 0x3b */ 480 { 0, "L4=RD8<b+=Sd=" }, /* 0x3c */ 481 { 1, "L4=RD8<b+=Sd=" }, /* 0x3d */ 456 482 /* R_SHORT_PCREL_MODE */ 457 0, "",/* 0x3e */483 { 0, "" }, /* 0x3e */ 458 484 /* R_LONG_PCREL_MODE */ 459 0, "",/* 0x3f */485 { 0, "" }, /* 0x3f */ 460 486 /* R_ABS_CALL */ 461 0, "L4=RD=Sb=",/* 0x40 */462 1, "L4=RD=Sb=",/* 0x41 */463 2, "L4=RD=Sb=",/* 0x42 */464 3, "L4=RD=Sb=",/* 0x43 */465 4, "L4=RD=Sb=",/* 0x44 */466 5, "L4=RD=Sb=",/* 0x45 */467 6, "L4=RD=Sb=",/* 0x46 */468 7, "L4=RD=Sb=",/* 0x47 */469 8, "L4=RD=Sb=",/* 0x48 */470 9, "L4=RD=Sb=",/* 0x49 */471 0, "L4=RD8<b+=Sb=",/* 0x4a */472 1, "L4=RD8<b+=Sb=",/* 0x4b */473 0, "L4=RD8<b+=Sd=",/* 0x4c */474 1, "L4=RD8<b+=Sd=",/* 0x4d */487 { 0, "L4=RD=Sb=" }, /* 0x40 */ 488 { 1, "L4=RD=Sb=" }, /* 0x41 */ 489 { 2, "L4=RD=Sb=" }, /* 0x42 */ 490 { 3, "L4=RD=Sb=" }, /* 0x43 */ 491 { 4, "L4=RD=Sb=" }, /* 0x44 */ 492 { 5, "L4=RD=Sb=" }, /* 0x45 */ 493 { 6, "L4=RD=Sb=" }, /* 0x46 */ 494 { 7, "L4=RD=Sb=" }, /* 0x47 */ 495 { 8, "L4=RD=Sb=" }, /* 0x48 */ 496 { 9, "L4=RD=Sb=" }, /* 0x49 */ 497 { 0, "L4=RD8<b+=Sb=" }, /* 0x4a */ 498 { 1, "L4=RD8<b+=Sb=" }, /* 0x4b */ 499 { 0, "L4=RD8<b+=Sd=" }, /* 0x4c */ 500 { 1, "L4=RD8<b+=Sd=" }, /* 0x4d */ 475 501 /* R_RESERVED */ 476 0, "",/* 0x4e */477 0, "",/* 0x4f */502 { 0, "" }, /* 0x4e */ 503 { 0, "" }, /* 0x4f */ 478 504 /* R_DP_RELATIVE */ 479 0, "L4=SD=",/* 0x50 */480 1, "L4=SD=",/* 0x51 */481 2, "L4=SD=",/* 0x52 */482 3, "L4=SD=",/* 0x53 */483 4, "L4=SD=",/* 0x54 */484 5, "L4=SD=",/* 0x55 */485 6, "L4=SD=",/* 0x56 */486 7, "L4=SD=",/* 0x57 */487 8, "L4=SD=",/* 0x58 */488 9, "L4=SD=",/* 0x59 */489 10, "L4=SD=",/* 0x5a */490 11, "L4=SD=",/* 0x5b */491 12, "L4=SD=",/* 0x5c */492 13, "L4=SD=",/* 0x5d */493 14, "L4=SD=",/* 0x5e */494 15, "L4=SD=",/* 0x5f */495 16, "L4=SD=",/* 0x60 */496 17, "L4=SD=",/* 0x61 */497 18, "L4=SD=",/* 0x62 */498 19, "L4=SD=",/* 0x63 */499 20, "L4=SD=",/* 0x64 */500 21, "L4=SD=",/* 0x65 */501 22, "L4=SD=",/* 0x66 */502 23, "L4=SD=",/* 0x67 */503 24, "L4=SD=",/* 0x68 */504 25, "L4=SD=",/* 0x69 */505 26, "L4=SD=",/* 0x6a */506 27, "L4=SD=",/* 0x6b */507 28, "L4=SD=",/* 0x6c */508 29, "L4=SD=",/* 0x6d */509 30, "L4=SD=",/* 0x6e */510 31, "L4=SD=",/* 0x6f */511 32, "L4=Sb=",/* 0x70 */512 33, "L4=Sd=",/* 0x71 */505 { 0, "L4=SD=" }, /* 0x50 */ 506 { 1, "L4=SD=" }, /* 0x51 */ 507 { 2, "L4=SD=" }, /* 0x52 */ 508 { 3, "L4=SD=" }, /* 0x53 */ 509 { 4, "L4=SD=" }, /* 0x54 */ 510 { 5, "L4=SD=" }, /* 0x55 */ 511 { 6, "L4=SD=" }, /* 0x56 */ 512 { 7, "L4=SD=" }, /* 0x57 */ 513 { 8, "L4=SD=" }, /* 0x58 */ 514 { 9, "L4=SD=" }, /* 0x59 */ 515 { 10, "L4=SD=" }, /* 0x5a */ 516 { 11, "L4=SD=" }, /* 0x5b */ 517 { 12, "L4=SD=" }, /* 0x5c */ 518 { 13, "L4=SD=" }, /* 0x5d */ 519 { 14, "L4=SD=" }, /* 0x5e */ 520 { 15, "L4=SD=" }, /* 0x5f */ 521 { 16, "L4=SD=" }, /* 0x60 */ 522 { 17, "L4=SD=" }, /* 0x61 */ 523 { 18, "L4=SD=" }, /* 0x62 */ 524 { 19, "L4=SD=" }, /* 0x63 */ 525 { 20, "L4=SD=" }, /* 0x64 */ 526 { 21, "L4=SD=" }, /* 0x65 */ 527 { 22, "L4=SD=" }, /* 0x66 */ 528 { 23, "L4=SD=" }, /* 0x67 */ 529 { 24, "L4=SD=" }, /* 0x68 */ 530 { 25, "L4=SD=" }, /* 0x69 */ 531 { 26, "L4=SD=" }, /* 0x6a */ 532 { 27, "L4=SD=" }, /* 0x6b */ 533 { 28, "L4=SD=" }, /* 0x6c */ 534 { 29, "L4=SD=" }, /* 0x6d */ 535 { 30, "L4=SD=" }, /* 0x6e */ 536 { 31, "L4=SD=" }, /* 0x6f */ 537 { 32, "L4=Sb=" }, /* 0x70 */ 538 { 33, "L4=Sd=" }, /* 0x71 */ 513 539 /* R_RESERVED */ 514 0, "",/* 0x72 */515 0, "",/* 0x73 */516 0, "",/* 0x74 */517 0, "",/* 0x75 */518 0, "",/* 0x76 */519 0, "",/* 0x77 */540 { 0, "" }, /* 0x72 */ 541 { 0, "" }, /* 0x73 */ 542 { 0, "" }, /* 0x74 */ 543 { 0, "" }, /* 0x75 */ 544 { 0, "" }, /* 0x76 */ 545 { 0, "" }, /* 0x77 */ 520 546 /* R_DLT_REL */ 521 0, "L4=Sb=",/* 0x78 */522 1, "L4=Sd=",/* 0x79 */547 { 0, "L4=Sb=" }, /* 0x78 */ 548 { 1, "L4=Sd=" }, /* 0x79 */ 523 549 /* R_RESERVED */ 524 0, "",/* 0x7a */525 0, "",/* 0x7b */526 0, "",/* 0x7c */527 0, "",/* 0x7d */528 0, "",/* 0x7e */529 0, "",/* 0x7f */550 { 0, "" }, /* 0x7a */ 551 { 0, "" }, /* 0x7b */ 552 { 0, "" }, /* 0x7c */ 553 { 0, "" }, /* 0x7d */ 554 { 0, "" }, /* 0x7e */ 555 { 0, "" }, /* 0x7f */ 530 556 /* R_CODE_ONE_SYMBOL */ 531 0, "L4=SD=",/* 0x80 */532 1, "L4=SD=",/* 0x81 */533 2, "L4=SD=",/* 0x82 */534 3, "L4=SD=",/* 0x83 */535 4, "L4=SD=",/* 0x84 */536 5, "L4=SD=",/* 0x85 */537 6, "L4=SD=",/* 0x86 */538 7, "L4=SD=",/* 0x87 */539 8, "L4=SD=",/* 0x88 */540 9, "L4=SD=",/* 0x89 */541 10, "L4=SD=",/* 0x8q */542 11, "L4=SD=",/* 0x8b */543 12, "L4=SD=",/* 0x8c */544 13, "L4=SD=",/* 0x8d */545 14, "L4=SD=",/* 0x8e */546 15, "L4=SD=",/* 0x8f */547 16, "L4=SD=",/* 0x90 */548 17, "L4=SD=",/* 0x91 */549 18, "L4=SD=",/* 0x92 */550 19, "L4=SD=",/* 0x93 */551 20, "L4=SD=",/* 0x94 */552 21, "L4=SD=",/* 0x95 */553 22, "L4=SD=",/* 0x96 */554 23, "L4=SD=",/* 0x97 */555 24, "L4=SD=",/* 0x98 */556 25, "L4=SD=",/* 0x99 */557 26, "L4=SD=",/* 0x9a */558 27, "L4=SD=",/* 0x9b */559 28, "L4=SD=",/* 0x9c */560 29, "L4=SD=",/* 0x9d */561 30, "L4=SD=",/* 0x9e */562 31, "L4=SD=",/* 0x9f */563 32, "L4=Sb=",/* 0xa0 */564 33, "L4=Sd=",/* 0xa1 */557 { 0, "L4=SD=" }, /* 0x80 */ 558 { 1, "L4=SD=" }, /* 0x81 */ 559 { 2, "L4=SD=" }, /* 0x82 */ 560 { 3, "L4=SD=" }, /* 0x83 */ 561 { 4, "L4=SD=" }, /* 0x84 */ 562 { 5, "L4=SD=" }, /* 0x85 */ 563 { 6, "L4=SD=" }, /* 0x86 */ 564 { 7, "L4=SD=" }, /* 0x87 */ 565 { 8, "L4=SD=" }, /* 0x88 */ 566 { 9, "L4=SD=" }, /* 0x89 */ 567 { 10, "L4=SD=" }, /* 0x8q */ 568 { 11, "L4=SD=" }, /* 0x8b */ 569 { 12, "L4=SD=" }, /* 0x8c */ 570 { 13, "L4=SD=" }, /* 0x8d */ 571 { 14, "L4=SD=" }, /* 0x8e */ 572 { 15, "L4=SD=" }, /* 0x8f */ 573 { 16, "L4=SD=" }, /* 0x90 */ 574 { 17, "L4=SD=" }, /* 0x91 */ 575 { 18, "L4=SD=" }, /* 0x92 */ 576 { 19, "L4=SD=" }, /* 0x93 */ 577 { 20, "L4=SD=" }, /* 0x94 */ 578 { 21, "L4=SD=" }, /* 0x95 */ 579 { 22, "L4=SD=" }, /* 0x96 */ 580 { 23, "L4=SD=" }, /* 0x97 */ 581 { 24, "L4=SD=" }, /* 0x98 */ 582 { 25, "L4=SD=" }, /* 0x99 */ 583 { 26, "L4=SD=" }, /* 0x9a */ 584 { 27, "L4=SD=" }, /* 0x9b */ 585 { 28, "L4=SD=" }, /* 0x9c */ 586 { 29, "L4=SD=" }, /* 0x9d */ 587 { 30, "L4=SD=" }, /* 0x9e */ 588 { 31, "L4=SD=" }, /* 0x9f */ 589 { 32, "L4=Sb=" }, /* 0xa0 */ 590 { 33, "L4=Sd=" }, /* 0xa1 */ 565 591 /* R_RESERVED */ 566 0, "",/* 0xa2 */567 0, "",/* 0xa3 */568 0, "",/* 0xa4 */569 0, "",/* 0xa5 */570 0, "",/* 0xa6 */571 0, "",/* 0xa7 */572 0, "",/* 0xa8 */573 0, "",/* 0xa9 */574 0, "",/* 0xaa */575 0, "",/* 0xab */576 0, "",/* 0xac */577 0, "",/* 0xad */592 { 0, "" }, /* 0xa2 */ 593 { 0, "" }, /* 0xa3 */ 594 { 0, "" }, /* 0xa4 */ 595 { 0, "" }, /* 0xa5 */ 596 { 0, "" }, /* 0xa6 */ 597 { 0, "" }, /* 0xa7 */ 598 { 0, "" }, /* 0xa8 */ 599 { 0, "" }, /* 0xa9 */ 600 { 0, "" }, /* 0xaa */ 601 { 0, "" }, /* 0xab */ 602 { 0, "" }, /* 0xac */ 603 { 0, "" }, /* 0xad */ 578 604 /* R_MILLI_REL */ 579 0, "L4=Sb=",/* 0xae */580 1, "L4=Sd=",/* 0xaf */605 { 0, "L4=Sb=" }, /* 0xae */ 606 { 1, "L4=Sd=" }, /* 0xaf */ 581 607 /* R_CODE_PLABEL */ 582 0, "L4=Sb=",/* 0xb0 */583 1, "L4=Sd=",/* 0xb1 */608 { 0, "L4=Sb=" }, /* 0xb0 */ 609 { 1, "L4=Sd=" }, /* 0xb1 */ 584 610 /* R_BREAKPOINT */ 585 0, "L4=",/* 0xb2 */611 { 0, "L4=" }, /* 0xb2 */ 586 612 /* R_ENTRY */ 587 0, "Te=Ue=",/* 0xb3 */588 1, "Uf=",/* 0xb4 */613 { 0, "Te=Ue=" }, /* 0xb3 */ 614 { 1, "Uf=" }, /* 0xb4 */ 589 615 /* R_ALT_ENTRY */ 590 0, "",/* 0xb5 */616 { 0, "" }, /* 0xb5 */ 591 617 /* R_EXIT */ 592 0, "",/* 0xb6 */618 { 0, "" }, /* 0xb6 */ 593 619 /* R_BEGIN_TRY */ 594 0, "",/* 0xb7 */620 { 0, "" }, /* 0xb7 */ 595 621 /* R_END_TRY */ 596 0, "R0=",/* 0xb8 */597 1, "Rb4*=",/* 0xb9 */598 2, "Rd4*=",/* 0xba */622 { 0, "R0=" }, /* 0xb8 */ 623 { 1, "Rb4*=" }, /* 0xb9 */ 624 { 2, "Rd4*=" }, /* 0xba */ 599 625 /* R_BEGIN_BRTAB */ 600 0, "",/* 0xbb */626 { 0, "" }, /* 0xbb */ 601 627 /* R_END_BRTAB */ 602 0, "",/* 0xbc */628 { 0, "" }, /* 0xbc */ 603 629 /* R_STATEMENT */ 604 0, "Nb=",/* 0xbd */605 1, "Nc=",/* 0xbe */606 2, "Nd=",/* 0xbf */630 { 0, "Nb=" }, /* 0xbd */ 631 { 1, "Nc=" }, /* 0xbe */ 632 { 2, "Nd=" }, /* 0xbf */ 607 633 /* R_DATA_EXPR */ 608 0, "L4=",/* 0xc0 */634 { 0, "L4=" }, /* 0xc0 */ 609 635 /* R_CODE_EXPR */ 610 0, "L4=",/* 0xc1 */636 { 0, "L4=" }, /* 0xc1 */ 611 637 /* R_FSEL */ 612 0, "",/* 0xc2 */638 { 0, "" }, /* 0xc2 */ 613 639 /* R_LSEL */ 614 0, "",/* 0xc3 */640 { 0, "" }, /* 0xc3 */ 615 641 /* R_RSEL */ 616 0, "",/* 0xc4 */642 { 0, "" }, /* 0xc4 */ 617 643 /* R_N_MODE */ 618 0, "",/* 0xc5 */644 { 0, "" }, /* 0xc5 */ 619 645 /* R_S_MODE */ 620 0, "",/* 0xc6 */646 { 0, "" }, /* 0xc6 */ 621 647 /* R_D_MODE */ 622 0, "",/* 0xc7 */648 { 0, "" }, /* 0xc7 */ 623 649 /* R_R_MODE */ 624 0, "",/* 0xc8 */650 { 0, "" }, /* 0xc8 */ 625 651 /* R_DATA_OVERRIDE */ 626 0, "V0=",/* 0xc9 */627 1, "Vb=",/* 0xca */628 2, "Vc=",/* 0xcb */629 3, "Vd=",/* 0xcc */630 4, "Ve=",/* 0xcd */652 { 0, "V0=" }, /* 0xc9 */ 653 { 1, "Vb=" }, /* 0xca */ 654 { 2, "Vc=" }, /* 0xcb */ 655 { 3, "Vd=" }, /* 0xcc */ 656 { 4, "Ve=" }, /* 0xcd */ 631 657 /* R_TRANSLATED */ 632 0, "",/* 0xce */658 { 0, "" }, /* 0xce */ 633 659 /* R_AUX_UNWIND */ 634 0, "Sd=Vf=Ef=",/* 0xcf */660 { 0,"Sd=Ve=Ee=" }, /* 0xcf */ 635 661 /* R_COMP1 */ 636 0, "Ob=",/* 0xd0 */662 { 0, "Ob=" }, /* 0xd0 */ 637 663 /* R_COMP2 */ 638 0, "Ob=Sd=",/* 0xd1 */664 { 0, "Ob=Sd=" }, /* 0xd1 */ 639 665 /* R_COMP3 */ 640 0, "Ob=Ve=",/* 0xd2 */666 { 0, "Ob=Ve=" }, /* 0xd2 */ 641 667 /* R_PREV_FIXUP */ 642 0, "P",/* 0xd3 */643 1, "P",/* 0xd4 */644 2, "P",/* 0xd5 */645 3, "P",/* 0xd6 */668 { 0, "P" }, /* 0xd3 */ 669 { 1, "P" }, /* 0xd4 */ 670 { 2, "P" }, /* 0xd5 */ 671 { 3, "P" }, /* 0xd6 */ 646 672 /* R_SEC_STMT */ 647 0, "",/* 0xd7 */673 { 0, "" }, /* 0xd7 */ 648 674 /* R_N0SEL */ 649 0, "",/* 0xd8 */675 { 0, "" }, /* 0xd8 */ 650 676 /* R_N1SEL */ 651 0, "",/* 0xd9 */677 { 0, "" }, /* 0xd9 */ 652 678 /* R_LINETAB */ 653 0, "Eb=Sd=Ve=",/* 0xda */679 { 0, "Eb=Sd=Ve=" }, /* 0xda */ 654 680 /* R_LINETAB_ESC */ 655 0, "Eb=Mb=",/* 0xdb */681 { 0, "Eb=Mb=" }, /* 0xdb */ 656 682 /* R_LTP_OVERRIDE */ 657 0, "",/* 0xdc */683 { 0, "" }, /* 0xdc */ 658 684 /* R_COMMENT */ 659 0, "Ob=Ve=",/* 0xdd */685 { 0, "Ob=Vf=" }, /* 0xdd */ 660 686 /* R_RESERVED */ 661 0, "",/* 0xde */662 0, "",/* 0xdf */663 0, "",/* 0xe0 */664 0, "",/* 0xe1 */665 0, "",/* 0xe2 */666 0, "",/* 0xe3 */667 0, "",/* 0xe4 */668 0, "",/* 0xe5 */669 0, "",/* 0xe6 */670 0, "",/* 0xe7 */671 0, "",/* 0xe8 */672 0, "",/* 0xe9 */673 0, "",/* 0xea */674 0, "",/* 0xeb */675 0, "",/* 0xec */676 0, "",/* 0xed */677 0, "",/* 0xee */678 0, "",/* 0xef */679 0, "",/* 0xf0 */680 0, "",/* 0xf1 */681 0, "",/* 0xf2 */682 0, "",/* 0xf3 */683 0, "",/* 0xf4 */684 0, "",/* 0xf5 */685 0, "",/* 0xf6 */686 0, "",/* 0xf7 */687 0, "",/* 0xf8 */688 0, "",/* 0xf9 */689 0, "",/* 0xfa */690 0, "",/* 0xfb */691 0, "",/* 0xfc */692 0, "",/* 0xfd */693 0, "",/* 0xfe */694 0, "",/* 0xff */687 { 0, "" }, /* 0xde */ 688 { 0, "" }, /* 0xdf */ 689 { 0, "" }, /* 0xe0 */ 690 { 0, "" }, /* 0xe1 */ 691 { 0, "" }, /* 0xe2 */ 692 { 0, "" }, /* 0xe3 */ 693 { 0, "" }, /* 0xe4 */ 694 { 0, "" }, /* 0xe5 */ 695 { 0, "" }, /* 0xe6 */ 696 { 0, "" }, /* 0xe7 */ 697 { 0, "" }, /* 0xe8 */ 698 { 0, "" }, /* 0xe9 */ 699 { 0, "" }, /* 0xea */ 700 { 0, "" }, /* 0xeb */ 701 { 0, "" }, /* 0xec */ 702 { 0, "" }, /* 0xed */ 703 { 0, "" }, /* 0xee */ 704 { 0, "" }, /* 0xef */ 705 { 0, "" }, /* 0xf0 */ 706 { 0, "" }, /* 0xf1 */ 707 { 0, "" }, /* 0xf2 */ 708 { 0, "" }, /* 0xf3 */ 709 { 0, "" }, /* 0xf4 */ 710 { 0, "" }, /* 0xf5 */ 711 { 0, "" }, /* 0xf6 */ 712 { 0, "" }, /* 0xf7 */ 713 { 0, "" }, /* 0xf8 */ 714 { 0, "" }, /* 0xf9 */ 715 { 0, "" }, /* 0xfa */ 716 { 0, "" }, /* 0xfb */ 717 { 0, "" }, /* 0xfc */ 718 { 0, "" }, /* 0xfd */ 719 { 0, "" }, /* 0xfe */ 720 { 0, "" }, /* 0xff */ 695 721 }; 696 722 … … 778 804 779 805 #define SOM_HOWTO(TYPE, NAME) \ 780 HOWTO(TYPE, 0, 0, 32, false, 0, 0, hppa_som_reloc, NAME, false, 0, 0, false)806 HOWTO(TYPE, 0, 0, 32, FALSE, 0, 0, hppa_som_reloc, NAME, FALSE, 0, 0, FALSE) 781 807 782 808 static reloc_howto_type som_hppa_howto_table[] = { … … 1199 1225 bfd_put_8 (abfd, R_NO_RELOCATION + 31, p); 1200 1226 bfd_put_8 (abfd, 0xff, p + 1); 1201 bfd_put_16 (abfd, 0xffff, p + 2);1227 bfd_put_16 (abfd, (bfd_vma) 0xffff, p + 2); 1202 1228 p = try_prev_fixup (abfd, subspace_reloc_sizep, p, 4, queue); 1203 1229 while (skip >= 0x1000000) … … 1235 1261 { 1236 1262 bfd_put_8 (abfd, R_NO_RELOCATION + 28 + (((skip >> 2) - 1) >> 16), p); 1237 bfd_put_16 (abfd, ( skip >> 2) - 1, p + 1);1263 bfd_put_16 (abfd, (bfd_vma) (skip >> 2) - 1, p + 1); 1238 1264 p = try_prev_fixup (abfd, subspace_reloc_sizep, p, 3, queue); 1239 1265 } … … 1244 1270 bfd_put_8 (abfd, R_NO_RELOCATION + 31, p); 1245 1271 bfd_put_8 (abfd, (skip - 1) >> 16, p + 1); 1246 bfd_put_16 (abfd, skip - 1, p + 2);1272 bfd_put_16 (abfd, (bfd_vma) skip - 1, p + 2); 1247 1273 p = try_prev_fixup (abfd, subspace_reloc_sizep, p, 4, queue); 1248 1274 } … … 1258 1284 som_reloc_addend (abfd, addend, p, subspace_reloc_sizep, queue) 1259 1285 bfd *abfd; 1260 intaddend;1286 bfd_vma addend; 1261 1287 unsigned char *p; 1262 1288 unsigned int *subspace_reloc_sizep; 1263 1289 struct reloc_queue *queue; 1264 1290 { 1265 if ( (unsigned) (addend)+ 0x80 < 0x100)1291 if (addend + 0x80 < 0x100) 1266 1292 { 1267 1293 bfd_put_8 (abfd, R_DATA_OVERRIDE + 1, p); … … 1269 1295 p = try_prev_fixup (abfd, subspace_reloc_sizep, p, 2, queue); 1270 1296 } 1271 else if ( (unsigned) (addend)+ 0x8000 < 0x10000)1297 else if (addend + 0x8000 < 0x10000) 1272 1298 { 1273 1299 bfd_put_8 (abfd, R_DATA_OVERRIDE + 2, p); … … 1275 1301 p = try_prev_fixup (abfd, subspace_reloc_sizep, p, 3, queue); 1276 1302 } 1277 else if ( (unsigned) (addend)+ 0x800000 < 0x1000000)1303 else if (addend + 0x800000 < 0x1000000) 1278 1304 { 1279 1305 bfd_put_8 (abfd, R_DATA_OVERRIDE + 3, p); … … 1396 1422 { 1397 1423 bfd_put_8 (abfd, sym_num >> 16, p + 2); 1398 bfd_put_16 (abfd, sym_num, p + 3);1424 bfd_put_16 (abfd, (bfd_vma) sym_num, p + 3); 1399 1425 p = try_prev_fixup (abfd, subspace_reloc_sizep, p, 5, queue); 1400 1426 } … … 1454 1480 int *final_type, **final_types; 1455 1481 1456 final_types = (int **) bfd_alloc (abfd, sizeof (int *) * 6);1457 final_type = (int *) bfd_alloc (abfd, sizeof (int));1482 final_types = (int **) bfd_alloc (abfd, (bfd_size_type) sizeof (int *) * 6); 1483 final_type = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); 1458 1484 if (!final_types || !final_type) 1459 1485 return NULL; … … 1479 1505 case e_ltsel: 1480 1506 case e_rtsel: 1481 final_types[0] = (int *) bfd_alloc (abfd, sizeof (int));1507 final_types[0] = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); 1482 1508 if (!final_types[0]) 1483 1509 return NULL; … … 1495 1521 case e_lssel: 1496 1522 case e_rssel: 1497 final_types[0] = (int *) bfd_alloc (abfd, sizeof (int));1523 final_types[0] = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); 1498 1524 if (!final_types[0]) 1499 1525 return NULL; … … 1506 1532 case e_lsel: 1507 1533 case e_rsel: 1508 final_types[0] = (int *) bfd_alloc (abfd, sizeof (int));1534 final_types[0] = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); 1509 1535 if (!final_types[0]) 1510 1536 return NULL; … … 1517 1543 case e_ldsel: 1518 1544 case e_rdsel: 1519 final_types[0] = (int *) bfd_alloc (abfd, sizeof (int));1545 final_types[0] = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); 1520 1546 if (!final_types[0]) 1521 1547 return NULL; … … 1528 1554 case e_lrsel: 1529 1555 case e_rrsel: 1530 final_types[0] = (int *) bfd_alloc (abfd, sizeof (int));1556 final_types[0] = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); 1531 1557 if (!final_types[0]) 1532 1558 return NULL; … … 1538 1564 1539 1565 case e_nsel: 1540 final_types[0] = (int *) bfd_alloc (abfd, sizeof (int));1566 final_types[0] = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); 1541 1567 if (!final_types[0]) 1542 1568 return NULL; … … 1549 1575 case e_nlsel: 1550 1576 case e_nlrsel: 1551 final_types[0] = (int *) bfd_alloc (abfd, sizeof (int));1577 final_types[0] = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); 1552 1578 if (!final_types[0]) 1553 1579 return NULL; 1554 1580 *final_types[0] = R_N0SEL; 1555 final_types[1] = (int *) bfd_alloc (abfd, sizeof (int));1581 final_types[1] = (int *) bfd_alloc (abfd, (bfd_size_type) sizeof (int)); 1556 1582 if (!final_types[1]) 1557 1583 return NULL; … … 1572 1598 if (sym_diff) 1573 1599 { 1574 final_types[0] = (int *) bfd_alloc (abfd, sizeof (int)); 1575 final_types[1] = (int *) bfd_alloc (abfd, sizeof (int)); 1576 final_types[2] = (int *) bfd_alloc (abfd, sizeof (int)); 1577 final_types[3] = (int *) bfd_alloc (abfd, sizeof (int)); 1600 bfd_size_type amt = sizeof (int); 1601 final_types[0] = (int *) bfd_alloc (abfd, amt); 1602 final_types[1] = (int *) bfd_alloc (abfd, amt); 1603 final_types[2] = (int *) bfd_alloc (abfd, amt); 1604 final_types[3] = (int *) bfd_alloc (abfd, amt); 1578 1605 if (!final_types[0] || !final_types[1] || !final_types[2]) 1579 1606 return NULL; … … 1652 1679 if (sym_diff) 1653 1680 { 1654 final_types[0] = (int *) bfd_alloc (abfd, sizeof (int)); 1655 final_types[1] = (int *) bfd_alloc (abfd, sizeof (int)); 1656 final_types[2] = (int *) bfd_alloc (abfd, sizeof (int)); 1657 final_types[3] = (int *) bfd_alloc (abfd, sizeof (int)); 1681 bfd_size_type amt = sizeof (int); 1682 final_types[0] = (int *) bfd_alloc (abfd, amt); 1683 final_types[1] = (int *) bfd_alloc (abfd, amt); 1684 final_types[2] = (int *) bfd_alloc (abfd, amt); 1685 final_types[3] = (int *) bfd_alloc (abfd, amt); 1658 1686 if (!final_types[0] || !final_types[1] || !final_types[2]) 1659 1687 return NULL; … … 1689 1717 mode selector, then the pcrel relocation. Redundant selectors 1690 1718 will be eliminted as the relocs are sized and emitted. */ 1691 final_types[0] = (int *) bfd_alloc (abfd, sizeof (int)); 1719 bfd_size_type amt = sizeof (int); 1720 final_types[0] = (int *) bfd_alloc (abfd, amt); 1692 1721 if (!final_types[0]) 1693 1722 return NULL; … … 1737 1766 1738 1767 /* som_mkobject will set bfd_error if som_mkobject fails. */ 1739 if ( som_mkobject (abfd) != true)1768 if (! som_mkobject (abfd)) 1740 1769 return 0; 1741 1770 … … 1774 1803 /* Allocate space to hold the saved exec header information. */ 1775 1804 obj_som_exec_data (abfd) = (struct som_exec_data *) 1776 bfd_zalloc (abfd, sizeof (struct som_exec_data));1805 bfd_zalloc (abfd, (bfd_size_type) sizeof (struct som_exec_data)); 1777 1806 if (obj_som_exec_data (abfd) == NULL) 1778 1807 return NULL; … … 1810 1839 obj_som_exec_data (abfd)->exec_flags = aux_hdrp->exec_flags; 1811 1840 } 1841 1842 obj_som_exec_data (abfd)->version_id = file_hdrp->version_id; 1812 1843 1813 1844 bfd_default_set_arch_mach (abfd, bfd_arch_hppa, pa10); … … 1837 1868 associated subspaces. */ 1838 1869 1839 static b oolean1870 static bfd_boolean 1840 1871 setup_sections (abfd, file_hdr, current_offset) 1841 1872 bfd *abfd; … … 1846 1877 unsigned int space_index, i; 1847 1878 unsigned int total_subspaces = 0; 1848 asection **subspace_sections, *section; 1879 asection **subspace_sections = NULL; 1880 asection *section; 1881 bfd_size_type amt; 1849 1882 1850 1883 /* First, read in space names. */ 1851 1884 1852 space_strings = bfd_malloc (file_hdr->space_strings_size); 1853 if (!space_strings && file_hdr->space_strings_size != 0) 1885 amt = file_hdr->space_strings_size; 1886 space_strings = bfd_malloc (amt); 1887 if (!space_strings && amt != 0) 1854 1888 goto error_return; 1855 1889 1856 1890 if (bfd_seek (abfd, current_offset + file_hdr->space_strings_location, 1857 SEEK_SET) <0)1891 SEEK_SET) != 0) 1858 1892 goto error_return; 1859 if (bfd_read (space_strings, 1, file_hdr->space_strings_size, abfd) 1860 != file_hdr->space_strings_size) 1893 if (bfd_bread (space_strings, amt, abfd) != amt) 1861 1894 goto error_return; 1862 1895 … … 1874 1907 (current_offset + file_hdr->space_location 1875 1908 + space_index * sizeof space), 1876 SEEK_SET) <0)1909 SEEK_SET) != 0) 1877 1910 goto error_return; 1878 if (bfd_read (&space, 1, sizeof space, abfd) != sizeof space) 1911 amt = sizeof space; 1912 if (bfd_bread (&space, amt, abfd) != amt) 1879 1913 goto error_return; 1880 1914 … … 1883 1917 1884 1918 /* Make a section out of it. */ 1885 newname = bfd_alloc (abfd, strlen (space.name.n_name) + 1); 1919 amt = strlen (space.name.n_name) + 1; 1920 newname = bfd_alloc (abfd, amt); 1886 1921 if (!newname) 1887 1922 goto error_return; … … 1896 1931 1897 1932 /* Set up all the attributes for the space. */ 1898 if ( bfd_som_set_section_attributes (space_asect, space.is_defined,1899 space.is_private, space.sort_key,1900 space.space_number) == false)1933 if (! bfd_som_set_section_attributes (space_asect, space.is_defined, 1934 space.is_private, space.sort_key, 1935 space.space_number)) 1901 1936 goto error_return; 1902 1937 … … 1909 1944 (current_offset + file_hdr->subspace_location 1910 1945 + space.subspace_index * sizeof subspace), 1911 SEEK_SET) <0)1946 SEEK_SET) != 0) 1912 1947 goto error_return; 1913 if (bfd_read (&subspace, 1, sizeof subspace, abfd) != sizeof subspace) 1948 amt = sizeof subspace; 1949 if (bfd_bread (&subspace, amt, abfd) != amt) 1914 1950 goto error_return; 1915 1951 /* Seek back to the start of the subspaces for loop below. */ … … 1917 1953 (current_offset + file_hdr->subspace_location 1918 1954 + space.subspace_index * sizeof subspace), 1919 SEEK_SET) <0)1955 SEEK_SET) != 0) 1920 1956 goto error_return; 1921 1957 1922 1958 /* Setup the start address and file loc from the first subspace 1923 1959 record. */ 1924 1960 space_asect->vma = subspace.subspace_start; 1925 1961 space_asect->filepos = subspace.file_loc_init_value + current_offset; 1926 1962 space_asect->alignment_power = log2 (subspace.alignment); 1927 if (space_asect->alignment_power == -1)1963 if (space_asect->alignment_power == (unsigned) -1) 1928 1964 goto error_return; 1929 1965 … … 1939 1975 1940 1976 /* Read in the next subspace. */ 1941 if (bfd_read (&subspace, 1, sizeof subspace, abfd)1942 != sizeof subspace)1977 amt = sizeof subspace; 1978 if (bfd_bread (&subspace, amt, abfd) != amt) 1943 1979 goto error_return; 1944 1980 … … 1946 1982 subspace.name.n_name = subspace.name.n_strx + space_strings; 1947 1983 1948 newname = bfd_alloc (abfd, strlen (subspace.name.n_name) + 1); 1984 amt = strlen (subspace.name.n_name) + 1; 1985 newname = bfd_alloc (abfd, amt); 1949 1986 if (!newname) 1950 1987 goto error_return; … … 1957 1994 1958 1995 /* Store private information about the section. */ 1959 if ( bfd_som_set_subsection_attributes (subspace_asect, space_asect,1960 subspace.access_control_bits,1961 subspace.sort_key,1962 subspace.quadrant) == false)1996 if (! bfd_som_set_subsection_attributes (subspace_asect, space_asect, 1997 subspace.access_control_bits, 1998 subspace.sort_key, 1999 subspace.quadrant)) 1963 2000 goto error_return; 1964 2001 … … 2037 2074 /* We can not determine this yet. When we read in the 2038 2075 relocation table the correct value will be filled in. */ 2039 subspace_asect->reloc_count = -1;2076 subspace_asect->reloc_count = (unsigned) -1; 2040 2077 } 2041 2078 … … 2050 2087 + current_offset); 2051 2088 subspace_asect->alignment_power = log2 (subspace.alignment); 2052 if (subspace_asect->alignment_power == -1)2089 if (subspace_asect->alignment_power == (unsigned) -1) 2053 2090 goto error_return; 2054 2091 } 2055 2092 2056 2093 /* This can happen for a .o which defines symbols in otherwise 2057 2094 empty subspaces. */ 2058 2095 if (!save_subspace.file_loc_init_value) 2059 2096 { … … 2075 2112 /* Now that we've read in all the subspace records, we need to assign 2076 2113 a target index to each subspace. */ 2077 subspace_sections = (asection **) bfd_malloc (total_subspaces 2078 * sizeof (asection *)); 2114 amt = total_subspaces; 2115 amt *= sizeof (asection *); 2116 subspace_sections = (asection **) bfd_malloc (amt); 2079 2117 if (subspace_sections == NULL) 2080 2118 goto error_return; … … 2102 2140 free (subspace_sections); 2103 2141 2104 return true;2142 return TRUE; 2105 2143 2106 2144 error_return: … … 2110 2148 if (subspace_sections != NULL) 2111 2149 free (subspace_sections); 2112 return false;2150 return FALSE; 2113 2151 } 2114 2152 … … 2124 2162 struct lst_header lst_header; 2125 2163 struct som_entry som_entry; 2164 bfd_size_type amt; 2126 2165 #define ENTRY_SIZE sizeof (struct som_entry) 2127 2166 2128 if (bfd_read ((PTR) & file_hdr, 1, FILE_HDR_SIZE, abfd) != FILE_HDR_SIZE) 2167 amt = FILE_HDR_SIZE; 2168 if (bfd_bread ((PTR) &file_hdr, amt, abfd) != amt) 2129 2169 { 2130 2170 if (bfd_get_error () != bfd_error_system_call) … … 2160 2200 /* Read the lst header and determine where the SOM directory begins. */ 2161 2201 2162 if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) <0)2202 if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) 2163 2203 { 2164 2204 if (bfd_get_error () != bfd_error_system_call) … … 2167 2207 } 2168 2208 2169 if (bfd_read ((PTR) & lst_header, 1, SLSTHDR, abfd) != SLSTHDR) 2209 amt = SLSTHDR; 2210 if (bfd_bread ((PTR) &lst_header, amt, abfd) != amt) 2170 2211 { 2171 2212 if (bfd_get_error () != bfd_error_system_call) … … 2176 2217 /* Position to and read the first directory entry. */ 2177 2218 2178 if (bfd_seek (abfd, lst_header.dir_loc, SEEK_SET) <0)2219 if (bfd_seek (abfd, lst_header.dir_loc, SEEK_SET) != 0) 2179 2220 { 2180 2221 if (bfd_get_error () != bfd_error_system_call) … … 2183 2224 } 2184 2225 2185 if (bfd_read ((PTR) & som_entry, 1, ENTRY_SIZE, abfd) != ENTRY_SIZE) 2226 amt = ENTRY_SIZE; 2227 if (bfd_bread ((PTR) &som_entry, amt, abfd) != amt) 2186 2228 { 2187 2229 if (bfd_get_error () != bfd_error_system_call) … … 2192 2234 /* Now position to the first SOM. */ 2193 2235 2194 if (bfd_seek (abfd, som_entry.location, SEEK_SET) <0)2236 if (bfd_seek (abfd, som_entry.location, SEEK_SET) != 0) 2195 2237 { 2196 2238 if (bfd_get_error () != bfd_error_system_call) … … 2202 2244 2203 2245 /* And finally, re-read the som header. */ 2204 2205 if (bfd_ read ((PTR) & file_hdr, 1, FILE_HDR_SIZE, abfd) != FILE_HDR_SIZE)2246 amt = FILE_HDR_SIZE; 2247 if (bfd_bread ((PTR) &file_hdr, amt, abfd) != amt) 2206 2248 { 2207 2249 if (bfd_get_error () != bfd_error_system_call) … … 2231 2273 if (file_hdr.aux_header_size != 0) 2232 2274 { 2233 if (bfd_read ((PTR) & aux_hdr, 1, AUX_HDR_SIZE, abfd) != AUX_HDR_SIZE) 2275 amt = AUX_HDR_SIZE; 2276 if (bfd_bread ((PTR) &aux_hdr, amt, abfd) != amt) 2234 2277 { 2235 2278 if (bfd_get_error () != bfd_error_system_call) … … 2252 2295 /* Create a SOM object. */ 2253 2296 2254 static b oolean2297 static bfd_boolean 2255 2298 som_mkobject (abfd) 2256 2299 bfd *abfd; … … 2258 2301 /* Allocate memory to hold backend information. */ 2259 2302 abfd->tdata.som_data = (struct som_data_struct *) 2260 bfd_zalloc (abfd, sizeof (struct som_data_struct));2303 bfd_zalloc (abfd, (bfd_size_type) sizeof (struct som_data_struct)); 2261 2304 if (abfd->tdata.som_data == NULL) 2262 return false;2263 return true;2305 return FALSE; 2306 return TRUE; 2264 2307 } 2265 2308 … … 2268 2311 is only meant to handle relocatable objects. */ 2269 2312 2270 static b oolean2313 static bfd_boolean 2271 2314 som_prep_headers (abfd) 2272 2315 bfd *abfd; … … 2274 2317 struct header *file_hdr; 2275 2318 asection *section; 2319 bfd_size_type amt = sizeof (struct header); 2276 2320 2277 2321 /* Make and attach a file header to the BFD. */ 2278 file_hdr = (struct header *) bfd_zalloc (abfd, sizeof (struct header));2322 file_hdr = (struct header *) bfd_zalloc (abfd, amt); 2279 2323 if (file_hdr == NULL) 2280 return false;2324 return FALSE; 2281 2325 obj_som_file_hdr (abfd) = file_hdr; 2282 2326 2283 2327 if (abfd->flags & (EXEC_P | DYNAMIC)) 2284 2328 { 2285 2286 2329 /* Make and attach an exec header to the BFD. */ 2287 obj_som_exec_hdr (abfd) = (struct som_exec_auxhdr *) 2288 bfd_zalloc (abfd, sizeof (struct som_exec_auxhdr)); 2330 amt = sizeof (struct som_exec_auxhdr); 2331 obj_som_exec_hdr (abfd) = 2332 (struct som_exec_auxhdr *) bfd_zalloc (abfd, amt); 2289 2333 if (obj_som_exec_hdr (abfd) == NULL) 2290 return false;2334 return FALSE; 2291 2335 2292 2336 if (abfd->flags & D_PAGED) … … 2304 2348 file_hdr->a_magic = RELOC_MAGIC; 2305 2349 2306 /* Only new format SOM is supported. */2307 file_hdr->version_id = NEW_VERSION_ID;2308 2309 2350 /* These fields are optional, and embedding timestamps is not always 2310 2351 a wise thing to do, it makes comparing objects during a multi-stage … … 2331 2372 { 2332 2373 /* Allocate space for the space dictionary. */ 2374 amt = sizeof (struct space_dictionary_record); 2333 2375 som_section_data (section)->space_dict = 2334 (struct space_dictionary_record *) 2335 bfd_zalloc (abfd, sizeof (struct space_dictionary_record)); 2376 (struct space_dictionary_record *) bfd_zalloc (abfd, amt); 2336 2377 if (som_section_data (section)->space_dict == NULL) 2337 return false;2378 return FALSE; 2338 2379 /* Set space attributes. Note most attributes of SOM spaces 2339 2380 are set based on the subspaces it contains. */ … … 2354 2395 { 2355 2396 /* Allocate space for the subspace dictionary. */ 2356 som_section_data (section)->subspace_dict2357 = (struct subspace_dictionary_record *)2358 bfd_zalloc (abfd, sizeof (struct subspace_dictionary_record));2397 amt = sizeof (struct subspace_dictionary_record); 2398 som_section_data (section)->subspace_dict = 2399 (struct subspace_dictionary_record *) bfd_zalloc (abfd, amt); 2359 2400 if (som_section_data (section)->subspace_dict == NULL) 2360 return false;2401 return FALSE; 2361 2402 2362 2403 /* Set subspace attributes. Basic stuff is done here, additional … … 2393 2434 } 2394 2435 } 2395 return true;2396 } 2397 2398 /* Return true if the given section is a SOM space, falseotherwise. */2399 2400 static b oolean2436 return TRUE; 2437 } 2438 2439 /* Return TRUE if the given section is a SOM space, FALSE otherwise. */ 2440 2441 static bfd_boolean 2401 2442 som_is_space (section) 2402 2443 asection *section; … … 2405 2446 subspace. */ 2406 2447 if (som_section_data (section)->copy_data == NULL) 2407 return false;2448 return FALSE; 2408 2449 2409 2450 /* If the containing space isn't the same as the given section, … … 2412 2453 && (som_section_data (section)->copy_data->container->output_section 2413 2454 != section)) 2414 return false;2455 return FALSE; 2415 2456 2416 2457 /* OK. Must be a space. */ 2417 return true;2418 } 2419 2420 /* Return true if the given section is a SOM subspace, falseotherwise. */2421 2422 static b oolean2458 return TRUE; 2459 } 2460 2461 /* Return TRUE if the given section is a SOM subspace, FALSE otherwise. */ 2462 2463 static bfd_boolean 2423 2464 som_is_subspace (section) 2424 2465 asection *section; … … 2427 2468 subspace. */ 2428 2469 if (som_section_data (section)->copy_data == NULL) 2429 return false;2470 return FALSE; 2430 2471 2431 2472 /* If the containing space is the same as the given section, … … 2434 2475 || (som_section_data (section)->copy_data->container->output_section 2435 2476 == section)) 2436 return false;2477 return FALSE; 2437 2478 2438 2479 /* OK. Must be a subspace. */ 2439 return true;2440 } 2441 2442 /* Return trueif the given space containins the given subspace. It2480 return TRUE; 2481 } 2482 2483 /* Return TRUE if the given space containins the given subspace. It 2443 2484 is safe to assume space really is a space, and subspace really 2444 2485 is a subspace. */ 2445 2486 2446 static b oolean2487 static bfd_boolean 2447 2488 som_is_container (space, subspace) 2448 2489 asection *space, *subspace; … … 2547 2588 unsigned long num_syms; 2548 2589 { 2549 inti;2590 unsigned long i; 2550 2591 asection *section; 2551 2592 asymbol **sorted_syms; 2593 bfd_size_type amt; 2552 2594 2553 2595 /* Most SOM relocations involving a symbol have a length which is … … 2575 2617 for (section = abfd->sections; section != NULL; section = section->next) 2576 2618 { 2577 int i;2619 int j; 2578 2620 2579 2621 /* Does this section have any relocations? */ 2580 if ( section->reloc_count <= 0)2622 if ((int) section->reloc_count <= 0) 2581 2623 continue; 2582 2624 2583 2625 /* Walk through each relocation for this section. */ 2584 for ( i = 1; i < section->reloc_count; i++)2626 for (j = 1; j < (int) section->reloc_count; j++) 2585 2627 { 2586 arelent *reloc = section->orelocation[ i];2628 arelent *reloc = section->orelocation[j]; 2587 2629 int scale; 2588 2630 … … 2621 2663 /* Sort a copy of the symbol table, rather than the canonical 2622 2664 output symbol table. */ 2623 sorted_syms = (asymbol **) bfd_zalloc (abfd, num_syms * sizeof (asymbol *)); 2665 amt = num_syms; 2666 amt *= sizeof (asymbol *); 2667 sorted_syms = (asymbol **) bfd_zalloc (abfd, amt); 2624 2668 memcpy (sorted_syms, syms, num_syms * sizeof (asymbol *)); 2625 2669 qsort (sorted_syms, num_syms, sizeof (asymbol *), compare_syms); … … 2639 2683 } 2640 2684 2641 static b oolean2685 static bfd_boolean 2642 2686 som_write_fixups (abfd, current_offset, total_reloc_sizep) 2643 2687 bfd *abfd; … … 2654 2698 unsigned int num_spaces = obj_som_file_hdr (abfd)->space_total; 2655 2699 asection *section = abfd->sections; 2700 bfd_size_type amt; 2656 2701 2657 2702 memset (tmp_space, 0, SOM_TMP_BUFSIZE); … … 2678 2723 subsection = subsection->next) 2679 2724 { 2680 int reloc_offset, current_rounding_mode; 2725 int reloc_offset; 2726 unsigned int current_rounding_mode; 2681 2727 #ifndef NO_PCREL_MODES 2682 2728 int current_call_mode; … … 2706 2752 for this subspace in preparation for writing out its fixup 2707 2753 stream. */ 2708 if (bfd_seek (abfd, current_offset + total_reloc_size, SEEK_SET) <0)2709 return false;2754 if (bfd_seek (abfd, current_offset + total_reloc_size, SEEK_SET) != 0) 2755 return FALSE; 2710 2756 2711 2757 /* Buffer space has already been allocated. Just perform some … … 2744 2790 if (p - tmp_space + 100 > SOM_TMP_BUFSIZE) 2745 2791 { 2746 if (bfd_write ((PTR) tmp_space, p - tmp_space, 1, abfd)2747 != p - tmp_space)2748 return false;2792 amt = p - tmp_space; 2793 if (bfd_bwrite ((PTR) tmp_space, amt, abfd) != amt) 2794 return FALSE; 2749 2795 2750 2796 p = tmp_space; … … 2828 2874 bfd_put_8 (abfd, bfd_reloc->howto->type + 33, p); 2829 2875 bfd_put_8 (abfd, sym_num >> 16, p + 1); 2830 bfd_put_16 (abfd, sym_num, p + 2);2876 bfd_put_16 (abfd, (bfd_vma) sym_num, p + 2); 2831 2877 p = try_prev_fixup (abfd, &subspace_reloc_size, 2832 2878 p, 4, reloc_queue); … … 2857 2903 bfd_put_8 (abfd, bfd_reloc->howto->type + 1, p); 2858 2904 bfd_put_8 (abfd, sym_num >> 16, p + 1); 2859 bfd_put_16 (abfd, sym_num, p + 2);2905 bfd_put_16 (abfd, (bfd_vma) sym_num, p + 2); 2860 2906 p = try_prev_fixup (abfd, &subspace_reloc_size, 2861 2907 p, 4, reloc_queue); … … 2867 2913 case R_ENTRY: 2868 2914 { 2869 int tmp;2915 unsigned int tmp; 2870 2916 arelent *tmp_reloc = NULL; 2871 2917 bfd_put_8 (abfd, R_ENTRY, p); … … 2940 2986 2941 2987 case R_END_TRY: 2942 /* The end of a exception handling region. The reloc's2988 /* The end of an exception handling region. The reloc's 2943 2989 addend contains the offset of the exception handling 2944 2990 code. */ … … 2979 3025 bfd_put_8 (abfd, 0x80, p + 1); 2980 3026 bfd_put_8 (abfd, sym_num >> 16, p + 2); 2981 bfd_put_16 (abfd, sym_num, p + 3);3027 bfd_put_16 (abfd, (bfd_vma) sym_num, p + 3); 2982 3028 p = try_prev_fixup (abfd, &subspace_reloc_size, 2983 3029 p, 5, reloc_queue); … … 3007 3053 /* Last BFD relocation for a subspace has been processed. 3008 3054 Map the rest of the subspace with R_NO_RELOCATION fixups. */ 3009 p = som_reloc_skip (abfd, bfd_section_size (abfd, subsection)3010 - reloc_offset,3055 p = som_reloc_skip (abfd, (bfd_section_size (abfd, subsection) 3056 - reloc_offset), 3011 3057 p, &subspace_reloc_size, reloc_queue); 3012 3058 3013 3059 /* Scribble out the relocations. */ 3014 if (bfd_write ((PTR) tmp_space, p - tmp_space, 1, abfd)3015 != p - tmp_space)3016 return false;3060 amt = p - tmp_space; 3061 if (bfd_bwrite ((PTR) tmp_space, amt, abfd) != amt) 3062 return FALSE; 3017 3063 p = tmp_space; 3018 3064 … … 3024 3070 } 3025 3071 *total_reloc_sizep = total_reloc_size; 3026 return true;3072 return TRUE; 3027 3073 } 3028 3074 3029 3075 /* Write out the space/subspace string table. */ 3030 3076 3031 static b oolean3077 static bfd_boolean 3032 3078 som_write_space_strings (abfd, current_offset, string_sizep) 3033 3079 bfd *abfd; … … 3042 3088 unsigned int strings_size = 0; 3043 3089 asection *section; 3090 bfd_size_type amt; 3044 3091 3045 3092 /* Seek to the start of the space strings in preparation for writing 3046 3093 them out. */ 3047 if (bfd_seek (abfd, current_offset, SEEK_SET) <0)3048 return false;3094 if (bfd_seek (abfd, (file_ptr) current_offset, SEEK_SET) != 0) 3095 return FALSE; 3049 3096 3050 3097 /* Walk through all the spaces and subspaces (order is not important) … … 3063 3110 3064 3111 /* If there is not enough room for the next entry, then dump the 3065 3066 3067 3112 current buffer contents now and maybe allocate a larger 3113 buffer. Each entry will take 4 bytes to hold the string 3114 length + the string itself + null terminator. */ 3068 3115 if (p - tmp_space + 5 + length > tmp_space_size) 3069 3116 { 3070 3117 /* Flush buffer before refilling or reallocating. */ 3071 if (bfd_write ((PTR) &tmp_space[0], p - tmp_space, 1, abfd)3072 != p - tmp_space)3073 return false;3118 amt = p - tmp_space; 3119 if (bfd_bwrite ((PTR) &tmp_space[0], amt, abfd) != amt) 3120 return FALSE; 3074 3121 3075 3122 /* Reallocate if now empty buffer still too small. */ … … 3077 3124 { 3078 3125 /* Ensure a minimum growth factor to avoid O(n**2) space 3079 3080 3081 wasting less then 50% space. (Note that we cannot3082 3083 3084 3085 3126 consumption for n strings. The optimal minimum 3127 factor seems to be 2, as no other value can guarantee 3128 wasting less than 50% space. (Note that we cannot 3129 deallocate space allocated by `alloca' without 3130 returning from this function.) The same technique is 3131 used a few more times below when a buffer is 3132 reallocated. */ 3086 3133 tmp_space_size = MAX (2 * tmp_space_size, 5 + length); 3087 3134 tmp_space = alloca (tmp_space_size); … … 3094 3141 /* First element in a string table entry is the length of the 3095 3142 string. Alignment issues are already handled. */ 3096 bfd_put_32 (abfd, length, p);3143 bfd_put_32 (abfd, (bfd_vma) length, p); 3097 3144 p += 4; 3098 3145 strings_size += 4; … … 3120 3167 /* Done with the space/subspace strings. Write out any information 3121 3168 contained in a partial block. */ 3122 if (bfd_write ((PTR) &tmp_space[0], p - tmp_space, 1, abfd) != p - tmp_space) 3123 return false; 3169 amt = p - tmp_space; 3170 if (bfd_bwrite ((PTR) &tmp_space[0], amt, abfd) != amt) 3171 return FALSE; 3124 3172 *string_sizep = strings_size; 3125 return true;3173 return TRUE; 3126 3174 } 3127 3175 3128 3176 /* Write out the symbol string table. */ 3129 3177 3130 static b oolean3178 static bfd_boolean 3131 3179 som_write_symbol_strings (abfd, current_offset, syms, num_syms, string_sizep, 3132 3180 compilation_unit) … … 3148 3196 unsigned int strings_size = 0; 3149 3197 unsigned char *comp[4]; 3198 bfd_size_type amt; 3150 3199 3151 3200 /* This gets a bit gruesome because of the compilation unit. The … … 3165 3214 /* Seek to the start of the space strings in preparation for writing 3166 3215 them out. */ 3167 if (bfd_seek (abfd, current_offset, SEEK_SET) <0)3168 return false;3216 if (bfd_seek (abfd, (file_ptr) current_offset, SEEK_SET) != 0) 3217 return FALSE; 3169 3218 3170 3219 if (compilation_unit) … … 3180 3229 { 3181 3230 /* Flush buffer before refilling or reallocating. */ 3182 if (bfd_write ((PTR) &tmp_space[0], p - tmp_space, 1, abfd)3183 != p - tmp_space)3184 return false;3231 amt = p - tmp_space; 3232 if (bfd_bwrite ((PTR) &tmp_space[0], amt, abfd) != amt) 3233 return FALSE; 3185 3234 3186 3235 /* Reallocate if now empty buffer still too small. */ … … 3193 3242 3194 3243 /* Reset to beginning of the (possibly new) buffer 3195 3244 space. */ 3196 3245 p = tmp_space; 3197 3246 } … … 3201 3250 also an appropriate time to fill in the string index 3202 3251 field in the symbol table entry. */ 3203 bfd_put_32 (abfd, length, p);3252 bfd_put_32 (abfd, (bfd_vma) length, p); 3204 3253 strings_size += 4; 3205 3254 p += 4; … … 3249 3298 { 3250 3299 /* Flush buffer before refilling or reallocating. */ 3251 if (bfd_write ((PTR) &tmp_space[0], p - tmp_space, 1, abfd)3252 != p - tmp_space)3253 return false;3300 amt = p - tmp_space; 3301 if (bfd_bwrite ((PTR) &tmp_space[0], amt, abfd) != amt) 3302 return FALSE; 3254 3303 3255 3304 /* Reallocate if now empty buffer still too small. */ … … 3269 3318 an appropriate time to fill in the string index field in the 3270 3319 symbol table entry. */ 3271 bfd_put_32 (abfd, length, p);3320 bfd_put_32 (abfd, (bfd_vma) length, p); 3272 3321 strings_size += 4; 3273 3322 p += 4; … … 3290 3339 3291 3340 /* Scribble out any partial block. */ 3292 if (bfd_write ((PTR) &tmp_space[0], p - tmp_space, 1, abfd) != p - tmp_space) 3293 return false; 3341 amt = p - tmp_space; 3342 if (bfd_bwrite ((PTR) &tmp_space[0], amt, abfd) != amt) 3343 return FALSE; 3294 3344 3295 3345 *string_sizep = strings_size; 3296 return true;3346 return TRUE; 3297 3347 } 3298 3348 … … 3301 3351 writing parts of the object file. */ 3302 3352 3303 static b oolean3353 static bfd_boolean 3304 3354 som_begin_writing (abfd) 3305 3355 bfd *abfd; … … 3344 3394 if (obj_som_version_hdr (abfd) != NULL) 3345 3395 { 3346 unsigned intlen;3347 3348 if (bfd_seek (abfd, current_offset, SEEK_SET) <0)3349 return false;3396 bfd_size_type len; 3397 3398 if (bfd_seek (abfd, (file_ptr) current_offset, SEEK_SET) != 0) 3399 return FALSE; 3350 3400 3351 3401 /* Write the aux_id structure and the string length. */ … … 3353 3403 obj_som_file_hdr (abfd)->aux_header_size += len; 3354 3404 current_offset += len; 3355 if (bfd_ write ((PTR) obj_som_version_hdr (abfd), len, 1, abfd) != len)3356 return false;3405 if (bfd_bwrite ((PTR) obj_som_version_hdr (abfd), len, abfd) != len) 3406 return FALSE; 3357 3407 3358 3408 /* Write the version string. */ … … 3360 3410 obj_som_file_hdr (abfd)->aux_header_size += len; 3361 3411 current_offset += len; 3362 if (bfd_ write ((PTR) obj_som_version_hdr (abfd)->user_string,3363 len, 1, abfd)!= len)3364 return false;3412 if (bfd_bwrite ((PTR) obj_som_version_hdr (abfd)->user_string, len, abfd) 3413 != len) 3414 return FALSE; 3365 3415 } 3366 3416 3367 3417 if (obj_som_copyright_hdr (abfd) != NULL) 3368 3418 { 3369 unsigned intlen;3370 3371 if (bfd_seek (abfd, current_offset, SEEK_SET) <0)3372 return false;3419 bfd_size_type len; 3420 3421 if (bfd_seek (abfd, (file_ptr) current_offset, SEEK_SET) != 0) 3422 return FALSE; 3373 3423 3374 3424 /* Write the aux_id structure and the string length. */ … … 3376 3426 obj_som_file_hdr (abfd)->aux_header_size += len; 3377 3427 current_offset += len; 3378 if (bfd_ write ((PTR) obj_som_copyright_hdr (abfd), len, 1, abfd) != len)3379 return false;3428 if (bfd_bwrite ((PTR) obj_som_copyright_hdr (abfd), len, abfd) != len) 3429 return FALSE; 3380 3430 3381 3431 /* Write the copyright string. */ … … 3383 3433 obj_som_file_hdr (abfd)->aux_header_size += len; 3384 3434 current_offset += len; 3385 if (bfd_ write ((PTR) obj_som_copyright_hdr (abfd)->copyright,3386 len, 1, abfd)!= len)3387 return false;3435 if (bfd_bwrite ((PTR) obj_som_copyright_hdr (abfd)->copyright, len, abfd) 3436 != len) 3437 return FALSE; 3388 3438 } 3389 3439 … … 3432 3482 3433 3483 /* Scribble out the space strings. */ 3434 if ( som_write_space_strings (abfd, current_offset, &strings_size) == false)3435 return false;3484 if (! som_write_space_strings (abfd, current_offset, &strings_size)) 3485 return FALSE; 3436 3486 3437 3487 /* Record total string table size in the header and update the … … 3629 3679 if (abfd->flags & (EXEC_P | DYNAMIC)) 3630 3680 current_offset = SOM_ALIGN (current_offset, PA_PAGESIZE); 3631 if (bfd_seek (abfd, current_offset - 1, SEEK_SET) <0)3632 return false;3633 if (bfd_ write ((PTR) "", 1,1, abfd) != 1)3634 return false;3681 if (bfd_seek (abfd, (file_ptr) current_offset - 1, SEEK_SET) != 0) 3682 return FALSE; 3683 if (bfd_bwrite ((PTR) "", (bfd_size_type) 1, abfd) != 1) 3684 return FALSE; 3635 3685 3636 3686 obj_som_file_hdr (abfd)->unloadable_sp_size … … 3644 3694 obj_som_file_hdr (abfd)->som_length = current_offset; 3645 3695 3646 return true;3696 return TRUE; 3647 3697 } 3648 3698 3649 3699 /* Finally, scribble out the various headers to the disk. */ 3650 3700 3651 static b oolean3701 static bfd_boolean 3652 3702 som_finish_writing (abfd) 3653 3703 bfd *abfd; … … 3661 3711 unsigned long current_offset; 3662 3712 unsigned int total_reloc_size; 3713 bfd_size_type amt; 3714 3715 /* We must set up the version identifier here as objcopy/strip copy 3716 private BFD data too late for us to handle this in som_begin_writing. */ 3717 if (obj_som_exec_data (abfd) 3718 && obj_som_exec_data (abfd)->version_id) 3719 obj_som_file_hdr (abfd)->version_id = obj_som_exec_data (abfd)->version_id; 3720 else 3721 obj_som_file_hdr (abfd)->version_id = NEW_VERSION_ID; 3663 3722 3664 3723 /* Next is the symbol table. These are fixed length records. … … 3693 3752 3694 3753 /* Scribble out the symbol strings. */ 3695 if (som_write_symbol_strings (abfd, current_offset, syms, 3696 num_syms, &strings_size, 3697 obj_som_compilation_unit (abfd)) 3698 == false) 3699 return false; 3754 if (! som_write_symbol_strings (abfd, current_offset, syms, 3755 num_syms, &strings_size, 3756 obj_som_compilation_unit (abfd))) 3757 return FALSE; 3700 3758 3701 3759 /* Record total string table size in header and update the … … 3717 3775 /* Write the fixups and update fields in subspace headers which 3718 3776 relate to the fixup stream. */ 3719 if ( som_write_fixups (abfd, current_offset, &total_reloc_size) == false)3720 return false;3777 if (! som_write_fixups (abfd, current_offset, &total_reloc_size)) 3778 return FALSE; 3721 3779 3722 3780 /* Record the total size of the fixup stream in the file header. */ … … 3728 3786 /* Now that the symbol table information is complete, build and 3729 3787 write the symbol table. */ 3730 if ( som_build_and_write_symbol_table (abfd) == false)3731 return false;3788 if (! som_build_and_write_symbol_table (abfd)) 3789 return FALSE; 3732 3790 3733 3791 /* Subspaces are written first so that we can set up information … … 3736 3794 /* Seek to the start of the subspace dictionary records. */ 3737 3795 location = obj_som_file_hdr (abfd)->subspace_location; 3738 if (bfd_seek (abfd, location, SEEK_SET) <0)3739 return false;3796 if (bfd_seek (abfd, location, SEEK_SET) != 0) 3797 return FALSE; 3740 3798 3741 3799 section = abfd->sections; … … 3784 3842 3785 3843 /* Dump the current subspace header. */ 3786 if (bfd_write ((PTR) som_section_data (subsection)->subspace_dict,3787 sizeof (struct subspace_dictionary_record), 1, abfd)3788 != sizeof (struct subspace_dictionary_record))3789 return false;3844 amt = sizeof (struct subspace_dictionary_record); 3845 if (bfd_bwrite ((PTR) som_section_data (subsection)->subspace_dict, 3846 amt, abfd) != amt) 3847 return FALSE; 3790 3848 } 3791 3849 /* Goto the next section. */ … … 3840 3898 3841 3899 /* Dump this subspace header. */ 3842 if (bfd_write ((PTR) som_section_data (subsection)->subspace_dict,3843 sizeof (struct subspace_dictionary_record), 1, abfd)3844 != sizeof (struct subspace_dictionary_record))3845 return false;3900 amt = sizeof (struct subspace_dictionary_record); 3901 if (bfd_bwrite ((PTR) som_section_data (subsection)->subspace_dict, 3902 amt, abfd) != amt) 3903 return FALSE; 3846 3904 } 3847 3905 /* Goto the next section. */ … … 3855 3913 dictionary records. */ 3856 3914 location = obj_som_file_hdr (abfd)->space_location; 3857 if (bfd_seek (abfd, location, SEEK_SET) <0)3858 return false;3915 if (bfd_seek (abfd, location, SEEK_SET) != 0) 3916 return FALSE; 3859 3917 3860 3918 section = abfd->sections; … … 3866 3924 3867 3925 /* Dump its header. */ 3868 if (bfd_write ((PTR) som_section_data (section)->space_dict,3869 sizeof (struct space_dictionary_record), 1, abfd) 3870 != sizeof (struct space_dictionary_record))3871 return false;3926 amt = sizeof (struct space_dictionary_record); 3927 if (bfd_bwrite ((PTR) som_section_data (section)->space_dict, 3928 amt, abfd) != amt) 3929 return FALSE; 3872 3930 3873 3931 /* Goto the next section. */ … … 3879 3937 { 3880 3938 location = obj_som_file_hdr (abfd)->compiler_location; 3881 if (bfd_seek (abfd, location, SEEK_SET) <0)3882 return false;3883 3884 if (bfd_write ((PTR) obj_som_compilation_unit (abfd),3885 COMPUNITSZ, 1, abfd) != COMPUNITSZ)3886 return false;3939 if (bfd_seek (abfd, location, SEEK_SET) != 0) 3940 return FALSE; 3941 3942 amt = COMPUNITSZ; 3943 if (bfd_bwrite ((PTR) obj_som_compilation_unit (abfd), amt, abfd) != amt) 3944 return FALSE; 3887 3945 } 3888 3946 … … 3904 3962 /* Only thing left to do is write out the file header. It is always 3905 3963 at location zero. Seek there and write it. */ 3906 if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) < 0) 3907 return false; 3908 if (bfd_write ((PTR) obj_som_file_hdr (abfd), 3909 sizeof (struct header), 1, abfd) 3910 != sizeof (struct header)) 3911 return false; 3964 if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) 3965 return FALSE; 3966 amt = sizeof (struct header); 3967 if (bfd_bwrite ((PTR) obj_som_file_hdr (abfd), amt, abfd) != amt) 3968 return FALSE; 3912 3969 3913 3970 /* Now write the exec header. */ … … 3938 3995 { 3939 3996 bfd_set_error (bfd_error_bad_value); 3940 return false;3997 return FALSE; 3941 3998 } 3942 3999 3943 4000 if (bfd_seek (abfd, obj_som_file_hdr (abfd)->aux_header_location, 3944 SEEK_SET) <0)3945 return false;3946 3947 if (bfd_write ((PTR) exec_header, AUX_HDR_SIZE, 1, abfd)3948 != AUX_HDR_SIZE)3949 return false;3950 } 3951 return true;4001 SEEK_SET) != 0) 4002 return FALSE; 4003 4004 amt = AUX_HDR_SIZE; 4005 if (bfd_bwrite ((PTR) exec_header, amt, abfd) != amt) 4006 return FALSE; 4007 } 4008 return TRUE; 3952 4009 } 3953 4010 … … 4084 4141 /* The secondary_def field is for weak symbols. */ 4085 4142 if (sym->flags & BSF_WEAK) 4086 info->secondary_def = true;4143 info->secondary_def = TRUE; 4087 4144 else 4088 info->secondary_def = false;4145 info->secondary_def = FALSE; 4089 4146 4090 4147 } … … 4093 4150 this BFD. */ 4094 4151 4095 static b oolean4152 static bfd_boolean 4096 4153 som_build_and_write_symbol_table (abfd) 4097 4154 bfd *abfd; … … 4101 4158 asymbol **bfd_syms = obj_som_sorted_syms (abfd); 4102 4159 struct symbol_dictionary_record *som_symtab = NULL; 4103 int i, symtab_size; 4160 unsigned int i; 4161 bfd_size_type symtab_size; 4104 4162 4105 4163 /* Compute total symbol table size and allocate a chunk of memory 4106 4164 to hold the symbol table as we build it. */ 4107 symtab_size = num_syms * sizeof (struct symbol_dictionary_record); 4108 som_symtab = (struct symbol_dictionary_record *) bfd_malloc (symtab_size); 4165 symtab_size = num_syms; 4166 symtab_size *= sizeof (struct symbol_dictionary_record); 4167 som_symtab = (struct symbol_dictionary_record *) bfd_zmalloc (symtab_size); 4109 4168 if (som_symtab == NULL && symtab_size != 0) 4110 4169 goto error_return; 4111 memset (som_symtab, 0, symtab_size);4112 4170 4113 4171 /* Walk over each symbol. */ … … 4137 4195 scribble out the symbol table. */ 4138 4196 if (bfd_seek (abfd, symtab_location, SEEK_SET) != 0) 4139 return false;4140 4141 if (bfd_ write ((PTR) som_symtab, symtab_size, 1, abfd) != symtab_size)4197 return FALSE; 4198 4199 if (bfd_bwrite ((PTR) som_symtab, symtab_size, abfd) != symtab_size) 4142 4200 goto error_return; 4143 4201 4144 4202 if (som_symtab != NULL) 4145 4203 free (som_symtab); 4146 return true;4204 return TRUE; 4147 4205 error_return: 4148 4206 if (som_symtab != NULL) 4149 4207 free (som_symtab); 4150 return false;4208 return FALSE; 4151 4209 } 4152 4210 4153 4211 /* Write an object in SOM format. */ 4154 4212 4155 static b oolean4213 static bfd_boolean 4156 4214 som_write_object_contents (abfd) 4157 4215 bfd *abfd; 4158 4216 { 4159 if ( abfd->output_has_begun == false)4217 if (! abfd->output_has_begun) 4160 4218 { 4161 4219 /* Set up fixed parts of the file, space, and subspace headers. 4162 4220 Notify the world that output has begun. */ 4163 4221 som_prep_headers (abfd); 4164 abfd->output_has_begun = true;4222 abfd->output_has_begun = TRUE; 4165 4223 /* Start writing the object file. This include all the string 4166 4224 tables, fixup streams, and other portions of the object file. */ … … 4174 4232 /* Read and save the string table associated with the given BFD. */ 4175 4233 4176 static b oolean4234 static bfd_boolean 4177 4235 som_slurp_string_table (abfd) 4178 4236 bfd *abfd; 4179 4237 { 4180 4238 char *stringtab; 4239 bfd_size_type amt; 4181 4240 4182 4241 /* Use the saved version if its available. */ 4183 4242 if (obj_som_stringtab (abfd) != NULL) 4184 return true;4243 return TRUE; 4185 4244 4186 4245 /* I don't think this can currently happen, and I'm not sure it should … … 4190 4249 { 4191 4250 bfd_set_error (bfd_error_no_symbols); 4192 return false;4251 return FALSE; 4193 4252 } 4194 4253 4195 4254 /* Allocate and read in the string table. */ 4196 stringtab = bfd_malloc (obj_som_stringtab_size (abfd)); 4255 amt = obj_som_stringtab_size (abfd); 4256 stringtab = bfd_zmalloc (amt); 4197 4257 if (stringtab == NULL) 4198 return false; 4199 memset (stringtab, 0, obj_som_stringtab_size (abfd)); 4200 4201 if (bfd_seek (abfd, obj_som_str_filepos (abfd), SEEK_SET) < 0) 4202 return false; 4203 4204 if (bfd_read (stringtab, obj_som_stringtab_size (abfd), 1, abfd) 4205 != obj_som_stringtab_size (abfd)) 4206 return false; 4258 return FALSE; 4259 4260 if (bfd_seek (abfd, obj_som_str_filepos (abfd), SEEK_SET) != 0) 4261 return FALSE; 4262 4263 if (bfd_bread (stringtab, amt, abfd) != amt) 4264 return FALSE; 4207 4265 4208 4266 /* Save our results and return success. */ 4209 4267 obj_som_stringtab (abfd) = stringtab; 4210 return true;4268 return TRUE; 4211 4269 } 4212 4270 … … 4284 4342 struct symbol_dictionary_record *buf = NULL, *bufp, *endbufp; 4285 4343 som_symbol_type *sym, *symbase; 4344 bfd_size_type amt; 4286 4345 4287 4346 /* Return saved value if it exists. */ … … 4298 4357 stringtab = obj_som_stringtab (abfd); 4299 4358 4300 symbase = ((som_symbol_type *) 4301 bfd_malloc (symbol_count * sizeof (som_symbol_type))); 4359 amt = symbol_count; 4360 amt *= sizeof (som_symbol_type); 4361 symbase = (som_symbol_type *) bfd_zmalloc (amt); 4302 4362 if (symbase == NULL) 4303 4363 goto error_return; 4304 memset (symbase, 0, symbol_count * sizeof (som_symbol_type));4305 4364 4306 4365 /* Read in the external SOM representation. */ 4307 buf = bfd_malloc (symbol_count * symsize); 4308 if (buf == NULL && symbol_count * symsize != 0) 4366 amt = symbol_count; 4367 amt *= symsize; 4368 buf = bfd_malloc (amt); 4369 if (buf == NULL && amt != 0) 4309 4370 goto error_return; 4310 if (bfd_seek (abfd, obj_som_sym_filepos (abfd), SEEK_SET) <0)4371 if (bfd_seek (abfd, obj_som_sym_filepos (abfd), SEEK_SET) != 0) 4311 4372 goto error_return; 4312 if (bfd_read (buf, symbol_count * symsize, 1, abfd) 4313 != symbol_count * symsize) 4373 if (bfd_bread (buf, amt, abfd) != amt) 4314 4374 goto error_return; 4315 4375 … … 4437 4497 4438 4498 /* Note increment at bottom of loop, since we skip some symbols 4439 4499 we can not include it as part of the for statement. */ 4440 4500 sym++; 4441 4501 } … … 4450 4510 if (buf != NULL) 4451 4511 free (buf); 4452 return ( true);4512 return (TRUE); 4453 4513 4454 4514 error_return: 4455 4515 if (buf != NULL) 4456 4516 free (buf); 4457 return false;4517 return FALSE; 4458 4518 } 4459 4519 … … 4489 4549 bfd *abfd; 4490 4550 { 4491 som_symbol_type *new =4492 (som_symbol_type *) bfd_zalloc (abfd, sizeof (som_symbol_type));4551 bfd_size_type amt = sizeof (som_symbol_type); 4552 som_symbol_type *new = (som_symbol_type *) bfd_zalloc (abfd, amt); 4493 4553 if (new == NULL) 4494 4554 return 0; … … 4501 4561 4502 4562 static void 4503 som_print_symbol ( ignore_abfd, afile, symbol, how)4504 bfd * ignore_abfd ATTRIBUTE_UNUSED;4563 som_print_symbol (abfd, afile, symbol, how) 4564 bfd *abfd; 4505 4565 PTR afile; 4506 4566 asymbol *symbol; … … 4520 4580 case bfd_print_symbol_all: 4521 4581 { 4522 CONSTchar *section_name;4582 const char *section_name; 4523 4583 section_name = symbol->section ? symbol->section->name : "(*none*)"; 4524 bfd_print_symbol_vandf ( (PTR) file, symbol);4584 bfd_print_symbol_vandf (abfd, (PTR) file, symbol); 4525 4585 fprintf (file, " %s\t%s", section_name, symbol->name); 4526 4586 break; … … 4529 4589 } 4530 4590 4531 static b oolean4591 static bfd_boolean 4532 4592 som_bfd_is_local_label_name (abfd, name) 4533 4593 bfd *abfd ATTRIBUTE_UNUSED; … … 4557 4617 asection *section; 4558 4618 asymbol **symbols; 4559 b oolean just_count;4619 bfd_boolean just_count; 4560 4620 { 4561 4621 unsigned int op, varname, deallocate_contents = 0; … … 4642 4702 4643 4703 /* If this is a variable, push it on the stack. */ 4644 if ( isupper(c))4704 if (ISUPPER (c)) 4645 4705 push (var (c)); 4646 4706 … … 4648 4708 additional data from the fixup stream to be pushed onto 4649 4709 the stack. */ 4650 else if ( islower(c))4710 else if (ISLOWER (c)) 4651 4711 { 4652 4712 int bits = (c - 'a') * 8; … … 4659 4719 4660 4720 /* A decimal constant. Push it on the stack. */ 4661 else if ( isdigit(c))4721 else if (ISDIGIT (c)) 4662 4722 { 4663 4723 v = c - '0'; 4664 while ( isdigit(*cp))4724 while (ISDIGIT (*cp)) 4665 4725 v = (v * 10) + (*cp++ - '0'); 4666 4726 push (v); … … 4847 4907 { 4848 4908 /* Got to read the damn contents first. We don't 4849 4909 bother saving the contents (yet). Add it one 4850 4910 day if the need arises. */ 4851 4911 section->contents = bfd_malloc (section->_raw_size); 4852 4912 if (section->contents == NULL) 4853 return -1;4913 return (unsigned) -1; 4854 4914 4855 4915 deallocate_contents = 1; … … 4857 4917 section, 4858 4918 section->contents, 4859 0,4919 (bfd_vma) 0, 4860 4920 section->_raw_size); 4861 4921 } … … 4891 4951 4892 4952 som_get_reloc_upper_bound calls this routine with JUST_COUNT 4893 set to trueto indicate it only needs a count of the number4953 set to TRUE to indicate it only needs a count of the number 4894 4954 of actual relocations. */ 4895 4955 4896 static b oolean4956 static bfd_boolean 4897 4957 som_slurp_reloc_table (abfd, section, symbols, just_count) 4898 4958 bfd *abfd; 4899 4959 asection *section; 4900 4960 asymbol **symbols; 4901 b oolean just_count;4961 bfd_boolean just_count; 4902 4962 { 4903 4963 char *external_relocs; … … 4905 4965 arelent *internal_relocs; 4906 4966 unsigned int num_relocs; 4967 bfd_size_type amt; 4907 4968 4908 4969 fixup_stream_size = som_section_data (section)->reloc_size; 4909 4970 /* If there were no relocations, then there is nothing to do. */ 4910 4971 if (section->reloc_count == 0) 4911 return true;4972 return TRUE; 4912 4973 4913 4974 /* If reloc_count is -1, then the relocation stream has not been 4914 4975 parsed. We must do so now to know how many relocations exist. */ 4915 if (section->reloc_count == -1) 4916 { 4917 external_relocs = (char *) bfd_malloc (fixup_stream_size); 4976 if (section->reloc_count == (unsigned) -1) 4977 { 4978 amt = fixup_stream_size; 4979 external_relocs = (char *) bfd_malloc (amt); 4918 4980 if (external_relocs == (char *) NULL) 4919 return false;4981 return FALSE; 4920 4982 /* Read in the external forms. */ 4921 4983 if (bfd_seek (abfd, … … 4923 4985 SEEK_SET) 4924 4986 != 0) 4925 return false; 4926 if (bfd_read (external_relocs, 1, fixup_stream_size, abfd) 4927 != fixup_stream_size) 4928 return false; 4987 return FALSE; 4988 if (bfd_bread (external_relocs, amt, abfd) != amt) 4989 return FALSE; 4929 4990 4930 4991 /* Let callers know how many relocations found. … … 4933 4994 section->reloc_count = som_set_reloc_info (external_relocs, 4934 4995 fixup_stream_size, 4935 NULL, NULL, NULL, true);4996 NULL, NULL, NULL, TRUE); 4936 4997 4937 4998 som_section_data (section)->reloc_stream = external_relocs; … … 4940 5001 /* If the caller only wanted a count, then return now. */ 4941 5002 if (just_count) 4942 return true;5003 return TRUE; 4943 5004 4944 5005 num_relocs = section->reloc_count; … … 4946 5007 /* Return saved information about the relocations if it is available. */ 4947 5008 if (section->relocation != (arelent *) NULL) 4948 return true; 4949 4950 internal_relocs = (arelent *) 4951 bfd_zalloc (abfd, (num_relocs * sizeof (arelent))); 5009 return TRUE; 5010 5011 amt = num_relocs; 5012 amt *= sizeof (arelent); 5013 internal_relocs = (arelent *) bfd_zalloc (abfd, (amt)); 4952 5014 if (internal_relocs == (arelent *) NULL) 4953 return false;5015 return FALSE; 4954 5016 4955 5017 /* Process and internalize the relocations. */ 4956 5018 som_set_reloc_info (external_relocs, fixup_stream_size, 4957 internal_relocs, section, symbols, false);5019 internal_relocs, section, symbols, FALSE); 4958 5020 4959 5021 /* We're done with the external relocations. Free them. */ … … 4963 5025 /* Save our results and return success. */ 4964 5026 section->relocation = internal_relocs; 4965 return (true);5027 return TRUE; 4966 5028 } 4967 5029 … … 4978 5040 if (asect->flags & SEC_RELOC) 4979 5041 { 4980 if (! som_slurp_reloc_table (abfd, asect, NULL, true))5042 if (! som_slurp_reloc_table (abfd, asect, NULL, TRUE)) 4981 5043 return -1; 4982 5044 return (asect->reloc_count + 1) * sizeof (arelent *); … … 4999 5061 int count; 5000 5062 5001 if ( som_slurp_reloc_table (abfd, section, symbols, false) == false)5063 if (! som_slurp_reloc_table (abfd, section, symbols, FALSE)) 5002 5064 return -1; 5003 5065 … … 5016 5078 /* A hook to set up object file dependent section information. */ 5017 5079 5018 static b oolean5080 static bfd_boolean 5019 5081 som_new_section_hook (abfd, newsect) 5020 5082 bfd *abfd; 5021 5083 asection *newsect; 5022 5084 { 5023 newsect->used_by_bfd =5024 (PTR) bfd_zalloc (abfd, sizeof (struct som_section_data_struct));5085 bfd_size_type amt = sizeof (struct som_section_data_struct); 5086 newsect->used_by_bfd = (PTR) bfd_zalloc (abfd, amt); 5025 5087 if (!newsect->used_by_bfd) 5026 return false;5088 return FALSE; 5027 5089 newsect->alignment_power = 3; 5028 5090 5029 5091 /* We allow more than three sections internally. */ 5030 return true;5092 return TRUE; 5031 5093 } 5032 5094 … … 5034 5096 to the output symbol. */ 5035 5097 5036 static b oolean5098 static bfd_boolean 5037 5099 som_bfd_copy_private_symbol_data (ibfd, isymbol, obfd, osymbol) 5038 5100 bfd *ibfd; … … 5047 5109 if (ibfd->xvec->flavour != bfd_target_som_flavour 5048 5110 || obfd->xvec->flavour != bfd_target_som_flavour) 5049 return false;5111 return FALSE; 5050 5112 5051 5113 /* The only private information we need to copy is the argument relocation … … 5054 5116 input_symbol->tc_data.ap.hppa_arg_reloc; 5055 5117 5056 return true;5118 return TRUE; 5057 5119 } 5058 5120 … … 5060 5122 to the output section. */ 5061 5123 5062 static b oolean5124 static bfd_boolean 5063 5125 som_bfd_copy_private_section_data (ibfd, isection, obfd, osection) 5064 5126 bfd *ibfd; … … 5067 5129 asection *osection; 5068 5130 { 5131 bfd_size_type amt; 5132 5069 5133 /* One day we may try to grok other private data. */ 5070 5134 if (ibfd->xvec->flavour != bfd_target_som_flavour 5071 5135 || obfd->xvec->flavour != bfd_target_som_flavour 5072 5136 || (!som_is_space (isection) && !som_is_subspace (isection))) 5073 return true; 5074 5137 return TRUE; 5138 5139 amt = sizeof (struct som_copyable_section_data_struct); 5075 5140 som_section_data (osection)->copy_data = 5076 (struct som_copyable_section_data_struct *) 5077 bfd_zalloc (obfd, sizeof (struct som_copyable_section_data_struct)); 5141 (struct som_copyable_section_data_struct *) bfd_zalloc (obfd, amt); 5078 5142 if (som_section_data (osection)->copy_data == NULL) 5079 return false;5143 return FALSE; 5080 5144 5081 5145 memcpy (som_section_data (osection)->copy_data, … … 5088 5152 som_section_data (osection)->copy_data->container->output_section; 5089 5153 5090 return true;5154 return TRUE; 5091 5155 } 5092 5156 … … 5094 5158 to the output bfd. */ 5095 5159 5096 static b oolean5160 static bfd_boolean 5097 5161 som_bfd_copy_private_bfd_data (ibfd, obfd) 5098 5162 bfd *ibfd, *obfd; … … 5101 5165 if (ibfd->xvec->flavour != bfd_target_som_flavour 5102 5166 || obfd->xvec->flavour != bfd_target_som_flavour) 5103 return true;5167 return TRUE; 5104 5168 5105 5169 /* Allocate some memory to hold the data we need. */ 5106 5170 obj_som_exec_data (obfd) = (struct som_exec_data *) 5107 bfd_zalloc (obfd, sizeof (struct som_exec_data));5171 bfd_zalloc (obfd, (bfd_size_type) sizeof (struct som_exec_data)); 5108 5172 if (obj_som_exec_data (obfd) == NULL) 5109 return false;5173 return FALSE; 5110 5174 5111 5175 /* Now copy the data. */ … … 5113 5177 sizeof (struct som_exec_data)); 5114 5178 5115 return true;5179 return TRUE; 5116 5180 } 5117 5181 … … 5119 5183 in the BFD data structures. */ 5120 5184 5121 b oolean5185 bfd_boolean 5122 5186 bfd_som_set_section_attributes (section, defined, private, sort_key, spnum) 5123 5187 asection *section; … … 5130 5194 if (som_section_data (section)->copy_data == NULL) 5131 5195 { 5196 bfd_size_type amt = sizeof (struct som_copyable_section_data_struct); 5132 5197 som_section_data (section)->copy_data = 5133 (struct som_copyable_section_data_struct *) 5134 bfd_zalloc (section->owner, 5135 sizeof (struct som_copyable_section_data_struct)); 5198 (struct som_copyable_section_data_struct *) bfd_zalloc (section->owner, 5199 amt); 5136 5200 if (som_section_data (section)->copy_data == NULL) 5137 return false;5201 return FALSE; 5138 5202 } 5139 5203 som_section_data (section)->copy_data->sort_key = sort_key; … … 5142 5206 som_section_data (section)->copy_data->container = section; 5143 5207 som_section_data (section)->copy_data->space_number = spnum; 5144 return true;5208 return TRUE; 5145 5209 } 5146 5210 … … 5148 5212 in the BFD data structures. */ 5149 5213 5150 b oolean5214 bfd_boolean 5151 5215 bfd_som_set_subsection_attributes (section, container, access, 5152 5216 sort_key, quadrant) … … 5160 5224 if (som_section_data (section)->copy_data == NULL) 5161 5225 { 5226 bfd_size_type amt = sizeof (struct som_copyable_section_data_struct); 5162 5227 som_section_data (section)->copy_data = 5163 (struct som_copyable_section_data_struct *) 5164 bfd_zalloc (section->owner, 5165 sizeof (struct som_copyable_section_data_struct)); 5228 (struct som_copyable_section_data_struct *) bfd_zalloc (section->owner, 5229 amt); 5166 5230 if (som_section_data (section)->copy_data == NULL) 5167 return false;5231 return FALSE; 5168 5232 } 5169 5233 som_section_data (section)->copy_data->sort_key = sort_key; … … 5171 5235 som_section_data (section)->copy_data->quadrant = quadrant; 5172 5236 som_section_data (section)->copy_data->container = container; 5173 return true;5237 return TRUE; 5174 5238 } 5175 5239 … … 5191 5255 written into the object file. */ 5192 5256 5193 b oolean5257 bfd_boolean 5194 5258 bfd_som_attach_aux_hdr (abfd, type, string) 5195 5259 bfd *abfd; … … 5197 5261 char *string; 5198 5262 { 5263 bfd_size_type amt; 5264 5199 5265 if (type == VERSION_AUX_ID) 5200 5266 { 5201 int len = strlen (string);5267 size_t len = strlen (string); 5202 5268 int pad = 0; 5203 5269 5204 5270 if (len % 4) 5205 5271 pad = (4 - (len % 4)); 5206 obj_som_version_hdr (abfd) = (struct user_string_aux_hdr *)5207 bfd_zalloc (abfd, sizeof (struct aux_id) 5208 + sizeof (unsigned int) + len + pad);5272 amt = sizeof (struct aux_id) + sizeof (unsigned int) + len + pad; 5273 obj_som_version_hdr (abfd) = 5274 (struct user_string_aux_hdr *) bfd_zalloc (abfd, amt); 5209 5275 if (!obj_som_version_hdr (abfd)) 5210 return false;5276 return FALSE; 5211 5277 obj_som_version_hdr (abfd)->header_id.type = VERSION_AUX_ID; 5212 5278 obj_som_version_hdr (abfd)->header_id.length = len + pad; … … 5222 5288 if (len % 4) 5223 5289 pad = (4 - (len % 4)); 5224 obj_som_copyright_hdr (abfd) = (struct copyright_aux_hdr *)5225 bfd_zalloc (abfd, sizeof (struct aux_id) 5226 + sizeof (unsigned int) + len + pad);5290 amt = sizeof (struct aux_id) + sizeof (unsigned int) + len + pad; 5291 obj_som_copyright_hdr (abfd) = 5292 (struct copyright_aux_hdr *) bfd_zalloc (abfd, amt); 5227 5293 if (!obj_som_copyright_hdr (abfd)) 5228 return false;5294 return FALSE; 5229 5295 obj_som_copyright_hdr (abfd)->header_id.type = COPYRIGHT_AUX_ID; 5230 5296 obj_som_copyright_hdr (abfd)->header_id.length = len + pad; … … 5233 5299 strcpy (obj_som_copyright_hdr (abfd)->copyright, string); 5234 5300 } 5235 return true;5236 } 5237 5238 /* Attach a ncompilation unit header to the BFD backend so that it may be5301 return TRUE; 5302 } 5303 5304 /* Attach a compilation unit header to the BFD backend so that it may be 5239 5305 written into the object file. */ 5240 5306 5241 b oolean5307 bfd_boolean 5242 5308 bfd_som_attach_compilation_unit (abfd, name, language_name, product_id, 5243 5309 version_id) … … 5248 5314 const char *version_id; 5249 5315 { 5250 COMPUNIT *n = (COMPUNIT *) bfd_zalloc (abfd, COMPUNITSZ);5316 COMPUNIT *n = (COMPUNIT *) bfd_zalloc (abfd, (bfd_size_type) COMPUNITSZ); 5251 5317 if (n == NULL) 5252 return false;5318 return FALSE; 5253 5319 5254 5320 #define STRDUP(f) \ 5255 5321 if (f != NULL) \ 5256 5322 { \ 5257 n->f.n_name = bfd_alloc (abfd, strlen (f) + 1); \5323 n->f.n_name = bfd_alloc (abfd, (bfd_size_type) strlen (f) + 1); \ 5258 5324 if (n->f.n_name == NULL) \ 5259 return false; \5325 return FALSE; \ 5260 5326 strcpy (n->f.n_name, f); \ 5261 5327 } … … 5270 5336 obj_som_compilation_unit (abfd) = n; 5271 5337 5272 return true;5273 } 5274 5275 static b oolean5338 return TRUE; 5339 } 5340 5341 static bfd_boolean 5276 5342 som_get_section_contents (abfd, section, location, offset, count) 5277 5343 bfd *abfd; … … 5282 5348 { 5283 5349 if (count == 0 || ((section->flags & SEC_HAS_CONTENTS) == 0)) 5284 return true;5350 return TRUE; 5285 5351 if ((bfd_size_type) (offset+count) > section->_raw_size 5286 || bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) == -15287 || bfd_ read (location, (bfd_size_type) 1, count, abfd) != count)5288 return (false); /* on error*/5289 return (true);5290 } 5291 5292 static b oolean5352 || bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) != 0 5353 || bfd_bread (location, count, abfd) != count) 5354 return FALSE; /* On error. */ 5355 return TRUE; 5356 } 5357 5358 static bfd_boolean 5293 5359 som_set_section_contents (abfd, section, location, offset, count) 5294 5360 bfd *abfd; … … 5298 5364 bfd_size_type count; 5299 5365 { 5300 if ( abfd->output_has_begun == false)5366 if (! abfd->output_has_begun) 5301 5367 { 5302 5368 /* Set up fixed parts of the file, space, and subspace headers. 5303 5369 Notify the world that output has begun. */ 5304 5370 som_prep_headers (abfd); 5305 abfd->output_has_begun = true;5371 abfd->output_has_begun = TRUE; 5306 5372 /* Start writing the object file. This include all the string 5307 5373 tables, fixup streams, and other portions of the object file. */ … … 5313 5379 if (!som_is_subspace (section) 5314 5380 || ((section->flags & SEC_HAS_CONTENTS) == 0)) 5315 return true;5381 return TRUE; 5316 5382 5317 5383 /* Seek to the proper offset within the object file and write the 5318 5384 data. */ 5319 5385 offset += som_section_data (section)->subspace_dict->file_loc_init_value; 5320 if (bfd_seek (abfd, offset, SEEK_SET) == -1)5321 return false;5322 5323 if (bfd_ write ((PTR) location, 1, count, abfd) != count)5324 return false;5325 return true;5326 } 5327 5328 static b oolean5386 if (bfd_seek (abfd, offset, SEEK_SET) != 0) 5387 return FALSE; 5388 5389 if (bfd_bwrite ((PTR) location, count, abfd) != count) 5390 return FALSE; 5391 return TRUE; 5392 } 5393 5394 static bfd_boolean 5329 5395 som_set_arch_mach (abfd, arch, machine) 5330 5396 bfd *abfd; … … 5336 5402 } 5337 5403 5338 static b oolean5404 static bfd_boolean 5339 5405 som_find_nearest_line (abfd, section, symbols, offset, filename_ptr, 5340 5406 functionname_ptr, line_ptr) … … 5343 5409 asymbol **symbols ATTRIBUTE_UNUSED; 5344 5410 bfd_vma offset ATTRIBUTE_UNUSED; 5345 CONSTchar **filename_ptr ATTRIBUTE_UNUSED;5346 CONSTchar **functionname_ptr ATTRIBUTE_UNUSED;5411 const char **filename_ptr ATTRIBUTE_UNUSED; 5412 const char **functionname_ptr ATTRIBUTE_UNUSED; 5347 5413 unsigned int *line_ptr ATTRIBUTE_UNUSED; 5348 5414 { 5349 return (false);5415 return FALSE; 5350 5416 } 5351 5417 … … 5353 5419 som_sizeof_headers (abfd, reloc) 5354 5420 bfd *abfd ATTRIBUTE_UNUSED; 5355 b oolean reloc ATTRIBUTE_UNUSED;5421 bfd_boolean reloc ATTRIBUTE_UNUSED; 5356 5422 { 5357 5423 (*_bfd_error_handler) (_("som_sizeof_headers unimplemented")); 5358 5424 fflush (stderr); 5359 5425 abort (); 5360 return (0);5426 return 0; 5361 5427 } 5362 5428 … … 5402 5468 return '?'; 5403 5469 if (symbol->flags & BSF_GLOBAL) 5404 c = toupper(c);5470 c = TOUPPER (c); 5405 5471 return c; 5406 5472 } … … 5425 5491 so that we can allocate space for all the carsyms at once. */ 5426 5492 5427 static b oolean5493 static bfd_boolean 5428 5494 som_bfd_count_ar_symbols (abfd, lst_header, count) 5429 5495 bfd *abfd; … … 5433 5499 unsigned int i; 5434 5500 unsigned int *hash_table = NULL; 5501 bfd_size_type amt; 5435 5502 file_ptr lst_filepos = bfd_tell (abfd) - sizeof (struct lst_header); 5436 5503 5437 hash_table =5438 (unsigned int *) bfd_malloc (lst_header->hash_size5439 * sizeof (unsigned int));5504 amt = lst_header->hash_size; 5505 amt *= sizeof (unsigned int); 5506 hash_table = (unsigned int *) bfd_malloc (amt); 5440 5507 if (hash_table == NULL && lst_header->hash_size != 0) 5441 5508 goto error_return; … … 5446 5513 /* Read in the hash table. The has table is an array of 32bit file offsets 5447 5514 which point to the hash chains. */ 5448 if (bfd_read ((PTR) hash_table, lst_header->hash_size, 4, abfd) 5449 != lst_header->hash_size * 4) 5515 if (bfd_bread ((PTR) hash_table, amt, abfd) != amt) 5450 5516 goto error_return; 5451 5517 … … 5461 5527 5462 5528 /* Seek to the first symbol in this hash chain. */ 5463 if (bfd_seek (abfd, lst_filepos + hash_table[i], SEEK_SET) <0)5529 if (bfd_seek (abfd, lst_filepos + hash_table[i], SEEK_SET) != 0) 5464 5530 goto error_return; 5465 5531 5466 5532 /* Read in this symbol and update the counter. */ 5467 if (bfd_read ((PTR) & lst_symbol, 1, sizeof (lst_symbol), abfd)5468 != sizeof (lst_symbol))5533 amt = sizeof (lst_symbol); 5534 if (bfd_bread ((PTR) &lst_symbol, amt, abfd) != amt) 5469 5535 goto error_return; 5470 5536 … … 5477 5543 /* Seek to the next symbol. */ 5478 5544 if (bfd_seek (abfd, lst_filepos + lst_symbol.next_entry, SEEK_SET) 5479 <0)5545 != 0) 5480 5546 goto error_return; 5481 5547 5482 5548 /* Read the symbol in and update the counter. */ 5483 if (bfd_read ((PTR) & lst_symbol, 1, sizeof (lst_symbol), abfd)5484 != sizeof (lst_symbol))5549 amt = sizeof (lst_symbol); 5550 if (bfd_bread ((PTR) &lst_symbol, amt, abfd) != amt) 5485 5551 goto error_return; 5486 5552 … … 5490 5556 if (hash_table != NULL) 5491 5557 free (hash_table); 5492 return true;5558 return TRUE; 5493 5559 5494 5560 error_return: 5495 5561 if (hash_table != NULL) 5496 5562 free (hash_table); 5497 return false;5563 return FALSE; 5498 5564 } 5499 5565 … … 5501 5567 by ABFD and LST_HEADER. */ 5502 5568 5503 static b oolean5569 static bfd_boolean 5504 5570 som_bfd_fill_in_ar_symbols (abfd, lst_header, syms) 5505 5571 bfd *abfd; … … 5511 5577 unsigned int *hash_table = NULL; 5512 5578 struct som_entry *som_dict = NULL; 5579 bfd_size_type amt; 5513 5580 file_ptr lst_filepos = bfd_tell (abfd) - sizeof (struct lst_header); 5514 5581 5515 hash_table =5516 (unsigned int *) bfd_malloc (lst_header->hash_size5517 * sizeof (unsigned int));5582 amt = lst_header->hash_size; 5583 amt *= sizeof (unsigned int); 5584 hash_table = (unsigned int *) bfd_malloc (amt); 5518 5585 if (hash_table == NULL && lst_header->hash_size != 0) 5519 5586 goto error_return; 5520 5587 5521 som_dict = 5522 (struct som_entry *) bfd_malloc (lst_header->module_count 5523 * sizeof (struct som_entry)); 5588 /* Read in the hash table. The has table is an array of 32bit file offsets 5589 which point to the hash chains. */ 5590 if (bfd_bread ((PTR) hash_table, amt, abfd) != amt) 5591 goto error_return; 5592 5593 /* Seek to and read in the SOM dictionary. We will need this to fill 5594 in the carsym's filepos field. */ 5595 if (bfd_seek (abfd, lst_filepos + lst_header->dir_loc, SEEK_SET) != 0) 5596 goto error_return; 5597 5598 amt = lst_header->module_count; 5599 amt *= sizeof (struct som_entry); 5600 som_dict = (struct som_entry *) bfd_malloc (amt); 5524 5601 if (som_dict == NULL && lst_header->module_count != 0) 5525 5602 goto error_return; 5526 5603 5527 /* Read in the hash table. The has table is an array of 32bit file offsets 5528 which point to the hash chains. */ 5529 if (bfd_read ((PTR) hash_table, lst_header->hash_size, 4, abfd) 5530 != lst_header->hash_size * 4) 5531 goto error_return; 5532 5533 /* Seek to and read in the SOM dictionary. We will need this to fill 5534 in the carsym's filepos field. */ 5535 if (bfd_seek (abfd, lst_filepos + lst_header->dir_loc, SEEK_SET) < 0) 5536 goto error_return; 5537 5538 if (bfd_read ((PTR) som_dict, lst_header->module_count, 5539 sizeof (struct som_entry), abfd) 5540 != lst_header->module_count * sizeof (struct som_entry)) 5604 if (bfd_bread ((PTR) som_dict, amt, abfd) != amt) 5541 5605 goto error_return; 5542 5606 … … 5551 5615 5552 5616 /* Seek to and read the first symbol on the chain. */ 5553 if (bfd_seek (abfd, lst_filepos + hash_table[i], SEEK_SET) <0)5617 if (bfd_seek (abfd, lst_filepos + hash_table[i], SEEK_SET) != 0) 5554 5618 goto error_return; 5555 5619 5556 if (bfd_read ((PTR) & lst_symbol, 1, sizeof (lst_symbol), abfd)5557 != sizeof (lst_symbol))5620 amt = sizeof (lst_symbol); 5621 if (bfd_bread ((PTR) &lst_symbol, amt, abfd) != amt) 5558 5622 goto error_return; 5559 5623 … … 5566 5630 using the string table would not be safe. */ 5567 5631 if (bfd_seek (abfd, lst_filepos + lst_header->string_loc 5568 + lst_symbol.name.n_strx - 4, SEEK_SET) <0)5632 + lst_symbol.name.n_strx - 4, SEEK_SET) != 0) 5569 5633 goto error_return; 5570 5634 5571 if (bfd_ read (&len, 1,4, abfd) != 4)5635 if (bfd_bread (&len, (bfd_size_type) 4, abfd) != 4) 5572 5636 goto error_return; 5573 5637 5574 5638 /* Allocate space for the name and null terminate it too. */ 5575 set->name = bfd_zalloc (abfd, len + 1);5639 set->name = bfd_zalloc (abfd, (bfd_size_type) len + 1); 5576 5640 if (!set->name) 5577 5641 goto error_return; 5578 if (bfd_ read (set->name, 1,len, abfd) != len)5642 if (bfd_bread (set->name, (bfd_size_type) len, abfd) != len) 5579 5643 goto error_return; 5580 5644 … … 5593 5657 { 5594 5658 /* Seek to the next symbol and read it in. */ 5595 if (bfd_seek (abfd, lst_filepos + lst_symbol.next_entry, SEEK_SET) <0) 5659 if (bfd_seek (abfd, lst_filepos + lst_symbol.next_entry, SEEK_SET) 5660 != 0) 5596 5661 goto error_return; 5597 5662 5598 if (bfd_read ((PTR) & lst_symbol, 1, sizeof (lst_symbol), abfd)5599 != sizeof (lst_symbol))5663 amt = sizeof (lst_symbol); 5664 if (bfd_bread ((PTR) &lst_symbol, amt, abfd) != amt) 5600 5665 goto error_return; 5601 5666 5602 5667 /* Seek to the name length & string and read them in. */ 5603 5668 if (bfd_seek (abfd, lst_filepos + lst_header->string_loc 5604 + lst_symbol.name.n_strx - 4, SEEK_SET) <0)5669 + lst_symbol.name.n_strx - 4, SEEK_SET) != 0) 5605 5670 goto error_return; 5606 5671 5607 if (bfd_ read (&len, 1,4, abfd) != 4)5672 if (bfd_bread (&len, (bfd_size_type) 4, abfd) != 4) 5608 5673 goto error_return; 5609 5674 5610 5675 /* Allocate space for the name and null terminate it too. */ 5611 set->name = bfd_zalloc (abfd, len + 1);5676 set->name = bfd_zalloc (abfd, (bfd_size_type) len + 1); 5612 5677 if (!set->name) 5613 5678 goto error_return; 5614 5679 5615 if (bfd_ read (set->name, 1,len, abfd) != len)5680 if (bfd_bread (set->name, (bfd_size_type) len, abfd) != len) 5616 5681 goto error_return; 5617 5682 set->name[len] = 0; … … 5632 5697 if (som_dict != NULL) 5633 5698 free (som_dict); 5634 return true;5699 return TRUE; 5635 5700 5636 5701 error_return: … … 5639 5704 if (som_dict != NULL) 5640 5705 free (som_dict); 5641 return false;5706 return FALSE; 5642 5707 } 5643 5708 5644 5709 /* Read in the LST from the archive. */ 5645 5710 5646 static b oolean5711 static bfd_boolean 5647 5712 som_slurp_armap (abfd) 5648 5713 bfd *abfd; … … 5653 5718 struct artdata *ardata = bfd_ardata (abfd); 5654 5719 char nextname[17]; 5655 int i = bfd_read ((PTR) nextname, 1, 16, abfd); 5720 bfd_size_type amt = 16; 5721 int i = bfd_bread ((PTR) nextname, amt, abfd); 5656 5722 5657 5723 /* Special cases. */ 5658 5724 if (i == 0) 5659 return true;5725 return TRUE; 5660 5726 if (i != 16) 5661 return false;5662 5663 if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) <0)5664 return false;5727 return FALSE; 5728 5729 if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0) 5730 return FALSE; 5665 5731 5666 5732 /* For archives without .o files there is no symbol table. */ 5667 5733 if (strncmp (nextname, "/ ", 16)) 5668 5734 { 5669 bfd_has_map (abfd) = false;5670 return true;5735 bfd_has_map (abfd) = FALSE; 5736 return TRUE; 5671 5737 } 5672 5738 5673 5739 /* Read in and sanity check the archive header. */ 5674 if (bfd_read ((PTR) &ar_header, 1, sizeof (struct ar_hdr), abfd)5675 != sizeof (struct ar_hdr))5676 return false;5740 amt = sizeof (struct ar_hdr); 5741 if (bfd_bread ((PTR) &ar_header, amt, abfd) != amt) 5742 return FALSE; 5677 5743 5678 5744 if (strncmp (ar_header.ar_fmag, ARFMAG, 2)) 5679 5745 { 5680 5746 bfd_set_error (bfd_error_malformed_archive); 5681 return false;5747 return FALSE; 5682 5748 } 5683 5749 … … 5688 5754 { 5689 5755 bfd_set_error (bfd_error_malformed_archive); 5690 return false;5756 return FALSE; 5691 5757 } 5692 5758 … … 5696 5762 /* Read in the library symbol table. We'll make heavy use of this 5697 5763 in just a minute. */ 5698 if (bfd_read ((PTR) & lst_header, 1, sizeof (struct lst_header), abfd)5699 != sizeof (struct lst_header))5700 return false;5764 amt = sizeof (struct lst_header); 5765 if (bfd_bread ((PTR) &lst_header, amt, abfd) != amt) 5766 return FALSE; 5701 5767 5702 5768 /* Sanity check. */ … … 5704 5770 { 5705 5771 bfd_set_error (bfd_error_malformed_archive); 5706 return false;5772 return FALSE; 5707 5773 } 5708 5774 5709 5775 /* Count the number of symbols in the library symbol table. */ 5710 if (som_bfd_count_ar_symbols (abfd, &lst_header, &ardata->symdef_count) 5711 == false) 5712 return false; 5776 if (! som_bfd_count_ar_symbols (abfd, &lst_header, &ardata->symdef_count)) 5777 return FALSE; 5713 5778 5714 5779 /* Get back to the start of the library symbol table. */ 5715 if (bfd_seek (abfd, ardata->first_file_filepos - parsed_size5716 + sizeof (struct lst_header), SEEK_SET) <0)5717 return false;5780 if (bfd_seek (abfd, (ardata->first_file_filepos - parsed_size 5781 + sizeof (struct lst_header)), SEEK_SET) != 0) 5782 return FALSE; 5718 5783 5719 5784 /* Initializae the cache and allocate space for the library symbols. */ 5720 5785 ardata->cache = 0; 5721 a rdata->symdefs = (carsym *) bfd_alloc (abfd,5722 (ardata->symdef_count 5723 * sizeof (carsym)));5786 amt = ardata->symdef_count; 5787 amt *= sizeof (carsym); 5788 ardata->symdefs = (carsym *) bfd_alloc (abfd, amt); 5724 5789 if (!ardata->symdefs) 5725 return false;5790 return FALSE; 5726 5791 5727 5792 /* Now fill in the canonical archive symbols. */ 5728 if (som_bfd_fill_in_ar_symbols (abfd, &lst_header, &ardata->symdefs) 5729 == false) 5730 return false; 5793 if (! som_bfd_fill_in_ar_symbols (abfd, &lst_header, &ardata->symdefs)) 5794 return FALSE; 5731 5795 5732 5796 /* Seek back to the "first" file in the archive. Note the "first" 5733 5797 file may be the extended name table. */ 5734 if (bfd_seek (abfd, ardata->first_file_filepos, SEEK_SET) <0)5735 return false;5798 if (bfd_seek (abfd, ardata->first_file_filepos, SEEK_SET) != 0) 5799 return FALSE; 5736 5800 5737 5801 /* Notify the generic archive code that we have a symbol map. */ 5738 bfd_has_map (abfd) = true;5739 return true;5802 bfd_has_map (abfd) = TRUE; 5803 return TRUE; 5740 5804 } 5741 5805 … … 5745 5809 and the size of the associated string section. */ 5746 5810 5747 static b oolean5811 static bfd_boolean 5748 5812 som_bfd_prep_for_ar_write (abfd, num_syms, stringsize) 5749 5813 bfd *abfd; … … 5773 5837 to it. It's a little slimey to grab the symbols via obj_som_symtab, 5774 5838 but doing so avoids allocating lots of extra memory. */ 5775 if ( som_slurp_symbol_table (curr_bfd) == false)5776 return false;5839 if (! som_slurp_symbol_table (curr_bfd)) 5840 return FALSE; 5777 5841 5778 5842 sym = obj_som_symtab (curr_bfd); … … 5813 5877 curr_bfd = curr_bfd->next; 5814 5878 } 5815 return true;5879 return TRUE; 5816 5880 } 5817 5881 … … 5836 5900 symbol table. */ 5837 5901 5838 static b oolean5902 static bfd_boolean 5839 5903 som_bfd_ar_write_symbol_stuff (abfd, nsyms, string_size, lst, elength) 5840 5904 bfd *abfd; … … 5851 5915 struct lst_symbol_record **last_hash_entry = NULL; 5852 5916 unsigned int curr_som_offset, som_index = 0; 5853 5854 hash_table = 5855 (unsigned int *) bfd_malloc (lst.hash_size * sizeof (unsigned int)); 5917 bfd_size_type amt; 5918 5919 amt = lst.hash_size; 5920 amt *= sizeof (unsigned int); 5921 hash_table = (unsigned int *) bfd_zmalloc (amt); 5856 5922 if (hash_table == NULL && lst.hash_size != 0) 5857 5923 goto error_return; 5858 som_dict = 5859 (struct som_entry *) bfd_malloc (lst.module_count 5860 * sizeof (struct som_entry)); 5924 5925 amt = lst.module_count; 5926 amt *= sizeof (struct som_entry); 5927 som_dict = (struct som_entry *) bfd_zmalloc (amt); 5861 5928 if (som_dict == NULL && lst.module_count != 0) 5862 5929 goto error_return; 5863 5930 5864 last_hash_entry =5865 ((struct lst_symbol_record **)5866 bfd_malloc (lst.hash_size * sizeof (struct lst_symbol_record *)));5931 amt = lst.hash_size; 5932 amt *= sizeof (struct lst_symbol_record *); 5933 last_hash_entry = ((struct lst_symbol_record **) bfd_zmalloc (amt)); 5867 5934 if (last_hash_entry == NULL && lst.hash_size != 0) 5868 5935 goto error_return; … … 5871 5938 of the lst record. So save its location. */ 5872 5939 lst_filepos = bfd_tell (abfd) - sizeof (struct lst_header); 5873 5874 /* Some initialization. */5875 memset (hash_table, 0, 4 * lst.hash_size);5876 memset (som_dict, 0, lst.module_count * sizeof (struct som_entry));5877 memset (last_hash_entry, 0,5878 lst.hash_size * sizeof (struct lst_symbol_record *));5879 5940 5880 5941 /* Symbols have som_index fields, so we have to keep track of the … … 5902 5963 5903 5964 /* FIXME should be done with buffers just like everything else... */ 5904 lst_syms = bfd_malloc (nsyms * sizeof (struct lst_symbol_record)); 5965 amt = nsyms; 5966 amt *= sizeof (struct lst_symbol_record); 5967 lst_syms = bfd_malloc (amt); 5905 5968 if (lst_syms == NULL && nsyms != 0) 5906 5969 goto error_return; 5907 strings = bfd_malloc ( string_size);5970 strings = bfd_malloc ((bfd_size_type) string_size); 5908 5971 if (strings == NULL && string_size != 0) 5909 5972 goto error_return; … … 5929 5992 to it. It's a little slimey to grab the symbols via obj_som_symtab, 5930 5993 but doing so avoids allocating lots of extra memory. */ 5931 if ( som_slurp_symbol_table (curr_bfd) == false)5994 if (! som_slurp_symbol_table (curr_bfd)) 5932 5995 goto error_return; 5933 5996 … … 6039 6102 linker requires objects begin on an even boundary. So round 6040 6103 up the current offset as necessary. */ 6041 curr_som_offset = (curr_som_offset + 0x1) & ~0x1;6104 curr_som_offset = (curr_som_offset + 0x1) &~ (unsigned) 1; 6042 6105 curr_bfd = curr_bfd->next; 6043 6106 som_index++; … … 6045 6108 6046 6109 /* Now scribble out the hash table. */ 6047 if (bfd_write ((PTR) hash_table, lst.hash_size, 4, abfd)6048 != lst.hash_size * 4)6110 amt = lst.hash_size * 4; 6111 if (bfd_bwrite ((PTR) hash_table, amt, abfd) != amt) 6049 6112 goto error_return; 6050 6113 6051 6114 /* Then the SOM dictionary. */ 6052 if (bfd_write ((PTR) som_dict, lst.module_count, 6053 sizeof (struct som_entry), abfd) 6054 != lst.module_count * sizeof (struct som_entry)) 6115 amt = lst.module_count * sizeof (struct som_entry); 6116 if (bfd_bwrite ((PTR) som_dict, amt, abfd) != amt) 6055 6117 goto error_return; 6056 6118 6057 6119 /* The library symbols. */ 6058 if (bfd_write ((PTR) lst_syms, nsyms, sizeof (struct lst_symbol_record), abfd)6059 != nsyms * sizeof (struct lst_symbol_record))6120 amt = nsyms * sizeof (struct lst_symbol_record); 6121 if (bfd_bwrite ((PTR) lst_syms, amt, abfd) != amt) 6060 6122 goto error_return; 6061 6123 6062 6124 /* And finally the strings. */ 6063 if (bfd_write ((PTR) strings, string_size, 1, abfd) != string_size) 6125 amt = string_size; 6126 if (bfd_bwrite ((PTR) strings, amt, abfd) != amt) 6064 6127 goto error_return; 6065 6128 … … 6074 6137 if (strings != NULL) 6075 6138 free (strings); 6076 return true;6139 return TRUE; 6077 6140 6078 6141 error_return: … … 6088 6151 free (strings); 6089 6152 6090 return false;6153 return FALSE; 6091 6154 } 6092 6155 … … 6095 6158 You'll never believe this is really how armaps are handled in SOM... */ 6096 6159 6097 static b oolean6160 static bfd_boolean 6098 6161 som_write_armap (abfd, elength, map, orl_count, stridx) 6099 6162 bfd *abfd; … … 6109 6172 struct lst_header lst; 6110 6173 int *p; 6174 bfd_size_type amt; 6111 6175 6112 6176 /* We'll use this for the archive's date and mode later. */ … … 6114 6178 { 6115 6179 bfd_set_error (bfd_error_system_call); 6116 return false;6180 return FALSE; 6117 6181 } 6118 6182 /* Fudge factor. */ … … 6164 6228 /* Count how many symbols we will have on the hash chains and the 6165 6229 size of the associated string table. */ 6166 if ( som_bfd_prep_for_ar_write (abfd, &nsyms, &stringsize) == false)6167 return false;6230 if (! som_bfd_prep_for_ar_write (abfd, &nsyms, &stringsize)) 6231 return FALSE; 6168 6232 6169 6233 lst_size += sizeof (struct lst_symbol_record) * nsyms; … … 6201 6265 6202 6266 /* Scribble out the ar header. */ 6203 if (bfd_write ((PTR) &hdr, 1, sizeof (struct ar_hdr), abfd)6204 != sizeof (struct ar_hdr))6205 return false;6267 amt = sizeof (struct ar_hdr); 6268 if (bfd_bwrite ((PTR) &hdr, amt, abfd) != amt) 6269 return FALSE; 6206 6270 6207 6271 /* Now scribble out the lst header. */ 6208 if (bfd_write ((PTR) &lst, 1, sizeof (struct lst_header), abfd)6209 != sizeof (struct lst_header))6210 return false;6272 amt = sizeof (struct lst_header); 6273 if (bfd_bwrite ((PTR) &lst, amt, abfd) != amt) 6274 return FALSE; 6211 6275 6212 6276 /* Build and write the armap. */ 6213 if (som_bfd_ar_write_symbol_stuff (abfd, nsyms, stringsize, lst, elength) 6214 == false) 6215 return false; 6277 if (!som_bfd_ar_write_symbol_stuff (abfd, nsyms, stringsize, lst, elength)) 6278 return FALSE; 6216 6279 6217 6280 /* Done. */ 6218 return true;6281 return TRUE; 6219 6282 } 6220 6283 … … 6222 6285 read it again later if we need it. */ 6223 6286 6224 static b oolean6287 static bfd_boolean 6225 6288 som_bfd_free_cached_info (abfd) 6226 6289 bfd *abfd; … … 6229 6292 6230 6293 if (bfd_get_format (abfd) != bfd_object) 6231 return true;6294 return TRUE; 6232 6295 6233 6296 #define FREE(x) if (x != NULL) { free (x); x = NULL; } … … 6238 6301 { 6239 6302 /* Free the native relocations. */ 6240 o->reloc_count = -1;6303 o->reloc_count = (unsigned) -1; 6241 6304 FREE (som_section_data (o)->reloc_stream); 6242 6305 /* Free the generic relocations. */ … … 6245 6308 #undef FREE 6246 6309 6247 return true;6310 return TRUE; 6248 6311 } 6249 6312 … … 6252 6315 /* Linker support functions. */ 6253 6316 6254 static b oolean6317 static bfd_boolean 6255 6318 som_bfd_link_split_section (abfd, sec) 6256 6319 bfd *abfd ATTRIBUTE_UNUSED; … … 6273 6336 #define som_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data 6274 6337 6275 #define som_get_lineno 6338 #define som_get_lineno _bfd_nosymbols_get_lineno 6276 6339 #define som_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol 6277 6340 #define som_read_minisymbols _bfd_generic_read_minisymbols … … 6284 6347 #define som_bfd_relax_section bfd_generic_relax_section 6285 6348 #define som_bfd_link_hash_table_create _bfd_generic_link_hash_table_create 6349 #define som_bfd_link_hash_table_free _bfd_generic_link_hash_table_free 6286 6350 #define som_bfd_link_add_symbols _bfd_generic_link_add_symbols 6351 #define som_bfd_link_just_syms _bfd_generic_link_just_syms 6287 6352 #define som_bfd_final_link _bfd_generic_final_link 6288 6353 6289 6354 #define som_bfd_gc_sections bfd_generic_gc_sections 6355 #define som_bfd_merge_sections bfd_generic_merge_sections 6356 #define som_bfd_discard_group bfd_generic_discard_group 6290 6357 6291 6358 const bfd_target som_vec = { … … 6301 6368 6302 6369 /* leading_symbol_char: is the first char of a user symbol 6303 predictable, and if so what is it */6370 predictable, and if so what is it. */ 6304 6371 0, 6305 6372 '/', /* ar_pad_char */ -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.