summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2017-02-27 16:28:18 +0100
committerPanu Matilainen <pmatilai@redhat.com>2017-03-06 15:17:20 +0200
commit88989572fff1f31e0c4f972a6895585e4742ef4b (patch)
treea4d89f4f72be1262f7fc3fe702811c33c40ba9cb /configure.ac
parent2d9c8cca7a4d87d9e636d63facb36ce25623d951 (diff)
downloadrpm-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 'configure.ac')
-rw-r--r--configure.ac6
1 files changed, 6 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 9ecef95d1..bdcb741fc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -463,18 +463,24 @@ AM_CONDITIONAL(WITH_ARCHIVE,[test "$with_archive" = yes])
#=================
# Check for elfutils libdw library with dwelf_elf_gnu_build_id.
WITH_LIBDW_LIB=
+HAVE_LIBDW_STRTAB=
AS_IF([test "$WITH_LIBELF" = yes],[
AC_CHECK_HEADERS([elfutils/libdwelf.h],[
+ # dwelf_elf_gnu_build_id was introduced in elfutils 0.159
AC_CHECK_LIB(dw, dwelf_elf_gnu_build_id, [
AC_DEFINE(HAVE_LIBDW, 1,
[Define to 1 if you have elfutils libdw library])
WITH_LIBDW_LIB="-ldw"
WITH_LIBDW=yes
+ # If possible we also want the strtab functions from elfutils 0.167.
+ # But we can fall back on the (unsupported) ebl alternatives if not.
+ AC_CHECK_LIB(dw, dwelf_strtab_init, [HAVE_LIBDW_STRTAB=yes])
])
])
])
AC_SUBST(WITH_LIBDW_LIB)
AM_CONDITIONAL(LIBDW,[test "$WITH_LIBDW" = yes])
+AM_CONDITIONAL(HAVE_LIBDW_STRTAB,[test "$HAVE_LIBDW_STRTAB" = yes])
#=================
# Process --with/without-external-db