bfd/ChangeLog:

* compress.c (bfd_uncompress_section_contents): Add ATTRIBUTE_UNUSED.
	* dwarf2.c (read_and_uncompress_section): New function.
	(read_section): Call it.
	(find_line): Likewise.

binutils/ChangeLog:

	* objdump.c (load_specific_debug_section): Decompress section contents
	before applying relocations.
	* readelf.c (load_specific_debug_section): Update section size after
	decompression.

gas/ChangeLog:

	* Makefile.am: Add compress-debug.c and compress-debug.h.
	* Makefile.in: Regenerate.
	* config.in: Add HAVE_ZLIB_H.
	* configure.in: Check for zlib.h.
	* configure: Regenerate.

	* as.c (parse_args): Add --compress-debug-sections and
	--nocompress-debug-sections.
	* as.h (flag_compress_debug): New variable.
	* compress-debug.c: New file.
	* compress-debug.h: New file.
	* write.c: Include compress-debug.h.
	(compress_frag): New function.
	(compress_debug): New function.
	(write_object_file): Compress debug sections if requested.
This commit is contained in:
Cary Coutant 2010-07-03 20:52:24 +00:00
parent 3a5530eaab
commit 0acf065b19
15 changed files with 441 additions and 58 deletions

View file

@ -2205,14 +2205,8 @@ load_specific_debug_section (enum dwarf_section_display_enum debug,
section->size = bfd_get_section_size (sec);
section->start = (unsigned char *) xmalloc (section->size);
if (is_relocatable && debug_displays [debug].relocate)
ret = bfd_simple_get_relocated_section_contents (abfd,
sec,
section->start,
syms) != NULL;
else
ret = bfd_get_section_contents (abfd, sec, section->start, 0,
section->size);
ret = bfd_get_section_contents (abfd, sec, section->start, 0,
section->size);
if (! ret)
{
@ -2234,6 +2228,30 @@ load_specific_debug_section (enum dwarf_section_display_enum debug,
section->size = size;
}
if (is_relocatable && debug_displays [debug].relocate)
{
/* We want to relocate the data we've already read (and
decompressed), so we store a pointer to the data in
the bfd_section, and tell it that the contents are
already in memory. */
sec->contents = section->start;
sec->flags |= SEC_IN_MEMORY;
sec->size = section->size;
ret = bfd_simple_get_relocated_section_contents (abfd,
sec,
section->start,
syms) != NULL;
if (! ret)
{
free_debug_section (debug);
printf (_("\nCan't get contents for section '%s'.\n"),
section->name);
return 0;
}
}
return 1;
}