summaryrefslogtreecommitdiff
path: root/binutils/testsuite
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-07-03 16:06:31 +0000
committerH.J. Lu <hjl.tools@gmail.com>2012-07-03 16:06:31 +0000
commit9fd0b9a622aaa64017f232611120ff7fa828b67a (patch)
tree156699688e75cb5ad4d5dc5c596bee884650418d /binutils/testsuite
parent9bb2949b19d073515dda13091ea423b57d6e760c (diff)
downloadbinutils-redhat-9fd0b9a622aaa64017f232611120ff7fa828b67a.tar.gz
Don't compress empty debug section
2012-07-03 H.J. Lu <hongjiu.lu@intel.com> PR binutils/14319 * elf.c (_bfd_elf_make_section_from_shdr): Don't compress empty debug section. 2012-07-03 H.J. Lu <hongjiu.lu@intel.com> PR binutils/14319 * binutils-all/compress.exp: Test compress empty debug sections. * binutils-all/dw2-empty.S: New file.
Diffstat (limited to 'binutils/testsuite')
-rw-r--r--binutils/testsuite/ChangeLog7
-rw-r--r--binutils/testsuite/binutils-all/compress.exp29
-rw-r--r--binutils/testsuite/binutils-all/dw2-empty.S1
3 files changed, 37 insertions, 0 deletions
diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog
index bb777f16cd..6b5a418728 100644
--- a/binutils/testsuite/ChangeLog
+++ b/binutils/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2012-07-03 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/14319
+ * binutils-all/compress.exp: Test compress empty debug sections.
+
+ * binutils-all/dw2-empty.S: New file.
+
2012-06-07 Thomas Schwinge <thomas@codesourcery.com>
* binutils-all/i386/i386.exp: Don't skip for x86_64-*-linux*.
diff --git a/binutils/testsuite/binutils-all/compress.exp b/binutils/testsuite/binutils-all/compress.exp
index 91ed7e4140..3b0b48563f 100644
--- a/binutils/testsuite/binutils-all/compress.exp
+++ b/binutils/testsuite/binutils-all/compress.exp
@@ -133,3 +133,32 @@ if ![string match "" $got] then {
pass "$testname"
}
}
+
+set testfile tmpdir/dw2-emty.o
+
+if { ![binutils_assemble_flags $srcdir/$subdir/dw2-empty.S $testfile --nocompress-debug-sections] } then {
+ unsupported "compressed debug sections"
+ return
+}
+
+set testname "objcopy compress empty debug sections"
+set got [binutils_run $OBJCOPY "--compress-debug-sections $testfile ${copyfile}.o"]
+if ![string match "" $got] then {
+ fail "objcopy ($testname)"
+} else {
+ send_log "cmp $testfile ${copyfile}.o\n"
+ verbose "cmp $testfile ${copyfile}.o"
+ set src1 ${testfile}
+ set src2 ${copyfile}.o
+ set status [remote_exec build cmp "${src1} ${src2}"]
+ set exec_output [lindex $status 1]
+ set exec_output [prune_warnings $exec_output]
+
+ if [string match "" $exec_output] then {
+ pass "objcopy ($testname)"
+ } else {
+ send_log "$exec_output\n"
+ verbose "$exec_output" 1
+ fail "objcopy ($testname)"
+ }
+}
diff --git a/binutils/testsuite/binutils-all/dw2-empty.S b/binutils/testsuite/binutils-all/dw2-empty.S
new file mode 100644
index 0000000000..63a2b9006a
--- /dev/null
+++ b/binutils/testsuite/binutils-all/dw2-empty.S
@@ -0,0 +1 @@
+ .section .debug_line