goto xcoff64_core_p_error;
if (sizeof (struct core_dumpxx)
- != bfd_bread (&core, sizeof (struct core_dumpxx), abfd))
+ != bfd_read (&core, sizeof (struct core_dumpxx), abfd))
goto xcoff64_core_p_error;
if (bfd_stat (abfd, &statbuf) < 0)
return NULL;
if (sizeof (struct __ld_info64) !=
- bfd_bread (&ldinfo, sizeof (struct __ld_info64), abfd))
+ bfd_read (&ldinfo, sizeof (struct __ld_info64), abfd))
return NULL;
if (ldinfo.ldinfo_core)
for (i = 0; i < core.c_vmregions; i++)
if (sizeof (struct vm_infox) !=
- bfd_bread (&vminfo, sizeof (struct vm_infox), abfd))
+ bfd_read (&vminfo, sizeof (struct vm_infox), abfd))
return NULL;
if (vminfo.vminfo_offset)
return return_value;
if (sizeof (struct core_dumpxx) !=
- bfd_bread (&core, sizeof (struct core_dumpxx), core_bfd))
+ bfd_read (&core, sizeof (struct core_dumpxx), core_bfd))
return return_value;
if (bfd_seek (core_bfd, core.c_loader, SEEK_SET) != 0)
while (1)
{
- if (bfd_bread (s, 1, core_bfd) != 1)
+ if (bfd_read (s, 1, core_bfd) != 1)
goto xcoff64_core_file_matches_executable_p_end_1;
if (*s == '\0')
bfd_cleanup cleanup;
size_t amt = EXEC_BYTES_SIZE;
- if (bfd_bread ((void *) &exec_bytes, amt, abfd) != amt)
+ if (bfd_read (&exec_bytes, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
if (count != 0)
{
if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
- || bfd_bwrite (location, count, abfd) != count)
+ || bfd_write (location, count, abfd) != count)
return false;
}
/* Get the size of the strings. */
if (bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET) != 0
- || bfd_bread ((void *) string_chars, amt, abfd) != amt)
+ || bfd_read (string_chars, amt, abfd) != amt)
return false;
stringsize = GET_WORD (abfd, string_chars);
if (stringsize == 0)
if (stringsize >= BYTES_IN_WORD)
{
amt = stringsize - BYTES_IN_WORD;
- if (bfd_bread (strings + BYTES_IN_WORD, amt, abfd) != amt)
+ if (bfd_read (strings + BYTES_IN_WORD, amt, abfd) != amt)
{
free (strings);
return false;
/* The string table starts with the size. */
PUT_WORD (abfd, _bfd_stringtab_size (tab) + BYTES_IN_WORD, buffer);
- if (bfd_bwrite ((void *) buffer, amt, abfd) != amt)
+ if (bfd_write (buffer, amt, abfd) != amt)
return false;
return _bfd_stringtab_emit (abfd, tab);
goto error_return;
amt = EXTERNAL_NLIST_SIZE;
- if (bfd_bwrite ((void *) &nsp, amt, abfd) != amt)
+ if (bfd_write (&nsp, amt, abfd) != amt)
goto error_return;
/* NB: `KEEPIT' currently overlays `udata.p', so set this only
}
}
- if (bfd_bwrite ((void *) native, natsize, abfd) != natsize)
+ if (bfd_write (native, natsize, abfd) != natsize)
{
bfd_release (abfd, native);
return false;
amt = EXTERNAL_NLIST_SIZE;
if (bfd_seek (output_bfd, flaginfo->symoff, SEEK_SET) != 0
- || bfd_bwrite ((void *) &outsym, amt, output_bfd) != amt)
+ || bfd_write (&outsym, amt, output_bfd) != amt)
/* FIXME: No way to handle errors. */
abort ();
amt = obj_reloc_entry_size (flaginfo->output_bfd);
if (bfd_seek (flaginfo->output_bfd, *reloff_ptr, SEEK_SET) != 0
- || bfd_bwrite (rel_ptr, amt, flaginfo->output_bfd) != amt)
+ || bfd_write (rel_ptr, amt, flaginfo->output_bfd) != amt)
return false;
*reloff_ptr += obj_reloc_entry_size (flaginfo->output_bfd);
if (rel_size > 0)
{
if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0
- || bfd_bread (relocs, rel_size, input_bfd) != rel_size)
+ || bfd_read (relocs, rel_size, input_bfd) != rel_size)
return false;
}
}
{
if (bfd_seek (flaginfo->output_bfd, *reloff_ptr, SEEK_SET) != 0)
return false;
- if (bfd_bwrite (relocs, rel_size, flaginfo->output_bfd) != rel_size)
+ if (bfd_write (relocs, rel_size, flaginfo->output_bfd) != rel_size)
return false;
*reloff_ptr += rel_size;
return false;
outsym_size = outsym - flaginfo->output_syms;
outsym_size *= EXTERNAL_NLIST_SIZE;
- if (bfd_bwrite ((void *) flaginfo->output_syms, outsym_size, output_bfd)
+ if (bfd_write (flaginfo->output_syms, outsym_size, output_bfd)
!= outsym_size)
return false;
flaginfo->symoff += outsym_size;
bfd_byte b[BYTES_IN_WORD];
memset (b, 0, BYTES_IN_WORD);
- if (bfd_bwrite (b, (bfd_size_type) BYTES_IN_WORD, abfd) != BYTES_IN_WORD)
+ if (bfd_write (b, BYTES_IN_WORD, abfd) != BYTES_IN_WORD)
goto error_return;
}
char fmag_save;
int scan;
- if (bfd_bread (hdrp, sizeof (struct ar_hdr), abfd) != sizeof (struct ar_hdr))
+ if (bfd_read (hdrp, sizeof (struct ar_hdr), abfd) != sizeof (struct ar_hdr))
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_no_more_archived_files);
filename = (allocptr
+ sizeof (struct areltdata)
+ sizeof (struct ar_hdr));
- if (bfd_bread (filename, namelen, abfd) != namelen)
+ if (bfd_read (filename, namelen, abfd) != namelen)
{
free (allocptr);
if (bfd_get_error () != bfd_error_system_call)
char armag[SARMAG + 1];
size_t amt;
- if (bfd_bread (armag, SARMAG, abfd) != SARMAG)
+ if (bfd_read (armag, SARMAG, abfd) != SARMAG)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
parsed_size = mapdata->parsed_size;
free (mapdata);
- if (bfd_bread (int_buf, 4, abfd) != 4)
+ if (bfd_read (int_buf, 4, abfd) != 4)
return false;
/* It seems that all numeric information in a coff archive is always
carsyms = ardata->symdefs;
stringbase = ((char *) ardata->symdefs) + carsym_size;
- if (bfd_bread (stringbase, stringsize, abfd) != stringsize)
+ if (bfd_read (stringbase, stringsize, abfd) != stringsize)
goto release_symdefs;
/* OK, build the carsyms. */
bfd_slurp_armap (bfd *abfd)
{
char nextname[17];
- int i = bfd_bread (nextname, 16, abfd);
+ int i = bfd_read (nextname, 16, abfd);
if (i == 0)
return true;
if (i != 16)
return false;
- if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
+ if (bfd_seek (abfd, -16, SEEK_CUR) != 0)
return false;
if (startswith (nextname, "__.SYMDEF ")
struct ar_hdr hdr;
char extname[21];
- if (bfd_bread (&hdr, sizeof (hdr), abfd) != sizeof (hdr))
+ if (bfd_read (&hdr, sizeof (hdr), abfd) != sizeof (hdr))
return false;
/* Read the extended name. We know its length. */
- if (bfd_bread (extname, 20, abfd) != 20)
+ if (bfd_read (extname, 20, abfd) != 20)
return false;
if (bfd_seek (abfd, -(file_ptr) (sizeof (hdr) + 20), SEEK_CUR) != 0)
return false;
if (bfd_seek (abfd, bfd_ardata (abfd)->first_file_filepos, SEEK_SET) != 0)
return false;
- if (bfd_bread (nextname, 16, abfd) == 16)
+ if (bfd_read (nextname, 16, abfd) == 16)
{
struct areltdata *namedata;
bfd_size_type amt;
ufile_ptr filesize;
- if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
+ if (bfd_seek (abfd, -16, SEEK_CUR) != 0)
return false;
if (! startswith (nextname, "ARFILENAMES/ ")
return false;
}
- if (bfd_bread (bfd_ardata (abfd)->extended_names, amt, abfd) != amt)
+ if (bfd_read (bfd_ardata (abfd)->extended_names, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
{
struct ar_hdr *hdr = arch_hdr (abfd);
- if (bfd_bwrite (hdr, sizeof (*hdr), archive) != sizeof (*hdr))
+ if (bfd_write (hdr, sizeof (*hdr), archive) != sizeof (*hdr))
return false;
return true;
}
arch_eltdata (abfd)->parsed_size + padded_len))
return false;
- if (bfd_bwrite (hdr, sizeof (*hdr), archive) != sizeof (*hdr))
+ if (bfd_write (hdr, sizeof (*hdr), archive) != sizeof (*hdr))
return false;
- if (bfd_bwrite (fullname, len, archive) != len)
+ if (bfd_write (fullname, len, archive) != len)
return false;
if (len & 3)
static const char pad[3] = { 0, 0, 0 };
len = 4 - (len & 3);
- if (bfd_bwrite (pad, len, archive) != len)
+ if (bfd_write (pad, len, archive) != len)
return false;
}
}
else
{
- if (bfd_bwrite (hdr, sizeof (*hdr), archive) != sizeof (*hdr))
+ if (bfd_write (hdr, sizeof (*hdr), archive) != sizeof (*hdr))
return false;
}
return true;
(arch, &etable, &elength, &ename)))
return false;
- if (bfd_seek (arch, (file_ptr) 0, SEEK_SET) != 0)
+ if (bfd_seek (arch, 0, SEEK_SET) != 0)
return false;
armag = ARMAG;
if (bfd_is_thin_archive (arch))
armag = ARMAGT;
- wrote = bfd_bwrite (armag, SARMAG, arch);
+ wrote = bfd_write (armag, SARMAG, arch);
if (wrote != SARMAG)
return false;
(elength + 1) & ~(bfd_size_type) 1))
return false;
memcpy (hdr.ar_fmag, ARFMAG, 2);
- if ((bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
+ if ((bfd_write (&hdr, sizeof (struct ar_hdr), arch)
!= sizeof (struct ar_hdr))
- || bfd_bwrite (etable, elength, arch) != elength)
+ || bfd_write (etable, elength, arch) != elength)
return false;
if ((elength % 2) == 1)
{
- if (bfd_bwrite (&ARFMAG[1], 1, arch) != 1)
+ if (bfd_write (&ARFMAG[1], 1, arch) != 1)
return false;
}
}
goto input_err;
if (bfd_is_thin_archive (arch))
continue;
- if (bfd_seek (current, (file_ptr) 0, SEEK_SET) != 0)
+ if (bfd_seek (current, 0, SEEK_SET) != 0)
goto input_err;
while (remaining)
if (amt > remaining)
amt = remaining;
errno = 0;
- if (bfd_bread (buffer, amt, current) != amt)
+ if (bfd_read (buffer, amt, current) != amt)
goto input_err;
- if (bfd_bwrite (buffer, amt, arch) != amt)
+ if (bfd_write (buffer, amt, arch) != amt)
goto input_err;
remaining -= amt;
}
if ((arelt_size (current) % 2) == 1)
{
- if (bfd_bwrite (&ARFMAG[1], 1, arch) != 1)
+ if (bfd_write (&ARFMAG[1], 1, arch) != 1)
goto input_err;
}
}
if (!_bfd_ar_sizepad (hdr.ar_size, sizeof (hdr.ar_size), mapsize))
return false;
memcpy (hdr.ar_fmag, ARFMAG, 2);
- if (bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
+ if (bfd_write (&hdr, sizeof (struct ar_hdr), arch)
!= sizeof (struct ar_hdr))
return false;
H_PUT_32 (arch, ranlibsize, temp);
- if (bfd_bwrite (temp, sizeof (temp), arch) != sizeof (temp))
+ if (bfd_write (temp, sizeof (temp), arch) != sizeof (temp))
return false;
firstreal = first;
last_elt = current;
H_PUT_32 (arch, map[count].namidx, buf);
H_PUT_32 (arch, firstreal, buf + BSD_SYMDEF_OFFSET_SIZE);
- if (bfd_bwrite (buf, BSD_SYMDEF_SIZE, arch)
+ if (bfd_write (buf, BSD_SYMDEF_SIZE, arch)
!= BSD_SYMDEF_SIZE)
return false;
}
/* Now write the strings themselves. */
H_PUT_32 (arch, stringsize, temp);
- if (bfd_bwrite (temp, sizeof (temp), arch) != sizeof (temp))
+ if (bfd_write (temp, sizeof (temp), arch) != sizeof (temp))
return false;
for (count = 0; count < orl_count; count++)
{
size_t len = strlen (*map[count].name) + 1;
- if (bfd_bwrite (*map[count].name, len, arch) != len)
+ if (bfd_write (*map[count].name, len, arch) != len)
return false;
}
bug-compatible for sun's ar we use a null. */
if (padit)
{
- if (bfd_bwrite ("", 1, arch) != 1)
+ if (bfd_write ("", 1, arch) != 1)
return false;
}
bfd_ardata (arch)->armap_datepos = (SARMAG
+ offsetof (struct ar_hdr, ar_date[0]));
if (bfd_seek (arch, bfd_ardata (arch)->armap_datepos, SEEK_SET) != 0
- || (bfd_bwrite (hdr.ar_date, sizeof (hdr.ar_date), arch)
+ || (bfd_write (hdr.ar_date, sizeof (hdr.ar_date), arch)
!= sizeof (hdr.ar_date)))
{
bfd_perror (_("Writing updated armap timestamp"));
memcpy (hdr.ar_fmag, ARFMAG, 2);
/* Write the ar header for this item and the number of symbols. */
- if (bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
+ if (bfd_write (&hdr, sizeof (struct ar_hdr), arch)
!= sizeof (struct ar_hdr))
return false;
{
size_t len = strlen (*map[count].name) + 1;
- if (bfd_bwrite (*map[count].name, len, arch) != len)
+ if (bfd_write (*map[count].name, len, arch) != len)
return false;
}
bug-compatible for arc960 we use a null. */
if (padit)
{
- if (bfd_bwrite ("", 1, arch) != 1)
+ if (bfd_write ("", 1, arch) != 1)
return false;
}
ardata->symdefs = NULL;
/* Get the name of the first element. */
- i = bfd_bread (nextname, 16, abfd);
+ i = bfd_read (nextname, 16, abfd);
if (i == 0)
return true;
if (i != 16)
return false;
- if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) != 0)
+ if (bfd_seek (abfd, -16, SEEK_CUR) != 0)
return false;
/* Archives with traditional armaps are still permitted. */
return false;
}
- if (bfd_bread (int_buf, 8, abfd) != 8)
+ if (bfd_read (int_buf, 8, abfd) != 8)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
raw_armap = (bfd_byte *) _bfd_alloc_and_read (abfd, ptrsize, ptrsize);
if (raw_armap == NULL
- || bfd_bread (stringbase, stringsize, abfd) != stringsize)
+ || bfd_read (stringbase, stringsize, abfd) != stringsize)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
/* Write the ar header for this item and the number of symbols */
- if (bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
+ if (bfd_write (&hdr, sizeof (struct ar_hdr), arch)
!= sizeof (struct ar_hdr))
return false;
bfd_putb64 ((bfd_vma) symbol_count, buf);
- if (bfd_bwrite (buf, 8, arch) != 8)
+ if (bfd_write (buf, 8, arch) != 8)
return false;
/* Two passes, first write the file offsets for each symbol -
count++)
{
bfd_putb64 ((bfd_vma) archive_member_file_ptr, buf);
- if (bfd_bwrite (buf, 8, arch) != 8)
+ if (bfd_write (buf, 8, arch) != 8)
return false;
}
{
size_t len = strlen (*map[count].name) + 1;
- if (bfd_bwrite (*map[count].name, len, arch) != len)
+ if (bfd_write (*map[count].name, len, arch) != len)
return false;
}
However, the Irix 6.2 tools do not appear to do this. */
while (padding != 0)
{
- if (bfd_bwrite ("", 1, arch) != 1)
+ if (bfd_write ("", 1, arch) != 1)
return false;
--padding;
}
char *bfd_demangle (bfd *, const char *, int);
/* Extracted from bfdio.c. */
-bfd_size_type bfd_bread (void *, bfd_size_type, bfd *);
+bfd_size_type bfd_read (void *, bfd_size_type, bfd *);
-bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *);
+bfd_size_type bfd_write (const void *, bfd_size_type, bfd *);
file_ptr bfd_tell (bfd *);
/*
FUNCTION
- bfd_bread
+ bfd_read
SYNOPSIS
- bfd_size_type bfd_bread (void *, bfd_size_type, bfd *);
+ bfd_size_type bfd_read (void *, bfd_size_type, bfd *);
DESCRIPTION
Attempt to read SIZE bytes from ABFD's iostream to PTR.
*/
bfd_size_type
-bfd_bread (void *ptr, bfd_size_type size, bfd *abfd)
+bfd_read (void *ptr, bfd_size_type size, bfd *abfd)
{
file_ptr nread;
bfd *element_bfd = abfd;
/*
FUNCTION
- bfd_bwrite
+ bfd_write
SYNOPSIS
- bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *);
+ bfd_size_type bfd_write (const void *, bfd_size_type, bfd *);
DESCRIPTION
Attempt to write SIZE bytes to ABFD's iostream from PTR.
*/
bfd_size_type
-bfd_bwrite (const void *ptr, bfd_size_type size, bfd *abfd)
+bfd_write (const void *ptr, bfd_size_type size, bfd *abfd)
{
file_ptr nwrote;
i->refcount = 1;
if (bfd_seek (abfd, offset, SEEK_SET) != 0)
goto free_and_fail;
- i->size = bfd_bread (i->data, size, abfd);
+ i->size = bfd_read (i->data, size, abfd);
if (i->size != size)
goto free_and_fail;
i->mapped = 0;
bfd_size_type count)
{
if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
- || bfd_bread (location, count, abfd) != count)
+ || bfd_read (location, count, abfd) != count)
return false;
return true;
}
size_t amt;
flagword flags;
- if (bfd_seek (abfd, (file_ptr) crash_info_loc, SEEK_SET) != 0)
+ if (bfd_seek (abfd, crash_info_loc, SEEK_SET) != 0)
return NULL;
- nread = bfd_bread (buf, (bfd_size_type) 4, abfd);
+ nread = bfd_read (buf, 4, abfd);
if (nread != 4)
{
if (bfd_get_error () != bfd_error_system_call)
}
crashinfo_offset = MASK_ADDR (bfd_get_32 (abfd, buf));
- if (bfd_seek (abfd, (file_ptr) crashinfo_offset, SEEK_SET) != 0)
+ if (bfd_seek (abfd, crashinfo_offset, SEEK_SET) != 0)
{
/* Most likely we failed because of a bogus (huge) offset */
bfd_set_error (bfd_error_wrong_format);
return NULL;
}
- nread = bfd_bread (&crashinfo, (bfd_size_type) sizeof (crashinfo), abfd);
+ nread = bfd_read (&crashinfo, sizeof (crashinfo), abfd);
if (nread != sizeof (crashinfo))
{
if (bfd_get_error () != bfd_error_system_call)
/* This is a compressed file. We must set the size correctly.
The size is the eight bytes after the dummy file header. */
- if (bfd_seek (abfd, (file_ptr) FILHSZ, SEEK_CUR) != 0
- || bfd_bread (ab, (bfd_size_type) 8, abfd) != 8
- || bfd_seek (abfd, (file_ptr) (- (FILHSZ + 8)), SEEK_CUR) != 0)
+ if (bfd_seek (abfd, FILHSZ, SEEK_CUR) != 0
+ || bfd_read (ab, 8, abfd) != 8
+ || bfd_seek (abfd, -(FILHSZ + 8), SEEK_CUR) != 0)
{
free (ret);
return NULL;
return nbfd;
/* We must uncompress this element. We do this by copying it into a
- memory buffer, and making bfd_bread and bfd_seek use that buffer.
+ memory buffer, and making bfd_read and bfd_seek use that buffer.
This can use a lot of memory, but it's simpler than getting a
temporary file, making that work with the file descriptor caching
code, and making sure that it is deleted at all appropriate
times. It can be changed if it ever becomes important. */
/* The compressed file starts with a dummy ECOFF file header. */
- if (bfd_seek (nbfd, (file_ptr) FILHSZ, SEEK_SET) != 0)
+ if (bfd_seek (nbfd, FILHSZ, SEEK_SET) != 0)
goto error_return;
/* The next eight bytes are the real file size. */
- if (bfd_bread (ab, (bfd_size_type) 8, nbfd) != 8)
+ if (bfd_read (ab, 8, nbfd) != 8)
goto error_return;
size = H_GET_64 (nbfd, ab);
left = size;
/* I don't know what the next eight bytes are for. */
- if (bfd_bread (ab, (bfd_size_type) 8, nbfd) != 8)
+ if (bfd_read (ab, 8, nbfd) != 8)
goto error_return;
/* This is the uncompression algorithm. It's a simple
next eight bytes in the output stream. */
memset (dict, 0, sizeof dict);
h = 0;
- while (bfd_bread (&b, (bfd_size_type) 1, nbfd) == 1)
+ while (bfd_read (&b, 1, nbfd) == 1)
{
unsigned int i;
n = dict[h];
else
{
- if (bfd_bread (&n, 1, nbfd) != 1)
+ if (bfd_read (&n, 1, nbfd) != 1)
goto error_return;
dict[h] = n;
}
struct external_PEI_IMAGE_hdr image_hdr;
file_ptr offset;
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || (bfd_bread (&dos_hdr, (bfd_size_type) sizeof (dos_hdr), abfd)
- != sizeof (dos_hdr)))
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0
+ || (bfd_read (&dos_hdr, sizeof (dos_hdr), abfd) != sizeof (dos_hdr)))
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
offset = H_GET_32 (abfd, dos_hdr.e_lfanew);
if (bfd_seek (abfd, offset, SEEK_SET) != 0
- || (bfd_bread (&image_hdr, (bfd_size_type) sizeof (image_hdr), abfd)
+ || (bfd_read (&image_hdr, sizeof (image_hdr), abfd)
!= sizeof (image_hdr)))
{
if (bfd_get_error () != bfd_error_system_call)
return false;
/* The symbol table starts with a normal archive header. */
- if (bfd_bread (&hdr, (bfd_size_type) SIZEOF_AR_HDR, abfd)
- != SIZEOF_AR_HDR)
+ if (bfd_read (&hdr, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR)
return false;
/* Skip the name (normally empty). */
return false;
/* The symbol table starts with a normal archive header. */
- if (bfd_bread (&hdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd)
- != SIZEOF_AR_HDR_BIG)
+ if (bfd_read (&hdr, SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG)
return false;
/* Skip the name (normally empty). */
char magic[SXCOFFARMAG];
size_t amt = SXCOFFARMAG;
- if (bfd_bread (magic, amt, abfd) != amt)
+ if (bfd_read (magic, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
/* Now read the rest of the file header. */
amt = SIZEOF_AR_FILE_HDR - SXCOFFARMAG;
- if (bfd_bread (&hdr.memoff, amt, abfd) != amt)
+ if (bfd_read (&hdr.memoff, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
/* Now read the rest of the file header. */
amt = SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG;
- if (bfd_bread (&hdr.memoff, amt, abfd) != amt)
+ if (bfd_read (&hdr.memoff, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
struct xcoff_ar_hdr hdr;
struct xcoff_ar_hdr *hdrp;
- if (bfd_bread (&hdr, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR)
+ if (bfd_read (&hdr, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR)
return NULL;
GET_VALUE_IN_FIELD (namlen, hdr.namlen, 10);
hdrp = (struct xcoff_ar_hdr *) (ret + 1);
memcpy (hdrp, &hdr, SIZEOF_AR_HDR);
- if (bfd_bread ((char *) hdrp + SIZEOF_AR_HDR, namlen, abfd) != namlen)
+ if (bfd_read ((char *) hdrp + SIZEOF_AR_HDR, namlen, abfd) != namlen)
{
free (ret);
return NULL;
struct xcoff_ar_hdr_big hdr;
struct xcoff_ar_hdr_big *hdrp;
- if (bfd_bread (&hdr, SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG)
+ if (bfd_read (&hdr, SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG)
return NULL;
GET_VALUE_IN_FIELD (namlen, hdr.namlen, 10);
hdrp = (struct xcoff_ar_hdr_big *) (ret + 1);
memcpy (hdrp, &hdr, SIZEOF_AR_HDR_BIG);
- if (bfd_bread ((char *) hdrp + SIZEOF_AR_HDR_BIG, namlen, abfd) != namlen)
+ if (bfd_read ((char *) hdrp + SIZEOF_AR_HDR_BIG, namlen, abfd) != namlen)
{
free (ret);
return NULL;
if (*p == '\0')
*p = ' ';
- if (bfd_bwrite (&hdr, (bfd_size_type) SIZEOF_AR_HDR, abfd)
- != SIZEOF_AR_HDR
- || (bfd_bwrite (XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG, abfd)
- != SXCOFFARFMAG))
+ if (bfd_write (&hdr, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR
+ || bfd_write (XCOFFARFMAG, SXCOFFARFMAG, abfd) != SXCOFFARFMAG)
return false;
H_PUT_32 (abfd, orl_count, buf);
- if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4)
+ if (bfd_write (buf, 4, abfd) != 4)
return false;
i = 0;
while (map[i].u.abfd == iterator.current.member)
{
H_PUT_32 (abfd, iterator.current.offset, buf);
- if (bfd_bwrite (buf, (bfd_size_type) 4, abfd) != 4)
+ if (bfd_write (buf, 4, abfd) != 4)
return false;
++i;
}
name = *map[i].name;
namlen = strlen (name);
- if (bfd_bwrite (name, (bfd_size_type) (namlen + 1), abfd) != namlen + 1)
+ if (bfd_write (name, namlen + 1, abfd) != namlen + 1)
return false;
}
char b;
b = '\0';
- if (bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1)
+ if (bfd_write (&b, 1, abfd) != 1)
return false;
}
return false;
while (number--)
- if (bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1)
+ if (bfd_write (&b, 1, abfd) != 1)
return false;
return true;
bfd_size_type remaining;
bfd_byte buffer[DEFAULT_BUFFERSIZE];
- if (bfd_seek (in_bfd, (file_ptr) 0, SEEK_SET) != 0)
+ if (bfd_seek (in_bfd, 0, SEEK_SET) != 0)
return false;
remaining = arelt_size (in_bfd);
while (remaining >= DEFAULT_BUFFERSIZE)
{
- if (bfd_bread (buffer, DEFAULT_BUFFERSIZE, in_bfd) != DEFAULT_BUFFERSIZE
- || bfd_bwrite (buffer, DEFAULT_BUFFERSIZE, out_bfd) != DEFAULT_BUFFERSIZE)
+ if (bfd_read (buffer, DEFAULT_BUFFERSIZE, in_bfd) != DEFAULT_BUFFERSIZE
+ || bfd_write (buffer, DEFAULT_BUFFERSIZE, out_bfd) != DEFAULT_BUFFERSIZE)
return false;
remaining -= DEFAULT_BUFFERSIZE;
if (remaining)
{
- if (bfd_bread (buffer, remaining, in_bfd) != remaining
- || bfd_bwrite (buffer, remaining, out_bfd) != remaining)
+ if (bfd_read (buffer, remaining, in_bfd) != remaining
+ || bfd_write (buffer, remaining, out_bfd) != remaining)
return false;
}
}
}
- bfd_bwrite (symbol_table, symbol_table_size, abfd);
+ bfd_write (symbol_table, symbol_table_size, abfd);
free (symbol_table);
}
}
- bfd_bwrite (symbol_table, symbol_table_size, abfd);
+ bfd_write (symbol_table, symbol_table_size, abfd);
free (symbol_table);
if (offsets == NULL)
return false;
- if (bfd_seek (abfd, (file_ptr) SIZEOF_AR_FILE_HDR, SEEK_SET) != 0)
+ if (bfd_seek (abfd, SIZEOF_AR_FILE_HDR, SEEK_SET) != 0)
return false;
makemap = bfd_has_map (abfd);
BFD_ASSERT (iterator.current.offset == bfd_tell (abfd));
namlen = iterator.current.padded_namlen;
- if (bfd_bwrite (ahdrp, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR
- || bfd_bwrite (iterator.current.name, namlen, abfd) != namlen
- || bfd_bwrite (XCOFFARFMAG, SXCOFFARFMAG, abfd) != SXCOFFARFMAG
+ if (bfd_write (ahdrp, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR
+ || bfd_write (iterator.current.name, namlen, abfd) != namlen
+ || bfd_write (XCOFFARFMAG, SXCOFFARFMAG, abfd) != SXCOFFARFMAG
|| bfd_seek (iterator.current.member, 0, SEEK_SET) != 0
|| !do_copy (abfd, iterator.current.member)
|| !do_pad (abfd, iterator.current.trailing_padding))
if (*p == '\0')
*p = ' ';
- if ((bfd_bwrite (&ahdr, (bfd_size_type) SIZEOF_AR_HDR, abfd)
- != SIZEOF_AR_HDR)
- || (bfd_bwrite (XCOFFARFMAG, (bfd_size_type) SXCOFFARFMAG, abfd)
- != SXCOFFARFMAG))
+ if ((bfd_write (&ahdr, SIZEOF_AR_HDR, abfd) != SIZEOF_AR_HDR)
+ || bfd_write (XCOFFARFMAG, SXCOFFARFMAG, abfd) != SXCOFFARFMAG)
return false;
sprintf (decbuf, "%-12ld", (long) count);
- if (bfd_bwrite (decbuf, (bfd_size_type) XCOFFARMAG_ELEMENT_SIZE, abfd)
+ if (bfd_write (decbuf, XCOFFARMAG_ELEMENT_SIZE, abfd)
!= XCOFFARMAG_ELEMENT_SIZE)
return false;
for (i = 0; i < (size_t) count; i++)
{
sprintf (decbuf, "%-12ld", (long) offsets[i]);
- if (bfd_bwrite (decbuf, (bfd_size_type) XCOFFARMAG_ELEMENT_SIZE,
- abfd) != XCOFFARMAG_ELEMENT_SIZE)
+ if (bfd_write (decbuf, XCOFFARMAG_ELEMENT_SIZE, abfd)
+ != XCOFFARMAG_ELEMENT_SIZE)
return false;
}
for (sub = abfd->archive_head; sub != NULL; sub = sub->archive_next)
name = normalize_filename (sub);
namlen = strlen (name);
- if (bfd_bwrite (name, namlen + 1, abfd) != namlen + 1)
+ if (bfd_write (name, namlen + 1, abfd) != namlen + 1)
return false;
}
*p = ' ';
if (bfd_seek (abfd, 0, SEEK_SET) != 0
- || (bfd_bwrite (fhdr, SIZEOF_AR_FILE_HDR, abfd) != SIZEOF_AR_FILE_HDR))
+ || (bfd_write (fhdr, SIZEOF_AR_FILE_HDR, abfd) != SIZEOF_AR_FILE_HDR))
return false;
return true;
memset (&xtdata, 0, sizeof (xtdata));
memcpy (fhdr->magic, XCOFFARMAGBIG, SXCOFFARMAG);
- if (bfd_seek (abfd, (file_ptr) SIZEOF_AR_FILE_HDR_BIG, SEEK_SET) != 0)
+ if (bfd_seek (abfd, SIZEOF_AR_FILE_HDR_BIG, SEEK_SET) != 0)
return false;
/* Calculate count and total_namlen. */
BFD_ASSERT (iterator.current.offset == bfd_tell (abfd));
namlen = iterator.current.padded_namlen;
- if (bfd_bwrite (ahdrp, SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG
- || bfd_bwrite (iterator.current.name, namlen, abfd) != namlen
- || bfd_bwrite (XCOFFARFMAG, SXCOFFARFMAG, abfd) != SXCOFFARFMAG
+ if (bfd_write (ahdrp, SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG
+ || bfd_write (iterator.current.name, namlen, abfd) != namlen
+ || bfd_write (XCOFFARFMAG, SXCOFFARFMAG, abfd) != SXCOFFARFMAG
|| bfd_seek (iterator.current.member, 0, SEEK_SET) != 0
|| !do_copy (abfd, iterator.current.member)
|| !do_pad (abfd, iterator.current.trailing_padding))
mt += namlen + 1;
}
- if (bfd_bwrite (member_table, member_table_size, abfd) != member_table_size)
+ if (bfd_write (member_table, member_table_size, abfd) != member_table_size)
return false;
free (member_table);
/* Write out the archive file header. */
if (bfd_seek (abfd, 0, SEEK_SET) != 0
- || bfd_bwrite (fhdr,
- SIZEOF_AR_FILE_HDR_BIG, abfd) != SIZEOF_AR_FILE_HDR_BIG)
+ || (bfd_write (fhdr, SIZEOF_AR_FILE_HDR_BIG, abfd)
+ != SIZEOF_AR_FILE_HDR_BIG))
return false;
return true;
filehdr.f_symptr = scnhdr.s_relptr + scnhdr.s_nreloc * RELSZ;
bfd_coff_swap_filehdr_out (abfd, &filehdr, filehdr_ext);
- bfd_bwrite (filehdr_ext, FILHSZ, abfd);
+ bfd_write (filehdr_ext, FILHSZ, abfd);
bfd_coff_swap_scnhdr_out (abfd, &scnhdr, scnhdr_ext);
- bfd_bwrite (scnhdr_ext, SCNHSZ, abfd);
- bfd_bwrite (data_buffer, data_buffer_size, abfd);
- bfd_bwrite (reloc_ext, scnhdr.s_nreloc * RELSZ, abfd);
- bfd_bwrite (syment_ext, filehdr.f_nsyms * SYMESZ, abfd);
- bfd_bwrite (string_table, string_table_size, abfd);
+ bfd_write (scnhdr_ext, SCNHSZ, abfd);
+ bfd_write (data_buffer, data_buffer_size, abfd);
+ bfd_write (reloc_ext, scnhdr.s_nreloc * RELSZ, abfd);
+ bfd_write (syment_ext, filehdr.f_nsyms * SYMESZ, abfd);
+ bfd_write (string_table, string_table_size, abfd);
free (data_buffer);
data_buffer = NULL;
bfd_set_error (bfd_error_system_call);
/* Read in the stub file header, which is a DOS MZ executable. */
- if (bfd_bread (&filehdr_dos, DOS_HDR_SIZE, abfd) != DOS_HDR_SIZE)
+ if (bfd_read (&filehdr_dos, DOS_HDR_SIZE, abfd) != DOS_HDR_SIZE)
goto fail;
/* Make sure that this is an MZ executable. */
go32exe_temp_stub = bfd_malloc (stubsize);
if (go32exe_temp_stub == NULL)
goto fail;
- if (bfd_bread (go32exe_temp_stub, stubsize, abfd) != stubsize)
+ if (bfd_read (go32exe_temp_stub, stubsize, abfd) != stubsize)
goto fail;
go32exe_temp_stub_size = stubsize;
abfd->origin = 0;
if (bfd_seek (abfd, 0, SEEK_SET) != 0)
return false;
- if (bfd_bwrite (coff_data (abfd)->stub, stubsize, abfd) != stubsize)
+ if (bfd_write (coff_data (abfd)->stub, stubsize, abfd) != stubsize)
return false;
/* Seek back to where we were. */
return false;
/* The symbol table starts with a normal archive header. */
- if (bfd_bread (&hdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd)
- != SIZEOF_AR_HDR_BIG)
+ if (bfd_read (&hdr, SIZEOF_AR_HDR_BIG, abfd) != SIZEOF_AR_HDR_BIG)
return false;
/* Skip the name (normally empty). */
struct xcoff_ar_file_hdr_big hdr;
size_t amt = SXCOFFARMAG;
- if (bfd_bread (magic, amt, abfd) != amt)
+ if (bfd_read (magic, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
/* Now read the rest of the file header. */
amt = SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG;
- if (bfd_bread (&hdr.memoff, amt, abfd) != amt)
+ if (bfd_read (&hdr.memoff, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
filehdr.f_symptr = data_scnhdr.s_relptr + data_scnhdr.s_nreloc * RELSZ;
bfd_coff_swap_filehdr_out (abfd, &filehdr, filehdr_ext);
- bfd_bwrite (filehdr_ext, FILHSZ, abfd);
+ bfd_write (filehdr_ext, FILHSZ, abfd);
bfd_coff_swap_scnhdr_out (abfd, &text_scnhdr, &scnhdr_ext[SCNHSZ * 0]);
bfd_coff_swap_scnhdr_out (abfd, &data_scnhdr, &scnhdr_ext[SCNHSZ * 1]);
bfd_coff_swap_scnhdr_out (abfd, &bss_scnhdr, &scnhdr_ext[SCNHSZ * 2]);
- bfd_bwrite (scnhdr_ext, 3 * SCNHSZ, abfd);
- bfd_bwrite (data_buffer, data_buffer_size, abfd);
- bfd_bwrite (reloc_ext, data_scnhdr.s_nreloc * RELSZ, abfd);
- bfd_bwrite (syment_ext, filehdr.f_nsyms * SYMESZ, abfd);
- bfd_bwrite (string_table, string_table_size, abfd);
+ bfd_write (scnhdr_ext, 3 * SCNHSZ, abfd);
+ bfd_write (data_buffer, data_buffer_size, abfd);
+ bfd_write (reloc_ext, data_scnhdr.s_nreloc * RELSZ, abfd);
+ bfd_write (syment_ext, filehdr.f_nsyms * SYMESZ, abfd);
+ bfd_write (string_table, string_table_size, abfd);
free (data_buffer);
data_buffer = NULL;
file_ptr oldpos = bfd_tell (abfd);
bfd_size_type relsz = bfd_coff_relsz (abfd);
- if (bfd_seek (abfd, (file_ptr) hdr->s_relptr, 0) != 0)
+ if (bfd_seek (abfd, hdr->s_relptr, 0) != 0)
return;
- if (bfd_bread (& dst, relsz, abfd) != relsz)
+ if (bfd_read (& dst, relsz, abfd) != relsz)
return;
bfd_coff_swap_reloc_in (abfd, &dst, &n);
const file_ptr oldpos = bfd_tell (abfd);
const bfd_size_type relsz = bfd_coff_relsz (abfd);
- if (bfd_seek (abfd, (file_ptr) hdr->s_relptr, 0) != 0)
+ if (bfd_seek (abfd, hdr->s_relptr, 0) != 0)
return;
- if (bfd_bread (& dst, relsz, abfd) != relsz)
+ if (bfd_read (& dst, relsz, abfd) != relsz)
return;
bfd_coff_swap_reloc_in (abfd, &dst, &n);
/* Add one to count *this* reloc (grr). */
n.r_vaddr = s->reloc_count + 1;
coff_swap_reloc_out (abfd, &n, &dst);
- if (bfd_bwrite (& dst, (bfd_size_type) bfd_coff_relsz (abfd),
- abfd) != bfd_coff_relsz (abfd))
+ if (bfd_write (&dst, bfd_coff_relsz (abfd), abfd)
+ != bfd_coff_relsz (abfd))
return false;
}
#endif
#endif
coff_swap_reloc_out (abfd, &n, &dst);
- if (bfd_bwrite (& dst, (bfd_size_type) bfd_coff_relsz (abfd),
- abfd) != bfd_coff_relsz (abfd))
+ if (bfd_write (&dst, bfd_coff_relsz (abfd), abfd)
+ != bfd_coff_relsz (abfd))
return false;
}
b = 0;
if (bfd_seek (abfd, sofar - 1, SEEK_SET) != 0
- || bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1)
+ || bfd_write (&b, 1, abfd) != 1)
return false;
}
unsigned char b[2];
int status;
- status = bfd_bread (b, (bfd_size_type) 2, abfd);
+ status = bfd_read (b, 2, abfd);
if (status < 1)
{
*value = 0;
if (bfd_seek (abfd, filepos, SEEK_SET) != 0)
return 0;
- buf_size = bfd_bread (buf, COFF_CHECKSUM_BUFFER_SIZE, abfd);
+ buf_size = bfd_read (buf, COFF_CHECKSUM_BUFFER_SIZE, abfd);
cur_buf_size = buf_size;
cur_buf = buf;
return false;
checksum = 0;
- bfd_bwrite (&checksum, (bfd_size_type) 4, abfd);
+ bfd_write (&checksum, 4, abfd);
if (bfd_seek (abfd, peheader, SEEK_SET) != 0)
return false;
if (bfd_seek (abfd, peheader + 0x58, SEEK_SET) != 0)
return false;
- bfd_bwrite (&checksum, (bfd_size_type) 4, abfd);
+ bfd_write (&checksum, 4, abfd);
return true;
}
bfd_size_type amt = bfd_coff_scnhsz (abfd);
if (bfd_coff_swap_scnhdr_out (abfd, §ion, &buff) == 0
- || bfd_bwrite (& buff, amt, abfd) != amt)
+ || bfd_write (& buff, amt, abfd) != amt)
return false;
}
scnhdr.s_flags = STYP_OVRFLO;
amt = bfd_coff_scnhsz (abfd);
if (bfd_coff_swap_scnhdr_out (abfd, &scnhdr, &buff) == 0
- || bfd_bwrite (& buff, amt, abfd) != amt)
+ || bfd_write (& buff, amt, abfd) != amt)
return false;
}
}
bfd_byte *b = bfd_zmalloc (fill_size);
if (b)
{
- bfd_bwrite (b, fill_size, abfd);
+ bfd_write (b, fill_size, abfd);
free (b);
}
}
#endif
/* Now write header. */
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0)
return false;
{
return false;
bfd_coff_swap_filehdr_out (abfd, & internal_f, buff);
- amount = bfd_bwrite (buff, amount, abfd);
+ amount = bfd_write (buff, amount, abfd);
free (buff);
return false;
coff_swap_aouthdr_out (abfd, & internal_a, buff);
- amount = bfd_bwrite (buff, amount, abfd);
+ amount = bfd_write (buff, amount, abfd);
free (buff);
size = bfd_coff_aoutsz (abfd);
else
size = SMALL_AOUTSZ;
- if (bfd_bwrite (& buff, (bfd_size_type) size, abfd) != size)
+ if (bfd_write (&buff, size, abfd) != size)
return false;
}
#endif
if (count == 0)
return true;
- return bfd_bwrite (location, count, abfd) == count;
+ return bfd_write (location, count, abfd) == count;
}
static void *
aoutsz) in executables. The bfd_coff_swap_aouthdr_in function
expects this header to be aoutsz bytes in length, so we use that
value in the call to bfd_alloc below. But we must be careful to
- only read in f_opthdr bytes in the call to bfd_bread. We should
+ only read in f_opthdr bytes in the call to bfd_read. We should
also attempt to catch corrupt or non-COFF binaries with a strange
value for f_opthdr. */
if (! bfd_coff_bad_format_hook (abfd, &internal_f)
}
if (bfd_seek (abfd, sec->rel_filepos, SEEK_SET) != 0
- || bfd_bread (external_relocs, amt, abfd) != amt)
+ || bfd_read (external_relocs, amt, abfd) != amt)
goto error_return;
if (internal_relocs == NULL)
if (!buf)
return false;
bfd_coff_swap_sym_out (abfd, &native->u.syment, buf);
- if (bfd_bwrite (buf, symesz, abfd) != symesz)
+ if (bfd_write (buf, symesz, abfd) != symesz)
return false;
bfd_release (abfd, buf);
type, n_sclass, (int) j,
native->u.syment.n_numaux,
buf);
- if (bfd_bwrite (buf, auxesz, abfd) != auxesz)
+ if (bfd_write (buf, auxesz, abfd) != auxesz)
return false;
}
bfd_release (abfd, buf);
#else
#error Change H_PUT_32
#endif
- if (bfd_bwrite ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd)
- != sizeof (buffer))
+ if (bfd_write (buffer, sizeof (buffer), abfd) != sizeof (buffer))
return false;
if (! _bfd_stringtab_emit (abfd, strtab))
out.l_lnno = 0;
out.l_addr.l_symndx = l->u.offset;
bfd_coff_swap_lineno_out (abfd, &out, buff);
- if (bfd_bwrite (buff, (bfd_size_type) linesz, abfd)
- != linesz)
+ if (bfd_write (buff, linesz, abfd) != linesz)
return false;
l++;
while (l->line_number)
out.l_lnno = l->line_number;
out.l_addr.l_symndx = l->u.offset;
bfd_coff_swap_lineno_out (abfd, &out, buff);
- if (bfd_bwrite (buff, (bfd_size_type) linesz, abfd)
- != linesz)
+ if (bfd_write (buff, linesz, abfd) != linesz)
return false;
l++;
}
if (bfd_seek (abfd, pos + size, SEEK_SET) != 0)
return NULL;
- if (bfd_bread (extstrsize, (bfd_size_type) sizeof extstrsize, abfd)
- != sizeof extstrsize)
+ if (bfd_read (extstrsize, sizeof extstrsize, abfd) != sizeof extstrsize)
{
if (bfd_get_error () != bfd_error_file_truncated)
return NULL;
they are zero. */
memset (strings, 0, STRING_SIZE_SIZE);
- if (bfd_bread (strings + STRING_SIZE_SIZE, strsize - STRING_SIZE_SIZE, abfd)
+ if (bfd_read (strings + STRING_SIZE_SIZE, strsize - STRING_SIZE_SIZE, abfd)
!= strsize - STRING_SIZE_SIZE)
{
free (strings);
if (rewrite
&& (bfd_seek (abfd, pos, SEEK_SET) != 0
- || bfd_bwrite (flaginfo.outsyms, symesz, abfd) != symesz))
+ || bfd_write (flaginfo.outsyms, symesz, abfd) != symesz))
goto error_return;
obj_raw_syment_count (abfd) += written;
pos = obj_sym_filepos (abfd) + flaginfo.last_file_index * symesz;
if (bfd_seek (abfd, pos, SEEK_SET) != 0
- || bfd_bwrite (flaginfo.outsyms, symesz, abfd) != symesz)
+ || bfd_write (flaginfo.outsyms, symesz, abfd) != symesz)
return false;
}
memset (&incount, 0, sizeof (incount));
incount.r_vaddr = o->reloc_count + 1;
bfd_coff_swap_reloc_out (abfd, &incount, excount);
- if (bfd_bwrite (excount, relsz, abfd) != relsz)
+ if (bfd_write (excount, relsz, abfd) != relsz)
/* We'll leak, but it's an error anyway. */
goto error_return;
free (excount);
}
- if (bfd_bwrite (external_relocs,
- (bfd_size_type) relsz * o->reloc_count, abfd)
+ if (bfd_write (external_relocs,
+ (bfd_size_type) relsz * o->reloc_count, abfd)
!= (bfd_size_type) relsz * o->reloc_count)
goto error_return;
}
#error Change H_PUT_32 above
#endif
- if (bfd_bwrite (strbuf, (bfd_size_type) STRING_SIZE_SIZE, abfd)
- != STRING_SIZE_SIZE)
+ if (bfd_write (strbuf, STRING_SIZE_SIZE, abfd) != STRING_SIZE_SIZE)
return false;
if (! _bfd_stringtab_emit (abfd, flaginfo.strtab))
pos = obj_sym_filepos (output_bfd);
pos += flaginfo->last_file_index * osymesz;
if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
- || bfd_bwrite (outsym, osymesz, output_bfd) != osymesz)
+ || bfd_write (outsym, osymesz, output_bfd) != osymesz)
return false;
}
}
pos = obj_sym_filepos (output_bfd);
pos += flaginfo->last_bf_index * osymesz;
if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
- || (bfd_bwrite (outsym, osymesz, output_bfd)
+ || (bfd_write (outsym, osymesz, output_bfd)
!= osymesz))
return false;
}
continue;
if (bfd_seek (input_bfd, o->line_filepos, SEEK_SET) != 0
- || bfd_bread (flaginfo->linenos, linesz * o->lineno_count,
+ || bfd_read (flaginfo->linenos, linesz * o->lineno_count,
input_bfd) != linesz * o->lineno_count)
return false;
pos += o->output_section->lineno_count * linesz;
amt = oeline - flaginfo->linenos;
if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
- || bfd_bwrite (flaginfo->linenos, amt, output_bfd) != amt)
+ || bfd_write (flaginfo->linenos, amt, output_bfd) != amt)
return false;
o->output_section->lineno_count += amt / linesz;
pos = obj_sym_filepos (output_bfd) + syment_base * osymesz;
amt = outsym - flaginfo->outsyms;
if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
- || bfd_bwrite (flaginfo->outsyms, amt, output_bfd) != amt)
+ || bfd_write (flaginfo->outsyms, amt, output_bfd) != amt)
return false;
BFD_ASSERT ((obj_raw_syment_count (output_bfd)
pos = obj_sym_filepos (output_bfd);
pos += obj_raw_syment_count (output_bfd) * symesz;
if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
- || bfd_bwrite (flaginfo->outsyms, symesz, output_bfd) != symesz)
+ || bfd_write (flaginfo->outsyms, symesz, output_bfd) != symesz)
{
flaginfo->failed = true;
return false;
bfd_coff_swap_aux_out (output_bfd, auxp, isym.n_type,
isym.n_sclass, (int) i, isym.n_numaux,
flaginfo->outsyms);
- if (bfd_bwrite (flaginfo->outsyms, symesz, output_bfd) != symesz)
+ if (bfd_write (flaginfo->outsyms, symesz, output_bfd) != symesz)
{
flaginfo->failed = true;
return false;
Get the contents of a section. This is called from
@samp{bfd_get_section_contents}. Most targets set this to
@samp{_bfd_generic_get_section_contents}, which does a @samp{bfd_seek}
-based on the section's @samp{filepos} field and a @samp{bfd_bread}. The
+based on the section's @samp{filepos} field and a @samp{bfd_read}. The
corresponding field in the target vector is named
@samp{_bfd_get_section_contents}.
target vector is named @samp{_bfd_truncate_arname}.
@item _write_armap
-Write out the archive symbol table using calls to @samp{bfd_bwrite}.
+Write out the archive symbol table using calls to @samp{bfd_write}.
This is normally called from the archive @samp{write_contents} routine.
The corresponding field in the target vector is named @samp{write_armap}
(no leading underscore).
pos = section->filepos + offset;
if (bfd_seek (abfd, pos, SEEK_SET) != 0
- || bfd_bwrite (location, count, abfd) != count)
+ || bfd_write (location, count, abfd) != count)
return false;
return true;
}
internal_f.f_nscns = 0;
- if (bfd_seek (abfd, (file_ptr) (filhsz + aoutsz), SEEK_SET) != 0)
+ if (bfd_seek (abfd, filhsz + aoutsz, SEEK_SET) != 0)
goto error_return;
for (current = abfd->sections;
current->flags);
if (bfd_coff_swap_scnhdr_out (abfd, (void *) §ion, buff) == 0
- || bfd_bwrite (buff, scnhsz, abfd) != scnhsz)
+ || bfd_write (buff, scnhsz, abfd) != scnhsz)
goto error_return;
if ((section.s_flags & STYP_TEXT) != 0
}
/* Write out the file header and the optional header. */
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0)
goto error_return;
bfd_coff_swap_filehdr_out (abfd, (void *) &internal_f, buff);
- if (bfd_bwrite (buff, filhsz, abfd) != filhsz)
+ if (bfd_write (buff, filhsz, abfd) != filhsz)
goto error_return;
bfd_coff_swap_aouthdr_out (abfd, (void *) &internal_a, buff);
- if (bfd_bwrite (buff, aoutsz, abfd) != aoutsz)
+ if (bfd_write (buff, aoutsz, abfd) != aoutsz)
goto error_return;
/* Build the external symbol information. This must be done before
if (bfd_seek (abfd, current->rel_filepos, SEEK_SET) != 0)
goto error_return;
amt = current->reloc_count * external_reloc_size;
- if (bfd_bwrite (reloc_buff, amt, abfd) != amt)
+ if (bfd_write (reloc_buff, amt, abfd) != amt)
goto error_return;
bfd_release (abfd, reloc_buff);
reloc_buff = NULL;
{
char c;
- if (bfd_seek (abfd, (file_ptr) ecoff_data (abfd)->sym_filepos - 1,
- SEEK_SET) != 0)
+ if (bfd_seek (abfd, ecoff_data (abfd)->sym_filepos - 1, SEEK_SET) != 0)
goto error_return;
- if (bfd_bread (&c, (bfd_size_type) 1, abfd) == 0)
+ if (bfd_read (&c, 1, abfd) == 0)
c = 0;
- if (bfd_seek (abfd, (file_ptr) ecoff_data (abfd)->sym_filepos - 1,
- SEEK_SET) != 0)
+ if (bfd_seek (abfd, ecoff_data (abfd)->sym_filepos - 1, SEEK_SET) != 0)
goto error_return;
- if (bfd_bwrite (&c, (bfd_size_type) 1, abfd) != 1)
+ if (bfd_write (&c, 1, abfd) != 1)
goto error_return;
}
bfd_size_type amt;
/* Get the name of the first element. */
- i = bfd_bread ((void *) nextname, (bfd_size_type) 16, abfd);
+ i = bfd_read (nextname, 16, abfd);
if (i == 0)
return true;
if (i != 16)
return false;
- if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
+ if (bfd_seek (abfd, -16, SEEK_CUR) != 0)
return false;
/* Irix 4.0.5F apparently can use either an ECOFF armap or a
if (((char *) (&hdr))[i] == '\0')
(((char *) (&hdr))[i]) = ' ';
- if (bfd_bwrite ((void *) &hdr, (bfd_size_type) sizeof (struct ar_hdr), abfd)
- != sizeof (struct ar_hdr))
+ if (bfd_write (&hdr, sizeof (struct ar_hdr), abfd) != sizeof (struct ar_hdr))
return false;
H_PUT_32 (abfd, hashsize, temp);
- if (bfd_bwrite ((void *) temp, (bfd_size_type) 4, abfd) != 4)
+ if (bfd_write (temp, 4, abfd) != 4)
return false;
hashtable = (bfd_byte *) bfd_zalloc (abfd, symdefsize);
H_PUT_32 (abfd, firstreal, (hashtable + hash * 8 + 4));
}
- if (bfd_bwrite ((void *) hashtable, symdefsize, abfd) != symdefsize)
+ if (bfd_write (hashtable, symdefsize, abfd) != symdefsize)
return false;
bfd_release (abfd, hashtable);
/* Now write the strings. */
H_PUT_32 (abfd, stringsize, temp);
- if (bfd_bwrite ((void *) temp, (bfd_size_type) 4, abfd) != 4)
+ if (bfd_write (temp, 4, abfd) != 4)
return false;
for (i = 0; i < orl_count; i++)
{
bfd_size_type len;
len = strlen (*map[i].name) + 1;
- if (bfd_bwrite ((void *) (*map[i].name), len, abfd) != len)
+ if (bfd_write (*map[i].name, len, abfd) != len)
return false;
}
bug-compatible for DECstation ar we use a null. */
if (padit)
{
- if (bfd_bwrite ("", (bfd_size_type) 1, abfd) != 1)
+ if (bfd_write ("", 1, abfd) != 1)
return false;
}
file_ptr pos = (output_section->rel_filepos
+ output_section->reloc_count * external_reloc_size);
if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
- || (bfd_bwrite (external_relocs, external_relocs_size, output_bfd)
+ || (bfd_write (external_relocs, external_relocs_size, output_bfd)
!= external_relocs_size))
goto error_return;
output_section->reloc_count += input_section->reloc_count;
pos = (output_section->rel_filepos
+ output_section->reloc_count * external_reloc_size);
ok = (bfd_seek (output_bfd, pos, SEEK_SET) == 0
- && (bfd_bwrite ((void *) rbuf, external_reloc_size, output_bfd)
+ && (bfd_write (rbuf, external_reloc_size, output_bfd)
== external_reloc_size));
if (ok)
goto error_return;
(*swap->swap_hdr_out) (abfd, symhdr, buff);
- if (bfd_bwrite (buff, swap->external_hdr_size, abfd)
+ if (bfd_write (buff, swap->external_hdr_size, abfd)
!= swap->external_hdr_size)
goto error_return;
BFD_ASSERT (symhdr->offset == 0 \
|| (bfd_vma) bfd_tell (abfd) == symhdr->offset); \
if (symhdr->count != 0 \
- && bfd_bwrite (debug->ptr, \
- (bfd_size_type) size * symhdr->count, \
- abfd) != size * symhdr->count) \
+ && bfd_write (debug->ptr, size * symhdr->count, \
+ abfd) != size * symhdr->count) \
return false;
WRITE (line, cbLine, sizeof (unsigned char), cbLineOffset);
WRITE (external_pdr, ipdMax, swap->external_pdr_size, cbPdOffset);
WRITE (external_sym, isymMax, swap->external_sym_size, cbSymOffset);
WRITE (external_opt, ioptMax, swap->external_opt_size, cbOptOffset);
- WRITE (external_aux, iauxMax, (bfd_size_type) sizeof (union aux_ext),
- cbAuxOffset);
+ WRITE (external_aux, iauxMax, sizeof (union aux_ext), cbAuxOffset);
WRITE (ss, issMax, sizeof (char), cbSsOffset);
WRITE (ssext, issExtMax, sizeof (char), cbSsExtOffset);
WRITE (external_fdr, ifdMax, swap->external_fdr_size, cbFdOffset);
void * space)
{
struct shuffle *l;
- unsigned long total;
+ size_t total;
total = 0;
- for (l = shuffle; l != (struct shuffle *) NULL; l = l->next)
+ for (l = shuffle; l != NULL; l = l->next)
{
if (! l->filep)
{
- if (bfd_bwrite (l->u.memory, (bfd_size_type) l->size, abfd)
- != l->size)
+ if (bfd_write (l->u.memory, l->size, abfd) != l->size)
return false;
}
else
{
if (bfd_seek (l->u.file.input_bfd, l->u.file.offset, SEEK_SET) != 0
- || bfd_bread (space, (bfd_size_type) l->size,
- l->u.file.input_bfd) != l->size
- || bfd_bwrite (space, (bfd_size_type) l->size, abfd) != l->size)
+ || bfd_read (space, l->size, l->u.file.input_bfd) != l->size
+ || bfd_write (space, l->size, abfd) != l->size)
return false;
}
total += l->size;
if ((total & (swap->debug_align - 1)) != 0)
{
- unsigned int i;
+ size_t i;
bfd_byte *s;
i = swap->debug_align - (total & (swap->debug_align - 1));
- s = (bfd_byte *) bfd_zmalloc ((bfd_size_type) i);
+ s = bfd_zmalloc (i);
if (s == NULL && i != 0)
return false;
- if (bfd_bwrite (s, (bfd_size_type) i, abfd) != i)
+ if (bfd_write (s, i, abfd) != i)
{
free (s);
return false;
bfd_byte null;
struct string_hash_entry *sh;
- BFD_ASSERT (ainfo->ss == (struct shuffle *) NULL);
+ BFD_ASSERT (ainfo->ss == NULL);
null = 0;
- if (bfd_bwrite (&null, (bfd_size_type) 1, abfd) != 1)
+ if (bfd_write (&null, 1, abfd) != 1)
goto error_return;
total = 1;
BFD_ASSERT (ainfo->ss_hash == NULL || ainfo->ss_hash->val == 1);
- for (sh = ainfo->ss_hash;
- sh != (struct string_hash_entry *) NULL;
- sh = sh->next)
+ for (sh = ainfo->ss_hash; sh != NULL; sh = sh->next)
{
size_t len;
len = strlen (sh->root.string);
amt = len + 1;
- if (bfd_bwrite (sh->root.string, amt, abfd) != amt)
+ if (bfd_write (sh->root.string, amt, abfd) != amt)
goto error_return;
total += len + 1;
}
if ((total & (swap->debug_align - 1)) != 0)
{
- unsigned int i;
+ size_t i;
bfd_byte *s;
i = swap->debug_align - (total & (swap->debug_align - 1));
- s = (bfd_byte *) bfd_zmalloc ((bfd_size_type) i);
+ s = bfd_zmalloc (i);
if (s == NULL && i != 0)
goto error_return;
- if (bfd_bwrite (s, (bfd_size_type) i, abfd) != i)
+ if (bfd_write (s, i, abfd) != i)
{
free (s);
goto error_return;
/* The external strings and symbol are not converted over to using
shuffles. FIXME: They probably should be. */
amt = debug->symbolic_header.issExtMax;
- if (amt != 0 && bfd_bwrite (debug->ssext, amt, abfd) != amt)
+ if (amt != 0 && bfd_write (debug->ssext, amt, abfd) != amt)
goto error_return;
if ((debug->symbolic_header.issExtMax & (swap->debug_align - 1)) != 0)
{
- unsigned int i;
+ size_t i;
bfd_byte *s;
i = (swap->debug_align
- (debug->symbolic_header.issExtMax & (swap->debug_align - 1)));
- s = (bfd_byte *) bfd_zmalloc ((bfd_size_type) i);
+ s = bfd_zmalloc (i);
if (s == NULL && i != 0)
goto error_return;
- if (bfd_bwrite (s, (bfd_size_type) i, abfd) != i)
+ if (bfd_write (s, i, abfd) != i)
{
free (s);
goto error_return;
== (bfd_vma) bfd_tell (abfd)));
amt = debug->symbolic_header.iextMax * swap->external_ext_size;
- if (amt != 0 && bfd_bwrite (debug->external_ext, amt, abfd) != amt)
+ if (amt != 0 && bfd_write (debug->external_ext, amt, abfd) != amt)
goto error_return;
free (space);
else
{
if (bfd_seek (l->u.file.input_bfd, l->u.file.offset, SEEK_SET) != 0
- || (bfd_bread (buff, (bfd_size_type) l->size, l->u.file.input_bfd)
- != l->size))
+ || bfd_read (buff, l->size, l->u.file.input_bfd) != l->size)
return false;
}
buff += l->size;
if (fill == NULL
|| bfd_seek (abfd, sec->filepos, SEEK_SET) != 0
- || bfd_bwrite (fill, sec->size, abfd) != sec->size)
+ || bfd_write (fill, sec->size, abfd) != sec->size)
{
/* We don't have a proper way to report an error here. So
instead fudge things so that elf_write_shdrs_and_ehdr will
bfd_size_type off = 1;
size_t i;
- if (bfd_bwrite ("", 1, abfd) != 1)
+ if (bfd_write ("", 1, abfd) != 1)
return false;
for (i = 1; i < tab->size; ++i)
continue;
str = tab->array[i]->root.string;
- if (bfd_bwrite (str, len, abfd) != len)
+ if (bfd_write (str, len, abfd) != len)
return false;
off += len;
}
if (extsym_buf == NULL
|| bfd_seek (ibfd, pos, SEEK_SET) != 0
- || bfd_bread (extsym_buf, amt, ibfd) != amt)
+ || bfd_read (extsym_buf, amt, ibfd) != amt)
{
intsym_buf = NULL;
goto out;
}
if (extshndx_buf == NULL
|| bfd_seek (ibfd, pos, SEEK_SET) != 0
- || bfd_bread (extshndx_buf, amt, ibfd) != amt)
+ || bfd_read (extshndx_buf, amt, ibfd) != amt)
{
intsym_buf = NULL;
goto out;
NULL);
if (filepos == (file_ptr) -1
|| bfd_seek (abfd, filepos, SEEK_SET) != 0
- || (bfd_bread (nb, 2 * hash_ent_size, abfd)
- != (2 * hash_ent_size)))
+ || bfd_read (nb, 2 * hash_ent_size, abfd) != 2 * hash_ent_size)
goto error_return;
/* The number of dynamic symbol table entries equals the number
sizeof (nb), NULL);
if (filepos == (file_ptr) -1
|| bfd_seek (abfd, filepos, SEEK_SET) != 0
- || bfd_bread (nb, sizeof (nb), abfd) != sizeof (nb))
+ || bfd_read (nb, sizeof (nb), abfd) != sizeof (nb))
goto error_return;
ngnubuckets = bfd_get_32 (abfd, nb);
do
{
- if (bfd_bread (nb, 4, abfd) != 4)
+ if (bfd_read (nb, 4, abfd) != 4)
goto error_return;
++maxchain;
if (maxchain == 0)
bfd_size_type amt = i_shdrp[count]->sh_size;
if (bfd_seek (abfd, i_shdrp[count]->sh_offset, SEEK_SET) != 0
- || bfd_bwrite (i_shdrp[count]->contents, amt, abfd) != amt)
+ || bfd_write (i_shdrp[count]->contents, amt, abfd) != amt)
return false;
}
}
}
if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0
- || (bfd_bread (native_relocs, hdr->sh_size, abfd)
- != hdr->sh_size))
+ || bfd_read (native_relocs, hdr->sh_size, abfd) != hdr->sh_size)
{
free (native_relocs);
/* The internal_relocs will be freed when
}
if (bfd_seek (ibfd, asec->filepos, SEEK_SET) != 0
- || (bfd_bread (buffer, length, ibfd) != length))
+ || (bfd_read (buffer, length, ibfd) != length))
{
/* xgettext:c-format */
error_message = _("unable to read in %s section from %pB");
if (bfd_seek (abfd, hdr->p_offset, SEEK_SET) != 0)
return false;
- if (bfd_bread (&sig, 4, abfd) != 4)
+ if (bfd_read (&sig, 4, abfd) != 4)
return false;
elf_tdata (abfd)->core->signal = sig;
bfd_putl64 (elf_ia64_vms_tdata (abfd)->needed_count, needed_count);
if (bfd_seek (abfd, sizeof (Elf64_External_Ehdr), SEEK_SET) != 0
- || bfd_bwrite (needed_count, 8, abfd) != 8)
+ || bfd_write (needed_count, 8, abfd) != 8)
return false;
return true;
uint64_t pad = 0;
bfd_seek (abfd, isize, SEEK_SET);
- bfd_bwrite (&pad, ishort, abfd);
+ bfd_write (&pad, ishort, abfd);
}
}
/* Read in the ELF header in external format. */
- if (bfd_bread (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr))
+ if (bfd_read (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr))
{
if (bfd_get_error () != bfd_error_system_call)
goto got_wrong_format_error;
/* Read the first section header at index 0, and convert to internal
form. */
- if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr))
+ if (bfd_read (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr))
goto got_no_match;
elf_swap_shdr_in (abfd, &x_shdr, &i_shdr);
if (bfd_seek (abfd, where, SEEK_SET) != 0)
goto got_no_match;
- if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr))
+ if (bfd_read (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr))
goto got_no_match;
/* Back to where we were. */
to internal form. */
for (shindex = 1; shindex < i_ehdrp->e_shnum; shindex++)
{
- if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr))
+ if (bfd_read (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr))
goto got_no_match;
elf_swap_shdr_in (abfd, &x_shdr, i_shdrp + shindex);
= (Elf_Internal_Phdr *) bfd_alloc (abfd, amt);
if (elf_tdata (abfd)->phdr == NULL)
goto got_no_match;
- if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_phoff, SEEK_SET) != 0)
+ if (bfd_seek (abfd, i_ehdrp->e_phoff, SEEK_SET) != 0)
goto got_no_match;
bool eu_strip_broken_phdrs = false;
i_phdr = elf_tdata (abfd)->phdr;
{
Elf_External_Phdr x_phdr;
- if (bfd_bread (&x_phdr, sizeof x_phdr, abfd) != sizeof x_phdr)
+ if (bfd_read (&x_phdr, sizeof x_phdr, abfd) != sizeof x_phdr)
goto got_no_match;
elf_swap_phdr_in (abfd, &x_phdr, i_phdr);
/* Too much code in BFD relies on alignment being a power of
Elf_External_Phdr extphdr;
elf_swap_phdr_out (abfd, phdr, &extphdr);
- if (bfd_bwrite (&extphdr, sizeof (Elf_External_Phdr), abfd)
+ if (bfd_write (&extphdr, sizeof (Elf_External_Phdr), abfd)
!= sizeof (Elf_External_Phdr))
return -1;
phdr++;
#endif
elf_swap_ehdr_out (abfd, i_ehdrp, &x_ehdr);
amt = sizeof (x_ehdr);
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || bfd_bwrite (&x_ehdr, amt, abfd) != amt)
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0
+ || bfd_write (&x_ehdr, amt, abfd) != amt)
return false;
if ((abfd->flags & BFD_NO_SECTION_HEADER) != 0)
elf_swap_shdr_out (abfd, *i_shdrp, x_shdrp + count);
}
amt = (bfd_size_type) i_ehdrp->e_shnum * sizeof (*x_shdrp);
- if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_shoff, SEEK_SET) != 0
- || bfd_bwrite (x_shdrp, amt, abfd) != amt)
+ if (bfd_seek (abfd, i_ehdrp->e_shoff, SEEK_SET) != 0
+ || bfd_write (x_shdrp, amt, abfd) != amt)
return false;
/* need to dump the string table too... */
ufile_ptr filesize;
/* Read in the ELF header in external format. */
- if (bfd_bread (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr))
+ if (bfd_read (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr))
{
if (bfd_get_error () != bfd_error_system_call)
goto wrong;
/* Read the first section header at index 0, and convert to internal
form. */
- if (bfd_bread (&x_shdr, sizeof (x_shdr), abfd) != sizeof (x_shdr))
+ if (bfd_read (&x_shdr, sizeof (x_shdr), abfd) != sizeof (x_shdr))
goto fail;
elf_swap_shdr_in (abfd, &x_shdr, &i_shdr);
if (bfd_seek (abfd, where, SEEK_SET) != 0)
goto fail;
- if (bfd_bread (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr))
+ if (bfd_read (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr))
goto fail;
}
/* Move to the start of the program headers. */
- if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_phoff, SEEK_SET) != 0)
+ if (bfd_seek (abfd, i_ehdrp->e_phoff, SEEK_SET) != 0)
goto wrong;
/* Allocate space for the program headers. */
{
Elf_External_Phdr x_phdr;
- if (bfd_bread (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr))
+ if (bfd_read (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr))
goto fail;
elf_swap_phdr_in (abfd, &x_phdr, i_phdrp + phindex);
goto fail;
/* Read in the ELF header in external format. */
- if (bfd_bread (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr))
+ if (bfd_read (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr))
{
if (bfd_get_error () != bfd_error_system_call)
goto wrong;
if (i_phdr == NULL)
goto fail;
- if (bfd_seek (abfd, (file_ptr) (offset + i_ehdr.e_phoff), SEEK_SET) != 0)
+ if (bfd_seek (abfd, offset + i_ehdr.e_phoff, SEEK_SET) != 0)
goto fail;
/* Read in program headers and parse notes. */
{
Elf_External_Phdr x_phdr;
- if (bfd_bread (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr))
+ if (bfd_read (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr))
goto fail;
elf_swap_phdr_in (abfd, &x_phdr, i_phdr);
i_phdr->p_filesz, i_phdr->p_align);
/* Make sure ABFD returns to processing the program headers. */
- if (bfd_seek (abfd, (file_ptr) (offset + i_ehdr.e_phoff
- + (i + 1) * sizeof (x_phdr)),
+ if (bfd_seek (abfd,
+ offset + i_ehdr.e_phoff + (i + 1) * sizeof (x_phdr),
SEEK_SET) != 0)
goto fail;
return false;
/* Read the relocations. */
- if (bfd_bread (external_relocs, shdr->sh_size, abfd) != shdr->sh_size)
+ if (bfd_read (external_relocs, shdr->sh_size, abfd) != shdr->sh_size)
return false;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
pos = hdr->sh_offset + hdr->sh_size;
amt = bed->s->sizeof_sym * flinfo->output_bfd->symcount;
if (bfd_seek (flinfo->output_bfd, pos, SEEK_SET) == 0
- && bfd_bwrite (symbuf, amt, flinfo->output_bfd) == amt)
+ && bfd_write (symbuf, amt, flinfo->output_bfd) == amt)
{
hdr->sh_size += amt;
ret = true;
off, true);
if (bfd_seek (abfd, symtab_shndx_hdr->sh_offset, SEEK_SET) != 0
- || (bfd_bwrite (flinfo.symshndxbuf, amt, abfd) != amt))
+ || (bfd_write (flinfo.symshndxbuf, amt, abfd) != amt))
{
ret = false;
goto return_local_hash_table;
SEEK_SET) != 0)
return false;
H_PUT_32 (abfd, elf_gp (abfd), buf);
- if (bfd_bwrite (buf, 4, abfd) != 4)
+ if (bfd_write (buf, 4, abfd) != 4)
return false;
}
SEEK_SET) != 0)
return false;
H_PUT_64 (abfd, elf_gp (abfd), buf);
- if (bfd_bwrite (buf, 8, abfd) != 8)
+ if (bfd_write (buf, 8, abfd) != 8)
return false;
}
else if (intopt.kind == ODK_REGINFO)
SEEK_SET) != 0)
return false;
H_PUT_32 (abfd, elf_gp (abfd), buf);
- if (bfd_bwrite (buf, 4, abfd) != 4)
+ if (bfd_write (buf, 4, abfd) != 4)
return false;
}
l += intopt.size;
/* If the target type was explicitly specified, just check that target. */
if (!abfd->target_defaulted)
{
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) /* rewind! */
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0) /* rewind! */
goto err_ret;
cleanup = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
/* Change BFD's target temporarily. */
abfd->xvec = *target;
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0)
goto err_ret;
cleanup = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
{
bfd_reinit (abfd, initial_section_id, &preserve, cleanup);
bfd_release (abfd, preserve.marker);
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0)
goto err_ret;
cleanup = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
BFD_ASSERT (cleanup != NULL);
bfd_byte buf[4];
/* The output length includes the null byte. */
- bfd_put_32 (abfd, (bfd_vma) len, buf);
- if (bfd_bwrite ((void *) buf, (bfd_size_type) 4, abfd) != 4)
+ bfd_put_32 (abfd, len, buf);
+ if (bfd_write (buf, 4, abfd) != 4)
return false;
}
else if (tab->length_field_size == 2)
bfd_byte buf[2];
/* The output length includes the null byte. */
- bfd_put_16 (abfd, (bfd_vma) len, buf);
- if (bfd_bwrite ((void *) buf, (bfd_size_type) 2, abfd) != 2)
+ bfd_put_16 (abfd, len, buf);
+ if (bfd_write (buf, 2, abfd) != 2)
return false;
}
- if (bfd_bwrite ((void *) str, (bfd_size_type) len, abfd) != len)
+ if (bfd_write (str, len, abfd) != len)
return false;
}
/* Try to read in the u-area. We will need information from this
to know how to grok the rest of the core structures. */
- val = bfd_bread ((void *) &u, (bfd_size_type) sizeof u, abfd);
+ val = bfd_read (&u, sizeof u, abfd);
if (val != sizeof u)
{
if (bfd_get_error () != bfd_error_system_call)
int val;
struct corehead core_header;
- val = bfd_bread ((void *) &core_header,
- (bfd_size_type) sizeof core_header, abfd);
+ val = bfd_read (&core_header, sizeof core_header, abfd);
if (val <= 0)
break;
switch (core_header.type)
case CORE_KERNEL:
case CORE_FORMAT:
/* Just skip this. */
- bfd_seek (abfd, (file_ptr) core_header.len, SEEK_CUR);
+ bfd_seek (abfd, core_header.len, SEEK_CUR);
good_sections++;
break;
case CORE_EXEC:
{
struct proc_exec proc_exec;
- if (bfd_bread ((void *) &proc_exec, (bfd_size_type) core_header.len,
- abfd) != core_header.len)
+ if (bfd_read (&proc_exec, core_header.len, abfd) != core_header.len)
break;
strncpy (core_command (abfd), proc_exec.cmd, MAXCOMLEN + 1);
good_sections++;
/* We need to read this section, 'cause we need to determine
whether the core-dumped app was threaded before we create
any .reg sections. */
- if (bfd_bread (&proc_info, (bfd_size_type) core_header.len, abfd)
- != core_header.len)
+ if (bfd_read (&proc_info, core_header.len, abfd) != core_header.len)
break;
/* However, we also want to create those sections with the
file positioned at the start of the record, it seems. */
- if (bfd_seek (abfd, -((file_ptr) core_header.len), SEEK_CUR) != 0)
+ if (bfd_seek (abfd, -(file_ptr) core_header.len, SEEK_CUR) != 0)
break;
#if defined(PROC_INFO_HAS_THREAD_ID)
#include "libbfd.h"
#ifndef WRITE_HEADERS
-#define WRITE_HEADERS(abfd, execp) \
- { \
- if (adata(abfd).magic == undecided_magic) \
- NAME(aout,adjust_sizes_and_vmas) (abfd); \
- \
- execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \
- execp->a_entry = bfd_get_start_address (abfd); \
- \
- execp->a_trsize = ((obj_textsec (abfd)->reloc_count) * \
- obj_reloc_entry_size (abfd)); \
- execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * \
- obj_reloc_entry_size (abfd)); \
- NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes); \
- \
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 \
- || bfd_bwrite (&exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, \
- abfd) != EXEC_BYTES_SIZE) \
- return false; \
- /* Now write out reloc info, followed by syms and strings */ \
- \
- if (bfd_get_symcount (abfd) != 0) \
- { \
- if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (execp)), SEEK_SET) \
- != 0) \
- return false; \
- \
- if (! NAME(aout,write_syms) (abfd)) return false; \
- \
- if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (execp)), SEEK_SET) \
- != 0) \
- return false; \
- \
- if (!NAME(lynx,squirt_out_relocs) (abfd, obj_textsec (abfd))) \
- return false; \
- if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (execp)), SEEK_SET) \
- != 0) \
- return 0; \
- \
- if (!NAME(lynx,squirt_out_relocs) (abfd, obj_datasec (abfd))) \
- return false; \
- } \
- }
+#define WRITE_HEADERS(abfd, execp) \
+ { \
+ if (adata(abfd).magic == undecided_magic) \
+ NAME (aout, adjust_sizes_and_vmas) (abfd); \
+ \
+ execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \
+ execp->a_entry = bfd_get_start_address (abfd); \
+ \
+ execp->a_trsize = ((obj_textsec (abfd)->reloc_count) \
+ * obj_reloc_entry_size (abfd)); \
+ execp->a_drsize = ((obj_datasec (abfd)->reloc_count) \
+ * obj_reloc_entry_size (abfd)); \
+ NAME (aout, swap_exec_header_out) (abfd, execp, &exec_bytes); \
+ \
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0 \
+ || bfd_write (&exec_bytes, EXEC_BYTES_SIZE, \
+ abfd) != EXEC_BYTES_SIZE) \
+ return false; \
+ /* Now write out reloc info, followed by syms and strings. */ \
+ \
+ if (bfd_get_outsymbols (abfd) != NULL \
+ && bfd_get_symcount (abfd) != 0) \
+ { \
+ if (bfd_seek (abfd, N_SYMOFF (execp), SEEK_SET) != 0) \
+ return false; \
+ \
+ if (! NAME (aout, write_syms) (abfd)) \
+ return false; \
+ } \
+ \
+ if (bfd_seek (abfd, N_TRELOFF (execp), SEEK_SET) != 0) \
+ return false; \
+ if (!NAME (lynx, squirt_out_relocs) (abfd, obj_textsec (abfd))) \
+ return false; \
+ \
+ if (bfd_seek (abfd, N_DRELOFF (execp), SEEK_SET) != 0) \
+ return false; \
+ if (!NAME (lynx, squirt_out_relocs) (abfd, obj_datasec (abfd))) \
+ return false; \
+ }
#endif
#include "libaout.h"
NAME(lynx,swap_std_reloc_out) (abfd, *generic, (struct reloc_std_external *) natptr);
}
- if (bfd_bwrite (native, natsize, abfd) != natsize)
+ if (bfd_write (native, natsize, abfd) != natsize)
{
bfd_release (abfd, native);
return false;
asection *section;
bfd_size_type size;
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || (size = bfd_bread (&hdr, sizeof (hdr), abfd)) + 1 < DOS_HDR_SIZE + 1)
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0
+ || (size = bfd_read (&hdr, sizeof (hdr), abfd)) + 1 < DOS_HDR_SIZE + 1)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
|| H_GET_16 (abfd, hdr.e_cparhdr) < 4)
;
else if (bfd_seek (abfd, H_GET_32 (abfd, hdr.e_lfanew), SEEK_SET) != 0
- || bfd_bread (buffer, (bfd_size_type) 2, abfd) != 2)
+ || bfd_read (buffer, 2, abfd) != 2)
{
if (bfd_get_error () == bfd_error_system_call)
return NULL;
The program's crt0 code must relocate it to a real stack. */
H_PUT_16 (abfd, high_vma, &hdr[16]);
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || bfd_bwrite (hdr, (bfd_size_type) sizeof(hdr), abfd) != sizeof(hdr))
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0
+ || bfd_write (hdr, sizeof (hdr), abfd) != sizeof (hdr))
return false;
return true;
if (bfd_section_flags (section) & SEC_LOAD)
{
if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
- || bfd_bwrite (location, count, abfd) != count)
+ || bfd_write (location, count, abfd) != count)
return false;
}
{
bfd_byte c;
- if (bfd_bread (&c, (bfd_size_type) 1, abfd) != 1)
+ if (bfd_read (&c, 1, abfd) != 1)
{
if (bfd_get_error () != bfd_error_file_truncated)
*errorptr = true;
return EOF;
}
- return (int) (c & 0xff);
+ return c & 0xff;
}
/* Report a problem in an Intel Hex file. */
size_t bufsize;
int c;
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0)
goto error_return;
abfd->start_address = 0;
pos = bfd_tell (abfd) - 1;
/* Read the header bytes. */
- if (bfd_bread (hdr, (bfd_size_type) 8, abfd) != 8)
+ if (bfd_read (hdr, 8, abfd) != 8)
goto error_return;
for (i = 0; i < 8; i++)
chars = len * 2 + 2;
if (chars >= bufsize)
{
- buf = (bfd_byte *) bfd_realloc (buf, (bfd_size_type) chars);
+ buf = bfd_realloc (buf, chars);
if (buf == NULL)
goto error_return;
bufsize = chars;
}
- if (bfd_bread (buf, (bfd_size_type) chars, abfd) != chars)
+ if (bfd_read (buf, chars, abfd) != chars)
goto error_return;
for (i = 0; i < chars; i++)
ihex_init ();
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0)
return NULL;
- if (bfd_bread (b, (bfd_size_type) 9, abfd) != 9)
+ if (bfd_read (b, 9, abfd) != 9)
{
if (bfd_get_error () == bfd_error_file_truncated)
bfd_set_error (bfd_error_wrong_format);
know the exact format. */
BFD_ASSERT (c == ':');
- if (bfd_bread (hdr, (bfd_size_type) 8, abfd) != 8)
+ if (bfd_read (hdr, 8, abfd) != 8)
goto error_return;
len = HEX2 (hdr);
if (len * 2 > bufsize)
{
- buf = (bfd_byte *) bfd_realloc (buf, (bfd_size_type) len * 2);
+ buf = bfd_realloc (buf, len * 2);
if (buf == NULL)
goto error_return;
bufsize = len * 2;
}
- if (bfd_bread (buf, (bfd_size_type) len * 2, abfd) != len * 2)
+ if (bfd_read (buf, len * 2, abfd) != len * 2)
goto error_return;
for (i = 0; i < len; i++)
}
/* Skip the checksum. */
- if (bfd_bread (buf, (bfd_size_type) 2, abfd) != 2)
+ if (bfd_read (buf, 2, abfd) != 2)
goto error_return;
}
p[3] = '\n';
total = 9 + count * 2 + 4;
- if (bfd_bwrite (buf, (bfd_size_type) total, abfd) != total)
+ if (bfd_write (buf, total, abfd) != total)
return false;
return true;
for (i = 0; i < coreout->c_nvmap; i++)
{
- val = bfd_bread (&vmap, (bfd_size_type) sizeof vmap, abfd);
+ val = bfd_read (&vmap, sizeof vmap, abfd);
if (val != sizeof vmap)
break;
for (i = 0; i < coreout->c_nvmap; i++)
{
- val = bfd_bread (&vmap, (bfd_size_type) sizeof vmap, abfd);
+ val = bfd_read (&vmap, sizeof vmap, abfd);
if (val != sizeof vmap)
break;
struct idesc *idg, *idf, *ids;
size_t amt;
- val = bfd_bread (&coreout, (bfd_size_type) sizeof coreout, abfd);
+ val = bfd_read (&coreout, sizeof coreout, abfd);
if (val != sizeof coreout)
{
if (bfd_get_error () != bfd_error_system_call)
#endif
#ifndef WRITE_HEADERS
-#define WRITE_HEADERS(abfd, execp) \
- { \
- if (adata(abfd).magic == undecided_magic) \
- NAME (aout, adjust_sizes_and_vmas) (abfd); \
- \
- execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \
- execp->a_entry = bfd_get_start_address (abfd); \
- \
- execp->a_trsize = ((obj_textsec (abfd)->reloc_count) * \
- obj_reloc_entry_size (abfd)); \
- execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * \
- obj_reloc_entry_size (abfd)); \
- NAME (aout, swap_exec_header_out) (abfd, execp, & exec_bytes); \
- \
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 \
- || bfd_bwrite (& exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, \
- abfd) != EXEC_BYTES_SIZE) \
- return false; \
- /* Now write out reloc info, followed by syms and strings. */ \
- \
- if (bfd_get_outsymbols (abfd) != NULL \
- && bfd_get_symcount (abfd) != 0) \
- { \
- if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (execp)), SEEK_SET) != 0)\
- return false; \
- \
- if (! NAME (aout, write_syms) (abfd)) \
- return false; \
- } \
- \
- if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (execp)), SEEK_SET) != 0) \
- return false; \
- if (!NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd))) \
- return false; \
- \
- if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (execp)), SEEK_SET) != 0) \
- return false; \
- if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd))) \
- return false; \
- }
+#define WRITE_HEADERS(abfd, execp) \
+ { \
+ if (adata(abfd).magic == undecided_magic) \
+ NAME (aout, adjust_sizes_and_vmas) (abfd); \
+ \
+ execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \
+ execp->a_entry = bfd_get_start_address (abfd); \
+ \
+ execp->a_trsize = ((obj_textsec (abfd)->reloc_count) \
+ * obj_reloc_entry_size (abfd)); \
+ execp->a_drsize = ((obj_datasec (abfd)->reloc_count) \
+ * obj_reloc_entry_size (abfd)); \
+ NAME (aout, swap_exec_header_out) (abfd, execp, &exec_bytes); \
+ \
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0 \
+ || bfd_write (&exec_bytes, EXEC_BYTES_SIZE, \
+ abfd) != EXEC_BYTES_SIZE) \
+ return false; \
+ /* Now write out reloc info, followed by syms and strings. */ \
+ \
+ if (bfd_get_outsymbols (abfd) != NULL \
+ && bfd_get_symcount (abfd) != 0) \
+ { \
+ if (bfd_seek (abfd, N_SYMOFF (execp), SEEK_SET) != 0) \
+ return false; \
+ \
+ if (! NAME (aout, write_syms) (abfd)) \
+ return false; \
+ } \
+ \
+ if (bfd_seek (abfd, N_TRELOFF (execp), SEEK_SET) != 0) \
+ return false; \
+ if (!NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd))) \
+ return false; \
+ \
+ if (bfd_seek (abfd, N_DRELOFF (execp), SEEK_SET) != 0) \
+ return false; \
+ if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd))) \
+ return false; \
+ }
#endif
/* Test if a read-only section can be merged with .text. This is
mem = bfd_alloc (abfd, asize);
if (mem != NULL)
{
- if (bfd_bread (mem, rsize, abfd) == rsize)
+ if (bfd_read (mem, rsize, abfd) == rsize)
return mem;
bfd_release (abfd, mem);
}
mem = bfd_malloc (asize);
if (mem != NULL)
{
- if (bfd_bread (mem, rsize, abfd) == rsize)
+ if (bfd_read (mem, rsize, abfd) == rsize)
return mem;
free (mem);
}
bfd_write_bigendian_4byte_int (bfd *abfd, unsigned int i)
{
bfd_byte buffer[4];
- bfd_putb32 ((bfd_vma) i, buffer);
- return bfd_bwrite (buffer, (bfd_size_type) 4, abfd) == 4;
+ bfd_putb32 (i, buffer);
+ return bfd_write (buffer, 4, abfd) == 4;
}
\f
}
if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
- || bfd_bread (location, count, abfd) != count)
+ || bfd_read (location, count, abfd) != count)
return false;
return true;
return true;
if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
- || bfd_bwrite (location, count, abfd) != count)
+ || bfd_write (location, count, abfd) != count)
return false;
return true;
mem = bfd_alloc (abfd, asize);
if (mem != NULL)
{
- if (bfd_bread (mem, rsize, abfd) == rsize)
+ if (bfd_read (mem, rsize, abfd) == rsize)
return mem;
bfd_release (abfd, mem);
}
mem = bfd_malloc (asize);
if (mem != NULL)
{
- if (bfd_bread (mem, rsize, abfd) == rsize)
+ if (bfd_read (mem, rsize, abfd) == rsize)
return mem;
free (mem);
}
/* Get the pss entry from the core file */
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0)
return NULL;
amt = sizeof pss;
- if (bfd_bread ((void *) &pss, amt, abfd) != amt)
+ if (bfd_read (&pss, amt, abfd) != amt)
{
/* Too small to be a core file */
if (bfd_get_error () != bfd_error_system_call)
char pad[4] = {0,0,0,0};
unsigned int padlen = 4 - (len % 4);
- if (bfd_bwrite (pad, padlen, abfd) != padlen)
+ if (bfd_write (pad, padlen, abfd) != padlen)
return -1;
return padlen;
char pad[8] = {0};
size_t padlen = align - (len % align);
- if (bfd_bwrite (pad, padlen, abfd) != padlen)
+ if (bfd_write (pad, padlen, abfd) != padlen)
return -1;
return padlen;
bfd_h_put_32 (abfd, header->reserved, raw.reserved);
if (bfd_seek (abfd, 0, SEEK_SET) != 0
- || bfd_bwrite (&raw, size, abfd) != size)
+ || bfd_write (&raw, size, abfd) != size)
return false;
return true;
bfd_h_put_32 (abfd, (cmd->flavours[i].size / 4), raw.count);
if (bfd_seek (abfd, command->offset + offset, SEEK_SET) != 0
- || bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw))
+ || bfd_write (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
offset += cmd->flavours[i].size + sizeof (raw);
bfd_h_put_32 (abfd, cmd->name_offset, raw.str);
if (bfd_seek (abfd, command->offset + BFD_MACH_O_LC_SIZE, SEEK_SET) != 0
- || bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw))
+ || bfd_write (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
namelen = strlen (cmd->name_str) + 1;
- if (bfd_bwrite (cmd->name_str, namelen, abfd) != namelen)
+ if (bfd_write (cmd->name_str, namelen, abfd) != namelen)
return false;
if (bfd_mach_o_pad_command (abfd, namelen) < 0)
bfd_h_put_32 (abfd, cmd->compatibility_version, raw.compatibility_version);
if (bfd_seek (abfd, command->offset + BFD_MACH_O_LC_SIZE, SEEK_SET) != 0
- || bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw))
+ || bfd_write (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
namelen = strlen (cmd->name_str) + 1;
- if (bfd_bwrite (cmd->name_str, namelen, abfd) != namelen)
+ if (bfd_write (cmd->name_str, namelen, abfd) != namelen)
return false;
if (bfd_mach_o_pad_command (abfd, namelen) < 0)
bfd_h_put_64 (abfd, cmd->stacksize, raw.stacksize);
if (bfd_seek (abfd, command->offset + BFD_MACH_O_LC_SIZE, SEEK_SET) != 0
- || bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw))
+ || bfd_write (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
return true;
bfd_h_put_32 (abfd, cmd->export_size, raw.export_size);
if (bfd_seek (abfd, command->offset + BFD_MACH_O_LC_SIZE, SEEK_SET) != 0
- || bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw))
+ || bfd_write (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
if (cmd->rebase_size != 0)
if (bfd_seek (abfd, cmd->rebase_off, SEEK_SET) != 0
- || (bfd_bwrite (cmd->rebase_content, cmd->rebase_size, abfd) !=
+ || (bfd_write (cmd->rebase_content, cmd->rebase_size, abfd) !=
cmd->rebase_size))
return false;
if (cmd->bind_size != 0)
if (bfd_seek (abfd, cmd->bind_off, SEEK_SET) != 0
- || (bfd_bwrite (cmd->bind_content, cmd->bind_size, abfd) !=
+ || (bfd_write (cmd->bind_content, cmd->bind_size, abfd) !=
cmd->bind_size))
return false;
if (cmd->weak_bind_size != 0)
if (bfd_seek (abfd, cmd->weak_bind_off, SEEK_SET) != 0
- || (bfd_bwrite (cmd->weak_bind_content, cmd->weak_bind_size, abfd) !=
+ || (bfd_write (cmd->weak_bind_content, cmd->weak_bind_size, abfd) !=
cmd->weak_bind_size))
return false;
if (cmd->lazy_bind_size != 0)
if (bfd_seek (abfd, cmd->lazy_bind_off, SEEK_SET) != 0
- || (bfd_bwrite (cmd->lazy_bind_content, cmd->lazy_bind_size, abfd) !=
+ || (bfd_write (cmd->lazy_bind_content, cmd->lazy_bind_size, abfd) !=
cmd->lazy_bind_size))
return false;
if (cmd->export_size != 0)
if (bfd_seek (abfd, cmd->export_off, SEEK_SET) != 0
- || (bfd_bwrite (cmd->export_content, cmd->export_size, abfd) !=
+ || (bfd_write (cmd->export_content, cmd->export_size, abfd) !=
cmd->export_size))
return false;
pinfo);
}
- if (bfd_bwrite (&raw, BFD_MACH_O_RELENT_SIZE, abfd)
+ if (bfd_write (&raw, BFD_MACH_O_RELENT_SIZE, abfd)
!= BFD_MACH_O_RELENT_SIZE)
return false;
}
bfd_h_put_32 (abfd, section->reserved1, raw.reserved1);
bfd_h_put_32 (abfd, section->reserved2, raw.reserved2);
- if (bfd_bwrite (&raw, BFD_MACH_O_SECTION_SIZE, abfd)
+ if (bfd_write (&raw, BFD_MACH_O_SECTION_SIZE, abfd)
!= BFD_MACH_O_SECTION_SIZE)
return false;
bfd_h_put_32 (abfd, section->reserved2, raw.reserved2);
bfd_h_put_32 (abfd, section->reserved3, raw.reserved3);
- if (bfd_bwrite (&raw, BFD_MACH_O_SECTION_64_SIZE, abfd)
+ if (bfd_write (&raw, BFD_MACH_O_SECTION_64_SIZE, abfd)
!= BFD_MACH_O_SECTION_64_SIZE)
return false;
bfd_h_put_32 (abfd, seg->flags, raw.flags);
if (bfd_seek (abfd, command->offset + BFD_MACH_O_LC_SIZE, SEEK_SET) != 0
- || bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw))
+ || bfd_write (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
for (sec = seg->sect_head; sec != NULL; sec = sec->next)
bfd_h_put_32 (abfd, seg->flags, raw.flags);
if (bfd_seek (abfd, command->offset + BFD_MACH_O_LC_SIZE, SEEK_SET) != 0
- || bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw))
+ || bfd_write (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
for (sec = seg->sect_head; sec != NULL; sec = sec->next)
bfd_h_put_64 (abfd, s->symbol.section->vma + s->symbol.value,
raw.n_value);
- if (bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_write (&raw, sizeof (raw), abfd) != sizeof (raw))
goto err;
}
else
bfd_h_put_32 (abfd, s->symbol.section->vma + s->symbol.value,
raw.n_value);
- if (bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_write (&raw, sizeof (raw), abfd) != sizeof (raw))
goto err;
}
}
bfd_h_put_32 (abfd, sym->strsize, raw.strsize);
if (bfd_seek (abfd, command->offset + BFD_MACH_O_LC_SIZE, SEEK_SET) != 0
- || bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw))
+ || bfd_write (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
return true;
bfd_h_put_32 (abfd, module->objc_module_info_size,
&w.objc_module_info_size);
- if (bfd_bwrite ((void *) &w, sizeof (w), abfd) != sizeof (w))
+ if (bfd_write (&w, sizeof (w), abfd) != sizeof (w))
return false;
}
else
bfd_h_put_32 (abfd, module->objc_module_info_size,
&n.objc_module_info_size);
- if (bfd_bwrite ((void *) &n, sizeof (n), abfd) != sizeof (n))
+ if (bfd_write (&n, sizeof (n), abfd) != sizeof (n))
return false;
}
}
bfd_h_put_32 (abfd, toc->symbol_index, &raw.symbol_index);
bfd_h_put_32 (abfd, toc->module_index, &raw.module_index);
- if (bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_write (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
}
}
unsigned char raw[4];
bfd_h_put_32 (abfd, cmd->indirect_syms[i], &raw);
- if (bfd_bwrite (raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_write (raw, sizeof (raw), abfd) != sizeof (raw))
return false;
}
}
}
bfd_h_put_32 (abfd, v, raw);
- if (bfd_bwrite (raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_write (raw, sizeof (raw), abfd) != sizeof (raw))
return false;
}
}
bfd_h_put_32 (abfd, cmd->locreloff, &raw.locreloff);
bfd_h_put_32 (abfd, cmd->nlocrel, &raw.nlocrel);
- if (bfd_bwrite (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_write (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
}
bfd_h_put_32 (abfd, cmd->len, raw.cmdsize);
if (bfd_seek (abfd, cmd->offset, SEEK_SET) != 0
- || bfd_bwrite (&raw, BFD_MACH_O_LC_SIZE, abfd) != 8)
+ || bfd_write (&raw, BFD_MACH_O_LC_SIZE, abfd) != 8)
return false;
switch (cmd->type)
pos = section->filepos + offset;
if (bfd_seek (abfd, pos, SEEK_SET) != 0
- || bfd_bwrite (location, count, abfd) != count)
+ || bfd_write (location, count, abfd) != count)
return false;
return true;
/* Just read the magic number. */
if (bfd_seek (abfd, hdr_off, SEEK_SET) != 0
- || bfd_bread (raw.magic, sizeof (raw.magic), abfd) != 4)
+ || bfd_read (raw.magic, sizeof (raw.magic), abfd) != 4)
return false;
if (bfd_getb32 (raw.magic) == BFD_MACH_O_MH_MAGIC)
BFD_MACH_O_HEADER_64_SIZE : BFD_MACH_O_HEADER_SIZE;
if (bfd_seek (abfd, hdr_off, SEEK_SET) != 0
- || bfd_bread (&raw, size, abfd) != size)
+ || bfd_read (&raw, size, abfd) != size)
return false;
header->cputype = (*get32) (raw.cputype);
asection *sec;
bfd_mach_o_section *section;
- if (bfd_bread (&raw, BFD_MACH_O_SECTION_SIZE, abfd)
+ if (bfd_read (&raw, BFD_MACH_O_SECTION_SIZE, abfd)
!= BFD_MACH_O_SECTION_SIZE)
return NULL;
asection *sec;
bfd_mach_o_section *section;
- if (bfd_bread (&raw, BFD_MACH_O_SECTION_64_SIZE, abfd)
+ if (bfd_read (&raw, BFD_MACH_O_SECTION_64_SIZE, abfd)
!= BFD_MACH_O_SECTION_64_SIZE)
return NULL;
BFD_ASSERT (sym->strtab != NULL);
if (bfd_seek (abfd, symoff, SEEK_SET) != 0
- || bfd_bread (&raw, symwidth, abfd) != symwidth)
+ || bfd_read (&raw, symwidth, abfd) != symwidth)
{
_bfd_error_handler
/* xgettext:c-format */
if (command->len < sizeof (raw) + 8)
return false;
- if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
nameoff = bfd_h_get_32 (abfd, raw.str);
return false;
}
- if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
nameoff = bfd_h_get_32 (abfd, raw.name);
if (command->len < sizeof (raw) + 8)
return false;
- if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
nameoff = bfd_h_get_32 (abfd, raw.name);
if (command->len < sizeof (raw) + 8)
return false;
- if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
cmd->cksum = bfd_get_32 (abfd, raw.cksum);
if (command->len < sizeof (raw) + 8)
return false;
- if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
cmd->offset = bfd_get_32 (abfd, raw.offset);
if (command->len < sizeof (raw) + 8)
return false;
- if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
nameoff = bfd_h_get_32 (abfd, raw.name);
unsigned int count;
if (bfd_seek (abfd, command->offset + offset, SEEK_SET) != 0
- || bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ || bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
count = bfd_h_get_32 (abfd, raw.count);
while (offset != command->len)
{
if (bfd_seek (abfd, command->offset + offset, SEEK_SET) != 0
- || bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ || bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
cmd->flavours[nflavours].flavour = bfd_h_get_32 (abfd, raw.flavour);
if (command->len < sizeof (raw) + 8)
return false;
- if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
cmd->ilocalsym = bfd_h_get_32 (abfd, raw.ilocalsym);
unsigned long v;
unsigned char buf[56];
- if (bfd_bread ((void *) buf, module_len, abfd) != module_len)
+ if (bfd_read (buf, module_len, abfd) != module_len)
return false;
module->module_name_idx = bfd_h_get_32 (abfd, buf + 0);
{
bfd_mach_o_dylib_table_of_content *toc = &cmd->dylib_toc[i];
- if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
toc->symbol_index = bfd_h_get_32 (abfd, raw.symbol_index);
unsigned char raw[4];
unsigned int *is = &cmd->indirect_syms[i];
- if (bfd_bread (raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_read (raw, sizeof (raw), abfd) != sizeof (raw))
return false;
*is = bfd_h_get_32 (abfd, raw);
unsigned char raw[4];
bfd_mach_o_dylib_reference *ref = &cmd->ext_refs[i];
- if (bfd_bread (raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_read (raw, sizeof (raw), abfd) != sizeof (raw))
return false;
/* Fields isym and flags are written as bit-fields, thus we need
if (command->len < sizeof (raw) + 8)
return false;
- if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
symtab->symoff = bfd_h_get_32 (abfd, raw.symoff);
if (command->len < 16 + 8)
return false;
- if (bfd_bread (cmd->uuid, 16, abfd) != 16)
+ if (bfd_read (cmd->uuid, 16, abfd) != 16)
return false;
return true;
if (command->len < sizeof (raw) + 8)
return false;
- if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
cmd->dataoff = bfd_get_32 (abfd, raw.dataoff);
if (command->len < sizeof (raw) + 8)
return false;
- if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
off = bfd_get_32 (abfd, raw.str);
if (command->len < sizeof (raw) + 8)
return false;
- if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
cmd->rebase_off = bfd_get_32 (abfd, raw.rebase_off);
if (command->len < sizeof (raw) + 8)
return false;
- if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
cmd->version = bfd_get_32 (abfd, raw.version);
if (command->len < sizeof (raw) + 8)
return false;
- if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
cmd->cryptoff = bfd_get_32 (abfd, raw.cryptoff);
if (command->len < sizeof (raw) + 8)
return false;
- if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
cmd->cryptoff = bfd_get_32 (abfd, raw.cryptoff);
if (command->len < sizeof (raw) + 8)
return false;
- if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
cmd->entryoff = bfd_get_64 (abfd, raw.entryoff);
if (command->len < sizeof (raw) + 8)
return false;
- if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
ver = bfd_get_64 (abfd, raw.version);
if (command->len < sizeof (raw) + 8)
return false;
- if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
memcpy (cmd->data_owner, raw.data_owner, 16);
if (command->len < sizeof (raw) + 8)
return false;
- if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
cmd->platform = bfd_get_32 (abfd, raw.platform);
if (command->len < sizeof (raw) + 8)
return false;
- if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
memcpy (seg->segname, raw.segname, 16);
if (command->len < sizeof (raw) + 8)
return false;
- if (bfd_bread (&raw, sizeof (raw), abfd) != sizeof (raw))
+ if (bfd_read (&raw, sizeof (raw), abfd) != sizeof (raw))
return false;
memcpy (seg->segname, raw.segname, 16);
/* Read command type and length. */
if (bfd_seek (abfd, mdata->hdr_offset + command->offset, SEEK_SET) != 0
- || bfd_bread (&raw, BFD_MACH_O_LC_SIZE, abfd) != BFD_MACH_O_LC_SIZE)
+ || bfd_read (&raw, BFD_MACH_O_LC_SIZE, abfd) != BFD_MACH_O_LC_SIZE)
return false;
cmd = bfd_h_get_32 (abfd, raw.cmd);
unsigned char buf[4];
if (bfd_seek (abfd, thr->flavours[i].offset + 40, SEEK_SET) != 0
- || bfd_bread (buf, 4, abfd) != 4)
+ || bfd_read (buf, 4, abfd) != 4)
return false;
abfd->start_address = bfd_h_get_32 (abfd, buf);
unsigned char buf[4];
if (bfd_seek (abfd, thr->flavours[i].offset + 0, SEEK_SET) != 0
- || bfd_bread (buf, 4, abfd) != 4)
+ || bfd_read (buf, 4, abfd) != 4)
return false;
abfd->start_address = bfd_h_get_32 (abfd, buf);
unsigned char buf[8];
if (bfd_seek (abfd, thr->flavours[i].offset + 0, SEEK_SET) != 0
- || bfd_bread (buf, 8, abfd) != 8)
+ || bfd_read (buf, 8, abfd) != 8)
return false;
abfd->start_address = bfd_h_get_64 (abfd, buf);
unsigned char buf[8];
if (bfd_seek (abfd, thr->flavours[i].offset + (16 * 8), SEEK_SET) != 0
- || bfd_bread (buf, 8, abfd) != 8)
+ || bfd_read (buf, 8, abfd) != 8)
return false;
abfd->start_address = bfd_h_get_64 (abfd, buf);
ufile_ptr filesize;
if (bfd_seek (abfd, 0, SEEK_SET) != 0
- || bfd_bread (&hdr, sizeof (hdr), abfd) != sizeof (hdr))
+ || bfd_read (&hdr, sizeof (hdr), abfd) != sizeof (hdr))
goto error;
adata = bfd_alloc (abfd, sizeof (mach_o_fat_data_struct));
for (i = 0; i < adata->nfat_arch; i++)
{
struct mach_o_fat_arch_external arch;
- if (bfd_bread (&arch, sizeof (arch), abfd) != sizeof (arch))
+ if (bfd_read (&arch, sizeof (arch), abfd) != sizeof (arch))
goto error;
adata->archentries[i].cputype = bfd_getb32 (arch.cputype);
adata->archentries[i].cpusubtype = bfd_getb32 (arch.cpusubtype);
return -1;
}
- nread = bfd_bread (buf, size, abfd);
+ nread = bfd_read (buf, size, abfd);
if (nread != size)
{
memcpy (contents + offset, pad, len);
offset += len;
}
- else if (bfd_bwrite (pad, len, abfd) != len)
+ else if (bfd_write (pad, len, abfd) != len)
goto err;
off += len;
}
memcpy (contents + offset, str, len);
offset += len;
}
- else if (bfd_bwrite (str, len, abfd) != len)
+ else if (bfd_write (str, len, abfd) != len)
goto err;
off += len;
BFD_ASSERT (off <= pad_len);
if (contents)
memcpy (contents + offset, pad, off);
- else if (bfd_bwrite (pad, off, abfd) != off)
+ else if (bfd_write (pad, off, abfd) != off)
goto err;
}
mmo_init ();
if (bfd_stat (abfd, &statbuf) < 0
- || bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || bfd_bread (b, 4, abfd) != 4)
+ || bfd_seek (abfd, 0, SEEK_SET) != 0
+ || bfd_read (b, 4, abfd) != 4)
goto bad_final;
/* All mmo files are a multiple of four bytes long.
goto bad_format;
/* Get the last 32-bit word. */
- if (bfd_seek (abfd, (file_ptr) statbuf.st_size - 4, SEEK_SET) != 0
- || bfd_bread (b, 4, abfd) != 4)
+ if (bfd_seek (abfd, statbuf.st_size - 4, SEEK_SET) != 0
+ || bfd_read (b, 4, abfd) != 4)
goto bad_final;
/* Check if the file ends in a lop_end lopcode. */
bfd_put_32 (abfd, value, buf);
- if (bfd_bwrite (buf, 4, abfd) != 4)
+ if (bfd_write (buf, 4, abfd) != 4)
abfd->tdata.mmo_data->have_error = true;
}
retval = (retval
&& ! mmop->have_error
- && 4 == bfd_bwrite (loc, 4, abfd));
+ && 4 == bfd_write (loc, 4, abfd));
loc += 4;
len -= 4;
orig_pos = bfd_tell (abfd);
/* Read the length (in 32-bit words). */
- if (bfd_bread (buf, 4, abfd) != 4)
+ if (bfd_read (buf, 4, abfd) != 4)
goto format_error;
if (buf[0] == LOP)
if (buf[1] != LOP_QUOTE)
goto format_error;
- if (bfd_bread (buf, 4, abfd) != 4)
+ if (bfd_read (buf, 4, abfd) != 4)
goto format_error;
}
for (i = 0; i < secname_length / 4; i++)
{
- if (bfd_bread (secname + i * 4, 4, abfd) != 4)
+ if (bfd_read (secname + i * 4, 4, abfd) != 4)
goto format_error_free;
if (secname[i * 4] == (char) LOP)
/* A bit of overkill, but we handle char 0x98 in a section name,
and recognize misparsing. */
if (secname[i * 4 + 1] != LOP_QUOTE
- || bfd_bread (secname + i * 4, 4, abfd) != 4)
+ || bfd_read (secname + i * 4, 4, abfd) != 4)
/* Whoops. We thought this was a name, and now we found a
non-lop_quote lopcode before we parsed the whole length of
the name. Signal end-of-file in the same manner. */
}
/* Get the section flags. */
- if (bfd_bread (buf, 4, abfd) != 4
+ if (bfd_read (buf, 4, abfd) != 4
|| (buf[0] == LOP
- && (buf[1] != LOP_QUOTE || bfd_bread (buf, 4, abfd) != 4)))
+ && (buf[1] != LOP_QUOTE || bfd_read (buf, 4, abfd) != 4)))
goto format_error_free;
flags = bfd_get_32 (abfd, buf);
/* Get the section length. */
- if (bfd_bread (buf, 4, abfd) != 4
+ if (bfd_read (buf, 4, abfd) != 4
|| (buf[0] == LOP
- && (buf[1] != LOP_QUOTE || bfd_bread (buf, 4, abfd) != 4)))
+ && (buf[1] != LOP_QUOTE || bfd_read (buf, 4, abfd) != 4)))
goto format_error_free;
section_length = (bfd_vma) bfd_get_32 (abfd, buf) << 32;
/* That's the first, high-part. Now get the low part. */
- if (bfd_bread (buf, 4, abfd) != 4
+ if (bfd_read (buf, 4, abfd) != 4
|| (buf[0] == LOP
- && (buf[1] != LOP_QUOTE || bfd_bread (buf, 4, abfd) != 4)))
+ && (buf[1] != LOP_QUOTE || bfd_read (buf, 4, abfd) != 4)))
goto format_error_free;
section_length |= (bfd_vma) bfd_get_32 (abfd, buf);
goto format_error_free;
/* Get the section VMA. */
- if (bfd_bread (buf, 4, abfd) != 4
+ if (bfd_read (buf, 4, abfd) != 4
|| (buf[0] == LOP
- && (buf[1] != LOP_QUOTE || bfd_bread (buf, 4, abfd) != 4)))
+ && (buf[1] != LOP_QUOTE || bfd_read (buf, 4, abfd) != 4)))
goto format_error_free;
section_vma = (bfd_vma) bfd_get_32 (abfd, buf) << 32;
/* That's the first, high-part. Now get the low part. */
- if (bfd_bread (buf, 4, abfd) != 4
+ if (bfd_read (buf, 4, abfd) != 4
|| (buf[0] == LOP
- && (buf[1] != LOP_QUOTE || bfd_bread (buf, 4, abfd) != 4)))
+ && (buf[1] != LOP_QUOTE || bfd_read (buf, 4, abfd) != 4)))
goto format_error_free;
section_vma |= (bfd_vma) bfd_get_32 (abfd, buf);
if (abfd->tdata.mmo_data->byte_no == 0)
{
if (!abfd->tdata.mmo_data->have_error
- && bfd_bread (abfd->tdata.mmo_data->buf, 4, abfd) != 4)
+ && bfd_read (abfd->tdata.mmo_data->buf, 4, abfd) != 4)
abfd->tdata.mmo_data->have_error = true;
/* A value somewhat safe against tripping on some inconsistency
if ((abfd->tdata.mmo_data->byte_no % 4) == 0)
{
if (! abfd->tdata.mmo_data->have_error
- && bfd_bwrite (abfd->tdata.mmo_data->buf, 4, abfd) != 4)
+ && bfd_write (abfd->tdata.mmo_data->buf, 4, abfd) != 4)
abfd->tdata.mmo_data->have_error = true;
}
}
abfd->symcount = 0;
memset (file_names, 0, sizeof (file_names));
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0)
goto error_return;
- while ((nbytes_read = bfd_bread (buf, 4, abfd)) == 4)
+ while ((nbytes_read = bfd_read (buf, 4, abfd)) == 4)
{
if (buf[0] == LOP)
{
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
- if (bfd_bread (buf, 4, abfd) != 4)
+ if (bfd_read (buf, 4, abfd) != 4)
goto error_return;
vma &= ~3;
if (z == 1)
{
/* Get a 32-bit value. */
- if (bfd_bread (buf, 4, abfd) != 4)
+ if (bfd_read (buf, 4, abfd) != 4)
goto error_return;
vma += bfd_get_32 (abfd, buf);
else if (z == 2)
{
/* Get a 64-bit value. */
- if (bfd_bread (buf, 8, abfd) != 8)
+ if (bfd_read (buf, 8, abfd) != 8)
goto error_return;
vma += bfd_get_64 (abfd, buf);
if (z == 1)
{
/* Get a 32-bit value. */
- if (bfd_bread (buf, 4, abfd) != 4)
+ if (bfd_read (buf, 4, abfd) != 4)
goto error_return;
p += bfd_get_32 (abfd, buf);
else if (z == 2)
{
/* Get a 64-bit value. */
- if (bfd_bread (buf, 8, abfd) != 8)
+ if (bfd_read (buf, 8, abfd) != 8)
goto error_return;
p += bfd_get_64 (abfd, buf);
}
/* Get the next 32-bit value. */
- if (bfd_bread (buf, 4, abfd) != 4)
+ if (bfd_read (buf, 4, abfd) != 4)
goto error_return;
delta = bfd_get_32 (abfd, buf);
for (i = 0; i < z; i++)
{
- if (bfd_bread (fname + i * 4, 4, abfd) != 4)
+ if (bfd_read (fname + i * 4, 4, abfd) != 4)
{
free (fname);
goto error_return;
creation time from the first 32-bit word with the time
in seconds since era. */
if (z >= 1
- && bfd_bread (abfd->tdata.mmo_data->created, 4,
+ && bfd_read (abfd->tdata.mmo_data->created, 4,
abfd) != 4)
goto error_return;
for (i = 1; i < z; i++)
- if (bfd_bread (buf, 4, abfd) != 4)
+ if (bfd_read (buf, 4, abfd) != 4)
goto error_return;
}
break;
/* Read first octaword outside loop to simplify logic when
excluding the Z == 255, octa == 0 case. */
- if (bfd_bread (buf, 8, abfd) != 8)
+ if (bfd_read (buf, 8, abfd) != 8)
goto error_return;
first_octa = bfd_get_64 (abfd, buf);
for (i = z + 1; i < 255; i++)
{
- if (bfd_bread (loc + (i - z) * 8, 8, abfd) != 8)
+ if (bfd_read (loc + (i - z) * 8, 8, abfd) != 8)
goto error_return;
}
/* Read out the last octabyte, and use it to set the
start address. */
- if (bfd_bread (buf, 8, abfd) != 8)
+ if (bfd_read (buf, 8, abfd) != 8)
goto error_return;
startaddr_octa = bfd_get_64 (abfd, buf);
{
const char lop_pre_bfd[] = { LOP, LOP_PRE, 1, 1};
- if (bfd_bwrite (lop_pre_bfd, 4, abfd) != 4)
+ if (bfd_write (lop_pre_bfd, 4, abfd) != 4)
return false;
/* Copy creation time of original file. */
- if (bfd_bwrite (abfd->tdata.mmo_data->created, 4, abfd) != 4)
+ if (bfd_write (abfd->tdata.mmo_data->created, 4, abfd) != 4)
return false;
return true;
{
bfd_byte *data = mmo_get_loc (sec, i * 8, 8);
- if (bfd_bwrite (data, 8, abfd) != 8)
+ if (bfd_write (data, 8, abfd) != 8)
return false;
}
Z == 255, don't assume DATA is valid. */
bfd_put_64 (abfd, bfd_get_start_address (abfd), buf);
- return ! abfd->tdata.mmo_data->have_error && bfd_bwrite (buf, 8, abfd) == 8;
+ return ! abfd->tdata.mmo_data->have_error && bfd_write (buf, 8, abfd) == 8;
}
/* Translate to and from BFD flags. This is to make sure that we don't
/* Put out the lop_stab mark. */
bfd_put_32 (abfd, (LOP << 24) | (LOP_STAB << 16), buf);
- if (bfd_bwrite (buf, 4, abfd) != 4)
+ if (bfd_write (buf, 4, abfd) != 4)
return false;
/* Dump out symbols. */
0, 4 - (abfd->tdata.mmo_data->byte_no % 4));
if (abfd->tdata.mmo_data->have_error
- || bfd_bwrite (abfd->tdata.mmo_data->buf, 4, abfd) != 4)
+ || bfd_write (abfd->tdata.mmo_data->buf, 4, abfd) != 4)
return false;
}
bfd_put_32 (abfd, (LOP << 24) | (LOP_END << 16) | trie_len, buf);
- return bfd_bwrite (buf, 4, abfd) == 4;
+ return bfd_write (buf, 4, abfd) == 4;
}
/* Write section unless it is the register contents section. For that, we
struct coreseg coreseg;
size_t amt = sizeof core;
- val = bfd_bread (&core, amt, abfd);
+ val = bfd_read (&core, amt, abfd);
if (val != sizeof core)
{
/* Too small to be a core file. */
if (bfd_seek (abfd, offset, SEEK_SET) != 0)
goto punt;
- val = bfd_bread (&coreseg, sizeof coreseg, abfd);
+ val = bfd_read (&coreseg, sizeof coreseg, abfd);
if (val != sizeof coreseg)
{
bfd_set_error (bfd_error_file_truncated);
if (bim == NULL)
return false; /* bfd_error already set. */
abfd->iostream = bim;
- /* bfd_bwrite will grow these as needed. */
+ /* bfd_write will grow these as needed. */
bim->size = 0;
bim->buffer = 0;
size_t amt;
amt = sizeof core_header;
- val = bfd_bread (& core_header, amt, abfd);
+ val = bfd_read (& core_header, amt, abfd);
if (val != sizeof core_header)
return NULL;
flagword flags;
amt = sizeof core_scnhdr;
- val = bfd_bread (& core_scnhdr, amt, abfd);
+ val = bfd_read (& core_scnhdr, amt, abfd);
if (val != sizeof core_scnhdr)
break;
int ret;
char magic[sizeof (pdb_magic)];
- ret = bfd_bread (magic, sizeof (magic), abfd);
+ ret = bfd_read (magic, sizeof (magic), abfd);
if (ret != sizeof (magic))
{
bfd_set_error (bfd_error_wrong_format);
if (bfd_seek (abfd, sizeof (pdb_magic), SEEK_SET))
return NULL;
- if (bfd_bread (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t))
+ if (bfd_read (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t))
{
bfd_set_error (bfd_error_malformed_archive);
return NULL;
if (bfd_seek (abfd, 4 * sizeof (uint32_t), SEEK_CUR))
return NULL;
- if (bfd_bread (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t))
+ if (bfd_read (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t))
{
bfd_set_error (bfd_error_malformed_archive);
return NULL;
if (bfd_seek (abfd, block_map_addr * block_size, SEEK_SET))
return NULL;
- if (bfd_bread (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t))
+ if (bfd_read (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t))
{
bfd_set_error (bfd_error_malformed_archive);
return NULL;
if (bfd_seek (abfd, first_dir_block * block_size, SEEK_SET))
return NULL;
- if (bfd_bread (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t))
+ if (bfd_read (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t))
{
bfd_set_error (bfd_error_malformed_archive);
return NULL;
SEEK_SET))
return NULL;
- if (bfd_bread (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t))
+ if (bfd_read (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t))
{
bfd_set_error (bfd_error_malformed_archive);
return NULL;
SEEK_SET))
return NULL;
- if (bfd_bread (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t))
+ if (bfd_read (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t))
{
bfd_set_error (bfd_error_malformed_archive);
return NULL;
SEEK_SET))
goto fail;
- if (bfd_bread (int_buf, sizeof (uint32_t), abfd) !=
+ if (bfd_read (int_buf, sizeof (uint32_t), abfd) !=
sizeof (uint32_t))
{
bfd_set_error (bfd_error_malformed_archive);
goto fail;
}
- if (bfd_bread (int_buf, sizeof (uint32_t), abfd) !=
+ if (bfd_read (int_buf, sizeof (uint32_t), abfd) !=
sizeof (uint32_t))
{
bfd_set_error (bfd_error_malformed_archive);
SEEK_SET))
goto fail;
- if (bfd_bread (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t))
+ if (bfd_read (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t))
{
bfd_set_error (bfd_error_malformed_archive);
goto fail;
SEEK_SET))
goto fail2;
- if (bfd_bread (int_buf, sizeof (uint32_t), abfd) !=
+ if (bfd_read (int_buf, sizeof (uint32_t), abfd) !=
sizeof (uint32_t))
{
bfd_set_error (bfd_error_malformed_archive);
SEEK_SET))
goto fail2;
- if (bfd_bread (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t))
+ if (bfd_read (int_buf, sizeof (uint32_t), abfd) != sizeof (uint32_t))
{
bfd_set_error (bfd_error_malformed_archive);
goto fail2;
to_read = left > block_size ? block_size : left;
- if (bfd_bread (buf, to_read, abfd) != to_read)
+ if (bfd_read (buf, to_read, abfd) != to_read)
{
bfd_set_error (bfd_error_malformed_archive);
goto fail2;
}
- if (bfd_bwrite (buf, to_read, file) != to_read)
+ if (bfd_write (buf, to_read, file) != to_read)
goto fail2;
if (left > block_size)
bfd_putl32 (block, tmp);
- if (bfd_bwrite (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t))
+ if (bfd_write (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t))
return false;
block_map_off = sizeof (uint32_t);
bfd_putl32 (num_files, tmp);
- if (bfd_bwrite (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t))
+ if (bfd_write (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t))
return false;
left -= sizeof (uint32_t);
bfd_putl32 (block, tmp);
- if (bfd_bwrite (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t))
+ if (bfd_write (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t))
return false;
block_map_off += sizeof (uint32_t);
bfd_putl32 (bfd_get_size (arelt), tmp);
- if (bfd_bwrite (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t))
+ if (bfd_write (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t))
return false;
left -= sizeof (uint32_t);
bfd_putl32 (block, tmp);
- if (bfd_bwrite (tmp, sizeof (uint32_t), abfd) !=
+ if (bfd_write (tmp, sizeof (uint32_t), abfd) !=
sizeof (uint32_t))
{
free (buf);
bfd_putl32 (file_block, tmp);
- if (bfd_bwrite (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t))
+ if (bfd_write (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t))
{
free (buf);
return false;
to_read = size > block_size ? block_size : size;
- if (bfd_bread (buf, to_read, arelt) != to_read)
+ if (bfd_read (buf, to_read, arelt) != to_read)
{
free (buf);
return false;
/* Write file contents into allocated block. */
- if (bfd_bwrite (buf, block_size, abfd) != block_size)
+ if (bfd_write (buf, block_size, abfd) != block_size)
{
free (buf);
return false;
memset (buf, 0, left);
- if (bfd_bwrite (buf, left, abfd) != left)
+ if (bfd_write (buf, left, abfd) != left)
{
free (buf);
return false;
else
num_blocks -= block_size * 8;
- if (bfd_bwrite (buf, block_size, abfd) != block_size)
+ if (bfd_write (buf, block_size, abfd) != block_size)
return false;
}
uint32_t num_directory_bytes = sizeof (uint32_t);
bfd *arelt;
- if (bfd_bwrite (pdb_magic, sizeof (pdb_magic), abfd) != sizeof (pdb_magic))
+ if (bfd_write (pdb_magic, sizeof (pdb_magic), abfd) != sizeof (pdb_magic))
return false;
bfd_putl32 (block_size, tmp);
- if (bfd_bwrite (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t))
+ if (bfd_write (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t))
return false;
bfd_putl32 (1, tmp); /* Free block map block (always either 1 or 2). */
- if (bfd_bwrite (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t))
+ if (bfd_write (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t))
return false;
arelt = abfd->archive_head;
bfd_putl32 (num_directory_bytes, tmp);
- if (bfd_bwrite (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t))
+ if (bfd_write (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t))
return false;
/* Skip unknown uint32_t (always 0?). */
bfd_putl32 (block_map_addr, tmp);
- if (bfd_bwrite (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t))
+ if (bfd_write (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t))
return false;
if (!pdb_write_directory
bfd_putl32 (num_blocks, tmp);
- if (bfd_bwrite (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t))
+ if (bfd_write (tmp, sizeof (uint32_t), abfd) != sizeof (uint32_t))
return false;
return true;
NAME (aout, swap_exec_header_out) (abfd, execp, & exec_bytes);
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0)
return false;
- if (bfd_bwrite ((void *) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, abfd)
- != EXEC_BYTES_SIZE)
+ if (bfd_write (&exec_bytes, EXEC_BYTES_SIZE, abfd) != EXEC_BYTES_SIZE)
return false;
/* Now write out reloc info, followed by syms and strings. */
if (bfd_get_outsymbols (abfd) != NULL
&& bfd_get_symcount (abfd) != 0)
{
- if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (execp)), SEEK_SET) != 0)
+ if (bfd_seek (abfd, N_SYMOFF (execp), SEEK_SET) != 0)
return false;
if (! NAME (aout, write_syms) (abfd))
if (obj_textsec (abfd)->reloc_count > 0
|| obj_datasec (abfd)->reloc_count > 0)
{
- if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (execp)), SEEK_SET) != 0
+ if (bfd_seek (abfd, N_TRELOFF (execp), SEEK_SET) != 0
|| !NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd))
- || bfd_seek (abfd, (file_ptr) (N_DRELOFF (execp)), SEEK_SET) != 0
+ || bfd_seek (abfd, N_DRELOFF (execp), SEEK_SET) != 0
|| !NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd)))
return false;
}
if (count != 0)
{
if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
- || bfd_bwrite (location, count, abfd) != count)
+ || bfd_write (location, count, abfd) != count)
return false;
}
/* Get the size of the strings. */
if (bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET) != 0
- || bfd_bread ((void *) string_chars, amt, abfd) != amt)
+ || bfd_read (string_chars, amt, abfd) != amt)
return false;
stringsize = H_GET_32 (abfd, string_chars);
if (stringsize == 0)
if (stringsize >= BYTES_IN_LONG)
{
amt = stringsize - BYTES_IN_LONG;
- if (bfd_bread (strings + BYTES_IN_LONG, amt, abfd) != amt)
+ if (bfd_read (strings + BYTES_IN_LONG, amt, abfd) != amt)
{
free (strings);
return false;
/* The string table starts with the size. */
H_PUT_32 (abfd, _bfd_stringtab_size (tab) + BYTES_IN_LONG, buffer);
- if (bfd_bwrite ((void *) buffer, (bfd_size_type) BYTES_IN_LONG, abfd)
- != BYTES_IN_LONG)
+ if (bfd_write (buffer, BYTES_IN_LONG, abfd) != BYTES_IN_LONG)
return false;
return _bfd_stringtab_emit (abfd, tab);
if (! translate_to_native_sym_flags (abfd, g, &nsp))
goto error_return;
- if (bfd_bwrite ((void *)&nsp, (bfd_size_type) EXTERNAL_NLIST_SIZE, abfd)
- != EXTERNAL_NLIST_SIZE)
+ if (bfd_write (&nsp, EXTERNAL_NLIST_SIZE, abfd) != EXTERNAL_NLIST_SIZE)
goto error_return;
/* NB: `KEEPIT' currently overlays `udata.p', so set this only
}
}
- if (bfd_bwrite ((void *) native, natsize, abfd) != natsize)
+ if (bfd_write (native, natsize, abfd) != natsize)
{
bfd_release (abfd, native);
return false;
amt = EXTERNAL_NLIST_SIZE;
if (bfd_seek (output_bfd, flaginfo->symoff, SEEK_SET) != 0
- || bfd_bwrite ((void *) &outsym, amt, output_bfd) != amt)
+ || bfd_write (&outsym, amt, output_bfd) != amt)
/* FIXME: No way to handle errors. */
abort ();
rel_size = obj_reloc_entry_size (flaginfo->output_bfd);
if (bfd_seek (flaginfo->output_bfd, *reloff_ptr, SEEK_SET) != 0
- || bfd_bwrite (rel_ptr, rel_size, flaginfo->output_bfd) != rel_size)
+ || bfd_write (rel_ptr, rel_size, flaginfo->output_bfd) != rel_size)
return false;
*reloff_ptr += rel_size;
if (rel_size > 0)
{
if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0
- || bfd_bread (relocs, rel_size, input_bfd) != rel_size)
+ || bfd_read (relocs, rel_size, input_bfd) != rel_size)
return false;
}
}
{
if (bfd_seek (flaginfo->output_bfd, *reloff_ptr, SEEK_SET) != 0)
return false;
- if (bfd_bwrite (relocs, rel_size, flaginfo->output_bfd) != rel_size)
+ if (bfd_write (relocs, rel_size, flaginfo->output_bfd) != rel_size)
return false;
*reloff_ptr += rel_size;
bfd_byte b = 0;
if (bfd_seek (abfd, pos - 1, SEEK_SET) != 0
- || bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1)
+ || bfd_write (&b, 1, abfd) != 1)
goto error_return;
}
}
return false;
size = outsym - flaginfo->output_syms;
size *= EXTERNAL_NLIST_SIZE;
- if (bfd_bwrite ((void *) flaginfo->output_syms, size, output_bfd) != size)
+ if (bfd_write (flaginfo->output_syms, size, output_bfd) != size)
return false;
flaginfo->symoff += size;
}
return NULL;
if (length > 256)
length = 256;
- nread = bfd_bread (buffer, length, abfd);
+ nread = bfd_read (buffer, length, abfd);
if (length != nread)
return NULL;
else
memcpy (cvinfo70->PdbFileName, pdb, pdb_len + 1);
- written = bfd_bwrite (buffer, size, abfd);
+ written = bfd_write (buffer, size, abfd);
free (buffer);
unsigned char buf[28];
bfd_seek (abfd, section->header_offset, SEEK_SET);
- if (bfd_bread ((void *) buf, 28, abfd) != 28)
+ if (bfd_read (buf, 28, abfd) != 28)
return -1;
section->name_offset = bfd_h_get_32 (abfd, buf);
bfd_seek (abfd, 0, SEEK_SET);
- if (bfd_bread ((void *) buf, 40, abfd) != 40)
+ if (bfd_read (buf, 40, abfd) != 40)
return -1;
header->tag1 = bfd_getb32 (buf);
bfd_seek (abfd, 0, SEEK_SET);
- if (bfd_bread ((void *) buf, sizeof buf, abfd) != sizeof buf)
+ if (bfd_read (buf, sizeof buf, abfd) != sizeof buf)
return -1;
header->tag1 = bfd_getb32 (buf);
/* Upon entry the first six bytes of the ILF header have
already been read. Now read the rest of the header. */
- if (bfd_bread (buffer, (bfd_size_type) 14, abfd) != 14)
+ if (bfd_read (buffer, 14, abfd) != 14)
return NULL;
ptr = buffer;
/* Detect if this a Microsoft Import Library Format element. */
/* First read the beginning of the header. */
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || bfd_bread (buffer, (bfd_size_type) 6, abfd) != 6)
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0
+ || bfd_read (buffer, 6, abfd) != 6)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
&& H_GET_16 (abfd, buffer + 4) == 0)
return pe_ILF_object_p (abfd);
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || bfd_bread (&dos_hdr, (bfd_size_type) sizeof (dos_hdr), abfd)
- != sizeof (dos_hdr))
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0
+ || bfd_read (&dos_hdr, sizeof (dos_hdr), abfd) != sizeof (dos_hdr))
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
offset = H_GET_32 (abfd, dos_hdr.e_lfanew);
if (bfd_seek (abfd, offset, SEEK_SET) != 0
- || (bfd_bread (&image_hdr, (bfd_size_type) sizeof (image_hdr), abfd)
- != sizeof (image_hdr)))
+ || bfd_read (&image_hdr, sizeof (image_hdr), abfd) != sizeof (image_hdr))
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
return NULL;
}
- if (bfd_bread (&hdr, (bfd_size_type) sizeof (hdr), abfd)
- != sizeof (hdr))
+ if (bfd_read (&hdr, sizeof (hdr), abfd) != sizeof (hdr))
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
file_ptr offset,
bfd_size_type count)
{
- if (bfd_seek (abfd, offset + (file_ptr) sizeof (ppcboot_hdr_t), SEEK_SET) != 0
- || bfd_bread (location, count, abfd) != count)
+ if (bfd_seek (abfd, offset + sizeof (ppcboot_hdr_t), SEEK_SET) != 0
+ || bfd_read (location, count, abfd) != count)
return false;
return true;
}
size_t amt;
flagword flags;
- val = bfd_bread ((void *)&u, (bfd_size_type) sizeof u, abfd);
+ val = bfd_read (&u, sizeof u, abfd);
if (val != sizeof u || u.pt_magic != _BCS_PTRACE_MAGIC
|| u.pt_rev != _BCS_PTRACE_REV)
{
{
bfd_size_type size;
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0)
return false;
/* Read the leading portion that old and new core dump structures have in
common. */
size = CORE_COMMONSZ;
- if (bfd_bread (core, size, abfd) != size)
+ if (bfd_read (core, size, abfd) != size)
return false;
/* Read the trailing portion of the structure. */
size = sizeof (core->old);
#endif
size -= CORE_COMMONSZ;
- return bfd_bread ((char *) core + CORE_COMMONSZ, size, abfd) == size;
+ return bfd_read ((char *) core + CORE_COMMONSZ, size, abfd) == size;
}
static asection *
{
if (bfd_seek (abfd, c_loader, SEEK_SET) != 0)
goto fail;
- if (bfd_bread (&ldinfo, size, abfd) != size)
+ if (bfd_read (&ldinfo, size, abfd) != size)
goto fail;
if (proc64)
#else
size = sizeof (vminfo.new_dump);
#endif
- if (bfd_bread (&vminfo, size, abfd) != size)
+ if (bfd_read (&vminfo, size, abfd) != size)
goto fail;
if (CORE_NEW (core))
while (1)
{
- if (bfd_bread (s, (bfd_size_type) 1, core_bfd) != 1)
+ if (bfd_read (s, 1, core_bfd) != 1)
{
free (path);
return false;
SEEK_SET) != 0)
goto error_return;
amt = sizeof ext_space;
- if (bfd_bread (&ext_space, amt, abfd) != amt)
+ if (bfd_read (&ext_space, amt, abfd) != amt)
goto error_return;
som_swap_space_dictionary_in (&ext_space, &space);
SEEK_SET) != 0)
goto error_return;
amt = sizeof ext_subspace;
- if (bfd_bread (&ext_subspace, amt, abfd) != amt)
+ if (bfd_read (&ext_subspace, amt, abfd) != amt)
goto error_return;
/* Seek back to the start of the subspaces for loop below. */
if (bfd_seek (abfd,
/* Read in the next subspace. */
amt = sizeof ext_subspace;
- if (bfd_bread (&ext_subspace, amt, abfd) != amt)
+ if (bfd_read (&ext_subspace, amt, abfd) != amt)
goto error_return;
som_swap_subspace_dictionary_in (&ext_subspace, &subspace);
#define ENTRY_SIZE sizeof (struct som_external_som_entry)
amt = sizeof (struct som_external_header);
- if (bfd_bread (&ext_file_hdr, amt, abfd) != amt)
+ if (bfd_read (&ext_file_hdr, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
case EXECLIBMAGIC:
/* Read the lst header and determine where the SOM directory begins. */
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
}
amt = sizeof (struct som_external_lst_header);
- if (bfd_bread (&ext_lst_header, amt, abfd) != amt)
+ if (bfd_read (&ext_lst_header, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
}
amt = ENTRY_SIZE;
- if (bfd_bread (&ext_som_entry, amt, abfd) != amt)
+ if (bfd_read (&ext_som_entry, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
/* And finally, re-read the som header. */
amt = sizeof (struct som_external_header);
- if (bfd_bread (&ext_file_hdr, amt, abfd) != amt)
+ if (bfd_read (&ext_file_hdr, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
if (aux_hdr_ptr == NULL)
return NULL;
amt = sizeof (struct som_external_exec_auxhdr);
- if (bfd_bread (&ext_exec_auxhdr, amt, abfd) != amt)
+ if (bfd_read (&ext_exec_auxhdr, amt, abfd) != amt)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
if (p - tmp_space + 512 > SOM_TMP_BUFSIZE)
{
amt = p - tmp_space;
- if (bfd_bwrite ((void *) tmp_space, amt, abfd) != amt)
+ if (bfd_write (tmp_space, amt, abfd) != amt)
return false;
p = tmp_space;
/* Scribble out the relocations. */
amt = p - tmp_space;
- if (bfd_bwrite ((void *) tmp_space, amt, abfd) != amt)
+ if (bfd_write (tmp_space, amt, abfd) != amt)
return false;
p = tmp_space;
/* Seek to the start of the space strings in preparation for writing
them out. */
- if (bfd_seek (abfd, (file_ptr) current_offset, SEEK_SET) != 0)
+ if (bfd_seek (abfd, current_offset, SEEK_SET) != 0)
return false;
/* Walk through all the spaces and subspaces (order is not important)
{
/* Flush buffer before refilling or reallocating. */
amt = p - tmp_space;
- if (bfd_bwrite ((void *) &tmp_space[0], amt, abfd) != amt)
+ if (bfd_write (&tmp_space[0], amt, abfd) != amt)
return false;
/* Reallocate if now empty buffer still too small. */
/* Done with the space/subspace strings. Write out any information
contained in a partial block. */
amt = p - tmp_space;
- res = bfd_bwrite ((void *) &tmp_space[0], amt, abfd);
+ res = bfd_write (&tmp_space[0], amt, abfd);
free (tmp_space);
if (res != amt)
return false;
/* Seek to the start of the space strings in preparation for writing
them out. */
- if (bfd_seek (abfd, (file_ptr) current_offset, SEEK_SET) != 0)
+ if (bfd_seek (abfd, current_offset, SEEK_SET) != 0)
return false;
if (compilation_unit)
{
/* Flush buffer before refilling or reallocating. */
amt = p - tmp_space;
- if (bfd_bwrite ((void *) &tmp_space[0], amt, abfd) != amt)
+ if (bfd_write (tmp_space, amt, abfd) != amt)
return false;
/* Reallocate if now empty buffer still too small. */
{
/* Flush buffer before refilling or reallocating. */
amt = p - tmp_space;
- if (bfd_bwrite ((void *) &tmp_space[0], amt, abfd) != amt)
+ if (bfd_write (tmp_space, amt, abfd) != amt)
return false;
/* Reallocate if now empty buffer still too small. */
/* Scribble out any partial block. */
amt = p - tmp_space;
- res = bfd_bwrite ((void *) &tmp_space[0], amt, abfd);
+ res = bfd_write (tmp_space, amt, abfd);
free (tmp_space);
if (res != amt)
return false;
struct som_external_string_auxhdr ext_string_auxhdr;
bfd_size_type len;
- if (bfd_seek (abfd, (file_ptr) current_offset, SEEK_SET) != 0)
+ if (bfd_seek (abfd, current_offset, SEEK_SET) != 0)
return false;
/* Write the aux_id structure and the string length. */
current_offset += len;
som_swap_string_auxhdr_out
(obj_som_version_hdr (abfd), &ext_string_auxhdr);
- if (bfd_bwrite (&ext_string_auxhdr, len, abfd) != len)
+ if (bfd_write (&ext_string_auxhdr, len, abfd) != len)
return false;
/* Write the version string. */
len = obj_som_version_hdr (abfd)->header_id.length - 4;
obj_som_file_hdr (abfd)->aux_header_size += len;
current_offset += len;
- if (bfd_bwrite ((void *) obj_som_version_hdr (abfd)->string, len, abfd)
- != len)
+ if (bfd_write (obj_som_version_hdr (abfd)->string, len, abfd) != len)
return false;
}
struct som_external_string_auxhdr ext_string_auxhdr;
bfd_size_type len;
- if (bfd_seek (abfd, (file_ptr) current_offset, SEEK_SET) != 0)
+ if (bfd_seek (abfd, current_offset, SEEK_SET) != 0)
return false;
/* Write the aux_id structure and the string length. */
current_offset += len;
som_swap_string_auxhdr_out
(obj_som_copyright_hdr (abfd), &ext_string_auxhdr);
- if (bfd_bwrite (&ext_string_auxhdr, len, abfd) != len)
+ if (bfd_write (&ext_string_auxhdr, len, abfd) != len)
return false;
/* Write the copyright string. */
len = obj_som_copyright_hdr (abfd)->header_id.length - 4;
obj_som_file_hdr (abfd)->aux_header_size += len;
current_offset += len;
- if (bfd_bwrite ((void *) obj_som_copyright_hdr (abfd)->string, len, abfd)
- != len)
+ if (bfd_write (obj_som_copyright_hdr (abfd)->string, len, abfd) != len)
return false;
}
zeros are filled in. Ugh. */
if (abfd->flags & (EXEC_P | DYNAMIC))
current_offset = SOM_ALIGN (current_offset, PA_PAGESIZE);
- if (bfd_seek (abfd, (file_ptr) current_offset - 1, SEEK_SET) != 0)
+ if (bfd_seek (abfd, current_offset - 1, SEEK_SET) != 0)
return false;
- if (bfd_bwrite ((void *) "", (bfd_size_type) 1, abfd) != 1)
+ if (bfd_write ("", 1, abfd) != 1)
return false;
obj_som_file_hdr (abfd)->unloadable_sp_size
som_swap_subspace_dictionary_record_out
(som_section_data (subsection)->subspace_dict, &ext_subspace_dict);
amt = sizeof (struct som_subspace_dictionary_record);
- if (bfd_bwrite (&ext_subspace_dict, amt, abfd) != amt)
+ if (bfd_write (&ext_subspace_dict, amt, abfd) != amt)
return false;
}
/* Goto the next section. */
som_swap_subspace_dictionary_record_out
(som_section_data (subsection)->subspace_dict, &ext_subspace_dict);
amt = sizeof (struct som_subspace_dictionary_record);
- if (bfd_bwrite (&ext_subspace_dict, amt, abfd) != amt)
+ if (bfd_write (&ext_subspace_dict, amt, abfd) != amt)
return false;
}
/* Goto the next section. */
som_swap_space_dictionary_out (som_section_data (section)->space_dict,
&ext_space_dict);
amt = sizeof (struct som_external_space_dictionary_record);
- if (bfd_bwrite (&ext_space_dict, amt, abfd) != amt)
+ if (bfd_write (&ext_space_dict, amt, abfd) != amt)
return false;
/* Goto the next section. */
(obj_som_compilation_unit (abfd), &ext_comp_unit);
amt = sizeof (struct som_external_compilation_unit);
- if (bfd_bwrite (&ext_comp_unit, amt, abfd) != amt)
+ if (bfd_write (&ext_comp_unit, amt, abfd) != amt)
return false;
}
/* Only thing left to do is write out the file header. It is always
at location zero. Seek there and write it. */
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0)
return false;
amt = sizeof (struct som_external_header);
- if (bfd_bwrite (&ext_header, amt, abfd) != amt)
+ if (bfd_write (&ext_header, amt, abfd) != amt)
return false;
/* Now write the exec header. */
return false;
amt = sizeof (ext_exec_header);
- if (bfd_bwrite (&ext_exec_header, amt, abfd) != amt)
+ if (bfd_write (&ext_exec_header, amt, abfd) != amt)
return false;
}
return true;
symtab_size = num_syms;
symtab_size *= sizeof (struct som_external_symbol_dictionary_record);
- if (bfd_bwrite ((void *) som_symtab, symtab_size, abfd) != symtab_size)
+ if (bfd_write (som_symtab, symtab_size, abfd) != symtab_size)
goto error_return;
free (som_symtab);
{
if (count == 0 || ((section->flags & SEC_HAS_CONTENTS) == 0))
return true;
- if ((bfd_size_type) (offset+count) > section->size
- || bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) != 0
- || bfd_bread (location, count, abfd) != count)
+ if ((bfd_size_type) (offset + count) > section->size
+ || bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
+ || bfd_read (location, count, abfd) != count)
return false; /* On error. */
return true;
}
if (bfd_seek (abfd, offset, SEEK_SET) != 0)
return false;
- if (bfd_bwrite (location, count, abfd) != count)
+ if (bfd_write (location, count, abfd) != count)
return false;
return true;
}
/* Read in this symbol and update the counter. */
amt = sizeof (ext_lst_symbol);
- if (bfd_bread ((void *) &ext_lst_symbol, amt, abfd) != amt)
+ if (bfd_read (&ext_lst_symbol, amt, abfd) != amt)
goto error_return;
(*count)++;
/* Read the symbol in and update the counter. */
amt = sizeof (ext_lst_symbol);
- if (bfd_bread ((void *) &ext_lst_symbol, amt, abfd) != amt)
+ if (bfd_read (&ext_lst_symbol, amt, abfd) != amt)
goto error_return;
(*count)++;
goto error_return;
amt = sizeof (lst_symbol);
- if (bfd_bread ((void *) &lst_symbol, amt, abfd) != amt)
+ if (bfd_read (&lst_symbol, amt, abfd) != amt)
goto error_return;
/* Get the name of the symbol, first get the length which is stored
+ bfd_getb32 (lst_symbol.name) - 4), SEEK_SET) != 0)
goto error_return;
- if (bfd_bread (&ext_len, (bfd_size_type) 4, abfd) != 4)
+ if (bfd_read (&ext_len, 4, abfd) != 4)
goto error_return;
len = bfd_getb32 (ext_len);
goto error_return;
amt = sizeof (lst_symbol);
- if (bfd_bread ((void *) &lst_symbol, amt, abfd) != amt)
+ if (bfd_read (&lst_symbol, amt, abfd) != amt)
goto error_return;
/* Seek to the name length & string and read them in. */
+ bfd_getb32 (lst_symbol.name) - 4, SEEK_SET) != 0)
goto error_return;
- if (bfd_bread (&ext_len, (bfd_size_type) 4, abfd) != 4)
+ if (bfd_read (&ext_len, 4, abfd) != 4)
goto error_return;
len = bfd_getb32 (ext_len);
struct artdata *ardata = bfd_ardata (abfd);
char nextname[17];
size_t amt = 16;
- int i = bfd_bread ((void *) nextname, amt, abfd);
+ int i = bfd_read (nextname, amt, abfd);
/* Special cases. */
if (i == 0)
if (i != 16)
return false;
- if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
+ if (bfd_seek (abfd, -16, SEEK_CUR) != 0)
return false;
/* For archives without .o files there is no symbol table. */
/* Read in and sanity check the archive header. */
amt = sizeof (struct ar_hdr);
- if (bfd_bread ((void *) &ar_header, amt, abfd) != amt)
+ if (bfd_read (&ar_header, amt, abfd) != amt)
return false;
if (strncmp (ar_header.ar_fmag, ARFMAG, 2))
/* Read in the library symbol table. We'll make heavy use of this
in just a minute. */
amt = sizeof (struct som_external_lst_header);
- if (bfd_bread ((void *) &ext_lst_header, amt, abfd) != amt)
+ if (bfd_read (&ext_lst_header, amt, abfd) != amt)
return false;
som_swap_lst_header_in (&ext_lst_header, &lst_header);
/* Now scribble out the hash table. */
amt = (size_t) hash_size * 4;
- if (bfd_bwrite ((void *) hash_table, amt, abfd) != amt)
+ if (bfd_write (hash_table, amt, abfd) != amt)
goto error_return;
/* Then the SOM dictionary. */
amt = (size_t) module_count * sizeof (struct som_external_som_entry);
- if (bfd_bwrite ((void *) som_dict, amt, abfd) != amt)
+ if (bfd_write (som_dict, amt, abfd) != amt)
goto error_return;
/* The library symbols. */
amt = (size_t) nsyms * sizeof (struct som_external_lst_symbol_record);
- if (bfd_bwrite ((void *) lst_syms, amt, abfd) != amt)
+ if (bfd_write (lst_syms, amt, abfd) != amt)
goto error_return;
/* And finally the strings. */
amt = string_size;
- if (bfd_bwrite ((void *) strings, amt, abfd) != amt)
+ if (bfd_write (strings, amt, abfd) != amt)
goto error_return;
free (hash_table);
/* Scribble out the ar header. */
amt = sizeof (struct ar_hdr);
- if (bfd_bwrite ((void *) &hdr, amt, abfd) != amt)
+ if (bfd_write (&hdr, amt, abfd) != amt)
return false;
/* Now scribble out the lst header. */
amt = sizeof (struct som_external_lst_header);
- if (bfd_bwrite ((void *) &lst, amt, abfd) != amt)
+ if (bfd_write (&lst, amt, abfd) != amt)
return false;
/* Build and write the armap. */
{
bfd_byte c;
- if (bfd_bread (&c, (bfd_size_type) 1, abfd) != 1)
+ if (bfd_read (&c, 1, abfd) != 1)
{
if (bfd_get_error () != bfd_error_file_truncated)
*errorptr = true;
asection *sec = NULL;
char *symbuf = NULL;
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0)
goto error_return;
while ((c = srec_get_byte (abfd, &error)) != EOF)
pos = bfd_tell (abfd) - 1;
- if (bfd_bread (hdr, (bfd_size_type) 3, abfd) != 3)
+ if (bfd_read (hdr, 3, abfd) != 3)
goto error_return;
if (! ISHEX (hdr[1]) || ! ISHEX (hdr[2]))
if (bytes * 2 > bufsize)
{
free (buf);
- buf = (bfd_byte *) bfd_malloc ((bfd_size_type) bytes * 2);
+ buf = bfd_malloc (bytes * 2);
if (buf == NULL)
goto error_return;
bufsize = bytes * 2;
}
- if (bfd_bread (buf, (bfd_size_type) bytes * 2, abfd) != bytes * 2)
+ if (bfd_read (buf, bytes * 2, abfd) != bytes * 2)
goto error_return;
/* Ignore the checksum byte. */
srec_init ();
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || bfd_bread (b, (bfd_size_type) 4, abfd) != 4)
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0
+ || bfd_read (b, 4, abfd) != 4)
return NULL;
if (b[0] != 'S' || !ISHEX (b[1]) || !ISHEX (b[2]) || !ISHEX (b[3]))
srec_init ();
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || bfd_bread (b, (bfd_size_type) 2, abfd) != 2)
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0
+ || bfd_read (b, 2, abfd) != 2)
return NULL;
if (b[0] != '$' || b[1] != '$')
if (c != 'S')
goto error_return;
- if (bfd_bread (hdr, (bfd_size_type) 3, abfd) != 3)
+ if (bfd_read (hdr, 3, abfd) != 3)
goto error_return;
BFD_ASSERT (ISHEX (hdr[1]) && ISHEX (hdr[2]));
if (bytes * 2 > bufsize)
{
free (buf);
- buf = (bfd_byte *) bfd_malloc ((bfd_size_type) bytes * 2);
+ buf = bfd_malloc (bytes * 2);
if (buf == NULL)
goto error_return;
bufsize = bytes * 2;
}
- if (bfd_bread (buf, (bfd_size_type) bytes * 2, abfd) != bytes * 2)
+ if (bfd_read (buf, bytes * 2, abfd) != bytes * 2)
goto error_return;
address = 0;
*dst++ = '\n';
wrlen = dst - buffer;
- return bfd_bwrite ((void *) buffer, wrlen, abfd) == wrlen;
+ return bfd_write (buffer, wrlen, abfd) == wrlen;
}
static bool
asymbol **table = bfd_get_outsymbols (abfd);
len = strlen (bfd_get_filename (abfd));
- if (bfd_bwrite ("$$ ", (bfd_size_type) 3, abfd) != 3
- || bfd_bwrite (bfd_get_filename (abfd), len, abfd) != len
- || bfd_bwrite ("\r\n", (bfd_size_type) 2, abfd) != 2)
+ if (bfd_write ("$$ ", 3, abfd) != 3
+ || bfd_write (bfd_get_filename (abfd), len, abfd) != len
+ || bfd_write ("\r\n", 2, abfd) != 2)
return false;
for (i = 0; i < count; i++)
char buf[43];
len = strlen (s->name);
- if (bfd_bwrite (" ", (bfd_size_type) 2, abfd) != 2
- || bfd_bwrite (s->name, len, abfd) != len)
+ if (bfd_write (" ", 2, abfd) != 2
+ || bfd_write (s->name, len, abfd) != len)
return false;
sprintf (buf, " $%" PRIx64 "\r\n",
+ s->section->output_section->lma
+ s->section->output_offset));
len = strlen (buf);
- if (bfd_bwrite (buf, len, abfd) != len)
+ if (bfd_write (buf, len, abfd) != len)
return false;
}
}
- if (bfd_bwrite ("$$ \r\n", (bfd_size_type) 5, abfd) != 5)
+ if (bfd_write ("$$ \r\n", 5, abfd) != 5)
return false;
}
bool is_eof = false;
/* To the front of the file. */
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0)
return false;
while (! is_eof)
char type;
/* Find first '%'. */
- is_eof = (bool) (bfd_bread (src, (bfd_size_type) 1, abfd) != 1);
+ is_eof = bfd_read (src, 1, abfd) != 1;
while (!is_eof && *src != '%')
- is_eof = (bool) (bfd_bread (src, (bfd_size_type) 1, abfd) != 1);
+ is_eof = bfd_read (src, 1, abfd) != 1;
if (is_eof)
break;
/* Fetch the type and the length and the checksum. */
- if (bfd_bread (src, (bfd_size_type) 5, abfd) != 5)
+ if (bfd_read (src, 5, abfd) != 5)
return false;
type = src[2];
if (chars_on_line >= MAXCHUNK)
return false;
- if (bfd_bread (src, (bfd_size_type) chars_on_line, abfd) != chars_on_line)
+ if (bfd_read (src, chars_on_line, abfd) != chars_on_line)
return false;
/* Put a null at the end. */
tekhex_init ();
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
- || bfd_bread (b, (bfd_size_type) 4, abfd) != 4)
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0
+ || bfd_read (b, 4, abfd) != 4)
return NULL;
if (b[0] != '%' || !ISHEX (b[1]) || !ISHEX (b[2]) || !ISHEX (b[3]))
sum += sum_block[(unsigned char) front[2]];
sum += sum_block[(unsigned char) front[3]]; /* Type. */
TOHEX (front + 4, sum);
- if (bfd_bwrite (front, (bfd_size_type) 6, abfd) != 6)
+ if (bfd_write (front, 6, abfd) != 6)
abort ();
end[0] = '\n';
wrlen = end - start + 1;
- if (bfd_bwrite (start, wrlen, abfd) != wrlen)
+ if (bfd_write (start, wrlen, abfd) != wrlen)
abort ();
}
}
/* And the terminator. */
- if (bfd_bwrite ("%0781010\n", (bfd_size_type) 9, abfd) != 9)
+ if (bfd_write ("%0781010\n", 9, abfd) != 9)
abort ();
return true;
}
#ifdef TRAD_CORE_USER_OFFSET
/* If defined, this macro is the file position of the user struct. */
- if (bfd_seek (abfd, (file_ptr) TRAD_CORE_USER_OFFSET, SEEK_SET) != 0)
+ if (bfd_seek (abfd, TRAD_CORE_USER_OFFSET, SEEK_SET) != 0)
return 0;
#endif
- val = bfd_bread ((void *) &u, (bfd_size_type) sizeof u, abfd);
+ val = bfd_read (&u, sizeof u, abfd);
if (val != sizeof u)
{
/* Too small to be a core file */
*dst++ = '\n';
wrlen = dst - buffer;
- return bfd_bwrite ((void *) buffer, wrlen, abfd) == wrlen;
+ return bfd_write (buffer, wrlen, abfd) == wrlen;
}
/* Write a record of type, of the supplied number of bytes. The
*dst++ = '\n';
wrlen = dst - buffer;
- return bfd_bwrite ((void *) buffer, wrlen, abfd) == wrlen;
+ return bfd_write (buffer, wrlen, abfd) == wrlen;
}
static bool
/* Skip alignment byte if the current position is odd. */
if (PRIV (recrd.file_format) == FF_FOREIGN && (bfd_tell (abfd) & 1))
{
- if (bfd_bread (PRIV (recrd.buf), 1, abfd) != 1)
+ if (bfd_read (PRIV (recrd.buf), 1, abfd) != 1)
{
bfd_set_error (bfd_error_file_truncated);
return -1;
}
/* Read the record header */
- if (bfd_bread (PRIV (recrd.buf), test_len, abfd) != test_len)
+ if (bfd_read (PRIV (recrd.buf), test_len, abfd) != test_len)
{
bfd_set_error (bfd_error_file_truncated);
return -1;
vms_debug2 ((8, "vms_get_remaining_obj_record: to_read %d\n", to_read));
- if (bfd_bread (PRIV (recrd.buf) + read_so_far, to_read, abfd) != to_read)
+ if (bfd_read (PRIV (recrd.buf) + read_so_far, to_read, abfd) != to_read)
{
bfd_set_error (bfd_error_file_truncated);
return 0;
return NULL;
}
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET))
+ if (bfd_seek (abfd, 0, SEEK_SET))
goto error_ret;
/* The first challenge with VMS is to discover the kind of the file.
if (PRIV (recrd.rec_size) < sizeof (struct vms_eihd))
goto err_wrong_format;
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET))
+ if (bfd_seek (abfd, 0, SEEK_SET))
goto error_ret;
free (PRIV (recrd.buf));
/* Write first block. */
bfd_putl32 (lnkflags, eihd.lnkflags);
- if (bfd_bwrite (&eihd, sizeof (eihd), abfd) != sizeof (eihd))
+ if (bfd_write (&eihd, sizeof (eihd), abfd) != sizeof (eihd))
return false;
/* Write remaining eisd. */
|| (next_eisd->file_pos / VMS_BLOCK_SIZE
!= eisd->file_pos / VMS_BLOCK_SIZE))
{
- if (bfd_bwrite (blk, sizeof (blk), abfd) != sizeof (blk))
+ if (bfd_write (blk, sizeof (blk), abfd) != sizeof (blk))
return false;
memset (blk, 0xff, sizeof (blk));
if (sec->size == 0 || !(sec->flags & SEC_HAS_CONTENTS)
|| sec->contents == NULL)
continue;
- if (bfd_bwrite (sec->contents, sec->size, abfd) != sec->size)
+ if (bfd_write (sec->contents, sec->size, abfd) != sec->size)
return false;
/* Pad. */
if (len != VMS_BLOCK_SIZE)
{
memset (blk, 0, len);
- if (bfd_bwrite (blk, len, abfd) != len)
+ if (bfd_write (blk, len, abfd) != len)
return false;
}
}
unsigned char buf[6];
hdr_size = has_records ? 6 : 4;
- if (bfd_bread (buf, hdr_size, abfd) != hdr_size)
+ if (bfd_read (buf, hdr_size, abfd) != hdr_size)
{
fprintf (file, _("cannot read GST record header\n"));
return;
memcpy (rec, buf + (has_records ? 2 : 0), hdr_size);
- if (bfd_bread (rec + hdr_size, pad_len - hdr_size, abfd)
+ if (bfd_read (rec + hdr_size, pad_len - hdr_size, abfd)
!= pad_len - hdr_size)
{
fprintf (file, _("cannot read GST record\n"));
unsigned int type;
unsigned char *buf;
- if (bfd_bread (&dsth, sizeof (dsth), abfd) != sizeof (dsth))
+ if (bfd_read (&dsth, sizeof (dsth), abfd) != sizeof (dsth))
{
fprintf (file, _("cannot read DST header\n"));
return;
unsigned int eiaf_size = 0;
unsigned int eihvn_off;
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET)
- || bfd_bread (&eihd, sizeof (eihd), abfd) != sizeof (eihd))
+ if (bfd_seek (abfd, 0, SEEK_SET)
+ || bfd_read (&eihd, sizeof (eihd), abfd) != sizeof (eihd))
{
fprintf (file, _("cannot read EIHD\n"));
return;
unsigned int j;
fprintf (file, _("system version array information:\n"));
- if (bfd_seek (abfd, (file_ptr) eihvn_off, SEEK_SET)
- || bfd_bread (&eihvn, sizeof (eihvn), abfd) != sizeof (eihvn))
+ if (bfd_seek (abfd, eihvn_off, SEEK_SET)
+ || bfd_read (&eihvn, sizeof (eihvn), abfd) != sizeof (eihvn))
{
fprintf (file, _("cannot read EIHVN header\n"));
return;
if (mask & (1u << j))
{
struct vms_eihvn_subversion ver;
- if (bfd_bread (&ver, sizeof (ver), abfd) != sizeof (ver))
+ if (bfd_read (&ver, sizeof (ver), abfd) != sizeof (ver))
{
fprintf (file, _("cannot read EIHVN version\n"));
return;
{
struct vms_eiha eiha;
- if (bfd_seek (abfd, (file_ptr) eiha_off, SEEK_SET)
- || bfd_bread (&eiha, sizeof (eiha), abfd) != sizeof (eiha))
+ if (bfd_seek (abfd, eiha_off, SEEK_SET)
+ || bfd_read (&eiha, sizeof (eiha), abfd) != sizeof (eiha))
{
fprintf (file, _("cannot read EIHA\n"));
return;
{
struct vms_eihi eihi;
- if (bfd_seek (abfd, (file_ptr) eihi_off, SEEK_SET)
- || bfd_bread (&eihi, sizeof (eihi), abfd) != sizeof (eihi))
+ if (bfd_seek (abfd, eihi_off, SEEK_SET)
+ || bfd_read (&eihi, sizeof (eihi), abfd) != sizeof (eihi))
{
fprintf (file, _("cannot read EIHI\n"));
return;
{
struct vms_eihs eihs;
- if (bfd_seek (abfd, (file_ptr) eihs_off, SEEK_SET)
- || bfd_bread (&eihs, sizeof (eihs), abfd) != sizeof (eihs))
+ if (bfd_seek (abfd, eihs_off, SEEK_SET)
+ || bfd_read (&eihs, sizeof (eihs), abfd) != sizeof (eihs))
{
fprintf (file, _("cannot read EIHS\n"));
return;
while (1)
{
- if (bfd_seek (abfd, (file_ptr) eisd_off, SEEK_SET)
- || bfd_bread (&eisd, sizeof (eisd), abfd) != sizeof (eisd))
+ if (bfd_seek (abfd, eisd_off, SEEK_SET)
+ || bfd_read (&eisd, sizeof (eisd), abfd) != sizeof (eisd))
{
fprintf (file, _("cannot read EISD\n"));
return;
struct vms_dmt_header dmth;
unsigned int count;
- if (bfd_bread (&dmth, sizeof (dmth), abfd) != sizeof (dmth))
+ if (bfd_read (&dmth, sizeof (dmth), abfd) != sizeof (dmth))
{
fprintf (file, _("cannot read DMT header\n"));
return;
{
struct vms_dmt_psect dmtp;
- if (bfd_bread (&dmtp, sizeof (dmtp), abfd) != sizeof (dmtp))
+ if (bfd_read (&dmtp, sizeof (dmtp), abfd) != sizeof (dmtp))
{
fprintf (file, _("cannot read DMT psect\n"));
return;
/* Read the LHS. */
off = (vbn - 1) * VMS_BLOCK_SIZE + bfd_getl16 (rfa->offset);
if (bfd_seek (abfd, off, SEEK_SET) != 0
- || bfd_bread (&lns, sizeof (lns), abfd) != sizeof (lns))
+ || bfd_read (&lns, sizeof (lns), abfd) != sizeof (lns))
return false;
if (!vms_add_index (cs, name,
off = (vbn - 1) * VMS_BLOCK_SIZE;
if (bfd_seek (abfd, off, SEEK_SET) != 0
- || bfd_bread (blk, VMS_BLOCK_SIZE, abfd) != VMS_BLOCK_SIZE)
+ || bfd_read (blk, VMS_BLOCK_SIZE, abfd) != VMS_BLOCK_SIZE)
return false;
return true;
off = (vbn - 1) * VMS_BLOCK_SIZE;
if (bfd_seek (abfd, off, SEEK_SET) != 0
- || bfd_bwrite (blk, VMS_BLOCK_SIZE, abfd) != VMS_BLOCK_SIZE)
+ || bfd_write (blk, VMS_BLOCK_SIZE, abfd) != VMS_BLOCK_SIZE)
return false;
return true;
/* Read the LHS. */
off = (idx_vbn - 1) * VMS_BLOCK_SIZE + idx_off;
if (bfd_seek (abfd, off, SEEK_SET) != 0
- || bfd_bread (&lhs, sizeof (lhs), abfd) != sizeof (lhs))
+ || bfd_read (&lhs, sizeof (lhs), abfd) != sizeof (lhs))
return false;
/* These extra entries may cause reallocation of CS. */
/* Read index desription. */
if (bfd_seek (abfd, LHD_IDXDESC + idx * IDD_LENGTH, SEEK_SET) != 0
- || bfd_bread (&idd, sizeof (idd), abfd) != sizeof (idd))
+ || bfd_read (&idd, sizeof (idd), abfd) != sizeof (idd))
return NULL;
/* Sanity checks. */
unsigned int nbr_ent;
/* Read header. */
- if (bfd_bread (&lhd, sizeof (lhd), abfd) != sizeof (lhd))
+ if (bfd_read (&lhd, sizeof (lhd), abfd) != sizeof (lhd))
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
unsigned int i;
if (bfd_seek (abfd, (dcxvbn - 1) * VMS_BLOCK_SIZE, SEEK_SET) != 0
- || bfd_bread (buf_reclen, sizeof (buf_reclen), abfd)
+ || bfd_read (buf_reclen, sizeof (buf_reclen), abfd)
!= sizeof (buf_reclen))
goto err;
reclen = bfd_getl32 (buf_reclen);
/* Length of the module, when known. */
ufile_ptr file_len;
- /* Current position in the record from bfd_bread point of view (ie, after
+ /* Current position in the record from bfd_read point of view (ie, after
decompression). 0 means that no data byte have been read, -2 and -1
are reserved for the length word. */
int rec_pos;
/* Read next block. */
if (bfd_seek (abfd->my_archive, vec->next_block, SEEK_SET) != 0)
return false;
- if (bfd_bread (hdr, sizeof (hdr), abfd->my_archive) != sizeof (hdr))
+ if (bfd_read (hdr, sizeof (hdr), abfd->my_archive) != sizeof (hdr))
return false;
vec->next_block = (bfd_getl32 (hdr + 2) - 1) * VMS_BLOCK_SIZE;
vec->blk_off = sizeof (hdr);
if (buf != NULL)
{
/* Really read into BUF. */
- if (bfd_bread (buf, l, abfd->my_archive) != l)
+ if (bfd_read (buf, l, abfd->my_archive) != l)
return -1;
}
else
/* Read the MHD now. */
if (bfd_seek (abfd, file_off, SEEK_SET) != 0)
return NULL;
- if (bfd_bread (buf, tdata->mhd_size, abfd) != tdata->mhd_size)
+ if (bfd_read (buf, tdata->mhd_size, abfd) != tdata->mhd_size)
return NULL;
mhd = (struct vms_mhd *) buf;
data->fill_1 = 0;
bfd_putl32 ((*off / VMS_BLOCK_SIZE) + 2, data->link);
- if (bfd_bwrite (data, sizeof (*data), arch) != sizeof (*data))
+ if (bfd_write (data, sizeof (*data), arch) != sizeof (*data))
return false;
*off += DATA__LENGTH - doff;
file_ptr off_hdr = off;
/* Read to complete the first block. */
- amt = bfd_bread (blk + sz, VMS_BLOCK_SIZE - sz, current);
+ amt = bfd_read (blk + sz, VMS_BLOCK_SIZE - sz, current);
if (amt == (bfd_size_type)-1)
goto input_err;
modsize = amt;
bfd_putl32 (modsize, mhd->modsize);
/* Write the first block (which contains an mhd). */
- if (bfd_bwrite (blk, VMS_BLOCK_SIZE, arch) != VMS_BLOCK_SIZE)
+ if (bfd_write (blk, VMS_BLOCK_SIZE, arch) != VMS_BLOCK_SIZE)
goto input_err;
off += VMS_BLOCK_SIZE;
while (1)
{
- amt = bfd_bread (buffer, sizeof (buffer), current);
+ amt = bfd_read (buffer, sizeof (buffer), current);
if (amt == (bfd_size_type)-1)
goto input_err;
if (amt == 0)
memset (buffer + amt, 0, sizeof (buffer) - amt);
amt = (amt + VMS_BLOCK_SIZE) & ~(VMS_BLOCK_SIZE - 1);
}
- if (bfd_bwrite (buffer, amt, arch) != amt)
+ if (bfd_write (buffer, amt, arch) != amt)
goto input_err;
off += amt;
}
/* Now that the size is known, write the first block (again). */
bfd_putl32 (modsize, mhd->modsize);
if (bfd_seek (arch, off_hdr, SEEK_SET) != 0
- || bfd_bwrite (blk, VMS_BLOCK_SIZE, arch) != VMS_BLOCK_SIZE)
+ || bfd_write (blk, VMS_BLOCK_SIZE, arch) != VMS_BLOCK_SIZE)
goto input_err;
if (bfd_seek (arch, off, SEEK_SET) != 0)
goto input_err;
/* Write the member. */
while (1)
{
- sz = bfd_bread (blk, sizeof (blk), current);
+ sz = bfd_read (blk, sizeof (blk), current);
if (sz == 0)
break;
if (!vms_write_data_block (arch, &data, &off, blk, sz, 0))
converted to variable length (VAR) format. VAR format has a length
word first which must be explicitly output in UDF format. */
/* So, first the length word. */
- bfd_bwrite (recwr->buf + 2, 2, abfd);
+ bfd_write (recwr->buf + 2, 2, abfd);
/* Align. */
if (recwr->size & 1)
recwr->buf[recwr->size++] = 0;
/* Then the record. */
- bfd_bwrite (recwr->buf, (size_t) recwr->size, abfd);
+ bfd_write (recwr->buf, (size_t) recwr->size, abfd);
recwr->size = 0;
}
unsigned char lost, mask;
int status = 1;
- while (bfd_bread (&byte, 1, abfd) == 1)
+ while (bfd_read (&byte, 1, abfd) == 1)
{
num_read++;
if (v)
c |= 0x80;
- if (bfd_bwrite (&c, 1, abfd) != 1)
+ if (bfd_write (&c, 1, abfd) != 1)
return false;
}
while (v);
bfd_byte magic_const[SIZEOF_WASM_MAGIC] = WASM_MAGIC;
bfd_byte magic[SIZEOF_WASM_MAGIC];
- if (bfd_bread (magic, sizeof (magic), abfd) == sizeof (magic)
+ if (bfd_read (magic, sizeof (magic), abfd) == sizeof (magic)
&& memcmp (magic, magic_const, sizeof (magic)) == 0)
return true;
bfd_byte vers_const[SIZEOF_WASM_VERSION] = WASM_VERSION;
bfd_byte vers[SIZEOF_WASM_VERSION];
- if (bfd_bread (vers, sizeof (vers), abfd) == sizeof (vers)
+ if (bfd_read (vers, sizeof (vers), abfd) == sizeof (vers)
/* Don't attempt to parse newer versions, which are likely to
require code changes. */
&& memcmp (vers, vers_const, sizeof (vers)) == 0)
{
bfd_byte byte;
- if (bfd_bread (&byte, (bfd_size_type) 1, abfd) != 1)
+ if (bfd_read (&byte, 1, abfd) != 1)
{
if (bfd_get_error () != bfd_error_file_truncated)
*errorptr = true;
unsigned int bytes_read;
asection *bfdsec;
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0)
goto error_return;
if (!wasm_read_header (abfd, &error))
if (!name)
goto error_return;
memcpy (name, prefix, prefixlen);
- if (bfd_bread (name + prefixlen, namelen, abfd) != namelen)
+ if (bfd_read (name + prefixlen, namelen, abfd) != namelen)
goto error_return;
name[prefixlen + namelen] = 0;
if (! wasm_write_uleb128 (abfd, 0)
|| ! wasm_write_uleb128 (abfd, payload_len)
|| ! wasm_write_uleb128 (abfd, name_len)
- || bfd_bwrite (name, name_len, abfd) != name_len)
+ || bfd_write (name, name_len, abfd) != name_len)
goto error_return;
fs->pos = asect->filepos = bfd_tell (abfd);
}
bfd_seek (abfd, (bfd_vma) 0, SEEK_SET);
- if (bfd_bwrite (magic, sizeof (magic), abfd) != (sizeof magic)
- || bfd_bwrite (vers, sizeof (vers), abfd) != sizeof (vers))
+ if (bfd_write (magic, sizeof (magic), abfd) != (sizeof magic)
+ || bfd_write (vers, sizeof (vers), abfd) != sizeof (vers))
return false;
for (i = 0; i < WASM_NUMBERED_SECTIONS; i++)
return false;
if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
- || bfd_bwrite (location, count, abfd) != count)
+ || bfd_write (location, count, abfd) != count)
return false;
return true;
if (bfd_seek (abfd, 0, SEEK_SET) != 0)
return false;
- if (bfd_bwrite (magic, sizeof (magic), abfd) != sizeof (magic)
- || bfd_bwrite (vers, sizeof (vers), abfd) != sizeof (vers))
+ if (bfd_write (magic, sizeof (magic), abfd) != sizeof (magic)
+ || bfd_write (vers, sizeof (vers), abfd) != sizeof (vers))
return false;
return true;
bool error;
asection *s;
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
+ if (bfd_seek (abfd, 0, SEEK_SET) != 0)
return NULL;
if (!wasm_read_header (abfd, &error))
pos = obj_sym_filepos (output_bfd);
pos += flinfo->last_file_index * osymesz;
if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
- || (bfd_bwrite (outsym, osymesz, output_bfd)
+ || (bfd_write (outsym, osymesz, output_bfd)
!= osymesz))
return false;
}
pos = enclosing->line_filepos;
amt = linesz * enc_count;
if (bfd_seek (input_bfd, pos, SEEK_SET) != 0
- || (bfd_bread (flinfo->linenos, amt, input_bfd)
+ || (bfd_read (flinfo->linenos, amt, input_bfd)
!= amt))
return false;
oline = enclosing;
+ o->output_section->lineno_count * linesz);
amt = linesz * *lineno_counts;
if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
- || bfd_bwrite (flinfo->linenos + linoff,
- amt, output_bfd) != amt)
+ || bfd_write (flinfo->linenos + linoff, amt,
+ output_bfd) != amt)
return false;
o->output_section->lineno_count += *lineno_counts;
file_ptr pos = obj_sym_filepos (output_bfd) + syment_base * osymesz;
bfd_size_type amt = outsym - flinfo->outsyms;
if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
- || bfd_bwrite (flinfo->outsyms, amt, output_bfd) != amt)
+ || bfd_write (flinfo->outsyms, amt, output_bfd) != amt)
return false;
BFD_ASSERT ((obj_raw_syment_count (output_bfd)
pos += obj_raw_syment_count (output_bfd) * bfd_coff_symesz (output_bfd);
size = 2 * bfd_coff_symesz (output_bfd);
if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
- || bfd_bwrite (flinfo->outsyms, size, output_bfd) != size)
+ || bfd_write (flinfo->outsyms, size, output_bfd) != size)
return false;
obj_raw_syment_count (output_bfd) += 2;
* bfd_coff_symesz (output_bfd));
amt = outsym - flinfo->outsyms;
if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
- || bfd_bwrite (flinfo->outsyms, amt, output_bfd) != amt)
+ || bfd_write (flinfo->outsyms, amt, output_bfd) != amt)
return false;
obj_raw_syment_count (output_bfd) +=
(outsym - flinfo->outsyms) / bfd_coff_symesz (output_bfd);
pos += obj_raw_syment_count (output_bfd) * bfd_coff_symesz (output_bfd);
amt = outsym - flinfo->outsyms;
if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
- || bfd_bwrite (flinfo->outsyms, amt, output_bfd) != amt)
+ || bfd_write (flinfo->outsyms, amt, output_bfd) != amt)
return false;
obj_raw_syment_count (output_bfd) +=
(outsym - flinfo->outsyms) / bfd_coff_symesz (output_bfd);
(void *) flinfo.outsyms);
pos = obj_sym_filepos (abfd) + flinfo.last_file_index * symesz;
if (bfd_seek (abfd, pos, SEEK_SET) != 0
- || bfd_bwrite (flinfo.outsyms, symesz, abfd) != symesz)
+ || bfd_write (flinfo.outsyms, symesz, abfd) != symesz)
goto error_return;
}
rel_size = relsz * o->reloc_count;
if (bfd_seek (abfd, o->rel_filepos, SEEK_SET) != 0
- || bfd_bwrite ((void *) external_relocs, rel_size, abfd) != rel_size)
+ || bfd_write (external_relocs, rel_size, abfd) != rel_size)
goto error_return;
}
_bfd_stringtab_size (flinfo.strtab) + STRING_SIZE_SIZE,
strbuf);
amt = STRING_SIZE_SIZE;
- if (bfd_bwrite (strbuf, amt, abfd) != amt)
+ if (bfd_write (strbuf, amt, abfd) != amt)
goto error_return;
if (! _bfd_stringtab_emit (abfd, flinfo.strtab))
goto error_return;
unsigned char buf[154];
long ret;
- ret = bfd_bread (buf, 154, abfd);
+ ret = bfd_read (buf, 154, abfd);
if (ret != 154)
return -1;
char version_string[32];
long ret;
- ret = bfd_bread (version_string, sizeof (version_string), abfd);
+ ret = bfd_read (version_string, sizeof (version_string), abfd);
if (ret != sizeof (version_string))
return -1;
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
- if (bfd_bread (buf, entry_size, abfd) != entry_size)
+ if (bfd_read (buf, entry_size, abfd) != entry_size)
return -1;
(*parser) (buf, entry_size, entry);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
- if (bfd_bread (buf, entry_size, abfd) != entry_size)
+ if (bfd_read (buf, entry_size, abfd) != entry_size)
return -1;
(*parser) (buf, entry_size, entry);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
- if (bfd_bread (buf, entry_size, abfd) != entry_size)
+ if (bfd_read (buf, entry_size, abfd) != entry_size)
return -1;
(*parser) (buf, entry_size, entry);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
- if (bfd_bread (buf, entry_size, abfd) != entry_size)
+ if (bfd_read (buf, entry_size, abfd) != entry_size)
return -1;
(*parser) (buf, entry_size, entry);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
- if (bfd_bread (buf, entry_size, abfd) != entry_size)
+ if (bfd_read (buf, entry_size, abfd) != entry_size)
return -1;
(*parser) (buf, entry_size, entry);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
- if (bfd_bread (buf, entry_size, abfd) != entry_size)
+ if (bfd_read (buf, entry_size, abfd) != entry_size)
return -1;
(*parser) (buf, entry_size, entry);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
- if (bfd_bread (buf, entry_size, abfd) != entry_size)
+ if (bfd_read (buf, entry_size, abfd) != entry_size)
return -1;
(*parser) (buf, entry_size, entry);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
- if (bfd_bread (buf, entry_size, abfd) != entry_size)
+ if (bfd_read (buf, entry_size, abfd) != entry_size)
return -1;
(*parser) (buf, entry_size, entry);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
- if (bfd_bread (buf, entry_size, abfd) != entry_size)
+ if (bfd_read (buf, entry_size, abfd) != entry_size)
return -1;
(*parser) (buf, entry_size, entry);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
- if (bfd_bread (buf, entry_size, abfd) != entry_size)
+ if (bfd_read (buf, entry_size, abfd) != entry_size)
return -1;
(*parser) (buf, entry_size, entry);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
- if (bfd_bread (buf, entry_size, abfd) != entry_size)
+ if (bfd_read (buf, entry_size, abfd) != entry_size)
return -1;
(*parser) (buf, entry_size, entry);
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
return -1;
- if (bfd_bread (buf, 4, abfd) != 4)
+ if (bfd_read (buf, 4, abfd) != 4)
return -1;
entry->nte_index = bfd_getb32 (buf);
- if (bfd_bread (buf, 2, abfd) != 2)
+ if (bfd_read (buf, 2, abfd) != 2)
return -1;
entry->physical_size = bfd_getb16 (buf);
if (entry->physical_size & 0x8000)
{
- if (bfd_bread (buf, 4, abfd) != 4)
+ if (bfd_read (buf, 4, abfd) != 4)
return -1;
entry->physical_size &= 0x7fff;
entry->logical_size = bfd_getb32 (buf);
}
else
{
- if (bfd_bread (buf, 2, abfd) != 2)
+ if (bfd_read (buf, 2, abfd) != 2)
return -1;
entry->physical_size &= 0x7fff;
entry->logical_size = bfd_getb16 (buf);
/* Create a bfd to contain the dependencies.
It inherits its type from arch, but we must set the type to
- "binary" otherwise bfd_bwrite() will fail. After writing, we
+ "binary" otherwise bfd_write() will fail. After writing, we
must set the type back to default otherwise adding it to the
archive will fail. */
libdeps_bfd = bfd_create (LIBDEPS, arch);
if (! bfd_make_writable (libdeps_bfd))
fatal (_("Cannot make libdeps object writable."));
- if (bfd_bwrite (libdeps, reclen, libdeps_bfd) != reclen)
+ if (bfd_write (libdeps, reclen, libdeps_bfd) != reclen)
fatal (_("Cannot write libdeps record."));
if (! bfd_make_readable (libdeps_bfd))
if (verbose)
printf ("\n<%s>\n\n", bfd_get_filename (abfd));
- bfd_seek (abfd, (file_ptr) 0, SEEK_SET);
+ bfd_seek (abfd, 0, SEEK_SET);
size = buf.st_size;
while (ncopied < size)
if (tocopy > BUFSIZE)
tocopy = BUFSIZE;
- nread = bfd_bread (cbuf, tocopy, abfd);
+ nread = bfd_read (cbuf, tocopy, abfd);
if (nread != tocopy)
/* xgettext:c-format */
fatal (_("%s is not a valid archive"),
fatal (_("internal stat error on %s"), bfd_get_filename (abfd));
size = buf.st_size;
- bfd_seek (abfd, (file_ptr) 0, SEEK_SET);
+ bfd_seek (abfd, 0, SEEK_SET);
output_file = NULL;
if (size == 0)
if (tocopy > BUFSIZE)
tocopy = BUFSIZE;
- nread = bfd_bread (cbuf, tocopy, abfd);
+ nread = bfd_read (cbuf, tocopy, abfd);
if (nread != tocopy)
/* xgettext:c-format */
fatal (_("%s is not a valid archive"),
return false;
}
- if (bfd_seek (ibfd, (file_ptr) 0, SEEK_SET) != 0)
+ if (bfd_seek (ibfd, 0, SEEK_SET) != 0)
{
bfd_nonfatal (bfd_get_archive_filename (ibfd));
return false;
else
tocopy = size;
- if (bfd_bread (cbuf, tocopy, ibfd) != tocopy)
+ if (bfd_read (cbuf, tocopy, ibfd) != tocopy)
{
bfd_nonfatal_message (NULL, ibfd, NULL, NULL);
free (cbuf);
return false;
}
- if (bfd_bwrite (cbuf, tocopy, obfd) != tocopy)
+ if (bfd_write (cbuf, tocopy, obfd) != tocopy)
{
bfd_nonfatal_message (NULL, obfd, NULL, NULL);
free (cbuf);
buf = xmalloc (len);
if (bfd_seek (abfd, off, SEEK_SET) == 0
- && bfd_bread (buf, len, abfd) == len)
+ && bfd_read (buf, len, abfd) == len)
dump (abfd, buf, len, off);
else
return false;
char *buf = xmalloc (flavour->size);
if (bfd_seek (abfd, flavour->offset, SEEK_SET) == 0
- && bfd_bread (buf, flavour->size, abfd) == flavour->size)
+ && bfd_read (buf, flavour->size, abfd) == flavour->size)
(*bed->_bfd_mach_o_print_thread)(abfd, flavour, stdout, buf);
free (buf);
unsigned int off;
if (bfd_seek (abfd, cmd->dataoff, SEEK_SET) != 0
- || bfd_bread (buf, cmd->datasize, abfd) != cmd->datasize)
+ || bfd_read (buf, cmd->datasize, abfd) != cmd->datasize)
{
non_fatal (_("cannot read code signature data"));
free (buf);
bfd_vma addr = 0;
if (bfd_seek (abfd, cmd->dataoff, SEEK_SET) != 0
- || bfd_bread (buf, cmd->datasize, abfd) != cmd->datasize)
+ || bfd_read (buf, cmd->datasize, abfd) != cmd->datasize)
{
non_fatal (_("cannot read segment split info"));
free (buf);
bfd_vma addr;
if (bfd_seek (abfd, cmd->dataoff, SEEK_SET) != 0
- || bfd_bread (buf, cmd->datasize, abfd) != cmd->datasize)
+ || bfd_read (buf, cmd->datasize, abfd) != cmd->datasize)
{
non_fatal (_("cannot read function starts"));
free (buf);
buf = xmalloc (cmd->datasize);
if (bfd_seek (abfd, cmd->dataoff, SEEK_SET) != 0
- || bfd_bread (buf, cmd->datasize, abfd) != cmd->datasize)
+ || bfd_read (buf, cmd->datasize, abfd) != cmd->datasize)
{
non_fatal (_("cannot read data_in_code"));
free (buf);
buf = xmalloc (sz);
if (bfd_seek (abfd, cmd->offset, SEEK_SET) != 0
- || bfd_bread (buf, sz, abfd) != sz)
+ || bfd_read (buf, sz, abfd) != sz)
{
non_fatal (_("cannot read twolevel hints"));
free (buf);
tools = xmalloc (tools_len);
if (bfd_seek (abfd, tools_offset, SEEK_SET) != 0
- || bfd_bread (tools, tools_len, abfd) != tools_len)
+ || bfd_read (tools, tools_len, abfd) != tools_len)
{
non_fatal (_("cannot read build tools"));
free (tools);
{ 0x0b00, "MCore", AOUTHDRSZ }
};
-static const struct target_specific_info unknown_info = { 0, "unknown", AOUTHDRSZ };
+static const struct target_specific_info unknown_info =
+ { 0, "unknown", AOUTHDRSZ };
static const struct target_specific_info *
get_target_specific_info (unsigned int machine)
if (targ_info[i].machine_number == machine)
return targ_info + i;
- return & unknown_info;
+ return &unknown_info;
}
/* Display help. */
{
/* Not correct on all platforms, but works on unix. */
time_t t = timedat;
- fputs (ctime (& t), stdout);
+ fputs (ctime (&t), stdout);
}
printf (_("Symbol table offset:\t\t%#08lx\n"),
// Fortunately, it appears that the size and layout of the
// PEPAOUTHDR header is consistent across all architectures.
if (bfd_seek (abfd, ihdr_off + sizeof (* ihdr), SEEK_SET) != 0
- || bfd_bread (& xhdr, sizeof (xhdr), abfd) != sizeof (xhdr))
+ || bfd_read (&xhdr, sizeof (xhdr), abfd) != sizeof (xhdr))
printf (_("error: unable to read AOUT and PE+ headers\n"));
else
{
off, aout_hdr_size);
if (bfd_seek (abfd, off, SEEK_SET) != 0
- || bfd_bread (& xhdr.standard, size, abfd) != size)
+ || bfd_read (&xhdr.standard, size, abfd) != size)
printf (_("error: unable to seek to/read AOUT header\n"));
else
{
/* FIXME: Sanitizers might complain about reading more bytes than
fit into the ImageBase field. Find a way to solve this. */
if (bfd_seek (abfd, off, SEEK_SET) != 0
- || bfd_bread (& xhdr.ImageBase, size, abfd) != size)
+ || bfd_read (&xhdr.ImageBase, size, abfd) != size)
printf (_("error: unable to seek to/read PE header\n"));
else
{
struct external_scnhdr scn;
unsigned int flags;
- if (bfd_bread (& scn, sizeof (scn), abfd) != sizeof (scn))
+ if (bfd_read (&scn, sizeof (scn), abfd) != sizeof (scn))
{
non_fatal (_("cannot read section header"));
return;
/* Read file header. */
if (bfd_seek (abfd, 0, SEEK_SET) != 0
- || bfd_bread (& fhdr, sizeof (fhdr), abfd) != sizeof (fhdr))
+ || bfd_read (&fhdr, sizeof (fhdr), abfd) != sizeof (fhdr))
{
non_fatal (_("cannot seek to/read file header"));
return;
struct external_PEI_IMAGE_hdr ihdr;
if (bfd_seek (abfd, ihdr_offset, SEEK_SET) != 0
- || bfd_bread (& ihdr, sizeof (ihdr), abfd) != sizeof (ihdr))
+ || bfd_read (&ihdr, sizeof (ihdr), abfd) != sizeof (ihdr))
{
non_fatal (_("cannot seek to/read image header at offset %#x"),
ihdr_offset);
return;
}
- dump_pe (abfd, & fhdr, & ihdr);
+ dump_pe (abfd, &fhdr, &ihdr);
}
/* See if we recognise this particular PE object file. */
else if (get_target_specific_info (magic)->machine_number)
struct external_filehdr ehdr;
if (bfd_seek (abfd, 0, SEEK_SET) != 0
- || bfd_bread (& ehdr, sizeof (ehdr), abfd) != sizeof (ehdr))
+ || bfd_read (&ehdr, sizeof (ehdr), abfd) != sizeof (ehdr))
{
non_fatal (_("cannot seek to/read image header"));
return;
}
struct external_PEI_IMAGE_hdr ihdr;
- memcpy (& ihdr.f_magic, & ehdr, sizeof (ehdr));
- dump_pe (abfd, NULL, & ihdr);
+ memcpy (&ihdr.f_magic, &ehdr, sizeof (ehdr));
+ dump_pe (abfd, NULL, &ihdr);
}
else
{
(int)sizeof (auxhdr));
sz = sizeof (auxhdr);
}
- if (bfd_bread (&auxhdr, sz, abfd) != sz)
+ if (bfd_read (&auxhdr, sz, abfd) != sz)
{
non_fatal (_("cannot read auxhdr"));
return;
struct external_scnhdr scn;
unsigned int flags;
- if (bfd_bread (&scn, sizeof (scn), abfd) != sizeof (scn))
+ if (bfd_read (&scn, sizeof (scn), abfd) != sizeof (scn))
{
non_fatal (_("cannot read section header"));
return;
struct external_scnhdr scn;
struct xcoff32_section *s = &data->sects[i];
- if (bfd_bread (&scn, sizeof (scn), abfd) != sizeof (scn))
+ if (bfd_read (&scn, sizeof (scn), abfd) != sizeof (scn))
{
non_fatal (_("cannot read section header"));
free (data->sects);
/* Read string table. */
if (bfd_seek (abfd, stptr, SEEK_SET) != 0
- || bfd_bread (&stsz_arr, sizeof (stsz_arr), abfd) != sizeof (stsz_arr))
+ || bfd_read (&stsz_arr, sizeof (stsz_arr), abfd) != sizeof (stsz_arr))
{
non_fatal (_("cannot read strings table length"));
data->strings_size = 0;
data->strings = xmalloc (data->strings_size);
memcpy (data->strings, stsz_arr, sizeof (stsz_arr));
- if (bfd_bread (data->strings + sizeof (stsz_arr), remsz, abfd)
+ if (bfd_read (data->strings + sizeof (stsz_arr), remsz, abfd)
!= remsz)
{
non_fatal (_("cannot read strings table"));
int j;
union xcoff32_symbol *s = &data->syms[i];
- if (bfd_bread (&sym, sizeof (sym), abfd) != sizeof (sym))
+ if (bfd_read (&sym, sizeof (sym), abfd) != sizeof (sym))
{
non_fatal (_("cannot read symbol entry"));
goto clean;
for (j = 0; j < s->sym.numaux; j++, i++)
{
- if (bfd_bread (&s[j + 1].aux,
+ if (bfd_read (&s[j + 1].aux,
sizeof (union external_auxent), abfd)
!= sizeof (union external_auxent))
{
unsigned char rsize;
unsigned int symndx;
- if (bfd_bread (&rel, sizeof (rel), abfd) != sizeof (rel))
+ if (bfd_read (&rel, sizeof (rel), abfd) != sizeof (rel))
{
non_fatal (_("cannot read relocation entry"));
return;
struct external_lineno ln;
unsigned int no;
- if (bfd_bread (&ln, sizeof (ln), abfd) != sizeof (ln))
+ if (bfd_read (&ln, sizeof (ln), abfd) != sizeof (ln))
{
non_fatal (_("cannot read line number entry"));
return;
/* Read file header. */
if (bfd_seek (abfd, 0, SEEK_SET) != 0
- || bfd_bread (&fhdr, sizeof (fhdr), abfd) != sizeof (fhdr))
+ || bfd_read (&fhdr, sizeof (fhdr), abfd) != sizeof (fhdr))
{
non_fatal (_("cannot read header"));
return;
ldr = xmalloc (len);
if (bfd_seek (abfd, off, SEEK_SET) != 0
- || bfd_bread (ldr, len, abfd) != len)
+ || bfd_read (ldr, len, abfd) != len)
non_fatal (_("cannot read loader info table"));
else
{
/* Read file header. */
if (bfd_seek (abfd, 0, SEEK_SET) != 0
- || bfd_bread (&hdr, sizeof (hdr), abfd) != sizeof (hdr))
+ || bfd_read (&hdr, sizeof (hdr), abfd) != sizeof (hdr))
{
non_fatal (_("cannot core read header"));
return;
file_ptr pos = sec->filepos + *sizep;
gas_assert (bfd_seek (stdoutput, pos - 1, SEEK_SET) == 0
- && bfd_bwrite (&b, 1, stdoutput) == 1);
+ && bfd_write (&b, 1, stdoutput) == 1);
}
}
}
FILE *ftmp;
/* We're not sure how big it is, but it will be smaller than "size". */
- size = bfd_bread (buf, size, mbfd);
+ size = bfd_read (buf, size, mbfd);
/* Write to a temporary file, then use s_include to include it
a bit of a hack. */
unsigned char b[2];
bfd_seek (abfd, (file_ptr) where, SEEK_SET);
- bfd_bread (b, (bfd_size_type) 2, abfd);
+ bfd_read (b, (bfd_size_type) 2, abfd);
return b[0] + (b[1] << 8);
}
unsigned char b[4];
bfd_seek (abfd, (file_ptr) where, SEEK_SET);
- bfd_bread (b, (bfd_size_type) 4, abfd);
+ bfd_read (b, (bfd_size_type) 4, abfd);
return b[0] + (b[1] << 8) + (b[2] << 16) + (b[3] << 24);
}
unsigned long fptr = pe_get32 (dll, secptr1 + 20);
bfd_seek (dll, (file_ptr) secptr1, SEEK_SET);
- bfd_bread (sname, (bfd_size_type) sizeof (sname), dll);
+ bfd_read (sname, (bfd_size_type) sizeof (sname), dll);
if ((strcmp (sname, ".edata") == 0)
|| (vaddr <= export_opthdrrva && export_opthdrrva < vaddr + vsize))
asection *section;
bfd_seek (dll, (file_ptr) secptr1 + 0, SEEK_SET);
- bfd_bread (sec_name, (bfd_size_type) SCNNMLEN, dll);
+ bfd_read (sec_name, (bfd_size_type) SCNNMLEN, dll);
sec_name[SCNNMLEN] = '\0';
sectix = read_pe_section_index (sec_name);
expdata = expdata_storage.data ();
bfd_seek (dll, (file_ptr) expptr, SEEK_SET);
- bfd_bread (expdata, (bfd_size_type) export_size, dll);
+ bfd_read (expdata, (bfd_size_type) export_size, dll);
erva = expdata - export_rva;
nexp = pe_as32 (expdata + 24);
unsigned long vaddr = pe_get32 (abfd, secptr1 + 12);
bfd_seek (abfd, (file_ptr) secptr1, SEEK_SET);
- bfd_bread (sname, (bfd_size_type) SCNNMLEN, abfd);
+ bfd_read (sname, (bfd_size_type) SCNNMLEN, abfd);
sname[SCNNMLEN] = '\0';
if (strcmp (sname, ".text") == 0)
return vaddr;
bfd_size_type bytes;
cs->c_symnum = symnum;
- bytes = bfd_bread (temp_sym, local_symesz, nlist_bfd_global);
+ bytes = bfd_read (temp_sym, local_symesz, nlist_bfd_global);
if (bytes != local_symesz)
error (_("%s: error reading symbols"), objfile_name (coffread_objfile));
bfd_coff_swap_sym_in (symfile_bfd, temp_sym, (char *) sym);
cs->c_naux = sym->n_numaux & 0xff;
if (cs->c_naux >= 1)
{
- bytes = bfd_bread (temp_aux, local_auxesz, nlist_bfd_global);
+ bytes = bfd_read (temp_aux, local_auxesz, nlist_bfd_global);
if (bytes != local_auxesz)
error (_("%s: error reading symbols"), objfile_name (coffread_objfile));
bfd_coff_swap_aux_in (symfile_bfd, temp_aux,
is important). */
for (i = 1; i < cs->c_naux; i++)
{
- bytes = bfd_bread (temp_aux, local_auxesz, nlist_bfd_global);
+ bytes = bfd_read (temp_aux, local_auxesz, nlist_bfd_global);
if (bytes != local_auxesz)
error (_("%s: error reading symbols"),
objfile_name (coffread_objfile));
if (bfd_seek (abfd, offset, 0) < 0)
return -1;
- val = bfd_bread ((char *) lengthbuf, sizeof lengthbuf, abfd);
+ val = bfd_read ((char *) lengthbuf, sizeof lengthbuf, abfd);
length = bfd_h_get_32 (symfile_bfd, lengthbuf);
/* If no string table is needed, then the file may end immediately
if (length == sizeof length) /* Empty table -- just the count. */
return 0;
- val = bfd_bread (stringtab + sizeof lengthbuf,
- length - sizeof lengthbuf, abfd);
+ val = bfd_read (stringtab + sizeof lengthbuf,
+ length - sizeof lengthbuf, abfd);
if (val != length - sizeof lengthbuf || stringtab[length - 1] != '\0')
return -1;
storage->reset ((char *) xmalloc (size + local_linesz));
linetab = storage->get ();
- val = bfd_bread (storage->get (), size, abfd);
+ val = bfd_read (storage->get (), size, abfd);
if (val != size)
return -1;
perror_with_name (name);
memset (size_temp, 0, sizeof (size_temp));
- val = bfd_bread (size_temp, sizeof (size_temp), sym_bfd);
+ val = bfd_read (size_temp, sizeof (size_temp), sym_bfd);
if (val < 0)
{
perror_with_name (name);
val = bfd_seek (sym_bfd, STRING_TABLE_OFFSET, SEEK_SET);
if (val < 0)
perror_with_name (name);
- val = bfd_bread (DBX_STRINGTAB (objfile),
- DBX_STRINGTAB_SIZE (objfile),
- sym_bfd);
+ val = bfd_read (DBX_STRINGTAB (objfile),
+ DBX_STRINGTAB_SIZE (objfile),
+ sym_bfd);
if (val != DBX_STRINGTAB_SIZE (objfile))
perror_with_name (name);
}
else if (symbuf_sections == NULL)
{
count = sizeof (symbuf);
- nbytes = bfd_bread (symbuf, count, sym_bfd);
+ nbytes = bfd_read (symbuf, count, sym_bfd);
}
else
{
count = symbuf_left;
if (count > sizeof (symbuf))
count = sizeof (symbuf);
- nbytes = bfd_bread (symbuf, count, sym_bfd);
+ nbytes = bfd_read (symbuf, count, sym_bfd);
}
if (nbytes < 0)
val = bfd_seek (sym_bfd, stabstroffset, SEEK_SET);
if (val < 0)
perror_with_name (name);
- val = bfd_bread (DBX_STRINGTAB (objfile), stabstrsize, sym_bfd);
+ val = bfd_read (DBX_STRINGTAB (objfile), stabstrsize, sym_bfd);
if (val != stabstrsize)
perror_with_name (name);
val = bfd_seek (sym_bfd, stabstroffset, SEEK_SET);
if (val < 0)
perror_with_name (name);
- val = bfd_bread (DBX_STRINGTAB (objfile), stabstrsize, sym_bfd);
+ val = bfd_read (DBX_STRINGTAB (objfile), stabstrsize, sym_bfd);
if (val != stabstrsize)
perror_with_name (name);
gdb_assert (abfd != NULL);
if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0
- || bfd_bread (buf, size, abfd) != size)
+ || bfd_read (buf, size, abfd) != size)
{
error (_("Dwarf Error: Can't read DWARF data"
" in section %s [in module %s]"),
gdb_byte buffer[8 * 1024];
bfd_size_type count;
- count = bfd_bread (buffer, sizeof (buffer), abfd);
+ count = bfd_read (buffer, sizeof (buffer), abfd);
if (count == (bfd_size_type) -1)
{
warning (_("Problem reading \"%s\" for CRC: %s"),
offset = section->filepos + size - LZMA_STREAM_HEADER_SIZE;
if (size < LZMA_STREAM_HEADER_SIZE
|| bfd_seek (section->owner, offset, SEEK_SET) != 0
- || bfd_bread (footer, LZMA_STREAM_HEADER_SIZE, section->owner)
+ || bfd_read (footer, LZMA_STREAM_HEADER_SIZE, section->owner)
!= LZMA_STREAM_HEADER_SIZE
|| lzma_stream_footer_decode (&options, footer) != LZMA_OK
|| offset < options.backward_size)
index = NULL;
pos = 0;
if (bfd_seek (section->owner, offset, SEEK_SET) != 0
- || bfd_bread (indexdata, options.backward_size, section->owner)
+ || bfd_read (indexdata, options.backward_size, section->owner)
!= options.backward_size
|| lzma_index_buffer_decode (&index, &memlimit, &gdb_lzma_allocator,
indexdata, &pos, options.backward_size)
compressed = (gdb_byte *) xmalloc (iter.block.total_size);
block_offset = section->filepos + iter.block.compressed_file_offset;
if (bfd_seek (section->owner, block_offset, SEEK_SET) != 0
- || bfd_bread (compressed, iter.block.total_size, section->owner)
+ || bfd_read (compressed, iter.block.total_size, section->owner)
!= iter.block.total_size)
{
xfree (compressed);
gdb::byte_vector buf (phdrs_size);
if (bfd_seek (abfd, ehdr->e_phoff, SEEK_SET) != 0
- || bfd_bread (buf.data (), phdrs_size, abfd) != phdrs_size)
+ || bfd_read (buf.data (), phdrs_size, abfd) != phdrs_size)
return {};
return buf;
while (curoffset <= limit_offset)
{
bfd_seek (abfd, curoffset, SEEK_SET);
- bfd_bread (ext_lnno, linesz, abfd);
+ bfd_read (ext_lnno, linesz, abfd);
bfd_coff_swap_lineno_in (abfd, ext_lnno, &int_lnno);
/* Find the address this line represents. */
error (_("cannot seek to string table in %s: %s"),
bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ()));
- val = bfd_bread ((char *) lengthbuf, sizeof lengthbuf, abfd);
+ val = bfd_read ((char *) lengthbuf, sizeof lengthbuf, abfd);
length = bfd_h_get_32 (abfd, lengthbuf);
/* If no string table is needed, then the file may end immediately
if (length == sizeof lengthbuf)
return;
- val = bfd_bread (strtbl + sizeof lengthbuf, length - sizeof lengthbuf, abfd);
+ val = bfd_read (strtbl + sizeof lengthbuf, length - sizeof lengthbuf, abfd);
if (val != length - sizeof lengthbuf)
error (_("cannot read string table from %s: %s"),
info->symtbl = (char *) obstack_alloc (&objfile->objfile_obstack, size);
info->symtbl_num_syms = num_symbols;
- val = bfd_bread (info->symtbl, size, abfd);
+ val = bfd_read (info->symtbl, size, abfd);
if (val != size)
perror_with_name (_("reading symbol table"));
if (bfd_seek (abfd, filepos, SEEK_SET) != 0)
return 0;
- status = bfd_bread (&b, (bfd_size_type) 1, abfd);
+ status = bfd_read (&b, 1, abfd);
if (status < 1)
{
break;
if (bfd_seek (abfd, asec->filepos + link_order->offset, SEEK_SET) != 0)
return 0;
- if (bfd_bwrite (contents, sizeof (*ext), abfd) != sizeof (*ext))
+ if (bfd_write (contents, sizeof (*ext), abfd) != sizeof (*ext))
return 0;
#ifdef PDB_H
if (bfd_seek (abfd, filepos, SEEK_SET) != 0)
return 0;
- status = bfd_bread (&b, (bfd_size_type) 1, abfd);
+ status = bfd_read (&b, 1, abfd);
if (status < 1)
{
break;
if (bfd_seek (abfd, asec->filepos + link_order->offset, SEEK_SET) != 0)
return 0;
- if (bfd_bwrite (contents, sizeof (*ext), abfd) != sizeof (*ext))
+ if (bfd_write (contents, sizeof (*ext), abfd) != sizeof (*ext))
return 0;
#ifdef PDB_H
position = i_shdr->sh_offset + asec->output_offset;
size = asec->size;
return (bfd_seek (abfd, position, SEEK_SET) == 0
- && bfd_bwrite (contents, size, abfd) == size);
+ && bfd_write (contents, size, abfd) == size);
}
/* Make .note.gnu.build-id section, and set up elf_tdata->build_id. */
position = i_shdr->sh_offset + asec->output_offset;
size = asec->size;
return (bfd_seek (abfd, position, SEEK_SET) == 0
- && bfd_bwrite (contents, size, abfd) == size);
+ && bfd_write (contents, size, abfd) == size);
}
/* Make .note.package section.
bfd_putl32 (0, buf);
- return bfd_bwrite (buf, sizeof (uint32_t), stream) == sizeof (uint32_t);
+ return bfd_write (buf, sizeof (uint32_t), stream) == sizeof (uint32_t);
}
/* Calculate the hash of a given string. */
bfd_putl16 (bfd_getb16 (&guid[6]), &h.guid[6]);
memcpy (&h.guid[8], &guid[8], 8);
- if (bfd_bwrite (&h, sizeof (h), info_stream) != sizeof (h))
+ if (bfd_write (&h, sizeof (h), info_stream) != sizeof (h))
return false;
/* Write hash list of named streams. This is a "rollover" hash, i.e.
bfd_putl32 (names_length, int_buf);
- if (bfd_bwrite (int_buf, sizeof (uint32_t), info_stream) !=
+ if (bfd_write (int_buf, sizeof (uint32_t), info_stream) !=
sizeof (uint32_t))
goto end;
size_t len = strlen (b->filename) + 1;
- if (bfd_bwrite (b->filename, len, info_stream) != len)
+ if (bfd_write (b->filename, len, info_stream) != len)
goto end;
}
bfd_putl32 (num_entries, int_buf);
- if (bfd_bwrite (int_buf, sizeof (uint32_t), info_stream) !=
+ if (bfd_write (int_buf, sizeof (uint32_t), info_stream) !=
sizeof (uint32_t))
goto end;
bfd_putl32 (num_buckets, int_buf);
- if (bfd_bwrite (int_buf, sizeof (uint32_t), info_stream) !=
+ if (bfd_write (int_buf, sizeof (uint32_t), info_stream) !=
sizeof (uint32_t))
goto end;
bfd_putl32 ((num_buckets + 31) / 32, int_buf);
- if (bfd_bwrite (int_buf, sizeof (uint32_t), info_stream) !=
+ if (bfd_write (int_buf, sizeof (uint32_t), info_stream) !=
sizeof (uint32_t))
goto end;
bfd_putl32 (v, int_buf);
- if (bfd_bwrite (int_buf, sizeof (uint32_t), info_stream) !=
+ if (bfd_write (int_buf, sizeof (uint32_t), info_stream) !=
sizeof (uint32_t))
goto end;
}
bfd_putl32 (0, int_buf);
- if (bfd_bwrite (int_buf, sizeof (uint32_t), info_stream) !=
+ if (bfd_write (int_buf, sizeof (uint32_t), info_stream) !=
sizeof (uint32_t))
goto end;
{
bfd_putl32 (buckets[i]->offset, int_buf);
- if (bfd_bwrite (int_buf, sizeof (uint32_t), info_stream) !=
+ if (bfd_write (int_buf, sizeof (uint32_t), info_stream) !=
sizeof (uint32_t))
goto end;
bfd_putl32 (buckets[i]->value, int_buf);
- if (bfd_bwrite (int_buf, sizeof (uint32_t), info_stream) !=
+ if (bfd_write (int_buf, sizeof (uint32_t), info_stream) !=
sizeof (uint32_t))
goto end;
}
bfd_putl32 (0, int_buf);
- if (bfd_bwrite (int_buf, sizeof (uint32_t), info_stream) !=
+ if (bfd_write (int_buf, sizeof (uint32_t), info_stream) !=
sizeof (uint32_t))
goto end;
bfd_putl32 (PDB_STREAM_VERSION_VC140, int_buf);
- if (bfd_bwrite (int_buf, sizeof (uint32_t), info_stream) !=
+ if (bfd_write (int_buf, sizeof (uint32_t), info_stream) !=
sizeof (uint32_t))
goto end;
&h.hash_adj_buffer_offset);
bfd_putl32 (0, &h.hash_adj_buffer_length);
- if (bfd_bwrite (&h, sizeof (h), stream) != sizeof (h))
+ if (bfd_write (&h, sizeof (h), stream) != sizeof (h))
return false;
/* Write the type definitions into the main stream, and the hashes
size = bfd_getl16 (e->data);
- if (bfd_bwrite (e->data, size + sizeof (uint16_t), stream)
+ if (bfd_write (e->data, size + sizeof (uint16_t), stream)
!= size + sizeof (uint16_t))
return false;
bfd_putl32 (e->cv_hash % NUM_TPI_HASH_BUCKETS, buf);
- if (bfd_bwrite (buf, sizeof (uint32_t), hash_stream)
+ if (bfd_write (buf, sizeof (uint32_t), hash_stream)
!= sizeof (uint32_t))
return false;
bfd_putl32 (TPI_FIRST_INDEX + e->index, buf);
- if (bfd_bwrite (buf, sizeof (uint32_t), hash_stream)
+ if (bfd_write (buf, sizeof (uint32_t), hash_stream)
!= sizeof (uint32_t))
return false;
bfd_putl32 (old_off, buf);
- if (bfd_bwrite (buf, sizeof (uint32_t), hash_stream)
+ if (bfd_write (buf, sizeof (uint32_t), hash_stream)
!= sizeof (uint32_t))
return false;
}
glob->last = g;
- return bfd_bwrite (data, len, sym_rec_stream) == len;
+ return bfd_write (data, len, sym_rec_stream) == len;
}
/* Find the end of the current scope within symbols data. */
bfd_putl32 (CV_SIGNATURE_C13, int_buf);
- if (bfd_bwrite (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t))
+ if (bfd_write (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t))
{
free (c13_info);
free (syms);
if (syms)
{
- if (bfd_bwrite (syms, *sym_byte_size, stream) != *sym_byte_size)
+ if (bfd_write (syms, *sym_byte_size, stream) != *sym_byte_size)
{
free (c13_info);
free (syms);
if (c13_info)
{
- if (bfd_bwrite (c13_info, *c13_info_size, stream) != *c13_info_size)
+ if (bfd_write (c13_info, *c13_info_size, stream) != *c13_info_size)
{
free (c13_info);
return false;
bfd_putl32 (0, int_buf);
- if (bfd_bwrite (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t))
+ if (bfd_write (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t))
return false;
return true;
{
bfd_seek (abfd, offset, SEEK_SET);
- if (bfd_bread (sect_flags + (i * sizeof (uint32_t)), sizeof (uint32_t),
+ if (bfd_read (sect_flags + (i * sizeof (uint32_t)), sizeof (uint32_t),
abfd) != sizeof (uint32_t))
{
free (*data);
&h.entries_size);
bfd_putl32 (buckets_size, &h.buckets_size);
- if (bfd_bwrite (&h, sizeof (h), stream) != sizeof (h))
+ if (bfd_write (&h, sizeof (h), stream) != sizeof (h))
return false;
/* Write hash entries, sorted by hash. */
bfd_putl32 (sorted[i]->offset + 1, &hr.offset);
bfd_putl32 (sorted[i]->refcount, &hr.reference);
- if (bfd_bwrite (&hr, sizeof (hr), stream) != sizeof (hr))
+ if (bfd_write (&hr, sizeof (hr), stream) != sizeof (hr))
goto end;
}
v |= 1 << j;
}
- if (bfd_bwrite (&v, sizeof (v), stream) != sizeof (v))
+ if (bfd_write (&v, sizeof (v), stream) != sizeof (v))
goto end;
}
bfd_putl32 (0, int_buf);
- if (bfd_bwrite (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t))
+ if (bfd_write (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t))
goto end;
/* Write the bucket offsets. */
Microsoft's parser. */
bfd_putl32 (buckets[i]->index * 0xc, int_buf);
- if (bfd_bwrite (int_buf, sizeof (uint32_t), stream) !=
+ if (bfd_write (int_buf, sizeof (uint32_t), stream) !=
sizeof (uint32_t))
goto end;
}
bfd_putl16 (get_arch_number (abfd), &h.machine);
bfd_putl32 (0, &h.padding);
- if (bfd_bwrite (&h, sizeof (h), stream) != sizeof (h))
+ if (bfd_write (&h, sizeof (h), stream) != sizeof (h))
{
free (source_info);
free (sc);
return false;
}
- if (bfd_bwrite (mod_info, mod_info_size, stream) != mod_info_size)
+ if (bfd_write (mod_info, mod_info_size, stream) != mod_info_size)
{
free (source_info);
free (sc);
free (mod_info);
- if (bfd_bwrite (sc, sc_size, stream) != sc_size)
+ if (bfd_write (sc, sc_size, stream) != sc_size)
{
free (source_info);
free (sc);
free (sc);
- if (bfd_bwrite (source_info, source_info_size, stream) != source_info_size)
+ if (bfd_write (source_info, source_info_size, stream) != source_info_size)
{
free (source_info);
return false;
bfd_putl16 (0xffff, &opt.new_fpo_stream);
bfd_putl16 (0xffff, &opt.orig_section_header_stream);
- if (bfd_bwrite (&opt, sizeof (opt), stream) != sizeof (opt))
+ if (bfd_write (&opt, sizeof (opt), stream) != sizeof (opt))
return false;
return true;
bfd_putl32 (p->address, &ps.offset);
bfd_putl16 (p->section, &ps.section);
- if (bfd_bwrite (&ps, sizeof (struct pubsym), sym_rec_stream) !=
+ if (bfd_write (&ps, sizeof (struct pubsym), sym_rec_stream) !=
sizeof (struct pubsym))
goto end;
- if (bfd_bwrite (name, name_len + 1, sym_rec_stream) !=
+ if (bfd_write (name, name_len + 1, sym_rec_stream) !=
name_len + 1)
goto end;
{
uint8_t b = 0;
- if (bfd_bwrite (&b, sizeof (uint8_t), sym_rec_stream) !=
+ if (bfd_write (&b, sizeof (uint8_t), sym_rec_stream) !=
sizeof (uint8_t))
goto end;
}
bfd_putl32 (0, &header.thunk_table_offset);
bfd_putl32 (0, &header.num_sects);
- if (bfd_bwrite (&header, sizeof (header), stream) != sizeof (header))
+ if (bfd_write (&header, sizeof (header), stream) != sizeof (header))
goto end;
/* Output the global hash header. */
&hash_header.entries_size);
bfd_putl32 (buckets_size, &hash_header.buckets_size);
- if (bfd_bwrite (&hash_header, sizeof (hash_header), stream) !=
+ if (bfd_write (&hash_header, sizeof (hash_header), stream) !=
sizeof (hash_header))
goto end;
bfd_putl32 (sorted[i]->offset + 1, &hr.offset);
bfd_putl32 (1, &hr.reference);
- if (bfd_bwrite (&hr, sizeof (hr), stream) != sizeof (hr))
+ if (bfd_write (&hr, sizeof (hr), stream) != sizeof (hr))
goto end;
}
v |= 1 << j;
}
- if (bfd_bwrite (&v, sizeof (v), stream) != sizeof (v))
+ if (bfd_write (&v, sizeof (v), stream) != sizeof (v))
goto end;
}
bfd_putl32 (0, int_buf);
- if (bfd_bwrite (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t))
+ if (bfd_write (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t))
goto end;
/* Write the bucket offsets. */
Microsoft's parser. */
bfd_putl32 (buckets[i]->index * 0xc, int_buf);
- if (bfd_bwrite (int_buf, sizeof (uint32_t), stream) !=
+ if (bfd_write (int_buf, sizeof (uint32_t), stream) !=
sizeof (uint32_t))
goto end;
}
{
bfd_putl32 (sorted[i]->offset, int_buf);
- if (bfd_bwrite (int_buf, sizeof (uint32_t), stream) !=
+ if (bfd_write (int_buf, sizeof (uint32_t), stream) !=
sizeof (uint32_t))
goto end;
}
len = section_count * sizeof (struct external_scnhdr);
buf = xmalloc (len);
- if (bfd_bread (buf, len, abfd) != len)
+ if (bfd_read (buf, len, abfd) != len)
{
free (buf);
return false;
}
- if (bfd_bwrite (buf, len, stream) != len)
+ if (bfd_write (buf, len, stream) != len)
{
free (buf);
return false;
bfd_putl32 (STRING_TABLE_SIGNATURE, &h.signature);
bfd_putl32 (STRING_TABLE_VERSION, &h.version);
- if (bfd_bwrite (&h, sizeof (h), stream) != sizeof (h))
+ if (bfd_write (&h, sizeof (h), stream) != sizeof (h))
return false;
bfd_putl32 (strings->strings_len, int_buf);
- if (bfd_bwrite (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t))
+ if (bfd_write (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t))
return false;
int_buf[0] = 0;
- if (bfd_bwrite (int_buf, 1, stream) != 1)
+ if (bfd_write (int_buf, 1, stream) != 1)
return false;
for (struct string *s = strings->strings_head; s; s = s->next)
{
- if (bfd_bwrite (s->s, s->len, stream) != s->len)
+ if (bfd_write (s->s, s->len, stream) != s->len)
return false;
- if (bfd_bwrite (int_buf, 1, stream) != 1)
+ if (bfd_write (int_buf, 1, stream) != 1)
return false;
num_strings++;
bfd_putl32 (num_buckets, int_buf);
- if (bfd_bwrite (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t))
+ if (bfd_write (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t))
{
free (buckets);
return false;
else
bfd_putl32 (0, int_buf);
- if (bfd_bwrite (int_buf, sizeof (uint32_t), stream) !=
+ if (bfd_write (int_buf, sizeof (uint32_t), stream) !=
sizeof (uint32_t))
{
free (buckets);
bfd_putl32 (num_strings, int_buf);
- if (bfd_bwrite (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t))
+ if (bfd_write (int_buf, sizeof (uint32_t), stream) != sizeof (uint32_t))
return false;
return true;
{
unsigned char b[2];
- bfd_seek (abfd, (file_ptr) where, SEEK_SET);
- bfd_bread (b, (bfd_size_type) 2, abfd);
+ bfd_seek (abfd, where, SEEK_SET);
+ bfd_read (b, 2, abfd);
return b[0] + (b[1] << 8);
}
{
unsigned char b[4];
- bfd_seek (abfd, (file_ptr) where, SEEK_SET);
- bfd_bread (b, (bfd_size_type) 4, abfd);
+ bfd_seek (abfd, where, SEEK_SET);
+ bfd_read (b, 4, abfd);
return b[0] + (b[1] << 8) + (b[2] << 16) + ((unsigned) b[3] << 24);
}
bfd_vma vsize = pe_get32 (dll, secptr1 + 16);
bfd_vma fptr = pe_get32 (dll, secptr1 + 20);
- bfd_seek (dll, (file_ptr) secptr1, SEEK_SET);
- bfd_bread (sname, (bfd_size_type) 8, dll);
+ bfd_seek (dll, secptr1, SEEK_SET);
+ bfd_read (sname, 8, dll);
if (vaddr <= export_rva && vaddr + vsize > export_rva)
{
char sec_name[9];
sec_name[8] = '\0';
- bfd_seek (dll, (file_ptr) secptr1 + 0, SEEK_SET);
- bfd_bread (sec_name, (bfd_size_type) 8, dll);
+ bfd_seek (dll, secptr1 + 0, SEEK_SET);
+ bfd_read (sec_name, 8, dll);
if (strcmp(sec_name,".data") == 0)
{
}
expdata = xmalloc (export_size);
- bfd_seek (dll, (file_ptr) expptr, SEEK_SET);
- bfd_bread (expdata, (bfd_size_type) export_size, dll);
+ bfd_seek (dll, expptr, SEEK_SET);
+ bfd_read (expdata, export_size, dll);
erva = (char *) expdata - export_rva;
if (pe_def_file == 0)
goto skip_fdpic_init;
if (bfd_seek (abfd, 0, SEEK_SET) != 0)
goto skip_fdpic_init;
- if (bfd_bread (&ehdr, sizeof (ehdr), abfd) != sizeof (ehdr))
+ if (bfd_read (&ehdr, sizeof (ehdr), abfd) != sizeof (ehdr))
goto skip_fdpic_init;
iehdr = elf_elfheader (abfd);
if (!(iehdr->e_flags & EF_BFIN_FDPIC))
if (bfd_seek (abfd, iehdr->e_phoff, SEEK_SET) != 0)
goto skip_fdpic_init;
data = xmalloc (phdr_size);
- if (bfd_bread (data, phdr_size, abfd) != phdr_size)
+ if (bfd_read (data, phdr_size, abfd) != phdr_size)
goto skip_fdpic_init;
*sp -= phdr_size;
elf_addrs[1] = *sp;
memset (data + filesz, 0, memsz - filesz);
if (bfd_seek (abfd, p->p_offset, SEEK_SET) == 0
- && bfd_bread (data, filesz, abfd) == filesz)
+ && bfd_read (data, filesz, abfd) == filesz)
sim_write (sd, paddr, data, memsz);
free (data);
*ldso_path = xmalloc (len);
if (bfd_seek (abfd, off, SEEK_SET) != 0
- || bfd_bread (*ldso_path, len, abfd) != len)
+ || bfd_read (*ldso_path, len, abfd) != len)
{
free (*ldso_path);
*ldso_path = NULL;
(uint64_t) lma, (uint64_t) phdr[i].p_filesz);
if (bfd_seek (abfd, phdr[i].p_offset, SEEK_SET) != 0
- || (bfd_bread (buf, phdr[i].p_filesz, abfd) != phdr[i].p_filesz))
+ || (bfd_read (buf, phdr[i].p_filesz, abfd) != phdr[i].p_filesz))
{
sim_io_eprintf (sd,
"%s: could not read segment at 0x%" PRIx64 ", "
/* Read in the name. */
if (bfd_seek (abfd, phdr[i].p_offset, SEEK_SET) != 0
- || (bfd_bread (interp + strlen (simulator_sysroot), interplen, abfd)
+ || (bfd_read (interp + strlen (simulator_sysroot), interplen, abfd)
!= interplen))
goto interpname_failed;
continue;
}
- if (bfd_bread (buf, size, prog) != size)
+ if (bfd_read (buf, size, prog) != size)
{
fprintf (stderr, "%s: Failed to read %" PRIx64 " bytes\n",
simname, (uint64_t) size);
fprintf (stderr, "Failed to seek to offset %lx\n", (long) offset);
continue;
}
- if (bfd_bread (buf, size, prog) != size)
+ if (bfd_read (buf, size, prog) != size)
{
fprintf (stderr, "Failed to read %" PRIx64 " bytes\n",
(uint64_t) size);