aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2020-05-04 10:19:38 +0100
committerNick Clifton <nickc@redhat.com>2020-05-04 10:19:38 +0100
commit4706679daca21b5d637afaf5b55858b26f0f8c16 (patch)
tree8950f5eb3edfacd8a64ff517515f9144daf5f624 /gas/testsuite
parent6015a0674901be2c3fd24867e1a610d2abf8c1a0 (diff)
downloadgdb-4706679daca21b5d637afaf5b55858b26f0f8c16.zip
gdb-4706679daca21b5d637afaf5b55858b26f0f8c16.tar.gz
gdb-4706679daca21b5d637afaf5b55858b26f0f8c16.tar.bz2
Fix an illegal memory access in the assembler when generating a DWARF5 file/directory table with no entries.
PR 25917 * dwarf2dbg.c (out_dir_and_file_list): Check for the directory table's existence before looking at its entries. * testsuite/gas/elf/pr25917.s: New test source file. * testsuite/gas/elf/pr25917.d: New test driver. * testsuite/gas/elf/elf.exp (run_elf_list_test): Run the new test.
Diffstat (limited to 'gas/testsuite')
-rw-r--r--gas/testsuite/gas/elf/elf.exp1
-rw-r--r--gas/testsuite/gas/elf/pr25917.d9
-rw-r--r--gas/testsuite/gas/elf/pr25917.s4
3 files changed, 14 insertions, 0 deletions
diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp
index 31026e4..86b304a 100644
--- a/gas/testsuite/gas/elf/elf.exp
+++ b/gas/testsuite/gas/elf/elf.exp
@@ -274,6 +274,7 @@ if { [is_elf_format] } then {
run_dump_test "dwarf2-18" $dump_opts
run_dump_test "dwarf2-19" $dump_opts
run_dump_test "dwarf-5-file0" $dump_opts
+ run_dump_test "pr25917"
run_dump_test "bss"
run_dump_test "bad-bss"
run_dump_test "bad-section-flag"
diff --git a/gas/testsuite/gas/elf/pr25917.d b/gas/testsuite/gas/elf/pr25917.d
new file mode 100644
index 0000000..6f83bbb
--- /dev/null
+++ b/gas/testsuite/gas/elf/pr25917.d
@@ -0,0 +1,9 @@
+#as: --gdwarf-5
+#name: DWARF5: no files or directories
+#readelf: -wl
+
+#...
+ The Directory Table is empty.
+
+ No Line Number Statements.
+#pass
diff --git a/gas/testsuite/gas/elf/pr25917.s b/gas/testsuite/gas/elf/pr25917.s
new file mode 100644
index 0000000..ec8d5a9
--- /dev/null
+++ b/gas/testsuite/gas/elf/pr25917.s
@@ -0,0 +1,4 @@
+ .section .debug_info,"",%progbits
+.Ldebug_info0:
+ .dc.l 0x30
+ .dc.l 0x5