summaryrefslogtreecommitdiff
path: root/gas/read.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2020-09-15 10:53:46 +0100
committerNick Clifton <nickc@redhat.com>2020-09-15 10:53:46 +0100
commitf36eda1fe30d394274a5f0becdff45bbd81fd6a8 (patch)
treea5c649c542367a4ea45a376a801cdbdbea0a962f /gas/read.c
parent6db9990640cdf7bc0880149f2707904506518fb8 (diff)
downloadbinutils-gdb-f36eda1fe30d394274a5f0becdff45bbd81fd6a8.tar.gz
Fix the assembler's new .nop directive so that the input line pointer is preserved.
* read.c (s_nop): Preserve the input_line_pointer around the call to md_assemble. * config/tc-s12z.c (md_assemble): Revert previous delta.
Diffstat (limited to 'gas/read.c')
-rw-r--r--gas/read.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gas/read.c b/gas/read.c
index 97a9e66e6f4..ff4737ef2cb 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -3530,7 +3530,12 @@ s_nop (int ignore ATTRIBUTE_UNUSED)
if (asprintf (&nop, "%s", md_single_noop_insn) < 0)
as_fatal ("%s", xstrerror (errno));
+ /* Some targets assume that they can update input_line_pointer inside
+ md_assemble, and, worse, that they can leave it assigned to the string
+ pointer that was provided as an argument. So preserve ilp here. */
+ char * saved_ilp = input_line_pointer;
md_assemble (nop);
+ input_line_pointer = saved_ilp;
free (nop);
#endif
}