Fix for PR 16299: Do not assume that bad relocations always have an associated symbol.
This commit is contained in:
parent
9d1b068967
commit
644a26542c
|
@ -1,3 +1,8 @@
|
||||||
|
Wed Oct 7 14:09:14 1998 Nick Clifton <nickc@cygnus.com>
|
||||||
|
|
||||||
|
* config/tc-d30v.c (md_apply_fix3): Do not assume that bad
|
||||||
|
relocations are always associated with a symbol.
|
||||||
|
|
||||||
Tue Oct 6 09:31:15 1998 Catherine Moore <clm@cygnus.com>
|
Tue Oct 6 09:31:15 1998 Catherine Moore <clm@cygnus.com>
|
||||||
|
|
||||||
* tc-sparc.h (TC_FORCE_RELOCATION): Define.
|
* tc-sparc.h (TC_FORCE_RELOCATION): Define.
|
||||||
|
|
|
@ -759,13 +759,14 @@ write_2_short (opcode1, insn1, opcode2, insn2, exec_type, fx)
|
||||||
|
|
||||||
if (exec_type == EXEC_SEQ
|
if (exec_type == EXEC_SEQ
|
||||||
&& (opcode1->op->flags_used & (FLAG_JMP | FLAG_JSR))
|
&& (opcode1->op->flags_used & (FLAG_JMP | FLAG_JSR))
|
||||||
|
&& ((opcode1->op->flags_used & FLAG_DELAY) == 0)
|
||||||
&& ((opcode1->ecc == ECC_AL) || ! Optimizing))
|
&& ((opcode1->ecc == ECC_AL) || ! Optimizing))
|
||||||
{
|
{
|
||||||
/* Unconditional branches kill instructions in the right bin.
|
/* Unconditional, non-delayed branches kill instructions in
|
||||||
Conditional branches don't always but if we are not
|
the right bin. Conditional branches don't always but if
|
||||||
optimizing, then we want to produce an error about such
|
we are not optimizing, then we have been asked to produce
|
||||||
constructs. For the purposes of this test, subroutine
|
an error about such constructs. For the purposes of this
|
||||||
calls are considered to be branches. */
|
test, subroutine calls are considered to be branches. */
|
||||||
write_1_short (opcode1, insn1, fx->next, false);
|
write_1_short (opcode1, insn1, fx->next, false);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -799,10 +800,11 @@ write_2_short (opcode1, insn1, opcode2, insn2, exec_type, fx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (opcode1->op->flags_used & (FLAG_JMP | FLAG_JSR)
|
else if (opcode1->op->flags_used & (FLAG_JMP | FLAG_JSR)
|
||||||
|
&& ((opcode1->op->flags_used & FLAG_DELAY) == 0)
|
||||||
&& ((opcode1->ecc == ECC_AL) || ! Optimizing))
|
&& ((opcode1->ecc == ECC_AL) || ! Optimizing))
|
||||||
{
|
{
|
||||||
/* We must emit branch type instruction on its own with
|
/* We must emit (non-delayed) branch type instructions
|
||||||
nothing in the right container. */
|
on their own with nothing in the right container. */
|
||||||
write_1_short (opcode1, insn1, fx->next, false);
|
write_1_short (opcode1, insn1, fx->next, false);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1725,26 +1727,25 @@ md_pcrel_from_section (fixp, sec)
|
||||||
|
|
||||||
int
|
int
|
||||||
md_apply_fix3 (fixp, valuep, seg)
|
md_apply_fix3 (fixp, valuep, seg)
|
||||||
fixS *fixp;
|
fixS * fixp;
|
||||||
valueT *valuep;
|
valueT * valuep;
|
||||||
segT seg;
|
segT seg;
|
||||||
{
|
{
|
||||||
char *where;
|
char * where;
|
||||||
unsigned long insn, insn2;
|
unsigned long insn, insn2;
|
||||||
long value;
|
long value;
|
||||||
|
|
||||||
if (fixp->fx_addsy == (symbolS *) NULL)
|
if (fixp->fx_addsy == (symbolS *) NULL)
|
||||||
{
|
{
|
||||||
value = *valuep;
|
value = * valuep;
|
||||||
fixp->fx_done = 1;
|
fixp->fx_done = 1;
|
||||||
}
|
}
|
||||||
else if (fixp->fx_pcrel)
|
else if (fixp->fx_pcrel)
|
||||||
{
|
value = * valuep;
|
||||||
value = *valuep;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
value = fixp->fx_offset;
|
value = fixp->fx_offset;
|
||||||
|
|
||||||
if (fixp->fx_subsy != (symbolS *) NULL)
|
if (fixp->fx_subsy != (symbolS *) NULL)
|
||||||
{
|
{
|
||||||
if (S_GET_SEGMENT (fixp->fx_subsy) == absolute_section)
|
if (S_GET_SEGMENT (fixp->fx_subsy) == absolute_section)
|
||||||
|
@ -1765,23 +1766,30 @@ md_apply_fix3 (fixp, valuep, seg)
|
||||||
|
|
||||||
switch (fixp->fx_r_type)
|
switch (fixp->fx_r_type)
|
||||||
{
|
{
|
||||||
case BFD_RELOC_8:
|
case BFD_RELOC_8: /* Caused by a bad .byte directive. */
|
||||||
/* Caused by a bad .byte directive. */
|
/* Drop trhough. */
|
||||||
as_fatal (_("line %d: unable to place address of symbol '%s' into a byte"),
|
|
||||||
fixp->fx_line, S_GET_NAME (fixp->fx_addsy));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BFD_RELOC_16:
|
case BFD_RELOC_16: /* Caused by a bad .short directive. */
|
||||||
/* Caused by a bad .short directive. */
|
/* Drop through. */
|
||||||
as_fatal (_("line %d: unable to place address of symbol '%s' into a short"),
|
|
||||||
fixp->fx_line, S_GET_NAME (fixp->fx_addsy));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BFD_RELOC_64:
|
case BFD_RELOC_64: /* Caused by a bad .quad directive. */
|
||||||
/* Caused by a bad .quad directive. */
|
{
|
||||||
as_fatal (_("line %d: unable to place address of symbol '%s' into a .quad"),
|
char * size;
|
||||||
fixp->fx_line, S_GET_NAME (fixp->fx_addsy));
|
|
||||||
break;
|
size = (fixp->fx_r_type == BFD_RELOC_8) ? _("byte")
|
||||||
|
: (fixp->fx_r_type == BFD_RELOC_16) ? _("short")
|
||||||
|
: _("quad");
|
||||||
|
|
||||||
|
if (fixp->fx_addsy == NULL)
|
||||||
|
as_bad (_("line %d: unable to place address into a %s"),
|
||||||
|
fixp->fx_line, size);
|
||||||
|
else
|
||||||
|
as_bad (_("line %d: unable to place address of symbol '%s' into a %s"),
|
||||||
|
fixp->fx_line,
|
||||||
|
S_GET_NAME (fixp->fx_addsy),
|
||||||
|
size);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case BFD_RELOC_D30V_6:
|
case BFD_RELOC_D30V_6:
|
||||||
check_size (value, 6, fixp->fx_file, fixp->fx_line);
|
check_size (value, 6, fixp->fx_file, fixp->fx_line);
|
||||||
|
|
Loading…
Reference in New Issue