[PATCH 3/3] gas: scrubber handling of string continuation across lines

Jan Beulich jbeulich@suse.com
Fri Jun 19 08:18:18 GMT 2026


Apparently forever (according to [available] history) two backslashes have
been emitted when, afaict, only one was meant.
---
RFC: Of course the behavior here (with or without this change) has an
     unwanted effect: With

	.macro m n:req
	.print "n: >>>\n<<<"
	.print ">>>\
<<<"
	.endm

     the 2nd .print use also references the "n" macro parameter. Problem
     being that at the scrubbing stage different forms of quoted entities
     (directive vs macro arguments) cannot be distinguished. Question
     therefore is whether such string continuation handling is useful in
     the first place.

--- a/gas/app.c
+++ b/gas/app.c
@@ -699,12 +699,12 @@ do_scrub_chars (size_t (*get) (char *, s
 	  ch = GET ();
 	  switch (ch)
 	    {
-	      /* Handle strings broken across lines, by turning '\n' into
-		 '\\' and 'n'.  */
+	      /* Handle strings broken across lines, by turning '\\' followed
+		 by '\n' into '\\' (already emitted when state moved to 6) and
+		 'n'.  */
 	    case '\n':
-	      UNGET ('n');
 	      add_newlines++;
-	      PUT ('\\');
+	      PUT ('n');
 	      continue;
 
 	    case EOF:



More information about the Binutils mailing list