On Thu, 2015-03-12 at 09:02 -0700, H.J. Lu wrote: > I am working on fixing: > > https://bugzilla.redhat.com/show_bug.cgi?id=807053
Thanks for posting to the list. I'll reply here to some comments on that bug. > There are a couple issues with compressed debug section support > in elfutils: > > 1.libdw doesn't handle compressed debug sections with relocations. > check_section tries to handle compressed debug sections. But > It is too late since relocations have been applied already. > 2. Dwarf debug section name handling is duplicated in both libdw > and libebl. ebl_debugscn_p is used to check for debug section. > But it doesn't handle compressed debug section wgile libdw does. > > libelf doesn't handle DWARF debug sections and I am not if it > should handle them directly. However, there is convert_data in > libelf, which seems to be an ideal place to handle compressed > debug sections. > > We just need to add a hook to libelf to allow > libdw to decompress debug sections. I propose to add > > Elf * > __libelf_elf_begin (int fildes, Elf_Cmd cmd, Elf *ref, > char *(*convert_debug_data) (Elf_Scn *, > char *, > size_t *)) > > to libelf. It will be a private function for libdw. The full patch is at > > https://bugzilla.redhat.com/attachment.cgi?id=1001009 An alternative would be to finish the lazy relocation work from the roland/relocate branch. Since that would do relocations later after the decompression. Things would be a bit easier if the toolchain adopted the SHF_COMPRESSED flag that got standardized: https://groups.google.com/forum/#!topic/generic-abi/dBOS1H47Q64 That way we wouldn't have to rely (in libelf) on some name based heuristics like we do in libdw right now. In the bug comments you say: > SHF_COMPRESSED doesn't help the existing relocatable files with compressed > debug sections. Which is true. But does any distro already use .zdebug sections in ET_REL files? We could decide to just only support newer toolchains that set SHF_COMPRESSED. To be honest I don't really see the appeal of using .zdebug in ET_REL files. We do support it for ET_EXEC/ET_DYN where we don't have the trouble with relocations. Also from the bug comments: > The Elf handle should be created with dwarf_elf_begin if the user > wants to support DWARF debug sections. I don't think this is a good idea. As is the current patch breaks support for .zdebug for current users that use dwarf_begin () or dwarf_begin_elf (). We don't want to break existing functionality. The last bug comment says: > NB. strip --reloc-debug-sections will decompress the compressed > debug sections and resolve all trivial relocations. It will generate > the decompressed debug sections with the compressed debug section > names. Both readelf and eu-readelf can handle them correctly. It is good that eu-readelf handles that. But is that also the case for existing eu-readelf, or only for the patched version? In general it seems wrong to have this section name confusion (especially without SHF_COMPRESSED). Cheers, Mark
