]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2009-01-16 Andrew Stubbs <ams@codesourcery.com>
authorAndrew Stubbs <andrew.stubbs@st.com>
Fri, 16 Jan 2009 10:26:49 +0000 (10:26 +0000)
committerAndrew Stubbs <andrew.stubbs@st.com>
Fri, 16 Jan 2009 10:26:49 +0000 (10:26 +0000)
    Daniel Jacobowitz  <dan@codesourcery.com>

gas/
* config/tc-arm.c (arm_copy_symbol_attributes): New function.
* config/tc-arm.h (arm_copy_symbol_attributes): New prototype.
(CONVERT_SYMBOLIC_ATTRIBUTE): New define.
* read.c (s_vendor_attribute): Add support for symbolic tag names.
Improve string parser.
* doc/c-arm.texi (ARM Machine Directives): Document
.eabi_attribute symbolic tag names.

gas/testsuite/
* gas/arm/attr-syntax.d: New file.
* gas/arm/attr-syntax.s: New file.

gas/ChangeLog
gas/config/tc-arm.c
gas/config/tc-arm.h
gas/doc/c-arm.texi
gas/read.c
gas/testsuite/ChangeLog
gas/testsuite/gas/arm/attr-syntax.d [new file with mode: 0644]
gas/testsuite/gas/arm/attr-syntax.s [new file with mode: 0644]

index ceb4eea5d522eda62db8c11876dc3f41b75a346a..bbfe3a1c9c50599ed86228901e0688327230bc34 100644 (file)
@@ -1,3 +1,14 @@
+2009-01-16  Andrew Stubbs  <ams@codesourcery.com>
+           Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * config/tc-arm.c (arm_copy_symbol_attributes): New function.
+       * config/tc-arm.h (arm_copy_symbol_attributes): New prototype.
+       (CONVERT_SYMBOLIC_ATTRIBUTE): New define.
+       * read.c (s_vendor_attribute): Add support for symbolic tag names.
+       Improve string parser.
+       * doc/c-arm.texi (ARM Machine Directives): Document
+       .eabi_attribute symbolic tag names.
+
 2009-01-16  Alan Modra  <amodra@bigpond.net.au>
 
        * configure.in (commonbfdlib): Delete.
index a8aca804750781a18760dba5a9ab243b99738d7c..bdd42f81729e26d1af0be7d35e5f16e74c06b950 100644 (file)
@@ -20972,3 +20972,67 @@ arm_copy_symbol_attributes (symbolS *dest, symbolS *src)
 {
   ARM_GET_FLAG (dest) = ARM_GET_FLAG (src);
 }
+
+/* Given a symbolic attribute NAME, return the proper integer value.
+   Returns -1 if the attribute is not known.  */
+int
+arm_convert_symbolic_attribute (const char *name)
+{
+#define T(tag) {#tag, tag}
+  /* When you modify this table you should also
+     modify the list in doc/c-arm.texi.  */
+  static const struct {
+    const char *name;
+    const int tag;
+  } attribute_table[] = {
+      T(Tag_CPU_raw_name),
+      T(Tag_CPU_name),
+      T(Tag_CPU_arch),
+      T(Tag_CPU_arch_profile),
+      T(Tag_ARM_ISA_use),
+      T(Tag_THUMB_ISA_use),
+      T(Tag_VFP_arch),
+      T(Tag_WMMX_arch),
+      T(Tag_Advanced_SIMD_arch),
+      T(Tag_PCS_config),
+      T(Tag_ABI_PCS_R9_use),
+      T(Tag_ABI_PCS_RW_data),
+      T(Tag_ABI_PCS_RO_data),
+      T(Tag_ABI_PCS_GOT_use),
+      T(Tag_ABI_PCS_wchar_t),
+      T(Tag_ABI_FP_rounding),
+      T(Tag_ABI_FP_denormal),
+      T(Tag_ABI_FP_exceptions),
+      T(Tag_ABI_FP_user_exceptions),
+      T(Tag_ABI_FP_number_model),
+      T(Tag_ABI_align8_needed),
+      T(Tag_ABI_align8_preserved),
+      T(Tag_ABI_enum_size),
+      T(Tag_ABI_HardFP_use),
+      T(Tag_ABI_VFP_args),
+      T(Tag_ABI_WMMX_args),
+      T(Tag_ABI_optimization_goals),
+      T(Tag_ABI_FP_optimization_goals),
+      T(Tag_compatibility),
+      T(Tag_CPU_unaligned_access),
+      T(Tag_VFP_HP_extension),
+      T(Tag_ABI_FP_16bit_format),
+      T(Tag_nodefaults),
+      T(Tag_also_compatible_with),
+      T(Tag_conformance),
+      T(Tag_T2EE_use),
+      T(Tag_Virtualization_use),
+      T(Tag_MPextension_use)
+  };
+#undef T
+  unsigned int i;
+
+  if (name == NULL)
+    return -1;
+
+  for (i = 0; i < ARRAY_SIZE(attribute_table); i++)
+    if (strcmp (name, attribute_table[i].name) == 0)
+      return attribute_table[i].tag;
+
+  return -1;
+}
index 9b58762e6f3bd5ea6c3e9c753e6e5a9afe6b67e7..353c9af8696f2826c148072eed3cf6f8c8b5dab2 100644 (file)
@@ -284,3 +284,6 @@ extern void tc_arm_frame_initial_instructions (void);
 void tc_pe_dwarf2_emit_offset (symbolS *, unsigned int);
 
 #endif /* TE_PE */
