Teach .org to handle complex expressions
This commit is contained in:
parent
4a5c6a1dd9
commit
2289f85d24
3 changed files with 30 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2001-03-17 Alan Modra <alan@linuxcare.com.au>
|
||||||
|
|
||||||
|
* read.c (do_org): Handle complex expressions.
|
||||||
|
* cgen.c (gas_cgen_finish_insn): Likewise.
|
||||||
|
|
||||||
2001-03-15 David Mosberger <davidm@hpl.hp.com>
|
2001-03-15 David Mosberger <davidm@hpl.hp.com>
|
||||||
|
|
||||||
* config/tc-ia64.c (md): New member keep_pending_output.
|
* config/tc-ia64.c (md): New member keep_pending_output.
|
||||||
|
|
17
gas/cgen.c
17
gas/cgen.c
|
@ -398,6 +398,9 @@ gas_cgen_finish_insn (insn, buf, length, relax_p, result)
|
||||||
{
|
{
|
||||||
int max_len;
|
int max_len;
|
||||||
fragS *old_frag;
|
fragS *old_frag;
|
||||||
|
expressionS *exp;
|
||||||
|
symbolS *sym;
|
||||||
|
offsetT off;
|
||||||
|
|
||||||
#ifdef TC_CGEN_MAX_RELAX
|
#ifdef TC_CGEN_MAX_RELAX
|
||||||
max_len = TC_CGEN_MAX_RELAX (insn, byte_len);
|
max_len = TC_CGEN_MAX_RELAX (insn, byte_len);
|
||||||
|
@ -414,14 +417,24 @@ gas_cgen_finish_insn (insn, buf, length, relax_p, result)
|
||||||
/* Create a relaxable fragment for this instruction. */
|
/* Create a relaxable fragment for this instruction. */
|
||||||
old_frag = frag_now;
|
old_frag = frag_now;
|
||||||
|
|
||||||
|
exp = &fixups[relax_operand].exp;
|
||||||
|
sym = exp->X_add_symbol;
|
||||||
|
off = exp->X_add_number;
|
||||||
|
if (exp->X_op != O_constant && exp->X_op != O_symbol)
|
||||||
|
{
|
||||||
|
/* Handle complex expressions. */
|
||||||
|
sym = make_expr_symbol (exp);
|
||||||
|
off = 0;
|
||||||
|
}
|
||||||
|
|
||||||
frag_var (rs_machine_dependent,
|
frag_var (rs_machine_dependent,
|
||||||
max_len - byte_len /* max chars */,
|
max_len - byte_len /* max chars */,
|
||||||
0 /* variable part already allocated */,
|
0 /* variable part already allocated */,
|
||||||
/* FIXME: When we machine generate the relax table,
|
/* FIXME: When we machine generate the relax table,
|
||||||
machine generate a macro to compute subtype. */
|
machine generate a macro to compute subtype. */
|
||||||
1 /* subtype */,
|
1 /* subtype */,
|
||||||
fixups[relax_operand].exp.X_add_symbol,
|
sym,
|
||||||
fixups[relax_operand].exp.X_add_number,
|
off,
|
||||||
f);
|
f);
|
||||||
|
|
||||||
/* Record the operand number with the fragment so md_convert_frag
|
/* Record the operand number with the fragment so md_convert_frag
|
||||||
|
|
12
gas/read.c
12
gas/read.c
|
@ -2379,9 +2379,17 @@ do_org (segment, exp, fill)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
symbolS *sym = exp->X_add_symbol;
|
||||||
|
offsetT off = exp->X_add_number * OCTETS_PER_BYTE;
|
||||||
|
|
||||||
p = frag_var (rs_org, 1, 1, (relax_substateT) 0, exp->X_add_symbol,
|
if (exp->X_op != O_constant && exp->X_op != O_symbol)
|
||||||
exp->X_add_number * OCTETS_PER_BYTE, (char *) NULL);
|
{
|
||||||
|
/* Handle complex expressions. */
|
||||||
|
sym = make_expr_symbol (exp);
|
||||||
|
off = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
p = frag_var (rs_org, 1, 1, (relax_substateT) 0, sym, off, (char *) 0);
|
||||||
*p = fill;
|
*p = fill;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue