aboutsummaryrefslogtreecommitdiff
path: root/bfd/archive64.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2003-06-29 10:06:40 +0000
committerAlan Modra <amodra@gmail.com>2003-06-29 10:06:40 +0000
commitc58b95236ce4c9345c4fa76e7ef16762e5229380 (patch)
tree332a115744ba45143797b861b78058e6f42fb995 /bfd/archive64.c
parent58611256d83c4bd2c27a88982d8449c99fdd154f (diff)
downloadgdb-c58b95236ce4c9345c4fa76e7ef16762e5229380.zip
gdb-c58b95236ce4c9345c4fa76e7ef16762e5229380.tar.gz
gdb-c58b95236ce4c9345c4fa76e7ef16762e5229380.tar.bz2
Convert to C90 and a few tweaks.
Diffstat (limited to 'bfd/archive64.c')
-rw-r--r--bfd/archive64.c44
1 files changed, 21 insertions, 23 deletions
diff --git a/bfd/archive64.c b/bfd/archive64.c
index 6267e68..1b9f5f3 100644
--- a/bfd/archive64.c
+++ b/bfd/archive64.c
@@ -1,5 +1,5 @@
/* MIPS-specific support for 64-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Ian Lance Taylor, Cygnus Support
Linker support added by Mark Mitchell, CodeSourcery, LLC.
@@ -31,15 +31,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Irix 6 defines a 64bit archive map format, so that they can
have archives more than 4 GB in size. */
-bfd_boolean bfd_elf64_archive_slurp_armap PARAMS ((bfd *));
+bfd_boolean bfd_elf64_archive_slurp_armap (bfd *);
bfd_boolean bfd_elf64_archive_write_armap
- PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
+ (bfd *, unsigned int, struct orl *, unsigned int, int);
/* Read an Irix 6 armap. */
bfd_boolean
-bfd_elf64_archive_slurp_armap (abfd)
- bfd *abfd;
+bfd_elf64_archive_slurp_armap (bfd *abfd)
{
struct artdata *ardata = bfd_ardata (abfd);
char nextname[17];
@@ -56,7 +55,7 @@ bfd_elf64_archive_slurp_armap (abfd)
/* Get the name of the first element. */
arhdrpos = bfd_tell (abfd);
- i = bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd);
+ i = bfd_bread (nextname, 16, abfd);
if (i == 0)
return TRUE;
if (i != 16)
@@ -79,9 +78,9 @@ bfd_elf64_archive_slurp_armap (abfd)
if (mapdata == NULL)
return FALSE;
parsed_size = mapdata->parsed_size;
- bfd_release (abfd, (PTR) mapdata);
+ bfd_release (abfd, mapdata);
- if (bfd_bread (int_buf, (bfd_size_type) 8, abfd) != 8)
+ if (bfd_bread (int_buf, 8, abfd) != 8)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
@@ -95,13 +94,13 @@ bfd_elf64_archive_slurp_armap (abfd)
ptrsize = 8 * nsymz;
amt = carsym_size + stringsize + 1;
- ardata->symdefs = (carsym *) bfd_zalloc (abfd, amt);
+ ardata->symdefs = bfd_zalloc (abfd, amt);
if (ardata->symdefs == NULL)
return FALSE;
carsyms = ardata->symdefs;
stringbase = ((char *) ardata->symdefs) + carsym_size;
- raw_armap = (bfd_byte *) bfd_alloc (abfd, ptrsize);
+ raw_armap = bfd_alloc (abfd, ptrsize);
if (raw_armap == NULL)
goto release_symdefs;
@@ -144,12 +143,11 @@ release_symdefs:
linker crashes. */
bfd_boolean
-bfd_elf64_archive_write_armap (arch, elength, map, symbol_count, stridx)
- bfd *arch;
- unsigned int elength;
- struct orl *map;
- unsigned int symbol_count;
- int stridx;
+bfd_elf64_archive_write_armap (bfd *arch,
+ unsigned int elength,
+ struct orl *map,
+ unsigned int symbol_count,
+ int stridx)
{
unsigned int ranlibsize = (symbol_count * 8) + 8;
unsigned int stringsize = stridx;
@@ -171,7 +169,7 @@ bfd_elf64_archive_write_armap (arch, elength, map, symbol_count, stridx)
+ sizeof (struct ar_hdr)
+ SARMAG);
- memset ((char *) (&hdr), 0, sizeof (struct ar_hdr));
+ memset (&hdr, 0, sizeof (struct ar_hdr));
strcpy (hdr.ar_name, "/SYM64/");
sprintf (hdr.ar_size, "%-10d", (int) mapsize);
sprintf (hdr.ar_date, "%ld", (long) time (NULL));
@@ -187,12 +185,12 @@ bfd_elf64_archive_write_armap (arch, elength, map, symbol_count, stridx)
/* Write the ar header for this item and the number of symbols */
- if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), arch)
+ if (bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
!= sizeof (struct ar_hdr))
return FALSE;
bfd_putb64 ((bfd_vma) symbol_count, buf);
- if (bfd_bwrite (buf, (bfd_size_type) 8, arch) != 8)
+ if (bfd_bwrite (buf, 8, arch) != 8)
return FALSE;
/* Two passes, first write the file offsets for each symbol -
@@ -203,7 +201,7 @@ bfd_elf64_archive_write_armap (arch, elength, map, symbol_count, stridx)
current = arch->archive_head;
count = 0;
- while (current != (bfd *) NULL && count < symbol_count)
+ while (current != NULL && count < symbol_count)
{
/* For each symbol which is used defined in this object, write out
the object file's address in the archive */
@@ -211,7 +209,7 @@ bfd_elf64_archive_write_armap (arch, elength, map, symbol_count, stridx)
while (map[count].u.abfd == current)
{
bfd_putb64 ((bfd_vma) archive_member_file_ptr, buf);
- if (bfd_bwrite (buf, (bfd_size_type) 8, arch) != 8)
+ if (bfd_bwrite (buf, 8, arch) != 8)
return FALSE;
count++;
}
@@ -228,7 +226,7 @@ bfd_elf64_archive_write_armap (arch, elength, map, symbol_count, stridx)
{
size_t len = strlen (*map[count].name) + 1;
- if (bfd_bwrite (*map[count].name, (bfd_size_type) len, arch) != len)
+ if (bfd_bwrite (*map[count].name, len, arch) != len)
return FALSE;
}
@@ -236,7 +234,7 @@ bfd_elf64_archive_write_armap (arch, elength, map, symbol_count, stridx)
However, the Irix 6.2 tools do not appear to do this. */
while (padding != 0)
{
- if (bfd_bwrite ("", (bfd_size_type) 1, arch) != 1)
+ if (bfd_bwrite ("", 1, arch) != 1)
return FALSE;
--padding;
}