diff --git a/gas/macro.c b/gas/macro.c index 763bafbdc3d..f9f2d63e9f7 100644 --- a/gas/macro.c +++ b/gas/macro.c @@ -265,7 +265,7 @@ buffer_and_nest (const char *from, const char *to, sb *ptr, { char saved_eol_char = ptr->ptr[ptr->len]; - ptr->ptr[ptr->len] = '\0'; + ptr->ptr[ptr->len] = '\n'; temp_ilp (ptr->ptr + i + 8); s_linefile (0); restore_ilp (); diff --git a/gas/read.c b/gas/read.c index 9f6a7007ebf..f1099cba1a3 100644 --- a/gas/read.c +++ b/gas/read.c @@ -2049,18 +2049,22 @@ s_linefile (int ignore ATTRIBUTE_UNUSED) if (file || flags) { - linenum--; + demand_empty_rest_of_line (); + + /* read_a_source_file() will bump the line number only if the line + is terminated by '\n'. */ + if (input_line_pointer[-1] == '\n') + linenum--; + new_logical_line_flags (file, linenum, flags); #ifdef LISTING if (listing) listing_source_line (linenum); #endif + return; } } - if (file || flags) - demand_empty_rest_of_line (); - else - ignore_rest_of_line (); + ignore_rest_of_line (); } /* Handle the .end pseudo-op. Actually, the real work is done in