relocs = (arelent **) malloc ((size_t) relsize);
relocs = (arelent **) bfd_malloc ((size_t) relsize);
_bfd_generic_final_link (abfd, info)     bfd *abfd;     struct bfd_link_info *info;{  bfd *sub;  asection *o;  struct bfd_link_order *p;  size_t outsymalloc;  struct generic_write_global_symbol_info wginfo;  abfd->outsymbols = (asymbol **) NULL;  abfd->symcount = 0;  outsymalloc = 0;  /* Build the output symbol table.  */  for (sub = info->input_bfds; sub != (bfd *) NULL; sub = sub->link_next)    if (! _bfd_generic_link_output_symbols (abfd, sub, info, &outsymalloc))      return false;  /* Accumulate the global symbols.  */  wginfo.info = info;  wginfo.output_bfd = abfd;  wginfo.psymalloc = &outsymalloc;  _bfd_generic_link_hash_traverse (_bfd_generic_hash_table (info),				   _bfd_generic_link_write_global_symbol,				   (PTR) &wginfo);  if (info->relocateable)    {      /* Allocate space for the output relocs for each section.  */      for (o = abfd->sections;	   o != (asection *) NULL;	   o = o->next)	{	  o->reloc_count = 0;	  for (p = o->link_order_head;	       p != (struct bfd_link_order *) NULL;	       p = p->next)	    {	      if (p->type == bfd_section_reloc_link_order		  || p->type == bfd_symbol_reloc_link_order)		++o->reloc_count;	      else if (p->type == bfd_indirect_link_order)		{		  asection *input_section;		  bfd *input_bfd;		  long relsize;		  arelent **relocs;		  asymbol **symbols;		  long reloc_count;		  input_section = p->u.indirect.section;		  input_bfd = input_section->owner;		  relsize = bfd_get_reloc_upper_bound (input_bfd,						       input_section);		  if (relsize < 0)		    return false;		  relocs = (arelent **) malloc ((size_t) relsize);		  if (!relocs && relsize != 0)		    {		      bfd_set_error (bfd_error_no_memory);		      return false;		    }		  symbols = _bfd_generic_link_get_symbols (input_bfd);		  reloc_count = bfd_canonicalize_reloc (input_bfd,							input_section,							relocs,							symbols);		  if (reloc_count < 0)		    return false;		  BFD_ASSERT ((unsigned long) reloc_count			      == input_section->reloc_count);		  o->reloc_count += reloc_count;		  free (relocs);		}	    }	  if (o->reloc_count > 0)	    {	      o->orelocation = ((arelent **)				bfd_alloc (abfd,					   (o->reloc_count					    * sizeof (arelent *))));	      if (!o->orelocation)		{		  bfd_set_error (bfd_error_no_memory);		  return false;		}	      o->flags |= SEC_RELOC;	      /* Reset the count so that it can be used as an index		 when putting in the output relocs.  */	      o->reloc_count = 0;	    }	}    }  /* Handle all the link order information for the sections.  */  for (o = abfd->sections;       o != (asection *) NULL;       o = o->next)    {      for (p = o->link_order_head;	   p != (struct bfd_link_order *) NULL;	   p = p->next)	{	  switch (p->type)	    {	    case bfd_section_reloc_link_order:	    case bfd_symbol_reloc_link_order:	      if (! _bfd_generic_reloc_link_order (abfd, info, o, p))		return false;	      break;	    case bfd_indirect_link_order:	      if (! default_indirect_link_order (abfd, info, o, p, true))		return false;	      break;	    default:	      if (! _bfd_default_link_order (abfd, info, o, p))		return false;	      break;	    }	}    }  return true;}