aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
Diffstat (limited to 'gas')
-rw-r--r--gas/read.c19
-rw-r--r--gas/testsuite/gas/all/gas.exp2
-rw-r--r--gas/testsuite/gas/all/linefile.l5
-rw-r--r--gas/testsuite/gas/all/linefile.s5
4 files changed, 27 insertions, 4 deletions
diff --git a/gas/read.c b/gas/read.c
index 9870a04..8524d0b 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -2037,17 +2037,28 @@ s_file (int ignore ATTRIBUTE_UNUSED)
}
}
-static int
+static bool
get_linefile_number (int *flag)
{
+ expressionS exp;
+
SKIP_WHITESPACE ();
if (*input_line_pointer < '0' || *input_line_pointer > '9')
- return 0;
+ return false;
+
+ expression_and_evaluate (&exp);
+ if (exp.X_op != O_constant)
+ return false;
+
+#if defined (BFD64) || LONG_MAX > INT_MAX
+ if (exp.X_add_number < INT_MIN || exp.X_add_number > INT_MAX)
+ return false;
+#endif
- *flag = get_absolute_expression ();
+ *flag = exp.X_add_number;
- return 1;
+ return true;
}
/* Handle the .linefile pseudo-op. This is automatically generated by
diff --git a/gas/testsuite/gas/all/gas.exp b/gas/testsuite/gas/all/gas.exp
index 1b87cf2..279d9b3 100644
--- a/gas/testsuite/gas/all/gas.exp
+++ b/gas/testsuite/gas/all/gas.exp
@@ -465,6 +465,8 @@ run_dump_test quoted-sym-names
# "# <line> <file>" into .linefile (PR gas/29120).
setup_xfail "tic30-*-*"
run_list_test cond-2 "-al"
+setup_xfail "tic30-*-*"
+run_list_test linefile ""
run_list_test macro "-alm"
diff --git a/gas/testsuite/gas/all/linefile.l b/gas/testsuite/gas/all/linefile.l
new file mode 100644
index 0000000..7a5f700
--- /dev/null
+++ b/gas/testsuite/gas/all/linefile.l
@@ -0,0 +1,5 @@
+# This should match the output of gas linefile.s.
+.*linefile\.s: Assembler messages:
+.*linefile\.s:2: Warning: line 2
+.*linefile\.s:5: Warning: line 5
+#pass
diff --git a/gas/testsuite/gas/all/linefile.s b/gas/testsuite/gas/all/linefile.s
new file mode 100644
index 0000000..4b34fee
--- /dev/null
+++ b/gas/testsuite/gas/all/linefile.s
@@ -0,0 +1,5 @@
+# 12345678900 "LineFile.s"
+ .warning "line 2"
+
+# 123456789123456789123456789 "LINEfile.s"
+ .warning "line 5"