aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2022-05-18 09:38:18 +0200
committerJan Beulich <jbeulich@suse.com>2022-05-18 09:38:18 +0200
commit9c70556165e97c43a2d7e829211e2c15fd7b3582 (patch)
treec9d0a7cca3bd5547e4b38d799b481c8ec67686c2 /gas/testsuite
parent7e6d6b62d8d2036a86a36b7f03862bb23506bf5c (diff)
downloadgdb-9c70556165e97c43a2d7e829211e2c15fd7b3582.zip
gdb-9c70556165e97c43a2d7e829211e2c15fd7b3582.tar.gz
gdb-9c70556165e97c43a2d7e829211e2c15fd7b3582.tar.bz2
gas: avoid bignum related errors when processing .linefile
Any construct which to the scrubber looks like a C preprocessor line/file "directive" is converted to .linefile, but the amount of checking the scrubber does is minimal (albeit it does let through only decimal digits for the line part of the contruct). Since the scrubber conversion is further tied to # being a line comment character, anything which upon closer inspection turns out not to be a line/file "directive" is supposed to be treated as a comment, i.e. ignored. Therefore we cannot use get_absolute_expression(), as this may raise errors. Open- code the function instead, treating everything not resulting in O_constant as a comment as well. Furthermore also bounds-check the parsed value. This bounds check tries to avoid implementation defined behavior (which may be the raising of an implementation defined signal), but for now makes the assumption that int has less than 64 bits. The way bfd_signed_vma (which is what offsetT aliases) is defined in bfd.h for the BFD64 case I cannot really see a clean way of avoiding this assumption. Omitting the #ifdef, otoh, would risk "condition is always false" warnings by compilers. Convert get_linefile_number() to return bool at this occasion as well.
Diffstat (limited to 'gas/testsuite')
-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
3 files changed, 12 insertions, 0 deletions
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"