This is the mail archive of the
mailing list for the elfutils project.
Re: RFC: Add compressed debug section support to elfutils
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Fri, 13 Mar 2015 13:46:13 +0100
- Subject: Re: RFC: Add compressed debug section support to elfutils
On Thu, 2015-03-12 at 09:02 -0700, H.J. Lu wrote:
> I am working on fixing:
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
An alternative would be to finish the lazy relocation work from the
roland/relocate branch. Since that would do relocations later after the
Things would be a bit easier if the toolchain adopted the SHF_COMPRESSED
flag that got standardized:
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
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