summaryrefslogtreecommitdiff
path: root/bfd/binary.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2001-09-18 09:57:26 +0000
committerAlan Modra <amodra@bigpond.net.au>2001-09-18 09:57:26 +0000
commit439c22790eb92fc38c0c4e91bc343ef8d0e55427 (patch)
treeeb49f3489bb7e104ca1c425d07d5d954ab03148f /bfd/binary.c
parent8ff532ca9bf72656df68051c20729d9fdec919b9 (diff)
downloadgdb-439c22790eb92fc38c0c4e91bc343ef8d0e55427.tar.gz
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/binary.c')
-rw-r--r--bfd/binary.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/bfd/binary.c b/bfd/binary.c
index 7fd01b37189..4d2fe03d6d8 100644
--- a/bfd/binary.c
+++ b/bfd/binary.c
@@ -1,5 +1,5 @@
/* BFD back-end for binary objects.
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>
@@ -111,7 +111,7 @@ binary_object_p (abfd)
&& (bfd_external_binary_architecture != bfd_arch_unknown))
bfd_set_arch_info (abfd, bfd_lookup_arch (bfd_external_binary_architecture, 0));
}
-
+
return abfd->xvec;
}
@@ -130,7 +130,7 @@ binary_get_section_contents (abfd, section, location, offset, count)
bfd_size_type count;
{
if (bfd_seek (abfd, offset, SEEK_SET) != 0
- || bfd_read (location, 1, count, abfd) != count)
+ || bfd_bread (location, count, abfd) != count)
return false;
return true;
}
@@ -151,7 +151,7 @@ mangle_name (abfd, suffix)
bfd *abfd;
char *suffix;
{
- int size;
+ bfd_size_type size;
char *buf;
char *p;
@@ -183,8 +183,9 @@ binary_get_symtab (abfd, alocation)
asection *sec = (asection *) abfd->tdata.any;
asymbol *syms;
unsigned int i;
+ bfd_size_type amt = BIN_SYMS * sizeof (asymbol);
- syms = (asymbol *) bfd_alloc (abfd, BIN_SYMS * sizeof (asymbol));
+ syms = (asymbol *) bfd_alloc (abfd, amt);
if (syms == NULL)
return false;
@@ -225,7 +226,7 @@ static asymbol *
binary_make_empty_symbol (abfd)
bfd *abfd;
{
- return (asymbol *) bfd_alloc (abfd, sizeof (asymbol));
+ return (asymbol *) bfd_alloc (abfd, (bfd_size_type) sizeof (asymbol));
}
#define binary_print_symbol _bfd_nosymbols_print_symbol