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.
This commit is contained in:
Alan Modra 2021-07-21 14:39:29 +09:30
parent e28a9225b8
commit 4bf094292c
33 changed files with 121 additions and 149 deletions

View file

@ -2936,12 +2936,7 @@ md_apply_fix (fixS *fixP,
}
else
{
as_bad_where (fixP->fx_file, fixP->fx_line,
_("can't resolve `%s' {%s section} - `%s' {%s section}"),
fx_addsy ? S_GET_NAME (fx_addsy) : "0",
segment_name (add_symbol_segment),
S_GET_NAME (fx_subsy),
segment_name (sub_symbol_segment));
as_bad_subtract (fixP);
return;
}
}

View file

@ -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;
}

View file

@ -573,14 +573,10 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS * fixP)
else
{
/* We only resolve difference expressions in the same section. */
as_bad_where (fixP->fx_file, fixP->fx_line,
_("can't resolve `%s' {%s section} - `%s' {%s section}"),
fixP->fx_addsy ? S_GET_NAME (fixP->fx_addsy) : "0",
segment_name (fixP->fx_addsy
? S_GET_SEGMENT (fixP->fx_addsy)
: absolute_section),
S_GET_NAME (fixP->fx_subsy),
segment_name (S_GET_SEGMENT (fixP->fx_addsy)));
as_bad_subtract (fixP);
free (reloc->sym_ptr_ptr);
free (reloc);
return NULL;
}
}
#ifdef OBJ_ELF

View file

@ -4050,8 +4050,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg)
/* We can'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);
/* This operand-type is scaled. */
if (fixP->fx_r_type == BFD_RELOC_CRIS_LAPCQ_OFFSET)

View file

@ -317,14 +317,10 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS * fixP)
else
{
/* We only resolve difference expressions in the same section. */
as_bad_where (fixP->fx_file, fixP->fx_line,
_("can't resolve `%s' {%s section} - `%s' {%s section}"),
fixP->fx_addsy ? S_GET_NAME (fixP->fx_addsy) : "0",
segment_name (fixP->fx_addsy
? S_GET_SEGMENT (fixP->fx_addsy)
: absolute_section),
S_GET_NAME (fixP->fx_subsy),
segment_name (S_GET_SEGMENT (fixP->fx_addsy)));
as_bad_subtract (fixP);
free (reloc->sym_ptr_ptr);
free (reloc);
return NULL;
}
}

View file

@ -1503,7 +1503,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
/* 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);
op_type = fixP->fx_r_type;
if (op_type & 2048)

View file

@ -1906,7 +1906,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
/* We don't 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);
/* Fetch the instruction, insert the fully resolved operand
value, and stuff the instruction back again. */

View file

@ -570,8 +570,7 @@ md_apply_fix (fixS *fixP ATTRIBUTE_UNUSED,
fixP->fx_r_type = BFD_RELOC_FT32_DIFF32;
break;
default:
as_bad_where (fixP->fx_file, fixP->fx_line,
_("expression too complex"));
as_bad_subtract (fixP);
break;
}
@ -584,7 +583,7 @@ md_apply_fix (fixS *fixP ATTRIBUTE_UNUSED,
/* 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);
switch (fixP->fx_r_type)
{

View file

@ -2298,8 +2298,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
if ((S_GET_SEGMENT (fixp->fx_addsy) != S_GET_SEGMENT (fixp->fx_subsy))
|| S_GET_SEGMENT (fixp->fx_addsy) == undefined_section)
{
as_bad_where (fixp->fx_file, fixp->fx_line,
_("Difference of symbols in different sections is not supported"));
as_bad_subtract (fixp);
return NULL;
}
}

View file

@ -4334,7 +4334,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
/* 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);
/* Patch the instruction with the resolved operand. Elf relocation
info will also be generated to take care of linker/loader fixups.

View file

@ -3742,8 +3742,7 @@ mmix_frob_file (void)
/* This case isn't doable in general anyway, methinks. */
if (fixP->fx_subsy != NULL)
{
as_bad_where (fixP->fx_file, fixP->fx_line,
_("GREG expression too complicated"));
as_bad_subtract (fixP);
continue;
}

View file

@ -762,14 +762,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
/* FIXME: We should try more ways to resolve difference expressions
here. At least this is better than silently ignoring the
subtrahend. */
as_bad_where (fixp->fx_file, fixp->fx_line,
_("can't resolve `%s' {%s section} - `%s' {%s section}"),
fixp->fx_addsy ? S_GET_NAME (fixp->fx_addsy) : "0",
segment_name (fixp->fx_addsy
? S_GET_SEGMENT (fixp->fx_addsy)
: absolute_section),
S_GET_NAME (fixp->fx_subsy),
segment_name (S_GET_SEGMENT (fixp->fx_addsy)));
as_bad_subtract (fixp);
}
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);

