diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2010-10-29 12:10:39 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2010-10-29 12:10:39 +0000 |
commit | 4a114e3e0c1c3337981179b774f1d6d1b06d201f (patch) | |
tree | 98b0b1e45b3ae0e7845215136253fa56e487a9b8 /gas | |
parent | e58bcb8f099ec42b3c905480629d1a49dd38b03f (diff) | |
download | gdb-4a114e3e0c1c3337981179b774f1d6d1b06d201f.zip gdb-4a114e3e0c1c3337981179b774f1d6d1b06d201f.tar.gz gdb-4a114e3e0c1c3337981179b774f1d6d1b06d201f.tar.bz2 |
Add compressed debug section support to binutils and ld.
bfd/
2010-10-29 H.J. Lu <hongjiu.lu@intel.com>
Cary Coutant <ccoutant@google.com>
* archive.c (bfd_openr_next_archived_file): Copy BFD_COMPRESS
and BFD_DECOMPRESS.
* bfd.c (BFD_COMPRESS): New.
(BFD_DECOMPRESS): Likewise.
(BFD_FLAGS_SAVED): Likewise.
(bfd_preserve_save): Replace BFD_IN_MEMORY with BFD_FLAGS_SAVED.
* compress.c (bfd_uncompress_section_contents): Removed.
(get_uncompressed_size): New.
(decompress_contents): Likewise.
(bfd_compress_section_contents): Likewise.
(bfd_get_full_section_contents): Likewise.
(bfd_is_section_compressed): Likewise.
(bfd_init_section_decompress_status): Likewise.
(bfd_init_section_compress_status): Likewise.
* dwarf2.c (dwarf_debug_sections): New.
(dwarf_debug_section_enum): Likewise.
(read_section): Remove section_name and compressed_section_name.
Add dwarf_debug_section_enum. Try compressed debug section.
(read_indirect_string): Updated.
(read_abbrevs): Likewise.
(decode_line_info): Likewise.
(read_debug_ranges): Likewise.
(find_line): Updated.
* ecoff.c (bfd_debug_section): Add compress_status and
compressed_size.
* elf.c (_bfd_elf_make_section_from_shdr): Call
bfd_is_section_compressed to check if a DWARF debug section is
compressed. Call bfd_init_section_compress_status or
bfd_init_section_decompress_status if needed.
* elflink.c (elf_link_input_bfd): Replace bfd_get_section_contents
with bfd_get_full_section_contents.
* merge.c (_bfd_add_merge_section): Likewise.
* reloc.c (bfd_generic_get_relocated_section_contents): Likewise.
* simple.c (bfd_simple_get_relocated_section_contents): Likewise.
* elfxx-target.h (TARGET_BIG_SYM): Allow BFD_COMPRESS and
BFD_DECOMPRESS.
(TARGET_LITTLE_SYM): Likewise.
* libbfd-in.h (dwarf_debug_section): New.
(dwarf_debug_sections): Likewise.
* libbfd.c (_bfd_generic_get_section_contents): Issue an error
when getting contents on compressed/decompressed section.
* section.c (COMPRESS_SECTION_NONE): New.
(COMPRESS_SECTION_DONE): Likewise.
(DECOMPRESS_SECTION_SIZED): Likewise.
(BFD_FAKE_SECTION): Add compress_status and compressed_size.
(bfd_malloc_and_get_section): Replace bfd_get_section_contents
with bfd_get_full_section_contents.
* bfd-in2.h: Regenerated.
* libbfd.h: Likewise.
binutils/
2010-10-29 H.J. Lu <hongjiu.lu@intel.com>
* addr2line.c (process_file): Set BFD_DECOMPRESS.
* objcopy.c (do_debug_sections): New.
(OPTION_COMPRESS_DEBUG_SECTIONS): New.
(OPTION_DECOMPRESS_DEBUG_SECTIONS): Likewise.
(copy_options): Add OPTION_COMPRESS_DEBUG_SECTIONS and
OPTION_DECOMPRESS_DEBUG_SECTIONS.
(copy_usage): Add --compress-debug-sections and
--decompress-debug-sections.
(copy_file): Set BFD_COMPRESS or BFD_DECOMPRESS.
(copy_section): Replace bfd_get_section_contents with
bfd_get_full_section_contents.
(copy_main): Handle OPTION_COMPRESS_DEBUG_SECTIONS and
OPTION_DECOMPRESS_DEBUG_SECTIONS. Check do_debug_sections to
rename DWARF debug sections.
* objdump.c (load_specific_debug_section): Replace
bfd_get_section_contents with bfd_get_full_section_contents.
Remove bfd_uncompress_section_contents.
(dump_section): Replace bfd_get_section_contents with
bfd_get_full_section_contents.
(display_file): Set BFD_DECOMPRESS if needed.
* readelf.c (uncompress_section_contents): Set buffer to NULL
to indiate decompression failure.
(load_specific_debug_section): Always call
uncompress_section_contents.
* doc/binutils.texi: Document --compress-debug-sections and
--decompress-debug-sections.
binutils/testsuite/
2010-10-29 H.J. Lu <hongjiu.lu@intel.com>
* binutils-all/compress.exp: New.
* binutils-all/dw2-1.S: Likewise.
* binutils-all/dw2-2.S: Likewise.
* binutils-all/libdw2-compressed.out: Likewise.
* binutils-all/libdw2.out: Likewise.
gas/
2010-10-29 H.J. Lu <hongjiu.lu@intel.com>
* write.c (compress_debug): Optimize section flags check.
gas/testsuite/
2010-10-29 H.J. Lu <hongjiu.lu@intel.com>
* elf/dwarf2-1.s: Replace .zdebug_abbrev section with
.debug_abbrev section.
* elf/dwarf2-2.3: Likewise.
* elf/dwarf2-1.d: Pass --compress-debug-sections to assembler.
Updated.
* elf/dwarf2-2.d: Likewise.
* gas/i386/i386.exp: Remove xfail on dw2-compress-2 and
x86-64-dw2-compress-2.
ld/
2010-10-29 H.J. Lu <hongjiu.lu@intel.com>
* ldfile.c (ldfile_try_open_bfd): Set BFD_DECOMPRESS after
bfd_openr returns.
* emultempl/elf32.em (gld${EMULATION_NAME}_try_needed): Likewise.
* scripttempl/elf.sc: Include compressed DWARF debug sections.
ld/testsuite/
2010-10-29 H.J. Lu <hongjiu.lu@intel.com>
* ld-elf/compress.exp: New.
* ld-elf/compress1.s: Likewise.
* ld-elf/compress1a.d: Likewise.
* ld-elf/compress1b.d: Likewise.
* ld-elf/compress1c.d: Likewise.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 4 | ||||
-rw-r--r-- | gas/testsuite/ChangeLog | 13 | ||||
-rw-r--r-- | gas/testsuite/gas/elf/dwarf2-1.d | 7 | ||||
-rw-r--r-- | gas/testsuite/gas/elf/dwarf2-1.s | 132 | ||||
-rw-r--r-- | gas/testsuite/gas/elf/dwarf2-2.d | 7 | ||||
-rw-r--r-- | gas/testsuite/gas/elf/dwarf2-2.s | 132 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/i386.exp | 2 | ||||
-rw-r--r-- | gas/write.c | 4 |
8 files changed, 139 insertions, 162 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 3e083fe..efd7d60 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,7 @@ +2010-10-29 H.J. Lu <hongjiu.lu@intel.com> + + * write.c (compress_debug): Optimize section flags check. + 2010-10-29 Bernd Schmidt <bernds@codesourcery.com> Joseph Myers <joseph@codesourcery.com> diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 0a51584..cc10178 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2010-10-29 H.J. Lu <hongjiu.lu@intel.com> + + * elf/dwarf2-1.s: Replace .zdebug_abbrev section with + .debug_abbrev section. + * elf/dwarf2-2.3: Likewise. + + * elf/dwarf2-1.d: Pass --compress-debug-sections to assembler. + Updated. + * elf/dwarf2-2.d: Likewise. + + * gas/i386/i386.exp: Remove xfail on dw2-compress-2 and + x86-64-dw2-compress-2. + 2010-10-29 Bernd Schmidt <bernds@codesourcery.com> Joseph Myers <joseph@codesourcery.com> diff --git a/gas/testsuite/gas/elf/dwarf2-1.d b/gas/testsuite/gas/elf/dwarf2-1.d index 076b01d..2cc17ac 100644 --- a/gas/testsuite/gas/elf/dwarf2-1.d +++ b/gas/testsuite/gas/elf/dwarf2-1.d @@ -1,8 +1,9 @@ +#as: --compress-debug-sections #readelf: -w #name: DWARF2 1 #not-target: ia64-*-* -Contents of the .debug_info section: +Contents of the .[z]?debug_info section: Compilation Unit @ offset 0x0: Length: 0x4e \(32-bit\) @@ -30,7 +31,7 @@ Contents of the .debug_info section: <4f> DW_AT_byte_size : 4 <50> DW_AT_encoding : 5 \(signed\) -Raw dump of debug contents of section .debug_line: +Raw dump of debug contents of section .[z]?debug_line: Offset: 0x0 Length: 62 @@ -74,7 +75,7 @@ Raw dump of debug contents of section .debug_line: Extended opcode 1: End of Sequence -Contents of the .zdebug_abbrev section: +Contents of the .[z]?debug_abbrev section: Number TAG 1 DW_TAG_compile_unit \[has children\] diff --git a/gas/testsuite/gas/elf/dwarf2-1.s b/gas/testsuite/gas/elf/dwarf2-1.s index 0310079..887fdd6 100644 --- a/gas/testsuite/gas/elf/dwarf2-1.s +++ b/gas/testsuite/gas/elf/dwarf2-1.s @@ -15,10 +15,6 @@ 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. */ .file "dwarf2-1.c" @@ -144,76 +140,60 @@ func_cu1: .Lline1_end: -/* Abbrev table -- compressed */ - .section .zdebug_abbrev +/* Abbrev table */ + .section .debug_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 + .uleb128 1 /* Abbrev code */ + .uleb128 0x11 /* DW_TAG_compile_unit */ + .byte 1 /* has_children */ + .uleb128 0x10 /* DW_AT_stmt_list */ + .uleb128 0x6 /* DW_FORM_data4 */ + .uleb128 0x12 /* DW_AT_high_pc */ + .uleb128 0x1 /* DW_FORM_addr */ + .uleb128 0x11 /* DW_AT_low_pc */ + .uleb128 0x1 /* DW_FORM_addr */ + .uleb128 0x3 /* DW_AT_name */ + .uleb128 0x8 /* DW_FORM_string */ + .uleb128 0x25 /* DW_AT_producer */ + .uleb128 0x8 /* DW_FORM_string */ + .uleb128 0x13 /* DW_AT_language */ + .uleb128 0xb /* DW_FORM_data1 */ + .byte 0x0 /* Terminator */ + .byte 0x0 /* Terminator */ + + .uleb128 2 /* Abbrev code */ + .uleb128 0x2e /* DW_TAG_subprogram */ + .byte 0 /* has_children */ + .uleb128 0x3f /* DW_AT_external */ + .uleb128 0xc /* DW_FORM_flag */ + .uleb128 0x3a /* DW_AT_decl_file */ + .uleb128 0xb /* DW_FORM_data1 */ + .uleb128 0x3b /* DW_AT_decl_line */ + .uleb128 0xb /* DW_FORM_data1 */ + .uleb128 0x3 /* DW_AT_name */ + .uleb128 0x8 /* DW_FORM_string */ + .uleb128 0x49 /* DW_AT_type */ + .uleb128 0x13 /* DW_FORM_ref4 */ + .uleb128 0x11 /* DW_AT_low_pc */ + .uleb128 0x1 /* DW_FORM_addr */ + .uleb128 0x12 /* DW_AT_high_pc */ + .uleb128 0x1 /* DW_FORM_addr */ + .uleb128 0x40 /* DW_AT_frame_base */ + .uleb128 0xa /* DW_FORM_block1 */ + .byte 0x0 /* Terminator */ + .byte 0x0 /* Terminator */ + + .uleb128 3 /* Abbrev code */ + .uleb128 0x24 /* DW_TAG_base_type */ + .byte 0 /* has_children */ + .uleb128 0x3 /* DW_AT_name */ + .uleb128 0x8 /* DW_FORM_string */ + .uleb128 0xb /* DW_AT_byte_size */ + .uleb128 0xb /* DW_FORM_data1 */ + .uleb128 0x3e /* DW_AT_encoding */ + .uleb128 0xb /* DW_FORM_data1 */ + .byte 0x0 /* Terminator */ + .byte 0x0 /* Terminator */ + + .byte 0x0 /* Terminator */ + .byte 0x0 /* Terminator */ diff --git a/gas/testsuite/gas/elf/dwarf2-2.d b/gas/testsuite/gas/elf/dwarf2-2.d index 036aafc..9825ee4 100644 --- a/gas/testsuite/gas/elf/dwarf2-2.d +++ b/gas/testsuite/gas/elf/dwarf2-2.d @@ -1,8 +1,9 @@ +#as: --compress-debug-sections #readelf: -w #name: DWARF2 2 #not-target: ia64-*-* -Contents of the .debug_info section: +Contents of the .[z]?debug_info section: Compilation Unit @ offset 0x0: Length: 0x4e \(32-bit\) @@ -30,7 +31,7 @@ Contents of the .debug_info section: <4f> DW_AT_byte_size : 4 <50> DW_AT_encoding : 5 \(signed\) -Raw dump of debug contents of section .debug_line: +Raw dump of debug contents of section .[z]?debug_line: Offset: 0x0 Length: 62 @@ -74,7 +75,7 @@ Raw dump of debug contents of section .debug_line: Extended opcode 1: End of Sequence -Contents of the .zdebug_abbrev section: +Contents of the .[z]?debug_abbrev section: Number TAG 1 DW_TAG_compile_unit \[has children\] diff --git a/gas/testsuite/gas/elf/dwarf2-2.s b/gas/testsuite/gas/elf/dwarf2-2.s index 389918c..38f62b8 100644 --- a/gas/testsuite/gas/elf/dwarf2-2.s +++ b/gas/testsuite/gas/elf/dwarf2-2.s @@ -15,10 +15,6 @@ 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. */ .file "dwarf2-2.c" @@ -144,76 +140,60 @@ func_cu1: .Lline1_end: -/* Abbrev table -- compressed */ - .section .zdebug_abbrev,"G",%progbits,foo,comdat +/* Abbrev table */ + .section .debug_abbrev,"G",%progbits,foo,comdat .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 + .uleb128 1 /* Abbrev code */ + .uleb128 0x11 /* DW_TAG_compile_unit */ + .byte 1 /* has_children */ + .uleb128 0x10 /* DW_AT_stmt_list */ + .uleb128 0x6 /* DW_FORM_data4 */ + .uleb128 0x12 /* DW_AT_high_pc */ + .uleb128 0x1 /* DW_FORM_addr */ + .uleb128 0x11 /* DW_AT_low_pc */ + .uleb128 0x1 /* DW_FORM_addr */ + .uleb128 0x3 /* DW_AT_name */ + .uleb128 0x8 /* DW_FORM_string */ + .uleb128 0x25 /* DW_AT_producer */ + .uleb128 0x8 /* DW_FORM_string */ + .uleb128 0x13 /* DW_AT_language */ + .uleb128 0xb /* DW_FORM_data1 */ + .byte 0x0 /* Terminator */ + .byte 0x0 /* Terminator */ + + .uleb128 2 /* Abbrev code */ + .uleb128 0x2e /* DW_TAG_subprogram */ + .byte 0 /* has_children */ + .uleb128 0x3f /* DW_AT_external */ + .uleb128 0xc /* DW_FORM_flag */ + .uleb128 0x3a /* DW_AT_decl_file */ + .uleb128 0xb /* DW_FORM_data1 */ + .uleb128 0x3b /* DW_AT_decl_line */ + .uleb128 0xb /* DW_FORM_data1 */ + .uleb128 0x3 /* DW_AT_name */ + .uleb128 0x8 /* DW_FORM_string */ + .uleb128 0x49 /* DW_AT_type */ + .uleb128 0x13 /* DW_FORM_ref4 */ + .uleb128 0x11 /* DW_AT_low_pc */ + .uleb128 0x1 /* DW_FORM_addr */ + .uleb128 0x12 /* DW_AT_high_pc */ + .uleb128 0x1 /* DW_FORM_addr */ + .uleb128 0x40 /* DW_AT_frame_base */ + .uleb128 0xa /* DW_FORM_block1 */ + .byte 0x0 /* Terminator */ + .byte 0x0 /* Terminator */ + + .uleb128 3 /* Abbrev code */ + .uleb128 0x24 /* DW_TAG_base_type */ + .byte 0 /* has_children */ + .uleb128 0x3 /* DW_AT_name */ + .uleb128 0x8 /* DW_FORM_string */ + .uleb128 0xb /* DW_AT_byte_size */ + .uleb128 0xb /* DW_FORM_data1 */ + .uleb128 0x3e /* DW_AT_encoding */ + .uleb128 0xb /* DW_FORM_data1 */ + .byte 0x0 /* Terminator */ + .byte 0x0 /* Terminator */ + + .byte 0x0 /* Terminator */ + .byte 0x0 /* Terminator */ diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp index fd58530..c295be6 100644 --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -219,7 +219,6 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]] run_dump_test "localpic" run_dump_test "debug1" - setup_xfail "*-*-*" run_dump_test "dw2-compress-2" } @@ -409,7 +408,6 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t run_dump_test "x86-64-localpic" run_dump_test "debug1" - setup_xfail "*-*-*" run_dump_test "x86-64-dw2-compress-2" } diff --git a/gas/write.c b/gas/write.c index 4b6592f..939b80e 100644 --- a/gas/write.c +++ b/gas/write.c @@ -1350,10 +1350,10 @@ compress_debug (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) char *header; struct z_stream_s *strm; int x; + flagword flags = bfd_get_section_flags (abfd, sec); if (seginfo == NULL - || !(bfd_get_section_flags (abfd, sec) & SEC_HAS_CONTENTS) - || (bfd_get_section_flags (abfd, sec) & SEC_ALLOC)) + || (flags & (SEC_ALLOC | SEC_HAS_CONTENTS)) == SEC_ALLOC) return; section_name = bfd_get_section_name (stdoutput, sec); |