Teach .org to handle complex expressions
authorAlan Modra <amodra@gmail.com>
Sat, 17 Mar 2001 03:02:06 +0000 (03:02 +0000)
committerAlan Modra <amodra@gmail.com>
Sat, 17 Mar 2001 03:02:06 +0000 (03:02 +0000)
gas/ChangeLog
gas/cgen.c
gas/read.c

index 3d9e3577bd7f46a4a1febf572dc67ac1519dc929..a2914001e3ec476e513c9be57e6e3012afbf6a68 100644 (file)
@@ -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>
 
        * config/tc-ia64.c (md): New member keep_pending_output.
index d2eb7eccd593204dc99b6ddd00e8069c968ae751..3baee8fe94b7555f408ead218fbed2aeec070904 100644 (file)
@@ -398,6 +398,9 @@ gas_cgen_finish_insn (insn, buf, length, relax_p, result)
     {
       int max_len;
       fragS *old_frag;
+      expressionS *exp;
+      symbolS *sym;
+      offsetT off;
 
 #ifdef TC_CGEN_MAX_RELAX
       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.  */
       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,
                max_len - byte_len /* max chars */,
                0 /* variable part already allocated */,
                /* FIXME: When we machine generate the relax table,
                   machine generate a macro to compute subtype.  */
                1 /* subtype */,
-               fixups[relax_operand].exp.X_add_symbol,
-               fixups[relax_operand].exp.X_add_number,
+               sym,
+               off,
                f);
 
       /* Record the operand number with the fragment so md_convert_frag
index e6462e6b365a9f7d070d68d1964bb3d89121f38f..29ab1553a5f6e92969aa485f5eb1dbedbb205316 100644 (file)
@@ -2379,9 +2379,17 @@ do_org (segment, exp, fill)
   else
     {
       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,
-                   exp->X_add_number * OCTETS_PER_BYTE, (char *) NULL);
+      if (exp->X_op != O_constant && exp->X_op != O_symbol)
+       {
+         /* 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;
     }
 }
This page took 0.036351 seconds and 4 git commands to generate.