summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Stubbs <andrew.stubbs@st.com>2009-01-16 10:26:49 +0000
committerAndrew Stubbs <andrew.stubbs@st.com>2009-01-16 10:26:49 +0000
commit461710384d383367c8674cf62d6c24a74b1c2a35 (patch)
tree3ba3f451664726dfae175f931624087a84cd5159
parent4f3f7e2970b75916ad6a4f4f260e3582fe00596b (diff)
downloadbinutils-redhat-461710384d383367c8674cf62d6c24a74b1c2a35.tar.gz
2009-01-16 Andrew Stubbs <ams@codesourcery.com>
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.
-rw-r--r--gas/ChangeLog11
-rw-r--r--gas/config/tc-arm.c64
-rw-r--r--gas/config/tc-arm.h3
-rw-r--r--gas/doc/c-arm.texi27
-rw-r--r--gas/read.c65
-rw-r--r--gas/testsuite/ChangeLog6
-rw-r--r--gas/testsuite/gas/arm/attr-syntax.d3
-rw-r--r--gas/testsuite/gas/arm/attr-syntax.s6
8 files changed, 158 insertions, 27 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index ceb4eea5d5..bbfe3a1c9c 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -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.
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index a8aca80475..bdd42f8172 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -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;
+}
diff --git a/gas/config/tc-arm.h b/gas/config/tc-arm.h
index 9b58762e6f..353c9af869 100644
--- a/gas/config/tc-arm.h
+++ b/gas/config/tc-arm.h
@@ -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)
diff --git a/gas/doc/c-arm.texi b/gas/doc/c-arm.texi
index 9e698b0c37..8b48c28dc2 100644
--- a/gas/doc/c-arm.texi
+++ b/gas/doc/c-arm.texi
@@ -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
diff --git a/gas/read.c b/gas/read.c
index e9a897170d..502e258088 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -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:
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index fd201a3f82..b4039ef213 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -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
index 0000000000..893bdb9872
--- /dev/null
+++ b/gas/testsuite/gas/arm/attr-syntax.d
@@ -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
index 0000000000..52c84503f9
--- /dev/null
+++ b/gas/testsuite/gas/arm/attr-syntax.s
@@ -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