Changeset 609 for branches/GNU/src/binutils/bfd/i386lynx.c
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/bfd/i386lynx.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* BFD back-end for i386 a.out binaries under LynxOS. 2 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996 2 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2001, 2002, 2003 3 3 Free Software Foundation, Inc. 4 4 … … 19 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 20 20 21 #define BYTES_IN_WORD 422 21 #define N_SHARED_LIB(x) 0 23 22 … … 27 26 #define DEFAULT_ARCH bfd_arch_i386 28 27 29 #define MY(OP) CAT(i386lynx_aout_,OP) 28 /* Do not "beautify" the CONCAT* macro args. Traditional C will not 29 remove whitespace added here, and thus will fail to concatenate 30 the tokens. */ 31 #define MY(OP) CONCAT2 (i386lynx_aout_,OP) 30 32 #define TARGETNAME "a.out-i386-lynx" 31 33 … … 51 53 NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes); \ 52 54 \ 53 if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 ) return false;\54 if (bfd_write ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd)\55 != EXEC_BYTES_SIZE)\56 return false; \55 if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 \ 56 || bfd_bwrite ((PTR) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, \ 57 abfd) != EXEC_BYTES_SIZE) \ 58 return FALSE; \ 57 59 /* Now write out reloc info, followed by syms and strings */ \ 58 60 \ 59 61 if (bfd_get_symcount (abfd) != 0) \ 60 62 { \ 61 if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET)\63 if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) \ 62 64 != 0) \ 63 return false; \65 return FALSE; \ 64 66 \ 65 if (! NAME(aout,write_syms) (abfd)) return false; \67 if (! NAME(aout,write_syms) (abfd)) return FALSE; \ 66 68 \ 67 if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET)\69 if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) \ 68 70 != 0) \ 69 return false; \71 return FALSE; \ 70 72 \ 71 73 if (!NAME(lynx,squirt_out_relocs) (abfd, obj_textsec (abfd))) \ 72 return false; \73 if (bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET)\74 return FALSE; \ 75 if (bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) \ 74 76 != 0) \ 75 77 return 0; \ 76 78 \ 77 if (!NAME(lynx,squirt_out_relocs) (abfd, obj_datasec (abfd)))\78 return false; \79 if (!NAME(lynx,squirt_out_relocs) (abfd, obj_datasec (abfd))) \ 80 return FALSE; \ 79 81 } \ 80 82 } … … 84 86 #include "aout/aout64.h" 85 87 88 void NAME (lynx,swap_std_reloc_out) 89 PARAMS ((bfd *, arelent *, struct reloc_std_external *)); 90 void NAME (lynx,swap_ext_reloc_out) 91 PARAMS ((bfd *, arelent *, struct reloc_ext_external *)); 92 void NAME (lynx,swap_ext_reloc_in) 93 PARAMS ((bfd *, struct reloc_ext_external *, arelent *, asymbol **, 94 bfd_size_type)); 95 void NAME (lynx,swap_std_reloc_in) 96 PARAMS ((bfd *, struct reloc_std_external *, arelent *, asymbol **, 97 bfd_size_type)); 98 bfd_boolean NAME (lynx,slurp_reloc_table) 99 PARAMS ((bfd *, sec_ptr, asymbol **)); 100 bfd_boolean NAME (lynx,squirt_out_relocs) 101 PARAMS ((bfd *, asection *)); 102 long NAME (lynx,canonicalize_reloc) 103 PARAMS ((bfd *, sec_ptr, arelent **, asymbol **)); 104 86 105 #ifdef LYNX_CORE 87 106 88 107 char *lynx_core_file_failing_command (); 89 108 int lynx_core_file_failing_signal (); 90 b oolean lynx_core_file_matches_executable_p ();109 bfd_boolean lynx_core_file_matches_executable_p (); 91 110 const bfd_target *lynx_core_file_p (); 92 111 … … 142 161 from the abs section, or as a symbol which has an abs value. 143 162 check for that here 144 163 */ 145 164 146 165 … … 152 171 { 153 172 /* Whoops, looked like an abs symbol, but is really an offset 154 from the abs section */173 from the abs section */ 155 174 r_index = 0; 156 175 r_extern = 0; … … 360 379 struct aoutdata *su = &(abfd->tdata.aout_data->a); 361 380 362 cache_ptr->address = bfd_h_get_32 (abfd, bytes->r_address);381 cache_ptr->address = H_GET_32 (abfd, bytes->r_address); 363 382 364 383 r_index = bytes->r_index[1]; … … 379 398 /* Reloc hackery */ 380 399 381 b oolean400 bfd_boolean 382 401 NAME(lynx,slurp_reloc_table) (abfd, asect, symbols) 383 402 bfd *abfd; … … 385 404 asymbol **symbols; 386 405 { 387 unsigned intcount;406 bfd_size_type count; 388 407 bfd_size_type reloc_size; 389 408 PTR relocs; … … 392 411 393 412 if (asect->relocation) 394 return true;413 return TRUE; 395 414 396 415 if (asect->flags & SEC_CONSTRUCTOR) 397 return true;416 return TRUE; 398 417 399 418 if (asect == obj_datasec (abfd)) … … 410 429 411 430 bfd_set_error (bfd_error_invalid_operation); 412 return false;431 return FALSE; 413 432 414 433 doit: 415 434 if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0) 416 return false;435 return FALSE; 417 436 each_size = obj_reloc_entry_size (abfd); 418 437 … … 420 439 421 440 422 reloc_cache = (arelent *) bfd_ malloc (count * sizeof (arelent));441 reloc_cache = (arelent *) bfd_zmalloc (count * sizeof (arelent)); 423 442 if (!reloc_cache && count != 0) 424 return false; 425 memset (reloc_cache, 0, count * sizeof (arelent)); 443 return FALSE; 426 444 427 445 relocs = (PTR) bfd_alloc (abfd, reloc_size); … … 429 447 { 430 448 free (reloc_cache); 431 return false;432 } 433 434 if (bfd_ read (relocs, 1, reloc_size, abfd) != reloc_size)449 return FALSE; 450 } 451 452 if (bfd_bread (relocs, reloc_size, abfd) != reloc_size) 435 453 { 436 454 bfd_release (abfd, relocs); 437 455 free (reloc_cache); 438 return false;456 return FALSE; 439 457 } 440 458 … … 448 466 { 449 467 NAME(lynx,swap_ext_reloc_in) (abfd, rptr, cache_ptr, symbols, 450 bfd_get_symcount (abfd));468 (bfd_size_type) bfd_get_symcount (abfd)); 451 469 } 452 470 } … … 460 478 { 461 479 NAME(lynx,swap_std_reloc_in) (abfd, rptr, cache_ptr, symbols, 462 bfd_get_symcount (abfd));480 (bfd_size_type) bfd_get_symcount (abfd)); 463 481 } 464 482 … … 468 486 asect->relocation = reloc_cache; 469 487 asect->reloc_count = count; 470 return true;488 return TRUE; 471 489 } 472 490 … … 475 493 /* Write out a relocation section into an object file. */ 476 494 477 b oolean495 bfd_boolean 478 496 NAME(lynx,squirt_out_relocs) (abfd, section) 479 497 bfd *abfd; … … 485 503 486 504 unsigned int count = section->reloc_count; 487 size_tnatsize;505 bfd_size_type natsize; 488 506 489 507 if (count == 0) 490 return true;508 return TRUE; 491 509 492 510 each_size = obj_reloc_entry_size (abfd); 493 natsize = each_size * count; 511 natsize = count; 512 natsize *= each_size; 494 513 native = (unsigned char *) bfd_zalloc (abfd, natsize); 495 514 if (!native) 496 return false;515 return FALSE; 497 516 498 517 generic = section->orelocation; … … 513 532 } 514 533 515 if (bfd_ write ((PTR) native, 1, natsize, abfd) != natsize)534 if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize) 516 535 { 517 536 bfd_release (abfd, native); 518 return false;537 return FALSE; 519 538 } 520 539 bfd_release (abfd, native); 521 540 522 return true;541 return TRUE; 523 542 } 524 543 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.