Changeset 609 for branches/GNU/src/binutils/bfd/nlm32-ppc.c
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/bfd/nlm32-ppc.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* Support for 32-bit PowerPC NLM (NetWare Loadable Module) 2 Copyright 1994, 1995, 2000 Free Software Foundation, Inc.2 Copyright 1994, 1995, 2000, 2001, 2002 Free Software Foundation, Inc. 3 3 4 4 This file is part of BFD, the Binary File Descriptor library. … … 33 33 34 34 #ifdef OLDFORMAT 35 static b oolean nlm_powerpc_backend_object_p35 static bfd_boolean nlm_powerpc_backend_object_p 36 36 PARAMS ((bfd *)); 37 static b oolean nlm_powerpc_write_prefix37 static bfd_boolean nlm_powerpc_write_prefix 38 38 PARAMS ((bfd *)); 39 39 #endif 40 40 41 static b oolean nlm_powerpc_read_reloc41 static bfd_boolean nlm_powerpc_read_reloc 42 42 PARAMS ((bfd *, nlmNAME(symbol_type) *, asection **, arelent *)); 43 static b oolean nlm_powerpc_mangle_relocs43 static bfd_boolean nlm_powerpc_mangle_relocs 44 44 PARAMS ((bfd *, asection *, PTR, bfd_vma, bfd_size_type)); 45 static b oolean nlm_powerpc_read_import45 static bfd_boolean nlm_powerpc_read_import 46 46 PARAMS ((bfd *, nlmNAME(symbol_type) *)); 47 47 48 48 #ifdef OLDFORMAT 49 static b oolean nlm_powerpc_write_reloc49 static bfd_boolean nlm_powerpc_write_reloc 50 50 PARAMS ((bfd *, asection *, arelent *, int)); 51 51 #endif 52 52 53 static b oolean nlm_powerpc_write_import53 static bfd_boolean nlm_powerpc_write_import 54 54 PARAMS ((bfd *, asection *, arelent *)); 55 static b oolean nlm_powerpc_write_external55 static bfd_boolean nlm_powerpc_write_external 56 56 PARAMS ((bfd *, bfd_size_type, asymbol *, struct reloc_and_sec *)); 57 57 58 58 #ifndef OLDFORMAT 59 static b oolean nlm_powerpc_set_public_section59 static bfd_boolean nlm_powerpc_set_public_section 60 60 PARAMS ((bfd *, nlmNAME(symbol_type) *)); 61 61 static bfd_vma nlm_powerpc_get_public_offset … … 72 72 the location before the regular NLM header. */ 73 73 74 static b oolean74 static bfd_boolean 75 75 nlm_powerpc_backend_object_p (abfd) 76 76 bfd *abfd; … … 78 78 struct nlm32_powerpc_external_prefix_header s; 79 79 80 if (bfd_ read ((PTR) &s, sizeof s, 1, abfd) != sizeof s)81 return false;80 if (bfd_bread ((PTR) &s, (bfd_size_type) sizeof s, abfd) != sizeof s) 81 return FALSE; 82 82 83 83 if (memcmp (s.signature, NLM32_POWERPC_SIGNATURE, sizeof s.signature) != 0 84 || bfd_h_get_32 (abfd, s.headerVersion) != NLM32_POWERPC_HEADER_VERSION)85 return false;86 87 return true;84 || H_GET_32 (abfd, s.headerVersion) != NLM32_POWERPC_HEADER_VERSION) 85 return FALSE; 86 87 return TRUE; 88 88 } 89 89 90 90 /* Write out the prefix. */ 91 91 92 static b oolean92 static bfd_boolean 93 93 nlm_powerpc_write_prefix (abfd) 94 94 bfd *abfd; … … 98 98 memset (&s, 0, sizeof s); 99 99 memcpy (s.signature, NLM32_POWERPC_SIGNATURE, sizeof s.signature); 100 bfd_h_put_32 (abfd, (bfd_vma)NLM32_POWERPC_HEADER_VERSION, s.headerVersion);101 bfd_h_put_32 (abfd, (bfd_vma)0, s.origins);100 H_PUT_32 (abfd, NLM32_POWERPC_HEADER_VERSION, s.headerVersion); 101 H_PUT_32 (abfd, 0, s.origins); 102 102 103 103 /* FIXME: What should we do about the date? */ 104 104 105 if (bfd_ write ((PTR) &s, sizeof s, 1, abfd) != sizeof s)106 return false;107 108 return true;105 if (bfd_bwrite ((PTR) &s, (bfd_size_type) sizeof s, abfd) != sizeof s) 106 return FALSE; 107 108 return TRUE; 109 109 } 110 110 … … 121 121 2, /* size (0 = byte, 1 = short, 2 = long) */ 122 122 32, /* bitsize */ 123 false, /* pc_relative */123 FALSE, /* pc_relative */ 124 124 0, /* bitpos */ 125 125 complain_overflow_bitfield, /* complain_on_overflow */ 126 126 0, /* special_function */ 127 127 "32", /* name */ 128 true, /* partial_inplace */128 TRUE, /* partial_inplace */ 129 129 0xffffffff, /* src_mask */ 130 130 0xffffffff, /* dst_mask */ 131 false); /* pcrel_offset */131 FALSE); /* pcrel_offset */ 132 132 133 133 /* Read a PowerPC NLM reloc. */ 134 134 135 static b oolean135 static bfd_boolean 136 136 nlm_powerpc_read_reloc (abfd, sym, secp, rel) 137 137 bfd *abfd; … … 144 144 const char *name; 145 145 146 if (bfd_ read (temp, sizeof (temp), 1, abfd) != sizeof (temp))147 return false;146 if (bfd_bread (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp)) 147 return FALSE; 148 148 149 149 val = bfd_get_32 (abfd, temp); … … 190 190 rel->addend = 0; 191 191 192 return true;192 return TRUE; 193 193 } 194 194 … … 207 207 2, /* size (0 = byte, 1 = short, 2 = long) */ 208 208 32, /* bitsize */ 209 false, /* pc_relative */209 FALSE, /* pc_relative */ 210 210 0, /* bitpos */ 211 211 complain_overflow_bitfield, /* complain_on_overflow */ 212 212 0, /* special_function */ 213 213 "R_POS", /* name */ 214 true, /* partial_inplace */214 TRUE, /* partial_inplace */ 215 215 0xffffffff, /* src_mask */ 216 216 0xffffffff, /* dst_mask */ 217 false), /* pcrel_offset */217 FALSE), /* pcrel_offset */ 218 218 219 219 /* 32 bit relocation, but store negative value. */ … … 222 222 -2, /* size (0 = byte, 1 = short, 2 = long) */ 223 223 32, /* bitsize */ 224 false, /* pc_relative */224 FALSE, /* pc_relative */ 225 225 0, /* bitpos */ 226 226 complain_overflow_bitfield, /* complain_on_overflow */ 227 227 0, /* special_function */ 228 228 "R_NEG", /* name */ 229 true, /* partial_inplace */229 TRUE, /* partial_inplace */ 230 230 0xffffffff, /* src_mask */ 231 231 0xffffffff, /* dst_mask */ 232 false), /* pcrel_offset */232 FALSE), /* pcrel_offset */ 233 233 234 234 /* 32 bit PC relative relocation. */ … … 237 237 2, /* size (0 = byte, 1 = short, 2 = long) */ 238 238 32, /* bitsize */ 239 true, /* pc_relative */239 TRUE, /* pc_relative */ 240 240 0, /* bitpos */ 241 241 complain_overflow_signed, /* complain_on_overflow */ 242 242 0, /* special_function */ 243 243 "R_REL", /* name */ 244 true, /* partial_inplace */244 TRUE, /* partial_inplace */ 245 245 0xffffffff, /* src_mask */ 246 246 0xffffffff, /* dst_mask */ 247 false), /* pcrel_offset */247 FALSE), /* pcrel_offset */ 248 248 249 249 /* 16 bit TOC relative relocation. */ … … 252 252 1, /* size (0 = byte, 1 = short, 2 = long) */ 253 253 16, /* bitsize */ 254 false, /* pc_relative */254 FALSE, /* pc_relative */ 255 255 0, /* bitpos */ 256 256 complain_overflow_signed, /* complain_on_overflow */ 257 257 0, /* special_function */ 258 258 "R_TOC", /* name */ 259 true, /* partial_inplace */260 0xffff, /* src_mask */ 261 0xffff, /* dst_mask */ 262 false), /* pcrel_offset */259 TRUE, /* partial_inplace */ 260 0xffff, /* src_mask */ 261 0xffff, /* dst_mask */ 262 FALSE), /* pcrel_offset */ 263 263 264 264 /* I don't really know what this is. */ … … 267 267 2, /* size (0 = byte, 1 = short, 2 = long) */ 268 268 32, /* bitsize */ 269 false, /* pc_relative */269 FALSE, /* pc_relative */ 270 270 0, /* bitpos */ 271 271 complain_overflow_bitfield, /* complain_on_overflow */ 272 272 0, /* special_function */ 273 273 "R_RTB", /* name */ 274 true, /* partial_inplace */274 TRUE, /* partial_inplace */ 275 275 0xffffffff, /* src_mask */ 276 276 0xffffffff, /* dst_mask */ 277 false), /* pcrel_offset */277 FALSE), /* pcrel_offset */ 278 278 279 279 /* External TOC relative symbol. */ … … 282 282 2, /* size (0 = byte, 1 = short, 2 = long) */ 283 283 16, /* bitsize */ 284 false, /* pc_relative */284 FALSE, /* pc_relative */ 285 285 0, /* bitpos */ 286 286 complain_overflow_bitfield, /* complain_on_overflow */ 287 287 0, /* special_function */ 288 288 "R_GL", /* name */ 289 true, /* partial_inplace */290 0xffff, /* src_mask */ 291 0xffff, /* dst_mask */ 292 false), /* pcrel_offset */289 TRUE, /* partial_inplace */ 290 0xffff, /* src_mask */ 291 0xffff, /* dst_mask */ 292 FALSE), /* pcrel_offset */ 293 293 294 294 /* Local TOC relative symbol. */ … … 297 297 2, /* size (0 = byte, 1 = short, 2 = long) */ 298 298 16, /* bitsize */ 299 false, /* pc_relative */299 FALSE, /* pc_relative */ 300 300 0, /* bitpos */ 301 301 complain_overflow_bitfield, /* complain_on_overflow */ 302 302 0, /* special_function */ 303 303 "R_TCL", /* name */ 304 true, /* partial_inplace */305 0xffff, /* src_mask */ 306 0xffff, /* dst_mask */ 307 false), /* pcrel_offset */304 TRUE, /* partial_inplace */ 305 0xffff, /* src_mask */ 306 0xffff, /* dst_mask */ 307 FALSE), /* pcrel_offset */ 308 308 309 309 { 7 }, … … 314 314 2, /* size (0 = byte, 1 = short, 2 = long) */ 315 315 26, /* bitsize */ 316 false, /* pc_relative */316 FALSE, /* pc_relative */ 317 317 0, /* bitpos */ 318 318 complain_overflow_bitfield, /* complain_on_overflow */ 319 319 0, /* special_function */ 320 320 "R_BA", /* name */ 321 true, /* partial_inplace */321 TRUE, /* partial_inplace */ 322 322 0x3fffffc, /* src_mask */ 323 323 0x3fffffc, /* dst_mask */ 324 false), /* pcrel_offset */324 FALSE), /* pcrel_offset */ 325 325 326 326 { 9 }, … … 331 331 2, /* size (0 = byte, 1 = short, 2 = long) */ 332 332 26, /* bitsize */ 333 true, /* pc_relative */333 TRUE, /* pc_relative */ 334 334 0, /* bitpos */ 335 335 complain_overflow_signed, /* complain_on_overflow */ 336 336 0, /* special_function */ 337 337 "R_BR", /* name */ 338 true, /* partial_inplace */338 TRUE, /* partial_inplace */ 339 339 0x3fffffc, /* src_mask */ 340 340 0x3fffffc, /* dst_mask */ 341 false), /* pcrel_offset */341 FALSE), /* pcrel_offset */ 342 342 343 343 { 0xb }, … … 348 348 2, /* size (0 = byte, 1 = short, 2 = long) */ 349 349 16, /* bitsize */ 350 false, /* pc_relative */350 FALSE, /* pc_relative */ 351 351 0, /* bitpos */ 352 352 complain_overflow_bitfield, /* complain_on_overflow */ 353 353 0, /* special_function */ 354 354 "R_RL", /* name */ 355 true, /* partial_inplace */356 0xffff, /* src_mask */ 357 0xffff, /* dst_mask */ 358 false), /* pcrel_offset */355 TRUE, /* partial_inplace */ 356 0xffff, /* src_mask */ 357 0xffff, /* dst_mask */ 358 FALSE), /* pcrel_offset */ 359 359 360 360 /* Load address. */ … … 363 363 2, /* size (0 = byte, 1 = short, 2 = long) */ 364 364 16, /* bitsize */ 365 false, /* pc_relative */365 FALSE, /* pc_relative */ 366 366 0, /* bitpos */ 367 367 complain_overflow_bitfield, /* complain_on_overflow */ 368 368 0, /* special_function */ 369 369 "R_RLA", /* name */ 370 true, /* partial_inplace */371 0xffff, /* src_mask */ 372 0xffff, /* dst_mask */ 373 false), /* pcrel_offset */370 TRUE, /* partial_inplace */ 371 0xffff, /* src_mask */ 372 0xffff, /* dst_mask */ 373 FALSE), /* pcrel_offset */ 374 374 375 375 { 0xe }, … … 380 380 2, /* size (0 = byte, 1 = short, 2 = long) */ 381 381 32, /* bitsize */ 382 false, /* pc_relative */382 FALSE, /* pc_relative */ 383 383 0, /* bitpos */ 384 384 complain_overflow_bitfield, /* complain_on_overflow */ 385 385 0, /* special_function */ 386 386 "R_REF", /* name */ 387 false, /* partial_inplace */387 FALSE, /* partial_inplace */ 388 388 0, /* src_mask */ 389 389 0, /* dst_mask */ 390 false), /* pcrel_offset */390 FALSE), /* pcrel_offset */ 391 391 392 392 { 0x10 }, … … 398 398 2, /* size (0 = byte, 1 = short, 2 = long) */ 399 399 16, /* bitsize */ 400 false, /* pc_relative */400 FALSE, /* pc_relative */ 401 401 0, /* bitpos */ 402 402 complain_overflow_bitfield, /* complain_on_overflow */ 403 403 0, /* special_function */ 404 404 "R_TRL", /* name */ 405 true, /* partial_inplace */406 0xffff, /* src_mask */ 407 0xffff, /* dst_mask */ 408 false), /* pcrel_offset */405 TRUE, /* partial_inplace */ 406 0xffff, /* src_mask */ 407 0xffff, /* dst_mask */ 408 FALSE), /* pcrel_offset */ 409 409 410 410 /* TOC relative load address. */ … … 413 413 2, /* size (0 = byte, 1 = short, 2 = long) */ 414 414 16, /* bitsize */ 415 false, /* pc_relative */415 FALSE, /* pc_relative */ 416 416 0, /* bitpos */ 417 417 complain_overflow_bitfield, /* complain_on_overflow */ 418 418 0, /* special_function */ 419 419 "R_TRLA", /* name */ 420 true, /* partial_inplace */421 0xffff, /* src_mask */ 422 0xffff, /* dst_mask */ 423 false), /* pcrel_offset */420 TRUE, /* partial_inplace */ 421 0xffff, /* src_mask */ 422 0xffff, /* dst_mask */ 423 FALSE), /* pcrel_offset */ 424 424 425 425 /* Modifiable relative branch. */ … … 428 428 2, /* size (0 = byte, 1 = short, 2 = long) */ 429 429 32, /* bitsize */ 430 false, /* pc_relative */430 FALSE, /* pc_relative */ 431 431 0, /* bitpos */ 432 432 complain_overflow_bitfield, /* complain_on_overflow */ 433 433 0, /* special_function */ 434 434 "R_RRTBI", /* name */ 435 true, /* partial_inplace */435 TRUE, /* partial_inplace */ 436 436 0xffffffff, /* src_mask */ 437 437 0xffffffff, /* dst_mask */ 438 false), /* pcrel_offset */438 FALSE), /* pcrel_offset */ 439 439 440 440 /* Modifiable absolute branch. */ … … 443 443 2, /* size (0 = byte, 1 = short, 2 = long) */ 444 444 32, /* bitsize */ 445 false, /* pc_relative */445 FALSE, /* pc_relative */ 446 446 0, /* bitpos */ 447 447 complain_overflow_bitfield, /* complain_on_overflow */ 448 448 0, /* special_function */ 449 449 "R_RRTBA", /* name */ 450 true, /* partial_inplace */450 TRUE, /* partial_inplace */ 451 451 0xffffffff, /* src_mask */ 452 452 0xffffffff, /* dst_mask */ 453 false), /* pcrel_offset */453 FALSE), /* pcrel_offset */ 454 454 455 455 /* Modifiable call absolute indirect. */ … … 458 458 2, /* size (0 = byte, 1 = short, 2 = long) */ 459 459 16, /* bitsize */ 460 false, /* pc_relative */460 FALSE, /* pc_relative */ 461 461 0, /* bitpos */ 462 462 complain_overflow_bitfield, /* complain_on_overflow */ 463 463 0, /* special_function */ 464 464 "R_CAI", /* name */ 465 true, /* partial_inplace */466 0xffff, /* src_mask */ 467 0xffff, /* dst_mask */ 468 false), /* pcrel_offset */465 TRUE, /* partial_inplace */ 466 0xffff, /* src_mask */ 467 0xffff, /* dst_mask */ 468 FALSE), /* pcrel_offset */ 469 469 470 470 /* Modifiable call relative. */ … … 473 473 2, /* size (0 = byte, 1 = short, 2 = long) */ 474 474 16, /* bitsize */ 475 false, /* pc_relative */475 FALSE, /* pc_relative */ 476 476 0, /* bitpos */ 477 477 complain_overflow_bitfield, /* complain_on_overflow */ 478 478 0, /* special_function */ 479 479 "R_REL", /* name */ 480 true, /* partial_inplace */481 0xffff, /* src_mask */ 482 0xffff, /* dst_mask */ 483 false), /* pcrel_offset */480 TRUE, /* partial_inplace */ 481 0xffff, /* src_mask */ 482 0xffff, /* dst_mask */ 483 FALSE), /* pcrel_offset */ 484 484 485 485 /* Modifiable branch absolute. */ … … 488 488 2, /* size (0 = byte, 1 = short, 2 = long) */ 489 489 16, /* bitsize */ 490 false, /* pc_relative */490 FALSE, /* pc_relative */ 491 491 0, /* bitpos */ 492 492 complain_overflow_bitfield, /* complain_on_overflow */ 493 493 0, /* special_function */ 494 494 "R_RBA", /* name */ 495 true, /* partial_inplace */496 0xffff, /* src_mask */ 497 0xffff, /* dst_mask */ 498 false), /* pcrel_offset */495 TRUE, /* partial_inplace */ 496 0xffff, /* src_mask */ 497 0xffff, /* dst_mask */ 498 FALSE), /* pcrel_offset */ 499 499 500 500 /* Modifiable branch absolute. */ … … 503 503 2, /* size (0 = byte, 1 = short, 2 = long) */ 504 504 16, /* bitsize */ 505 false, /* pc_relative */505 FALSE, /* pc_relative */ 506 506 0, /* bitpos */ 507 507 complain_overflow_bitfield, /* complain_on_overflow */ 508 508 0, /* special_function */ 509 509 "R_RBAC", /* name */ 510 true, /* partial_inplace */511 0xffff, /* src_mask */ 512 0xffff, /* dst_mask */ 513 false), /* pcrel_offset */510 TRUE, /* partial_inplace */ 511 0xffff, /* src_mask */ 512 0xffff, /* dst_mask */ 513 FALSE), /* pcrel_offset */ 514 514 515 515 /* Modifiable branch relative. */ … … 518 518 2, /* size (0 = byte, 1 = short, 2 = long) */ 519 519 26, /* bitsize */ 520 false, /* pc_relative */520 FALSE, /* pc_relative */ 521 521 0, /* bitpos */ 522 522 complain_overflow_signed, /* complain_on_overflow */ 523 523 0, /* special_function */ 524 524 "R_REL", /* name */ 525 true, /* partial_inplace */526 0xffff, /* src_mask */ 527 0xffff, /* dst_mask */ 528 false), /* pcrel_offset */525 TRUE, /* partial_inplace */ 526 0xffff, /* src_mask */ 527 0xffff, /* dst_mask */ 528 FALSE), /* pcrel_offset */ 529 529 530 530 /* Modifiable branch absolute. */ … … 533 533 2, /* size (0 = byte, 1 = short, 2 = long) */ 534 534 16, /* bitsize */ 535 false, /* pc_relative */535 FALSE, /* pc_relative */ 536 536 0, /* bitpos */ 537 537 complain_overflow_bitfield, /* complain_on_overflow */ 538 538 0, /* special_function */ 539 539 "R_REL", /* name */ 540 true, /* partial_inplace */541 0xffff, /* src_mask */ 542 0xffff, /* dst_mask */ 543 false) /* pcrel_offset */540 TRUE, /* partial_inplace */ 541 0xffff, /* src_mask */ 542 0xffff, /* dst_mask */ 543 FALSE) /* pcrel_offset */ 544 544 }; 545 545 … … 549 549 /* Read a PowerPC NLM reloc. */ 550 550 551 static b oolean551 static bfd_boolean 552 552 nlm_powerpc_read_reloc (abfd, sym, secp, rel) 553 553 bfd *abfd; … … 564 564 565 565 /* Read the reloc from the file. */ 566 if (bfd_ read (&ext, sizeof ext, 1, abfd) != sizeof ext)567 return false;566 if (bfd_bread (&ext, (bfd_size_type) sizeof ext, abfd) != sizeof ext) 567 return FALSE; 568 568 569 569 /* Swap in the fields. */ 570 l_vaddr = bfd_h_get_32 (abfd, ext.l_vaddr);571 l_symndx = bfd_h_get_32 (abfd, ext.l_symndx);572 l_rtype = bfd_h_get_16 (abfd, ext.l_rtype);573 l_rsecnm = bfd_h_get_16 (abfd, ext.l_rsecnm);570 l_vaddr = H_GET_32 (abfd, ext.l_vaddr); 571 l_symndx = H_GET_32 (abfd, ext.l_symndx); 572 l_rtype = H_GET_16 (abfd, ext.l_rtype); 573 l_rsecnm = H_GET_16 (abfd, ext.l_rsecnm); 574 574 575 575 /* Get the sections now, for convenience. */ … … 598 598 { 599 599 bfd_set_error (bfd_error_bad_value); 600 return false;600 return FALSE; 601 601 } 602 602 … … 628 628 { 629 629 bfd_set_error (bfd_error_bad_value); 630 return false;630 return FALSE; 631 631 } 632 632 633 633 rel->address = l_vaddr; 634 634 635 return true;635 return TRUE; 636 636 } 637 637 … … 640 640 /* Mangle PowerPC NLM relocs for output. */ 641 641 642 static b oolean642 static bfd_boolean 643 643 nlm_powerpc_mangle_relocs (abfd, sec, data, offset, count) 644 644 bfd *abfd ATTRIBUTE_UNUSED; … … 648 648 bfd_size_type count ATTRIBUTE_UNUSED; 649 649 { 650 return true;650 return TRUE; 651 651 } 652 652 653 653 /* Read a PowerPC NLM import record */ 654 654 655 static b oolean655 static bfd_boolean 656 656 nlm_powerpc_read_import (abfd, sym) 657 657 bfd *abfd; … … 664 664 char *name; 665 665 666 if (bfd_ read ((PTR) &symlength, sizeof (symlength), 1, abfd)666 if (bfd_bread ((PTR) &symlength, (bfd_size_type) sizeof (symlength), abfd) 667 667 != sizeof (symlength)) 668 return (false);668 return FALSE; 669 669 sym -> symbol.the_bfd = abfd; 670 name = bfd_alloc (abfd, symlength + 1);670 name = bfd_alloc (abfd, (bfd_size_type) symlength + 1); 671 671 if (name == NULL) 672 return false;673 if (bfd_ read (name, symlength, 1, abfd) != symlength)674 return (false);672 return FALSE; 673 if (bfd_bread (name, (bfd_size_type) symlength, abfd) != symlength) 674 return FALSE; 675 675 name[symlength] = '\0'; 676 676 sym -> symbol.name = name; … … 678 678 sym -> symbol.value = 0; 679 679 sym -> symbol.section = bfd_und_section_ptr; 680 if (bfd_read ((PTR) temp, sizeof (temp), 1, abfd) != sizeof (temp)) 681 return (false); 682 rcount = bfd_h_get_32 (abfd, temp); 680 if (bfd_bread ((PTR) temp, (bfd_size_type) sizeof (temp), abfd) 681 != sizeof (temp)) 682 return FALSE; 683 rcount = H_GET_32 (abfd, temp); 683 684 nlm_relocs = ((struct nlm_relent *) 684 685 bfd_alloc (abfd, rcount * sizeof (struct nlm_relent))); 685 686 if (nlm_relocs == (struct nlm_relent *) NULL) 686 return false;687 return FALSE; 687 688 sym -> relocs = nlm_relocs; 688 689 sym -> rcnt = 0; … … 691 692 asection *section; 692 693 693 if (nlm_powerpc_read_reloc (abfd, sym, §ion, 694 &nlm_relocs -> reloc) 695 == false) 696 return false; 694 if (! nlm_powerpc_read_reloc (abfd, sym, §ion, &nlm_relocs -> reloc)) 695 return FALSE; 697 696 nlm_relocs -> section = section; 698 697 nlm_relocs++; 699 698 sym -> rcnt++; 700 699 } 701 return true;700 return TRUE; 702 701 } 703 702 … … 706 705 /* Write a PowerPC NLM reloc. */ 707 706 708 static b oolean707 static bfd_boolean 709 708 nlm_powerpc_write_import (abfd, sec, rel) 710 709 bfd *abfd; … … 728 727 { 729 728 bfd_set_error (bfd_error_invalid_operation); 730 return false;729 return FALSE; 731 730 } 732 731 … … 741 740 { 742 741 bfd_set_error (bfd_error_bad_value); 743 return false;742 return FALSE; 744 743 } 745 744 val >>= 2; … … 765 764 766 765 bfd_put_32 (abfd, val, temp); 767 if (bfd_ write (temp, sizeof (temp), 1, abfd) != sizeof (temp))768 return false;769 770 return true;766 if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp)) 767 return FALSE; 768 769 return TRUE; 771 770 } 772 771 … … 777 776 /* Write a PowerPC NLM reloc. */ 778 777 779 static b oolean778 static bfd_boolean 780 779 nlm_powerpc_write_reloc (abfd, sec, rel, indx) 781 780 bfd *abfd; … … 817 816 { 818 817 bfd_set_error (bfd_error_bad_value); 819 return false;818 return FALSE; 820 819 } 821 820 } 822 821 823 bfd_h_put_32 (abfd, (bfd_vma)l_symndx, ext.l_symndx);822 H_PUT_32 (abfd, l_symndx, ext.l_symndx); 824 823 825 824 for (howto = nlm_powerpc_howto_table; … … 845 844 { 846 845 bfd_set_error (bfd_error_bad_value); 847 return false;846 return FALSE; 848 847 } 849 848 … … 852 851 l_rtype |= 0x8000; 853 852 l_rtype |= (howto->bitsize - 1) << 8; 854 bfd_h_put_16 (abfd, (bfd_vma)l_rtype, ext.l_rtype);853 H_PUT_16 (abfd, l_rtype, ext.l_rtype); 855 854 856 855 address = rel->address; … … 866 865 { 867 866 bfd_set_error (bfd_error_bad_value); 868 return false;869 } 870 871 bfd_h_put_16 (abfd, (bfd_vma)l_rsecnm, ext.l_rsecnm);872 bfd_h_put_32 (abfd, (bfd_vma)address, ext.l_vaddr);873 874 if (bfd_ write (&ext, sizeof ext, 1, abfd) != sizeof ext)875 return false;876 877 return true;867 return FALSE; 868 } 869 870 H_PUT_16 (abfd, l_rsecnm, ext.l_rsecnm); 871 H_PUT_32 (abfd, address, ext.l_vaddr); 872 873 if (bfd_bwrite (&ext, (bfd_size_type) sizeof ext, abfd) != sizeof ext) 874 return FALSE; 875 876 return TRUE; 878 877 } 879 878 880 879 /* Write a PowerPC NLM import. */ 881 880 882 static b oolean881 static bfd_boolean 883 882 nlm_powerpc_write_import (abfd, sec, rel) 884 883 bfd *abfd; … … 895 894 necessary, and the index never gets reset. */ 896 895 897 static b oolean896 static bfd_boolean 898 897 nlm_powerpc_write_external (abfd, count, sym, relocs) 899 898 bfd *abfd; … … 910 909 911 910 len = strlen (sym->name); 912 if ((bfd_write (&len, sizeof (bfd_byte), 1, abfd) != sizeof (bfd_byte)) 913 || bfd_write (sym->name, len, 1, abfd) != len) 914 return false; 911 if ((bfd_bwrite (&len, (bfd_size_type) sizeof (bfd_byte), abfd) 912 != sizeof (bfd_byte)) 913 || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len) 914 return FALSE; 915 915 916 916 bfd_put_32 (abfd, count, temp); 917 if (bfd_ write (temp, sizeof (temp), 1, abfd) != sizeof (temp))918 return false;917 if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp)) 918 return FALSE; 919 919 920 920 for (i = 0; i < count; i++) … … 922 922 #ifndef OLDFORMAT 923 923 if (! nlm_powerpc_write_import (abfd, relocs[i].sec, relocs[i].rel)) 924 return false;924 return FALSE; 925 925 #else 926 926 if (! nlm_powerpc_write_reloc (abfd, relocs[i].sec, 927 927 relocs[i].rel, indx)) 928 return false;928 return FALSE; 929 929 #endif 930 930 } … … 934 934 #endif 935 935 936 return true;936 return TRUE; 937 937 } 938 938 … … 945 945 /* Set the section for a public symbol. */ 946 946 947 static b oolean947 static bfd_boolean 948 948 nlm_powerpc_set_public_section (abfd, sym) 949 949 bfd *abfd; … … 965 965 sym->symbol.value <<= 2; 966 966 967 return true;967 return TRUE; 968 968 } 969 969 … … 1018 1018 bfd_arch_powerpc, 1019 1019 0, 1020 false,1020 FALSE, 1021 1021 #ifndef OLDFORMAT 1022 1022 0, /* backend_object_p */ -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.