Stricter prototyping, to force type conversions between 64-bit target and

32-bit host values.

* libbfd.c (bfd_xmalloc_by_size_t): New function.
* opncls.c (bfd_cache_init, bfd_open_file): Add prototypes to declarations.
(obstack_chunk_alloc): Use bfd_xmalloc_by_size_t.
(new_bfd): Prototype-style definition, using DEFUN.
(bfd_alloc_grow, bfd_alloc, bfd_zalloc, bfd_realloc): Size argument is type
size_t, not bfd_size_type.
* ieee.c (obstack_chunk_alloc): Use bfd_xmalloc_by_size_t.
* bfd.c (bfd_default_error_trap, bfd_error_trap,
bfd_error_nonrepresentabltrap): Prototypes.
* libbfd-in.h (bfd_alloc, bfd_zalloc, bfd_realloc, bfd_alloc_grow): Adjusted
prototypes for arg type change.
* archive.c (get_elt_at_filepos, do_slurp_bsd_armap, normalize,
do_slurp_coff_armap, bfd_construct_extended_name_table): Prototypes.
This commit is contained in:
Ken Raeburn
1993-07-06 20:20:31 +00:00
parent 238ffce0bf
commit 70e009144e
3 changed files with 93 additions and 63 deletions

View File

@@ -32,7 +32,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "obstack.h"
#define obstack_chunk_alloc bfd_xmalloc
#define obstack_chunk_alloc bfd_xmalloc_by_size_t
#define obstack_chunk_free free
/* Functions for writing to ieee files in the strange way that the
@@ -1004,7 +1004,7 @@ DEFUN(ieee_archive_p,(abfd),
boolean loop;
unsigned int i;
uint8e_type buffer[512];
unsigned char buffer[512];
struct obstack ob;
file_ptr buffer_offset = 0;
ieee_ar_data_type *save = abfd->tdata.ieee_ar_data;
@@ -1122,8 +1122,9 @@ DEFUN(ieee_object_p,(abfd),
char *processor;
unsigned int part;
ieee_data_type *ieee;
uint8e_type buffer[300];
unsigned char buffer[300];
ieee_data_type *save = IEEE_DATA(abfd);
abfd->tdata.ieee_data = 0;
ieee_mkobject(abfd);
@@ -1198,7 +1199,7 @@ DEFUN(ieee_object_p,(abfd),
quickly. We can work out how big the file is from the trailer
record */
IEEE_DATA(abfd)->h.first_byte = (uint8e_type *) bfd_alloc(ieee->h.abfd, ieee->w.r.me_record
IEEE_DATA(abfd)->h.first_byte = (unsigned char *) bfd_alloc(ieee->h.abfd, ieee->w.r.me_record
+ 50);
bfd_seek(abfd, (file_ptr) 0, SEEK_SET);
bfd_read((PTR)(IEEE_DATA(abfd)->h.first_byte), 1, ieee->w.r.me_record+50, abfd);
@@ -1211,6 +1212,18 @@ abfd->tdata.ieee_data = save;
return (bfd_target *)NULL;
}
void
DEFUN(ieee_get_symbol_info,(ignore_abfd, symbol, ret),
bfd *ignore_abfd AND
asymbol *symbol AND
symbol_info *ret)
{
bfd_symbol_info (symbol, ret);
if (symbol->name[0] == ' ')
ret->name = "* empty table entry ";
if (!symbol->section)
ret->type = (symbol->flags & BSF_LOCAL) ? 'a' : 'A';
}
void
DEFUN(ieee_print_symbol,(ignore_abfd, afile, symbol, how),
@@ -1232,7 +1245,6 @@ DEFUN(ieee_print_symbol,(ignore_abfd, afile, symbol, how),
#endif
BFD_FAIL();
break;
case bfd_print_symbol_nm:
case bfd_print_symbol_all:
{
CONST char *section_name = symbol->section == (asection *)NULL ?
@@ -1261,7 +1273,7 @@ static void
DEFUN(do_one,(ieee, current_map, location_ptr,s),
ieee_data_type *ieee AND
ieee_per_section_type *current_map AND
uint8e_type *location_ptr AND
unsigned char *location_ptr AND
asection *s)
{
switch (this_byte(&(ieee->h)))
@@ -1522,7 +1534,7 @@ DEFUN(ieee_slurp_section_data,(abfd),
*/
unsigned int iterations ;
uint8e_type *start ;
unsigned char *start ;
next_byte(&(ieee->h));
iterations = must_parse_int(&(ieee->h));
start = ieee->h.input_p;
@@ -1780,7 +1792,7 @@ DEFUN(do_with_relocs,(abfd, s),
if ((PTR)stream == (PTR)NULL) {
/* Outputting a section without data, fill it up */
stream = (uint8e_type *)(bfd_alloc(abfd, s->_raw_size));
stream = (unsigned char *)(bfd_alloc(abfd, s->_raw_size));
memset((PTR)stream, 0, s->_raw_size);
}
while (current_byte_index < s->_raw_size) {
@@ -2989,8 +3001,12 @@ bfd_target ieee_vec =
' ', /* ar_pad_char */
16, /* ar_max_namelen */
1, /* minimum alignment */
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* data */
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs */
_do_getb64, _do_getb_signed_64, _do_putb64,
_do_getb32, _do_getb_signed_32, _do_putb32,
_do_getb16, _do_getb_signed_16, _do_putb16, /* data */
_do_getb64, _do_getb_signed_64, _do_putb64,
_do_getb32, _do_getb_signed_32, _do_putb32,
_do_getb16, _do_getb_signed_16, _do_putb16, /* hdrs */
{ _bfd_dummy_target,
ieee_object_p, /* bfd_check_format */