{ bfd_set_error (bfd_error_no_memory); return false; }
return false;
bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap,			    input_bfd, input_debug, input_swap,			    info)     PTR handle;     bfd *output_bfd;     struct ecoff_debug_info *output_debug;     const struct ecoff_debug_swap *output_swap;     bfd *input_bfd;     struct ecoff_debug_info *input_debug;     const struct ecoff_debug_swap *input_swap;     struct bfd_link_info *info;{  struct accumulate *ainfo = (struct accumulate *) handle;  void (* const swap_sym_in) PARAMS ((bfd *, PTR, SYMR *))    = input_swap->swap_sym_in;  void (* const swap_rfd_in) PARAMS ((bfd *, PTR, RFDT *))    = input_swap->swap_rfd_in;  void (* const swap_sym_out) PARAMS ((bfd *, const SYMR *, PTR))    = output_swap->swap_sym_out;  void (* const swap_fdr_out) PARAMS ((bfd *, const FDR *, PTR))    = output_swap->swap_fdr_out;  void (* const swap_rfd_out) PARAMS ((bfd *, const RFDT *, PTR))    = output_swap->swap_rfd_out;  bfd_size_type external_pdr_size = output_swap->external_pdr_size;  bfd_size_type external_sym_size = output_swap->external_sym_size;  bfd_size_type external_opt_size = output_swap->external_opt_size;  bfd_size_type external_fdr_size = output_swap->external_fdr_size;  bfd_size_type external_rfd_size = output_swap->external_rfd_size;  HDRR * const output_symhdr = &output_debug->symbolic_header;  HDRR * const input_symhdr = &input_debug->symbolic_header;  bfd_vma section_adjust[scMax];  asection *sec;  bfd_byte *fdr_start;  bfd_byte *fdr_ptr;  bfd_byte *fdr_end;  bfd_size_type fdr_add;  unsigned int copied;  RFDT i;  unsigned long sz;  bfd_byte *rfd_out;  bfd_byte *rfd_in;  bfd_byte *rfd_end;  long newrfdbase = 0;  long oldrfdbase = 0;  bfd_byte *fdr_out;  /* Use section_adjust to hold the value to add to a symbol in a     particular section.  */  memset ((PTR) section_adjust, 0, sizeof section_adjust);#define SET(name, indx) \  sec = bfd_get_section_by_name (input_bfd, name); \  if (sec != NULL) \    section_adjust[indx] = (sec->output_section->vma \			    + sec->output_offset \			    - sec->vma);  SET (".text", scText);  SET (".data", scData);  SET (".bss", scBss);  SET (".sdata", scSData);  SET (".sbss", scSBss);  /* scRdata section may be either .rdata or .rodata.  */  SET (".rdata", scRData);  SET (".rodata", scRData);  SET (".init", scInit);  SET (".fini", scFini);#undef SET  /* Find all the debugging information based on the FDR's.  We need     to handle them whether they are swapped or not.  */  if (input_debug->fdr != (FDR *) NULL)    {      fdr_start = (bfd_byte *) input_debug->fdr;      fdr_add = sizeof (FDR);    }  else    {      fdr_start = (bfd_byte *) input_debug->external_fdr;      fdr_add = input_swap->external_fdr_size;    }  fdr_end = fdr_start + input_symhdr->ifdMax * fdr_add;  input_debug->ifdmap = (RFDT *) bfd_alloc (input_bfd,					    (input_symhdr->ifdMax					     * sizeof (RFDT)));  sz = (input_symhdr->crfd + input_symhdr->ifdMax) * external_rfd_size;  rfd_out = (bfd_byte *) obstack_alloc (&ainfo->memory, sz);  if (!input_debug->ifdmap || !rfd_out)    {      bfd_set_error (bfd_error_no_memory);      return false;    }  if (!add_memory_shuffle (ainfo, &ainfo->rfd, &ainfo->rfd_end, rfd_out, sz))    return false;  copied = 0;  /* Look through the FDR's to see which ones we are going to include     in the final output.  We do not want duplicate FDR information     for header files, because ECOFF debugging is often very large.     When we find an FDR with no line information which can be merged,     we look it up in a hash table to ensure that we only include it     once.  We keep a table mapping FDR numbers to the final number     they get with the BFD, so that we can refer to it when we write     out the external symbols.  */  for (fdr_ptr = fdr_start, i = 0;       fdr_ptr < fdr_end;       fdr_ptr += fdr_add, i++, rfd_out += external_rfd_size)    {      FDR fdr;      if (input_debug->fdr != (FDR *) NULL)	fdr = *(FDR *) fdr_ptr;      else	(*input_swap->swap_fdr_in) (input_bfd, (PTR) fdr_ptr, &fdr);      /* See if this FDR can be merged with an existing one.  */      if (fdr.cbLine == 0 && fdr.rss != -1 && fdr.fMerge)	{	  const char *name;	  char *lookup;	  struct string_hash_entry *fh;	  /* We look up a string formed from the file name and the	     number of symbols.  Sometimes an include file will	     conditionally define a typedef or something based on the	     order of include files.  Using the number of symbols as a	     hash reduces the chance that we will merge symbol	     information that should not be merged.  */	  name = input_debug->ss + fdr.issBase + fdr.rss;	  lookup = (char *) malloc (strlen (name) + 20);	  if (lookup == NULL)	    {	      bfd_set_error (bfd_error_no_memory);	      return false;	    }	  sprintf (lookup, "%s %lx", name, fdr.csym);	  fh = string_hash_lookup (&ainfo->fdr_hash, lookup, true, true);	  free (lookup);	  if (fh == (struct string_hash_entry *) NULL)	    return false;	  if (fh->val != -1)	    {	      input_debug->ifdmap[i] = fh->val;	      (*swap_rfd_out) (output_bfd, input_debug->ifdmap + i,			       (PTR) rfd_out);	      /* Don't copy this FDR.  */	      continue;	    }	  fh->val = output_symhdr->ifdMax + copied;	}      input_debug->ifdmap[i] = output_symhdr->ifdMax + copied;      (*swap_rfd_out) (output_bfd, input_debug->ifdmap + i, (PTR) rfd_out);      ++copied;    }  newrfdbase = output_symhdr->crfd;  output_symhdr->crfd += input_symhdr->ifdMax;  /* Copy over any existing RFD's.  RFD's are only created by the     linker, so this will only happen for input files which are the     result of a partial link.  */  rfd_in = (bfd_byte *) input_debug->external_rfd;  rfd_end = rfd_in + input_symhdr->crfd * input_swap->external_rfd_size;  for (;       rfd_in < rfd_end;       rfd_in += input_swap->external_rfd_size)    {      RFDT rfd;      (*swap_rfd_in) (input_bfd, (PTR) rfd_in, &rfd);      BFD_ASSERT (rfd >= 0 && rfd < input_symhdr->ifdMax);      rfd = input_debug->ifdmap[rfd];      (*swap_rfd_out) (output_bfd, &rfd, (PTR) rfd_out);      rfd_out += external_rfd_size;    }  oldrfdbase = output_symhdr->crfd;  output_symhdr->crfd += input_symhdr->crfd;  /* Look through the FDR's and copy over all associated debugging     information.  */  sz = copied * external_fdr_size;  fdr_out = (bfd_byte *) obstack_alloc (&ainfo->memory, sz);  if (!fdr_out)    {      bfd_set_error (bfd_error_no_memory);      return false;    }  if (!add_memory_shuffle (ainfo, &ainfo->fdr, &ainfo->fdr_end, fdr_out, sz))    return false;  for (fdr_ptr = fdr_start, i = 0;       fdr_ptr < fdr_end;       fdr_ptr += fdr_add, i++)    {      FDR fdr;      bfd_vma fdr_adr;      bfd_byte *sym_out;      bfd_byte *lraw_src;      bfd_byte *lraw_end;      boolean fgotfilename;      if (input_debug->ifdmap[i] < output_symhdr->ifdMax)	{	  /* We are not copying this FDR.  */	  continue;	}      if (input_debug->fdr != (FDR *) NULL)	fdr = *(FDR *) fdr_ptr;      else	(*input_swap->swap_fdr_in) (input_bfd, (PTR) fdr_ptr, &fdr);      fdr_adr = fdr.adr;      /* Adjust the FDR address for any changes that may have been	 made by relaxing.  */      if (input_debug->adjust != (struct ecoff_value_adjust *) NULL)	{	  struct ecoff_value_adjust *adjust;	  for (adjust = input_debug->adjust;	       adjust != (struct ecoff_value_adjust *) NULL;	       adjust = adjust->next)	    if (fdr_adr >= adjust->start		&& fdr_adr < adjust->end)	      fdr.adr += adjust->adjust;	}      /* FIXME: It is conceivable that this FDR points to the .init or	 .fini section, in which case this will not do the right	 thing.  */      fdr.adr += section_adjust[scText];      /* Swap in the local symbols, adjust their values, and swap them	 out again.  */      fgotfilename = false;      sz = fdr.csym * external_sym_size;      sym_out = (bfd_byte *) obstack_alloc (&ainfo->memory, sz);      if (!sym_out)	{	  bfd_set_error (bfd_error_no_memory);	  return false;	}      if (!add_memory_shuffle (ainfo, &ainfo->sym, &ainfo->sym_end, sym_out,			       sz))	return false;      lraw_src = ((bfd_byte *) input_debug->external_sym		  + fdr.isymBase * input_swap->external_sym_size);      lraw_end = lraw_src + fdr.csym * input_swap->external_sym_size;      for (;  lraw_src < lraw_end;  lraw_src += input_swap->external_sym_size)	{	  SYMR internal_sym;	  (*swap_sym_in) (input_bfd, (PTR) lraw_src, &internal_sym);	  BFD_ASSERT (internal_sym.sc != scCommon		      && internal_sym.sc != scSCommon);	  /* Adjust the symbol value if appropriate.  */	  switch (internal_sym.st)	    {	    case stNil:	      if (ECOFF_IS_STAB (&internal_sym))		break;	      /* Fall through.  */	    case stGlobal:	    case stStatic:	    case stLabel:	    case stProc:	    case stStaticProc:	      if (input_debug->adjust != (struct ecoff_value_adjust *) NULL)		{		  bfd_vma value;		  struct ecoff_value_adjust *adjust;		  value = internal_sym.value;		  for (adjust = input_debug->adjust;		       adjust != (struct ecoff_value_adjust *) NULL;		       adjust = adjust->next)		    if (value >= adjust->start			&& value < adjust->end)		      internal_sym.value += adjust->adjust;		}	      internal_sym.value += section_adjust[internal_sym.sc];	      break;	    default:	      break;	    }	  /* If we are doing a final link, we hash all the strings in	     the local symbol table together.  This reduces the amount	     of space required by debugging information.  We don't do	     this when performing a relocateable link because it would	     prevent us from easily merging different FDR's.  */	  if (! info->relocateable)	    {	      boolean ffilename;	      const char *name;	      if (! fgotfilename && internal_sym.iss == fdr.rss)		ffilename = true;	      else		ffilename = false;	      /* Hash the name into the string table.  */	      name = input_debug->ss + fdr.issBase + internal_sym.iss;	      if (*name == '\0')		internal_sym.iss = 0;	      else		{		  struct string_hash_entry *sh;		  sh = string_hash_lookup (&ainfo->str_hash, name, true, true);		  if (sh == (struct string_hash_entry *) NULL)		    return false;		  if (sh->val == -1)		    {		      sh->val = output_symhdr->issMax;		      output_symhdr->issMax += strlen (name) + 1;		      if (ainfo->ss_hash == (struct string_hash_entry *) NULL)			ainfo->ss_hash = sh;		      if (ainfo->ss_hash_end			  != (struct string_hash_entry *) NULL)			ainfo->ss_hash_end->next = sh;		      ainfo->ss_hash_end = sh;		    }		  internal_sym.iss = sh->val;		}	      if (ffilename)		{		  fdr.rss = internal_sym.iss;		  fgotfilename = true;		}	    }	  (*swap_sym_out) (output_bfd, &internal_sym, sym_out);	  sym_out += external_sym_size;	}      fdr.isymBase = output_symhdr->isymMax;      output_symhdr->isymMax += fdr.csym;      /* Copy the information that does not need swapping.  */      /* FIXME: If we are relaxing, we need to adjust the line	 numbers.  Frankly, forget it.  Anybody using stabs debugging	 information will not use this line number information, and	 stabs are adjusted correctly.  */      if (fdr.cbLine > 0)	{	  if (!add_file_shuffle (ainfo, &ainfo->line, &ainfo->line_end,				 input_bfd,				 input_symhdr->cbLineOffset + fdr.cbLineOffset,				 fdr.cbLine))	    return false;	  fdr.ilineBase = output_symhdr->ilineMax;	  fdr.cbLineOffset = output_symhdr->cbLine;	  output_symhdr->ilineMax += fdr.cline;	  output_symhdr->cbLine += fdr.cbLine;	}      if (fdr.caux > 0)	{	  if (!add_file_shuffle (ainfo, &ainfo->aux, &ainfo->aux_end,				 input_bfd,				 (input_symhdr->cbAuxOffset				  + fdr.iauxBase * sizeof (union aux_ext)),				 fdr.caux * sizeof (union aux_ext)))	    return false;	  fdr.iauxBase = output_symhdr->iauxMax;	  output_symhdr->iauxMax += fdr.caux;	}      if (! info->relocateable)	{	  /* When are are hashing strings, we lie about the number of	     strings attached to each FDR.  We need to set cbSs	     because some versions of dbx apparently use it to decide	     how much of the string table to read in.  */	  fdr.issBase = 0;	  fdr.cbSs = output_symhdr->issMax;	}      else if (fdr.cbSs > 0)	{	  if (!add_file_shuffle (ainfo, &ainfo->ss, &ainfo->ss_end,				 input_bfd,				 input_symhdr->cbSsOffset + fdr.issBase,				 fdr.cbSs))	    return false;	  fdr.issBase = output_symhdr->issMax;	  output_symhdr->issMax += fdr.cbSs;	}      if ((output_bfd->xvec->header_byteorder_big_p	   == input_bfd->xvec->header_byteorder_big_p)	  && input_debug->adjust == (struct ecoff_value_adjust *) NULL)	{	  /* The two BFD's have the same endianness, and we don't have	     to adjust the PDR addresses, so simply copying the	     information will suffice.  */	  BFD_ASSERT (external_pdr_size == input_swap->external_pdr_size);	  if (fdr.cpd > 0)	    {	      if (!add_file_shuffle (ainfo, &ainfo->pdr, &ainfo->pdr_end,				     input_bfd,				     (input_symhdr->cbPdOffset				      + fdr.ipdFirst * external_pdr_size),				     fdr.cpd * external_pdr_size))		return false;	    }	  BFD_ASSERT (external_opt_size == input_swap->external_opt_size);	  if (fdr.copt > 0)	    {	      if (!add_file_shuffle (ainfo, &ainfo->opt, &ainfo->opt_end,				     input_bfd,				     (input_symhdr->cbOptOffset				      + fdr.ioptBase * external_opt_size),				     fdr.copt * external_opt_size))		return false;	    }	}      else	{	  bfd_size_type outsz, insz;	  bfd_byte *in;	  bfd_byte *end;	  bfd_byte *out;	  /* The two BFD's have different endianness, so we must swap	     everything in and out.  This code would always work, but	     it would be unnecessarily slow in the normal case.  */	  outsz = external_pdr_size;	  insz = input_swap->external_pdr_size;	  in = ((bfd_byte *) input_debug->external_pdr		+ fdr.ipdFirst * insz);	  end = in + fdr.cpd * insz;	  sz = fdr.cpd * outsz;	  out = (bfd_byte *) obstack_alloc (&ainfo->memory, sz);	  if (!out)	    {	      bfd_set_error (bfd_error_no_memory);	      return false;	    }	  if (!add_memory_shuffle (ainfo, &ainfo->pdr, &ainfo->pdr_end, out,				   sz))	    return false;	  for (; in < end; in += insz, out += outsz)	    {	      PDR pdr;	      (*input_swap->swap_pdr_in) (input_bfd, (PTR) in, &pdr);	      /* If we have been relaxing, we may have to adjust the		 address.  */	      if (input_debug->adjust != (struct ecoff_value_adjust *) NULL)		{		  bfd_vma adr;		  struct ecoff_value_adjust *adjust;		  adr = fdr_adr + pdr.adr;		  for (adjust = input_debug->adjust;		       adjust != (struct ecoff_value_adjust *) NULL;		       adjust = adjust->next)		    if (adr >= adjust->start			&& adr < adjust->end)		      pdr.adr += adjust->adjust;		}	      (*output_swap->swap_pdr_out) (output_bfd, &pdr, (PTR) out);	    }	  /* Swap over the optimization information.  */	  outsz = external_opt_size;	  insz = input_swap->external_opt_size;	  in = ((bfd_byte *) input_debug->external_opt		+ fdr.ioptBase * insz);	  end = in + fdr.copt * insz;	  sz = fdr.copt * outsz;	  out = (bfd_byte *) obstack_alloc (&ainfo->memory, sz);	  if (!out)	    {	      bfd_set_error (bfd_error_no_memory);	      return false;	    }	  if (!add_memory_shuffle (ainfo, &ainfo->opt, &ainfo->opt_end, out,				   sz))	    return false;	  for (; in < end; in += insz, out += outsz)	    {	      OPTR opt;	      (*input_swap->swap_opt_in) (input_bfd, (PTR) in, &opt);	      (*output_swap->swap_opt_out) (output_bfd, &opt, (PTR) out);	    }	}      fdr.ipdFirst = output_symhdr->ipdMax;      output_symhdr->ipdMax += fdr.cpd;      fdr.ioptBase = output_symhdr->ioptMax;      output_symhdr->ioptMax += fdr.copt;      if (fdr.crfd <= 0)	{	  /* Point this FDR at the table of RFD's we created.  */	  fdr.rfdBase = newrfdbase;	  fdr.crfd = input_symhdr->ifdMax;	}      else	{	  /* Point this FDR at the remapped RFD's.  */	  fdr.rfdBase += oldrfdbase;	}      (*swap_fdr_out) (output_bfd, &fdr, fdr_out);      fdr_out += external_fdr_size;      ++output_symhdr->ifdMax;    }  return true;}