Changeset 609 for branches/GNU/src/binutils/bfd/nlm32-i386.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-i386.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* Support for 32-bit i386 NLM (NetWare Loadable Module) 2 Copyright 1993, 1994, 2000 Free Software Foundation, Inc.2 Copyright 1993, 1994, 2000, 2001, 2002 Free Software Foundation, Inc. 3 3 4 4 This file is part of BFD, the Binary File Descriptor library. … … 29 29 #include "libnlm.h" 30 30 31 static b oolean nlm_i386_read_reloc31 static bfd_boolean nlm_i386_read_reloc 32 32 PARAMS ((bfd *, nlmNAME(symbol_type) *, asection **, arelent *)); 33 static b oolean nlm_i386_write_import33 static bfd_boolean nlm_i386_write_import 34 34 PARAMS ((bfd *, asection *, arelent *)); 35 static b oolean nlm_i386_mangle_relocs35 static bfd_boolean nlm_i386_mangle_relocs 36 36 PARAMS ((bfd *, asection *, PTR, bfd_vma, bfd_size_type)); 37 static b oolean nlm_i386_read_import37 static bfd_boolean nlm_i386_read_import 38 38 PARAMS ((bfd *, nlmNAME(symbol_type) *)); 39 static b oolean nlm_i386_write_external39 static bfd_boolean nlm_i386_write_external 40 40 PARAMS ((bfd *, bfd_size_type, asymbol *, struct reloc_and_sec *)); 41 41 … … 47 47 2, /* size (0 = byte, 1 = short, 2 = long) */ 48 48 32, /* bitsize */ 49 false, /* pc_relative */49 FALSE, /* pc_relative */ 50 50 0, /* bitpos */ 51 51 complain_overflow_bitfield, /* complain_on_overflow */ 52 52 0, /* special_function */ 53 53 "32", /* name */ 54 true, /* partial_inplace */54 TRUE, /* partial_inplace */ 55 55 0xffffffff, /* src_mask */ 56 56 0xffffffff, /* dst_mask */ 57 false); /* pcrel_offset */57 FALSE); /* pcrel_offset */ 58 58 59 59 /* Adjust the reloc location by a PC relative displacement. */ … … 64 64 2, /* size (0 = byte, 1 = short, 2 = long) */ 65 65 32, /* bitsize */ 66 true, /* pc_relative */66 TRUE, /* pc_relative */ 67 67 0, /* bitpos */ 68 68 complain_overflow_signed, /* complain_on_overflow */ 69 69 0, /* special_function */ 70 70 "DISP32", /* name */ 71 true, /* partial_inplace */71 TRUE, /* partial_inplace */ 72 72 0xffffffff, /* src_mask */ 73 73 0xffffffff, /* dst_mask */ 74 true); /* pcrel_offset */74 TRUE); /* pcrel_offset */ 75 75 76 76 /* Read a NetWare i386 reloc. */ 77 77 78 static b oolean78 static bfd_boolean 79 79 nlm_i386_read_reloc (abfd, sym, secp, rel) 80 80 bfd *abfd; … … 87 87 const char *name; 88 88 89 if (bfd_ read (temp, sizeof (temp), 1, abfd) != sizeof (temp))90 return false;89 if (bfd_bread (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp)) 90 return FALSE; 91 91 92 92 val = bfd_get_32 (abfd, temp); … … 146 146 rel->addend = 0; 147 147 148 return true;148 return TRUE; 149 149 } 150 150 151 151 /* Write a NetWare i386 reloc. */ 152 152 153 static b oolean153 static bfd_boolean 154 154 nlm_i386_write_import (abfd, sec, rel) 155 155 bfd *abfd; … … 175 175 { 176 176 bfd_set_error (bfd_error_invalid_operation); 177 return false;177 return FALSE; 178 178 } 179 179 … … 203 203 { 204 204 bfd_set_error (bfd_error_invalid_operation); 205 return false;205 return FALSE; 206 206 } 207 207 … … 223 223 { 224 224 bfd_set_error (bfd_error_invalid_operation); 225 return false;225 return FALSE; 226 226 } 227 227 } … … 229 229 230 230 bfd_put_32 (abfd, val, temp); 231 if (bfd_ write (temp, sizeof (temp), 1, abfd) != sizeof (temp))232 return false;233 234 return true;231 if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp)) 232 return FALSE; 233 234 return TRUE; 235 235 } 236 236 237 /* I want to be able to use objcopy to turn a i386 a.out or COFF file237 /* I want to be able to use objcopy to turn an i386 a.out or COFF file 238 238 into a NetWare i386 module. That means that the relocs from the 239 239 source file have to be mapped into relocs that apply to the target … … 244 244 general implementation. */ 245 245 246 static b oolean246 static bfd_boolean 247 247 nlm_i386_mangle_relocs (abfd, sec, data, offset, count) 248 248 bfd *abfd; … … 336 336 } 337 337 338 return true;338 return TRUE; 339 339 } 340 340 341 341 /* Read a NetWare i386 import record */ 342 static b oolean342 static bfd_boolean 343 343 nlm_i386_read_import (abfd, sym) 344 344 bfd *abfd; … … 351 351 char *name; 352 352 353 if (bfd_ read ((PTR) &symlength, sizeof (symlength), 1, abfd)353 if (bfd_bread ((PTR) &symlength, (bfd_size_type) sizeof (symlength), abfd) 354 354 != sizeof (symlength)) 355 return false;355 return FALSE; 356 356 sym -> symbol.the_bfd = abfd; 357 name = bfd_alloc (abfd, symlength + 1);357 name = bfd_alloc (abfd, (bfd_size_type) symlength + 1); 358 358 if (name == NULL) 359 return false;360 if (bfd_ read (name, symlength, 1, abfd) != symlength)361 return false;359 return FALSE; 360 if (bfd_bread (name, (bfd_size_type) symlength, abfd) != symlength) 361 return FALSE; 362 362 name[symlength] = '\0'; 363 363 sym -> symbol.name = name; … … 365 365 sym -> symbol.value = 0; 366 366 sym -> symbol.section = bfd_und_section_ptr; 367 if (bfd_read ((PTR) temp, sizeof (temp), 1, abfd) != sizeof (temp)) 368 return false; 369 rcount = bfd_h_get_32 (abfd, temp); 367 if (bfd_bread ((PTR) temp, (bfd_size_type) sizeof (temp), abfd) 368 != sizeof (temp)) 369 return FALSE; 370 rcount = H_GET_32 (abfd, temp); 370 371 nlm_relocs = ((struct nlm_relent *) 371 372 bfd_alloc (abfd, rcount * sizeof (struct nlm_relent))); 372 373 if (!nlm_relocs) 373 return false;374 return FALSE; 374 375 sym -> relocs = nlm_relocs; 375 376 sym -> rcnt = 0; … … 378 379 asection *section; 379 380 380 if (nlm_i386_read_reloc (abfd, sym, §ion, 381 &nlm_relocs -> reloc) 382 == false) 383 return false; 381 if (! nlm_i386_read_reloc (abfd, sym, §ion, &nlm_relocs -> reloc)) 382 return FALSE; 384 383 nlm_relocs -> section = section; 385 384 nlm_relocs++; 386 385 sym -> rcnt++; 387 386 } 388 return true;387 return TRUE; 389 388 } 390 389 391 390 /* Write out an external reference. */ 392 391 393 static b oolean392 static bfd_boolean 394 393 nlm_i386_write_external (abfd, count, sym, relocs) 395 394 bfd *abfd; … … 403 402 404 403 len = strlen (sym->name); 405 if ((bfd_write (&len, sizeof (bfd_byte), 1, abfd) != sizeof (bfd_byte)) 406 || bfd_write (sym->name, len, 1, abfd) != len) 407 return false; 404 if ((bfd_bwrite (&len, (bfd_size_type) sizeof (bfd_byte), abfd) 405 != sizeof (bfd_byte)) 406 || bfd_bwrite (sym->name, (bfd_size_type) len, abfd) != len) 407 return FALSE; 408 408 409 409 bfd_put_32 (abfd, count, temp); 410 if (bfd_ write (temp, sizeof (temp), 1, abfd) != sizeof (temp))411 return false;410 if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), abfd) != sizeof (temp)) 411 return FALSE; 412 412 413 413 for (i = 0; i < count; i++) 414 414 { 415 if (nlm_i386_write_import (abfd, relocs[i].sec, 416 relocs[i].rel) == false) 417 return false; 418 } 419 420 return true; 415 if (! nlm_i386_write_import (abfd, relocs[i].sec, relocs[i].rel)) 416 return FALSE; 417 } 418 419 return TRUE; 421 420 } 422 421 … … 430 429 bfd_arch_i386, 431 430 0, 432 false,431 FALSE, 433 432 0, /* backend_object_p */ 434 433 0, /* write_prefix_func */ -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.