Fix more breakages from the multiple relax pass patch.

This commit is contained in:
Alan Modra 2001-04-05 04:21:36 +00:00
parent 608506ed67
commit e66457fbf3
7 changed files with 295 additions and 274 deletions

View File

@ -1,3 +1,23 @@
2001-04-05 Alan Modra <alan@linuxcare.com.au>
* configure.in: Add h8500-*-coff and h8500-*-rtems targets.
* configure: Regenerate.
* config/tc-h8500.c (md_estimate_size_before_relax): Add missing
cases, and always return size based on current fr_subtype.
(md_begin): Move initialization of md_relax_table..
(md_relax_table): ..to static initializer. Set rlx_length for
UNDEF_WORD_DISP cases.
* config/tc-w65.c (md_estimate_size_before_relax): Likewise.
(md_begin): Likewise.
(md_relax_table): Likewise.
* config/tc-mcore.c (md_estimate_size_before_relax): Likewise.
(md_relax_table): Set rlx_length for UNDEF_WORD_DISP cases.
Set rlx_backward and rlx_forward to zero for unused states.
* config/tc-sh.c (md_estimate_size_before_relax): Likewise.
(md_relax_table): Set rlx_length for UNDEF_WORD_DISP cases.
(UNCOND12, UNCOND32): Remove duplicate defines.
2001-04-04 Hans-Peter Nilsson <hp@axis.com>
* config/tc-cris.c (md_estimate_size_before_relax) <case

View File

@ -86,7 +86,31 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP";
#define WORD_F 32767
#define WORD_B 32768
relax_typeS md_relax_table[C (END, 0)];
relax_typeS md_relax_table[C (END, 0)] = {
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
/* BRANCH */
{ 0, 0, 0, 0 },
{ BYTE_F, BYTE_B, 2, C (BRANCH, WORD_DISP) },
{ WORD_F, WORD_B, 3, 0 },
{ 0, 0, 3, 0 },
/* SCB_F */
{ 0, 0, 0, 0 },
{ BYTE_F, BYTE_B, 3, C (SCB_F, WORD_DISP) },
{ WORD_F, WORD_B, 8, 0 },
{ 0, 0, 8, 0 },
/* SCB_TST */
{ 0, 0, 0, 0 },
{ BYTE_F, BYTE_B, 3, C (SCB_TST, WORD_DISP) },
{ WORD_F, WORD_B, 10, 0 },
{ 0, 0, 10, 0 }
};
static struct hash_control *opcode_hash_control; /* Opcode mnemonics */
@ -101,7 +125,6 @@ md_begin ()
h8500_opcode_info *opcode;
char prev_buffer[100];
int idx = 0;
register relax_typeS *table;
opcode_hash_control = hash_new ();
prev_buffer[0] = 0;
@ -115,40 +138,6 @@ md_begin ()
idx++;
}
}
/* Initialize the relax table. We use a local variable to avoid
warnings about modifying a supposedly const data structure. */
table = (relax_typeS *) md_relax_table;
table[C (BRANCH, BYTE_DISP)].rlx_forward = BYTE_F;
table[C (BRANCH, BYTE_DISP)].rlx_backward = BYTE_B;
table[C (BRANCH, BYTE_DISP)].rlx_length = 2;
table[C (BRANCH, BYTE_DISP)].rlx_more = C (BRANCH, WORD_DISP);
table[C (BRANCH, WORD_DISP)].rlx_forward = WORD_F;
table[C (BRANCH, WORD_DISP)].rlx_backward = WORD_B;
table[C (BRANCH, WORD_DISP)].rlx_length = 3;
table[C (BRANCH, WORD_DISP)].rlx_more = 0;
table[C (SCB_F, BYTE_DISP)].rlx_forward = BYTE_F;
table[C (SCB_F, BYTE_DISP)].rlx_backward = BYTE_B;
table[C (SCB_F, BYTE_DISP)].rlx_length = 3;
table[C (SCB_F, BYTE_DISP)].rlx_more = C (SCB_F, WORD_DISP);
table[C (SCB_F, WORD_DISP)].rlx_forward = WORD_F;
table[C (SCB_F, WORD_DISP)].rlx_backward = WORD_B;
table[C (SCB_F, WORD_DISP)].rlx_length = 8;
table[C (SCB_F, WORD_DISP)].rlx_more = 0;
table[C (SCB_TST, BYTE_DISP)].rlx_forward = BYTE_F;
table[C (SCB_TST, BYTE_DISP)].rlx_backward = BYTE_B;
table[C (SCB_TST, BYTE_DISP)].rlx_length = 3;
table[C (SCB_TST, BYTE_DISP)].rlx_more = C (SCB_TST, WORD_DISP);
table[C (SCB_TST, WORD_DISP)].rlx_forward = WORD_F;
table[C (SCB_TST, WORD_DISP)].rlx_backward = WORD_B;
table[C (SCB_TST, WORD_DISP)].rlx_length = 10;
table[C (SCB_TST, WORD_DISP)].rlx_more = 0;
}
static int rn; /* register number used by RN */
@ -1442,7 +1431,7 @@ md_estimate_size_before_relax (fragP, segment_type)
register fragS *fragP;
register segT segment_type;
{
int what = GET_WHAT (fragP->fr_subtype);
int what;
switch (fragP->fr_subtype)
{
@ -1452,33 +1441,37 @@ md_estimate_size_before_relax (fragP, segment_type)
case C (BRANCH, UNDEF_BYTE_DISP):
case C (SCB_F, UNDEF_BYTE_DISP):
case C (SCB_TST, UNDEF_BYTE_DISP):
what = GET_WHAT (fragP->fr_subtype);
/* used to be a branch to somewhere which was unknown */
if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type)
{
/* Got a symbol and it's defined in this segment, become byte
sized - maybe it will fix up. */
fragP->fr_subtype = C (what, BYTE_DISP);
fragP->fr_var = md_relax_table[C (what, BYTE_DISP)].rlx_length;
}
else
{
/* Its got a segment, but its not ours, so it will always be
long. */
fragP->fr_subtype = C (what, UNDEF_WORD_DISP);
fragP->fr_var = md_relax_table[C (what, WORD_DISP)].rlx_length;
}
break;
case C (BRANCH, BYTE_DISP):
case C (BRANCH, WORD_DISP):
case C (BRANCH, UNDEF_WORD_DISP):
case C (SCB_F, BYTE_DISP):
case C (SCB_F, WORD_DISP):
case C (SCB_F, UNDEF_WORD_DISP):
case C (SCB_TST, BYTE_DISP):
case C (SCB_TST, WORD_DISP):
case C (SCB_TST, UNDEF_WORD_DISP):
/* When relaxing a section for the second time, we don't need to
do anything. */
do anything besides return the current size. */
break;
}
fragP->fr_var = md_relax_table[fragP->fr_subtype].rlx_length;
return fragP->fr_var;
}

