aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2001-09-18 09:57:26 +0000
committerAlan Modra <amodra@gmail.com>2001-09-18 09:57:26 +0000
commitdc810e3900d47ab2eea86d50231ff2e70b596847 (patch)
tree13fc3d267fb99c450380f08a0775b2dff076b8d7 /bfd/ppcboot.c
parentFix typo (diff)
downloadbinutils-gdb-dc810e3900d47ab2eea86d50231ff2e70b596847.tar.gz
binutils-gdb-dc810e3900d47ab2eea86d50231ff2e70b596847.tar.bz2
binutils-gdb-dc810e3900d47ab2eea86d50231ff2e70b596847.zip
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become bfd_bread and bfd_bwrite. o bfd_*alloc now all take a bfd_size_type arg, and will error if size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files or bugs in linker scripts etc. o file_ptr becomes a bfd_signed_vma. Besides matching sizes with various other types involved in handling sections, this should make it easier for bfd to support a 64 bit off_t on 32 bit hosts that provide it. o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*) generally available. They now cast their args to bfd_vma and bfd_byte * as appropriate, which removes a swag of casts from the source. o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and aout-encap.c. o Zillions of formatting and -Wconversion fixes.
Diffstat (limited to 'bfd/ppcboot.c')
-rw-r--r--bfd/ppcboot.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c
index eccbe7980cb..478d55a2342 100644
--- a/bfd/ppcboot.c
+++ b/bfd/ppcboot.c
@@ -114,7 +114,10 @@ ppcboot_mkobject (abfd)
bfd *abfd;
{
if (!ppcboot_get_tdata (abfd))
- ppcboot_set_tdata (abfd, bfd_zalloc (abfd, sizeof (ppcboot_data_t)));
+ {
+ bfd_size_type amt = sizeof (ppcboot_data_t);
+ ppcboot_set_tdata (abfd, bfd_zalloc (abfd, amt));
+ }
return true;
}
@@ -172,7 +175,8 @@ ppcboot_object_p (abfd)
return NULL;
}
- if (bfd_read ((PTR) &hdr, sizeof (hdr), 1, abfd) != sizeof (hdr))
+ if (bfd_bread ((PTR) &hdr, (bfd_size_type) sizeof (hdr), abfd)
+ != sizeof (hdr))
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
@@ -216,7 +220,7 @@ ppcboot_object_p (abfd)
tdata->sec = sec;
memcpy ((PTR) &tdata->header, (PTR) &hdr, sizeof (ppcboot_hdr_t));
- ppcboot_set_arch_mach (abfd, bfd_arch_powerpc, 0);
+ ppcboot_set_arch_mach (abfd, bfd_arch_powerpc, 0L);
return abfd->xvec;
}
@@ -235,8 +239,8 @@ ppcboot_get_section_contents (abfd, section, location, offset, count)
file_ptr offset;
bfd_size_type count;
{
- if (bfd_seek (abfd, offset + sizeof (ppcboot_hdr_t), SEEK_SET) != 0
- || bfd_read (location, 1, count, abfd) != count)
+ if (bfd_seek (abfd, offset + (file_ptr) sizeof (ppcboot_hdr_t), SEEK_SET) != 0
+ || bfd_bread (location, count, abfd) != count)
return false;
return true;
}
@@ -259,7 +263,7 @@ mangle_name (abfd, suffix)
bfd *abfd;
char *suffix;
{
- int size;
+ bfd_size_type size;
char *buf;
char *p;
@@ -292,8 +296,9 @@ ppcboot_get_symtab (abfd, alocation)
asection *sec = ppcboot_get_tdata (abfd)->sec;
asymbol *syms;
unsigned int i;
+ bfd_size_type amt = PPCBOOT_SYMS * sizeof (asymbol);
- syms = (asymbol *) bfd_alloc (abfd, PPCBOOT_SYMS * sizeof (asymbol));
+ syms = (asymbol *) bfd_alloc (abfd, amt);
if (syms == NULL)
return false;
@@ -335,7 +340,7 @@ static asymbol *
ppcboot_make_empty_symbol (abfd)
bfd *abfd;
{
- return (asymbol *) bfd_alloc (abfd, sizeof (asymbol));
+ return (asymbol *) bfd_alloc (abfd, (bfd_size_type) sizeof (asymbol));
}