{
char *c;
- c = bfd_alloc (abfd, (bfd_size_type) SYMNMLEN + 1);
+ c = bfd_alloc (abfd, SYMNMLEN + 1);
if (c == NULL)
return -1;
memcpy (c, ldsym._l._l_name, SYMNMLEN);
{
char *dsnm;
- dsnm = bfd_malloc ((bfd_size_type) strlen (name) + 2);
+ dsnm = bfd_malloc (strlen (name) + 2);
if (dsnm == NULL)
return false;
dsnm[0] = '.';
coff_section_data (abfd, lsec)->contents = NULL;
/* Record this file in the import files. */
- n = bfd_alloc (abfd, (bfd_size_type) sizeof (struct xcoff_import_file));
+ n = bfd_alloc (abfd, sizeof (*n));
if (n == NULL)
return false;
n->next = NULL;
bfd_vma value;
struct xcoff_link_hash_entry *set_toc;
- bfd_coff_swap_sym_in (abfd, (void *) esym, (void *) &sym);
+ bfd_coff_swap_sym_in (abfd, esym, &sym);
/* In this pass we are only interested in symbols with csect
information. */
{
union internal_auxent auxlin;
- bfd_coff_swap_aux_in (abfd, (void *) (esym + symesz),
+ if (symesz >= (size_t) (esym_end - esym))
+ goto badaux;
+
+ bfd_coff_swap_aux_in (abfd, esym + symesz,
sym.n_type, sym.n_sclass,
- 0, sym.n_numaux, (void *) &auxlin);
+ 0, sym.n_numaux, &auxlin);
if (auxlin.x_sym.x_fcnary.x_fcn.x_lnnoptr != 0)
{
linpstart = (reloc_info[enclosing->target_index].linenos
+ linoff);
- bfd_coff_swap_lineno_in (abfd, (void *) linpstart, (void *) &lin);
+ bfd_coff_swap_lineno_in (abfd, linpstart, &lin);
if (lin.l_lnno == 0
&& ((bfd_size_type) lin.l_addr.l_symndx
== ((esym
linp < linpend;
linp += linesz)
{
- bfd_coff_swap_lineno_in (abfd, (void *) linp,
- (void *) &lin);
+ bfd_coff_swap_lineno_in (abfd, linp, &lin);
if (lin.l_lnno == 0)
break;
}
visibility = sym.n_type & SYM_V_MASK;
/* Pick up the csect auxiliary information. */
- if (sym.n_numaux == 0)
+ if (sym.n_numaux < 1
+ || sym.n_numaux * symesz >= (size_t) (esym_end - esym))
{
+ badaux:
_bfd_error_handler
/* xgettext:c-format */
- (_("%pB: class %d symbol `%s' has no aux entries"),
+ (_("%pB: class %d symbol '%s' has missing aux entries"),
abfd, sym.n_sclass, name);
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
- bfd_coff_swap_aux_in (abfd,
- (void *) (esym + symesz * sym.n_numaux),
+ bfd_coff_swap_aux_in (abfd, esym + symesz * sym.n_numaux,
sym.n_type, sym.n_sclass,
- sym.n_numaux - 1, sym.n_numaux,
- (void *) &aux);
+ sym.n_numaux - 1, sym.n_numaux, &aux);
smtyp = SMTYP_SMTYP (aux.x_csect.x_smtyp);
erelsym = ((bfd_byte *) obj_coff_external_syms (abfd)
+ rel->r_symndx * symesz);
- bfd_coff_swap_sym_in (abfd, (void *) erelsym, (void *) &relsym);
+ bfd_coff_swap_sym_in (abfd, erelsym, &relsym);
if (EXTERN_SYM_P (relsym.n_sclass))
{
const char *relname;
{
struct internal_syment sym;
- bfd_coff_swap_sym_in (abfd, (void *) esym, (void *) &sym);
+ bfd_coff_swap_sym_in (abfd, esym, &sym);
esym += (sym.n_numaux + 1) * symesz;
if (EXTERN_SYM_P (sym.n_sclass) && sym.n_scnum != N_UNDEF)
return true;
xcoff_link_hash_traverse (xcoff_hash_table (info), xcoff_post_gc_symbol,
- (void *) ldinfo);
+ ldinfo);
if (ldinfo->failed)
goto error_return;
/* Read in the csect information, if any. */
if (CSECT_SYM_P (sym.n_sclass))
{
- BFD_ASSERT (sym.n_numaux > 0);
+ BFD_ASSERT (sym.n_numaux > 0
+ && symesz * sym.n_numaux < (size_t) (esymend - esym));
bfd_coff_swap_aux_in (sub, esym + symesz * sym.n_numaux,
sym.n_type, sym.n_sclass,
sym.n_numaux - 1, sym.n_numaux, &aux);
{
struct bfd_in_memory *bim;
- bim = bfd_malloc ((bfd_size_type) sizeof (* bim));
+ bim = bfd_malloc (sizeof (*bim));
if (bim == NULL)
return false;
abfd->link.next = 0;
abfd->format = bfd_object;
- abfd->iostream = (void *) bim;
+ abfd->iostream = bim;
abfd->flags = BFD_IN_MEMORY;
abfd->iovec = &_bfd_memory_iovec;
abfd->direction = write_direction;
}
bfd_coff_swap_sym_in (input_bfd,
- (void *) esyms + irel->r_symndx * symesz,
- (void *) &sym);
+ esyms + irel->r_symndx * symesz,
+ &sym);
sym_sec = xcoff_data (input_bfd)->csects[irel->r_symndx];
sym_value = sym.n_value - sym_sec->vma;
int smtyp = 0;
int add;
- bfd_coff_swap_sym_in (input_bfd, (void *) esym, (void *) isymp);
+ bfd_coff_swap_sym_in (input_bfd, esym, isymp);
/* Read in the csect information, if any. */
if (CSECT_SYM_P (isymp->n_sclass))
{
- BFD_ASSERT (isymp->n_numaux > 0);
- bfd_coff_swap_aux_in (input_bfd,
- (void *) (esym + isymesz * isymp->n_numaux),
+ BFD_ASSERT (isymp->n_numaux > 0
+ && isymesz * isymp->n_numaux < (size_t) (esym_end - esym));
+ bfd_coff_swap_aux_in (input_bfd, esym + isymesz * isymp->n_numaux,
isymp->n_type, isymp->n_sclass,
- isymp->n_numaux - 1, isymp->n_numaux,
- (void *) &aux);
+ isymp->n_numaux - 1, isymp->n_numaux, &aux);
smtyp = SMTYP_SMTYP (aux.x_csect.x_smtyp);
}
if ((bfd_size_type) flinfo->last_file_index >= syment_base)
{
/* The last C_FILE symbol is in this input file. */
- bfd_coff_swap_sym_out (output_bfd,
- (void *) &flinfo->last_file,
- (void *) (flinfo->outsyms
- + ((flinfo->last_file_index
- - syment_base)
- * osymesz)));
+ bfd_coff_swap_sym_out
+ (output_bfd, &flinfo->last_file,
+ flinfo->outsyms + (flinfo->last_file_index
+ - syment_base) * osymesz);
}
else
{
borrow *outsym temporarily. */
file_ptr pos;
- bfd_coff_swap_sym_out (output_bfd,
- (void *) &flinfo->last_file,
- (void *) outsym);
+ bfd_coff_swap_sym_out (output_bfd, &flinfo->last_file,
+ outsym);
pos = obj_sym_filepos (output_bfd);
pos += flinfo->last_file_index * osymesz;
}
/* Output the symbol. */
- bfd_coff_swap_sym_out (output_bfd, (void *) &isym, (void *) outsym);
+ bfd_coff_swap_sym_out (output_bfd, &isym, outsym);
esym += isymesz;
outsym += osymesz;
{
union internal_auxent aux;
- bfd_coff_swap_aux_in (input_bfd, (void *) esym, isymp->n_type,
- isymp->n_sclass, i, isymp->n_numaux,
- (void *) &aux);
+ bfd_coff_swap_aux_in (input_bfd, esym,
+ isymp->n_type, isymp->n_sclass, i,
+ isymp->n_numaux, &aux);
if (isymp->n_sclass == C_FILE)
{
}
}
- bfd_coff_swap_aux_out (output_bfd, (void *) &aux, isymp->n_type,
+ bfd_coff_swap_aux_out (output_bfd, &aux, isymp->n_type,
isymp->n_sclass, i, isymp->n_numaux,
- (void *) outsym);
+ outsym);
outsym += osymesz;
esym += isymesz;
}
&& (bfd_size_type) flinfo->last_file_index >= syment_base)
{
flinfo->last_file.n_value = output_index;
- bfd_coff_swap_sym_out (output_bfd, (void *) &flinfo->last_file,
- (void *) (flinfo->outsyms
- + ((flinfo->last_file_index - syment_base)
- * osymesz)));
+ bfd_coff_swap_sym_out (output_bfd, &flinfo->last_file,
+ flinfo->outsyms + (flinfo->last_file_index
+ - syment_base) * osymesz);
}
/* Write the modified symbols to the output file. */
void * auxptr;
union internal_auxent aux;
- auxptr = ((void *)
- (((bfd_byte *)
- obj_coff_external_syms (input_bfd))
- + ((r_symndx + is->n_numaux)
- * isymesz)));
+ auxptr = ((bfd_byte *)
+ obj_coff_external_syms (input_bfd)
+ + (r_symndx + is->n_numaux) * isymesz);
bfd_coff_swap_aux_in (input_bfd, auxptr,
is->n_type, is->n_sclass,
is->n_numaux - 1,
- is->n_numaux,
- (void *) &aux);
+ is->n_numaux, &aux);
if (SMTYP_SMTYP (aux.x_csect.x_smtyp) == XTY_SD
&& aux.x_csect.x_smclas == XMC_TC0)
indx = flinfo->toc_symindx;
irsym.n_type = T_NULL;
irsym.n_numaux = 1;
- bfd_coff_swap_sym_out (output_bfd, (void *) &irsym, (void *) outsym);
+ bfd_coff_swap_sym_out (output_bfd, &irsym, outsym);
outsym += bfd_coff_symesz (output_bfd);
/* Note : iraux is initialized above. */
- bfd_coff_swap_aux_out (output_bfd, (void *) &iraux, T_NULL, C_HIDEXT,
- 0, 1, (void *) outsym);
+ bfd_coff_swap_aux_out (output_bfd, &iraux, T_NULL, C_HIDEXT,
+ 0, 1, outsym);
outsym += bfd_coff_auxesz (output_bfd);
if (h->indx >= 0)
isym.n_type = T_NULL;
isym.n_numaux = 1;
- bfd_coff_swap_sym_out (output_bfd, (void *) &isym, (void *) outsym);
+ bfd_coff_swap_sym_out (output_bfd, &isym, outsym);
outsym += bfd_coff_symesz (output_bfd);
aux.x_csect.x_smclas = h->smclas;
- bfd_coff_swap_aux_out (output_bfd, (void *) &aux, T_NULL, isym.n_sclass, 0, 1,
- (void *) outsym);
+ bfd_coff_swap_aux_out (output_bfd, &aux, T_NULL, isym.n_sclass, 0, 1, outsym);
outsym += bfd_coff_auxesz (output_bfd);
if ((h->root.type == bfd_link_hash_defined
isym.n_sclass = C_WEAKEXT;
else
isym.n_sclass = C_EXT;
- bfd_coff_swap_sym_out (output_bfd, (void *) &isym, (void *) outsym);
+ bfd_coff_swap_sym_out (output_bfd, &isym, outsym);
outsym += bfd_coff_symesz (output_bfd);
aux.x_csect.x_smtyp = XTY_LD;
aux.x_csect.x_scnlen.u64 = obj_raw_syment_count (output_bfd);
- bfd_coff_swap_aux_out (output_bfd, (void *) &aux, T_NULL, C_EXT, 0, 1,
- (void *) outsym);
+ bfd_coff_swap_aux_out (output_bfd, &aux, T_NULL, C_EXT, 0, 1, outsym);
outsym += bfd_coff_auxesz (output_bfd);
}
howto->name, addend, NULL, NULL, (bfd_vma) 0);
break;
}
- ok = bfd_set_section_contents (output_bfd, output_section, (void *) buf,
- (file_ptr) link_order->offset, size);
+ ok = bfd_set_section_contents (output_bfd, output_section, buf,
+ link_order->offset, size);
free (buf);
if (! ok)
return false;
if (flinfo.last_file_index != -1)
{
flinfo.last_file.n_value = -(bfd_vma) 1;
- bfd_coff_swap_sym_out (abfd, (void *) &flinfo.last_file,
- (void *) flinfo.outsyms);
+ bfd_coff_swap_sym_out (abfd, &flinfo.last_file, flinfo.outsyms);
pos = obj_sym_filepos (abfd) + flinfo.last_file_index * symesz;
if (bfd_seek (abfd, pos, SEEK_SET) != 0
|| bfd_write (flinfo.outsyms, symesz, abfd) != symesz)
appear in the symbol table, which is not necessarily by
address. So we sort them here. There may be a better way to
do this. */
- qsort ((void *) flinfo.section_info[o->target_index].relocs,
+ qsort (flinfo.section_info[o->target_index].relocs,
o->reloc_count, sizeof (struct internal_reloc),
xcoff_sort_relocs);
irelend = irel + o->reloc_count;
erel = external_relocs;
for (; irel < irelend; irel++, rel_hash++, erel += relsz)
- bfd_coff_swap_reloc_out (abfd, (void *) irel, (void *) erel);
+ bfd_coff_swap_reloc_out (abfd, irel, erel);
rel_size = relsz * o->reloc_count;
if (bfd_seek (abfd, o->rel_filepos, SEEK_SET) != 0