diff options
author | Nick Clifton <nickc@redhat.com> | 2015-08-21 16:42:14 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2015-08-21 16:42:14 +0100 |
commit | d02603dc201f80cd9d2a1f4b1a16110b1e04222b (patch) | |
tree | b55476923d8bde556b6b3421345bde8e4562ad97 /gas/config/tc-mips.c | |
parent | 40045d91812b25c88c8275b8c08d27c234b68ba8 (diff) | |
download | gdb-d02603dc201f80cd9d2a1f4b1a16110b1e04222b.zip gdb-d02603dc201f80cd9d2a1f4b1a16110b1e04222b.tar.gz gdb-d02603dc201f80cd9d2a1f4b1a16110b1e04222b.tar.bz2 |
Allow symbol and label names to be enclosed in double quotes.
gas PR gas/18581
* expr.c (get_symbol_end): Rename to get_symbol_name. Add a
return parameter pointing to the start of the symbol. Allow
symbol names enclosed in double quotes.
(restore_line_pointer): New function. Replace the NUL character
inserted into the input stream with the given character. If the
character was a double quote, advance the input pointer.
* expr.h (get_symbol_end): Delete.
(get_symbol_name): Add prototype.
(restore_line_pointer): Prototype.
* read.h (SKIP_WHITESPACE_AFTER_NAME): New macro.
* doc/as.texinfo (Symbol Intro): Document that symbol names can
now be enclosed in double quotes.
* cond.c (s_ifdef): Replace get_symbol_end with get_symbol_name.
Use restore_line_pointer to replace the NUL in the input stream.
Use SKIP_WHITESPACE_AFTER_NAME to skip past the end of a symbol.
Check for the use of double quoted symbol names.
* expr.c: Likewise.
* config/obj-aout.c: Likewise.
* config/obj-coff-seh.c: Likewise.
* config/obj-coff.c: Likewise.
* config/obj-elf.c: Likewise.
* config/obj-evax.c: Likewise.
* config/obj-macho.c: Likewise.
* config/obj-som.c: Likewise.
* config/tc-alpha.c: Likewise.
* config/tc-arc.c: Likewise.
* config/tc-arm.c: Likewise.
* config/tc-dlx.c: Likewise.
* config/tc-h8300.c: Likewise.
* config/tc-hppa.c: Likewise.
* config/tc-i370.c: Likewise.
* config/tc-i386-intel.c: Likewise.
* config/tc-i386.c: Likewise.
* config/tc-i960.c: Likewise.
* config/tc-ia64.c: Likewise.
* config/tc-iq2000.c: Likewise.
* config/tc-m32r.c: Likewise.
* config/tc-m68hc11.c: Likewise.
* config/tc-m68k.c: Likewise.
* config/tc-microblaze.c: Likewise.
* config/tc-mips.c: Likewise.
* config/tc-mmix.c: Likewise.
* config/tc-mn10200.c: Likewise.
* config/tc-mn10300.c: Likewise.
* config/tc-nios2.c: Likewise.
* config/tc-ppc.c: Likewise.
* config/tc-s390.c: Likewise.
* config/tc-score.c: Likewise.
* config/tc-score7.c: Likewise.
* config/tc-sparc.c: Likewise.
* config/tc-tic4x.c: Likewise.
* config/tc-tic54x.c: Likewise.
* config/tc-tic6x.c: Likewise.
* config/tc-tilegx.c: Likewise.
* config/tc-tilepro.c: Likewise.
* config/tc-v850.c: Likewise.
* config/tc-xtensa.c: Likewise.
* config/tc-z80.c: Likewise.
* dw2gencfi.c: Likewise.
* dwarf2dbgc.: Likewise.
* ecoff.c: Likewise.
* read.c: Likewise.
* stabs.c: Likewise.
tests PR gas/18581
* gas/all/byte.d: Disable this test. Quoted expressions
are now allowed in .byte directives.
* gas/all/quoted-sym-names.s: New test.
* gas/all/quoted-sym-names.d: Expected output.
* gas/all/gas.exp: Run the new test.
Diffstat (limited to 'gas/config/tc-mips.c')
-rw-r--r-- | gas/config/tc-mips.c | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 74b7fb4..d951dfc 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -15134,10 +15134,9 @@ get_symbol (void) char *name; symbolS *p; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); p = (symbolS *) symbol_find_or_make (name); - *input_line_pointer = c; + (void) restore_line_pointer (c); return p; } @@ -15280,28 +15279,34 @@ s_change_sec (int sec) void s_change_section (int ignore ATTRIBUTE_UNUSED) { + char *saved_ilp; char *section_name; - char c; + char c, endc; char next_c = 0; int section_type; int section_flag; int section_entry_size; int section_alignment; - section_name = input_line_pointer; - c = get_symbol_end (); + saved_ilp = input_line_pointer; + endc = get_symbol_name (§ion_name); + c = (endc == '"' ? input_line_pointer[1] : endc); if (c) - next_c = *(input_line_pointer + 1); + next_c = input_line_pointer [(endc == '"' ? 2 : 1)]; /* Do we have .section Name<,"flags">? */ if (c != ',' || (c == ',' && next_c == '"')) { - /* just after name is now '\0'. */ - *input_line_pointer = c; - input_line_pointer = section_name; + /* Just after name is now '\0'. */ + (void) restore_line_pointer (endc); + input_line_pointer = saved_ilp; obj_elf_section (ignore); return; } + + section_name = xstrdup (section_name); + c = restore_line_pointer (endc); + input_line_pointer++; /* Do we have .section Name<,type><,flag><,entry_size><,alignment> */ @@ -15309,23 +15314,25 @@ s_change_section (int ignore ATTRIBUTE_UNUSED) section_type = get_absolute_expression (); else section_type = 0; + if (*input_line_pointer++ == ',') section_flag = get_absolute_expression (); else section_flag = 0; + if (*input_line_pointer++ == ',') section_entry_size = get_absolute_expression (); else section_entry_size = 0; + if (*input_line_pointer++ == ',') section_alignment = get_absolute_expression (); else section_alignment = 0; + /* FIXME: really ignore? */ (void) section_alignment; - section_name = xstrdup (section_name); - /* When using the generic form of .section (as implemented by obj-elf.c), there's no way to set the section type to SHT_MIPS_DWARF. Users have traditionally had to fall back on the more common @progbits instead. @@ -15404,13 +15411,12 @@ s_mips_globl (int x ATTRIBUTE_UNUSED) do { - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); symbolP = symbol_find_or_make (name); S_SET_EXTERNAL (symbolP); *input_line_pointer = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); /* On Irix 5, every global symbol that is not explicitly labelled as being a function is apparently labelled as being an object. */ @@ -15422,12 +15428,11 @@ s_mips_globl (int x ATTRIBUTE_UNUSED) char *secname; asection *sec; - secname = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&secname); sec = bfd_get_section_by_name (stdoutput, secname); if (sec == NULL) as_bad (_("%s: no such section"), secname); - *input_line_pointer = c; + (void) restore_line_pointer (c); if (sec != NULL && (sec->flags & SEC_CODE) != 0) flag = BSF_FUNCTION; @@ -15455,8 +15460,7 @@ s_option (int x ATTRIBUTE_UNUSED) char *opt; char c; - opt = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&opt); if (*opt == 'O') { @@ -15488,7 +15492,7 @@ s_option (int x ATTRIBUTE_UNUSED) else as_warn (_("unrecognized option \"%s\""), opt); - *input_line_pointer = c; + (void) restore_line_pointer (c); demand_empty_rest_of_line (); } @@ -16425,13 +16429,12 @@ s_mips_weakext (int ignore ATTRIBUTE_UNUSED) symbolS *symbolP; expressionS exp; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); symbolP = symbol_find_or_make (name); S_SET_WEAK (symbolP); *input_line_pointer = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (! is_end_of_line[(unsigned char) *input_line_pointer]) { |