aboutsummaryrefslogtreecommitdiff
path: root/binutils/testsuite/binutils-all
diff options
context:
space:
mode:
Diffstat (limited to 'binutils/testsuite/binutils-all')
-rw-r--r--binutils/testsuite/binutils-all/compress.exp10
-rw-r--r--binutils/testsuite/binutils-all/debug_str.d9
-rw-r--r--binutils/testsuite/binutils-all/debug_str.s12
3 files changed, 31 insertions, 0 deletions
diff --git a/binutils/testsuite/binutils-all/compress.exp b/binutils/testsuite/binutils-all/compress.exp
index 570425b..d74555d 100644
--- a/binutils/testsuite/binutils-all/compress.exp
+++ b/binutils/testsuite/binutils-all/compress.exp
@@ -173,3 +173,13 @@ if ![string match "" $got] then {
fail "objcopy ($testname)"
}
}
+
+if ![is_remote host] {
+ set tempfile tmpdir/debug_str.o
+ set copyfile tmpdir/debug_str.copy
+} else {
+ set tempfile [remote_download host tmpdir/debug_str.o]
+ set copyfile debug_str.copy
+}
+
+run_dump_test "debug_str"
diff --git a/binutils/testsuite/binutils-all/debug_str.d b/binutils/testsuite/binutils-all/debug_str.d
new file mode 100644
index 0000000..eda1db1
--- /dev/null
+++ b/binutils/testsuite/binutils-all/debug_str.d
@@ -0,0 +1,9 @@
+#PROG: objcopy
+#source: debug_str.s
+#objdump: -h
+#name: Uncompressed .debug_str section starting with ZLIB
+
+.*ebug_str.copy.o: file format .*
+#...
+ . .debug_str 0+01. 0+0 0+0 0+0.. 2..0
+#...
diff --git a/binutils/testsuite/binutils-all/debug_str.s b/binutils/testsuite/binutils-all/debug_str.s
new file mode 100644
index 0000000..485d0cc
--- /dev/null
+++ b/binutils/testsuite/binutils-all/debug_str.s
@@ -0,0 +1,12 @@
+/* This test is derived from a C source file which, when compiled by gcc
+ with debugging enabled, managed to create a .debug_str section whose
+ first string was ZLIB_VER_SUBVERSION. The code in bfd/compress.c
+ used to just check for the characters "ZLIB" at the start of a section
+ and then assume that the section was compressed. This meant that the BFD
+ library then processed the next 8 bytes as if they were the size of the
+ decompressed version of the section. Naturally with this test case the
+ resulting size was gigantic and consequently the library quickly ran out
+ of memory. */
+
+ .section .debug_str,"MS",@progbits,1
+ .string "ZLIB_VER_SUBREVISION 0"