summaryrefslogtreecommitdiff
path: root/gas/read.c
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 /gas/read.c
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.
Diffstat (limited to 'gas/read.c')
-rw-r--r--gas/read.c65
1 files changed, 41 insertions, 24 deletions
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: