* PATCH: PR binutils/14319: unable to initialize commpress status for section .debug_line
@ 2012-06-30 22:25 H.J. Lu
2012-07-03 16:02 ` nick clifton
0 siblings, 1 reply; 2+ messages in thread
From: H.J. Lu @ 2012-06-30 22:25 UTC (permalink / raw)
To: binutils
Hi,
This patch avoids compressing empty debug sections. OK to install?
Thanks.
H.J.
----
bfd/
2012-06-30 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/14319
* elf.c (_bfd_elf_make_section_from_shdr): Don't compress empty
debug section.
binutils/testsuite/
2012-06-30 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.
diff --git a/bfd/elf.c b/bfd/elf.c
index ecbf727..8933c2c 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1025,7 +1025,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
else
{
/* Normal section. Check if we should compress. */
- if ((abfd->flags & BFD_COMPRESS))
+ if ((abfd->flags & BFD_COMPRESS) && newsect->size != 0)
action = compress;
}
diff --git a/binutils/testsuite/binutils-all/compress.exp b/binutils/testsuite/binutils-all/compress.exp
index 91ed7e4..3b0b485 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 0000000..63a2b90
--- /dev/null
+++ b/binutils/testsuite/binutils-all/dw2-empty.S
@@ -0,0 +1 @@
+ .section .debug_line
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: PATCH: PR binutils/14319: unable to initialize commpress status for section .debug_line
2012-06-30 22:25 PATCH: PR binutils/14319: unable to initialize commpress status for section .debug_line H.J. Lu
@ 2012-07-03 16:02 ` nick clifton
0 siblings, 0 replies; 2+ messages in thread
From: nick clifton @ 2012-07-03 16:02 UTC (permalink / raw)
To: H.J. Lu; +Cc: H.J. Lu, binutils
Hi H.J.
> 2012-06-30 H.J. Lu <hongjiu.lu@intel.com>
>
> PR binutils/14319
> * elf.c (_bfd_elf_make_section_from_shdr): Don't compress empty
> debug section.
>
> binutils/testsuite/
>
> 2012-06-30 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.
Approved - please apply.
Cheers
Nick
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-07-03 16:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-30 22:25 PATCH: PR binutils/14319: unable to initialize commpress status for section .debug_line H.J. Lu
2012-07-03 16:02 ` nick clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).