* bfd/aoutx.h: Add casts.
* bfd/archive.c: Add casts.
* bfd/archive64.c: Add casts.
* bfd/archures.c: Add casts.
* bfd/bfd-in2.h: Regenerated.
* bfd/bfd.c: Add casts. (enum bfd_direction): Move out to top
level.
* bfd/bfdio.c: Add casts.
* bfd/binary.c: Add casts.
* bfd/cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated
parameter to use enum value instead of int.
* bfd/coffcode.h: Add casts.
* bfd/coffgen.c: Add casts.
* bfd/cofflink.c: Add casts.
* bfd/compress.c: Add casts.
* bfd/dwarf1.c: Add casts.
* bfd/dwarf2.c: Add casts. (struct dwarf2_debug): Rename member
bfd to bfd_ptr. Update code to use new name.
* bfd/elf-attrs.c: Add casts.
* bfd/elf-bfd.h (elf_link_virtual_table_entry): Gives name to
anonymous struct. (union gotplt_union, struct
elf_link_virtual_table_entry): Move to top level.
* bfd/elf-eh-frame.c: Add casts.
* bfd/elf-strtab.c: Add casts.
* bfd/elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change
argument name from typename to type_name.
* bfd/elf32-i386.c: Add casts.
* bfd/elf64-x86-64.c: Add casts.
* bfd/elfcode.h: Add casts.
* bfd/elfcore.h: Add casts.
* bfd/elflink.c: Add casts.
* bfd/format.c: Add casts.
* bfd/hash.c: Add casts.
* bfd/ihex.c: Add casts.
* bfd/libaout.h (enum aout_subformat, enum aout_magic): Move to
top level.
* bfd/libbfd.c: Add casts.
* bfd/linker.c: Add casts.
* bfd/merge.c: Add casts.
* bfd/opncls.c: Add casts.
* bfd/peXXigen.c: Add casts.
* bfd/peicode.h: Add casts.
* bfd/reloc.c: Add casts.
* bfd/section.c: Add casts.
* bfd/simple.c: Add casts.
* bfd/srec.c: Add casts.
* bfd/stabs.c: Add casts.
* bfd/syms.c: Add casts.
* bfd/targets.c: Add casts.
* bfd/tekhex.c: Add casts.
* bfd/verilog.c: Add casts.
* include/bfdlink.h (struct bfd_link_hash_common_entry): Move to
top level.
+2009-09-09 Martin Thuresson <martin@mtme.org>
+
+ Update soruces to compile cleanly with -Wc++-compat:
+ * aoutx.h: Add casts.
+ * archive.c: Add casts.
+ * archive64.c: Add casts.
+ * archures.c: Add casts.
+ * bfd-in2.h: Regenerated.
+ * bfd.c: Add casts. (enum bfd_direction): Move out to top level.
+ * bfdio.c: Add casts.
+ * binary.c: Add casts.
+ * cache.c (cache_bseek,cache_bread_1,cache_bwrite): Updated
+ parameter to use enum value instead of int.
+ * coffcode.h: Add casts.
+ * coffgen.c: Add casts.
+ * cofflink.c: Add casts.
+ * compress.c: Add casts.
+ * dwarf1.c: Add casts.
+ * dwarf2.c: Add casts. (struct dwarf2_debug): Rename member bfd to
+ bfd_ptr. Update code to use new name.
+ * elf-attrs.c: Add casts.
+ * elf-bfd.h (elf_link_virtual_table_entry): Gives name to
+ anonymous struct. (union gotplt_union, struct
+ elf_link_virtual_table_entry): Move to top level.
+ * elf-eh-frame.c: Add casts.
+ * elf-strtab.c: Add casts.
+ * elf.c: Add casts. (_bfd_elm_make_Section_from_phdr): Change
+ argument name from typename to type_name.
+ * elf32-i386.c: Add casts.
+ * elf64-x86-64.c: Add casts.
+ * elfcode.h: Add casts.
+ * elfcore.h: Add casts.
+ * elflink.c: Add casts.
+ * format.c: Add casts.
+ * hash.c: Add casts.
+ * ihex.c: Add casts.
+ * libaout.h (enum aout_subformat, enum aout_magic): Move to top
+ level.
+ * libbfd.c: Add casts.
+ * linker.c: Add casts.
+ * merge.c: Add casts.
+ * opncls.c: Add casts.
+ * peXXigen.c: Add casts.
+ * peicode.h: Add casts.
+ * reloc.c: Add casts.
+ * section.c: Add casts.
+ * simple.c: Add casts.
+ * srec.c: Add casts.
+ * stabs.c: Add casts.
+ * syms.c: Add casts.
+ * targets.c: Add casts.
+ * tekhex.c: Add casts.
+ * verilog.c: Add casts.
+
2009-09-09 Paolo Bonzini <bonzini@gnu.org>
* configure: Regenerate.
const bfd_target *result;
bfd_size_type amt = sizeof (* rawptr);
- rawptr = bfd_zalloc (abfd, amt);
+ rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt);
if (rawptr == NULL)
return NULL;
bfd_set_error (bfd_error_system_call);
- rawptr = bfd_zalloc (abfd, amt);
+ rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt);
if (rawptr == NULL)
return FALSE;
/* We allocate using malloc to make the values easy to free
later on. If we put them on the objalloc it might not be
possible to free them. */
- syms = bfd_malloc (count * EXTERNAL_NLIST_SIZE);
+ syms = (struct external_nlist *) bfd_malloc (count * EXTERNAL_NLIST_SIZE);
if (syms == NULL)
return FALSE;
return FALSE;
strings = (char *) obj_aout_string_window (abfd).data;
#else
- strings = bfd_malloc (stringsize + 1);
+ strings = (char *) bfd_malloc (stringsize + 1);
if (strings == NULL)
return FALSE;
return TRUE; /* Nothing to do. */
cached_size *= sizeof (aout_symbol_type);
- cached = bfd_zmalloc (cached_size);
+ cached = (aout_symbol_type *) bfd_zmalloc (cached_size);
if (cached == NULL)
return FALSE;
return TRUE; /* Nothing to be done. */
amt = count * sizeof (arelent);
- reloc_cache = bfd_zmalloc (amt);
+ reloc_cache = (arelent *) bfd_zmalloc (amt);
if (reloc_cache == NULL)
return FALSE;
each_size = obj_reloc_entry_size (abfd);
natsize = (bfd_size_type) each_size * count;
- native = bfd_zalloc (abfd, natsize);
+ native = (unsigned char *) bfd_zalloc (abfd, natsize);
if (!native)
return FALSE;
adata (abfd).line_buf = buf = NULL;
else
{
- buf = bfd_malloc (filelen + funclen + 3);
+ buf = (char *) bfd_malloc (filelen + funclen + 3);
adata (abfd).line_buf = buf;
if (buf == NULL)
return FALSE;
/* Allocate the structure if it has not already been allocated by a
subclass. */
if (ret == NULL)
- ret = bfd_hash_allocate (table, sizeof (* ret));
+ ret = (struct aout_link_hash_entry *) bfd_hash_allocate (table,
+ sizeof (* ret));
if (ret == NULL)
return NULL;
struct aout_link_hash_table *ret;
bfd_size_type amt = sizeof (* ret);
- ret = bfd_malloc (amt);
+ ret = (struct aout_link_hash_table *) bfd_malloc (amt);
if (ret == NULL)
return NULL;
table, but keeping the list is more efficient. Perhaps this
should be conditional on info->keep_memory. */
amt = sym_count * sizeof (struct aout_link_hash_entry *);
- sym_hash = bfd_alloc (abfd, amt);
+ sym_hash = (struct aout_link_hash_entry **) bfd_alloc (abfd, amt);
if (sym_hash == NULL)
return FALSE;
obj_aout_sym_hashes (abfd) = sym_hash;
/* Turn the current link symbol into a common
symbol. It is already on the undefs list. */
h->type = bfd_link_hash_common;
- h->u.c.p = bfd_hash_allocate (&info->hash->table,
- sizeof (struct bfd_link_hash_common_entry));
+ h->u.c.p = (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;
/* Allocate the structure if it has not already been allocated by a
subclass. */
if (ret == NULL)
- ret = bfd_hash_allocate (table, sizeof (* ret));
+ ret = (struct aout_link_includes_entry *)
+ bfd_hash_allocate (table, sizeof (* ret));
if (ret == NULL)
return NULL;
bfd_boolean ok;
size = bfd_get_reloc_size (howto);
- buf = bfd_zmalloc (size);
+ buf = (bfd_byte *) bfd_zmalloc (size);
if (buf == NULL)
return FALSE;
r = MY_relocate_contents (howto, finfo->output_bfd,
{
/* This is the first time we have seen this header
file with this set of stabs strings. */
- t = bfd_hash_allocate (&finfo->includes.root,
+ t = (struct aout_link_includes_totals *)
+ bfd_hash_allocate (&finfo->includes.root,
sizeof *t);
if (t == NULL)
return FALSE;
goto error_return;
/* Allocate buffers to hold section contents and relocs. */
- aout_info.contents = bfd_malloc (max_contents_size);
+ aout_info.contents = (bfd_byte *) bfd_malloc (max_contents_size);
aout_info.relocs = bfd_malloc (max_relocs_size);
- aout_info.symbol_map = bfd_malloc (max_sym_count * sizeof (int *));
- aout_info.output_syms = bfd_malloc ((max_sym_count + 1)
- * sizeof (struct external_nlist));
+ aout_info.symbol_map = (int *) bfd_malloc (max_sym_count * sizeof (int *));
+ aout_info.output_syms = (struct external_nlist *)
+ bfd_malloc ((max_sym_count + 1) * sizeof (struct external_nlist));
if ((aout_info.contents == NULL && max_contents_size != 0)
|| (aout_info.relocs == NULL && max_relocs_size != 0)
|| (aout_info.symbol_map == NULL && max_sym_count != 0)
{
bfd_size_type amt = sizeof (struct artdata);
- abfd->tdata.aout_ar_data = bfd_zalloc (abfd, amt);
+ abfd->tdata.aout_ar_data = (struct artdata *) bfd_zalloc (abfd, amt);
if (bfd_ardata (abfd) == NULL)
return FALSE;
}
/* Insert new_elt into the hash table by filepos. */
- cache = bfd_zalloc (arch_bfd, sizeof (struct ar_cache));
+ cache = (struct ar_cache *) bfd_zalloc (arch_bfd, sizeof (struct ar_cache));
cache->ptr = filepos;
cache->arbfd = new_elt;
*htab_find_slot (hash_table, (const void *) cache, INSERT) = cache;
allocsize += namelen + 1;
parsed_size -= namelen;
- allocptr = bfd_zalloc (abfd, allocsize);
+ allocptr = (char *) bfd_zalloc (abfd, allocsize);
if (allocptr == NULL)
return NULL;
filename = (allocptr
spaces, so only look for ' ' if we don't find '/'. */
char *e;
- e = memchr (hdr.ar_name, '\0', ar_maxnamelen (abfd));
+ e = (char *) memchr (hdr.ar_name, '\0', ar_maxnamelen (abfd));
if (e == NULL)
{
- e = memchr (hdr.ar_name, '/', ar_maxnamelen (abfd));
+ e = (char *) memchr (hdr.ar_name, '/', ar_maxnamelen (abfd));
if (e == NULL)
- e = memchr (hdr.ar_name, ' ', ar_maxnamelen (abfd));
+ e = (char *) memchr (hdr.ar_name, ' ', ar_maxnamelen (abfd));
}
if (e != NULL)
if (!allocptr)
{
- allocptr = bfd_zalloc (abfd, allocsize);
+ allocptr = (char *) bfd_zalloc (abfd, allocsize);
if (allocptr == NULL)
return NULL;
}
return elt_name;
prefix_len = base_name - arch_name;
- filename = bfd_alloc (arch, prefix_len + strlen (elt_name) + 1);
+ filename = (char *) bfd_alloc (arch, prefix_len + strlen (elt_name) + 1);
if (filename == NULL)
return NULL;
if (0 > bfd_seek (archive, filepos, SEEK_SET))
return NULL;
- if ((new_areldata = _bfd_read_ar_hdr (archive)) == NULL)
+ if ((new_areldata = (struct areltdata *) _bfd_read_ar_hdr (archive)) == NULL)
return NULL;
filename = new_areldata->filename;
tdata_hold = bfd_ardata (abfd);
amt = sizeof (struct artdata);
- bfd_ardata (abfd) = bfd_zalloc (abfd, amt);
+ bfd_ardata (abfd) = (struct artdata *) bfd_zalloc (abfd, amt);
if (bfd_ardata (abfd) == NULL)
{
bfd_ardata (abfd) = tdata_hold;
bfd_size_type parsed_size, amt;
carsym *set;
- mapdata = _bfd_read_ar_hdr (abfd);
+ mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
if (mapdata == NULL)
return FALSE;
parsed_size = mapdata->parsed_size;
bfd_release (abfd, mapdata); /* Don't need it any more. */
- raw_armap = bfd_zalloc (abfd, parsed_size);
+ raw_armap = (bfd_byte *) bfd_zalloc (abfd, parsed_size);
if (raw_armap == NULL)
return FALSE;
+ ardata->symdef_count * BSD_SYMDEF_SIZE
+ BSD_STRING_COUNT_SIZE);
amt = ardata->symdef_count * sizeof (carsym);
- ardata->symdefs = bfd_alloc (abfd, amt);
+ ardata->symdefs = (struct carsym *) bfd_alloc (abfd, amt);
if (!ardata->symdefs)
return FALSE;
bfd_size_type carsym_size, ptrsize;
unsigned int i;
- mapdata = _bfd_read_ar_hdr (abfd);
+ mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
if (mapdata == NULL)
return FALSE;
parsed_size = mapdata->parsed_size;
if (carsym_size + stringsize + 1 <= carsym_size)
return FALSE;
- ardata->symdefs = bfd_zalloc (abfd, carsym_size + stringsize + 1);
+ ardata->symdefs = (struct carsym *) 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 = bfd_alloc (abfd, ptrsize);
+ raw_armap = (int *) bfd_alloc (abfd, ptrsize);
if (raw_armap == NULL)
goto release_symdefs;
if (bfd_bread (raw_armap, ptrsize, abfd) != ptrsize
struct areltdata *tmp;
bfd_seek (abfd, ardata->first_file_filepos, SEEK_SET);
- tmp = _bfd_read_ar_hdr (abfd);
+ tmp = (struct areltdata *) _bfd_read_ar_hdr (abfd);
if (tmp != NULL)
{
if (tmp->arch_header[0] == '/'
return TRUE;
}
- mapdata = _bfd_read_ar_hdr (abfd);
+ mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
if (mapdata == NULL)
return FALSE;
amt = mapdata->parsed_size;
- raw_armap = bfd_zalloc (abfd, amt);
+ raw_armap = (bfd_byte *) bfd_zalloc (abfd, amt);
if (raw_armap == NULL)
{
byebye:
+ BSD_STRING_COUNT_SIZE);
rbase = (bfd_byte *) stringbase + stringsize;
amt = ardata->symdef_count * BSD_SYMDEF_SIZE;
- ardata->symdefs = bfd_alloc (abfd, amt);
+ ardata->symdefs = (struct carsym *) bfd_alloc (abfd, amt);
if (!ardata->symdefs)
return FALSE;
return TRUE;
}
- namedata = _bfd_read_ar_hdr (abfd);
+ namedata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
if (namedata == NULL)
return FALSE;
goto byebye;
bfd_ardata (abfd)->extended_names_size = amt;
- bfd_ardata (abfd)->extended_names = bfd_zalloc (abfd, amt + 1);
+ bfd_ardata (abfd)->extended_names = (char *) bfd_zalloc (abfd, amt + 1);
if (bfd_ardata (abfd)->extended_names == NULL)
{
byebye:
if (pathbuf != NULL)
free (pathbuf);
pathbuf_len = 0;
- pathbuf = bfd_malloc (len);
+ pathbuf = (char *) bfd_malloc (len);
if (pathbuf == NULL)
return path;
pathbuf_len = len;
if (total_namelen == 0)
return TRUE;
- *tabloc = bfd_zalloc (abfd, total_namelen);
+ *tabloc = (char *) bfd_zalloc (abfd, total_namelen);
if (*tabloc == NULL)
return FALSE;
if (member && (member->flags & BFD_IN_MEMORY) != 0)
{
/* Assume we just "made" the member, and fake it. */
- struct bfd_in_memory *bim = member->iostream;
+ struct bfd_in_memory *bim = (struct bfd_in_memory *) member->iostream;
time (&status.st_mtime);
status.st_uid = getuid ();
status.st_gid = getgid ();
}
amt = sizeof (struct ar_hdr) + sizeof (struct areltdata);
- ared = bfd_zalloc (abfd, amt);
+ ared = (struct areltdata *) bfd_zalloc (abfd, amt);
if (ared == NULL)
return NULL;
hdr = (struct ar_hdr *) (((char *) ared) + sizeof (struct areltdata));
elength += elength % 2;
amt = orl_max * sizeof (struct orl);
- map = bfd_malloc (amt);
+ map = (struct orl *) 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, 1);
+ first_name = (char *) bfd_alloc (arch, 1);
if (first_name == NULL)
goto error_return;
if (syms_max > 0)
free (syms);
syms_max = storage;
- syms = bfd_malloc (syms_max);
+ syms = (asymbol **) bfd_malloc (syms_max);
if (syms == NULL)
goto error_return;
}
{
orl_max *= 2;
amt = orl_max * sizeof (struct orl);
- new_map = bfd_realloc (map, amt);
+ new_map = (struct orl *) bfd_realloc (map, amt);
if (new_map == NULL)
goto error_return;
namelen = strlen (syms[src_count]->name);
amt = sizeof (char *);
- map[orl_count].name = bfd_alloc (arch, amt);
+ map[orl_count].name = (char **) bfd_alloc (arch, amt);
if (map[orl_count].name == NULL)
goto error_return;
- *(map[orl_count].name) = bfd_alloc (arch, namelen + 1);
+ *(map[orl_count].name) = (char *) bfd_alloc (arch,
+ namelen + 1);
if (*(map[orl_count].name) == NULL)
goto error_return;
strcpy (*(map[orl_count].name), syms[src_count]->name);
ptrsize = 8 * nsymz;
amt = carsym_size + stringsize + 1;
- ardata->symdefs = bfd_zalloc (abfd, amt);
+ ardata->symdefs = (struct carsym *) bfd_zalloc (abfd, amt);
if (ardata->symdefs == NULL)
return FALSE;
carsyms = ardata->symdefs;
stringbase = ((char *) ardata->symdefs) + carsym_size;
- raw_armap = bfd_alloc (abfd, ptrsize);
+ raw_armap = (bfd_byte *) bfd_alloc (abfd, ptrsize);
if (raw_armap == NULL)
goto release_symdefs;
}
amt = (vec_length + 1) * sizeof (char **);
- name_list = bfd_malloc (amt);
+ name_list = (const char **) bfd_malloc (amt);
if (name_list == NULL)
return NULL;
(ibfd, isymbol, obfd, osymbol))
/* Extracted from bfd.c. */
+enum bfd_direction
+ {
+ no_direction = 0,
+ read_direction = 1,
+ write_direction = 2,
+ both_direction = 3
+ };
+
struct bfd
{
/* A unique identifier of the BFD */
bfd_format format;
/* The direction with which the BFD was opened. */
- enum bfd_direction
- {
- no_direction = 0,
- read_direction = 1,
- write_direction = 2,
- both_direction = 3
- }
- direction;
+ enum bfd_direction direction;
/* Format_specific flags. */
flagword flags;
CODE_FRAGMENT
.
+.enum bfd_direction
+. {
+. no_direction = 0,
+. read_direction = 1,
+. write_direction = 2,
+. both_direction = 3
+. };
+.
.struct bfd
.{
. {* A unique identifier of the BFD *}
. bfd_format format;
.
. {* The direction with which the BFD was opened. *}
-. enum bfd_direction
-. {
-. no_direction = 0,
-. read_direction = 1,
-. write_direction = 2,
-. both_direction = 3
-. }
-. direction;
+. enum bfd_direction direction;
.
. {* Format_specific flags. *}
. flagword flags;
va_start (ap, error_tag);
input_bfd = va_arg (ap, bfd *);
- input_error = va_arg (ap, int);
+ input_error = (bfd_error_type) va_arg (ap, int);
if (input_error >= bfd_error_on_input)
abort ();
va_end (ap);
amt = sizeof (struct elf_segment_map);
amt += ((bfd_size_type) count - 1) * sizeof (asection *);
- m = bfd_zalloc (abfd, amt);
+ m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
if (m == NULL)
return FALSE;
suf = strchr (name, '@');
if (suf != NULL)
{
- alloc = bfd_malloc (suf - name + 1);
+ alloc = (char *) bfd_malloc (suf - name + 1);
if (alloc == NULL)
return NULL;
memcpy (alloc, name, suf - name);
if (skip_lead)
{
size_t len = strlen (pre) + 1;
- alloc = bfd_malloc (len);
+ alloc = (char *) bfd_malloc (len);
if (alloc == NULL)
return NULL;
memcpy (alloc, pre, len);
if (suf == NULL)
suf = res + len;
suf_len = strlen (suf) + 1;
- final = bfd_malloc (pre_len + len + suf_len);
+ final = (char *) bfd_malloc (pre_len + len + suf_len);
if (final != NULL)
{
memcpy (final, pre, pre_len);
struct bfd_in_memory *bim;
bfd_size_type get;
- bim = abfd->iostream;
+ bim = (struct bfd_in_memory *) abfd->iostream;
get = size;
if (abfd->where + get > bim->size)
{
if ((abfd->flags & BFD_IN_MEMORY) != 0)
{
- struct bfd_in_memory *bim = abfd->iostream;
+ struct bfd_in_memory *bim = (struct bfd_in_memory *) abfd->iostream;
size = (size_t) size;
if (abfd->where + size > bim->size)
newsize = (bim->size + 127) & ~(bfd_size_type) 127;
if (newsize > oldsize)
{
- bim->buffer = bfd_realloc_or_free (bim->buffer, newsize);
+ bim->buffer = (bfd_byte *) bfd_realloc_or_free (bim->buffer,
+ newsize);
if (bim->buffer == NULL)
{
bim->size = 0;
{
struct bfd_in_memory *bim;
- bim = abfd->iostream;
+ bim = (struct bfd_in_memory *) abfd->iostream;
if (direction == SEEK_SET)
abfd->where = position;
newsize = (bim->size + 127) & ~(bfd_size_type) 127;
if (newsize > oldsize)
{
- bim->buffer = bfd_realloc_or_free (bim->buffer, newsize);
+ bim->buffer = (bfd_byte *) bfd_realloc_or_free (bim->buffer,
+ newsize);
if (bim->buffer == NULL)
{
bim->size = 0;
+ strlen (suffix)
+ sizeof "_binary__");
- buf = bfd_alloc (abfd, size);
+ buf = (char *) bfd_alloc (abfd, size);
if (buf == NULL)
return "";
unsigned int i;
bfd_size_type amt = BIN_SYMS * sizeof (asymbol);
- syms = bfd_alloc (abfd, amt);
+ syms = (asymbol *) bfd_alloc (abfd, amt);
if (syms == NULL)
return -1;
static int
cache_bseek (struct bfd *abfd, file_ptr offset, int whence)
{
- FILE *f = bfd_cache_lookup (abfd, whence != SEEK_CUR ? CACHE_NO_SEEK : 0);
+ FILE *f = bfd_cache_lookup (abfd, whence != SEEK_CUR ? CACHE_NO_SEEK : CACHE_NORMAL);
if (f == NULL)
return -1;
return real_fseek (f, offset, whence);
if (nbytes == 0)
return 0;
- f = bfd_cache_lookup (abfd, 0);
+ f = bfd_cache_lookup (abfd, CACHE_NORMAL);
if (f == NULL)
return 0;
cache_bwrite (struct bfd *abfd, const void *where, file_ptr nbytes)
{
file_ptr nwrite;
- FILE *f = bfd_cache_lookup (abfd, 0);
+ FILE *f = bfd_cache_lookup (abfd, CACHE_NORMAL);
if (f == NULL)
return 0;
amt = sizeof (struct coff_comdat_info);
coff_section_data (abfd, section)->comdat
- = bfd_alloc (abfd, amt);
+ = (struct coff_comdat_info *) bfd_alloc (abfd, amt);
if (coff_section_data (abfd, section)->comdat == NULL)
abort ();
(esym - esymstart) / bfd_coff_symesz (abfd);
amt = strlen (symname) + 1;
- newname = bfd_alloc (abfd, amt);
+ newname = (char *) bfd_alloc (abfd, amt);
if (newname == NULL)
abort ();
@@ The 10 is a guess at a plausible maximum number of aux entries
(but shouldn't be a constant). */
amt = sizeof (combined_entry_type) * 10;
- native = bfd_zalloc (abfd, amt);
+ native = (combined_entry_type *) bfd_zalloc (abfd, amt);
if (native == NULL)
return FALSE;
/* We allocate an extra cell to simplify the final loop. */
amt = sizeof (struct asection *) * (count + 1);
- section_list = bfd_malloc (amt);
+ section_list = (asection **) bfd_malloc (amt);
if (section_list == NULL)
return FALSE;
char * buff;
bfd_size_type amount = bfd_coff_filhsz (abfd);
- buff = bfd_malloc (amount);
+ buff = (char *) bfd_malloc (amount);
if (buff == NULL)
return FALSE;
char * buff;
bfd_size_type amount = bfd_coff_aoutsz (abfd);
- buff = bfd_malloc (amount);
+ buff = (char *) bfd_malloc (amount);
if (buff == NULL)
return FALSE;
BFD_ASSERT (asect->lineno == NULL);
amt = ((bfd_size_type) asect->lineno_count + 1) * sizeof (alent);
- lineno_cache = bfd_alloc (abfd, amt);
+ lineno_cache = (alent *) bfd_alloc (abfd, amt);
if (lineno_cache == NULL)
return FALSE;
alent *n_lineno_cache;
/* Create a table of functions. */
- func_table = bfd_alloc (abfd, nbr_func * sizeof (alent *));
+ func_table = (alent **) bfd_alloc (abfd, nbr_func * sizeof (alent *));
if (func_table != NULL)
{
alent **p = func_table;
/* Create the new sorted table. */
amt = ((bfd_size_type) asect->lineno_count + 1) * sizeof (alent);
- n_lineno_cache = bfd_alloc (abfd, amt);
+ n_lineno_cache = (alent *) bfd_alloc (abfd, amt);
if (n_lineno_cache != NULL)
{
alent *n_cache_ptr = n_lineno_cache;
/* Allocate enough room for all the symbols in cached form. */
amt = obj_raw_syment_count (abfd);
amt *= sizeof (coff_symbol_type);
- cached_area = bfd_alloc (abfd, amt);
+ cached_area = (coff_symbol_type *) bfd_alloc (abfd, amt);
if (cached_area == NULL)
return FALSE;
amt = obj_raw_syment_count (abfd);
amt *= sizeof (unsigned int);
- table_ptr = bfd_alloc (abfd, amt);
+ table_ptr = (unsigned int *) bfd_alloc (abfd, amt);
if (table_ptr == NULL)
return FALSE;
amt = (bfd_size_type) bfd_coff_relsz (abfd) * asect->reloc_count;
native_relocs = (RELOC *) buy_and_read (abfd, asect->rel_filepos, amt);
amt = (bfd_size_type) asect->reloc_count * sizeof (arelent);
- reloc_cache = bfd_alloc (abfd, amt);
+ reloc_cache = (arelent *) bfd_alloc (abfd, amt);
if (reloc_cache == NULL || native_relocs == NULL)
return FALSE;
strindex does not run us past the end, but right now we
don't know the length of the string table. */
strings += strindex;
- name = bfd_alloc (abfd, (bfd_size_type) strlen (strings) + 1);
+ name = (char *) bfd_alloc (abfd,
+ (bfd_size_type) strlen (strings) + 1);
if (name == NULL)
return FALSE;
strcpy (name, strings);
if (name == NULL)
{
/* Assorted wastage to null-terminate the name, thanks AT&T! */
- name = bfd_alloc (abfd, (bfd_size_type) sizeof (hdr->s_name) + 1);
+ name = (char *) bfd_alloc (abfd,
+ (bfd_size_type) sizeof (hdr->s_name) + 1);
if (name == NULL)
return FALSE;
strncpy (name, (char *) &hdr->s_name[0], sizeof (hdr->s_name));
scnhsz = bfd_coff_scnhsz (abfd);
readsize = (bfd_size_type) nscns * scnhsz;
- external_sections = bfd_alloc (abfd, readsize);
+ external_sections = (char *) bfd_alloc (abfd, readsize);
if (!external_sections)
goto fail;
amt = sec->reloc_count * relsz;
if (external_relocs == NULL)
{
- free_external = bfd_malloc (amt);
+ free_external = (bfd_byte *) bfd_malloc (amt);
if (free_external == NULL)
goto error_return;
external_relocs = free_external;
{
amt = sec->reloc_count;
amt *= sizeof (struct internal_reloc);
- free_internal = bfd_malloc (amt);
+ free_internal = (struct internal_reloc *) bfd_malloc (amt);
if (free_internal == NULL)
goto error_return;
internal_relocs = free_internal;
bfd_size_type amt;
amt = sizeof (asymbol *) * ((bfd_size_type) symbol_count + 1);
- newsyms = bfd_alloc (bfd_ptr, amt);
+ newsyms = (asymbol **) bfd_alloc (bfd_ptr, amt);
if (!newsyms)
return FALSE;
bfd_ptr->outsymbols = newsyms;
{
unsigned int numaux = native->u.syment.n_numaux;
int type = native->u.syment.n_type;
- int n_sclass = native->u.syment.n_sclass;
+ int n_sclass = (int) native->u.syment.n_sclass;
void * buf;
bfd_size_type symesz;
}
sec_size = sect->size;
- debug_section = bfd_alloc (abfd, sec_size);
+ debug_section = (char *) bfd_alloc (abfd, sec_size);
if (debug_section == NULL)
return NULL;
if (name[len] == '\0')
break;
- if ((newname = bfd_alloc (abfd, (bfd_size_type) len + 1)) == NULL)
+ if ((newname = (char *) bfd_alloc (abfd, (bfd_size_type) len + 1)) == NULL)
return NULL;
strncpy (newname, name, len);
return NULL;
}
- strings = bfd_malloc (strsize);
+ strings = (char *) bfd_malloc (strsize);
if (strings == NULL)
return NULL;
return obj_raw_syments (abfd);
size = obj_raw_syment_count (abfd) * sizeof (combined_entry_type);
- internal = bfd_zalloc (abfd, size);
+ internal = (combined_entry_type *) bfd_zalloc (abfd, size);
if (internal == NULL && size != 0)
return NULL;
internal_end = internal + obj_raw_syment_count (abfd);
if (internal_ptr->u.syment._n._n_name[i] == '\0')
break;
- newstring = bfd_zalloc (abfd, (bfd_size_type) (i + 1));
+ newstring = (char *) bfd_zalloc (abfd, (bfd_size_type) (i + 1));
if (newstring == NULL)
return NULL;
strncpy (newstring, internal_ptr->u.syment._n._n_name, i);
combined_entry_type * native;
bfd_size_type amt = sizeof (* native);
- native = bfd_zalloc (abfd, amt);
+ native = (combined_entry_type *) bfd_zalloc (abfd, amt);
if (native == NULL)
return FALSE;
struct coff_link_hash_table *ret;
bfd_size_type amt = sizeof (struct coff_link_hash_table);
- ret = bfd_malloc (amt);
+ ret = (struct coff_link_hash_table *) bfd_malloc (amt);
if (ret == NULL)
return NULL;
/* We keep a list of the linker hash table entries that correspond
to particular symbols. */
amt = symcount * sizeof (struct coff_link_hash_entry *);
- sym_hash = bfd_zalloc (abfd, amt);
+ sym_hash = (struct coff_link_hash_entry **) bfd_zalloc (abfd, amt);
if (sym_hash == NULL)
goto error_return;
obj_coff_sym_hashes (abfd) = sym_hash;
the target_index fields are 1 based. */
amt = abfd->section_count + 1;
amt *= sizeof (struct coff_link_section_info);
- finfo.section_info = bfd_malloc (amt);
+ finfo.section_info = (struct coff_link_section_info *) bfd_malloc (amt);
if (finfo.section_info == NULL)
goto error_return;
for (i = 0; i <= abfd->section_count; i++)
BFD_ASSERT (info->relocatable);
amt = o->reloc_count;
amt *= sizeof (struct internal_reloc);
- finfo.section_info[o->target_index].relocs = bfd_malloc (amt);
+ finfo.section_info[o->target_index].relocs =
+ (struct internal_reloc *) bfd_malloc (amt);
amt = o->reloc_count;
amt *= sizeof (struct coff_link_hash_entry *);
- finfo.section_info[o->target_index].rel_hashes = bfd_malloc (amt);
+ finfo.section_info[o->target_index].rel_hashes =
+ (struct coff_link_hash_entry **) bfd_malloc (amt);
if (finfo.section_info[o->target_index].relocs == NULL
|| finfo.section_info[o->target_index].rel_hashes == NULL)
goto error_return;
/* Allocate some buffers used while linking. */
amt = max_sym_count * sizeof (struct internal_syment);
- finfo.internal_syms = bfd_malloc (amt);
+ finfo.internal_syms = (struct internal_syment *) bfd_malloc (amt);
amt = max_sym_count * sizeof (asection *);
- finfo.sec_ptrs = bfd_malloc (amt);
+ finfo.sec_ptrs = (asection **) bfd_malloc (amt);
amt = max_sym_count * sizeof (long);
- finfo.sym_indices = bfd_malloc (amt);
- finfo.outsyms = bfd_malloc ((max_sym_count + 1) * symesz);
+ finfo.sym_indices = (long int *) bfd_malloc (amt);
+ finfo.outsyms = (bfd_byte *) bfd_malloc ((max_sym_count + 1) * symesz);
amt = max_lineno_count * bfd_coff_linesz (abfd);
- finfo.linenos = bfd_malloc (amt);
- finfo.contents = bfd_malloc (max_contents_size);
+ finfo.linenos = (bfd_byte *) bfd_malloc (amt);
+ finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size);
amt = max_reloc_count * relsz;
- finfo.external_relocs = bfd_malloc (amt);
+ finfo.external_relocs = (bfd_byte *) bfd_malloc (amt);
if (! info->relocatable)
{
amt = max_reloc_count * sizeof (struct internal_reloc);
- finfo.internal_relocs = bfd_malloc (amt);
+ finfo.internal_relocs = (struct internal_reloc *) bfd_malloc (amt);
}
if ((finfo.internal_syms == NULL && max_sym_count > 0)
|| (finfo.sec_ptrs == NULL && max_sym_count > 0)
the symbol indices to use for relocs against them, and we can
finally write out the relocs. */
amt = max_output_reloc_count * relsz;
- external_relocs = bfd_malloc (amt);
+ external_relocs = (bfd_byte *) bfd_malloc (amt);
if (external_relocs == NULL)
goto error_return;
out to be a duplicate, we pass this address to
bfd_release. */
amt = sizeof (struct coff_debug_merge_type);
- mt = bfd_alloc (input_bfd, amt);
+ mt = (struct coff_debug_merge_type *) bfd_alloc (input_bfd, amt);
if (mt == NULL)
return FALSE;
mt->type_class = isym.n_sclass;
bfd_coff_swap_sym_in (input_bfd, esl, islp);
amt = sizeof (struct coff_debug_merge_element);
- *epp = bfd_alloc (input_bfd, amt);
+ *epp = (struct coff_debug_merge_element *)
+ bfd_alloc (input_bfd, amt);
if (*epp == NULL)
return FALSE;
return FALSE;
amt = strlen (elename) + 1;
- name_copy = bfd_alloc (input_bfd, amt);
+ name_copy = (char *) bfd_alloc (input_bfd, amt);
if (name_copy == NULL)
return FALSE;
strcpy (name_copy, elename);
file_ptr loc;
size = bfd_get_reloc_size (howto);
- buf = bfd_zmalloc (size);
+ buf = (bfd_byte *) bfd_zmalloc (size);
if (buf == NULL)
return FALSE;
strm.avail_in = compressed_size - header_size;
strm.next_in = (Bytef*) compressed_buffer + header_size;
strm.avail_out = uncompressed_size;
- uncompressed_buffer = bfd_malloc (uncompressed_size);
+ uncompressed_buffer = (bfd_byte *) bfd_malloc (uncompressed_size);
if (! uncompressed_buffer)
return FALSE;
{
bfd_size_type amt = sizeof (struct dwarf1_unit);
- struct dwarf1_unit* x = bfd_zalloc (stash->abfd, amt);
+ struct dwarf1_unit* x = (struct dwarf1_unit *) bfd_zalloc (stash->abfd, amt);
if (x)
{
x->prev = stash->lastUnit;
{
bfd_size_type amt = sizeof (struct dwarf1_func);
- struct dwarf1_func* x = bfd_zalloc (stash->abfd, amt);
+ struct dwarf1_func* x = (struct dwarf1_func *) bfd_zalloc (stash->abfd, amt);
if (x)
{
x->prev = aUnit->func_list;
/* Allocate an array for the entries. */
amt = sizeof (struct linenumber) * aUnit->line_count;
- aUnit->linenumber_table = bfd_alloc (stash->abfd, amt);
+ aUnit->linenumber_table = (struct linenumber *) bfd_alloc (stash->abfd,
+ amt);
if (!aUnit->linenumber_table)
return FALSE;
bfd_size_type size = sizeof (struct dwarf1_debug);
stash = elf_tdata (abfd)->dwarf1_find_line_info
- = bfd_zalloc (abfd, size);
+ = (struct dwarf1_debug *) bfd_zalloc (abfd, size);
if (! stash)
return FALSE;
/* Pointer to the bfd, section and address of the beginning of the
section. The bfd might be different than expected because of
gnu_debuglink sections. */
- bfd * bfd;
+ bfd *bfd_ptr;
asection *sec;
bfd_byte *sec_info_ptr;
derived class. */
if (ret == NULL)
{
- ret = bfd_hash_allocate (table, sizeof (* ret));
+ ret = (struct info_hash_entry *) bfd_hash_allocate (table,
+ sizeof (* ret));
if (ret == NULL)
return NULL;
}
{
struct info_hash_table *hash_table;
- hash_table = bfd_alloc (abfd, sizeof (struct info_hash_table));
+ hash_table = (struct info_hash_table *)
+ bfd_alloc (abfd, sizeof (struct info_hash_table));
if (!hash_table)
return hash_table;
if (!entry)
return FALSE;
- node = bfd_hash_allocate (&hash_table->base, sizeof (*node));
+ node = (struct info_list_node *) bfd_hash_allocate (&hash_table->base,
+ sizeof (*node));
if (!node)
return FALSE;
}
else
{
- *section_buffer = bfd_malloc (*section_size);
+ *section_buffer = (bfd_byte *) bfd_malloc (*section_size);
if (! *section_buffer)
return FALSE;
if (! bfd_get_section_contents (abfd, msec, *section_buffer,
return 0;
amt = sizeof (struct abbrev_info*) * ABBREV_HASH_SIZE;
- abbrevs = bfd_zalloc (abfd, amt);
+ abbrevs = (struct abbrev_info **) bfd_zalloc (abfd, amt);
abbrev_ptr = stash->dwarf_abbrev_buffer + offset;
abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
while (abbrev_number)
{
amt = sizeof (struct abbrev_info);
- cur_abbrev = bfd_zalloc (abfd, amt);
+ cur_abbrev = (struct abbrev_info *) bfd_zalloc (abfd, amt);
/* Read in abbrev header. */
cur_abbrev->number = abbrev_number;
amt = cur_abbrev->num_attrs + ATTR_ALLOC_CHUNK;
amt *= sizeof (struct attr_abbrev);
- tmp = bfd_realloc (cur_abbrev->attrs, amt);
+ tmp = (struct attr_abbrev *) bfd_realloc (cur_abbrev->attrs, amt);
if (tmp == NULL)
{
size_t i;
break;
case DW_FORM_block2:
amt = sizeof (struct dwarf_block);
- blk = bfd_alloc (abfd, amt);
+ blk = (struct dwarf_block *) bfd_alloc (abfd, amt);
blk->size = read_2_bytes (abfd, info_ptr);
info_ptr += 2;
blk->data = read_n_bytes (abfd, info_ptr, blk->size);
break;
case DW_FORM_block4:
amt = sizeof (struct dwarf_block);
- blk = bfd_alloc (abfd, amt);
+ blk = (struct dwarf_block *) bfd_alloc (abfd, amt);
blk->size = read_4_bytes (abfd, info_ptr);
info_ptr += 4;
blk->data = read_n_bytes (abfd, info_ptr, blk->size);
break;
case DW_FORM_block:
amt = sizeof (struct dwarf_block);
- blk = bfd_alloc (abfd, amt);
+ blk = (struct dwarf_block *) bfd_alloc (abfd, amt);
blk->size = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
info_ptr += bytes_read;
blk->data = read_n_bytes (abfd, info_ptr, blk->size);
break;
case DW_FORM_block1:
amt = sizeof (struct dwarf_block);
- blk = bfd_alloc (abfd, amt);
+ blk = (struct dwarf_block *) bfd_alloc (abfd, amt);
blk->size = read_1_byte (abfd, info_ptr);
info_ptr += 1;
blk->data = read_n_bytes (abfd, info_ptr, blk->size);
int end_sequence)
{
bfd_size_type amt = sizeof (struct line_info);
- struct line_info* info = bfd_alloc (table->abfd, amt);
+ struct line_info* info = (struct line_info *) bfd_alloc (table->abfd, amt);
/* Set member data of 'info'. */
info->address = address;
if (filename && filename[0])
{
- info->filename = bfd_alloc (table->abfd, strlen (filename) + 1);
+ info->filename = (char *) bfd_alloc (table->abfd, strlen (filename) + 1);
if (info->filename)
strcpy (info->filename, filename);
}
if (subdirname)
{
len += strlen (subdirname) + 1;
- name = bfd_malloc (len);
+ name = (char *) bfd_malloc (len);
if (name)
sprintf (name, "%s/%s/%s", dirname, subdirname, filename);
}
else
{
- name = bfd_malloc (len);
+ name = (char *) bfd_malloc (len);
if (name)
sprintf (name, "%s/%s", dirname, filename);
}
/* Need to allocate a new arange and insert it into the arange list.
Order isn't significant, so just insert after the first arange. */
- arange = bfd_zalloc (abfd, sizeof (*arange));
+ arange = (struct arange *) bfd_zalloc (abfd, sizeof (*arange));
arange->low = low_pc;
arange->high = high_pc;
arange->next = first_arange->next;
return 0;
amt = sizeof (struct line_info_table);
- table = bfd_alloc (abfd, amt);
+ table = (struct line_info_table *) bfd_alloc (abfd, amt);
table->abfd = abfd;
table->comp_dir = unit->comp_dir;
lh.opcode_base = read_1_byte (abfd, line_ptr);
line_ptr += 1;
amt = lh.opcode_base * sizeof (unsigned char);
- lh.standard_opcode_lengths = bfd_alloc (abfd, amt);
+ lh.standard_opcode_lengths = (unsigned char *) bfd_alloc (abfd, amt);
lh.standard_opcode_lengths[0] = 1;
amt = table->num_dirs + DIR_ALLOC_CHUNK;
amt *= sizeof (char *);
- tmp = bfd_realloc (table->dirs, amt);
+ tmp = (char **) bfd_realloc (table->dirs, amt);
if (tmp == NULL)
{
free (table->dirs);
amt = table->num_files + FILE_ALLOC_CHUNK;
amt *= sizeof (struct fileinfo);
- tmp = bfd_realloc (table->files, amt);
+ tmp = (struct fileinfo *) bfd_realloc (table->files, amt);
if (tmp == NULL)
{
free (table->files);
amt = table->num_files + FILE_ALLOC_CHUNK;
amt *= sizeof (struct fileinfo);
- tmp = bfd_realloc (table->files, amt);
+ tmp = (struct fileinfo *) bfd_realloc (table->files, amt);
if (tmp == NULL)
{
free (table->files);
/* Maintain a stack of in-scope functions and inlined functions, which we
can use to set the caller_func field. */
nested_funcs_size = 32;
- nested_funcs = bfd_malloc (nested_funcs_size * sizeof (struct funcinfo *));
+ nested_funcs = (struct funcinfo **)
+ bfd_malloc (nested_funcs_size * sizeof (struct funcinfo *));
if (nested_funcs == NULL)
return FALSE;
nested_funcs[nesting_level] = 0;
|| abbrev->tag == DW_TAG_inlined_subroutine)
{
bfd_size_type amt = sizeof (struct funcinfo);
- func = bfd_zalloc (abfd, amt);
+ func = (struct funcinfo *) bfd_zalloc (abfd, amt);
func->tag = abbrev->tag;
func->prev_func = unit->function_table;
unit->function_table = func;
if (abbrev->tag == DW_TAG_variable)
{
bfd_size_type amt = sizeof (struct varinfo);
- var = bfd_zalloc (abfd, amt);
+ var = (struct varinfo *) bfd_zalloc (abfd, amt);
var->tag = abbrev->tag;
var->stack = 1;
var->prev_var = unit->variable_table;
struct funcinfo **tmp;
nested_funcs_size *= 2;
- tmp = bfd_realloc (nested_funcs,
- (nested_funcs_size
- * sizeof (struct funcinfo *)));
+ tmp = (struct funcinfo **)
+ bfd_realloc (nested_funcs,
+ (nested_funcs_size * sizeof (struct funcinfo *)));
if (tmp == NULL)
{
free (nested_funcs);
bfd_size_type amt;
bfd_vma low_pc = 0;
bfd_vma high_pc = 0;
- bfd *abfd = stash->bfd;
+ bfd *abfd = stash->bfd_ptr;
version = read_2_bytes (abfd, info_ptr);
info_ptr += 2;
}
amt = sizeof (struct comp_unit);
- unit = bfd_zalloc (abfd, amt);
+ unit = (struct comp_unit *) bfd_zalloc (abfd, amt);
unit->abfd = abfd;
unit->version = version;
unit->addr_size = addr_size;
node;
node = node->next)
{
- each_func = node->info;
+ each_func = (struct funcinfo *) node->info;
for (arange = &each_func->arange;
arange;
arange = arange->next)
node;
node = node->next)
{
- each = node->info;
+ each = (struct varinfo *) node->info;
if (each->addr == addr
&& (!each->sec || each->sec == sec))
{
bfd_vma found = FALSE;
bfd_boolean do_line;
- stash = *pinfo;
+ stash = (struct dwarf2_debug *) *pinfo;
if (! stash)
{
bfd_size_type amt = sizeof (struct dwarf2_debug);
- stash = bfd_zalloc (abfd, amt);
+ stash = (struct dwarf2_debug *) bfd_zalloc (abfd, amt);
if (! stash)
return FALSE;
}
if (all_uncompressed)
{
/* Case 2: multiple sections, but none is compressed. */
- stash->info_ptr_memory = bfd_malloc (total_size);
+ stash->info_ptr_memory = (bfd_byte *) bfd_malloc (total_size);
if (stash->info_ptr_memory == NULL)
goto done;
goto done;
}
}
- stash->info_ptr_memory = bfd_realloc (stash->info_ptr_memory,
- total_size + size);
+ stash->info_ptr_memory = (bfd_byte *)
+ bfd_realloc (stash->info_ptr_memory, total_size + size);
memcpy (stash->info_ptr_memory + total_size, buffer, size);
free (buffer);
total_size += size;
stash->sec = find_debug_info (debug_bfd, NULL);
stash->sec_info_ptr = stash->info_ptr;
stash->syms = symbols;
- stash->bfd = debug_bfd;
+ stash->bfd_ptr = debug_bfd;
}
/* A null info_ptr indicates that there is no dwarf2 info
unsigned int offset_size = addr_size;
bfd_byte *info_ptr_unit = stash->info_ptr;
- length = read_4_bytes (stash->bfd, stash->info_ptr);
+ length = read_4_bytes (stash->bfd_ptr, stash->info_ptr);
/* A 0xffffff length is the DWARF3 way of indicating
we use 64-bit offsets, instead of 32-bit offsets. */
if (length == 0xffffffff)
{
offset_size = 8;
- length = read_8_bytes (stash->bfd, stash->info_ptr + 4);
+ length = read_8_bytes (stash->bfd_ptr, stash->info_ptr + 4);
stash->info_ptr += 12;
}
/* A zero length is the IRIX way of indicating 64-bit offsets,
else if (length == 0)
{
offset_size = 8;
- length = read_4_bytes (stash->bfd, stash->info_ptr + 4);
+ length = read_4_bytes (stash->bfd_ptr, stash->info_ptr + 4);
stash->info_ptr += 8;
}
/* In the absence of the hints above, we assume 32-bit DWARF2
if ((bfd_vma) (stash->info_ptr - stash->sec_info_ptr)
== stash->sec->size)
{
- stash->sec = find_debug_info (stash->bfd, stash->sec);
+ stash->sec = find_debug_info (stash->bfd_ptr, stash->sec);
stash->sec_info_ptr = stash->info_ptr;
}
{
struct dwarf2_debug *stash;
- stash = *pinfo;
+ stash = (struct dwarf2_debug *) *pinfo;
if (stash)
{
struct funcinfo *func = stash->inliner_chain;
if (abfd == NULL || elf_tdata (abfd) == NULL)
return;
- stash = elf_tdata (abfd)->dwarf2_find_line_info;
+ stash = (struct dwarf2_debug *) elf_tdata (abfd)->dwarf2_find_line_info;
if (stash == NULL)
return;
{
char * p;
int len;
-
+
len = strlen (s) + 1;
p = (char *) bfd_alloc (abfd, len);
- return memcpy (p, s, len);
+ return (char *) memcpy (p, s, len);
}
/* Add a string object attribute. */
bfd_vma len;
const char *std_section;
- contents = bfd_malloc (hdr->sh_size);
+ contents = (bfd_byte *) bfd_malloc (hdr->sh_size);
if (!contents)
return;
if (!bfd_get_section_contents (abfd, hdr->bfd_section, contents, 0,
struct got_entry;
struct plt_entry;
+union gotplt_union
+ {
+ bfd_signed_vma refcount;
+ bfd_vma offset;
+ struct got_entry *glist;
+ struct plt_entry *plist;
+ };
+
+struct elf_link_virtual_table_entry
+ {
+ /* Virtual table entry use information. This array is nominally of size
+ size/sizeof(target_void_pointer), though we have to be able to assume
+ and track a size while the symbol is still undefined. It is indexed
+ via offset/sizeof(target_void_pointer). */
+ size_t size;
+ bfd_boolean *used;
+
+ /* Virtual table derivation info. */
+ struct elf_link_hash_entry *parent;
+ };
+
/* ELF linker hash table entries. */
struct elf_link_hash_entry
require a global offset table entry. The second scheme allows
multiple GOT entries per symbol, managed via a linked list
pointed to by GLIST. */
- union gotplt_union
- {
- bfd_signed_vma refcount;
- bfd_vma offset;
- struct got_entry *glist;
- struct plt_entry *plist;
- } got;
+ union gotplt_union got;
/* Same, but tracks a procedure linkage table entry. */
union gotplt_union plt;
struct bfd_elf_version_tree *vertree;
} verinfo;
- struct
- {
- /* Virtual table entry use information. This array is nominally of size
- size/sizeof(target_void_pointer), though we have to be able to assume
- and track a size while the symbol is still undefined. It is indexed
- via offset/sizeof(target_void_pointer). */
- size_t size;
- bfd_boolean *used;
-
- /* Virtual table derivation info. */
- struct elf_link_hash_entry *parent;
- } *vtable;
+ struct elf_link_virtual_table_entry *vtable;
};
/* Will references to this symbol always reference the symbol
static int
cie_eq (const void *e1, const void *e2)
{
- const struct cie *c1 = e1;
- const struct cie *c2 = e2;
+ const struct cie *c1 = (const struct cie *) e1;
+ const struct cie *c2 = (const struct cie *) e2;
if (c1->hash == c2->hash
&& c1->length == c2->length
static hashval_t
cie_hash (const void *e)
{
- const struct cie *c = e;
+ const struct cie *c = (const struct cie *) e;
return c->hash;
}
REQUIRE (skip_bytes (&buf, end, hdr_length - 4));
}
- sec_info = bfd_zmalloc (sizeof (struct eh_frame_sec_info)
- + (num_entries - 1) * sizeof (struct eh_cie_fde));
+ sec_info = (struct eh_frame_sec_info *)
+ bfd_zmalloc (sizeof (struct eh_frame_sec_info)
+ + (num_entries - 1) * sizeof (struct eh_cie_fde));
REQUIRE (sec_info);
/* We need to have a "struct cie" for each CIE in this section. */
- local_cies = bfd_zmalloc (num_cies * sizeof (*local_cies));
+ local_cies = (struct cie *) bfd_zmalloc (num_cies * sizeof (*local_cies));
REQUIRE (local_cies);
/* FIXME: octets_per_byte. */
unsigned int cnt;
bfd_byte *p;
- this_inf->set_loc = bfd_malloc ((set_loc_count + 1)
- * sizeof (unsigned int));
+ this_inf->set_loc = (unsigned int *)
+ bfd_malloc ((set_loc_count + 1) * sizeof (unsigned int));
REQUIRE (this_inf->set_loc);
this_inf->set_loc[0] = set_loc_count;
p = insns;
if (new_cie == NULL)
{
/* Keep CIE_INF and record it in the hash table. */
- new_cie = malloc (sizeof (struct cie));
+ new_cie = (struct cie *) malloc (sizeof (struct cie));
if (new_cie == NULL)
return cie_inf;
if (sec->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
return offset;
- sec_info = elf_section_data (sec)->sec_info;
+ sec_info = (struct eh_frame_sec_info *) elf_section_data (sec)->sec_info;
if (offset >= sec->rawsize)
return offset - sec->rawsize + sec->size;
->elf_backend_eh_frame_address_size (abfd, sec));
BFD_ASSERT (ptr_size != 0);
- sec_info = elf_section_data (sec)->sec_info;
+ sec_info = (struct eh_frame_sec_info *) elf_section_data (sec)->sec_info;
htab = elf_hash_table (info);
hdr_info = &htab->eh_info;
if (hdr_info->table && hdr_info->array == NULL)
- hdr_info->array
- = bfd_malloc (hdr_info->fde_count * sizeof(*hdr_info->array));
+ hdr_info->array = (struct eh_frame_array_ent *)
+ bfd_malloc (hdr_info->fde_count * sizeof(*hdr_info->array));
if (hdr_info->array == NULL)
hdr_info = NULL;
static int
vma_compare (const void *a, const void *b)
{
- const struct eh_frame_array_ent *p = a;
- const struct eh_frame_array_ent *q = b;
+ const struct eh_frame_array_ent *p = (const struct eh_frame_array_ent *) a;
+ const struct eh_frame_array_ent *q = (const struct eh_frame_array_ent *) b;
if (p->initial_loc > q->initial_loc)
return 1;
if (p->initial_loc < q->initial_loc)
size = EH_FRAME_HDR_SIZE;
if (hdr_info->array && hdr_info->array_count == hdr_info->fde_count)
size += 4 + hdr_info->fde_count * 8;
- contents = bfd_malloc (size);
+ contents = (bfd_byte *) bfd_malloc (size);
if (contents == NULL)
return FALSE;
/* Allocate the structure if it has not already been allocated by a
subclass. */
if (entry == NULL)
- entry = bfd_hash_allocate (table, sizeof (struct elf_strtab_hash_entry));
+ entry = (struct bfd_hash_entry *)
+ bfd_hash_allocate (table, sizeof (struct elf_strtab_hash_entry));
if (entry == NULL)
return NULL;
struct elf_strtab_hash *table;
bfd_size_type amt = sizeof (struct elf_strtab_hash);
- table = bfd_malloc (amt);
+ table = (struct elf_strtab_hash *) bfd_malloc (amt);
if (table == NULL)
return NULL;
table->size = 1;
table->alloced = 64;
amt = sizeof (struct elf_strtab_hasn_entry *);
- table->array = bfd_malloc (table->alloced * amt);
+ table->array = (struct elf_strtab_hash_entry **)
+ bfd_malloc (table->alloced * amt);
if (table->array == NULL)
{
free (table);
{
bfd_size_type amt = sizeof (struct elf_strtab_hash_entry *);
tab->alloced *= 2;
- tab->array = bfd_realloc_or_free (tab->array, tab->alloced * amt);
+ tab->array = (struct elf_strtab_hash_entry **)
+ bfd_realloc_or_free (tab->array, tab->alloced * amt);
if (tab->array == NULL)
return (bfd_size_type) -1;
}
/* Sort the strings by suffix and length. */
amt = tab->size * sizeof (struct elf_strtab_hash_entry *);
- array = bfd_malloc (amt);
+ array = (struct elf_strtab_hash_entry **) bfd_malloc (amt);
if (array == NULL)
goto alloc_failure;
/* Allocate and clear an extra byte at the end, to prevent crashes
in case the string table is not terminated. */
if (shstrtabsize + 1 <= 1
- || (shstrtab = bfd_alloc (abfd, shstrtabsize + 1)) == NULL
+ || (shstrtab = (bfd_byte *) bfd_alloc (abfd, shstrtabsize + 1)) == NULL
|| bfd_seek (abfd, offset, SEEK_SET) != 0)
shstrtab = NULL;
else if (bfd_bread (shstrtab, shstrtabsize, abfd) != shstrtabsize)
pos = shndx_hdr->sh_offset + symoffset * sizeof (Elf_External_Sym_Shndx);
if (extshndx_buf == NULL)
{
- alloc_extshndx = bfd_malloc2 (symcount,
- sizeof (Elf_External_Sym_Shndx));
+ alloc_extshndx = (Elf_External_Sym_Shndx *)
+ bfd_malloc2 (symcount, sizeof (Elf_External_Sym_Shndx));
extshndx_buf = alloc_extshndx;
}
if (extshndx_buf == NULL
if (intsym_buf == NULL)
{
- alloc_intsym = bfd_malloc2 (symcount, sizeof (Elf_Internal_Sym));
+ alloc_intsym = (Elf_Internal_Sym *)
+ bfd_malloc2 (symcount, sizeof (Elf_Internal_Sym));
intsym_buf = alloc_intsym;
if (intsym_buf == NULL)
goto out;
/* Convert the symbols to internal form. */
isymend = intsym_buf + symcount;
- for (esym = extsym_buf, isym = intsym_buf, shndx = extshndx_buf;
+ for (esym = (const bfd_byte *) extsym_buf, isym = intsym_buf,
+ shndx = extshndx_buf;
isym < isymend;
esym += extsym_size, isym++, shndx = shndx != NULL ? shndx + 1 : NULL)
if (!(*bed->s->swap_symbol_in) (ibfd, esym, shndx, isym))
bfd_size_type amt;
elf_tdata (abfd)->num_group = num_group;
- elf_tdata (abfd)->group_sect_ptr
- = bfd_alloc2 (abfd, num_group, sizeof (Elf_Internal_Shdr *));
+ elf_tdata (abfd)->group_sect_ptr = (Elf_Internal_Shdr **)
+ bfd_alloc2 (abfd, num_group, sizeof (Elf_Internal_Shdr *));
if (elf_tdata (abfd)->group_sect_ptr == NULL)
return FALSE;
/* Read the raw contents. */
BFD_ASSERT (sizeof (*dest) >= 4);
amt = shdr->sh_size * sizeof (*dest) / 4;
- shdr->contents = bfd_alloc2 (abfd, shdr->sh_size,
- sizeof (*dest) / 4);
+ shdr->contents = (unsigned char *)
+ bfd_alloc2 (abfd, shdr->sh_size, sizeof (*dest) / 4);
/* PR binutils/4110: Handle corrupt group headers. */
if (shdr->contents == NULL)
{
bfd_boolean
_bfd_elf_print_private_bfd_data (bfd *abfd, void *farg)
{
- FILE *f = farg;
+ FILE *f = (FILE *) farg;
Elf_Internal_Phdr *p;
asection *s;
bfd_byte *dynbuf = NULL;
asymbol *symbol,
bfd_print_symbol_type how)
{
- FILE *file = filep;
+ FILE *file = (FILE *) filep;
switch (how)
{
case bfd_print_symbol_name:
bfd_size_type amt;
BFD_ASSERT (elf_section_data (target_sect)->rel_hdr2 == NULL);
amt = sizeof (*hdr2);
- hdr2 = bfd_alloc (abfd, amt);
+ hdr2 = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt);
if (hdr2 == NULL)
return FALSE;
elf_section_data (target_sect)->rel_hdr2 = hdr2;
sdata = (struct bfd_elf_section_data *) sec->used_by_bfd;
if (sdata == NULL)
{
- sdata = bfd_zalloc (abfd, sizeof (*sdata));
+ sdata = (struct bfd_elf_section_data *) bfd_zalloc (abfd,
+ sizeof (*sdata));
if (sdata == NULL)
return FALSE;
sec->used_by_bfd = sdata;
_bfd_elf_make_section_from_phdr (bfd *abfd,
Elf_Internal_Phdr *hdr,
int index,
- const char *typename)
+ const char *type_name)
{
asection *newsect;
char *name;
if (hdr->p_filesz > 0)
{
- sprintf (namebuf, "%s%d%s", typename, index, split ? "a" : "");
+ sprintf (namebuf, "%s%d%s", type_name, index, split ? "a" : "");
len = strlen (namebuf) + 1;
- name = bfd_alloc (abfd, len);
+ name = (char *) bfd_alloc (abfd, len);
if (!name)
return FALSE;
memcpy (name, namebuf, len);
{
bfd_vma align;
- sprintf (namebuf, "%s%d%s", typename, index, split ? "b" : "");
+ sprintf (namebuf, "%s%d%s", type_name, index, split ? "b" : "");
len = strlen (namebuf) + 1;
- name = bfd_alloc (abfd, len);
+ name = (char *) bfd_alloc (abfd, len);
if (!name)
return FALSE;
memcpy (name, namebuf, len);
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
bfd_size_type amt = sizeof ".rela" + strlen (asect->name);
- name = bfd_alloc (abfd, amt);
+ name = (char *) bfd_alloc (abfd, amt);
if (name == NULL)
return FALSE;
sprintf (name, "%s%s", use_rela_p ? ".rela" : ".rel", asect->name);
elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg)
{
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- bfd_boolean *failedptr = failedptrarg;
+ bfd_boolean *failedptr = (bfd_boolean *) failedptrarg;
Elf_Internal_Shdr *this_hdr;
unsigned int sh_type;
void
bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg)
{
- bfd_boolean *failedptr = failedptrarg;
+ bfd_boolean *failedptr = (bfd_boolean *) failedptrarg;
asection *elt, *first;
unsigned char *loc;
bfd_boolean gas;
if (sec->contents == NULL)
{
gas = FALSE;
- sec->contents = bfd_alloc (abfd, sec->size);
+ sec->contents = (unsigned char *) bfd_alloc (abfd, sec->size);
/* Arrange for the section to be written out. */
elf_section_data (sec)->this_hdr.contents = sec->contents;
/* Set up the list of section header pointers, in agreement with the
indices. */
- i_shdrp = bfd_zalloc2 (abfd, section_number, sizeof (Elf_Internal_Shdr *));
+ i_shdrp = (Elf_Internal_Shdr **) bfd_zalloc2 (abfd, section_number,
+ sizeof (Elf_Internal_Shdr *));
if (i_shdrp == NULL)
return FALSE;
- i_shdrp[0] = bfd_zalloc (abfd, sizeof (Elf_Internal_Shdr));
+ i_shdrp[0] = (Elf_Internal_Shdr *) bfd_zalloc (abfd,
+ sizeof (Elf_Internal_Shdr));
if (i_shdrp[0] == NULL)
{
bfd_release (abfd, i_shdrp);
char *alc;
len = strlen (sec->name);
- alc = bfd_malloc (len - 2);
+ alc = (char *) bfd_malloc (len - 2);
if (alc == NULL)
return FALSE;
memcpy (alc, sec->name, len - 3);
}
max_index++;
- sect_syms = bfd_zalloc2 (abfd, max_index, sizeof (asymbol *));
+ sect_syms = (asymbol **) bfd_zalloc2 (abfd, max_index, sizeof (asymbol *));
if (sect_syms == NULL)
return FALSE;
elf_section_syms (abfd) = sect_syms;
}
/* Now sort the symbols so the local symbols are first. */
- new_syms = bfd_alloc2 (abfd, num_locals + num_globals, sizeof (asymbol *));
+ new_syms = (asymbol **) bfd_alloc2 (abfd, num_locals + num_globals,
+ sizeof (asymbol *));
if (new_syms == NULL)
return FALSE;
amt = sizeof (struct elf_segment_map);
amt += (to - from - 1) * sizeof (asection *);
- m = bfd_zalloc (abfd, amt);
+ m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
if (m == NULL)
return NULL;
m->next = NULL;
{
struct elf_segment_map *m;
- m = bfd_zalloc (abfd, sizeof (struct elf_segment_map));
+ m = (struct elf_segment_map *) bfd_zalloc (abfd,
+ sizeof (struct elf_segment_map));
if (m == NULL)
return NULL;
m->next = NULL;
/* Select the allocated sections, and sort them. */
- sections = bfd_malloc2 (bfd_count_sections (abfd), sizeof (asection *));
+ sections = (asection **) bfd_malloc2 (bfd_count_sections (abfd),
+ sizeof (asection *));
if (sections == NULL)
goto error_return;
if (s != NULL && (s->flags & SEC_LOAD) != 0)
{
amt = sizeof (struct elf_segment_map);
- m = bfd_zalloc (abfd, amt);
+ m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
if (m == NULL)
goto error_return;
m->next = NULL;
pm = &m->next;
amt = sizeof (struct elf_segment_map);
- m = bfd_zalloc (abfd, amt);
+ m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
if (m == NULL)
goto error_return;
m->next = NULL;
break;
}
amt += (count - 1) * sizeof (asection *);
- m = bfd_zalloc (abfd, amt);
+ m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
if (m == NULL)
goto error_return;
m->next = NULL;
amt = sizeof (struct elf_segment_map);
amt += (tls_count - 1) * sizeof (asection *);
- m = bfd_zalloc (abfd, amt);
+ m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
if (m == NULL)
goto error_return;
m->next = NULL;
&& (eh_frame_hdr->output_section->flags & SEC_LOAD) != 0)
{
amt = sizeof (struct elf_segment_map);
- m = bfd_zalloc (abfd, amt);
+ m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
if (m == NULL)
goto error_return;
m->next = NULL;
if (elf_tdata (abfd)->stack_flags)
{
amt = sizeof (struct elf_segment_map);
- m = bfd_zalloc (abfd, amt);
+ m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
if (m == NULL)
goto error_return;
m->next = NULL;
if (m != NULL)
{
amt = sizeof (struct elf_segment_map);
- m = bfd_zalloc (abfd, amt);
+ m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
if (m == NULL)
goto error_return;
m->next = NULL;
last iterations for the testcase ld-elf/header. */
BFD_ASSERT (elf_tdata (abfd)->program_header_size % bed->s->sizeof_phdr
== 0);
- phdrs = bfd_zalloc2 (abfd,
- (elf_tdata (abfd)->program_header_size
- / bed->s->sizeof_phdr),
- sizeof (Elf_Internal_Phdr));
+ phdrs = (Elf_Internal_Phdr *)
+ bfd_zalloc2 (abfd,
+ (elf_tdata (abfd)->program_header_size / bed->s->sizeof_phdr),
+ sizeof (Elf_Internal_Phdr));
elf_tdata (abfd)->phdr = phdrs;
if (phdrs == NULL)
return FALSE;
all of the sections we have selected. */
amt = sizeof (struct elf_segment_map);
amt += ((bfd_size_type) section_count - 1) * sizeof (asection *);
- map = bfd_zalloc (obfd, amt);
+ map = (struct elf_segment_map *) bfd_zalloc (obfd, amt);
if (map == NULL)
return FALSE;
pointers that we are interested in. As these sections get assigned
to a segment, they are removed from this array. */
- sections = bfd_malloc2 (section_count, sizeof (asection *));
+ sections = (asection **) bfd_malloc2 (section_count, sizeof (asection *));
if (sections == NULL)
return FALSE;
and carry on looping. */
amt = sizeof (struct elf_segment_map);
amt += ((bfd_size_type) section_count - 1) * sizeof (asection *);
- map = bfd_alloc (obfd, amt);
+ map = (struct elf_segment_map *) bfd_alloc (obfd, amt);
if (map == NULL)
{
free (sections);
amt = sizeof (struct elf_segment_map);
if (section_count != 0)
amt += ((bfd_size_type) section_count - 1) * sizeof (asection *);
- map = bfd_zalloc (obfd, amt);
+ map = (struct elf_segment_map *) bfd_zalloc (obfd, amt);
if (map == NULL)
return FALSE;
symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr;
symstrtab_hdr->sh_type = SHT_STRTAB;
- outbound_syms = bfd_alloc2 (abfd, 1 + symcount, bed->s->sizeof_sym);
+ outbound_syms = (bfd_byte *) bfd_alloc2 (abfd, 1 + symcount,
+ bed->s->sizeof_sym);
if (outbound_syms == NULL)
{
_bfd_stringtab_free (stt);
if (symtab_shndx_hdr->sh_name != 0)
{
amt = (bfd_size_type) (1 + symcount) * sizeof (Elf_External_Sym_Shndx);
- outbound_shndx = bfd_zalloc2 (abfd, 1 + symcount,
- sizeof (Elf_External_Sym_Shndx));
+ outbound_shndx = (bfd_byte *)
+ bfd_zalloc2 (abfd, 1 + symcount, sizeof (Elf_External_Sym_Shndx));
if (outbound_shndx == NULL)
{
_bfd_stringtab_free (stt);
hdr = &elf_tdata (abfd)->dynverref_hdr;
- elf_tdata (abfd)->verref = bfd_zalloc2 (abfd, hdr->sh_info,
- sizeof (Elf_Internal_Verneed));
+ elf_tdata (abfd)->verref = (Elf_Internal_Verneed *)
+ bfd_zalloc2 (abfd, hdr->sh_info, sizeof (Elf_Internal_Verneed));
if (elf_tdata (abfd)->verref == NULL)
goto error_return;
elf_tdata (abfd)->cverrefs = hdr->sh_info;
- contents = bfd_malloc (hdr->sh_size);
+ contents = (bfd_byte *) bfd_malloc (hdr->sh_size);
if (contents == NULL)
{
error_return_verref:
iverneed->vn_auxptr = NULL;
else
{
- iverneed->vn_auxptr = bfd_alloc2 (abfd, iverneed->vn_cnt,
- sizeof (Elf_Internal_Vernaux));
+ iverneed->vn_auxptr = (struct elf_internal_vernaux *)
+ bfd_alloc2 (abfd, iverneed->vn_cnt,
+ sizeof (Elf_Internal_Vernaux));
if (iverneed->vn_auxptr == NULL)
goto error_return_verref;
}
hdr = &elf_tdata (abfd)->dynverdef_hdr;
- contents = bfd_malloc (hdr->sh_size);
+ contents = (bfd_byte *) bfd_malloc (hdr->sh_size);
if (contents == NULL)
goto error_return;
if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0
else
freeidx = ++maxidx;
}
- elf_tdata (abfd)->verdef = bfd_zalloc2 (abfd, maxidx,
- sizeof (Elf_Internal_Verdef));
+ elf_tdata (abfd)->verdef = (Elf_Internal_Verdef *)
+ bfd_zalloc2 (abfd, maxidx, sizeof (Elf_Internal_Verdef));
if (elf_tdata (abfd)->verdef == NULL)
goto error_return;
iverdef->vd_auxptr = NULL;
else
{
- iverdef->vd_auxptr = bfd_alloc2 (abfd, iverdef->vd_cnt,
- sizeof (Elf_Internal_Verdaux));
+ iverdef->vd_auxptr = (struct elf_internal_verdaux *)
+ bfd_alloc2 (abfd, iverdef->vd_cnt,
+ sizeof (Elf_Internal_Verdaux));
if (iverdef->vd_auxptr == NULL)
goto error_return_verdef;
}
else
freeidx++;
- elf_tdata (abfd)->verdef = bfd_zalloc2 (abfd, freeidx,
- sizeof (Elf_Internal_Verdef));
+ elf_tdata (abfd)->verdef = (Elf_Internal_Verdef *)
+ bfd_zalloc2 (abfd, freeidx, sizeof (Elf_Internal_Verdef));
if (elf_tdata (abfd)->verdef == NULL)
goto error_return;
if (iverdef->vd_nodename == NULL)
goto error_return_verdef;
iverdef->vd_nextdef = NULL;
- iverdef->vd_auxptr = bfd_alloc (abfd, sizeof (Elf_Internal_Verdaux));
+ iverdef->vd_auxptr = (struct elf_internal_verdaux *)
+ bfd_alloc (abfd, sizeof (Elf_Internal_Verdaux));
if (iverdef->vd_auxptr == NULL)
goto error_return_verdef;
elf_symbol_type *newsym;
bfd_size_type amt = sizeof (elf_symbol_type);
- newsym = bfd_zalloc (abfd, amt);
+ newsym = (elf_symbol_type *) bfd_zalloc (abfd, amt);
if (!newsym)
return NULL;
else
sprintf (buf, "%s/%d", name, elfcore_make_pid (abfd));
len = strlen (buf) + 1;
- threaded_name = bfd_alloc (abfd, len);
+ threaded_name = (char *) bfd_alloc (abfd, len);
if (threaded_name == NULL)
return FALSE;
memcpy (threaded_name, buf, len);
_bfd_elfcore_strndup (bfd *abfd, char *start, size_t max)
{
char *dups;
- char *end = memchr (start, '\0', max);
+ char *end = (char *) memchr (start, '\0', max);
size_t len;
if (end == NULL)
else
len = end - start;
- dups = bfd_alloc (abfd, len + 1);
+ dups = (char *) bfd_alloc (abfd, len + 1);
if (dups == NULL)
return NULL;
sprintf (buf, ".reg/%ld", (long) bfd_get_32 (abfd, note->descdata + 8));
len = strlen (buf) + 1;
- name = bfd_alloc (abfd, len);
+ name = (char *) bfd_alloc (abfd, len);
if (name == NULL)
return FALSE;
sprintf (buf, ".module/%08lx", (unsigned long) base_addr);
len = strlen (buf) + 1;
- name = bfd_alloc (abfd, len);
+ name = (char *) bfd_alloc (abfd, len);
if (name == NULL)
return FALSE;
elfobj_grok_gnu_build_id (bfd *abfd, Elf_Internal_Note *note)
{
elf_tdata (abfd)->build_id_size = note->descsz;
- elf_tdata (abfd)->build_id = bfd_alloc (abfd, note->descsz);
+ elf_tdata (abfd)->build_id = (bfd_byte *) bfd_alloc (abfd, note->descsz);
if (elf_tdata (abfd)->build_id == NULL)
return FALSE;
/* Make a ".qnx_core_status/%d" section. */
sprintf (buf, ".qnx_core_status/%ld", *tid);
- name = bfd_alloc (abfd, strlen (buf) + 1);
+ name = (char *) bfd_alloc (abfd, strlen (buf) + 1);
if (name == NULL)
return FALSE;
strcpy (name, buf);
/* Make a "(base)/%d" section. */
sprintf (buf, "%s/%ld", base, tid);
- name = bfd_alloc (abfd, strlen (buf) + 1);
+ name = (char *) bfd_alloc (abfd, strlen (buf) + 1);
if (name == NULL)
return FALSE;
strcpy (name, buf);
/* Use note name as section name. */
len = note->namesz;
- name = bfd_alloc (abfd, len);
+ name = (char *) bfd_alloc (abfd, len);
if (name == NULL)
return FALSE;
memcpy (name, note->namedata, len);
newspace = 12 + ((namesz + 3) & -4) + ((size + 3) & -4);
- buf = realloc (buf, *bufsiz + newspace);
+ buf = (char *) realloc (buf, *bufsiz + newspace);
if (buf == NULL)
return buf;
dest = buf + *bufsiz;
if (bfd_seek (abfd, offset, SEEK_SET) != 0)
return FALSE;
- buf = bfd_malloc (size);
+ buf = (char *) bfd_malloc (size);
if (buf == NULL)
return FALSE;
}
}
- s = *ret = bfd_malloc (size);
+ s = *ret = (asymbol *) bfd_malloc (size);
if (s == NULL)
return -1;
subclass. */
if (entry == NULL)
{
- entry = bfd_hash_allocate (table,
- sizeof (struct elf_i386_link_hash_entry));
+ entry = (struct bfd_hash_entry *)
+ bfd_hash_allocate (table, sizeof (struct elf_i386_link_hash_entry));
if (entry == NULL)
return entry;
}
struct elf_i386_link_hash_table *ret;
bfd_size_type amt = sizeof (struct elf_i386_link_hash_table);
- ret = bfd_malloc (amt);
+ ret = (struct elf_i386_link_hash_table *) bfd_malloc (amt);
if (ret == NULL)
return NULL;
size = symtab_hdr->sh_info;
size *= (sizeof (bfd_signed_vma)
+ sizeof (bfd_vma) + sizeof(char));
- local_got_refcounts = bfd_zalloc (abfd, size);
+ local_got_refcounts = (bfd_signed_vma *)
+ bfd_zalloc (abfd, size);
if (local_got_refcounts == NULL)
return FALSE;
elf_local_got_refcounts (abfd) = local_got_refcounts;
if (p == NULL || p->sec != sec)
{
bfd_size_type amt = sizeof *p;
- p = bfd_alloc (htab->elf.dynobj, amt);
+ p = (struct elf_dyn_relocs *) bfd_alloc (htab->elf.dynobj,
+ amt);
if (p == NULL)
return FALSE;
p->next = *head;
section's contents are written out. This should not happen,
but this way if it does, we get a R_386_NONE reloc instead
of garbage. */
- s->contents = bfd_zalloc (dynobj, s->size);
+ s->contents = (unsigned char *) bfd_zalloc (dynobj, s->size);
if (s->contents == NULL)
return FALSE;
}
subclass. */
if (entry == NULL)
{
- entry = bfd_hash_allocate (table,
- sizeof (struct elf64_x86_64_link_hash_entry));
+ entry = (struct bfd_hash_entry *)
+ bfd_hash_allocate (table,
+ sizeof (struct elf64_x86_64_link_hash_entry));
if (entry == NULL)
return entry;
}
const void *pshn,
Elf_Internal_Sym *dst)
{
- const Elf_External_Sym *src = psrc;
- const Elf_External_Sym_Shndx *shndx = pshn;
+ const Elf_External_Sym *src = (const Elf_External_Sym *) psrc;
+ const Elf_External_Sym_Shndx *shndx = (const Elf_External_Sym_Shndx *) pshn;
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
dst->st_name = H_GET_32 (abfd, src->st_name);
void *shndx)
{
unsigned int tmp;
- Elf_External_Sym *dst = cdst;
+ Elf_External_Sym *dst = (Elf_External_Sym *) cdst;
H_PUT_32 (abfd, src->st_name, dst->st_name);
H_PUT_WORD (abfd, src->st_value, dst->st_value);
H_PUT_WORD (abfd, src->st_size, dst->st_size);
const void *p,
Elf_Internal_Dyn *dst)
{
- const Elf_External_Dyn *src = p;
+ const Elf_External_Dyn *src = (const Elf_External_Dyn *) p;
dst->d_tag = H_GET_WORD (abfd, src->d_tag);
dst->d_un.d_val = H_GET_WORD (abfd, src->d_un.d_val);
const Elf_Internal_Dyn *src,
void *p)
{
- Elf_External_Dyn *dst = p;
+ Elf_External_Dyn *dst = (Elf_External_Dyn *) p;
H_PUT_WORD (abfd, src->d_tag, dst->d_tag);
H_PUT_WORD (abfd, src->d_un.d_val, dst->d_un.d_val);
unsigned int num_sec;
amt = sizeof (*i_shdrp) * i_ehdrp->e_shnum;
- i_shdrp = bfd_alloc (abfd, amt);
+ i_shdrp = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt);
if (!i_shdrp)
goto got_no_match;
num_sec = i_ehdrp->e_shnum;
elf_numsections (abfd) = num_sec;
amt = sizeof (i_shdrp) * num_sec;
- elf_elfsections (abfd) = bfd_alloc (abfd, amt);
+ elf_elfsections (abfd) = (Elf_Internal_Shdr **) bfd_alloc (abfd, amt);
if (!elf_elfsections (abfd))
goto got_no_match;
unsigned int i;
amt = i_ehdrp->e_phnum * sizeof (Elf_Internal_Phdr);
- elf_tdata (abfd)->phdr = bfd_alloc (abfd, amt);
+ elf_tdata (abfd)->phdr = (Elf_Internal_Phdr *) bfd_alloc (abfd, amt);
if (elf_tdata (abfd)->phdr == NULL)
goto got_no_match;
if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_phoff, SEEK_SET) != 0)
void
elf_write_relocs (bfd *abfd, asection *sec, void *data)
{
- bfd_boolean *failedp = data;
+ bfd_boolean *failedp = (bfd_boolean *) data;
Elf_Internal_Shdr *rela_hdr;
bfd_vma addr_offset;
void (*swap_out) (bfd *, const Elf_Internal_Rela *, bfd_byte *);
rela_hdr = &elf_section_data (sec)->rel_hdr;
rela_hdr->sh_size = rela_hdr->sh_entsize * sec->reloc_count;
- rela_hdr->contents = bfd_alloc (abfd, rela_hdr->sh_size);
+ rela_hdr->contents = (unsigned char *) bfd_alloc (abfd, rela_hdr->sh_size);
if (rela_hdr->contents == NULL)
{
*failedp = TRUE;
/* at this point we've concocted all the ELF sections... */
amt = i_ehdrp->e_shnum;
amt *= sizeof (*x_shdrp);
- x_shdrp = bfd_alloc (abfd, amt);
+ x_shdrp = (Elf_External_Shdr *) bfd_alloc (abfd, amt);
if (!x_shdrp)
return FALSE;
amt = symcount;
amt *= sizeof (elf_symbol_type);
- symbase = bfd_zalloc (abfd, amt);
+ symbase = (elf_symbol_type *) bfd_zalloc (abfd, amt);
if (symbase == (elf_symbol_type *) NULL)
goto error_return;
if (bfd_seek (abfd, verhdr->sh_offset, SEEK_SET) != 0)
goto error_return;
- xverbuf = bfd_malloc (verhdr->sh_size);
+ xverbuf = (Elf_External_Versym *) bfd_malloc (verhdr->sh_size);
if (xverbuf == NULL && verhdr->sh_size != 0)
goto error_return;
!= rel_hdr->sh_size))
goto error_return;
- native_relocs = allocated;
+ native_relocs = (bfd_byte *) allocated;
entsize = rel_hdr->sh_entsize;
BFD_ASSERT (entsize == sizeof (Elf_External_Rel)
}
amt = (reloc_count + reloc_count2) * sizeof (arelent);
- relents = bfd_alloc (abfd, amt);
+ relents = (arelent *) bfd_alloc (abfd, amt);
if (relents == NULL)
return FALSE;
return NULL;
}
- x_phdrs = bfd_malloc (i_ehdr.e_phnum * (sizeof *x_phdrs + sizeof *i_phdrs));
+ x_phdrs = (Elf_External_Phdr *)
+ bfd_malloc (i_ehdr.e_phnum * (sizeof *x_phdrs + sizeof *i_phdrs));
if (x_phdrs == NULL)
{
bfd_set_error (bfd_error_no_memory);
contents_size = last_phdr->p_offset + last_phdr->p_filesz;
/* Now we know the size of the whole image we want read in. */
- contents = bfd_zmalloc (contents_size);
+ contents = (bfd_byte *) bfd_zmalloc (contents_size);
if (contents == NULL)
{
free (x_phdrs);
memcpy (contents, &x_ehdr, sizeof x_ehdr);
/* Now we have a memory image of the ELF file contents. Make a BFD. */
- bim = bfd_malloc (sizeof (struct bfd_in_memory));
+ bim = (struct bfd_in_memory *) bfd_malloc (sizeof (struct bfd_in_memory));
if (bim == NULL)
{
free (contents);
/* Allocate space for the program headers. */
amt = sizeof (*i_phdrp) * i_ehdrp->e_phnum;
- i_phdrp = bfd_alloc (abfd, amt);
+ i_phdrp = (Elf_Internal_Phdr *) bfd_alloc (abfd, amt);
if (!i_phdrp)
goto fail;
return 1;
amt = sizeof (*entry);
- entry = bfd_alloc (input_bfd, amt);
+ entry = (struct elf_link_local_dynamic_entry *) bfd_alloc (input_bfd, amt);
if (entry == NULL)
return 0;
elf_link_renumber_hash_table_dynsyms (struct elf_link_hash_entry *h,
void *data)
{
- size_t *count = data;
+ size_t *count = (size_t *) data;
if (h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
elf_link_renumber_local_hash_table_dynsyms (struct elf_link_hash_entry *h,
void *data)
{
- size_t *count = data;
+ size_t *count = (size_t *) data;
if (h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
dynamic = (abfd->flags & DYNAMIC) != 0;
shortlen = p - name;
- shortname = bfd_hash_allocate (&info->hash->table, shortlen + 1);
+ shortname = (char *) bfd_hash_allocate (&info->hash->table, shortlen + 1);
if (shortname == NULL)
return FALSE;
memcpy (shortname, name, shortlen);
nondefault:
len = strlen (name);
- shortname = bfd_hash_allocate (&info->hash->table, len);
+ shortname = (char *) bfd_hash_allocate (&info->hash->table, len);
if (shortname == NULL)
return FALSE;
memcpy (shortname, name, shortlen);
static bfd_boolean
_bfd_elf_export_symbol (struct elf_link_hash_entry *h, void *data)
{
- struct elf_info_failed *eif = data;
+ struct elf_info_failed *eif = (struct elf_info_failed *) data;
/* Ignore this if we won't export it. */
if (!eif->info->export_dynamic && !h->dynamic)
_bfd_elf_link_find_version_dependencies (struct elf_link_hash_entry *h,
void *data)
{
- struct elf_find_verdep_info *rinfo = data;
+ struct elf_find_verdep_info *rinfo = (struct elf_find_verdep_info *) data;
Elf_Internal_Verneed *t;
Elf_Internal_Vernaux *a;
bfd_size_type amt;
if (t == NULL)
{
amt = sizeof *t;
- t = bfd_zalloc (rinfo->info->output_bfd, amt);
+ t = (Elf_Internal_Verneed *) bfd_zalloc (rinfo->info->output_bfd, amt);
if (t == NULL)
{
rinfo->failed = TRUE;
}
amt = sizeof *a;
- a = bfd_zalloc (rinfo->info->output_bfd, amt);
+ a = (Elf_Internal_Vernaux *) bfd_zalloc (rinfo->info->output_bfd, amt);
if (a == NULL)
{
rinfo->failed = TRUE;
char *p;
bfd_size_type amt;
- sinfo = data;
+ sinfo = (struct elf_info_failed *) data;
info = sinfo->info;
if (h->root.type == bfd_link_hash_warning)
struct bfd_elf_version_expr *d;
len = p - h->root.root.string;
- alc = bfd_malloc (len);
+ alc = (char *) bfd_malloc (len);
if (alc == NULL)
{
sinfo->failed = TRUE;
return TRUE;
amt = sizeof *t;
- t = bfd_zalloc (info->output_bfd, amt);
+ t = (struct bfd_elf_version_tree *) bfd_zalloc (info->output_bfd, amt);
if (t == NULL)
{
sinfo->failed = TRUE;
return FALSE;
}
- erela = external_relocs;
+ erela = (const bfd_byte *) external_relocs;
erelaend = erela + shdr->sh_size;
irela = internal_relocs;
while (erela < erelaend)
size = o->reloc_count;
size *= bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rela);
if (keep_memory)
- internal_relocs = alloc2 = bfd_alloc (abfd, size);
+ internal_relocs = alloc2 = (Elf_Internal_Rela *) bfd_alloc (abfd, size);
else
- internal_relocs = alloc2 = bfd_malloc (size);
+ internal_relocs = alloc2 = (Elf_Internal_Rela *) bfd_malloc (size);
if (internal_relocs == NULL)
goto error_return;
}
allocate it with bfd_alloc rather than malloc. Also since we
cannot be sure that the contents will actually be filled in,
we zero the allocated space. */
- rel_hdr->contents = bfd_zalloc (abfd, rel_hdr->sh_size);
+ rel_hdr->contents = (unsigned char *) bfd_zalloc (abfd, rel_hdr->sh_size);
if (rel_hdr->contents == NULL && rel_hdr->sh_size != 0)
return FALSE;
{
struct elf_link_hash_entry **p;
- p = bfd_zmalloc (num_rel_hashes * sizeof (struct elf_link_hash_entry *));
+ p = (struct elf_link_hash_entry **)
+ bfd_zmalloc (num_rel_hashes * sizeof (struct elf_link_hash_entry *));
if (p == NULL)
return FALSE;
static bfd_boolean
_bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data)
{
- struct elf_info_failed *eif = data;
+ struct elf_info_failed *eif = (struct elf_info_failed *) data;
bfd *dynobj;
const struct elf_backend_data *bed;
&& ((sec = h->root.u.def.section)->flags & SEC_MERGE)
&& sec->sec_info_type == ELF_INFO_TYPE_MERGE)
{
- bfd *output_bfd = data;
+ bfd *output_bfd = (bfd *) data;
h->root.u.def.value =
_bfd_merged_section_offset (output_bfd,
BFD_ASSERT (s != NULL);
newsize = s->size + bed->s->sizeof_dyn;
- newcontents = bfd_realloc (s->contents, newsize);
+ newcontents = (bfd_byte *) bfd_realloc (s->contents, newsize);
if (newcontents == NULL)
return FALSE;
static bfd_boolean
elf_adjust_dynstr_offsets (struct elf_link_hash_entry *h, void *data)
{
- struct elf_strtab_hash *dynstr = data;
+ struct elf_strtab_hash *dynstr = (struct elf_strtab_hash *) data;
if (h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
}
sz = s->size;
- msg = bfd_alloc (abfd, sz + 1);
+ msg = (char *) bfd_alloc (abfd, sz + 1);
if (msg == NULL)
goto error_return;
unsigned int tagv = dyn.d_un.d_val;
amt = sizeof (struct bfd_link_needed_list);
- n = bfd_alloc (abfd, amt);
+ n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
if (n == NULL || fnm == NULL)
goto error_free_dyn;
amt = strlen (fnm) + 1;
- anm = bfd_alloc (abfd, amt);
+ anm = (char *) bfd_alloc (abfd, amt);
if (anm == NULL)
goto error_free_dyn;
memcpy (anm, fnm, amt);
unsigned int tagv = dyn.d_un.d_val;
amt = sizeof (struct bfd_link_needed_list);
- n = bfd_alloc (abfd, amt);
+ n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
if (n == NULL || fnm == NULL)
goto error_free_dyn;
amt = strlen (fnm) + 1;
- anm = bfd_alloc (abfd, amt);
+ anm = (char *) bfd_alloc (abfd, amt);
if (anm == NULL)
goto error_free_dyn;
memcpy (anm, fnm, amt);
unsigned int tagv = dyn.d_un.d_val;
amt = sizeof (struct bfd_link_needed_list);
- n = bfd_alloc (abfd, amt);
+ n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
if (n == NULL || fnm == NULL)
goto error_free_dyn;
amt = strlen (fnm) + 1;
- anm = bfd_alloc (abfd, amt);
+ anm = (char *) bfd_alloc (abfd, amt);
if (anm == NULL)
goto error_free_dyn;
memcpy (anm, fnm, amt);
/* We store a pointer to the hash table entry for each external
symbol. */
amt = extsymcount * sizeof (struct elf_link_hash_entry *);
- sym_hash = bfd_alloc (abfd, amt);
+ sym_hash = (struct elf_link_hash_entry **) bfd_alloc (abfd, amt);
if (sym_hash == NULL)
goto error_free_sym;
elf_sym_hashes (abfd) = sym_hash;
Elf_Internal_Shdr *versymhdr;
versymhdr = &elf_tdata (abfd)->dynversym_hdr;
- extversym = bfd_malloc (versymhdr->sh_size);
+ extversym = (Elf_External_Versym *) bfd_malloc (versymhdr->sh_size);
if (extversym == NULL)
goto error_free_sym;
amt = versymhdr->sh_size;
&& isym->st_shndx != SHN_UNDEF)
++newlen;
- newname = bfd_hash_allocate (&htab->root.table, newlen);
+ newname = (char *) bfd_hash_allocate (&htab->root.table, newlen);
if (newname == NULL)
goto error_free_vers;
memcpy (newname, name, namelen);
{
amt = ((isymend - isym + 1)
* sizeof (struct elf_link_hash_entry *));
- nondeflt_vers = bfd_malloc (amt);
+ nondeflt_vers =
+ (struct elf_link_hash_entry **) bfd_malloc (amt);
if (!nondeflt_vers)
goto error_free_vers;
}
goto error_free_vers;
}
- elf_dyn_lib_class (abfd) &= ~DYN_AS_NEEDED;
+ elf_dyn_lib_class (abfd) = (enum dynamic_lib_link_class)
+ (elf_dyn_lib_class (abfd) & ~DYN_AS_NEEDED);
add_needed = TRUE;
ret = elf_add_dt_needed_tag (abfd, info, soname, add_needed);
continue;
amt = p - h->root.root.string;
- shortname = bfd_malloc (amt + 1);
+ shortname = (char *) bfd_malloc (amt + 1);
if (!shortname)
goto error_free_vers;
memcpy (shortname, h->root.root.string, amt);
defined symbol, search time for N weak defined symbols will be
O(N^2). Binary search will cut it down to O(NlogN). */
amt = extsymcount * sizeof (struct elf_link_hash_entry *);
- sorted_sym_hash = bfd_malloc (amt);
+ sorted_sym_hash = (struct elf_link_hash_entry **) bfd_malloc (amt);
if (sorted_sym_hash == NULL)
goto error_return;
sym_hash = sorted_sym_hash;
/* Add this bfd to the loaded list. */
struct elf_link_loaded_list *n;
- n = bfd_alloc (abfd, sizeof (struct elf_link_loaded_list));
+ n = (struct elf_link_loaded_list *)
+ bfd_alloc (abfd, sizeof (struct elf_link_loaded_list));
if (n == NULL)
goto error_return;
n->abfd = abfd;
/* First check with only one `@'. */
len = strlen (name);
- copy = bfd_alloc (abfd, len);
+ copy = (char *) bfd_alloc (abfd, len);
if (copy == NULL)
return (struct elf_link_hash_entry *) 0 - 1;
return TRUE;
amt = c;
amt *= sizeof (bfd_boolean);
- defined = bfd_zmalloc (amt);
- included = bfd_zmalloc (amt);
+ defined = (bfd_boolean *) bfd_zmalloc (amt);
+ included = (bfd_boolean *) bfd_zmalloc (amt);
if (defined == NULL || included == NULL)
goto error_return;
static bfd_boolean
elf_collect_hash_codes (struct elf_link_hash_entry *h, void *data)
{
- struct hash_codes_info *inf = data;
+ struct hash_codes_info *inf = (struct hash_codes_info *) data;
const char *name;
char *p;
unsigned long ha;
p = strchr (name, ELF_VER_CHR);
if (p != NULL)
{
- alc = bfd_malloc (p - name + 1);
+ alc = (char *) bfd_malloc (p - name + 1);
if (alc == NULL)
{
inf->error = TRUE;
static bfd_boolean
elf_collect_gnu_hash_codes (struct elf_link_hash_entry *h, void *data)
{
- struct collect_gnu_hash_codes *s = data;
+ struct collect_gnu_hash_codes *s = (struct collect_gnu_hash_codes *) data;
const char *name;
char *p;
unsigned long ha;
p = strchr (name, ELF_VER_CHR);
if (p != NULL)
{
- alc = bfd_malloc (p - name + 1);
+ alc = (char *) bfd_malloc (p - name + 1);
if (alc == NULL)
{
s->error = TRUE;
static bfd_boolean
elf_renumber_gnu_hash_syms (struct elf_link_hash_entry *h, void *data)
{
- struct collect_gnu_hash_codes *s = data;
+ struct collect_gnu_hash_codes *s = (struct collect_gnu_hash_codes *) data;
unsigned long int bucket;
unsigned long int val;
since the size could be large. */
amt = maxsize;
amt *= sizeof (unsigned long int);
- counts = bfd_malloc (amt);
+ counts = (unsigned long int *) bfd_malloc (amt);
if (counts == NULL)
return 0;
verlen = strlen (verstr);
newlen = namelen + verlen + 3;
- newname = bfd_malloc (newlen);
+ newname = (char *) bfd_malloc (newlen);
if (newname == NULL)
return FALSE;
memcpy (newname, name, namelen);
}
s->size = size;
- s->contents = bfd_alloc (output_bfd, s->size);
+ s->contents = (unsigned char *) bfd_alloc (output_bfd, s->size);
if (s->contents == NULL && s->size != 0)
return FALSE;
}
s->size = size;
- s->contents = bfd_alloc (output_bfd, s->size);
+ s->contents = (unsigned char *) bfd_alloc (output_bfd, s->size);
if (s->contents == NULL)
return FALSE;
&& (s->flags & SEC_EXCLUDE) == 0)
{
s->size = dynsymcount * sizeof (Elf_External_Versym);
- s->contents = bfd_zalloc (output_bfd, s->size);
+ s->contents = (unsigned char *) bfd_zalloc (output_bfd, s->size);
if (s->contents == NULL)
return FALSE;
if (dynsymcount != 0)
{
- s->contents = bfd_alloc (output_bfd, s->size);
+ s->contents = (unsigned char *) bfd_alloc (output_bfd, s->size);
if (s->contents == NULL)
return FALSE;
time store the values in an array so that we could use them for
optimizations. */
amt = dynsymcount * sizeof (unsigned long int);
- hashcodes = bfd_malloc (amt);
+ hashcodes = (unsigned long int *) bfd_malloc (amt);
if (hashcodes == NULL)
return FALSE;
hashinf.hashcodes = hashcodes;
BFD_ASSERT (s != NULL);
hash_entry_size = elf_section_data (s)->this_hdr.sh_entsize;
s->size = ((2 + bucketcount + dynsymcount) * hash_entry_size);
- s->contents = bfd_zalloc (output_bfd, s->size);
+ s->contents = (unsigned char *) bfd_zalloc (output_bfd, s->size);
if (s->contents == NULL)
return FALSE;
time store the values in an array so that we could use them for
optimizations. */
amt = dynsymcount * 2 * sizeof (unsigned long int);
- cinfo.hashcodes = bfd_malloc (amt);
+ cinfo.hashcodes = (long unsigned int *) bfd_malloc (amt);
if (cinfo.hashcodes == NULL)
return FALSE;
BFD_ASSERT (cinfo.min_dynindx == -1);
free (cinfo.hashcodes);
s->size = 5 * 4 + bed->s->arch_size / 8;
- contents = bfd_zalloc (output_bfd, s->size);
+ contents = (unsigned char *) bfd_zalloc (output_bfd, s->size);
if (contents == NULL)
return FALSE;
s->contents = contents;
maskwords = 1 << (maskbitslog2 - cinfo.shift1);
amt = bucketcount * sizeof (unsigned long int) * 2;
amt += maskwords * sizeof (bfd_vma);
- cinfo.bitmask = bfd_malloc (amt);
+ cinfo.bitmask = (bfd_vma *) bfd_malloc (amt);
if (cinfo.bitmask == NULL)
{
free (cinfo.hashcodes);
return FALSE;
}
- cinfo.counts = (void *) (cinfo.bitmask + maskwords);
+ cinfo.counts = (long unsigned int *) (cinfo.bitmask + maskwords);
cinfo.indx = cinfo.counts + bucketcount;
cinfo.symindx = dynsymcount - cinfo.nsyms;
memset (cinfo.bitmask, 0, maskwords * sizeof (bfd_vma));
s->size = (4 + bucketcount + cinfo.nsyms) * 4;
s->size += cinfo.maskbits / 8;
- contents = bfd_zalloc (output_bfd, s->size);
+ contents = (unsigned char *) bfd_zalloc (output_bfd, s->size);
if (contents == NULL)
{
free (cinfo.bitmask);
subclass. */
if (entry == NULL)
{
- entry = bfd_hash_allocate (table, sizeof (struct elf_link_hash_entry));
+ entry = (struct bfd_hash_entry *)
+ bfd_hash_allocate (table, sizeof (struct elf_link_hash_entry));
if (entry == NULL)
return entry;
}
struct elf_link_hash_table *ret;
bfd_size_type amt = sizeof (struct elf_link_hash_table);
- ret = bfd_malloc (amt);
+ ret = (struct elf_link_hash_table *) bfd_malloc (amt);
if (ret == NULL)
return NULL;
goto error_return;
amt = sizeof *l;
- l = bfd_alloc (abfd, amt);
+ l = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
if (l == NULL)
goto error_return;
struct elf_symbuf_head *ssymbuf, *ssymhead;
bfd_size_type i, shndx_count, total_size;
- indbuf = bfd_malloc2 (symcount, sizeof (*indbuf));
+ indbuf = (Elf_Internal_Sym **) bfd_malloc2 (symcount, sizeof (*indbuf));
if (indbuf == NULL)
return NULL;
total_size = ((shndx_count + 1) * sizeof (*ssymbuf)
+ (indbufend - indbuf) * sizeof (*ssym));
- ssymbuf = bfd_malloc (total_size);
+ ssymbuf = (struct elf_symbuf_head *) bfd_malloc (total_size);
if (ssymbuf == NULL)
{
free (indbuf);
result = FALSE;
isymbuf1 = NULL;
isymbuf2 = NULL;
- ssymbuf1 = elf_tdata (bfd1)->symbuf;
- ssymbuf2 = elf_tdata (bfd2)->symbuf;
+ ssymbuf1 = (struct elf_symbuf_head *) elf_tdata (bfd1)->symbuf;
+ ssymbuf2 = (struct elf_symbuf_head *) elf_tdata (bfd2)->symbuf;
if (ssymbuf1 == NULL)
{
if (count1 == 0 || count2 == 0 || count1 != count2)
goto done;
- symtable1 = bfd_malloc (count1 * sizeof (struct elf_symbol));
- symtable2 = bfd_malloc (count2 * sizeof (struct elf_symbol));
+ symtable1 = (struct elf_symbol *)
+ bfd_malloc (count1 * sizeof (struct elf_symbol));
+ symtable2 = (struct elf_symbol *)
+ bfd_malloc (count2 * sizeof (struct elf_symbol));
if (symtable1 == NULL || symtable2 == NULL)
goto done;
goto done;
}
- symtable1 = bfd_malloc (symcount1 * sizeof (struct elf_symbol));
- symtable2 = bfd_malloc (symcount2 * sizeof (struct elf_symbol));
+ symtable1 = (struct elf_symbol *)
+ bfd_malloc (symcount1 * sizeof (struct elf_symbol));
+ symtable2 = (struct elf_symbol *)
+ bfd_malloc (symcount2 * sizeof (struct elf_symbol));
if (symtable1 == NULL || symtable2 == NULL)
goto done;
static int
elf_link_sort_cmp1 (const void *A, const void *B)
{
- const struct elf_link_sort_rela *a = A;
- const struct elf_link_sort_rela *b = B;
+ const struct elf_link_sort_rela *a = (const struct elf_link_sort_rela *) A;
+ const struct elf_link_sort_rela *b = (const struct elf_link_sort_rela *) B;
int relativea, relativeb;
relativea = a->type == reloc_class_relative;
static int
elf_link_sort_cmp2 (const void *A, const void *B)
{
- const struct elf_link_sort_rela *a = A;
- const struct elf_link_sort_rela *b = B;
+ const struct elf_link_sort_rela *a = (const struct elf_link_sort_rela *) A;
+ const struct elf_link_sort_rela *b = (const struct elf_link_sort_rela *) B;
int copya, copyb;
if (a->u.offset < b->u.offset)
count = dynamic_relocs->size / ext_size;
if (count == 0)
return 0;
- sort = bfd_zmalloc (sort_elt * count);
+ sort = (bfd_byte *) bfd_zmalloc (sort_elt * count);
if (sort == NULL)
{
bfd_size_type amt;
amt = finfo->shndxbuf_size * sizeof (Elf_External_Sym_Shndx);
- destshndx = bfd_realloc (destshndx, amt * 2);
+ destshndx = (Elf_External_Sym_Shndx *) bfd_realloc (destshndx,
+ amt * 2);
if (destshndx == NULL)
return 0;
finfo->symshndxbuf = destshndx;
/* Read in any version definitions. */
versymhdr = &elf_tdata (input)->dynversym_hdr;
- extversym = bfd_malloc (versymhdr->sh_size);
+ extversym = (Elf_External_Versym *) bfd_malloc (versymhdr->sh_size);
if (extversym == NULL)
goto error_ret;
static bfd_boolean
elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
{
- struct elf_outext_info *eoinfo = data;
+ struct elf_outext_info *eoinfo = (struct elf_outext_info *) data;
struct elf_final_link_info *finfo = eoinfo->finfo;
bfd_boolean strip;
Elf_Internal_Sym sym;
bfd_boolean ok;
const char *sym_name;
- size = bfd_get_reloc_size (howto);
- buf = bfd_zmalloc (size);
+ size = (bfd_size_type) bfd_get_reloc_size (howto);
+ buf = (bfd_byte *) bfd_zmalloc (size);
if (buf == NULL)
return FALSE;
rstat = _bfd_relocate_contents (howto, output_bfd, addend, buf);
finfo.symbuf_size = max_sym_count;
amt = finfo.symbuf_size;
amt *= bed->s->sizeof_sym;
- finfo.symbuf = bfd_malloc (amt);
+ finfo.symbuf = (bfd_byte *) bfd_malloc (amt);
if (finfo.symbuf == NULL)
goto error_return;
if (elf_numsections (abfd) > (SHN_LORESERVE & 0xFFFF))
amt = 2 * max_sym_count + elf_numsections (abfd) + 1000;
finfo.shndxbuf_size = amt;
amt *= sizeof (Elf_External_Sym_Shndx);
- finfo.symshndxbuf = bfd_zmalloc (amt);
+ finfo.symshndxbuf = (Elf_External_Sym_Shndx *) bfd_zmalloc (amt);
if (finfo.symshndxbuf == NULL)
goto error_return;
}
files. */
if (max_contents_size != 0)
{
- finfo.contents = bfd_malloc (max_contents_size);
+ finfo.contents = (bfd_byte *) bfd_malloc (max_contents_size);
if (finfo.contents == NULL)
goto error_return;
}
{
amt = max_internal_reloc_count * bed->s->int_rels_per_ext_rel;
amt *= sizeof (Elf_Internal_Rela);
- finfo.internal_relocs = bfd_malloc (amt);
+ finfo.internal_relocs = (Elf_Internal_Rela *) bfd_malloc (amt);
if (finfo.internal_relocs == NULL)
goto error_return;
}
if (max_sym_count != 0)
{
amt = max_sym_count * bed->s->sizeof_sym;
- finfo.external_syms = bfd_malloc (amt);
+ finfo.external_syms = (bfd_byte *) bfd_malloc (amt);
if (finfo.external_syms == NULL)
goto error_return;
amt = max_sym_count * sizeof (Elf_Internal_Sym);
- finfo.internal_syms = bfd_malloc (amt);
+ finfo.internal_syms = (Elf_Internal_Sym *) bfd_malloc (amt);
if (finfo.internal_syms == NULL)
goto error_return;
amt = max_sym_count * sizeof (long);
- finfo.indices = bfd_malloc (amt);
+ finfo.indices = (long int *) bfd_malloc (amt);
if (finfo.indices == NULL)
goto error_return;
amt = max_sym_count * sizeof (asection *);
- finfo.sections = bfd_malloc (amt);
+ finfo.sections = (asection **) bfd_malloc (amt);
if (finfo.sections == NULL)
goto error_return;
}
if (max_sym_shndx_count != 0)
{
amt = max_sym_shndx_count * sizeof (Elf_External_Sym_Shndx);
- finfo.locsym_shndx = bfd_malloc (amt);
+ finfo.locsym_shndx = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
if (finfo.locsym_shndx == NULL)
goto error_return;
}
if (attr_section)
{
- bfd_byte *contents = bfd_malloc (attr_size);
+ bfd_byte *contents = (bfd_byte *) bfd_malloc (attr_size);
if (contents == NULL)
return FALSE; /* Bail out and fail. */
bfd_elf_set_obj_attr_contents (abfd, contents, attr_size);
&& !h->root.u.def.section->gc_mark
&& !(h->root.u.def.section->owner->flags & DYNAMIC))
{
- struct elf_gc_sweep_symbol_info *inf = data;
+ struct elf_gc_sweep_symbol_info *inf =
+ (struct elf_gc_sweep_symbol_info *) data;
(*inf->hide_symbol) (inf->info, h, TRUE);
}
win:
if (!child->vtable)
{
- child->vtable = bfd_zalloc (abfd, sizeof (*child->vtable));
+ child->vtable = (struct elf_link_virtual_table_entry *)
+ bfd_zalloc (abfd, sizeof (*child->vtable));
if (!child->vtable)
return FALSE;
}
if (!h->vtable)
{
- h->vtable = bfd_zalloc (abfd, sizeof (*h->vtable));
+ h->vtable = (struct elf_link_virtual_table_entry *)
+ bfd_zalloc (abfd, sizeof (*h->vtable));
if (!h->vtable)
return FALSE;
}
if (ptr)
{
- ptr = bfd_realloc (ptr - 1, bytes);
+ ptr = (bfd_boolean *) bfd_realloc (ptr - 1, bytes);
if (ptr != NULL)
{
}
}
else
- ptr = bfd_zmalloc (bytes);
+ ptr = (bfd_boolean *) bfd_zmalloc (bytes);
if (ptr == NULL)
return FALSE;
static bfd_boolean
elf_gc_allocate_got_offsets (struct elf_link_hash_entry *h, void *arg)
{
- struct alloc_got_off_arg *gofarg = arg;
+ struct alloc_got_off_arg *gofarg = (struct alloc_got_off_arg *) arg;
bfd *obfd = gofarg->info->output_bfd;
const struct elf_backend_data *bed = get_elf_backend_data (obfd);
bfd_boolean
bfd_elf_reloc_symbol_deleted_p (bfd_vma offset, void *cookie)
{
- struct elf_reloc_cookie *rcookie = cookie;
+ struct elf_reloc_cookie *rcookie = (struct elf_reloc_cookie *) cookie;
if (rcookie->bad_symtab)
rcookie->rel = rcookie->rels;
bfd_size_type amt;
amt = sizeof (*matching_vector) * 2 * _bfd_target_vector_entries;
- matching_vector = bfd_malloc (amt);
+ matching_vector = (const bfd_target **) bfd_malloc (amt);
if (!matching_vector)
return FALSE;
}
bfd_set_error (bfd_error_no_memory);
return FALSE;
}
- table->table = objalloc_alloc ((struct objalloc *) table->memory, alloc);
+ table->table = (struct bfd_hash_entry **)
+ objalloc_alloc ((struct objalloc *) table->memory, alloc);
if (table->table == NULL)
{
bfd_set_error (bfd_error_no_memory);
void
bfd_hash_table_free (struct bfd_hash_table *table)
{
- objalloc_free (table->memory);
+ objalloc_free ((struct objalloc *) table->memory);
table->memory = NULL;
}
const char *string ATTRIBUTE_UNUSED)
{
if (entry == NULL)
- entry = bfd_hash_allocate (table, sizeof (* entry));
+ entry = (struct bfd_hash_entry *) bfd_hash_allocate (table,
+ sizeof (* entry));
return entry;
}
/* Allocate the structure if it has not already been allocated by a
subclass. */
if (ret == NULL)
- ret = bfd_hash_allocate (table, sizeof (* ret));
+ ret = (struct strtab_hash_entry *) bfd_hash_allocate (table,
+ sizeof (* ret));
if (ret == NULL)
return NULL;
struct bfd_strtab_hash *table;
bfd_size_type amt = sizeof (* table);
- table = bfd_malloc (amt);
+ table = (struct bfd_strtab_hash *) bfd_malloc (amt);
if (table == NULL)
return NULL;
}
else
{
- entry = bfd_hash_allocate (&tab->table, sizeof (* entry));
+ entry = (struct strtab_hash_entry *) bfd_hash_allocate (&tab->table,
+ sizeof (* entry));
if (entry == NULL)
return (bfd_size_type) -1;
if (! copy)
{
char *n;
- n = bfd_hash_allocate (&tab->table, strlen (str) + 1);
+ n = (char *) bfd_hash_allocate (&tab->table, strlen (str) + 1);
if (n == NULL)
return (bfd_size_type) -1;
entry->root.string = n;
{
struct ihex_data_struct *tdata;
- tdata = bfd_alloc (abfd, sizeof (* tdata));
+ tdata = (struct ihex_data_struct *) bfd_alloc (abfd, sizeof (* tdata));
if (tdata == NULL)
return FALSE;
chars = len * 2 + 2;
if (chars >= bufsize)
{
- buf = bfd_realloc (buf, (bfd_size_type) chars);
+ buf = (bfd_byte *) bfd_realloc (buf, (bfd_size_type) chars);
if (buf == NULL)
goto error_return;
bufsize = chars;
sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1);
amt = strlen (secbuf) + 1;
- secname = bfd_alloc (abfd, amt);
+ secname = (char *) bfd_alloc (abfd, amt);
if (secname == NULL)
goto error_return;
strcpy (secname, secbuf);
if (len * 2 > bufsize)
{
- buf = bfd_realloc (buf, (bfd_size_type) len * 2);
+ buf = (bfd_byte *) bfd_realloc (buf, (bfd_size_type) len * 2);
if (buf == NULL)
goto error_return;
bufsize = len * 2;
section->used_by_bfd = bfd_alloc (abfd, section->size);
if (section->used_by_bfd == NULL)
return FALSE;
- if (! ihex_read_section (abfd, section, section->used_by_bfd))
+ if (! ihex_read_section (abfd, section,
+ (bfd_byte *) section->used_by_bfd))
return FALSE;
}
|| (section->flags & SEC_LOAD) == 0)
return TRUE;
- n = bfd_alloc (abfd, sizeof (* n));
+ n = (struct ihex_data_list *) bfd_alloc (abfd, sizeof (* n));
if (n == NULL)
return FALSE;
- data = bfd_alloc (abfd, count);
+ data = (bfd_byte *) bfd_alloc (abfd, count);
if (data == NULL)
return FALSE;
memcpy (data, location, (size_t) count);
Various things depend on this struct being around any time an a.out
file is being handled. An example is dbxread.c in GDB. */
+enum aout_subformat {
+ default_format = 0,
+ /* Used on HP 9000/300 running HP/UX. See hp300hpux.c. */
+ gnu_encap_format,
+ /* Used on Linux, 386BSD, etc. See include/aout/aout64.h. */
+ q_magic_format
+};
+
+enum aout_magic {
+ undecided_magic = 0,
+ z_magic,
+ o_magic,
+ n_magic
+};
+
struct aoutdata
{
struct internal_exec *hdr; /* Exec file header. */
unsigned vma_adjusted : 1;
/* Used when a bfd supports several highly similar formats. */
- enum
- {
- default_format = 0,
- /* Used on HP 9000/300 running HP/UX. See hp300hpux.c. */
- gnu_encap_format,
- /* Used on Linux, 386BSD, etc. See include/aout/aout64.h. */
- q_magic_format
- } subformat;
-
- enum
- {
- undecided_magic = 0,
- z_magic,
- o_magic,
- n_magic
- } magic;
+ enum aout_subformat subformat;
+
+ enum aout_magic magic;
/* A buffer for find_nearest_line. */
char *line_buf;
bfd_vma
bfd_getb16 (const void *p)
{
- const bfd_byte *addr = p;
+ const bfd_byte *addr = (const bfd_byte *) p;
return (addr[0] << 8) | addr[1];
}
bfd_vma
bfd_getl16 (const void *p)
{
- const bfd_byte *addr = p;
+ const bfd_byte *addr = (const bfd_byte *) p;
return (addr[1] << 8) | addr[0];
}
bfd_signed_vma
bfd_getb_signed_16 (const void *p)
{
- const bfd_byte *addr = p;
+ const bfd_byte *addr = (const bfd_byte *) p;
return COERCE16 ((addr[0] << 8) | addr[1]);
}
bfd_signed_vma
bfd_getl_signed_16 (const void *p)
{
- const bfd_byte *addr = p;
+ const bfd_byte *addr = (const bfd_byte *) p;
return COERCE16 ((addr[1] << 8) | addr[0]);
}
void
bfd_putb16 (bfd_vma data, void *p)
{
- bfd_byte *addr = p;
+ bfd_byte *addr = (bfd_byte *) p;
addr[0] = (data >> 8) & 0xff;
addr[1] = data & 0xff;
}
void
bfd_putl16 (bfd_vma data, void *p)
{
- bfd_byte *addr = p;
+ bfd_byte *addr = (bfd_byte *) p;
addr[0] = data & 0xff;
addr[1] = (data >> 8) & 0xff;
}
bfd_vma
bfd_getb32 (const void *p)
{
- const bfd_byte *addr = p;
+ const bfd_byte *addr = (const bfd_byte *) p;
unsigned long v;
v = (unsigned long) addr[0] << 24;
bfd_vma
bfd_getl32 (const void *p)
{
- const bfd_byte *addr = p;
+ const bfd_byte *addr = (const bfd_byte *) p;
unsigned long v;
v = (unsigned long) addr[0];
bfd_signed_vma
bfd_getb_signed_32 (const void *p)
{
- const bfd_byte *addr = p;
+ const bfd_byte *addr = (const bfd_byte *) p;
unsigned long v;
v = (unsigned long) addr[0] << 24;
bfd_signed_vma
bfd_getl_signed_32 (const void *p)
{
- const bfd_byte *addr = p;
+ const bfd_byte *addr = (const bfd_byte *) p;
unsigned long v;
v = (unsigned long) addr[0];
bfd_getb64 (const void *p ATTRIBUTE_UNUSED)
{
#ifdef BFD_HOST_64_BIT
- const bfd_byte *addr = p;
+ const bfd_byte *addr = (const bfd_byte *) p;
bfd_uint64_t v;
v = addr[0]; v <<= 8;
bfd_getl64 (const void *p ATTRIBUTE_UNUSED)
{
#ifdef BFD_HOST_64_BIT
- const bfd_byte *addr = p;
+ const bfd_byte *addr = (const bfd_byte *) p;
bfd_uint64_t v;
v = addr[7]; v <<= 8;
bfd_getb_signed_64 (const void *p ATTRIBUTE_UNUSED)
{
#ifdef BFD_HOST_64_BIT
- const bfd_byte *addr = p;
+ const bfd_byte *addr = (const bfd_byte *) p;
bfd_uint64_t v;
v = addr[0]; v <<= 8;
bfd_getl_signed_64 (const void *p ATTRIBUTE_UNUSED)
{
#ifdef BFD_HOST_64_BIT
- const bfd_byte *addr = p;
+ const bfd_byte *addr = (const bfd_byte *) p;
bfd_uint64_t v;
v = addr[7]; v <<= 8;
void
bfd_putb32 (bfd_vma data, void *p)
{
- bfd_byte *addr = p;
+ bfd_byte *addr = (bfd_byte *) p;
addr[0] = (data >> 24) & 0xff;
addr[1] = (data >> 16) & 0xff;
addr[2] = (data >> 8) & 0xff;
void
bfd_putl32 (bfd_vma data, void *p)
{
- bfd_byte *addr = p;
+ bfd_byte *addr = (bfd_byte *) p;
addr[0] = data & 0xff;
addr[1] = (data >> 8) & 0xff;
addr[2] = (data >> 16) & 0xff;
bfd_putb64 (bfd_uint64_t data ATTRIBUTE_UNUSED, void *p ATTRIBUTE_UNUSED)
{
#ifdef BFD_HOST_64_BIT
- bfd_byte *addr = p;
+ bfd_byte *addr = (bfd_byte *) p;
addr[0] = (data >> (7*8)) & 0xff;
addr[1] = (data >> (6*8)) & 0xff;
addr[2] = (data >> (5*8)) & 0xff;
bfd_putl64 (bfd_uint64_t data ATTRIBUTE_UNUSED, void *p ATTRIBUTE_UNUSED)
{
#ifdef BFD_HOST_64_BIT
- bfd_byte *addr = p;
+ bfd_byte *addr = (bfd_byte *) p;
addr[7] = (data >> (7*8)) & 0xff;
addr[6] = (data >> (6*8)) & 0xff;
addr[5] = (data >> (5*8)) & 0xff;
void
bfd_put_bits (bfd_uint64_t data, void *p, int bits, bfd_boolean big_p)
{
- bfd_byte *addr = p;
+ bfd_byte *addr = (bfd_byte *) p;
int i;
int bytes;
bfd_uint64_t
bfd_get_bits (const void *p, int bits, bfd_boolean big_p)
{
- const bfd_byte *addr = p;
+ const bfd_byte *addr = (const bfd_byte *) p;
bfd_uint64_t data;
int i;
int bytes;
subclass. */
if (entry == NULL)
{
- entry = bfd_hash_allocate (table, sizeof (struct bfd_link_hash_entry));
+ entry = (struct bfd_hash_entry *)
+ bfd_hash_allocate (table, sizeof (struct bfd_link_hash_entry));
if (entry == NULL)
return entry;
}
references to SYM with references to __wrap_SYM. */
amt = strlen (l) + sizeof WRAP + 1;
- n = bfd_malloc (amt);
+ n = (char *) bfd_malloc (amt);
if (n == NULL)
return NULL;
with references to SYM. */
amt = strlen (l + sizeof REAL - 1) + 2;
- n = bfd_malloc (amt);
+ n = (char *) bfd_malloc (amt);
if (n == NULL)
return NULL;
subclass. */
if (entry == NULL)
{
- entry =
+ entry = (struct bfd_hash_entry *)
bfd_hash_allocate (table, sizeof (struct generic_link_hash_entry));
if (entry == NULL)
return entry;
struct generic_link_hash_table *ret;
bfd_size_type amt = sizeof (struct generic_link_hash_table);
- ret = bfd_malloc (amt);
+ ret = (struct generic_link_hash_table *) bfd_malloc (amt);
if (ret == NULL)
return NULL;
if (! _bfd_link_hash_table_init (&ret->root, abfd,
symsize = bfd_get_symtab_upper_bound (abfd);
if (symsize < 0)
return FALSE;
- bfd_get_outsymbols (abfd) = bfd_alloc (abfd, symsize);
+ bfd_get_outsymbols (abfd) = (struct bfd_symbol **) bfd_alloc (abfd,
+ symsize);
if (bfd_get_outsymbols (abfd) == NULL && symsize != 0)
return FALSE;
symcount = bfd_canonicalize_symtab (abfd, bfd_get_outsymbols (abfd));
/* Allocate the structure if it has not already been allocated by a
subclass. */
if (ret == NULL)
- ret = bfd_hash_allocate (table, sizeof (struct archive_hash_entry));
+ ret = (struct archive_hash_entry *)
+ bfd_hash_allocate (table, sizeof (struct archive_hash_entry));
if (ret == NULL)
return NULL;
if (info->pei386_auto_import)
{
bfd_size_type amt = strlen (h->root.string) + 10;
- char *buf = bfd_malloc (amt);
+ char *buf = (char *) bfd_malloc (amt);
if (buf == NULL)
return FALSE;
attached to symbfd to ensure that it is in a BFD which
will be linked in. */
h->type = bfd_link_hash_common;
- h->u.c.p =
+ h->u.c.p = (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)
if (h->type == bfd_link_hash_new)
bfd_link_add_undef (info->hash, h);
h->type = bfd_link_hash_common;
- h->u.c.p =
+ h->u.c.p = (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)
char *w;
size_t len = strlen (string) + 1;
- w = bfd_hash_allocate (&info->hash->table, len);
+ w = (char *) bfd_hash_allocate (&info->hash->table, len);
if (w == NULL)
return FALSE;
memcpy (w, string, len);
input_section);
if (relsize < 0)
return FALSE;
- relocs = bfd_malloc (relsize);
+ relocs = (arelent **) bfd_malloc (relsize);
if (!relocs && relsize != 0)
return FALSE;
symbols = _bfd_generic_link_get_symbols (input_bfd);
amt = o->reloc_count;
amt *= sizeof (arelent *);
- o->orelocation = bfd_alloc (abfd, amt);
+ o->orelocation = (struct reloc_cache_entry **) bfd_alloc (abfd, amt);
if (!o->orelocation)
return FALSE;
o->flags |= SEC_RELOC;
*psymalloc *= 2;
amt = *psymalloc;
amt *= sizeof (asymbol *);
- newsyms = bfd_realloc (bfd_get_outsymbols (output_bfd), amt);
+ newsyms = (asymbol **) bfd_realloc (bfd_get_outsymbols (output_bfd), amt);
if (newsyms == NULL)
return FALSE;
bfd_get_outsymbols (output_bfd) = newsyms;
|| bfd_is_ind_section (bfd_get_section (sym)))
{
if (sym->udata.p != NULL)
- h = sym->udata.p;
+ h = (struct generic_link_hash_entry *) sym->udata.p;
else if ((sym->flags & BSF_CONSTRUCTOR) != 0)
{
/* This case normally means that the main linker code
_bfd_generic_link_write_global_symbol (struct generic_link_hash_entry *h,
void *data)
{
- struct generic_write_global_symbol_info *wginfo = data;
+ struct generic_write_global_symbol_info *wginfo =
+ (struct generic_write_global_symbol_info *) data;
asymbol *sym;
if (h->root.type == bfd_link_hash_warning)
if (sec->orelocation == NULL)
abort ();
- r = bfd_alloc (abfd, sizeof (arelent));
+ r = (arelent *) bfd_alloc (abfd, sizeof (arelent));
if (r == NULL)
return FALSE;
file_ptr loc;
size = bfd_get_reloc_size (r->howto);
- buf = bfd_zmalloc (size);
+ buf = (bfd_byte *) bfd_zmalloc (size);
if (buf == NULL)
return FALSE;
rstat = _bfd_relocate_contents (r->howto, abfd,
if (fill_size != 0 && fill_size < size)
{
bfd_byte *p;
- fill = bfd_malloc (size);
+ fill = (bfd_byte *) bfd_malloc (size);
if (fill == NULL)
return FALSE;
p = fill;
/* sym->udata may have been set by
generic_link_add_symbol_list. */
if (sym->udata.p != NULL)
- h = sym->udata.p;
+ h = (struct bfd_link_hash_entry *) 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),
sec_size = (input_section->rawsize > input_section->size
? input_section->rawsize
: input_section->size);
- contents = bfd_malloc (sec_size);
+ contents = (bfd_byte *) bfd_malloc (sec_size);
if (contents == NULL && sec_size != 0)
goto error_return;
new_contents = (bfd_get_relocated_section_contents
/* Allocate the memory from the same obstack as the hash table is
kept in. */
- l = bfd_hash_allocate (&_bfd_section_already_linked_table, sizeof *l);
+ l = (struct bfd_section_already_linked *)
+ bfd_hash_allocate (&_bfd_section_already_linked_table, sizeof *l);
if (l == NULL)
return FALSE;
l->sec = sec;
const char *string ATTRIBUTE_UNUSED)
{
struct bfd_section_already_linked_hash_entry *ret =
- bfd_hash_allocate (table, sizeof *ret);
+ (struct bfd_section_already_linked_hash_entry *)
+ bfd_hash_allocate (table, sizeof *ret);
if (ret == NULL)
return NULL;
/* Allocate the structure if it has not already been allocated by a
subclass. */
if (entry == NULL)
- entry = bfd_hash_allocate (table, sizeof (struct sec_merge_hash_entry));
+ entry = (struct bfd_hash_entry *)
+ bfd_hash_allocate (table, sizeof (struct sec_merge_hash_entry));
if (entry == NULL)
return NULL;
{
struct sec_merge_hash *table;
- table = bfd_malloc (sizeof (struct sec_merge_hash));
+ table = (struct sec_merge_hash *) bfd_malloc (sizeof (struct sec_merge_hash));
if (table == NULL)
return NULL;
if (alignment_power)
{
- pad = bfd_zmalloc ((bfd_size_type) 1 << alignment_power);
+ pad = (char *) bfd_zmalloc ((bfd_size_type) 1 << alignment_power);
if (pad == NULL)
return FALSE;
}
if (sinfo == NULL)
{
/* Initialize the information we need to keep track of. */
- sinfo = bfd_alloc (abfd, sizeof (struct sec_merge_info));
+ sinfo = (struct sec_merge_info *)
+ bfd_alloc (abfd, sizeof (struct sec_merge_info));
if (sinfo == NULL)
goto error_return;
sinfo->next = (struct sec_merge_info *) *psinfo;
/* Now sort the strings */
amt = sinfo->htab->size * sizeof (struct sec_merge_hash_entry *);
- array = bfd_malloc (amt);
+ array = (struct sec_merge_hash_entry **) bfd_malloc (amt);
if (array == NULL)
goto alloc_failure;
{
bfd *nbfd;
- nbfd = bfd_zmalloc (sizeof (bfd));
+ nbfd = (bfd *) bfd_zmalloc (sizeof (bfd));
if (nbfd == NULL)
return NULL;
bfd *
bfd_openstreamr (const char *filename, const char *target, void *streamarg)
{
- FILE *stream = streamarg;
+ FILE *stream = (FILE *) streamarg;
bfd *nbfd;
const bfd_target *target_vec;
static file_ptr
opncls_btell (struct bfd *abfd)
{
- struct opncls *vec = abfd->iostream;
+ struct opncls *vec = (struct opncls *) abfd->iostream;
return vec->where;
}
static int
opncls_bseek (struct bfd *abfd, file_ptr offset, int whence)
{
- struct opncls *vec = abfd->iostream;
+ struct opncls *vec = (struct opncls *) abfd->iostream;
switch (whence)
{
case SEEK_SET: vec->where = offset; break;
static file_ptr
opncls_bread (struct bfd *abfd, void *buf, file_ptr nbytes)
{
- struct opncls *vec = abfd->iostream;
+ struct opncls *vec = (struct opncls *) abfd->iostream;
file_ptr nread = (vec->pread) (abfd, vec->stream, buf, nbytes, vec->where);
if (nread < 0)
return nread;
static int
opncls_bclose (struct bfd *abfd)
{
- struct opncls *vec = abfd->iostream;
+ struct opncls *vec = (struct opncls *) abfd->iostream;
/* Since the VEC's memory is bound to the bfd deleting the bfd will
free it. */
int status = 0;
static int
opncls_bstat (struct bfd *abfd, struct stat *sb)
{
- struct opncls *vec = abfd->iostream;
+ struct opncls *vec = (struct opncls *) abfd->iostream;
memset (sb, 0, sizeof (*sb));
if (vec->stat == NULL)
return NULL;
}
- vec = bfd_zalloc (nbfd, sizeof (struct opncls));
+ vec = (struct opncls *) bfd_zalloc (nbfd, sizeof (struct opncls));
vec->stream = stream;
vec->pread = pread;
vec->close = close;
/* FIXME: cagney/2004-02-15: Need to implement a BFD_IN_MEMORY io
vector.
Until that's done, at least don't leak memory. */
- struct bfd_in_memory *bim = abfd->iostream;
+ struct bfd_in_memory *bim = (struct bfd_in_memory *) abfd->iostream;
free (bim->buffer);
free (bim);
ret = TRUE;
return FALSE;
}
- bim = bfd_malloc (sizeof (struct bfd_in_memory));
+ bim = (struct bfd_in_memory *) bfd_malloc (sizeof (struct bfd_in_memory));
if (bim == NULL)
return FALSE; /* bfd_error already set. */
abfd->iostream = bim;
return NULL;
}
- ret = objalloc_alloc (abfd->memory, (unsigned long) size);
+ ret = objalloc_alloc ((struct objalloc *) abfd->memory, (unsigned long) size);
if (ret == NULL)
bfd_set_error (bfd_error_no_memory);
return ret;
return NULL;
}
- ret = objalloc_alloc (abfd->memory, (unsigned long) size);
+ ret = objalloc_alloc ((struct objalloc *) abfd->memory, (unsigned long) size);
if (ret == NULL)
bfd_set_error (bfd_error_no_memory);
return ret;
if (IS_DIR_SEPARATOR (abfd->filename[dirlen - 1]))
break;
- dir = bfd_malloc (dirlen + 1);
+ dir = (char *) bfd_malloc (dirlen + 1);
if (dir == NULL)
{
free (basename);
break;
canon_dir[canon_dirlen] = '\0';
- debugfile = bfd_malloc (strlen (debug_file_directory) + 1
- + (canon_dirlen > dirlen ? canon_dirlen : dirlen)
- + strlen (".debug/")
- + strlen (basename)
- + 1);
+ debugfile = (char *)
+ bfd_malloc (strlen (debug_file_directory) + 1
+ + (canon_dirlen > dirlen ? canon_dirlen : dirlen)
+ + strlen (".debug/")
+ + strlen (basename)
+ + 1);
if (debugfile == NULL)
{
free (basename);
debuglink_size &= ~3;
debuglink_size += 4;
- contents = bfd_malloc (debuglink_size);
+ contents = (char *) bfd_malloc (debuglink_size);
if (contents == NULL)
{
/* XXX Should we delete the section from the bfd ? */
if (name == namebuf)
{
- name = bfd_alloc (abfd, strlen (namebuf) + 1);
+ name = (const char *) bfd_alloc (abfd, strlen (namebuf) + 1);
if (name == NULL)
/* FIXME: Return error. */
abort ();
else
{
ft_idx = first_thunk - (ft_section->vma - extra->ImageBase);
- ft_data = bfd_malloc (datasize);
+ ft_data = (bfd_byte *) bfd_malloc (datasize);
if (ft_data == NULL)
continue;
fprintf (file, _("\nThere is an export table in %s at 0x%lx\n"),
section->name, (unsigned long) addr);
- data = bfd_malloc (datasize);
+ data = (bfd_byte *) bfd_malloc (datasize);
if (data == NULL)
return FALSE;
if (storage < 0)
return NULL;
if (storage)
- sy = bfd_malloc (storage);
+ sy = (asymbol **) bfd_malloc (storage);
psc->symcount = bfd_canonicalize_symtab (abfd, sy);
if (psc->symcount < 0)
{
int xx = (begin_addr - 8) - tsection->vma;
- tdata = bfd_malloc (8);
+ tdata = (bfd_byte *) bfd_malloc (8);
if (bfd_get_section_contents (abfd, tsection, tdata, (bfd_vma) xx, 8))
{
bfd_vma eh, eh_data;
We are going to construct the contents of the BFD in memory,
so allocate all the space that we will need right now. */
- ptr = bfd_zalloc (abfd, (bfd_size_type) ILF_DATA_SIZE);
+ ptr = (bfd_byte *) bfd_zalloc (abfd, (bfd_size_type) ILF_DATA_SIZE);
if (ptr == NULL)
return FALSE;
/* ptr += 2; */
/* Now read in the two strings that follow. */
- ptr = bfd_alloc (abfd, size);
+ ptr = (bfd_byte *) bfd_alloc (abfd, size);
if (ptr == NULL)
return NULL;
if (reloc_size == 0)
return data;
- reloc_vector = bfd_malloc (reloc_size);
+ reloc_vector = (arelent **) bfd_malloc (reloc_size);
if (reloc_vector == NULL)
return NULL;
char *sname;
len = strlen (templat);
- sname = bfd_malloc (len + 8);
+ sname = (char *) bfd_malloc (len + 8);
if (sname == NULL)
return NULL;
memcpy (sname, templat, len);
if (sz == 0)
return TRUE;
- p = bfd_malloc (sec->rawsize > sec->size ? sec->rawsize : sec->size);
+ p = (bfd_byte *)
+ bfd_malloc (sec->rawsize > sec->size ? sec->rawsize : sec->size);
if (p == NULL)
return FALSE;
*buf = p;
asection *section,
void *ptr)
{
- struct saved_output_info *output_info = ptr;
+ struct saved_output_info *output_info = (struct saved_output_info *) ptr;
output_info[section->index].offset = section->output_offset;
output_info[section->index].section = section->output_section;
if ((section->flags & SEC_DEBUGGING) != 0
asection *section,
void *ptr)
{
- struct saved_output_info *output_info = ptr;
+ struct saved_output_info *output_info = (struct saved_output_info *) ptr;
section->output_offset = output_info[section->index].offset;
section->output_section = output_info[section->index].section;
}
bfd_size_type size = sec->rawsize ? sec->rawsize : sec->size;
if (outbuf == NULL)
- contents = bfd_malloc (amt);
+ contents = (bfd_byte *) bfd_malloc (amt);
else
contents = outbuf;
if (outbuf == NULL)
{
bfd_size_type amt = sec->rawsize > sec->size ? sec->rawsize : sec->size;
- data = bfd_malloc (amt);
+ data = (bfd_byte *) bfd_malloc (amt);
if (data == NULL)
return NULL;
outbuf = data;
_bfd_generic_link_add_symbols (abfd, &link_info);
storage_needed = bfd_get_symtab_upper_bound (abfd);
- symbol_table = bfd_malloc (storage_needed);
+ symbol_table = (asymbol **) bfd_malloc (storage_needed);
bfd_canonicalize_symtab (abfd, symbol_table);
}
else
srec_init ();
- tdata = bfd_alloc (abfd, sizeof (tdata_type));
+ tdata = (tdata_type *) bfd_alloc (abfd, sizeof (tdata_type));
if (tdata == NULL)
return FALSE;
{
struct srec_symbol *n;
- n = bfd_alloc (abfd, sizeof (* n));
+ n = (struct srec_symbol *) bfd_alloc (abfd, sizeof (* n));
if (n == NULL)
return FALSE;
}
alc = 10;
- symbuf = bfd_malloc (alc + 1);
+ symbuf = (char *) bfd_malloc (alc + 1);
if (symbuf == NULL)
goto error_return;
char *n;
alc *= 2;
- n = bfd_realloc (symbuf, alc + 1);
+ n = (char *) bfd_realloc (symbuf, alc + 1);
if (n == NULL)
goto error_return;
p = n + (p - symbuf);
}
*p++ = '\0';
- symname = bfd_alloc (abfd, (bfd_size_type) (p - symbuf));
+ symname = (char *) bfd_alloc (abfd, (bfd_size_type) (p - symbuf));
if (symname == NULL)
goto error_return;
strcpy (symname, symbuf);
{
if (buf != NULL)
free (buf);
- buf = bfd_malloc ((bfd_size_type) bytes * 2);
+ buf = (bfd_byte *) bfd_malloc ((bfd_size_type) bytes * 2);
if (buf == NULL)
goto error_return;
bufsize = bytes * 2;
sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1);
amt = strlen (secbuf) + 1;
- secname = bfd_alloc (abfd, amt);
+ secname = (char *) bfd_alloc (abfd, amt);
strcpy (secname, secbuf);
flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
sec = bfd_make_section_with_flags (abfd, secname, flags);
{
if (buf != NULL)
free (buf);
- buf = bfd_malloc ((bfd_size_type) bytes * 2);
+ buf = (bfd_byte *) bfd_malloc ((bfd_size_type) bytes * 2);
if (buf == NULL)
goto error_return;
bufsize = bytes * 2;
if (section->used_by_bfd == NULL)
return FALSE;
- if (! srec_read_section (abfd, section, section->used_by_bfd))
+ if (! srec_read_section (abfd, section,
+ (bfd_byte *) section->used_by_bfd))
return FALSE;
}
tdata_type *tdata = abfd->tdata.srec_data;
srec_data_list_type *entry;
- entry = bfd_alloc (abfd, sizeof (* entry));
+ entry = (srec_data_list_type *) bfd_alloc (abfd, sizeof (* entry));
if (entry == NULL)
return FALSE;
{
bfd_byte *data;
- data = bfd_alloc (abfd, bytes_to_do);
+ data = (bfd_byte *) bfd_alloc (abfd, bytes_to_do);
if (data == NULL)
return FALSE;
memcpy ((void *) data, location, (size_t) bytes_to_do);
asymbol *c;
struct srec_symbol *s;
- csymbols = bfd_alloc (abfd, symcount * sizeof (asymbol));
+ csymbols = (asymbol *) bfd_alloc (abfd, symcount * sizeof (asymbol));
if (csymbols == NULL)
return -1;
abfd->tdata.srec_data->csymbols = csymbols;
/* Allocate the structure if it has not already been allocated by a
subclass. */
if (ret == NULL)
- ret = bfd_hash_allocate (table,
- sizeof (struct stab_link_includes_entry));
+ ret = (struct stab_link_includes_entry *)
+ bfd_hash_allocate (table, sizeof (struct stab_link_includes_entry));
if (ret == NULL)
return NULL;
if (num_chars >= buf_len)
{
buf_len += 32 * 1024;
- symb = bfd_realloc_or_free (symb, buf_len);
+ symb = (char *) bfd_realloc_or_free (symb, buf_len);
if (symb == NULL)
goto error_return;
symb_rover = symb + num_chars;
/* Record this symbol, so that we can set the value
correctly. */
amt = sizeof *ne;
- ne = bfd_alloc (abfd, amt);
+ ne = (struct stab_excl_list *) bfd_alloc (abfd, amt);
if (ne == NULL)
goto error_return;
ne->offset = sym - stabbuf;
{
/* This is the first time we have seen this header file
with this set of stabs strings. */
- t = bfd_hash_allocate (&sinfo->includes, sizeof *t);
+ t = (struct stab_link_includes_totals *)
+ bfd_hash_allocate (&sinfo->includes, sizeof *t);
if (t == NULL)
goto error_return;
t->sum_chars = sum_chars;
t->num_chars = num_chars;
- t->symb = symb = bfd_realloc_or_free (symb, num_chars); /* Trim data down. */
+ /* Trim data down. */
+ t->symb = symb = (char *) bfd_realloc_or_free (symb, num_chars);
t->next = incl_entry->totals;
incl_entry->totals = t;
}
bfd_size_type *pskips;
amt = count * sizeof (bfd_size_type);
- secinfo->cumulative_skips = bfd_alloc (abfd, amt);
+ secinfo->cumulative_skips = (bfd_size_type *) bfd_alloc (abfd, amt);
if (secinfo->cumulative_skips == NULL)
goto error_return;
if (secinfo->cumulative_skips == NULL)
{
amt = count * sizeof (bfd_size_type);
- secinfo->cumulative_skips = bfd_alloc (abfd, amt);
+ secinfo->cumulative_skips = (bfd_size_type *) bfd_alloc (abfd, amt);
if (secinfo->cumulative_skips == NULL)
goto error_return;
}
void
bfd_print_symbol_vandf (bfd *abfd, void *arg, asymbol *symbol)
{
- FILE *file = arg;
+ FILE *file = (FILE *) arg;
flagword type = symbol->flags;
if (storage == 0)
return 0;
- syms = bfd_malloc (storage);
+ syms = (asymbol **) bfd_malloc (storage);
if (syms == NULL)
goto error_return;
static int
cmpindexentry (const void *a, const void *b)
{
- const struct indexentry *contestantA = a;
- const struct indexentry *contestantB = b;
+ const struct indexentry *contestantA = (const struct indexentry *) a;
+ const struct indexentry *contestantB = (const struct indexentry *) b;
if (contestantA->val < contestantB->val)
return -1;
#define VALOFF (8)
#define STABSIZE (12)
- info = *pinfo;
+ info = (struct stab_find_info *) *pinfo;
if (info != NULL)
{
if (info->stabsec == NULL || info->strsec == NULL)
char *function_name;
bfd_size_type amt = sizeof *info;
- info = bfd_zalloc (abfd, amt);
+ info = (struct stab_find_info *) bfd_zalloc (abfd, amt);
if (info == NULL)
return FALSE;
? info->strsec->rawsize
: info->strsec->size);
- info->stabs = bfd_alloc (abfd, stabsize);
- info->strs = bfd_alloc (abfd, strsize);
+ info->stabs = (bfd_byte *) bfd_alloc (abfd, stabsize);
+ info->strs = (bfd_byte *) bfd_alloc (abfd, strsize);
if (info->stabs == NULL || info->strs == NULL)
return FALSE;
reloc_size = bfd_get_reloc_upper_bound (abfd, info->stabsec);
if (reloc_size < 0)
return FALSE;
- reloc_vector = bfd_malloc (reloc_size);
+ reloc_vector = (arelent **) bfd_malloc (reloc_size);
if (reloc_vector == NULL && reloc_size != 0)
return FALSE;
reloc_count = bfd_canonicalize_reloc (abfd, info->stabsec, reloc_vector,
amt = info->indextablesize;
amt *= sizeof (struct indexentry);
- info->indextable = bfd_alloc (abfd, amt);
+ info->indextable = (struct indexentry *) bfd_alloc (abfd, amt);
if (info->indextable == NULL)
return FALSE;
apps keep a copy of a previously returned file name
pointer. */
len = strlen (file_name) + 1;
- info->filename = bfd_alloc (abfd, dirlen + len);
+ info->filename = (char *) bfd_alloc (abfd, dirlen + len);
if (info->filename == NULL)
return FALSE;
memcpy (info->filename, directory_name, dirlen);
vec_length++;
amt = (vec_length + 1) * sizeof (char **);
- name_ptr = name_list = bfd_malloc (amt);
+ name_ptr = name_list = (const char **) bfd_malloc (amt);
if (name_list == NULL)
return NULL;
if (!d)
{
/* No chunk for this address, so make one up. */
- d = bfd_zalloc (abfd, (bfd_size_type) sizeof (struct data_struct));
+ d = (struct data_struct *)
+ bfd_zalloc (abfd, (bfd_size_type) sizeof (struct data_struct));
if (!d)
return NULL;
section = bfd_get_section_by_name (abfd, sym);
if (section == NULL)
{
- char *n = bfd_alloc (abfd, (bfd_size_type) len + 1);
+ char *n = (char *) bfd_alloc (abfd, (bfd_size_type) len + 1);
if (!n)
return FALSE;
{
tdata_type *tdata;
- tdata = bfd_alloc (abfd, (bfd_size_type) sizeof (tdata_type));
+ tdata = (tdata_type *) bfd_alloc (abfd, (bfd_size_type) sizeof (tdata_type));
if (!tdata)
return FALSE;
abfd->tdata.tekhex_data = tdata;
tdata_type *tdata = abfd->tdata.verilog_data;
verilog_data_list_type *entry;
- entry = bfd_alloc (abfd, sizeof (* entry));
+ entry = (verilog_data_list_type *) bfd_alloc (abfd, sizeof (* entry));
if (entry == NULL)
return FALSE;
{
bfd_byte *data;
- data = bfd_alloc (abfd, bytes_to_do);
+ data = (bfd_byte *) bfd_alloc (abfd, bytes_to_do);
if (data == NULL)
return FALSE;
memcpy ((void *) data, location, (size_t) bytes_to_do);
verilog_init ();
- tdata = bfd_alloc (abfd, sizeof (tdata_type));
+ tdata = (tdata_type *) bfd_alloc (abfd, sizeof (tdata_type));
if (tdata == NULL)
return FALSE;
+2009-09-09 Martin Thuresson <martin@mtme.org>
+
+ * bfdlink.h (struct bfd_link_hash_common_entry): Move to top
+ level.
+
2009-09-04 Jie Zhang <jie.zhang@analog.com>
* opcode/bfin.h (PseudoDbg_Assert): Add bits_grp and mask_grp.
bfd_link_common_skip_all
};
+struct bfd_link_hash_common_entry
+ {
+ unsigned int alignment_power; /* Alignment. */
+ asection *section; /* Symbol section. */
+ };
+
/* The linking routines use a hash table which uses this structure for
its elements. */
directly because we don't want to increase the size of
the union; this structure is a major space user in the
linker. */
- struct bfd_link_hash_common_entry
- {
- unsigned int alignment_power; /* Alignment. */
- asection *section; /* Symbol section. */
- } *p;
+ struct bfd_link_hash_common_entry *p;
bfd_size_type size; /* Common symbol size. */
} c;
} u;
/* Section indices. */
-#define SHN_BEFORE SHN_LORESERVE /* used with SHF_ORDERED */
-#define SHN_AFTER (SHN_LORESERVE + 1) /* used with SHF_ORDERED */
+#define SHN_BEFORE SHN_LORESERVE /* Used with SHF_ORDERED and... */
+#define SHN_AFTER (SHN_LORESERVE + 1) /* SHF_LINK_ORDER section flags. */
/* Section flags. */