Correctly check gcc version.
[platform/upstream/binutils.git] / gas / cgen.c
index bcd59ef..e15e1b6 100644 (file)
@@ -184,9 +184,9 @@ gas_cgen_record_fixup (frag, where, insn, length, operand, opinfo, symbol, offse
                  CGEN_OPERAND_ATTR_VALUE (operand, CGEN_OPERAND_PCREL_ADDR),
                  (bfd_reloc_code_real_type)
                    ((int) BFD_RELOC_UNUSED
-                    + CGEN_OPERAND_INDEX (gas_cgen_cpu_desc, operand)));
-  fixP->tc_fix_data.insn   = (PTR) insn;
-  fixP->tc_fix_data.opinfo = opinfo;
+                    + (int) operand->type));
+  fixP->fx_cgen.insn = insn;
+  fixP->fx_cgen.opinfo = opinfo;
 
   return fixP;
 }
@@ -223,9 +223,9 @@ gas_cgen_record_fixup_exp (frag, where, insn, length, operand, opinfo, exp)
                      CGEN_OPERAND_ATTR_VALUE (operand, CGEN_OPERAND_PCREL_ADDR),
                      (bfd_reloc_code_real_type)
                        ((int) BFD_RELOC_UNUSED
-                        + CGEN_OPERAND_INDEX (gas_cgen_cpu_desc, operand)));
-  fixP->tc_fix_data.insn = (PTR) insn;
-  fixP->tc_fix_data.opinfo = opinfo;
+                        + (int) operand->type));
+  fixP->fx_cgen.insn = insn;
+  fixP->fx_cgen.opinfo = opinfo;
 
   return fixP;
 }
@@ -376,7 +376,7 @@ gas_cgen_finish_insn (insn, buf, length, relax_p, result)
 
       for (i = 0; i < num_fixups; ++ i)
        {
-         if (CGEN_OPERAND_ATTR_VALUE (& CGEN_CPU_OPERAND_TABLE (gas_cgen_cpu_desc) [fixups[i].opindex],
+         if (CGEN_OPERAND_ATTR_VALUE (cgen_operand_lookup_by_num (gas_cgen_cpu_desc, fixups[i].opindex),
                                       CGEN_OPERAND_RELAX))
            {
              relax_operand = i;
@@ -441,15 +441,16 @@ gas_cgen_finish_insn (insn, buf, length, relax_p, result)
   /* Create any fixups.  */
   for (i = 0; i < num_fixups; ++i)
     {
-      fixS * fixP;
+      fixS *fixP;
+      const CGEN_OPERAND *operand =
+       cgen_operand_lookup_by_num (gas_cgen_cpu_desc, fixups[i].opindex);
 
       /* Don't create fixups for these.  That's done during relaxation.
         We don't need to test for CGEN_INSN_RELAX as they can't get here
         (see above).  */
       if (relax_p
          && CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAXABLE)
-         && CGEN_OPERAND_ATTR_VALUE (& CGEN_CPU_OPERAND_TABLE (gas_cgen_cpu_desc) [fixups[i].opindex],
-                                     CGEN_OPERAND_RELAX))
+         && CGEN_OPERAND_ATTR_VALUE (operand, CGEN_OPERAND_RELAX))
        continue;
 
 #ifndef md_cgen_record_fixup_exp
@@ -457,8 +458,7 @@ gas_cgen_finish_insn (insn, buf, length, relax_p, result)
 #endif
 
        fixP = md_cgen_record_fixup_exp (frag_now, f - frag_now->fr_literal,
-                                        insn, length,
-                                        & CGEN_CPU_OPERAND_TABLE (gas_cgen_cpu_desc) [fixups[i].opindex],
+                                        insn, length, operand,
                                         fixups[i].opinfo,
                                         & fixups[i].exp);
        if (result)
@@ -532,11 +532,11 @@ gas_cgen_md_apply_fix3 (fixP, valueP, seg)
   if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
     {
       int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
-      const CGEN_OPERAND *operand = & CGEN_CPU_OPERAND_TABLE (cd) [opindex];
+      const CGEN_OPERAND *operand = cgen_operand_lookup_by_num (cd, opindex);
       const char *errmsg;
       bfd_reloc_code_real_type reloc_type;
       CGEN_FIELDS *fields = alloca (CGEN_CPU_SIZEOF_FIELDS (cd));
-      const CGEN_INSN *insn = (CGEN_INSN *) fixP->tc_fix_data.insn;
+      const CGEN_INSN *insn = fixP->fx_cgen.insn;
 
       /* If the reloc has been fully resolved finish the operand here.  */
       /* FIXME: This duplicates the capabilities of code in BFD.  */
@@ -546,7 +546,7 @@ gas_cgen_md_apply_fix3 (fixP, valueP, seg)
          || fixP->fx_pcrel)
        {
          CGEN_CPU_SET_FIELDS_BITSIZE (cd) (fields, CGEN_INSN_BITSIZE (insn));
-         CGEN_CPU_SET_VMA_OPERAND (cd) (opindex, fields, (bfd_vma) value);
+         CGEN_CPU_SET_VMA_OPERAND (cd) (cd, opindex, fields, (bfd_vma) value);
 
 #if CGEN_INT_INSN_P
          {
@@ -649,7 +649,8 @@ gas_cgen_tc_gen_reloc (section, fixP)
 
   assert (!fixP->fx_pcrel == !reloc->howto->pc_relative);
 
-  reloc->sym_ptr_ptr = & fixP->fx_addsy->bsym;
+  reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
 
   /* Use fx_offset for these cases */
   if (   fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY