* config/tc-v850.h (TC_PARSE_CONS_EXPRESSION): Define.
authorJeff Law <law@redhat.com>
Thu, 24 Oct 1996 22:55:22 +0000 (22:55 +0000)
committerJeff Law <law@redhat.com>
Thu, 24 Oct 1996 22:55:22 +0000 (22:55 +0000)
        (TC_CONS_FIX_NEW): Likewise.
        * config/tc-v850.c (parse_cons_expression_v850): New function.
        (cons_fix_new_v850): Likewise.
So we can handle ".hword lo(_foo)".

gas/ChangeLog
gas/config/tc-v850.c

index 32d4fe4a9852a7f3e6d7ea15aa34d3d7e9e23a03..3621240dc6600df9428c26eecd96063bc253c6f5 100644 (file)
@@ -1,6 +1,11 @@
 start-sanitize-v850
 Thu Oct 24 14:31:04 1996  Jeffrey A Law  (law@cygnus.com)
 
+       * config/tc-v850.h (TC_PARSE_CONS_EXPRESSION): Define.
+       (TC_CONS_FIX_NEW): Likewise.
+       * config/tc-v850.c (parse_cons_expression_v850): New function.
+       (cons_fix_new_v850): Likewise.
+
        * config/tc-v850.h (tc_fix_adjustable): Don't adjust TDA relocs.
 
 end-sanitize-v850
index cab16ee8407edcffbbc976034e0bb27e31097fb2..355815b1582f29b14d2c7e5ff14e134e8be22bc5 100644 (file)
@@ -24,6 +24,9 @@
 #include "as.h"
 #include "subsegs.h"     
 #include "opcode/v850.h"
+
+/* Temporarily holds the reloc in a cons expression.  */
+static bfd_reloc_code_real_type hold_cons_reloc;
 \f
 /* Structure to hold information about predefined registers.  */
 struct reg_name
@@ -1004,3 +1007,47 @@ v850_insert_operand (insn, operand, val, file, line)
     insn |= (((long) val & ((1 << operand->bits) - 1)) << operand->shift);
   return insn;
 }
+
+/* Parse a cons expression.  We have to handle hi(), lo(), etc
+   on the v850.  */
+void
+parse_cons_expression_v850 (exp)
+  expressionS *exp;
+{
+  /* See if there's a reloc prefix like hi() we have to handle.  */
+  hold_cons_reloc = v850_reloc_prefix ();
+
+  /* Do normal expression parsing.  */
+  expression (exp);
+
+  /* If we had to handle a reloc prefix, then eat the trailing
+     close paren.  */
+  if (hold_cons_reloc != BFD_RELOC_UNUSED)
+    input_line_pointer++;
+}
+
+/* Create a fixup for a cons expression.  If parse_cons_expression_v850
+   found a reloc prefix, then we use that reloc, else we choose an
+   appropriate one based on the size of the expression.  */
+void
+cons_fix_new_v850 (frag, where, size, exp)
+     fragS *frag;
+     int where;
+     int size;
+     expressionS *exp;
+{
+  if (hold_cons_reloc == BFD_RELOC_UNUSED)
+    {
+      if (size == 4)
+       hold_cons_reloc = BFD_RELOC_32;
+      if (size == 2)
+       hold_cons_reloc = BFD_RELOC_16;
+      if (size == 1)
+       hold_cons_reloc = BFD_RELOC_8;
+    }
+
+  if (exp != NULL)
+    fix_new_exp (frag, where, size, exp, 0, hold_cons_reloc);
+  else
+    fix_new (frag, where, size, NULL, 0, 0, hold_cons_reloc);
+}
This page took 0.050517 seconds and 4 git commands to generate.