diff options
author | Mark Wielaard <mark@klomp.org> | 2017-02-27 16:28:18 +0100 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2017-03-06 15:17:20 +0200 |
commit | 88989572fff1f31e0c4f972a6895585e4742ef4b (patch) | |
tree | a4d89f4f72be1262f7fc3fe702811c33c40ba9cb /Makefile.am | |
parent | 2d9c8cca7a4d87d9e636d63facb36ce25623d951 (diff) | |
download | rpm-88989572fff1f31e0c4f972a6895585e4742ef4b.tar.gz |
debugedit: Support String/Line table rewriting for larger/smaller paths.
debugedit --base to --dest rewriting of debug source file paths only
supported dest paths that were smaller or equal than the base path
(and the size should differ more than 1 character for correct debug lines).
All paths were changed "in place". Which could in theory mess up debug str
sharing.
This rewrite supports base and dest strings of any size (some limitations,
see below). This is done by reconstructing the debug_str and debug_line
tables and updating the references in the debug_info attributes pointing
to these tables. Plus, if necessary (only for ET_REL kernel modules),
updating any relocations for the debug_info and debug_line sections.
This has the nice benefit of merging any duplicate strings in the
debug_str table which might resulting on slightly smaller files.
kernel modules are ET_REL files that often contain a lot of duplicate
strings.
The rewrite uses elfutils (either libebl or libdw) to reconstruct the
debug_str table. Since we are changing some section sizes now we cannot
just use mmap and rawdata to poke the values, but need to read in and
write out the changed sections. This does take a bit more memory because
we now also need to keep track of all string/line references.
There are still some limitations (already in the original debugedit)
not fixed by this rewrite:
- DW_AT_comp_dir in .debug_info using DW_FORM_string can not be made
larger. We only warn about that now instead of failing. The only
producer of DW_FORM_string comp_dirs is binutils gas. It seems simpler
to fix gas than to try to support resizing the debug_info section.
- A DW_AT_name on a DW_TAG_compile_unit is only rewritten for DW_FORM_strp
not for DW_FORM_string. Probably no problem in practice since this
wasn't supported originally either.
- The debug_line program isn't scanned for DW_LNE_define_file which
could in theory define an absolute path that might need rewriting.
Again probably not a problem because this wasn't supported before
and there are no know producers for this construct.
To support the upcoming DWARFv5 in gcc 7 (not on by default), we will
need to add support for the new debug_line format and scan the new
debug_macro section that can have references to the debug_str table.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'Makefile.am')
-rw-r--r-- | Makefile.am | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am index 56aa485f7..154d3c638 100644 --- a/Makefile.am +++ b/Makefile.am @@ -155,13 +155,18 @@ rpm2archive_LDADD += @WITH_BEECRYPT_LIB@ @WITH_NSS_LIB@ @WITH_OPENSSL_LIB@ @WITH if LIBELF if LIBDWARF +if LIBDW rpmconfig_SCRIPTS += scripts/find-debuginfo.sh rpmlibexec_PROGRAMS += debugedit debugedit_SOURCES = tools/debugedit.c tools/hashtab.c tools/hashtab.h debugedit_LDADD = rpmio/librpmio.la debugedit_LDADD += @WITH_LIBELF_LIB@ @WITH_POPT_LIB@ - +if HAVE_LIBDW_STRTAB +debugedit_LDADD += @WITH_LIBDW_LIB@ +else +debugedit_LDADD += @WITH_LIBDW_LIB@ -lebl +endif rpmlibexec_PROGRAMS += elfdeps elfdeps_SOURCES = tools/elfdeps.c elfdeps_LDADD = rpmio/librpmio.la @@ -172,6 +177,7 @@ sepdebugcrcfix_SOURCES = tools/sepdebugcrcfix.c sepdebugcrcfix_LDADD = @WITH_LIBELF_LIB@ endif endif +endif rpmlibexec_PROGRAMS += rpmdeps rpmdeps_SOURCES = tools/rpmdeps.c |