aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gas/expr.c50
-rw-r--r--gas/testsuite/gas/all/quoted-sym-names.d11
-rw-r--r--gas/testsuite/gas/all/quoted-sym-names.s17
-rw-r--r--gas/testsuite/gas/elf/syms.d2
-rw-r--r--gas/testsuite/gas/elf/syms.s4
5 files changed, 69 insertions, 15 deletions
diff --git a/gas/expr.c b/gas/expr.c
index c7f4de5..1e97a83 100644
--- a/gas/expr.c
+++ b/gas/expr.c
@@ -2400,18 +2400,52 @@ get_symbol_name (char ** ilp_return)
}
else if (c == '"')
{
- bool backslash_seen;
+ char *dst = input_line_pointer;
* ilp_return = input_line_pointer;
- do
+ for (;;)
{
- backslash_seen = c == '\\';
- c = * input_line_pointer ++;
- }
- while (c != 0 && (c != '"' || backslash_seen));
+ c = *input_line_pointer++;
+
+ if (c == 0)
+ {
+ as_warn (_("missing closing '\"'"));
+ break;
+ }
- if (c == 0)
- as_warn (_("missing closing '\"'"));
+ if (c == '"')
+ {
+ char *ilp_save = input_line_pointer;
+
+ SKIP_WHITESPACE ();
+ if (*input_line_pointer == '"')
+ {
+ ++input_line_pointer;
+ continue;
+ }
+ input_line_pointer = ilp_save;
+ break;
+ }
+
+ if (c == '\\')
+ switch (*input_line_pointer)
+ {
+ case '"':
+ case '\\':
+ c = *input_line_pointer++;
+ break;
+
+ default:
+ if (c != 0)
+ as_warn (_("'\\%c' in quoted symbol name; "
+ "behavior may change in the future"),
+ *input_line_pointer);
+ break;
+ }
+
+ *dst++ = c;
+ }
+ *dst = 0;
}
*--input_line_pointer = 0;
return c;
diff --git a/gas/testsuite/gas/all/quoted-sym-names.d b/gas/testsuite/gas/all/quoted-sym-names.d
index cf7a9ae..5f0d3f8 100644
--- a/gas/testsuite/gas/all/quoted-sym-names.d
+++ b/gas/testsuite/gas/all/quoted-sym-names.d
@@ -1,6 +1,13 @@
-#nm: --extern-only
+#nm: --extern-only --numeric-sort
#name: quoted symbol names
+# No quoted strings handling (TC_STRING_ESCAPES set to 0):
+#notarget: powerpc*-*-aix* powerpc*-*-beos* powerpc-*-macos* rs6000-*-*
+# Explicitly no escapes in quoted strings:
+#notarget: z80-*-*
#...
0+00 T test-a
-
+0+01 T back\\slash
+0+02 T back"slash
+0+03 T backslash\\
+0+04 T backslash"
diff --git a/gas/testsuite/gas/all/quoted-sym-names.s b/gas/testsuite/gas/all/quoted-sym-names.s
index b4b6171..677f5dd 100644
--- a/gas/testsuite/gas/all/quoted-sym-names.s
+++ b/gas/testsuite/gas/all/quoted-sym-names.s
@@ -1,4 +1,19 @@
.text
.globl "test-a"
"test-a":
- .word 0
+ .byte 0
+ .globl "back\\slash"
+"back\\slash":
+ .byte 0
+ .globl "back\"slash"
+"back\"slash":
+ .byte 0
+ .globl "backslash\\"
+"backslash\\":
+ .byte 0
+ .globl "backslash\""
+"backslash\"":
+ .byte 0
+/* .globl "back""slash" */
+"back""slash":
+ .byte 0
diff --git a/gas/testsuite/gas/elf/syms.d b/gas/testsuite/gas/elf/syms.d
index 011075f..f1f40c1 100644
--- a/gas/testsuite/gas/elf/syms.d
+++ b/gas/testsuite/gas/elf/syms.d
@@ -1,7 +1,5 @@
#readelf: -S -s -p .strtab
#name: Multibyte symbol names
-# The following targets use an unusual .set syntax...
-#notarget: alpha*-*-* h8300-*-*
#...
Section Headers:
diff --git a/gas/testsuite/gas/elf/syms.s b/gas/testsuite/gas/elf/syms.s
index 977c6bb..0fd960d 100644
--- a/gas/testsuite/gas/elf/syms.s
+++ b/gas/testsuite/gas/elf/syms.s
@@ -1,5 +1,5 @@
- .section "sec\xa5\xc2tion"
+ .section "sec\xa5\xc2tion", "a"
- .set "sy\xa5\xc2mbol", .
+ .equiv "sy\xa5\xc2mbol", .
.string8 "str\xa5\xc2ing"