Updated soruces in bfd/* to compile cleanly with -Wc++-compat.
* 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.
This commit is contained in:
parent
b1dfe69a90
commit
a50b1753d4
48 changed files with 713 additions and 574 deletions
|
@ -1,3 +1,57 @@
|
|||
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.
|
||||
|
|
44
bfd/aoutx.h
44
bfd/aoutx.h
|
@ -464,7 +464,7 @@ NAME (aout, some_aout_object_p) (bfd *abfd,
|
|||
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;
|
||||
|
||||
|
@ -679,7 +679,7 @@ NAME (aout, mkobject) (bfd *abfd)
|
|||
|
||||
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;
|
||||
|
||||
|
@ -1309,7 +1309,7 @@ aout_get_external_symbols (bfd *abfd)
|
|||
/* 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;
|
||||
|
||||
|
@ -1349,7 +1349,7 @@ aout_get_external_symbols (bfd *abfd)
|
|||
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;
|
||||
|
||||
|
@ -1750,7 +1750,7 @@ NAME (aout, slurp_symbol_table) (bfd *abfd)
|
|||
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;
|
||||
|
||||
|
@ -2311,7 +2311,7 @@ NAME (aout, slurp_reloc_table) (bfd *abfd, sec_ptr asect, asymbol **symbols)
|
|||
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;
|
||||
|
||||
|
@ -2372,7 +2372,7 @@ NAME (aout, squirt_out_relocs) (bfd *abfd, asection *section)
|
|||
|
||||
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;
|
||||
|
||||
|
@ -2786,7 +2786,7 @@ NAME (aout, find_nearest_line) (bfd *abfd,
|
|||
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;
|
||||
|
@ -2880,7 +2880,8 @@ NAME (aout, link_hash_newfunc) (struct bfd_hash_entry *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 aout_link_hash_entry *) bfd_hash_allocate (table,
|
||||
sizeof (* ret));
|
||||
if (ret == NULL)
|
||||
return NULL;
|
||||
|
||||
|
@ -2919,7 +2920,7 @@ NAME (aout, link_hash_table_create) (bfd *abfd)
|
|||
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;
|
||||
|
||||
|
@ -2974,7 +2975,7 @@ aout_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
|
|||
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;
|
||||
|
@ -3338,8 +3339,9 @@ aout_link_check_ar_symbols (bfd *abfd,
|
|||
/* 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;
|
||||
|
||||
|
@ -3509,7 +3511,8 @@ aout_link_includes_newfunc (struct bfd_hash_entry *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 aout_link_includes_entry *)
|
||||
bfd_hash_allocate (table, sizeof (* ret));
|
||||
if (ret == NULL)
|
||||
return NULL;
|
||||
|
||||
|
@ -3786,7 +3789,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *finfo,
|
|||
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,
|
||||
|
@ -5136,7 +5139,8 @@ aout_link_write_symbols (struct aout_final_link_info *finfo, bfd *input_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;
|
||||
|
@ -5427,11 +5431,11 @@ NAME (aout, final_link) (bfd *abfd,
|
|||
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)
|
||||
|
|
|
@ -181,7 +181,7 @@ _bfd_generic_mkarchive (bfd *abfd)
|
|||
{
|
||||
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;
|
||||
|
||||
|
@ -319,7 +319,7 @@ _bfd_add_bfd_to_archive_cache (bfd *arch_bfd, file_ptr filepos, bfd *new_elt)
|
|||
}
|
||||
|
||||
/* 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;
|
||||
|
@ -462,7 +462,7 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
|
|||
allocsize += namelen + 1;
|
||||
parsed_size -= namelen;
|
||||
|
||||
allocptr = bfd_zalloc (abfd, allocsize);
|
||||
allocptr = (char *) bfd_zalloc (abfd, allocsize);
|
||||
if (allocptr == NULL)
|
||||
return NULL;
|
||||
filename = (allocptr
|
||||
|
@ -483,12 +483,12 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
|
|||
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)
|
||||
|
@ -505,7 +505,7 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
|
|||
|
||||
if (!allocptr)
|
||||
{
|
||||
allocptr = bfd_zalloc (abfd, allocsize);
|
||||
allocptr = (char *) bfd_zalloc (abfd, allocsize);
|
||||
if (allocptr == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
@ -546,7 +546,7 @@ append_relative_path (bfd *arch, char *elt_name)
|
|||
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;
|
||||
|
||||
|
@ -579,7 +579,7 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos)
|
|||
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;
|
||||
|
@ -745,7 +745,7 @@ bfd_generic_archive_p (bfd *abfd)
|
|||
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;
|
||||
|
@ -835,13 +835,13 @@ do_slurp_bsd_armap (bfd *abfd)
|
|||
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;
|
||||
|
||||
|
@ -870,7 +870,7 @@ do_slurp_bsd_armap (bfd *abfd)
|
|||
+ 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;
|
||||
|
||||
|
@ -911,7 +911,7 @@ do_slurp_coff_armap (bfd *abfd)
|
|||
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;
|
||||
|
@ -956,14 +956,15 @@ do_slurp_coff_armap (bfd *abfd)
|
|||
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
|
||||
|
@ -998,7 +999,7 @@ do_slurp_coff_armap (bfd *abfd)
|
|||
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] == '/'
|
||||
|
@ -1098,12 +1099,12 @@ bfd_slurp_bsd_armap_f2 (bfd *abfd)
|
|||
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:
|
||||
|
@ -1139,7 +1140,7 @@ bfd_slurp_bsd_armap_f2 (bfd *abfd)
|
|||
+ 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;
|
||||
|
||||
|
@ -1196,7 +1197,7 @@ _bfd_slurp_extended_name_table (bfd *abfd)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
namedata = _bfd_read_ar_hdr (abfd);
|
||||
namedata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
|
||||
if (namedata == NULL)
|
||||
return FALSE;
|
||||
|
||||
|
@ -1205,7 +1206,7 @@ _bfd_slurp_extended_name_table (bfd *abfd)
|
|||
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:
|
||||
|
@ -1355,7 +1356,7 @@ adjust_relative_path (const char * path, const char * ref_path)
|
|||
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;
|
||||
|
@ -1505,7 +1506,7 @@ _bfd_construct_extended_name_table (bfd *abfd,
|
|||
if (total_namelen == 0)
|
||||
return TRUE;
|
||||
|
||||
*tabloc = bfd_zalloc (abfd, total_namelen);
|
||||
*tabloc = (char *) bfd_zalloc (abfd, total_namelen);
|
||||
if (*tabloc == NULL)
|
||||
return FALSE;
|
||||
|
||||
|
@ -1639,7 +1640,7 @@ bfd_ar_hdr_from_filesystem (bfd *abfd, const char *filename, bfd *member)
|
|||
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 ();
|
||||
|
@ -1663,7 +1664,7 @@ bfd_ar_hdr_from_filesystem (bfd *abfd, const char *filename, bfd *member)
|
|||
}
|
||||
|
||||
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));
|
||||
|
@ -2088,13 +2089,13 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
|
|||
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;
|
||||
|
||||
|
@ -2126,7 +2127,7 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
|
|||
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;
|
||||
}
|
||||
|
@ -2155,7 +2156,7 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
|
|||
{
|
||||
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;
|
||||
|
||||
|
@ -2164,10 +2165,11 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
|
|||
|
||||
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);
|
||||
|
|
|
@ -95,13 +95,13 @@ bfd_elf64_archive_slurp_armap (bfd *abfd)
|
|||
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;
|
||||
|
||||
|
|
|
@ -691,7 +691,7 @@ bfd_arch_list (void)
|
|||
}
|
||||
|
||||
amt = (vec_length + 1) * sizeof (char **);
|
||||
name_list = bfd_malloc (amt);
|
||||
name_list = (const char **) bfd_malloc (amt);
|
||||
if (name_list == NULL)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -4783,6 +4783,14 @@ bfd_boolean bfd_copy_private_symbol_data
|
|||
(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 */
|
||||
|
@ -4817,14 +4825,7 @@ struct 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;
|
||||
|
|
27
bfd/bfd.c
27
bfd/bfd.c
|
@ -35,6 +35,14 @@ SECTION
|
|||
|
||||
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 *}
|
||||
|
@ -69,14 +77,7 @@ CODE_FRAGMENT
|
|||
. 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;
|
||||
|
@ -438,7 +439,7 @@ bfd_set_error (bfd_error_type error_tag, ...)
|
|||
|
||||
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);
|
||||
|
@ -1448,7 +1449,7 @@ bfd_record_phdr (bfd *abfd,
|
|||
|
||||
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;
|
||||
|
||||
|
@ -1858,7 +1859,7 @@ bfd_demangle (bfd *abfd, const char *name, int options)
|
|||
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);
|
||||
|
@ -1876,7 +1877,7 @@ bfd_demangle (bfd *abfd, const char *name, int options)
|
|||
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);
|
||||
|
@ -1896,7 +1897,7 @@ bfd_demangle (bfd *abfd, const char *name, int options)
|
|||
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);
|
||||
|
|
12
bfd/bfdio.c
12
bfd/bfdio.c
|
@ -187,7 +187,7 @@ bfd_bread (void *ptr, bfd_size_type size, bfd *abfd)
|
|||
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)
|
||||
{
|
||||
|
@ -219,7 +219,7 @@ bfd_bwrite (const void *ptr, bfd_size_type size, bfd *abfd)
|
|||
|
||||
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)
|
||||
|
@ -232,7 +232,8 @@ bfd_bwrite (const void *ptr, bfd_size_type size, bfd *abfd)
|
|||
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;
|
||||
|
@ -338,7 +339,7 @@ bfd_seek (bfd *abfd, file_ptr position, int direction)
|
|||
{
|
||||
struct bfd_in_memory *bim;
|
||||
|
||||
bim = abfd->iostream;
|
||||
bim = (struct bfd_in_memory *) abfd->iostream;
|
||||
|
||||
if (direction == SEEK_SET)
|
||||
abfd->where = position;
|
||||
|
@ -358,7 +359,8 @@ bfd_seek (bfd *abfd, file_ptr position, int direction)
|
|||
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;
|
||||
|
|
|
@ -143,7 +143,7 @@ mangle_name (bfd *abfd, char *suffix)
|
|||
+ strlen (suffix)
|
||||
+ sizeof "_binary__");
|
||||
|
||||
buf = bfd_alloc (abfd, size);
|
||||
buf = (char *) bfd_alloc (abfd, size);
|
||||
if (buf == NULL)
|
||||
return "";
|
||||
|
||||
|
@ -167,7 +167,7 @@ binary_canonicalize_symtab (bfd *abfd, asymbol **alocation)
|
|||
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;
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ cache_btell (struct bfd *abfd)
|
|||
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);
|
||||
|
@ -270,7 +270,7 @@ cache_bread_1 (struct bfd *abfd, void *buf, file_ptr nbytes)
|
|||
if (nbytes == 0)
|
||||
return 0;
|
||||
|
||||
f = bfd_cache_lookup (abfd, 0);
|
||||
f = bfd_cache_lookup (abfd, CACHE_NORMAL);
|
||||
if (f == NULL)
|
||||
return 0;
|
||||
|
||||
|
@ -345,7 +345,7 @@ static file_ptr
|
|||
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;
|
||||
|
|
|
@ -1071,7 +1071,7 @@ handle_COMDAT (bfd * abfd,
|
|||
|
||||
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 ();
|
||||
|
||||
|
@ -1079,7 +1079,7 @@ handle_COMDAT (bfd * abfd,
|
|||
(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 ();
|
||||
|
||||
|
@ -1714,7 +1714,7 @@ coff_new_section_hook (bfd * abfd, asection * section)
|
|||
@@ 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;
|
||||
|
||||
|
@ -3207,7 +3207,7 @@ coff_compute_section_file_positions (bfd * abfd)
|
|||
|
||||
/* 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;
|
||||
|
||||
|
@ -4278,7 +4278,7 @@ coff_write_object_contents (bfd * abfd)
|
|||
char * buff;
|
||||
bfd_size_type amount = bfd_coff_filhsz (abfd);
|
||||
|
||||
buff = bfd_malloc (amount);
|
||||
buff = (char *) bfd_malloc (amount);
|
||||
if (buff == NULL)
|
||||
return FALSE;
|
||||
|
||||
|
@ -4298,7 +4298,7 @@ coff_write_object_contents (bfd * abfd)
|
|||
char * buff;
|
||||
bfd_size_type amount = bfd_coff_aoutsz (abfd);
|
||||
|
||||
buff = bfd_malloc (amount);
|
||||
buff = (char *) bfd_malloc (amount);
|
||||
if (buff == NULL)
|
||||
return FALSE;
|
||||
|
||||
|
@ -4467,7 +4467,7 @@ coff_slurp_line_table (bfd *abfd, asection *asect)
|
|||
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;
|
||||
|
||||
|
@ -4546,7 +4546,7 @@ coff_slurp_line_table (bfd *abfd, asection *asect)
|
|||
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;
|
||||
|
@ -4561,7 +4561,7 @@ coff_slurp_line_table (bfd *abfd, asection *asect)
|
|||
|
||||
/* 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;
|
||||
|
@ -4615,13 +4615,13 @@ coff_slurp_symbol_table (bfd * abfd)
|
|||
/* 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;
|
||||
|
@ -5113,7 +5113,7 @@ coff_slurp_reloc_table (bfd * abfd, sec_ptr asect, asymbol ** symbols)
|
|||
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;
|
||||
|
|
|
@ -90,7 +90,8 @@ make_a_section_from_file (bfd *abfd,
|
|||
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);
|
||||
|
@ -100,7 +101,8 @@ make_a_section_from_file (bfd *abfd,
|
|||
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));
|
||||
|
@ -195,7 +197,7 @@ coff_real_object_p (bfd *abfd,
|
|||
|
||||
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;
|
||||
|
||||
|
@ -437,7 +439,7 @@ _bfd_coff_read_internal_relocs (bfd *abfd,
|
|||
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;
|
||||
|
@ -451,7 +453,7 @@ _bfd_coff_read_internal_relocs (bfd *abfd,
|
|||
{
|
||||
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;
|
||||
|
@ -651,7 +653,7 @@ coff_renumber_symbols (bfd *bfd_ptr, int *first_undef)
|
|||
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;
|
||||
|
@ -912,7 +914,7 @@ coff_write_symbol (bfd *abfd,
|
|||
{
|
||||
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;
|
||||
|
||||
|
@ -1448,7 +1450,7 @@ build_debug_section (bfd *abfd)
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -1478,7 +1480,7 @@ copy_name (bfd *abfd, char *name, size_t maxlen)
|
|||
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);
|
||||
|
@ -1573,7 +1575,7 @@ _bfd_coff_read_string_table (bfd *abfd)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
strings = bfd_malloc (strsize);
|
||||
strings = (char *) bfd_malloc (strsize);
|
||||
if (strings == NULL)
|
||||
return NULL;
|
||||
|
||||
|
@ -1632,7 +1634,7 @@ coff_get_normalized_symtab (bfd *abfd)
|
|||
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);
|
||||
|
@ -1738,7 +1740,7 @@ coff_get_normalized_symtab (bfd *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);
|
||||
|
@ -2338,7 +2340,7 @@ bfd_coff_set_symbol_class (bfd * abfd,
|
|||
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;
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ _bfd_coff_link_hash_table_create (bfd *abfd)
|
|||
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;
|
||||
|
||||
|
@ -320,7 +320,7 @@ coff_link_add_symbols (bfd *abfd,
|
|||
/* 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;
|
||||
|
@ -772,7 +772,7 @@ _bfd_coff_final_link (bfd *abfd,
|
|||
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++)
|
||||
|
@ -815,10 +815,12 @@ _bfd_coff_final_link (bfd *abfd,
|
|||
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;
|
||||
|
@ -851,21 +853,21 @@ _bfd_coff_final_link (bfd *abfd,
|
|||
|
||||
/* 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)
|
||||
|
@ -1015,7 +1017,7 @@ _bfd_coff_final_link (bfd *abfd,
|
|||
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;
|
||||
|
||||
|
@ -1602,7 +1604,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd)
|
|||
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;
|
||||
|
@ -1629,7 +1631,8 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd)
|
|||
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;
|
||||
|
||||
|
@ -1639,7 +1642,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd)
|
|||
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);
|
||||
|
@ -2729,7 +2732,7 @@ _bfd_coff_reloc_link_order (bfd *output_bfd,
|
|||
file_ptr loc;
|
||||
|
||||
size = bfd_get_reloc_size (howto);
|
||||
buf = bfd_zmalloc (size);
|
||||
buf = (bfd_byte *) bfd_zmalloc (size);
|
||||
if (buf == NULL)
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ bfd_uncompress_section_contents (bfd_byte **buffer, bfd_size_type *size)
|
|||
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;
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ alloc_dwarf1_unit (struct dwarf1_debug* stash)
|
|||
{
|
||||
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;
|
||||
|
@ -161,7 +161,7 @@ alloc_dwarf1_func (struct dwarf1_debug* stash, struct dwarf1_unit* aUnit)
|
|||
{
|
||||
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;
|
||||
|
@ -312,7 +312,8 @@ parse_line_table (struct dwarf1_debug* stash, struct dwarf1_unit* aUnit)
|
|||
|
||||
/* 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;
|
||||
|
||||
|
@ -473,7 +474,7 @@ _bfd_dwarf1_find_nearest_line (bfd *abfd,
|
|||
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;
|
||||
|
|
92
bfd/dwarf2.c
92
bfd/dwarf2.c
|
@ -100,7 +100,7 @@ struct dwarf2_debug
|
|||
/* 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;
|
||||
|
||||
|
@ -316,7 +316,8 @@ info_hash_table_newfunc (struct bfd_hash_entry *entry,
|
|||
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;
|
||||
}
|
||||
|
@ -341,7 +342,8 @@ create_info_hash_table (bfd *abfd)
|
|||
{
|
||||
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;
|
||||
|
||||
|
@ -374,7 +376,8 @@ insert_info_hash_table (struct info_hash_table *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;
|
||||
|
||||
|
@ -442,7 +445,7 @@ read_section (bfd * abfd,
|
|||
}
|
||||
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,
|
||||
|
@ -643,7 +646,7 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash)
|
|||
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);
|
||||
|
@ -653,7 +656,7 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash)
|
|||
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;
|
||||
|
@ -677,7 +680,7 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash)
|
|||
|
||||
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;
|
||||
|
@ -766,7 +769,7 @@ read_attribute_value (struct attribute *attr,
|
|||
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);
|
||||
|
@ -775,7 +778,7 @@ read_attribute_value (struct attribute *attr,
|
|||
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);
|
||||
|
@ -804,7 +807,7 @@ read_attribute_value (struct attribute *attr,
|
|||
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);
|
||||
|
@ -813,7 +816,7 @@ read_attribute_value (struct attribute *attr,
|
|||
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);
|
||||
|
@ -978,7 +981,7 @@ add_line_info (struct line_info_table *table,
|
|||
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;
|
||||
|
@ -988,7 +991,7 @@ add_line_info (struct line_info_table *table,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -1109,13 +1112,13 @@ concat_filename (struct line_info_table *table, unsigned int file)
|
|||
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);
|
||||
}
|
||||
|
@ -1159,7 +1162,7 @@ arange_add (bfd *abfd, struct arange *first_arange, bfd_vma low_pc, bfd_vma high
|
|||
|
||||
/* 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;
|
||||
|
@ -1187,7 +1190,7 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
|
|||
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;
|
||||
|
||||
|
@ -1239,7 +1242,7 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
|
|||
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;
|
||||
|
||||
|
@ -1261,7 +1264,7 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
|
|||
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);
|
||||
|
@ -1287,7 +1290,7 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
|
|||
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);
|
||||
|
@ -1383,7 +1386,7 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
|
|||
|
||||
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);
|
||||
|
@ -1837,7 +1840,8 @@ scan_unit_for_symbols (struct comp_unit *unit)
|
|||
/* 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;
|
||||
|
@ -1877,7 +1881,7 @@ scan_unit_for_symbols (struct comp_unit *unit)
|
|||
|| 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;
|
||||
|
@ -1898,7 +1902,7 @@ scan_unit_for_symbols (struct comp_unit *unit)
|
|||
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;
|
||||
|
@ -2036,9 +2040,9 @@ scan_unit_for_symbols (struct comp_unit *unit)
|
|||
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);
|
||||
|
@ -2082,7 +2086,7 @@ parse_comp_unit (struct dwarf2_debug *stash,
|
|||
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;
|
||||
|
@ -2143,7 +2147,7 @@ parse_comp_unit (struct dwarf2_debug *stash,
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -2650,7 +2654,7 @@ info_hash_lookup_funcinfo (struct info_hash_table *hash_table,
|
|||
node;
|
||||
node = node->next)
|
||||
{
|
||||
each_func = node->info;
|
||||
each_func = (struct funcinfo *) node->info;
|
||||
for (arange = &each_func->arange;
|
||||
arange;
|
||||
arange = arange->next)
|
||||
|
@ -2698,7 +2702,7 @@ info_hash_lookup_varinfo (struct info_hash_table *hash_table,
|
|||
node;
|
||||
node = node->next)
|
||||
{
|
||||
each = node->info;
|
||||
each = (struct varinfo *) node->info;
|
||||
if (each->addr == addr
|
||||
&& (!each->sec || each->sec == sec))
|
||||
{
|
||||
|
@ -2889,13 +2893,13 @@ find_line (bfd *abfd,
|
|||
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;
|
||||
}
|
||||
|
@ -2999,7 +3003,7 @@ find_line (bfd *abfd,
|
|||
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;
|
||||
|
||||
|
@ -3050,8 +3054,8 @@ find_line (bfd *abfd,
|
|||
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;
|
||||
|
@ -3064,7 +3068,7 @@ find_line (bfd *abfd,
|
|||
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
|
||||
|
@ -3138,13 +3142,13 @@ find_line (bfd *abfd,
|
|||
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,
|
||||
|
@ -3153,7 +3157,7 @@ find_line (bfd *abfd,
|
|||
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
|
||||
|
@ -3216,7 +3220,7 @@ find_line (bfd *abfd,
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -3277,7 +3281,7 @@ _bfd_dwarf2_find_inliner_info (bfd *abfd ATTRIBUTE_UNUSED,
|
|||
{
|
||||
struct dwarf2_debug *stash;
|
||||
|
||||
stash = *pinfo;
|
||||
stash = (struct dwarf2_debug *) *pinfo;
|
||||
if (stash)
|
||||
{
|
||||
struct funcinfo *func = stash->inliner_chain;
|
||||
|
@ -3304,7 +3308,7 @@ _bfd_dwarf2_cleanup_debug_info (bfd *abfd)
|
|||
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;
|
||||
|
|
|
@ -307,10 +307,10 @@ _bfd_elf_attr_strdup (bfd *abfd, const char * s)
|
|||
{
|
||||
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. */
|
||||
|
@ -428,7 +428,7 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
|
|||
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,
|
||||
|
|
|
@ -85,6 +85,27 @@ struct elf_strtab_hash;
|
|||
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
|
||||
|
@ -118,13 +139,7 @@ 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;
|
||||
|
@ -210,18 +225,7 @@ struct elf_link_hash_entry
|
|||
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
|
||||
|
|
|
@ -215,8 +215,8 @@ write_value (bfd *abfd, bfd_byte *buf, bfd_vma value, int width)
|
|||
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
|
||||
|
@ -246,7 +246,7 @@ cie_eq (const void *e1, const void *e2)
|
|||
static hashval_t
|
||||
cie_hash (const void *e)
|
||||
{
|
||||
const struct cie *c = e;
|
||||
const struct cie *c = (const struct cie *) e;
|
||||
return c->hash;
|
||||
}
|
||||
|
||||
|
@ -529,12 +529,13 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
|
|||
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. */
|
||||
|
@ -848,8 +849,8 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
|
|||
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;
|
||||
|
@ -1055,7 +1056,7 @@ find_merged_cie (bfd *abfd, asection *sec,
|
|||
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;
|
||||
|
||||
|
@ -1246,7 +1247,7 @@ _bfd_elf_eh_frame_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED,
|
|||
|
||||
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;
|
||||
|
@ -1336,13 +1337,13 @@ _bfd_elf_write_section_eh_frame (bfd *abfd,
|
|||
->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;
|
||||
|
||||
|
@ -1629,8 +1630,8 @@ _bfd_elf_write_section_eh_frame (bfd *abfd,
|
|||
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)
|
||||
|
@ -1681,7 +1682,7 @@ _bfd_elf_write_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info)
|
|||
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;
|
||||
|
||||
|
|
|
@ -68,7 +68,8 @@ elf_strtab_hash_newfunc (struct bfd_hash_entry *entry,
|
|||
/* 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;
|
||||
|
||||
|
@ -97,7 +98,7 @@ _bfd_elf_strtab_init (void)
|
|||
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;
|
||||
|
||||
|
@ -112,7 +113,8 @@ _bfd_elf_strtab_init (void)
|
|||
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);
|
||||
|
@ -166,7 +168,8 @@ _bfd_elf_strtab_add (struct elf_strtab_hash *tab,
|
|||
{
|
||||
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;
|
||||
}
|
||||
|
@ -311,7 +314,7 @@ _bfd_elf_strtab_finalize (struct elf_strtab_hash *tab)
|
|||
|
||||
/* 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;
|
||||
|
||||
|
|
160
bfd/elf.c
160
bfd/elf.c
|
@ -283,7 +283,7 @@ bfd_elf_get_str_section (bfd *abfd, unsigned int shindex)
|
|||
/* 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)
|
||||
|
@ -407,8 +407,8 @@ bfd_elf_get_elf_syms (bfd *ibfd,
|
|||
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
|
||||
|
@ -422,7 +422,8 @@ bfd_elf_get_elf_syms (bfd *ibfd,
|
|||
|
||||
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;
|
||||
|
@ -430,7 +431,8 @@ bfd_elf_get_elf_syms (bfd *ibfd,
|
|||
|
||||
/* 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))
|
||||
|
@ -564,8 +566,8 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
|
|||
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;
|
||||
|
||||
|
@ -586,8 +588,8 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
|
|||
/* 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)
|
||||
{
|
||||
|
@ -1091,7 +1093,7 @@ get_segment_type (unsigned int p_type)
|
|||
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;
|
||||
|
@ -1334,7 +1336,7 @@ bfd_elf_print_symbol (bfd *abfd,
|
|||
asymbol *symbol,
|
||||
bfd_print_symbol_type how)
|
||||
{
|
||||
FILE *file = filep;
|
||||
FILE *file = (FILE *) filep;
|
||||
switch (how)
|
||||
{
|
||||
case bfd_print_symbol_name:
|
||||
|
@ -1789,7 +1791,7 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
|
|||
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;
|
||||
|
@ -2207,7 +2209,8 @@ _bfd_elf_new_section_hook (bfd *abfd, asection *sec)
|
|||
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;
|
||||
|
@ -2263,7 +2266,7 @@ bfd_boolean
|
|||
_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;
|
||||
|
@ -2277,9 +2280,9 @@ _bfd_elf_make_section_from_phdr (bfd *abfd,
|
|||
|
||||
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);
|
||||
|
@ -2313,9 +2316,9 @@ _bfd_elf_make_section_from_phdr (bfd *abfd,
|
|||
{
|
||||
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);
|
||||
|
@ -2414,7 +2417,7 @@ _bfd_elf_init_reloc_shdr (bfd *abfd,
|
|||
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);
|
||||
|
@ -2454,7 +2457,7 @@ static void
|
|||
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;
|
||||
|
||||
|
@ -2654,7 +2657,7 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg)
|
|||
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;
|
||||
|
@ -2714,7 +2717,7 @@ bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg)
|
|||
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;
|
||||
|
@ -2860,11 +2863,13 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
|
|||
|
||||
/* 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);
|
||||
|
@ -3013,7 +3018,7 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
|
|||
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);
|
||||
|
@ -3133,7 +3138,7 @@ elf_map_symbols (bfd *abfd)
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -3185,7 +3190,8 @@ elf_map_symbols (bfd *abfd)
|
|||
}
|
||||
|
||||
/* 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;
|
||||
|
@ -3494,7 +3500,7 @@ make_mapping (bfd *abfd,
|
|||
|
||||
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;
|
||||
|
@ -3521,7 +3527,8 @@ _bfd_elf_make_dynamic_segment (bfd *abfd, asection *dynsec)
|
|||
{
|
||||
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;
|
||||
|
@ -3612,7 +3619,8 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
|
|||
|
||||
/* 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;
|
||||
|
||||
|
@ -3642,7 +3650,7 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
|
|||
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;
|
||||
|
@ -3656,7 +3664,7 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
|
|||
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;
|
||||
|
@ -3866,7 +3874,7 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
|
|||
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;
|
||||
|
@ -3898,7 +3906,7 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
|
|||
|
||||
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;
|
||||
|
@ -3925,7 +3933,7 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
|
|||
&& (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;
|
||||
|
@ -3940,7 +3948,7 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
|
|||
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;
|
||||
|
@ -3973,7 +3981,7 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
|
|||
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;
|
||||
|
@ -4175,10 +4183,10 @@ assign_file_positions_for_load_sections (bfd *abfd,
|
|||
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;
|
||||
|
@ -5370,7 +5378,7 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
|
|||
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;
|
||||
|
||||
|
@ -5454,7 +5462,7 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
|
|||
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;
|
||||
|
||||
|
@ -5700,7 +5708,7 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
|
|||
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);
|
||||
|
@ -5821,7 +5829,7 @@ copy_elf_program_header (bfd *ibfd, bfd *obfd)
|
|||
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;
|
||||
|
||||
|
@ -6225,7 +6233,8 @@ swap_out_syms (bfd *abfd,
|
|||
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);
|
||||
|
@ -6238,8 +6247,8 @@ swap_out_syms (bfd *abfd,
|
|||
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);
|
||||
|
@ -6677,14 +6686,14 @@ _bfd_elf_slurp_version_tables (bfd *abfd, bfd_boolean default_imported_symver)
|
|||
|
||||
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:
|
||||
|
@ -6724,8 +6733,9 @@ 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;
|
||||
}
|
||||
|
@ -6793,7 +6803,7 @@ 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
|
||||
|
@ -6837,8 +6847,8 @@ error_return_verref:
|
|||
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;
|
||||
|
||||
|
@ -6871,8 +6881,9 @@ error_return_verdef:
|
|||
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;
|
||||
}
|
||||
|
@ -6929,8 +6940,8 @@ 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;
|
||||
|
||||
|
@ -6956,7 +6967,8 @@ error_return_verdef:
|
|||
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;
|
||||
|
||||
|
@ -6979,7 +6991,7 @@ _bfd_elf_make_empty_symbol (bfd *abfd)
|
|||
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
|
||||
|
@ -7464,7 +7476,7 @@ _bfd_elfcore_make_pseudosection (bfd *abfd,
|
|||
|
||||
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);
|
||||
|
@ -7622,7 +7634,7 @@ char *
|
|||
_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)
|
||||
|
@ -7630,7 +7642,7 @@ _bfd_elfcore_strndup (bfd *abfd, char *start, size_t max)
|
|||
else
|
||||
len = end - start;
|
||||
|
||||
dups = bfd_alloc (abfd, len + 1);
|
||||
dups = (char *) bfd_alloc (abfd, len + 1);
|
||||
if (dups == NULL)
|
||||
return NULL;
|
||||
|
||||
|
@ -7850,7 +7862,7 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
|
|||
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;
|
||||
|
||||
|
@ -7881,7 +7893,7 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
|
|||
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;
|
||||
|
||||
|
@ -7992,7 +8004,7 @@ static bfd_boolean
|
|||
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;
|
||||
|
||||
|
@ -8211,7 +8223,7 @@ elfcore_grok_nto_status (bfd *abfd, Elf_Internal_Note *note, long *tid)
|
|||
/* 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);
|
||||
|
@ -8240,7 +8252,7 @@ elfcore_grok_nto_regs (bfd *abfd,
|
|||
/* 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);
|
||||
|
@ -8297,7 +8309,7 @@ elfcore_grok_spu_note (bfd *abfd, Elf_Internal_Note *note)
|
|||
|
||||
/* 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);
|
||||
|
@ -8351,7 +8363,7 @@ elfcore_write_note (bfd *abfd,
|
|||
|
||||
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;
|
||||
|
@ -8711,7 +8723,7 @@ elf_read_notes (bfd *abfd, file_ptr offset, bfd_size_type size)
|
|||
if (bfd_seek (abfd, offset, SEEK_SET) != 0)
|
||||
return FALSE;
|
||||
|
||||
buf = bfd_malloc (size);
|
||||
buf = (char *) bfd_malloc (size);
|
||||
if (buf == NULL)
|
||||
return FALSE;
|
||||
|
||||
|
@ -8941,7 +8953,7 @@ _bfd_elf_get_synthetic_symtab (bfd *abfd,
|
|||
}
|
||||
}
|
||||
|
||||
s = *ret = bfd_malloc (size);
|
||||
s = *ret = (asymbol *) bfd_malloc (size);
|
||||
if (s == NULL)
|
||||
return -1;
|
||||
|
||||
|
|
|
@ -704,8 +704,8 @@ elf_i386_link_hash_newfunc (struct bfd_hash_entry *entry,
|
|||
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;
|
||||
}
|
||||
|
@ -802,7 +802,7 @@ elf_i386_link_hash_table_create (bfd *abfd)
|
|||
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;
|
||||
|
||||
|
@ -1511,7 +1511,8 @@ elf_i386_check_relocs (bfd *abfd,
|
|||
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;
|
||||
|
@ -1687,7 +1688,8 @@ elf_i386_check_relocs (bfd *abfd,
|
|||
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;
|
||||
|
@ -2559,7 +2561,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -517,8 +517,9 @@ elf64_x86_64_link_hash_newfunc (struct bfd_hash_entry *entry,
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -176,8 +176,8 @@ elf_swap_symbol_in (bfd *abfd,
|
|||
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);
|
||||
|
@ -210,7 +210,7 @@ elf_swap_symbol_out (bfd *abfd,
|
|||
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);
|
||||
|
@ -439,7 +439,7 @@ elf_swap_dyn_in (bfd *abfd,
|
|||
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);
|
||||
|
@ -450,7 +450,7 @@ elf_swap_dyn_out (bfd *abfd,
|
|||
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);
|
||||
|
@ -736,13 +736,13 @@ elf_object_p (bfd *abfd)
|
|||
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;
|
||||
|
||||
|
@ -823,7 +823,7 @@ elf_object_p (bfd *abfd)
|
|||
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)
|
||||
|
@ -914,7 +914,7 @@ elf_object_p (bfd *abfd)
|
|||
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 *);
|
||||
|
@ -947,7 +947,7 @@ elf_write_relocs (bfd *abfd, asection *sec, void *data)
|
|||
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;
|
||||
|
@ -1077,7 +1077,7 @@ elf_write_shdrs_and_ehdr (bfd *abfd)
|
|||
/* 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;
|
||||
|
||||
|
@ -1205,7 +1205,7 @@ elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bfd_boolean dynamic)
|
|||
|
||||
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;
|
||||
|
||||
|
@ -1229,7 +1229,7 @@ elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bfd_boolean dynamic)
|
|||
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;
|
||||
|
||||
|
@ -1418,7 +1418,7 @@ elf_slurp_reloc_table_from_section (bfd *abfd,
|
|||
!= 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)
|
||||
|
@ -1539,7 +1539,7 @@ elf_slurp_reloc_table (bfd *abfd,
|
|||
}
|
||||
|
||||
amt = (reloc_count + reloc_count2) * sizeof (arelent);
|
||||
relents = bfd_alloc (abfd, amt);
|
||||
relents = (arelent *) bfd_alloc (abfd, amt);
|
||||
if (relents == NULL)
|
||||
return FALSE;
|
||||
|
||||
|
@ -1690,7 +1690,8 @@ NAME(_bfd_elf,bfd_from_remote_memory)
|
|||
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);
|
||||
|
@ -1758,7 +1759,7 @@ NAME(_bfd_elf,bfd_from_remote_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);
|
||||
|
@ -1803,7 +1804,7 @@ NAME(_bfd_elf,bfd_from_remote_memory)
|
|||
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);
|
||||
|
|
|
@ -190,7 +190,7 @@ elf_core_file_p (bfd *abfd)
|
|||
|
||||
/* 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;
|
||||
|
||||
|
|
203
bfd/elflink.c
203
bfd/elflink.c
|
@ -634,7 +634,7 @@ bfd_elf_link_record_local_dynamic_symbol (struct bfd_link_info *info,
|
|||
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;
|
||||
|
||||
|
@ -719,7 +719,7 @@ static bfd_boolean
|
|||
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;
|
||||
|
@ -741,7 +741,7 @@ static bfd_boolean
|
|||
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;
|
||||
|
@ -1624,7 +1624,7 @@ _bfd_elf_add_default_symbol (bfd *abfd,
|
|||
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);
|
||||
|
@ -1735,7 +1735,7 @@ _bfd_elf_add_default_symbol (bfd *abfd,
|
|||
|
||||
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);
|
||||
|
@ -1809,7 +1809,7 @@ nondefault:
|
|||
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)
|
||||
|
@ -1852,7 +1852,7 @@ static bfd_boolean
|
|||
_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;
|
||||
|
@ -1888,7 +1888,7 @@ _bfd_elf_link_find_version_dependencies (struct elf_link_hash_entry *h,
|
|||
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;
|
||||
|
@ -1901,7 +1901,7 @@ _bfd_elf_link_find_version_dependencies (struct elf_link_hash_entry *h,
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -1942,7 +1942,7 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data)
|
|||
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)
|
||||
|
@ -1999,7 +1999,7 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data)
|
|||
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;
|
||||
|
@ -2046,7 +2046,7 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data)
|
|||
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;
|
||||
|
@ -2148,7 +2148,7 @@ elf_link_read_relocs_from_section (bfd *abfd,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
erela = external_relocs;
|
||||
erela = (const bfd_byte *) external_relocs;
|
||||
erelaend = erela + shdr->sh_size;
|
||||
irela = internal_relocs;
|
||||
while (erela < erelaend)
|
||||
|
@ -2226,9 +2226,9 @@ _bfd_elf_link_read_relocs (bfd *abfd,
|
|||
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;
|
||||
}
|
||||
|
@ -2311,7 +2311,7 @@ _bfd_elf_link_size_reloc_section (bfd *abfd,
|
|||
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;
|
||||
|
||||
|
@ -2322,7 +2322,8 @@ _bfd_elf_link_size_reloc_section (bfd *abfd,
|
|||
{
|
||||
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;
|
||||
|
||||
|
@ -2571,7 +2572,7 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h,
|
|||
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;
|
||||
|
||||
|
@ -2752,7 +2753,7 @@ _bfd_elf_link_sec_merge_syms (struct elf_link_hash_entry *h, void *data)
|
|||
&& ((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,
|
||||
|
@ -3067,7 +3068,7 @@ _bfd_elf_add_dynamic_entry (struct bfd_link_info *info,
|
|||
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;
|
||||
|
||||
|
@ -3182,7 +3183,7 @@ elf_sort_symbol (const void *arg1, const void *arg2)
|
|||
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;
|
||||
|
@ -3473,7 +3474,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
|
|||
}
|
||||
|
||||
sz = s->size;
|
||||
msg = bfd_alloc (abfd, sz + 1);
|
||||
msg = (char *) bfd_alloc (abfd, sz + 1);
|
||||
if (msg == NULL)
|
||||
goto error_return;
|
||||
|
||||
|
@ -3585,12 +3586,12 @@ error_free_dyn:
|
|||
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);
|
||||
|
@ -3608,12 +3609,12 @@ error_free_dyn:
|
|||
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);
|
||||
|
@ -3634,12 +3635,12 @@ error_free_dyn:
|
|||
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);
|
||||
|
@ -3743,7 +3744,7 @@ error_free_dyn:
|
|||
/* 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;
|
||||
|
@ -3763,7 +3764,7 @@ error_free_dyn:
|
|||
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;
|
||||
|
@ -4079,7 +4080,7 @@ error_free_dyn:
|
|||
&& 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);
|
||||
|
@ -4384,7 +4385,8 @@ error_free_dyn:
|
|||
{
|
||||
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;
|
||||
}
|
||||
|
@ -4441,7 +4443,8 @@ error_free_dyn:
|
|||
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);
|
||||
|
@ -4547,7 +4550,7 @@ error_free_dyn:
|
|||
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);
|
||||
|
@ -4605,7 +4608,7 @@ error_free_dyn:
|
|||
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;
|
||||
|
@ -4818,7 +4821,8 @@ error_free_dyn:
|
|||
/* 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;
|
||||
|
@ -4869,7 +4873,7 @@ _bfd_elf_archive_symbol_lookup (bfd *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;
|
||||
|
||||
|
@ -4946,8 +4950,8 @@ elf_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info)
|
|||
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;
|
||||
|
||||
|
@ -5111,7 +5115,7 @@ struct hash_codes_info
|
|||
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;
|
||||
|
@ -5128,7 +5132,7 @@ elf_collect_hash_codes (struct elf_link_hash_entry *h, void *data)
|
|||
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;
|
||||
|
@ -5182,7 +5186,7 @@ struct collect_gnu_hash_codes
|
|||
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;
|
||||
|
@ -5203,7 +5207,7 @@ elf_collect_gnu_hash_codes (struct elf_link_hash_entry *h, void *data)
|
|||
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;
|
||||
|
@ -5237,7 +5241,7 @@ elf_collect_gnu_hash_codes (struct elf_link_hash_entry *h, void *data)
|
|||
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;
|
||||
|
||||
|
@ -5349,7 +5353,7 @@ compute_bucket_count (struct bfd_link_info *info,
|
|||
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;
|
||||
|
||||
|
@ -5631,7 +5635,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
|
|||
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);
|
||||
|
@ -5869,7 +5873,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -6107,7 +6111,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -6267,7 +6271,7 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info)
|
|||
&& (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;
|
||||
|
||||
|
@ -6287,7 +6291,7 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info)
|
|||
|
||||
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;
|
||||
|
||||
|
@ -6314,7 +6318,7 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info)
|
|||
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;
|
||||
|
@ -6343,7 +6347,7 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info)
|
|||
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;
|
||||
|
||||
|
@ -6366,7 +6370,7 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info)
|
|||
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;
|
||||
|
||||
|
@ -6402,7 +6406,7 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info)
|
|||
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;
|
||||
|
@ -6446,14 +6450,14 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info)
|
|||
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));
|
||||
|
@ -6475,7 +6479,7 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info)
|
|||
|
||||
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);
|
||||
|
@ -6599,7 +6603,8 @@ _bfd_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
|
|||
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;
|
||||
}
|
||||
|
@ -6740,7 +6745,7 @@ _bfd_elf_link_hash_table_create (bfd *abfd)
|
|||
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;
|
||||
|
||||
|
@ -6883,7 +6888,7 @@ bfd_elf_get_bfd_needed_list (bfd *abfd,
|
|||
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;
|
||||
|
||||
|
@ -6955,7 +6960,7 @@ elf_create_symbuf (bfd_size_type symcount, Elf_Internal_Sym *isymbuf)
|
|||
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;
|
||||
|
||||
|
@ -6975,7 +6980,7 @@ elf_create_symbuf (bfd_size_type symcount, Elf_Internal_Sym *isymbuf)
|
|||
|
||||
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);
|
||||
|
@ -7056,8 +7061,8 @@ bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2,
|
|||
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)
|
||||
{
|
||||
|
@ -7131,8 +7136,10 @@ bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2,
|
|||
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;
|
||||
|
||||
|
@ -7173,8 +7180,10 @@ bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2,
|
|||
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;
|
||||
|
||||
|
@ -7878,8 +7887,8 @@ struct elf_link_sort_rela
|
|||
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;
|
||||
|
@ -7903,8 +7912,8 @@ elf_link_sort_cmp1 (const void *A, const void *B)
|
|||
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)
|
||||
|
@ -8104,7 +8113,7 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
|
|||
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)
|
||||
{
|
||||
|
@ -8273,7 +8282,8 @@ elf_link_output_sym (struct elf_final_link_info *finfo,
|
|||
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;
|
||||
|
@ -8399,7 +8409,7 @@ elf_link_check_versioned_symbol (struct bfd_link_info *info,
|
|||
|
||||
/* 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;
|
||||
|
||||
|
@ -8467,7 +8477,7 @@ elf_link_check_versioned_symbol (struct bfd_link_info *info,
|
|||
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;
|
||||
|
@ -9809,8 +9819,8 @@ elf_reloc_link_order (bfd *output_bfd,
|
|||
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);
|
||||
|
@ -10368,7 +10378,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
|
|||
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))
|
||||
|
@ -10377,7 +10387,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
|
|||
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;
|
||||
}
|
||||
|
@ -10428,7 +10438,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
|
|||
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;
|
||||
}
|
||||
|
@ -10444,7 +10454,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
|
|||
{
|
||||
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;
|
||||
}
|
||||
|
@ -10452,22 +10462,22 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
|
|||
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;
|
||||
}
|
||||
|
@ -10475,7 +10485,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
|
|||
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;
|
||||
}
|
||||
|
@ -11080,7 +11090,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
|
|||
|
||||
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);
|
||||
|
@ -11422,7 +11432,8 @@ elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *data)
|
|||
&& !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);
|
||||
}
|
||||
|
||||
|
@ -11803,7 +11814,8 @@ bfd_elf_gc_record_vtinherit (bfd *abfd,
|
|||
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;
|
||||
}
|
||||
|
@ -11835,7 +11847,8 @@ bfd_elf_gc_record_vtentry (bfd *abfd ATTRIBUTE_UNUSED,
|
|||
|
||||
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;
|
||||
}
|
||||
|
@ -11868,7 +11881,7 @@ bfd_elf_gc_record_vtentry (bfd *abfd ATTRIBUTE_UNUSED,
|
|||
|
||||
if (ptr)
|
||||
{
|
||||
ptr = bfd_realloc (ptr - 1, bytes);
|
||||
ptr = (bfd_boolean *) bfd_realloc (ptr - 1, bytes);
|
||||
|
||||
if (ptr != NULL)
|
||||
{
|
||||
|
@ -11880,7 +11893,7 @@ bfd_elf_gc_record_vtentry (bfd *abfd ATTRIBUTE_UNUSED,
|
|||
}
|
||||
}
|
||||
else
|
||||
ptr = bfd_zmalloc (bytes);
|
||||
ptr = (bfd_boolean *) bfd_zmalloc (bytes);
|
||||
|
||||
if (ptr == NULL)
|
||||
return FALSE;
|
||||
|
@ -11906,7 +11919,7 @@ struct alloc_got_off_arg {
|
|||
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);
|
||||
|
||||
|
@ -12006,7 +12019,7 @@ bfd_elf_gc_common_final_link (bfd *abfd, struct bfd_link_info *info)
|
|||
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;
|
||||
|
|
|
@ -149,7 +149,7 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
|
|||
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;
|
||||
}
|
||||
|
|
18
bfd/hash.c
18
bfd/hash.c
|
@ -374,7 +374,8 @@ bfd_hash_table_init_n (struct bfd_hash_table *table,
|
|||
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);
|
||||
|
@ -407,7 +408,7 @@ bfd_hash_table_init (struct bfd_hash_table *table,
|
|||
void
|
||||
bfd_hash_table_free (struct bfd_hash_table *table)
|
||||
{
|
||||
objalloc_free (table->memory);
|
||||
objalloc_free ((struct objalloc *) table->memory);
|
||||
table->memory = NULL;
|
||||
}
|
||||
|
||||
|
@ -581,7 +582,8 @@ bfd_hash_newfunc (struct bfd_hash_entry *entry,
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -676,7 +678,8 @@ strtab_hash_newfunc (struct bfd_hash_entry *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;
|
||||
|
||||
|
@ -708,7 +711,7 @@ _bfd_stringtab_init (void)
|
|||
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;
|
||||
|
||||
|
@ -771,7 +774,8 @@ _bfd_stringtab_add (struct bfd_strtab_hash *tab,
|
|||
}
|
||||
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)
|
||||
|
@ -780,7 +784,7 @@ _bfd_stringtab_add (struct bfd_strtab_hash *tab,
|
|||
{
|
||||
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;
|
||||
|
|
15
bfd/ihex.c
15
bfd/ihex.c
|
@ -177,7 +177,7 @@ ihex_mkobject (bfd *abfd)
|
|||
{
|
||||
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;
|
||||
|
||||
|
@ -309,7 +309,7 @@ ihex_scan (bfd *abfd)
|
|||
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;
|
||||
|
@ -361,7 +361,7 @@ ihex_scan (bfd *abfd)
|
|||
|
||||
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);
|
||||
|
@ -583,7 +583,7 @@ ihex_read_section (bfd *abfd, asection *section, bfd_byte *contents)
|
|||
|
||||
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;
|
||||
|
@ -640,7 +640,8 @@ ihex_get_section_contents (bfd *abfd,
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -668,11 +669,11 @@ ihex_set_section_contents (bfd *abfd,
|
|||
|| (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);
|
||||
|
|
|
@ -349,6 +349,21 @@ typedef struct aout_symbol
|
|||
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. */
|
||||
|
@ -384,22 +399,9 @@ struct aoutdata
|
|||
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 aout_subformat subformat;
|
||||
|
||||
enum
|
||||
{
|
||||
undecided_magic = 0,
|
||||
z_magic,
|
||||
o_magic,
|
||||
n_magic
|
||||
} magic;
|
||||
enum aout_magic magic;
|
||||
|
||||
/* A buffer for find_nearest_line. */
|
||||
char *line_buf;
|
||||
|
|
40
bfd/libbfd.c
40
bfd/libbfd.c
|
@ -549,35 +549,35 @@ DESCRIPTION
|
|||
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;
|
||||
}
|
||||
|
@ -585,7 +585,7 @@ bfd_putb16 (bfd_vma data, void *p)
|
|||
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;
|
||||
}
|
||||
|
@ -593,7 +593,7 @@ bfd_putl16 (bfd_vma data, void *p)
|
|||
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;
|
||||
|
@ -606,7 +606,7 @@ bfd_getb32 (const void *p)
|
|||
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];
|
||||
|
@ -619,7 +619,7 @@ bfd_getl32 (const void *p)
|
|||
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;
|
||||
|
@ -632,7 +632,7 @@ bfd_getb_signed_32 (const void *p)
|
|||
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];
|
||||
|
@ -646,7 +646,7 @@ bfd_uint64_t
|
|||
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;
|
||||
|
@ -669,7 +669,7 @@ bfd_uint64_t
|
|||
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;
|
||||
|
@ -693,7 +693,7 @@ bfd_int64_t
|
|||
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;
|
||||
|
@ -716,7 +716,7 @@ bfd_int64_t
|
|||
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;
|
||||
|
@ -738,7 +738,7 @@ bfd_getl_signed_64 (const void *p ATTRIBUTE_UNUSED)
|
|||
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;
|
||||
|
@ -748,7 +748,7 @@ bfd_putb32 (bfd_vma data, void *p)
|
|||
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;
|
||||
|
@ -759,7 +759,7 @@ void
|
|||
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;
|
||||
|
@ -777,7 +777,7 @@ void
|
|||
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;
|
||||
|
@ -794,7 +794,7 @@ bfd_putl64 (bfd_uint64_t data ATTRIBUTE_UNUSED, void *p ATTRIBUTE_UNUSED)
|
|||
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;
|
||||
|
||||
|
@ -814,7 +814,7 @@ bfd_put_bits (bfd_uint64_t data, void *p, int bits, bfd_boolean big_p)
|
|||
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;
|
||||
|
|
52
bfd/linker.c
52
bfd/linker.c
|
@ -444,7 +444,8 @@ _bfd_link_hash_newfunc (struct bfd_hash_entry *entry,
|
|||
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;
|
||||
}
|
||||
|
@ -548,7 +549,7 @@ bfd_wrapped_link_hash_lookup (bfd *abfd,
|
|||
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;
|
||||
|
||||
|
@ -579,7 +580,7 @@ bfd_wrapped_link_hash_lookup (bfd *abfd,
|
|||
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;
|
||||
|
||||
|
@ -678,7 +679,7 @@ _bfd_generic_link_hash_newfunc (struct bfd_hash_entry *entry,
|
|||
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;
|
||||
|
@ -707,7 +708,7 @@ _bfd_generic_link_hash_table_create (bfd *abfd)
|
|||
struct generic_link_hash_table *ret;
|
||||
bfd_size_type amt = sizeof (struct generic_link_hash_table);
|
||||
|
||||
ret = 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,
|
||||
|
@ -748,7 +749,8 @@ bfd_generic_link_read_symbols (bfd *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));
|
||||
|
@ -880,7 +882,8 @@ archive_hash_newfunc (struct bfd_hash_entry *entry,
|
|||
/* 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;
|
||||
|
||||
|
@ -1051,7 +1054,7 @@ _bfd_generic_link_add_archive_symbols
|
|||
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;
|
||||
|
||||
|
@ -1242,7 +1245,7 @@ generic_link_check_archive_element (bfd *abfd,
|
|||
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)
|
||||
|
@ -1691,7 +1694,7 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
|
|||
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)
|
||||
|
@ -1972,7 +1975,7 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
|
|||
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);
|
||||
|
@ -2059,7 +2062,7 @@ _bfd_generic_final_link (bfd *abfd, struct bfd_link_info *info)
|
|||
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);
|
||||
|
@ -2081,7 +2084,7 @@ _bfd_generic_final_link (bfd *abfd, struct bfd_link_info *info)
|
|||
|
||||
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;
|
||||
|
@ -2135,7 +2138,7 @@ generic_add_output_symbol (bfd *output_bfd, size_t *psymalloc, asymbol *sym)
|
|||
*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;
|
||||
|
@ -2212,7 +2215,7 @@ _bfd_generic_link_output_symbols (bfd *output_bfd,
|
|||
|| 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
|
||||
|
@ -2451,7 +2454,8 @@ bfd_boolean
|
|||
_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)
|
||||
|
@ -2508,7 +2512,7 @@ _bfd_generic_reloc_link_order (bfd *abfd,
|
|||
if (sec->orelocation == NULL)
|
||||
abort ();
|
||||
|
||||
r = bfd_alloc (abfd, sizeof (arelent));
|
||||
r = (arelent *) bfd_alloc (abfd, sizeof (arelent));
|
||||
if (r == NULL)
|
||||
return FALSE;
|
||||
|
||||
|
@ -2556,7 +2560,7 @@ _bfd_generic_reloc_link_order (bfd *abfd,
|
|||
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,
|
||||
|
@ -2671,7 +2675,7 @@ default_data_link_order (bfd *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;
|
||||
|
@ -2781,7 +2785,7 @@ default_indirect_link_order (bfd *output_bfd,
|
|||
/* 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),
|
||||
|
@ -2816,7 +2820,7 @@ default_indirect_link_order (bfd *output_bfd,
|
|||
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
|
||||
|
@ -2949,7 +2953,8 @@ bfd_section_already_linked_table_insert
|
|||
|
||||
/* 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;
|
||||
|
@ -2964,7 +2969,8 @@ already_linked_newfunc (struct bfd_hash_entry *entry ATTRIBUTE_UNUSED,
|
|||
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;
|
||||
|
|
12
bfd/merge.c
12
bfd/merge.c
|
@ -108,7 +108,8 @@ sec_merge_hash_newfunc (struct bfd_hash_entry *entry,
|
|||
/* 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;
|
||||
|
||||
|
@ -235,7 +236,7 @@ sec_merge_init (unsigned int entsize, bfd_boolean strings)
|
|||
{
|
||||
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;
|
||||
|
||||
|
@ -293,7 +294,7 @@ sec_merge_emit (bfd *abfd, struct sec_merge_hash_entry *entry)
|
|||
|
||||
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;
|
||||
}
|
||||
|
@ -390,7 +391,8 @@ _bfd_add_merge_section (bfd *abfd, void **psinfo, asection *sec,
|
|||
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;
|
||||
|
@ -601,7 +603,7 @@ merge_strings (struct sec_merge_info *sinfo)
|
|||
|
||||
/* 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;
|
||||
|
||||
|
|
39
bfd/opncls.c
39
bfd/opncls.c
|
@ -52,7 +52,7 @@ _bfd_new_bfd (void)
|
|||
{
|
||||
bfd *nbfd;
|
||||
|
||||
nbfd = bfd_zmalloc (sizeof (bfd));
|
||||
nbfd = (bfd *) bfd_zmalloc (sizeof (bfd));
|
||||
if (nbfd == NULL)
|
||||
return NULL;
|
||||
|
||||
|
@ -342,7 +342,7 @@ DESCRIPTION
|
|||
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;
|
||||
|
||||
|
@ -438,14 +438,14 @@ struct opncls
|
|||
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;
|
||||
|
@ -458,7 +458,7 @@ opncls_bseek (struct bfd *abfd, file_ptr offset, int whence)
|
|||
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;
|
||||
|
@ -477,7 +477,7 @@ opncls_bwrite (struct bfd *abfd ATTRIBUTE_UNUSED,
|
|||
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;
|
||||
|
@ -496,7 +496,7 @@ opncls_bflush (struct bfd *abfd ATTRIBUTE_UNUSED)
|
|||
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)
|
||||
|
@ -564,7 +564,7 @@ bfd_openr_iovec (const char *filename, const char *target,
|
|||
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;
|
||||
|
@ -708,7 +708,7 @@ bfd_close (bfd *abfd)
|
|||
/* 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;
|
||||
|
@ -819,7 +819,7 @@ bfd_make_writable (bfd *abfd)
|
|||
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;
|
||||
|
@ -917,7 +917,7 @@ bfd_alloc (bfd *abfd, bfd_size_type size)
|
|||
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;
|
||||
|
@ -956,7 +956,7 @@ bfd_alloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size)
|
|||
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;
|
||||
|
@ -1266,7 +1266,7 @@ find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
|
|||
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);
|
||||
|
@ -1283,11 +1283,12 @@ find_separate_debug_file (bfd *abfd, const char *debug_file_directory)
|
|||
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);
|
||||
|
@ -1507,7 +1508,7 @@ bfd_fill_in_gnu_debuglink_section (bfd *abfd,
|
|||
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 ? */
|
||||
|
|
|
@ -160,7 +160,7 @@ _bfd_XXi_swap_sym_in (bfd * abfd, void * ext1, void * in1)
|
|||
|
||||
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 ();
|
||||
|
@ -1263,7 +1263,7 @@ pe_print_idata (bfd * abfd, void * vfile)
|
|||
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;
|
||||
|
||||
|
@ -1432,7 +1432,7 @@ pe_print_edata (bfd * abfd, void * vfile)
|
|||
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;
|
||||
|
||||
|
@ -1736,7 +1736,7 @@ slurp_symtab (bfd *abfd, sym_cache *psc)
|
|||
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)
|
||||
|
@ -1857,7 +1857,7 @@ _bfd_XX_print_ce_compressed_pdata (bfd * abfd, void * vfile)
|
|||
{
|
||||
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;
|
||||
|
|
|
@ -780,7 +780,7 @@ pe_ILF_build_a_bfd (bfd * abfd,
|
|||
|
||||
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;
|
||||
|
||||
|
@ -1194,7 +1194,7 @@ pe_ILF_object_p (bfd * abfd)
|
|||
/* 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;
|
||||
|
||||
|
|
|
@ -5475,7 +5475,7 @@ bfd_generic_get_relocated_section_contents (bfd *abfd,
|
|||
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;
|
||||
|
||||
|
|
|
@ -937,7 +937,7 @@ bfd_get_unique_section_name (bfd *abfd, const char *templat, int *count)
|
|||
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);
|
||||
|
@ -1495,7 +1495,8 @@ bfd_malloc_and_get_section (bfd *abfd, sec_ptr sec, bfd_byte **buf)
|
|||
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;
|
||||
|
|
10
bfd/simple.c
10
bfd/simple.c
|
@ -109,7 +109,7 @@ simple_save_output_info (bfd *abfd ATTRIBUTE_UNUSED,
|
|||
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
|
||||
|
@ -125,7 +125,7 @@ simple_restore_output_info (bfd *abfd ATTRIBUTE_UNUSED,
|
|||
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;
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ bfd_simple_get_relocated_section_contents (bfd *abfd,
|
|||
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;
|
||||
|
||||
|
@ -211,7 +211,7 @@ bfd_simple_get_relocated_section_contents (bfd *abfd,
|
|||
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;
|
||||
|
@ -241,7 +241,7 @@ bfd_simple_get_relocated_section_contents (bfd *abfd,
|
|||
_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
|
||||
|
|
25
bfd/srec.c
25
bfd/srec.c
|
@ -198,7 +198,7 @@ srec_mkobject (bfd *abfd)
|
|||
|
||||
srec_init ();
|
||||
|
||||
tdata = bfd_alloc (abfd, sizeof (tdata_type));
|
||||
tdata = (tdata_type *) bfd_alloc (abfd, sizeof (tdata_type));
|
||||
if (tdata == NULL)
|
||||
return FALSE;
|
||||
|
||||
|
@ -271,7 +271,7 @@ srec_new_symbol (bfd *abfd, const char *name, bfd_vma val)
|
|||
{
|
||||
struct srec_symbol *n;
|
||||
|
||||
n = bfd_alloc (abfd, sizeof (* n));
|
||||
n = (struct srec_symbol *) bfd_alloc (abfd, sizeof (* n));
|
||||
if (n == NULL)
|
||||
return FALSE;
|
||||
|
||||
|
@ -363,7 +363,7 @@ srec_scan (bfd *abfd)
|
|||
}
|
||||
|
||||
alc = 10;
|
||||
symbuf = bfd_malloc (alc + 1);
|
||||
symbuf = (char *) bfd_malloc (alc + 1);
|
||||
if (symbuf == NULL)
|
||||
goto error_return;
|
||||
|
||||
|
@ -378,7 +378,7 @@ srec_scan (bfd *abfd)
|
|||
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);
|
||||
|
@ -395,7 +395,7 @@ srec_scan (bfd *abfd)
|
|||
}
|
||||
|
||||
*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);
|
||||
|
@ -482,7 +482,7 @@ srec_scan (bfd *abfd)
|
|||
{
|
||||
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;
|
||||
|
@ -542,7 +542,7 @@ srec_scan (bfd *abfd)
|
|||
|
||||
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);
|
||||
|
@ -738,7 +738,7 @@ srec_read_section (bfd *abfd, asection *section, bfd_byte *contents)
|
|||
{
|
||||
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;
|
||||
|
@ -838,7 +838,8 @@ srec_get_section_contents (bfd *abfd,
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -872,7 +873,7 @@ srec_set_section_contents (bfd *abfd,
|
|||
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;
|
||||
|
||||
|
@ -882,7 +883,7 @@ srec_set_section_contents (bfd *abfd,
|
|||
{
|
||||
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);
|
||||
|
@ -1181,7 +1182,7 @@ srec_canonicalize_symtab (bfd *abfd, asymbol **alocation)
|
|||
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;
|
||||
|
|
18
bfd/stabs.c
18
bfd/stabs.c
|
@ -127,8 +127,8 @@ stab_link_includes_newfunc (struct bfd_hash_entry *entry,
|
|||
/* 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;
|
||||
|
||||
|
@ -337,7 +337,7 @@ _bfd_link_section_stabs (bfd *abfd,
|
|||
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;
|
||||
|
@ -375,7 +375,7 @@ _bfd_link_section_stabs (bfd *abfd,
|
|||
/* 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;
|
||||
|
@ -388,12 +388,14 @@ _bfd_link_section_stabs (bfd *abfd,
|
|||
{
|
||||
/* 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;
|
||||
}
|
||||
|
@ -471,7 +473,7 @@ _bfd_link_section_stabs (bfd *abfd,
|
|||
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;
|
||||
|
||||
|
@ -624,7 +626,7 @@ _bfd_discard_section_stabs (bfd *abfd,
|
|||
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;
|
||||
}
|
||||
|
|
22
bfd/syms.c
22
bfd/syms.c
|
@ -474,7 +474,7 @@ DESCRIPTION
|
|||
void
|
||||
bfd_print_symbol_vandf (bfd *abfd, void *arg, asymbol *symbol)
|
||||
{
|
||||
FILE *file = arg;
|
||||
FILE *file = (FILE *) arg;
|
||||
|
||||
flagword type = symbol->flags;
|
||||
|
||||
|
@ -811,7 +811,7 @@ _bfd_generic_read_minisymbols (bfd *abfd,
|
|||
if (storage == 0)
|
||||
return 0;
|
||||
|
||||
syms = bfd_malloc (storage);
|
||||
syms = (asymbol **) bfd_malloc (storage);
|
||||
if (syms == NULL)
|
||||
goto error_return;
|
||||
|
||||
|
@ -878,8 +878,8 @@ struct indexentry
|
|||
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;
|
||||
|
@ -966,7 +966,7 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
|
|||
#define VALOFF (8)
|
||||
#define STABSIZE (12)
|
||||
|
||||
info = *pinfo;
|
||||
info = (struct stab_find_info *) *pinfo;
|
||||
if (info != NULL)
|
||||
{
|
||||
if (info->stabsec == NULL || info->strsec == NULL)
|
||||
|
@ -991,7 +991,7 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
|
|||
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;
|
||||
|
||||
|
@ -1024,8 +1024,8 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
|
|||
? 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;
|
||||
|
||||
|
@ -1042,7 +1042,7 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
|
|||
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,
|
||||
|
@ -1139,7 +1139,7 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
|
|||
|
||||
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;
|
||||
|
||||
|
@ -1395,7 +1395,7 @@ _bfd_stab_section_find_nearest_line (bfd *abfd,
|
|||
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);
|
||||
|
|
|
@ -1455,7 +1455,7 @@ bfd_target_list (void)
|
|||
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;
|
||||
|
|
|
@ -324,7 +324,8 @@ find_chunk (bfd *abfd, bfd_vma vma)
|
|||
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;
|
||||
|
@ -383,7 +384,7 @@ first_phase (bfd *abfd, int type, char *src)
|
|||
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;
|
||||
|
@ -534,7 +535,7 @@ tekhex_mkobject (bfd *abfd)
|
|||
{
|
||||
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;
|
||||
|
|
|
@ -114,7 +114,7 @@ verilog_set_section_contents (bfd *abfd,
|
|||
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;
|
||||
|
||||
|
@ -124,7 +124,7 @@ verilog_set_section_contents (bfd *abfd,
|
|||
{
|
||||
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);
|
||||
|
@ -283,7 +283,7 @@ verilog_mkobject (bfd *abfd)
|
|||
|
||||
verilog_init ();
|
||||
|
||||
tdata = bfd_alloc (abfd, sizeof (tdata_type));
|
||||
tdata = (tdata_type *) bfd_alloc (abfd, sizeof (tdata_type));
|
||||
if (tdata == NULL)
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
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.
|
||||
|
|
|
@ -75,6 +75,12 @@ enum bfd_link_common_skip_ar_aymbols
|
|||
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. */
|
||||
|
||||
|
@ -143,11 +149,7 @@ struct bfd_link_hash_entry
|
|||
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;
|
||||
|
|
|
@ -45,8 +45,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
/* 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. */
|
||||
|
||||
|
|
Loading…
Reference in a new issue