aboutsummaryrefslogtreecommitdiff
path: root/bfd/coffgen.c
diff options
context:
space:
mode:
authorKai Tietz <kai.tietz@onevision.com>2012-10-18 17:42:29 +0000
committerKai Tietz <kai.tietz@onevision.com>2012-10-18 17:42:29 +0000
commita29a8af823af0415dae4d3b2ffd60cb3b53ec011 (patch)
treedf66edb33293676a41d1ed63dadbb40701203f51 /bfd/coffgen.c
parent4fc8b8950a1aed53bc553c9003808f04919cc7ca (diff)
downloadgdb-a29a8af823af0415dae4d3b2ffd60cb3b53ec011.zip
gdb-a29a8af823af0415dae4d3b2ffd60cb3b53ec011.tar.gz
gdb-a29a8af823af0415dae4d3b2ffd60cb3b53ec011.tar.bz2
ChangeLog bfd
2012-10-18 Kai Tietz <ktietz@redhat.com> PR binutils/14067 * coff-i386.c (bfd_target): Add section flag SEC_EXCLUDE. Allow BFD_COMPRESS and BFD_DECOMPRESS flags. * coff-x86_64.c: Likewise. * coffcode.h (DOT_ZDEBUG): New define. (sec_to_styp_flags): Check for .zdebug. (styp_to_sec_flags): Likewise. * coffgen.c (make_a_section): Handle .debug_* section compression/decompression flags. * cofflink.c (mark_relocs): Ignore relocations for a section, which isn't marked as used. (_bfd_coff_link_input_bfd): Add support of compressed debug sections. * compress.c (decompress_contents): Loop as long as there is input available and there is room for output. * bfd/pe-arm.c: Add .zdebug_ partial match entry. * pe-i386.c: Likewise. * pe-x86_64.c: Likewise. * peXXigen.c (_bfd_XXi_swap_aouthdr_out): Don't clear all data-directories as this might destroy content. * coff-i386.c (_bfd_generic_find_nearest_line_discriminator): define as coff_find_nearest_line_discriminator. * libcoff-in.h (coff_find_nearest_line_discriminator): New * libcoff.h: Regenerated. * coff-x86_64.c: Likewise. * coffgen.c (coff_find_nearest_line_discriminator): New function. prototype. ChangeLog binutils 2012-10-18 Kai Tietz <ktietz@redhat.com> * objdump.c (dump_bfd): Call dump headers after call of slurp_symtab. ChangeLog ld 2012-10-18 Kai Tietz <ktietz@redhat.com> PR binutils/14067 * NEWS: Menition new feature. * scripttempl/pep.sc: Add zdebug sections. * scripttempl/pe.sc: L
Diffstat (limited to 'bfd/coffgen.c')
-rw-r--r--bfd/coffgen.c92
1 files changed, 90 insertions, 2 deletions
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 509119b..584f64b 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -91,7 +91,7 @@ make_a_section_from_file (bfd *abfd,
don't know the length of the string table. */
strings += strindex;
name = (char *) bfd_alloc (abfd,
- (bfd_size_type) strlen (strings) + 1);
+ (bfd_size_type) strlen (strings) + 1 + 1);
if (name == NULL)
return FALSE;
strcpy (name, strings);
@@ -102,7 +102,7 @@ make_a_section_from_file (bfd *abfd,
{
/* Assorted wastage to null-terminate the name, thanks AT&T! */
name = (char *) bfd_alloc (abfd,
- (bfd_size_type) sizeof (hdr->s_name) + 1);
+ (bfd_size_type) sizeof (hdr->s_name) + 1 + 1);
if (name == NULL)
return FALSE;
strncpy (name, (char *) &hdr->s_name[0], sizeof (hdr->s_name));
@@ -146,6 +146,76 @@ make_a_section_from_file (bfd *abfd,
if (hdr->s_scnptr != 0)
return_section->flags |= SEC_HAS_CONTENTS;
+ /* Compress/decompress DWARF debug sections with names: .debug_* and
+ .zdebug_*, after the section flags is set. */
+ if ((flags & SEC_DEBUGGING)
+ && ((name[1] == 'd' && name[6] == '_')
+ || (name[1] == 'z' && name[7] == '_')))
+ {
+ enum { nothing, compress, decompress } action = nothing;
+ char *new_name = NULL;
+
+ if (bfd_is_section_compressed (abfd, return_section))
+ {
+ /* Compressed section. Check if we should decompress. */
+ if ((abfd->flags & BFD_DECOMPRESS))
+ action = decompress;
+ }
+ else if (!bfd_is_section_compressed (abfd, return_section))
+ {
+ /* Normal section. Check if we should compress. */
+ if ((abfd->flags & BFD_COMPRESS) && return_section->size != 0)
+ action = compress;
+ }
+
+ switch (action)
+ {
+ case nothing:
+ break;
+ case compress:
+ if (!bfd_init_section_compress_status (abfd, return_section))
+ {
+ (*_bfd_error_handler)
+ (_("%B: unable to initialize compress status for section %s"),
+ abfd, name);
+ return FALSE;
+ }
+ if (name[1] != 'z')
+ {
+ unsigned int len = strlen (name);
+
+ new_name = bfd_alloc (abfd, len + 2);
+ if (new_name == NULL)
+ return FALSE;
+ new_name[0] = '.';
+ new_name[1] = 'z';
+ memcpy (new_name + 2, name + 1, len);
+ }
+ break;
+ case decompress:
+ if (!bfd_init_section_decompress_status (abfd, return_section))
+ {
+ (*_bfd_error_handler)
+ (_("%B: unable to initialize decompress status for section %s"),
+ abfd, name);
+ return FALSE;
+ }
+ if (name[1] == 'z')
+ {
+ unsigned int len = strlen (name);
+
+ new_name = bfd_alloc (abfd, len);
+ if (new_name == NULL)
+ return FALSE;
+ new_name[0] = '.';
+ memcpy (new_name + 1, name + 2, len - 1);
+ }
+ break;
+ }
+ if (new_name != NULL)
+ bfd_rename_section (abfd, return_section, new_name);
+ }
+
return result;
}
@@ -2349,6 +2419,24 @@ coff_find_nearest_line (bfd *abfd,
}
bfd_boolean
+coff_find_nearest_line_discriminator (bfd *abfd,
+ asection *section,
+ asymbol **symbols,
+ bfd_vma offset,
+ const char **filename_ptr,
+ const char **functionname_ptr,
+ unsigned int *line_ptr,
+ unsigned int *discriminator)
+{
+ *discriminator = 0;
+ return coff_find_nearest_line_with_names (abfd, dwarf_debug_sections,
+ section, symbols, offset,
+ filename_ptr, functionname_ptr,
+ line_ptr);
+}
+
+
+bfd_boolean
coff_find_inliner_info (bfd *abfd,
const char **filename_ptr,
const char **functionname_ptr,