gas: error for section type, attr, or entsize change
[deliverable/binutils-gdb.git] / gas / config / tc-epiphany.c
index fb896971a2a6fcff40db5e15b035b2be95794299..836b23b710305f54098326dfc35a518614148a54 100644 (file)
@@ -1,5 +1,5 @@
 /* tc-epiphany.c -- Assembler for the Adapteva EPIPHANY
 /* tc-epiphany.c -- Assembler for the Adapteva EPIPHANY
-   Copyright (C) 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2009-2020 Free Software Foundation, Inc.
    Contributed by Embecosm on behalf of Adapteva, Inc.
 
    This file is part of GAS, the GNU Assembler.
    Contributed by Embecosm on behalf of Adapteva, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -145,12 +145,14 @@ md_begin (void)
 
   /* Set the machine type.  */
   bfd_default_set_arch_mach (stdoutput, bfd_arch_epiphany, bfd_mach_epiphany32);
 
   /* Set the machine type.  */
   bfd_default_set_arch_mach (stdoutput, bfd_arch_epiphany, bfd_mach_epiphany32);
+
+  literal_prefix_dollar_hex = TRUE;
 }
 
 valueT
 md_section_align (segT segment, valueT size)
 {
 }
 
 valueT
 md_section_align (segT segment, valueT size)
 {
-  int align = bfd_get_section_alignment (stdoutput, segment);
+  int align = bfd_section_alignment (segment);
 
   return ((size + (1 << align) - 1) & -(1 << align));
 }
 
   return ((size + (1 << align) - 1) & -(1 << align));
 }
@@ -725,6 +727,8 @@ md_estimate_size_before_relax (fragS *fragP, segT segment)
         handling to md_convert_frag.  */
 
       EPIPHANY_RELAX_TYPES subtype;
         handling to md_convert_frag.  */
 
       EPIPHANY_RELAX_TYPES subtype;
+      const CGEN_INSN *insn;
+      int i;
       /* We haven't relaxed this at all, so the relaxation type may be
         completely wrong.  Set the subtype correctly.  */
       epiphany_relax_frag (segment, fragP, 0);
       /* We haven't relaxed this at all, so the relaxation type may be
         completely wrong.  Set the subtype correctly.  */
       epiphany_relax_frag (segment, fragP, 0);
@@ -751,26 +755,29 @@ md_estimate_size_before_relax (fragS *fragP, segT segment)
 
       fragP->fr_subtype = subtype;
 
 
       fragP->fr_subtype = subtype;
 
-      {
-       const CGEN_INSN *insn;
-       int i;
-
-       /* Update the recorded insn.  */
+      /* Update the recorded insn.  */
+      for (i = 0, insn = fragP->fr_cgen.insn; i < 4; i++, insn++)
+       {
+         if (strcmp (CGEN_INSN_MNEMONIC (insn),
+                     CGEN_INSN_MNEMONIC (fragP->fr_cgen.insn)) == 0
+             && CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAXED))
+           break;
+       }
 
 
-       for (i = 0, insn = fragP->fr_cgen.insn; i < 4; i++, insn++)
-         {
-           if ((strcmp (CGEN_INSN_MNEMONIC (insn),
-                        CGEN_INSN_MNEMONIC (fragP->fr_cgen.insn))
-                == 0)
-               && CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAXED))
-             break;
-         }
+      if (i == 4)
+       abort ();
 
 
-       if (i == 4)
-         abort ();
+      /* When changing from a 2-byte to 4-byte insn, don't leave
+        opcode bytes uninitialised.  */
+      if (CGEN_INSN_BITSIZE (fragP->fr_cgen.insn) < CGEN_INSN_BITSIZE (insn))
+       {
+         gas_assert (CGEN_INSN_BITSIZE (fragP->fr_cgen.insn) == 16);
+         gas_assert (CGEN_INSN_BITSIZE (insn) == 32);
+         fragP->fr_opcode[2] = 0;
+         fragP->fr_opcode[3] = 0;
+       }
 
 
-       fragP->fr_cgen.insn = insn;
-      }
+      fragP->fr_cgen.insn = insn;
     }
 
   return md_relax_table[fragP->fr_subtype].rlx_length;
     }
 
   return md_relax_table[fragP->fr_subtype].rlx_length;
@@ -1008,9 +1015,6 @@ md_cgen_lookup_reloc (const CGEN_INSN *insn ATTRIBUTE_UNUSED,
    of LITTLENUMS emitted is stored in *SIZEP.  An error message is
    returned, or NULL on OK.  */
 
    of LITTLENUMS emitted is stored in *SIZEP.  An error message is
    returned, or NULL on OK.  */
 
-/* Equal to MAX_PRECISION in atof-ieee.c.  */
-#define MAX_LITTLENUMS 6
-
 const char *
 md_atof (int type, char *litP, int *sizeP)
 {
 const char *
 md_atof (int type, char *litP, int *sizeP)
 {
This page took 0.049098 seconds and 4 git commands to generate.