aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2016-01-28 13:29:53 -0800
committerH.J. Lu <hjl.tools@gmail.com>2016-01-28 13:29:53 -0800
commitbf150a0bad8d3fcfa17f5d6b5a5ca75efae855ed (patch)
treef52bdea6825b37b8dae31c51509af6bf7810b97c /binutils
parent935c61442bc369c0cf9db6f998ef6a18ba83a116 (diff)
downloadgdb-bf150a0bad8d3fcfa17f5d6b5a5ca75efae855ed.zip
gdb-bf150a0bad8d3fcfa17f5d6b5a5ca75efae855ed.tar.gz
gdb-bf150a0bad8d3fcfa17f5d6b5a5ca75efae855ed.tar.bz2
Set BFD_DECOMPRESS to decompress debug sections
We should set BFD_DECOMPRESS to decompress debug sections when reading in DWARF debug sections. bfd/ PR binutils/19523 * dwarf2.c (_bfd_dwarf2_slurp_debug_info): Set BFD_DECOMPRESS to decompress debug sections. binutils/ PR binutils/19523 * Makefile.am (check-DEJAGNU): Pass CC and CC_FOR_BUILD to runtest. * Makefile.in: Regenerated. * testsuite/binutils-all/compress.exp (test_gnu_debuglink): New proc. Run test_gnu_debuglink for native ELF build.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog10
-rw-r--r--binutils/Makefile.am1
-rw-r--r--binutils/Makefile.in1
-rw-r--r--binutils/testsuite/binutils-all/compress.exp95
4 files changed, 106 insertions, 1 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index d836de3..edc66cd 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,13 @@
+2016-01-28 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/19523
+ * Makefile.am (check-DEJAGNU): Pass CC and CC_FOR_BUILD to
+ runtest.
+ * Makefile.in: Regenerated.
+ * testsuite/binutils-all/compress.exp (test_gnu_debuglink): New
+ proc.
+ Run test_gnu_debuglink for native ELF build.
+
2016-01-20 Nick Clifton <nickc@redhat.com>
PR 19495
diff --git a/binutils/Makefile.am b/binutils/Makefile.am
index 39ef2ff..18af2c8 100644
--- a/binutils/Makefile.am
+++ b/binutils/Makefile.am
@@ -192,6 +192,7 @@ check-DEJAGNU: site.exp
EXPECT=$(EXPECT); export EXPECT; \
runtest=$(RUNTEST); \
if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+ CC="$(CC)" CC_FOR_BUILD="$(CC_FOR_BUILD)" \
CC_FOR_TARGET="$(CC_FOR_TARGET)" CFLAGS_FOR_TARGET="$(CFLAGS)" \
$$runtest --tool $(DEJATOOL) --srcdir $${srcdir}/testsuite \
$(RUNTESTFLAGS); \
diff --git a/binutils/Makefile.in b/binutils/Makefile.in
index 2acf8ce..bd4f792 100644
--- a/binutils/Makefile.in
+++ b/binutils/Makefile.in
@@ -1290,6 +1290,7 @@ check-DEJAGNU: site.exp
EXPECT=$(EXPECT); export EXPECT; \
runtest=$(RUNTEST); \
if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+ CC="$(CC)" CC_FOR_BUILD="$(CC_FOR_BUILD)" \
CC_FOR_TARGET="$(CC_FOR_TARGET)" CFLAGS_FOR_TARGET="$(CFLAGS)" \
$$runtest --tool $(DEJATOOL) --srcdir $${srcdir}/testsuite \
$(RUNTESTFLAGS); \
diff --git a/binutils/testsuite/binutils-all/compress.exp b/binutils/testsuite/binutils-all/compress.exp
index d7c5e0a..b35aba4 100644
--- a/binutils/testsuite/binutils-all/compress.exp
+++ b/binutils/testsuite/binutils-all/compress.exp
@@ -667,4 +667,97 @@ if { ([istarget "x86_64-*-elf*"]
set testname "Convert x32 object to x86-64 (3)"
convert_test "$testname" "--nocompress-debug-sections --x32" "-O elf64-x86-64 --compress-debug-sections=zlib-gnu"
- }
+}
+
+proc test_gnu_debuglink {} {
+ global srcdir
+ global subdir
+ global env
+ global CC_FOR_TARGET
+ global STRIP
+ global OBJCOPY
+ global OBJDUMP
+
+ set test "gnu-debuglink"
+ if {![info exists CC_FOR_TARGET]} {
+ set CC_FOR_TARGET $env(CC)
+ }
+ if { $CC_FOR_TARGET == "" } {
+ unsupported $test
+ return
+ }
+
+ if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog exectuable debug] != "" } {
+ fail "$test (build)"
+ return
+ }
+ set got [remote_exec host "$OBJDUMP -S tmpdir/testprog" "" "/dev/null" "tmpdir/testprog.dump"]
+ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
+ fail "$test (objcopy dump)"
+ return
+ }
+ if { [binutils_run $STRIP "--strip-debug --remove-section=.comment --remove-section=.note tmpdir/testprog -o tmpdir/testprog.strip"] != "" } {
+ fail "$test (strip)"
+ return
+ }
+ if { [binutils_run $OBJCOPY "--only-keep-debug --decompress-debug-sections tmpdir/testprog tmpdir/testprog.decompress"] != "" } {
+ fail "$test (objcopy decompress)"
+ return
+ }
+ if { [binutils_run $OBJCOPY "--only-keep-debug --compress-debug-sections tmpdir/testprog tmpdir/testprog.compress"] != "" } {
+ fail "$test (objcopy compress)"
+ return
+ }
+ if { [binutils_run $OBJCOPY "--add-gnu-debuglink=tmpdir/testprog.decompress tmpdir/testprog.strip tmpdir/testprog"] != "" } {
+ fail "$test (objcopy link decompress)"
+ return
+ }
+ set got [remote_exec host "$OBJDUMP -S tmpdir/testprog" "" "/dev/null" "tmpdir/testprog.decompress.dump"]
+ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
+ fail "$test (objcopy dump decompress)"
+ return
+ }
+ if { [binutils_run $OBJCOPY "--add-gnu-debuglink=tmpdir/testprog.compress tmpdir/testprog.strip tmpdir/testprog"] != "" } {
+ fail "$test (objcopy link compress)"
+ return
+ }
+ set got [remote_exec host "$OBJDUMP -S tmpdir/testprog" "" "/dev/null" "tmpdir/testprog.compress.dump"]
+ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
+ fail "$test (objcopy dump compress)"
+ return
+ }
+
+ set src1 tmpdir/testprog.dump
+ set src2 tmpdir/testprog.compress.dump
+ send_log "cmp ${src1} ${src2}\n"
+ verbose "cmp ${src1} ${src2}"
+ 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 {
+ send_log "$exec_output\n"
+ verbose "$exec_output" 1
+ fail "$test (objdump 1)"
+ } else {
+ pass "$test (objdump 1)"
+ }
+
+ set src1 tmpdir/testprog.decompress.dump
+ set src2 tmpdir/testprog.compress.dump
+ send_log "cmp ${src1} ${src2}\n"
+ verbose "cmp ${src1} ${src2}"
+ 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 {
+ send_log "$exec_output\n"
+ verbose "$exec_output" 1
+ fail "$test (objdump 2)"
+ } else {
+ pass "$test (objdump 2)"
+ }
+}
+
+if {[isnative] && [is_elf_format]} then {
+ test_gnu_debuglink
+}