diff options
author | Andrew Stubbs <andrew.stubbs@st.com> | 2009-01-16 10:26:49 +0000 |
---|---|---|
committer | Andrew Stubbs <andrew.stubbs@st.com> | 2009-01-16 10:26:49 +0000 |
commit | e04befd0f5bf511dba7a32717d075d90d7de361f (patch) | |
tree | 7904c7c296b0f5f3d05733a9d8fe45966753489c /gas/read.c | |
parent | 44893cfbc73c24109274650160914fa9378f40fd (diff) | |
download | gdb-e04befd0f5bf511dba7a32717d075d90d7de361f.zip gdb-e04befd0f5bf511dba7a32717d075d90d7de361f.tar.gz gdb-e04befd0f5bf511dba7a32717d075d90d7de361f.tar.bz2 |
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.c | 65 |
1 files changed, 41 insertions, 24 deletions
@@ -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: |