From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2071.outbound.protection.outlook.com [40.107.92.71]) by sourceware.org (Postfix) with ESMTPS id 432B6383A81A for ; Thu, 12 Aug 2021 04:20:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 432B6383A81A ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UWa0B9dMqlDU1siBGjlB2FX7Img9/NzEJw+5sZh9HJoYm2VudLEl+wZJlOPm39LZcHZBUQd6HMMjBm83n3gKj4QsbVGFCdjKdeHwM2uBmnILaV67ijHIQTBan1KcsS/xoetQsmYQ/dHx4Z90a7aqeMT+kyg13Nv9kHIDhn+M4xiOIUXWJx34zj0kZEp3EEJcRl7AXk/hf94IzaWjws6iknuE6PqVchzxgjdPIaeEr7gM3FFOgBFsjxf4uOg+Q6t4k+QQ6SyZfkOFTkGSATIIJ00c+Rv3HM1GlN0RQLaxuG+OwhvbjLmvF+k0fEFv0DzQ/nO29LwHhkT6InuBAMbrPA== 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-SenderADCheck; bh=y7maC5GQKh1WKdq7AGxUK9ymhz4jGRH3Wn6fqAhNIdQ=; b=k0QJeda3ZPsWgVjh29xxvxB8vx/blNeXmP5tPKOWRMYeCmRQeiybyWL2OGFhkeCwFD++sX3redqPhX9EZ5JBHaQIMKBk7kP21xaaXYBoLh2NtyEGc+obV7rXfZKXnu5Y3sQ/xCXPCZzrJcbwEXPzyV+vtHz+VhRSy71N1KZepfTVsCWHPqLR6qwbzXujk+sBIOvQu62WP7sAASrLJeSSJWtH4QMYEW/yS/qoJ4CUfMSExrsJnHeJq9iHqdfe0pWfJVA26WKdLCESfE23HhCpnCEJ7mxfqUpnWGRdkvT5m3BaAqQFhJVO0TBj4CQ3lRP75au7Aa8vzIkTPHCbG3OCyg== 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 BN9PR12MB5383.namprd12.prod.outlook.com (2603:10b6:408:104::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.17; Thu, 12 Aug 2021 04:20:22 +0000 Received: from BN9PR12MB5243.namprd12.prod.outlook.com ([fe80::e55d:b4d8:cb84:145]) by BN9PR12MB5243.namprd12.prod.outlook.com ([fe80::e55d:b4d8:cb84:145%7]) with mapi id 15.20.4415.014; Thu, 12 Aug 2021 04:20:22 +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: AdePMURJLq5tNUaoSQylxX8NCOhzvA== Date: Thu, 12 Aug 2021 04:20:21 +0000 Message-ID: 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_SetDate=2021-08-12T04:20:18Z; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_Method=Standard; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_Name=AMD Official Use Only-AIP 2.0; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_ActionId=a49568a6-6d8b-48a0-bc74-093de28e7932; MSIP_Label_88914ebd-7e6c-4e12-a031-a9906be2db14_ContentBits=1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b207a487-5251-4f2e-4ae4-08d95d48804e x-ms-traffictypediagnostic: BN9PR12MB5383: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:99; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: UfyUdOV+/PKTV6mAI9Jbp36zInX2PGZ/oz2C+7jeakcyiwPQRvK1m1Ca4A0tclfhJ/Oxq4Bw93HpEyg1DkcDAmXTURiKNwAmVf+giLM3fubOfiyX0mQ0T0SCL7sPc1Qw0xeQOQ1+fOppOLDk2cITdHRZYHeaKqFLzv8bhji8anNgbJ6t31qscimIS+6uKAIZBbQWkuY62JwCqWfu7kj2RzRGNZGW4oPyuVUC7BG2ggE+Ge9lOKDWa4Le9yhR7FWnoQpkor+mmivNxA9O9gfMHr0/xXHJGEun9/Z3r49cHkF2ZL5FICHf+DqnVz2UFiqliFYuUT7vpFx0oxnxKzMbQ7AwfPYZ7L7Ksb519+IDuw0Jokyv8RLKM5mqXEysCIN3RTASMuT189tmRfuSCBQzED2YG0Rj1pNhO3x8GSwFh5X+q3JQXaOjKcUSr0XxXZPlya3vYiIb9NIJQhad4vy8gJv+WqrxebO2O2DuX2qfGVN8pMa2ZXX3XwYxfqCSrPZIHaqhpiJi5h7BpCLjsvsQMazJ4+zv0Sk6REOYRdD31rz7vmoHT3Ktv+NYAEYG25x/ca3TahikSwPmQrXziXXv929hB0wdHDqQiYCEQqeYkVH+MBMD89+/T4k2KlNG0b1TLA7XtX2tYU9TeL9844LkvTGynAOwK1mv6D7zXYEMpKFe1rdZvMVN52KU8kg3u0UyjWHpKKlxOb/Rg3w+/we+YQ== 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)(396003)(39860400002)(366004)(376002)(346002)(136003)(5660300002)(71200400001)(55016002)(33656002)(110136005)(2906002)(9686003)(478600001)(4326008)(52536014)(53546011)(6506007)(55236004)(122000001)(30864003)(38100700002)(316002)(64756008)(66476007)(86362001)(66556008)(66946007)(186003)(83380400001)(8676002)(7696005)(66446008)(76116006)(26005)(38070700005)(8936002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?8/fE8Cszkao0G2yDZY0ly80wIWAwcnjq+Nn7vpQVluUK6LkI6WWOy6sOZJU7?= =?us-ascii?Q?VtHh1kwks8o5Ci8mq5sHQT862ZATTQKrMOWjTK0YKNAWKng49PqU8QeSY3U7?= =?us-ascii?Q?XuW4gKIq1u5oUPf9Y05TqUjsaaHCvbwtCpzG7vOMKP/MBmGYd4eikX4WhrSu?= =?us-ascii?Q?fcrLDWPBQreYApLdL+s7S3Uos1NAgNy4Hq8tWdBnaey4oJjcqY9NosMi5JHd?= =?us-ascii?Q?K0d6aBZsNBcGbG2BTJGqGI+9umvAn7Ncmhn3NVhw9H9FuLOQ8+ROpLek77K7?= =?us-ascii?Q?rMfpTmVRouT+ccgVuFXRhl4rQtV/2WFUWeiaAL1taGIsRhwQtnTp4oe2gw7B?= =?us-ascii?Q?o3RE3ZsjaAoN56gPr+wQnwDVE5j1D7sAMPbYHuSR0T9+tMNZpSdy60/7DUuL?= =?us-ascii?Q?8jarrZTS+dLjrW6qDPzrBeCDzPhIWVeWbay+EpoPEaJ7TrCy4Jt1F5P5ITIG?= =?us-ascii?Q?gPlRQIaidm8d8SSnVcMc+mlNwVvGrGMUuvUazxrcgS2M830us9oB5cYCI4ZI?= =?us-ascii?Q?XRKUPNH0RtFrAMN83cZvOCCrF9HEsPOBx6Vpw/wzy9LZq//ytaS1UFWEPAjw?= =?us-ascii?Q?Yk55IGJNadSQxpx5cCy46skP352zlKyMRfPH0BSX7CEIQRfDJRf9n4AOUi0b?= =?us-ascii?Q?EAgBRu3Vkrm58Qaf5doUevwyxrFApyieQYqXEtci5ca7vM7aTT9H3zE2y9dS?= =?us-ascii?Q?aWUgBiGCkGlw6+QXiqZeWl5Uqyjb2yGWeY3Mrb0hh1SovrRENg1CTLn3KT1d?= =?us-ascii?Q?buaZxms+KpOSROfmed8/RVwPbKBUhXBe88rFY7e2/ssry7k+s8fm3VLnLa0/?= =?us-ascii?Q?76jxYI65xrxO+mhmXVLOng32dF4FgkWfSRg/K+nPtejRYYBNGz2TVDDozUWs?= =?us-ascii?Q?6OOQ3KNC8mp+xDcSWOzJQ2+K10+48YFhrh968ABB1UX+SG74jPlbIclLwPRE?= =?us-ascii?Q?i5YV/me4Cty5qVAfppgCEOlIbLzrszI47nzGhdJZgC8Glz3b//vI1tyyeV8A?= =?us-ascii?Q?oeCv7/g8mwrkvRj611ctb0VkET6ioBV20k/CM37QtRbb+asZukF0Z89QV9dI?= =?us-ascii?Q?Qnvmq09DpMCgXbzH4ElyBVusG0xRg5H7TiPkmLvJRPSnkSInk0VFa9aVrm4y?= =?us-ascii?Q?mJZ1iEsmr33QVfTGg3Ytv7mj1JLyDWTEsqVBfJhQbhcn3HGb6j2uOYMRxaKP?= =?us-ascii?Q?vU6FjTKJ7LuyRPHlMCxw74E1/p9TEWSezImETWcv38PY5tFu2+zv+5lMq446?= =?us-ascii?Q?HukyLKIg+eWqEa3h5WT2DY+9JikVMGvSePtnVHknpK3V9sYjBMcdloWmtOsX?= =?us-ascii?Q?W/wenklNQo47788R2i3uSWNz?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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: b207a487-5251-4f2e-4ae4-08d95d48804e X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Aug 2021 04:20:22.0014 (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: ux4CzuBBLDsOzDloJBg5+CpHiR1K0e48iJ7RZ0Msrl+wm89Mia/TIkTLYcHfhAz2UxI0aJOBwquspQB6c+JW/w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5383 X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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 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, 12 Aug 2021 04:20:33 -0000 [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. */=20 + 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. =20 + */ 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= =20 + !=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= =20 + !=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 ?=20 + (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 ?= =20 + 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