View File

@ -111,20 +111,24 @@ cpu_type;
cpu_type cpu = M340;
/* Initialize the relax table. */
const relax_typeS md_relax_table[] =
{
{ 1, 1, 0, 0 }, /* 0: unused */
{ 1, 1, 0, 0 }, /* 1: unused */
{ 1, 1, 0, 0 }, /* 2: unused */
{ 1, 1, 0, 0 }, /* 3: unused */
{ 1, 1, 0, 0 }, /* 4: unused */
{ 2048, -2046, C12_LEN, C(COND_JUMP, DISP32) }, /* 5: C(COND_JUMP, DISP12) */
{ 0, 0, C32_LEN, 0 }, /* 6: C(COND_JUMP, DISP32) */
{ 1, 1, 0, 0 }, /* 7: unused */
{ 1, 1, 0, 0 }, /* 8: unused */
{ 2048, -2046, U12_LEN, C(UNCD_JUMP, DISP32) }, /* 9: C(UNCD_JUMP, DISP12) */
{ 0, 0, U32_LEN, 0 }, /*10: C(UNCD_JUMP, DISP32) */
{ 1, 1, 0, 0 }, /*11: unused */
const relax_typeS md_relax_table[] = {
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
/* COND_JUMP */
{ 0, 0, 0, 0 }, /* UNDEF_DISP */
{ 2048, -2046, C12_LEN, C(COND_JUMP, DISP32) }, /* DISP12 */
{ 0, 0, C32_LEN, 0 }, /* DISP32 */
{ 0, 0, C32_LEN, 0 }, /* UNDEF_WORD_DISP */
/* UNCD_JUMP */
{ 0, 0, 0, 0 }, /* UNDEF_DISP */
{ 2048, -2046, U12_LEN, C(UNCD_JUMP, DISP32) }, /* DISP12 */
{ 0, 0, U32_LEN, 0 }, /* DISP32 */
{ 0, 0, U32_LEN, 0 } /* UNDEF_WORD_DISP */
};
/* Literal pool data structures. */
@ -2251,17 +2255,14 @@ md_estimate_size_before_relax (fragP, segment_type)
if (!fragP->fr_symbol)
{
fragP->fr_subtype = C (UNCD_JUMP, DISP12);
fragP->fr_var = md_relax_table[C (UNCD_JUMP, DISP12)].rlx_length;
}
else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type)
{
fragP->fr_subtype = C (UNCD_JUMP, DISP12);
fragP->fr_var = md_relax_table[C (UNCD_JUMP, DISP12)].rlx_length;
}
else
{
fragP->fr_subtype = C (UNCD_JUMP, UNDEF_WORD_DISP);
fragP->fr_var = md_relax_table[C (UNCD_JUMP, DISP32)].rlx_length;
}
break;
@ -2273,31 +2274,31 @@ md_estimate_size_before_relax (fragP, segment_type)
/* Got a symbol and it's defined in this segment, become byte
sized - maybe it will fix up */
fragP->fr_subtype = C (COND_JUMP, DISP12);
fragP->fr_var = md_relax_table[C (COND_JUMP, DISP12)].rlx_length;
}
else if (fragP->fr_symbol)
{
/* Its got a segment, but its not ours, so it will always be long. */
fragP->fr_subtype = C (COND_JUMP, UNDEF_WORD_DISP);
fragP->fr_var = md_relax_table[C (COND_JUMP, DISP32)].rlx_length;
}
else
{
/* We know the abs value. */
fragP->fr_subtype = C (COND_JUMP, DISP12);
fragP->fr_var = md_relax_table[C (COND_JUMP, DISP12)].rlx_length;
}
break;
case C (UNCD_JUMP, DISP12):
case C (UNCD_JUMP, DISP32):
case C (UNCD_JUMP, UNDEF_WORD_DISP):
case C (COND_JUMP, DISP12):
case C (COND_JUMP, DISP32):
case C (COND_JUMP, UNDEF_WORD_DISP):
/* When relaxing a section for the second time, we don't need to
do anything. */
do anything besides return the current size. */
break;
}
fragP->fr_var = md_relax_table[fragP->fr_subtype].rlx_length;
return fragP->fr_var;
}

