done:
tc_gen_reloc (section, fixp)     asection *section;     fixS *fixp;{  arelent *reloc;  struct hppa_fix_struct *hppa_fixp;  bfd_reloc_code_real_type code;  static arelent *no_relocs = NULL;  arelent **relocs;  bfd_reloc_code_real_type **codes;  int n_relocs;  int i;  hppa_fixp = (struct hppa_fix_struct *) fixp->tc_fix_data;  if (fixp->fx_addsy == 0)    return &no_relocs;  assert (hppa_fixp != 0);  assert (section != 0);  reloc = (arelent *) bfd_alloc_by_size_t (stdoutput, sizeof (arelent));  assert (reloc != 0);  reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym;  codes = (bfd_reloc_code_real_type **) hppa_gen_reloc_type (stdoutput,			       fixp->fx_r_type,			       hppa_fixp->fx_r_format,			       hppa_fixp->fx_r_field,			       fixp->fx_subsy != NULL);  for (n_relocs = 0; codes[n_relocs]; n_relocs++)    ;  relocs = (arelent **)    bfd_alloc_by_size_t (stdoutput, sizeof (arelent *) * n_relocs + 1);  assert (relocs != 0);  reloc = (arelent *) bfd_alloc_by_size_t (stdoutput,					   sizeof (arelent) * n_relocs);  if (n_relocs > 0)    assert (reloc != 0);  for (i = 0; i < n_relocs; i++)    relocs[i] = &reloc[i];  relocs[n_relocs] = NULL;#ifdef OBJ_ELF  switch (fixp->fx_r_type)    {    default:      assert (n_relocs == 1);      code = *codes[0];      reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym;      reloc->howto = bfd_reloc_type_lookup (stdoutput, code);      reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;      reloc->addend = 0;	/* default */      assert (reloc->howto && code == reloc->howto->type);      /* Now, do any processing that is dependent on the relocation type.  */      switch (code)	{	case R_PARISC_DLTREL21L:	case R_PARISC_DLTREL14R:	case R_PARISC_DLTREL14F:	case R_PARISC_PLABEL32:	case R_PARISC_PLABEL21L:	case R_PARISC_PLABEL14R:	  /* For plabel relocations, the addend of the	     relocation should be either 0 (no static link) or 2	     (static link required).	     FIXME: We always assume no static link!	     We also slam a zero addend into the DLT relative relocs;	     it doesn't make a lot of sense to use any addend since	     it gets you a different (eg unknown) DLT entry.  */	  reloc->addend = 0;	  break;	case R_PARISC_PCREL21L:	case R_PARISC_PCREL17R:	case R_PARISC_PCREL17F:	case R_PARISC_PCREL17C:	case R_PARISC_PCREL14R:	case R_PARISC_PCREL14F:	  /* The constant is stored in the instruction.  */	  reloc->addend = HPPA_R_ADDEND (hppa_fixp->fx_arg_reloc, 0);	  break;	default:	  reloc->addend = fixp->fx_offset;	  break;	}      break;    }#else /* OBJ_SOM */  /* Walk over reach relocation returned by the BFD backend.  */  for (i = 0; i < n_relocs; i++)    {      code = *codes[i];      relocs[i]->sym_ptr_ptr = &fixp->fx_addsy->bsym;      relocs[i]->howto = bfd_reloc_type_lookup (stdoutput, code);      relocs[i]->address = fixp->fx_frag->fr_address + fixp->fx_where;      switch (code)	{	case R_COMP2:	  /* The only time we ever use a R_COMP2 fixup is for the difference	     of two symbols.  With that in mind we fill in all four	     relocs now and break out of the loop.  */	  assert (i == 1);	  relocs[0]->sym_ptr_ptr = &bfd_abs_symbol;	  relocs[0]->howto = bfd_reloc_type_lookup (stdoutput, *codes[0]);	  relocs[0]->address = fixp->fx_frag->fr_address + fixp->fx_where;	  relocs[0]->addend = 0;	  relocs[0]->sym_ptr_ptr = &fixp->fx_addsy->bsym;	  relocs[1]->howto = bfd_reloc_type_lookup (stdoutput, *codes[1]);	  relocs[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;	  relocs[1]->addend = 0;	  relocs[2]->sym_ptr_ptr = &fixp->fx_subsy->bsym;	  relocs[2]->howto = bfd_reloc_type_lookup (stdoutput, *codes[2]);	  relocs[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;	  relocs[2]->addend = 0;	  relocs[3]->sym_ptr_ptr = &bfd_abs_symbol;	  relocs[3]->howto = bfd_reloc_type_lookup (stdoutput, *codes[3]);	  relocs[3]->address = fixp->fx_frag->fr_address + fixp->fx_where;	  relocs[3]->addend = 0;	  relocs[4]->sym_ptr_ptr = &bfd_abs_symbol;	  relocs[4]->howto = bfd_reloc_type_lookup (stdoutput, *codes[4]);	  relocs[4]->address = fixp->fx_frag->fr_address + fixp->fx_where;	  relocs[4]->addend = 0;	  goto done;	case R_PCREL_CALL:	case R_ABS_CALL:	  relocs[i]->addend = HPPA_R_ADDEND (hppa_fixp->fx_arg_reloc, 0);	  break;	case R_DLT_REL:	case R_DATA_PLABEL:	case R_CODE_PLABEL:	  /* For plabel relocations, the addend of the	     relocation should be either 0 (no static link) or 2	     (static link required).	     FIXME: We always assume no static link!	     We also slam a zero addend into the DLT relative relocs;	     it doesn't make a lot of sense to use any addend since	     it gets you a different (eg unknown) DLT entry.  */	  relocs[i]->addend = 0;	  break;	case R_N_MODE:	case R_S_MODE:	case R_D_MODE:	case R_R_MODE:	case R_FSEL:	case R_LSEL:	case R_RSEL:	case R_BEGIN_BRTAB:	case R_END_BRTAB:	  /* There is no symbol or addend associated with these fixups.  */	  relocs[i]->sym_ptr_ptr = &dummy_symbol->bsym;	  relocs[i]->addend = 0;	  break;	case R_ENTRY:	case R_EXIT:	  /* There is no symbol associated with these fixups.  */	  relocs[i]->sym_ptr_ptr = &dummy_symbol->bsym;	  relocs[i]->addend = fixp->fx_offset;	  break;	default:	  relocs[i]->addend = fixp->fx_offset;	}    }#endifdone:  return relocs;}