View file

@ -7825,8 +7825,7 @@ nds32_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
/* cvt_frag_to_fill () has called output_leb128 () for us. */
break;
default:
as_bad_where (fixP->fx_file, fixP->fx_line,
_("expression too complex"));
as_bad_subtract (fixP);
return;
}
}

View file

@ -7476,7 +7476,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
}
reloc->addend = fixp->fx_addnumber;
if (fixp->fx_subsy && fixp->fx_addsy)
if (fixp->fx_subsy != NULL)
{
relocs[1] = reloc = XNEW (arelent);
relocs[2] = NULL;
@ -7490,9 +7490,11 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
if (reloc->howto == (reloc_howto_type *) NULL)
{
as_bad_where (fixp->fx_file, fixp->fx_line,
_("reloc %d not supported by object file format"),
BFD_RELOC_PPC_NEG);
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;
}
}

View file

@ -742,8 +742,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
diffval /= 4;
break;
default:
as_bad_where (fixP->fx_file, fixP->fx_line,
_("expression too complex"));
as_bad_subtract (fixP);
break;
}
@ -753,7 +752,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
}
/* 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)

View file

@ -3201,8 +3201,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
}
if (fixP->fx_subsy != NULL)
as_bad_where (fixP->fx_file, fixP->fx_line,
_("unsupported symbol subtraction"));
as_bad_subtract (fixP);
/* Add an R_RISCV_RELAX reloc if the reloc is relaxable. */
if (relaxable && fixP->fx_tcbit && fixP->fx_addsy != NULL)

View file

@ -3933,7 +3933,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
/* 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);
/*
Patch the instruction with the resolved operand. Elf relocation

View file

@ -2254,10 +2254,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
where = fixP->fx_frag->fr_literal + fixP->fx_where;
if (fixP->fx_subsy != NULL)
as_bad_where (fixP->fx_file, fixP->fx_line,
_("cannot emit relocation %s against subsy symbol %s"),
bfd_get_reloc_code_name (fixP->fx_r_type),
S_GET_NAME (fixP->fx_subsy));
as_bad_subtract (fixP);
if (fixP->fx_addsy != NULL)
{

View file

@ -868,12 +868,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
arelent *reloc;
reloc = XNEW (arelent);
reloc->sym_ptr_ptr = XNEW (asymbol *);
if (fixp->fx_addsy)
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
else if (fixp->fx_subsy)
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_subsy);
else
abort ();
*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);
if (reloc->howto == (reloc_howto_type *) NULL)
@ -881,6 +876,8 @@ 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;
@ -957,7 +954,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
if (fixP->fx_subsy != (symbolS *) NULL)
{
/* We can't actually support subtracting a symbol. */
as_bad_where (fixP->fx_file, fixP->fx_line, _("expression too complex"));
as_bad_subtract (fixP);
}
if (fixP->fx_addsy != NULL)

View file

@ -1476,7 +1476,7 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
if (fixP->fx_subsy != (symbolS *) NULL)
{
/* We can't actually support subtracting a symbol. */
as_bad_where (fixP->fx_file, fixP->fx_line, _("expression too complex"));
as_bad_subtract (fixP);
}
/* Correct relocation types for pc-relativeness. */

View file

@ -1334,7 +1334,7 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
if (fixP->fx_subsy != (symbolS *) NULL)
{
/* We can't actually support subtracting a symbol. */
as_bad_where (fixP->fx_file, fixP->fx_line, _("expression too complex"));
as_bad_subtract (fixP);
}
/* Correct relocation types for pc-relativeness. */

View file

@ -3447,8 +3447,7 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED)
value -= S_GET_VALUE (fixP->fx_subsy);
else
/* We don't actually support subtracting a symbol. */
as_bad_where (fixP->fx_file, fixP->fx_line,
_("expression too complex"));
as_bad_subtract (fixP);
}
fixP->fx_addnumber = value;
}

View file

@ -279,7 +279,7 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED)
valueT value = * valueP;
if (fixP->fx_subsy != (symbolS *) NULL)
as_bad_where (fixP->fx_file, fixP->fx_line, _("expression too complex"));
as_bad_subtract (fixP);
if (fixP->fx_addsy == NULL)
fixP->fx_done = 1;

