diff options
author | Craig Silverstein <csilvers@google.com> | 2008-07-10 01:32:23 +0000 |
---|---|---|
committer | Craig Silverstein <csilvers@google.com> | 2008-07-10 01:32:23 +0000 |
commit | 1b315056928c75e989b6a0fa858577141da5cc4f (patch) | |
tree | 614e9ce91f305d95088448cd17509082373d0b1d /binutils | |
parent | 67f9f80fe82daf2c0b287fa8ccb8b96ae9e68e7f (diff) | |
download | gdb-1b315056928c75e989b6a0fa858577141da5cc4f.zip gdb-1b315056928c75e989b6a0fa858577141da5cc4f.tar.gz gdb-1b315056928c75e989b6a0fa858577141da5cc4f.tar.bz2 |
bfd/
* Makefile.am (BFD32_LIBS): Add compress.lo.
(BFD32_LIBS_CFILES): Add compress.c.
(BFD_H_FILES): Likewise.
* Makefile.in: Regenerate.
* bfd-in2.h: Regenerate.
* config.in: Add HAVE_ZLIB_H
* configure.in: Add test for libz and zlib.h
* configure: Regenerate.
* dwarf2.c (read_section): New function.
(read_indirect_string): Call new function read_section.
(read_abbrevs): Likewise.
(decode_line_info): Likewise.
(read_debug_ranges): Likewise.
(find_line): Call new function read_section when just one
.zdebug_info section is found, otherwise read and compress
multiple sections.
(_bfd_dwarf2_cleanup_debug_info): Free sec_info_ptr.
* elf.c (_bfd_elf_make_section_from_shdr): Add zdebug prefix.
(special_sections_z): New struct.
(special_sections): Refer to special_sections_z.
* elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Recognize
sections named .zdebug_*.
(_bfd_mips_elf_fake_sections): Likewise.
* compress.c: New file.
(bfd_uncompress_section_contents): New function.
bfd/doc/
* Makefile.am (BFD_H_DEP): Add ../compress.c.
* Makefile.in: Regenerate.
binutils/
* config.in: Add HAVE_ZLIB_H
* configure.in: Add test for libz and zlib.h
* configure: Regenerate.
* dwarf.c (debug_displays): Add .zdebug_* strings.
* dwarf.h (struct dwarf_section): Add fields uncompressed_namd
and compressed_name.
* objdump.c (load_debug_section): Call
bfd_uncompress_section_contents when loading a compressed
section.
(dump_dwarf_section): Recognize compressed section name.
(mach_o_dwarf_sections): Rename as
mach_o_uncompressed_dwarf_sections.
(mach_o_compressed_dwarf_sections): New variable.
(generic_dwarf_section): Rename as
generic_uncompressed_dwarf_sections.
(generic_compressed_dwarf_sections): New variable.
(check_mach_o_dwarf): Save and restore
mach_o_compressed_dwarf_sections.
* readelf.c: Add #include for config.h and zlib.h
(process_section_headers): Recognize compressed section name.
(uncompress_section_contents): New function.
(load_debug_section): Call uncompress_section_contents when
loading a compressed section.
(display_debug_section): Recognize compressed section name.
binutils/testsuite:
* binutils-all/objdump.exp: Add test for objdump -s on a file
with a compressed debug section. Add test for objdump -W on a
file that contains a compressed debug section.
* binutils-all/readelf.exp: Call readelf_compressed_wa_test.
(readelf_compressed_wa_test): New function.
* binutils-all/dw2-compressed.S: New file.
* binutils-all/objdump.W: New file.
* binutils-all/objdump.s: New file.
* binutils-all/readelf.wa: New file.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 27 | ||||
-rw-r--r-- | binutils/Makefile.in | 8 | ||||
-rw-r--r-- | binutils/config.in | 3 | ||||
-rwxr-xr-x | binutils/configure | 506 | ||||
-rw-r--r-- | binutils/configure.in | 5 | ||||
-rw-r--r-- | binutils/doc/Makefile.in | 4 | ||||
-rw-r--r-- | binutils/dwarf.c | 32 | ||||
-rw-r--r-- | binutils/dwarf.h | 10 | ||||
-rw-r--r-- | binutils/objdump.c | 86 | ||||
-rw-r--r-- | binutils/readelf.c | 112 | ||||
-rw-r--r-- | binutils/testsuite/ChangeLog | 12 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/dw2-compressed.S | 218 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/objdump.W | 129 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/objdump.exp | 43 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/objdump.s | 9 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/readelf.exp | 37 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/readelf.wa | 24 |
17 files changed, 1079 insertions, 186 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 699abcf..8491b07 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,30 @@ +2008-07-09 Craig Silverstein <csilvers@google.com> + + * config.in: Add HAVE_ZLIB_H + * configure.in: Add test for libz and zlib.h + * configure: Regenerate. + * dwarf.c (debug_displays): Add .zdebug_* strings. + * dwarf.h (struct dwarf_section): Add fields uncompressed_namd + and compressed_name. + * objdump.c (load_debug_section): Call + bfd_uncompress_section_contents when loading a compressed + section. + (dump_dwarf_section): Recognize compressed section name. + (mach_o_dwarf_sections): Rename as + mach_o_uncompressed_dwarf_sections. + (mach_o_compressed_dwarf_sections): New variable. + (generic_dwarf_section): Rename as + generic_uncompressed_dwarf_sections. + (generic_compressed_dwarf_sections): New variable. + (check_mach_o_dwarf): Save and restore + mach_o_compressed_dwarf_sections. + * readelf.c: Add #include for config.h and zlib.h + (process_section_headers): Recognize compressed section name. + (uncompress_section_contents): New function. + (load_debug_section): Call uncompress_section_contents when + loading a compressed section. + (display_debug_section): Recognize compressed section name. + 2008-07-07 Alan Modra <amodra@bigpond.net.au> * objdump.c (find_symbol_for_address): Prefer symbols in current diff --git a/binutils/Makefile.in b/binutils/Makefile.in index 4b76fae..6eeab88 100644 --- a/binutils/Makefile.in +++ b/binutils/Makefile.in @@ -534,15 +534,15 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --cygnus '; \ - cd $(srcdir) && $(AUTOMAKE) --cygnus \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ + cd $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ cd $(top_srcdir) && \ - $(AUTOMAKE) --cygnus Makefile + $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ diff --git a/binutils/config.in b/binutils/config.in index 6183c37..62e726c 100644 --- a/binutils/config.in +++ b/binutils/config.in @@ -148,6 +148,9 @@ /* Define to 1 if you have the `utimes' function. */ #undef HAVE_UTIMES +/* Define to 1 if you have the <zlib.h> header file. */ +#undef HAVE_ZLIB_H + /* Define as const if the declaration of iconv() needs const. */ #undef ICONV_CONST diff --git a/binutils/configure b/binutils/configure index b5923c2..2c1c9f4 100755 --- a/binutils/configure +++ b/binutils/configure @@ -1128,7 +1128,7 @@ esac else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi - cd $ac_popdir + cd "$ac_popdir" done fi @@ -2175,8 +2175,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2234,8 +2233,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2351,8 +2349,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2406,8 +2403,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2452,8 +2448,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2497,8 +2492,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2576,8 +2570,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2631,8 +2624,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3634,8 +3626,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3693,8 +3684,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3810,8 +3800,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3865,8 +3854,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3911,8 +3899,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3956,8 +3943,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4535,13 +4521,13 @@ if test "${lt_cv_nm_interface+set}" = set; then else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:4538: $ac_compile\"" >&5) + (eval echo "\"\$as_me:4524: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:4541: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:4527: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:4544: output\"" >&5) + (eval echo "\"\$as_me:4530: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -5596,7 +5582,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5599 "configure"' > conftest.$ac_ext + echo '#line 5585 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5723,8 +5709,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6052,8 +6037,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6223,8 +6207,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6285,8 +6268,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6698,11 +6680,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6701: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6683: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6705: \$? = $ac_status" >&5 + echo "$as_me:6687: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7020,11 +7002,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7023: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7005: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7027: \$? = $ac_status" >&5 + echo "$as_me:7009: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7125,11 +7107,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7128: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7110: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7132: \$? = $ac_status" >&5 + echo "$as_me:7114: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -7180,11 +7162,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7183: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7165: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7187: \$? = $ac_status" >&5 + echo "$as_me:7169: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -7683,8 +7665,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7752,8 +7733,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8046,8 +8026,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8999,8 +8978,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9437,8 +9415,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9541,8 +9518,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9607,8 +9583,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9701,8 +9676,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9767,8 +9741,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9834,8 +9807,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9901,8 +9873,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9977,7 +9948,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 9980 "configure" +#line 9951 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10077,7 +10048,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10080 "configure" +#line 10051 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10531,8 +10502,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10598,8 +10568,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -10688,8 +10657,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11424,8 +11392,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11579,8 +11546,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11642,8 +11608,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11724,8 +11689,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11866,8 +11830,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12043,8 +12006,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12141,8 +12103,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12239,8 +12200,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12304,8 +12264,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12348,8 +12307,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12414,8 +12372,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12458,8 +12415,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12544,8 +12500,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12599,8 +12554,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12662,8 +12616,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12724,8 +12677,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12786,8 +12738,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12854,8 +12805,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12919,8 +12869,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12989,8 +12938,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -13059,8 +13007,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -13129,8 +13076,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -13199,8 +13145,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -13269,8 +13214,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -13339,8 +13283,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -13409,8 +13352,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -13479,8 +13421,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -13520,6 +13461,282 @@ fi +# Link in zlib if we can. This allows us to read compressed debug +# sections. This is used only by readelf.c (objdump uses bfd for +# reading compressed sections). +echo "$as_me:$LINENO: checking for library containing zlibVersion" >&5 +echo $ECHO_N "checking for library containing zlibVersion... $ECHO_C" >&6 +if test "${ac_cv_search_zlibVersion+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_zlibVersion=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char zlibVersion (); +int +main () +{ +zlibVersion (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_zlibVersion="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_zlibVersion" = no; then + for ac_lib in z; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char zlibVersion (); +int +main () +{ +zlibVersion (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_zlibVersion="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_zlibVersion" >&5 +echo "${ECHO_T}$ac_cv_search_zlibVersion" >&6 +if test "$ac_cv_search_zlibVersion" != no; then + test "$ac_cv_search_zlibVersion" = "none required" || LIBS="$ac_cv_search_zlibVersion $LIBS" + +for ac_header in zlib.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +fi + + case "${host}" in *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*) @@ -13576,8 +13793,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -14293,8 +14509,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -14344,8 +14559,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -14435,8 +14649,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -15902,11 +16115,6 @@ esac *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ @@ -15945,6 +16153,12 @@ echo "$as_me: error: cannot find input file: $f" >&2;} fi;; esac done` || { (exit 1); exit 1; } + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub diff --git a/binutils/configure.in b/binutils/configure.in index fa0cee3..d6dcea8 100644 --- a/binutils/configure.in +++ b/binutils/configure.in @@ -182,6 +182,11 @@ fi AC_CHECK_DECLS([fprintf, stpcpy, strstr, sbrk, getenv, environ, getc_unlocked, snprintf, vsnprintf]) +# Link in zlib if we can. This allows us to read compressed debug +# sections. This is used only by readelf.c (objdump uses bfd for +# reading compressed sections). +AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)]) + BFD_BINARY_FOPEN # target-specific stuff: diff --git a/binutils/doc/Makefile.in b/binutils/doc/Makefile.in index 4d81e7d..5e349d2 100644 --- a/binutils/doc/Makefile.in +++ b/binutils/doc/Makefile.in @@ -285,9 +285,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --cygnus doc/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \ cd $(top_srcdir) && \ - $(AUTOMAKE) --cygnus doc/Makefile + $(AUTOMAKE) --foreign doc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ diff --git a/binutils/dwarf.c b/binutils/dwarf.c index 2892be8..d23fec2 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -4613,36 +4613,36 @@ free_debug_memory (void) struct dwarf_section_display debug_displays[] = { - { { ".debug_abbrev", NULL, 0, 0 }, + { { ".debug_abbrev", ".zdebug_abbrev", NULL, NULL, 0, 0 }, display_debug_abbrev, 0, 0 }, - { { ".debug_aranges", NULL, 0, 0 }, + { { ".debug_aranges", ".zdebug_aranges", NULL, NULL, 0, 0 }, display_debug_aranges, 0, 0 }, - { { ".debug_frame", NULL, 0, 0 }, + { { ".debug_frame", ".zdebug_frame", NULL, NULL, 0, 0 }, display_debug_frames, 1, 0 }, - { { ".debug_info", NULL, 0, 0 }, + { { ".debug_info", ".zdebug_info", NULL, NULL, 0, 0 }, display_debug_info, 1, 0 }, - { { ".debug_line", NULL, 0, 0 }, + { { ".debug_line", ".zdebug_line", NULL, NULL, 0, 0 }, display_debug_lines, 0, 0 }, - { { ".debug_pubnames", NULL, 0, 0 }, + { { ".debug_pubnames", ".zdebug_pubnames", NULL, NULL, 0, 0 }, display_debug_pubnames, 0, 0 }, - { { ".eh_frame", NULL, 0, 0 }, + { { ".eh_frame", "", NULL, NULL, 0, 0 }, display_debug_frames, 1, 1 }, - { { ".debug_macinfo", NULL, 0, 0 }, + { { ".debug_macinfo", ".zdebug_macinfo", NULL, NULL, 0, 0 }, display_debug_macinfo, 0, 0 }, - { { ".debug_str", NULL, 0, 0 }, + { { ".debug_str", ".zdebug_str", NULL, NULL, 0, 0 }, display_debug_str, 0, 0 }, - { { ".debug_loc", NULL, 0, 0 }, + { { ".debug_loc", ".zdebug_loc", NULL, NULL, 0, 0 }, display_debug_loc, 0, 0 }, - { { ".debug_pubtypes", NULL, 0, 0 }, + { { ".debug_pubtypes", ".zdebug_pubtypes", NULL, NULL, 0, 0 }, display_debug_pubnames, 0, 0 }, - { { ".debug_ranges", NULL, 0, 0 }, + { { ".debug_ranges", ".zdebug_ranges", NULL, NULL, 0, 0 }, display_debug_ranges, 0, 0 }, - { { ".debug_static_func", NULL, 0, 0 }, + { { ".debug_static_func", ".zdebug_static_func", NULL, NULL, 0, 0 }, display_debug_not_supported, 0, 0 }, - { { ".debug_static_vars", NULL, 0, 0 }, + { { ".debug_static_vars", ".zdebug_static_vars", NULL, NULL, 0, 0 }, display_debug_not_supported, 0, 0 }, - { { ".debug_types", NULL, 0, 0 }, + { { ".debug_types", ".zdebug_types", NULL, NULL, 0, 0 }, display_debug_not_supported, 0, 0 }, - { { ".debug_weaknames", NULL, 0, 0 }, + { { ".debug_weaknames", ".zdebug_weaknames", NULL, NULL, 0, 0 }, display_debug_not_supported, 0, 0 } }; diff --git a/binutils/dwarf.h b/binutils/dwarf.h index dd6f553..88595ba 100644 --- a/binutils/dwarf.h +++ b/binutils/dwarf.h @@ -1,4 +1,4 @@ -/* dwwrf.h - DWARF support header file +/* dwarf.h - DWARF support header file Copyright 2005, 2007, 2008 Free Software Foundation, Inc. @@ -31,7 +31,13 @@ typedef unsigned long dwarf_size_type; struct dwarf_section { - const char *name; + /* A debug section has a different name when it's stored compressed + * or not. COMPRESSED_NAME and UNCOMPRESSED_NAME are the two + * possibilities. NAME is set to whichever one is used for this + * input file, as determined by load_debug_section(). */ + const char *uncompressed_name; + const char *compressed_name; + const char* name; unsigned char *start; dwarf_vma address; dwarf_size_type size; diff --git a/binutils/objdump.c b/binutils/objdump.c index 5894724..c869033 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -2062,13 +2062,28 @@ load_debug_section (enum dwarf_section_display_enum debug, void *file) bfd *abfd = file; asection *sec; bfd_boolean ret; + int section_is_compressed; /* If it is already loaded, do nothing. */ if (section->start != NULL) return 1; /* Locate the debug section. */ - sec = bfd_get_section_by_name (abfd, section->name); + sec = bfd_get_section_by_name (abfd, section->uncompressed_name); + if (sec != NULL) + { + section->name = section->uncompressed_name; + section_is_compressed = 0; + } + else + { + sec = bfd_get_section_by_name (abfd, section->compressed_name); + if (sec != NULL) + { + section->name = section->compressed_name; + section_is_compressed = 1; + } + } if (sec == NULL) return 0; @@ -2097,11 +2112,24 @@ load_debug_section (enum dwarf_section_display_enum debug, void *file) ret = bfd_get_section_contents (abfd, sec, section->start, 0, section->size); - if (!ret) + if (! ret) { free_debug_section (debug); printf (_("\nCan't get contents for section '%s'.\n"), section->name); + return 0; + } + + if (section_is_compressed) + { + bfd_size_type size = section->size; + if (! bfd_uncompress_section_contents (§ion->start, &size)) + { + free_debug_section (debug); + printf (_("\nCan't uncompress section '%s'.\n"), section->name); + return 0; + } + section->size = size; } return ret; @@ -2135,15 +2163,16 @@ dump_dwarf_section (bfd *abfd, asection *section, match = name; for (i = 0; i < max; i++) - if (strcmp (debug_displays[i].section.name, match) == 0) + if (strcmp (debug_displays [i].section.uncompressed_name, match) == 0 + || strcmp (debug_displays [i].section.compressed_name, match) == 0) { - if (!debug_displays[i].eh_frame) + if (!debug_displays [i].eh_frame) { struct dwarf_section *sec = &debug_displays [i].section; if (load_debug_section (i, abfd)) { - debug_displays[i].display (sec, abfd); + debug_displays [i].display (sec, abfd); if (i != info && i != abbrev) free_debug_section (i); @@ -2153,7 +2182,7 @@ dump_dwarf_section (bfd *abfd, asection *section, } } -static const char *mach_o_dwarf_sections [] = { +static const char *mach_o_uncompressed_dwarf_sections [] = { "LC_SEGMENT.__DWARFA.__debug_abbrev", /* .debug_abbrev */ "LC_SEGMENT.__DWARFA.__debug_aranges", /* .debug_aranges */ "LC_SEGMENT.__DWARFA.__debug_frame", /* .debug_frame */ @@ -2172,7 +2201,27 @@ static const char *mach_o_dwarf_sections [] = { "LC_SEGMENT.__DWARFA.__debug_weaknames" /* .debug_weaknames */ }; -static const char *generic_dwarf_sections [max]; +static const char *mach_o_compressed_dwarf_sections [] = { + "LC_SEGMENT.__DWARFA.__zdebug_abbrev", /* .zdebug_abbrev */ + "LC_SEGMENT.__DWARFA.__zdebug_aranges", /* .zdebug_aranges */ + "LC_SEGMENT.__DWARFA.__zdebug_frame", /* .zdebug_frame */ + "LC_SEGMENT.__DWARFA.__zdebug_info", /* .zdebug_info */ + "LC_SEGMENT.__DWARFA.__zdebug_line", /* .zdebug_line */ + "LC_SEGMENT.__DWARFA.__zdebug_pubnames", /* .zdebug_pubnames */ + ".eh_frame", /* .eh_frame */ + "LC_SEGMENT.__DWARFA.__zdebug_macinfo", /* .zdebug_macinfo */ + "LC_SEGMENT.__DWARFA.__zdebug_str", /* .zdebug_str */ + "LC_SEGMENT.__DWARFA.__zdebug_loc", /* .zdebug_loc */ + "LC_SEGMENT.__DWARFA.__zdebug_pubtypes", /* .zdebug_pubtypes */ + "LC_SEGMENT.__DWARFA.__zdebug_ranges", /* .zdebug_ranges */ + "LC_SEGMENT.__DWARFA.__zdebug_static_func", /* .zdebug_static_func */ + "LC_SEGMENT.__DWARFA.__zdebug_static_vars", /* .zdebug_static_vars */ + "LC_SEGMENT.__DWARFA.__zdebug_types", /* .zdebug_types */ + "LC_SEGMENT.__DWARFA.__zdebug_weaknames" /* .zdebug_weaknames */ +}; + +static const char *generic_uncompressed_dwarf_sections [max]; +static const char *generic_compressed_dwarf_sections [max]; static void check_mach_o_dwarf (bfd *abfd) @@ -2181,18 +2230,33 @@ check_mach_o_dwarf (bfd *abfd) enum bfd_flavour current_flavour = bfd_get_flavour (abfd); enum dwarf_section_display_enum i; - if (generic_dwarf_sections [0] == NULL) + if (generic_uncompressed_dwarf_sections [0] == NULL) for (i = 0; i < max; i++) - generic_dwarf_sections [i] = debug_displays[i].section.name; + { + generic_uncompressed_dwarf_sections [i] + = debug_displays[i].section.uncompressed_name; + generic_compressed_dwarf_sections [i] + = debug_displays[i].section.compressed_name; + } if (old_flavour != current_flavour) { if (current_flavour == bfd_target_mach_o_flavour) for (i = 0; i < max; i++) - debug_displays[i].section.name = mach_o_dwarf_sections [i]; + { + debug_displays[i].section.uncompressed_name + = mach_o_uncompressed_dwarf_sections [i]; + debug_displays[i].section.compressed_name + = mach_o_compressed_dwarf_sections [i]; + } else if (old_flavour == bfd_target_mach_o_flavour) for (i = 0; i < max; i++) - debug_displays[i].section.name = generic_dwarf_sections [i]; + { + debug_displays[i].section.uncompressed_name + = generic_uncompressed_dwarf_sections [i]; + debug_displays[i].section.compressed_name + = generic_compressed_dwarf_sections [i]; + } old_flavour = current_flavour; } diff --git a/binutils/readelf.c b/binutils/readelf.c index 8c9003b..8a38db7 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -41,10 +41,14 @@ ELF file than is provided by objdump. In particular it can display DWARF debugging information which (at the moment) objdump cannot. */ +#include "config.h" #include "sysdep.h" #include <assert.h> #include <sys/stat.h> #include <time.h> +#ifdef HAVE_ZLIB_H +#include <zlib.h> +#endif /* for PATH_MAX */ #ifdef HAVE_LIMITS_H @@ -4385,9 +4389,13 @@ process_section_headers (FILE *file) || do_debug_lines || do_debug_lines_decoded || do_debug_pubnames || do_debug_aranges || do_debug_frames || do_debug_macinfo || do_debug_str || do_debug_loc || do_debug_ranges) - && const_strneq (name, ".debug_")) + && (const_strneq (name, ".debug_") + || const_strneq (name, ".zdebug_"))) { - name += 7; + if (name[1] == 'z') + name += sizeof (".zdebug_") - 1; + else + name += sizeof (".debug_") - 1; if (do_debugging || (do_debug_info && streq (name, "info")) @@ -8349,6 +8357,78 @@ is_16bit_abs_reloc (unsigned int reloc_type) } } +/* Uncompresses a section that was compressed using zlib, in place. + * This is a copy of bfd_uncompress_section_contents, in bfd/compress.c */ + +static int +uncompress_section_contents (unsigned char **buffer, dwarf_size_type *size) +{ +#ifndef HAVE_ZLIB_H + /* These are just to quiet gcc. */ + buffer = 0; + size = 0; + return FALSE; +#else + dwarf_size_type compressed_size = *size; + unsigned char* compressed_buffer = *buffer; + dwarf_size_type uncompressed_size; + unsigned char* uncompressed_buffer; + z_stream strm; + int rc; + dwarf_size_type header_size = 12; + + /* Read the zlib header. In this case, it should be "ZLIB" followed + by the uncompressed section size, 8 bytes in big-endian order. */ + if (compressed_size < header_size + || ! streq ((char*) compressed_buffer, "ZLIB")) + return 0; + uncompressed_size = compressed_buffer[4]; uncompressed_size <<= 8; + uncompressed_size += compressed_buffer[5]; uncompressed_size <<= 8; + uncompressed_size += compressed_buffer[6]; uncompressed_size <<= 8; + uncompressed_size += compressed_buffer[7]; uncompressed_size <<= 8; + uncompressed_size += compressed_buffer[8]; uncompressed_size <<= 8; + uncompressed_size += compressed_buffer[9]; uncompressed_size <<= 8; + uncompressed_size += compressed_buffer[10]; uncompressed_size <<= 8; + uncompressed_size += compressed_buffer[11]; + + /* It is possible the section consists of several compressed + buffers concatenated together, so we uncompress in a loop. */ + strm.zalloc = NULL; + strm.zfree = NULL; + strm.opaque = NULL; + strm.avail_in = compressed_size - header_size; + strm.next_in = (Bytef*) compressed_buffer + header_size; + strm.avail_out = uncompressed_size; + uncompressed_buffer = xmalloc (uncompressed_size); + + rc = inflateInit (&strm); + while (strm.avail_in > 0) + { + if (rc != Z_OK) + goto fail; + strm.next_out = ((Bytef*) uncompressed_buffer + + (uncompressed_size - strm.avail_out)); + rc = inflate (&strm, Z_FINISH); + if (rc != Z_STREAM_END) + goto fail; + rc = inflateReset (&strm); + } + rc = inflateEnd (&strm); + if (rc != Z_OK + || strm.avail_out != 0) + goto fail; + + free (compressed_buffer); + *buffer = uncompressed_buffer; + *size = uncompressed_size; + return 1; + + fail: + free (uncompressed_buffer); + return 0; +#endif /* HAVE_ZLIB_H */ +} + /* Apply relocations to a debug section. */ static void @@ -8491,13 +8571,28 @@ load_debug_section (enum dwarf_section_display_enum debug, void *file) struct dwarf_section *section = &debug_displays [debug].section; Elf_Internal_Shdr *sec; char buf [64]; + int section_is_compressed; /* If it is already loaded, do nothing. */ if (section->start != NULL) return 1; /* Locate the debug section. */ - sec = find_section (section->name); + sec = find_section (section->uncompressed_name); + if (sec != NULL) + { + section->name = section->uncompressed_name; + section_is_compressed = 0; + } + else + { + sec = find_section (section->compressed_name); + if (sec != NULL) + { + section->name = section->compressed_name; + section_is_compressed = 1; + } + } if (sec == NULL) return 0; @@ -8506,11 +8601,17 @@ load_debug_section (enum dwarf_section_display_enum debug, void *file) section->size = sec->sh_size; section->start = get_data (NULL, file, sec->sh_offset, 1, sec->sh_size, buf); + if (section->start == NULL) + return 0; + + if (section_is_compressed) + if (! uncompress_section_contents (§ion->start, §ion->size)) + return 0; if (debug_displays [debug].relocate) debug_apply_relocations (file, sec, section->start); - return section->start != NULL; + return 1; } void @@ -8547,7 +8648,8 @@ display_debug_section (Elf_Internal_Shdr *section, FILE *file) /* See if we know how to display the contents of this section. */ for (i = 0; i < max; i++) - if (streq (debug_displays[i].section.name, name)) + if (streq (debug_displays[i].section.uncompressed_name, name) + || streq (debug_displays[i].section.compressed_name, name)) { struct dwarf_section *sec = &debug_displays [i].section; diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog index 83d79d5..3fb1c55 100644 --- a/binutils/testsuite/ChangeLog +++ b/binutils/testsuite/ChangeLog @@ -1,3 +1,15 @@ +2008-07-09 Craig Silverstein <csilvers@google.com> + + * binutils-all/objdump.exp: Add test for objdump -s on a file + with a compressed debug section. Add test for objdump -W on a + file that contains a compressed debug section. + * binutils-all/readelf.exp: Call readelf_compressed_wa_test. + (readelf_compressed_wa_test): New function. + * binutils-all/dw2-compressed.S: New file. + * binutils-all/objdump.W: New file. + * binutils-all/objdump.s: New file. + * binutils-all/readelf.wa: New file. + 2008-07-08 Kai Tietz <kai.tietz@onevision.com> * binutils-all/objcopy.exp (copy_setup): Check if host-triplet diff --git a/binutils/testsuite/binutils-all/dw2-compressed.S b/binutils/testsuite/binutils-all/dw2-compressed.S new file mode 100644 index 0000000..f11d68f --- /dev/null +++ b/binutils/testsuite/binutils-all/dw2-compressed.S @@ -0,0 +1,218 @@ +/* This testcase is derived from a similar test in GDB. + + Copyright 2008 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* This tests that gdb can read compressed sections. The contents + are a basic assembly file, but the .debug_abbrev section has been + comrpessed using zlib. */ + +/* Dummy function to provide debug information for. */ + + .text + .globl _start +_start: + .int 0 +.Lbegin_text1: + .globl func_cu1 + .type func_cu1, %function +func_cu1: +.Lbegin_func_cu1: + .int 0 +.Lend_func_cu1: + .size func_cu1, .-func_cu1 +.Lend_text1: + +/* Debug information */ + + .section .debug_info +.Lcu1_begin: + /* CU header */ + .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */ +.Lcu1_start: + .2byte 2 /* DWARF Version */ + .4byte .Labbrev1_begin /* Offset into abbrev section */ + .byte 4 /* Pointer size */ + + /* CU die */ + .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ + .4byte .Lline1_begin /* DW_AT_stmt_list */ + .4byte .Lend_text1 /* DW_AT_high_pc */ + .4byte .Lbegin_text1 /* DW_AT_low_pc */ + .ascii "file1.txt\0" /* DW_AT_name */ + .ascii "GNU C 3.3.3\0" /* DW_AT_producer */ + .byte 1 /* DW_AT_language (C) */ + + /* func_cu1 */ + .uleb128 2 /* Abbrev: DW_TAG_subprogram */ + .byte 1 /* DW_AT_external */ + .byte 1 /* DW_AT_decl_file */ + .byte 2 /* DW_AT_decl_line */ + .ascii "func_cu1\0" /* DW_AT_name */ + .4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */ + .4byte .Lbegin_func_cu1 /* DW_AT_low_pc */ + .4byte .Lend_func_cu1 /* DW_AT_high_pc */ + .byte 1 /* DW_AT_frame_base: length */ + .byte 0x55 /* DW_AT_frame_base: DW_OP_reg5 */ + +.Ltype_int: + .uleb128 3 /* Abbrev: DW_TAG_base_type */ + .ascii "int\0" /* DW_AT_name */ + .byte 4 /* DW_AT_byte_size */ + .byte 5 /* DW_AT_encoding */ + + .byte 0 /* End of children of CU */ + +.Lcu1_end: + +/* Line table */ + .section .debug_line +.Lline1_begin: + .4byte .Lline1_end - .Lline1_start /* Initial length */ +.Lline1_start: + .2byte 2 /* Version */ + .4byte .Lline1_lines - .Lline1_hdr /* header_length */ +.Lline1_hdr: + .byte 1 /* Minimum insn length */ + .byte 1 /* default_is_stmt */ + .byte 1 /* line_base */ + .byte 1 /* line_range */ + .byte 0x10 /* opcode_base */ + + /* Standard lengths */ + .byte 0 + .byte 1 + .byte 1 + .byte 1 + .byte 1 + .byte 0 + .byte 0 + .byte 0 + .byte 1 + .byte 0 + .byte 0 + .byte 1 + .byte 0 + .byte 0 + .byte 0 + + /* Include directories */ + .byte 0 + + /* File names */ + .ascii "file1.txt\0" + .uleb128 0 + .uleb128 0 + .uleb128 0 + + .byte 0 + +.Lline1_lines: + .byte 0 /* DW_LNE_set_address */ + .uleb128 5 + .byte 2 + .4byte .Lbegin_func_cu1 + + .byte 3 /* DW_LNS_advance_line */ + .sleb128 3 /* ... to 4 */ + + .byte 1 /* DW_LNS_copy */ + + .byte 1 /* DW_LNS_copy (second time as an end-of-prologue marker) */ + + .byte 0 /* DW_LNE_set_address */ + .uleb128 5 + .byte 2 + .4byte .Lend_func_cu1 + + .byte 0 /* DW_LNE_end_of_sequence */ + .uleb128 1 + .byte 1 + +.Lline1_end: + +/* Abbrev table -- compressed */ + .section .zdebug_abbrev +.Labbrev1_begin: + .ascii "ZLIB" + .4byte 0 + .2byte 0 + .byte 0 + .byte 51 + .byte 0x78 + .byte 0x5e + .byte 0x63 + .byte 0x14 + .byte 0x64 + .byte 0x14 + .byte 0x60 + .byte 0x13 + .byte 0x62 + .byte 0x14 + .byte 0x64 + .byte 0x64 + .byte 0xe6 + .byte 0x50 + .byte 0xe5 + .byte 0x10 + .byte 0xe6 + .byte 0x66 + .byte 0x60 + .byte 0x60 + .byte 0xd2 + .byte 0x63 + .byte 0xb0 + .byte 0xe7 + .byte 0xb1 + .byte 0xe2 + .byte 0xb6 + .byte 0xe6 + .byte 0x66 + .byte 0xe6 + .byte 0xf0 + .byte 0x14 + .byte 0x16 + .byte 0x64 + .byte 0x14 + .byte 0x62 + .byte 0x74 + .byte 0xe0 + .byte 0x02 + .byte 0x00 + .byte 0x25 + .byte 0x78 + .byte 0x02 + .byte 0x81 + .byte 0x78 + .byte 0x9c + .byte 0x63 + .byte 0x60 + .byte 0x60 + .byte 0x56 + .byte 0x61 + .byte 0x60 + .byte 0xe6 + .byte 0xe0 + .byte 0xe6 + .byte 0xb6 + .byte 0xe3 + .byte 0x66 + .byte 0x00 + .byte 0x02 + .byte 0x00 + .byte 0x04 + .byte 0x9c + .byte 0x00 + .byte 0x92 diff --git a/binutils/testsuite/binutils-all/objdump.W b/binutils/testsuite/binutils-all/objdump.W new file mode 100644 index 0000000..18dad34 --- /dev/null +++ b/binutils/testsuite/binutils-all/objdump.W @@ -0,0 +1,129 @@ + +tmpdir/dw2-compressed.o: file format .* + +The section .debug_info contains: + + Compilation Unit @ offset 0x0: + Length: 0x4e \(32-bit\) + Version: 2 + Abbrev Offset: 0 + Pointer Size: 4 + <0><b>: Abbrev Number: 1 \(DW_TAG_compile_unit\) + < c> DW_AT_stmt_list : 0x0 + <10> DW_AT_high_pc : 0x8 + <14> DW_AT_low_pc : 0x4 + <18> DW_AT_name : file1.txt + <22> DW_AT_producer : GNU C 3.3.3 + <2e> DW_AT_language : 1 \(ANSI C\) + <1><2f>: Abbrev Number: 2 \(DW_TAG_subprogram\) + <30> DW_AT_external : 1 + <31> DW_AT_decl_file : 1 + <32> DW_AT_decl_line : 2 + <33> DW_AT_name : func_cu1 + <3c> DW_AT_type : <0x4a> + <40> DW_AT_low_pc : 0x4 + <44> DW_AT_high_pc : 0x8 + <48> DW_AT_frame_base : 1 byte block: 55 \(DW_OP_reg5\) + <1><4a>: Abbrev Number: 3 \(DW_TAG_base_type\) + <4b> DW_AT_name : int + <4f> DW_AT_byte_size : 4 + <50> DW_AT_encoding : 5 \(signed\) + +Raw dump of debug contents of section .debug_line: + + Offset: 0x0 + Length: 62 + DWARF Version: 2 + Prologue Length: 35 + Minimum Instruction Length: 1 + Initial value of 'is_stmt': 1 + Line Base: 1 + Line Range: 1 + Opcode Base: 16 + + Opcodes: + Opcode 1 has 0 args + Opcode 2 has 1 args + Opcode 3 has 1 args + Opcode 4 has 1 args + Opcode 5 has 1 args + Opcode 6 has 0 args + Opcode 7 has 0 args + Opcode 8 has 0 args + Opcode 9 has 1 args + Opcode 10 has 0 args + Opcode 11 has 0 args + Opcode 12 has 1 args + Opcode 13 has 0 args + Opcode 14 has 0 args + Opcode 15 has 0 args + + The Directory Table is empty. + + The File Name Table: + Entry Dir Time Size Name + 1 0 0 0 file1.txt + + Line Number Statements: + Extended opcode 2: set Address to .* + Advance Line by 3 to 4 + Copy + Copy + Extended opcode 2: set Address to .* + Extended opcode 1: End of Sequence + + + Offset: 0x42 + Length: 25 + DWARF Version: 2 + Prologue Length: 19 + Minimum Instruction Length: 1 + Initial value of 'is_stmt': 1 + Line Base: -5 + Line Range: 14 + Opcode Base: 13 + + Opcodes: + Opcode 1 has 0 args + Opcode 2 has 1 args + Opcode 3 has 1 args + Opcode 4 has 1 args + Opcode 5 has 1 args + Opcode 6 has 0 args + Opcode 7 has 0 args + Opcode 8 has 0 args + Opcode 9 has 1 args + Opcode 10 has 0 args + Opcode 11 has 0 args + Opcode 12 has 1 args + + The Directory Table is empty. + + The File Name Table is empty. + + Line Number Statements: + +Contents of the .zdebug_abbrev section: + + Number TAG + 1 DW_TAG_compile_unit \[has children\] + DW_AT_stmt_list DW_FORM_data4 + DW_AT_high_pc DW_FORM_addr + DW_AT_low_pc DW_FORM_addr + DW_AT_name DW_FORM_string + DW_AT_producer DW_FORM_string + DW_AT_language DW_FORM_data1 + 2 DW_TAG_subprogram \[no children\] + DW_AT_external DW_FORM_flag + DW_AT_decl_file DW_FORM_data1 + DW_AT_decl_line DW_FORM_data1 + DW_AT_name DW_FORM_string + DW_AT_type DW_FORM_ref4 + DW_AT_low_pc DW_FORM_addr + DW_AT_high_pc DW_FORM_addr + DW_AT_frame_base DW_FORM_block1 + 3 DW_TAG_base_type \[no children\] + DW_AT_name DW_FORM_string + DW_AT_byte_size DW_FORM_data1 + DW_AT_encoding DW_FORM_data1 + diff --git a/binutils/testsuite/binutils-all/objdump.exp b/binutils/testsuite/binutils-all/objdump.exp index 335b8bd..b9416a4 100644 --- a/binutils/testsuite/binutils-all/objdump.exp +++ b/binutils/testsuite/binutils-all/objdump.exp @@ -158,6 +158,49 @@ if [regexp $want $got] then { fail "objdump -s" } +# Test objdump -s on a file that contains a compressed .debug section + +if {![binutils_assemble $srcdir/$subdir/dw2-compressed.S tmpdir/dw2-compressed.o]} then { + return +} +if [is_remote host] { + set compressed_testfile [remote_download host tmpdir/dw2-compressed.o] +} else { + set compressed_testfile tmpdir/dw2-compressed.o +} + +set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS -s -j .zdebug_abbrev $compressed_testfile" "" "/dev/null" "objdump.out"] + +if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { + fail "objdump -s -j .zdebug_abbrev (reason: unexpected output)" + send_log $got + send_log "\n" +} + +if { [regexp_diff objdump.out $srcdir/$subdir/objdump.s] } then { + fail "objdump -s -j .zdebug_abbrev" +} else { + pass "objdump -s -j .zdebug_abbrev" +} + +# Test objdump -W on a file that contains some compressed .debug sections + +set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS -W $compressed_testfile" "" "/dev/null" "objdump.out"] + +if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { + fail "objdump -W (reason: unexpected output)" + send_log $got + send_log "\n" +} + +if { [regexp_diff objdump.out $srcdir/$subdir/objdump.W] } then { + fail "objdump -W" +} else { + pass "objdump -W" +} + + + # Options which are not tested: -a -d -D -R -T -x -l --stabs # I don't see any generic way to test any of these other than -a. # Tests could be written for specific targets, and that should be done diff --git a/binutils/testsuite/binutils-all/objdump.s b/binutils/testsuite/binutils-all/objdump.s new file mode 100644 index 0000000..72c59d2 --- /dev/null +++ b/binutils/testsuite/binutils-all/objdump.s @@ -0,0 +1,9 @@ + +tmpdir/dw2-compressed.o: file format .* + +Contents of section .zdebug_abbrev: + 0000 5a4c4942 00000000 00000033 785e6314 ZLIB.......3x\^c. + 0010 64146013 62146464 e650e510 e6666060 d.`.b.dd.P...f`` + 0020 d263b0e7 b1e2b6e6 66e6f014 16641462 .c......f....d.b + 0030 74e00200 25780281 789c6360 60566160 t...%x..x.c``Va` + 0040 e6e0e6b6 e3660002 00049c00 92 .....f....... diff --git a/binutils/testsuite/binutils-all/readelf.exp b/binutils/testsuite/binutils-all/readelf.exp index 52be1ee..c879af7 100644 --- a/binutils/testsuite/binutils-all/readelf.exp +++ b/binutils/testsuite/binutils-all/readelf.exp @@ -208,6 +208,42 @@ proc readelf_wi_test {} { pass "readelf -wi" } +# This tests "readelf -wa", but on a file with a compressed +# .debug_abbrev section. + +proc readelf_compressed_wa_test {} { + global READELF + global READELFFLAGS + global srcdir + global subdir + + # Compile the compressed-debug-section test file. + if { [target_compile $srcdir/$subdir/dw2-compressed.S tmpdir/dw2-compressed.o object debug] != "" } { + verbose "Unable to compile test file." + untested "readelf -wa (compressed)" + return + } + + # Download it. + set tempfile [remote_download host tmpdir/dw2-compressed.o] + + # Run "readelf -wa" on it. + set got [remote_exec host "$READELF $READELFFLAGS -wa $tempfile" "" "/dev/null" "readelf.out"] + + # Upload the results. + set output [remote_upload host readelf.out] + + file_on_host delete $tempfile + + if { [string compare [file_contents readelf.out] [file_contents $srcdir/$subdir/readelf.wa]] != 0 } then { + fail "readelf -wa (compressed)" + verbose "output is \n[file_contents readelf.out]" 2 + verbose "expected is \n[file_contents $srcdir/$subdir/readelf.wa]" 2 + return + } + + pass "readelf -wa (compressed)" +} # Test readelf's dumping abilities. @@ -295,5 +331,6 @@ readelf_test -s $tempfile readelf.ss {} readelf_test -r $tempfile readelf.r {} readelf_wi_test +readelf_compressed_wa_test readelf_dump_test diff --git a/binutils/testsuite/binutils-all/readelf.wa b/binutils/testsuite/binutils-all/readelf.wa new file mode 100644 index 0000000..63892a4 --- /dev/null +++ b/binutils/testsuite/binutils-all/readelf.wa @@ -0,0 +1,24 @@ +Contents of the .zdebug_abbrev section: + + Number TAG + 1 DW_TAG_compile_unit [has children] + DW_AT_stmt_list DW_FORM_data4 + DW_AT_high_pc DW_FORM_addr + DW_AT_low_pc DW_FORM_addr + DW_AT_name DW_FORM_string + DW_AT_producer DW_FORM_string + DW_AT_language DW_FORM_data1 + 2 DW_TAG_subprogram [no children] + DW_AT_external DW_FORM_flag + DW_AT_decl_file DW_FORM_data1 + DW_AT_decl_line DW_FORM_data1 + DW_AT_name DW_FORM_string + DW_AT_type DW_FORM_ref4 + DW_AT_low_pc DW_FORM_addr + DW_AT_high_pc DW_FORM_addr + DW_AT_frame_base DW_FORM_block1 + 3 DW_TAG_base_type [no children] + DW_AT_name DW_FORM_string + DW_AT_byte_size DW_FORM_data1 + DW_AT_encoding DW_FORM_data1 + |