From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (wildebeest.demon.nl [212.238.236.112]) by sourceware.org (Postfix) with ESMTPS id 97C733898527 for ; Thu, 18 Feb 2021 13:40:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 97C733898527 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mark@klomp.org Received: from tarox.wildebeest.org (tarox.wildebeest.org [172.31.17.39]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 79B3D30005B3 for ; Thu, 18 Feb 2021 14:40:36 +0100 (CET) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id 6A2A940422D7; Thu, 18 Feb 2021 14:40:36 +0100 (CET) Message-ID: <3fd1ebde0c9e1b8cbe09ea858a3e0f0a84af44b4.camel@klomp.org> Subject: Re: [PATCH] Don't handle blocks as exprlocs for DWARF version 4 or higher. From: Mark Wielaard To: dwz@sourceware.org Date: Thu, 18 Feb 2021 14:40:36 +0100 In-Reply-To: <20210213224622.16521-1-mark@klomp.org> References: <20210213224622.16521-1-mark@klomp.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Evolution 3.28.5 (3.28.5-10.el7) Mime-Version: 1.0 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, 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 13:40:40 -0000 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. >=20 > * dwz.c (add_locexpr_dummy_dies): Only handle block as exprloc > for cu_version < 4. > (checksum_die): Likewise. > (write_die): Likewise. >=20 > https://sourceware.org/bugzilla/show_bug.cgi?id=3D26987 Ping. Any comments? > dwz.c | 166 +++++++++++++++++++++++++++++--------------------------- > -- > 1 file changed, 84 insertions(+), 82 deletions(-) >=20 > diff --git a/dwz.c b/dwz.c > index d6b9df0..02fcd8c 100644 > --- a/dwz.c > +++ b/dwz.c > @@ -2913,43 +2913,44 @@ add_locexpr_dummy_dies (DSO *dso, dw_cu_ref > cu, dw_die_ref die, > if (form =3D=3D DW_FORM_block1) > { > /* Old DWARF uses blocks instead of exprlocs. */ > - switch (attr) > - { > - case DW_AT_frame_base: > - case DW_AT_location: > - case DW_AT_data_member_location: > - case DW_AT_vtable_elem_location: > - case DW_AT_byte_size: > - case DW_AT_bit_offset: > - case DW_AT_bit_size: > - case DW_AT_string_length: > - case DW_AT_lower_bound: > - case DW_AT_return_addr: > - case DW_AT_bit_stride: > - case DW_AT_upper_bound: > - case DW_AT_count: > - case DW_AT_segment: > - case DW_AT_static_link: > - case DW_AT_use_location: > - case DW_AT_allocated: > - case DW_AT_associated: > - case DW_AT_data_location: > - case DW_AT_byte_stride: > - case DW_AT_rank: > - case DW_AT_call_value: > - case DW_AT_call_target: > - case DW_AT_call_target_clobbered: > - case DW_AT_call_data_location: > - case DW_AT_call_data_value: > - case DW_AT_GNU_call_site_value: > - case DW_AT_GNU_call_site_data_value: > - case DW_AT_GNU_call_site_target: > - case DW_AT_GNU_call_site_target_clobbered: > - if (read_exprloc_low_mem_phase1 (dso, die, ptr, len)) > - return 1; > - default: > - break; > - } > + if (cu->cu_version < 4) > + switch (attr) > + { > + case DW_AT_frame_base: > + case DW_AT_location: > + case DW_AT_data_member_location: > + case DW_AT_vtable_elem_location: > + case DW_AT_byte_size: > + case DW_AT_bit_offset: > + case DW_AT_bit_size: > + case DW_AT_string_length: > + case DW_AT_lower_bound: > + case DW_AT_return_addr: > + case DW_AT_bit_stride: > + case DW_AT_upper_bound: > + case DW_AT_count: > + case DW_AT_segment: > + case DW_AT_static_link: > + case DW_AT_use_location: > + case DW_AT_allocated: > + case DW_AT_associated: > + case DW_AT_data_location: > + case DW_AT_byte_stride: > + case DW_AT_rank: > + case DW_AT_call_value: > + case DW_AT_call_target: > + case DW_AT_call_target_clobbered: > + case DW_AT_call_data_location: > + case DW_AT_call_data_value: > + case DW_AT_GNU_call_site_value: > + case DW_AT_GNU_call_site_data_value: > + case DW_AT_GNU_call_site_target: > + case DW_AT_GNU_call_site_target_clobbered: > + if (read_exprloc_low_mem_phase1 (dso, die, ptr, len)) > + return 1; > + default: > + break; > + } > =20 > return 0; > } > @@ -3736,50 +3737,51 @@ checksum_die (DSO *dso, dw_cu_ref cu, > dw_die_ref top_die, dw_die_ref die) > if (form =3D=3D DW_FORM_block1) > { > /* Old DWARF uses blocks instead of exprlocs. */ > - switch (t->attr[i].attr) > - { > - case DW_AT_frame_base: > - case DW_AT_location: > - case DW_AT_data_member_location: > - case DW_AT_vtable_elem_location: > - case DW_AT_byte_size: > - case DW_AT_bit_offset: > - case DW_AT_bit_size: > - case DW_AT_string_length: > - case DW_AT_lower_bound: > - case DW_AT_return_addr: > - case DW_AT_bit_stride: > - case DW_AT_upper_bound: > - case DW_AT_count: > - case DW_AT_segment: > - case DW_AT_static_link: > - case DW_AT_use_location: > - case DW_AT_allocated: > - case DW_AT_associated: > - case DW_AT_data_location: > - case DW_AT_byte_stride: > - case DW_AT_rank: > - case DW_AT_call_value: > - case DW_AT_call_target: > - case DW_AT_call_target_clobbered: > - case DW_AT_call_data_location: > - case DW_AT_call_data_value: > - case DW_AT_GNU_call_site_value: > - case DW_AT_GNU_call_site_data_value: > - case DW_AT_GNU_call_site_target: > - case DW_AT_GNU_call_site_target_clobbered: > - if (die->die_ck_state !=3D CK_BAD) > - { > - s =3D t->attr[i].attr; > - die->u.p1.die_hash > - =3D iterative_hash_object (s, die->u.p1.die_hash); > - } > - if (read_exprloc (dso, die, ptr, len, NULL)) > - return 1; > - handled =3D true; > - default: > - break; > - } > + if (cu->cu_version < 4) > + switch (t->attr[i].attr) > + { > + case DW_AT_frame_base: > + case DW_AT_location: > + case DW_AT_data_member_location: > + case DW_AT_vtable_elem_location: > + case DW_AT_byte_size: > + case DW_AT_bit_offset: > + case DW_AT_bit_size: > + case DW_AT_string_length: > + case DW_AT_lower_bound: > + case DW_AT_return_addr: > + case DW_AT_bit_stride: > + case DW_AT_upper_bound: > + case DW_AT_count: > + case DW_AT_segment: > + case DW_AT_static_link: > + case DW_AT_use_location: > + case DW_AT_allocated: > + case DW_AT_associated: > + case DW_AT_data_location: > + case DW_AT_byte_stride: > + case DW_AT_rank: > + case DW_AT_call_value: > + case DW_AT_call_target: > + case DW_AT_call_target_clobbered: > + case DW_AT_call_data_location: > + case DW_AT_call_data_value: > + case DW_AT_GNU_call_site_value: > + case DW_AT_GNU_call_site_data_value: > + case DW_AT_GNU_call_site_target: > + case DW_AT_GNU_call_site_target_clobbered: > + if (die->die_ck_state !=3D CK_BAD) > + { > + s =3D t->attr[i].attr; > + die->u.p1.die_hash > + =3D iterative_hash_object (s, die->u.p1.die_hash); > + } > + if (read_exprloc (dso, die, ptr, len, NULL)) > + return 1; > + handled =3D true; > + default: > + break; > + } > ptr +=3D len; > } > else if (form =3D=3D DW_FORM_exprloc) > @@ -12392,7 +12394,7 @@ write_die (unsigned char *ptr, dw_cu_ref cu, > dw_die_ref die, > ptr +=3D inptr - orig_ptr; > =20 > /* Old DWARF uses blocks instead of exprlocs. */ > - if (form =3D=3D DW_FORM_block1) > + if (form =3D=3D DW_FORM_block1 && cu->cu_version < 4) > switch (reft->attr[i].attr) > { > case DW_AT_frame_base: