From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 6B702383442B for ; Thu, 18 Feb 2021 14:09:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6B702383442B Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-303-bZ1gd7GENa2siT4zFTI4IQ-1; Thu, 18 Feb 2021 09:09:53 -0500 X-MC-Unique: bZ1gd7GENa2siT4zFTI4IQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B8B40AFA80; Thu, 18 Feb 2021 14:09:51 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-112-197.ams2.redhat.com [10.36.112.197]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 630B55D766; Thu, 18 Feb 2021 14:09:51 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 11IE9mQl2529970 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 18 Feb 2021 15:09:48 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 11IE9lCn2529969; Thu, 18 Feb 2021 15:09:47 +0100 Date: Thu, 18 Feb 2021 15:09:47 +0100 From: Jakub Jelinek To: Mark Wielaard Cc: dwz@sourceware.org Subject: Re: [PATCH] Don't handle blocks as exprlocs for DWARF version 4 or higher. Message-ID: <20210218140947.GG4020736@tucnak> Reply-To: Jakub Jelinek References: <20210213224622.16521-1-mark@klomp.org> <3fd1ebde0c9e1b8cbe09ea858a3e0f0a84af44b4.camel@klomp.org> MIME-Version: 1.0 In-Reply-To: <3fd1ebde0c9e1b8cbe09ea858a3e0f0a84af44b4.camel@klomp.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_LOW, 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: Thu, 18 Feb 2021 14:09:58 -0000 On Thu, Feb 18, 2021 at 02:40:36PM +0100, Mark Wielaard wrote: > On Sat, 2021-02-13 at 23:46 +0100, Mark Wielaard wrote: > > Since DWARF version 4 blocks just contain bytes, trying to interpret > > them as exprlocs will most likely fail. > > > > * dwz.c (add_locexpr_dummy_dies): Only handle block as exprloc > > for cu_version < 4. > > (checksum_die): Likewise. > > (write_die): Likewise. > > > > https://sourceware.org/bugzilla/show_bug.cgi?id=26987 > > Ping. Any comments? Doing some GCC archeology if it is safe, I think it principially ok, but I'd like slightly different patch, see below. While -gdwarf-4 support has been added in https://gcc.gnu.org/r0-96109-g15b3fbeb7e97f2ca3731881bf3a0f899ec56ebbf during GCC 4.5 development, it was still emitting DWARF 3 .debug_info headers and not using DW_FORM_exprloc. DW_FORM_exprloc came with: https://gcc.gnu.org/r0-99103-g290d8971e6e3b784a88b5c4b6b91b8d77552cb3a and DWARF version .debug_info header changed from 3 to 4 for -gdwarf-4 a day after that: https://gcc.gnu.org/r0-99139-g2f43d500a6769e563fb8f645e7530c2f144d7023 > > +++ b/dwz.c > > @@ -2913,43 +2913,44 @@ add_locexpr_dummy_dies (DSO *dso, dw_cu_ref > > cu, dw_die_ref die, > > if (form == DW_FORM_block1) > > { > > /* Old DWARF uses blocks instead of exprlocs. */ Instead of reindenting everything, can't you simply change - if (form == DW_FORM_block1) + if (form == DW_FORM_block1 && cu->cu_version < 4) > > if (form == DW_FORM_block1) And likewise here: - if (form == DW_FORM_block1) + if (form == DW_FORM_block1 && cu->cu_version < 4) > > @@ -12392,7 +12394,7 @@ write_die (unsigned char *ptr, dw_cu_ref cu, > > dw_die_ref die, > > ptr += inptr - orig_ptr; > > > > /* Old DWARF uses blocks instead of exprlocs. */ > > - if (form == DW_FORM_block1) > > + if (form == DW_FORM_block1 && cu->cu_version < 4) Like you've done it here? > > switch (reft->attr[i].attr) > > { > > case DW_AT_frame_base: Jakub