aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2001-04-04 03:53:12 +0000
committerHans-Peter Nilsson <hp@axis.com>2001-04-04 03:53:12 +0000
commitc335d39444bc893563d53e62bff76a8d1c98cc2c (patch)
treed2ce31c04800fa354ac0d8557705f08250a272f4 /gas
parentaacb52510a2e29f5a4c3ebae082f9e99b24cf79f (diff)
downloadgdb-c335d39444bc893563d53e62bff76a8d1c98cc2c.zip
gdb-c335d39444bc893563d53e62bff76a8d1c98cc2c.tar.gz
gdb-c335d39444bc893563d53e62bff76a8d1c98cc2c.tar.bz2
* config/tc-cris.c (md_estimate_size_before_relax) <case
ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_UNDF)>: Don't emit 32-bit branch, just set fragP->fr_subtype. Set fragP->fr_var. <all cases>: Always set fragP->fr_var using md_cris_relax_table. Add cases to cover all relax states.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/config/tc-cris.c43
2 files changed, 21 insertions, 28 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 64816e3..bb24ea8 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,11 @@
2001-04-04 Hans-Peter Nilsson <hp@axis.com>
+ * config/tc-cris.c (md_estimate_size_before_relax) <case
+ ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_UNDF)>: Don't emit
+ 32-bit branch, just set fragP->fr_subtype. Set fragP->fr_var.
+ <all cases>: Always set fragP->fr_var using md_cris_relax_table.
+ Add cases to cover all relax states.
+
* write.c (write_object_file): Reset broken word state before
calling relax_seg.
diff --git a/gas/config/tc-cris.c b/gas/config/tc-cris.c
index 4fbc96a0..0b11f38 100644
--- a/gas/config/tc-cris.c
+++ b/gas/config/tc-cris.c
@@ -357,33 +357,14 @@ md_estimate_size_before_relax (fragP, segment_type)
{
case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_UNDF):
if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type)
- {
- /* The symbol lies in the same segment - a relaxable case. */
- fragP->fr_subtype
- = ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_BYTE);
- }
+ /* The symbol lies in the same segment - a relaxable case. */
+ fragP->fr_subtype
+ = ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_BYTE);
else
- {
- /* Unknown or not the same segment, so not relaxable. */
- char *writep;
-
- /* A small branch-always (2 bytes) to the "real" branch
- instruction, plus a delay-slot nop (2 bytes), plus a
- jump (2 plus 4 bytes). See gen_cond_branch_32. */
- fragP->fr_fix += 2 + 2 + 2 + 4;
- writep = fragP->fr_literal + old_fr_fix;
- gen_cond_branch_32 (fragP->fr_opcode, writep, fragP,
- fragP->fr_symbol, (symbolS *) NULL,
- fragP->fr_offset);
- frag_wane (fragP);
- }
- break;
-
- case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_BYTE):
- case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_WORD):
- /* We *might* give a better initial guess if we peek at offsets
- now, but the caller will relax correctly and without this, so
- don't bother. */
+ /* Unknown or not the same segment, so not relaxable. */
+ fragP->fr_subtype
+ = ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_DWORD);
+ fragP->fr_var = md_cris_relax_table[fragP->fr_subtype].rlx_length;
break;
case ENCODE_RELAX (STATE_BASE_PLUS_DISP_PREFIX, STATE_UNDF):
@@ -402,7 +383,7 @@ md_estimate_size_before_relax (fragP, segment_type)
/* Go for dword if not absolute or same segment. */
fragP->fr_subtype
= ENCODE_RELAX (STATE_BASE_PLUS_DISP_PREFIX, STATE_DWORD);
- fragP->fr_var += 4;
+ fragP->fr_var = md_cris_relax_table[fragP->fr_subtype].rlx_length;
}
else
{
@@ -445,9 +426,15 @@ md_estimate_size_before_relax (fragP, segment_type)
}
break;
+ case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_BYTE):
+ case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_WORD):
+ case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_DWORD):
+ case ENCODE_RELAX (STATE_BASE_PLUS_DISP_PREFIX, STATE_BYTE):
+ case ENCODE_RELAX (STATE_BASE_PLUS_DISP_PREFIX, STATE_WORD):
case ENCODE_RELAX (STATE_BASE_PLUS_DISP_PREFIX, STATE_DWORD):
/* When relaxing a section for the second time, we don't need to
- do anything. */
+ do anything except making sure that fr_var is set right. */
+ fragP->fr_var = md_cris_relax_table[fragP->fr_subtype].rlx_length;
break;
default: