From: Petr Machata Date: Mon, 26 Jan 2009 22:04:34 +0000 (+0100) Subject: Check that each CU is referenced only from one pubname/pubtype section X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9a46cff1a1d93c631d074c7b39fbcf370a5123e5;p=thirdparty%2Felfutils.git Check that each CU is referenced only from one pubname/pubtype section --- diff --git a/src/ChangeLog b/src/ChangeLog index daf095023..33b9e23bc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -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 diff --git a/src/dwarflint.c b/src/dwarflint.c index e1ad896b4..cc3e1e25c 100644 --- a/src/dwarflint.c +++ b/src/dwarflint.c @@ -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;