Automatic date update in version.in
[deliverable/binutils-gdb.git] / gas / read.c
index 9f2909f797976955a89dd9dd8f36742e83daff26..ff78caef38c77f77bfc959df3f2220c2955ebf42 100644 (file)
@@ -1,5 +1,5 @@
 /* read.c - read a source file -
-   Copyright (C) 1986-2017 Free Software Foundation, Inc.
+   Copyright (C) 1986-2018 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -62,6 +62,7 @@
 #endif
 
 char *input_line_pointer;      /*->next char of source file to parse.  */
+bfd_boolean input_from_string = FALSE;
 
 #if BITS_PER_CHAR != 8
 /*  The following table is indexed by[(char)] and will break if
@@ -416,6 +417,7 @@ static const pseudo_typeS potable[] = {
   {"noformat", s_ignore, 0},
   {"nolist", listing_list, 0}, /* Turn listing off.  */
   {"nopage", listing_nopage, 0},
+  {"nops", s_nops, 0},
   {"octa", cons, 16},
   {"offset", s_struct, 0},
   {"org", s_org, 0},
@@ -713,19 +715,19 @@ assemble_one (char *line)
       /* Make sure this hasn't pushed the locked sequence
         past the bundle size.  */
       unsigned int bundle_size = pending_bundle_size (bundle_lock_frag);
-      if (bundle_size > (1U << bundle_align_p2))
-       as_bad (_("\
-.bundle_lock sequence at %u bytes but .bundle_align_mode limit is %u bytes"),
+      if (bundle_size > 1U << bundle_align_p2)
+       as_bad (_ (".bundle_lock sequence at %u bytes, "
+                  "but .bundle_align_mode limit is %u bytes"),
                bundle_size, 1U << bundle_align_p2);
     }
   else if (bundle_align_p2 > 0)
     {
       unsigned int insn_size = pending_bundle_size (insn_start_frag);
 
-      if (insn_size > (1U << bundle_align_p2))
-       as_bad (_("\
-single instruction is %u bytes long but .bundle_align_mode limit is %u"),
-               (unsigned int) insn_size, 1U << bundle_align_p2);
+      if (insn_size > 1U << bundle_align_p2)
+       as_bad (_("single instruction is %u bytes long, "
+                 "but .bundle_align_mode limit is %u bytes"),
+               insn_size, 1U << bundle_align_p2);
 
       finish_bundle (insn_start_frag, insn_size);
     }
@@ -1684,16 +1686,16 @@ read_symbol_name (void)
       if (mbstowcs (NULL, name, len) == (size_t) -1)
        as_warn (_("symbol name not recognised in the current locale"));
     }
-  else if (is_name_beginner (c) || c == '\001')
+  else if (is_name_beginner (c) || (input_from_string && c == FAKE_LABEL_CHAR))
     {
       ptrdiff_t len;
 
       name = input_line_pointer - 1;
 
-      /* We accept \001 in a name in case this is
+      /* We accept FAKE_LABEL_CHAR in a name in case this is
         being called with a constructed string.  */
       while (is_part_of_name (c = *input_line_pointer++)
-            || c == '\001')
+            || (input_from_string && c == FAKE_LABEL_CHAR))
        ;
 
       len = (input_line_pointer - name) - 1;
@@ -3507,6 +3509,58 @@ s_space (int mult)
     mri_comment_end (stop, stopc);
 }
 
+void
+s_nops (int ignore ATTRIBUTE_UNUSED)
+{
+  expressionS exp;
+  expressionS val;
+
+#ifdef md_flush_pending_output
+  md_flush_pending_output ();
+#endif
+
+#ifdef md_cons_align
+  md_cons_align (1);
+#endif
+
+  expression (&exp);
+
+  if (*input_line_pointer == ',')
+    {
+      ++input_line_pointer;
+      expression (&val);
+    }
+  else
+    {
+      val.X_op = O_constant;
+      val.X_add_number = 0;
+    }
+
+  if (val.X_op == O_constant)
+    {
+      if (val.X_add_number < 0)
+       {
+         as_warn (_("negative nop control byte, ignored"));
+         val.X_add_number = 0;
+       }
+
+      if (!need_pass_2)
+       {
+         /* Store the no-op instruction control byte in the first byte
+            of frag.  */
+         char *p;
+         symbolS *sym = make_expr_symbol (&exp);
+         p = frag_var (rs_space_nop, 1, 1, (relax_substateT) 0,
+                       sym, (offsetT) 0, (char *) 0);
+         *p = val.X_add_number;
+       }
+    }
+  else
+    as_bad (_("unsupported variable nop control in .nops directive"));
+
+  demand_empty_rest_of_line ();
+}
+
 /* This is like s_space, but the value is a floating point number with
    the given precision.  This is for the MRI dcb.s pseudo-op and
    friends.  */
@@ -4489,7 +4543,10 @@ emit_expr_with_reloc (expressionS *exp,
            }
 
          if (i < exp->X_add_number)
-           as_warn (_("bignum truncated to %d bytes"), nbytes);
+           as_warn (ngettext ("bignum truncated to %d byte",
+                              "bignum truncated to %d bytes",
+                              nbytes),
+                    nbytes);
          size = nbytes;
        }
 
@@ -4565,7 +4622,9 @@ emit_expr_fix (expressionS *exp, unsigned int nbytes, fragS *frag, char *p,
 
       if (size > nbytes)
        {
-         as_bad (_("%s relocations do not fit in %u bytes\n"),
+         as_bad (ngettext ("%s relocations do not fit in %u byte",
+                           "%s relocations do not fit in %u bytes",
+                           nbytes),
                  reloc_howto->name, nbytes);
          return;
        }
@@ -4674,7 +4733,11 @@ parse_bitfield_cons (expressionS *exp, unsigned int nbytes)
 
          if ((width = exp->X_add_number) > (BITS_PER_CHAR * nbytes))
            {
-             as_warn (_("field width %lu too big to fit in %d bytes: truncated to %d bits"),
+             as_warn (ngettext ("field width %lu too big to fit in %d byte:"
+                                " truncated to %d bits",
+                                "field width %lu too big to fit in %d bytes:"
+                                " truncated to %d bits",
+                                nbytes),
                       width, nbytes, (BITS_PER_CHAR * nbytes));
              width = BITS_PER_CHAR * nbytes;
            }                   /* Too big.  */
@@ -6235,9 +6298,10 @@ s_bundle_unlock (int arg ATTRIBUTE_UNUSED)
 
   size = pending_bundle_size (bundle_lock_frag);
 
-  if (size > (1U << bundle_align_p2))
-    as_bad (_(".bundle_lock sequence is %u bytes, but bundle size only %u"),
-           size, 1 << bundle_align_p2);
+  if (size > 1U << bundle_align_p2)
+    as_bad (_(".bundle_lock sequence is %u bytes, "
+             "but bundle size is only %u bytes"),
+           size, 1u << bundle_align_p2);
   else
     finish_bundle (bundle_lock_frag, size);
 
@@ -6375,6 +6439,7 @@ temp_ilp (char *buf)
 
   input_line_pointer = buf;
   buffer_limit = buf + strlen (buf);
+  input_from_string = TRUE;
 }
 
 /* Restore a saved input line pointer.  */
@@ -6386,6 +6451,7 @@ restore_ilp (void)
 
   input_line_pointer = saved_ilp;
   buffer_limit = saved_limit;
+  input_from_string = FALSE;
 
   saved_ilp = NULL;
 }
This page took 0.026932 seconds and 4 git commands to generate.