From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 28FF93854804 for ; Tue, 16 Mar 2021 15:54:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 28FF93854804 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 35307AE6D; Tue, 16 Mar 2021 15:54:28 +0000 (UTC) Date: Tue, 16 Mar 2021 16:54:25 +0100 From: Tom de Vries To: dwz@sourceware.org, jakub@redhat.com, mark@klomp.org Subject: [committed] Fix another reference from PU to CU for odr Message-ID: <20210316155424.GA32231@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: dwz@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Dwz mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 15:54:30 -0000 Hi, When using the test-case from PR27578 with --no-import-optimize, we run into: ... $ dwz libvclplug_genlo.so.debug -o libvclplug_genlo.so.debug.z \ -lnone --odr --no-import-optimize dwz: dwz.c:12700: write_die: \ Assertion `IMPLIES (cu->cu_kind == CU_PU, \ die_cu (refd)->cu_kind == CU_PU)' failed. Aborted (core dumped) ... The assert is triggered when trying to write out the reference to the DIE at 2f5e for DW_AT_type: ... <1><2e8c>: Abbrev Number: 76 (DW_TAG_structure_type) <2e8d> DW_AT_name : (indirect string, offset: 0x5f592): SalXLib <2e91> DW_AT_byte_size : 320 ... <2><2ed9>: Abbrev Number: 22 (DW_TAG_member) <2eda> DW_AT_name : (indirect string, offset: 0x56c9b): aReadFDS_ <2ede> DW_AT_decl_file : 33 <2edf> DW_AT_decl_line : 173 <2ee0> DW_AT_decl_column : 21 <2ee1> DW_AT_type : <0x2f5e> <2ee5> DW_AT_data_member_location: 48 <2ee6> DW_AT_accessibility: 2 (protected) ... The corresponding duplicate chain (with some annotations manually added) is: ... duplicate chain: Compilation Unit @ offset 0x44: 2d01 O 9f6a4268(29178f4e) 9f6a4268 SalXLib structure_type DECL 2e8c O 9f6a4268(87d059e8) 9f6a4268 SalXLib structure_type DEF 40a6 O 9f6a4268(87d059e8) 9f6a4268 SalXLib structure_type DEF Compilation Unit @ offset 0xfaf6: 419be O 9f6a4268(29178f4e) 9f6a4268 SalXLib structure_type DECL 50e56 O 9f6a4268(29178f4e) 9f6a4268 SalXLib structure_type DECL 6063a O 9f6a4268(29178f4e) 9f6a4268 SalXLib structure_type DECL Compilation Unit @ offset 0x1bb0f: ... The duplicate chain is created by split_dups, which merged all the DECLs with one duplicate chain containing only DEFs. When doing the test for merged_singleton on this duplicate chain, it returns NULL, because there are two DEFs. However, the DEFs are from the same CU, and the type for aReadFDS_ is 0x2f5e for both DEFs. Consequently, there is no duplicate chain for 0x2f5e, and we need to force a singleton duplicate chain. Fix this by making merged_singleton return the first DEF. Committed to trunk. Thanks, - Tom Fix another reference from PU to CU for odr 2021-03-16 Tom de Vries PR dwz/27578 * dwz.c (merged_singleton): Handle DEFs in the same CU. --- dwz.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dwz.c b/dwz.c index 54b4bda..11c9114 100644 --- a/dwz.c +++ b/dwz.c @@ -8433,7 +8433,12 @@ merged_singleton (dw_die_ref die) { case ODR_DEF: if (res) - return NULL; + { + if (die_cu (res) == die_cu (d)) + continue; + else + return NULL; + } else res = d; break;