@@ -1023,7 +1023,9 @@ gas_cgen_tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP)
bfd_reloc_code_real_type r_type = fixP->fx_r_type;
arelent *reloc;
- reloc = XNEW (arelent);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
+ *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
#ifdef GAS_CGEN_PCREL_R_TYPE
if (fixP->fx_pcrel)
@@ -1031,7 +1033,7 @@ gas_cgen_tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP)
#endif
reloc->howto = bfd_reloc_type_lookup (stdoutput, r_type);
- if (reloc->howto == (reloc_howto_type *) NULL)
+ if (reloc->howto == NULL)
{
as_bad_where (fixP->fx_file, fixP->fx_line,
_("relocation is not supported"));
@@ -1040,9 +1042,6 @@ gas_cgen_tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP)
gas_assert (!fixP->fx_pcrel == !reloc->howto->pc_relative);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
- *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
-
/* Use fx_offset for these cases. */
if (fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY
|| fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT)
@@ -9984,9 +9984,8 @@ tc_gen_reloc (asection * section, fixS * fixp)
arelent *reloc;
bfd_reloc_code_real_type code;
- reloc = XNEW (arelent);
-
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
@@ -6224,8 +6224,8 @@ tc_gen_reloc (asection *sec ATTRIBUTE_UNUSED,
{
arelent *reloc;
- reloc = XNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
@@ -6300,7 +6300,7 @@ tc_gen_reloc (asection *sec ATTRIBUTE_UNUSED,
pname = symbol_get_bfdsym (sym)->name;
}
- udata = XNEW (struct evax_private_udata_struct);
+ udata = notes_alloc (sizeof (*udata));
udata->enbsym = symbol_get_bfdsym (fixp->fx_addsy);
udata->bsym = symbol_get_bfdsym (fixp->tc_fix_data.info->psym);
udata->origname = (char *)pname;
@@ -3251,8 +3251,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED,
arelent *reloc;
bfd_reloc_code_real_type code;
- reloc = XNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
reloc->address = fixP->fx_frag->fr_address + fixP->fx_where;
@@ -29358,9 +29358,8 @@ tc_gen_reloc (asection *section, fixS *fixp)
arelent * reloc;
bfd_reloc_code_real_type code;
- reloc = XNEW (arelent);
-
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
@@ -1838,9 +1838,8 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED,
return NULL;
}
- reloc = XNEW (arelent);
-
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
@@ -798,10 +798,10 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
{
arelent *reloc;
- reloc = XNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
- reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
+ reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc->addend = fixp->fx_offset;
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
@@ -812,9 +812,6 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
/* xgettext:c-format. */
_("reloc %d not supported by object file format"),
(int) fixp->fx_r_type);
-
- xfree (reloc);
-
return NULL;
}
@@ -346,7 +346,9 @@ tc_gen_reloc (asection *sec ATTRIBUTE_UNUSED, fixS *fixP)
bfd_reloc_code_real_type r_type = fixP->fx_r_type;
arelent *reloc;
- reloc = XNEW (arelent);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
+ *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
if (fixP->fx_pcrel)
{
@@ -367,11 +369,6 @@ tc_gen_reloc (asection *sec ATTRIBUTE_UNUSED, fixS *fixP)
return NULL;
}
- //XXX gas_assert (!fixP->fx_pcrel == !reloc->howto->pc_relative);
-
- reloc->sym_ptr_ptr = XNEW (asymbol *);
- *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
-
/* Use fx_offset for these cases. */
if (fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY
|| fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT)
@@ -537,8 +537,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS * fixP)
&& (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section)))
return NULL;
- reloc = XNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
reloc->address = fixP->fx_frag->fr_address + fixP->fx_where;
reloc->addend = fixP->fx_offset;
@@ -574,8 +574,6 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS * fixP)
{
/* We only resolve difference expressions in the same section. */
as_bad_subtract (fixP);
- free (reloc->sym_ptr_ptr);
- free (reloc);
return NULL;
}
}
@@ -3953,9 +3953,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP)
return 0;
}
- relP = XNEW (arelent);
- gas_assert (relP != 0);
- relP->sym_ptr_ptr = XNEW (asymbol *);
+ relP = notes_alloc (sizeof (arelent));
+ relP->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*relP->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
relP->address = fixP->fx_frag->fr_address + fixP->fx_where;
@@ -284,8 +284,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS * fixP)
{
arelent * reloc;
- reloc = XNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
reloc->address = fixP->fx_frag->fr_address + fixP->fx_where;
reloc->addend = fixP->fx_offset;
@@ -318,8 +318,6 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS * fixP)
{
/* We only resolve difference expressions in the same section. */
as_bad_subtract (fixP);
- free (reloc->sym_ptr_ptr);
- free (reloc);
return NULL;
}
}
@@ -5655,10 +5655,10 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP)
if (fixP->fx_pcrel
&& fixP->fx_r_type == BFD_RELOC_CKCORE_ADDR32)
- fixP->fx_r_type = BFD_RELOC_CKCORE_PCREL32;
+ fixP->fx_r_type = BFD_RELOC_CKCORE_PCREL32;
- rel = xmalloc (sizeof (arelent));
- rel->sym_ptr_ptr = xmalloc (sizeof (asymbol *));
+ rel = notes_alloc (sizeof (arelent));
+ rel->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*rel->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
rel->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type);
rel->addend = fixP->fx_offset;
@@ -1450,8 +1450,8 @@ arelent *
tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
{
arelent *reloc;
- reloc = XNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
@@ -1757,8 +1757,8 @@ arelent *
tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
{
arelent *reloc;
- reloc = XNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
@@ -1169,9 +1169,11 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED,
{
arelent * reloc;
- reloc = XNEW (arelent);
- reloc->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
+ *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
+ reloc->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type);
if (reloc->howto == NULL)
{
as_bad_where (fixP->fx_file, fixP->fx_line,
@@ -1183,8 +1185,6 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED,
gas_assert (!fixP->fx_pcrel == !reloc->howto->pc_relative);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
- *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
reloc->address = fixP->fx_frag->fr_address + fixP->fx_where;
if (fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
@@ -690,9 +690,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP)
return NULL;
}
- relP = XNEW (arelent);
- gas_assert (relP != 0);
- relP->sym_ptr_ptr = XNEW (asymbol *);
+ relP = notes_alloc (sizeof (arelent));
+ relP->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*relP->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
relP->address = fixP->fx_frag->fr_address + fixP->fx_where;
@@ -2300,8 +2300,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
}
}
- rel = XNEW (arelent);
- rel->sym_ptr_ptr = XNEW (asymbol *);
+ rel = notes_alloc (sizeof (arelent));
+ rel->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
rel->address = fixp->fx_frag->fr_address + fixp->fx_where;
rel->addend = fixp->fx_offset;
@@ -1348,18 +1348,13 @@ tc_gen_reloc (asection *section, fixS *fixp)
int n_relocs;
int i;
- hppa_fixp = (struct hppa_fix_struct *) fixp->tc_fix_data;
if (fixp->fx_addsy == 0)
return &no_relocs;
+ hppa_fixp = (struct hppa_fix_struct *) fixp->tc_fix_data;
gas_assert (hppa_fixp != 0);
gas_assert (section != 0);
- reloc = XNEW (arelent);
-
- reloc->sym_ptr_ptr = XNEW (asymbol *);
- *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
-
/* Allow fixup_segment to recognize hand-written pc-relative relocations.
When we went through cons_fix_new_hppa, we classified them as complex. */
/* ??? It might be better to hide this +8 stuff in tc_cfi_emit_pcrel_expr,
@@ -1388,11 +1383,10 @@ tc_gen_reloc (asection *section, fixS *fixp)
for (n_relocs = 0; codes[n_relocs]; n_relocs++)
;
- relocs = XNEWVEC (arelent *, n_relocs + 1);
- reloc = XNEWVEC (arelent, n_relocs);
+ relocs = notes_alloc (sizeof (*relocs) * (n_relocs + 1));
+ reloc = notes_alloc (sizeof (*reloc) * n_relocs);
for (i = 0; i < n_relocs; i++)
relocs[i] = &reloc[i];
-
relocs[n_relocs] = NULL;
#ifdef OBJ_ELF
@@ -1447,7 +1441,7 @@ tc_gen_reloc (asection *section, fixS *fixp)
break;
}
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->howto = bfd_reloc_type_lookup (stdoutput,
(bfd_reloc_code_real_type) code);
@@ -1463,7 +1457,7 @@ tc_gen_reloc (asection *section, fixS *fixp)
{
code = *codes[i];
- relocs[i]->sym_ptr_ptr = XNEW (asymbol *);
+ relocs[i]->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*relocs[i]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
relocs[i]->howto =
bfd_reloc_type_lookup (stdoutput,
@@ -1477,20 +1471,12 @@ tc_gen_reloc (asection *section, fixS *fixp)
of two symbols. With that in mind we fill in all four
relocs now and break out of the loop. */
gas_assert (i == 1);
+ /* relocs[0] and relocs[1] have been initialised above. We can
+ use relocs[0]->sym_ptr_ptr allocation for relocs[2]. */
+ relocs[2]->sym_ptr_ptr = relocs[0]->sym_ptr_ptr;
relocs[0]->sym_ptr_ptr = &bfd_abs_section_ptr->symbol;
- relocs[0]->howto
- = bfd_reloc_type_lookup (stdoutput,
- (bfd_reloc_code_real_type) *codes[0]);
- relocs[0]->address = fixp->fx_frag->fr_address + fixp->fx_where;
relocs[0]->addend = 0;
- relocs[1]->sym_ptr_ptr = XNEW (asymbol *);
- *relocs[1]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
- relocs[1]->howto
- = bfd_reloc_type_lookup (stdoutput,
- (bfd_reloc_code_real_type) *codes[1]);
- relocs[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
relocs[1]->addend = 0;
- relocs[2]->sym_ptr_ptr = XNEW (asymbol *);
*relocs[2]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_subsy);
relocs[2]->howto
= bfd_reloc_type_lookup (stdoutput,
@@ -1543,7 +1529,6 @@ tc_gen_reloc (asection *section, fixS *fixp)
case R_N0SEL:
case R_N1SEL:
/* There is no symbol or addend associated with these fixups. */
- relocs[i]->sym_ptr_ptr = XNEW (asymbol *);
*relocs[i]->sym_ptr_ptr = symbol_get_bfdsym (dummy_symbol);
relocs[i]->addend = 0;
break;
@@ -1552,7 +1537,6 @@ tc_gen_reloc (asection *section, fixS *fixp)
case R_ENTRY:
case R_EXIT:
/* There is no symbol associated with these fixups. */
- relocs[i]->sym_ptr_ptr = XNEW (asymbol *);
*relocs[i]->sym_ptr_ptr = symbol_get_bfdsym (dummy_symbol);
relocs[i]->addend = fixp->fx_offset;
break;
@@ -18169,8 +18169,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
code = BFD_RELOC_X86_64_GOTPC64;
}
- rel = XNEW (arelent);
- rel->sym_ptr_ptr = XNEW (asymbol *);
+ rel = notes_alloc (sizeof (arelent));
+ rel->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
rel->address = fixp->fx_frag->fr_address + fixp->fx_where;
@@ -11515,8 +11515,8 @@ tc_gen_reloc (asection *sec ATTRIBUTE_UNUSED, fixS *fixp)
{
arelent *reloc;
- reloc = XNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc->addend = fixp->fx_offset;
@@ -11527,7 +11527,6 @@ tc_gen_reloc (asection *sec ATTRIBUTE_UNUSED, fixS *fixp)
as_bad_where (fixp->fx_file, fixp->fx_line,
_("Cannot represent %s relocation in object file"),
bfd_get_reloc_code_name (fixp->fx_r_type));
- free (reloc);
return NULL;
}
return reloc;
@@ -1914,9 +1914,8 @@ tc_gen_reloc (asection * sec ATTRIBUTE_UNUSED, fixS * fixp)
arelent *reloc;
bfd_reloc_code_real_type code;
- reloc = (arelent *) xmalloc (sizeof (arelent));
-
- reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
@@ -1879,9 +1879,10 @@ md_estimate_size_before_relax (fragS *fragp, asection *sec)
arelent *
tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
{
- arelent *reloc = (arelent *) xmalloc (sizeof (arelent));
+ arelent *reloc;
- reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc->addend = fixp->fx_offset;
@@ -1032,11 +1032,10 @@ tc_gen_reloc (asection *sec, fixS *fx)
|| fx->fx_r_type == BFD_RELOC_M32C_RL_1ADDR
|| fx->fx_r_type == BFD_RELOC_M32C_RL_2ADDR)
{
- arelent * reloc;
+ arelent *reloc;
- reloc = XNEW (arelent);
-
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fx->fx_addsy);
reloc->address = fx->fx_frag->fr_address + fx->fx_where;
reloc->howto = bfd_reloc_type_lookup (stdoutput, fx->fx_r_type);
@@ -2193,9 +2193,8 @@ tc_gen_reloc (asection * section, fixS * fixP)
arelent * reloc;
bfd_reloc_code_real_type code;
- reloc = XNEW (arelent);
-
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
reloc->address = fixP->fx_frag->fr_address + fixP->fx_where;
@@ -2268,7 +2267,7 @@ printf(" => %s",bfd_get_reloc_code_name(code));
printf(" => %s\n",reloc->howto->name);
#endif
- if (reloc->howto == (reloc_howto_type *) NULL)
+ if (reloc->howto == NULL)
{
as_bad_where (fixP->fx_file, fixP->fx_line,
_("internal error: can't export reloc type %d (`%s')"),
@@ -3830,8 +3830,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
{
arelent *reloc;
- reloc = XNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
if (fixp->fx_r_type == 0)
@@ -1282,8 +1282,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
#undef F
#undef MAP
- reloc = XNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
if (!fixp->fx_pcrel)
@@ -2193,8 +2193,8 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
break;
}
- rel = XNEW (arelent);
- rel->sym_ptr_ptr = XNEW (asymbol *);
+ rel = notes_alloc (sizeof (arelent));
+ rel->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
rel->address = fixp->fx_frag->fr_address + fixp->fx_where;
/* Always pass the addend along! */
@@ -7001,10 +7001,10 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
{
arelent *reloc;
- reloc = XNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
- reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
+ reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc->addend = fixp->fx_offset;
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
@@ -7015,9 +7015,6 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
/* xgettext:c-format. */
_("reloc %d not supported by object file format"),
(int) fixp->fx_r_type);
-
- xfree (reloc);
-
return NULL;
}
@@ -2533,8 +2533,8 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
break;
}
- rel = XNEW (arelent);
- rel->sym_ptr_ptr = XNEW (asymbol *);
+ rel = notes_alloc (sizeof (arelent));
+ rel->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
if (code == BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM)
*rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_subsy);
@@ -18381,9 +18381,10 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
arelent *reloc;
bfd_reloc_code_real_type code;
- memset (retval, 0, sizeof(retval));
- reloc = retval[0] = XCNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ memset (retval, 0, sizeof (retval));
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
+ retval[0] = reloc;
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
@@ -2878,9 +2878,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP)
return NULL;
}
- relP = XNEW (arelent);
- gas_assert (relP != 0);
- relP->sym_ptr_ptr = XNEW (asymbol *);
+ relP = notes_alloc (sizeof (arelent));
+ relP->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*relP->sym_ptr_ptr = baddsy;
relP->address = fixP->fx_frag->fr_address + fixP->fx_where;
@@ -748,7 +748,10 @@ arelent *
tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
{
arelent *reloc;
- reloc = XNEW (arelent);
+
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
+ *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
if (fixp->fx_subsy != NULL)
{
@@ -774,8 +777,6 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
return NULL;
}
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
- reloc->sym_ptr_ptr = XNEW (asymbol *);
- *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->addend = fixp->fx_offset;
return reloc;
}
@@ -2169,7 +2169,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
static arelent * relocs[MAX_RELOC_EXPANSION + 1];
arelent *reloc;
- reloc = XNEW (arelent);
+ reloc = notes_alloc (sizeof (arelent));
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
if (reloc->howto == NULL)
@@ -2177,8 +2177,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
as_bad_where (fixp->fx_file, fixp->fx_line,
_("reloc %d not supported by object file format"),
(int) fixp->fx_r_type);
- free (reloc);
- return & no_relocs;
+ return &no_relocs;
}
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
@@ -2205,7 +2204,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
even local symbols defined in the same section. */
if (ssec != absolute_section || asec != absolute_section)
{
- arelent * reloc2 = XNEW (arelent);
+ arelent *reloc2 = notes_alloc (sizeof (arelent));
relocs[0] = reloc2;
relocs[1] = reloc;
@@ -2213,7 +2212,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
reloc2->address = reloc->address;
reloc2->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_MN10300_SYM_DIFF);
reloc2->addend = - S_GET_VALUE (fixp->fx_subsy);
- reloc2->sym_ptr_ptr = XNEW (asymbol *);
+ reloc2->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc2->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_subsy);
reloc->addend = fixp->fx_offset;
@@ -2224,7 +2223,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
}
else
{
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
}
@@ -2262,13 +2261,12 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
return relocs;
}
- free (reloc);
- return & no_relocs;
+ return &no_relocs;
}
}
else
{
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->addend = fixp->fx_offset;
}
@@ -777,8 +777,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP)
return 0;
}
- relP = XNEW (arelent);
- relP->sym_ptr_ptr = XNEW (asymbol *);
+ relP = notes_alloc (sizeof (arelent));
+ relP->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*relP->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
relP->address = fixP->fx_frag->fr_address + fixP->fx_where;
@@ -4629,23 +4629,22 @@ S_IS_GAS_LOCAL (symbolS * s)
then it is done here. */
arelent **
-tc_gen_reloc (asection * seg ATTRIBUTE_UNUSED, fixS * fixp)
+tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
{
- static arelent * no_relocs = NULL;
- static arelent * relocs[MAX_RELOC_EXPANSION + 1];
+ static arelent *no_relocs = NULL;
+ static arelent *relocs[MAX_RELOC_EXPANSION + 1];
arelent *reloc;
- reloc = XNEW (arelent);
+ reloc = notes_alloc (sizeof (arelent));
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
- if (reloc->howto == (reloc_howto_type *) NULL)
+ if (reloc->howto == NULL)
{
as_bad_where (fixp->fx_file, fixp->fx_line,
_("reloc %d not supported by object file format"),
(int) fixp->fx_r_type);
- free (reloc);
- return & no_relocs;
+ return &no_relocs;
}
relocs[0] = reloc;
@@ -4686,7 +4685,7 @@ tc_gen_reloc (asection * seg ATTRIBUTE_UNUSED, fixS * fixp)
&& ! S_IS_GAS_LOCAL (fixp->fx_addsy)
&& ! S_IS_GAS_LOCAL (fixp->fx_subsy))
{
- arelent * reloc2 = XNEW (arelent);
+ arelent *reloc2 = notes_alloc (sizeof (arelent));
relocs[0] = reloc2;
relocs[1] = reloc;
@@ -4700,7 +4699,7 @@ tc_gen_reloc (asection * seg ATTRIBUTE_UNUSED, fixS * fixp)
reloc2->sym_ptr_ptr = &bfd_abs_section_ptr->symbol;
else
{
- reloc2->sym_ptr_ptr = XNEW (asymbol *);
+ reloc2->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc2->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_subsy);
}
@@ -4712,7 +4711,7 @@ tc_gen_reloc (asection * seg ATTRIBUTE_UNUSED, fixS * fixp)
}
else
{
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
}
@@ -4750,8 +4749,7 @@ tc_gen_reloc (asection * seg ATTRIBUTE_UNUSED, fixS * fixp)
return relocs;
}
- free (reloc);
- return & no_relocs;
+ return &no_relocs;
}
}
else
@@ -4764,11 +4762,10 @@ tc_gen_reloc (asection * seg ATTRIBUTE_UNUSED, fixS * fixp)
char *fixpos = fixp->fx_where + fixp->fx_frag->fr_literal;
md_number_to_chars (fixpos, amount, 2);
- free (reloc);
- return & no_relocs;
+ return &no_relocs;
}
#endif
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->addend = fixp->fx_offset;
@@ -7826,9 +7826,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP)
arelent *reloc;
bfd_reloc_code_real_type code;
- reloc = XNEW (arelent);
-
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
reloc->address = fixP->fx_frag->fr_address + fixP->fx_where;
@@ -2226,8 +2226,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
code = reloc (fixp->fx_size, fixp->fx_pcrel, fix_im_disp (fixp));
- rel = XNEW (arelent);
- rel->sym_ptr_ptr = XNEW (asymbol *);
+ rel = notes_alloc (sizeof (arelent));
+ rel->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
rel->address = fixp->fx_frag->fr_address + fixp->fx_where;
if (fixp->fx_pcrel)
@@ -298,9 +298,8 @@ tc_gen_reloc (asection * section, fixS * fixp)
arelent *reloc;
bfd_reloc_code_real_type code;
- reloc = XNEW (arelent);
-
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
@@ -1430,9 +1430,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED,
arelent *reloc;
bfd_reloc_code_real_type code;
- reloc = XNEW (arelent);
-
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
@@ -473,8 +473,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
arelent *rel;
bfd_reloc_code_real_type r_type;
- rel = XNEW (arelent);
- rel->sym_ptr_ptr = XNEW (asymbol *);
+ rel = notes_alloc (sizeof (arelent));
+ rel->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
rel->address = fixp->fx_frag->fr_address + fixp->fx_where;
@@ -7747,17 +7747,17 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
static arelent *relocs[3];
arelent *reloc;
- relocs[0] = reloc = XNEW (arelent);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
+ relocs[0] = reloc;
relocs[1] = NULL;
-
- reloc->sym_ptr_ptr = XNEW (asymbol *);
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
/* BFD_RELOC_PPC64_TLS_PCREL generates R_PPC64_TLS with an odd r_offset. */
if (fixp->fx_r_type == BFD_RELOC_PPC64_TLS_PCREL)
reloc->address++;
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
- if (reloc->howto == (reloc_howto_type *) NULL)
+ if (reloc->howto == NULL)
{
as_bad_where (fixp->fx_file, fixp->fx_line,
_("reloc %d not supported by object file format"),
@@ -7768,10 +7768,10 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
if (fixp->fx_subsy != NULL)
{
- relocs[1] = reloc = XNEW (arelent);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
+ relocs[1] = reloc;
relocs[2] = NULL;
-
- reloc->sym_ptr_ptr = XNEW (asymbol *);
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_subsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
@@ -7781,15 +7781,10 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
if (reloc->howto == (reloc_howto_type *) NULL)
{
as_bad_subtract (fixp);
- free (relocs[1]->sym_ptr_ptr);
- free (relocs[1]);
- free (relocs[0]->sym_ptr_ptr);
- free (relocs[0]);
relocs[0] = NULL;
}
}
-
return relocs;
}
@@ -1766,10 +1766,11 @@ pru_fix_adjustable (fixS *fixp)
arelent *
tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
{
- arelent *reloc = XNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
- *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
+ arelent *reloc;
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
+ *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc->addend = fixp->fx_offset; /* fixp->fx_addnumber; */
@@ -5200,9 +5200,10 @@ md_estimate_size_before_relax (fragS *fragp, asection *segtype)
arelent *
tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
{
- arelent *reloc = (arelent *) xmalloc (sizeof (arelent));
+ arelent *reloc;
- reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc->addend = fixp->fx_addnumber;
@@ -1257,11 +1257,11 @@ tc_gen_reloc (asection * seg ATTRIBUTE_UNUSED, fixS * fixp)
fixp->fx_subsy = NULL;
}
- reloc[0] = XNEW (arelent);
- reloc[0]->sym_ptr_ptr = XNEW (asymbol *);
- * reloc[0]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
- reloc[0]->address = fixp->fx_frag->fr_address + fixp->fx_where;
- reloc[0]->addend = fixp->fx_offset;
+ reloc[0] = notes_alloc (sizeof (arelent));
+ reloc[0]->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
+ *reloc[0]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
+ reloc[0]->address = fixp->fx_frag->fr_address + fixp->fx_where;
+ reloc[0]->addend = fixp->fx_offset;
if (fixp->fx_r_type == BFD_RELOC_RL78_32_OP
&& fixp->fx_subsy)
@@ -1269,13 +1269,13 @@ tc_gen_reloc (asection * seg ATTRIBUTE_UNUSED, fixS * fixp)
fixp->fx_r_type = BFD_RELOC_RL78_DIFF;
}
-#define OPX(REL,SYM,ADD) \
- reloc[rp] = XNEW (arelent); \
- reloc[rp]->sym_ptr_ptr = XNEW (asymbol *); \
- reloc[rp]->howto = bfd_reloc_type_lookup (stdoutput, REL); \
- reloc[rp]->addend = ADD; \
- * reloc[rp]->sym_ptr_ptr = SYM; \
- reloc[rp]->address = fixp->fx_frag->fr_address + fixp->fx_where; \
+#define OPX(REL,SYM,ADD) \
+ reloc[rp] = notes_alloc (sizeof (arelent)); \
+ reloc[rp]->sym_ptr_ptr = notes_alloc (sizeof (asymbol *)); \
+ reloc[rp]->howto = bfd_reloc_type_lookup (stdoutput, REL); \
+ reloc[rp]->addend = ADD; \
+ *reloc[rp]->sym_ptr_ptr = SYM; \
+ reloc[rp]->address = fixp->fx_frag->fr_address + fixp->fx_where; \
reloc[++rp] = NULL
#define OPSYM(SYM) OPX(BFD_RELOC_RL78_SYM, SYM, 0)
@@ -2466,11 +2466,11 @@ tc_gen_reloc (asection * sec ATTRIBUTE_UNUSED, fixS * fixp)
fixp->fx_subsy = NULL;
}
- reloc[0] = XNEW (arelent);
- reloc[0]->sym_ptr_ptr = XNEW (asymbol *);
- * reloc[0]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
- reloc[0]->address = fixp->fx_frag->fr_address + fixp->fx_where;
- reloc[0]->addend = fixp->fx_offset;
+ reloc[0] = notes_alloc (sizeof (arelent));
+ reloc[0]->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
+ *reloc[0]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
+ reloc[0]->address = fixp->fx_frag->fr_address + fixp->fx_where;
+ reloc[0]->addend = fixp->fx_offset;
if (fixp->fx_r_type == BFD_RELOC_RX_32_OP
&& fixp->fx_subsy)
@@ -2487,54 +2487,54 @@ tc_gen_reloc (asection * sec ATTRIBUTE_UNUSED, fixS * fixp)
switch (fixp->fx_r_type)
{
case BFD_RELOC_RX_DIFF:
- reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
-
- reloc[1] = XNEW (arelent);
- reloc[1]->sym_ptr_ptr = XNEW (asymbol *);
- * reloc[1]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_subsy);
- reloc[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
- reloc[1]->addend = 0;
- reloc[1]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
-
- reloc[2] = XNEW (arelent);
- reloc[2]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_OP_SUBTRACT);
- reloc[2]->addend = 0;
- reloc[2]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
- reloc[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
-
- reloc[3] = XNEW (arelent);
+ reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
+
+ reloc[1] = notes_alloc (sizeof (arelent));
+ reloc[1]->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
+ *reloc[1]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_subsy);
+ reloc[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
+ reloc[1]->addend = 0;
+ reloc[1]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
+
+ reloc[2] = notes_alloc (sizeof (arelent));
+ reloc[2]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_OP_SUBTRACT);
+ reloc[2]->addend = 0;
+ reloc[2]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
+ reloc[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
+
+ reloc[3] = notes_alloc (sizeof (arelent));
switch (fixp->fx_size)
{
case 1:
- reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS8);
+ reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS8);
break;
case 2:
if (!is_opcode && target_big_endian)
- reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS16_REV);
+ reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS16_REV);
else if (is_opcode)
- reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS16UL);
+ reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS16UL);
else
- reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS16);
+ reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS16);
break;
case 4:
if (!is_opcode && target_big_endian)
- reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS32_REV);
+ reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS32_REV);
else
- reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS32);
+ reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS32);
break;
}
- reloc[3]->addend = 0;
+ reloc[3]->addend = 0;
reloc[3]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
- reloc[3]->address = fixp->fx_frag->fr_address + fixp->fx_where;
+ reloc[3]->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc[4] = NULL;
break;
case BFD_RELOC_RX_GPRELL:
- reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
+ reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
- reloc[1] = XNEW (arelent);
- reloc[1]->sym_ptr_ptr = XNEW (asymbol *);
+ reloc[1] = notes_alloc (sizeof (arelent));
+ reloc[1]->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
if (gp_symbol == NULL)
{
if (symbol_table_frozen)
@@ -2550,31 +2550,31 @@ tc_gen_reloc (asection * sec ATTRIBUTE_UNUSED, fixS * fixp)
else
gp_symbol = symbol_get_bfdsym (symbol_find_or_make ("__gp"));
}
- * reloc[1]->sym_ptr_ptr = gp_symbol;
- reloc[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
- reloc[1]->addend = 0;
- reloc[1]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
-
- reloc[2] = XNEW (arelent);
- reloc[2]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_OP_SUBTRACT);
- reloc[2]->addend = 0;
+ *reloc[1]->sym_ptr_ptr = gp_symbol;
+ reloc[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
+ reloc[1]->addend = 0;
+ reloc[1]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
+
+ reloc[2] = notes_alloc (sizeof (arelent));
+ reloc[2]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_OP_SUBTRACT);
+ reloc[2]->addend = 0;
reloc[2]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
- reloc[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
+ reloc[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
- reloc[3] = XNEW (arelent);
- reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS16UL);
- reloc[3]->addend = 0;
+ reloc[3] = notes_alloc (sizeof (arelent));
+ reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS16UL);
+ reloc[3]->addend = 0;
reloc[3]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
- reloc[3]->address = fixp->fx_frag->fr_address + fixp->fx_where;
+ reloc[3]->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc[4] = NULL;
break;
case BFD_RELOC_RX_GPRELW:
- reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
+ reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
- reloc[1] = XNEW (arelent);
- reloc[1]->sym_ptr_ptr = XNEW (asymbol *);
+ reloc[1] = notes_alloc (sizeof (arelent));
+ reloc[1]->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
if (gp_symbol == NULL)
{
if (symbol_table_frozen)
@@ -2590,31 +2590,31 @@ tc_gen_reloc (asection * sec ATTRIBUTE_UNUSED, fixS * fixp)
else
gp_symbol = symbol_get_bfdsym (symbol_find_or_make ("__gp"));
}
- * reloc[1]->sym_ptr_ptr = gp_symbol;
- reloc[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
- reloc[1]->addend = 0;
- reloc[1]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
-
- reloc[2] = XNEW (arelent);
- reloc[2]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_OP_SUBTRACT);
- reloc[2]->addend = 0;
+ *reloc[1]->sym_ptr_ptr = gp_symbol;
+ reloc[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
+ reloc[1]->addend = 0;
+ reloc[1]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
+
+ reloc[2] = notes_alloc (sizeof (arelent));
+ reloc[2]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_OP_SUBTRACT);
+ reloc[2]->addend = 0;
reloc[2]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
- reloc[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
+ reloc[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
- reloc[3] = XNEW (arelent);
- reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS16UW);
- reloc[3]->addend = 0;
+ reloc[3] = notes_alloc (sizeof (arelent));
+ reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS16UW);
+ reloc[3]->addend = 0;
reloc[3]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
- reloc[3]->address = fixp->fx_frag->fr_address + fixp->fx_where;
+ reloc[3]->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc[4] = NULL;
break;
case BFD_RELOC_RX_GPRELB:
- reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
+ reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
- reloc[1] = XNEW (arelent);
- reloc[1]->sym_ptr_ptr = XNEW (asymbol *);
+ reloc[1] = notes_alloc (sizeof (arelent));
+ reloc[1]->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
if (gp_symbol == NULL)
{
if (symbol_table_frozen)
@@ -2630,40 +2630,40 @@ tc_gen_reloc (asection * sec ATTRIBUTE_UNUSED, fixS * fixp)
else
gp_symbol = symbol_get_bfdsym (symbol_find_or_make ("__gp"));
}
- * reloc[1]->sym_ptr_ptr = gp_symbol;
- reloc[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
- reloc[1]->addend = 0;
- reloc[1]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
-
- reloc[2] = XNEW (arelent);
- reloc[2]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_OP_SUBTRACT);
- reloc[2]->addend = 0;
+ *reloc[1]->sym_ptr_ptr = gp_symbol;
+ reloc[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
+ reloc[1]->addend = 0;
+ reloc[1]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
+
+ reloc[2] = notes_alloc (sizeof (arelent));
+ reloc[2]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_OP_SUBTRACT);
+ reloc[2]->addend = 0;
reloc[2]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
- reloc[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
+ reloc[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
- reloc[3] = XNEW (arelent);
- reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS16U);
- reloc[3]->addend = 0;
+ reloc[3] = notes_alloc (sizeof (arelent));
+ reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS16U);
+ reloc[3]->addend = 0;
reloc[3]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
- reloc[3]->address = fixp->fx_frag->fr_address + fixp->fx_where;
+ reloc[3]->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc[4] = NULL;
break;
case BFD_RELOC_RX_NEG32:
- reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
+ reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
- reloc[1] = XNEW (arelent);
- reloc[1]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_OP_NEG);
- reloc[1]->addend = 0;
+ reloc[1] = notes_alloc (sizeof (arelent));
+ reloc[1]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_OP_NEG);
+ reloc[1]->addend = 0;
reloc[1]->sym_ptr_ptr = reloc[0]->sym_ptr_ptr;
- reloc[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
+ reloc[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
- reloc[2] = XNEW (arelent);
- reloc[2]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS32);
- reloc[2]->addend = 0;
+ reloc[2] = notes_alloc (sizeof (arelent));
+ reloc[2]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS32);
+ reloc[2]->addend = 0;
reloc[2]->sym_ptr_ptr = reloc[0]->sym_ptr_ptr;
- reloc[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
+ reloc[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc[3] = NULL;
break;
@@ -3884,8 +3884,10 @@ md_estimate_size_before_relax (fragS *fragP ATTRIBUTE_UNUSED, asection *segment
arelent *
tc_gen_reloc (asection *section, fixS *fixp)
{
- arelent *reloc = XNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ arelent *reloc;
+
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
@@ -2824,8 +2824,8 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
code = BFD_RELOC_390_GOTPCDBL;
}
- reloc = XNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc->howto = bfd_reloc_type_lookup (stdoutput, code);
@@ -7311,10 +7311,10 @@ s3_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
bfd_reloc_code_real_type code;
const char *type;
- reloc = retval[0] = XNEW (arelent);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
+ retval[0] = reloc;
retval[1] = NULL;
-
- reloc->sym_ptr_ptr = XNEW (asymbol *);
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc->addend = fixp->fx_offset;
@@ -7342,9 +7342,9 @@ s3_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
newval |= (((off >> 14) & 0x3) << 16);
s3_md_number_to_chars (buf, newval, s3_INSN_SIZE);
- retval[1] = XNEW (arelent);
+ retval[1] = notes_alloc (sizeof (arelent));
+ retval[1]->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
retval[2] = NULL;
- retval[1]->sym_ptr_ptr = XNEW (asymbol *);
*retval[1]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
retval[1]->address = (reloc->address + s3_RELAX_RELOC2 (fixp->fx_frag->fr_subtype));
@@ -6813,10 +6813,10 @@ s7_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
bfd_reloc_code_real_type code;
const char *type;
- reloc = retval[0] = XNEW (arelent);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
+ retval[0] = reloc;
retval[1] = NULL;
-
- reloc->sym_ptr_ptr = XNEW (asymbol *);
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc->addend = fixp->fx_offset;
@@ -6844,9 +6844,9 @@ s7_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
newval |= (((off >> 14) & 0x3) << 16);
s7_number_to_chars (buf, newval, s7_INSN_SIZE);
- retval[1] = XNEW (arelent);
+ retval[1] = notes_alloc (sizeof (arelent));
+ retval[2]->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
retval[2] = NULL;
- retval[1]->sym_ptr_ptr = XNEW (asymbol *);
*retval[1]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
retval[1]->address = (reloc->address + s7_RELAX_RELOC2 (fixp->fx_frag->fr_subtype));
@@ -3838,8 +3838,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
arelent *rel;
bfd_reloc_code_real_type r_type;
- rel = XNEW (arelent);
- rel->sym_ptr_ptr = XNEW (asymbol *);
+ rel = notes_alloc (sizeof (arelent));
+ rel->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
rel->address = fixp->fx_frag->fr_address + fixp->fx_where;
@@ -3834,10 +3834,10 @@ tc_gen_reloc (asection *section, fixS *fixp)
arelent *reloc;
bfd_reloc_code_real_type code;
- relocs[0] = reloc = XNEW (arelent);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
+ relocs[0] = reloc;
relocs[1] = NULL;
-
- reloc->sym_ptr_ptr = XNEW (asymbol *);
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
@@ -4014,7 +4014,6 @@ tc_gen_reloc (asection *section, fixS *fixp)
as_bad_where (fixp->fx_file, fixp->fx_line,
_("internal error: can't export reloc type %d (`%s')"),
fixp->fx_r_type, bfd_get_reloc_code_name (code));
- xfree (reloc);
relocs[0] = NULL;
return relocs;
}
@@ -4040,10 +4039,10 @@ tc_gen_reloc (asection *section, fixS *fixp)
on the same location. */
if (code == BFD_RELOC_SPARC_OLO10)
{
- relocs[1] = reloc = XNEW (arelent);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
+ relocs[1] = reloc;
relocs[2] = NULL;
-
- reloc->sym_ptr_ptr = XNEW (asymbol *);
*reloc->sym_ptr_ptr
= symbol_get_bfdsym (section_symbol (absolute_section));
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
@@ -867,8 +867,8 @@ arelent *
tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
{
arelent *reloc;
- reloc = XNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
@@ -877,8 +877,6 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
as_bad_where (fixp->fx_file, fixp->fx_line,
_("reloc %d not supported by object file format"),
(int) fixp->fx_r_type);
- free (reloc->sym_ptr_ptr);
- free (reloc);
return NULL;
}
reloc->addend = fixp->fx_addnumber;
@@ -1367,9 +1367,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP)
#undef MAP
#undef F
- rel = XNEW (arelent);
- gas_assert (rel != 0);
- rel->sym_ptr_ptr = XNEW (asymbol *);
+ rel = notes_alloc (sizeof (arelent));
+ rel->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*rel->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
rel->address = fixP->fx_frag->fr_address + fixP->fx_where;
rel->addend = 0;
@@ -2998,9 +2998,8 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixP)
{
arelent *reloc;
- reloc = XNEW (arelent);
-
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
reloc->address = fixP->fx_frag->fr_address + fixP->fx_where;
reloc->address /= OCTETS_PER_BYTE;
@@ -5095,8 +5095,8 @@ tc_gen_reloc (asection *section, fixS *fixP)
bfd_reloc_code_real_type code = fixP->fx_r_type;
asymbol *sym = symbol_get_bfdsym (fixP->fx_addsy);
- rel = XNEW (arelent);
- rel->sym_ptr_ptr = XNEW (asymbol *);
+ rel = notes_alloc (sizeof (arelent));
+ rel->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*rel->sym_ptr_ptr = sym;
/* We assume that all rel->address are host byte offsets. */
rel->address = fixP->fx_frag->fr_address + fixP->fx_where;
@@ -4500,8 +4500,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
asymbol *symbol;
bfd_reloc_code_real_type r_type;
- reloc = XNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
symbol = symbol_get_bfdsym (fixp->fx_addsy);
*reloc->sym_ptr_ptr = symbol;
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
@@ -1729,8 +1729,8 @@ tc_gen_reloc (asection *sec ATTRIBUTE_UNUSED, fixS *fixp)
{
arelent *reloc;
- reloc = XNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
@@ -1506,8 +1506,8 @@ tc_gen_reloc (asection *sec ATTRIBUTE_UNUSED, fixS *fixp)
{
arelent *reloc;
- reloc = XNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
@@ -3329,10 +3329,10 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
{
arelent *reloc;
- reloc = XNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
- reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
+ reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
if ( fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY
|| fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT
@@ -3359,9 +3359,6 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
/* xgettext:c-format */
_("reloc %d not supported by object file format"),
(int) fixp->fx_r_type);
-
- xfree (reloc);
-
return NULL;
}
@@ -2345,8 +2345,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
#undef F
#undef MAP
- reloc = XNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
#ifndef OBJ_ELF
@@ -111,9 +111,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
arelent *reloc;
bfd_reloc_code_real_type code;
- reloc = XNEW (arelent);
-
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
@@ -797,8 +797,8 @@ tc_gen_reloc (asection * sec ATTRIBUTE_UNUSED, fixS * fixp)
{
arelent *reloc;
- reloc = (arelent *) xmalloc (sizeof (*reloc));
- reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
@@ -614,8 +614,8 @@ tc_gen_reloc (asection * section ATTRIBUTE_UNUSED, fixS * fixp)
{
arelent * reloc;
- reloc = XNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
@@ -6158,8 +6158,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
{
arelent *reloc;
- reloc = XNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
@@ -6175,8 +6175,6 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
as_bad_where (fixp->fx_file, fixp->fx_line,
_("cannot represent `%s' relocation in object file"),
bfd_get_reloc_code_name (fixp->fx_r_type));
- free (reloc->sym_ptr_ptr);
- free (reloc);
return NULL;
}
@@ -3859,12 +3859,12 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED , fixS *fixp)
return NULL;
}
- reloc = XNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
- reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
- reloc->addend = fixp->fx_offset;
- reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
+ reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
+ reloc->addend = fixp->fx_offset;
+ reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
if (reloc->howto == NULL)
{
as_bad_where (fixp->fx_file, fixp->fx_line,
@@ -1375,8 +1375,8 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED,
{
arelent *reloc;
- reloc = XNEW (arelent);
- reloc->sym_ptr_ptr = XNEW (asymbol *);
+ reloc = notes_alloc (sizeof (arelent));
+ reloc->sym_ptr_ptr = notes_alloc (sizeof (asymbol *));
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc->addend = fixp->fx_offset;
@@ -1294,7 +1294,7 @@ write_relocs (bfd *abfd ATTRIBUTE_UNUSED, asection *sec,
rp = &r->next;
}
- relocs = XCNEWVEC (arelent *, n);
+ relocs = notes_alloc (n * sizeof (arelent *));
n = 0;
r = my_reloc_list;