View file

@ -283,13 +283,12 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
arelent *rel;
bfd_reloc_code_real_type r_type;
if (fixp->fx_addsy && fixp->fx_subsy)
if (fixp->fx_subsy)
{
if ((S_GET_SEGMENT (fixp->fx_addsy) != S_GET_SEGMENT (fixp->fx_subsy))
|| S_GET_SEGMENT (fixp->fx_addsy) == undefined_section)
{
as_bad_where (fixp->fx_file, fixp->fx_line,
_("Difference of symbols in different sections is not supported"));
as_bad_subtract (fixp);
return NULL;
}
}

View file

@ -660,7 +660,7 @@ md_apply_fix (fixS * fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
/* 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);
where = fixP->fx_frag->fr_literal + fixP->fx_where;
opcode = bfd_getl16 (where);

View file

@ -479,7 +479,7 @@ xstormy16_md_apply_fix (fixS * fixP,
/* 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);
if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
{

View file

@ -6006,7 +6006,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg)
if (fixP->fx_subsy && !(linkrelax && (fixP->fx_r_type == BFD_RELOC_32
|| fixP->fx_r_type == BFD_RELOC_16
|| fixP->fx_r_type == BFD_RELOC_8)))
as_bad_where (fixP->fx_file, fixP->fx_line, _("expression too complex"));
as_bad_subtract (fixP);
switch (fixP->fx_r_type)
{

View file

@ -3853,7 +3853,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED , fixS *fixp)
if (fixp->fx_subsy != NULL)
{
as_bad_where (fixp->fx_file, fixp->fx_line, _("expression too complex"));
as_bad_subtract (fixp);
return NULL;
}

View file

@ -1,61 +1,61 @@
.*/ifunc-2\.s: Assembler messages:
.*/ifunc-2\.s:4: Error: can't resolve `bar1' {\.text\.1 section} - `foo1' {\.text\.1 section}
.*/ifunc-2\.s:5: Error: can't resolve `bar2' {\.text\.2 section} - `foo2' {\.text\.2 section}
.*/ifunc-2\.s:6: Error: can't resolve `bar1' {\.text\.1 section} - `bar2' {\.text\.2 section}
.*/ifunc-2\.s:7: Error: can't resolve `bar2' {\.text\.2 section} - `bar1' {\.text\.1 section}
.*/ifunc-2\.s:8: Error: can't resolve `\.text\.1' {\.text\.1 section} - `bar1' {\.text\.1 section}
.*/ifunc-2\.s:9: Error: can't resolve `\.text\.1' {\.text\.1 section} - `bar2' {\.text\.2 section}
.*/ifunc-2\.s:10: Error: can't resolve `bar1' {\.text\.1 section} - `abs1' {\*ABS\* section}
.*/ifunc-2\.s:11: Error: can't resolve `abs1' {\*ABS\* section} - `bar1' {\.text\.1 section}
.*/ifunc-2\.s:12: Error: can't resolve `\.text\.1' {\.text\.1 section} - `bar1' {\.text\.1 section}
.*/ifunc-2\.s:19: Error: can't resolve `bar1' {\.text\.1 section} - `foo1' {\.text\.1 section}
.*/ifunc-2\.s:20: Error: can't resolve `bar2' {\.text\.2 section} - `foo2' {\.text\.2 section}
.*/ifunc-2\.s:21: Error: can't resolve `bar1' {\.text\.1 section} - `bar2' {\.text\.2 section}
.*/ifunc-2\.s:22: Error: can't resolve `bar2' {\.text\.2 section} - `bar1' {\.text\.1 section}
.*/ifunc-2\.s:23: Error: can't resolve `\.text\.1' {\.text\.1 section} - `bar1' {\.text\.1 section}
.*/ifunc-2\.s:24: Error: can't resolve `\.text\.1' {\.text\.1 section} - `bar2' {\.text\.2 section}
.*/ifunc-2\.s:25: Error: can't resolve `bar1' {\.text\.1 section} - `abs1' {\*ABS\* section}
.*/ifunc-2\.s:26: Error: can't resolve `abs1' {\*ABS\* section} - `bar1' {\.text\.1 section}
.*/ifunc-2\.s:27: Error: can't resolve `\.text\.1' {\.text\.1 section} - `bar1' {\.text\.1 section}
.*/ifunc-2\.s:34: Error: can't resolve `bar1' {\.text\.1 section} - `foo1' {\.text\.1 section}
.*/ifunc-2\.s:35: Error: can't resolve `bar2' {\.text\.2 section} - `foo2' {\.text\.2 section}
.*/ifunc-2\.s:36: Error: can't resolve `bar1' {\.text\.1 section} - `bar2' {\.text\.2 section}
.*/ifunc-2\.s:37: Error: can't resolve `bar2' {\.text\.2 section} - `bar1' {\.text\.1 section}
.*/ifunc-2\.s:38: Error: can't resolve `\.text\.1' {\.text\.1 section} - `bar1' {\.text\.1 section}
.*/ifunc-2\.s:39: Error: can't resolve `\.text\.1' {\.text\.1 section} - `bar2' {\.text\.2 section}
.*/ifunc-2\.s:40: Error: can't resolve `bar1' {\.text\.1 section} - `abs1' {\*ABS\* section}
.*/ifunc-2\.s:41: Error: can't resolve `abs1' {\*ABS\* section} - `bar1' {\.text\.1 section}
.*/ifunc-2\.s:42: Error: can't resolve `\.text\.1' {\.text\.1 section} - `bar1' {\.text\.1 section}
.*/ifunc-2\.s:44: Error: can't resolve `abs1' {\*ABS\* section} - `abs2' {\*ABS\* section}
.*/ifunc-2\.s:45: Error: can't resolve `abs2' {\*ABS\* section} - `abs1' {\*ABS\* section}
.*/ifunc-2\.s:50: Error: can't resolve `abs1' {\*ABS\* section} - `abs2' {\*ABS\* section}
.*/ifunc-2\.s:51: Error: can't resolve `abs2' {\*ABS\* section} - `abs1' {\*ABS\* section}
.*/ifunc-2\.s:56: Error: can't resolve `abs1' {\*ABS\* section} - `abs2' {\*ABS\* section}
.*/ifunc-2\.s:57: Error: can't resolve `abs2' {\*ABS\* section} - `abs1' {\*ABS\* section}
.*/ifunc-2\.s:62: Error: can't resolve `bar1' {\.text\.1 section} - `foo1' {\.text\.1 section}
.*/ifunc-2\.s:63: Error: can't resolve `bar2' {\.text\.2 section} - `foo2' {\.text\.2 section}
.*/ifunc-2\.s:64: Error: can't resolve `bar1' {\.text\.1 section} - `bar2' {\.text\.2 section}
.*/ifunc-2\.s:65: Error: can't resolve `bar2' {\.text\.2 section} - `bar1' {\.text\.1 section}
.*/ifunc-2\.s:66: Error: can't resolve `\.text\.2' {\.text\.2 section} - `bar1' {\.text\.1 section}
.*/ifunc-2\.s:67: Error: can't resolve `\.text\.2' {\.text\.2 section} - `bar2' {\.text\.2 section}
.*/ifunc-2\.s:68: Error: can't resolve `bar2' {\.text\.2 section} - `abs1' {\*ABS\* section}
.*/ifunc-2\.s:69: Error: can't resolve `abs1' {\*ABS\* section} - `bar2' {\.text\.2 section}
.*/ifunc-2\.s:70: Error: can't resolve `\.text\.2' {\.text\.2 section} - `bar2' {\.text\.2 section}
.*/ifunc-2\.s:77: Error: can't resolve `bar1' {\.text\.1 section} - `foo1' {\.text\.1 section}
.*/ifunc-2\.s:78: Error: can't resolve `bar2' {\.text\.2 section} - `foo2' {\.text\.2 section}
.*/ifunc-2\.s:79: Error: can't resolve `bar1' {\.text\.1 section} - `bar2' {\.text\.2 section}
.*/ifunc-2\.s:80: Error: can't resolve `bar2' {\.text\.2 section} - `bar1' {\.text\.1 section}
.*/ifunc-2\.s:81: Error: can't resolve `\.text\.2' {\.text\.2 section} - `bar1' {\.text\.1 section}
.*/ifunc-2\.s:82: Error: can't resolve `\.text\.2' {\.text\.2 section} - `bar2' {\.text\.2 section}
.*/ifunc-2\.s:83: Error: can't resolve `bar2' {\.text\.2 section} - `abs1' {\*ABS\* section}
.*/ifunc-2\.s:84: Error: can't resolve `abs1' {\*ABS\* section} - `bar2' {\.text\.2 section}
.*/ifunc-2\.s:85: Error: can't resolve `\.text\.2' {\.text\.2 section} - `bar2' {\.text\.2 section}
.*/ifunc-2\.s:92: Error: can't resolve `bar1' {\.text\.1 section} - `foo1' {\.text\.1 section}
.*/ifunc-2\.s:93: Error: can't resolve `bar2' {\.text\.2 section} - `foo2' {\.text\.2 section}
.*/ifunc-2\.s:94: Error: can't resolve `bar1' {\.text\.1 section} - `bar2' {\.text\.2 section}
.*/ifunc-2\.s:95: Error: can't resolve `bar2' {\.text\.2 section} - `bar1' {\.text\.1 section}
.*/ifunc-2\.s:96: Error: can't resolve `\.text\.2' {\.text\.2 section} - `bar1' {\.text\.1 section}
.*/ifunc-2\.s:97: Error: can't resolve `\.text\.2' {\.text\.2 section} - `bar2' {\.text\.2 section}
.*/ifunc-2\.s:98: Error: can't resolve `bar2' {\.text\.2 section} - `abs1' {\*ABS\* section}
.*/ifunc-2\.s:99: Error: can't resolve `abs1' {\*ABS\* section} - `bar2' {\.text\.2 section}
.*/ifunc-2\.s:100: Error: can't resolve `\.text\.2' {\.text\.2 section} - `bar2' {\.text\.2 section}
.*/ifunc-2\.s:4: Error: can't resolve bar1 - foo1
.*/ifunc-2\.s:5: Error: can't resolve bar2 - foo2
.*/ifunc-2\.s:6: Error: can't resolve bar1 - bar2
.*/ifunc-2\.s:7: Error: can't resolve bar2 - bar1
.*/ifunc-2\.s:8: Error: can't resolve \.text\.1 - bar1
.*/ifunc-2\.s:9: Error: can't resolve \.text\.1 - bar2
.*/ifunc-2\.s:10: Error: can't resolve bar1 - abs1
.*/ifunc-2\.s:11: Error: can't resolve abs1 - bar1
.*/ifunc-2\.s:12: Error: can't resolve \.text\.1 - bar1
.*/ifunc-2\.s:19: Error: can't resolve bar1 - foo1
.*/ifunc-2\.s:20: Error: can't resolve bar2 - foo2
.*/ifunc-2\.s:21: Error: can't resolve bar1 - bar2
.*/ifunc-2\.s:22: Error: can't resolve bar2 - bar1
.*/ifunc-2\.s:23: Error: can't resolve \.text\.1 - bar1
.*/ifunc-2\.s:24: Error: can't resolve \.text\.1 - bar2
.*/ifunc-2\.s:25: Error: can't resolve bar1 - abs1
.*/ifunc-2\.s:26: Error: can't resolve abs1 - bar1
.*/ifunc-2\.s:27: Error: can't resolve \.text\.1 - bar1
.*/ifunc-2\.s:34: Error: can't resolve bar1 - foo1
.*/ifunc-2\.s:35: Error: can't resolve bar2 - foo2
.*/ifunc-2\.s:36: Error: can't resolve bar1 - bar2
.*/ifunc-2\.s:37: Error: can't resolve bar2 - bar1
.*/ifunc-2\.s:38: Error: can't resolve \.text\.1 - bar1
.*/ifunc-2\.s:39: Error: can't resolve \.text\.1 - bar2
.*/ifunc-2\.s:40: Error: can't resolve bar1 - abs1
.*/ifunc-2\.s:41: Error: can't resolve abs1 - bar1
.*/ifunc-2\.s:42: Error: can't resolve \.text\.1 - bar1
.*/ifunc-2\.s:44: Error: can't resolve abs1 - abs2
.*/ifunc-2\.s:45: Error: can't resolve abs2 - abs1
.*/ifunc-2\.s:50: Error: can't resolve abs1 - abs2
.*/ifunc-2\.s:51: Error: can't resolve abs2 - abs1
.*/ifunc-2\.s:56: Error: can't resolve abs1 - abs2
.*/ifunc-2\.s:57: Error: can't resolve abs2 - abs1
.*/ifunc-2\.s:62: Error: can't resolve bar1 - foo1
.*/ifunc-2\.s:63: Error: can't resolve bar2 - foo2
.*/ifunc-2\.s:64: Error: can't resolve bar1 - bar2
.*/ifunc-2\.s:65: Error: can't resolve bar2 - bar1
.*/ifunc-2\.s:66: Error: can't resolve \.text\.2 - bar1
.*/ifunc-2\.s:67: Error: can't resolve \.text\.2 - bar2
.*/ifunc-2\.s:68: Error: can't resolve bar2 - abs1
.*/ifunc-2\.s:69: Error: can't resolve abs1 - bar2
.*/ifunc-2\.s:70: Error: can't resolve \.text\.2 - bar2
.*/ifunc-2\.s:77: Error: can't resolve bar1 - foo1
.*/ifunc-2\.s:78: Error: can't resolve bar2 - foo2
.*/ifunc-2\.s:79: Error: can't resolve bar1 - bar2
.*/ifunc-2\.s:80: Error: can't resolve bar2 - bar1
.*/ifunc-2\.s:81: Error: can't resolve \.text\.2 - bar1
.*/ifunc-2\.s:82: Error: can't resolve \.text\.2 - bar2
.*/ifunc-2\.s:83: Error: can't resolve bar2 - abs1
.*/ifunc-2\.s:84: Error: can't resolve abs1 - bar2
.*/ifunc-2\.s:85: Error: can't resolve \.text\.2 - bar2
.*/ifunc-2\.s:92: Error: can't resolve bar1 - foo1
.*/ifunc-2\.s:93: Error: can't resolve bar2 - foo2
.*/ifunc-2\.s:94: Error: can't resolve bar1 - bar2
.*/ifunc-2\.s:95: Error: can't resolve bar2 - bar1
.*/ifunc-2\.s:96: Error: can't resolve \.text\.2 - bar1
.*/ifunc-2\.s:97: Error: can't resolve \.text\.2 - bar2
.*/ifunc-2\.s:98: Error: can't resolve bar2 - abs1
.*/ifunc-2\.s:99: Error: can't resolve abs1 - bar2
.*/ifunc-2\.s:100: Error: can't resolve \.text\.2 - bar2

View file

@ -1,5 +1,5 @@
.*\.s: Assembler messages:
.*\.s:10: Error: invalid operands \(\*UND\* and \*UND\* sections\) for `/'
.*\.s:7: Error: PC-relative reference to a different section
.*\.s:8: Error: can't resolve `baz' {\*UND\* section} - `bar' {\*UND\* section}
.*\.s:9: Error: can't resolve `\.text' {\.text section} - `baz' {\*UND\* section}
.*\.s:8: Error: can't resolve baz - bar
.*\.s:9: Error: can't resolve \.text - baz

View file

@ -1,2 +1,2 @@
[^:]*: Assembler messages:
[^:]*:8: Error: can't resolve `a' \{\*UND\* section\} - `b' \{\*UND\* section\}
[^:]*:8: Error: can't resolve a - b

View file

@ -899,6 +899,15 @@ adjust_reloc_syms (bfd *abfd ATTRIBUTE_UNUSED,
dump_section_relocs (abfd, sec, stderr);
}
void
as_bad_subtract (fixS *fixp)
{
as_bad_where (fixp->fx_file, fixp->fx_line,
_("can't resolve %s - %s"),
fixp->fx_addsy ? S_GET_NAME (fixp->fx_addsy) : "0",
S_GET_NAME (fixp->fx_subsy));
}
/* fixup_segment()
Go through all the fixS's in a segment and see which ones can be
@ -1021,12 +1030,7 @@ fixup_segment (fixS *fixP, segT this_segment)
as_bad_where (fixP->fx_file, fixP->fx_line,
_("register value used as expression"));
else
as_bad_where (fixP->fx_file, fixP->fx_line,
_("can't resolve `%s' {%s section} - `%s' {%s section}"),
fixP->fx_addsy ? S_GET_NAME (fixP->fx_addsy) : "0",
segment_name (add_symbol_segment),
S_GET_NAME (fixP->fx_subsy),
segment_name (sub_symbol_segment));
as_bad_subtract (fixP);
}
else if (sub_symbol_segment != undefined_section
&& ! bfd_is_com_section (sub_symbol_segment)

View file

@ -184,5 +184,6 @@ extern fixS *fix_at_start (fragS *, unsigned long, symbolS *,
extern fixS *fix_new_exp (fragS *, unsigned long, unsigned long,
expressionS *, int, bfd_reloc_code_real_type);
extern void write_print_statistics (FILE *);
extern void as_bad_subtract (fixS *);
#endif /* __write_h__ */