+2018-01-31  Alan Modra  <amodra@gmail.com>
+
+       PR 22714
+       * app.c (last_char): New static var.
+       (struct app_save): Add last_char field.
+       (app_push, app_pop): Handle it.
+       (do_scrub_chars): Use last_char in test for "\@".  Set last_char.
+
 2018-01-29  Eric Botcazou  <ebotcazou@adacore.com>
 
        PR gas/22738
 
 static const char   symver_pseudo[] = ".symver";
 static const char * symver_state;
 #endif
+#ifdef TC_ARM
+static char last_char;
+#endif
 
 static char lex[256];
 static const char symbol_chars[] =
 #if defined TC_ARM && defined OBJ_ELF
   const char * symver_state;
 #endif
+#ifdef TC_ARM
+  char last_char;
+#endif
 };
 
 char *
 #if defined TC_ARM && defined OBJ_ELF
   saved->symver_state = symver_state;
 #endif
+#ifdef TC_ARM
+  saved->last_char = last_char;
+#endif
 
   /* do_scrub_begin() is not useful, just wastes time.  */
 
 #if defined TC_ARM && defined OBJ_ELF
   symver_state = saved->symver_state;
 #endif
+#ifdef TC_ARM
+  last_char = saved->last_char;
+#endif
 
   free (arg);
 }
 #ifdef TC_ARM
          /* For the ARM, care is needed not to damage occurrences of \@
             by stripping the @ onwards.  Yuck.  */
-         if (to > tostart && *(to - 1) == '\\')
+         if ((to > tostart ? to[-1] : last_char) == '\\')
            /* Do not treat the @ as a start-of-comment.  */
            goto de_fault;
 #endif
 
  fromeof:
   /* We have reached the end of the input.  */
+#ifdef TC_ARM
+  if (to > tostart)
+    last_char = to[-1];
+#endif
   return to - tostart;
 
  tofull:
   else
     saved_input = NULL;
 
+#ifdef TC_ARM
+  if (to > tostart)
+    last_char = to[-1];
+#endif
   return to - tostart;
 }