GNU Binutils with patches for OS216
修訂 | c4306ea069ec2207753c0413afee0f8551478f19 (tree) |
---|---|
時間 | 2016-03-15 09:39:06 |
作者 | H.J. Lu <hjl.tools@gmai...> |
Commiter | H.J. Lu |
Set BFD_DECOMPRESS to decompress debug sections
We should set BFD_DECOMPRESS to decompress debug sections when reading in
DWARF debug sections.
Backport from master
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.
@@ -1,3 +1,12 @@ | ||
1 | +2016-03-14 H.J. Lu <hongjiu.lu@intel.com> | |
2 | + | |
3 | + Backport from master | |
4 | + 2016-01-28 H.J. Lu <hongjiu.lu@intel.com> | |
5 | + | |
6 | + PR binutils/19523 | |
7 | + * dwarf2.c (_bfd_dwarf2_slurp_debug_info): Set BFD_DECOMPRESS to | |
8 | + decompress debug sections. | |
9 | + | |
1 | 10 | 2016-03-09 H.J. Lu <hongjiu.lu@intel.com> |
2 | 11 | |
3 | 12 | PR ld/19579 |
@@ -3706,8 +3706,10 @@ _bfd_dwarf2_slurp_debug_info (bfd *abfd, bfd *debug_bfd, | ||
3706 | 3706 | fail more quickly. */ |
3707 | 3707 | return FALSE; |
3708 | 3708 | |
3709 | + /* Set BFD_DECOMPRESS to decompress debug sections. */ | |
3709 | 3710 | if ((debug_bfd = bfd_openr (debug_filename, NULL)) == NULL |
3710 | - || ! bfd_check_format (debug_bfd, bfd_object) | |
3711 | + || !(debug_bfd->flags |= BFD_DECOMPRESS, | |
3712 | + bfd_check_format (debug_bfd, bfd_object)) | |
3711 | 3713 | || (msec = find_debug_info (debug_bfd, |
3712 | 3714 | debug_sections, NULL)) == NULL |
3713 | 3715 | || !bfd_generic_link_read_symbols (debug_bfd)) |
@@ -1,3 +1,16 @@ | ||
1 | +2016-03-14 H.J. Lu <hongjiu.lu@intel.com> | |
2 | + | |
3 | + Backport from master | |
4 | + 2016-01-28 H.J. Lu <hongjiu.lu@intel.com> | |
5 | + | |
6 | + PR binutils/19523 | |
7 | + * Makefile.am (check-DEJAGNU): Pass CC and CC_FOR_BUILD to | |
8 | + runtest. | |
9 | + * Makefile.in: Regenerated. | |
10 | + * testsuite/binutils-all/compress.exp (test_gnu_debuglink): New | |
11 | + proc. | |
12 | + Run test_gnu_debuglink for native ELF build. | |
13 | + | |
1 | 14 | 2016-03-09 Nick Clifton <nickc@redhat.com> |
2 | 15 | |
3 | 16 | PR binutils/19775 |
@@ -192,6 +192,7 @@ check-DEJAGNU: site.exp | ||
192 | 192 | EXPECT=$(EXPECT); export EXPECT; \ |
193 | 193 | runtest=$(RUNTEST); \ |
194 | 194 | if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ |
195 | + CC="$(CC)" CC_FOR_BUILD="$(CC_FOR_BUILD)" \ | |
195 | 196 | CC_FOR_TARGET="$(CC_FOR_TARGET)" CFLAGS_FOR_TARGET="$(CFLAGS)" \ |
196 | 197 | $$runtest --tool $(DEJATOOL) --srcdir $${srcdir}/testsuite \ |
197 | 198 | $(RUNTESTFLAGS); \ |
@@ -1290,6 +1290,7 @@ check-DEJAGNU: site.exp | ||
1290 | 1290 | EXPECT=$(EXPECT); export EXPECT; \ |
1291 | 1291 | runtest=$(RUNTEST); \ |
1292 | 1292 | if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ |
1293 | + CC="$(CC)" CC_FOR_BUILD="$(CC_FOR_BUILD)" \ | |
1293 | 1294 | CC_FOR_TARGET="$(CC_FOR_TARGET)" CFLAGS_FOR_TARGET="$(CFLAGS)" \ |
1294 | 1295 | $$runtest --tool $(DEJATOOL) --srcdir $${srcdir}/testsuite \ |
1295 | 1296 | $(RUNTESTFLAGS); \ |
@@ -667,4 +667,97 @@ if { ([istarget "x86_64-*-elf*"] | ||
667 | 667 | |
668 | 668 | set testname "Convert x32 object to x86-64 (3)" |
669 | 669 | convert_test "$testname" "--nocompress-debug-sections --x32" "-O elf64-x86-64 --compress-debug-sections=zlib-gnu" |
670 | - } | |
670 | +} | |
671 | + | |
672 | +proc test_gnu_debuglink {} { | |
673 | + global srcdir | |
674 | + global subdir | |
675 | + global env | |
676 | + global CC_FOR_TARGET | |
677 | + global STRIP | |
678 | + global OBJCOPY | |
679 | + global OBJDUMP | |
680 | + | |
681 | + set test "gnu-debuglink" | |
682 | + if {![info exists CC_FOR_TARGET]} { | |
683 | + set CC_FOR_TARGET $env(CC) | |
684 | + } | |
685 | + if { $CC_FOR_TARGET == "" } { | |
686 | + unsupported $test | |
687 | + return | |
688 | + } | |
689 | + | |
690 | + if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog exectuable debug] != "" } { | |
691 | + fail "$test (build)" | |
692 | + return | |
693 | + } | |
694 | + set got [remote_exec host "$OBJDUMP -S tmpdir/testprog" "" "/dev/null" "tmpdir/testprog.dump"] | |
695 | + if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { | |
696 | + fail "$test (objcopy dump)" | |
697 | + return | |
698 | + } | |
699 | + if { [binutils_run $STRIP "--strip-debug --remove-section=.comment --remove-section=.note tmpdir/testprog -o tmpdir/testprog.strip"] != "" } { | |
700 | + fail "$test (strip)" | |
701 | + return | |
702 | + } | |
703 | + if { [binutils_run $OBJCOPY "--only-keep-debug --decompress-debug-sections tmpdir/testprog tmpdir/testprog.decompress"] != "" } { | |
704 | + fail "$test (objcopy decompress)" | |
705 | + return | |
706 | + } | |
707 | + if { [binutils_run $OBJCOPY "--only-keep-debug --compress-debug-sections tmpdir/testprog tmpdir/testprog.compress"] != "" } { | |
708 | + fail "$test (objcopy compress)" | |
709 | + return | |
710 | + } | |
711 | + if { [binutils_run $OBJCOPY "--add-gnu-debuglink=tmpdir/testprog.decompress tmpdir/testprog.strip tmpdir/testprog"] != "" } { | |
712 | + fail "$test (objcopy link decompress)" | |
713 | + return | |
714 | + } | |
715 | + set got [remote_exec host "$OBJDUMP -S tmpdir/testprog" "" "/dev/null" "tmpdir/testprog.decompress.dump"] | |
716 | + if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { | |
717 | + fail "$test (objcopy dump decompress)" | |
718 | + return | |
719 | + } | |
720 | + if { [binutils_run $OBJCOPY "--add-gnu-debuglink=tmpdir/testprog.compress tmpdir/testprog.strip tmpdir/testprog"] != "" } { | |
721 | + fail "$test (objcopy link compress)" | |
722 | + return | |
723 | + } | |
724 | + set got [remote_exec host "$OBJDUMP -S tmpdir/testprog" "" "/dev/null" "tmpdir/testprog.compress.dump"] | |
725 | + if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { | |
726 | + fail "$test (objcopy dump compress)" | |
727 | + return | |
728 | + } | |
729 | + | |
730 | + set src1 tmpdir/testprog.dump | |
731 | + set src2 tmpdir/testprog.compress.dump | |
732 | + send_log "cmp ${src1} ${src2}\n" | |
733 | + verbose "cmp ${src1} ${src2}" | |
734 | + set status [remote_exec build cmp "${src1} ${src2}"] | |
735 | + set exec_output [lindex $status 1] | |
736 | + set exec_output [prune_warnings $exec_output] | |
737 | + if ![string match "" $exec_output] then { | |
738 | + send_log "$exec_output\n" | |
739 | + verbose "$exec_output" 1 | |
740 | + fail "$test (objdump 1)" | |
741 | + } else { | |
742 | + pass "$test (objdump 1)" | |
743 | + } | |
744 | + | |
745 | + set src1 tmpdir/testprog.decompress.dump | |
746 | + set src2 tmpdir/testprog.compress.dump | |
747 | + send_log "cmp ${src1} ${src2}\n" | |
748 | + verbose "cmp ${src1} ${src2}" | |
749 | + set status [remote_exec build cmp "${src1} ${src2}"] | |
750 | + set exec_output [lindex $status 1] | |
751 | + set exec_output [prune_warnings $exec_output] | |
752 | + if ![string match "" $exec_output] then { | |
753 | + send_log "$exec_output\n" | |
754 | + verbose "$exec_output" 1 | |
755 | + fail "$test (objdump 2)" | |
756 | + } else { | |
757 | + pass "$test (objdump 2)" | |
758 | + } | |
759 | +} | |
760 | + | |
761 | +if {[isnative] && [is_elf_format]} then { | |
762 | + test_gnu_debuglink | |
763 | +} |