[binutils-gdb] gas tc_gen_reloc memory leaks
Alan Modra
amodra@sourceware.org
Wed Jan 1 12:45:47 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3fb6f5457e5b53fdb73a98a24b3764e821e8ccc5
commit 3fb6f5457e5b53fdb73a98a24b3764e821e8ccc5
Author: Alan Modra <amodra@gmail.com>
Date: Wed Jan 1 22:49:04 2025 +1030
gas tc_gen_reloc memory leaks
This makes all the tc_gen_reloc functions and the associated array in
write.c:write_relocs use notes_alloc rather than malloc. tc-hppa.c
tc_gen_reloc gets a few more changes, deleting some dead code, and
tidying code that duplicates prior initialisation.
Diff:
---
gas/cgen.c | 9 ++-
gas/config/tc-aarch64.c | 5 +-
gas/config/tc-alpha.c | 6 +-
gas/config/tc-arc.c | 4 +-
gas/config/tc-arm.c | 5 +-
gas/config/tc-avr.c | 5 +-
gas/config/tc-bfin.c | 9 +--
gas/config/tc-bpf.c | 9 +--
gas/config/tc-cr16.c | 6 +-
gas/config/tc-cris.c | 5 +-
gas/config/tc-crx.c | 6 +-
gas/config/tc-csky.c | 6 +-
gas/config/tc-d10v.c | 4 +-
gas/config/tc-d30v.c | 4 +-
gas/config/tc-dlx.c | 8 +--
gas/config/tc-ft32.c | 5 +-
gas/config/tc-h8300.c | 4 +-
gas/config/tc-hppa.c | 32 +++------
gas/config/tc-i386.c | 4 +-
gas/config/tc-ia64.c | 5 +-
gas/config/tc-kvx.c | 5 +-
gas/config/tc-loongarch.c | 5 +-
gas/config/tc-m32c.c | 7 +-
gas/config/tc-m32r.c | 7 +-
gas/config/tc-m68hc11.c | 4 +-
gas/config/tc-m68k.c | 4 +-
gas/config/tc-mcore.c | 4 +-
gas/config/tc-metag.c | 9 +--
gas/config/tc-microblaze.c | 4 +-
gas/config/tc-mips.c | 7 +-
gas/config/tc-mmix.c | 5 +-
gas/config/tc-mn10200.c | 7 +-
gas/config/tc-mn10300.c | 16 ++---
gas/config/tc-moxie.c | 4 +-
gas/config/tc-msp430.c | 27 ++++---
gas/config/tc-nds32.c | 5 +-
gas/config/tc-ns32k.c | 4 +-
gas/config/tc-or1k.c | 5 +-
gas/config/tc-pdp11.c | 5 +-
gas/config/tc-pj.c | 4 +-
gas/config/tc-ppc.c | 19 ++---
gas/config/tc-pru.c | 7 +-
gas/config/tc-riscv.c | 5 +-
gas/config/tc-rl78.c | 24 +++----
gas/config/tc-rx.c | 172 ++++++++++++++++++++++-----------------------
gas/config/tc-s12z.c | 6 +-
gas/config/tc-s390.c | 4 +-
gas/config/tc-score.c | 10 +--
gas/config/tc-score7.c | 10 +--
gas/config/tc-sh.c | 4 +-
gas/config/tc-sparc.c | 13 ++--
gas/config/tc-spu.c | 6 +-
gas/config/tc-tic30.c | 5 +-
gas/config/tc-tic4x.c | 5 +-
gas/config/tc-tic54x.c | 4 +-
gas/config/tc-tic6x.c | 4 +-
gas/config/tc-tilegx.c | 4 +-
gas/config/tc-tilepro.c | 4 +-
gas/config/tc-v850.c | 9 +--
gas/config/tc-vax.c | 4 +-
gas/config/tc-visium.c | 5 +-
gas/config/tc-wasm32.c | 4 +-
gas/config/tc-xgate.c | 4 +-
gas/config/tc-xtensa.c | 6 +-
gas/config/tc-z80.c | 10 +--
gas/config/tc-z8k.c | 4 +-
gas/write.c | 2 +-
67 files changed, 288 insertions(+), 345 deletions(-)
diff --git a/gas/cgen.c b/gas/cgen.c
index bdadf32430e..030c2f0bebd 100644
--- a/gas/cgen.c
+++ b/gas/cgen.c
@@ -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)
diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index bf594e70960..3046d3d8b5e 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -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;
diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c
index 8d27f7585be..4f5897bd58e 100644
--- a/gas/config/tc-alpha.c
+++ b/gas/config/tc-alpha.c
@@ -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;
diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c
index d62e0a19693..8b69ca6d1f7 100644
--- a/gas/config/tc-arc.c
+++ b/gas/config/tc-arc.c
@@ -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;
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index f977117500c..c2173b730ed 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -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;
diff --git a/gas/config/tc-avr.c b/gas/config/tc-avr.c
index 61398e6823e..5976e58dd33 100644
--- a/gas/config/tc-avr.c
+++ b/gas/config/tc-avr.c
@@ -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;
diff --git a/gas/config/tc-bfin.c b/gas/config/tc-bfin.c
index 44c3661bd9d..d91ca5fa083 100644
--- a/gas/config/tc-bfin.c
+++ b/gas/config/tc-bfin.c
@@ -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;
}
diff --git a/gas/config/tc-bpf.c b/gas/config/tc-bpf.c
index a2923354219..91ef7b3a49c 100644
--- a/gas/config/tc-bpf.c
+++ b/gas/config/tc-bpf.c
@@ -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)
diff --git a/gas/config/tc-cr16.c b/gas/config/tc-cr16.c
index 4f2ef2c1501..4bc6a14187e 100644
--- a/gas/config/tc-cr16.c
+++ b/gas/config/tc-cr16.c
@@ -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;
}
}
diff --git a/gas/config/tc-cris.c b/gas/config/tc-cris.c
index 302e7d06be6..2c002845bcc 100644
--- a/gas/config/tc-cris.c
+++ b/gas/config/tc-cris.c
@@ -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;
diff --git a/gas/config/tc-crx.c b/gas/config/tc-crx.c
index 0561a07c184..7a8db73bb0e 100644
--- a/gas/config/tc-crx.c
+++ b/gas/config/tc-crx.c
@@ -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;
}
}
diff --git a/gas/config/tc-csky.c b/gas/config/tc-csky.c
index 90bc411f792..df98c88459c 100644
--- a/gas/config/tc-csky.c
+++ b/gas/config/tc-csky.c
@@ -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;
diff --git a/gas/config/tc-d10v.c b/gas/config/tc-d10v.c
index eeaf8bcd1bd..d6c2a47a0b5 100644
--- a/gas/config/tc-d10v.c
+++ b/gas/config/tc-d10v.c
@@ -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);
diff --git a/gas/config/tc-d30v.c b/gas/config/tc-d30v.c
index 1971e9227fb..d465b2a2214 100644
--- a/gas/config/tc-d30v.c
+++ b/gas/config/tc-d30v.c
@@ -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);
diff --git a/gas/config/tc-dlx.c b/gas/config/tc-dlx.c
index d77a36b19b4..a3922710a8b 100644
--- a/gas/config/tc-dlx.c
+++ b/gas/config/tc-dlx.c
@@ -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)
diff --git a/gas/config/tc-ft32.c b/gas/config/tc-ft32.c
index 8468df198af..4c177e0b2c6 100644
--- a/gas/config/tc-ft32.c
+++ b/gas/config/tc-ft32.c
@@ -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;
diff --git a/gas/config/tc-h8300.c b/gas/config/tc-h8300.c
index f1dd69edf25..f8e54064166 100644
--- a/gas/config/tc-h8300.c
+++ b/gas/config/tc-h8300.c
@@ -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;
diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c
index 9124e41fcd7..80a142fa466 100644
--- a/gas/config/tc-hppa.c
+++ b/gas/config/tc-hppa.c
@@ -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;
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index cd57972086c..09c0d2154e1 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -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;
diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c
index 5b714ccefdb..b50823270aa 100644
--- a/gas/config/tc-ia64.c
+++ b/gas/config/tc-ia64.c
@@ -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;
diff --git a/gas/config/tc-kvx.c b/gas/config/tc-kvx.c
index 3f641dbff81..02887453b42 100644
--- a/gas/config/tc-kvx.c
+++ b/gas/config/tc-kvx.c
@@ -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;
diff --git a/gas/config/tc-loongarch.c b/gas/config/tc-loongarch.c
index 3ddb7bcf7a7..b0bcdebdd10 100644
--- a/gas/config/tc-loongarch.c
+++ b/gas/config/tc-loongarch.c
@@ -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;
diff --git a/gas/config/tc-m32c.c b/gas/config/tc-m32c.c
index c46162b5c26..b5887b1c6b3 100644
--- a/gas/config/tc-m32c.c
+++ b/gas/config/tc-m32c.c
@@ -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);
diff --git a/gas/config/tc-m32r.c b/gas/config/tc-m32r.c
index 4baa5dfd448..aa0acea7743 100644
--- a/gas/config/tc-m32r.c
+++ b/gas/config/tc-m32r.c
@@ -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')"),
diff --git a/gas/config/tc-m68hc11.c b/gas/config/tc-m68hc11.c
index cc6e86aba07..8c8035ce594 100644
--- a/gas/config/tc-m68hc11.c
+++ b/gas/config/tc-m68hc11.c
@@ -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)
diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c
index 4b24b162bad..1f8f9a8f3c7 100644
--- a/gas/config/tc-m68k.c
+++ b/gas/config/tc-m68k.c
@@ -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)
diff --git a/gas/config/tc-mcore.c b/gas/config/tc-mcore.c
index b02f96ed086..1264577b361 100644
--- a/gas/config/tc-mcore.c
+++ b/gas/config/tc-mcore.c
@@ -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! */
diff --git a/gas/config/tc-metag.c b/gas/config/tc-metag.c
index 4d4c212020f..bf084f7df13 100644
--- a/gas/config/tc-metag.c
+++ b/gas/config/tc-metag.c
@@ -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;
}
diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c
index 97ffe23e3a5..5774eeaefb8 100644
--- a/gas/config/tc-microblaze.c
+++ b/gas/config/tc-microblaze.c
@@ -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);
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 7024744167b..3c338343611 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -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;
diff --git a/gas/config/tc-mmix.c b/gas/config/tc-mmix.c
index 50f17eb44fc..a43774d755c 100644
--- a/gas/config/tc-mmix.c
+++ b/gas/config/tc-mmix.c
@@ -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;
diff --git a/gas/config/tc-mn10200.c b/gas/config/tc-mn10200.c
index 8ce261b1e5c..d630929f8c6 100644
--- a/gas/config/tc-mn10200.c
+++ b/gas/config/tc-mn10200.c
@@ -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;
}
diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c
index e6e0593e05c..08f6a1c6aef 100644
--- a/gas/config/tc-mn10300.c
+++ b/gas/config/tc-mn10300.c
@@ -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;
}
diff --git a/gas/config/tc-moxie.c b/gas/config/tc-moxie.c
index e4ab416ecd8..28bed87536c 100644
--- a/gas/config/tc-moxie.c
+++ b/gas/config/tc-moxie.c
@@ -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;
diff --git a/gas/config/tc-msp430.c b/gas/config/tc-msp430.c
index 69159b219c7..f5c864e4016 100644
--- a/gas/config/tc-msp430.c
+++ b/gas/config/tc-msp430.c
@@ -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;
diff --git a/gas/config/tc-nds32.c b/gas/config/tc-nds32.c
index 41a0739cf21..3de27fdcea9 100644
--- a/gas/config/tc-nds32.c
+++ b/gas/config/tc-nds32.c
@@ -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;
diff --git a/gas/config/tc-ns32k.c b/gas/config/tc-ns32k.c
index 8a417ef8d98..ba30e247dc1 100644
--- a/gas/config/tc-ns32k.c
+++ b/gas/config/tc-ns32k.c
@@ -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)
diff --git a/gas/config/tc-or1k.c b/gas/config/tc-or1k.c
index 1ff5a60659d..5b3e0130628 100644
--- a/gas/config/tc-or1k.c
+++ b/gas/config/tc-or1k.c
@@ -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;
diff --git a/gas/config/tc-pdp11.c b/gas/config/tc-pdp11.c
index 1168b35957c..2ae671082ec 100644
--- a/gas/config/tc-pdp11.c
+++ b/gas/config/tc-pdp11.c
@@ -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;
diff --git a/gas/config/tc-pj.c b/gas/config/tc-pj.c
index 7a8164eaec8..c1243728301 100644
--- a/gas/config/tc-pj.c
+++ b/gas/config/tc-pj.c
@@ -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;
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 9c8b15700d4..1ff1175d02a 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -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;
}
diff --git a/gas/config/tc-pru.c b/gas/config/tc-pru.c
index ea49d55eee8..abf7870bdb0 100644
--- a/gas/config/tc-pru.c
+++ b/gas/config/tc-pru.c
@@ -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; */
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index e7473082c2c..a915c8b4995 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -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;
diff --git a/gas/config/tc-rl78.c b/gas/config/tc-rl78.c
index 89f4bb99666..bcdc87399d3 100644
--- a/gas/config/tc-rl78.c
+++ b/gas/config/tc-rl78.c
@@ -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)
diff --git a/gas/config/tc-rx.c b/gas/config/tc-rx.c
index 9927874c678..7a426d281df 100644
--- a/gas/config/tc-rx.c
+++ b/gas/config/tc-rx.c
@@ -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;
diff --git a/gas/config/tc-s12z.c b/gas/config/tc-s12z.c
index 468410e10ae..3e07ea7c7a7 100644
--- a/gas/config/tc-s12z.c
+++ b/gas/config/tc-s12z.c
@@ -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);
diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c
index 9b1c9947bd1..e7a7e7e04f1 100644
--- a/gas/config/tc-s390.c
+++ b/gas/config/tc-s390.c
@@ -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);
diff --git a/gas/config/tc-score.c b/gas/config/tc-score.c
index c47308af3ce..62bd9ab4a1f 100644
--- a/gas/config/tc-score.c
+++ b/gas/config/tc-score.c
@@ -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));
diff --git a/gas/config/tc-score7.c b/gas/config/tc-score7.c
index 38082a35e0d..07177954e5b 100644
--- a/gas/config/tc-score7.c
+++ b/gas/config/tc-score7.c
@@ -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));
diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c
index e974a38d1a5..fe720e7eae9 100644
--- a/gas/config/tc-sh.c
+++ b/gas/config/tc-sh.c
@@ -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;
diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c
index 484746b9528..c6f8026e5c1 100644
--- a/gas/config/tc-sparc.c
+++ b/gas/config/tc-sparc.c
@@ -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;
diff --git a/gas/config/tc-spu.c b/gas/config/tc-spu.c
index 37484651357..8dba224a952 100644
--- a/gas/config/tc-spu.c
+++ b/gas/config/tc-spu.c
@@ -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;
diff --git a/gas/config/tc-tic30.c b/gas/config/tc-tic30.c
index 8e3b1a0ad74..21efe8a6d50 100644
--- a/gas/config/tc-tic30.c
+++ b/gas/config/tc-tic30.c
@@ -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;
diff --git a/gas/config/tc-tic4x.c b/gas/config/tc-tic4x.c
index 93cbd660b00..c8afd1638a1 100644
--- a/gas/config/tc-tic4x.c
+++ b/gas/config/tc-tic4x.c
@@ -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;
diff --git a/gas/config/tc-tic54x.c b/gas/config/tc-tic54x.c
index b0d98f1ab4a..ee95eb222a8 100644
--- a/gas/config/tc-tic54x.c
+++ b/gas/config/tc-tic54x.c
@@ -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;
diff --git a/gas/config/tc-tic6x.c b/gas/config/tc-tic6x.c
index c5256bf9f0d..b256ddf34df 100644
--- a/gas/config/tc-tic6x.c
+++ b/gas/config/tc-tic6x.c
@@ -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;
diff --git a/gas/config/tc-tilegx.c b/gas/config/tc-tilegx.c
index 2f468a6181b..b63567ba0f7 100644
--- a/gas/config/tc-tilegx.c
+++ b/gas/config/tc-tilegx.c
@@ -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;
diff --git a/gas/config/tc-tilepro.c b/gas/config/tc-tilepro.c
index 43371d8d6fd..38666adc028 100644
--- a/gas/config/tc-tilepro.c
+++ b/gas/config/tc-tilepro.c
@@ -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;
diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c
index 688ec1e9893..d907211ce18 100644
--- a/gas/config/tc-v850.c
+++ b/gas/config/tc-v850.c
@@ -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;
}
diff --git a/gas/config/tc-vax.c b/gas/config/tc-vax.c
index e67dac40a70..d6d5569105d 100644
--- a/gas/config/tc-vax.c
+++ b/gas/config/tc-vax.c
@@ -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
diff --git a/gas/config/tc-visium.c b/gas/config/tc-visium.c
index ae3dbdae03e..975a0c848d4 100644
--- a/gas/config/tc-visium.c
+++ b/gas/config/tc-visium.c
@@ -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;
diff --git a/gas/config/tc-wasm32.c b/gas/config/tc-wasm32.c
index 5a6a264d0b2..e7db729c5f3 100644
--- a/gas/config/tc-wasm32.c
+++ b/gas/config/tc-wasm32.c
@@ -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;
diff --git a/gas/config/tc-xgate.c b/gas/config/tc-xgate.c
index eaf8202c348..1c98f2dffb6 100644
--- a/gas/config/tc-xgate.c
+++ b/gas/config/tc-xgate.c
@@ -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;
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index 11032c9b5f5..25599f8eb3c 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -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;
}
diff --git a/gas/config/tc-z80.c b/gas/config/tc-z80.c
index 767faa4bd95..3805e32b15a 100644
--- a/gas/config/tc-z80.c
+++ b/gas/config/tc-z80.c
@@ -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,
diff --git a/gas/config/tc-z8k.c b/gas/config/tc-z8k.c
index 8f2d62c067f..75fbabb09f5 100644
--- a/gas/config/tc-z8k.c
+++ b/gas/config/tc-z8k.c
@@ -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;
diff --git a/gas/write.c b/gas/write.c
index cde6041536a..d96d8c20dbd 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -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;
More information about the Binutils-cvs
mailing list