]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Check that each CU is referenced only from one pubname/pubtype section
authorPetr Machata <pmachata@redhat.com>
Mon, 26 Jan 2009 22:04:34 +0000 (23:04 +0100)
committerPetr Machata <pmachata@redhat.com>
Mon, 26 Jan 2009 22:04:34 +0000 (23:04 +0100)
src/ChangeLog
src/dwarflint.c

index daf09502399659ac1257b547ad79852faf3cd402..33b9e23bccb9b4ac8fb6f3fb6855acc70a0e51b4 100644 (file)
@@ -2,6 +2,7 @@
 
        * dwarflint.c (check_aranges_structural): Check that each CU is
        referenced from one aranges section only.
+       (check_pub_structural): Likewise for pubnames and pubtypes.
        (read_ctx_read_uleb128): Allow ten-byte ULEB128.
 
 2009-01-23  Petr Machata  <pmachata@redhat.com>
index e1ad896b47ae76c9764cf65fffcf389bcefb0a8f..cc3e1e25c53c9dade46b471b9f6618d60d4e6375 100644 (file)
@@ -604,6 +604,8 @@ struct cu
   struct ref_record die_refs;   // DIE references into other CUs from this CU.
   struct where where;           // Where was this section defined.
   bool has_arange;              // Whether we saw arange section pointing to this CU.
+  bool has_pubnames;            // Likewise for pubnames.
+  bool has_pubtypes;            // Likewise for pubtypes.
   struct cu *next;
 };
 
@@ -2921,7 +2923,16 @@ check_pub_structural (struct read_ctx *ctx, struct cu *cu_chain,
       if (cu_chain != NULL && (cu = cu_find_cu (cu_chain, cu_off)) == NULL)
        wr_error (&where, ": unresolved reference to " PRI_CU ".\n", cu_off);
       if (cu != NULL)
-       where.ref = &cu->where;
+       {
+         where.ref = &cu->where;
+         bool *has = sec == sec_pubnames
+                       ? &cu->has_pubnames : &cu->has_pubtypes;
+         if (*has)
+           wr_message (mc_impact_2 | mc_aranges, &where,
+                       ": there has already been section for this CU.\n");
+         else
+           *has = true;
+       }
 
       /* Covered length.  */
       uint64_t cu_len;