+
+extern int arm_convert_symbolic_attribute (const char *);
+#define CONVERT_SYMBOLIC_ATTRIBUTE(name) arm_convert_symbolic_attribute (name)
index 9e698b0c377030770faac88d86e8994b6b929596..8b48c28dc24880cbf684451d274b4a9003cf18bb 100644 (file)
@@ -652,9 +652,30 @@ are the same as for the @option{-mfpu} commandline option.
 
 @cindex @code{.eabi_attribute} directive, ARM
 @item .eabi_attribute @var{tag}, @var{value}
-Set the EABI object attribute number @var{tag} to @var{value}.  The value
-is either a @code{number}, @code{"string"}, or @code{number, "string"}
-depending on the tag.
+Set the EABI object attribute @var{tag} to @var{value}.
+
+The @var{tag} is either an attribute number, or one of the following:
+@code{Tag_CPU_raw_name}, @code{Tag_CPU_name}, @code{Tag_CPU_arch},
+@code{Tag_CPU_arch_profile}, @code{Tag_ARM_ISA_use},
+@code{Tag_THUMB_ISA_use}, @code{Tag_VFP_arch}, @code{Tag_WMMX_arch},
+@code{Tag_Advanced_SIMD_arch}, @code{Tag_PCS_config},
+@code{Tag_ABI_PCS_R9_use}, @code{Tag_ABI_PCS_RW_data},
+@code{Tag_ABI_PCS_RO_data}, @code{Tag_ABI_PCS_GOT_use},
+@code{Tag_ABI_PCS_wchar_t}, @code{Tag_ABI_FP_rounding},
+@code{Tag_ABI_FP_denormal}, @code{Tag_ABI_FP_exceptions},
+@code{Tag_ABI_FP_user_exceptions}, @code{Tag_ABI_FP_number_model},
+@code{Tag_ABI_align8_needed}, @code{Tag_ABI_align8_preserved},
+@code{Tag_ABI_enum_size}, @code{Tag_ABI_HardFP_use},
+@code{Tag_ABI_VFP_args}, @code{Tag_ABI_WMMX_args},
+@code{Tag_ABI_optimization_goals}, @code{Tag_ABI_FP_optimization_goals},
+@code{Tag_compatibility}, @code{Tag_CPU_unaligned_access},
+@code{Tag_VFP_HP_extension}, @code{Tag_ABI_FP_16bit_format},
+@code{Tag_nodefaults}, @code{Tag_also_compatible_with},
+@code{Tag_conformance}, @code{Tag_T2EE_use},
+@code{Tag_Virtualization_use}, @code{Tag_MPextension_use}
+
+The @var{value} is either a @code{number}, @code{"string"}, or
+@code{number, "string"} depending on the tag.
 
 @end table
 
