This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB 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]

[Bug gdb/14704] GDB fails to decompress relocatable files


http://sourceware.org/bugzilla/show_bug.cgi?id=14704

dje at google dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dje at google dot com,
                   |                            |tromey at redhat dot com

--- Comment #1 from dje at google dot com 2012-10-11 23:12:39 UTC ---
Filing this here for reference sake, having just tripped over this myself in a
different (non .o) context.

In 7.5 the check for whether a section is compressed appears before the check
for whether a section has relocs.  In cvs head the tests are (effectively)
reversed.

The change came in here:

2012-07-18  Tom Tromey  <tromey@redhat.com>

        * dwarf2read.c: Don't include zlib.h or sys/mman.h.
        (pagesize): Remove.
        (struct dwarf2_section_info) <map_addr, map_len>: Remove.
        (zlib_decompress_section): Remove.
        (dwarf2_read_section): Use gdb_bfd_map_section.
        (munmap_section_buffer): Remove.
        (free_dwo_file, dwarf2_per_objfile_free): Don't use
        munmap_section_buffer.
        * gdb_bfd.c: Include zlib.h, sys/mman.h.
        (struct gdb_bfd_section_data): New.
        (free_one_bfd_section): New function.
        (gdb_bfd_close_or_warn): Use free_one_bfd_section.
        (get_section_descriptor, zlib_decompress_section)
        (gdb_bfd_map_section): New functions.
        * gdb_bfd.h (gdb_bfd_map_section): Declare.

Also, I think there's a separate issue here, which is: Why does bfd attach
SEC_RELOC to a section if its .rela section is empty?

Seems like we want this, but of course I can't discount the possibility of some
obscure reason why things are the way they are:

--- elf.c=    2012-10-11 15:55:02.722802893 -0700
+++ elf.c    2012-10-11 15:55:02.722802893 -0700
@@ -1873,18 +1873,20 @@
        *hdr2 = *hdr;
        *p_hdr = hdr2;
        elf_elfsections (abfd)[shindex] = hdr2;
-       target_sect->reloc_count += NUM_SHDR_ENTRIES (hdr);
-       target_sect->flags |= SEC_RELOC;
-       target_sect->relocation = NULL;
-       target_sect->rel_filepos = hdr->sh_offset;
-       /* In the section to which the relocations apply, mark whether
-          its relocations are of the REL or RELA variety.  */
+       /* Don't mark the target section as having relocs if this
+          section is empty.  */
        if (hdr->sh_size != 0)
          {
+           target_sect->reloc_count += NUM_SHDR_ENTRIES (hdr);
+           target_sect->flags |= SEC_RELOC;
+           target_sect->relocation = NULL;
+           target_sect->rel_filepos = hdr->sh_offset;
+           /* In the section to which the relocations apply, mark whether
+              its relocations are of the REL or RELA variety.  */
            if (hdr->sh_type == SHT_RELA)
              target_sect->use_rela_p = 1;
+           abfd->flags |= HAS_RELOC;
          }
-       abfd->flags |= HAS_RELOC;
        return TRUE;
       }

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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