This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Generate compressed DWARF debug info in .debug* sections


On Wed, Jul 21, 2010 at 9:23 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Jul 21, 2010 at 7:48 AM, Jakub Jelinek <jakub@redhat.com> wrote:
>> On Wed, Jul 21, 2010 at 07:30:37AM -0700, H.J. Lu wrote:
>>> On Tue, Jul 20, 2010 at 04:38:56PM -0700, H.J. Lu wrote:
>>> > Hi,
>>> >
>>> > This patch added SHF_GNU_COMPRESSED and fixed:
>>> >
>>> > http://www.sourceware.org/bugzilla/show_bug.cgi?id=11819
>>> >
>>> > I implemented --compress-debug-sections/--decompress-debug-sections for
>>> > objcopy. ?Linker can also understand compressed debug sections. ?I will
>>> > work on linker --compress-debug-sections support later.
>>> >
>>> > SHF_GNU_COMPRESSED isn't strictly required. I can peek into
>>> > .debug_* sections like gdb does. On the other hand, SHF_GNU_COMPRESSED
>>> > can avoid the peek. I can prepare a patch without SHF_GNU_COMPRESSED.
>>> > Any comments on that?
>>> >
>>>
>>> I think we should avoid SHF_GNU_COMPRESSED. ?Here is a patch without
>>> SHF_GNU_COMPRESSED. ?OK to install?
>>
>> 0x5a4c4942 or 0x42494c5a are valid unit lengths for .debug_info, so
>> IMHO it is a very bad design to avoid having any special flag that the
>> section has different, special, compressed format.
>>
>> BTW, if some .debug_* sections are compressed in some objects and not
>> compressed in others, is the result of linking them together a mixture of
>> both, or will it be recompressed as whole, something else?
>
> For the time being, linker will work with mixed input and generate
> uncompressed output. Linker compression will be a separate patch.
>
>> I think .zdebug_* was much better idea then this weird overloading of
>> standard sections, it will confuse a lot of tools very badly.
>>
>
> OK. ?Can the new .zdebug sections can be either compressed or
> uncompressed?
>

Here is the updated patch to support compressed DWARF debug
sections in .zdebug sections.  OK to install?

Thanks.

-- 
H.J.
---
bfd/

2010-07-21  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.
	(dwarf_debug_sections): New.
	(get_uncompressed_size): Likewise.
	(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 (read_section): Remove compressed_section_name.
	Try compressed debug section.
	(read_indirect_string): Updated.
	(read_abbrevs): Likewise.
	(decode_line_info): Likewise.
	(read_debug_ranges): Likewise.
	(find_line): Updated.

	* elf.c (_bfd_elf_make_section_from_shdr): Call
	bfd_is_section_compressed to check if a debug section is
	compressed.  Call bfd_init_section_compress_status or
	bfd_init_section_decompress_status if needed.
	(special_sections_z): Use .zdebug prefix.

	* elflink.c (elf_link_input_bfd): Replace bfd_get_section_contents
	with bfd_get_full_section_contents.
	* merge.c (_bfd_add_merge_section): 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.

	* reloc.c (bfd_generic_get_relocated_section_contents): Use
	bfd_get_full_section_contents to get full section contents.
	* simple.c (bfd_simple_get_relocated_section_contents): Likewise.

	* 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.

	* ecoff.c (bfd_debug_section): Add compress_status and
	compressed_size.

	* bfd-in2.h: Regenerated.
	* libbfd.h: Likewise.

binutils/

2010-07-21  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.

binutils/testsuite/

2010-07-20  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-07-21  H.J. Lu  <hongjiu.lu@intel.com>

	* write.c (compress_debug): Optimize section flags check.

gas/testsuite/

2010-07-21  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.

ld/

2010-07-21  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-07-20  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-elf/compress.exp: New.
	* ld-elf/compress1.d: Likewise.
	* ld-elf/compress1.s: Likewise.

Attachment: binutils-zlib-2.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]