index e9a897170d71f393c052e40a7367ac3f96720b80..502e2580881da385d09541eb5f66ba15e23543f8 100644 (file)
@@ -2069,13 +2069,45 @@ s_vendor_attribute (int vendor)
   int tag;
   unsigned int i = 0;
   char *s = NULL;
-  char saved_char;
 
-  expression (& exp);
-  if (exp.X_op != O_constant)
-    goto bad;
+  /* Read the first number or name.  */
+  skip_whitespace (input_line_pointer);
+  s = input_line_pointer;
+  if (ISDIGIT (*input_line_pointer))
+    {
+      expression (& exp);
+      if (exp.X_op != O_constant)
+       goto bad;
+      tag = exp.X_add_number;
+    }
+  else
+    {
+      char *name;
+
+      /* A name may contain '_', but no other punctuation.  */
+      for (; ISALNUM (*input_line_pointer) || *input_line_pointer == '_';
+          ++input_line_pointer)
+       i++;
+      if (i == 0)
+       goto bad;
+
+      name = alloca (i + 1);
+      memcpy (name, s, i);
+      name[i] = '\0';
+
+#ifndef CONVERT_SYMBOLIC_ATTRIBUTE
+#define CONVERT_SYMBOLIC_ATTRIBUTE(a) -1
+#endif
+
+      tag = CONVERT_SYMBOLIC_ATTRIBUTE (name);
+      if (tag == -1)
+       {
+         as_bad (_("Attribute name not recognised: %s"), name);
+         ignore_rest_of_line ();
+         return;
+       }
+    }
 
-  tag = exp.X_add_number;
   type = _bfd_elf_obj_attrs_arg_type (stdoutput, vendor, tag);
 
   if (skip_past_comma (&input_line_pointer) == -1)
@@ -2100,22 +2132,12 @@ s_vendor_attribute (int vendor)
     }
   if (type & 2)
     {
-      skip_whitespace(input_line_pointer);
-      if (*input_line_pointer != '"')
-       goto bad_string;
-      input_line_pointer++;
-      s = input_line_pointer;
-      while (*input_line_pointer && *input_line_pointer != '"')
-       input_line_pointer++;
+      int len;
+
+      skip_whitespace (input_line_pointer);
       if (*input_line_pointer != '"')
        goto bad_string;
-      saved_char = *input_line_pointer;
-      *input_line_pointer = 0;
-    }
-  else
-    {
-      s = NULL;
-      saved_char = 0;
+      s = demand_copy_C_string (&len);
     }
 
   switch (type)
@@ -2133,11 +2155,6 @@ s_vendor_attribute (int vendor)
       abort ();
     }
 
-  if (s)
-    {
-      *input_line_pointer = saved_char;
-      input_line_pointer++;
-    }
   demand_empty_rest_of_line ();
   return;
 bad_string:
index fd201a3f8248fa3dee376a0120ec30d95f7e567c..b4039ef213c552059a54509cf00f5657857f254c 100644 (file)
@@ -1,3 +1,9 @@
+2009-01-16  Andrew Stubbs  <ams@codesourcery.com>
+           Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * gas/arm/attr-syntax.d: New file.
+       * gas/arm/attr-syntax.s: New file.
+
 2009-01-15  Nick Clifton  <nickc@redhat.com>
 
        PR 9722
diff --git a/gas/testsuite/gas/arm/attr-syntax.d b/gas/testsuite/gas/arm/attr-syntax.d
new file mode 100644 (file)
index 0000000..893bdb9
--- /dev/null
@@ -0,0 +1,3 @@
+#source: attr-syntax.s
+#as:
+#error: :1: Error: Attribute name not recognised: made_up_tag.*:3: Error: expected <tag> , <value>.*:5: Error: expected <tag> , <value>
diff --git a/gas/testsuite/gas/arm/attr-syntax.s b/gas/testsuite/gas/arm/attr-syntax.s
new file mode 100644 (file)
index 0000000..52c8450
--- /dev/null
@@ -0,0 +1,6 @@
+.eabi_attribute made_up_tag, 11
+.eabi_attribute 12, 3
+.eabi_attribute , 2
+.eabi_attribute Tag_CPU_name, "hi"
+.eabi_attribute 10asdf, 3
+.eabi_attribute Tag_ABI_align8_needed, 1