Changeset 609 for branches/GNU/src/binutils/bfd/coff-alpha.c
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/bfd/coff-alpha.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* BFD back-end for ALPHA Extended-Coff files. 2 Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 2 Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 3 3 Free Software Foundation, Inc. 4 4 Modified from coff-mips.c by Steve Chamberlain <sac@cygnus.com> and … … 37 37 /* Prototypes for static functions. */ 38 38 39 static const bfd_target *alpha_ecoff_object_p PARAMS ((bfd *)); 40 static boolean alpha_ecoff_bad_format_hook PARAMS ((bfd *abfd, PTR filehdr)); 41 static PTR alpha_ecoff_mkobject_hook PARAMS ((bfd *, PTR filehdr, PTR aouthdr)); 42 static void alpha_ecoff_swap_reloc_in PARAMS ((bfd *, PTR, 43 struct internal_reloc *)); 44 static void alpha_ecoff_swap_reloc_out PARAMS ((bfd *, 45 const struct internal_reloc *, 46 PTR)); 47 static void alpha_adjust_reloc_in PARAMS ((bfd *, 48 const struct internal_reloc *, 49 arelent *)); 50 static void alpha_adjust_reloc_out PARAMS ((bfd *, const arelent *, 51 struct internal_reloc *)); 39 static const bfd_target *alpha_ecoff_object_p 40 PARAMS ((bfd *)); 41 static bfd_boolean alpha_ecoff_bad_format_hook 42 PARAMS ((bfd *abfd, PTR filehdr)); 43 static PTR alpha_ecoff_mkobject_hook 44 PARAMS ((bfd *, PTR filehdr, PTR aouthdr)); 45 static void alpha_ecoff_swap_reloc_in 46 PARAMS ((bfd *, PTR, struct internal_reloc *)); 47 static void alpha_ecoff_swap_reloc_out 48 PARAMS ((bfd *, const struct internal_reloc *, PTR)); 49 static void alpha_adjust_reloc_in 50 PARAMS ((bfd *, const struct internal_reloc *, arelent *)); 51 static void alpha_adjust_reloc_out 52 PARAMS ((bfd *, const arelent *, struct internal_reloc *)); 52 53 static reloc_howto_type *alpha_bfd_reloc_type_lookup 53 PARAMS ((bfd *, bfd_reloc_code_real_type));54 PARAMS ((bfd *, bfd_reloc_code_real_type)); 54 55 static bfd_byte *alpha_ecoff_get_relocated_section_contents 55 56 PARAMS ((bfd *abfd, struct bfd_link_info *, struct bfd_link_order *, 56 bfd_byte *data, b oolean relocateable, asymbol **symbols));57 bfd_byte *data, bfd_boolean relocateable, asymbol **symbols)); 57 58 static bfd_vma alpha_convert_external_reloc 58 59 PARAMS ((bfd *, struct bfd_link_info *, bfd *, struct external_reloc *, 59 60 struct ecoff_link_hash_entry *)); 60 static boolean alpha_relocate_section PARAMS ((bfd *, struct bfd_link_info *, 61 bfd *, asection *, 62 bfd_byte *, PTR)); 63 static boolean alpha_adjust_headers 61 static bfd_boolean alpha_relocate_section 62 PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, PTR)); 63 static bfd_boolean alpha_adjust_headers 64 64 PARAMS ((bfd *, struct internal_filehdr *, struct internal_aouthdr *)); 65 static PTR alpha_ecoff_read_ar_hdr PARAMS ((bfd *)); 66 static bfd *alpha_ecoff_get_elt_at_filepos PARAMS ((bfd *, file_ptr)); 67 static bfd *alpha_ecoff_openr_next_archived_file PARAMS ((bfd *, bfd *)); 68 static bfd *alpha_ecoff_get_elt_at_index PARAMS ((bfd *, symindex)); 65 static PTR alpha_ecoff_read_ar_hdr 66 PARAMS ((bfd *)); 67 static bfd *alpha_ecoff_get_elt_at_filepos 68 PARAMS ((bfd *, file_ptr)); 69 static bfd *alpha_ecoff_openr_next_archived_file 70 PARAMS ((bfd *, bfd *)); 71 static bfd *alpha_ecoff_get_elt_at_index 72 PARAMS ((bfd *, symindex)); 69 73 70 74 … … 79 83 accessor macros for the large sizes used for Alpha ECOFF. */ 80 84 81 #define GET_FILEHDR_SYMPTR bfd_h_get_6482 #define PUT_FILEHDR_SYMPTR bfd_h_put_6483 #define GET_AOUTHDR_TSIZE bfd_h_get_6484 #define PUT_AOUTHDR_TSIZE bfd_h_put_6485 #define GET_AOUTHDR_DSIZE bfd_h_get_6486 #define PUT_AOUTHDR_DSIZE bfd_h_put_6487 #define GET_AOUTHDR_BSIZE bfd_h_get_6488 #define PUT_AOUTHDR_BSIZE bfd_h_put_6489 #define GET_AOUTHDR_ENTRY bfd_h_get_6490 #define PUT_AOUTHDR_ENTRY bfd_h_put_6491 #define GET_AOUTHDR_TEXT_START bfd_h_get_6492 #define PUT_AOUTHDR_TEXT_START bfd_h_put_6493 #define GET_AOUTHDR_DATA_START bfd_h_get_6494 #define PUT_AOUTHDR_DATA_START bfd_h_put_6495 #define GET_SCNHDR_PADDR bfd_h_get_6496 #define PUT_SCNHDR_PADDR bfd_h_put_6497 #define GET_SCNHDR_VADDR bfd_h_get_6498 #define PUT_SCNHDR_VADDR bfd_h_put_6499 #define GET_SCNHDR_SIZE bfd_h_get_64100 #define PUT_SCNHDR_SIZE bfd_h_put_64101 #define GET_SCNHDR_SCNPTR bfd_h_get_64102 #define PUT_SCNHDR_SCNPTR bfd_h_put_64103 #define GET_SCNHDR_RELPTR bfd_h_get_64104 #define PUT_SCNHDR_RELPTR bfd_h_put_64105 #define GET_SCNHDR_LNNOPTR bfd_h_get_64106 #define PUT_SCNHDR_LNNOPTR bfd_h_put_6485 #define GET_FILEHDR_SYMPTR H_GET_64 86 #define PUT_FILEHDR_SYMPTR H_PUT_64 87 #define GET_AOUTHDR_TSIZE H_GET_64 88 #define PUT_AOUTHDR_TSIZE H_PUT_64 89 #define GET_AOUTHDR_DSIZE H_GET_64 90 #define PUT_AOUTHDR_DSIZE H_PUT_64 91 #define GET_AOUTHDR_BSIZE H_GET_64 92 #define PUT_AOUTHDR_BSIZE H_PUT_64 93 #define GET_AOUTHDR_ENTRY H_GET_64 94 #define PUT_AOUTHDR_ENTRY H_PUT_64 95 #define GET_AOUTHDR_TEXT_START H_GET_64 96 #define PUT_AOUTHDR_TEXT_START H_PUT_64 97 #define GET_AOUTHDR_DATA_START H_GET_64 98 #define PUT_AOUTHDR_DATA_START H_PUT_64 99 #define GET_SCNHDR_PADDR H_GET_64 100 #define PUT_SCNHDR_PADDR H_PUT_64 101 #define GET_SCNHDR_VADDR H_GET_64 102 #define PUT_SCNHDR_VADDR H_PUT_64 103 #define GET_SCNHDR_SIZE H_GET_64 104 #define PUT_SCNHDR_SIZE H_PUT_64 105 #define GET_SCNHDR_SCNPTR H_GET_64 106 #define PUT_SCNHDR_SCNPTR H_PUT_64 107 #define GET_SCNHDR_RELPTR H_GET_64 108 #define PUT_SCNHDR_RELPTR H_PUT_64 109 #define GET_SCNHDR_LNNOPTR H_GET_64 110 #define PUT_SCNHDR_LNNOPTR H_PUT_64 107 111 108 112 #define ALPHAECOFF … … 126 130 /* How to process the various reloc types. */ 127 131 128 static bfd_reloc_status_type 129 reloc_nil PARAMS ((bfd *, arelent *, asymbol *, PTR, 130 asection *, bfd *, char **)); 132 static bfd_reloc_status_type reloc_nil 133 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); 131 134 132 135 static bfd_reloc_status_type … … 156 159 0, /* size (0 = byte, 1 = short, 2 = long) */ 157 160 8, /* bitsize */ 158 true, /* pc_relative */161 TRUE, /* pc_relative */ 159 162 0, /* bitpos */ 160 163 complain_overflow_dont, /* complain_on_overflow */ 161 164 reloc_nil, /* special_function */ 162 165 "IGNORE", /* name */ 163 true, /* partial_inplace */166 TRUE, /* partial_inplace */ 164 167 0, /* src_mask */ 165 168 0, /* dst_mask */ 166 true), /* pcrel_offset */169 TRUE), /* pcrel_offset */ 167 170 168 171 /* A 32 bit reference to a symbol. */ … … 171 174 2, /* size (0 = byte, 1 = short, 2 = long) */ 172 175 32, /* bitsize */ 173 false, /* pc_relative */176 FALSE, /* pc_relative */ 174 177 0, /* bitpos */ 175 178 complain_overflow_bitfield, /* complain_on_overflow */ 176 179 0, /* special_function */ 177 180 "REFLONG", /* name */ 178 true, /* partial_inplace */181 TRUE, /* partial_inplace */ 179 182 0xffffffff, /* src_mask */ 180 183 0xffffffff, /* dst_mask */ 181 false), /* pcrel_offset */184 FALSE), /* pcrel_offset */ 182 185 183 186 /* A 64 bit reference to a symbol. */ … … 186 189 4, /* size (0 = byte, 1 = short, 2 = long) */ 187 190 64, /* bitsize */ 188 false, /* pc_relative */191 FALSE, /* pc_relative */ 189 192 0, /* bitpos */ 190 193 complain_overflow_bitfield, /* complain_on_overflow */ 191 194 0, /* special_function */ 192 195 "REFQUAD", /* name */ 193 true, /* partial_inplace */196 TRUE, /* partial_inplace */ 194 197 MINUS_ONE, /* src_mask */ 195 198 MINUS_ONE, /* dst_mask */ 196 false), /* pcrel_offset */199 FALSE), /* pcrel_offset */ 197 200 198 201 /* A 32 bit GP relative offset. This is just like REFLONG except … … 203 206 2, /* size (0 = byte, 1 = short, 2 = long) */ 204 207 32, /* bitsize */ 205 false, /* pc_relative */208 FALSE, /* pc_relative */ 206 209 0, /* bitpos */ 207 210 complain_overflow_bitfield, /* complain_on_overflow */ 208 211 0, /* special_function */ 209 212 "GPREL32", /* name */ 210 true, /* partial_inplace */213 TRUE, /* partial_inplace */ 211 214 0xffffffff, /* src_mask */ 212 215 0xffffffff, /* dst_mask */ 213 false), /* pcrel_offset */216 FALSE), /* pcrel_offset */ 214 217 215 218 /* Used for an instruction that refers to memory off the GP … … 220 223 2, /* size (0 = byte, 1 = short, 2 = long) */ 221 224 16, /* bitsize */ 222 false, /* pc_relative */225 FALSE, /* pc_relative */ 223 226 0, /* bitpos */ 224 227 complain_overflow_signed, /* complain_on_overflow */ 225 228 0, /* special_function */ 226 229 "LITERAL", /* name */ 227 true, /* partial_inplace */230 TRUE, /* partial_inplace */ 228 231 0xffff, /* src_mask */ 229 232 0xffff, /* dst_mask */ 230 false), /* pcrel_offset */233 FALSE), /* pcrel_offset */ 231 234 232 235 /* This reloc only appears immediately following a LITERAL reloc. … … 243 246 2, /* size (0 = byte, 1 = short, 2 = long) */ 244 247 32, /* bitsize */ 245 false, /* pc_relative */248 FALSE, /* pc_relative */ 246 249 0, /* bitpos */ 247 250 complain_overflow_dont, /* complain_on_overflow */ 248 251 reloc_nil, /* special_function */ 249 252 "LITUSE", /* name */ 250 false, /* partial_inplace */253 FALSE, /* partial_inplace */ 251 254 0, /* src_mask */ 252 255 0, /* dst_mask */ 253 false), /* pcrel_offset */256 FALSE), /* pcrel_offset */ 254 257 255 258 /* Load the gp register. This is always used for a ldah instruction … … 268 271 2, /* size (0 = byte, 1 = short, 2 = long) */ 269 272 16, /* bitsize */ 270 true, /* pc_relative */273 TRUE, /* pc_relative */ 271 274 0, /* bitpos */ 272 275 complain_overflow_dont, /* complain_on_overflow */ 273 276 reloc_nil, /* special_function */ 274 277 "GPDISP", /* name */ 275 true, /* partial_inplace */278 TRUE, /* partial_inplace */ 276 279 0xffff, /* src_mask */ 277 280 0xffff, /* dst_mask */ 278 true), /* pcrel_offset */281 TRUE), /* pcrel_offset */ 279 282 280 283 /* A 21 bit branch. The native assembler generates these for … … 285 288 2, /* size (0 = byte, 1 = short, 2 = long) */ 286 289 21, /* bitsize */ 287 true, /* pc_relative */290 TRUE, /* pc_relative */ 288 291 0, /* bitpos */ 289 292 complain_overflow_signed, /* complain_on_overflow */ 290 293 0, /* special_function */ 291 294 "BRADDR", /* name */ 292 true, /* partial_inplace */295 TRUE, /* partial_inplace */ 293 296 0x1fffff, /* src_mask */ 294 297 0x1fffff, /* dst_mask */ 295 false), /* pcrel_offset */298 FALSE), /* pcrel_offset */ 296 299 297 300 /* A hint for a jump to a register. */ … … 300 303 2, /* size (0 = byte, 1 = short, 2 = long) */ 301 304 14, /* bitsize */ 302 true, /* pc_relative */305 TRUE, /* pc_relative */ 303 306 0, /* bitpos */ 304 307 complain_overflow_dont, /* complain_on_overflow */ 305 308 0, /* special_function */ 306 309 "HINT", /* name */ 307 true, /* partial_inplace */310 TRUE, /* partial_inplace */ 308 311 0x3fff, /* src_mask */ 309 312 0x3fff, /* dst_mask */ 310 false), /* pcrel_offset */313 FALSE), /* pcrel_offset */ 311 314 312 315 /* 16 bit PC relative offset. */ … … 315 318 1, /* size (0 = byte, 1 = short, 2 = long) */ 316 319 16, /* bitsize */ 317 true, /* pc_relative */320 TRUE, /* pc_relative */ 318 321 0, /* bitpos */ 319 322 complain_overflow_signed, /* complain_on_overflow */ 320 323 0, /* special_function */ 321 324 "SREL16", /* name */ 322 true, /* partial_inplace */325 TRUE, /* partial_inplace */ 323 326 0xffff, /* src_mask */ 324 327 0xffff, /* dst_mask */ 325 false), /* pcrel_offset */328 FALSE), /* pcrel_offset */ 326 329 327 330 /* 32 bit PC relative offset. */ … … 330 333 2, /* size (0 = byte, 1 = short, 2 = long) */ 331 334 32, /* bitsize */ 332 true, /* pc_relative */335 TRUE, /* pc_relative */ 333 336 0, /* bitpos */ 334 337 complain_overflow_signed, /* complain_on_overflow */ 335 338 0, /* special_function */ 336 339 "SREL32", /* name */ 337 true, /* partial_inplace */340 TRUE, /* partial_inplace */ 338 341 0xffffffff, /* src_mask */ 339 342 0xffffffff, /* dst_mask */ 340 false), /* pcrel_offset */343 FALSE), /* pcrel_offset */ 341 344 342 345 /* A 64 bit PC relative offset. */ … … 345 348 4, /* size (0 = byte, 1 = short, 2 = long) */ 346 349 64, /* bitsize */ 347 true, /* pc_relative */350 TRUE, /* pc_relative */ 348 351 0, /* bitpos */ 349 352 complain_overflow_signed, /* complain_on_overflow */ 350 353 0, /* special_function */ 351 354 "SREL64", /* name */ 352 true, /* partial_inplace */355 TRUE, /* partial_inplace */ 353 356 MINUS_ONE, /* src_mask */ 354 357 MINUS_ONE, /* dst_mask */ 355 false), /* pcrel_offset */358 FALSE), /* pcrel_offset */ 356 359 357 360 /* Push a value on the reloc evaluation stack. */ … … 360 363 0, /* size (0 = byte, 1 = short, 2 = long) */ 361 364 0, /* bitsize */ 362 false, /* pc_relative */365 FALSE, /* pc_relative */ 363 366 0, /* bitpos */ 364 367 complain_overflow_dont, /* complain_on_overflow */ 365 368 0, /* special_function */ 366 369 "OP_PUSH", /* name */ 367 false, /* partial_inplace */370 FALSE, /* partial_inplace */ 368 371 0, /* src_mask */ 369 372 0, /* dst_mask */ 370 false), /* pcrel_offset */373 FALSE), /* pcrel_offset */ 371 374 372 375 /* Store the value from the stack at the given address. Store it in … … 376 379 4, /* size (0 = byte, 1 = short, 2 = long) */ 377 380 64, /* bitsize */ 378 false, /* pc_relative */381 FALSE, /* pc_relative */ 379 382 0, /* bitpos */ 380 383 complain_overflow_dont, /* complain_on_overflow */ 381 384 0, /* special_function */ 382 385 "OP_STORE", /* name */ 383 false, /* partial_inplace */386 FALSE, /* partial_inplace */ 384 387 0, /* src_mask */ 385 388 MINUS_ONE, /* dst_mask */ 386 false), /* pcrel_offset */389 FALSE), /* pcrel_offset */ 387 390 388 391 /* Subtract the reloc address from the value on the top of the … … 392 395 0, /* size (0 = byte, 1 = short, 2 = long) */ 393 396 0, /* bitsize */ 394 false, /* pc_relative */397 FALSE, /* pc_relative */ 395 398 0, /* bitpos */ 396 399 complain_overflow_dont, /* complain_on_overflow */ 397 400 0, /* special_function */ 398 401 "OP_PSUB", /* name */ 399 false, /* partial_inplace */402 FALSE, /* partial_inplace */ 400 403 0, /* src_mask */ 401 404 0, /* dst_mask */ 402 false), /* pcrel_offset */405 FALSE), /* pcrel_offset */ 403 406 404 407 /* Shift the value on the top of the relocation stack right by the … … 408 411 0, /* size (0 = byte, 1 = short, 2 = long) */ 409 412 0, /* bitsize */ 410 false, /* pc_relative */413 FALSE, /* pc_relative */ 411 414 0, /* bitpos */ 412 415 complain_overflow_dont, /* complain_on_overflow */ 413 416 0, /* special_function */ 414 417 "OP_PRSHIFT", /* name */ 415 false, /* partial_inplace */418 FALSE, /* partial_inplace */ 416 419 0, /* src_mask */ 417 420 0, /* dst_mask */ 418 false), /* pcrel_offset */421 FALSE), /* pcrel_offset */ 419 422 420 423 /* Adjust the GP value for a new range in the object file. */ … … 423 426 0, /* size (0 = byte, 1 = short, 2 = long) */ 424 427 0, /* bitsize */ 425 false, /* pc_relative */428 FALSE, /* pc_relative */ 426 429 0, /* bitpos */ 427 430 complain_overflow_dont, /* complain_on_overflow */ 428 431 0, /* special_function */ 429 432 "GPVALUE", /* name */ 430 false, /* partial_inplace */433 FALSE, /* partial_inplace */ 431 434 0, /* src_mask */ 432 435 0, /* dst_mask */ 433 false) /* pcrel_offset */436 FALSE) /* pcrel_offset */ 434 437 }; 435 438 … … 476 479 /* See whether the magic number matches. */ 477 480 478 static b oolean481 static bfd_boolean 479 482 alpha_ecoff_bad_format_hook (abfd, filehdr) 480 483 bfd *abfd ATTRIBUTE_UNUSED; … … 484 487 485 488 if (ALPHA_ECOFF_BADMAG (*internal_f)) 486 return false;487 488 return true;489 return FALSE; 490 491 return TRUE; 489 492 } 490 493 … … 536 539 const RELOC *ext = (RELOC *) ext_ptr; 537 540 538 intern->r_vaddr = bfd_h_get_64 (abfd, (bfd_byte *)ext->r_vaddr);539 intern->r_symndx = bfd_h_get_32 (abfd, (bfd_byte *)ext->r_symndx);541 intern->r_vaddr = H_GET_64 (abfd, ext->r_vaddr); 542 intern->r_symndx = H_GET_32 (abfd, ext->r_symndx); 540 543 541 544 BFD_ASSERT (bfd_header_little_endian (abfd)); … … 609 612 || (intern->r_symndx >= 0 && intern->r_symndx <= 14)); 610 613 611 bfd_h_put_64 (abfd, intern->r_vaddr, (bfd_byte *)ext->r_vaddr);612 bfd_h_put_32 (abfd, symndx, (bfd_byte *)ext->r_symndx);614 H_PUT_64 (abfd, intern->r_vaddr, ext->r_vaddr); 615 H_PUT_32 (abfd, symndx, ext->r_symndx); 613 616 614 617 BFD_ASSERT (bfd_header_little_endian (abfd)); … … 761 764 struct bfd_link_order *link_order; 762 765 bfd_byte *data; 763 b oolean relocateable;766 bfd_boolean relocateable; 764 767 asymbol **symbols; 765 768 { … … 771 774 bfd *output_bfd = relocateable ? abfd : (bfd *) NULL; 772 775 bfd_vma gp; 773 b oolean gp_undefined;776 bfd_boolean gp_undefined; 774 777 bfd_vma stack[RELOC_STACKSIZE]; 775 778 int tos = 0; … … 777 780 if (reloc_size < 0) 778 781 goto error_return; 779 reloc_vector = (arelent **) bfd_malloc ( reloc_size);782 reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); 780 783 if (reloc_vector == NULL && reloc_size != 0) 781 784 goto error_return; … … 787 790 /* The section size is not going to change. */ 788 791 input_section->_cooked_size = input_section->_raw_size; 789 input_section->reloc_done = true;792 input_section->reloc_done = TRUE; 790 793 791 794 reloc_count = bfd_canonicalize_reloc (input_bfd, input_section, … … 797 800 798 801 /* Get the GP value for the output BFD. */ 799 gp_undefined = false;802 gp_undefined = FALSE; 800 803 gp = _bfd_get_gp_value (abfd); 801 804 if (gp == 0) 802 805 { 803 if (relocateable != false)806 if (relocateable) 804 807 { 805 808 asection *sec; … … 825 828 struct bfd_link_hash_entry *h; 826 829 827 h = bfd_link_hash_lookup (link_info->hash, "_gp", false, false,828 true);830 h = bfd_link_hash_lookup (link_info->hash, "_gp", FALSE, FALSE, 831 TRUE); 829 832 if (h == (struct bfd_link_hash_entry *) NULL 830 833 || h->type != bfd_link_hash_defined) 831 gp_undefined = true;834 gp_undefined = TRUE; 832 835 else 833 836 { … … 1117 1120 /* I really don't know if this does the right thing. */ 1118 1121 gp = rel->addend; 1119 gp_undefined = false;1122 gp_undefined = FALSE; 1120 1123 break; 1121 1124 … … 1140 1143 if (! ((*link_info->callbacks->undefined_symbol) 1141 1144 (link_info, bfd_asymbol_name (*rel->sym_ptr_ptr), 1142 input_bfd, input_section, rel->address, true)))1145 input_bfd, input_section, rel->address, TRUE))) 1143 1146 goto error_return; 1144 1147 break; … … 1284 1287 name = bfd_get_section_name (output_bfd, hsec->output_section); 1285 1288 1286 r_symndx = -1;1289 r_symndx = (unsigned long) -1; 1287 1290 switch (name[1]) 1288 1291 { … … 1341 1344 } 1342 1345 1343 if (r_symndx == -1)1346 if (r_symndx == (unsigned long) -1) 1344 1347 abort (); 1345 1348 … … 1354 1357 the output BFD. */ 1355 1358 r_symndx = h->indx; 1356 if (r_symndx == -1)1359 if (r_symndx == (unsigned long) -1) 1357 1360 { 1358 1361 /* Caller must give an error. */ … … 1363 1366 1364 1367 /* Write out the new r_symndx value. */ 1365 bfd_h_put_32 (input_bfd, (bfd_vma) r_symndx, 1366 (bfd_byte *) ext_rel->r_symndx); 1368 H_PUT_32 (input_bfd, r_symndx, ext_rel->r_symndx); 1367 1369 1368 1370 return relocation; … … 1373 1375 could be combined somehow. */ 1374 1376 1375 static b oolean1377 static bfd_boolean 1376 1378 alpha_relocate_section (output_bfd, info, input_bfd, input_section, 1377 1379 contents, external_relocs) … … 1386 1388 struct ecoff_link_hash_entry **sym_hashes; 1387 1389 bfd_vma gp; 1388 b oolean gp_undefined;1390 bfd_boolean gp_undefined; 1389 1391 bfd_vma stack[RELOC_STACKSIZE]; 1390 1392 int tos = 0; 1391 1393 struct external_reloc *ext_rel; 1392 1394 struct external_reloc *ext_rel_end; 1395 bfd_size_type amt; 1393 1396 1394 1397 /* We keep a table mapping the symndx found in an internal reloc to … … 1398 1401 if (symndx_to_section == (asection **) NULL) 1399 1402 { 1400 symndx_to_section = ((asection **) 1401 bfd_alloc (input_bfd, 1402 (NUM_RELOC_SECTIONS 1403 * sizeof (asection *)))); 1403 amt = NUM_RELOC_SECTIONS * sizeof (asection *); 1404 symndx_to_section = (asection **) bfd_alloc (input_bfd, amt); 1404 1405 if (!symndx_to_section) 1405 return false;1406 return FALSE; 1406 1407 1407 1408 symndx_to_section[RELOC_SECTION_NONE] = NULL; … … 1458 1459 if (lita_sec_data == NULL) 1459 1460 { 1461 amt = sizeof (struct ecoff_section_tdata); 1460 1462 lita_sec_data = ((struct ecoff_section_tdata *) 1461 bfd_zalloc (input_bfd, 1462 sizeof (struct ecoff_section_tdata))); 1463 bfd_zalloc (input_bfd, amt)); 1463 1464 ecoff_section_data (input_bfd, lita_sec) = lita_sec_data; 1464 1465 } … … 1494 1495 (char *) NULL, output_bfd, 1495 1496 (asection *) NULL, (bfd_vma) 0); 1496 ecoff_data (output_bfd)->issued_multiple_gp_warning = true;1497 ecoff_data (output_bfd)->issued_multiple_gp_warning = TRUE; 1497 1498 } 1498 1499 if (lita_vma < gp - 0x8000) … … 1524 1525 int r_offset; 1525 1526 int r_size; 1526 b oolean relocatep;1527 b oolean adjust_addrp;1528 b oolean gp_usedp;1527 bfd_boolean relocatep; 1528 bfd_boolean adjust_addrp; 1529 bfd_boolean gp_usedp; 1529 1530 bfd_vma addend; 1530 1531 1531 r_vaddr = bfd_h_get_64 (input_bfd, (bfd_byte *)ext_rel->r_vaddr);1532 r_symndx = bfd_h_get_32 (input_bfd, (bfd_byte *)ext_rel->r_symndx);1532 r_vaddr = H_GET_64 (input_bfd, ext_rel->r_vaddr); 1533 r_symndx = H_GET_32 (input_bfd, ext_rel->r_symndx); 1533 1534 1534 1535 r_type = ((ext_rel->r_bits[0] & RELOC_BITS0_TYPE_LITTLE) … … 1541 1542 >> RELOC_BITS3_SIZE_SH_LITTLE); 1542 1543 1543 relocatep = false;1544 adjust_addrp = true;1545 gp_usedp = false;1544 relocatep = FALSE; 1545 adjust_addrp = TRUE; 1546 gp_usedp = FALSE; 1546 1547 addend = 0; 1547 1548 … … 1559 1560 section VMA, unlike the other relocation types. */ 1560 1561 if (info->relocateable) 1561 bfd_h_put_64 (input_bfd, 1562 input_section->output_offset + r_vaddr, 1563 (bfd_byte *) ext_rel->r_vaddr); 1564 adjust_addrp = false; 1562 H_PUT_64 (input_bfd, input_section->output_offset + r_vaddr, 1563 ext_rel->r_vaddr); 1564 adjust_addrp = FALSE; 1565 1565 break; 1566 1566 … … 1568 1568 case ALPHA_R_REFQUAD: 1569 1569 case ALPHA_R_HINT: 1570 relocatep = true;1570 relocatep = TRUE; 1571 1571 break; 1572 1572 … … 1577 1577 if (r_extern) 1578 1578 addend += - (r_vaddr + 4); 1579 relocatep = true;1579 relocatep = TRUE; 1580 1580 break; 1581 1581 … … 1585 1585 by the different between the original GP value and the 1586 1586 current GP value. */ 1587 relocatep = true;1587 relocatep = TRUE; 1588 1588 addend = ecoff_data (input_bfd)->gp - gp; 1589 gp_usedp = true;1589 gp_usedp = TRUE; 1590 1590 break; 1591 1591 … … 1618 1618 } 1619 1619 1620 relocatep = true;1620 relocatep = TRUE; 1621 1621 addend = ecoff_data (input_bfd)->gp - gp; 1622 gp_usedp = true;1622 gp_usedp = TRUE; 1623 1623 break; 1624 1624 … … 1684 1684 contents + r_vaddr - input_section->vma + r_symndx); 1685 1685 1686 gp_usedp = true;1686 gp_usedp = TRUE; 1687 1687 } 1688 1688 break; … … 1727 1727 if (! ((*info->callbacks->undefined_symbol) 1728 1728 (info, h->root.root.string, input_bfd, 1729 input_section, (bfd_vma) 0, true)))1730 return false;1729 input_section, (bfd_vma) 0, TRUE))) 1730 return FALSE; 1731 1731 addend = 0; 1732 1732 } … … 1744 1744 (info, h->root.root.string, input_bfd, 1745 1745 input_section, (bfd_vma) 0))) 1746 return false;1746 return FALSE; 1747 1747 } 1748 1748 … … 1758 1758 { 1759 1759 /* Adjust r_vaddr by the addend. */ 1760 bfd_h_put_64 (input_bfd, addend, 1761 (bfd_byte *) ext_rel->r_vaddr); 1760 H_PUT_64 (input_bfd, addend, ext_rel->r_vaddr); 1762 1761 } 1763 1762 else … … 1785 1784 } 1786 1785 1787 adjust_addrp = false;1786 adjust_addrp = FALSE; 1788 1787 break; 1789 1788 … … 1822 1821 /* I really don't know if this does the right thing. */ 1823 1822 gp = ecoff_data (input_bfd)->gp + r_symndx; 1824 gp_undefined = false;1823 gp_undefined = FALSE; 1825 1824 break; 1826 1825 } … … 1872 1871 (info, h->root.root.string, input_bfd, 1873 1872 input_section, r_vaddr - input_section->vma))) 1874 return false;1873 return FALSE; 1875 1874 } 1876 1875 … … 1929 1928 (info, h->root.root.string, input_bfd, 1930 1929 input_section, 1931 r_vaddr - input_section->vma, true)))1932 return false;1930 r_vaddr - input_section->vma, TRUE))) 1931 return FALSE; 1933 1932 relocation = 0; 1934 1933 } … … 1976 1975 (bfd_vma) 0, input_bfd, input_section, 1977 1976 r_vaddr - input_section->vma))) 1978 return false;1977 return FALSE; 1979 1978 } 1980 1979 break; … … 1986 1985 { 1987 1986 /* Change the address of the relocation. */ 1988 bfd_h_put_64 (input_bfd,1989 1990 1991 1992 1993 (bfd_byte *)ext_rel->r_vaddr);1987 H_PUT_64 (input_bfd, 1988 (input_section->output_section->vma 1989 + input_section->output_offset 1990 - input_section->vma 1991 + r_vaddr), 1992 ext_rel->r_vaddr); 1994 1993 } 1995 1994 … … 1997 1996 { 1998 1997 if (! ((*info->callbacks->reloc_dangerous) 1999 (info, _("GP relative relocation when GP not defined"),1998 (info, _("GP relative relocation used when GP not defined"), 2000 1999 input_bfd, input_section, r_vaddr - input_section->vma))) 2001 return false;2000 return FALSE; 2002 2001 /* Only give the error once per link. */ 2003 2002 gp = 4; 2004 2003 _bfd_set_gp_value (output_bfd, gp); 2005 gp_undefined = false;2004 gp_undefined = FALSE; 2006 2005 } 2007 2006 } … … 2010 2009 abort (); 2011 2010 2012 return true;2011 return TRUE; 2013 2012 } 2014 2013 … … 2017 2016 sets the dynamic bits in the file header. */ 2018 2017 2019 static b oolean2018 static bfd_boolean 2020 2019 alpha_adjust_headers (abfd, fhdr, ahdr) 2021 2020 bfd *abfd; … … 2027 2026 else if ((abfd->flags & DYNAMIC) != 0) 2028 2027 fhdr->f_flags |= F_ALPHA_SHARABLE; 2029 return true;2028 return TRUE; 2030 2029 } 2031 2030 … … 2071 2070 /* This is a compressed file. We must set the size correctly. 2072 2071 The size is the eight bytes after the dummy file header. */ 2073 if (bfd_seek (abfd, FILHSZ, SEEK_CUR) != 02074 || bfd_ read (ab, 1,8, abfd) != 82075 || bfd_seek (abfd, - (FILHSZ + 8), SEEK_CUR) != 0)2072 if (bfd_seek (abfd, (file_ptr) FILHSZ, SEEK_CUR) != 0 2073 || bfd_bread (ab, (bfd_size_type) 8, abfd) != 8 2074 || bfd_seek (abfd, (file_ptr) (- (FILHSZ + 8)), SEEK_CUR) != 0) 2076 2075 return NULL; 2077 2076 2078 ret->parsed_size = bfd_h_get_64 (abfd, ab);2077 ret->parsed_size = H_GET_64 (abfd, ab); 2079 2078 } 2080 2079 … … 2114 2113 2115 2114 /* We must uncompress this element. We do this by copying it into a 2116 memory buffer, and making bfd_ read and bfd_seek use that buffer.2115 memory buffer, and making bfd_bread and bfd_seek use that buffer. 2117 2116 This can use a lot of memory, but it's simpler than getting a 2118 2117 temporary file, making that work with the file descriptor caching … … 2121 2120 2122 2121 /* The compressed file starts with a dummy ECOFF file header. */ 2123 if (bfd_seek (nbfd, FILHSZ, SEEK_SET) != 0)2122 if (bfd_seek (nbfd, (file_ptr) FILHSZ, SEEK_SET) != 0) 2124 2123 goto error_return; 2125 2124 2126 2125 /* The next eight bytes are the real file size. */ 2127 if (bfd_ read (ab, 1,8, nbfd) != 8)2126 if (bfd_bread (ab, (bfd_size_type) 8, nbfd) != 8) 2128 2127 goto error_return; 2129 size = bfd_h_get_64 (nbfd, ab);2128 size = H_GET_64 (nbfd, ab); 2130 2129 2131 2130 if (size == 0) … … 2146 2145 2147 2146 /* I don't know what the next eight bytes are for. */ 2148 if (bfd_ read (ab, 1,8, nbfd) != 8)2147 if (bfd_bread (ab, (bfd_size_type) 8, nbfd) != 8) 2149 2148 goto error_return; 2150 2149 … … 2157 2156 memset (dict, 0, sizeof dict); 2158 2157 h = 0; 2159 while (bfd_ read (&b, 1,1, nbfd) == 1)2158 while (bfd_bread (&b, (bfd_size_type) 1, nbfd) == 1) 2160 2159 { 2161 2160 unsigned int i; … … 2169 2168 else 2170 2169 { 2171 if (! bfd_ read (&n, 1,1, nbfd))2170 if (! bfd_bread (&n, (bfd_size_type) 1, nbfd)) 2172 2171 goto error_return; 2173 2172 dict[h] = n; … … 2192 2191 /* Now the uncompressed file contents are in buf. */ 2193 2192 bim = ((struct bfd_in_memory *) 2194 bfd_alloc (nbfd, sizeof (struct bfd_in_memory)));2193 bfd_alloc (nbfd, (bfd_size_type) sizeof (struct bfd_in_memory))); 2195 2194 if (bim == NULL) 2196 2195 goto error_return; … … 2198 2197 bim->buffer = buf; 2199 2198 2200 nbfd->mtime_set = true;2199 nbfd->mtime_set = TRUE; 2201 2200 nbfd->mtime = strtol (hdr->ar_date, (char **) NULL, 10); 2202 2201 … … 2276 2275 alpha_ecoff_swap_filehdr_out, alpha_ecoff_swap_aouthdr_out, 2277 2276 alpha_ecoff_swap_scnhdr_out, 2278 FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, true, false, 4, false, 2,2277 FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, TRUE, FALSE, 4, FALSE, 2, 2279 2278 alpha_ecoff_swap_filehdr_in, alpha_ecoff_swap_aouthdr_in, 2280 2279 alpha_ecoff_swap_scnhdr_in, NULL, … … 2292 2291 executable file. E.g., 0x1000. */ 2293 2292 0x2000, 2294 /* T rueif the .rdata section is part of the text segment, as on the2295 Alpha. F alseif .rdata is part of the data segment, as on the2293 /* TRUE if the .rdata section is part of the text segment, as on the 2294 Alpha. FALSE if .rdata is part of the data segment, as on the 2296 2295 MIPS. */ 2297 true,2296 TRUE, 2298 2297 /* Bitsize of constructor entries. */ 2299 2298 64, … … 2369 2368 #define _bfd_ecoff_bfd_relax_section bfd_generic_relax_section 2370 2369 #define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections 2370 #define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_sections 2371 #define _bfd_ecoff_bfd_discard_group bfd_generic_discard_group 2371 2372 2372 2373 const bfd_target ecoffalpha_little_vec = -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.