free (relas);
if (is_rela) free (relas); else free (rels);
dump_relocations (file, rel_offset, rel_size, symtab, nsyms, strtab, is_rela)     FILE *             file;     unsigned long      rel_offset;     unsigned long      rel_size;     Elf_Internal_Sym * symtab;     unsigned long      nsyms;     char *             strtab;     int                is_rela;{  unsigned int        i;  Elf_Internal_Rel *  rels;  Elf_Internal_Rela * relas;  if (is_rela == UNKNOWN)    is_rela = guess_is_rela (elf_header.e_machine);  if (is_rela)    {      if (is_32bit_elf)	{	  Elf32_External_Rela * erelas;	  GET_DATA_ALLOC (rel_offset, rel_size, erelas,			  Elf32_External_Rela *, "relocs");	  rel_size = rel_size / sizeof (Elf32_External_Rela);	  relas = (Elf_Internal_Rela *)	    malloc (rel_size * sizeof (Elf_Internal_Rela));	  if (relas == NULL)	    {	      error(_("out of memory parsing relocs"));	      return 0;	    }	  for (i = 0; i < rel_size; i++)	    {	      relas[i].r_offset = BYTE_GET (erelas[i].r_offset);	      relas[i].r_info   = BYTE_GET (erelas[i].r_info);	      relas[i].r_addend = BYTE_GET (erelas[i].r_addend);	    }	  free (erelas);	  rels = (Elf_Internal_Rel *) relas;	}      else	{	  Elf64_External_Rela * erelas;	  GET_DATA_ALLOC (rel_offset, rel_size, erelas,			  Elf64_External_Rela *, "relocs");	  rel_size = rel_size / sizeof (Elf64_External_Rela);	  relas = (Elf_Internal_Rela *)	    malloc (rel_size * sizeof (Elf_Internal_Rela));	  if (relas == NULL)	    {	      error(_("out of memory parsing relocs"));	      return 0;	    }	  for (i = 0; i < rel_size; i++)	    {	      relas[i].r_offset = BYTE_GET8 (erelas[i].r_offset);	      relas[i].r_info   = BYTE_GET8 (erelas[i].r_info);	      relas[i].r_addend = BYTE_GET8 (erelas[i].r_addend);	    }	  free (erelas);	  rels = (Elf_Internal_Rel *) relas;	}    }  else    {      if (is_32bit_elf)	{	  Elf32_External_Rel * erels;	  GET_DATA_ALLOC (rel_offset, rel_size, erels,			  Elf32_External_Rel *, "relocs");	  rel_size = rel_size / sizeof (Elf32_External_Rel);	  rels = (Elf_Internal_Rel *)	    malloc (rel_size * sizeof (Elf_Internal_Rel));	  if (rels == NULL)	    {	      error(_("out of memory parsing relocs"));	      return 0;	    }	  for (i = 0; i < rel_size; i++)	    {	      rels[i].r_offset = BYTE_GET (erels[i].r_offset);	      rels[i].r_info   = BYTE_GET (erels[i].r_info);	    }	  free (erels);	  relas = (Elf_Internal_Rela *) rels;	}      else	{	  Elf64_External_Rel * erels;	  GET_DATA_ALLOC (rel_offset, rel_size, erels,			  Elf64_External_Rel *, "relocs");	  rel_size = rel_size / sizeof (Elf64_External_Rel);	  rels = (Elf_Internal_Rel *)	    malloc (rel_size * sizeof (Elf_Internal_Rel));	  if (rels == NULL)	    {	      error(_("out of memory parsing relocs"));	      return 0;	    }	  for (i = 0; i < rel_size; i++)	    {	      rels[i].r_offset = BYTE_GET8 (erels[i].r_offset);	      rels[i].r_info   = BYTE_GET8 (erels[i].r_info);	    }	  free (erels);	  relas = (Elf_Internal_Rela *) rels;	}    }  if (is_rela)    printf      (_("  Offset    Info  Type            Symbol's Value  Symbol's Name          Addend\n"));  else    printf      (_("  Offset    Info  Type            Symbol's Value  Symbol's Name\n"));  for (i = 0; i < rel_size; i++)    {      const char * rtype;      bfd_vma      offset;      bfd_vma      info;      bfd_vma      symtab_index;      bfd_vma      type;      if (is_rela)	{	  offset = relas [i].r_offset;	  info   = relas [i].r_info;	}      else	{	  offset = rels [i].r_offset;	  info   = rels [i].r_info;	}      if (is_32bit_elf)	{	  type         = ELF32_R_TYPE (info);	  symtab_index = ELF32_R_SYM  (info);	}      else	{	  if (elf_header.e_machine == EM_SPARCV9)	    type       = ELF64_R_TYPE_ID (info);	  else	    type       = ELF64_R_TYPE (info);	  /* The #ifdef BFD64 below is to prevent a compile time warning.	     We know that if we do not have a 64 bit data type that we	     will never execute this code anyway.  */#ifdef BFD64	  symtab_index = ELF64_R_SYM  (info);#endif	}#ifdef _bfd_int64_low      printf ("  %8.8lx  %5.5lx ", _bfd_int64_low (offset), _bfd_int64_low (info));#else      printf ("  %8.8lx  %5.5lx ", offset, info);#endif      switch (elf_header.e_machine)	{	default:	  rtype = NULL;	  break;	case EM_CYGNUS_M32R:	  rtype = elf_m32r_reloc_type (type);	  break;	case EM_386:	case EM_486:	  rtype = elf_i386_reloc_type (type);	  break;	case EM_68K:	  rtype = elf_m68k_reloc_type (type);	  break;	case EM_960:	  rtype = elf_i960_reloc_type (type);	  break;	case EM_AVR:	  rtype = elf_avr_reloc_type (type);	  break;	case EM_OLD_SPARCV9:	case EM_SPARC32PLUS:	case EM_SPARCV9:	case EM_SPARC:	  rtype = elf_sparc_reloc_type (type);	  break;	case EM_CYGNUS_V850:	  rtype = v850_reloc_type (type);	  break;	case EM_CYGNUS_D10V:	  rtype = elf_d10v_reloc_type (type);	  break;	case EM_CYGNUS_D30V:	  rtype = elf_d30v_reloc_type (type);	  break;	case EM_SH:	  rtype = elf_sh_reloc_type (type);	  break;	case EM_CYGNUS_MN10300:	  rtype = elf_mn10300_reloc_type (type);	  break;	case EM_CYGNUS_MN10200:	  rtype = elf_mn10200_reloc_type (type);	  break;	case EM_CYGNUS_FR30:	  rtype = elf_fr30_reloc_type (type);	  break;	case EM_MCORE:	  rtype = elf_mcore_reloc_type (type);	  break;	case EM_PPC:	  rtype = elf_ppc_reloc_type (type);	  break;	case EM_MIPS:	case EM_MIPS_RS4_BE:	  rtype = elf_mips_reloc_type (type);	  break;	case EM_ALPHA:	  rtype = elf_alpha_reloc_type (type);	  break;	case EM_ARM:	  rtype = elf_arm_reloc_type (type);	  break;	case EM_CYGNUS_ARC:	  rtype = elf_arc_reloc_type (type);	  break;	case EM_PARISC:	  rtype = elf_hppa_reloc_type (type);	  break;	case EM_PJ:	  rtype = elf_pj_reloc_type (type);	  break;	}      if (rtype == NULL)#ifdef _bfd_int64_low	printf (_("unrecognised: %-7lx"), _bfd_int64_low (type));#else	printf (_("unrecognised: %-7lx"), type);#endif      else	printf ("%-21.21s", rtype);      if (symtab_index)	{	  if (symtab != NULL)	    {	      if (symtab_index >= nsyms)		printf (" bad symbol index: %08lx", (unsigned long) symtab_index);	      else		{		  Elf_Internal_Sym * psym;		  psym = symtab + symtab_index;		  printf (" ");		  print_vma (psym->st_value, LONG_HEX);		  printf ("  ");		  if (psym->st_name == 0)		    printf ("%-25.25s",			    SECTION_NAME (section_headers + psym->st_shndx));		  else if (strtab == NULL)		    printf (_("<string table index %3ld>"), psym->st_name);		  else		    printf ("%-25.25s", strtab + psym->st_name);		  if (is_rela)		    printf (" + %lx", (unsigned long) relas [i].r_addend);		}	    }	}      else if (is_rela)	{	  printf ("%*c", is_32bit_elf ? 34 : 26, ' ');	  print_vma (relas[i].r_addend, LONG_HEX);	}      if (elf_header.e_machine == EM_SPARCV9	  && !strcmp (rtype, "R_SPARC_OLO10"))	printf (" + %lx", (unsigned long) ELF64_R_TYPE_DATA (info));      putchar ('\n');    }  free (relas);  return 1;}