From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2088.outbound.protection.outlook.com [40.107.101.88]) by sourceware.org (Postfix) with ESMTPS id 60A6B3858D3C for ; Sun, 3 Oct 2021 22:50:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 60A6B3858D3C ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SGw+wX4QUaPJoNDcoym5p09Ru6mRlP3gazXXWP+dXd9cj0oFkWMLaR/RePoP087zEXzSI0topmIdEWnKZqAZXPKULvsTL9TuF4Q8C1cScQ9gt3Yp9Qcjhw3mS81smBjuL54iuLcFqp5oHFsXaATUprBST+jorlINRSbv2cBrrl4qf9SpGgKozxWjSArSjAo+PSXZqMVWdQIKGF/JnIEGEa2ikf2uzohgBPOBPoZgJgaH+lgLtY6NW6hZUwLTfRV0d8d/oyIq0icyiwlVI+CwCvzlPYhZiy2deX0dEi8Yu3Gq+L4s1SvGng6F6LPJ5wlmUOVxUaAfo2SZRD901FPkqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Q6N81D3caSpTdN87mJo9ThA5bvNxnnRtX3768fY/feA=; b=evSla+uJMMKYuGSaG+2BCFHqqn5dwxvVW0BH1BKFZT2bcGWBio5FGITBa2d7rfPJSOrsE5pEf+niYwUeuM71R7RRCnRvZ1gUHjarAr3pX1SHg+raIDzaCdzA+W4t++hCW6Lg9eR1FqIOnTA3oSXCtiksQVILjH8U3+GGlD7BiD+mEBmkmaU/39tN7BjPzQRul5ODaxYheiPypyffJHuXgSinx2cMPw0C51AExR/TGiubcHk+lk/q/F1yJv+h31zSGaVRJKtJ3cxcKVR/7MM5eiGo9JCawEq5s40ryBp4Lp7seuvTyoHQT4IFf+ut7Rct8c0P0gGwA1oYS7PQmKSSyA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none Received: from BN9PR12MB5243.namprd12.prod.outlook.com (2603:10b6:408:100::8) by BN9PR12MB5178.namprd12.prod.outlook.com (2603:10b6:408:11b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.16; Sun, 3 Oct 2021 22:50:19 +0000 Received: from BN9PR12MB5243.namprd12.prod.outlook.com ([fe80::4863:1c19:9604:6df2]) by BN9PR12MB5243.namprd12.prod.outlook.com ([fe80::4863:1c19:9604:6df2%3]) with mapi id 15.20.4566.022; Sun, 3 Oct 2021 22:50:19 +0000 From: "Achra, Nitika" To: Jakub Jelinek , "dwz@sourceware.org" CC: "George, Jini Susan" Subject: Re: [PING][PATCH] DWARFv5: Support for unit type DW_UT_type and DW_TAG_type_unit. Thread-Topic: [PING][PATCH] DWARFv5: Support for unit type DW_UT_type and DW_TAG_type_unit. Thread-Index: AdePMURJLq5tNUaoSQylxX8NCOhzvAK/8EHAB533Ojk= Date: Sun, 3 Oct 2021 22:50:18 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_Enabled=True; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_SetDate=2021-10-03T22:49:11.8807619Z; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_ContentBits=0; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_Method=Privileged x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 48d2751b-c7e8-4bcb-b268-08d986c02cbd x-ms-traffictypediagnostic: BN9PR12MB5178: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:37; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Mp2rrBjjxX8qTENFRtrjFet3UrZKsYHZ68gx+zlU96GBV+bFhrqJvHmpu6xxkq9YDDpx45pEmZGrjQkxpusvol6TZoeq8pfBHd6aAUVAZ7K6DY8OgWM1OgDS9U0Tdm7IyVPIEzwDpU33UScWi7wHl+Ys0GJaUeCEWFDsm9xZ4ksAl2D4DPvqTXDNo29jqn8m+AoAGCSXpAoZSA+T/yl1iCER27J0PJ6G32BnVEkuymYNVBxfCdws+iVjqN8+f7xDzU2bI/GA3D9xlGiZMq0ka6OElXp+sqe3mnRulSC2Rh2sjLWIcplPO09+iRmCf5k5ctu9a+oIQmS2xFSOjUWwNi6KGe3TbGA5Fsm2FsjbLzyetJDqw05g1LHsECCgonjaoUlQedKw8SZ1M2mD6mVsxPv6l1/zY95eukKBR90adKilPoPjSTnsnbu1lMgM3DyCIJHQN6dyf5EY6+ogfkSe6e9lQew+59JoAPEdxYddUJrgG2QI5ioBc+Qmj9Gf8nVCdHwOJBcFAnAbYnfZMmQ7KBAsgnXmAVci82OvluzIVhbR3ftPXIsOK7ln/mT8oYmu1CO07l76nhQcE2LxG9EMQuO01eWBGWP12hIyGF0EXq5AjPbMRfJk8VhOxDFh2wFQzYgJluqXkjU9lBErYtVxIiwTUK27ABCNyMeMvKdasj+SFmBM0fXNl9pAtpUg99ujqHVJddvNeNMCNJVX8Y+4jlAyRN9cO+gCcawhSOkNj1luH3OUmUrZeaC/Y5f6sJubOOdU/zFzpCnpUVB9G3kfh4qfgKET5XZzo/fkglnCfBo= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN9PR12MB5243.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(26005)(8676002)(86362001)(186003)(66946007)(316002)(76116006)(66476007)(33656002)(66556008)(64756008)(66446008)(38070700005)(91956017)(166002)(110136005)(4326008)(508600001)(30864003)(6506007)(5660300002)(7696005)(55016002)(52536014)(83380400001)(9686003)(38100700002)(8936002)(71200400001)(53546011)(45080400002)(2906002)(122000001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?zAWc0V1q8JDQ6H/5FugRLWg7juzhUyqD2TyDShgljD34uMoOYJqhFKrRwdnH?= =?us-ascii?Q?4d19gN8hGxbtMJmlpfKarXXJrzf6saM8q/wTHnGKA+EvrSY6/mzvL4gOxZlU?= =?us-ascii?Q?Xys/+cD6XnkEZcoObmAjVPyYBf+o50Yr2eQGYEdMRqaOMx0KHrfNmEd2zJ5P?= =?us-ascii?Q?pdP5Ptcb4pIoVTC9vAsyUpPDwWfnhb6x5Mi5FOXwuHuG4tmPlitOzyUiblE0?= =?us-ascii?Q?GvoCeFsRZh8ZTGoRnxnQIeYp+yv/zRcY7ejMrIqs42a/rr2QNtRbJJiP5t0p?= =?us-ascii?Q?2VM+5VM/PnVwi6SiAJBGAUGvrUGJpo0lYwLePqO87DUkFpo9qOKYtdZlOcYV?= =?us-ascii?Q?nBj533fWSqzyDUI0gbupbWwvVYDt5FV+KuX7wuIcJoiWPGEwTlfLIgenCCzs?= =?us-ascii?Q?O5UKsM+UV6lmjqqAkibGGyQPLNQppFdeR4DyP9tkJpNE1NJHOsBq6CS3In6r?= =?us-ascii?Q?cWUTMR2EKiH+moKDJGPqSBx11MZDD2p42HyHvSKfs4FPgjyxKEBVGxlOVN7p?= =?us-ascii?Q?KXTBvcVJJaH/LnU+eCRRdZluRCZZkwHBQc4wPsnlEOnFz+5SpqcXYi0mQ4uj?= =?us-ascii?Q?8dRoesnoiyJQNnXYn3AEXUATXTSZ7o7mm+JD3XNtsJmbKrPZUHXWBXUMt3gP?= =?us-ascii?Q?4aRnFI/izaHx7Amju9bfJgPpH6jdyvkdp3RImRB+e9DmpN3zQlaZe3hR2TKS?= =?us-ascii?Q?8nJJ7gKVV+kDq4W8hLE/uGXIfDvDQb5Zsb9m64GnkhaAd+VGAO5hSfcuPhCi?= =?us-ascii?Q?v91KHU4jAzr40AqgZ4bDN82pmKp79kOuIq4vbrOEEQKxMb4hCNSWjPMZ370c?= =?us-ascii?Q?nrLJCLMu9D5ImVA6hBeg+9Ul/T2kQhlI1Dh1PoY+8nL+iO6Yz8872otLXnze?= =?us-ascii?Q?wEnFbVJTjywNAV+eURgA1Og03b4wJalP+80SEyvAc8kvlZuEdWsu+gdPtOeK?= =?us-ascii?Q?oqY7xLle0XNhGUcKNN8ZJNZ/kxnAbjYhy0kPmjXVgIs7wt7WyidnfwYJX8XY?= =?us-ascii?Q?yGEnO6Ql7lBVwvKlYr63akP9+9eBZEBGrCe42E36G3Kyj2q3U5kuEJ29hBjd?= =?us-ascii?Q?OZaHd1dAJrmL0PGXyy8zU7Prn5mk0rRo0NAI3dp0+gnwReMgPd3jL4sd0mmK?= =?us-ascii?Q?oXYNqYPQKzMvJc88PBWosSFcG+pbmiDvMdzvoUpMZ2lmXJAhOszlAift/VhJ?= =?us-ascii?Q?fhAqFtqtlWFHe+V59D3Q0n6H8g9pf83/xFmOa0B1d/Q/AC/IcOPEbUqnSWYa?= =?us-ascii?Q?khrwcq3ZgGt/90aMzt3HmlXSX+dmEVeriHH5NLE4+7W6dOms8D0oKRIAC2aV?= =?us-ascii?Q?buZSBRd5ZGKnX5dRMyPCXQeLCpn171EGYvY043KynyhsIg=3D=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR12MB5243.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 48d2751b-c7e8-4bcb-b268-08d986c02cbd X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Oct 2021 22:50:18.7279 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: r2A5WvsIEoCdzISPB+5LdMKjr1vKcW7sTVr8sbIxeLzto8pj6Qh39jTaN8gFAgqaI7k0GgADEffFqtxHsgvKYg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5178 X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, HTML_MESSAGE, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Sun, 03 Oct 2021 22:50:26 -0000 [AMD Official Use Only] Requesting to please review this. Regards, Nitika Get Outlook for Android ________________________________ From: Achra, Nitika Sent: Thursday, August 26, 2021 9:47:14 AM To: Jakub Jelinek ; dwz@sourceware.org Cc: George, Jini Susan Subject: RE: [PING][PATCH] DWARFv5: Support for unit type DW_UT_type and DW= _TAG_type_unit. [AMD Official Use Only] A gentle reminder. Regards Nitika -----Original Message----- From: Achra, Nitika Sent: Thursday, August 12, 2021 9:50 AM To: 'Jakub Jelinek' ; dwz@sourceware.org Cc: George, Jini Susan Subject: RE: [PING][PATCH] DWARFv5: Support for unit type DW_UT_type and DW= _TAG_type_unit. [AMD Official Use Only] Just a gentle reminder for review. Regards, Nitika -----Original Message----- From: Achra, Nitika Sent: Wednesday, July 28, 2021 8:02 PM To: Jakub Jelinek Cc: dwz@sourceware.org; George, Jini Susan Subject: RE: [PATCH] DWARFv5: Support for unit type DW_UT_type and DW_TAG_t= ype_unit. [AMD Official Use Only] Hi Jakub, Thanks for the review. Please find the attached patch with some of the chan= ges you suggested. Please take a look at it. Regards, Nitika -----Original Message----- From: Jakub Jelinek Sent: Friday, June 11, 2021 4:25 PM To: Achra, Nitika Cc: dwz@sourceware.org; George, Jini Susan Subject: Re: [PATCH] DWARFv5: Support for unit type DW_UT_type and DW_TAG_t= ype_unit. [CAUTION: External Email] On Fri, Jun 11, 2021 at 09:37:18AM +0000, Achra, Nitika via Dwz wrote: > The attached patch handles the DW_UT_type and DW_TAG_type_unit for DWARFv= 5. Requesting everyone to please review this. Ideally, dwz should rewrite all those DW_TAG_type_units into DW_TAG_partial= _unit, after a library or binary is linked, nothing from outside can refer = to its type units. The DW_FORM_ref_sig8 references are too large, DW_FORM_= ref_addr is (for 32-bit DWARF) half the size and cheaper for the consumer w= hich doesn't have to look up the type id in some hash table. Furthermore o= ne can save some bytes from the unit header too. --- a/dwz.c +++ b/dwz.c @@ -903,6 +903,13 @@ struct dw_cu unsigned int cu_offset; /* DWARF version of the CU. */ unsigned int cu_version; + /* True if the CU unit_type is DW_UT_type inside the debug_info. */ + bool isUTType; Why can't this be in cu_kind instead, just another kind? And, dwz doesn't use this kind of variable/field names. + /* A unique 8-byte signature of the type described in this type unit. + */ uint64_t cu_type_signature; + /* A 4-byte unsigned offset relative to the beginning of the type unit + header. */ + unsigned int cu_type_offset; This will create unnecessary padding in the struct on 64-bit arches. They should be moved somewhere where that doesn't happen. /* Cached DW_AT_comp_dir value from DW_TAG_*_unit cu_die, or NULL if that attribute is not present. */ char *cu_comp_dir; @@ -3245,6 +3252,7 @@ checksum_die (DSO *dso, dw_cu_ref cu, dw_die_ref top_= die, dw_die_ref die) die->u.p1.die_hash =3D 0; if (die->die_tag =3D=3D DW_TAG_compile_unit || die->die_tag =3D=3D DW_TAG_partial_unit + || die->die_tag =3D=3D DW_TAG_type_unit || die->die_tag =3D=3D DW_TAG_namespace || die->die_tag =3D=3D DW_TAG_module || die->die_tag =3D=3D DW_TAG_imported_unit) @@ -4065,6 +4073,7 @@ c= hecksum_ref_die (dw_cu_ref cu, dw_die_ref top_die, dw_die_ref die, while (!reft->die_root && reft->die_parent->die_tag !=3D DW_TAG_compile_unit && reft->die_parent->die_tag !=3D DW_TAG_partial_unit + && reft->die_parent->die_tag !=3D DW_TAG_type_unit && !reft->die_parent->die_named_namespace) reft =3D reft->die_parent; if (reft->die_ck_state !=3D CK_KNOWN || reft->die_root) @@ -4= 580,9 +4589,11 @@ die_eq_1 (dw_cu_ref cu1, dw_cu_ref cu2, { const char *name1, *name2; if ((ref1->die_tag =3D=3D DW_TAG_compile_unit - || ref1->die_tag =3D=3D DW_TAG_partial_unit) + || ref1->die_tag =3D=3D DW_TAG_partial_unit + || ref1->die_tag =3D=3D DW_TAG_type_unit) && (ref2->die_tag =3D=3D DW_TAG_compile_unit - || ref2->die_tag =3D=3D DW_TAG_partial_unit)) + || ref2->die_tag =3D=3D DW_TAG_partial_unit + || ref2->die_tag =3D=3D DW_TAG_type_unit)) break; if (ref1->die_tag !=3D ref2->die_tag) return 0; @@ -6023,6 +6034,7 @@ mark_refs (dw_cu_ref cu, dw_die_ref top_die, dw_die_r= ef die, int mode) while (!reft->die_root && reft->die_parent->die_tag !=3D DW_TAG_compile_unit && reft->die_parent->die_tag !=3D DW_TAG_partial_unit + && reft->die_parent->die_tag !=3D DW_TAG_type_unit && !reft->die_parent->die_named_namespace) reft =3D reft->die_parent; if ((mode & MARK_REFS_FOLLOW_DUPS) && reft->die_dup !=3D NULL= ) @@ -6342,7 +6354,7 @@ try_debug_info (DSO *dso) if (cu_version =3D=3D 5) { value =3D read_8 (ptr); - if (value !=3D DW_UT_compile && value !=3D DW_UT_partial) + if (value !=3D DW_UT_compile && value !=3D DW_UT_partial && value + !=3D DW_UT_type) error (0, 0, "%s: DWARF CU type %s unhandled", dso->filename, get_DW_UT_str (value)); } @@ -6571,6 +6583,8 @@ read_debug_info (DSO *dso, int kind, unsigned int *di= e_count) bool present; unsigned int debug_line_off; unsigned int type_offset =3D 0; + uint64_t type_signature =3D 0; + bool isUTType =3D false; /* Note header is one bigger with DWARF version 5. */ if (ptr + (kind =3D=3D DEBUG_TYPES ? 23 : 11) > endsec) @@ -6613,12 = +6627,13 @@ read_debug_info (DSO *dso, int kind, unsigned int *die_count) if (cu_version =3D=3D 5) { value =3D read_8 (ptr); - if (value !=3D DW_UT_compile && value !=3D DW_UT_partial) + if (value !=3D DW_UT_compile && value !=3D DW_UT_partial && value + !=3D DW_UT_type) { error (0, 0, "%s: DWARF CU type %s unhandled", dso->filename, get_DW_UT_str (value)); goto fail; } + isUTType =3D (value =3D=3D DW_UT_type); } else { @@ -6760,9 +6775,9 @@ read_debug_info (DSO *dso, int kind, unsigned int *di= e_count) } last_abbrev_offset =3D value; - if (unlikely (kind =3D=3D DEBUG_TYPES)) + if (unlikely (kind =3D=3D DEBUG_TYPES) || isUTType) { - ptr +=3D 8; + type_signature =3D read_64 (ptr); type_offset =3D read_32 (ptr); } @@ -6775,6 +6790,10 @@ read_debug_info (DSO *dso, int kind, unsigned int *d= ie_count) cu->cu_offset =3D cu_offset; cu->cu_version =3D cu_version; cu->cu_chunk =3D cu_chunk; + cu->cu_type_offset =3D type_offset; + cu->cu_type_signature =3D type_signature; + cu->isUTType =3D isUTType; + if (unlikely (op_multifile || low_mem)) cu->cu_abbrev =3D abbrev; diep =3D &cu->cu_die; @@ -6955,14 +6974,16 @@ read_debug_info (DSO *dso, int kind, unsigned int *= die_count) case DW_FORM_implicit_const: if (lang_p && (die->die_tag =3D=3D DW_TAG_compile_unit - || die->die_tag =3D=3D DW_TAG_partial_unit) + || die->die_tag =3D=3D DW_TAG_partial_unit + || die->die_tag =3D=3D DW_TAG_type_unit) && t->attr[i].attr =3D=3D DW_AT_language) cu->lang =3D t->values[i]; break; case DW_FORM_data1: if (lang_p && (die->die_tag =3D=3D DW_TAG_compile_unit - || die->die_tag =3D=3D DW_TAG_partial_unit) + || die->die_tag =3D=3D DW_TAG_partial_unit + || die->die_tag =3D=3D DW_TAG_type_unit) && t->attr[i].attr =3D=3D DW_AT_language) cu->lang =3D *ptr; /* FALLTHRU */ @@ -6973,7 +6994,8 @@ read_debug_info (DSO *dso, int kind, unsigned int *di= e_count) case DW_FORM_data2: if (lang_p && (die->die_tag =3D=3D DW_TAG_compile_unit - || die->die_tag =3D=3D DW_TAG_partial_unit) + || die->die_tag =3D=3D DW_TAG_partial_unit + || die->die_tag =3D=3D DW_TAG_type_unit) && t->attr[i].attr =3D=3D DW_AT_language) cu->lang =3D do_read_16 (ptr); /* FALLTHRU */ @@ -6983,7 +7005,8 @@ read_debug_info (DSO *dso, int kind, unsigned int *di= e_count) case DW_FORM_data4: if (lang_p && (die->die_tag =3D=3D DW_TAG_compile_unit - || die->die_tag =3D=3D DW_TAG_partial_unit) + || die->die_tag =3D=3D DW_TAG_partial_unit + || die->die_tag =3D=3D DW_TAG_type_unit) && t->attr[i].attr =3D=3D DW_AT_language) read_lang (ptr, form, &cu->lang); /* FALLTHRU */ @@ -6994,7 +7017,8 @@ read_debug_info (DSO *dso, int kind, unsigned int *di= e_count) case DW_FORM_data8: if (lang_p && (die->die_tag =3D=3D DW_TAG_compile_unit - || die->die_tag =3D=3D DW_TAG_partial_unit) + || die->die_tag =3D=3D DW_TAG_partial_unit + || die->die_tag =3D=3D DW_TAG_type_unit) && t->attr[i].attr =3D=3D DW_AT_language) read_lang (ptr, form, &cu->lang); /* FALLTHRU */ @@ -7009,7 +7033,8 @@ read_debug_info (DSO *dso, int kind, unsigned int *di= e_count) case DW_FORM_udata: if (lang_p && (die->die_tag =3D=3D DW_TAG_compile_unit - || die->die_tag =3D=3D DW_TAG_partial_unit) + || die->die_tag =3D=3D DW_TAG_partial_unit + || die->die_tag =3D=3D DW_TAG_type_unit) && t->attr[i].attr =3D=3D DW_AT_language) { ptr =3D read_lang (ptr, form, &cu->lang); @@ -7559,6 = +7584,7 @@ mark_singletons (dw_cu_ref cu, dw_die_ref top_die, dw_die_ref di= e, while (!reft->die_root && reft->die_parent->die_tag !=3D DW_TAG_compile_unit && reft->die_parent->die_tag !=3D DW_TAG_partial_unit + && reft->die_parent->die_tag !=3D DW_TAG_type_unit && !reft->die_parent->die_named_namespace) reft =3D reft->die_parent; if (reft->die_dup !=3D NULL || reft->die_nextdup !=3D NULL) @@ -1= 1001,6 +11027,7 @@ build_abbrevs_for_die (htab_t h, dw_cu_ref cu, dw_die_re= f die, { case DW_TAG_partial_unit: case DW_TAG_compile_unit: + case DW_TAG_type_unit: t->nattr =3D 0; die->die_size =3D 0; if (origin =3D=3D NULL) @@ -11014,7 +11041,7 @@ build_abbrevs_for_die (htab_t h, dw_cu_ref cu, dw_d= ie_ref die, die->die_size +=3D 4; t->nattr++; } - if (uni_lang_p || cu->cu_die->die_tag =3D=3D DW_TAG_compile_unit) + if (uni_lang_p || cu->cu_die->die_tag =3D=3D DW_TAG_compile_unit || + cu->cu_die->die_tag =3D=3D DW_TAG_type_unit) { unsigned int lang_size =3D nr_bytes_for (cu->lang); die->die_size +=3D lang_size; @@ -11421,7 +11448,7 @@ compute_abbrevs (DSO *dso) enum dwarf_form intracuform =3D DW_FORM_ref4; dw_die_ref child, *lastotr, child_next, *last; unsigned int headersz =3D (cu->cu_kind =3D=3D CU_TYPES - ? 23 : (cu->cu_version >=3D 5 ? 12 : 11)); + ? 23 : (cu->cu_version >=3D 5 ? + (cu->isUTType ? 24 : 12) : 11)); if (unlikely (fi_multifile) && cu->cu_die->die_remove) continue; @@ -12639,6 +12666,7 @@ write_die (unsigned char *ptr, dw_cu_ref cu, dw_die= _ref die, { case DW_TAG_partial_unit: case DW_TAG_compile_unit: + case DW_TAG_type_unit: ptr =3D write_unit_die (ptr, die, origin); break; case DW_TAG_namespace: @@ -12737,7 +12765,7 @@ static void recompute_abbrevs (dw_cu_ref cu, unsigned int cu_size) { unsigned int headersz =3D (cu->cu_kind =3D=3D CU_TYPES - ? 23 : (cu->cu_version >=3D 5 ? 12 : 11)); + ? 23 : (cu->cu_version >=3D 5 ? (cu->isUTType ? + 24 : 12) : 11)); struct abbrev_tag *t; unsigned int ndies =3D 0, intracusize, off, i; dw_die_ref *intracuarr, *intracuvec; @@ -12846,13 +12874,23 @@ write_info (unsigned int *die_count) write_16 (ptr, cu->cu_version); if (cu->cu_version >=3D 5) { - *ptr++ =3D (cu->cu_die->die_tag =3D=3D DW_TAG_compile_unit - ? DW_UT_compile : DW_UT_partial); + if (cu->cu_die->die_tag =3D=3D DW_TAG_compile_unit) + *ptr++ =3D DW_UT_compile; + else if (cu->cu_die->die_tag =3D=3D DW_TAG_type_unit) + *ptr++ =3D DW_UT_type; + else + *ptr++ =3D DW_UT_partial; write_8 (ptr, ptr_size); } write_32 (ptr, cu->u2.cu_new_abbrev_offset); if (cu->cu_version < 5) write_8 (ptr, ptr_size); + if (cu->cu_die->die_tag =3D=3D DW_TAG_type_unit) + { + write_64 (ptr, cu->cu_type_signature); + write_32 (ptr, cu->cu_type_offset); + } + ptr =3D write_die (ptr, cu, cu->cu_die, NULL, NULL, die_count); assert (info + (next_off - (wr_multifile ? multi_info_off : 0)) =3D= =3D ptr); if (unlikely (low_mem) && cu->cu_kind !=3D CU_PU) @@ -14470,6 +14508= ,7 @@ propagate_multifile_refs_backward (dw_cu_ref cu, dw_die_ref top_die, while (!reft->die_root && reft->die_parent->die_tag !=3D DW_TAG_compile_unit && reft->die_parent->die_tag !=3D DW_TAG_partial_unit + && reft->die_parent->die_tag !=3D DW_TAG_type_unit && !reft->die_parent->die_named_namespace) reft =3D reft->die_parent; if (reft->die_root) -- 2.17.1 Jakub