Don't include dwz support by default.
authorMark Wielaard <mjw@redhat.com>
Fri, 24 Aug 2012 11:54:52 +0000 (13:54 +0200)
committerMark Wielaard <mjw@redhat.com>
Fri, 24 Aug 2012 13:33:55 +0000 (15:33 +0200)
By default the dwz multi file support is not included.  This means any
DW_FORM_GNU_ref_alt or DW_FORM_GNU_strp_alt encountered in libdw will
just produce an error message.  A new configure option --enable-dwz is
needed to include it for those we wish to test it.  The dwz test is also
disabled by default.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
ChangeLog
NEWS
configure.ac
libdw/ChangeLog
libdw/dwarf_begin_elf.c
libdw/libdwP.h
tests/ChangeLog
tests/Makefile.am

index 5842492..89fea8f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-08-24  Mark Wielaard  <mjw@redhat.com>
+
+       * configure.ac: Add --enable-dwz check, defaults to no.
+
 2012-07-24  Mark Wielaard  <mjw@redhat.com>
 
        * TODO: Add note on shdrs after elf_cntl (ELF_C_FDREAD).
diff --git a/NEWS b/NEWS
index 610253d..c92f55c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,7 +9,9 @@ libdw: dwarf.h corrected the DW_LANG_ObjC constant name (was DW_LANG_Objc).
        Any existing sources using the old name will have to be updated.
        Add DW_MACRO_GNU .debug_macro type encodings constants, DW_ATE_UTF
        and DW_OP_GNU_parameter_ref to dwarf.h.
-       Support for DWZ multifile forms DW_FORM_GNU_ref_alt/strp_alt.
+       Experimental support for DWZ multifile forms DW_FORM_GNU_ref_alt
+       and DW_FORM_GNU_strp_alt.  Disabled by default.  Use configure
+       --enable-dwz to test it.
 
 readelf: Add .debug_macro parsing support.
          Add .gdb_index version 7 parsing support.
index 7932489..dbd3efc 100644 (file)
@@ -67,6 +67,14 @@ AS_IF([test "$use_locks" = yes], [AC_DEFINE(USE_LOCKS)])
 
 AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.])
 
+AC_ARG_ENABLE([dwz],
+AS_HELP_STRING([--enable-dwz], [enable experimental GNU ref_alt FORM, dwz multi file support in libdw]),
+enable_dwz=$enableval, enable_dwz=no)
+AM_CONDITIONAL(ENABLE_DWZ, test "$enable_dwz" = yes)
+AS_IF([test "$enable_dwz" = yes], [AC_DEFINE(ENABLE_DWZ)])
+
+AH_TEMPLATE([ENABLE_DWZ], [Defined if libdw should support GNU ref_alt FORM, dwz multi files.])
+
 AC_PROG_CC
 AC_PROG_RANLIB
 AC_PROG_YACC
index 89009f0..416a16f 100644 (file)
@@ -1,3 +1,10 @@
+2012-08-24  Mark Wielaard  <mjw@redhat.com>
+
+       * dwarf_begin_elf.c (check_section): Only probe for dwz multi files
+       when ENABLE_DWZ is defined.
+       * libdwP.h (__check_build_id): Only declare when ENABLE_DWZ is
+       defined.
+
 2012-08-16  Mark Wielaard  <mjw@redhat.com>
 
        * Makefile.am (EXTRA_DIST): Add known-dwarf.h.
index fd95770..a9c826c 100644 (file)
@@ -71,6 +71,7 @@ static const char dwarf_scnnames[IDX_last][17] =
 };
 #define ndwarf_scnnames (sizeof (dwarf_scnnames) / sizeof (dwarf_scnnames[0]))
 
+#ifdef ENABLE_DWZ
 internal_function int
 __check_build_id (Dwarf *dw, const uint8_t *build_id, const size_t id_len)
 {
@@ -175,6 +176,7 @@ open_debugaltlink (Dwarf *result, const char *alt_name,
   result->alt_dwarf = NULL;
   return result;
 }
+#endif /* ENABLE_DWZ */
 
 static Dwarf *
 check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
@@ -219,6 +221,7 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
       return NULL;
     }
 
+#ifdef ENABLE_DWZ
   /* For dwz multifile support, ignore if it looks wrong.  */
   if (strcmp (scnname, ".gnu_debugaltlink") == 0)
     {
@@ -232,7 +235,7 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
            return open_debugaltlink (result, alt_name, build_id + 1, id_len);
        }
     }
-
+#endif /* ENABLE_DWZ */
 
   /* Recognize the various sections.  Most names start with .debug_.  */
   size_t cnt;
index da82e5d..76bddff 100644 (file)
@@ -624,12 +624,13 @@ unsigned char * __libdw_formptr (Dwarf_Attribute *attr, int sec_index,
                                 Dwarf_Off *offsetp)
   internal_function;
 
+#ifdef ENABLE_DWZ
 /* Checks that the build_id of the underlying Elf matches the expected.
    Returns zero on match, -1 on error or no build_id found or 1 when
    build_id doesn't match.  */
 int __check_build_id (Dwarf *dw, const uint8_t *build_id, const size_t id_len)
   internal_function;
-
+#endif /* ENABLE_DWZ */
 
 
 /* Aliases to avoid PLTs.  */
index f0c83e6..825b98a 100644 (file)
@@ -1,3 +1,8 @@
+2012-08-24  Mark Wielaard  <mjw@redhat.com>
+
+       * Makefile.am (TESTS): Only add run-readelf-dwz-multi.sh if
+       ENABLE_DWZ.
+
 2012-08-16  Mark Wielaard  <mjw@redhat.com>
 
        * allregs.c (dwarf_encoding_string): Rewritten using known-dwarf
index df66db6..724d866 100644 (file)
@@ -73,7 +73,7 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
        run-nm-self.sh run-readelf-self.sh \
        run-readelf-test1.sh run-readelf-test2.sh run-readelf-test3.sh \
        run-readelf-test4.sh run-readelf-twofiles.sh \
-       run-readelf-macro.sh run-readelf-dwz-multi.sh \
+       run-readelf-macro.sh \
        run-native-test.sh run-bug1-test.sh \
        dwfl-bug-addr-overflow run-addrname-test.sh \
        dwfl-bug-fd-leak dwfl-bug-report \
@@ -96,6 +96,10 @@ check_PROGRAMS += $(asm_TESTS)
 TESTS += $(asm_TESTS)
 endif
 
+if ENABLE_DWZ
+TESTS += run-readelf-dwz-multi.sh
+endif
+
 
 EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
             run-show-die-info.sh run-get-files.sh run-get-lines.sh \