View File

@ -140,8 +140,6 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP";
#define COND8 1
#define COND12 2
#define COND32 3
#define UNCOND12 1
#define UNCOND32 2
#define UNDEF_WORD_DISP 4
#define UNCOND12 1
@ -190,7 +188,9 @@ const relax_typeS md_relax_table[C (END, 0)] = {
{ COND12_F, COND12_M, COND12_LENGTH, C (COND_JUMP, COND32), },
/* C (COND_JUMP, COND32) */
{ COND32_F, COND32_M, COND32_LENGTH, 0, },
EMPTY, EMPTY, EMPTY, EMPTY,
/* C (COND_JUMP, UNDEF_WORD_DISP) */
{ 0, 0, COND32_LENGTH, 0, },
EMPTY, EMPTY, EMPTY,
EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY,
EMPTY,
@ -200,7 +200,9 @@ const relax_typeS md_relax_table[C (END, 0)] = {
{ COND12_F, COND12_M, COND12_DELAY_LENGTH, C (COND_JUMP_DELAY, COND32), },
/* C (COND_JUMP_DELAY, COND32) */
{ COND32_F, COND32_M, COND32_LENGTH, 0, },
EMPTY, EMPTY, EMPTY, EMPTY,
/* C (COND_JUMP_DELAY, UNDEF_WORD_DISP) */
{ 0, 0, COND32_LENGTH, 0, },
EMPTY, EMPTY, EMPTY,
EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY,
EMPTY,
@ -208,7 +210,10 @@ const relax_typeS md_relax_table[C (END, 0)] = {
{ UNCOND12_F, UNCOND12_M, UNCOND12_LENGTH, C (UNCOND_JUMP, UNCOND32), },
/* C (UNCOND_JUMP, UNCOND32) */
{ UNCOND32_F, UNCOND32_M, UNCOND32_LENGTH, 0, },
EMPTY, EMPTY, EMPTY, EMPTY, EMPTY,
EMPTY,
/* C (UNCOND_JUMP, UNDEF_WORD_DISP) */
{ 0, 0, UNCOND32_LENGTH, 0, },
EMPTY, EMPTY, EMPTY,
EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY,
};
@ -3028,6 +3033,8 @@ md_estimate_size_before_relax (fragP, segment_type)
register fragS *fragP;
register segT segment_type;
{
int what;
switch (fragP->fr_subtype)
{
default:
@ -3038,58 +3045,57 @@ md_estimate_size_before_relax (fragP, segment_type)
if (!fragP->fr_symbol)
{
fragP->fr_subtype = C (UNCOND_JUMP, UNCOND12);
fragP->fr_var = md_relax_table[C (UNCOND_JUMP, UNCOND12)].rlx_length;
}
else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type)
{
fragP->fr_subtype = C (UNCOND_JUMP, UNCOND12);
fragP->fr_var = md_relax_table[C (UNCOND_JUMP, UNCOND12)].rlx_length;
}
else
{
fragP->fr_subtype = C (UNCOND_JUMP, UNDEF_WORD_DISP);
fragP->fr_var = md_relax_table[C (UNCOND_JUMP, UNCOND32)].rlx_length;
}
break;
case C (COND_JUMP, UNDEF_DISP):
case C (COND_JUMP_DELAY, UNDEF_DISP):
what = GET_WHAT (fragP->fr_subtype);
/* Used to be a branch to somewhere which was unknown. */
if (fragP->fr_symbol
&& S_GET_SEGMENT (fragP->fr_symbol) == segment_type)
{
int what = GET_WHAT (fragP->fr_subtype);
/* Got a symbol and it's defined in this segment, become byte
sized - maybe it will fix up. */
fragP->fr_subtype = C (what, COND8);
fragP->fr_var = md_relax_table[C (what, COND8)].rlx_length;
}
else if (fragP->fr_symbol)
{
int what = GET_WHAT (fragP->fr_subtype);
/* Its got a segment, but its not ours, so it will always be long. */
fragP->fr_subtype = C (what, UNDEF_WORD_DISP);
fragP->fr_var = md_relax_table[C (what, COND32)].rlx_length;
}
else
{
int what = GET_WHAT (fragP->fr_subtype);
/* We know the abs value. */
fragP->fr_subtype = C (what, COND8);
fragP->fr_var = md_relax_table[C (what, COND8)].rlx_length;
}
break;
case C (UNCOND_JUMP, UNCOND12):
case C (UNCOND_JUMP, UNCOND32):
case C (UNCOND_JUMP, UNDEF_WORD_DISP):
case C (COND_JUMP, COND8):
case C (COND_JUMP, COND12):
case C (COND_JUMP, COND32):
case C (COND_JUMP, UNDEF_WORD_DISP):
case C (COND_JUMP_DELAY, COND8):
case C (COND_JUMP_DELAY, COND12):
case C (COND_JUMP_DELAY, COND32):
case C (COND_JUMP_DELAY, UNDEF_WORD_DISP):
/* When relaxing a section for the second time, we don't need to
do anything. */
do anything besides return the current size. */
break;
}
fragP->fr_var = md_relax_table[fragP->fr_subtype].rlx_length;
return fragP->fr_var;
}

View File

@ -101,7 +101,25 @@ int X; /* X flag */
#define WORD_F 32767
#define WORD_B 32768
relax_typeS md_relax_table[C (END, 0)];
relax_typeS md_relax_table[C (END, 0)] = {
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
/* COND_BRANCH */
{ 0, 0, 0, 0 }, /* UNDEF_BYTE_DISP */
{ BYTE_F, BYTE_B, 2, C (COND_BRANCH, WORD_DISP) }, /* BYTE_DISP */
{ WORD_F, WORD_B, 5, 0 }, /* WORD_DISP */
{ 0, 0, 5, 0 }, /* UNDEF_WORD_DISP */
/* UNCOND_BRANCH */
{ 0, 0, 0, 0 }, /* UNDEF_BYTE_DISP */
{ BYTE_F, BYTE_B, 2, C (UNCOND_BRANCH, WORD_DISP) }, /* BYTE_DISP */
{ WORD_F, WORD_B, 3, 0 }, /* WORD_DISP */
{ 0, 0, 3, 0 } /* UNDEF_WORD_DISP */
};
/* This function is called once, at assembler startup time. This
should set up all the tables, etc that the MD part of the assembler
@ -131,7 +149,6 @@ s_longa (xmode)
void
md_begin ()
{
relax_typeS *table;
struct opinfo *opcode;
char *prev_name = "";
@ -153,29 +170,6 @@ md_begin ()
}
}
/* Initialize the relax table. We use a local variable to avoid
warnings about modifying a supposedly const data structure. */
table = (relax_typeS *) md_relax_table;
table[C (COND_BRANCH, BYTE_DISP)].rlx_forward = BYTE_F;
table[C (COND_BRANCH, BYTE_DISP)].rlx_backward = BYTE_B;
table[C (COND_BRANCH, BYTE_DISP)].rlx_length = 2;
table[C (COND_BRANCH, BYTE_DISP)].rlx_more = C (COND_BRANCH, WORD_DISP);
table[C (COND_BRANCH, WORD_DISP)].rlx_forward = WORD_F;
table[C (COND_BRANCH, WORD_DISP)].rlx_backward = WORD_B;
table[C (COND_BRANCH, WORD_DISP)].rlx_length = 5;
table[C (COND_BRANCH, WORD_DISP)].rlx_more = 0;
table[C (UNCOND_BRANCH, BYTE_DISP)].rlx_forward = BYTE_F;
table[C (UNCOND_BRANCH, BYTE_DISP)].rlx_backward = BYTE_B;
table[C (UNCOND_BRANCH, BYTE_DISP)].rlx_length = 2;
table[C (UNCOND_BRANCH, BYTE_DISP)].rlx_more = C (UNCOND_BRANCH, WORD_DISP);
table[C (UNCOND_BRANCH, WORD_DISP)].rlx_forward = WORD_F;
table[C (UNCOND_BRANCH, WORD_DISP)].rlx_backward = WORD_B;
table[C (UNCOND_BRANCH, WORD_DISP)].rlx_length = 3;
table[C (UNCOND_BRANCH, WORD_DISP)].rlx_more = 0;
flag_signed_overflow_ok = 1;
}
@ -1148,7 +1142,7 @@ md_estimate_size_before_relax (fragP, segment_type)
register fragS *fragP;
register segT segment_type;
{
int what = GET_WHAT (fragP->fr_subtype);
int what;
switch (fragP->fr_subtype)
{
@ -1157,31 +1151,34 @@ md_estimate_size_before_relax (fragP, segment_type)
case C (COND_BRANCH, UNDEF_BYTE_DISP):
case C (UNCOND_BRANCH, UNDEF_BYTE_DISP):
what = GET_WHAT (fragP->fr_subtype);
/* Used to be a branch to somewhere which was unknown. */
if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type)
{
/* Got a symbol and it's defined in this segment, become byte
sized - maybe it will fix up. */
fragP->fr_subtype = C (what, BYTE_DISP);
fragP->fr_var = md_relax_table[C (what, BYTE_DISP)].rlx_length;
}
else
{
/* Its got a segment, but its not ours, so it will always be
long. */
fragP->fr_subtype = C (what, UNDEF_WORD_DISP);
fragP->fr_var = md_relax_table[C (what, WORD_DISP)].rlx_length;
}
break;
case C (COND_BRANCH, BYTE_DISP):
case C (COND_BRANCH, WORD_DISP):
case C (COND_BRANCH, UNDEF_WORD_DISP):
case C (UNCOND_BRANCH, BYTE_DISP):
case C (UNCOND_BRANCH, WORD_DISP):
case C (UNCOND_BRANCH, UNDEF_WORD_DISP):
/* When relaxing a section for the second time, we don't need to
do anything. */
do anything besides return the current size. */
break;
}
fragP->fr_var = md_relax_table[fragP->fr_subtype].rlx_length;
return fragP->fr_var;
}

340
gas/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -231,6 +231,8 @@ changequote([,])dnl
h8300-*-rtems*) fmt=coff ;;
h8300-*-coff) fmt=coff ;;
h8500-*-rtems*) fmt=coff ;;
h8500-*-coff) fmt=coff ;;
i370-*-elf* | i370-*-linux*) fmt=elf ;;
i386-ibm-aix*) fmt=coff em=i386aix ;;