[PATCH] gas/config/tc-msp430.c. undo last changes and add more sanity check.
Dmitry Diky
ddiky@alarity.com
Fri Sep 9 18:27:00 GMT 2005
Fellows,
Last changes to msp430 target lead to strange errors if an input sile size is
big. The following patch fixes this problem.
Cheers,
Dmitry.
2005-09-09 Dmitry Diky <diwil@spec.ru>
* config/tc-msp430.c (msp430_operands): Undo last changes. Instead...
(msp430_relax_frag): add a guard check to ensure that final fr_subtype
has been reached.
Index: config/tc-msp430.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-msp430.c,v
retrieving revision 1.21
diff -c -3 -p -r1.21 tc-msp430.c
*** config/tc-msp430.c 1 Sep 2005 12:41:25 -0000 1.21
--- config/tc-msp430.c 9 Sep 2005 08:44:46 -0000
*************** msp430_operands (struct msp430_opcode_s
*** 1778,1791 ****
of the insn from the fix piece of instruction that was emitted.
Since next fragments may have variable size we tie debug info
to the beginning of the instruction. */
! frag = frag_more (0);
dwarf2_emit_insn (0);
! frag = frag_var/*iant*/ (rs_machine_dependent, 8, 2,
ENCODE_RELAX (rc.lpos, STATE_BITS10), /* Wild guess. */
exp.X_add_symbol,
0, /* Offset is zero if jump dist less than 1K. */
(char *) frag);
- bfd_putl16 ((bfd_vma) rc.sop, frag);
break;
}
}
--- 1778,1791 ----
of the insn from the fix piece of instruction that was emitted.
Since next fragments may have variable size we tie debug info
to the beginning of the instruction. */
! frag = frag_more (8);
dwarf2_emit_insn (0);
! bfd_putl16 ((bfd_vma) rc.sop, frag);
! frag = frag_variant (rs_machine_dependent, 8, 2,
ENCODE_RELAX (rc.lpos, STATE_BITS10), /* Wild guess. */
exp.X_add_symbol,
0, /* Offset is zero if jump dist less than 1K. */
(char *) frag);
break;
}
}
*************** msp430_operands (struct msp430_opcode_s
*** 1815,1829 ****
/* Relaxation required. */
struct hcodes_s hc = msp430_hcodes[opcode->insn_opnumb];
! frag = frag_more (0);
dwarf2_emit_insn (0);
! frag = frag_var/*iant*/ (rs_machine_dependent, 8, 2,
ENCODE_RELAX (STATE_EMUL_BRANCH, STATE_BITS10), /* Wild guess. */
exp.X_add_symbol,
0, /* Offset is zero if jump dist less than 1K. */
(char *) frag);
- bfd_putl16 ((bfd_vma) hc.op0, frag);
- bfd_putl16 ((bfd_vma) hc.op1, frag+2);
break;
}
}
--- 1815,1830 ----
/* Relaxation required. */
struct hcodes_s hc = msp430_hcodes[opcode->insn_opnumb];
! frag = frag_more (8);
dwarf2_emit_insn (0);
! bfd_putl16 ((bfd_vma) hc.op0, frag);
! bfd_putl16 ((bfd_vma) hc.op1, frag+2);
!
! frag = frag_variant (rs_machine_dependent, 8, 2,
ENCODE_RELAX (STATE_EMUL_BRANCH, STATE_BITS10), /* Wild guess. */
exp.X_add_symbol,
0, /* Offset is zero if jump dist less than 1K. */
(char *) frag);
break;
}
}
*************** msp430_relax_frag (segT seg ATTRIBUTE_UN
*** 2305,2311 ****
{
/* Look backwards. */
for (next_state = this_type->rlx_more; next_state;)
! if (aim >= this_type->rlx_backward)
next_state = 0;
else
{
--- 2306,2312 ----
{
/* Look backwards. */
for (next_state = this_type->rlx_more; next_state;)
! if (aim >= this_type->rlx_backward || !this_type->rlx_backward)
next_state = 0;
else
{
*************** msp430_relax_frag (segT seg ATTRIBUTE_UN
*** 2319,2325 ****
{
/* Look forwards. */
for (next_state = this_type->rlx_more; next_state;)
! if (aim <= this_type->rlx_forward)
next_state = 0;
else
{
--- 2320,2326 ----
{
/* Look forwards. */
for (next_state = this_type->rlx_more; next_state;)
! if (aim <= this_type->rlx_forward || !this_type->rlx_forward)
next_state = 0;
else
{
More information about the Binutils
mailing list