diff options
author | Alan Modra <amodra@gmail.com> | 2021-07-21 14:39:29 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2021-07-21 19:35:34 +0930 |
commit | 4bf094292c72b6d316a72ddc60739466c5085d3d (patch) | |
tree | f76789cd3103c27fb5f2ff965ff2b0bf29e6e72e /gas/config/tc-avr.c | |
parent | e28a9225b85f2ee76760b4b93116a5630bdd0699 (diff) | |
download | binutils-4bf094292c72b6d316a72ddc60739466c5085d3d.zip binutils-4bf094292c72b6d316a72ddc60739466c5085d3d.tar.gz binutils-4bf094292c72b6d316a72ddc60739466c5085d3d.tar.bz2 |
as_bad_subtract
Many places report errors of the nature "can't resolve a - b".
This provides a utility function to report such errors consistently.
I removed the section reporting and quotes around symbol names while I
was at it. Compare
ifunc-2.s:4: Error: can't resolve `bar1' {.text.1 section} - `foo1' {.text.1 section}
with
ifunc-2.s:4: Error: can't resolve bar1 - foo1
In many cases the section names don't help the user very much in
figuring out what went wrong, and the quotes if present arguably ought
to be placed around the entire expression:
can't resolve `bar1 - foo1'
The patch also tidies some tc_get_reloc functions that leak memory on
error paths.
* write.h (as_bad_subtract): Declare.
* write.c (as_bad_subtract): New function.
(fixup_segment): Use as_bad_subtract.
* config/tc-arc.c (md_apply_fix): Likewise.
* config/tc-avr.c (md_apply_fix, tc_gen_reloc): Likewise.
* config/tc-cris.c (md_apply_fix): Likewise.
* config/tc-d10v.c (md_apply_fix): Likewise.
* config/tc-d30v.c (md_apply_fix): Likewise.
* config/tc-ft32.c (md_apply_fix): Likewise.
* config/tc-h8300.c (tc_gen_reloc): Likewise.
* config/tc-m68hc11.c (md_apply_fix): Likewise.
* config/tc-mmix.c (mmix_frob_file): Likewise.
* config/tc-mn10200.c (tc_gen_reloc): Likewise.
* config/tc-nds32.c (nds32_apply_fix): Likewise.
* config/tc-pru.c (md_apply_fix): Likewise.
* config/tc-riscv.c (md_apply_fix): Likewise.
* config/tc-s12z.c (md_apply_fix): Likewise.
* config/tc-s390.c (md_apply_fix): Likewise.
* config/tc-tilegx.c (md_apply_fix): Likewise.
* config/tc-tilepro.c (md_apply_fix): Likewise.
* config/tc-v850.c (md_apply_fix): Likewise.
* config/tc-vax.c (md_apply_fix): Likewise.
* config/tc-xc16x.c (tc_gen_reloc): Likewise.
* config/tc-xgate.c (md_apply_fix): Likewise.
* config/tc-xstormy16.c (xstormy16_md_apply_fix): Likewise.
* config/tc-xtensa.c (md_apply_fix): Likewise.
* config/tc-z80.c (tc_gen_reloc): Likewise.
* config/tc-spu.c (md_apply_fix): Likewise.
(tc_gen_reloc): Delete dead code. Free memory on error.
* config/tc-cr16.c (tc_gen_reloc): Use as_bad_subtract. Free
on error.
* config/tc-crx.c (tc_gen_reloc): Likewise.
* config/tc-ppc.c (tc_gen_reloc): Likewise.
* testsuite/gas/i386/ifunc-2.l: Adjust to suit changed error message.
* testsuite/gas/mips/lui-2.l: Likewise.
* testsuite/gas/tic6x/reloc-bad-1.l: Likewise.
Diffstat (limited to 'gas/config/tc-avr.c')
-rw-r--r-- | gas/config/tc-avr.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gas/config/tc-avr.c b/gas/config/tc-avr.c index 397f22d..40dcce7 100644 --- a/gas/config/tc-avr.c +++ b/gas/config/tc-avr.c @@ -1548,7 +1548,7 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg) fixP->fx_r_type = BFD_RELOC_AVR_DIFF32; break; default: - as_bad_where (fixP->fx_file, fixP->fx_line, _("expression too complex")); + as_bad_subtract (fixP); break; } @@ -1560,7 +1560,7 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg) } /* We don't actually support subtracting a symbol. */ if (fixP->fx_subsy != (symbolS *) NULL) - as_bad_where (fixP->fx_file, fixP->fx_line, _("expression too complex")); + as_bad_subtract (fixP); /* For the DIFF relocs, write the value into the object file while still keeping fx_done FALSE, as both the difference (recorded in the object file) @@ -1824,7 +1824,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, if (fixp->fx_subsy != NULL) { - as_bad_where (fixp->fx_file, fixp->fx_line, _("expression too complex")); + as_bad_subtract (fixp); return NULL; } |