diff options
author | Alan Modra <amodra@gmail.com> | 2003-06-29 10:06:40 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2003-06-29 10:06:40 +0000 |
commit | c58b95236ce4c9345c4fa76e7ef16762e5229380 (patch) | |
tree | 332a115744ba45143797b861b78058e6f42fb995 | |
parent | 58611256d83c4bd2c27a88982d8449c99fdd154f (diff) | |
download | binutils-gdb-c58b95236ce4c9345c4fa76e7ef16762e5229380.tar.gz |
Convert to C90 and a few tweaks.
-rw-r--r-- | bfd/ChangeLog | 34 | ||||
-rw-r--r-- | bfd/archive.c | 404 | ||||
-rw-r--r-- | bfd/archive64.c | 44 | ||||
-rw-r--r-- | bfd/archures.c | 120 | ||||
-rw-r--r-- | bfd/bfd-in.h | 343 | ||||
-rw-r--r-- | bfd/bfd-in2.h | 1115 | ||||
-rw-r--r-- | bfd/bfd.c | 227 | ||||
-rw-r--r-- | bfd/bfdio.c | 52 | ||||
-rw-r--r-- | bfd/bfdwin.c | 28 | ||||
-rw-r--r-- | bfd/cache.c | 38 | ||||
-rw-r--r-- | bfd/corefile.c | 51 | ||||
-rw-r--r-- | bfd/doc/ChangeLog | 4 | ||||
-rw-r--r-- | bfd/doc/chew.c | 7 | ||||
-rw-r--r-- | bfd/ecoff.c | 4 | ||||
-rw-r--r-- | bfd/format.c | 40 | ||||
-rw-r--r-- | bfd/init.c | 4 | ||||
-rw-r--r-- | bfd/libbfd-in.h | 364 | ||||
-rw-r--r-- | bfd/libbfd.c | 391 | ||||
-rw-r--r-- | bfd/libbfd.h | 426 | ||||
-rw-r--r-- | bfd/linker.c | 505 | ||||
-rw-r--r-- | bfd/opncls.c | 175 | ||||
-rw-r--r-- | bfd/reloc.c | 239 | ||||
-rw-r--r-- | bfd/section.c | 161 | ||||
-rw-r--r-- | bfd/simple.c | 125 | ||||
-rw-r--r-- | bfd/syms.c | 148 | ||||
-rw-r--r-- | bfd/targets.c | 335 |
26 files changed, 2354 insertions, 3030 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b3f08bc4836..f2e5665b982 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,37 @@ +2003-06-29 Alan Modra <amodra@bigpond.net.au> + + * archive.c: Convert to C90, remove unnecessary prototypes and casts. + Replace PTR with void *. Formatting. + * archive64.c: Likewise. + * archures.c: Likewise. + * bfd-in.h: Likewise. + * bfd.c: Likewise. + * bfdio.c: Likewise. + * bfdwin.c: Likewise. + * cache.c: Likewise. + * corefile.c: Likewise. + * format.c: Likewise. + * init.c: Likewise. + * libbfd-in.h: Likewise. + * libbfd.c: Likewise. + * linker.c: Likewise. + * opncls.c: Likewise. + * reloc.c: Likewise. + * section.c: Likewise. + * simple.c: Likewise. + * syms.c: Likewise. + * targets.c: Likewise. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + + * ecoff.c (bfd_debug_section): Add missing kept_section initialization. + * libbfd-in.h (_bfd_sh_align_load_span): Don't declare if defined. + * libbfd.c (COERCE32, EIGHT_GAZILLION): Simplify. + (bfd_getb64): Rewrite without parens. + (bfd_getl64, bfd_getb_signed_64, bfd_getl_signed_64): Likewise. + * cache.c (insert, snip): Remove INLINE. + * linker.c (bfd_link_add_undef): Likewise. + 2003-06-29 Andreas Jaeger <aj@suse.de> * elf64-x86-64.c: Convert to ISO C90 prototypes, remove diff --git a/bfd/archive.c b/bfd/archive.c index ffb0bd4c875..c4171e7bc83 100644 --- a/bfd/archive.c +++ b/bfd/archive.c @@ -1,6 +1,6 @@ /* BFD back-end for archive files (libraries). Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002 + 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. Mostly Gumby Henkel-Wallace's fault. @@ -158,28 +158,15 @@ struct ar_cache { #define ar_maxnamelen(abfd) ((abfd)->xvec->ar_max_namelen) #define arch_eltdata(bfd) ((struct areltdata *) ((bfd)->arelt_data)) -#define arch_hdr(bfd) ((struct ar_hdr *)arch_eltdata(bfd)->arch_header) - -static char *get_extended_arelt_filename - PARAMS ((bfd *arch, const char *name)); -static bfd_boolean do_slurp_bsd_armap - PARAMS ((bfd *abfd)); -static bfd_boolean do_slurp_coff_armap - PARAMS ((bfd *abfd)); -bfd_boolean bfd_elf64_archive_slurp_armap - PARAMS ((bfd *abfd)); -static const char *normalize - PARAMS ((bfd *, const char *file)); -static struct areltdata *bfd_ar_hdr_from_filesystem - PARAMS ((bfd *abfd, const char *, bfd *member)); +#define arch_hdr(bfd) ((struct ar_hdr *) arch_eltdata(bfd)->arch_header) + bfd_boolean -_bfd_generic_mkarchive (abfd) - bfd *abfd; +_bfd_generic_mkarchive (bfd *abfd) { bfd_size_type amt = sizeof (struct artdata); - abfd->tdata.aout_ar_data = (struct artdata *) bfd_zalloc (abfd, amt); + abfd->tdata.aout_ar_data = bfd_zalloc (abfd, amt); if (bfd_ardata (abfd) == NULL) return FALSE; @@ -197,7 +184,8 @@ FUNCTION bfd_get_next_mapent SYNOPSIS - symindex bfd_get_next_mapent(bfd *abfd, symindex previous, carsym **sym); + symindex bfd_get_next_mapent + (bfd *abfd, symindex previous, carsym **sym); DESCRIPTION Step through archive @var{abfd}'s symbol table (if it @@ -214,10 +202,7 @@ DESCRIPTION */ symindex -bfd_get_next_mapent (abfd, prev, entry) - bfd *abfd; - symindex prev; - carsym **entry; +bfd_get_next_mapent (bfd *abfd, symindex prev, carsym **entry) { if (!bfd_has_map (abfd)) { @@ -239,8 +224,7 @@ bfd_get_next_mapent (abfd, prev, entry) /* To be called by backends only */ bfd * -_bfd_create_empty_archive_element_shell (obfd) - bfd *obfd; +_bfd_create_empty_archive_element_shell (bfd *obfd) { return _bfd_new_bfd_contained_in (obfd); } @@ -250,7 +234,7 @@ FUNCTION bfd_set_archive_head SYNOPSIS - bfd_boolean bfd_set_archive_head(bfd *output, bfd *new_head); + bfd_boolean bfd_set_archive_head (bfd *output, bfd *new_head); DESCRIPTION Set the head of the chain of @@ -258,19 +242,14 @@ DESCRIPTION */ bfd_boolean -bfd_set_archive_head (output_archive, new_head) - bfd *output_archive; - bfd *new_head; +bfd_set_archive_head (bfd *output_archive, bfd *new_head) { - output_archive->archive_head = new_head; return TRUE; } bfd * -_bfd_look_for_bfd_in_cache (arch_bfd, filepos) - bfd *arch_bfd; - file_ptr filepos; +_bfd_look_for_bfd_in_cache (bfd *arch_bfd, file_ptr filepos) { struct ar_cache *current; @@ -284,19 +263,17 @@ _bfd_look_for_bfd_in_cache (arch_bfd, filepos) /* Kind of stupid to call cons for each one, but we don't do too many */ bfd_boolean -_bfd_add_bfd_to_archive_cache (arch_bfd, filepos, new_elt) - bfd *arch_bfd, *new_elt; - file_ptr filepos; +_bfd_add_bfd_to_archive_cache (bfd *arch_bfd, file_ptr filepos, bfd *new_elt) { bfd_size_type amt = sizeof (struct ar_cache); - struct ar_cache *new_cache = (struct ar_cache *) bfd_zalloc (arch_bfd, amt); + struct ar_cache *new_cache = bfd_zalloc (arch_bfd, amt); if (new_cache == NULL) return FALSE; new_cache->ptr = filepos; new_cache->arelt = new_elt; - new_cache->next = (struct ar_cache *) NULL; + new_cache->next = NULL; if (bfd_ardata (arch_bfd)->cache == NULL) bfd_ardata (arch_bfd)->cache = new_cache; else @@ -315,9 +292,7 @@ _bfd_add_bfd_to_archive_cache (arch_bfd, filepos, new_elt) the string table. */ static char * -get_extended_arelt_filename (arch, name) - bfd *arch; - const char *name; +get_extended_arelt_filename (bfd *arch, const char *name) { unsigned long index = 0; @@ -344,20 +319,17 @@ get_extended_arelt_filename (arch, name) could have been moved arbitrarily. */ -PTR -_bfd_generic_read_ar_hdr (abfd) - bfd *abfd; +void * +_bfd_generic_read_ar_hdr (bfd *abfd) { - return _bfd_generic_read_ar_hdr_mag (abfd, (const char *) NULL); + return _bfd_generic_read_ar_hdr_mag (abfd, NULL); } /* Alpha ECOFF uses an optional different ARFMAG value, so we have a variant of _bfd_generic_read_ar_hdr which accepts a magic string. */ -PTR -_bfd_generic_read_ar_hdr_mag (abfd, mag) - bfd *abfd; - const char *mag; +void * +_bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag) { struct ar_hdr hdr; char *hdrp = (char *) &hdr; @@ -368,8 +340,7 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag) bfd_size_type allocsize = sizeof (struct areltdata) + sizeof (struct ar_hdr); char *allocptr = 0; - if (bfd_bread ((PTR) hdrp, (bfd_size_type) sizeof (struct ar_hdr), abfd) - != sizeof (struct ar_hdr)) + if (bfd_bread (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); @@ -439,12 +410,12 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag) spaces, so only look for ' ' if we don't find '/'. */ char *e; - e = (char *) memchr (hdr.ar_name, '\0', ar_maxnamelen (abfd)); + e = memchr (hdr.ar_name, '\0', ar_maxnamelen (abfd)); if (e == NULL) { - e = (char *) memchr (hdr.ar_name, '/', ar_maxnamelen (abfd)); + e = memchr (hdr.ar_name, '/', ar_maxnamelen (abfd)); if (e == NULL) - e = (char *) memchr (hdr.ar_name, ' ', ar_maxnamelen (abfd)); + e = memchr (hdr.ar_name, ' ', ar_maxnamelen (abfd)); } if (e != NULL) @@ -469,7 +440,7 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag) ared = (struct areltdata *) allocptr; ared->arch_header = allocptr + sizeof (struct areltdata); - memcpy ((char *) ared->arch_header, (char *) &hdr, sizeof (struct ar_hdr)); + memcpy (ared->arch_header, &hdr, sizeof (struct ar_hdr)); ared->parsed_size = parsed_size; if (filename != NULL) @@ -479,11 +450,11 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag) ared->filename = allocptr + (sizeof (struct areltdata) + sizeof (struct ar_hdr)); if (namelen) - memcpy (ared->filename, hdr.ar_name, (size_t) namelen); + memcpy (ared->filename, hdr.ar_name, namelen); ared->filename[namelen] = '\0'; } - return (PTR) ared; + return ared; } /* This is an internal function; it's mainly used when indexing @@ -491,9 +462,7 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag) element, since it handles the bookkeeping so nicely for us. */ bfd * -_bfd_get_elt_at_filepos (archive, filepos) - bfd *archive; - file_ptr filepos; +_bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos) { struct areltdata *new_areldata; bfd *n_nfd; @@ -505,26 +474,26 @@ _bfd_get_elt_at_filepos (archive, filepos) if (0 > bfd_seek (archive, filepos, SEEK_SET)) return NULL; - if ((new_areldata = (struct areltdata *) _bfd_read_ar_hdr (archive)) == NULL) + if ((new_areldata = _bfd_read_ar_hdr (archive)) == NULL) return NULL; n_nfd = _bfd_create_empty_archive_element_shell (archive); if (n_nfd == NULL) { - bfd_release (archive, (PTR) new_areldata); + bfd_release (archive, new_areldata); return NULL; } n_nfd->origin = bfd_tell (archive); - n_nfd->arelt_data = (PTR) new_areldata; + n_nfd->arelt_data = new_areldata; n_nfd->filename = new_areldata->filename; if (_bfd_add_bfd_to_archive_cache (archive, filepos, n_nfd)) return n_nfd; /* Huh? */ - bfd_release (archive, (PTR) n_nfd); - bfd_release (archive, (PTR) new_areldata); + bfd_release (archive, n_nfd); + bfd_release (archive, new_areldata); return NULL; } @@ -532,9 +501,7 @@ _bfd_get_elt_at_filepos (archive, filepos) INDEX. INDEX should have been returned by bfd_get_next_mapent. */ bfd * -_bfd_generic_get_elt_at_index (abfd, index) - bfd *abfd; - symindex index; +_bfd_generic_get_elt_at_index (bfd *abfd, symindex index) { carsym *entry; @@ -547,7 +514,7 @@ FUNCTION bfd_openr_next_archived_file SYNOPSIS - bfd *bfd_openr_next_archived_file(bfd *archive, bfd *previous); + bfd *bfd_openr_next_archived_file (bfd *archive, bfd *previous); DESCRIPTION Provided a BFD, @var{archive}, containing an archive and NULL, open @@ -559,9 +526,7 @@ DESCRIPTION */ bfd * -bfd_openr_next_archived_file (archive, last_file) - bfd *archive; - bfd *last_file; +bfd_openr_next_archived_file (bfd *archive, bfd *last_file) { if ((bfd_get_format (archive) != bfd_archive) || (archive->direction == write_direction)) @@ -571,15 +536,11 @@ bfd_openr_next_archived_file (archive, last_file) } return BFD_SEND (archive, - openr_next_archived_file, - (archive, - last_file)); + openr_next_archived_file, (archive, last_file)); } bfd * -bfd_generic_openr_next_archived_file (archive, last_file) - bfd *archive; - bfd *last_file; +bfd_generic_openr_next_archived_file (bfd *archive, bfd *last_file) { file_ptr filestart; @@ -599,14 +560,13 @@ bfd_generic_openr_next_archived_file (archive, last_file) } const bfd_target * -bfd_generic_archive_p (abfd) - bfd *abfd; +bfd_generic_archive_p (bfd *abfd) { struct artdata *tdata_hold; char armag[SARMAG + 1]; bfd_size_type amt; - if (bfd_bread ((PTR) armag, (bfd_size_type) SARMAG, abfd) != SARMAG) + if (bfd_bread (armag, SARMAG, abfd) != SARMAG) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -625,7 +585,7 @@ bfd_generic_archive_p (abfd) tdata_hold = bfd_ardata (abfd); amt = sizeof (struct artdata); - bfd_ardata (abfd) = (struct artdata *) bfd_zalloc (abfd, amt); + bfd_ardata (abfd) = bfd_zalloc (abfd, amt); if (bfd_ardata (abfd) == NULL) { bfd_ardata (abfd) = tdata_hold; @@ -664,7 +624,7 @@ bfd_generic_archive_p (abfd) normal archive, regardless of the format of the object files. We do accept an empty archive. */ - first = bfd_openr_next_archived_file (abfd, (bfd *) NULL); + first = bfd_openr_next_archived_file (abfd, NULL); if (first != NULL) { bfd_boolean fail; @@ -679,7 +639,7 @@ bfd_generic_archive_p (abfd) we have no way to remove it from the archive cache. It's close to impossible to figure out when we can release bfd_ardata. FIXME. */ - (void) bfd_close (first); + bfd_close (first); bfd_release (abfd, bfd_ardata (abfd)); #endif bfd_set_error (bfd_error_wrong_object_format); @@ -713,8 +673,7 @@ bfd_generic_archive_p (abfd) /* Returns FALSE on error, TRUE otherwise */ static bfd_boolean -do_slurp_bsd_armap (abfd) - bfd *abfd; +do_slurp_bsd_armap (bfd *abfd) { struct areltdata *mapdata; unsigned int counter; @@ -724,22 +683,22 @@ do_slurp_bsd_armap (abfd) bfd_size_type parsed_size, amt; carsym *set; - mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd); + mapdata = _bfd_read_ar_hdr (abfd); if (mapdata == NULL) return FALSE; parsed_size = mapdata->parsed_size; - bfd_release (abfd, (PTR) mapdata); /* Don't need it any more. */ + bfd_release (abfd, mapdata); /* Don't need it any more. */ - raw_armap = (bfd_byte *) bfd_zalloc (abfd, parsed_size); - if (raw_armap == (bfd_byte *) NULL) + raw_armap = bfd_zalloc (abfd, parsed_size); + if (raw_armap == NULL) return FALSE; - if (bfd_bread ((PTR) raw_armap, parsed_size, abfd) != parsed_size) + if (bfd_bread (raw_armap, parsed_size, abfd) != parsed_size) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_malformed_archive); byebye: - bfd_release (abfd, (PTR) raw_armap); + bfd_release (abfd, raw_armap); return FALSE; } @@ -758,8 +717,8 @@ do_slurp_bsd_armap (abfd) stringbase = ((char *) rbase + ardata->symdef_count * BSD_SYMDEF_SIZE + BSD_STRING_COUNT_SIZE); - amt = (bfd_size_type) ardata->symdef_count * sizeof (carsym); - ardata->symdefs = (carsym *) bfd_alloc (abfd, amt); + amt = ardata->symdef_count * sizeof (carsym); + ardata->symdefs = bfd_alloc (abfd, amt); if (!ardata->symdefs) return FALSE; @@ -784,8 +743,7 @@ do_slurp_bsd_armap (abfd) /* Returns FALSE on error, TRUE otherwise. */ static bfd_boolean -do_slurp_coff_armap (abfd) - bfd *abfd; +do_slurp_coff_armap (bfd *abfd) { struct areltdata *mapdata; int *raw_armap, *rawptr; @@ -795,18 +753,18 @@ do_slurp_coff_armap (abfd) unsigned int parsed_size; carsym *carsyms; bfd_size_type nsymz; /* Number of symbols in armap. */ - bfd_vma (*swap) PARAMS ((const bfd_byte *)); + bfd_vma (*swap) (const bfd_byte *); char int_buf[sizeof (long)]; bfd_size_type carsym_size, ptrsize; unsigned int i; - mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd); + mapdata = _bfd_read_ar_hdr (abfd); if (mapdata == NULL) return FALSE; parsed_size = mapdata->parsed_size; - bfd_release (abfd, (PTR) mapdata); /* Don't need it any more. */ + bfd_release (abfd, mapdata); /* Don't need it any more. */ - if (bfd_bread ((PTR) int_buf, (bfd_size_type) 4, abfd) != 4) + if (bfd_bread (int_buf, 4, abfd) != 4) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_malformed_archive); @@ -815,7 +773,7 @@ do_slurp_coff_armap (abfd) /* It seems that all numeric information in a coff archive is always in big endian format, nomatter the host or target. */ swap = bfd_getb32; - nsymz = bfd_getb32 ((PTR) int_buf); + nsymz = bfd_getb32 (int_buf); stringsize = parsed_size - (4 * nsymz) - 4; #if 1 @@ -829,7 +787,7 @@ do_slurp_coff_armap (abfd) && bfd_get_flavour (abfd) == bfd_target_coff_flavour) { /* This looks dangerous, let's do it the other way around. */ - nsymz = bfd_getl32 ((PTR) int_buf); + nsymz = bfd_getl32 (int_buf); stringsize = parsed_size - (4 * nsymz) - 4; swap = bfd_getl32; } @@ -841,18 +799,18 @@ do_slurp_coff_armap (abfd) carsym_size = (nsymz * sizeof (carsym)); ptrsize = (4 * nsymz); - ardata->symdefs = (carsym *) bfd_zalloc (abfd, carsym_size + stringsize + 1); + ardata->symdefs = bfd_zalloc (abfd, carsym_size + stringsize + 1); if (ardata->symdefs == NULL) return FALSE; carsyms = ardata->symdefs; stringbase = ((char *) ardata->symdefs) + carsym_size; /* Allocate and read in the raw offsets. */ - raw_armap = (int *) bfd_alloc (abfd, ptrsize); + raw_armap = bfd_alloc (abfd, ptrsize); if (raw_armap == NULL) goto release_symdefs; - if (bfd_bread ((PTR) raw_armap, ptrsize, abfd) != ptrsize - || (bfd_bread ((PTR) stringbase, stringsize, abfd) != stringsize)) + if (bfd_bread (raw_armap, ptrsize, abfd) != ptrsize + || (bfd_bread (stringbase, stringsize, abfd) != stringsize)) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_malformed_archive); @@ -863,7 +821,7 @@ do_slurp_coff_armap (abfd) for (i = 0; i < nsymz; i++) { rawptr = raw_armap + i; - carsyms->file_offset = swap ((PTR) rawptr); + carsyms->file_offset = swap ((bfd_byte *) rawptr); carsyms->name = stringbase; stringbase += strlen (stringbase) + 1; carsyms++; @@ -876,14 +834,14 @@ do_slurp_coff_armap (abfd) ardata->first_file_filepos += (ardata->first_file_filepos) % 2; bfd_has_map (abfd) = TRUE; - bfd_release (abfd, (PTR) raw_armap); + bfd_release (abfd, raw_armap); /* Check for a second archive header (as used by PE). */ { struct areltdata *tmp; bfd_seek (abfd, ardata->first_file_filepos, SEEK_SET); - tmp = (struct areltdata *) _bfd_read_ar_hdr (abfd); + tmp = _bfd_read_ar_hdr (abfd); if (tmp != NULL) { if (tmp->arch_header[0] == '/' @@ -899,9 +857,9 @@ do_slurp_coff_armap (abfd) return TRUE; release_raw_armap: - bfd_release (abfd, (PTR) raw_armap); + bfd_release (abfd, raw_armap); release_symdefs: - bfd_release (abfd, (PTR) (ardata)->symdefs); + bfd_release (abfd, (ardata)->symdefs); return FALSE; } @@ -909,11 +867,10 @@ release_symdefs: Returns FALSE on error, TRUE otherwise */ bfd_boolean -bfd_slurp_armap (abfd) - bfd *abfd; +bfd_slurp_armap (bfd *abfd) { char nextname[17]; - int i = bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd); + int i = bfd_bread (nextname, 16, abfd); if (i == 0) return TRUE; @@ -932,6 +889,7 @@ bfd_slurp_armap (abfd) { /* 64bit ELF (Irix 6) archive. */ #ifdef BFD64 + extern bfd_boolean bfd_elf64_archive_slurp_armap (bfd *); return bfd_elf64_archive_slurp_armap (abfd); #else bfd_set_error (bfd_error_wrong_format); @@ -951,8 +909,7 @@ bfd_slurp_armap (abfd) #define HPUX_SYMDEF_COUNT_SIZE 2 bfd_boolean -bfd_slurp_bsd_armap_f2 (abfd) - bfd *abfd; +bfd_slurp_bsd_armap_f2 (bfd *abfd) { struct areltdata *mapdata; char nextname[17]; @@ -963,7 +920,7 @@ bfd_slurp_bsd_armap_f2 (abfd) unsigned int stringsize; bfd_size_type amt; carsym *set; - int i = bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd); + int i = bfd_bread (nextname, 16, abfd); if (i == 0) return TRUE; @@ -984,29 +941,29 @@ bfd_slurp_bsd_armap_f2 (abfd) return TRUE; } - mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd); + mapdata = _bfd_read_ar_hdr (abfd); if (mapdata == NULL) return FALSE; amt = mapdata->parsed_size; - raw_armap = (bfd_byte *) bfd_zalloc (abfd, amt); + raw_armap = bfd_zalloc (abfd, amt); if (raw_armap == NULL) { byebye: - bfd_release (abfd, (PTR) mapdata); + bfd_release (abfd, mapdata); return FALSE; } - if (bfd_bread ((PTR) raw_armap, amt, abfd) != amt) + if (bfd_bread (raw_armap, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_malformed_archive); byebyebye: - bfd_release (abfd, (PTR) raw_armap); + bfd_release (abfd, raw_armap); goto byebye; } - ardata->symdef_count = H_GET_16 (abfd, (PTR) raw_armap); + ardata->symdef_count = H_GET_16 (abfd, raw_armap); if (ardata->symdef_count * BSD_SYMDEF_SIZE > mapdata->parsed_size - HPUX_SYMDEF_COUNT_SIZE) @@ -1024,8 +981,8 @@ bfd_slurp_bsd_armap_f2 (abfd) + HPUX_SYMDEF_COUNT_SIZE + BSD_STRING_COUNT_SIZE); rbase = (bfd_byte *) stringbase + stringsize; - amt = (bfd_size_type) ardata->symdef_count * BSD_SYMDEF_SIZE; - ardata->symdefs = (carsym *) bfd_alloc (abfd, amt); + amt = ardata->symdef_count * BSD_SYMDEF_SIZE; + ardata->symdefs = bfd_alloc (abfd, amt); if (!ardata->symdefs) return FALSE; @@ -1060,8 +1017,7 @@ bfd_slurp_bsd_armap_f2 (abfd) /* Returns FALSE on error, TRUE otherwise. */ bfd_boolean -_bfd_slurp_extended_name_table (abfd) - bfd *abfd; +_bfd_slurp_extended_name_table (bfd *abfd) { char nextname[17]; struct areltdata *namedata; @@ -1070,7 +1026,7 @@ _bfd_slurp_extended_name_table (abfd) /* FIXME: Formatting sucks here, and in case of failure of BFD_READ, we probably don't want to return TRUE. */ bfd_seek (abfd, bfd_ardata (abfd)->first_file_filepos, SEEK_SET); - if (bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd) == 16) + if (bfd_bread (nextname, 16, abfd) == 16) { if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0) return FALSE; @@ -1082,7 +1038,7 @@ _bfd_slurp_extended_name_table (abfd) return TRUE; } - namedata = (struct areltdata *) _bfd_read_ar_hdr (abfd); + namedata = _bfd_read_ar_hdr (abfd); if (namedata == NULL) return FALSE; @@ -1091,15 +1047,15 @@ _bfd_slurp_extended_name_table (abfd) if (bfd_ardata (abfd)->extended_names == NULL) { byebye: - bfd_release (abfd, (PTR) namedata); + bfd_release (abfd, namedata); return FALSE; } - if (bfd_bread ((PTR) bfd_ardata (abfd)->extended_names, amt, abfd) != amt) + if (bfd_bread (bfd_ardata (abfd)->extended_names, amt, abfd) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_malformed_archive); - bfd_release (abfd, (PTR) (bfd_ardata (abfd)->extended_names)); + bfd_release (abfd, (bfd_ardata (abfd)->extended_names)); bfd_ardata (abfd)->extended_names = NULL; goto byebye; } @@ -1141,9 +1097,7 @@ _bfd_slurp_extended_name_table (abfd) semicolon. */ static const char * -normalize (abfd, file) - bfd *abfd; - const char *file; +normalize (bfd *abfd, const char *file) { const char *first; const char *last; @@ -1164,7 +1118,7 @@ normalize (abfd, file) first--; } - copy = (char *) bfd_alloc (abfd, (bfd_size_type) (last - first + 1)); + copy = bfd_alloc (abfd, last - first + 1); if (copy == NULL) return NULL; @@ -1176,9 +1130,7 @@ normalize (abfd, file) #else static const char * -normalize (abfd, file) - bfd *abfd ATTRIBUTE_UNUSED; - const char *file; +normalize (bfd *abfd ATTRIBUTE_UNUSED, const char *file) { const char *filename = strrchr (file, '/'); @@ -1192,7 +1144,7 @@ normalize (abfd, file) filename = file + 1; } #endif - if (filename != (char *) NULL) + if (filename != NULL) filename++; else filename = file; @@ -1203,11 +1155,10 @@ normalize (abfd, file) /* Build a BFD style extended name table. */ bfd_boolean -_bfd_archive_bsd_construct_extended_name_table (abfd, tabloc, tablen, name) - bfd *abfd; - char **tabloc; - bfd_size_type *tablen; - const char **name; +_bfd_archive_bsd_construct_extended_name_table (bfd *abfd, + char **tabloc, + bfd_size_type *tablen, + const char **name) { *name = "ARFILENAMES/"; return _bfd_construct_extended_name_table (abfd, FALSE, tabloc, tablen); @@ -1216,11 +1167,10 @@ _bfd_archive_bsd_construct_extended_name_table (abfd, tabloc, tablen, name) /* Build an SVR4 style extended name table. */ bfd_boolean -_bfd_archive_coff_construct_extended_name_table (abfd, tabloc, tablen, name) - bfd *abfd; - char **tabloc; - bfd_size_type *tablen; - const char **name; +_bfd_archive_coff_construct_extended_name_table (bfd *abfd, + char **tabloc, + bfd_size_type *tablen, + const char **name) { *name = "//"; return _bfd_construct_extended_name_table (abfd, TRUE, tabloc, tablen); @@ -1235,11 +1185,10 @@ _bfd_archive_coff_construct_extended_name_table (abfd, tabloc, tablen, name) zero-length tablen! */ bfd_boolean -_bfd_construct_extended_name_table (abfd, trailing_slash, tabloc, tablen) - bfd *abfd; - bfd_boolean trailing_slash; - char **tabloc; - bfd_size_type *tablen; +_bfd_construct_extended_name_table (bfd *abfd, + bfd_boolean trailing_slash, + char **tabloc, + bfd_size_type *tablen) { unsigned int maxname = abfd->xvec->ar_max_namelen; bfd_size_type total_namelen = 0; @@ -1353,9 +1302,7 @@ _bfd_construct_extended_name_table (abfd, trailing_slash, tabloc, tablen) /* Function to encode large UID/GID values according to HP. */ static void -hpux_uid_gid_encode (str, id) - char str[6]; - long int id; +hpux_uid_gid_encode (char str[6], long int id) { int cnt; @@ -1381,10 +1328,7 @@ hpux_uid_gid_encode (str, id) is set, and it's an in-memory bfd, we fake it. */ static struct areltdata * -bfd_ar_hdr_from_filesystem (abfd, filename, member) - bfd *abfd; - const char *filename; - bfd *member; +bfd_ar_hdr_from_filesystem (bfd *abfd, const char *filename, bfd *member) { struct stat status; struct areltdata *ared; @@ -1395,7 +1339,7 @@ bfd_ar_hdr_from_filesystem (abfd, filename, member) if (member && (member->flags & BFD_IN_MEMORY) != 0) { /* Assume we just "made" the member, and fake it. */ - struct bfd_in_memory *bim = (struct bfd_in_memory *) member->iostream; + struct bfd_in_memory *bim = member->iostream; time (&status.st_mtime); status.st_uid = getuid (); status.st_gid = getgid (); @@ -1409,13 +1353,13 @@ bfd_ar_hdr_from_filesystem (abfd, filename, member) } amt = sizeof (struct ar_hdr) + sizeof (struct areltdata); - ared = (struct areltdata *) bfd_zalloc (abfd, amt); + ared = bfd_zalloc (abfd, amt); if (ared == NULL) return NULL; hdr = (struct ar_hdr *) (((char *) ared) + sizeof (struct areltdata)); /* ar headers are space padded, not null padded! */ - memset ((PTR) hdr, ' ', sizeof (struct ar_hdr)); + memset (hdr, ' ', sizeof (struct ar_hdr)); strncpy (hdr->ar_fmag, ARFMAG, 2); @@ -1461,13 +1405,10 @@ bfd_ar_hdr_from_filesystem (abfd, filename, member) a strong stomach to write this, and it does, but it takes even a stronger stomach to try to code around such a thing! */ -struct ar_hdr *bfd_special_undocumented_glue - PARAMS ((bfd *, const char *)); +struct ar_hdr *bfd_special_undocumented_glue (bfd *, const char *); struct ar_hdr * -bfd_special_undocumented_glue (abfd, filename) - bfd *abfd; - const char *filename; +bfd_special_undocumented_glue (bfd *abfd, const char *filename) { struct areltdata *ar_elt = bfd_ar_hdr_from_filesystem (abfd, filename, 0); if (ar_elt == NULL) @@ -1478,9 +1419,7 @@ bfd_special_undocumented_glue (abfd, filename) /* Analogous to stat call. */ int -bfd_generic_stat_arch_elt (abfd, buf) - bfd *abfd; - struct stat *buf; +bfd_generic_stat_arch_elt (bfd *abfd, struct stat *buf) { struct ar_hdr *hdr; char *aloser; @@ -1535,10 +1474,7 @@ bfd_generic_stat_arch_elt (abfd, buf) } void -bfd_dont_truncate_arname (abfd, pathname, arhdr) - bfd *abfd; - const char *pathname; - char *arhdr; +bfd_dont_truncate_arname (bfd *abfd, const char *pathname, char *arhdr) { /* FIXME: This interacts unpleasantly with ar's quick-append option. Fortunately ic960 users will never use that option. Fixing this @@ -1575,10 +1511,7 @@ bfd_dont_truncate_arname (abfd, pathname, arhdr) } void -bfd_bsd_truncate_arname (abfd, pathname, arhdr) - bfd *abfd; - const char *pathname; - char *arhdr; +bfd_bsd_truncate_arname (bfd *abfd, const char *pathname, char *arhdr) { struct ar_hdr *hdr = (struct ar_hdr *) arhdr; size_t length; @@ -1626,10 +1559,7 @@ bfd_bsd_truncate_arname (abfd, pathname, arhdr) bsd ar. */ void -bfd_gnu_truncate_arname (abfd, pathname, arhdr) - bfd *abfd; - const char *pathname; - char *arhdr; +bfd_gnu_truncate_arname (bfd *abfd, const char *pathname, char *arhdr) { struct ar_hdr *hdr = (struct ar_hdr *) arhdr; size_t length; @@ -1674,8 +1604,7 @@ bfd_gnu_truncate_arname (abfd, pathname, arhdr) /* The BFD is open for write and has its format set to bfd_archive. */ bfd_boolean -_bfd_write_archive_contents (arch) - bfd *arch; +_bfd_write_archive_contents (bfd *arch) { bfd *current; char *etable = NULL; @@ -1706,14 +1635,13 @@ _bfd_write_archive_contents (arch) if (!current->arelt_data) { current->arelt_data = - (PTR) bfd_ar_hdr_from_filesystem (arch, current->filename, current); + bfd_ar_hdr_from_filesystem (arch, current->filename, current); if (!current->arelt_data) return FALSE; /* Put in the file name. */ - BFD_SEND (arch, _bfd_truncate_arname, (arch, - current->filename, - (char *) arch_hdr (current))); + BFD_SEND (arch, _bfd_truncate_arname, + (arch, current->filename, (char *) arch_hdr (current))); } if (makemap && ! hasobjects) @@ -1734,9 +1662,9 @@ _bfd_write_archive_contents (arch) if (bfd_seek (arch, (file_ptr) 0, SEEK_SET) != 0) return FALSE; #ifdef GNU960 - wrote = bfd_bwrite (BFD_GNU960_ARMAG (arch), (bfd_size_type) SARMAG, arch); + wrote = bfd_bwrite (BFD_GNU960_ARMAG (arch), SARMAG, arch); #else - wrote = bfd_bwrite (ARMAG, (bfd_size_type) SARMAG, arch); + wrote = bfd_bwrite (ARMAG, SARMAG, arch); #endif if (wrote != SARMAG) return FALSE; @@ -1751,7 +1679,7 @@ _bfd_write_archive_contents (arch) { struct ar_hdr hdr; - memset ((char *) (&hdr), 0, sizeof (struct ar_hdr)); + memset (&hdr, 0, sizeof (struct ar_hdr)); strcpy (hdr.ar_name, ename); /* Round size up to even number in archive header. */ sprintf (&(hdr.ar_size[0]), "%-10d", @@ -1760,13 +1688,13 @@ _bfd_write_archive_contents (arch) for (i = 0; i < sizeof (struct ar_hdr); i++) if (((char *) (&hdr))[i] == '\0') (((char *) (&hdr))[i]) = ' '; - 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)) || bfd_bwrite (etable, elength, arch) != elength) return FALSE; if ((elength % 2) == 1) { - if (bfd_bwrite ("\012", (bfd_size_type) 1, arch) != 1) + if (bfd_bwrite ("\012", 1, arch) != 1) return FALSE; } } @@ -1778,7 +1706,7 @@ _bfd_write_archive_contents (arch) struct ar_hdr *hdr = arch_hdr (current); /* Write ar header. */ - if (bfd_bwrite ((PTR) hdr, (bfd_size_type) sizeof (*hdr), arch) + if (bfd_bwrite (hdr, sizeof (*hdr), arch) != sizeof (*hdr)) return FALSE; if (bfd_seek (current, (file_ptr) 0, SEEK_SET) != 0) @@ -1789,19 +1717,19 @@ _bfd_write_archive_contents (arch) if (amt > remaining) amt = remaining; errno = 0; - if (bfd_bread (buffer, (bfd_size_type) amt, current) != amt) + if (bfd_bread (buffer, amt, current) != amt) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_malformed_archive); return FALSE; } - if (bfd_bwrite (buffer, (bfd_size_type) amt, arch) != amt) + if (bfd_bwrite (buffer, amt, arch) != amt) return FALSE; remaining -= amt; } if ((arelt_size (current) % 2) == 1) { - if (bfd_bwrite ("\012", (bfd_size_type) 1, arch) != 1) + if (bfd_bwrite ("\012", 1, arch) != 1) return FALSE; } } @@ -1831,9 +1759,7 @@ _bfd_write_archive_contents (arch) /* Note that the namidx for the first symbol is 0. */ bfd_boolean -_bfd_compute_and_write_armap (arch, elength) - bfd *arch; - unsigned int elength; +_bfd_compute_and_write_armap (bfd *arch, unsigned int elength) { char *first_name = NULL; bfd *current; @@ -1852,14 +1778,14 @@ _bfd_compute_and_write_armap (arch, elength) elength += sizeof (struct ar_hdr); elength += elength % 2; - amt = (bfd_size_type) orl_max * sizeof (struct orl); - map = (struct orl *) bfd_malloc (amt); + amt = orl_max * sizeof (struct orl); + map = bfd_malloc (amt); if (map == NULL) goto error_return; /* We put the symbol names on the arch objalloc, and then discard them when done. */ - first_name = bfd_alloc (arch, (bfd_size_type) 1); + first_name = bfd_alloc (arch, 1); if (first_name == NULL) goto error_return; @@ -1870,7 +1796,7 @@ _bfd_compute_and_write_armap (arch, elength) /* Map over each element. */ for (current = arch->archive_head; - current != (bfd *) NULL; + current != NULL; current = current->next, elt_no++) { if (bfd_check_format (current, bfd_object) @@ -1891,7 +1817,7 @@ _bfd_compute_and_write_armap (arch, elength) if (syms_max > 0) free (syms); syms_max = storage; - syms = (asymbol **) bfd_malloc ((bfd_size_type) syms_max); + syms = bfd_malloc (syms_max); if (syms == NULL) goto error_return; } @@ -1919,9 +1845,9 @@ _bfd_compute_and_write_armap (arch, elength) if (orl_count == orl_max) { orl_max *= 2; - amt = (bfd_size_type) orl_max * sizeof (struct orl); - new_map = (struct orl *) bfd_realloc (map, amt); - if (new_map == (struct orl *) NULL) + amt = orl_max * sizeof (struct orl); + new_map = bfd_realloc (map, amt); + if (new_map == NULL) goto error_return; map = new_map; @@ -1929,7 +1855,7 @@ _bfd_compute_and_write_armap (arch, elength) namelen = strlen (syms[src_count]->name); amt = sizeof (char *); - map[orl_count].name = (char **) bfd_alloc (arch, amt); + map[orl_count].name = bfd_alloc (arch, amt); if (map[orl_count].name == NULL) goto error_return; *(map[orl_count].name) = bfd_alloc (arch, namelen + 1); @@ -1977,12 +1903,11 @@ _bfd_compute_and_write_armap (arch, elength) } bfd_boolean -bsd_write_armap (arch, elength, map, orl_count, stridx) - bfd *arch; - unsigned int elength; - struct orl *map; - unsigned int orl_count; - int stridx; +bsd_write_armap (bfd *arch, + unsigned int elength, + struct orl *map, + unsigned int orl_count, + int stridx) { int padit = stridx & 1; unsigned int ranlibsize = orl_count * BSD_SYMDEF_SIZE; @@ -2001,7 +1926,7 @@ bsd_write_armap (arch, elength, map, orl_count, stridx) firstreal = mapsize + elength + sizeof (struct ar_hdr) + SARMAG; stat (arch->filename, &statbuf); - memset ((char *) (&hdr), 0, sizeof (struct ar_hdr)); + memset (&hdr, 0, sizeof (struct ar_hdr)); sprintf (hdr.ar_name, RANLIBMAG); /* Remember the timestamp, to keep it holy. But fudge it a little. */ bfd_ardata (arch)->armap_timestamp = statbuf.st_mtime + ARMAP_TIME_OFFSET; @@ -2015,11 +1940,11 @@ bsd_write_armap (arch, elength, map, orl_count, stridx) for (i = 0; i < sizeof (struct ar_hdr); i++) if (((char *) (&hdr))[i] == '\0') (((char *) (&hdr))[i]) = ' '; - 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; H_PUT_32 (arch, ranlibsize, temp); - if (bfd_bwrite (temp, (bfd_size_type) sizeof (temp), arch) != sizeof (temp)) + if (bfd_bwrite (temp, sizeof (temp), arch) != sizeof (temp)) return FALSE; for (count = 0; count < orl_count; count++) @@ -2040,20 +1965,20 @@ bsd_write_armap (arch, elength, map, orl_count, stridx) 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, (bfd_size_type) BSD_SYMDEF_SIZE, arch) + if (bfd_bwrite (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, (bfd_size_type) sizeof (temp), arch) != sizeof (temp)) + if (bfd_bwrite (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, (bfd_size_type) len, arch) != len) + if (bfd_bwrite (*map[count].name, len, arch) != len) return FALSE; } @@ -2061,7 +1986,7 @@ bsd_write_armap (arch, elength, map, orl_count, stridx) bug-compatible for sun's ar we use a null. */ if (padit) { - if (bfd_bwrite ("", (bfd_size_type) 1, arch) != 1) + if (bfd_bwrite ("", 1, arch) != 1) return FALSE; } @@ -2075,8 +2000,7 @@ bsd_write_armap (arch, elength, map, orl_count, stridx) Return FALSE if we updated the timestamp. */ bfd_boolean -_bfd_archive_bsd_update_armap_timestamp (arch) - bfd *arch; +_bfd_archive_bsd_update_armap_timestamp (bfd *arch) { struct stat archstat; struct ar_hdr hdr; @@ -2110,7 +2034,7 @@ _bfd_archive_bsd_update_armap_timestamp (arch) 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, (bfd_size_type) sizeof (hdr.ar_date), arch) + || (bfd_bwrite (hdr.ar_date, sizeof (hdr.ar_date), arch) != sizeof (hdr.ar_date))) { bfd_perror (_("Writing updated armap timestamp")); @@ -2138,12 +2062,11 @@ _bfd_archive_bsd_update_armap_timestamp (arch) */ bfd_boolean -coff_write_armap (arch, elength, map, symbol_count, stridx) - bfd *arch; - unsigned int elength; - struct orl *map; - unsigned int symbol_count; - int stridx; +coff_write_armap (bfd *arch, + unsigned int elength, + struct orl *map, + unsigned int symbol_count, + int stridx) { /* The size of the ranlib is the number of exported symbols in the archive * the number of bytes in an int, + an int for the count. */ @@ -2166,7 +2089,7 @@ coff_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)); hdr.ar_name[0] = '/'; sprintf (hdr.ar_size, "%-10d", (int) mapsize); sprintf (hdr.ar_date, "%ld", (long) time (NULL)); @@ -2182,7 +2105,7 @@ coff_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; @@ -2197,7 +2120,7 @@ coff_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. */ @@ -2209,8 +2132,7 @@ coff_write_armap (arch, elength, map, symbol_count, stridx) count++; } /* Add size of this archive entry. */ - archive_member_file_ptr += (arelt_size (current) - + sizeof (struct ar_hdr)); + archive_member_file_ptr += arelt_size (current) + sizeof (struct ar_hdr); /* Remember aboout the even alignment. */ archive_member_file_ptr += archive_member_file_ptr % 2; current = current->next; @@ -2221,7 +2143,7 @@ coff_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; } @@ -2229,7 +2151,7 @@ coff_write_armap (arch, elength, map, symbol_count, stridx) bug-compatible for arc960 we use a null. */ if (padit) { - if (bfd_bwrite ("", (bfd_size_type) 1, arch) != 1) + if (bfd_bwrite ("", 1, arch) != 1) return FALSE; } diff --git a/bfd/archive64.c b/bfd/archive64.c index 6267e68b3e2..1b9f5f3c0f2 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; } diff --git a/bfd/archures.c b/bfd/archures.c index 6132f155df0..c010c9eccaa 100644 --- a/bfd/archures.c +++ b/bfd/archures.c @@ -342,10 +342,9 @@ DESCRIPTION . all the entries for that arch can be accessed via <<next>>. *} . bfd_boolean the_default; . const struct bfd_arch_info * (*compatible) -. PARAMS ((const struct bfd_arch_info *a, -. const struct bfd_arch_info *b)); +. (const struct bfd_arch_info *a, const struct bfd_arch_info *b); . -. bfd_boolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *)); +. bfd_boolean (*scan) (const struct bfd_arch_info *, const char *); . . const struct bfd_arch_info *next; .} @@ -474,7 +473,7 @@ FUNCTION bfd_printable_name SYNOPSIS - const char *bfd_printable_name(bfd *abfd); + const char *bfd_printable_name (bfd *abfd); DESCRIPTION Return a printable string representing the architecture and machine @@ -483,8 +482,7 @@ DESCRIPTION */ const char * -bfd_printable_name (abfd) - bfd *abfd; +bfd_printable_name (bfd *abfd) { return abfd->arch_info->printable_name; } @@ -494,7 +492,7 @@ FUNCTION bfd_scan_arch SYNOPSIS - const bfd_arch_info_type *bfd_scan_arch(const char *string); + const bfd_arch_info_type *bfd_scan_arch (const char *string); DESCRIPTION Figure out if BFD supports any cpu which could be described with @@ -503,8 +501,7 @@ DESCRIPTION */ const bfd_arch_info_type * -bfd_scan_arch (string) - const char *string; +bfd_scan_arch (const char *string) { const bfd_arch_info_type * const *app, *ap; @@ -526,7 +523,7 @@ FUNCTION bfd_arch_list SYNOPSIS - const char **bfd_arch_list(void); + const char **bfd_arch_list (void); DESCRIPTION Return a freshly malloced NULL-terminated vector of the names @@ -534,7 +531,7 @@ DESCRIPTION */ const char ** -bfd_arch_list () +bfd_arch_list (void) { int vec_length = 0; const char **name_ptr; @@ -554,7 +551,7 @@ bfd_arch_list () } amt = (vec_length + 1) * sizeof (char **); - name_list = (const char **) bfd_malloc (amt); + name_list = bfd_malloc (amt); if (name_list == NULL) return NULL; @@ -579,10 +576,8 @@ FUNCTION bfd_arch_get_compatible SYNOPSIS - const bfd_arch_info_type *bfd_arch_get_compatible( - const bfd *abfd, - const bfd *bbfd, - bfd_boolean accept_unknowns); + const bfd_arch_info_type *bfd_arch_get_compatible + (const bfd *abfd, const bfd *bbfd, bfd_boolean accept_unknowns); DESCRIPTION Determine whether two BFDs' architectures and machine types @@ -593,10 +588,9 @@ DESCRIPTION */ const bfd_arch_info_type * -bfd_arch_get_compatible (abfd, bbfd, accept_unknowns) - const bfd *abfd; - const bfd *bbfd; - bfd_boolean accept_unknowns; +bfd_arch_get_compatible (const bfd *abfd, + const bfd *bbfd, + bfd_boolean accept_unknowns) { const bfd * ubfd = NULL; @@ -645,16 +639,14 @@ FUNCTION bfd_set_arch_info SYNOPSIS - void bfd_set_arch_info(bfd *abfd, const bfd_arch_info_type *arg); + void bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg); DESCRIPTION Set the architecture info of @var{abfd} to @var{arg}. */ void -bfd_set_arch_info (abfd, arg) - bfd *abfd; - const bfd_arch_info_type *arg; +bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg) { abfd->arch_info = arg; } @@ -664,9 +656,8 @@ INTERNAL_FUNCTION bfd_default_set_arch_mach SYNOPSIS - bfd_boolean bfd_default_set_arch_mach(bfd *abfd, - enum bfd_architecture arch, - unsigned long mach); + bfd_boolean bfd_default_set_arch_mach + (bfd *abfd, enum bfd_architecture arch, unsigned long mach); DESCRIPTION Set the architecture and machine type in BFD @var{abfd} @@ -676,10 +667,9 @@ DESCRIPTION */ bfd_boolean -bfd_default_set_arch_mach (abfd, arch, mach) - bfd *abfd; - enum bfd_architecture arch; - unsigned long mach; +bfd_default_set_arch_mach (bfd *abfd, + enum bfd_architecture arch, + unsigned long mach) { abfd->arch_info = bfd_lookup_arch (arch, mach); if (abfd->arch_info != NULL) @@ -695,7 +685,7 @@ FUNCTION bfd_get_arch SYNOPSIS - enum bfd_architecture bfd_get_arch(bfd *abfd); + enum bfd_architecture bfd_get_arch (bfd *abfd); DESCRIPTION Return the enumerated type which describes the BFD @var{abfd}'s @@ -703,8 +693,7 @@ DESCRIPTION */ enum bfd_architecture -bfd_get_arch (abfd) - bfd *abfd; +bfd_get_arch (bfd *abfd) { return abfd->arch_info->arch; } @@ -714,7 +703,7 @@ FUNCTION bfd_get_mach SYNOPSIS - unsigned long bfd_get_mach(bfd *abfd); + unsigned long bfd_get_mach (bfd *abfd); DESCRIPTION Return the long type which describes the BFD @var{abfd}'s @@ -722,8 +711,7 @@ DESCRIPTION */ unsigned long -bfd_get_mach (abfd) - bfd *abfd; +bfd_get_mach (bfd *abfd) { return abfd->arch_info->mach; } @@ -733,7 +721,7 @@ FUNCTION bfd_arch_bits_per_byte SYNOPSIS - unsigned int bfd_arch_bits_per_byte(bfd *abfd); + unsigned int bfd_arch_bits_per_byte (bfd *abfd); DESCRIPTION Return the number of bits in one of the BFD @var{abfd}'s @@ -741,8 +729,7 @@ DESCRIPTION */ unsigned int -bfd_arch_bits_per_byte (abfd) - bfd *abfd; +bfd_arch_bits_per_byte (bfd *abfd) { return abfd->arch_info->bits_per_byte; } @@ -752,7 +739,7 @@ FUNCTION bfd_arch_bits_per_address SYNOPSIS - unsigned int bfd_arch_bits_per_address(bfd *abfd); + unsigned int bfd_arch_bits_per_address (bfd *abfd); DESCRIPTION Return the number of bits in one of the BFD @var{abfd}'s @@ -760,8 +747,7 @@ DESCRIPTION */ unsigned int -bfd_arch_bits_per_address (abfd) - bfd *abfd; +bfd_arch_bits_per_address (bfd *abfd) { return abfd->arch_info->bits_per_address; } @@ -772,17 +758,15 @@ INTERNAL_FUNCTION SYNOPSIS const bfd_arch_info_type *bfd_default_compatible - (const bfd_arch_info_type *a, - const bfd_arch_info_type *b); + (const bfd_arch_info_type *a, const bfd_arch_info_type *b); DESCRIPTION The default function for testing for compatibility. */ const bfd_arch_info_type * -bfd_default_compatible (a, b) - const bfd_arch_info_type *a; - const bfd_arch_info_type *b; +bfd_default_compatible (const bfd_arch_info_type *a, + const bfd_arch_info_type *b) { if (a->arch != b->arch) return NULL; @@ -804,7 +788,8 @@ INTERNAL_FUNCTION bfd_default_scan SYNOPSIS - bfd_boolean bfd_default_scan(const struct bfd_arch_info *info, const char *string); + bfd_boolean bfd_default_scan + (const struct bfd_arch_info *info, const char *string); DESCRIPTION The default function for working out whether this is an @@ -812,9 +797,7 @@ DESCRIPTION */ bfd_boolean -bfd_default_scan (info, string) - const bfd_arch_info_type *info; - const char *string; +bfd_default_scan (const bfd_arch_info_type *info, const char *string) { const char *ptr_src; const char *ptr_tst; @@ -1023,15 +1006,14 @@ FUNCTION bfd_get_arch_info SYNOPSIS - const bfd_arch_info_type * bfd_get_arch_info(bfd *abfd); + const bfd_arch_info_type *bfd_get_arch_info (bfd *abfd); DESCRIPTION Return the architecture info struct in @var{abfd}. */ const bfd_arch_info_type * -bfd_get_arch_info (abfd) - bfd *abfd; +bfd_get_arch_info (bfd *abfd) { return abfd->arch_info; } @@ -1042,9 +1024,7 @@ FUNCTION SYNOPSIS const bfd_arch_info_type *bfd_lookup_arch - (enum bfd_architecture - arch, - unsigned long machine); + (enum bfd_architecture arch, unsigned long machine); DESCRIPTION Look for the architecure info structure which matches the @@ -1054,9 +1034,7 @@ DESCRIPTION */ const bfd_arch_info_type * -bfd_lookup_arch (arch, machine) - enum bfd_architecture arch; - unsigned long machine; +bfd_lookup_arch (enum bfd_architecture arch, unsigned long machine) { const bfd_arch_info_type * const *app, *ap; @@ -1080,7 +1058,7 @@ FUNCTION SYNOPSIS const char *bfd_printable_arch_mach - (enum bfd_architecture arch, unsigned long machine); + (enum bfd_architecture arch, unsigned long machine); DESCRIPTION Return a printable string representing the architecture and @@ -1090,9 +1068,7 @@ DESCRIPTION */ const char * -bfd_printable_arch_mach (arch, machine) - enum bfd_architecture arch; - unsigned long machine; +bfd_printable_arch_mach (enum bfd_architecture arch, unsigned long machine) { const bfd_arch_info_type *ap = bfd_lookup_arch (arch, machine); @@ -1106,7 +1082,7 @@ FUNCTION bfd_octets_per_byte SYNOPSIS - unsigned int bfd_octets_per_byte(bfd *abfd); + unsigned int bfd_octets_per_byte (bfd *abfd); DESCRIPTION Return the number of octets (8-bit quantities) per target byte @@ -1115,8 +1091,7 @@ DESCRIPTION */ unsigned int -bfd_octets_per_byte (abfd) - bfd *abfd; +bfd_octets_per_byte (bfd *abfd) { return bfd_arch_mach_octets_per_byte (bfd_get_arch (abfd), bfd_get_mach (abfd)); @@ -1127,8 +1102,8 @@ FUNCTION bfd_arch_mach_octets_per_byte SYNOPSIS - unsigned int bfd_arch_mach_octets_per_byte(enum bfd_architecture arch, - unsigned long machine); + unsigned int bfd_arch_mach_octets_per_byte + (enum bfd_architecture arch, unsigned long machine); DESCRIPTION See bfd_octets_per_byte. @@ -1138,9 +1113,8 @@ DESCRIPTION */ unsigned int -bfd_arch_mach_octets_per_byte (arch, mach) - enum bfd_architecture arch; - unsigned long mach; +bfd_arch_mach_octets_per_byte (enum bfd_architecture arch, + unsigned long mach) { const bfd_arch_info_type *ap = bfd_lookup_arch (arch, mach); diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 977095e1966..e800a922119 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -172,10 +172,8 @@ typedef unsigned long bfd_size_type; typedef bfd_signed_vma file_ptr; typedef bfd_vma ufile_ptr; -extern void bfd_sprintf_vma - PARAMS ((bfd *, char *, bfd_vma)); -extern void bfd_fprintf_vma - PARAMS ((bfd *, PTR, bfd_vma)); +extern void bfd_sprintf_vma (bfd *, char *, bfd_vma); +extern void bfd_fprintf_vma (bfd *, void *, bfd_vma); #define printf_vma(x) fprintf_vma(stdout,x) #define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x) @@ -361,8 +359,7 @@ typedef struct _symbol_info /* Get the name of a stabs type code. */ -extern const char *bfd_get_stab_name - PARAMS ((int)); +extern const char *bfd_get_stab_name (int); /* Hash table routines. There is no way to free up a hash table. */ @@ -396,80 +393,73 @@ struct bfd_hash_table each function should be written to allocate a new block of memory only if the argument is NULL. */ struct bfd_hash_entry *(*newfunc) - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); + (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); /* An objalloc for this hash table. This is a struct objalloc *, - but we use PTR to avoid requiring the inclusion of objalloc.h. */ - PTR memory; + but we use void * to avoid requiring the inclusion of objalloc.h. */ + void *memory; }; /* Initialize a hash table. */ extern bfd_boolean bfd_hash_table_init - PARAMS ((struct bfd_hash_table *, - struct bfd_hash_entry *(*) (struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *))); + (struct bfd_hash_table *, + struct bfd_hash_entry *(*) (struct bfd_hash_entry *, + struct bfd_hash_table *, + const char *)); /* Initialize a hash table specifying a size. */ extern bfd_boolean bfd_hash_table_init_n - PARAMS ((struct bfd_hash_table *, - struct bfd_hash_entry *(*) (struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *), - unsigned int size)); + (struct bfd_hash_table *, + struct bfd_hash_entry *(*) (struct bfd_hash_entry *, + struct bfd_hash_table *, + const char *), + unsigned int size); /* Free up a hash table. */ extern void bfd_hash_table_free - PARAMS ((struct bfd_hash_table *)); + (struct bfd_hash_table *); /* Look up a string in a hash table. If CREATE is TRUE, a new entry will be created for this string if one does not already exist. The COPY argument must be TRUE if this routine should copy the string into newly allocated memory when adding an entry. */ extern struct bfd_hash_entry *bfd_hash_lookup - PARAMS ((struct bfd_hash_table *, const char *, bfd_boolean create, - bfd_boolean copy)); + (struct bfd_hash_table *, const char *, bfd_boolean create, + bfd_boolean copy); /* Replace an entry in a hash table. */ extern void bfd_hash_replace - PARAMS ((struct bfd_hash_table *, struct bfd_hash_entry *old, - struct bfd_hash_entry *nw)); + (struct bfd_hash_table *, struct bfd_hash_entry *old, + struct bfd_hash_entry *nw); /* Base method for creating a hash table entry. */ extern struct bfd_hash_entry *bfd_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, - const char *)); + (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); /* Grab some space for a hash table entry. */ -extern PTR bfd_hash_allocate - PARAMS ((struct bfd_hash_table *, unsigned int)); +extern void *bfd_hash_allocate + (struct bfd_hash_table *, unsigned int); /* Traverse a hash table in a random order, calling a function on each element. If the function returns FALSE, the traversal stops. The INFO argument is passed to the function. */ extern void bfd_hash_traverse - PARAMS ((struct bfd_hash_table *, - bfd_boolean (*) (struct bfd_hash_entry *, PTR), - PTR info)); + (struct bfd_hash_table *, + bfd_boolean (*) (struct bfd_hash_entry *, void *), + void *info); -#define COFF_SWAP_TABLE (PTR) &bfd_coff_std_swap_table +#define COFF_SWAP_TABLE (void *) &bfd_coff_std_swap_table /* User program access to BFD facilities. */ /* Direct I/O routines, for programs which know more about the object file than BFD does. Use higher level routines if possible. */ -extern bfd_size_type bfd_bread - PARAMS ((PTR, bfd_size_type, bfd *)); -extern bfd_size_type bfd_bwrite - PARAMS ((const PTR, bfd_size_type, bfd *)); -extern int bfd_seek - PARAMS ((bfd *, file_ptr, int)); -extern ufile_ptr bfd_tell - PARAMS ((bfd *)); -extern int bfd_flush - PARAMS ((bfd *)); -extern int bfd_stat - PARAMS ((bfd *, struct stat *)); +extern bfd_size_type bfd_bread (void *, bfd_size_type, bfd *); +extern bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *); +extern int bfd_seek (bfd *, file_ptr, int); +extern ufile_ptr bfd_tell (bfd *); +extern int bfd_flush (bfd *); +extern int bfd_stat (bfd *, struct stat *); /* Deprecated old routines. */ #if __GNUC__ @@ -487,8 +477,7 @@ extern int bfd_stat (warn_deprecated ("bfd_write", (const char *) 0, 0, (const char *) 0),\ bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) #endif -extern void warn_deprecated - PARAMS ((const char *, const char *, int, const char *)); +extern void warn_deprecated (const char *, const char *, int, const char *); /* Cast from const char * to char * so that caller can assign to a char * without a warning. */ @@ -527,58 +516,38 @@ extern void warn_deprecated #define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE) extern bfd_boolean bfd_cache_close - PARAMS ((bfd *abfd)); + (bfd *abfd); /* NB: This declaration should match the autogenerated one in libbfd.h. */ extern bfd_boolean bfd_record_phdr - PARAMS ((bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma, - bfd_boolean, bfd_boolean, unsigned int, struct sec **)); + (bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma, + bfd_boolean, bfd_boolean, unsigned int, struct sec **); /* Byte swapping routines. */ -bfd_vma bfd_getb64 - PARAMS ((const unsigned char *)); -bfd_vma bfd_getl64 - PARAMS ((const unsigned char *)); -bfd_signed_vma bfd_getb_signed_64 - PARAMS ((const unsigned char *)); -bfd_signed_vma bfd_getl_signed_64 - PARAMS ((const unsigned char *)); -bfd_vma bfd_getb32 - PARAMS ((const unsigned char *)); -bfd_vma bfd_getl32 - PARAMS ((const unsigned char *)); -bfd_signed_vma bfd_getb_signed_32 - PARAMS ((const unsigned char *)); -bfd_signed_vma bfd_getl_signed_32 - PARAMS ((const unsigned char *)); -bfd_vma bfd_getb16 - PARAMS ((const unsigned char *)); -bfd_vma bfd_getl16 - PARAMS ((const unsigned char *)); -bfd_signed_vma bfd_getb_signed_16 - PARAMS ((const unsigned char *)); -bfd_signed_vma bfd_getl_signed_16 - PARAMS ((const unsigned char *)); -void bfd_putb64 - PARAMS ((bfd_vma, unsigned char *)); -void bfd_putl64 - PARAMS ((bfd_vma, unsigned char *)); -void bfd_putb32 - PARAMS ((bfd_vma, unsigned char *)); -void bfd_putl32 - PARAMS ((bfd_vma, unsigned char *)); -void bfd_putb16 - PARAMS ((bfd_vma, unsigned char *)); -void bfd_putl16 - PARAMS ((bfd_vma, unsigned char *)); +bfd_vma bfd_getb64 (const unsigned char *); +bfd_vma bfd_getl64 (const unsigned char *); +bfd_signed_vma bfd_getb_signed_64 (const unsigned char *); +bfd_signed_vma bfd_getl_signed_64 (const unsigned char *); +bfd_vma bfd_getb32 (const unsigned char *); +bfd_vma bfd_getl32 (const unsigned char *); +bfd_signed_vma bfd_getb_signed_32 (const unsigned char *); +bfd_signed_vma bfd_getl_signed_32 (const unsigned char *); +bfd_vma bfd_getb16 (const unsigned char *); +bfd_vma bfd_getl16 (const unsigned char *); +bfd_signed_vma bfd_getb_signed_16 (const unsigned char *); +bfd_signed_vma bfd_getl_signed_16 (const unsigned char *); +void bfd_putb64 (bfd_vma, unsigned char *); +void bfd_putl64 (bfd_vma, unsigned char *); +void bfd_putb32 (bfd_vma, unsigned char *); +void bfd_putl32 (bfd_vma, unsigned char *); +void bfd_putb16 (bfd_vma, unsigned char *); +void bfd_putl16 (bfd_vma, unsigned char *); /* Byte swapping routines which take size and endiannes as arguments. */ -bfd_vma bfd_get_bits - PARAMS ((bfd_byte *, int, bfd_boolean)); -void bfd_put_bits - PARAMS ((bfd_vma, bfd_byte *, int, bfd_boolean)); +bfd_vma bfd_get_bits (bfd_byte *, int, bfd_boolean); +void bfd_put_bits (bfd_vma, bfd_byte *, int, bfd_boolean); /* Externally visible ECOFF routines. */ @@ -592,55 +561,48 @@ struct bfd_link_hash_entry; struct bfd_elf_version_tree; #endif extern bfd_vma bfd_ecoff_get_gp_value - PARAMS ((bfd * abfd)); + (bfd * abfd); extern bfd_boolean bfd_ecoff_set_gp_value - PARAMS ((bfd *abfd, bfd_vma gp_value)); + (bfd *abfd, bfd_vma gp_value); extern bfd_boolean bfd_ecoff_set_regmasks - PARAMS ((bfd *abfd, unsigned long gprmask, unsigned long fprmask, - unsigned long *cprmask)); -extern PTR bfd_ecoff_debug_init - PARAMS ((bfd *output_bfd, struct ecoff_debug_info *output_debug, - const struct ecoff_debug_swap *output_swap, - struct bfd_link_info *)); + (bfd *abfd, unsigned long gprmask, unsigned long fprmask, + unsigned long *cprmask); +extern void *bfd_ecoff_debug_init + (bfd *output_bfd, struct ecoff_debug_info *output_debug, + const struct ecoff_debug_swap *output_swap, struct bfd_link_info *); extern void bfd_ecoff_debug_free - PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, - const struct ecoff_debug_swap *output_swap, - struct bfd_link_info *)); + (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, + const struct ecoff_debug_swap *output_swap, struct bfd_link_info *); extern bfd_boolean bfd_ecoff_debug_accumulate - PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, - const struct ecoff_debug_swap *output_swap, - bfd *input_bfd, struct ecoff_debug_info *input_debug, - const struct ecoff_debug_swap *input_swap, - struct bfd_link_info *)); + (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, + const struct ecoff_debug_swap *output_swap, bfd *input_bfd, + struct ecoff_debug_info *input_debug, + const struct ecoff_debug_swap *input_swap, struct bfd_link_info *); extern bfd_boolean bfd_ecoff_debug_accumulate_other - PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, - const struct ecoff_debug_swap *output_swap, bfd *input_bfd, - struct bfd_link_info *)); + (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, + const struct ecoff_debug_swap *output_swap, bfd *input_bfd, + struct bfd_link_info *); extern bfd_boolean bfd_ecoff_debug_externals - PARAMS ((bfd *abfd, struct ecoff_debug_info *debug, - const struct ecoff_debug_swap *swap, - bfd_boolean relocatable, - bfd_boolean (*get_extr) (struct symbol_cache_entry *, - struct ecoff_extr *), - void (*set_index) (struct symbol_cache_entry *, - bfd_size_type))); + (bfd *abfd, struct ecoff_debug_info *debug, + const struct ecoff_debug_swap *swap, bfd_boolean relocatable, + bfd_boolean (*get_extr) (struct symbol_cache_entry *, struct ecoff_extr *), + void (*set_index) (struct symbol_cache_entry *, bfd_size_type)); extern bfd_boolean bfd_ecoff_debug_one_external - PARAMS ((bfd *abfd, struct ecoff_debug_info *debug, - const struct ecoff_debug_swap *swap, - const char *name, struct ecoff_extr *esym)); + (bfd *abfd, struct ecoff_debug_info *debug, + const struct ecoff_debug_swap *swap, const char *name, + struct ecoff_extr *esym); extern bfd_size_type bfd_ecoff_debug_size - PARAMS ((bfd *abfd, struct ecoff_debug_info *debug, - const struct ecoff_debug_swap *swap)); + (bfd *abfd, struct ecoff_debug_info *debug, + const struct ecoff_debug_swap *swap); extern bfd_boolean bfd_ecoff_write_debug - PARAMS ((bfd *abfd, struct ecoff_debug_info *debug, - const struct ecoff_debug_swap *swap, file_ptr where)); + (bfd *abfd, struct ecoff_debug_info *debug, + const struct ecoff_debug_swap *swap, file_ptr where); extern bfd_boolean bfd_ecoff_write_accumulated_debug - PARAMS ((PTR handle, bfd *abfd, struct ecoff_debug_info *debug, - const struct ecoff_debug_swap *swap, - struct bfd_link_info *info, file_ptr where)); + (void *handle, bfd *abfd, struct ecoff_debug_info *debug, + const struct ecoff_debug_swap *swap, + struct bfd_link_info *info, file_ptr where); extern bfd_boolean bfd_mips_ecoff_create_embedded_relocs - PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *, - char **)); + (bfd *, struct bfd_link_info *, struct sec *, struct sec *, char **); /* Externally visible ELF routines. */ @@ -652,37 +614,35 @@ struct bfd_link_needed_list }; extern bfd_boolean bfd_elf_record_link_assignment - PARAMS ((bfd *, struct bfd_link_info *, const char *, bfd_boolean)); + (bfd *, struct bfd_link_info *, const char *, bfd_boolean); extern struct bfd_link_needed_list *bfd_elf_get_needed_list - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_elf_get_bfd_needed_list - PARAMS ((bfd *, struct bfd_link_needed_list **)); + (bfd *, struct bfd_link_needed_list **); extern bfd_boolean bfd_elf32_size_dynamic_sections - PARAMS ((bfd *, const char *, const char *, const char *, - const char * const *, struct bfd_link_info *, struct sec **, - struct bfd_elf_version_tree *)); + (bfd *, const char *, const char *, const char *, const char * const *, + struct bfd_link_info *, struct sec **, struct bfd_elf_version_tree *); extern bfd_boolean bfd_elf64_size_dynamic_sections - PARAMS ((bfd *, const char *, const char *, const char *, - const char * const *, struct bfd_link_info *, struct sec **, - struct bfd_elf_version_tree *)); + (bfd *, const char *, const char *, const char *, const char * const *, + struct bfd_link_info *, struct sec **, struct bfd_elf_version_tree *); extern void bfd_elf_set_dt_needed_name - PARAMS ((bfd *, const char *)); + (bfd *, const char *); extern void bfd_elf_set_dt_needed_soname - PARAMS ((bfd *, const char *)); + (bfd *, const char *); extern const char *bfd_elf_get_dt_soname - PARAMS ((bfd *)); + (bfd *); extern struct bfd_link_needed_list *bfd_elf_get_runpath_list - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_elf32_discard_info - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_elf64_discard_info - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); /* Return an upper bound on the number of bytes required to store a copy of ABFD's program header table entries. Return -1 if an error occurs; bfd_get_error will return an appropriate code. */ extern long bfd_get_elf_phdr_upper_bound - PARAMS ((bfd *abfd)); + (bfd *abfd); /* Copy ABFD's program header table entries to *PHDRS. The entries will be stored as an array of Elf_Internal_Phdr structures, as @@ -692,7 +652,7 @@ extern long bfd_get_elf_phdr_upper_bound Return the number of program header table entries read, or -1 if an error occurs; bfd_get_error will return an appropriate code. */ extern int bfd_get_elf_phdrs - PARAMS ((bfd *abfd, void *phdrs)); + (bfd *abfd, void *phdrs); /* Create a new BFD as if by bfd_openr. Rather than opening a file, reconstruct an ELF file by reading the segments out of remote memory @@ -707,42 +667,39 @@ extern int bfd_get_elf_phdrs be a BFD for an ELF target with the word size and byte order found in the remote memory. */ extern bfd *bfd_elf_bfd_from_remote_memory - PARAMS ((bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, - int (*target_read_memory) (bfd_vma vma, char *myaddr, int len))); + (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, + int (*target_read_memory) (bfd_vma vma, char *myaddr, int len)); /* Return the arch_size field of an elf bfd, or -1 if not elf. */ extern int bfd_get_arch_size - PARAMS ((bfd *)); + (bfd *); /* Return TRUE if address "naturally" sign extends, or -1 if not elf. */ extern int bfd_get_sign_extend_vma - PARAMS ((bfd *)); + (bfd *); extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs - PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *, - char **)); + (bfd *, struct bfd_link_info *, struct sec *, struct sec *, char **); extern bfd_boolean bfd_mips_elf32_create_embedded_relocs - PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *, - char **)); + (bfd *, struct bfd_link_info *, struct sec *, struct sec *, char **); /* SunOS shared library support routines for the linker. */ extern struct bfd_link_needed_list *bfd_sunos_get_needed_list - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_sunos_record_link_assignment - PARAMS ((bfd *, struct bfd_link_info *, const char *)); + (bfd *, struct bfd_link_info *, const char *); extern bfd_boolean bfd_sunos_size_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *, struct sec **, struct sec **, - struct sec **)); + (bfd *, struct bfd_link_info *, struct sec **, struct sec **, struct sec **); /* Linux shared library support routines for the linker. */ extern bfd_boolean bfd_i386linux_size_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_m68klinux_size_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_sparclinux_size_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); /* mmap hacks */ @@ -752,7 +709,7 @@ typedef struct _bfd_window_internal bfd_window_internal; typedef struct _bfd_window { /* What the user asked for. */ - PTR data; + void *data; bfd_size_type size; /* The actual window used by BFD. Small user-requested read-only regions sharing a page may share a single window into the object @@ -765,36 +722,35 @@ typedef struct _bfd_window bfd_window; extern void bfd_init_window - PARAMS ((bfd_window *)); + (bfd_window *); extern void bfd_free_window - PARAMS ((bfd_window *)); + (bfd_window *); extern bfd_boolean bfd_get_file_window - PARAMS ((bfd *, file_ptr, bfd_size_type, bfd_window *, bfd_boolean)); + (bfd *, file_ptr, bfd_size_type, bfd_window *, bfd_boolean); /* XCOFF support routines for the linker. */ extern bfd_boolean bfd_xcoff_link_record_set - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, - bfd_size_type)); + (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_size_type); extern bfd_boolean bfd_xcoff_import_symbol - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, - bfd_vma, const char *, const char *, const char *, unsigned int)); + (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_vma, + const char *, const char *, const char *, unsigned int); extern bfd_boolean bfd_xcoff_export_symbol - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *)); + (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *); extern bfd_boolean bfd_xcoff_link_count_reloc - PARAMS ((bfd *, struct bfd_link_info *, const char *)); + (bfd *, struct bfd_link_info *, const char *); extern bfd_boolean bfd_xcoff_record_link_assignment - PARAMS ((bfd *, struct bfd_link_info *, const char *)); + (bfd *, struct bfd_link_info *, const char *); extern bfd_boolean bfd_xcoff_size_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *, const char *, const char *, - unsigned long, unsigned long, unsigned long, bfd_boolean, - int, bfd_boolean, bfd_boolean, struct sec **, bfd_boolean)); + (bfd *, struct bfd_link_info *, const char *, const char *, + unsigned long, unsigned long, unsigned long, bfd_boolean, + int, bfd_boolean, bfd_boolean, struct sec **, bfd_boolean); extern bfd_boolean bfd_xcoff_link_generate_rtinit - PARAMS ((bfd *, const char *, const char *, bfd_boolean)); + (bfd *, const char *, const char *, bfd_boolean); /* XCOFF support routines for ar. */ extern bfd_boolean bfd_xcoff_ar_archive_set_magic - PARAMS ((bfd *, char *)); + (bfd *, char *); /* Externally visible COFF routines. */ @@ -804,65 +760,64 @@ union internal_auxent; #endif extern bfd_boolean bfd_coff_get_syment - PARAMS ((bfd *, struct symbol_cache_entry *, struct internal_syment *)); + (bfd *, struct symbol_cache_entry *, struct internal_syment *); extern bfd_boolean bfd_coff_get_auxent - PARAMS ((bfd *, struct symbol_cache_entry *, int, union internal_auxent *)); + (bfd *, struct symbol_cache_entry *, int, union internal_auxent *); extern bfd_boolean bfd_coff_set_symbol_class - PARAMS ((bfd *, struct symbol_cache_entry *, unsigned int)); + (bfd *, struct symbol_cache_entry *, unsigned int); extern bfd_boolean bfd_m68k_coff_create_embedded_relocs - PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *, - char **)); + (bfd *, struct bfd_link_info *, struct sec *, struct sec *, char **); /* ARM Interworking support. Called from linker. */ extern bfd_boolean bfd_arm_allocate_interworking_sections - PARAMS ((struct bfd_link_info *)); + (struct bfd_link_info *); extern bfd_boolean bfd_arm_process_before_allocation - PARAMS ((bfd *, struct bfd_link_info *, int)); + (bfd *, struct bfd_link_info *, int); extern bfd_boolean bfd_arm_get_bfd_for_interworking - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); /* PE ARM Interworking support. Called from linker. */ extern bfd_boolean bfd_arm_pe_allocate_interworking_sections - PARAMS ((struct bfd_link_info *)); + (struct bfd_link_info *); extern bfd_boolean bfd_arm_pe_process_before_allocation - PARAMS ((bfd *, struct bfd_link_info *, int)); + (bfd *, struct bfd_link_info *, int); extern bfd_boolean bfd_arm_pe_get_bfd_for_interworking - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); /* ELF ARM Interworking support. Called from linker. */ extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections - PARAMS ((struct bfd_link_info *)); + (struct bfd_link_info *); extern bfd_boolean bfd_elf32_arm_process_before_allocation - PARAMS ((bfd *, struct bfd_link_info *, int)); + (bfd *, struct bfd_link_info *, int); extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); /* ARM Note section processing. */ extern bfd_boolean bfd_arm_merge_machines - PARAMS ((bfd *, bfd *)); + (bfd *, bfd *); extern bfd_boolean bfd_arm_update_notes - PARAMS ((bfd *, const char *)); + (bfd *, const char *); extern unsigned int bfd_arm_get_mach_from_notes - PARAMS ((bfd *, const char *)); + (bfd *, const char *); /* TI COFF load page support. */ extern void bfd_ticoff_set_section_load_page - PARAMS ((struct sec *, int)); + (struct sec *, int); extern int bfd_ticoff_get_section_load_page - PARAMS ((struct sec *)); + (struct sec *); diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index c6815ccb07b..77996549132 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -179,10 +179,8 @@ typedef unsigned long bfd_size_type; typedef bfd_signed_vma file_ptr; typedef bfd_vma ufile_ptr; -extern void bfd_sprintf_vma - PARAMS ((bfd *, char *, bfd_vma)); -extern void bfd_fprintf_vma - PARAMS ((bfd *, PTR, bfd_vma)); +extern void bfd_sprintf_vma (bfd *, char *, bfd_vma); +extern void bfd_fprintf_vma (bfd *, void *, bfd_vma); #define printf_vma(x) fprintf_vma(stdout,x) #define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x) @@ -368,8 +366,7 @@ typedef struct _symbol_info /* Get the name of a stabs type code. */ -extern const char *bfd_get_stab_name - PARAMS ((int)); +extern const char *bfd_get_stab_name (int); /* Hash table routines. There is no way to free up a hash table. */ @@ -403,80 +400,73 @@ struct bfd_hash_table each function should be written to allocate a new block of memory only if the argument is NULL. */ struct bfd_hash_entry *(*newfunc) - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); + (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); /* An objalloc for this hash table. This is a struct objalloc *, - but we use PTR to avoid requiring the inclusion of objalloc.h. */ - PTR memory; + but we use void * to avoid requiring the inclusion of objalloc.h. */ + void *memory; }; /* Initialize a hash table. */ extern bfd_boolean bfd_hash_table_init - PARAMS ((struct bfd_hash_table *, - struct bfd_hash_entry *(*) (struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *))); + (struct bfd_hash_table *, + struct bfd_hash_entry *(*) (struct bfd_hash_entry *, + struct bfd_hash_table *, + const char *)); /* Initialize a hash table specifying a size. */ extern bfd_boolean bfd_hash_table_init_n - PARAMS ((struct bfd_hash_table *, - struct bfd_hash_entry *(*) (struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *), - unsigned int size)); + (struct bfd_hash_table *, + struct bfd_hash_entry *(*) (struct bfd_hash_entry *, + struct bfd_hash_table *, + const char *), + unsigned int size); /* Free up a hash table. */ extern void bfd_hash_table_free - PARAMS ((struct bfd_hash_table *)); + (struct bfd_hash_table *); /* Look up a string in a hash table. If CREATE is TRUE, a new entry will be created for this string if one does not already exist. The COPY argument must be TRUE if this routine should copy the string into newly allocated memory when adding an entry. */ extern struct bfd_hash_entry *bfd_hash_lookup - PARAMS ((struct bfd_hash_table *, const char *, bfd_boolean create, - bfd_boolean copy)); + (struct bfd_hash_table *, const char *, bfd_boolean create, + bfd_boolean copy); /* Replace an entry in a hash table. */ extern void bfd_hash_replace - PARAMS ((struct bfd_hash_table *, struct bfd_hash_entry *old, - struct bfd_hash_entry *nw)); + (struct bfd_hash_table *, struct bfd_hash_entry *old, + struct bfd_hash_entry *nw); /* Base method for creating a hash table entry. */ extern struct bfd_hash_entry *bfd_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, - const char *)); + (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); /* Grab some space for a hash table entry. */ -extern PTR bfd_hash_allocate - PARAMS ((struct bfd_hash_table *, unsigned int)); +extern void *bfd_hash_allocate + (struct bfd_hash_table *, unsigned int); /* Traverse a hash table in a random order, calling a function on each element. If the function returns FALSE, the traversal stops. The INFO argument is passed to the function. */ extern void bfd_hash_traverse - PARAMS ((struct bfd_hash_table *, - bfd_boolean (*) (struct bfd_hash_entry *, PTR), - PTR info)); + (struct bfd_hash_table *, + bfd_boolean (*) (struct bfd_hash_entry *, void *), + void *info); -#define COFF_SWAP_TABLE (PTR) &bfd_coff_std_swap_table +#define COFF_SWAP_TABLE (void *) &bfd_coff_std_swap_table /* User program access to BFD facilities. */ /* Direct I/O routines, for programs which know more about the object file than BFD does. Use higher level routines if possible. */ -extern bfd_size_type bfd_bread - PARAMS ((PTR, bfd_size_type, bfd *)); -extern bfd_size_type bfd_bwrite - PARAMS ((const PTR, bfd_size_type, bfd *)); -extern int bfd_seek - PARAMS ((bfd *, file_ptr, int)); -extern ufile_ptr bfd_tell - PARAMS ((bfd *)); -extern int bfd_flush - PARAMS ((bfd *)); -extern int bfd_stat - PARAMS ((bfd *, struct stat *)); +extern bfd_size_type bfd_bread (void *, bfd_size_type, bfd *); +extern bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *); +extern int bfd_seek (bfd *, file_ptr, int); +extern ufile_ptr bfd_tell (bfd *); +extern int bfd_flush (bfd *); +extern int bfd_stat (bfd *, struct stat *); /* Deprecated old routines. */ #if __GNUC__ @@ -494,8 +484,7 @@ extern int bfd_stat (warn_deprecated ("bfd_write", (const char *) 0, 0, (const char *) 0),\ bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) #endif -extern void warn_deprecated - PARAMS ((const char *, const char *, int, const char *)); +extern void warn_deprecated (const char *, const char *, int, const char *); /* Cast from const char * to char * so that caller can assign to a char * without a warning. */ @@ -534,58 +523,38 @@ extern void warn_deprecated #define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE) extern bfd_boolean bfd_cache_close - PARAMS ((bfd *abfd)); + (bfd *abfd); /* NB: This declaration should match the autogenerated one in libbfd.h. */ extern bfd_boolean bfd_record_phdr - PARAMS ((bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma, - bfd_boolean, bfd_boolean, unsigned int, struct sec **)); + (bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma, + bfd_boolean, bfd_boolean, unsigned int, struct sec **); /* Byte swapping routines. */ -bfd_vma bfd_getb64 - PARAMS ((const unsigned char *)); -bfd_vma bfd_getl64 - PARAMS ((const unsigned char *)); -bfd_signed_vma bfd_getb_signed_64 - PARAMS ((const unsigned char *)); -bfd_signed_vma bfd_getl_signed_64 - PARAMS ((const unsigned char *)); -bfd_vma bfd_getb32 - PARAMS ((const unsigned char *)); -bfd_vma bfd_getl32 - PARAMS ((const unsigned char *)); -bfd_signed_vma bfd_getb_signed_32 - PARAMS ((const unsigned char *)); -bfd_signed_vma bfd_getl_signed_32 - PARAMS ((const unsigned char *)); -bfd_vma bfd_getb16 - PARAMS ((const unsigned char *)); -bfd_vma bfd_getl16 - PARAMS ((const unsigned char *)); -bfd_signed_vma bfd_getb_signed_16 - PARAMS ((const unsigned char *)); -bfd_signed_vma bfd_getl_signed_16 - PARAMS ((const unsigned char *)); -void bfd_putb64 - PARAMS ((bfd_vma, unsigned char *)); -void bfd_putl64 - PARAMS ((bfd_vma, unsigned char *)); -void bfd_putb32 - PARAMS ((bfd_vma, unsigned char *)); -void bfd_putl32 - PARAMS ((bfd_vma, unsigned char *)); -void bfd_putb16 - PARAMS ((bfd_vma, unsigned char *)); -void bfd_putl16 - PARAMS ((bfd_vma, unsigned char *)); +bfd_vma bfd_getb64 (const unsigned char *); +bfd_vma bfd_getl64 (const unsigned char *); +bfd_signed_vma bfd_getb_signed_64 (const unsigned char *); +bfd_signed_vma bfd_getl_signed_64 (const unsigned char *); +bfd_vma bfd_getb32 (const unsigned char *); +bfd_vma bfd_getl32 (const unsigned char *); +bfd_signed_vma bfd_getb_signed_32 (const unsigned char *); +bfd_signed_vma bfd_getl_signed_32 (const unsigned char *); +bfd_vma bfd_getb16 (const unsigned char *); +bfd_vma bfd_getl16 (const unsigned char *); +bfd_signed_vma bfd_getb_signed_16 (const unsigned char *); +bfd_signed_vma bfd_getl_signed_16 (const unsigned char *); +void bfd_putb64 (bfd_vma, unsigned char *); +void bfd_putl64 (bfd_vma, unsigned char *); +void bfd_putb32 (bfd_vma, unsigned char *); +void bfd_putl32 (bfd_vma, unsigned char *); +void bfd_putb16 (bfd_vma, unsigned char *); +void bfd_putl16 (bfd_vma, unsigned char *); /* Byte swapping routines which take size and endiannes as arguments. */ -bfd_vma bfd_get_bits - PARAMS ((bfd_byte *, int, bfd_boolean)); -void bfd_put_bits - PARAMS ((bfd_vma, bfd_byte *, int, bfd_boolean)); +bfd_vma bfd_get_bits (bfd_byte *, int, bfd_boolean); +void bfd_put_bits (bfd_vma, bfd_byte *, int, bfd_boolean); /* Externally visible ECOFF routines. */ @@ -599,55 +568,48 @@ struct bfd_link_hash_entry; struct bfd_elf_version_tree; #endif extern bfd_vma bfd_ecoff_get_gp_value - PARAMS ((bfd * abfd)); + (bfd * abfd); extern bfd_boolean bfd_ecoff_set_gp_value - PARAMS ((bfd *abfd, bfd_vma gp_value)); + (bfd *abfd, bfd_vma gp_value); extern bfd_boolean bfd_ecoff_set_regmasks - PARAMS ((bfd *abfd, unsigned long gprmask, unsigned long fprmask, - unsigned long *cprmask)); -extern PTR bfd_ecoff_debug_init - PARAMS ((bfd *output_bfd, struct ecoff_debug_info *output_debug, - const struct ecoff_debug_swap *output_swap, - struct bfd_link_info *)); + (bfd *abfd, unsigned long gprmask, unsigned long fprmask, + unsigned long *cprmask); +extern void *bfd_ecoff_debug_init + (bfd *output_bfd, struct ecoff_debug_info *output_debug, + const struct ecoff_debug_swap *output_swap, struct bfd_link_info *); extern void bfd_ecoff_debug_free - PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, - const struct ecoff_debug_swap *output_swap, - struct bfd_link_info *)); + (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, + const struct ecoff_debug_swap *output_swap, struct bfd_link_info *); extern bfd_boolean bfd_ecoff_debug_accumulate - PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, - const struct ecoff_debug_swap *output_swap, - bfd *input_bfd, struct ecoff_debug_info *input_debug, - const struct ecoff_debug_swap *input_swap, - struct bfd_link_info *)); + (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, + const struct ecoff_debug_swap *output_swap, bfd *input_bfd, + struct ecoff_debug_info *input_debug, + const struct ecoff_debug_swap *input_swap, struct bfd_link_info *); extern bfd_boolean bfd_ecoff_debug_accumulate_other - PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, - const struct ecoff_debug_swap *output_swap, bfd *input_bfd, - struct bfd_link_info *)); + (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, + const struct ecoff_debug_swap *output_swap, bfd *input_bfd, + struct bfd_link_info *); extern bfd_boolean bfd_ecoff_debug_externals - PARAMS ((bfd *abfd, struct ecoff_debug_info *debug, - const struct ecoff_debug_swap *swap, - bfd_boolean relocatable, - bfd_boolean (*get_extr) (struct symbol_cache_entry *, - struct ecoff_extr *), - void (*set_index) (struct symbol_cache_entry *, - bfd_size_type))); + (bfd *abfd, struct ecoff_debug_info *debug, + const struct ecoff_debug_swap *swap, bfd_boolean relocatable, + bfd_boolean (*get_extr) (struct symbol_cache_entry *, struct ecoff_extr *), + void (*set_index) (struct symbol_cache_entry *, bfd_size_type)); extern bfd_boolean bfd_ecoff_debug_one_external - PARAMS ((bfd *abfd, struct ecoff_debug_info *debug, - const struct ecoff_debug_swap *swap, - const char *name, struct ecoff_extr *esym)); + (bfd *abfd, struct ecoff_debug_info *debug, + const struct ecoff_debug_swap *swap, const char *name, + struct ecoff_extr *esym); extern bfd_size_type bfd_ecoff_debug_size - PARAMS ((bfd *abfd, struct ecoff_debug_info *debug, - const struct ecoff_debug_swap *swap)); + (bfd *abfd, struct ecoff_debug_info *debug, + const struct ecoff_debug_swap *swap); extern bfd_boolean bfd_ecoff_write_debug - PARAMS ((bfd *abfd, struct ecoff_debug_info *debug, - const struct ecoff_debug_swap *swap, file_ptr where)); + (bfd *abfd, struct ecoff_debug_info *debug, + const struct ecoff_debug_swap *swap, file_ptr where); extern bfd_boolean bfd_ecoff_write_accumulated_debug - PARAMS ((PTR handle, bfd *abfd, struct ecoff_debug_info *debug, - const struct ecoff_debug_swap *swap, - struct bfd_link_info *info, file_ptr where)); + (void *handle, bfd *abfd, struct ecoff_debug_info *debug, + const struct ecoff_debug_swap *swap, + struct bfd_link_info *info, file_ptr where); extern bfd_boolean bfd_mips_ecoff_create_embedded_relocs - PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *, - char **)); + (bfd *, struct bfd_link_info *, struct sec *, struct sec *, char **); /* Externally visible ELF routines. */ @@ -659,37 +621,35 @@ struct bfd_link_needed_list }; extern bfd_boolean bfd_elf_record_link_assignment - PARAMS ((bfd *, struct bfd_link_info *, const char *, bfd_boolean)); + (bfd *, struct bfd_link_info *, const char *, bfd_boolean); extern struct bfd_link_needed_list *bfd_elf_get_needed_list - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_elf_get_bfd_needed_list - PARAMS ((bfd *, struct bfd_link_needed_list **)); + (bfd *, struct bfd_link_needed_list **); extern bfd_boolean bfd_elf32_size_dynamic_sections - PARAMS ((bfd *, const char *, const char *, const char *, - const char * const *, struct bfd_link_info *, struct sec **, - struct bfd_elf_version_tree *)); + (bfd *, const char *, const char *, const char *, const char * const *, + struct bfd_link_info *, struct sec **, struct bfd_elf_version_tree *); extern bfd_boolean bfd_elf64_size_dynamic_sections - PARAMS ((bfd *, const char *, const char *, const char *, - const char * const *, struct bfd_link_info *, struct sec **, - struct bfd_elf_version_tree *)); + (bfd *, const char *, const char *, const char *, const char * const *, + struct bfd_link_info *, struct sec **, struct bfd_elf_version_tree *); extern void bfd_elf_set_dt_needed_name - PARAMS ((bfd *, const char *)); + (bfd *, const char *); extern void bfd_elf_set_dt_needed_soname - PARAMS ((bfd *, const char *)); + (bfd *, const char *); extern const char *bfd_elf_get_dt_soname - PARAMS ((bfd *)); + (bfd *); extern struct bfd_link_needed_list *bfd_elf_get_runpath_list - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_elf32_discard_info - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_elf64_discard_info - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); /* Return an upper bound on the number of bytes required to store a copy of ABFD's program header table entries. Return -1 if an error occurs; bfd_get_error will return an appropriate code. */ extern long bfd_get_elf_phdr_upper_bound - PARAMS ((bfd *abfd)); + (bfd *abfd); /* Copy ABFD's program header table entries to *PHDRS. The entries will be stored as an array of Elf_Internal_Phdr structures, as @@ -699,7 +659,7 @@ extern long bfd_get_elf_phdr_upper_bound Return the number of program header table entries read, or -1 if an error occurs; bfd_get_error will return an appropriate code. */ extern int bfd_get_elf_phdrs - PARAMS ((bfd *abfd, void *phdrs)); + (bfd *abfd, void *phdrs); /* Create a new BFD as if by bfd_openr. Rather than opening a file, reconstruct an ELF file by reading the segments out of remote memory @@ -714,42 +674,39 @@ extern int bfd_get_elf_phdrs be a BFD for an ELF target with the word size and byte order found in the remote memory. */ extern bfd *bfd_elf_bfd_from_remote_memory - PARAMS ((bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, - int (*target_read_memory) (bfd_vma vma, char *myaddr, int len))); + (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, + int (*target_read_memory) (bfd_vma vma, char *myaddr, int len)); /* Return the arch_size field of an elf bfd, or -1 if not elf. */ extern int bfd_get_arch_size - PARAMS ((bfd *)); + (bfd *); /* Return TRUE if address "naturally" sign extends, or -1 if not elf. */ extern int bfd_get_sign_extend_vma - PARAMS ((bfd *)); + (bfd *); extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs - PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *, - char **)); + (bfd *, struct bfd_link_info *, struct sec *, struct sec *, char **); extern bfd_boolean bfd_mips_elf32_create_embedded_relocs - PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *, - char **)); + (bfd *, struct bfd_link_info *, struct sec *, struct sec *, char **); /* SunOS shared library support routines for the linker. */ extern struct bfd_link_needed_list *bfd_sunos_get_needed_list - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_sunos_record_link_assignment - PARAMS ((bfd *, struct bfd_link_info *, const char *)); + (bfd *, struct bfd_link_info *, const char *); extern bfd_boolean bfd_sunos_size_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *, struct sec **, struct sec **, - struct sec **)); + (bfd *, struct bfd_link_info *, struct sec **, struct sec **, struct sec **); /* Linux shared library support routines for the linker. */ extern bfd_boolean bfd_i386linux_size_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_m68klinux_size_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_sparclinux_size_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); /* mmap hacks */ @@ -759,7 +716,7 @@ typedef struct _bfd_window_internal bfd_window_internal; typedef struct _bfd_window { /* What the user asked for. */ - PTR data; + void *data; bfd_size_type size; /* The actual window used by BFD. Small user-requested read-only regions sharing a page may share a single window into the object @@ -772,36 +729,35 @@ typedef struct _bfd_window bfd_window; extern void bfd_init_window - PARAMS ((bfd_window *)); + (bfd_window *); extern void bfd_free_window - PARAMS ((bfd_window *)); + (bfd_window *); extern bfd_boolean bfd_get_file_window - PARAMS ((bfd *, file_ptr, bfd_size_type, bfd_window *, bfd_boolean)); + (bfd *, file_ptr, bfd_size_type, bfd_window *, bfd_boolean); /* XCOFF support routines for the linker. */ extern bfd_boolean bfd_xcoff_link_record_set - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, - bfd_size_type)); + (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_size_type); extern bfd_boolean bfd_xcoff_import_symbol - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, - bfd_vma, const char *, const char *, const char *, unsigned int)); + (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_vma, + const char *, const char *, const char *, unsigned int); extern bfd_boolean bfd_xcoff_export_symbol - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *)); + (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *); extern bfd_boolean bfd_xcoff_link_count_reloc - PARAMS ((bfd *, struct bfd_link_info *, const char *)); + (bfd *, struct bfd_link_info *, const char *); extern bfd_boolean bfd_xcoff_record_link_assignment - PARAMS ((bfd *, struct bfd_link_info *, const char *)); + (bfd *, struct bfd_link_info *, const char *); extern bfd_boolean bfd_xcoff_size_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *, const char *, const char *, - unsigned long, unsigned long, unsigned long, bfd_boolean, - int, bfd_boolean, bfd_boolean, struct sec **, bfd_boolean)); + (bfd *, struct bfd_link_info *, const char *, const char *, + unsigned long, unsigned long, unsigned long, bfd_boolean, + int, bfd_boolean, bfd_boolean, struct sec **, bfd_boolean); extern bfd_boolean bfd_xcoff_link_generate_rtinit - PARAMS ((bfd *, const char *, const char *, bfd_boolean)); + (bfd *, const char *, const char *, bfd_boolean); /* XCOFF support routines for ar. */ extern bfd_boolean bfd_xcoff_ar_archive_set_magic - PARAMS ((bfd *, char *)); + (bfd *, char *); /* Externally visible COFF routines. */ @@ -811,165 +767,153 @@ union internal_auxent; #endif extern bfd_boolean bfd_coff_get_syment - PARAMS ((bfd *, struct symbol_cache_entry *, struct internal_syment *)); + (bfd *, struct symbol_cache_entry *, struct internal_syment *); extern bfd_boolean bfd_coff_get_auxent - PARAMS ((bfd *, struct symbol_cache_entry *, int, union internal_auxent *)); + (bfd *, struct symbol_cache_entry *, int, union internal_auxent *); extern bfd_boolean bfd_coff_set_symbol_class - PARAMS ((bfd *, struct symbol_cache_entry *, unsigned int)); + (bfd *, struct symbol_cache_entry *, unsigned int); extern bfd_boolean bfd_m68k_coff_create_embedded_relocs - PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *, - char **)); + (bfd *, struct bfd_link_info *, struct sec *, struct sec *, char **); /* ARM Interworking support. Called from linker. */ extern bfd_boolean bfd_arm_allocate_interworking_sections - PARAMS ((struct bfd_link_info *)); + (struct bfd_link_info *); extern bfd_boolean bfd_arm_process_before_allocation - PARAMS ((bfd *, struct bfd_link_info *, int)); + (bfd *, struct bfd_link_info *, int); extern bfd_boolean bfd_arm_get_bfd_for_interworking - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); /* PE ARM Interworking support. Called from linker. */ extern bfd_boolean bfd_arm_pe_allocate_interworking_sections - PARAMS ((struct bfd_link_info *)); + (struct bfd_link_info *); extern bfd_boolean bfd_arm_pe_process_before_allocation - PARAMS ((bfd *, struct bfd_link_info *, int)); + (bfd *, struct bfd_link_info *, int); extern bfd_boolean bfd_arm_pe_get_bfd_for_interworking - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); /* ELF ARM Interworking support. Called from linker. */ extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections - PARAMS ((struct bfd_link_info *)); + (struct bfd_link_info *); extern bfd_boolean bfd_elf32_arm_process_before_allocation - PARAMS ((bfd *, struct bfd_link_info *, int)); + (bfd *, struct bfd_link_info *, int); extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); /* ARM Note section processing. */ extern bfd_boolean bfd_arm_merge_machines - PARAMS ((bfd *, bfd *)); + (bfd *, bfd *); extern bfd_boolean bfd_arm_update_notes - PARAMS ((bfd *, const char *)); + (bfd *, const char *); extern unsigned int bfd_arm_get_mach_from_notes - PARAMS ((bfd *, const char *)); + (bfd *, const char *); /* TI COFF load page support. */ extern void bfd_ticoff_set_section_load_page - PARAMS ((struct sec *, int)); + (struct sec *, int); extern int bfd_ticoff_get_section_load_page - PARAMS ((struct sec *)); + (struct sec *); /* Extracted from init.c. */ -void -bfd_init PARAMS ((void)); +void bfd_init (void); /* Extracted from opncls.c. */ -bfd * -bfd_openr PARAMS ((const char *filename, const char *target)); +bfd *bfd_openr (const char *filename, const char *target); -bfd * -bfd_fdopenr PARAMS ((const char *filename, const char *target, int fd)); +bfd *bfd_fdopenr (const char *filename, const char *target, int fd); -bfd * -bfd_openstreamr PARAMS ((const char *, const char *, PTR)); +bfd *bfd_openstreamr (const char *, const char *, void *); -bfd * -bfd_openw PARAMS ((const char *filename, const char *target)); +bfd *bfd_openw (const char *filename, const char *target); -bfd_boolean -bfd_close PARAMS ((bfd *abfd)); +bfd_boolean bfd_close (bfd *abfd); -bfd_boolean -bfd_close_all_done PARAMS ((bfd *)); +bfd_boolean bfd_close_all_done (bfd *); -bfd * -bfd_create PARAMS ((const char *filename, bfd *templ)); +bfd *bfd_create (const char *filename, bfd *templ); -bfd_boolean -bfd_make_writable PARAMS ((bfd *abfd)); +bfd_boolean bfd_make_writable (bfd *abfd); -bfd_boolean -bfd_make_readable PARAMS ((bfd *abfd)); +bfd_boolean bfd_make_readable (bfd *abfd); -unsigned long -bfd_calc_gnu_debuglink_crc32 PARAMS ((unsigned long crc, const unsigned char *buf, bfd_size_type len)); +unsigned long bfd_calc_gnu_debuglink_crc32 + (unsigned long crc, const unsigned char *buf, bfd_size_type len); -char * -bfd_follow_gnu_debuglink PARAMS ((bfd *abfd, const char *dir)); +char *bfd_follow_gnu_debuglink (bfd *abfd, const char *dir); -struct sec * -bfd_create_gnu_debuglink_section PARAMS ((bfd * abfd, const char * filename)); +struct sec *bfd_create_gnu_debuglink_section + (bfd *abfd, const char *filename); -bfd_boolean -bfd_fill_in_gnu_debuglink_section PARAMS ((bfd * abfd, struct sec * sect, const char * filename)); +bfd_boolean bfd_fill_in_gnu_debuglink_section + (bfd *abfd, struct sec *sect, const char *filename); /* Extracted from libbfd.c. */ /* Byte swapping macros for user section data. */ #define bfd_put_8(abfd, val, ptr) \ - ((void) (*((unsigned char *) (ptr)) = (unsigned char) (val))) + ((void) (*((unsigned char *) (ptr)) = (unsigned char) (val))) #define bfd_put_signed_8 \ - bfd_put_8 + bfd_put_8 #define bfd_get_8(abfd, ptr) \ - (*(unsigned char *) (ptr) & 0xff) + (*(unsigned char *) (ptr) & 0xff) #define bfd_get_signed_8(abfd, ptr) \ - (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80) + (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80) #define bfd_put_16(abfd, val, ptr) \ - BFD_SEND(abfd, bfd_putx16, ((val),(ptr))) + BFD_SEND (abfd, bfd_putx16, ((val),(ptr))) #define bfd_put_signed_16 \ - bfd_put_16 + bfd_put_16 #define bfd_get_16(abfd, ptr) \ - BFD_SEND(abfd, bfd_getx16, (ptr)) + BFD_SEND (abfd, bfd_getx16, (ptr)) #define bfd_get_signed_16(abfd, ptr) \ - BFD_SEND (abfd, bfd_getx_signed_16, (ptr)) + BFD_SEND (abfd, bfd_getx_signed_16, (ptr)) #define bfd_put_32(abfd, val, ptr) \ - BFD_SEND(abfd, bfd_putx32, ((val),(ptr))) + BFD_SEND (abfd, bfd_putx32, ((val),(ptr))) #define bfd_put_signed_32 \ - bfd_put_32 + bfd_put_32 #define bfd_get_32(abfd, ptr) \ - BFD_SEND(abfd, bfd_getx32, (ptr)) + BFD_SEND (abfd, bfd_getx32, (ptr)) #define bfd_get_signed_32(abfd, ptr) \ - BFD_SEND(abfd, bfd_getx_signed_32, (ptr)) + BFD_SEND (abfd, bfd_getx_signed_32, (ptr)) #define bfd_put_64(abfd, val, ptr) \ - BFD_SEND(abfd, bfd_putx64, ((val), (ptr))) + BFD_SEND (abfd, bfd_putx64, ((val), (ptr))) #define bfd_put_signed_64 \ - bfd_put_64 + bfd_put_64 #define bfd_get_64(abfd, ptr) \ - BFD_SEND(abfd, bfd_getx64, (ptr)) + BFD_SEND (abfd, bfd_getx64, (ptr)) #define bfd_get_signed_64(abfd, ptr) \ - BFD_SEND(abfd, bfd_getx_signed_64, (ptr)) + BFD_SEND (abfd, bfd_getx_signed_64, (ptr)) -#define bfd_get(bits, abfd, ptr) \ - ( (bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \ - : (bits) == 16 ? bfd_get_16 (abfd, ptr) \ - : (bits) == 32 ? bfd_get_32 (abfd, ptr) \ - : (bits) == 64 ? bfd_get_64 (abfd, ptr) \ - : (abort (), (bfd_vma) - 1)) +#define bfd_get(bits, abfd, ptr) \ + ((bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \ + : (bits) == 16 ? bfd_get_16 (abfd, ptr) \ + : (bits) == 32 ? bfd_get_32 (abfd, ptr) \ + : (bits) == 64 ? bfd_get_64 (abfd, ptr) \ + : (abort (), (bfd_vma) - 1)) -#define bfd_put(bits, abfd, val, ptr) \ - ( (bits) == 8 ? bfd_put_8 (abfd, val, ptr) \ - : (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \ - : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \ - : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \ - : (abort (), (void) 0)) +#define bfd_put(bits, abfd, val, ptr) \ + ((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \ + : (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \ + : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \ + : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \ + : (abort (), (void) 0)) /* Byte swapping macros for file header data. */ @@ -1059,11 +1003,9 @@ bfd_fill_in_gnu_debuglink_section PARAMS ((bfd * abfd, struct sec * sect, const /* Extracted from bfdio.c. */ -long -bfd_get_mtime PARAMS ((bfd *abfd)); +long bfd_get_mtime (bfd *abfd); -long -bfd_get_size PARAMS ((bfd *abfd)); +long bfd_get_size (bfd *abfd); /* Extracted from bfdwin.c. */ /* Extracted from section.c. */ @@ -1393,7 +1335,7 @@ typedef struct sec file_ptr line_filepos; /* Pointer to data for applications. */ - PTR userdata; + void *userdata; /* If the SEC_IN_MEMORY flag is set, this points to the actual contents. */ @@ -1422,7 +1364,7 @@ typedef struct sec /* What the section number is in the target world. */ int target_index; - PTR used_by_bfd; + void *used_by_bfd; /* If this is a constructor section then here is a list of the relocations created to relocate items within it. */ @@ -1507,61 +1449,48 @@ extern const struct symbol_cache_entry * const bfd_ind_symbol; } \ while (0) -void -bfd_section_list_clear PARAMS ((bfd *)); +void bfd_section_list_clear (bfd *); -asection * -bfd_get_section_by_name PARAMS ((bfd *abfd, const char *name)); +asection *bfd_get_section_by_name (bfd *abfd, const char *name); -char * -bfd_get_unique_section_name PARAMS ((bfd *abfd, - const char *templat, - int *count)); +char *bfd_get_unique_section_name + (bfd *abfd, const char *templat, int *count); -asection * -bfd_make_section_old_way PARAMS ((bfd *abfd, const char *name)); +asection *bfd_make_section_old_way (bfd *abfd, const char *name); -asection * -bfd_make_section_anyway PARAMS ((bfd *abfd, const char *name)); +asection *bfd_make_section_anyway (bfd *abfd, const char *name); -asection * -bfd_make_section PARAMS ((bfd *, const char *name)); +asection *bfd_make_section (bfd *, const char *name); -bfd_boolean -bfd_set_section_flags PARAMS ((bfd *abfd, asection *sec, flagword flags)); +bfd_boolean bfd_set_section_flags + (bfd *abfd, asection *sec, flagword flags); -void -bfd_map_over_sections PARAMS ((bfd *abfd, - void (*func) (bfd *abfd, - asection *sect, - PTR obj), - PTR obj)); +void bfd_map_over_sections + (bfd *abfd, + void (*func) (bfd *abfd, asection *sect, void *obj), + void *obj); -bfd_boolean -bfd_set_section_size PARAMS ((bfd *abfd, asection *sec, bfd_size_type val)); +bfd_boolean bfd_set_section_size + (bfd *abfd, asection *sec, bfd_size_type val); -bfd_boolean -bfd_set_section_contents PARAMS ((bfd *abfd, asection *section, - PTR data, file_ptr offset, - bfd_size_type count)); +bfd_boolean bfd_set_section_contents + (bfd *abfd, asection *section, void *data, file_ptr offset, + bfd_size_type count); -bfd_boolean -bfd_get_section_contents PARAMS ((bfd *abfd, asection *section, - PTR location, file_ptr offset, - bfd_size_type count)); +bfd_boolean bfd_get_section_contents + (bfd *abfd, asection *section, void *location, file_ptr offset, + bfd_size_type count); -bfd_boolean -bfd_copy_private_section_data PARAMS ((bfd *ibfd, asection *isec, - bfd *obfd, asection *osec)); +bfd_boolean bfd_copy_private_section_data + (bfd *ibfd, asection *isec, bfd *obfd, asection *osec); #define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \ BFD_SEND (obfd, _bfd_copy_private_section_data, \ (ibfd, isection, obfd, osection)) -void -_bfd_strip_section_from_output PARAMS ((struct bfd_link_info *info, asection *section)); +void _bfd_strip_section_from_output + (struct bfd_link_info *info, asection *section); -bfd_boolean -bfd_generic_discard_group PARAMS ((bfd *abfd, asection *group)); +bfd_boolean bfd_generic_discard_group (bfd *abfd, asection *group); /* Extracted from archures.c. */ enum bfd_architecture @@ -1829,62 +1758,45 @@ typedef struct bfd_arch_info all the entries for that arch can be accessed via <<next>>. */ bfd_boolean the_default; const struct bfd_arch_info * (*compatible) - PARAMS ((const struct bfd_arch_info *a, - const struct bfd_arch_info *b)); + (const struct bfd_arch_info *a, const struct bfd_arch_info *b); - bfd_boolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *)); + bfd_boolean (*scan) (const struct bfd_arch_info *, const char *); const struct bfd_arch_info *next; } bfd_arch_info_type; -const char * -bfd_printable_name PARAMS ((bfd *abfd)); +const char *bfd_printable_name (bfd *abfd); -const bfd_arch_info_type * -bfd_scan_arch PARAMS ((const char *string)); +const bfd_arch_info_type *bfd_scan_arch (const char *string); -const char ** -bfd_arch_list PARAMS ((void)); +const char **bfd_arch_list (void); -const bfd_arch_info_type * -bfd_arch_get_compatible PARAMS (( - const bfd *abfd, - const bfd *bbfd, - bfd_boolean accept_unknowns)); +const bfd_arch_info_type *bfd_arch_get_compatible + (const bfd *abfd, const bfd *bbfd, bfd_boolean accept_unknowns); -void -bfd_set_arch_info PARAMS ((bfd *abfd, const bfd_arch_info_type *arg)); +void bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg); -enum bfd_architecture -bfd_get_arch PARAMS ((bfd *abfd)); +enum bfd_architecture bfd_get_arch (bfd *abfd); -unsigned long -bfd_get_mach PARAMS ((bfd *abfd)); +unsigned long bfd_get_mach (bfd *abfd); -unsigned int -bfd_arch_bits_per_byte PARAMS ((bfd *abfd)); +unsigned int bfd_arch_bits_per_byte (bfd *abfd); -unsigned int -bfd_arch_bits_per_address PARAMS ((bfd *abfd)); +unsigned int bfd_arch_bits_per_address (bfd *abfd); -const bfd_arch_info_type * -bfd_get_arch_info PARAMS ((bfd *abfd)); +const bfd_arch_info_type *bfd_get_arch_info (bfd *abfd); -const bfd_arch_info_type * -bfd_lookup_arch PARAMS ((enum bfd_architecture - arch, - unsigned long machine)); +const bfd_arch_info_type *bfd_lookup_arch + (enum bfd_architecture arch, unsigned long machine); -const char * -bfd_printable_arch_mach PARAMS ((enum bfd_architecture arch, unsigned long machine)); +const char *bfd_printable_arch_mach + (enum bfd_architecture arch, unsigned long machine); -unsigned int -bfd_octets_per_byte PARAMS ((bfd *abfd)); +unsigned int bfd_octets_per_byte (bfd *abfd); -unsigned int -bfd_arch_mach_octets_per_byte PARAMS ((enum bfd_architecture arch, - unsigned long machine)); +unsigned int bfd_arch_mach_octets_per_byte + (enum bfd_architecture arch, unsigned long machine); /* Extracted from reloc.c. */ typedef enum bfd_reloc_status @@ -1996,8 +1908,8 @@ struct reloc_howto_struct strange relocation methods to be accomodated (e.g., i960 callj instructions). */ bfd_reloc_status_type (*special_function) - PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR, asection *, - bfd *, char **)); + (bfd *, arelent *, struct symbol_cache_entry *, void *, asection *, + bfd *, char **); /* The textual name of the relocation type. */ char *name; @@ -2054,7 +1966,7 @@ struct reloc_howto_struct #define HOWTO_PREPARE(relocation, symbol) \ { \ - if (symbol != (asymbol *) NULL) \ + if (symbol != NULL) \ { \ if (bfd_is_com_section (symbol->section)) \ { \ @@ -2067,8 +1979,7 @@ struct reloc_howto_struct } \ } -unsigned int -bfd_get_reloc_size PARAMS ((reloc_howto_type *)); +unsigned int bfd_get_reloc_size (reloc_howto_type *); typedef struct relent_chain { @@ -2077,27 +1988,27 @@ typedef struct relent_chain } arelent_chain; -bfd_reloc_status_type -bfd_check_overflow PARAMS ((enum complain_overflow how, +bfd_reloc_status_type bfd_check_overflow + (enum complain_overflow how, unsigned int bitsize, unsigned int rightshift, unsigned int addrsize, - bfd_vma relocation)); + bfd_vma relocation); -bfd_reloc_status_type -bfd_perform_relocation PARAMS ((bfd *abfd, +bfd_reloc_status_type bfd_perform_relocation + (bfd *abfd, arelent *reloc_entry, - PTR data, + void *data, asection *input_section, bfd *output_bfd, - char **error_message)); + char **error_message); -bfd_reloc_status_type -bfd_install_relocation PARAMS ((bfd *abfd, +bfd_reloc_status_type bfd_install_relocation + (bfd *abfd, arelent *reloc_entry, - PTR data, bfd_vma data_start, + void *data, bfd_vma data_start, asection *input_section, - char **error_message)); + char **error_message); enum bfd_reloc_code_real { _dummy_first_bfd_reloc_code_real, @@ -3508,11 +3419,10 @@ BFD_RELOC_XTENSA_ASM_EXPAND. */ BFD_RELOC_XTENSA_ASM_SIMPLIFY, BFD_RELOC_UNUSED }; typedef enum bfd_reloc_code_real bfd_reloc_code_real_type; -reloc_howto_type * -bfd_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); +reloc_howto_type *bfd_reloc_type_lookup + (bfd *abfd, bfd_reloc_code_real_type code); -const char * -bfd_get_reloc_code_name PARAMS ((bfd_reloc_code_real_type code)); +const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code); /* Extracted from syms.c. */ @@ -3633,7 +3543,7 @@ typedef struct symbol_cache_entry /* Back end special data. */ union { - PTR p; + void *p; bfd_vma i; } udata; @@ -3643,49 +3553,41 @@ asymbol; #define bfd_get_symtab_upper_bound(abfd) \ BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd)) -bfd_boolean -bfd_is_local_label PARAMS ((bfd *abfd, asymbol *sym)); +bfd_boolean bfd_is_local_label (bfd *abfd, asymbol *sym); -bfd_boolean -bfd_is_local_label_name PARAMS ((bfd *abfd, const char *name)); +bfd_boolean bfd_is_local_label_name (bfd *abfd, const char *name); #define bfd_is_local_label_name(abfd, name) \ - BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name)) + BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name)) #define bfd_canonicalize_symtab(abfd, location) \ - BFD_SEND (abfd, _bfd_canonicalize_symtab,\ - (abfd, location)) + BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location)) -bfd_boolean -bfd_set_symtab PARAMS ((bfd *abfd, asymbol **location, unsigned int count)); +bfd_boolean bfd_set_symtab + (bfd *abfd, asymbol **location, unsigned int count); -void -bfd_print_symbol_vandf PARAMS ((bfd *abfd, PTR file, asymbol *symbol)); +void bfd_print_symbol_vandf (bfd *abfd, void *file, asymbol *symbol); #define bfd_make_empty_symbol(abfd) \ - BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd)) + BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd)) -asymbol * -_bfd_generic_make_empty_symbol PARAMS ((bfd *)); +asymbol *_bfd_generic_make_empty_symbol (bfd *); #define bfd_make_debug_symbol(abfd,ptr,size) \ - BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size)) + BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size)) -int -bfd_decode_symclass PARAMS ((asymbol *symbol)); +int bfd_decode_symclass (asymbol *symbol); -bfd_boolean -bfd_is_undefined_symclass PARAMS ((int symclass)); +bfd_boolean bfd_is_undefined_symclass (int symclass); -void -bfd_symbol_info PARAMS ((asymbol *symbol, symbol_info *ret)); +void bfd_symbol_info (asymbol *symbol, symbol_info *ret); -bfd_boolean -bfd_copy_private_symbol_data PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym)); +bfd_boolean bfd_copy_private_symbol_data + (bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym); #define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \ - BFD_SEND (obfd, _bfd_copy_private_symbol_data, \ - (ibfd, isymbol, obfd, osymbol)) + BFD_SEND (obfd, _bfd_copy_private_symbol_data, \ + (ibfd, isymbol, obfd, osymbol)) /* Extracted from bfd.c. */ struct bfd @@ -3706,7 +3608,7 @@ struct bfd is the result of an fopen on the filename. However, if the BFD_IN_MEMORY flag is set, then iostream is actually a pointer to a bfd_in_memory struct. */ - PTR iostream; + void *iostream; /* Is the file descriptor being cached? That is, can it be closed as needed, and re-opened when accessed later? */ @@ -3792,7 +3694,7 @@ struct bfd const struct bfd_arch_info *arch_info; /* Stuff only useful for archives. */ - PTR arelt_data; + void *arelt_data; struct bfd *my_archive; /* The containing archive BFD. */ struct bfd *next; /* The next BFD in the archive. */ struct bfd *archive_head; /* The first BFD in the archive. */ @@ -3842,17 +3744,17 @@ struct bfd struct bfd_pef_data_struct *pef_data; struct bfd_pef_xlib_data_struct *pef_xlib_data; struct bfd_sym_data_struct *sym_data; - PTR any; + void *any; } tdata; /* Used by the application to hold private data. */ - PTR usrdata; + void *usrdata; /* Where all the allocated stuff under this BFD goes. This is a - struct objalloc *, but we use PTR to avoid requiring the inclusion of - objalloc.h. */ - PTR memory; + struct objalloc *, but we use void * to avoid requiring the inclusion + of objalloc.h. */ + void *memory; }; typedef enum bfd_error @@ -3880,79 +3782,57 @@ typedef enum bfd_error } bfd_error_type; -bfd_error_type -bfd_get_error PARAMS ((void)); +bfd_error_type bfd_get_error (void); -void -bfd_set_error PARAMS ((bfd_error_type error_tag)); +void bfd_set_error (bfd_error_type error_tag); -const char * -bfd_errmsg PARAMS ((bfd_error_type error_tag)); +const char *bfd_errmsg (bfd_error_type error_tag); -void -bfd_perror PARAMS ((const char *message)); +void bfd_perror (const char *message); -typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...)); +typedef void (*bfd_error_handler_type) (const char *, ...); -bfd_error_handler_type -bfd_set_error_handler PARAMS ((bfd_error_handler_type)); +bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type); -void -bfd_set_error_program_name PARAMS ((const char *)); +void bfd_set_error_program_name (const char *); -bfd_error_handler_type -bfd_get_error_handler PARAMS ((void)); +bfd_error_handler_type bfd_get_error_handler (void); -const char * -bfd_archive_filename PARAMS ((bfd *)); +const char *bfd_archive_filename (bfd *); -long -bfd_get_reloc_upper_bound PARAMS ((bfd *abfd, asection *sect)); +long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect); -long -bfd_canonicalize_reloc PARAMS ((bfd *abfd, - asection *sec, - arelent **loc, - asymbol **syms)); +long bfd_canonicalize_reloc + (bfd *abfd, asection *sec, arelent **loc, asymbol **syms); -void -bfd_set_reloc PARAMS ((bfd *abfd, asection *sec, arelent **rel, unsigned int count)); +void bfd_set_reloc + (bfd *abfd, asection *sec, arelent **rel, unsigned int count); -bfd_boolean -bfd_set_file_flags PARAMS ((bfd *abfd, flagword flags)); +bfd_boolean bfd_set_file_flags (bfd *abfd, flagword flags); -int -bfd_get_arch_size PARAMS ((bfd *abfd)); +int bfd_get_arch_size (bfd *abfd); -int -bfd_get_sign_extend_vma PARAMS ((bfd *abfd)); +int bfd_get_sign_extend_vma (bfd *abfd); -bfd_boolean -bfd_set_start_address PARAMS ((bfd *abfd, bfd_vma vma)); +bfd_boolean bfd_set_start_address (bfd *abfd, bfd_vma vma); -unsigned int -bfd_get_gp_size PARAMS ((bfd *abfd)); +unsigned int bfd_get_gp_size (bfd *abfd); -void -bfd_set_gp_size PARAMS ((bfd *abfd, unsigned int i)); +void bfd_set_gp_size (bfd *abfd, unsigned int i); -bfd_vma -bfd_scan_vma PARAMS ((const char *string, const char **end, int base)); +bfd_vma bfd_scan_vma (const char *string, const char **end, int base); -bfd_boolean -bfd_copy_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd)); +bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd); #define bfd_copy_private_bfd_data(ibfd, obfd) \ BFD_SEND (obfd, _bfd_copy_private_bfd_data, \ (ibfd, obfd)) -bfd_boolean -bfd_merge_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd)); +bfd_boolean bfd_merge_private_bfd_data (bfd *ibfd, bfd *obfd); #define bfd_merge_private_bfd_data(ibfd, obfd) \ BFD_SEND (obfd, _bfd_merge_private_bfd_data, \ (ibfd, obfd)) -bfd_boolean -bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags)); +bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags); #define bfd_set_private_flags(abfd, flags) \ BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags)) @@ -4027,17 +3907,15 @@ bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags)); BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms)) extern bfd_byte *bfd_get_relocated_section_contents - PARAMS ((bfd *, struct bfd_link_info *, - struct bfd_link_order *, bfd_byte *, - bfd_boolean, asymbol **)); + (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *, + bfd_boolean, asymbol **); -bfd_boolean -bfd_alt_mach_code PARAMS ((bfd *abfd, int alternative)); +bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative); struct bfd_preserve { - PTR marker; - PTR tdata; + void *marker; + void *tdata; flagword flags; const struct bfd_arch_info *arch_info; struct sec *sections; @@ -4046,38 +3924,31 @@ struct bfd_preserve struct bfd_hash_table section_htab; }; -bfd_boolean -bfd_preserve_save PARAMS ((bfd *, struct bfd_preserve *)); +bfd_boolean bfd_preserve_save (bfd *, struct bfd_preserve *); -void -bfd_preserve_restore PARAMS ((bfd *, struct bfd_preserve *)); +void bfd_preserve_restore (bfd *, struct bfd_preserve *); -void -bfd_preserve_finish PARAMS ((bfd *, struct bfd_preserve *)); +void bfd_preserve_finish (bfd *, struct bfd_preserve *); /* Extracted from archive.c. */ -symindex -bfd_get_next_mapent PARAMS ((bfd *abfd, symindex previous, carsym **sym)); +symindex bfd_get_next_mapent + (bfd *abfd, symindex previous, carsym **sym); -bfd_boolean -bfd_set_archive_head PARAMS ((bfd *output, bfd *new_head)); +bfd_boolean bfd_set_archive_head (bfd *output, bfd *new_head); -bfd * -bfd_openr_next_archived_file PARAMS ((bfd *archive, bfd *previous)); +bfd *bfd_openr_next_archived_file (bfd *archive, bfd *previous); /* Extracted from corefile.c. */ -const char * -bfd_core_file_failing_command PARAMS ((bfd *abfd)); +const char *bfd_core_file_failing_command (bfd *abfd); -int -bfd_core_file_failing_signal PARAMS ((bfd *abfd)); +int bfd_core_file_failing_signal (bfd *abfd); -bfd_boolean -core_file_matches_executable_p PARAMS ((bfd *core_bfd, bfd *exec_bfd)); +bfd_boolean core_file_matches_executable_p + (bfd *core_bfd, bfd *exec_bfd); /* Extracted from targets.c. */ #define BFD_SEND(bfd, message, arglist) \ - ((*((bfd)->xvec->message)) arglist) + ((*((bfd)->xvec->message)) arglist) #ifdef DEBUG_BFD_SEND #undef BFD_SEND @@ -4087,7 +3958,7 @@ core_file_matches_executable_p PARAMS ((bfd *core_bfd, bfd *exec_bfd)); (bfd_assert (__FILE__,__LINE__), NULL)) #endif #define BFD_SEND_FMT(bfd, message, arglist) \ - (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) + (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) #ifdef DEBUG_BFD_SEND #undef BFD_SEND_FMT @@ -4165,307 +4036,303 @@ typedef struct bfd_target /* Entries for byte swapping for data. These are different from the other entry points, since they don't take a BFD asthe first argument. Certain other handlers could do the same. */ - bfd_vma (*bfd_getx64) PARAMS ((const bfd_byte *)); - bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *)); - void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *)); - bfd_vma (*bfd_getx32) PARAMS ((const bfd_byte *)); - bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((const bfd_byte *)); - void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *)); - bfd_vma (*bfd_getx16) PARAMS ((const bfd_byte *)); - bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((const bfd_byte *)); - void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *)); + bfd_vma (*bfd_getx64) (const bfd_byte *); + bfd_signed_vma (*bfd_getx_signed_64) (const bfd_byte *); + void (*bfd_putx64) (bfd_vma, bfd_byte *); + bfd_vma (*bfd_getx32) (const bfd_byte *); + bfd_signed_vma (*bfd_getx_signed_32) (const bfd_byte *); + void (*bfd_putx32) (bfd_vma, bfd_byte *); + bfd_vma (*bfd_getx16) (const bfd_byte *); + bfd_signed_vma (*bfd_getx_signed_16) (const bfd_byte *); + void (*bfd_putx16) (bfd_vma, bfd_byte *); /* Byte swapping for the headers. */ - bfd_vma (*bfd_h_getx64) PARAMS ((const bfd_byte *)); - bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((const bfd_byte *)); - void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *)); - bfd_vma (*bfd_h_getx32) PARAMS ((const bfd_byte *)); - bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((const bfd_byte *)); - void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *)); - bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *)); - bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *)); - void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *)); + bfd_vma (*bfd_h_getx64) (const bfd_byte *); + bfd_signed_vma (*bfd_h_getx_signed_64) (const bfd_byte *); + void (*bfd_h_putx64) (bfd_vma, bfd_byte *); + bfd_vma (*bfd_h_getx32) (const bfd_byte *); + bfd_signed_vma (*bfd_h_getx_signed_32) (const bfd_byte *); + void (*bfd_h_putx32) (bfd_vma, bfd_byte *); + bfd_vma (*bfd_h_getx16) (const bfd_byte *); + bfd_signed_vma (*bfd_h_getx_signed_16) (const bfd_byte *); + void (*bfd_h_putx16) (bfd_vma, bfd_byte *); /* Format dependent routines: these are vectors of entry points within the target vector structure, one for each format to check. */ /* Check the format of a file being read. Return a <<bfd_target *>> or zero. */ - const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *)); + const struct bfd_target *(*_bfd_check_format[bfd_type_end]) (bfd *); /* Set the format of a file being written. */ - bfd_boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *)); + bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *); /* Write cached information into a file being written, at <<bfd_close>>. */ - bfd_boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *)); + bfd_boolean (*_bfd_write_contents[bfd_type_end]) (bfd *); /* Generic entry points. */ #define BFD_JUMP_TABLE_GENERIC(NAME) \ -CONCAT2 (NAME,_close_and_cleanup), \ -CONCAT2 (NAME,_bfd_free_cached_info), \ -CONCAT2 (NAME,_new_section_hook), \ -CONCAT2 (NAME,_get_section_contents), \ -CONCAT2 (NAME,_get_section_contents_in_window) + NAME##_close_and_cleanup, \ + NAME##_bfd_free_cached_info, \ + NAME##_new_section_hook, \ + NAME##_get_section_contents, \ + NAME##_get_section_contents_in_window /* Called when the BFD is being closed to do any necessary cleanup. */ - bfd_boolean (*_close_and_cleanup) PARAMS ((bfd *)); + bfd_boolean (*_close_and_cleanup) (bfd *); /* Ask the BFD to free all cached information. */ - bfd_boolean (*_bfd_free_cached_info) PARAMS ((bfd *)); + bfd_boolean (*_bfd_free_cached_info) (bfd *); /* Called when a new section is created. */ - bfd_boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr)); + bfd_boolean (*_new_section_hook) (bfd *, sec_ptr); /* Read the contents of a section. */ bfd_boolean (*_bfd_get_section_contents) - PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); + (bfd *, sec_ptr, void *, file_ptr, bfd_size_type); bfd_boolean (*_bfd_get_section_contents_in_window) - PARAMS ((bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type)); + (bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type); /* Entry points to copy private data. */ #define BFD_JUMP_TABLE_COPY(NAME) \ -CONCAT2 (NAME,_bfd_copy_private_bfd_data), \ -CONCAT2 (NAME,_bfd_merge_private_bfd_data), \ -CONCAT2 (NAME,_bfd_copy_private_section_data), \ -CONCAT2 (NAME,_bfd_copy_private_symbol_data), \ -CONCAT2 (NAME,_bfd_set_private_flags), \ -CONCAT2 (NAME,_bfd_print_private_bfd_data) \ + NAME##_bfd_copy_private_bfd_data, \ + NAME##_bfd_merge_private_bfd_data, \ + NAME##_bfd_copy_private_section_data, \ + NAME##_bfd_copy_private_symbol_data, \ + NAME##_bfd_set_private_flags, \ + NAME##_bfd_print_private_bfd_data + /* Called to copy BFD general private data from one object file to another. */ - bfd_boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *)); + bfd_boolean (*_bfd_copy_private_bfd_data) (bfd *, bfd *); /* Called to merge BFD general private data from one object file to a common output file when linking. */ - bfd_boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *)); + bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *); /* Called to copy BFD private section data from one object file to another. */ bfd_boolean (*_bfd_copy_private_section_data) - PARAMS ((bfd *, sec_ptr, bfd *, sec_ptr)); + (bfd *, sec_ptr, bfd *, sec_ptr); /* Called to copy BFD private symbol data from one symbol to another. */ bfd_boolean (*_bfd_copy_private_symbol_data) - PARAMS ((bfd *, asymbol *, bfd *, asymbol *)); + (bfd *, asymbol *, bfd *, asymbol *); /* Called to set private backend flags. */ - bfd_boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword)); + bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword); /* Called to print private BFD data. */ - bfd_boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR)); + bfd_boolean (*_bfd_print_private_bfd_data) (bfd *, void *); /* Core file entry points. */ #define BFD_JUMP_TABLE_CORE(NAME) \ -CONCAT2 (NAME,_core_file_failing_command), \ -CONCAT2 (NAME,_core_file_failing_signal), \ -CONCAT2 (NAME,_core_file_matches_executable_p) - char * (*_core_file_failing_command) PARAMS ((bfd *)); - int (*_core_file_failing_signal) PARAMS ((bfd *)); - bfd_boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *)); + NAME##_core_file_failing_command, \ + NAME##_core_file_failing_signal, \ + NAME##_core_file_matches_executable_p + + char * (*_core_file_failing_command) (bfd *); + int (*_core_file_failing_signal) (bfd *); + bfd_boolean (*_core_file_matches_executable_p) (bfd *, bfd *); /* Archive entry points. */ #define BFD_JUMP_TABLE_ARCHIVE(NAME) \ -CONCAT2 (NAME,_slurp_armap), \ -CONCAT2 (NAME,_slurp_extended_name_table), \ -CONCAT2 (NAME,_construct_extended_name_table), \ -CONCAT2 (NAME,_truncate_arname), \ -CONCAT2 (NAME,_write_armap), \ -CONCAT2 (NAME,_read_ar_hdr), \ -CONCAT2 (NAME,_openr_next_archived_file), \ -CONCAT2 (NAME,_get_elt_at_index), \ -CONCAT2 (NAME,_generic_stat_arch_elt), \ -CONCAT2 (NAME,_update_armap_timestamp) - bfd_boolean (*_bfd_slurp_armap) PARAMS ((bfd *)); - bfd_boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *)); + NAME##_slurp_armap, \ + NAME##_slurp_extended_name_table, \ + NAME##_construct_extended_name_table, \ + NAME##_truncate_arname, \ + NAME##_write_armap, \ + NAME##_read_ar_hdr, \ + NAME##_openr_next_archived_file, \ + NAME##_get_elt_at_index, \ + NAME##_generic_stat_arch_elt, \ + NAME##_update_armap_timestamp + + bfd_boolean (*_bfd_slurp_armap) (bfd *); + bfd_boolean (*_bfd_slurp_extended_name_table) (bfd *); bfd_boolean (*_bfd_construct_extended_name_table) - PARAMS ((bfd *, char **, bfd_size_type *, const char **)); - void (*_bfd_truncate_arname) PARAMS ((bfd *, const char *, char *)); + (bfd *, char **, bfd_size_type *, const char **); + void (*_bfd_truncate_arname) (bfd *, const char *, char *); bfd_boolean (*write_armap) - PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); - PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *)); - bfd * (*openr_next_archived_file) PARAMS ((bfd *, bfd *)); -#define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i)) - bfd * (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex)); - int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *)); - bfd_boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *)); + (bfd *, unsigned int, struct orl *, unsigned int, int); + void * (*_bfd_read_ar_hdr_fn) (bfd *); + bfd * (*openr_next_archived_file) (bfd *, bfd *); +#define bfd_get_elt_at_index(b,i) BFD_SEND (b, _bfd_get_elt_at_index, (b,i)) + bfd * (*_bfd_get_elt_at_index) (bfd *, symindex); + int (*_bfd_stat_arch_elt) (bfd *, struct stat *); + bfd_boolean (*_bfd_update_armap_timestamp) (bfd *); /* Entry points used for symbols. */ #define BFD_JUMP_TABLE_SYMBOLS(NAME) \ -CONCAT2 (NAME,_get_symtab_upper_bound), \ -CONCAT2 (NAME,_get_symtab), \ -CONCAT2 (NAME,_make_empty_symbol), \ -CONCAT2 (NAME,_print_symbol), \ -CONCAT2 (NAME,_get_symbol_info), \ -CONCAT2 (NAME,_bfd_is_local_label_name), \ -CONCAT2 (NAME,_get_lineno), \ -CONCAT2 (NAME,_find_nearest_line), \ -CONCAT2 (NAME,_bfd_make_debug_symbol), \ -CONCAT2 (NAME,_read_minisymbols), \ -CONCAT2 (NAME,_minisymbol_to_symbol) - long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *)); - long (*_bfd_canonicalize_symtab) PARAMS ((bfd *, - struct symbol_cache_entry **)); + NAME##_get_symtab_upper_bound, \ + NAME##_get_symtab, \ + NAME##_make_empty_symbol, \ + NAME##_print_symbol, \ + NAME##_get_symbol_info, \ + NAME##_bfd_is_local_label_name, \ + NAME##_get_lineno, \ + NAME##_find_nearest_line, \ + NAME##_bfd_make_debug_symbol, \ + NAME##_read_minisymbols, \ + NAME##_minisymbol_to_symbol + + long (*_bfd_get_symtab_upper_bound) (bfd *); + long (*_bfd_canonicalize_symtab) + (bfd *, struct symbol_cache_entry **); struct symbol_cache_entry * - (*_bfd_make_empty_symbol) PARAMS ((bfd *)); + (*_bfd_make_empty_symbol) (bfd *); void (*_bfd_print_symbol) - PARAMS ((bfd *, PTR, struct symbol_cache_entry *, bfd_print_symbol_type)); -#define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e)) + (bfd *, void *, struct symbol_cache_entry *, bfd_print_symbol_type); +#define bfd_print_symbol(b,p,s,e) BFD_SEND (b, _bfd_print_symbol, (b,p,s,e)) void (*_bfd_get_symbol_info) - PARAMS ((bfd *, struct symbol_cache_entry *, symbol_info *)); -#define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e)) - bfd_boolean (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *)); + (bfd *, struct symbol_cache_entry *, symbol_info *); +#define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e)) + bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *); - alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *)); + alent * (*_get_lineno) (bfd *, struct symbol_cache_entry *); bfd_boolean (*_bfd_find_nearest_line) - PARAMS ((bfd *, struct sec *, struct symbol_cache_entry **, bfd_vma, - const char **, const char **, unsigned int *)); + (bfd *, struct sec *, struct symbol_cache_entry **, bfd_vma, + const char **, const char **, unsigned int *); /* Back-door to allow format-aware applications to create debug symbols while using BFD for everything else. Currently used by the assembler when creating COFF files. */ asymbol * (*_bfd_make_debug_symbol) - PARAMS ((bfd *, void *, unsigned long size)); + (bfd *, void *, unsigned long size); #define bfd_read_minisymbols(b, d, m, s) \ BFD_SEND (b, _read_minisymbols, (b, d, m, s)) long (*_read_minisymbols) - PARAMS ((bfd *, bfd_boolean, PTR *, unsigned int *)); + (bfd *, bfd_boolean, void **, unsigned int *); #define bfd_minisymbol_to_symbol(b, d, m, f) \ BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f)) asymbol * (*_minisymbol_to_symbol) - PARAMS ((bfd *, bfd_boolean, const PTR, asymbol *)); + (bfd *, bfd_boolean, const void *, asymbol *); /* Routines for relocs. */ #define BFD_JUMP_TABLE_RELOCS(NAME) \ -CONCAT2 (NAME,_get_reloc_upper_bound), \ -CONCAT2 (NAME,_canonicalize_reloc), \ -CONCAT2 (NAME,_bfd_reloc_type_lookup) - long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr)); + NAME##_get_reloc_upper_bound, \ + NAME##_canonicalize_reloc, \ + NAME##_bfd_reloc_type_lookup + + long (*_get_reloc_upper_bound) (bfd *, sec_ptr); long (*_bfd_canonicalize_reloc) - PARAMS ((bfd *, sec_ptr, arelent **, struct symbol_cache_entry **)); + (bfd *, sec_ptr, arelent **, struct symbol_cache_entry **); /* See documentation on reloc types. */ reloc_howto_type * - (*reloc_type_lookup) PARAMS ((bfd *, bfd_reloc_code_real_type)); + (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); /* Routines used when writing an object file. */ #define BFD_JUMP_TABLE_WRITE(NAME) \ -CONCAT2 (NAME,_set_arch_mach), \ -CONCAT2 (NAME,_set_section_contents) + NAME##_set_arch_mach, \ + NAME##_set_section_contents + bfd_boolean (*_bfd_set_arch_mach) - PARAMS ((bfd *, enum bfd_architecture, unsigned long)); + (bfd *, enum bfd_architecture, unsigned long); bfd_boolean (*_bfd_set_section_contents) - PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); + (bfd *, sec_ptr, void *, file_ptr, bfd_size_type); /* Routines used by the linker. */ #define BFD_JUMP_TABLE_LINK(NAME) \ -CONCAT2 (NAME,_sizeof_headers), \ -CONCAT2 (NAME,_bfd_get_relocated_section_contents), \ -CONCAT2 (NAME,_bfd_relax_section), \ -CONCAT2 (NAME,_bfd_link_hash_table_create), \ -CONCAT2 (NAME,_bfd_link_hash_table_free), \ -CONCAT2 (NAME,_bfd_link_add_symbols), \ -CONCAT2 (NAME,_bfd_link_just_syms), \ -CONCAT2 (NAME,_bfd_final_link), \ -CONCAT2 (NAME,_bfd_link_split_section), \ -CONCAT2 (NAME,_bfd_gc_sections), \ -CONCAT2 (NAME,_bfd_merge_sections), \ -CONCAT2 (NAME,_bfd_discard_group) - int (*_bfd_sizeof_headers) PARAMS ((bfd *, bfd_boolean)); + NAME##_sizeof_headers, \ + NAME##_bfd_get_relocated_section_contents, \ + NAME##_bfd_relax_section, \ + NAME##_bfd_link_hash_table_create, \ + NAME##_bfd_link_hash_table_free, \ + NAME##_bfd_link_add_symbols, \ + NAME##_bfd_link_just_syms, \ + NAME##_bfd_final_link, \ + NAME##_bfd_link_split_section, \ + NAME##_bfd_gc_sections, \ + NAME##_bfd_merge_sections, \ + NAME##_bfd_discard_group + + int (*_bfd_sizeof_headers) (bfd *, bfd_boolean); bfd_byte * (*_bfd_get_relocated_section_contents) - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, - bfd_byte *, bfd_boolean, struct symbol_cache_entry **)); + (bfd *, struct bfd_link_info *, struct bfd_link_order *, + bfd_byte *, bfd_boolean, struct symbol_cache_entry **); bfd_boolean (*_bfd_relax_section) - PARAMS ((bfd *, struct sec *, struct bfd_link_info *, bfd_boolean *)); + (bfd *, struct sec *, struct bfd_link_info *, bfd_boolean *); /* Create a hash table for the linker. Different backends store different information in this table. */ struct bfd_link_hash_table * - (*_bfd_link_hash_table_create) PARAMS ((bfd *)); + (*_bfd_link_hash_table_create) (bfd *); /* Release the memory associated with the linker hash table. */ - void (*_bfd_link_hash_table_free) - PARAMS ((struct bfd_link_hash_table *)); + void (*_bfd_link_hash_table_free) (struct bfd_link_hash_table *); /* Add symbols from this object file into the hash table. */ - bfd_boolean (*_bfd_link_add_symbols) - PARAMS ((bfd *, struct bfd_link_info *)); + bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *); /* Indicate that we are only retrieving symbol values from this section. */ - void (*_bfd_link_just_syms) - PARAMS ((asection *, struct bfd_link_info *)); + void (*_bfd_link_just_syms) (asection *, struct bfd_link_info *); /* Do a link based on the link_order structures attached to each section of the BFD. */ - bfd_boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *)); + bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *); /* Should this section be split up into smaller pieces during linking. */ - bfd_boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *)); + bfd_boolean (*_bfd_link_split_section) (bfd *, struct sec *); /* Remove sections that are not referenced from the output. */ - bfd_boolean (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *)); + bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *); /* Attempt to merge SEC_MERGE sections. */ - bfd_boolean (*_bfd_merge_sections) PARAMS ((bfd *, struct bfd_link_info *)); + bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *); /* Discard members of a group. */ - bfd_boolean (*_bfd_discard_group) PARAMS ((bfd *, struct sec *)); + bfd_boolean (*_bfd_discard_group) (bfd *, struct sec *); /* Routines to handle dynamic symbols and relocs. */ #define BFD_JUMP_TABLE_DYNAMIC(NAME) \ -CONCAT2 (NAME,_get_dynamic_symtab_upper_bound), \ -CONCAT2 (NAME,_canonicalize_dynamic_symtab), \ -CONCAT2 (NAME,_get_dynamic_reloc_upper_bound), \ -CONCAT2 (NAME,_canonicalize_dynamic_reloc) + NAME##_get_dynamic_symtab_upper_bound, \ + NAME##_canonicalize_dynamic_symtab, \ + NAME##_get_dynamic_reloc_upper_bound, \ + NAME##_canonicalize_dynamic_reloc + /* Get the amount of memory required to hold the dynamic symbols. */ - long (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *)); + long (*_bfd_get_dynamic_symtab_upper_bound) (bfd *); /* Read in the dynamic symbols. */ long (*_bfd_canonicalize_dynamic_symtab) - PARAMS ((bfd *, struct symbol_cache_entry **)); + (bfd *, struct symbol_cache_entry **); /* Get the amount of memory required to hold the dynamic relocs. */ - long (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *)); + long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *); /* Read in the dynamic relocs. */ long (*_bfd_canonicalize_dynamic_reloc) - PARAMS ((bfd *, arelent **, struct symbol_cache_entry **)); + (bfd *, arelent **, struct symbol_cache_entry **); /* Opposite endian version of this target. */ const struct bfd_target * alternative_target; /* Data for use by back-end routines, which isn't generic enough to belong in this structure. */ - PTR backend_data; + void *backend_data; } bfd_target; -bfd_boolean -bfd_set_default_target PARAMS ((const char *name)); +bfd_boolean bfd_set_default_target (const char *name); -const bfd_target * -bfd_find_target PARAMS ((const char *target_name, bfd *abfd)); +const bfd_target *bfd_find_target (const char *target_name, bfd *abfd); -const char ** -bfd_target_list PARAMS ((void)); +const char ** bfd_target_list (void); -const bfd_target * -bfd_search_for_target PARAMS ((int (* search_func) - (const bfd_target *, void *), - void *)); +const bfd_target *bfd_search_for_target + (int (*search_func) (const bfd_target *, void *), + void *); /* Extracted from format.c. */ -bfd_boolean -bfd_check_format PARAMS ((bfd *abfd, bfd_format format)); +bfd_boolean bfd_check_format (bfd *abfd, bfd_format format); -bfd_boolean -bfd_check_format_matches PARAMS ((bfd *abfd, bfd_format format, - char ***matching)); +bfd_boolean bfd_check_format_matches + (bfd *abfd, bfd_format format, char ***matching); -bfd_boolean -bfd_set_format PARAMS ((bfd *abfd, bfd_format format)); +bfd_boolean bfd_set_format (bfd *abfd, bfd_format format); -const char * -bfd_format_string PARAMS ((bfd_format format)); +const char *bfd_format_string (bfd_format format); /* Extracted from linker.c. */ -bfd_boolean -bfd_link_split_section PARAMS ((bfd *abfd, asection *sec)); +bfd_boolean bfd_link_split_section (bfd *abfd, asection *sec); #define bfd_link_split_section(abfd, sec) \ BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec)) /* Extracted from simple.c. */ -bfd_byte * -bfd_simple_get_relocated_section_contents PARAMS ((bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table)); +bfd_byte *bfd_simple_get_relocated_section_contents + (bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table); #ifdef __cplusplus } diff --git a/bfd/bfd.c b/bfd/bfd.c index e54bd89d6c2..472d0ed9fbf 100644 --- a/bfd/bfd.c +++ b/bfd/bfd.c @@ -52,7 +52,7 @@ CODE_FRAGMENT . is the result of an fopen on the filename. However, if the . BFD_IN_MEMORY flag is set, then iostream is actually a pointer . to a bfd_in_memory struct. *} -. PTR iostream; +. void *iostream; . . {* Is the file descriptor being cached? That is, can it be closed as . needed, and re-opened when accessed later? *} @@ -138,7 +138,7 @@ CODE_FRAGMENT . const struct bfd_arch_info *arch_info; . . {* Stuff only useful for archives. *} -. PTR arelt_data; +. void *arelt_data; . struct bfd *my_archive; {* The containing archive BFD. *} . struct bfd *next; {* The next BFD in the archive. *} . struct bfd *archive_head; {* The first BFD in the archive. *} @@ -188,17 +188,17 @@ CODE_FRAGMENT . struct bfd_pef_data_struct *pef_data; . struct bfd_pef_xlib_data_struct *pef_xlib_data; . struct bfd_sym_data_struct *sym_data; -. PTR any; +. void *any; . } . tdata; . . {* Used by the application to hold private data. *} -. PTR usrdata; +. void *usrdata; . . {* Where all the allocated stuff under this BFD goes. This is a -. struct objalloc *, but we use PTR to avoid requiring the inclusion of -. objalloc.h. *} -. PTR memory; +. struct objalloc *, but we use void * to avoid requiring the inclusion +. of objalloc.h. *} +. void *memory; .}; . */ @@ -206,13 +206,7 @@ CODE_FRAGMENT #include "bfd.h" #include "bfdver.h" #include "sysdep.h" - -#ifdef ANSI_PROTOTYPES #include <stdarg.h> -#else -#include <varargs.h> -#endif - #include "libiberty.h" #include "safe-ctype.h" #include "bfdlink.h" @@ -317,7 +311,7 @@ DESCRIPTION */ bfd_error_type -bfd_get_error () +bfd_get_error (void) { return bfd_error; } @@ -334,8 +328,7 @@ DESCRIPTION */ void -bfd_set_error (error_tag) - bfd_error_type error_tag; +bfd_set_error (bfd_error_type error_tag) { bfd_error = error_tag; } @@ -353,8 +346,7 @@ DESCRIPTION */ const char * -bfd_errmsg (error_tag) - bfd_error_type error_tag; +bfd_errmsg (bfd_error_type error_tag) { #ifndef errno extern int errno; @@ -362,11 +354,10 @@ bfd_errmsg (error_tag) if (error_tag == bfd_error_system_call) return xstrerror (errno); - if ((((int) error_tag < (int) bfd_error_no_error) || - ((int) error_tag > (int) bfd_error_invalid_error_code))) - error_tag = bfd_error_invalid_error_code;/* sanity check */ + if (error_tag > bfd_error_invalid_error_code) + error_tag = bfd_error_invalid_error_code; /* sanity check */ - return _(bfd_errmsgs [(int)error_tag]); + return _(bfd_errmsgs [error_tag]); } /* @@ -385,12 +376,11 @@ DESCRIPTION */ void -bfd_perror (message) - const char *message; +bfd_perror (const char *message) { if (bfd_get_error () == bfd_error_system_call) /* Must be a system error then. */ - perror ((char *)message); + perror ((char *) message); else { if (message == NULL || *message == '\0') @@ -412,7 +402,7 @@ SUBSECTION CODE_FRAGMENT . -.typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...)); +.typedef void (*bfd_error_handler_type) (const char *, ...); . */ @@ -422,20 +412,19 @@ static const char *_bfd_error_program_name; /* This is the default routine to handle BFD error messages. */ -static void _bfd_default_error_handler PARAMS ((const char *s, ...)); - static void -_bfd_default_error_handler VPARAMS ((const char *s, ...)) +_bfd_default_error_handler (const char *s, ...) { + va_list p; + if (_bfd_error_program_name != NULL) fprintf (stderr, "%s: ", _bfd_error_program_name); else fprintf (stderr, "BFD: "); - VA_OPEN (p, s); - VA_FIXEDARG (p, const char *, s); + va_start (p, s); vfprintf (stderr, s, p); - VA_CLOSE (p); + va_end (p); fprintf (stderr, "\n"); } @@ -461,8 +450,7 @@ DESCRIPTION */ bfd_error_handler_type -bfd_set_error_handler (pnew) - bfd_error_handler_type pnew; +bfd_set_error_handler (bfd_error_handler_type pnew) { bfd_error_handler_type pold; @@ -486,8 +474,7 @@ DESCRIPTION */ void -bfd_set_error_program_name (name) - const char *name; +bfd_set_error_program_name (const char *name) { _bfd_error_program_name = name; } @@ -504,7 +491,7 @@ DESCRIPTION */ bfd_error_handler_type -bfd_get_error_handler () +bfd_get_error_handler (void) { return _bfd_error_handler; } @@ -523,8 +510,7 @@ DESCRIPTION */ const char * -bfd_archive_filename (abfd) - bfd *abfd; +bfd_archive_filename (bfd *abfd) { if (abfd->my_archive) { @@ -539,7 +525,7 @@ bfd_archive_filename (abfd) if (curr) free (buf); curr = needed + (needed >> 1); - buf = bfd_malloc ((bfd_size_type) curr); + buf = bfd_malloc (curr); /* If we can't malloc, fail safe by returning just the file name. This function is only used when building error messages. */ @@ -577,9 +563,7 @@ DESCRIPTION */ long -bfd_get_reloc_upper_bound (abfd, asect) - bfd *abfd; - sec_ptr asect; +bfd_get_reloc_upper_bound (bfd *abfd, sec_ptr asect) { if (abfd->format != bfd_object) { @@ -596,10 +580,7 @@ FUNCTION SYNOPSIS long bfd_canonicalize_reloc - (bfd *abfd, - asection *sec, - arelent **loc, - asymbol **syms); + (bfd *abfd, asection *sec, arelent **loc, asymbol **syms); DESCRIPTION Call the back end associated with the open BFD @@ -615,11 +596,10 @@ DESCRIPTION */ long -bfd_canonicalize_reloc (abfd, asect, location, symbols) - bfd *abfd; - sec_ptr asect; - arelent **location; - asymbol **symbols; +bfd_canonicalize_reloc (bfd *abfd, + sec_ptr asect, + arelent **location, + asymbol **symbols) { if (abfd->format != bfd_object) { @@ -647,11 +627,10 @@ DESCRIPTION */ void -bfd_set_reloc (ignore_abfd, asect, location, count) - bfd *ignore_abfd ATTRIBUTE_UNUSED; - sec_ptr asect; - arelent **location; - unsigned int count; +bfd_set_reloc (bfd *ignore_abfd ATTRIBUTE_UNUSED, + sec_ptr asect, + arelent **location, + unsigned int count) { asect->orelocation = location; asect->reloc_count = count; @@ -678,9 +657,7 @@ DESCRIPTION */ bfd_boolean -bfd_set_file_flags (abfd, flags) - bfd *abfd; - flagword flags; +bfd_set_file_flags (bfd *abfd, flagword flags) { if (abfd->format != bfd_object) { @@ -705,9 +682,7 @@ bfd_set_file_flags (abfd, flags) } void -bfd_assert (file, line) - const char *file; - int line; +bfd_assert (const char *file, int line) { (*_bfd_error_handler) (_("BFD %s assertion fail %s:%d"), BFD_VERSION_STRING, file, line); @@ -721,10 +696,7 @@ bfd_assert (file, line) #endif void -_bfd_abort (file, line, fn) - const char *file; - int line; - const char *fn; +_bfd_abort (const char *file, int line, const char *fn) { if (fn != NULL) (*_bfd_error_handler) @@ -755,11 +727,10 @@ RETURNS */ int -bfd_get_arch_size (abfd) - bfd *abfd; +bfd_get_arch_size (bfd *abfd) { if (abfd->xvec->flavour == bfd_target_elf_flavour) - return (get_elf_backend_data (abfd))->s->arch_size; + return get_elf_backend_data (abfd)->s->arch_size; return -1; } @@ -786,13 +757,12 @@ RETURNS */ int -bfd_get_sign_extend_vma (abfd) - bfd *abfd; +bfd_get_sign_extend_vma (bfd *abfd) { char *name; if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) - return (get_elf_backend_data (abfd)->sign_extend_vma); + return get_elf_backend_data (abfd)->sign_extend_vma; name = bfd_get_target (abfd); @@ -823,9 +793,7 @@ RETURNS */ bfd_boolean -bfd_set_start_address (abfd, vma) - bfd *abfd; - bfd_vma vma; +bfd_set_start_address (bfd *abfd, bfd_vma vma) { abfd->start_address = vma; return TRUE; @@ -845,8 +813,7 @@ DESCRIPTION */ unsigned int -bfd_get_gp_size (abfd) - bfd *abfd; +bfd_get_gp_size (bfd *abfd) { if (abfd->format == bfd_object) { @@ -872,9 +839,7 @@ DESCRIPTION */ void -bfd_set_gp_size (abfd, i) - bfd *abfd; - unsigned int i; +bfd_set_gp_size (bfd *abfd, unsigned int i) { /* Don't try to set GP size on an archive or core file! */ if (abfd->format != bfd_object) @@ -891,8 +856,7 @@ bfd_set_gp_size (abfd, i) register. */ bfd_vma -_bfd_get_gp_value (abfd) - bfd *abfd; +_bfd_get_gp_value (bfd *abfd) { if (! abfd) return 0; @@ -910,9 +874,7 @@ _bfd_get_gp_value (abfd) /* Set the GP value. */ void -_bfd_set_gp_value (abfd, v) - bfd *abfd; - bfd_vma v; +_bfd_set_gp_value (bfd *abfd, bfd_vma v) { if (! abfd) BFD_FAIL (); @@ -947,10 +909,7 @@ DESCRIPTION */ bfd_vma -bfd_scan_vma (string, end, base) - const char *string; - const char **end; - int base; +bfd_scan_vma (const char *string, const char **end, int base) { bfd_vma value; bfd_vma cutoff; @@ -959,7 +918,7 @@ bfd_scan_vma (string, end, base) /* Let the host do it if possible. */ if (sizeof (bfd_vma) <= sizeof (unsigned long)) - return (bfd_vma) strtoul (string, (char **) end, base); + return strtoul (string, (char **) end, base); if (base == 0) { @@ -1155,27 +1114,23 @@ DESCRIPTION . BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms)) . .extern bfd_byte *bfd_get_relocated_section_contents -. PARAMS ((bfd *, struct bfd_link_info *, -. struct bfd_link_order *, bfd_byte *, -. bfd_boolean, asymbol **)); +. (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *, +. bfd_boolean, asymbol **); . */ bfd_byte * -bfd_get_relocated_section_contents (abfd, link_info, link_order, data, - relocatable, symbols) - bfd *abfd; - struct bfd_link_info *link_info; - struct bfd_link_order *link_order; - bfd_byte *data; - bfd_boolean relocatable; - asymbol **symbols; +bfd_get_relocated_section_contents (bfd *abfd, + struct bfd_link_info *link_info, + struct bfd_link_order *link_order, + bfd_byte *data, + bfd_boolean relocatable, + asymbol **symbols) { bfd *abfd2; - bfd_byte *(*fn) PARAMS ((bfd *, struct bfd_link_info *, - struct bfd_link_order *, bfd_byte *, bfd_boolean, - asymbol **)); + bfd_byte *(*fn) (bfd *, struct bfd_link_info *, struct bfd_link_order *, + bfd_byte *, bfd_boolean, asymbol **); if (link_order->type == bfd_indirect_link_order) { @@ -1194,18 +1149,16 @@ bfd_get_relocated_section_contents (abfd, link_info, link_order, data, /* Record information about an ELF program header. */ bfd_boolean -bfd_record_phdr (abfd, type, flags_valid, flags, at_valid, at, - includes_filehdr, includes_phdrs, count, secs) - bfd *abfd; - unsigned long type; - bfd_boolean flags_valid; - flagword flags; - bfd_boolean at_valid; - bfd_vma at; - bfd_boolean includes_filehdr; - bfd_boolean includes_phdrs; - unsigned int count; - asection **secs; +bfd_record_phdr (bfd *abfd, + unsigned long type, + bfd_boolean flags_valid, + flagword flags, + bfd_boolean at_valid, + bfd_vma at, + bfd_boolean includes_filehdr, + bfd_boolean includes_phdrs, + unsigned int count, + asection **secs) { struct elf_segment_map *m, **pm; bfd_size_type amt; @@ -1215,7 +1168,7 @@ bfd_record_phdr (abfd, type, flags_valid, flags, at_valid, at, amt = sizeof (struct elf_segment_map); amt += ((bfd_size_type) count - 1) * sizeof (asection *); - m = (struct elf_segment_map *) bfd_alloc (abfd, amt); + m = bfd_alloc (abfd, amt); if (m == NULL) return FALSE; @@ -1223,10 +1176,10 @@ bfd_record_phdr (abfd, type, flags_valid, flags, at_valid, at, m->p_type = type; m->p_flags = flags; m->p_paddr = at; - m->p_flags_valid = (unsigned int) flags_valid; - m->p_paddr_valid = (unsigned int) at_valid; - m->includes_filehdr = (unsigned int) includes_filehdr; - m->includes_phdrs = (unsigned int) includes_phdrs; + m->p_flags_valid = flags_valid; + m->p_paddr_valid = at_valid; + m->includes_filehdr = includes_filehdr; + m->includes_phdrs = includes_phdrs; m->count = count; if (count > 0) memcpy (m->sections, secs, count * sizeof (asection *)); @@ -1239,10 +1192,7 @@ bfd_record_phdr (abfd, type, flags_valid, flags, at_valid, at, } void -bfd_sprintf_vma (abfd, buf, value) - bfd *abfd; - char *buf; - bfd_vma value; +bfd_sprintf_vma (bfd *abfd, char *buf, bfd_vma value) { if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) get_elf_backend_data (abfd)->elf_backend_sprintf_vma (abfd, buf, value); @@ -1251,10 +1201,7 @@ bfd_sprintf_vma (abfd, buf, value) } void -bfd_fprintf_vma (abfd, stream, value) - bfd *abfd; - PTR stream; - bfd_vma value; +bfd_fprintf_vma (bfd *abfd, void *stream, bfd_vma value) { if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) get_elf_backend_data (abfd)->elf_backend_fprintf_vma (abfd, stream, value); @@ -1279,9 +1226,7 @@ DESCRIPTION */ bfd_boolean -bfd_alt_mach_code (abfd, alternative) - bfd *abfd; - int alternative; +bfd_alt_mach_code (bfd *abfd, int alternative) { if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) { @@ -1322,8 +1267,8 @@ CODE_FRAGMENT .struct bfd_preserve .{ -. PTR marker; -. PTR tdata; +. void *marker; +. void *tdata; . flagword flags; . const struct bfd_arch_info *arch_info; . struct sec *sections; @@ -1355,9 +1300,7 @@ DESCRIPTION */ bfd_boolean -bfd_preserve_save (abfd, preserve) - bfd *abfd; - struct bfd_preserve *preserve; +bfd_preserve_save (bfd *abfd, struct bfd_preserve *preserve) { preserve->tdata = abfd->tdata.any; preserve->arch_info = abfd->arch_info; @@ -1395,9 +1338,7 @@ DESCRIPTION */ void -bfd_preserve_restore (abfd, preserve) - bfd *abfd; - struct bfd_preserve *preserve; +bfd_preserve_restore (bfd *abfd, struct bfd_preserve *preserve) { bfd_hash_table_free (&abfd->section_htab); @@ -1433,9 +1374,7 @@ DESCRIPTION */ void -bfd_preserve_finish (abfd, preserve) - bfd *abfd ATTRIBUTE_UNUSED; - struct bfd_preserve *preserve; +bfd_preserve_finish (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_preserve *preserve) { /* It would be nice to be able to free more memory here, eg. old tdata, but that's not possible since these blocks are sitting diff --git a/bfd/bfdio.c b/bfd/bfdio.c index 32293162367..377622fe557 100644 --- a/bfd/bfdio.c +++ b/bfd/bfdio.c @@ -43,13 +43,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ contents (0 for non-archive elements). For archive entries this is the first octet in the file, NOT the beginning of the archive header. */ -static size_t real_read PARAMS ((PTR where, size_t a, size_t b, FILE *file)); static size_t -real_read (where, a, b, file) - PTR where; - size_t a; - size_t b; - FILE *file; +real_read (void *where, size_t a, size_t b, FILE *file) { /* FIXME - this looks like an optimization, but it's really to cover up for a feature of some OSs (not solaris - sigh) that @@ -76,10 +71,7 @@ real_read (where, a, b, file) /* Return value is amount read. */ bfd_size_type -bfd_bread (ptr, size, abfd) - PTR ptr; - bfd_size_type size; - bfd *abfd; +bfd_bread (void *ptr, bfd_size_type size, bfd *abfd) { size_t nread; @@ -88,7 +80,7 @@ bfd_bread (ptr, size, abfd) struct bfd_in_memory *bim; bfd_size_type get; - bim = (struct bfd_in_memory *) abfd->iostream; + bim = abfd->iostream; get = size; if (abfd->where + get > bim->size) { @@ -126,16 +118,13 @@ bfd_bread (ptr, size, abfd) } bfd_size_type -bfd_bwrite (ptr, size, abfd) - const PTR ptr; - bfd_size_type size; - bfd *abfd; +bfd_bwrite (const void *ptr, bfd_size_type size, bfd *abfd) { size_t nwrote; if ((abfd->flags & BFD_IN_MEMORY) != 0) { - struct bfd_in_memory *bim = (struct bfd_in_memory *) (abfd->iostream); + struct bfd_in_memory *bim = abfd->iostream; size = (size_t) size; if (abfd->where + size > bim->size) { @@ -147,7 +136,7 @@ bfd_bwrite (ptr, size, abfd) newsize = (bim->size + 127) & ~(bfd_size_type) 127; if (newsize > oldsize) { - bim->buffer = (bfd_byte *) bfd_realloc (bim->buffer, newsize); + bim->buffer = bfd_realloc (bim->buffer, newsize); if (bim->buffer == 0) { bim->size = 0; @@ -174,8 +163,7 @@ bfd_bwrite (ptr, size, abfd) } bfd_vma -bfd_tell (abfd) - bfd *abfd; +bfd_tell (bfd *abfd) { file_ptr ptr; @@ -191,8 +179,7 @@ bfd_tell (abfd) } int -bfd_flush (abfd) - bfd *abfd; +bfd_flush (bfd *abfd) { if ((abfd->flags & BFD_IN_MEMORY) != 0) return 0; @@ -202,9 +189,7 @@ bfd_flush (abfd) /* Returns 0 for success, negative value for failure (in which case bfd_get_error can retrieve the error code). */ int -bfd_stat (abfd, statbuf) - bfd *abfd; - struct stat *statbuf; +bfd_stat (bfd *abfd, struct stat *statbuf) { FILE *f; int result; @@ -228,10 +213,7 @@ bfd_stat (abfd, statbuf) can retrieve the error code). */ int -bfd_seek (abfd, position, direction) - bfd *abfd; - file_ptr position; - int direction; +bfd_seek (bfd *abfd, file_ptr position, int direction) { int result; FILE *f; @@ -249,7 +231,7 @@ bfd_seek (abfd, position, direction) { struct bfd_in_memory *bim; - bim = (struct bfd_in_memory *) abfd->iostream; + bim = abfd->iostream; if (direction == SEEK_SET) abfd->where = position; @@ -268,7 +250,7 @@ bfd_seek (abfd, position, direction) newsize = (bim->size + 127) & ~(bfd_size_type) 127; if (newsize > oldsize) { - bim->buffer = (bfd_byte *) bfd_realloc (bim->buffer, newsize); + bim->buffer = bfd_realloc (bim->buffer, newsize); if (bim->buffer == 0) { bim->size = 0; @@ -359,7 +341,7 @@ FUNCTION bfd_get_mtime SYNOPSIS - long bfd_get_mtime(bfd *abfd); + long bfd_get_mtime (bfd *abfd); DESCRIPTION Return the file modification time (as read from the file system, or @@ -368,8 +350,7 @@ DESCRIPTION */ long -bfd_get_mtime (abfd) - bfd *abfd; +bfd_get_mtime (bfd *abfd) { FILE *fp; struct stat buf; @@ -390,7 +371,7 @@ FUNCTION bfd_get_size SYNOPSIS - long bfd_get_size(bfd *abfd); + long bfd_get_size (bfd *abfd); DESCRIPTION Return the file size (as read from file system) for the file @@ -419,8 +400,7 @@ DESCRIPTION */ long -bfd_get_size (abfd) - bfd *abfd; +bfd_get_size (bfd *abfd) { FILE *fp; struct stat buf; diff --git a/bfd/bfdwin.c b/bfd/bfdwin.c index 442a8a4905b..00d1a146e07 100644 --- a/bfd/bfdwin.c +++ b/bfd/bfdwin.c @@ -52,7 +52,7 @@ INTERNAL_DEFINITION .struct _bfd_window_internal { . struct _bfd_window_internal *next; -. PTR data; +. void *data; . bfd_size_type size; . int refcount : 31; {* should be enough... *} . unsigned mapped : 1; {* 1 = mmap, 0 = malloc *} @@ -60,8 +60,7 @@ INTERNAL_DEFINITION */ void -bfd_init_window (windowp) - bfd_window *windowp; +bfd_init_window (bfd_window *windowp) { windowp->data = 0; windowp->i = 0; @@ -69,8 +68,7 @@ bfd_init_window (windowp) } void -bfd_free_window (windowp) - bfd_window *windowp; +bfd_free_window (bfd_window *windowp) { bfd_window_internal *i = windowp->i; windowp->i = 0; @@ -108,12 +106,11 @@ bfd_free_window (windowp) static int ok_to_map = 1; bfd_boolean -bfd_get_file_window (abfd, offset, size, windowp, writable) - bfd *abfd; - file_ptr offset; - bfd_size_type size; - bfd_window *windowp; - bfd_boolean writable; +bfd_get_file_window (bfd *abfd, + file_ptr offset, + bfd_size_type size, + bfd_window *windowp, + bfd_boolean writable) { static size_t pagesize; bfd_window_internal *i = windowp->i; @@ -133,8 +130,7 @@ bfd_get_file_window (abfd, offset, size, windowp, writable) if (i == 0) { - i = ((bfd_window_internal *) - bfd_zmalloc ((bfd_size_type) sizeof (bfd_window_internal))); + i = bfd_zmalloc (sizeof (bfd_window_internal)); windowp->i = i; if (i == 0) return FALSE; @@ -180,7 +176,7 @@ bfd_get_file_window (abfd, offset, size, windowp, writable) ? MAP_FILE | MAP_PRIVATE : MAP_FILE | MAP_SHARED), fd, file_offset); - if (i->data == (PTR) -1) + if (i->data == (void *) -1) { /* An error happened. Report it, or try using malloc, or something. */ @@ -195,7 +191,7 @@ bfd_get_file_window (abfd, offset, size, windowp, writable) fprintf (stderr, "\n\tmapped %ld at %p, offset is %ld\n", (long) real_size, i->data, (long) offset2); i->size = real_size; - windowp->data = (PTR) ((bfd_byte *) i->data + offset2); + windowp->data = (bfd_byte *) i->data + offset2; windowp->size = size; i->mapped = 1; return TRUE; @@ -222,7 +218,7 @@ bfd_get_file_window (abfd, offset, size, windowp, writable) if (debug_windows) fprintf (stderr, "\n\t%s(%6ld)", i->data ? "realloc" : " malloc", (long) size_to_alloc); - i->data = (PTR) bfd_realloc (i->data, size_to_alloc); + i->data = bfd_realloc (i->data, size_to_alloc); if (debug_windows) fprintf (stderr, "\t-> %p\n", i->data); i->refcount = 1; diff --git a/bfd/cache.c b/bfd/cache.c index 98a1c72e884..b3091659984 100644 --- a/bfd/cache.c +++ b/bfd/cache.c @@ -1,5 +1,5 @@ /* BFD library -- caching of file descriptors. - Copyright 1990, 1991, 1992, 1993, 1994, 1996, 2000, 2001, 2002 + Copyright 1990, 1991, 1992, 1993, 1994, 1996, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Hacked by Steve Chamberlain of Cygnus Support (steve@cygnus.com). @@ -40,10 +40,7 @@ SECTION #include "sysdep.h" #include "libbfd.h" -static void insert PARAMS ((bfd *)); -static void snip PARAMS ((bfd *)); -static bfd_boolean close_one PARAMS ((void)); -static bfd_boolean bfd_cache_delete PARAMS ((bfd *)); +static bfd_boolean bfd_cache_delete (bfd *); /* INTERNAL_FUNCTION @@ -95,9 +92,8 @@ bfd *bfd_last_cache; /* Insert a BFD into the cache. */ -static INLINE void -insert (abfd) - bfd *abfd; +static void +insert (bfd *abfd) { if (bfd_last_cache == NULL) { @@ -116,9 +112,8 @@ insert (abfd) /* Remove a BFD from the cache. */ -static INLINE void -snip (abfd) - bfd *abfd; +static void +snip (bfd *abfd) { abfd->lru_prev->lru_next = abfd->lru_next; abfd->lru_next->lru_prev = abfd->lru_prev; @@ -134,7 +129,7 @@ snip (abfd) recently used cacheable BFD and close it. */ static bfd_boolean -close_one () +close_one (void) { register bfd *kill; @@ -168,8 +163,7 @@ close_one () /* Close a BFD and remove it from the cache. */ static bfd_boolean -bfd_cache_delete (abfd) - bfd *abfd; +bfd_cache_delete (bfd *abfd) { bfd_boolean ret; @@ -201,8 +195,7 @@ DESCRIPTION */ bfd_boolean -bfd_cache_init (abfd) - bfd *abfd; +bfd_cache_init (bfd *abfd) { BFD_ASSERT (abfd->iostream != NULL); if (open_files >= BFD_CACHE_MAX_OPEN) @@ -232,8 +225,7 @@ RETURNS */ bfd_boolean -bfd_cache_close (abfd) - bfd *abfd; +bfd_cache_close (bfd *abfd) { if (abfd->iostream == NULL || (abfd->flags & BFD_IN_MEMORY) != 0) @@ -247,7 +239,7 @@ INTERNAL_FUNCTION bfd_open_file SYNOPSIS - FILE* bfd_open_file(bfd *abfd); + FILE* bfd_open_file (bfd *abfd); DESCRIPTION Call the OS to open a file for @var{abfd}. Return the <<FILE *>> @@ -258,8 +250,7 @@ DESCRIPTION */ FILE * -bfd_open_file (abfd) - bfd *abfd; +bfd_open_file (bfd *abfd) { abfd->cacheable = TRUE; /* Allow it to be closed later. */ @@ -331,7 +322,7 @@ INTERNAL_FUNCTION bfd_cache_lookup_worker SYNOPSIS - FILE *bfd_cache_lookup_worker(bfd *abfd); + FILE *bfd_cache_lookup_worker (bfd *abfd); DESCRIPTION Called when the macro <<bfd_cache_lookup>> fails to find a @@ -342,8 +333,7 @@ DESCRIPTION */ FILE * -bfd_cache_lookup_worker (abfd) - bfd *abfd; +bfd_cache_lookup_worker (bfd *abfd) { if ((abfd->flags & BFD_IN_MEMORY) != 0) abort (); diff --git a/bfd/corefile.c b/bfd/corefile.c index da9d4d739dc..8af4f451784 100644 --- a/bfd/corefile.c +++ b/bfd/corefile.c @@ -1,5 +1,5 @@ /* Core file generic interface routines for BFD. - Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2002 + Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. @@ -36,7 +36,7 @@ FUNCTION bfd_core_file_failing_command SYNOPSIS - const char *bfd_core_file_failing_command(bfd *abfd); + const char *bfd_core_file_failing_command (bfd *abfd); DESCRIPTION Return a read-only string explaining which program was running @@ -45,13 +45,13 @@ DESCRIPTION */ const char * -bfd_core_file_failing_command (abfd) - bfd *abfd; +bfd_core_file_failing_command (bfd *abfd) { - if (abfd->format != bfd_core) { - bfd_set_error (bfd_error_invalid_operation); - return NULL; - } + if (abfd->format != bfd_core) + { + bfd_set_error (bfd_error_invalid_operation); + return NULL; + } return BFD_SEND (abfd, _core_file_failing_command, (abfd)); } @@ -60,7 +60,7 @@ FUNCTION bfd_core_file_failing_signal SYNOPSIS - int bfd_core_file_failing_signal(bfd *abfd); + int bfd_core_file_failing_signal (bfd *abfd); DESCRIPTION Returns the signal number which caused the core dump which @@ -68,13 +68,13 @@ DESCRIPTION */ int -bfd_core_file_failing_signal (abfd) - bfd *abfd; +bfd_core_file_failing_signal (bfd *abfd) { - if (abfd->format != bfd_core) { - bfd_set_error (bfd_error_invalid_operation); - return 0; - } + if (abfd->format != bfd_core) + { + bfd_set_error (bfd_error_invalid_operation); + return 0; + } return BFD_SEND (abfd, _core_file_failing_signal, (abfd)); } @@ -84,22 +84,23 @@ FUNCTION SYNOPSIS bfd_boolean core_file_matches_executable_p - (bfd *core_bfd, bfd *exec_bfd); + (bfd *core_bfd, bfd *exec_bfd); DESCRIPTION Return <<TRUE>> if the core file attached to @var{core_bfd} was generated by a run of the executable file attached to @var{exec_bfd}, <<FALSE>> otherwise. */ + bfd_boolean -core_file_matches_executable_p (core_bfd, exec_bfd) - bfd *core_bfd, *exec_bfd; +core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd) { - if ((core_bfd->format != bfd_core) || (exec_bfd->format != bfd_object)) { - bfd_set_error (bfd_error_wrong_format); - return FALSE; - } - - return BFD_SEND (core_bfd, _core_file_matches_executable_p, - (core_bfd, exec_bfd)); + if (core_bfd->format != bfd_core || exec_bfd->format != bfd_object) + { + bfd_set_error (bfd_error_wrong_format); + return FALSE; + } + + return BFD_SEND (core_bfd, _core_file_matches_executable_p, + (core_bfd, exec_bfd)); } diff --git a/bfd/doc/ChangeLog b/bfd/doc/ChangeLog index b1339911106..e2dba66809a 100644 --- a/bfd/doc/ChangeLog +++ b/bfd/doc/ChangeLog @@ -1,3 +1,7 @@ +2003-06-29 Alan Modra <amodra@bigpond.net.au> + + * chew.c (paramstuff): Don't emit PARAMS. + 2003-02-12 Bob Wilson <bob.wilson@acm.org> * bfd.texinfo: Fix quotes for texinfo. Make section title diff --git a/bfd/doc/chew.c b/bfd/doc/chew.c index bdf76e46e19..7c060da2d1c 100644 --- a/bfd/doc/chew.c +++ b/bfd/doc/chew.c @@ -1,6 +1,6 @@ /* chew Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001, - 2002 + 2002, 2003 Free Software Foundation, Inc. Contributed by steve chamberlain @cygnus @@ -494,8 +494,11 @@ paramstuff () string_type out; init_string (&out); +#define NO_PARAMS 1 + /* Make sure that it's not already param'd or proto'd. */ - if (find (tos, "PARAMS") || find (tos, "PROTO") || !find (tos, "(")) + if (NO_PARAMS + || find (tos, "PARAMS") || find (tos, "PROTO") || !find (tos, "(")) { catstr (&out, tos); } diff --git a/bfd/ecoff.c b/bfd/ecoff.c index ce18f54b0b1..021c1fe1320 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -95,8 +95,8 @@ static asection bfd_debug_section = NULL, NULL, 0, 0, 0, /* line_filepos, userdata, contents, lineno, lineno_count, */ 0, NULL, NULL, NULL, 0, - /* entsize, comdat, moving_line_filepos, */ - 0, NULL, 0, + /* entsize, comdat, kept_section, moving_line_filepos, */ + 0, NULL, NULL, 0, /* target_index, used_by_bfd, constructor_chain, owner, */ 0, NULL, NULL, NULL, /* symbol, */ diff --git a/bfd/format.c b/bfd/format.c index 6415b8d57bc..256ec0efd42 100644 --- a/bfd/format.c +++ b/bfd/format.c @@ -86,9 +86,7 @@ DESCRIPTION */ bfd_boolean -bfd_check_format (abfd, format) - bfd *abfd; - bfd_format format; +bfd_check_format (bfd *abfd, bfd_format format) { return bfd_check_format_matches (abfd, format, NULL); } @@ -98,8 +96,8 @@ FUNCTION bfd_check_format_matches SYNOPSIS - bfd_boolean bfd_check_format_matches (bfd *abfd, bfd_format format, - char ***matching); + bfd_boolean bfd_check_format_matches + (bfd *abfd, bfd_format format, char ***matching); DESCRIPTION Like <<bfd_check_format>>, except when it returns FALSE with @@ -114,10 +112,7 @@ DESCRIPTION */ bfd_boolean -bfd_check_format_matches (abfd, format, matching) - bfd *abfd; - bfd_format format; - char ***matching; +bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching) { extern const bfd_target binary_vec; const bfd_target * const *target; @@ -148,7 +143,7 @@ bfd_check_format_matches (abfd, format, matching) *matching = NULL; amt = sizeof (*matching_vector) * 2 * _bfd_target_vector_entries; - matching_vector = (const bfd_target **) bfd_malloc (amt); + matching_vector = bfd_malloc (amt); if (!matching_vector) return FALSE; } @@ -165,7 +160,7 @@ bfd_check_format_matches (abfd, format, matching) if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) /* rewind! */ { if (matching) - free ((PTR) matching_vector); + free (matching_vector); return FALSE; } @@ -176,7 +171,7 @@ bfd_check_format_matches (abfd, format, matching) abfd->xvec = right_targ; /* Set the target as returned. */ if (matching) - free ((PTR) matching_vector); + free (matching_vector); return TRUE; /* File position has moved, BTW. */ } @@ -199,7 +194,7 @@ bfd_check_format_matches (abfd, format, matching) abfd->format = bfd_unknown; if (matching) - free ((PTR) matching_vector); + free (matching_vector); bfd_set_error (bfd_error_file_not_recognized); @@ -220,7 +215,7 @@ bfd_check_format_matches (abfd, format, matching) if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) { if (matching) - free ((PTR) matching_vector); + free (matching_vector); return FALSE; } @@ -279,7 +274,7 @@ bfd_check_format_matches (abfd, format, matching) abfd->format = bfd_unknown; if (matching) - free ((PTR) matching_vector); + free (matching_vector); return FALSE; } @@ -332,7 +327,7 @@ bfd_check_format_matches (abfd, format, matching) abfd->xvec = right_targ; /* Change BFD's target permanently. */ if (matching) - free ((PTR) matching_vector); + free (matching_vector); return TRUE; /* File position has moved, BTW. */ } @@ -345,7 +340,7 @@ bfd_check_format_matches (abfd, format, matching) bfd_set_error (bfd_error_file_not_recognized); if (matching) - free ((PTR) matching_vector); + free (matching_vector); } else { @@ -383,9 +378,7 @@ DESCRIPTION */ bfd_boolean -bfd_set_format (abfd, format) - bfd *abfd; - bfd_format format; +bfd_set_format (bfd *abfd, bfd_format format) { if (bfd_read_p (abfd) || (unsigned int) abfd->format >= (unsigned int) bfd_type_end) @@ -423,11 +416,10 @@ DESCRIPTION */ const char * -bfd_format_string (format) - bfd_format format; +bfd_format_string (bfd_format format) { - if (((int)format <(int) bfd_unknown) - || ((int)format >=(int) bfd_type_end)) + if (((int) format < (int) bfd_unknown) + || ((int) format >= (int) bfd_type_end)) return "invalid"; switch (format) diff --git a/bfd/init.c b/bfd/init.c index 198b979e1b1..995213e3df5 100644 --- a/bfd/init.c +++ b/bfd/init.c @@ -35,7 +35,7 @@ FUNCTION bfd_init SYNOPSIS - void bfd_init(void); + void bfd_init (void); DESCRIPTION This routine must be called before any other BFD function to @@ -46,6 +46,6 @@ DESCRIPTION However, someday it may be needed, so keep it around. */ void -bfd_init () +bfd_init (void) { } diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index 726883cb943..2c9c23cd443 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -1,7 +1,7 @@ /* libbfd.h -- Declarations used by bfd library *implementation*. (This include file is not for users of the library.) Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002 + 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. @@ -36,7 +36,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Set a tdata field. Can't use the other macros for this, since they do casts, and casting to the left of assignment isn't portable. */ -#define set_tdata(bfd, v) ((bfd)->tdata.any = (PTR) (v)) +#define set_tdata(bfd, v) ((bfd)->tdata.any = (v)) /* If BFD_IN_MEMORY is set for a BFD, then the iostream fields points to an instance of this structure. */ @@ -69,7 +69,7 @@ struct artdata { archive. */ file_ptr armap_datepos; /* Position within archive to seek to rewrite the date field. */ - PTR tdata; /* Backend specific information. */ + void *tdata; /* Backend specific information. */ }; #define bfd_ardata(bfd) ((bfd)->tdata.aout_ar_data) @@ -83,105 +83,105 @@ struct areltdata { #define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size) -extern PTR bfd_malloc - PARAMS ((bfd_size_type)); -extern PTR bfd_realloc - PARAMS ((PTR, bfd_size_type)); -extern PTR bfd_zmalloc - PARAMS ((bfd_size_type)); +extern void *bfd_malloc + (bfd_size_type); +extern void *bfd_realloc + (void *, bfd_size_type); +extern void *bfd_zmalloc + (bfd_size_type); extern bfd_error_handler_type _bfd_error_handler; /* These routines allocate and free things on the BFD's objalloc. */ -extern PTR bfd_alloc - PARAMS ((bfd *, bfd_size_type)); -extern PTR bfd_zalloc - PARAMS ((bfd *, bfd_size_type)); +extern void *bfd_alloc + (bfd *, bfd_size_type); +extern void *bfd_zalloc + (bfd *, bfd_size_type); extern void bfd_release - PARAMS ((bfd *, PTR)); + (bfd *, void *); bfd * _bfd_create_empty_archive_element_shell - PARAMS ((bfd *obfd)); + (bfd *obfd); bfd * _bfd_look_for_bfd_in_cache - PARAMS ((bfd *, file_ptr)); + (bfd *, file_ptr); bfd_boolean _bfd_add_bfd_to_archive_cache - PARAMS ((bfd *, file_ptr, bfd *)); + (bfd *, file_ptr, bfd *); bfd_boolean _bfd_generic_mkarchive - PARAMS ((bfd *abfd)); + (bfd *abfd); const bfd_target *bfd_generic_archive_p - PARAMS ((bfd *abfd)); + (bfd *abfd); bfd_boolean bfd_slurp_armap - PARAMS ((bfd *abfd)); + (bfd *abfd); bfd_boolean bfd_slurp_bsd_armap_f2 - PARAMS ((bfd *abfd)); + (bfd *abfd); #define bfd_slurp_bsd_armap bfd_slurp_armap #define bfd_slurp_coff_armap bfd_slurp_armap bfd_boolean _bfd_slurp_extended_name_table - PARAMS ((bfd *abfd)); + (bfd *abfd); extern bfd_boolean _bfd_construct_extended_name_table - PARAMS ((bfd *, bfd_boolean, char **, bfd_size_type *)); + (bfd *, bfd_boolean, char **, bfd_size_type *); bfd_boolean _bfd_write_archive_contents - PARAMS ((bfd *abfd)); + (bfd *abfd); bfd_boolean _bfd_compute_and_write_armap - PARAMS ((bfd *, unsigned int elength)); + (bfd *, unsigned int elength); bfd *_bfd_get_elt_at_filepos - PARAMS ((bfd *archive, file_ptr filepos)); + (bfd *archive, file_ptr filepos); extern bfd *_bfd_generic_get_elt_at_index - PARAMS ((bfd *, symindex)); + (bfd *, symindex); bfd * _bfd_new_bfd - PARAMS ((void)); + (void); void _bfd_delete_bfd - PARAMS ((bfd *)); + (bfd *); bfd_boolean bfd_false - PARAMS ((bfd *ignore)); + (bfd *ignore); bfd_boolean bfd_true - PARAMS ((bfd *ignore)); -PTR bfd_nullvoidptr - PARAMS ((bfd *ignore)); + (bfd *ignore); +void *bfd_nullvoidptr + (bfd *ignore); int bfd_0 - PARAMS ((bfd *ignore)); + (bfd *ignore); unsigned int bfd_0u - PARAMS ((bfd *ignore)); + (bfd *ignore); long bfd_0l - PARAMS ((bfd *ignore)); + (bfd *ignore); long _bfd_n1 - PARAMS ((bfd *ignore)); + (bfd *ignore); void bfd_void - PARAMS ((bfd *ignore)); + (bfd *ignore); bfd *_bfd_new_bfd_contained_in - PARAMS ((bfd *)); + (bfd *); const bfd_target *_bfd_dummy_target - PARAMS ((bfd *abfd)); + (bfd *abfd); void bfd_dont_truncate_arname - PARAMS ((bfd *abfd, const char *filename, char *hdr)); + (bfd *abfd, const char *filename, char *hdr); void bfd_bsd_truncate_arname - PARAMS ((bfd *abfd, const char *filename, char *hdr)); + (bfd *abfd, const char *filename, char *hdr); void bfd_gnu_truncate_arname - PARAMS ((bfd *abfd, const char *filename, char *hdr)); + (bfd *abfd, const char *filename, char *hdr); bfd_boolean bsd_write_armap - PARAMS ((bfd *arch, unsigned int elength, struct orl *map, - unsigned int orl_count, int stridx)); + (bfd *arch, unsigned int elength, struct orl *map, unsigned int orl_count, + int stridx); bfd_boolean coff_write_armap - PARAMS ((bfd *arch, unsigned int elength, struct orl *map, - unsigned int orl_count, int stridx)); + (bfd *arch, unsigned int elength, struct orl *map, unsigned int orl_count, + int stridx); -extern PTR _bfd_generic_read_ar_hdr - PARAMS ((bfd *)); +extern void *_bfd_generic_read_ar_hdr + (bfd *); -extern PTR _bfd_generic_read_ar_hdr_mag - PARAMS ((bfd *, const char *)); +extern void *_bfd_generic_read_ar_hdr_mag + (bfd *, const char *); bfd * bfd_generic_openr_next_archived_file - PARAMS ((bfd *archive, bfd *last_file)); + (bfd *archive, bfd *last_file); int bfd_generic_stat_arch_elt - PARAMS ((bfd *, struct stat *)); + (bfd *, struct stat *); #define _bfd_read_ar_hdr(abfd) \ BFD_SEND (abfd, _bfd_read_ar_hdr_fn, (abfd)) @@ -192,37 +192,37 @@ int bfd_generic_stat_arch_elt #define _bfd_generic_close_and_cleanup bfd_true #define _bfd_generic_bfd_free_cached_info bfd_true #define _bfd_generic_new_section_hook \ - ((bfd_boolean (*) PARAMS ((bfd *, asection *))) bfd_true) + ((bfd_boolean (*) (bfd *, asection *)) bfd_true) extern bfd_boolean _bfd_generic_get_section_contents - PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); + (bfd *, asection *, void *, file_ptr, bfd_size_type); extern bfd_boolean _bfd_generic_get_section_contents_in_window - PARAMS ((bfd *, asection *, bfd_window *, file_ptr, bfd_size_type)); + (bfd *, asection *, bfd_window *, file_ptr, bfd_size_type); /* Generic routines to use for BFD_JUMP_TABLE_COPY. Use BFD_JUMP_TABLE_COPY (_bfd_generic). */ #define _bfd_generic_bfd_copy_private_bfd_data \ - ((bfd_boolean (*) PARAMS ((bfd *, bfd *))) bfd_true) + ((bfd_boolean (*) (bfd *, bfd *)) bfd_true) #define _bfd_generic_bfd_merge_private_bfd_data \ - ((bfd_boolean (*) PARAMS ((bfd *, bfd *))) bfd_true) + ((bfd_boolean (*) (bfd *, bfd *)) bfd_true) #define _bfd_generic_bfd_set_private_flags \ - ((bfd_boolean (*) PARAMS ((bfd *, flagword))) bfd_true) + ((bfd_boolean (*) (bfd *, flagword)) bfd_true) #define _bfd_generic_bfd_copy_private_section_data \ - ((bfd_boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true) + ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true) #define _bfd_generic_bfd_copy_private_symbol_data \ - ((bfd_boolean (*) PARAMS ((bfd *, asymbol *, bfd *, asymbol *))) bfd_true) + ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true) #define _bfd_generic_bfd_print_private_bfd_data \ - ((bfd_boolean (*) PARAMS ((bfd *, PTR))) bfd_true) + ((bfd_boolean (*) (bfd *, void *)) bfd_true) /* Routines to use for BFD_JUMP_TABLE_CORE when there is no core file support. Use BFD_JUMP_TABLE_CORE (_bfd_nocore). */ extern char *_bfd_nocore_core_file_failing_command - PARAMS ((bfd *)); + (bfd *); extern int _bfd_nocore_core_file_failing_signal - PARAMS ((bfd *)); + (bfd *); extern bfd_boolean _bfd_nocore_core_file_matches_executable_p - PARAMS ((bfd *, bfd *)); + (bfd *, bfd *); /* Routines to use for BFD_JUMP_TABLE_ARCHIVE when there is no archive file support. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive). */ @@ -230,20 +230,18 @@ extern bfd_boolean _bfd_nocore_core_file_matches_executable_p #define _bfd_noarchive_slurp_armap bfd_false #define _bfd_noarchive_slurp_extended_name_table bfd_false #define _bfd_noarchive_construct_extended_name_table \ - ((bfd_boolean (*) \ - PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \ + ((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) \ bfd_false) #define _bfd_noarchive_truncate_arname \ - ((void (*) PARAMS ((bfd *, const char *, char *))) bfd_void) + ((void (*) (bfd *, const char *, char *)) bfd_void) #define _bfd_noarchive_write_armap \ - ((bfd_boolean (*) \ - PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int))) \ + ((bfd_boolean (*) (bfd *, unsigned int, struct orl *, unsigned int, int)) \ bfd_false) #define _bfd_noarchive_read_ar_hdr bfd_nullvoidptr #define _bfd_noarchive_openr_next_archived_file \ - ((bfd *(*) PARAMS ((bfd *, bfd *))) bfd_nullvoidptr) + ((bfd *(*) (bfd *, bfd *)) bfd_nullvoidptr) #define _bfd_noarchive_get_elt_at_index \ - ((bfd *(*) PARAMS ((bfd *, symindex))) bfd_nullvoidptr) + ((bfd *(*) (bfd *, symindex)) bfd_nullvoidptr) #define _bfd_noarchive_generic_stat_arch_elt bfd_generic_stat_arch_elt #define _bfd_noarchive_update_armap_timestamp bfd_false @@ -254,7 +252,7 @@ extern bfd_boolean _bfd_nocore_core_file_matches_executable_p #define _bfd_archive_bsd_slurp_extended_name_table \ _bfd_slurp_extended_name_table extern bfd_boolean _bfd_archive_bsd_construct_extended_name_table - PARAMS ((bfd *, char **, bfd_size_type *, const char **)); + (bfd *, char **, bfd_size_type *, const char **); #define _bfd_archive_bsd_truncate_arname bfd_bsd_truncate_arname #define _bfd_archive_bsd_write_armap bsd_write_armap #define _bfd_archive_bsd_read_ar_hdr _bfd_generic_read_ar_hdr @@ -264,7 +262,7 @@ extern bfd_boolean _bfd_archive_bsd_construct_extended_name_table #define _bfd_archive_bsd_generic_stat_arch_elt \ bfd_generic_stat_arch_elt extern bfd_boolean _bfd_archive_bsd_update_armap_timestamp - PARAMS ((bfd *)); + (bfd *); /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get COFF style archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff). */ @@ -273,7 +271,7 @@ extern bfd_boolean _bfd_archive_bsd_update_armap_timestamp #define _bfd_archive_coff_slurp_extended_name_table \ _bfd_slurp_extended_name_table extern bfd_boolean _bfd_archive_coff_construct_extended_name_table - PARAMS ((bfd *, char **, bfd_size_type *, const char **)); + (bfd *, char **, bfd_size_type *, const char **); #define _bfd_archive_coff_truncate_arname bfd_dont_truncate_arname #define _bfd_archive_coff_write_armap coff_write_armap #define _bfd_archive_coff_read_ar_hdr _bfd_generic_read_ar_hdr @@ -289,49 +287,46 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table #define _bfd_nosymbols_get_symtab_upper_bound _bfd_n1 #define _bfd_nosymbols_get_symtab \ - ((long (*) PARAMS ((bfd *, asymbol **))) _bfd_n1) + ((long (*) (bfd *, asymbol **)) _bfd_n1) #define _bfd_nosymbols_make_empty_symbol _bfd_generic_make_empty_symbol #define _bfd_nosymbols_print_symbol \ - ((void (*) PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type))) bfd_void) + ((void (*) (bfd *, void *, asymbol *, bfd_print_symbol_type)) bfd_void) #define _bfd_nosymbols_get_symbol_info \ - ((void (*) PARAMS ((bfd *, asymbol *, symbol_info *))) bfd_void) + ((void (*) (bfd *, asymbol *, symbol_info *)) bfd_void) #define _bfd_nosymbols_bfd_is_local_label_name \ - ((bfd_boolean (*) PARAMS ((bfd *, const char *))) bfd_false) + ((bfd_boolean (*) (bfd *, const char *)) bfd_false) #define _bfd_nosymbols_get_lineno \ - ((alent *(*) PARAMS ((bfd *, asymbol *))) bfd_nullvoidptr) + ((alent *(*) (bfd *, asymbol *)) bfd_nullvoidptr) #define _bfd_nosymbols_find_nearest_line \ - ((bfd_boolean (*) \ - PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, \ - const char **, unsigned int *))) \ + ((bfd_boolean (*) (bfd *, asection *, asymbol **, bfd_vma, const char **, \ + const char **, unsigned int *)) \ bfd_false) #define _bfd_nosymbols_bfd_make_debug_symbol \ - ((asymbol *(*) PARAMS ((bfd *, PTR, unsigned long))) bfd_nullvoidptr) + ((asymbol *(*) (bfd *, void *, unsigned long)) bfd_nullvoidptr) #define _bfd_nosymbols_read_minisymbols \ - ((long (*) PARAMS ((bfd *, bfd_boolean, PTR *, unsigned int *))) _bfd_n1) + ((long (*) (bfd *, bfd_boolean, void **, unsigned int *)) _bfd_n1) #define _bfd_nosymbols_minisymbol_to_symbol \ - ((asymbol *(*) PARAMS ((bfd *, bfd_boolean, const PTR, asymbol *))) \ + ((asymbol *(*) (bfd *, bfd_boolean, const void *, asymbol *)) \ bfd_nullvoidptr) /* Routines to use for BFD_JUMP_TABLE_RELOCS when there is no reloc support. Use BFD_JUMP_TABLE_RELOCS (_bfd_norelocs). */ #define _bfd_norelocs_get_reloc_upper_bound \ - ((long (*) PARAMS ((bfd *, asection *))) _bfd_n1) + ((long (*) (bfd *, asection *)) _bfd_n1) #define _bfd_norelocs_canonicalize_reloc \ - ((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) _bfd_n1) + ((long (*) (bfd *, asection *, arelent **, asymbol **)) _bfd_n1) #define _bfd_norelocs_bfd_reloc_type_lookup \ - ((reloc_howto_type *(*) PARAMS ((bfd *, bfd_reloc_code_real_type))) \ - bfd_nullvoidptr) + ((reloc_howto_type *(*) (bfd *, bfd_reloc_code_real_type)) bfd_nullvoidptr) /* Routines to use for BFD_JUMP_TABLE_WRITE for targets which may not be written. Use BFD_JUMP_TABLE_WRITE (_bfd_nowrite). */ #define _bfd_nowrite_set_arch_mach \ - ((bfd_boolean (*) PARAMS ((bfd *, enum bfd_architecture, unsigned long))) \ + ((bfd_boolean (*) (bfd *, enum bfd_architecture, unsigned long)) \ bfd_false) #define _bfd_nowrite_set_section_contents \ - ((bfd_boolean (*) \ - PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type))) \ + ((bfd_boolean (*) (bfd *, asection *, void *, file_ptr, bfd_size_type)) \ bfd_false) /* Generic routines to use for BFD_JUMP_TABLE_WRITE. Use @@ -339,45 +334,41 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table #define _bfd_generic_set_arch_mach bfd_default_set_arch_mach extern bfd_boolean _bfd_generic_set_section_contents - PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); + (bfd *, asection *, void *, file_ptr, bfd_size_type); /* Routines to use for BFD_JUMP_TABLE_LINK for targets which do not support linking. Use BFD_JUMP_TABLE_LINK (_bfd_nolink). */ -#define _bfd_nolink_sizeof_headers ((int (*) PARAMS ((bfd *, bfd_boolean))) bfd_0) +#define _bfd_nolink_sizeof_headers ((int (*) (bfd *, bfd_boolean)) bfd_0) #define _bfd_nolink_bfd_get_relocated_section_contents \ - ((bfd_byte *(*) \ - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, \ - bfd_byte *, bfd_boolean, asymbol **))) \ + ((bfd_byte *(*) (bfd *, struct bfd_link_info *, struct bfd_link_order *, \ + bfd_byte *, bfd_boolean, asymbol **)) \ bfd_nullvoidptr) #define _bfd_nolink_bfd_relax_section \ ((bfd_boolean (*) \ - PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *))) \ + (bfd *, asection *, struct bfd_link_info *, bfd_boolean *)) \ bfd_false) #define _bfd_nolink_bfd_gc_sections \ - ((bfd_boolean (*) \ - PARAMS ((bfd *, struct bfd_link_info *))) \ + ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \ bfd_false) #define _bfd_nolink_bfd_merge_sections \ - ((bfd_boolean (*) \ - PARAMS ((bfd *, struct bfd_link_info *))) \ + ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \ bfd_false) #define _bfd_nolink_bfd_discard_group \ - ((bfd_boolean (*) \ - PARAMS ((bfd *, struct sec *))) \ + ((bfd_boolean (*) (bfd *, struct sec *)) \ bfd_false) #define _bfd_nolink_bfd_link_hash_table_create \ - ((struct bfd_link_hash_table *(*) PARAMS ((bfd *))) bfd_nullvoidptr) + ((struct bfd_link_hash_table *(*) (bfd *)) bfd_nullvoidptr) #define _bfd_nolink_bfd_link_hash_table_free \ - ((void (*) PARAMS ((struct bfd_link_hash_table *))) bfd_void) + ((void (*) (struct bfd_link_hash_table *)) bfd_void) #define _bfd_nolink_bfd_link_add_symbols \ - ((bfd_boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false) + ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false) #define _bfd_nolink_bfd_link_just_syms \ - ((void (*) PARAMS ((asection *, struct bfd_link_info *))) bfd_void) + ((void (*) (asection *, struct bfd_link_info *)) bfd_void) #define _bfd_nolink_bfd_final_link \ - ((bfd_boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false) + ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false) #define _bfd_nolink_bfd_link_split_section \ - ((bfd_boolean (*) PARAMS ((bfd *, struct sec *))) bfd_false) + ((bfd_boolean (*) (bfd *, struct sec *)) bfd_false) /* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC @@ -385,195 +376,189 @@ extern bfd_boolean _bfd_generic_set_section_contents #define _bfd_nodynamic_get_dynamic_symtab_upper_bound _bfd_n1 #define _bfd_nodynamic_canonicalize_dynamic_symtab \ - ((long (*) PARAMS ((bfd *, asymbol **))) _bfd_n1) + ((long (*) (bfd *, asymbol **)) _bfd_n1) #define _bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_n1 #define _bfd_nodynamic_canonicalize_dynamic_reloc \ - ((long (*) PARAMS ((bfd *, arelent **, asymbol **))) _bfd_n1) + ((long (*) (bfd *, arelent **, asymbol **)) _bfd_n1) /* Generic routine to determine of the given symbol is a local label. */ extern bfd_boolean bfd_generic_is_local_label_name - PARAMS ((bfd *, const char *)); + (bfd *, const char *); /* Generic minisymbol routines. */ extern long _bfd_generic_read_minisymbols - PARAMS ((bfd *, bfd_boolean, PTR *, unsigned int *)); + (bfd *, bfd_boolean, void **, unsigned int *); extern asymbol *_bfd_generic_minisymbol_to_symbol - PARAMS ((bfd *, bfd_boolean, const PTR, asymbol *)); + (bfd *, bfd_boolean, const void *, asymbol *); /* Find the nearest line using .stab/.stabstr sections. */ extern bfd_boolean _bfd_stab_section_find_nearest_line - PARAMS ((bfd *, asymbol **, asection *, bfd_vma, bfd_boolean *, - const char **, const char **, unsigned int *, PTR *)); + (bfd *, asymbol **, asection *, bfd_vma, bfd_boolean *, + const char **, const char **, unsigned int *, void **); /* Find the neaderst line using DWARF 1 debugging information. */ extern bfd_boolean _bfd_dwarf1_find_nearest_line - PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, - const char **, unsigned int *)); + (bfd *, asection *, asymbol **, bfd_vma, const char **, + const char **, unsigned int *); /* Find the nearest line using DWARF 2 debugging information. */ extern bfd_boolean _bfd_dwarf2_find_nearest_line - PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, - const char **, unsigned int *, unsigned int, - PTR *)); + (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, + unsigned int *, unsigned int, void **); /* Create a new section entry. */ extern struct bfd_hash_entry *bfd_section_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); + (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); /* A routine to create entries for a bfd_link_hash_table. */ extern struct bfd_hash_entry *_bfd_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *entry, - struct bfd_hash_table *table, - const char *string)); + (struct bfd_hash_entry *entry, struct bfd_hash_table *table, + const char *string); /* Initialize a bfd_link_hash_table. */ extern bfd_boolean _bfd_link_hash_table_init - PARAMS ((struct bfd_link_hash_table *, bfd *, - struct bfd_hash_entry *(*) (struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *))); + (struct bfd_link_hash_table *, bfd *, + struct bfd_hash_entry *(*) (struct bfd_hash_entry *, + struct bfd_hash_table *, + const char *)); /* Generic link hash table creation routine. */ extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create - PARAMS ((bfd *)); + (bfd *); /* Generic link hash table destruction routine. */ extern void _bfd_generic_link_hash_table_free - PARAMS ((struct bfd_link_hash_table *)); + (struct bfd_link_hash_table *); /* Generic add symbol routine. */ extern bfd_boolean _bfd_generic_link_add_symbols - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); /* Generic add symbol routine. This version is used by targets for which the linker must collect constructors and destructors by name, as the collect2 program does. */ extern bfd_boolean _bfd_generic_link_add_symbols_collect - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); /* Generic archive add symbol routine. */ extern bfd_boolean _bfd_generic_link_add_archive_symbols - PARAMS ((bfd *, struct bfd_link_info *, - bfd_boolean (*) (bfd *, struct bfd_link_info *, bfd_boolean *))); + (bfd *, struct bfd_link_info *, + bfd_boolean (*) (bfd *, struct bfd_link_info *, bfd_boolean *)); /* Forward declaration to avoid prototype errors. */ typedef struct bfd_link_hash_entry _bfd_link_hash_entry; /* Generic routine to add a single symbol. */ extern bfd_boolean _bfd_generic_link_add_one_symbol - PARAMS ((struct bfd_link_info *, bfd *, const char *name, flagword, - asection *, bfd_vma, const char *, bfd_boolean copy, - bfd_boolean constructor, struct bfd_link_hash_entry **)); + (struct bfd_link_info *, bfd *, const char *name, flagword, + asection *, bfd_vma, const char *, bfd_boolean copy, + bfd_boolean constructor, struct bfd_link_hash_entry **); /* Generic routine to mark section as supplying symbols only. */ extern void _bfd_generic_link_just_syms - PARAMS ((asection *, struct bfd_link_info *)); + (asection *, struct bfd_link_info *); /* Generic link routine. */ extern bfd_boolean _bfd_generic_final_link - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_generic_link_split_section - PARAMS ((bfd *, struct sec *)); + (bfd *, struct sec *); /* Generic reloc_link_order processing routine. */ extern bfd_boolean _bfd_generic_reloc_link_order - PARAMS ((bfd *, struct bfd_link_info *, asection *, - struct bfd_link_order *)); + (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *); /* Default link order processing routine. */ extern bfd_boolean _bfd_default_link_order - PARAMS ((bfd *, struct bfd_link_info *, asection *, - struct bfd_link_order *)); + (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *); /* Count the number of reloc entries in a link order list. */ extern unsigned int _bfd_count_link_order_relocs - PARAMS ((struct bfd_link_order *)); + (struct bfd_link_order *); /* Final link relocation routine. */ extern bfd_reloc_status_type _bfd_final_link_relocate - PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, - bfd_vma, bfd_vma, bfd_vma)); + (reloc_howto_type *, bfd *, asection *, bfd_byte *, + bfd_vma, bfd_vma, bfd_vma); /* Relocate a particular location by a howto and a value. */ extern bfd_reloc_status_type _bfd_relocate_contents - PARAMS ((reloc_howto_type *, bfd *, bfd_vma, bfd_byte *)); + (reloc_howto_type *, bfd *, bfd_vma, bfd_byte *); /* Link stabs in sections in the first pass. */ extern bfd_boolean _bfd_link_section_stabs - PARAMS ((bfd *, PTR *, asection *, asection *, PTR *)); + (bfd *, void **, asection *, asection *, void **); /* Eliminate stabs for discarded functions and symbols. */ extern bfd_boolean _bfd_discard_section_stabs - PARAMS ((bfd *, asection *, PTR, - bfd_boolean (*) (bfd_vma, PTR), PTR)); + (bfd *, asection *, void *, bfd_boolean (*) (bfd_vma, void *), void *); /* Write out the .stab section when linking stabs in sections. */ extern bfd_boolean _bfd_write_section_stabs - PARAMS ((bfd *, PTR *, asection *, PTR *, bfd_byte *)); + (bfd *, void **, asection *, void **, bfd_byte *); /* Write out the .stabstr string table when linking stabs in sections. */ extern bfd_boolean _bfd_write_stab_strings - PARAMS ((bfd *, PTR *)); + (bfd *, void **); /* Find an offset within a .stab section when linking stabs in sections. */ extern bfd_vma _bfd_stab_section_offset - PARAMS ((bfd *, PTR *, asection *, PTR *, bfd_vma)); + (bfd *, void **, asection *, void **, bfd_vma); /* Attempt to merge a SEC_MERGE section. */ extern bfd_boolean _bfd_merge_section - PARAMS ((bfd *, PTR *, asection *, PTR *)); + (bfd *, void **, asection *, void **); /* Attempt to merge SEC_MERGE sections. */ extern bfd_boolean _bfd_merge_sections - PARAMS ((bfd *, PTR, void (*)(bfd *, asection *))); + (bfd *, void *, void (*) (bfd *, asection *)); /* Write out a merged section. */ extern bfd_boolean _bfd_write_merged_section - PARAMS ((bfd *, asection *, PTR)); + (bfd *, asection *, void *); /* Find an offset within a modified SEC_MERGE section. */ extern bfd_vma _bfd_merged_section_offset - PARAMS ((bfd *, asection **, PTR, bfd_vma, bfd_vma)); + (bfd *, asection **, void *, bfd_vma, bfd_vma); /* Create a string table. */ extern struct bfd_strtab_hash *_bfd_stringtab_init - PARAMS ((void)); + (void); /* Create an XCOFF .debug section style string table. */ extern struct bfd_strtab_hash *_bfd_xcoff_stringtab_init - PARAMS ((void)); + (void); /* Free a string table. */ extern void _bfd_stringtab_free - PARAMS ((struct bfd_strtab_hash *)); + (struct bfd_strtab_hash *); /* Get the size of a string table. */ extern bfd_size_type _bfd_stringtab_size - PARAMS ((struct bfd_strtab_hash *)); + (struct bfd_strtab_hash *); /* Add a string to a string table. */ extern bfd_size_type _bfd_stringtab_add - PARAMS ((struct bfd_strtab_hash *, const char *, bfd_boolean hash, - bfd_boolean copy)); + (struct bfd_strtab_hash *, const char *, bfd_boolean hash, bfd_boolean copy); /* Write out a string table. */ extern bfd_boolean _bfd_stringtab_emit - PARAMS ((bfd *, struct bfd_strtab_hash *)); + (bfd *, struct bfd_strtab_hash *); /* Check that endianness of input and output file match. */ extern bfd_boolean _bfd_generic_verify_endian_match - PARAMS ((bfd *, bfd *)); + (bfd *, bfd *); /* Macros to tell if bfds are read or write enabled. @@ -584,20 +569,22 @@ extern bfd_boolean _bfd_generic_verify_endian_match !bfd_read_p, and only sometimes bfd_write_p. */ -#define bfd_read_p(abfd) ((abfd)->direction == read_direction || (abfd)->direction == both_direction) -#define bfd_write_p(abfd) ((abfd)->direction == write_direction || (abfd)->direction == both_direction) +#define bfd_read_p(abfd) \ + ((abfd)->direction == read_direction || (abfd)->direction == both_direction) +#define bfd_write_p(abfd) \ + ((abfd)->direction == write_direction || (abfd)->direction == both_direction) void bfd_assert - PARAMS ((const char*,int)); + (const char*,int); #define BFD_ASSERT(x) \ -{ if (!(x)) bfd_assert(__FILE__,__LINE__); } + { if (!(x)) bfd_assert(__FILE__,__LINE__); } #define BFD_FAIL() \ -{ bfd_assert(__FILE__,__LINE__); } + { bfd_assert(__FILE__,__LINE__); } extern void _bfd_abort - PARAMS ((const char *, int, const char *)) ATTRIBUTE_NORETURN; + (const char *, int, const char *) ATTRIBUTE_NORETURN; /* if gcc >= 2.6, we can give a function name, too */ #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6) @@ -608,7 +595,7 @@ extern void _bfd_abort #define abort() _bfd_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__) FILE * bfd_cache_lookup_worker - PARAMS ((bfd *)); + (bfd *); extern bfd *bfd_last_cache; @@ -628,26 +615,27 @@ struct ecoff_find_line; #endif extern bfd_boolean _bfd_ecoff_locate_line - PARAMS ((bfd *, asection *, bfd_vma, struct ecoff_debug_info * const, - const struct ecoff_debug_swap * const, struct ecoff_find_line *, - const char **, const char **, unsigned int *)); + (bfd *, asection *, bfd_vma, struct ecoff_debug_info * const, + const struct ecoff_debug_swap * const, struct ecoff_find_line *, + const char **, const char **, unsigned int *); extern bfd_boolean _bfd_ecoff_get_accumulated_pdr - PARAMS ((PTR, bfd_byte *)); + (void *, bfd_byte *); extern bfd_boolean _bfd_ecoff_get_accumulated_sym - PARAMS ((PTR, bfd_byte *)); + (void *, bfd_byte *); extern bfd_boolean _bfd_ecoff_get_accumulated_ss - PARAMS ((PTR, bfd_byte *)); + (void *, bfd_byte *); extern bfd_vma _bfd_get_gp_value - PARAMS ((bfd *)); + (bfd *); extern void _bfd_set_gp_value - PARAMS ((bfd *, bfd_vma)); + (bfd *, bfd_vma); /* Function shared by the COFF and ELF SH backends, which have no other common header files. */ +#ifndef _bfd_sh_align_load_span extern bfd_boolean _bfd_sh_align_load_span - PARAMS ((bfd *, asection *, bfd_byte *, - bfd_boolean (*) (bfd *, asection *, PTR, bfd_byte *, bfd_vma), - PTR, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, bfd_boolean *)); - + (bfd *, asection *, bfd_byte *, + bfd_boolean (*) (bfd *, asection *, void *, bfd_byte *, bfd_vma), + void *, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, bfd_boolean *); +#endif diff --git a/bfd/libbfd.c b/bfd/libbfd.c index da93831e6db..50bd21551e3 100644 --- a/bfd/libbfd.c +++ b/bfd/libbfd.c @@ -1,6 +1,6 @@ /* Assorted BFD support routines, only used internally. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002 + 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. @@ -42,8 +42,7 @@ DESCRIPTION operations. */ bfd_boolean -bfd_false (ignore) - bfd *ignore ATTRIBUTE_UNUSED; +bfd_false (bfd *ignore ATTRIBUTE_UNUSED) { bfd_set_error (bfd_error_invalid_operation); return FALSE; @@ -53,8 +52,7 @@ bfd_false (ignore) which do not actually do anything. */ bfd_boolean -bfd_true (ignore) - bfd *ignore ATTRIBUTE_UNUSED; +bfd_true (bfd *ignore ATTRIBUTE_UNUSED) { return TRUE; } @@ -62,31 +60,27 @@ bfd_true (ignore) /* A routine which is used in target vectors for unsupported operations which return a pointer value. */ -PTR -bfd_nullvoidptr (ignore) - bfd *ignore ATTRIBUTE_UNUSED; +void * +bfd_nullvoidptr (bfd *ignore ATTRIBUTE_UNUSED) { bfd_set_error (bfd_error_invalid_operation); return NULL; } int -bfd_0 (ignore) - bfd *ignore ATTRIBUTE_UNUSED; +bfd_0 (bfd *ignore ATTRIBUTE_UNUSED) { return 0; } unsigned int -bfd_0u (ignore) - bfd *ignore ATTRIBUTE_UNUSED; +bfd_0u (bfd *ignore ATTRIBUTE_UNUSED) { return 0; } long -bfd_0l (ignore) - bfd *ignore ATTRIBUTE_UNUSED; +bfd_0l (bfd *ignore ATTRIBUTE_UNUSED) { return 0; } @@ -95,23 +89,21 @@ bfd_0l (ignore) operations which return -1 on error. */ long -_bfd_n1 (ignore_abfd) - bfd *ignore_abfd ATTRIBUTE_UNUSED; +_bfd_n1 (bfd *ignore_abfd ATTRIBUTE_UNUSED) { bfd_set_error (bfd_error_invalid_operation); return -1; } void -bfd_void (ignore) - bfd *ignore ATTRIBUTE_UNUSED; +bfd_void (bfd *ignore ATTRIBUTE_UNUSED) { } bfd_boolean -_bfd_nocore_core_file_matches_executable_p (ignore_core_bfd, ignore_exec_bfd) - bfd *ignore_core_bfd ATTRIBUTE_UNUSED; - bfd *ignore_exec_bfd ATTRIBUTE_UNUSED; +_bfd_nocore_core_file_matches_executable_p + (bfd *ignore_core_bfd ATTRIBUTE_UNUSED, + bfd *ignore_exec_bfd ATTRIBUTE_UNUSED) { bfd_set_error (bfd_error_invalid_operation); return FALSE; @@ -121,27 +113,24 @@ _bfd_nocore_core_file_matches_executable_p (ignore_core_bfd, ignore_exec_bfd) without core file support. */ char * -_bfd_nocore_core_file_failing_command (ignore_abfd) - bfd *ignore_abfd ATTRIBUTE_UNUSED; +_bfd_nocore_core_file_failing_command (bfd *ignore_abfd ATTRIBUTE_UNUSED) { bfd_set_error (bfd_error_invalid_operation); - return (char *)NULL; + return NULL; } /* Routine to handle core_file_failing_signal entry point for targets without core file support. */ int -_bfd_nocore_core_file_failing_signal (ignore_abfd) - bfd *ignore_abfd ATTRIBUTE_UNUSED; +_bfd_nocore_core_file_failing_signal (bfd *ignore_abfd ATTRIBUTE_UNUSED) { bfd_set_error (bfd_error_invalid_operation); return 0; } const bfd_target * -_bfd_dummy_target (ignore_abfd) - bfd *ignore_abfd ATTRIBUTE_UNUSED; +_bfd_dummy_target (bfd *ignore_abfd ATTRIBUTE_UNUSED) { bfd_set_error (bfd_error_wrong_format); return 0; @@ -149,11 +138,10 @@ _bfd_dummy_target (ignore_abfd) /* Allocate memory using malloc. */ -PTR -bfd_malloc (size) - bfd_size_type size; +void * +bfd_malloc (bfd_size_type size) { - PTR ptr; + void *ptr; if (size != (size_t) size) { @@ -161,7 +149,7 @@ bfd_malloc (size) return NULL; } - ptr = (PTR) malloc ((size_t) size); + ptr = malloc ((size_t) size); if (ptr == NULL && (size_t) size != 0) bfd_set_error (bfd_error_no_memory); @@ -170,12 +158,10 @@ bfd_malloc (size) /* Reallocate memory using realloc. */ -PTR -bfd_realloc (ptr, size) - PTR ptr; - bfd_size_type size; +void * +bfd_realloc (void *ptr, bfd_size_type size) { - PTR ret; + void *ret; if (size != (size_t) size) { @@ -184,9 +170,9 @@ bfd_realloc (ptr, size) } if (ptr == NULL) - ret = (PTR) malloc ((size_t) size); + ret = malloc ((size_t) size); else - ret = (PTR) realloc (ptr, (size_t) size); + ret = realloc (ptr, (size_t) size); if (ret == NULL && (size_t) size != 0) bfd_set_error (bfd_error_no_memory); @@ -196,11 +182,10 @@ bfd_realloc (ptr, size) /* Allocate memory using malloc and clear it. */ -PTR -bfd_zmalloc (size) - bfd_size_type size; +void * +bfd_zmalloc (bfd_size_type size) { - PTR ptr; + void *ptr; if (size != (size_t) size) { @@ -208,7 +193,7 @@ bfd_zmalloc (size) return NULL; } - ptr = (PTR) malloc ((size_t) size); + ptr = malloc ((size_t) size); if ((size_t) size != 0) { @@ -234,13 +219,11 @@ DESCRIPTION */ bfd_boolean -bfd_write_bigendian_4byte_int (abfd, i) - bfd *abfd; - unsigned int i; +bfd_write_bigendian_4byte_int (bfd *abfd, unsigned int i) { bfd_byte buffer[4]; bfd_putb32 ((bfd_vma) i, buffer); - return bfd_bwrite ((PTR) buffer, (bfd_size_type) 4, abfd) == 4; + return bfd_bwrite (buffer, (bfd_size_type) 4, abfd) == 4; } @@ -283,54 +266,54 @@ DESCRIPTION .{* Byte swapping macros for user section data. *} . .#define bfd_put_8(abfd, val, ptr) \ -. ((void) (*((unsigned char *) (ptr)) = (unsigned char) (val))) +. ((void) (*((unsigned char *) (ptr)) = (unsigned char) (val))) .#define bfd_put_signed_8 \ -. bfd_put_8 +. bfd_put_8 .#define bfd_get_8(abfd, ptr) \ -. (*(unsigned char *) (ptr) & 0xff) +. (*(unsigned char *) (ptr) & 0xff) .#define bfd_get_signed_8(abfd, ptr) \ -. (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80) +. (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80) . .#define bfd_put_16(abfd, val, ptr) \ -. BFD_SEND(abfd, bfd_putx16, ((val),(ptr))) +. BFD_SEND (abfd, bfd_putx16, ((val),(ptr))) .#define bfd_put_signed_16 \ -. bfd_put_16 +. bfd_put_16 .#define bfd_get_16(abfd, ptr) \ -. BFD_SEND(abfd, bfd_getx16, (ptr)) +. BFD_SEND (abfd, bfd_getx16, (ptr)) .#define bfd_get_signed_16(abfd, ptr) \ -. BFD_SEND (abfd, bfd_getx_signed_16, (ptr)) +. BFD_SEND (abfd, bfd_getx_signed_16, (ptr)) . .#define bfd_put_32(abfd, val, ptr) \ -. BFD_SEND(abfd, bfd_putx32, ((val),(ptr))) +. BFD_SEND (abfd, bfd_putx32, ((val),(ptr))) .#define bfd_put_signed_32 \ -. bfd_put_32 +. bfd_put_32 .#define bfd_get_32(abfd, ptr) \ -. BFD_SEND(abfd, bfd_getx32, (ptr)) +. BFD_SEND (abfd, bfd_getx32, (ptr)) .#define bfd_get_signed_32(abfd, ptr) \ -. BFD_SEND(abfd, bfd_getx_signed_32, (ptr)) +. BFD_SEND (abfd, bfd_getx_signed_32, (ptr)) . .#define bfd_put_64(abfd, val, ptr) \ -. BFD_SEND(abfd, bfd_putx64, ((val), (ptr))) +. BFD_SEND (abfd, bfd_putx64, ((val), (ptr))) .#define bfd_put_signed_64 \ -. bfd_put_64 +. bfd_put_64 .#define bfd_get_64(abfd, ptr) \ -. BFD_SEND(abfd, bfd_getx64, (ptr)) +. BFD_SEND (abfd, bfd_getx64, (ptr)) .#define bfd_get_signed_64(abfd, ptr) \ -. BFD_SEND(abfd, bfd_getx_signed_64, (ptr)) +. BFD_SEND (abfd, bfd_getx_signed_64, (ptr)) . -.#define bfd_get(bits, abfd, ptr) \ -. ( (bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \ -. : (bits) == 16 ? bfd_get_16 (abfd, ptr) \ -. : (bits) == 32 ? bfd_get_32 (abfd, ptr) \ -. : (bits) == 64 ? bfd_get_64 (abfd, ptr) \ -. : (abort (), (bfd_vma) - 1)) +.#define bfd_get(bits, abfd, ptr) \ +. ((bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \ +. : (bits) == 16 ? bfd_get_16 (abfd, ptr) \ +. : (bits) == 32 ? bfd_get_32 (abfd, ptr) \ +. : (bits) == 64 ? bfd_get_64 (abfd, ptr) \ +. : (abort (), (bfd_vma) - 1)) . -.#define bfd_put(bits, abfd, val, ptr) \ -. ( (bits) == 8 ? bfd_put_8 (abfd, val, ptr) \ -. : (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \ -. : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \ -. : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \ -. : (abort (), (void) 0)) +.#define bfd_put(bits, abfd, val, ptr) \ +. ((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \ +. : (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \ +. : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \ +. : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \ +. : (abort (), (void) 0)) . */ @@ -435,61 +418,51 @@ DESCRIPTION /* Sign extension to bfd_signed_vma. */ #define COERCE16(x) (((bfd_signed_vma) (x) ^ 0x8000) - 0x8000) -#define COERCE32(x) \ - ((bfd_signed_vma) (long) (((unsigned long) (x) ^ 0x80000000) - 0x80000000)) -#define EIGHT_GAZILLION (((BFD_HOST_64_BIT)0x80000000) << 32) +#define COERCE32(x) (((bfd_signed_vma) (x) ^ 0x80000000) - 0x80000000) +#define EIGHT_GAZILLION ((BFD_HOST_64_BIT) 1 << 63) #define COERCE64(x) \ (((bfd_signed_vma) (x) ^ EIGHT_GAZILLION) - EIGHT_GAZILLION) bfd_vma -bfd_getb16 (addr) - register const bfd_byte *addr; +bfd_getb16 (const bfd_byte *addr) { return (addr[0] << 8) | addr[1]; } bfd_vma -bfd_getl16 (addr) - register const bfd_byte *addr; +bfd_getl16 (const bfd_byte *addr) { return (addr[1] << 8) | addr[0]; } bfd_signed_vma -bfd_getb_signed_16 (addr) - register const bfd_byte *addr; +bfd_getb_signed_16 (const bfd_byte *addr) { - return COERCE16((addr[0] << 8) | addr[1]); + return COERCE16 ((addr[0] << 8) | addr[1]); } bfd_signed_vma -bfd_getl_signed_16 (addr) - register const bfd_byte *addr; +bfd_getl_signed_16 (const bfd_byte *addr) { - return COERCE16((addr[1] << 8) | addr[0]); + return COERCE16 ((addr[1] << 8) | addr[0]); } void -bfd_putb16 (data, addr) - bfd_vma data; - register bfd_byte *addr; +bfd_putb16 (bfd_vma data, bfd_byte *addr) { addr[0] = (bfd_byte) (data >> 8); addr[1] = (bfd_byte) data; } void -bfd_putl16 (data, addr) - bfd_vma data; - register bfd_byte *addr; +bfd_putl16 (bfd_vma data, bfd_byte *addr) { addr[0] = (bfd_byte) data; addr[1] = (bfd_byte) (data >> 8); } bfd_vma -bfd_getb32 (addr) - register const bfd_byte *addr; +bfd_getb32 (const bfd_byte *addr) { unsigned long v; @@ -497,12 +470,11 @@ bfd_getb32 (addr) v |= (unsigned long) addr[1] << 16; v |= (unsigned long) addr[2] << 8; v |= (unsigned long) addr[3]; - return (bfd_vma) v; + return v; } bfd_vma -bfd_getl32 (addr) - register const bfd_byte *addr; +bfd_getl32 (const bfd_byte *addr) { unsigned long v; @@ -510,12 +482,11 @@ bfd_getl32 (addr) v |= (unsigned long) addr[1] << 8; v |= (unsigned long) addr[2] << 16; v |= (unsigned long) addr[3] << 24; - return (bfd_vma) v; + return v; } bfd_signed_vma -bfd_getb_signed_32 (addr) - register const bfd_byte *addr; +bfd_getb_signed_32 (const bfd_byte *addr) { unsigned long v; @@ -527,8 +498,7 @@ bfd_getb_signed_32 (addr) } bfd_signed_vma -bfd_getl_signed_32 (addr) - register const bfd_byte *addr; +bfd_getl_signed_32 (const bfd_byte *addr) { unsigned long v; @@ -540,23 +510,21 @@ bfd_getl_signed_32 (addr) } bfd_vma -bfd_getb64 (addr) - register const bfd_byte *addr ATTRIBUTE_UNUSED; +bfd_getb64 (const bfd_byte *addr ATTRIBUTE_UNUSED) { #ifdef BFD64 - bfd_vma low, high; - - high= ((((((((addr[0]) << 8) | - addr[1]) << 8) | - addr[2]) << 8) | - addr[3]) ); - - low = (((((((((bfd_vma)addr[4]) << 8) | - addr[5]) << 8) | - addr[6]) << 8) | - addr[7])); - - return high << 32 | low; + bfd_vma v; + + v = addr[0]; v <<= 8; + v |= addr[1]; v <<= 8; + v |= addr[2]; v <<= 8; + v |= addr[3]; v <<= 8; + v |= addr[4]; v <<= 8; + v |= addr[5]; v <<= 8; + v |= addr[6]; v <<= 8; + v |= addr[7]; + + return v; #else BFD_FAIL(); return 0; @@ -564,22 +532,21 @@ bfd_getb64 (addr) } bfd_vma -bfd_getl64 (addr) - register const bfd_byte *addr ATTRIBUTE_UNUSED; +bfd_getl64 (const bfd_byte *addr ATTRIBUTE_UNUSED) { #ifdef BFD64 - bfd_vma low, high; - high= (((((((addr[7] << 8) | - addr[6]) << 8) | - addr[5]) << 8) | - addr[4])); - - low = ((((((((bfd_vma)addr[3] << 8) | - addr[2]) << 8) | - addr[1]) << 8) | - addr[0]) ); - - return high << 32 | low; + bfd_vma v; + + v = addr[7]; v <<= 8; + v |= addr[6]; v <<= 8; + v |= addr[5]; v <<= 8; + v |= addr[4]; v <<= 8; + v |= addr[3]; v <<= 8; + v |= addr[2]; v <<= 8; + v |= addr[1]; v <<= 8; + v |= addr[0]; + + return v; #else BFD_FAIL(); return 0; @@ -592,19 +559,18 @@ bfd_getb_signed_64 (addr) register const bfd_byte *addr ATTRIBUTE_UNUSED; { #ifdef BFD64 - bfd_vma low, high; - - high= ((((((((addr[0]) << 8) | - addr[1]) << 8) | - addr[2]) << 8) | - addr[3]) ); - - low = (((((((((bfd_vma)addr[4]) << 8) | - addr[5]) << 8) | - addr[6]) << 8) | - addr[7])); - - return COERCE64(high << 32 | low); + bfd_vma v; + + v = addr[0]; v <<= 8; + v |= addr[1]; v <<= 8; + v |= addr[2]; v <<= 8; + v |= addr[3]; v <<= 8; + v |= addr[4]; v <<= 8; + v |= addr[5]; v <<= 8; + v |= addr[6]; v <<= 8; + v |= addr[7]; + + return COERCE64 (v); #else BFD_FAIL(); return 0; @@ -616,18 +582,18 @@ bfd_getl_signed_64 (addr) register const bfd_byte *addr ATTRIBUTE_UNUSED; { #ifdef BFD64 - bfd_vma low, high; - high= (((((((addr[7] << 8) | - addr[6]) << 8) | - addr[5]) << 8) | - addr[4])); - - low = ((((((((bfd_vma)addr[3] << 8) | - addr[2]) << 8) | - addr[1]) << 8) | - addr[0]) ); - - return COERCE64(high << 32 | low); + bfd_vma v; + + v = addr[7]; v <<= 8; + v |= addr[6]; v <<= 8; + v |= addr[5]; v <<= 8; + v |= addr[4]; v <<= 8; + v |= addr[3]; v <<= 8; + v |= addr[2]; v <<= 8; + v |= addr[1]; v <<= 8; + v |= addr[0]; + + return COERCE64 (v); #else BFD_FAIL(); return 0; @@ -635,31 +601,25 @@ bfd_getl_signed_64 (addr) } void -bfd_putb32 (data, addr) - bfd_vma data; - register bfd_byte *addr; +bfd_putb32 (bfd_vma data, bfd_byte *addr) { - addr[0] = (bfd_byte) (data >> 24); - addr[1] = (bfd_byte) (data >> 16); - addr[2] = (bfd_byte) (data >> 8); - addr[3] = (bfd_byte) data; + addr[0] = (bfd_byte) (data >> 24); + addr[1] = (bfd_byte) (data >> 16); + addr[2] = (bfd_byte) (data >> 8); + addr[3] = (bfd_byte) data; } void -bfd_putl32 (data, addr) - bfd_vma data; - register bfd_byte *addr; +bfd_putl32 (bfd_vma data, bfd_byte *addr) { - addr[0] = (bfd_byte) data; - addr[1] = (bfd_byte) (data >> 8); - addr[2] = (bfd_byte) (data >> 16); - addr[3] = (bfd_byte) (data >> 24); + addr[0] = (bfd_byte) data; + addr[1] = (bfd_byte) (data >> 8); + addr[2] = (bfd_byte) (data >> 16); + addr[3] = (bfd_byte) (data >> 24); } void -bfd_putb64 (data, addr) - bfd_vma data ATTRIBUTE_UNUSED; - register bfd_byte *addr ATTRIBUTE_UNUSED; +bfd_putb64 (bfd_vma data ATTRIBUTE_UNUSED, bfd_byte *addr ATTRIBUTE_UNUSED) { #ifdef BFD64 addr[0] = (bfd_byte) (data >> (7*8)); @@ -676,9 +636,7 @@ bfd_putb64 (data, addr) } void -bfd_putl64 (data, addr) - bfd_vma data ATTRIBUTE_UNUSED; - register bfd_byte *addr ATTRIBUTE_UNUSED; +bfd_putl64 (bfd_vma data ATTRIBUTE_UNUSED, bfd_byte *addr ATTRIBUTE_UNUSED) { #ifdef BFD64 addr[7] = (bfd_byte) (data >> (7*8)); @@ -695,11 +653,7 @@ bfd_putl64 (data, addr) } void -bfd_put_bits (data, addr, bits, big_p) - bfd_vma data; - bfd_byte *addr; - int bits; - bfd_boolean big_p; +bfd_put_bits (bfd_vma data, bfd_byte *addr, int bits, bfd_boolean big_p) { int i; int bytes; @@ -718,10 +672,7 @@ bfd_put_bits (data, addr, bits, big_p) } bfd_vma -bfd_get_bits (addr, bits, big_p) - bfd_byte *addr; - int bits; - bfd_boolean big_p; +bfd_get_bits (bfd_byte *addr, int bits, bfd_boolean big_p) { bfd_vma data; int i; @@ -745,12 +696,11 @@ bfd_get_bits (addr, bits, big_p) /* Default implementation */ bfd_boolean -_bfd_generic_get_section_contents (abfd, section, location, offset, count) - bfd *abfd; - sec_ptr section; - PTR location; - file_ptr offset; - bfd_size_type count; +_bfd_generic_get_section_contents (bfd *abfd, + sec_ptr section, + void *location, + file_ptr offset, + bfd_size_type count) { if (count == 0) return TRUE; @@ -769,17 +719,18 @@ _bfd_generic_get_section_contents (abfd, section, location, offset, count) } bfd_boolean -_bfd_generic_get_section_contents_in_window (abfd, section, w, offset, count) - bfd *abfd ATTRIBUTE_UNUSED; - sec_ptr section ATTRIBUTE_UNUSED; - bfd_window *w ATTRIBUTE_UNUSED; - file_ptr offset ATTRIBUTE_UNUSED; - bfd_size_type count ATTRIBUTE_UNUSED; +_bfd_generic_get_section_contents_in_window + (bfd *abfd ATTRIBUTE_UNUSED, + sec_ptr section ATTRIBUTE_UNUSED, + bfd_window *w ATTRIBUTE_UNUSED, + file_ptr offset ATTRIBUTE_UNUSED, + bfd_size_type count ATTRIBUTE_UNUSED) { #ifdef USE_MMAP if (count == 0) return TRUE; - if (abfd->xvec->_bfd_get_section_contents != _bfd_generic_get_section_contents) + if (abfd->xvec->_bfd_get_section_contents + != _bfd_generic_get_section_contents) { /* We don't know what changes the bfd's get_section_contents method may have to make. So punt trying to map the file @@ -787,11 +738,10 @@ _bfd_generic_get_section_contents_in_window (abfd, section, w, offset, count) /* @@ FIXME : If the internal window has a refcount of 1 and was allocated with malloc instead of mmap, just reuse it. */ bfd_free_window (w); - w->i = ((bfd_window_internal *) - bfd_zmalloc ((bfd_size_type) sizeof (bfd_window_internal))); + w->i = bfd_zmalloc (sizeof (bfd_window_internal)); if (w->i == NULL) return FALSE; - w->i->data = (PTR) bfd_malloc (count); + w->i->data = bfd_malloc (count); if (w->i->data == NULL) { free (w->i); @@ -819,12 +769,11 @@ _bfd_generic_get_section_contents_in_window (abfd, section, w, offset, count) in read-write files, though. See other set_section_contents functions to see why it doesn't work for new sections. */ bfd_boolean -_bfd_generic_set_section_contents (abfd, section, location, offset, count) - bfd *abfd; - sec_ptr section; - PTR location; - file_ptr offset; - bfd_size_type count; +_bfd_generic_set_section_contents (bfd *abfd, + sec_ptr section, + void *location, + file_ptr offset, + bfd_size_type count) { if (count == 0) return TRUE; @@ -849,8 +798,7 @@ DESCRIPTION */ unsigned int -bfd_log2 (x) - bfd_vma x; +bfd_log2 (bfd_vma x) { unsigned int result = 0; @@ -860,9 +808,7 @@ bfd_log2 (x) } bfd_boolean -bfd_generic_is_local_label_name (abfd, name) - bfd *abfd; - const char *name; +bfd_generic_is_local_label_name (bfd *abfd, const char *name) { char locals_prefix = (bfd_get_symbol_leading_char (abfd) == '_') ? 'L' : '.'; @@ -873,9 +819,7 @@ bfd_generic_is_local_label_name (abfd, name) endianness matches between input and output file. Returns TRUE for a match, otherwise returns FALSE and emits an error. */ bfd_boolean -_bfd_generic_verify_endian_match (ibfd, obfd) - bfd *ibfd; - bfd *obfd; +_bfd_generic_verify_endian_match (bfd *ibfd, bfd *obfd) { if (ibfd->xvec->byteorder != obfd->xvec->byteorder && ibfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN @@ -901,11 +845,10 @@ _bfd_generic_verify_endian_match (ibfd, obfd) old routines. */ void -warn_deprecated (what, file, line, func) - const char *what; - const char *file; - int line; - const char *func; +warn_deprecated (const char *what, + const char *file, + int line, + const char *func) { /* Poor man's tracking of functions we've already warned about. */ static size_t mask = 0; diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 46695e766ad..19dfadf0fcf 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -6,7 +6,7 @@ /* libbfd.h -- Declarations used by bfd library *implementation*. (This include file is not for users of the library.) Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002 + 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. @@ -41,7 +41,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Set a tdata field. Can't use the other macros for this, since they do casts, and casting to the left of assignment isn't portable. */ -#define set_tdata(bfd, v) ((bfd)->tdata.any = (PTR) (v)) +#define set_tdata(bfd, v) ((bfd)->tdata.any = (v)) /* If BFD_IN_MEMORY is set for a BFD, then the iostream fields points to an instance of this structure. */ @@ -74,7 +74,7 @@ struct artdata { archive. */ file_ptr armap_datepos; /* Position within archive to seek to rewrite the date field. */ - PTR tdata; /* Backend specific information. */ + void *tdata; /* Backend specific information. */ }; #define bfd_ardata(bfd) ((bfd)->tdata.aout_ar_data) @@ -88,105 +88,105 @@ struct areltdata { #define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size) -extern PTR bfd_malloc - PARAMS ((bfd_size_type)); -extern PTR bfd_realloc - PARAMS ((PTR, bfd_size_type)); -extern PTR bfd_zmalloc - PARAMS ((bfd_size_type)); +extern void *bfd_malloc + (bfd_size_type); +extern void *bfd_realloc + (void *, bfd_size_type); +extern void *bfd_zmalloc + (bfd_size_type); extern bfd_error_handler_type _bfd_error_handler; /* These routines allocate and free things on the BFD's objalloc. */ -extern PTR bfd_alloc - PARAMS ((bfd *, bfd_size_type)); -extern PTR bfd_zalloc - PARAMS ((bfd *, bfd_size_type)); +extern void *bfd_alloc + (bfd *, bfd_size_type); +extern void *bfd_zalloc + (bfd *, bfd_size_type); extern void bfd_release - PARAMS ((bfd *, PTR)); + (bfd *, void *); bfd * _bfd_create_empty_archive_element_shell - PARAMS ((bfd *obfd)); + (bfd *obfd); bfd * _bfd_look_for_bfd_in_cache - PARAMS ((bfd *, file_ptr)); + (bfd *, file_ptr); bfd_boolean _bfd_add_bfd_to_archive_cache - PARAMS ((bfd *, file_ptr, bfd *)); + (bfd *, file_ptr, bfd *); bfd_boolean _bfd_generic_mkarchive - PARAMS ((bfd *abfd)); + (bfd *abfd); const bfd_target *bfd_generic_archive_p - PARAMS ((bfd *abfd)); + (bfd *abfd); bfd_boolean bfd_slurp_armap - PARAMS ((bfd *abfd)); + (bfd *abfd); bfd_boolean bfd_slurp_bsd_armap_f2 - PARAMS ((bfd *abfd)); + (bfd *abfd); #define bfd_slurp_bsd_armap bfd_slurp_armap #define bfd_slurp_coff_armap bfd_slurp_armap bfd_boolean _bfd_slurp_extended_name_table - PARAMS ((bfd *abfd)); + (bfd *abfd); extern bfd_boolean _bfd_construct_extended_name_table - PARAMS ((bfd *, bfd_boolean, char **, bfd_size_type *)); + (bfd *, bfd_boolean, char **, bfd_size_type *); bfd_boolean _bfd_write_archive_contents - PARAMS ((bfd *abfd)); + (bfd *abfd); bfd_boolean _bfd_compute_and_write_armap - PARAMS ((bfd *, unsigned int elength)); + (bfd *, unsigned int elength); bfd *_bfd_get_elt_at_filepos - PARAMS ((bfd *archive, file_ptr filepos)); + (bfd *archive, file_ptr filepos); extern bfd *_bfd_generic_get_elt_at_index - PARAMS ((bfd *, symindex)); + (bfd *, symindex); bfd * _bfd_new_bfd - PARAMS ((void)); + (void); void _bfd_delete_bfd - PARAMS ((bfd *)); + (bfd *); bfd_boolean bfd_false - PARAMS ((bfd *ignore)); + (bfd *ignore); bfd_boolean bfd_true - PARAMS ((bfd *ignore)); -PTR bfd_nullvoidptr - PARAMS ((bfd *ignore)); + (bfd *ignore); +void *bfd_nullvoidptr + (bfd *ignore); int bfd_0 - PARAMS ((bfd *ignore)); + (bfd *ignore); unsigned int bfd_0u - PARAMS ((bfd *ignore)); + (bfd *ignore); long bfd_0l - PARAMS ((bfd *ignore)); + (bfd *ignore); long _bfd_n1 - PARAMS ((bfd *ignore)); + (bfd *ignore); void bfd_void - PARAMS ((bfd *ignore)); + (bfd *ignore); bfd *_bfd_new_bfd_contained_in - PARAMS ((bfd *)); + (bfd *); const bfd_target *_bfd_dummy_target - PARAMS ((bfd *abfd)); + (bfd *abfd); void bfd_dont_truncate_arname - PARAMS ((bfd *abfd, const char *filename, char *hdr)); + (bfd *abfd, const char *filename, char *hdr); void bfd_bsd_truncate_arname - PARAMS ((bfd *abfd, const char *filename, char *hdr)); + (bfd *abfd, const char *filename, char *hdr); void bfd_gnu_truncate_arname - PARAMS ((bfd *abfd, const char *filename, char *hdr)); + (bfd *abfd, const char *filename, char *hdr); bfd_boolean bsd_write_armap - PARAMS ((bfd *arch, unsigned int elength, struct orl *map, - unsigned int orl_count, int stridx)); + (bfd *arch, unsigned int elength, struct orl *map, unsigned int orl_count, + int stridx); bfd_boolean coff_write_armap - PARAMS ((bfd *arch, unsigned int elength, struct orl *map, - unsigned int orl_count, int stridx)); + (bfd *arch, unsigned int elength, struct orl *map, unsigned int orl_count, + int stridx); -extern PTR _bfd_generic_read_ar_hdr - PARAMS ((bfd *)); +extern void *_bfd_generic_read_ar_hdr + (bfd *); -extern PTR _bfd_generic_read_ar_hdr_mag - PARAMS ((bfd *, const char *)); +extern void *_bfd_generic_read_ar_hdr_mag + (bfd *, const char *); bfd * bfd_generic_openr_next_archived_file - PARAMS ((bfd *archive, bfd *last_file)); + (bfd *archive, bfd *last_file); int bfd_generic_stat_arch_elt - PARAMS ((bfd *, struct stat *)); + (bfd *, struct stat *); #define _bfd_read_ar_hdr(abfd) \ BFD_SEND (abfd, _bfd_read_ar_hdr_fn, (abfd)) @@ -197,37 +197,37 @@ int bfd_generic_stat_arch_elt #define _bfd_generic_close_and_cleanup bfd_true #define _bfd_generic_bfd_free_cached_info bfd_true #define _bfd_generic_new_section_hook \ - ((bfd_boolean (*) PARAMS ((bfd *, asection *))) bfd_true) + ((bfd_boolean (*) (bfd *, asection *)) bfd_true) extern bfd_boolean _bfd_generic_get_section_contents - PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); + (bfd *, asection *, void *, file_ptr, bfd_size_type); extern bfd_boolean _bfd_generic_get_section_contents_in_window - PARAMS ((bfd *, asection *, bfd_window *, file_ptr, bfd_size_type)); + (bfd *, asection *, bfd_window *, file_ptr, bfd_size_type); /* Generic routines to use for BFD_JUMP_TABLE_COPY. Use BFD_JUMP_TABLE_COPY (_bfd_generic). */ #define _bfd_generic_bfd_copy_private_bfd_data \ - ((bfd_boolean (*) PARAMS ((bfd *, bfd *))) bfd_true) + ((bfd_boolean (*) (bfd *, bfd *)) bfd_true) #define _bfd_generic_bfd_merge_private_bfd_data \ - ((bfd_boolean (*) PARAMS ((bfd *, bfd *))) bfd_true) + ((bfd_boolean (*) (bfd *, bfd *)) bfd_true) #define _bfd_generic_bfd_set_private_flags \ - ((bfd_boolean (*) PARAMS ((bfd *, flagword))) bfd_true) + ((bfd_boolean (*) (bfd *, flagword)) bfd_true) #define _bfd_generic_bfd_copy_private_section_data \ - ((bfd_boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true) + ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true) #define _bfd_generic_bfd_copy_private_symbol_data \ - ((bfd_boolean (*) PARAMS ((bfd *, asymbol *, bfd *, asymbol *))) bfd_true) + ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true) #define _bfd_generic_bfd_print_private_bfd_data \ - ((bfd_boolean (*) PARAMS ((bfd *, PTR))) bfd_true) + ((bfd_boolean (*) (bfd *, void *)) bfd_true) /* Routines to use for BFD_JUMP_TABLE_CORE when there is no core file support. Use BFD_JUMP_TABLE_CORE (_bfd_nocore). */ extern char *_bfd_nocore_core_file_failing_command - PARAMS ((bfd *)); + (bfd *); extern int _bfd_nocore_core_file_failing_signal - PARAMS ((bfd *)); + (bfd *); extern bfd_boolean _bfd_nocore_core_file_matches_executable_p - PARAMS ((bfd *, bfd *)); + (bfd *, bfd *); /* Routines to use for BFD_JUMP_TABLE_ARCHIVE when there is no archive file support. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive). */ @@ -235,20 +235,18 @@ extern bfd_boolean _bfd_nocore_core_file_matches_executable_p #define _bfd_noarchive_slurp_armap bfd_false #define _bfd_noarchive_slurp_extended_name_table bfd_false #define _bfd_noarchive_construct_extended_name_table \ - ((bfd_boolean (*) \ - PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \ + ((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) \ bfd_false) #define _bfd_noarchive_truncate_arname \ - ((void (*) PARAMS ((bfd *, const char *, char *))) bfd_void) + ((void (*) (bfd *, const char *, char *)) bfd_void) #define _bfd_noarchive_write_armap \ - ((bfd_boolean (*) \ - PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int))) \ + ((bfd_boolean (*) (bfd *, unsigned int, struct orl *, unsigned int, int)) \ bfd_false) #define _bfd_noarchive_read_ar_hdr bfd_nullvoidptr #define _bfd_noarchive_openr_next_archived_file \ - ((bfd *(*) PARAMS ((bfd *, bfd *))) bfd_nullvoidptr) + ((bfd *(*) (bfd *, bfd *)) bfd_nullvoidptr) #define _bfd_noarchive_get_elt_at_index \ - ((bfd *(*) PARAMS ((bfd *, symindex))) bfd_nullvoidptr) + ((bfd *(*) (bfd *, symindex)) bfd_nullvoidptr) #define _bfd_noarchive_generic_stat_arch_elt bfd_generic_stat_arch_elt #define _bfd_noarchive_update_armap_timestamp bfd_false @@ -259,7 +257,7 @@ extern bfd_boolean _bfd_nocore_core_file_matches_executable_p #define _bfd_archive_bsd_slurp_extended_name_table \ _bfd_slurp_extended_name_table extern bfd_boolean _bfd_archive_bsd_construct_extended_name_table - PARAMS ((bfd *, char **, bfd_size_type *, const char **)); + (bfd *, char **, bfd_size_type *, const char **); #define _bfd_archive_bsd_truncate_arname bfd_bsd_truncate_arname #define _bfd_archive_bsd_write_armap bsd_write_armap #define _bfd_archive_bsd_read_ar_hdr _bfd_generic_read_ar_hdr @@ -269,7 +267,7 @@ extern bfd_boolean _bfd_archive_bsd_construct_extended_name_table #define _bfd_archive_bsd_generic_stat_arch_elt \ bfd_generic_stat_arch_elt extern bfd_boolean _bfd_archive_bsd_update_armap_timestamp - PARAMS ((bfd *)); + (bfd *); /* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get COFF style archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff). */ @@ -278,7 +276,7 @@ extern bfd_boolean _bfd_archive_bsd_update_armap_timestamp #define _bfd_archive_coff_slurp_extended_name_table \ _bfd_slurp_extended_name_table extern bfd_boolean _bfd_archive_coff_construct_extended_name_table - PARAMS ((bfd *, char **, bfd_size_type *, const char **)); + (bfd *, char **, bfd_size_type *, const char **); #define _bfd_archive_coff_truncate_arname bfd_dont_truncate_arname #define _bfd_archive_coff_write_armap coff_write_armap #define _bfd_archive_coff_read_ar_hdr _bfd_generic_read_ar_hdr @@ -294,49 +292,46 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table #define _bfd_nosymbols_get_symtab_upper_bound _bfd_n1 #define _bfd_nosymbols_get_symtab \ - ((long (*) PARAMS ((bfd *, asymbol **))) _bfd_n1) + ((long (*) (bfd *, asymbol **)) _bfd_n1) #define _bfd_nosymbols_make_empty_symbol _bfd_generic_make_empty_symbol #define _bfd_nosymbols_print_symbol \ - ((void (*) PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type))) bfd_void) + ((void (*) (bfd *, void *, asymbol *, bfd_print_symbol_type)) bfd_void) #define _bfd_nosymbols_get_symbol_info \ - ((void (*) PARAMS ((bfd *, asymbol *, symbol_info *))) bfd_void) + ((void (*) (bfd *, asymbol *, symbol_info *)) bfd_void) #define _bfd_nosymbols_bfd_is_local_label_name \ - ((bfd_boolean (*) PARAMS ((bfd *, const char *))) bfd_false) + ((bfd_boolean (*) (bfd *, const char *)) bfd_false) #define _bfd_nosymbols_get_lineno \ - ((alent *(*) PARAMS ((bfd *, asymbol *))) bfd_nullvoidptr) + ((alent *(*) (bfd *, asymbol *)) bfd_nullvoidptr) #define _bfd_nosymbols_find_nearest_line \ - ((bfd_boolean (*) \ - PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, \ - const char **, unsigned int *))) \ + ((bfd_boolean (*) (bfd *, asection *, asymbol **, bfd_vma, const char **, \ + const char **, unsigned int *)) \ bfd_false) #define _bfd_nosymbols_bfd_make_debug_symbol \ - ((asymbol *(*) PARAMS ((bfd *, PTR, unsigned long))) bfd_nullvoidptr) + ((asymbol *(*) (bfd *, void *, unsigned long)) bfd_nullvoidptr) #define _bfd_nosymbols_read_minisymbols \ - ((long (*) PARAMS ((bfd *, bfd_boolean, PTR *, unsigned int *))) _bfd_n1) + ((long (*) (bfd *, bfd_boolean, void **, unsigned int *)) _bfd_n1) #define _bfd_nosymbols_minisymbol_to_symbol \ - ((asymbol *(*) PARAMS ((bfd *, bfd_boolean, const PTR, asymbol *))) \ + ((asymbol *(*) (bfd *, bfd_boolean, const void *, asymbol *)) \ bfd_nullvoidptr) /* Routines to use for BFD_JUMP_TABLE_RELOCS when there is no reloc support. Use BFD_JUMP_TABLE_RELOCS (_bfd_norelocs). */ #define _bfd_norelocs_get_reloc_upper_bound \ - ((long (*) PARAMS ((bfd *, asection *))) _bfd_n1) + ((long (*) (bfd *, asection *)) _bfd_n1) #define _bfd_norelocs_canonicalize_reloc \ - ((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) _bfd_n1) + ((long (*) (bfd *, asection *, arelent **, asymbol **)) _bfd_n1) #define _bfd_norelocs_bfd_reloc_type_lookup \ - ((reloc_howto_type *(*) PARAMS ((bfd *, bfd_reloc_code_real_type))) \ - bfd_nullvoidptr) + ((reloc_howto_type *(*) (bfd *, bfd_reloc_code_real_type)) bfd_nullvoidptr) /* Routines to use for BFD_JUMP_TABLE_WRITE for targets which may not be written. Use BFD_JUMP_TABLE_WRITE (_bfd_nowrite). */ #define _bfd_nowrite_set_arch_mach \ - ((bfd_boolean (*) PARAMS ((bfd *, enum bfd_architecture, unsigned long))) \ + ((bfd_boolean (*) (bfd *, enum bfd_architecture, unsigned long)) \ bfd_false) #define _bfd_nowrite_set_section_contents \ - ((bfd_boolean (*) \ - PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type))) \ + ((bfd_boolean (*) (bfd *, asection *, void *, file_ptr, bfd_size_type)) \ bfd_false) /* Generic routines to use for BFD_JUMP_TABLE_WRITE. Use @@ -344,45 +339,41 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table #define _bfd_generic_set_arch_mach bfd_default_set_arch_mach extern bfd_boolean _bfd_generic_set_section_contents - PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type)); + (bfd *, asection *, void *, file_ptr, bfd_size_type); /* Routines to use for BFD_JUMP_TABLE_LINK for targets which do not support linking. Use BFD_JUMP_TABLE_LINK (_bfd_nolink). */ -#define _bfd_nolink_sizeof_headers ((int (*) PARAMS ((bfd *, bfd_boolean))) bfd_0) +#define _bfd_nolink_sizeof_headers ((int (*) (bfd *, bfd_boolean)) bfd_0) #define _bfd_nolink_bfd_get_relocated_section_contents \ - ((bfd_byte *(*) \ - PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, \ - bfd_byte *, bfd_boolean, asymbol **))) \ + ((bfd_byte *(*) (bfd *, struct bfd_link_info *, struct bfd_link_order *, \ + bfd_byte *, bfd_boolean, asymbol **)) \ bfd_nullvoidptr) #define _bfd_nolink_bfd_relax_section \ ((bfd_boolean (*) \ - PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *))) \ + (bfd *, asection *, struct bfd_link_info *, bfd_boolean *)) \ bfd_false) #define _bfd_nolink_bfd_gc_sections \ - ((bfd_boolean (*) \ - PARAMS ((bfd *, struct bfd_link_info *))) \ + ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \ bfd_false) #define _bfd_nolink_bfd_merge_sections \ - ((bfd_boolean (*) \ - PARAMS ((bfd *, struct bfd_link_info *))) \ + ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \ bfd_false) #define _bfd_nolink_bfd_discard_group \ - ((bfd_boolean (*) \ - PARAMS ((bfd *, struct sec *))) \ + ((bfd_boolean (*) (bfd *, struct sec *)) \ bfd_false) #define _bfd_nolink_bfd_link_hash_table_create \ - ((struct bfd_link_hash_table *(*) PARAMS ((bfd *))) bfd_nullvoidptr) + ((struct bfd_link_hash_table *(*) (bfd *)) bfd_nullvoidptr) #define _bfd_nolink_bfd_link_hash_table_free \ - ((void (*) PARAMS ((struct bfd_link_hash_table *))) bfd_void) + ((void (*) (struct bfd_link_hash_table *)) bfd_void) #define _bfd_nolink_bfd_link_add_symbols \ - ((bfd_boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false) + ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false) #define _bfd_nolink_bfd_link_just_syms \ - ((void (*) PARAMS ((asection *, struct bfd_link_info *))) bfd_void) + ((void (*) (asection *, struct bfd_link_info *)) bfd_void) #define _bfd_nolink_bfd_final_link \ - ((bfd_boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false) + ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false) #define _bfd_nolink_bfd_link_split_section \ - ((bfd_boolean (*) PARAMS ((bfd *, struct sec *))) bfd_false) + ((bfd_boolean (*) (bfd *, struct sec *)) bfd_false) /* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC @@ -390,195 +381,189 @@ extern bfd_boolean _bfd_generic_set_section_contents #define _bfd_nodynamic_get_dynamic_symtab_upper_bound _bfd_n1 #define _bfd_nodynamic_canonicalize_dynamic_symtab \ - ((long (*) PARAMS ((bfd *, asymbol **))) _bfd_n1) + ((long (*) (bfd *, asymbol **)) _bfd_n1) #define _bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_n1 #define _bfd_nodynamic_canonicalize_dynamic_reloc \ - ((long (*) PARAMS ((bfd *, arelent **, asymbol **))) _bfd_n1) + ((long (*) (bfd *, arelent **, asymbol **)) _bfd_n1) /* Generic routine to determine of the given symbol is a local label. */ extern bfd_boolean bfd_generic_is_local_label_name - PARAMS ((bfd *, const char *)); + (bfd *, const char *); /* Generic minisymbol routines. */ extern long _bfd_generic_read_minisymbols - PARAMS ((bfd *, bfd_boolean, PTR *, unsigned int *)); + (bfd *, bfd_boolean, void **, unsigned int *); extern asymbol *_bfd_generic_minisymbol_to_symbol - PARAMS ((bfd *, bfd_boolean, const PTR, asymbol *)); + (bfd *, bfd_boolean, const void *, asymbol *); /* Find the nearest line using .stab/.stabstr sections. */ extern bfd_boolean _bfd_stab_section_find_nearest_line - PARAMS ((bfd *, asymbol **, asection *, bfd_vma, bfd_boolean *, - const char **, const char **, unsigned int *, PTR *)); + (bfd *, asymbol **, asection *, bfd_vma, bfd_boolean *, + const char **, const char **, unsigned int *, void **); /* Find the neaderst line using DWARF 1 debugging information. */ extern bfd_boolean _bfd_dwarf1_find_nearest_line - PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, - const char **, unsigned int *)); + (bfd *, asection *, asymbol **, bfd_vma, const char **, + const char **, unsigned int *); /* Find the nearest line using DWARF 2 debugging information. */ extern bfd_boolean _bfd_dwarf2_find_nearest_line - PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, - const char **, unsigned int *, unsigned int, - PTR *)); + (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, + unsigned int *, unsigned int, void **); /* Create a new section entry. */ extern struct bfd_hash_entry *bfd_section_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); + (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); /* A routine to create entries for a bfd_link_hash_table. */ extern struct bfd_hash_entry *_bfd_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *entry, - struct bfd_hash_table *table, - const char *string)); + (struct bfd_hash_entry *entry, struct bfd_hash_table *table, + const char *string); /* Initialize a bfd_link_hash_table. */ extern bfd_boolean _bfd_link_hash_table_init - PARAMS ((struct bfd_link_hash_table *, bfd *, - struct bfd_hash_entry *(*) (struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *))); + (struct bfd_link_hash_table *, bfd *, + struct bfd_hash_entry *(*) (struct bfd_hash_entry *, + struct bfd_hash_table *, + const char *)); /* Generic link hash table creation routine. */ extern struct bfd_link_hash_table *_bfd_generic_link_hash_table_create - PARAMS ((bfd *)); + (bfd *); /* Generic link hash table destruction routine. */ extern void _bfd_generic_link_hash_table_free - PARAMS ((struct bfd_link_hash_table *)); + (struct bfd_link_hash_table *); /* Generic add symbol routine. */ extern bfd_boolean _bfd_generic_link_add_symbols - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); /* Generic add symbol routine. This version is used by targets for which the linker must collect constructors and destructors by name, as the collect2 program does. */ extern bfd_boolean _bfd_generic_link_add_symbols_collect - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); /* Generic archive add symbol routine. */ extern bfd_boolean _bfd_generic_link_add_archive_symbols - PARAMS ((bfd *, struct bfd_link_info *, - bfd_boolean (*) (bfd *, struct bfd_link_info *, bfd_boolean *))); + (bfd *, struct bfd_link_info *, + bfd_boolean (*) (bfd *, struct bfd_link_info *, bfd_boolean *)); /* Forward declaration to avoid prototype errors. */ typedef struct bfd_link_hash_entry _bfd_link_hash_entry; /* Generic routine to add a single symbol. */ extern bfd_boolean _bfd_generic_link_add_one_symbol - PARAMS ((struct bfd_link_info *, bfd *, const char *name, flagword, - asection *, bfd_vma, const char *, bfd_boolean copy, - bfd_boolean constructor, struct bfd_link_hash_entry **)); + (struct bfd_link_info *, bfd *, const char *name, flagword, + asection *, bfd_vma, const char *, bfd_boolean copy, + bfd_boolean constructor, struct bfd_link_hash_entry **); /* Generic routine to mark section as supplying symbols only. */ extern void _bfd_generic_link_just_syms - PARAMS ((asection *, struct bfd_link_info *)); + (asection *, struct bfd_link_info *); /* Generic link routine. */ extern bfd_boolean _bfd_generic_final_link - PARAMS ((bfd *, struct bfd_link_info *)); + (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_generic_link_split_section - PARAMS ((bfd *, struct sec *)); + (bfd *, struct sec *); /* Generic reloc_link_order processing routine. */ extern bfd_boolean _bfd_generic_reloc_link_order - PARAMS ((bfd *, struct bfd_link_info *, asection *, - struct bfd_link_order *)); + (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *); /* Default link order processing routine. */ extern bfd_boolean _bfd_default_link_order - PARAMS ((bfd *, struct bfd_link_info *, asection *, - struct bfd_link_order *)); + (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *); /* Count the number of reloc entries in a link order list. */ extern unsigned int _bfd_count_link_order_relocs - PARAMS ((struct bfd_link_order *)); + (struct bfd_link_order *); /* Final link relocation routine. */ extern bfd_reloc_status_type _bfd_final_link_relocate - PARAMS ((reloc_howto_type *, bfd *, asection *, bfd_byte *, - bfd_vma, bfd_vma, bfd_vma)); + (reloc_howto_type *, bfd *, asection *, bfd_byte *, + bfd_vma, bfd_vma, bfd_vma); /* Relocate a particular location by a howto and a value. */ extern bfd_reloc_status_type _bfd_relocate_contents - PARAMS ((reloc_howto_type *, bfd *, bfd_vma, bfd_byte *)); + (reloc_howto_type *, bfd *, bfd_vma, bfd_byte *); /* Link stabs in sections in the first pass. */ extern bfd_boolean _bfd_link_section_stabs - PARAMS ((bfd *, PTR *, asection *, asection *, PTR *)); + (bfd *, void **, asection *, asection *, void **); /* Eliminate stabs for discarded functions and symbols. */ extern bfd_boolean _bfd_discard_section_stabs - PARAMS ((bfd *, asection *, PTR, - bfd_boolean (*) (bfd_vma, PTR), PTR)); + (bfd *, asection *, void *, bfd_boolean (*) (bfd_vma, void *), void *); /* Write out the .stab section when linking stabs in sections. */ extern bfd_boolean _bfd_write_section_stabs - PARAMS ((bfd *, PTR *, asection *, PTR *, bfd_byte *)); + (bfd *, void **, asection *, void **, bfd_byte *); /* Write out the .stabstr string table when linking stabs in sections. */ extern bfd_boolean _bfd_write_stab_strings - PARAMS ((bfd *, PTR *)); + (bfd *, void **); /* Find an offset within a .stab section when linking stabs in sections. */ extern bfd_vma _bfd_stab_section_offset - PARAMS ((bfd *, PTR *, asection *, PTR *, bfd_vma)); + (bfd *, void **, asection *, void **, bfd_vma); /* Attempt to merge a SEC_MERGE section. */ extern bfd_boolean _bfd_merge_section - PARAMS ((bfd *, PTR *, asection *, PTR *)); + (bfd *, void **, asection *, void **); /* Attempt to merge SEC_MERGE sections. */ extern bfd_boolean _bfd_merge_sections - PARAMS ((bfd *, PTR, void (*)(bfd *, asection *))); + (bfd *, void *, void (*) (bfd *, asection *)); /* Write out a merged section. */ extern bfd_boolean _bfd_write_merged_section - PARAMS ((bfd *, asection *, PTR)); + (bfd *, asection *, void *); /* Find an offset within a modified SEC_MERGE section. */ extern bfd_vma _bfd_merged_section_offset - PARAMS ((bfd *, asection **, PTR, bfd_vma, bfd_vma)); + (bfd *, asection **, void *, bfd_vma, bfd_vma); /* Create a string table. */ extern struct bfd_strtab_hash *_bfd_stringtab_init - PARAMS ((void)); + (void); /* Create an XCOFF .debug section style string table. */ extern struct bfd_strtab_hash *_bfd_xcoff_stringtab_init - PARAMS ((void)); + (void); /* Free a string table. */ extern void _bfd_stringtab_free - PARAMS ((struct bfd_strtab_hash *)); + (struct bfd_strtab_hash *); /* Get the size of a string table. */ extern bfd_size_type _bfd_stringtab_size - PARAMS ((struct bfd_strtab_hash *)); + (struct bfd_strtab_hash *); /* Add a string to a string table. */ extern bfd_size_type _bfd_stringtab_add - PARAMS ((struct bfd_strtab_hash *, const char *, bfd_boolean hash, - bfd_boolean copy)); + (struct bfd_strtab_hash *, const char *, bfd_boolean hash, bfd_boolean copy); /* Write out a string table. */ extern bfd_boolean _bfd_stringtab_emit - PARAMS ((bfd *, struct bfd_strtab_hash *)); + (bfd *, struct bfd_strtab_hash *); /* Check that endianness of input and output file match. */ extern bfd_boolean _bfd_generic_verify_endian_match - PARAMS ((bfd *, bfd *)); + (bfd *, bfd *); /* Macros to tell if bfds are read or write enabled. @@ -589,20 +574,22 @@ extern bfd_boolean _bfd_generic_verify_endian_match !bfd_read_p, and only sometimes bfd_write_p. */ -#define bfd_read_p(abfd) ((abfd)->direction == read_direction || (abfd)->direction == both_direction) -#define bfd_write_p(abfd) ((abfd)->direction == write_direction || (abfd)->direction == both_direction) +#define bfd_read_p(abfd) \ + ((abfd)->direction == read_direction || (abfd)->direction == both_direction) +#define bfd_write_p(abfd) \ + ((abfd)->direction == write_direction || (abfd)->direction == both_direction) void bfd_assert - PARAMS ((const char*,int)); + (const char*,int); #define BFD_ASSERT(x) \ -{ if (!(x)) bfd_assert(__FILE__,__LINE__); } + { if (!(x)) bfd_assert(__FILE__,__LINE__); } #define BFD_FAIL() \ -{ bfd_assert(__FILE__,__LINE__); } + { bfd_assert(__FILE__,__LINE__); } extern void _bfd_abort - PARAMS ((const char *, int, const char *)) ATTRIBUTE_NORETURN; + (const char *, int, const char *) ATTRIBUTE_NORETURN; /* if gcc >= 2.6, we can give a function name, too */ #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6) @@ -613,7 +600,7 @@ extern void _bfd_abort #define abort() _bfd_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__) FILE * bfd_cache_lookup_worker - PARAMS ((bfd *)); + (bfd *); extern bfd *bfd_last_cache; @@ -633,42 +620,41 @@ struct ecoff_find_line; #endif extern bfd_boolean _bfd_ecoff_locate_line - PARAMS ((bfd *, asection *, bfd_vma, struct ecoff_debug_info * const, - const struct ecoff_debug_swap * const, struct ecoff_find_line *, - const char **, const char **, unsigned int *)); + (bfd *, asection *, bfd_vma, struct ecoff_debug_info * const, + const struct ecoff_debug_swap * const, struct ecoff_find_line *, + const char **, const char **, unsigned int *); extern bfd_boolean _bfd_ecoff_get_accumulated_pdr - PARAMS ((PTR, bfd_byte *)); + (void *, bfd_byte *); extern bfd_boolean _bfd_ecoff_get_accumulated_sym - PARAMS ((PTR, bfd_byte *)); + (void *, bfd_byte *); extern bfd_boolean _bfd_ecoff_get_accumulated_ss - PARAMS ((PTR, bfd_byte *)); + (void *, bfd_byte *); extern bfd_vma _bfd_get_gp_value - PARAMS ((bfd *)); + (bfd *); extern void _bfd_set_gp_value - PARAMS ((bfd *, bfd_vma)); + (bfd *, bfd_vma); /* Function shared by the COFF and ELF SH backends, which have no other common header files. */ +#ifndef _bfd_sh_align_load_span extern bfd_boolean _bfd_sh_align_load_span - PARAMS ((bfd *, asection *, bfd_byte *, - bfd_boolean (*) (bfd *, asection *, PTR, bfd_byte *, bfd_vma), - PTR, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, bfd_boolean *)); - + (bfd *, asection *, bfd_byte *, + bfd_boolean (*) (bfd *, asection *, void *, bfd_byte *, bfd_vma), + void *, bfd_vma **, bfd_vma *, bfd_vma, bfd_vma, bfd_boolean *); +#endif /* Extracted from init.c. */ /* Extracted from libbfd.c. */ -bfd_boolean -bfd_write_bigendian_4byte_int PARAMS ((bfd *, unsigned int)); +bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int); -unsigned int -bfd_log2 PARAMS ((bfd_vma x)); +unsigned int bfd_log2 (bfd_vma x); /* Extracted from bfdio.c. */ /* Extracted from bfdwin.c. */ struct _bfd_window_internal { struct _bfd_window_internal *next; - PTR data; + void *data; bfd_size_type size; int refcount : 31; /* should be enough... */ unsigned mapped : 1; /* 1 = mmap, 0 = malloc */ @@ -681,17 +667,13 @@ extern bfd *bfd_last_cache; ((x)==bfd_last_cache? \ (FILE*) (bfd_last_cache->iostream): \ bfd_cache_lookup_worker(x)) -bfd_boolean -bfd_cache_init PARAMS ((bfd *abfd)); +bfd_boolean bfd_cache_init (bfd *abfd); -bfd_boolean -bfd_cache_close PARAMS ((bfd *abfd)); +bfd_boolean bfd_cache_close (bfd *abfd); -FILE* -bfd_open_file PARAMS ((bfd *abfd)); +FILE* bfd_open_file (bfd *abfd); -FILE * -bfd_cache_lookup_worker PARAMS ((bfd *abfd)); +FILE *bfd_cache_lookup_worker (bfd *abfd); /* Extracted from reloc.c. */ #ifdef _BFD_MAKE_TABLE_bfd_reloc_code_real @@ -1489,44 +1471,40 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", }; #endif -reloc_howto_type * -bfd_default_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); +reloc_howto_type *bfd_default_reloc_type_lookup + (bfd *abfd, bfd_reloc_code_real_type code); -bfd_boolean -bfd_generic_relax_section PARAMS ((bfd *abfd, +bfd_boolean bfd_generic_relax_section + (bfd *abfd, asection *section, struct bfd_link_info *, - bfd_boolean *)); + bfd_boolean *); -bfd_boolean -bfd_generic_gc_sections PARAMS ((bfd *, struct bfd_link_info *)); +bfd_boolean bfd_generic_gc_sections + (bfd *, struct bfd_link_info *); -bfd_boolean -bfd_generic_merge_sections PARAMS ((bfd *, struct bfd_link_info *)); +bfd_boolean bfd_generic_merge_sections + (bfd *, struct bfd_link_info *); -bfd_byte * -bfd_generic_get_relocated_section_contents PARAMS ((bfd *abfd, +bfd_byte *bfd_generic_get_relocated_section_contents + (bfd *abfd, struct bfd_link_info *link_info, struct bfd_link_order *link_order, bfd_byte *data, bfd_boolean relocatable, - asymbol **symbols)); + asymbol **symbols); /* Extracted from archures.c. */ extern const bfd_arch_info_type bfd_default_arch_struct; -bfd_boolean -bfd_default_set_arch_mach PARAMS ((bfd *abfd, - enum bfd_architecture arch, - unsigned long mach)); +bfd_boolean bfd_default_set_arch_mach + (bfd *abfd, enum bfd_architecture arch, unsigned long mach); -const bfd_arch_info_type * -bfd_default_compatible PARAMS ((const bfd_arch_info_type *a, - const bfd_arch_info_type *b)); +const bfd_arch_info_type *bfd_default_compatible + (const bfd_arch_info_type *a, const bfd_arch_info_type *b); -bfd_boolean -bfd_default_scan PARAMS ((const struct bfd_arch_info *info, const char *string)); +bfd_boolean bfd_default_scan + (const struct bfd_arch_info *info, const char *string); /* Extracted from elf.c. */ -struct elf_internal_shdr * -bfd_elf_find_section PARAMS ((bfd *abfd, char *name)); +struct elf_internal_shdr *bfd_elf_find_section (bfd *abfd, char *name); diff --git a/bfd/linker.c b/bfd/linker.c index 72f8bfd909d..b7c557608d6 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -406,34 +406,26 @@ SUBSUBSECTION file at the end of <<NAME(aout,final_link)>>. */ -static bfd_boolean generic_link_read_symbols - PARAMS ((bfd *)); -static bfd_boolean generic_link_add_symbols - PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean collect)); static bfd_boolean generic_link_add_object_symbols - PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean collect)); + (bfd *, struct bfd_link_info *, bfd_boolean collect); +static bfd_boolean generic_link_add_symbols + (bfd *, struct bfd_link_info *, bfd_boolean); static bfd_boolean generic_link_check_archive_element_no_collect - PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *pneeded)); + (bfd *, struct bfd_link_info *, bfd_boolean *); static bfd_boolean generic_link_check_archive_element_collect - PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *pneeded)); + (bfd *, struct bfd_link_info *, bfd_boolean *); static bfd_boolean generic_link_check_archive_element - PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *pneeded, - bfd_boolean collect)); + (bfd *, struct bfd_link_info *, bfd_boolean *, bfd_boolean); static bfd_boolean generic_link_add_symbol_list - PARAMS ((bfd *, struct bfd_link_info *, bfd_size_type count, asymbol **, - bfd_boolean collect)); -static bfd *hash_entry_bfd - PARAMS ((struct bfd_link_hash_entry *)); -static void set_symbol_from_hash - PARAMS ((asymbol *, struct bfd_link_hash_entry *)); + (bfd *, struct bfd_link_info *, bfd_size_type count, asymbol **, + bfd_boolean); static bfd_boolean generic_add_output_symbol - PARAMS ((bfd *, size_t *psymalloc, asymbol *)); + (bfd *, size_t *psymalloc, asymbol *); static bfd_boolean default_data_link_order - PARAMS ((bfd *, struct bfd_link_info *, asection *, - struct bfd_link_order *)); + (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *); static bfd_boolean default_indirect_link_order - PARAMS ((bfd *, struct bfd_link_info *, asection *, - struct bfd_link_order *, bfd_boolean)); + (bfd *, struct bfd_link_info *, asection *, struct bfd_link_order *, + bfd_boolean); /* The link hash table structure is defined in bfdlink.h. It provides a base hash table which the backend specific hash tables are built @@ -442,17 +434,15 @@ static bfd_boolean default_indirect_link_order /* Routine to create an entry in the link hash table. */ struct bfd_hash_entry * -_bfd_link_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; +_bfd_link_hash_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, + const char *string) { /* Allocate the structure if it has not already been allocated by a subclass. */ if (entry == NULL) { - entry = (struct bfd_hash_entry *) - bfd_hash_allocate (table, sizeof (struct bfd_link_hash_entry)); + entry = bfd_hash_allocate (table, sizeof (struct bfd_link_hash_entry)); if (entry == NULL) return entry; } @@ -475,12 +465,12 @@ _bfd_link_hash_newfunc (entry, table, string) responsible for creating this table. */ bfd_boolean -_bfd_link_hash_table_init (table, abfd, newfunc) - struct bfd_link_hash_table *table; - bfd *abfd; - struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *)); +_bfd_link_hash_table_init + (struct bfd_link_hash_table *table, + bfd *abfd, + struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *, + struct bfd_hash_table *, + const char *)) { table->creator = abfd->xvec; table->undefs = NULL; @@ -495,19 +485,18 @@ _bfd_link_hash_table_init (table, abfd, newfunc) the real symbol. */ struct bfd_link_hash_entry * -bfd_link_hash_lookup (table, string, create, copy, follow) - struct bfd_link_hash_table *table; - const char *string; - bfd_boolean create; - bfd_boolean copy; - bfd_boolean follow; +bfd_link_hash_lookup (struct bfd_link_hash_table *table, + const char *string, + bfd_boolean create, + bfd_boolean copy, + bfd_boolean follow) { struct bfd_link_hash_entry *ret; ret = ((struct bfd_link_hash_entry *) bfd_hash_lookup (&table->table, string, create, copy)); - if (follow && ret != (struct bfd_link_hash_entry *) NULL) + if (follow && ret != NULL) { while (ret->type == bfd_link_hash_indirect || ret->type == bfd_link_hash_warning) @@ -522,13 +511,12 @@ bfd_link_hash_lookup (table, string, create, copy, follow) undefined symbol, not for definitions of a symbol. */ struct bfd_link_hash_entry * -bfd_wrapped_link_hash_lookup (abfd, info, string, create, copy, follow) - bfd *abfd; - struct bfd_link_info *info; - const char *string; - bfd_boolean create; - bfd_boolean copy; - bfd_boolean follow; +bfd_wrapped_link_hash_lookup (bfd *abfd, + struct bfd_link_info *info, + const char *string, + bfd_boolean create, + bfd_boolean copy, + bfd_boolean follow) { bfd_size_type amt; @@ -552,7 +540,7 @@ bfd_wrapped_link_hash_lookup (abfd, info, string, create, copy, follow) references to SYM with references to __wrap_SYM. */ amt = strlen (l) + sizeof WRAP + 1; - n = (char *) bfd_malloc (amt); + n = bfd_malloc (amt); if (n == NULL) return NULL; @@ -584,7 +572,7 @@ bfd_wrapped_link_hash_lookup (abfd, info, string, create, copy, follow) with references to SYM. */ amt = strlen (l + sizeof REAL - 1) + 2; - n = (char *) bfd_malloc (amt); + n = bfd_malloc (amt); if (n == NULL) return NULL; @@ -610,28 +598,26 @@ bfd_wrapped_link_hash_lookup (abfd, info, string, create, copy, follow) call. */ void -bfd_link_hash_traverse (table, func, info) - struct bfd_link_hash_table *table; - bfd_boolean (*func) PARAMS ((struct bfd_link_hash_entry *, PTR)); - PTR info; +bfd_link_hash_traverse + (struct bfd_link_hash_table *table, + bfd_boolean (*func) (struct bfd_link_hash_entry *, void *), + void *info) { bfd_hash_traverse (&table->table, - ((bfd_boolean (*) PARAMS ((struct bfd_hash_entry *, PTR))) - func), + (bfd_boolean (*) (struct bfd_hash_entry *, void *)) func, info); } /* Add a symbol to the linker hash table undefs list. */ -INLINE void -bfd_link_add_undef (table, h) - struct bfd_link_hash_table *table; - struct bfd_link_hash_entry *h; +void +bfd_link_add_undef (struct bfd_link_hash_table *table, + struct bfd_link_hash_entry *h) { BFD_ASSERT (h->next == NULL); - if (table->undefs_tail != (struct bfd_link_hash_entry *) NULL) + if (table->undefs_tail != NULL) table->undefs_tail->next = h; - if (table->undefs == (struct bfd_link_hash_entry *) NULL) + if (table->undefs == NULL) table->undefs = h; table->undefs_tail = h; } @@ -639,16 +625,15 @@ bfd_link_add_undef (table, h) /* Routine to create an entry in a generic link hash table. */ struct bfd_hash_entry * -_bfd_generic_link_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; +_bfd_generic_link_hash_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, + const char *string) { /* Allocate the structure if it has not already been allocated by a subclass. */ if (entry == NULL) { - entry = (struct bfd_hash_entry *) + entry = bfd_hash_allocate (table, sizeof (struct generic_link_hash_entry)); if (entry == NULL) return entry; @@ -672,27 +657,25 @@ _bfd_generic_link_hash_newfunc (entry, table, string) /* Create a generic link hash table. */ struct bfd_link_hash_table * -_bfd_generic_link_hash_table_create (abfd) - bfd *abfd; +_bfd_generic_link_hash_table_create (bfd *abfd) { struct generic_link_hash_table *ret; bfd_size_type amt = sizeof (struct generic_link_hash_table); - ret = (struct generic_link_hash_table *) bfd_malloc (amt); + ret = bfd_malloc (amt); if (ret == NULL) - return (struct bfd_link_hash_table *) NULL; + return NULL; if (! _bfd_link_hash_table_init (&ret->root, abfd, _bfd_generic_link_hash_newfunc)) { free (ret); - return (struct bfd_link_hash_table *) NULL; + return NULL; } return &ret->root; } void -_bfd_generic_link_hash_table_free (hash) - struct bfd_link_hash_table *hash; +_bfd_generic_link_hash_table_free (struct bfd_link_hash_table *hash) { struct generic_link_hash_table *ret = (struct generic_link_hash_table *) hash; @@ -709,10 +692,9 @@ _bfd_generic_link_hash_table_free (hash) structure. */ static bfd_boolean -generic_link_read_symbols (abfd) - bfd *abfd; +generic_link_read_symbols (bfd *abfd) { - if (bfd_get_outsymbols (abfd) == (asymbol **) NULL) + if (bfd_get_outsymbols (abfd) == NULL) { long symsize; long symcount; @@ -720,8 +702,7 @@ generic_link_read_symbols (abfd) symsize = bfd_get_symtab_upper_bound (abfd); if (symsize < 0) return FALSE; - bfd_get_outsymbols (abfd) = - (asymbol **) bfd_alloc (abfd, (bfd_size_type) symsize); + bfd_get_outsymbols (abfd) = bfd_alloc (abfd, symsize); if (bfd_get_outsymbols (abfd) == NULL && symsize != 0) return FALSE; symcount = bfd_canonicalize_symtab (abfd, bfd_get_outsymbols (abfd)); @@ -738,9 +719,7 @@ generic_link_read_symbols (abfd) constructors by name. */ bfd_boolean -_bfd_generic_link_add_symbols (abfd, info) - bfd *abfd; - struct bfd_link_info *info; +_bfd_generic_link_add_symbols (bfd *abfd, struct bfd_link_info *info) { return generic_link_add_symbols (abfd, info, FALSE); } @@ -753,9 +732,7 @@ _bfd_generic_link_add_symbols (abfd, info) for which gcc uses collect2 and do not support stabs. */ bfd_boolean -_bfd_generic_link_add_symbols_collect (abfd, info) - bfd *abfd; - struct bfd_link_info *info; +_bfd_generic_link_add_symbols_collect (bfd *abfd, struct bfd_link_info *info) { return generic_link_add_symbols (abfd, info, TRUE); } @@ -765,9 +742,8 @@ _bfd_generic_link_add_symbols_collect (abfd, info) file are absolute. */ void -_bfd_generic_link_just_syms (sec, info) - asection *sec; - struct bfd_link_info *info ATTRIBUTE_UNUSED; +_bfd_generic_link_just_syms (asection *sec, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { sec->output_section = bfd_abs_section_ptr; sec->output_offset = sec->vma; @@ -776,10 +752,9 @@ _bfd_generic_link_just_syms (sec, info) /* Add symbols from an object file to the global hash table. */ static bfd_boolean -generic_link_add_symbols (abfd, info, collect) - bfd *abfd; - struct bfd_link_info *info; - bfd_boolean collect; +generic_link_add_symbols (bfd *abfd, + struct bfd_link_info *info, + bfd_boolean collect) { bfd_boolean ret; @@ -806,10 +781,9 @@ generic_link_add_symbols (abfd, info, collect) /* Add symbols from an object file to the global hash table. */ static bfd_boolean -generic_link_add_object_symbols (abfd, info, collect) - bfd *abfd; - struct bfd_link_info *info; - bfd_boolean collect; +generic_link_add_object_symbols (bfd *abfd, + struct bfd_link_info *info, + bfd_boolean collect) { bfd_size_type symcount; struct symbol_cache_entry **outsyms; @@ -848,30 +822,20 @@ struct archive_hash_table struct bfd_hash_table table; }; -static struct bfd_hash_entry *archive_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); -static bfd_boolean archive_hash_table_init - PARAMS ((struct archive_hash_table *, - struct bfd_hash_entry *(*) (struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *))); - /* Create a new entry for an archive hash table. */ static struct bfd_hash_entry * -archive_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; +archive_hash_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, + const char *string) { struct archive_hash_entry *ret = (struct archive_hash_entry *) entry; /* Allocate the structure if it has not already been allocated by a subclass. */ - if (ret == (struct archive_hash_entry *) NULL) - ret = ((struct archive_hash_entry *) - bfd_hash_allocate (table, sizeof (struct archive_hash_entry))); - if (ret == (struct archive_hash_entry *) NULL) + if (ret == NULL) + ret = bfd_hash_allocate (table, sizeof (struct archive_hash_entry)); + if (ret == NULL) return NULL; /* Call the allocation method of the superclass. */ @@ -881,20 +845,20 @@ archive_hash_newfunc (entry, table, string) if (ret) { /* Initialize the local fields. */ - ret->defs = (struct archive_list *) NULL; + ret->defs = NULL; } - return (struct bfd_hash_entry *) ret; + return &ret->root; } /* Initialize an archive hash table. */ static bfd_boolean -archive_hash_table_init (table, newfunc) - struct archive_hash_table *table; - struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *)); +archive_hash_table_init + (struct archive_hash_table *table, + struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *, + struct bfd_hash_table *, + const char *)) { return bfd_hash_table_init (&table->table, newfunc); } @@ -947,11 +911,10 @@ archive_hash_table_init (table, newfunc) object file to be included. */ bfd_boolean -_bfd_generic_link_add_archive_symbols (abfd, info, checkfn) - bfd *abfd; - struct bfd_link_info *info; - bfd_boolean (*checkfn) - PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *pneeded)); +_bfd_generic_link_add_archive_symbols + (bfd *abfd, + struct bfd_link_info *info, + bfd_boolean (*checkfn) (bfd *, struct bfd_link_info *, bfd_boolean *)) { carsym *arsyms; carsym *arsym_end; @@ -964,7 +927,7 @@ _bfd_generic_link_add_archive_symbols (abfd, info, checkfn) if (! bfd_has_map (abfd)) { /* An empty archive is a special case. */ - if (bfd_openr_next_archived_file (abfd, (bfd *) NULL) == NULL) + if (bfd_openr_next_archived_file (abfd, NULL) == NULL) return TRUE; bfd_set_error (bfd_error_no_armap); return FALSE; @@ -983,16 +946,14 @@ _bfd_generic_link_add_archive_symbols (abfd, info, checkfn) struct archive_list *l, **pp; arh = archive_hash_lookup (&arsym_hash, arsym->name, TRUE, FALSE); - if (arh == (struct archive_hash_entry *) NULL) + if (arh == NULL) goto error_return; l = ((struct archive_list *) archive_hash_allocate (&arsym_hash, sizeof (struct archive_list))); if (l == NULL) goto error_return; l->indx = indx; - for (pp = &arh->defs; - *pp != (struct archive_list *) NULL; - pp = &(*pp)->next) + for (pp = &arh->defs; *pp != NULL; pp = &(*pp)->next) ; *pp = l; l->next = NULL; @@ -1006,7 +967,7 @@ _bfd_generic_link_add_archive_symbols (abfd, info, checkfn) /* New undefined symbols are added to the end of the list, so we only need to look through it once. */ pundef = &info->hash->undefs; - while (*pundef != (struct bfd_link_hash_entry *) NULL) + while (*pundef != NULL) { struct bfd_link_hash_entry *h; struct archive_hash_entry *arh; @@ -1035,14 +996,14 @@ _bfd_generic_link_add_archive_symbols (abfd, info, checkfn) /* Look for this symbol in the archive symbol map. */ arh = archive_hash_lookup (&arsym_hash, h->root.string, FALSE, FALSE); - if (arh == (struct archive_hash_entry *) NULL) + if (arh == NULL) { /* If we haven't found the exact symbol we're looking for, let's look for its import thunk */ if (info->pei386_auto_import) { bfd_size_type amt = strlen (h->root.string) + 10; - char *buf = (char *) bfd_malloc (amt); + char *buf = bfd_malloc (amt); if (buf == NULL) return FALSE; @@ -1050,14 +1011,14 @@ _bfd_generic_link_add_archive_symbols (abfd, info, checkfn) arh = archive_hash_lookup (&arsym_hash, buf, FALSE, FALSE); free(buf); } - if (arh == (struct archive_hash_entry *) NULL) + if (arh == NULL) { pundef = &(*pundef)->next; continue; } } /* Look at all the objects which define this symbol. */ - for (l = arh->defs; l != (struct archive_list *) NULL; l = l->next) + for (l = arh->defs; l != NULL; l = l->next) { bfd *element; bfd_boolean needed; @@ -1068,7 +1029,7 @@ _bfd_generic_link_add_archive_symbols (abfd, info, checkfn) break; element = bfd_get_elt_at_index (abfd, l->indx); - if (element == (bfd *) NULL) + if (element == NULL) goto error_return; /* If we've already included this element, or if we've @@ -1122,10 +1083,10 @@ _bfd_generic_link_add_archive_symbols (abfd, info, checkfn) for finding them. */ static bfd_boolean -generic_link_check_archive_element_no_collect (abfd, info, pneeded) - bfd *abfd; - struct bfd_link_info *info; - bfd_boolean *pneeded; +generic_link_check_archive_element_no_collect ( + bfd *abfd, + struct bfd_link_info *info, + bfd_boolean *pneeded) { return generic_link_check_archive_element (abfd, info, pneeded, FALSE); } @@ -1135,10 +1096,9 @@ generic_link_check_archive_element_no_collect (abfd, info, pneeded) symbol name, as collect2 does. */ static bfd_boolean -generic_link_check_archive_element_collect (abfd, info, pneeded) - bfd *abfd; - struct bfd_link_info *info; - bfd_boolean *pneeded; +generic_link_check_archive_element_collect (bfd *abfd, + struct bfd_link_info *info, + bfd_boolean *pneeded) { return generic_link_check_archive_element (abfd, info, pneeded, TRUE); } @@ -1147,11 +1107,10 @@ generic_link_check_archive_element_collect (abfd, info, pneeded) constructors. */ static bfd_boolean -generic_link_check_archive_element (abfd, info, pneeded, collect) - bfd *abfd; - struct bfd_link_info *info; - bfd_boolean *pneeded; - bfd_boolean collect; +generic_link_check_archive_element (bfd *abfd, + struct bfd_link_info *info, + bfd_boolean *pneeded, + bfd_boolean collect) { asymbol **pp, **ppend; @@ -1181,7 +1140,7 @@ generic_link_check_archive_element (abfd, info, pneeded, collect) SVR4 ABI, p. 4-27. */ h = bfd_link_hash_lookup (info->hash, bfd_asymbol_name (p), FALSE, FALSE, TRUE); - if (h == (struct bfd_link_hash_entry *) NULL + if (h == NULL || (h->type != bfd_link_hash_undefined && h->type != bfd_link_hash_common)) continue; @@ -1215,7 +1174,7 @@ generic_link_check_archive_element (abfd, info, pneeded, collect) unsigned int power; symbfd = h->u.undef.abfd; - if (symbfd == (bfd *) NULL) + if (symbfd == NULL) { /* This symbol was created as undefined from outside BFD. We assume that we should link in the object @@ -1236,9 +1195,8 @@ generic_link_check_archive_element (abfd, info, pneeded, collect) will be linked in. */ h->type = bfd_link_hash_common; h->u.c.p = - ((struct bfd_link_hash_common_entry *) - bfd_hash_allocate (&info->hash->table, - sizeof (struct bfd_link_hash_common_entry))); + bfd_hash_allocate (&info->hash->table, + sizeof (struct bfd_link_hash_common_entry)); if (h->u.c.p == NULL) return FALSE; @@ -1279,12 +1237,11 @@ generic_link_check_archive_element (abfd, info, pneeded, collect) as is done by collect2. */ static bfd_boolean -generic_link_add_symbol_list (abfd, info, symbol_count, symbols, collect) - bfd *abfd; - struct bfd_link_info *info; - bfd_size_type symbol_count; - asymbol **symbols; - bfd_boolean collect; +generic_link_add_symbol_list (bfd *abfd, + struct bfd_link_info *info, + bfd_size_type symbol_count, + asymbol **symbols, + bfd_boolean collect) { asymbol **pp, **ppend; @@ -1358,7 +1315,7 @@ generic_link_add_symbol_list (abfd, info, symbol_count, symbols, collect) generic one. */ if (info->hash->creator == abfd->xvec) { - if (h->sym == (asymbol *) NULL + if (h->sym == NULL || (! bfd_is_und_section (bfd_get_section (p)) && (! bfd_is_com_section (bfd_get_section (p)) || bfd_is_und_section (bfd_get_section (h->sym))))) @@ -1377,7 +1334,7 @@ generic_link_add_symbol_list (abfd, info, symbol_count, symbols, collect) it gets rewritten to not use asymbol structures. Setting this is also used to check whether these symbols were set up by the generic linker. */ - p->udata.p = (PTR) h; + p->udata.p = h; } } @@ -1477,8 +1434,7 @@ static const enum link_action link_action[8][8] = /* Return the BFD in which a hash entry has been defined, if known. */ static bfd * -hash_entry_bfd (h) - struct bfd_link_hash_entry *h; +hash_entry_bfd (struct bfd_link_hash_entry *h) { while (h->type == bfd_link_hash_warning) h = h->u.i.link; @@ -1517,18 +1473,16 @@ hash_entry_bfd (h) the hash table entry, and stored it in *HASHP. */ bfd_boolean -_bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value, - string, copy, collect, hashp) - struct bfd_link_info *info; - bfd *abfd; - const char *name; - flagword flags; - asection *section; - bfd_vma value; - const char *string; - bfd_boolean copy; - bfd_boolean collect; - struct bfd_link_hash_entry **hashp; +_bfd_generic_link_add_one_symbol (struct bfd_link_info *info, + bfd *abfd, + const char *name, + flagword flags, + asection *section, + bfd_vma value, + const char *string, + bfd_boolean copy, + bfd_boolean collect, + struct bfd_link_hash_entry **hashp) { enum link_row row; struct bfd_link_hash_entry *h; @@ -1572,16 +1526,15 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value, } if (info->notice_all - || (info->notice_hash != (struct bfd_hash_table *) NULL - && (bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE) - != (struct bfd_hash_entry *) NULL))) + || (info->notice_hash != NULL + && bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE) != NULL)) { if (! (*info->callbacks->notice) (info, h->root.string, abfd, section, value)) return FALSE; } - if (hashp != (struct bfd_link_hash_entry **) NULL) + if (hashp != NULL) *hashp = h; do @@ -1619,7 +1572,7 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value, if (! ((*info->callbacks->multiple_common) (info, h->root.string, h->u.c.p->section->owner, bfd_link_hash_common, h->u.c.size, - abfd, bfd_link_hash_defined, (bfd_vma) 0))) + abfd, bfd_link_hash_defined, 0))) return FALSE; /* Fall through. */ case DEF: @@ -1694,9 +1647,8 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value, bfd_link_add_undef (info->hash, h); h->type = bfd_link_hash_common; h->u.c.p = - ((struct bfd_link_hash_common_entry *) - bfd_hash_allocate (&info->hash->table, - sizeof (struct bfd_link_hash_common_entry))); + bfd_hash_allocate (&info->hash->table, + sizeof (struct bfd_link_hash_common_entry)); if (h->u.c.p == NULL) return FALSE; @@ -1802,7 +1754,7 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value, else obfd = NULL; if (! ((*info->callbacks->multiple_common) - (info, h->root.string, obfd, h->type, (bfd_vma) 0, + (info, h->root.string, obfd, h->type, 0, abfd, bfd_link_hash_common, value))) return FALSE; } @@ -1856,7 +1808,7 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value, if (! ((*info->callbacks->multiple_common) (info, h->root.string, h->u.c.p->section->owner, bfd_link_hash_common, h->u.c.size, - abfd, bfd_link_hash_indirect, (bfd_vma) 0))) + abfd, bfd_link_hash_indirect, 0))) return FALSE; /* Fall through. */ case IND: @@ -1868,7 +1820,7 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value, to. */ inh = bfd_wrapped_link_hash_lookup (abfd, info, string, TRUE, copy, FALSE); - if (inh == (struct bfd_link_hash_entry *) NULL) + if (inh == NULL) return FALSE; if (inh->type == bfd_link_hash_indirect && inh->u.i.link == h) @@ -1913,8 +1865,7 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value, { if (! (*info->callbacks->warning) (info, h->u.i.warning, h->root.string, abfd, - (asection *) NULL, - (bfd_vma) 0)) + NULL, 0)) return FALSE; /* Only issue a warning once. */ h->u.i.warning = NULL; @@ -1937,8 +1888,7 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value, case WARN: /* Issue a warning. */ if (! (*info->callbacks->warning) (info, string, h->root.string, - hash_entry_bfd (h), - (asection *) NULL, (bfd_vma) 0)) + hash_entry_bfd (h), NULL, 0)) return FALSE; break; @@ -1951,9 +1901,7 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value, if (h->next != NULL || info->hash->undefs_tail == h) { if (! (*info->callbacks->warning) (info, string, h->root.string, - hash_entry_bfd (h), - (asection *) NULL, - (bfd_vma) 0)) + hash_entry_bfd (h), NULL, 0)) return FALSE; break; } @@ -1966,8 +1914,7 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value, /* STRING is the warning to give. */ sub = ((struct bfd_link_hash_entry *) ((*info->hash->table.newfunc) - ((struct bfd_hash_entry *) NULL, &info->hash->table, - h->root.string))); + (NULL, &info->hash->table, h->root.string))); if (sub == NULL) return FALSE; *sub = *h; @@ -2004,9 +1951,7 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value, /* Generic final link routine. */ bfd_boolean -_bfd_generic_final_link (abfd, info) - bfd *abfd; - struct bfd_link_info *info; +_bfd_generic_final_link (bfd *abfd, struct bfd_link_info *info) { bfd *sub; asection *o; @@ -2014,7 +1959,7 @@ _bfd_generic_final_link (abfd, info) size_t outsymalloc; struct generic_write_global_symbol_info wginfo; - bfd_get_outsymbols (abfd) = (asymbol **) NULL; + bfd_get_outsymbols (abfd) = NULL; bfd_get_symcount (abfd) = 0; outsymalloc = 0; @@ -2025,7 +1970,7 @@ _bfd_generic_final_link (abfd, info) p->u.indirect.section->linker_mark = TRUE; /* Build the output symbol table. */ - for (sub = info->input_bfds; sub != (bfd *) NULL; sub = sub->link_next) + for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) if (! _bfd_generic_link_output_symbols (abfd, sub, info, &outsymalloc)) return FALSE; @@ -2035,7 +1980,7 @@ _bfd_generic_final_link (abfd, info) wginfo.psymalloc = &outsymalloc; _bfd_generic_link_hash_traverse (_bfd_generic_hash_table (info), _bfd_generic_link_write_global_symbol, - (PTR) &wginfo); + &wginfo); /* Make sure we have a trailing NULL pointer on OUTSYMBOLS. We shouldn't really need one, since we have SYMCOUNT, but some old @@ -2046,14 +1991,10 @@ _bfd_generic_final_link (abfd, info) if (info->relocatable) { /* Allocate space for the output relocs for each section. */ - for (o = abfd->sections; - o != (asection *) NULL; - o = o->next) + for (o = abfd->sections; o != NULL; o = o->next) { o->reloc_count = 0; - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) + for (p = o->link_order_head; p != NULL; p = p->next) { if (p->type == bfd_section_reloc_link_order || p->type == bfd_symbol_reloc_link_order) @@ -2073,7 +2014,7 @@ _bfd_generic_final_link (abfd, info) input_section); if (relsize < 0) return FALSE; - relocs = (arelent **) bfd_malloc ((bfd_size_type) relsize); + relocs = bfd_malloc (relsize); if (!relocs && relsize != 0) return FALSE; symbols = _bfd_generic_link_get_symbols (input_bfd); @@ -2095,7 +2036,7 @@ _bfd_generic_final_link (abfd, info) amt = o->reloc_count; amt *= sizeof (arelent *); - o->orelocation = (arelent **) bfd_alloc (abfd, amt); + o->orelocation = bfd_alloc (abfd, amt); if (!o->orelocation) return FALSE; o->flags |= SEC_RELOC; @@ -2107,13 +2048,9 @@ _bfd_generic_final_link (abfd, info) } /* Handle all the link order information for the sections. */ - for (o = abfd->sections; - o != (asection *) NULL; - o = o->next) + for (o = abfd->sections; o != NULL; o = o->next) { - for (p = o->link_order_head; - p != (struct bfd_link_order *) NULL; - p = p->next) + for (p = o->link_order_head; p != NULL; p = p->next) { switch (p->type) { @@ -2140,10 +2077,7 @@ _bfd_generic_final_link (abfd, info) /* Add an output symbol to the output BFD. */ static bfd_boolean -generic_add_output_symbol (output_bfd, psymalloc, sym) - bfd *output_bfd; - size_t *psymalloc; - asymbol *sym; +generic_add_output_symbol (bfd *output_bfd, size_t *psymalloc, asymbol *sym) { if (bfd_get_symcount (output_bfd) >= *psymalloc) { @@ -2156,8 +2090,8 @@ generic_add_output_symbol (output_bfd, psymalloc, sym) *psymalloc *= 2; amt = *psymalloc; amt *= sizeof (asymbol *); - newsyms = (asymbol **) bfd_realloc (bfd_get_outsymbols (output_bfd), amt); - if (newsyms == (asymbol **) NULL) + newsyms = bfd_realloc (bfd_get_outsymbols (output_bfd), amt); + if (newsyms == NULL) return FALSE; bfd_get_outsymbols (output_bfd) = newsyms; } @@ -2172,11 +2106,10 @@ generic_add_output_symbol (output_bfd, psymalloc, sym) /* Handle the symbols for an input BFD. */ bfd_boolean -_bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc) - bfd *output_bfd; - bfd *input_bfd; - struct bfd_link_info *info; - size_t *psymalloc; +_bfd_generic_link_output_symbols (bfd *output_bfd, + bfd *input_bfd, + struct bfd_link_info *info, + size_t *psymalloc) { asymbol **sym_ptr; asymbol **sym_end; @@ -2185,13 +2118,11 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc) return FALSE; /* Create a filename symbol if we are supposed to. */ - if (info->create_object_symbols_section != (asection *) NULL) + if (info->create_object_symbols_section != NULL) { asection *sec; - for (sec = input_bfd->sections; - sec != (asection *) NULL; - sec = sec->next) + for (sec = input_bfd->sections; sec != NULL; sec = sec->next) { if (sec->output_section == info->create_object_symbols_section) { @@ -2224,7 +2155,7 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc) struct generic_link_hash_entry *h; bfd_boolean output; - h = (struct generic_link_hash_entry *) NULL; + h = NULL; sym = *sym_ptr; if ((sym->flags & (BSF_INDIRECT | BSF_WARNING @@ -2236,7 +2167,7 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc) || bfd_is_ind_section (bfd_get_section (sym))) { if (sym->udata.p != NULL) - h = (struct generic_link_hash_entry *) sym->udata.p; + h = sym->udata.p; else if ((sym->flags & BSF_CONSTRUCTOR) != 0) { /* This case normally means that the main linker code @@ -2259,7 +2190,7 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc) bfd_asymbol_name (sym), FALSE, FALSE, TRUE); - if (h != (struct generic_link_hash_entry *) NULL) + if (h != NULL) { /* Force all references to this symbol to point to the same area in memory. It is possible that @@ -2268,7 +2199,7 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc) check that. */ if (info->hash->creator == input_bfd->xvec) { - if (h->sym != (asymbol *) NULL) + if (h->sym != NULL) *sym_ptr = sym = h->sym; } @@ -2320,9 +2251,8 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc) write_file_locals in ldsym.c. */ if (info->strip == strip_all || (info->strip == strip_some - && (bfd_hash_lookup (info->keep_hash, bfd_asymbol_name (sym), - FALSE, FALSE) - == (struct bfd_hash_entry *) NULL))) + && bfd_hash_lookup (info->keep_hash, bfd_asymbol_name (sym), + FALSE, FALSE) == NULL)) output = FALSE; else if ((sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0) { @@ -2401,7 +2331,7 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc) { if (! generic_add_output_symbol (output_bfd, psymalloc, sym)) return FALSE; - if (h != (struct generic_link_hash_entry *) NULL) + if (h != NULL) h->written = TRUE; } } @@ -2413,9 +2343,7 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc) hash table entry. */ static void -set_symbol_from_hash (sym, h) - asymbol *sym; - struct bfd_link_hash_entry *h; +set_symbol_from_hash (asymbol *sym, struct bfd_link_hash_entry *h) { switch (h->type) { @@ -2476,12 +2404,10 @@ set_symbol_from_hash (sym, h) This is called for each symbol in the hash table. */ bfd_boolean -_bfd_generic_link_write_global_symbol (h, data) - struct generic_link_hash_entry *h; - PTR data; +_bfd_generic_link_write_global_symbol (struct generic_link_hash_entry *h, + void *data) { - struct generic_write_global_symbol_info *wginfo = - (struct generic_write_global_symbol_info *) data; + struct generic_write_global_symbol_info *wginfo = data; asymbol *sym; if (h->root.type == bfd_link_hash_warning) @@ -2498,7 +2424,7 @@ _bfd_generic_link_write_global_symbol (h, data) FALSE, FALSE) == NULL)) return TRUE; - if (h->sym != (asymbol *) NULL) + if (h->sym != NULL) sym = h->sym; else { @@ -2526,21 +2452,20 @@ _bfd_generic_link_write_global_symbol (h, data) /* Create a relocation. */ bfd_boolean -_bfd_generic_reloc_link_order (abfd, info, sec, link_order) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - struct bfd_link_order *link_order; +_bfd_generic_reloc_link_order (bfd *abfd, + struct bfd_link_info *info, + asection *sec, + struct bfd_link_order *link_order) { arelent *r; if (! info->relocatable) abort (); - if (sec->orelocation == (arelent **) NULL) + if (sec->orelocation == NULL) abort (); - r = (arelent *) bfd_alloc (abfd, (bfd_size_type) sizeof (arelent)); - if (r == (arelent *) NULL) + r = bfd_alloc (abfd, sizeof (arelent)); + if (r == NULL) return FALSE; r->address = link_order->offset; @@ -2562,12 +2487,11 @@ _bfd_generic_reloc_link_order (abfd, info, sec, link_order) bfd_wrapped_link_hash_lookup (abfd, info, link_order->u.reloc.p->u.name, FALSE, FALSE, TRUE)); - if (h == (struct generic_link_hash_entry *) NULL + if (h == NULL || ! h->written) { if (! ((*info->callbacks->unattached_reloc) - (info, link_order->u.reloc.p->u.name, - (bfd *) NULL, (asection *) NULL, (bfd_vma) 0))) + (info, link_order->u.reloc.p->u.name, NULL, NULL, 0))) return FALSE; bfd_set_error (bfd_error_bad_value); return FALSE; @@ -2588,8 +2512,8 @@ _bfd_generic_reloc_link_order (abfd, info, sec, link_order) file_ptr loc; size = bfd_get_reloc_size (r->howto); - buf = (bfd_byte *) bfd_zmalloc (size); - if (buf == (bfd_byte *) NULL) + buf = bfd_zmalloc (size); + if (buf == NULL) return FALSE; rstat = _bfd_relocate_contents (r->howto, abfd, (bfd_vma) link_order->u.reloc.p->addend, @@ -2608,7 +2532,7 @@ _bfd_generic_reloc_link_order (abfd, info, sec, link_order) ? bfd_section_name (abfd, link_order->u.reloc.p->u.section) : link_order->u.reloc.p->u.name), r->howto->name, link_order->u.reloc.p->addend, - (bfd *) NULL, (asection *) NULL, (bfd_vma) 0))) + NULL, NULL, 0))) { free (buf); return FALSE; @@ -2616,8 +2540,7 @@ _bfd_generic_reloc_link_order (abfd, info, sec, link_order) break; } loc = link_order->offset * bfd_octets_per_byte (abfd); - ok = bfd_set_section_contents (abfd, sec, (PTR) buf, loc, - (bfd_size_type) size); + ok = bfd_set_section_contents (abfd, sec, buf, loc, size); free (buf); if (! ok) return FALSE; @@ -2634,20 +2557,18 @@ _bfd_generic_reloc_link_order (abfd, info, sec, link_order) /* Allocate a new link_order for a section. */ struct bfd_link_order * -bfd_new_link_order (abfd, section) - bfd *abfd; - asection *section; +bfd_new_link_order (bfd *abfd, asection *section) { bfd_size_type amt = sizeof (struct bfd_link_order); struct bfd_link_order *new; - new = (struct bfd_link_order *) bfd_zalloc (abfd, amt); + new = bfd_zalloc (abfd, amt); if (!new) return NULL; new->type = bfd_undefined_link_order; - if (section->link_order_tail != (struct bfd_link_order *) NULL) + if (section->link_order_tail != NULL) section->link_order_tail->next = new; else section->link_order_head = new; @@ -2661,11 +2582,10 @@ bfd_new_link_order (abfd, section) of how the particular backends generates relocs. */ bfd_boolean -_bfd_default_link_order (abfd, info, sec, link_order) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - struct bfd_link_order *link_order; +_bfd_default_link_order (bfd *abfd, + struct bfd_link_info *info, + asection *sec, + struct bfd_link_order *link_order) { switch (link_order->type) { @@ -2685,11 +2605,10 @@ _bfd_default_link_order (abfd, info, sec, link_order) /* Default routine to handle a bfd_data_link_order. */ static bfd_boolean -default_data_link_order (abfd, info, sec, link_order) - bfd *abfd; - struct bfd_link_info *info ATTRIBUTE_UNUSED; - asection *sec; - struct bfd_link_order *link_order; +default_data_link_order (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + asection *sec, + struct bfd_link_order *link_order) { bfd_size_type size; size_t fill_size; @@ -2708,7 +2627,7 @@ default_data_link_order (abfd, info, sec, link_order) if (fill_size != 0 && fill_size < size) { bfd_byte *p; - fill = (bfd_byte *) bfd_malloc (size); + fill = bfd_malloc (size); if (fill == NULL) return FALSE; p = fill; @@ -2740,13 +2659,11 @@ default_data_link_order (abfd, info, sec, link_order) /* Default routine to handle a bfd_indirect_link_order. */ static bfd_boolean -default_indirect_link_order (output_bfd, info, output_section, link_order, - generic_linker) - bfd *output_bfd; - struct bfd_link_info *info; - asection *output_section; - struct bfd_link_order *link_order; - bfd_boolean generic_linker; +default_indirect_link_order (bfd *output_bfd, + struct bfd_link_info *info, + asection *output_section, + struct bfd_link_order *link_order, + bfd_boolean generic_linker) { asection *input_section; bfd *input_bfd; @@ -2769,7 +2686,7 @@ default_indirect_link_order (output_bfd, info, output_section, link_order, if (info->relocatable && input_section->reloc_count > 0 - && output_section->orelocation == (arelent **) NULL) + && output_section->orelocation == NULL) { /* Space has not been allocated for the output relocations. This can happen when we are called by a specific backend @@ -2821,7 +2738,7 @@ default_indirect_link_order (output_bfd, info, output_section, link_order, /* sym->udata may have been set by generic_link_add_symbol_list. */ if (sym->udata.p != NULL) - h = (struct bfd_link_hash_entry *) sym->udata.p; + h = sym->udata.p; else if (bfd_is_und_section (bfd_get_section (sym))) h = bfd_wrapped_link_hash_lookup (output_bfd, info, bfd_asymbol_name (sym), @@ -2838,7 +2755,7 @@ default_indirect_link_order (output_bfd, info, output_section, link_order, /* Get and relocate the section contents. */ sec_size = bfd_section_size (input_bfd, input_section); - contents = ((bfd_byte *) bfd_malloc (sec_size)); + contents = bfd_malloc (sec_size); if (contents == NULL && sec_size != 0) goto error_return; new_contents = (bfd_get_relocated_section_contents @@ -2850,7 +2767,7 @@ default_indirect_link_order (output_bfd, info, output_section, link_order, /* Output the section contents. */ loc = link_order->offset * bfd_octets_per_byte (output_bfd); if (! bfd_set_section_contents (output_bfd, output_section, - (PTR) new_contents, loc, link_order->size)) + new_contents, loc, link_order->size)) goto error_return; if (contents != NULL) @@ -2867,14 +2784,13 @@ default_indirect_link_order (output_bfd, info, output_section, link_order, list. */ unsigned int -_bfd_count_link_order_relocs (link_order) - struct bfd_link_order *link_order; +_bfd_count_link_order_relocs (struct bfd_link_order *link_order) { register unsigned int c; register struct bfd_link_order *l; c = 0; - for (l = link_order; l != (struct bfd_link_order *) NULL; l = l->next) + for (l = link_order; l != NULL; l = l->next) { if (l->type == bfd_section_reloc_link_order || l->type == bfd_symbol_reloc_link_order) @@ -2889,7 +2805,7 @@ FUNCTION bfd_link_split_section SYNOPSIS - bfd_boolean bfd_link_split_section(bfd *abfd, asection *sec); + bfd_boolean bfd_link_split_section (bfd *abfd, asection *sec); DESCRIPTION Return nonzero if @var{sec} should be split during a @@ -2902,9 +2818,8 @@ DESCRIPTION */ bfd_boolean -_bfd_generic_link_split_section (abfd, sec) - bfd *abfd ATTRIBUTE_UNUSED; - asection *sec ATTRIBUTE_UNUSED; +_bfd_generic_link_split_section (bfd *abfd ATTRIBUTE_UNUSED, + asection *sec ATTRIBUTE_UNUSED) { return FALSE; } diff --git a/bfd/opncls.c b/bfd/opncls.c index 5237190d97c..086775bde5b 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -47,17 +47,17 @@ static unsigned int _bfd_id_counter = 0; /* Return a new BFD. All BFD's are allocated through this routine. */ bfd * -_bfd_new_bfd () +_bfd_new_bfd (void) { bfd *nbfd; - nbfd = (bfd *) bfd_zmalloc ((bfd_size_type) sizeof (bfd)); + nbfd = bfd_zmalloc (sizeof (bfd)); if (nbfd == NULL) return NULL; nbfd->id = _bfd_id_counter++; - nbfd->memory = (PTR) objalloc_create (); + nbfd->memory = objalloc_create (); if (nbfd->memory == NULL) { bfd_set_error (bfd_error_no_memory); @@ -77,15 +77,15 @@ _bfd_new_bfd () free (nbfd); return NULL; } - nbfd->sections = (asection *) NULL; + nbfd->sections = NULL; nbfd->section_tail = &nbfd->sections; nbfd->format = bfd_unknown; - nbfd->my_archive = (bfd *) NULL; + nbfd->my_archive = NULL; nbfd->origin = 0; nbfd->opened_once = FALSE; nbfd->output_has_begun = FALSE; nbfd->section_count = 0; - nbfd->usrdata = (PTR) NULL; + nbfd->usrdata = NULL; nbfd->cacheable = FALSE; nbfd->flags = BFD_NO_FLAGS; nbfd->mtime_set = FALSE; @@ -96,8 +96,7 @@ _bfd_new_bfd () /* Allocate a new BFD as a member of archive OBFD. */ bfd * -_bfd_new_bfd_contained_in (obfd) - bfd *obfd; +_bfd_new_bfd_contained_in (bfd *obfd) { bfd *nbfd; @@ -114,8 +113,7 @@ _bfd_new_bfd_contained_in (obfd) /* Delete a BFD. */ void -_bfd_delete_bfd (abfd) - bfd *abfd; +_bfd_delete_bfd (bfd *abfd) { bfd_hash_table_free (&abfd->section_htab); objalloc_free ((struct objalloc *) abfd->memory); @@ -133,7 +131,7 @@ FUNCTION bfd_openr SYNOPSIS - bfd *bfd_openr(const char *filename, const char *target); + bfd *bfd_openr (const char *filename, const char *target); DESCRIPTION Open the file @var{filename} (using <<fopen>>) with the target @@ -148,9 +146,7 @@ DESCRIPTION */ bfd * -bfd_openr (filename, target) - const char *filename; - const char *target; +bfd_openr (const char *filename, const char *target) { bfd *nbfd; const bfd_target *target_vec; @@ -192,7 +188,7 @@ FUNCTION bfd_fdopenr SYNOPSIS - bfd *bfd_fdopenr(const char *filename, const char *target, int fd); + bfd *bfd_fdopenr (const char *filename, const char *target, int fd); DESCRIPTION <<bfd_fdopenr>> is to <<bfd_fopenr>> much like <<fdopen>> is to @@ -214,10 +210,7 @@ DESCRIPTION */ bfd * -bfd_fdopenr (filename, target, fd) - const char *filename; - const char *target; - int fd; +bfd_fdopenr (const char *filename, const char *target, int fd) { bfd *nbfd; const bfd_target *target_vec; @@ -244,14 +237,14 @@ bfd_fdopenr (filename, target, fd) } #ifndef HAVE_FDOPEN - nbfd->iostream = (PTR) fopen (filename, FOPEN_RB); + nbfd->iostream = fopen (filename, FOPEN_RB); #else /* (O_ACCMODE) parens are to avoid Ultrix header file bug. */ switch (fdflags & (O_ACCMODE)) { - case O_RDONLY: nbfd->iostream = (PTR) fdopen (fd, FOPEN_RB); break; - case O_WRONLY: nbfd->iostream = (PTR) fdopen (fd, FOPEN_RUB); break; - case O_RDWR: nbfd->iostream = (PTR) fdopen (fd, FOPEN_RUB); break; + case O_RDONLY: nbfd->iostream = fdopen (fd, FOPEN_RB); break; + case O_WRONLY: nbfd->iostream = fdopen (fd, FOPEN_RUB); break; + case O_RDWR: nbfd->iostream = fdopen (fd, FOPEN_RUB); break; default: abort (); } #endif @@ -292,7 +285,7 @@ FUNCTION bfd_openstreamr SYNOPSIS - bfd *bfd_openstreamr(const char *, const char *, PTR); + bfd *bfd_openstreamr (const char *, const char *, void *); DESCRIPTION @@ -301,12 +294,9 @@ DESCRIPTION */ bfd * -bfd_openstreamr (filename, target, streamarg) - const char *filename; - const char *target; - PTR streamarg; +bfd_openstreamr (const char *filename, const char *target, void *streamarg) { - FILE *stream = (FILE *) streamarg; + FILE *stream = streamarg; bfd *nbfd; const bfd_target *target_vec; @@ -321,7 +311,7 @@ bfd_openstreamr (filename, target, streamarg) return NULL; } - nbfd->iostream = (PTR) stream; + nbfd->iostream = stream; nbfd->filename = filename; nbfd->direction = read_direction; @@ -344,7 +334,7 @@ FUNCTION bfd_openw SYNOPSIS - bfd *bfd_openw(const char *filename, const char *target); + bfd *bfd_openw (const char *filename, const char *target); DESCRIPTION Create a BFD, associated with file @var{filename}, using the @@ -355,9 +345,7 @@ DESCRIPTION */ bfd * -bfd_openw (filename, target) - const char *filename; - const char *target; +bfd_openw (const char *filename, const char *target) { bfd *nbfd; const bfd_target *target_vec; @@ -415,8 +403,7 @@ RETURNS bfd_boolean -bfd_close (abfd) - bfd *abfd; +bfd_close (bfd *abfd) { bfd_boolean ret; @@ -478,8 +465,7 @@ RETURNS */ bfd_boolean -bfd_close_all_done (abfd) - bfd *abfd; +bfd_close_all_done (bfd *abfd) { bfd_boolean ret; @@ -514,7 +500,7 @@ FUNCTION bfd_create SYNOPSIS - bfd *bfd_create(const char *filename, bfd *templ); + bfd *bfd_create (const char *filename, bfd *templ); DESCRIPTION Create a new BFD in the manner of <<bfd_openw>>, but without @@ -523,9 +509,7 @@ DESCRIPTION */ bfd * -bfd_create (filename, templ) - const char *filename; - bfd *templ; +bfd_create (const char *filename, bfd *templ) { bfd *nbfd; @@ -559,8 +543,7 @@ RETURNS */ bfd_boolean -bfd_make_writable(abfd) - bfd *abfd; +bfd_make_writable (bfd *abfd) { struct bfd_in_memory *bim; @@ -570,9 +553,8 @@ bfd_make_writable(abfd) return FALSE; } - bim = ((struct bfd_in_memory *) - bfd_malloc ((bfd_size_type) sizeof (struct bfd_in_memory))); - abfd->iostream = (PTR) bim; + bim = bfd_malloc (sizeof (struct bfd_in_memory)); + abfd->iostream = bim; /* bfd_bwrite will grow these as needed. */ bim->size = 0; bim->buffer = 0; @@ -602,8 +584,7 @@ RETURNS <<TRUE>> is returned if all is ok, otherwise <<FALSE>>. */ bfd_boolean -bfd_make_readable(abfd) - bfd *abfd; +bfd_make_readable (bfd *abfd) { if (abfd->direction != write_direction || !(abfd->flags & BFD_IN_MEMORY)) { @@ -622,12 +603,12 @@ bfd_make_readable(abfd) abfd->where = 0; abfd->format = bfd_unknown; - abfd->my_archive = (bfd *) NULL; + abfd->my_archive = NULL; abfd->origin = 0; abfd->opened_once = FALSE; abfd->output_has_begun = FALSE; abfd->section_count = 0; - abfd->usrdata = (PTR) NULL; + abfd->usrdata = NULL; abfd->cacheable = FALSE; abfd->flags = BFD_IN_MEMORY; abfd->mtime_set = FALSE; @@ -650,7 +631,7 @@ INTERNAL_FUNCTION bfd_alloc SYNOPSIS - PTR bfd_alloc (bfd *abfd, size_t wanted); + void *bfd_alloc (bfd *abfd, size_t wanted); DESCRIPTION Allocate a block of @var{wanted} bytes of memory attached to @@ -658,12 +639,10 @@ DESCRIPTION */ -PTR -bfd_alloc (abfd, size) - bfd *abfd; - bfd_size_type size; +void * +bfd_alloc (bfd *abfd, bfd_size_type size) { - PTR ret; + void *ret; if (size != (unsigned long) size) { @@ -677,12 +656,10 @@ bfd_alloc (abfd, size) return ret; } -PTR -bfd_zalloc (abfd, size) - bfd *abfd; - bfd_size_type size; +void * +bfd_zalloc (bfd *abfd, bfd_size_type size) { - PTR res; + void *res; res = bfd_alloc (abfd, size); if (res) @@ -694,9 +671,7 @@ bfd_zalloc (abfd, size) Note: Also frees all more recently allocated blocks! */ void -bfd_release (abfd, block) - bfd *abfd; - PTR block; +bfd_release (bfd *abfd, void *block) { objalloc_free_block ((struct objalloc *) abfd->memory, block); } @@ -716,17 +691,14 @@ bfd_release (abfd, block) without debug symbols). */ -static char * get_debug_link_info PARAMS ((bfd *, unsigned long *)); -static bfd_boolean separate_debug_file_exists PARAMS ((const char *, const unsigned long)); -static char * find_separate_debug_file PARAMS ((bfd *, const char *)); - #define GNU_DEBUGLINK ".gnu_debuglink" /* FUNCTION bfd_calc_gnu_debuglink_crc32 SYNOPSIS - unsigned long bfd_calc_gnu_debuglink_crc32 (unsigned long crc, const unsigned char *buf, bfd_size_type len); + unsigned long bfd_calc_gnu_debuglink_crc32 + (unsigned long crc, const unsigned char *buf, bfd_size_type len); DESCRIPTION Computes a CRC value as used in the .gnu_debuglink section. @@ -738,10 +710,9 @@ RETURNS */ unsigned long -bfd_calc_gnu_debuglink_crc32 (crc, buf, len) - unsigned long crc; - const unsigned char *buf; - bfd_size_type len; +bfd_calc_gnu_debuglink_crc32 (unsigned long crc, + const unsigned char *buf, + bfd_size_type len) { static const unsigned long crc32_table[256] = { @@ -812,7 +783,7 @@ INTERNAL_FUNCTION get_debug_link_info SYNOPSIS - char * get_debug_link_info (bfd * abfd, unsigned long * crc32_out) + char *get_debug_link_info (bfd *abfd, unsigned long *crc32_out); DESCRIPTION fetch the filename and CRC32 value for any separate debuginfo @@ -821,9 +792,7 @@ DESCRIPTION */ static char * -get_debug_link_info (abfd, crc32_out) - bfd * abfd; - unsigned long * crc32_out; +get_debug_link_info (bfd *abfd, unsigned long *crc32_out) { asection * sect; bfd_size_type debuglink_size; @@ -846,8 +815,7 @@ get_debug_link_info (abfd, crc32_out) if (contents == NULL) return NULL; - ret = bfd_get_section_contents (abfd, sect, contents, - (file_ptr)0, debuglink_size); + ret = bfd_get_section_contents (abfd, sect, contents, 0, debuglink_size); if (! ret) { free (contents); @@ -858,7 +826,7 @@ get_debug_link_info (abfd, crc32_out) crc_offset = strlen (contents) + 1; crc_offset = (crc_offset + 3) & ~3; - crc32 = bfd_get_32 (abfd, (bfd_byte *) (contents + crc_offset)); + crc32 = bfd_get_32 (abfd, contents + crc_offset); *crc32_out = crc32; return contents; @@ -869,7 +837,8 @@ INTERNAL_FUNCTION separate_debug_file_exists SYNOPSIS - bfd_boolean separate_debug_file_exists (char * name, unsigned long crc32) + bfd_boolean separate_debug_file_exists + (char *name, unsigned long crc32); DESCRIPTION Checks to see if @var{name} is a file and if its contents @@ -877,9 +846,7 @@ DESCRIPTION */ static bfd_boolean -separate_debug_file_exists (name, crc) - const char *name; - const unsigned long crc; +separate_debug_file_exists (const char *name, const unsigned long crc) { static char buffer [8 * 1024]; unsigned long file_crc = 0; @@ -906,7 +873,7 @@ INTERNAL_FUNCTION find_separate_debug_file SYNOPSIS - char * find_separate_debug_file (bfd *abfd) + char *find_separate_debug_file (bfd *abfd); DESCRIPTION Searches @var{abfd} for a reference to separate debugging @@ -918,9 +885,7 @@ DESCRIPTION */ static char * -find_separate_debug_file (abfd, debug_file_directory) - bfd *abfd; - const char *debug_file_directory; +find_separate_debug_file (bfd *abfd, const char *debug_file_directory) { char *basename; char *dir; @@ -1026,7 +991,7 @@ FUNCTION bfd_follow_gnu_debuglink SYNOPSIS - char * bfd_follow_gnu_debuglink(bfd *abfd, const char *dir); + char *bfd_follow_gnu_debuglink (bfd *abfd, const char *dir); DESCRIPTION @@ -1045,9 +1010,7 @@ RETURNS */ char * -bfd_follow_gnu_debuglink (abfd, dir) - bfd *abfd; - const char * dir; +bfd_follow_gnu_debuglink (bfd *abfd, const char *dir) { #if 0 /* Disabled until DEBUGDIR can be defined by configure.in */ if (dir == NULL) @@ -1061,7 +1024,8 @@ FUNCTION bfd_create_gnu_debuglink_section SYNOPSIS - struct sec * bfd_create_gnu_debuglink_section (bfd * abfd, const char * filename); + struct sec *bfd_create_gnu_debuglink_section + (bfd *abfd, const char *filename); DESCRIPTION @@ -1074,12 +1038,10 @@ RETURNS */ asection * -bfd_create_gnu_debuglink_section - (bfd * abfd, - const char * filename) +bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename) { - asection * sect; - bfd_size_type debuglink_size; + asection *sect; + bfd_size_type debuglink_size; if (abfd == NULL || filename == NULL) { @@ -1126,7 +1088,8 @@ FUNCTION bfd_fill_in_gnu_debuglink_section SYNOPSIS - bfd_boolean bfd_fill_in_gnu_debuglink_section (bfd * abfd, struct sec * sect, const char * filename); + bfd_boolean bfd_fill_in_gnu_debuglink_section + (bfd *abfd, struct sec *sect, const char *filename); DESCRIPTION @@ -1141,10 +1104,9 @@ RETURNS */ bfd_boolean -bfd_fill_in_gnu_debuglink_section - (bfd * abfd, - struct sec * sect, - const char * filename) +bfd_fill_in_gnu_debuglink_section (bfd *abfd, + struct sec *sect, + const char *filename) { bfd_size_type debuglink_size; unsigned long crc32; @@ -1198,10 +1160,9 @@ bfd_fill_in_gnu_debuglink_section strcpy (contents, filename); crc_offset = debuglink_size - 4; - bfd_put_32 (abfd, crc32, (bfd_byte *) (contents + crc_offset)); + bfd_put_32 (abfd, crc32, contents + crc_offset); - if (! bfd_set_section_contents (abfd, sect, contents, - (file_ptr)0, debuglink_size)) + if (! bfd_set_section_contents (abfd, sect, contents, 0, debuglink_size)) { /* XXX Should we delete the section from the bfd ? */ free (contents); diff --git a/bfd/reloc.c b/bfd/reloc.c index 09155b2757e..d80729e3f2a 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -321,8 +321,8 @@ CODE_FRAGMENT . strange relocation methods to be accomodated (e.g., i960 callj . instructions). *} . bfd_reloc_status_type (*special_function) -. PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR, asection *, -. bfd *, char **)); +. (bfd *, arelent *, struct symbol_cache_entry *, void *, asection *, +. bfd *, char **); . . {* The textual name of the relocation type. *} . char *name; @@ -401,7 +401,7 @@ DESCRIPTION .#define HOWTO_PREPARE(relocation, symbol) \ . { \ -. if (symbol != (asymbol *) NULL) \ +. if (symbol != NULL) \ . { \ . if (bfd_is_com_section (symbol->section)) \ . { \ @@ -429,8 +429,7 @@ DESCRIPTION */ unsigned int -bfd_get_reloc_size (howto) - reloc_howto_type *howto; +bfd_get_reloc_size (reloc_howto_type *howto) { switch (howto->size) { @@ -470,13 +469,12 @@ FUNCTION bfd_check_overflow SYNOPSIS - bfd_reloc_status_type - bfd_check_overflow - (enum complain_overflow how, - unsigned int bitsize, - unsigned int rightshift, - unsigned int addrsize, - bfd_vma relocation); + bfd_reloc_status_type bfd_check_overflow + (enum complain_overflow how, + unsigned int bitsize, + unsigned int rightshift, + unsigned int addrsize, + bfd_vma relocation); DESCRIPTION Perform overflow checking on @var{relocation} which has @@ -488,12 +486,11 @@ DESCRIPTION */ bfd_reloc_status_type -bfd_check_overflow (how, bitsize, rightshift, addrsize, relocation) - enum complain_overflow how; - unsigned int bitsize; - unsigned int rightshift; - unsigned int addrsize; - bfd_vma relocation; +bfd_check_overflow (enum complain_overflow how, + unsigned int bitsize, + unsigned int rightshift, + unsigned int addrsize, + bfd_vma relocation) { bfd_vma fieldmask, addrmask, signmask, ss, a; bfd_reloc_status_type flag = bfd_reloc_ok; @@ -553,14 +550,13 @@ FUNCTION bfd_perform_relocation SYNOPSIS - bfd_reloc_status_type - bfd_perform_relocation - (bfd *abfd, - arelent *reloc_entry, - PTR data, - asection *input_section, - bfd *output_bfd, - char **error_message); + bfd_reloc_status_type bfd_perform_relocation + (bfd *abfd, + arelent *reloc_entry, + void *data, + asection *input_section, + bfd *output_bfd, + char **error_message); DESCRIPTION If @var{output_bfd} is supplied to this function, the @@ -581,14 +577,12 @@ DESCRIPTION */ bfd_reloc_status_type -bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd, - error_message) - bfd *abfd; - arelent *reloc_entry; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +bfd_perform_relocation (bfd *abfd, + arelent *reloc_entry, + void *data, + asection *input_section, + bfd *output_bfd, + char **error_message) { bfd_vma relocation; bfd_reloc_status_type flag = bfd_reloc_ok; @@ -600,7 +594,7 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd, symbol = *(reloc_entry->sym_ptr_ptr); if (bfd_is_abs_section (symbol->section) - && output_bfd != (bfd *) NULL) + && output_bfd != NULL) { reloc_entry->address += input_section->output_offset; return bfd_reloc_ok; @@ -611,7 +605,7 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd, considered to have a value of zero (SVR4 ABI, p. 4-27). */ if (bfd_is_und_section (symbol->section) && (symbol->flags & BSF_WEAK) == 0 - && output_bfd == (bfd *) NULL) + && output_bfd == NULL) flag = bfd_reloc_undefined; /* If there is a function supplied to handle this relocation type, @@ -695,7 +689,7 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd, relocation -= reloc_entry->address; } - if (output_bfd != (bfd *) NULL) + if (output_bfd != NULL) { if (! howto->partial_inplace) { @@ -958,13 +952,12 @@ FUNCTION bfd_install_relocation SYNOPSIS - bfd_reloc_status_type - bfd_install_relocation - (bfd *abfd, - arelent *reloc_entry, - PTR data, bfd_vma data_start, - asection *input_section, - char **error_message); + bfd_reloc_status_type bfd_install_relocation + (bfd *abfd, + arelent *reloc_entry, + void *data, bfd_vma data_start, + asection *input_section, + char **error_message); DESCRIPTION This looks remarkably like <<bfd_perform_relocation>>, except it @@ -977,14 +970,12 @@ DESCRIPTION */ bfd_reloc_status_type -bfd_install_relocation (abfd, reloc_entry, data_start, data_start_offset, - input_section, error_message) - bfd *abfd; - arelent *reloc_entry; - PTR data_start; - bfd_vma data_start_offset; - asection *input_section; - char **error_message; +bfd_install_relocation (bfd *abfd, + arelent *reloc_entry, + void *data_start, + bfd_vma data_start_offset, + asection *input_section, + char **error_message) { bfd_vma relocation; bfd_reloc_status_type flag = bfd_reloc_ok; @@ -1277,32 +1268,32 @@ space consuming. For each target: { case 0: { - char x = bfd_get_8 (abfd, (char *) data); + char x = bfd_get_8 (abfd, data); DOIT (x); - bfd_put_8 (abfd, x, (unsigned char *) data); + bfd_put_8 (abfd, x, data); } break; case 1: { - short x = bfd_get_16 (abfd, (bfd_byte *) data); + short x = bfd_get_16 (abfd, data); DOIT (x); - bfd_put_16 (abfd, (bfd_vma) x, (unsigned char *) data); + bfd_put_16 (abfd, (bfd_vma) x, data); } break; case 2: { - long x = bfd_get_32 (abfd, (bfd_byte *) data); + long x = bfd_get_32 (abfd, data); DOIT (x); - bfd_put_32 (abfd, (bfd_vma) x, (bfd_byte *) data); + bfd_put_32 (abfd, (bfd_vma) x, data); } break; case -2: { - long x = bfd_get_32 (abfd, (bfd_byte *) data); + long x = bfd_get_32 (abfd, data); relocation = -relocation; DOIT (x); - bfd_put_32 (abfd, (bfd_vma) x, (bfd_byte *) data); + bfd_put_32 (abfd, (bfd_vma) x, data); } break; @@ -1312,9 +1303,9 @@ space consuming. For each target: case 4: { - bfd_vma x = bfd_get_64 (abfd, (bfd_byte *) data); + bfd_vma x = bfd_get_64 (abfd, data); DOIT (x); - bfd_put_64 (abfd, x, (bfd_byte *) data); + bfd_put_64 (abfd, x, data); } break; default: @@ -1347,15 +1338,13 @@ space consuming. For each target: ADDEND is the addend of the reloc. */ bfd_reloc_status_type -_bfd_final_link_relocate (howto, input_bfd, input_section, contents, address, - value, addend) - reloc_howto_type *howto; - bfd *input_bfd; - asection *input_section; - bfd_byte *contents; - bfd_vma address; - bfd_vma value; - bfd_vma addend; +_bfd_final_link_relocate (reloc_howto_type *howto, + bfd *input_bfd, + asection *input_section, + bfd_byte *contents, + bfd_vma address, + bfd_vma value, + bfd_vma addend) { bfd_vma relocation; @@ -1394,11 +1383,10 @@ _bfd_final_link_relocate (howto, input_bfd, input_section, contents, address, /* Relocate a given location using a given value and howto. */ bfd_reloc_status_type -_bfd_relocate_contents (howto, input_bfd, relocation, location) - reloc_howto_type *howto; - bfd *input_bfd; - bfd_vma relocation; - bfd_byte *location; +_bfd_relocate_contents (reloc_howto_type *howto, + bfd *input_bfd, + bfd_vma relocation, + bfd_byte *location) { int size; bfd_vma x = 0; @@ -3905,8 +3893,8 @@ FUNCTION bfd_reloc_type_lookup SYNOPSIS - reloc_howto_type * - bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code); + reloc_howto_type *bfd_reloc_type_lookup + (bfd *abfd, bfd_reloc_code_real_type code); DESCRIPTION Return a pointer to a howto structure which, when @@ -3916,9 +3904,7 @@ DESCRIPTION */ reloc_howto_type * -bfd_reloc_type_lookup (abfd, code) - bfd *abfd; - bfd_reloc_code_real_type code; +bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code) { return BFD_SEND (abfd, reloc_type_lookup, (abfd, code)); } @@ -3932,7 +3918,7 @@ INTERNAL_FUNCTION SYNOPSIS reloc_howto_type *bfd_default_reloc_type_lookup - (bfd *abfd, bfd_reloc_code_real_type code); + (bfd *abfd, bfd_reloc_code_real_type code); DESCRIPTION Provides a default relocation lookup routine for any architecture. @@ -3940,9 +3926,7 @@ DESCRIPTION */ reloc_howto_type * -bfd_default_reloc_type_lookup (abfd, code) - bfd *abfd; - bfd_reloc_code_real_type code; +bfd_default_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code) { switch (code) { @@ -3963,7 +3947,7 @@ bfd_default_reloc_type_lookup (abfd, code) default: BFD_FAIL (); } - return (reloc_howto_type *) NULL; + return NULL; } /* @@ -3979,12 +3963,11 @@ DESCRIPTION */ const char * -bfd_get_reloc_code_name (code) - bfd_reloc_code_real_type code; +bfd_get_reloc_code_name (bfd_reloc_code_real_type code) { - if ((int) code > (int) BFD_RELOC_UNUSED) + if (code > BFD_RELOC_UNUSED) return 0; - return bfd_reloc_code_real_names[(int)code]; + return bfd_reloc_code_real_names[code]; } /* @@ -3993,10 +3976,10 @@ INTERNAL_FUNCTION SYNOPSIS bfd_boolean bfd_generic_relax_section - (bfd *abfd, - asection *section, - struct bfd_link_info *, - bfd_boolean *); + (bfd *abfd, + asection *section, + struct bfd_link_info *, + bfd_boolean *); DESCRIPTION Provides default handling for relaxing for back ends which @@ -4004,11 +3987,10 @@ DESCRIPTION */ bfd_boolean -bfd_generic_relax_section (abfd, section, link_info, again) - bfd *abfd ATTRIBUTE_UNUSED; - asection *section ATTRIBUTE_UNUSED; - struct bfd_link_info *link_info ATTRIBUTE_UNUSED; - bfd_boolean *again; +bfd_generic_relax_section (bfd *abfd ATTRIBUTE_UNUSED, + asection *section ATTRIBUTE_UNUSED, + struct bfd_link_info *link_info ATTRIBUTE_UNUSED, + bfd_boolean *again) { *again = FALSE; return TRUE; @@ -4020,7 +4002,7 @@ INTERNAL_FUNCTION SYNOPSIS bfd_boolean bfd_generic_gc_sections - (bfd *, struct bfd_link_info *); + (bfd *, struct bfd_link_info *); DESCRIPTION Provides default handling for relaxing for back ends which @@ -4028,9 +4010,8 @@ DESCRIPTION */ bfd_boolean -bfd_generic_gc_sections (abfd, link_info) - bfd *abfd ATTRIBUTE_UNUSED; - struct bfd_link_info *link_info ATTRIBUTE_UNUSED; +bfd_generic_gc_sections (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *link_info ATTRIBUTE_UNUSED) { return TRUE; } @@ -4041,7 +4022,7 @@ INTERNAL_FUNCTION SYNOPSIS bfd_boolean bfd_generic_merge_sections - (bfd *, struct bfd_link_info *); + (bfd *, struct bfd_link_info *); DESCRIPTION Provides default handling for SEC_MERGE section merging for back ends @@ -4049,9 +4030,8 @@ DESCRIPTION */ bfd_boolean -bfd_generic_merge_sections (abfd, link_info) - bfd *abfd ATTRIBUTE_UNUSED; - struct bfd_link_info *link_info ATTRIBUTE_UNUSED; +bfd_generic_merge_sections (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *link_info ATTRIBUTE_UNUSED) { return TRUE; } @@ -4061,13 +4041,13 @@ INTERNAL_FUNCTION bfd_generic_get_relocated_section_contents SYNOPSIS - bfd_byte * - bfd_generic_get_relocated_section_contents (bfd *abfd, - struct bfd_link_info *link_info, - struct bfd_link_order *link_order, - bfd_byte *data, - bfd_boolean relocatable, - asymbol **symbols); + bfd_byte *bfd_generic_get_relocated_section_contents + (bfd *abfd, + struct bfd_link_info *link_info, + struct bfd_link_order *link_order, + bfd_byte *data, + bfd_boolean relocatable, + asymbol **symbols); DESCRIPTION Provides default handling of relocation effort for back ends @@ -4076,14 +4056,12 @@ DESCRIPTION */ bfd_byte * -bfd_generic_get_relocated_section_contents (abfd, link_info, link_order, data, - relocatable, symbols) - bfd *abfd; - struct bfd_link_info *link_info; - struct bfd_link_order *link_order; - bfd_byte *data; - bfd_boolean relocatable; - asymbol **symbols; +bfd_generic_get_relocated_section_contents (bfd *abfd, + struct bfd_link_info *link_info, + struct bfd_link_order *link_order, + bfd_byte *data, + bfd_boolean relocatable, + asymbol **symbols) { /* Get enough memory to hold the stuff. */ bfd *input_bfd = link_order->u.indirect.section->owner; @@ -4096,15 +4074,15 @@ bfd_generic_get_relocated_section_contents (abfd, link_info, link_order, data, if (reloc_size < 0) goto error_return; - reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); + reloc_vector = bfd_malloc (reloc_size); if (reloc_vector == NULL && reloc_size != 0) goto error_return; /* Read in the section. */ if (!bfd_get_section_contents (input_bfd, input_section, - (PTR) data, - (bfd_vma) 0, + data, + 0, input_section->_raw_size)) goto error_return; @@ -4122,16 +4100,15 @@ bfd_generic_get_relocated_section_contents (abfd, link_info, link_order, data, if (reloc_count > 0) { arelent **parent; - for (parent = reloc_vector; *parent != (arelent *) NULL; - parent++) + for (parent = reloc_vector; *parent != NULL; parent++) { - char *error_message = (char *) NULL; + char *error_message = NULL; bfd_reloc_status_type r = bfd_perform_relocation (input_bfd, *parent, - (PTR) data, + data, input_section, - relocatable ? abfd : (bfd *) NULL, + relocatable ? abfd : NULL, &error_message); if (relocatable) @@ -4155,7 +4132,7 @@ bfd_generic_get_relocated_section_contents (abfd, link_info, link_order, data, goto error_return; break; case bfd_reloc_dangerous: - BFD_ASSERT (error_message != (char *) NULL); + BFD_ASSERT (error_message != NULL); if (!((*link_info->callbacks->reloc_dangerous) (link_info, error_message, input_bfd, input_section, (*parent)->address))) diff --git a/bfd/section.c b/bfd/section.c index 44edb073caa..0f5ab9a29b4 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -475,7 +475,7 @@ CODE_FRAGMENT . file_ptr line_filepos; . . {* Pointer to data for applications. *} -. PTR userdata; +. void *userdata; . . {* If the SEC_IN_MEMORY flag is set, this points to the actual . contents. *} @@ -504,7 +504,7 @@ CODE_FRAGMENT . {* What the section number is in the target world. *} . int target_index; . -. PTR used_by_bfd; +. void *used_by_bfd; . . {* If this is a constructor section then here is a list of the . relocations created to relocate items within it. *} @@ -676,10 +676,9 @@ struct section_hash_entry /* Initialize an entry in the section hash table. */ struct bfd_hash_entry * -bfd_section_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; +bfd_section_hash_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, + const char *string) { /* Allocate the structure if it has not already been allocated by a subclass. */ @@ -694,10 +693,8 @@ bfd_section_hash_newfunc (entry, table, string) /* Call the allocation method of the superclass. */ entry = bfd_hash_newfunc (entry, table, string); if (entry != NULL) - { - memset ((PTR) &((struct section_hash_entry *) entry)->section, - 0, sizeof (asection)); - } + memset (&((struct section_hash_entry *) entry)->section, 0, + sizeof (asection)); return entry; } @@ -711,9 +708,7 @@ bfd_section_hash_newfunc (entry, table, string) static asection *bfd_section_init PARAMS ((bfd *, asection *)); static asection * -bfd_section_init (abfd, newsect) - bfd *abfd; - asection *newsect; +bfd_section_init (bfd *abfd, asection *newsect) { static int section_id = 0x10; /* id 0 to 3 used by STD_SECTION. */ @@ -768,13 +763,12 @@ DESCRIPTION */ void -bfd_section_list_clear (abfd) - bfd *abfd; +bfd_section_list_clear (bfd *abfd) { abfd->sections = NULL; abfd->section_tail = &abfd->sections; abfd->section_count = 0; - memset ((PTR) abfd->section_htab.table, 0, + memset (abfd->section_htab.table, 0, abfd->section_htab.size * sizeof (struct bfd_hash_entry *)); } @@ -783,7 +777,7 @@ FUNCTION bfd_get_section_by_name SYNOPSIS - asection *bfd_get_section_by_name(bfd *abfd, const char *name); + asection *bfd_get_section_by_name (bfd *abfd, const char *name); DESCRIPTION Run through @var{abfd} and return the one of the @@ -797,9 +791,7 @@ DESCRIPTION */ asection * -bfd_get_section_by_name (abfd, name) - bfd *abfd; - const char *name; +bfd_get_section_by_name (bfd *abfd, const char *name) { struct section_hash_entry *sh; @@ -815,9 +807,8 @@ FUNCTION bfd_get_unique_section_name SYNOPSIS - char *bfd_get_unique_section_name(bfd *abfd, - const char *templat, - int *count); + char *bfd_get_unique_section_name + (bfd *abfd, const char *templat, int *count); DESCRIPTION Invent a section name that is unique in @var{abfd} by tacking @@ -828,17 +819,14 @@ DESCRIPTION */ char * -bfd_get_unique_section_name (abfd, templat, count) - bfd *abfd; - const char *templat; - int *count; +bfd_get_unique_section_name (bfd *abfd, const char *templat, int *count) { int num; unsigned int len; char *sname; len = strlen (templat); - sname = bfd_malloc ((bfd_size_type) len + 8); + sname = bfd_malloc (len + 8); if (sname == NULL) return NULL; memcpy (sname, templat, len); @@ -865,7 +853,7 @@ FUNCTION bfd_make_section_old_way SYNOPSIS - asection *bfd_make_section_old_way(bfd *abfd, const char *name); + asection *bfd_make_section_old_way (bfd *abfd, const char *name); DESCRIPTION Create a new empty section called @var{name} @@ -886,9 +874,7 @@ DESCRIPTION */ asection * -bfd_make_section_old_way (abfd, name) - bfd *abfd; - const char *name; +bfd_make_section_old_way (bfd *abfd, const char *name) { struct section_hash_entry *sh; asection *newsect; @@ -931,7 +917,7 @@ FUNCTION bfd_make_section_anyway SYNOPSIS - asection *bfd_make_section_anyway(bfd *abfd, const char *name); + asection *bfd_make_section_anyway (bfd *abfd, const char *name); DESCRIPTION Create a new empty section called @var{name} and attach it to the end of @@ -944,9 +930,7 @@ DESCRIPTION */ sec_ptr -bfd_make_section_anyway (abfd, name) - bfd *abfd; - const char *name; +bfd_make_section_anyway (bfd *abfd, const char *name) { struct section_hash_entry *sh; asection *newsect; @@ -968,7 +952,7 @@ bfd_make_section_anyway (abfd, name) section_htab without generating a unique section name and that would be pointless; We don't need to traverse the hash table. */ - newsect = (asection *) bfd_zalloc (abfd, sizeof (asection)); + newsect = bfd_zalloc (abfd, sizeof (asection)); if (newsect == NULL) return NULL; } @@ -982,7 +966,7 @@ FUNCTION bfd_make_section SYNOPSIS - asection *bfd_make_section(bfd *, const char *name); + asection *bfd_make_section (bfd *, const char *name); DESCRIPTION Like <<bfd_make_section_anyway>>, but return <<NULL>> (without calling @@ -992,9 +976,7 @@ DESCRIPTION */ asection * -bfd_make_section (abfd, name) - bfd *abfd; - const char *name; +bfd_make_section (bfd *abfd, const char *name) { struct section_hash_entry *sh; asection *newsect; @@ -1031,7 +1013,8 @@ FUNCTION bfd_set_section_flags SYNOPSIS - bfd_boolean bfd_set_section_flags (bfd *abfd, asection *sec, flagword flags); + bfd_boolean bfd_set_section_flags + (bfd *abfd, asection *sec, flagword flags); DESCRIPTION Set the attributes of the section @var{sec} in the BFD @@ -1047,10 +1030,9 @@ DESCRIPTION /*ARGSUSED*/ bfd_boolean -bfd_set_section_flags (abfd, section, flags) - bfd *abfd ATTRIBUTE_UNUSED; - sec_ptr section; - flagword flags; +bfd_set_section_flags (bfd *abfd ATTRIBUTE_UNUSED, + sec_ptr section, + flagword flags) { #if 0 /* If you try to copy a text section from an input file (where it @@ -1074,34 +1056,32 @@ FUNCTION bfd_map_over_sections SYNOPSIS - void bfd_map_over_sections(bfd *abfd, - void (*func) (bfd *abfd, - asection *sect, - PTR obj), - PTR obj); + void bfd_map_over_sections + (bfd *abfd, + void (*func) (bfd *abfd, asection *sect, void *obj), + void *obj); DESCRIPTION Call the provided function @var{func} for each section attached to the BFD @var{abfd}, passing @var{obj} as an argument. The function will be called as if by -| func(abfd, the_section, obj); +| func (abfd, the_section, obj); This is the prefered method for iterating over sections; an alternative would be to use a loop: | section *p; | for (p = abfd->sections; p != NULL; p = p->next) -| func(abfd, p, ...) +| func (abfd, p, ...) */ /*VARARGS2*/ void -bfd_map_over_sections (abfd, operation, user_storage) - bfd *abfd; - void (*operation) PARAMS ((bfd * abfd, asection * sect, PTR obj)); - PTR user_storage; +bfd_map_over_sections (bfd *abfd, + void (*operation) (bfd *, asection *, void *), + void *user_storage) { asection *sect; unsigned int i = 0; @@ -1118,7 +1098,8 @@ FUNCTION bfd_set_section_size SYNOPSIS - bfd_boolean bfd_set_section_size (bfd *abfd, asection *sec, bfd_size_type val); + bfd_boolean bfd_set_section_size + (bfd *abfd, asection *sec, bfd_size_type val); DESCRIPTION Set @var{sec} to the size @var{val}. If the operation is @@ -1131,10 +1112,7 @@ DESCRIPTION */ bfd_boolean -bfd_set_section_size (abfd, ptr, val) - bfd *abfd; - sec_ptr ptr; - bfd_size_type val; +bfd_set_section_size (bfd *abfd, sec_ptr ptr, bfd_size_type val) { /* Once you've started writing to any section you cannot create or change the size of any others. */ @@ -1156,9 +1134,9 @@ FUNCTION bfd_set_section_contents SYNOPSIS - bfd_boolean bfd_set_section_contents (bfd *abfd, asection *section, - PTR data, file_ptr offset, - bfd_size_type count); + bfd_boolean bfd_set_section_contents + (bfd *abfd, asection *section, void *data, file_ptr offset, + bfd_size_type count); DESCRIPTION Sets the contents of the section @var{section} in BFD @@ -1178,18 +1156,17 @@ DESCRIPTION */ -#define bfd_get_section_size_now(abfd,sec) \ -(sec->reloc_done \ - ? bfd_get_section_size_after_reloc (sec) \ - : bfd_get_section_size_before_reloc (sec)) +#define bfd_get_section_size_now(abfd, sec) \ + (sec->reloc_done \ + ? bfd_get_section_size_after_reloc (sec) \ + : bfd_get_section_size_before_reloc (sec)) bfd_boolean -bfd_set_section_contents (abfd, section, location, offset, count) - bfd *abfd; - sec_ptr section; - PTR location; - file_ptr offset; - bfd_size_type count; +bfd_set_section_contents (bfd *abfd, + sec_ptr section, + void *location, + file_ptr offset, + bfd_size_type count) { bfd_size_type sz; @@ -1229,7 +1206,7 @@ bfd_set_section_contents (abfd, section, location, offset, count) /* Record a copy of the data in memory if desired. */ if (section->contents - && location != (PTR) (section->contents + offset)) + && location != section->contents + offset) memcpy (section->contents + offset, location, (size_t) count); if (BFD_SEND (abfd, _bfd_set_section_contents, @@ -1247,9 +1224,9 @@ FUNCTION bfd_get_section_contents SYNOPSIS - bfd_boolean bfd_get_section_contents (bfd *abfd, asection *section, - PTR location, file_ptr offset, - bfd_size_type count); + bfd_boolean bfd_get_section_contents + (bfd *abfd, asection *section, void *location, file_ptr offset, + bfd_size_type count); DESCRIPTION Read data from @var{section} in BFD @var{abfd} @@ -1265,12 +1242,11 @@ DESCRIPTION */ bfd_boolean -bfd_get_section_contents (abfd, section, location, offset, count) - bfd *abfd; - sec_ptr section; - PTR location; - file_ptr offset; - bfd_size_type count; +bfd_get_section_contents (bfd *abfd, + sec_ptr section, + void *location, + file_ptr offset, + bfd_size_type count) { bfd_size_type sz; @@ -1317,8 +1293,8 @@ FUNCTION bfd_copy_private_section_data SYNOPSIS - bfd_boolean bfd_copy_private_section_data (bfd *ibfd, asection *isec, - bfd *obfd, asection *osec); + bfd_boolean bfd_copy_private_section_data + (bfd *ibfd, asection *isec, bfd *obfd, asection *osec); DESCRIPTION Copy private section information from @var{isec} in the BFD @@ -1340,7 +1316,7 @@ FUNCTION SYNOPSIS void _bfd_strip_section_from_output - (struct bfd_link_info *info, asection *section); + (struct bfd_link_info *info, asection *section); DESCRIPTION Remove @var{section} from the output. If the output section @@ -1351,9 +1327,7 @@ DESCRIPTION to remove sections. */ void -_bfd_strip_section_from_output (info, s) - struct bfd_link_info *info; - asection *s; +_bfd_strip_section_from_output (struct bfd_link_info *info, asection *s) { asection *os; asection *is; @@ -1392,9 +1366,8 @@ DESCRIPTION */ bfd_boolean -bfd_generic_discard_group (abfd, group) - bfd *abfd ATTRIBUTE_UNUSED; - asection *group ATTRIBUTE_UNUSED; +bfd_generic_discard_group (bfd *abfd ATTRIBUTE_UNUSED, + asection *group ATTRIBUTE_UNUSED) { return TRUE; } diff --git a/bfd/simple.c b/bfd/simple.c index 0042e60a3f5..256fd913b85 100644 --- a/bfd/simple.c +++ b/bfd/simple.c @@ -24,89 +24,56 @@ #include "libbfd.h" #include "bfdlink.h" -static bfd_boolean simple_dummy_warning - PARAMS ((struct bfd_link_info *, const char *, const char *, bfd *, - asection *, bfd_vma)); - -static bfd_boolean simple_dummy_undefined_symbol - PARAMS ((struct bfd_link_info *, const char *, bfd *, asection *, - bfd_vma, bfd_boolean)); - -static bfd_boolean simple_dummy_reloc_overflow - PARAMS ((struct bfd_link_info *, const char *, const char *, bfd_vma, - bfd *, asection *, bfd_vma)); - -static bfd_boolean simple_dummy_reloc_dangerous - PARAMS ((struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma)); - -static bfd_boolean simple_dummy_unattached_reloc - PARAMS ((struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma)); - -static void simple_save_output_info - PARAMS ((bfd *, asection *, PTR)); - -static void simple_restore_output_info - PARAMS ((bfd *, asection *, PTR)); - -bfd_byte * bfd_simple_get_relocated_section_contents - PARAMS ((bfd *, asection *, bfd_byte *, asymbol **)); - static bfd_boolean -simple_dummy_warning (link_info, warning, symbol, abfd, section, address) - struct bfd_link_info *link_info ATTRIBUTE_UNUSED; - const char *warning ATTRIBUTE_UNUSED; - const char *symbol ATTRIBUTE_UNUSED; - bfd *abfd ATTRIBUTE_UNUSED; - asection *section ATTRIBUTE_UNUSED; - bfd_vma address ATTRIBUTE_UNUSED; +simple_dummy_warning (struct bfd_link_info *link_info ATTRIBUTE_UNUSED, + const char *warning ATTRIBUTE_UNUSED, + const char *symbol ATTRIBUTE_UNUSED, + bfd *abfd ATTRIBUTE_UNUSED, + asection *section ATTRIBUTE_UNUSED, + bfd_vma address ATTRIBUTE_UNUSED) { return TRUE; } static bfd_boolean -simple_dummy_undefined_symbol (link_info, name, abfd, section, address, fatal) - struct bfd_link_info *link_info ATTRIBUTE_UNUSED; - const char *name ATTRIBUTE_UNUSED; - bfd *abfd ATTRIBUTE_UNUSED; - asection *section ATTRIBUTE_UNUSED; - bfd_vma address ATTRIBUTE_UNUSED; - bfd_boolean fatal ATTRIBUTE_UNUSED; +simple_dummy_undefined_symbol (struct bfd_link_info *link_info ATTRIBUTE_UNUSED, + const char *name ATTRIBUTE_UNUSED, + bfd *abfd ATTRIBUTE_UNUSED, + asection *section ATTRIBUTE_UNUSED, + bfd_vma address ATTRIBUTE_UNUSED, + bfd_boolean fatal ATTRIBUTE_UNUSED) { return TRUE; } static bfd_boolean -simple_dummy_reloc_overflow (link_info, name, reloc_name, addend, abfd, - section, address) - struct bfd_link_info *link_info ATTRIBUTE_UNUSED; - const char *name ATTRIBUTE_UNUSED; - const char *reloc_name ATTRIBUTE_UNUSED; - bfd_vma addend ATTRIBUTE_UNUSED; - bfd *abfd ATTRIBUTE_UNUSED; - asection *section ATTRIBUTE_UNUSED; - bfd_vma address ATTRIBUTE_UNUSED; +simple_dummy_reloc_overflow (struct bfd_link_info *link_info ATTRIBUTE_UNUSED, + const char *name ATTRIBUTE_UNUSED, + const char *reloc_name ATTRIBUTE_UNUSED, + bfd_vma addend ATTRIBUTE_UNUSED, + bfd *abfd ATTRIBUTE_UNUSED, + asection *section ATTRIBUTE_UNUSED, + bfd_vma address ATTRIBUTE_UNUSED) { return TRUE; } static bfd_boolean -simple_dummy_reloc_dangerous (link_info, message, abfd, section, address) - struct bfd_link_info *link_info ATTRIBUTE_UNUSED; - const char *message ATTRIBUTE_UNUSED; - bfd *abfd ATTRIBUTE_UNUSED; - asection *section ATTRIBUTE_UNUSED; - bfd_vma address ATTRIBUTE_UNUSED; +simple_dummy_reloc_dangerous (struct bfd_link_info *link_info ATTRIBUTE_UNUSED, + const char *message ATTRIBUTE_UNUSED, + bfd *abfd ATTRIBUTE_UNUSED, + asection *section ATTRIBUTE_UNUSED, + bfd_vma address ATTRIBUTE_UNUSED) { return TRUE; } static bfd_boolean -simple_dummy_unattached_reloc (link_info, name, abfd, section, address) - struct bfd_link_info *link_info ATTRIBUTE_UNUSED; - const char *name ATTRIBUTE_UNUSED; - bfd *abfd ATTRIBUTE_UNUSED; - asection *section ATTRIBUTE_UNUSED; - bfd_vma address ATTRIBUTE_UNUSED; +simple_dummy_unattached_reloc (struct bfd_link_info *link_info ATTRIBUTE_UNUSED, + const char *name ATTRIBUTE_UNUSED, + bfd *abfd ATTRIBUTE_UNUSED, + asection *section ATTRIBUTE_UNUSED, + bfd_vma address ATTRIBUTE_UNUSED) { return TRUE; } @@ -118,12 +85,11 @@ struct saved_output_info }; static void -simple_save_output_info (abfd, section, ptr) - bfd *abfd ATTRIBUTE_UNUSED; - asection *section; - PTR ptr; +simple_save_output_info (bfd *abfd ATTRIBUTE_UNUSED, + asection *section, + void *ptr) { - struct saved_output_info *output_info = (struct saved_output_info *) ptr; + struct saved_output_info *output_info = ptr; output_info[section->index].offset = section->output_offset; output_info[section->index].section = section->output_section; section->output_offset = 0; @@ -131,12 +97,11 @@ simple_save_output_info (abfd, section, ptr) } static void -simple_restore_output_info (abfd, section, ptr) - bfd *abfd ATTRIBUTE_UNUSED; - asection *section; - PTR ptr; +simple_restore_output_info (bfd *abfd ATTRIBUTE_UNUSED, + asection *section, + void *ptr) { - struct saved_output_info *output_info = (struct saved_output_info *) ptr; + struct saved_output_info *output_info = ptr; section->output_offset = output_info[section->index].offset; section->output_section = output_info[section->index].section; } @@ -146,7 +111,8 @@ FUNCTION bfd_simple_relocate_secton SYNOPSIS - bfd_byte *bfd_simple_get_relocated_section_contents (bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table); + bfd_byte *bfd_simple_get_relocated_section_contents + (bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table); DESCRIPTION Returns the relocated contents of section @var{sec}. The symbols in @@ -163,18 +129,17 @@ DESCRIPTION */ bfd_byte * -bfd_simple_get_relocated_section_contents (abfd, sec, outbuf, symbol_table) - bfd *abfd; - asection *sec; - bfd_byte *outbuf; - asymbol **symbol_table; +bfd_simple_get_relocated_section_contents (bfd *abfd, + asection *sec, + bfd_byte *outbuf, + asymbol **symbol_table) { struct bfd_link_info link_info; struct bfd_link_order link_order; struct bfd_link_callbacks callbacks; bfd_byte *contents, *data; int storage_needed; - PTR saved_offsets; + void *saved_offsets; if (! (sec->flags & SEC_RELOC)) { @@ -246,7 +211,7 @@ bfd_simple_get_relocated_section_contents (abfd, sec, outbuf, symbol_table) _bfd_generic_link_add_symbols (abfd, &link_info); storage_needed = bfd_get_symtab_upper_bound (abfd); - symbol_table = (asymbol **) bfd_malloc (storage_needed); + symbol_table = bfd_malloc (storage_needed); bfd_canonicalize_symtab (abfd, symbol_table); } else diff --git a/bfd/syms.c b/bfd/syms.c index d0ffcc727e3..33fd9fdfd2e 100644 --- a/bfd/syms.c +++ b/bfd/syms.c @@ -77,7 +77,7 @@ SUBSECTION | if (storage_needed == 0) | return; | -| symbol_table = (asymbol **) xmalloc (storage_needed); +| symbol_table = xmalloc (storage_needed); | ... | number_of_symbols = | bfd_canonicalize_symtab (abfd, symbol_table); @@ -122,7 +122,7 @@ SUBSECTION | new->value = 0x12345; | | ptrs[0] = new; -| ptrs[1] = (asymbol *)0; +| ptrs[1] = 0; | | bfd_set_symtab (abfd, ptrs, 1); | bfd_close (abfd); @@ -298,7 +298,7 @@ CODE_FRAGMENT . {* Back end special data. *} . union . { -. PTR p; +. void *p; . bfd_vma i; . } . udata; @@ -314,10 +314,6 @@ CODE_FRAGMENT #include "bfdlink.h" #include "aout/stab_gnu.h" -static char coff_section_type PARAMS ((const char *)); -static char decode_section_type PARAMS ((const struct sec *)); -static int cmpindexentry PARAMS ((const PTR, const PTR)); - /* DOCDD INODE @@ -354,9 +350,7 @@ DESCRIPTION */ bfd_boolean -bfd_is_local_label (abfd, sym) - bfd *abfd; - asymbol *sym; +bfd_is_local_label (bfd *abfd, asymbol *sym) { /* The BSF_SECTION_SYM check is needed for IA-64, where every label that starts with '.' is local. This would accidentally catch section names @@ -382,7 +376,7 @@ DESCRIPTION local label. .#define bfd_is_local_label_name(abfd, name) \ -. BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name)) +. BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name)) . */ @@ -398,8 +392,7 @@ DESCRIPTION including the NULL. .#define bfd_canonicalize_symtab(abfd, location) \ -. BFD_SEND (abfd, _bfd_canonicalize_symtab,\ -. (abfd, location)) +. BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location)) . */ @@ -408,7 +401,8 @@ FUNCTION bfd_set_symtab SYNOPSIS - bfd_boolean bfd_set_symtab (bfd *abfd, asymbol **location, unsigned int count); + bfd_boolean bfd_set_symtab + (bfd *abfd, asymbol **location, unsigned int count); DESCRIPTION Arrange that when the output BFD @var{abfd} is closed, @@ -417,12 +411,9 @@ DESCRIPTION */ bfd_boolean -bfd_set_symtab (abfd, location, symcount) - bfd *abfd; - asymbol **location; - unsigned int symcount; +bfd_set_symtab (bfd *abfd, asymbol **location, unsigned int symcount) { - if ((abfd->format != bfd_object) || (bfd_read_p (abfd))) + if (abfd->format != bfd_object || bfd_read_p (abfd)) { bfd_set_error (bfd_error_invalid_operation); return FALSE; @@ -438,25 +429,21 @@ FUNCTION bfd_print_symbol_vandf SYNOPSIS - void bfd_print_symbol_vandf (bfd *abfd, PTR file, asymbol *symbol); + void bfd_print_symbol_vandf (bfd *abfd, void *file, asymbol *symbol); DESCRIPTION Print the value and flags of the @var{symbol} supplied to the stream @var{file}. */ void -bfd_print_symbol_vandf (abfd, arg, symbol) - bfd *abfd; - PTR arg; - asymbol *symbol; +bfd_print_symbol_vandf (bfd *abfd, void *arg, asymbol *symbol) { - FILE *file = (FILE *) arg; + FILE *file = arg; flagword type = symbol->flags; - if (symbol->section != (asection *) NULL) - bfd_fprintf_vma (abfd, file, - symbol->value + symbol->section->vma); + if (symbol->section != NULL) + bfd_fprintf_vma (abfd, file, symbol->value + symbol->section->vma); else bfd_fprintf_vma (abfd, file, symbol->value); @@ -493,7 +480,7 @@ DESCRIPTION information, and will cause problems later on. .#define bfd_make_empty_symbol(abfd) \ -. BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd)) +. BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd)) . */ @@ -502,7 +489,7 @@ FUNCTION _bfd_generic_make_empty_symbol SYNOPSIS - asymbol * _bfd_generic_make_empty_symbol (bfd *); + asymbol *_bfd_generic_make_empty_symbol (bfd *); DESCRIPTION Create a new <<asymbol>> structure for the BFD @var{abfd} @@ -512,11 +499,10 @@ DESCRIPTION */ asymbol * -_bfd_generic_make_empty_symbol (abfd) - bfd *abfd; +_bfd_generic_make_empty_symbol (bfd *abfd) { bfd_size_type amt = sizeof (asymbol); - asymbol *new = (asymbol *) bfd_zalloc (abfd, amt); + asymbol *new = bfd_zalloc (abfd, amt); if (new) new->the_bfd = abfd; return new; @@ -532,7 +518,7 @@ DESCRIPTION yet to be worked out. .#define bfd_make_debug_symbol(abfd,ptr,size) \ -. BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size)) +. BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size)) . */ @@ -576,8 +562,7 @@ static const struct section_to_type stt[] = 't' as well as .text */ static char -coff_section_type (s) - const char *s; +coff_section_type (const char *s) { const struct section_to_type *t; @@ -596,8 +581,7 @@ coff_section_type (s) we could perhaps obsolete coff_section_type. */ static char -decode_section_type (section) - const struct sec *section; +decode_section_type (const struct sec *section) { if (section->flags & SEC_CODE) return 't'; @@ -619,8 +603,7 @@ decode_section_type (section) } if (section->flags & SEC_DEBUGGING) return 'N'; - if ((section->flags & SEC_HAS_CONTENTS) && - (section->flags & SEC_READONLY)) + if ((section->flags & SEC_HAS_CONTENTS) && (section->flags & SEC_READONLY)) return 'n'; return '?'; @@ -638,8 +621,7 @@ SYNOPSIS int bfd_decode_symclass (asymbol *symbol); */ int -bfd_decode_symclass (symbol) - asymbol *symbol; +bfd_decode_symclass (asymbol *symbol) { char c; @@ -711,8 +693,7 @@ SYNOPSIS */ bfd_boolean -bfd_is_undefined_symclass (symclass) - int symclass; +bfd_is_undefined_symclass (int symclass) { return symclass == 'U' || symclass == 'w' || symclass == 'v'; } @@ -731,9 +712,7 @@ SYNOPSIS */ void -bfd_symbol_info (symbol, ret) - asymbol *symbol; - symbol_info *ret; +bfd_symbol_info (asymbol *symbol, symbol_info *ret) { ret->type = bfd_decode_symclass (symbol); @@ -750,7 +729,8 @@ FUNCTION bfd_copy_private_symbol_data SYNOPSIS - bfd_boolean bfd_copy_private_symbol_data (bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym); + bfd_boolean bfd_copy_private_symbol_data + (bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym); DESCRIPTION Copy private symbol information from @var{isym} in the BFD @@ -762,8 +742,8 @@ DESCRIPTION Not enough memory exists to create private data for @var{osec}. .#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \ -. BFD_SEND (obfd, _bfd_copy_private_symbol_data, \ -. (ibfd, isymbol, obfd, osymbol)) +. BFD_SEND (obfd, _bfd_copy_private_symbol_data, \ +. (ibfd, isymbol, obfd, osymbol)) . */ @@ -772,11 +752,10 @@ DESCRIPTION version. It just uses BFD asymbol structures as mini symbols. */ long -_bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep) - bfd *abfd; - bfd_boolean dynamic; - PTR *minisymsp; - unsigned int *sizep; +_bfd_generic_read_minisymbols (bfd *abfd, + bfd_boolean dynamic, + void **minisymsp, + unsigned int *sizep) { long storage; asymbol **syms = NULL; @@ -791,7 +770,7 @@ _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep) if (storage == 0) return 0; - syms = (asymbol **) bfd_malloc ((bfd_size_type) storage); + syms = bfd_malloc (storage); if (syms == NULL) goto error_return; @@ -802,7 +781,7 @@ _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep) if (symcount < 0) goto error_return; - *minisymsp = (PTR) syms; + *minisymsp = syms; *sizep = sizeof (asymbol *); return symcount; @@ -818,11 +797,10 @@ _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep) we just return the asymbol the minisymbol points to. */ asymbol * -_bfd_generic_minisymbol_to_symbol (abfd, dynamic, minisym, sym) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_boolean dynamic ATTRIBUTE_UNUSED; - const PTR minisym; - asymbol *sym ATTRIBUTE_UNUSED; +_bfd_generic_minisymbol_to_symbol (bfd *abfd ATTRIBUTE_UNUSED, + bfd_boolean dynamic ATTRIBUTE_UNUSED, + const void *minisym, + asymbol *sym ATTRIBUTE_UNUSED) { return *(asymbol **) minisym; } @@ -857,12 +835,10 @@ struct indexentry /* Compare two indexentry structures. This is called via qsort. */ static int -cmpindexentry (a, b) - const PTR a; - const PTR b; +cmpindexentry (const void *a, const void *b) { - const struct indexentry *contestantA = (const struct indexentry *) a; - const struct indexentry *contestantB = (const struct indexentry *) b; + const struct indexentry *contestantA = a; + const struct indexentry *contestantB = b; if (contestantA->val < contestantB->val) return -1; @@ -903,17 +879,15 @@ struct stab_find_info }; bfd_boolean -_bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, - pfilename, pfnname, pline, pinfo) - bfd *abfd; - asymbol **symbols; - asection *section; - bfd_vma offset; - bfd_boolean *pfound; - const char **pfilename; - const char **pfnname; - unsigned int *pline; - PTR *pinfo; +_bfd_stab_section_find_nearest_line (bfd *abfd, + asymbol **symbols, + asection *section, + bfd_vma offset, + bfd_boolean *pfound, + const char **pfilename, + const char **pfnname, + unsigned int *pline, + void **pinfo) { struct stab_find_info *info; bfd_size_type stabsize, strsize; @@ -951,7 +925,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, #define VALOFF (8) #define STABSIZE (12) - info = (struct stab_find_info *) *pinfo; + info = *pinfo; if (info != NULL) { if (info->stabsec == NULL || info->strsec == NULL) @@ -972,7 +946,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, char *function_name; bfd_size_type amt = sizeof *info; - info = (struct stab_find_info *) bfd_zalloc (abfd, amt); + info = bfd_zalloc (abfd, amt); if (info == NULL) return FALSE; @@ -987,15 +961,15 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, { /* No stabs debugging information. Set *pinfo so that we can return quickly in the info != NULL case above. */ - *pinfo = (PTR) info; + *pinfo = info; return TRUE; } stabsize = info->stabsec->_raw_size; strsize = info->strsec->_raw_size; - info->stabs = (bfd_byte *) bfd_alloc (abfd, stabsize); - info->strs = (bfd_byte *) bfd_alloc (abfd, strsize); + info->stabs = bfd_alloc (abfd, stabsize); + info->strs = bfd_alloc (abfd, strsize); if (info->stabs == NULL || info->strs == NULL) return FALSE; @@ -1012,7 +986,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, reloc_size = bfd_get_reloc_upper_bound (abfd, info->stabsec); if (reloc_size < 0) return FALSE; - reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size); + reloc_vector = bfd_malloc (reloc_size); if (reloc_vector == NULL && reloc_size != 0) return FALSE; reloc_count = bfd_canonicalize_reloc (abfd, info->stabsec, reloc_vector, @@ -1105,7 +1079,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, amt = info->indextablesize; amt *= sizeof (struct indexentry); - info->indextable = (struct indexentry *) bfd_alloc (abfd, amt); + info->indextable = bfd_alloc (abfd, amt); if (info->indextable == NULL) return FALSE; @@ -1226,7 +1200,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, qsort (info->indextable, (size_t) i, sizeof (struct indexentry), cmpindexentry); - *pinfo = (PTR) info; + *pinfo = info; } /* We are passed a section relative offset. The offsets in the @@ -1360,7 +1334,7 @@ _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, pfound, if (info->filename != NULL) free (info->filename); len = strlen (file_name) + 1; - info->filename = (char *) bfd_malloc ((bfd_size_type) dirlen + len); + info->filename = bfd_malloc (dirlen + len); if (info->filename == NULL) return FALSE; memcpy (info->filename, directory_name, dirlen); diff --git a/bfd/targets.c b/bfd/targets.c index 5ccae2a9928..f903cc327bb 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -103,7 +103,7 @@ DESCRIPTION someone wants to fix this and not break the above, please do. .#define BFD_SEND(bfd, message, arglist) \ -. ((*((bfd)->xvec->message)) arglist) +. ((*((bfd)->xvec->message)) arglist) . .#ifdef DEBUG_BFD_SEND .#undef BFD_SEND @@ -116,7 +116,7 @@ DESCRIPTION For operations which index on the BFD format: .#define BFD_SEND_FMT(bfd, message, arglist) \ -. (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) +. (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) . .#ifdef DEBUG_BFD_SEND .#undef BFD_SEND_FMT @@ -203,264 +203,266 @@ DESCRIPTION . {* Entries for byte swapping for data. These are different from the . other entry points, since they don't take a BFD asthe first argument. . Certain other handlers could do the same. *} -. bfd_vma (*bfd_getx64) PARAMS ((const bfd_byte *)); -. bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *)); -. void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *)); -. bfd_vma (*bfd_getx32) PARAMS ((const bfd_byte *)); -. bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((const bfd_byte *)); -. void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *)); -. bfd_vma (*bfd_getx16) PARAMS ((const bfd_byte *)); -. bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((const bfd_byte *)); -. void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *)); +. bfd_vma (*bfd_getx64) (const bfd_byte *); +. bfd_signed_vma (*bfd_getx_signed_64) (const bfd_byte *); +. void (*bfd_putx64) (bfd_vma, bfd_byte *); +. bfd_vma (*bfd_getx32) (const bfd_byte *); +. bfd_signed_vma (*bfd_getx_signed_32) (const bfd_byte *); +. void (*bfd_putx32) (bfd_vma, bfd_byte *); +. bfd_vma (*bfd_getx16) (const bfd_byte *); +. bfd_signed_vma (*bfd_getx_signed_16) (const bfd_byte *); +. void (*bfd_putx16) (bfd_vma, bfd_byte *); . . {* Byte swapping for the headers. *} -. bfd_vma (*bfd_h_getx64) PARAMS ((const bfd_byte *)); -. bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((const bfd_byte *)); -. void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *)); -. bfd_vma (*bfd_h_getx32) PARAMS ((const bfd_byte *)); -. bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((const bfd_byte *)); -. void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *)); -. bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *)); -. bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *)); -. void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *)); +. bfd_vma (*bfd_h_getx64) (const bfd_byte *); +. bfd_signed_vma (*bfd_h_getx_signed_64) (const bfd_byte *); +. void (*bfd_h_putx64) (bfd_vma, bfd_byte *); +. bfd_vma (*bfd_h_getx32) (const bfd_byte *); +. bfd_signed_vma (*bfd_h_getx_signed_32) (const bfd_byte *); +. void (*bfd_h_putx32) (bfd_vma, bfd_byte *); +. bfd_vma (*bfd_h_getx16) (const bfd_byte *); +. bfd_signed_vma (*bfd_h_getx_signed_16) (const bfd_byte *); +. void (*bfd_h_putx16) (bfd_vma, bfd_byte *); . . {* Format dependent routines: these are vectors of entry points . within the target vector structure, one for each format to check. *} . . {* Check the format of a file being read. Return a <<bfd_target *>> or zero. *} -. const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *)); +. const struct bfd_target *(*_bfd_check_format[bfd_type_end]) (bfd *); . . {* Set the format of a file being written. *} -. bfd_boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *)); +. bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *); . . {* Write cached information into a file being written, at <<bfd_close>>. *} -. bfd_boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *)); +. bfd_boolean (*_bfd_write_contents[bfd_type_end]) (bfd *); . The general target vector. These vectors are initialized using the BFD_JUMP_TABLE macros. . . {* Generic entry points. *} -Do not "beautify" the CONCAT* macro args. Traditional C will not -remove whitespace added here, and thus will fail to concatenate -the tokens. .#define BFD_JUMP_TABLE_GENERIC(NAME) \ -.CONCAT2 (NAME,_close_and_cleanup), \ -.CONCAT2 (NAME,_bfd_free_cached_info), \ -.CONCAT2 (NAME,_new_section_hook), \ -.CONCAT2 (NAME,_get_section_contents), \ -.CONCAT2 (NAME,_get_section_contents_in_window) +. NAME##_close_and_cleanup, \ +. NAME##_bfd_free_cached_info, \ +. NAME##_new_section_hook, \ +. NAME##_get_section_contents, \ +. NAME##_get_section_contents_in_window . . {* Called when the BFD is being closed to do any necessary cleanup. *} -. bfd_boolean (*_close_and_cleanup) PARAMS ((bfd *)); +. bfd_boolean (*_close_and_cleanup) (bfd *); . {* Ask the BFD to free all cached information. *} -. bfd_boolean (*_bfd_free_cached_info) PARAMS ((bfd *)); +. bfd_boolean (*_bfd_free_cached_info) (bfd *); . {* Called when a new section is created. *} -. bfd_boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr)); +. bfd_boolean (*_new_section_hook) (bfd *, sec_ptr); . {* Read the contents of a section. *} . bfd_boolean (*_bfd_get_section_contents) -. PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); +. (bfd *, sec_ptr, void *, file_ptr, bfd_size_type); . bfd_boolean (*_bfd_get_section_contents_in_window) -. PARAMS ((bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type)); +. (bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type); . . {* Entry points to copy private data. *} .#define BFD_JUMP_TABLE_COPY(NAME) \ -.CONCAT2 (NAME,_bfd_copy_private_bfd_data), \ -.CONCAT2 (NAME,_bfd_merge_private_bfd_data), \ -.CONCAT2 (NAME,_bfd_copy_private_section_data), \ -.CONCAT2 (NAME,_bfd_copy_private_symbol_data), \ -.CONCAT2 (NAME,_bfd_set_private_flags), \ -.CONCAT2 (NAME,_bfd_print_private_bfd_data) \ +. NAME##_bfd_copy_private_bfd_data, \ +. NAME##_bfd_merge_private_bfd_data, \ +. NAME##_bfd_copy_private_section_data, \ +. NAME##_bfd_copy_private_symbol_data, \ +. NAME##_bfd_set_private_flags, \ +. NAME##_bfd_print_private_bfd_data +. . {* Called to copy BFD general private data from one object file . to another. *} -. bfd_boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *)); +. bfd_boolean (*_bfd_copy_private_bfd_data) (bfd *, bfd *); . {* Called to merge BFD general private data from one object file . to a common output file when linking. *} -. bfd_boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *)); +. bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *); . {* Called to copy BFD private section data from one object file . to another. *} . bfd_boolean (*_bfd_copy_private_section_data) -. PARAMS ((bfd *, sec_ptr, bfd *, sec_ptr)); +. (bfd *, sec_ptr, bfd *, sec_ptr); . {* Called to copy BFD private symbol data from one symbol . to another. *} . bfd_boolean (*_bfd_copy_private_symbol_data) -. PARAMS ((bfd *, asymbol *, bfd *, asymbol *)); +. (bfd *, asymbol *, bfd *, asymbol *); . {* Called to set private backend flags. *} -. bfd_boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword)); +. bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword); . . {* Called to print private BFD data. *} -. bfd_boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR)); +. bfd_boolean (*_bfd_print_private_bfd_data) (bfd *, void *); . . {* Core file entry points. *} .#define BFD_JUMP_TABLE_CORE(NAME) \ -.CONCAT2 (NAME,_core_file_failing_command), \ -.CONCAT2 (NAME,_core_file_failing_signal), \ -.CONCAT2 (NAME,_core_file_matches_executable_p) -. char * (*_core_file_failing_command) PARAMS ((bfd *)); -. int (*_core_file_failing_signal) PARAMS ((bfd *)); -. bfd_boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *)); +. NAME##_core_file_failing_command, \ +. NAME##_core_file_failing_signal, \ +. NAME##_core_file_matches_executable_p +. +. char * (*_core_file_failing_command) (bfd *); +. int (*_core_file_failing_signal) (bfd *); +. bfd_boolean (*_core_file_matches_executable_p) (bfd *, bfd *); . . {* Archive entry points. *} .#define BFD_JUMP_TABLE_ARCHIVE(NAME) \ -.CONCAT2 (NAME,_slurp_armap), \ -.CONCAT2 (NAME,_slurp_extended_name_table), \ -.CONCAT2 (NAME,_construct_extended_name_table), \ -.CONCAT2 (NAME,_truncate_arname), \ -.CONCAT2 (NAME,_write_armap), \ -.CONCAT2 (NAME,_read_ar_hdr), \ -.CONCAT2 (NAME,_openr_next_archived_file), \ -.CONCAT2 (NAME,_get_elt_at_index), \ -.CONCAT2 (NAME,_generic_stat_arch_elt), \ -.CONCAT2 (NAME,_update_armap_timestamp) -. bfd_boolean (*_bfd_slurp_armap) PARAMS ((bfd *)); -. bfd_boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *)); +. NAME##_slurp_armap, \ +. NAME##_slurp_extended_name_table, \ +. NAME##_construct_extended_name_table, \ +. NAME##_truncate_arname, \ +. NAME##_write_armap, \ +. NAME##_read_ar_hdr, \ +. NAME##_openr_next_archived_file, \ +. NAME##_get_elt_at_index, \ +. NAME##_generic_stat_arch_elt, \ +. NAME##_update_armap_timestamp +. +. bfd_boolean (*_bfd_slurp_armap) (bfd *); +. bfd_boolean (*_bfd_slurp_extended_name_table) (bfd *); . bfd_boolean (*_bfd_construct_extended_name_table) -. PARAMS ((bfd *, char **, bfd_size_type *, const char **)); -. void (*_bfd_truncate_arname) PARAMS ((bfd *, const char *, char *)); +. (bfd *, char **, bfd_size_type *, const char **); +. void (*_bfd_truncate_arname) (bfd *, const char *, char *); . bfd_boolean (*write_armap) -. PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); -. PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *)); -. bfd * (*openr_next_archived_file) PARAMS ((bfd *, bfd *)); -.#define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i)) -. bfd * (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex)); -. int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *)); -. bfd_boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *)); +. (bfd *, unsigned int, struct orl *, unsigned int, int); +. void * (*_bfd_read_ar_hdr_fn) (bfd *); +. bfd * (*openr_next_archived_file) (bfd *, bfd *); +.#define bfd_get_elt_at_index(b,i) BFD_SEND (b, _bfd_get_elt_at_index, (b,i)) +. bfd * (*_bfd_get_elt_at_index) (bfd *, symindex); +. int (*_bfd_stat_arch_elt) (bfd *, struct stat *); +. bfd_boolean (*_bfd_update_armap_timestamp) (bfd *); . . {* Entry points used for symbols. *} .#define BFD_JUMP_TABLE_SYMBOLS(NAME) \ -.CONCAT2 (NAME,_get_symtab_upper_bound), \ -.CONCAT2 (NAME,_get_symtab), \ -.CONCAT2 (NAME,_make_empty_symbol), \ -.CONCAT2 (NAME,_print_symbol), \ -.CONCAT2 (NAME,_get_symbol_info), \ -.CONCAT2 (NAME,_bfd_is_local_label_name), \ -.CONCAT2 (NAME,_get_lineno), \ -.CONCAT2 (NAME,_find_nearest_line), \ -.CONCAT2 (NAME,_bfd_make_debug_symbol), \ -.CONCAT2 (NAME,_read_minisymbols), \ -.CONCAT2 (NAME,_minisymbol_to_symbol) -. long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *)); -. long (*_bfd_canonicalize_symtab) PARAMS ((bfd *, -. struct symbol_cache_entry **)); +. NAME##_get_symtab_upper_bound, \ +. NAME##_get_symtab, \ +. NAME##_make_empty_symbol, \ +. NAME##_print_symbol, \ +. NAME##_get_symbol_info, \ +. NAME##_bfd_is_local_label_name, \ +. NAME##_get_lineno, \ +. NAME##_find_nearest_line, \ +. NAME##_bfd_make_debug_symbol, \ +. NAME##_read_minisymbols, \ +. NAME##_minisymbol_to_symbol +. +. long (*_bfd_get_symtab_upper_bound) (bfd *); +. long (*_bfd_canonicalize_symtab) +. (bfd *, struct symbol_cache_entry **); . struct symbol_cache_entry * -. (*_bfd_make_empty_symbol) PARAMS ((bfd *)); +. (*_bfd_make_empty_symbol) (bfd *); . void (*_bfd_print_symbol) -. PARAMS ((bfd *, PTR, struct symbol_cache_entry *, bfd_print_symbol_type)); -.#define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e)) +. (bfd *, void *, struct symbol_cache_entry *, bfd_print_symbol_type); +.#define bfd_print_symbol(b,p,s,e) BFD_SEND (b, _bfd_print_symbol, (b,p,s,e)) . void (*_bfd_get_symbol_info) -. PARAMS ((bfd *, struct symbol_cache_entry *, symbol_info *)); -.#define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e)) -. bfd_boolean (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *)); +. (bfd *, struct symbol_cache_entry *, symbol_info *); +.#define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e)) +. bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *); . -. alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *)); +. alent * (*_get_lineno) (bfd *, struct symbol_cache_entry *); . bfd_boolean (*_bfd_find_nearest_line) -. PARAMS ((bfd *, struct sec *, struct symbol_cache_entry **, bfd_vma, -. const char **, const char **, unsigned int *)); +. (bfd *, struct sec *, struct symbol_cache_entry **, bfd_vma, +. const char **, const char **, unsigned int *); . {* Back-door to allow format-aware applications to create debug symbols . while using BFD for everything else. Currently used by the assembler . when creating COFF files. *} . asymbol * (*_bfd_make_debug_symbol) -. PARAMS ((bfd *, void *, unsigned long size)); +. (bfd *, void *, unsigned long size); .#define bfd_read_minisymbols(b, d, m, s) \ . BFD_SEND (b, _read_minisymbols, (b, d, m, s)) . long (*_read_minisymbols) -. PARAMS ((bfd *, bfd_boolean, PTR *, unsigned int *)); +. (bfd *, bfd_boolean, void **, unsigned int *); .#define bfd_minisymbol_to_symbol(b, d, m, f) \ . BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f)) . asymbol * (*_minisymbol_to_symbol) -. PARAMS ((bfd *, bfd_boolean, const PTR, asymbol *)); +. (bfd *, bfd_boolean, const void *, asymbol *); . . {* Routines for relocs. *} .#define BFD_JUMP_TABLE_RELOCS(NAME) \ -.CONCAT2 (NAME,_get_reloc_upper_bound), \ -.CONCAT2 (NAME,_canonicalize_reloc), \ -.CONCAT2 (NAME,_bfd_reloc_type_lookup) -. long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr)); +. NAME##_get_reloc_upper_bound, \ +. NAME##_canonicalize_reloc, \ +. NAME##_bfd_reloc_type_lookup +. +. long (*_get_reloc_upper_bound) (bfd *, sec_ptr); . long (*_bfd_canonicalize_reloc) -. PARAMS ((bfd *, sec_ptr, arelent **, struct symbol_cache_entry **)); +. (bfd *, sec_ptr, arelent **, struct symbol_cache_entry **); . {* See documentation on reloc types. *} . reloc_howto_type * -. (*reloc_type_lookup) PARAMS ((bfd *, bfd_reloc_code_real_type)); +. (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); . . {* Routines used when writing an object file. *} .#define BFD_JUMP_TABLE_WRITE(NAME) \ -.CONCAT2 (NAME,_set_arch_mach), \ -.CONCAT2 (NAME,_set_section_contents) +. NAME##_set_arch_mach, \ +. NAME##_set_section_contents +. . bfd_boolean (*_bfd_set_arch_mach) -. PARAMS ((bfd *, enum bfd_architecture, unsigned long)); +. (bfd *, enum bfd_architecture, unsigned long); . bfd_boolean (*_bfd_set_section_contents) -. PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); +. (bfd *, sec_ptr, void *, file_ptr, bfd_size_type); . . {* Routines used by the linker. *} .#define BFD_JUMP_TABLE_LINK(NAME) \ -.CONCAT2 (NAME,_sizeof_headers), \ -.CONCAT2 (NAME,_bfd_get_relocated_section_contents), \ -.CONCAT2 (NAME,_bfd_relax_section), \ -.CONCAT2 (NAME,_bfd_link_hash_table_create), \ -.CONCAT2 (NAME,_bfd_link_hash_table_free), \ -.CONCAT2 (NAME,_bfd_link_add_symbols), \ -.CONCAT2 (NAME,_bfd_link_just_syms), \ -.CONCAT2 (NAME,_bfd_final_link), \ -.CONCAT2 (NAME,_bfd_link_split_section), \ -.CONCAT2 (NAME,_bfd_gc_sections), \ -.CONCAT2 (NAME,_bfd_merge_sections), \ -.CONCAT2 (NAME,_bfd_discard_group) -. int (*_bfd_sizeof_headers) PARAMS ((bfd *, bfd_boolean)); +. NAME##_sizeof_headers, \ +. NAME##_bfd_get_relocated_section_contents, \ +. NAME##_bfd_relax_section, \ +. NAME##_bfd_link_hash_table_create, \ +. NAME##_bfd_link_hash_table_free, \ +. NAME##_bfd_link_add_symbols, \ +. NAME##_bfd_link_just_syms, \ +. NAME##_bfd_final_link, \ +. NAME##_bfd_link_split_section, \ +. NAME##_bfd_gc_sections, \ +. NAME##_bfd_merge_sections, \ +. NAME##_bfd_discard_group +. +. int (*_bfd_sizeof_headers) (bfd *, bfd_boolean); . bfd_byte * (*_bfd_get_relocated_section_contents) -. PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, -. bfd_byte *, bfd_boolean, struct symbol_cache_entry **)); +. (bfd *, struct bfd_link_info *, struct bfd_link_order *, +. bfd_byte *, bfd_boolean, struct symbol_cache_entry **); . . bfd_boolean (*_bfd_relax_section) -. PARAMS ((bfd *, struct sec *, struct bfd_link_info *, bfd_boolean *)); +. (bfd *, struct sec *, struct bfd_link_info *, bfd_boolean *); . . {* Create a hash table for the linker. Different backends store . different information in this table. *} . struct bfd_link_hash_table * -. (*_bfd_link_hash_table_create) PARAMS ((bfd *)); +. (*_bfd_link_hash_table_create) (bfd *); . . {* Release the memory associated with the linker hash table. *} -. void (*_bfd_link_hash_table_free) -. PARAMS ((struct bfd_link_hash_table *)); +. void (*_bfd_link_hash_table_free) (struct bfd_link_hash_table *); . . {* Add symbols from this object file into the hash table. *} -. bfd_boolean (*_bfd_link_add_symbols) -. PARAMS ((bfd *, struct bfd_link_info *)); +. bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *); . . {* Indicate that we are only retrieving symbol values from this section. *} -. void (*_bfd_link_just_syms) -. PARAMS ((asection *, struct bfd_link_info *)); +. void (*_bfd_link_just_syms) (asection *, struct bfd_link_info *); . . {* Do a link based on the link_order structures attached to each . section of the BFD. *} -. bfd_boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *)); +. bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *); . . {* Should this section be split up into smaller pieces during linking. *} -. bfd_boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *)); +. bfd_boolean (*_bfd_link_split_section) (bfd *, struct sec *); . . {* Remove sections that are not referenced from the output. *} -. bfd_boolean (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *)); +. bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *); . . {* Attempt to merge SEC_MERGE sections. *} -. bfd_boolean (*_bfd_merge_sections) PARAMS ((bfd *, struct bfd_link_info *)); +. bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *); . . {* Discard members of a group. *} -. bfd_boolean (*_bfd_discard_group) PARAMS ((bfd *, struct sec *)); +. bfd_boolean (*_bfd_discard_group) (bfd *, struct sec *); . . {* Routines to handle dynamic symbols and relocs. *} .#define BFD_JUMP_TABLE_DYNAMIC(NAME) \ -.CONCAT2 (NAME,_get_dynamic_symtab_upper_bound), \ -.CONCAT2 (NAME,_canonicalize_dynamic_symtab), \ -.CONCAT2 (NAME,_get_dynamic_reloc_upper_bound), \ -.CONCAT2 (NAME,_canonicalize_dynamic_reloc) +. NAME##_get_dynamic_symtab_upper_bound, \ +. NAME##_canonicalize_dynamic_symtab, \ +. NAME##_get_dynamic_reloc_upper_bound, \ +. NAME##_canonicalize_dynamic_reloc +. . {* Get the amount of memory required to hold the dynamic symbols. *} -. long (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *)); +. long (*_bfd_get_dynamic_symtab_upper_bound) (bfd *); . {* Read in the dynamic symbols. *} . long (*_bfd_canonicalize_dynamic_symtab) -. PARAMS ((bfd *, struct symbol_cache_entry **)); +. (bfd *, struct symbol_cache_entry **); . {* Get the amount of memory required to hold the dynamic relocs. *} -. long (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *)); +. long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *); . {* Read in the dynamic relocs. *} . long (*_bfd_canonicalize_dynamic_reloc) -. PARAMS ((bfd *, arelent **, struct symbol_cache_entry **)); +. (bfd *, arelent **, struct symbol_cache_entry **); . A pointer to an alternative bfd_target in case the current one is not @@ -475,7 +477,7 @@ to find an alternative output format that is suitable. . {* Data for use by back-end routines, which isn't . generic enough to belong in this structure. *} -. PTR backend_data; +. void *backend_data; . .} bfd_target; . @@ -1156,13 +1158,10 @@ static const struct targmatch bfd_target_match[] = { { NULL, NULL } }; -static const bfd_target *find_target PARAMS ((const char *)); - /* Find a target vector, given a name or configuration triplet. */ static const bfd_target * -find_target (name) - const char *name; +find_target (const char *name) { const bfd_target * const *target; const struct targmatch *match; @@ -1203,8 +1202,7 @@ DESCRIPTION */ bfd_boolean -bfd_set_default_target (name) - const char *name; +bfd_set_default_target (const char *name) { const bfd_target *target; @@ -1240,9 +1238,7 @@ DESCRIPTION */ const bfd_target * -bfd_find_target (target_name, abfd) - const char *target_name; - bfd *abfd; +bfd_find_target (const char *target_name, bfd *abfd) { const char *targname; const bfd_target *target; @@ -1288,9 +1284,9 @@ DESCRIPTION */ const char ** -bfd_target_list () +bfd_target_list (void) { - int vec_length= 0; + int vec_length = 0; bfd_size_type amt; #if defined (HOST_HPPAHPUX) && ! defined (__STDC__) /* The native compiler on the HP9000/700 has a bug which causes it @@ -1304,7 +1300,7 @@ bfd_target_list () vec_length++; amt = (vec_length + 1) * sizeof (char **); - name_ptr = name_list = (const char **) bfd_malloc (amt); + name_ptr = name_list = bfd_malloc (amt); if (name_list == NULL) return NULL; @@ -1323,9 +1319,9 @@ FUNCTION bfd_seach_for_target SYNOPSIS - const bfd_target * bfd_search_for_target (int (* search_func) - (const bfd_target *, void *), - void *); + const bfd_target *bfd_search_for_target + (int (*search_func) (const bfd_target *, void *), + void *); DESCRIPTION Return a pointer to the first transfer vector in the list of @@ -1336,15 +1332,14 @@ DESCRIPTION */ const bfd_target * -bfd_search_for_target (search_func, data) - int (* search_func) PARAMS ((const bfd_target * target, void * data)); - void * data; +bfd_search_for_target (int (*search_func) (const bfd_target *, void *), + void *data) { - const bfd_target * const * target; + const bfd_target * const *target; - for (target = bfd_target_vector; * target != NULL; target ++) - if (search_func (* target, data)) - return * target; + for (target = bfd_target_vector; *target != NULL; target ++) + if (search_func (*target, data)) + return *target; return NULL; } |