From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2048.outbound.protection.outlook.com [40.107.101.48]) by sourceware.org (Postfix) with ESMTPS id 4FB863858400 for ; Thu, 26 Aug 2021 04:17:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4FB863858400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TW5Um9QAZT2GtNiwi3vV7EJ06uOMCiKCRT+xYz0vHrG87K68IGWYZorHhAwe1uhXuqDYPlMEK+jhcZm3UL1s4ifqpiMYQ3rqF3Ebf2KtJ0OReRCWov6Fs4oGJuqbh0dhoMEkRB9WFRvh5t/r/hp0s7CYY4Uq1Kfm8wJgJV2iw4IBXa51rq/KMGfa3SYMyJLJqq7FwsJjEO0HhYZl4uHFg13tPYXpwgwsA9VvCPvC9OI9AFJyVvuerF6MNTAOUrLbWFKvjFqtN2JEhou3F73PJDdr6qBGxLuAErf4fVoWR/8NmbBzkhrUf3Hqxcj7pbZfcAmZaoSh9vu/egiMBb6a9Q== 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=iNsnap9Gz5nXuAe7qoLlBeusV+v49RovPqejrt3xS3E=; b=HtukaCCyBLOEGEYjkU4xd4lXuTDZvoUs4hhaCIVS3YdvHmgrO6vYdjc183HeJk4fU2wW5B1SoppmdM8xSg1IVCoMooeJvo5vFUyBJL6l7CkKZA1gb1CCzvjfZ06HjyRFUcpVBCiUdMLXEyfMOmdjQxAJ5pwlu2JBLVsUjqHb6dhpPMS+CUEq3gpBPp66tKXIlUfTTB9Yn0JOj4byv3odq1C+80D6huXSyn1oKR31WsZJzIc5CsqwxxomERzXulERNZxCmfUaOXBzvf8hevPMooC/ZSlH8NuECD3LjB/a6Okdib7UlgqWmS4dQ/6SDN3Dw7ED51ET4jWFlARIsWHAZQ== 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 BN9PR12MB5099.namprd12.prod.outlook.com (2603:10b6:408:118::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Thu, 26 Aug 2021 04:17:15 +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.4457.019; Thu, 26 Aug 2021 04:17:14 +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/8EHA Date: Thu, 26 Aug 2021 04:17:14 +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_SetDate=2021-08-26T04:17:08Z; 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: a8d0e84a-6b7c-4933-8ebf-08d96848628c x-ms-traffictypediagnostic: BN9PR12MB5099: 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: nrLfCAfAcRf3SfIC2ielI/CvtcC1BywW3ZIaoJL2IFYkr7LUmgyqr2SoNglGvPin7EnOQkvHVhqkbOj1JkrXSG5+5QXTFPAiD/grXOrlPZDDEotNV805Hb9sSXL9V1r477/uv7lxbjzAzsKaSP7T6F89Ax9Lq2RZbxkwfkjKYQab8A7qHcXs3J1snDc5FdRPCumMDjvO/nfzrHmX4Sgj9uXWrvZpQkK+AY2eeoXyKvyxsFmczNWoSDSGLJv42gAqoenszDppWUwvACi2nu+2uwfd1r4/k8TYHvGxhHr6um4ILeYmX+wcRqHI5Z/jBIbrnOgF0JKZXSPOh5eeAAejhCnOQvk1bV8AU+67uLcYSDxZFy65LFw8qu952ZAEk266uw+prfENmAkRhX/veDWsrrRNUHf8HRYNugcgFiNd79AVOekbL/bpUPOGYkO2n16/WaAiTJba8rdvSrWuvNCvj+KeCJoSOP4WnWXY04O50pJKiphn9ckp9hnELPig1IgDBumexV91cUYnTV2R4xasgzTg19WvPNvk6XGjV2sLt/QjCEPPEp4KnZOwp12WHrl8ORBuqDROqxUcBm/Dgelh9i3qdmmsrQd4sdxFgjoPl3TEVDjAVpotK24iWz0uWhd44KAHp22rGJOkqFjfPGsDRNLKK8KrEGA2ss/ihNfElZOwZwJmu/Tmcctkb/sccCf812benLAv5SMW6EKZlMUV6g== 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)(346002)(136003)(366004)(39860400002)(376002)(4326008)(26005)(30864003)(71200400001)(8676002)(53546011)(186003)(55016002)(9686003)(478600001)(7696005)(6506007)(66946007)(76116006)(38070700005)(38100700002)(5660300002)(55236004)(83380400001)(86362001)(2906002)(122000001)(316002)(33656002)(66476007)(66446008)(66556008)(110136005)(8936002)(52536014)(64756008); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?/IJHdGaFaLPVaR8h+XO/tn/rq2sj011R5YZizXz9Rx9ltNgmC9Qa/ubFXssr?= =?us-ascii?Q?s+VqwoSQgD6gntDNsmq08rQXPOcYKq9uJLWrR02e4FwmsvV7udB2/Adqs7XF?= =?us-ascii?Q?NhbeIg/dRSNEUlxxaRG0yPyURFy0Y0bLvBbTgHtNLboPx7+PYBO7c4eG90qa?= =?us-ascii?Q?XOyxtz43nPq4eIp7YrcSty+lVNSClW5MV1pu+6c+gMCOXybxldKS+1sQauoH?= =?us-ascii?Q?o1MJmrbvinU0oeSTcxfqLrTdnH2xNiL9xf5j5f2zhHW9qrSisbKUxLXeNYa5?= =?us-ascii?Q?8SKnZ3KvwOywofckYhEYjOMgl7S/C4tQZooNR3o1lVrK49T+N/elNMuck11y?= =?us-ascii?Q?Vsx9UEC5uHYiTsc0hk5dspu2BZCs71Cp9f/gKrXLGTJElfOtwoja/vvo7nXz?= =?us-ascii?Q?muazJZp3om0Ohamdn84X3cKRbjEeK6eoOr2KlaiRo0sPGZMjUxZXooMGEqmn?= =?us-ascii?Q?H79haGJaDEnnGSWouSXSdB1wGWXrB//BOSk52ca5YulLZgfSgS83J0+p9gGD?= =?us-ascii?Q?//1qyrXBYxwZvXGKKluLH6VMCf2z1uktrY2dZBTWuEQhhGP2hjdfh1MIptFk?= =?us-ascii?Q?NrUruHqoe2uMJrvk4l1813b5JxGWHgVwaZMTqC58Ma5WLd3RrtrMg/TjZoRr?= =?us-ascii?Q?wgwORc5xQVB9ddQsbeehtps39av798uR78Hw4a6A2OT7SJGGINgm/IYpy5Td?= =?us-ascii?Q?3ijqitf9gPgCGY3PLjv0dLYIJm7p/OCCEZ5ppviAETh5a5BQw5Pt3zFH0V7/?= =?us-ascii?Q?34telhf6/kTKAi6t0zZqQnjEaPP0yhQx+dakfOeD+jNrk6YUX9mL8oqAsp2d?= =?us-ascii?Q?Z9Y2wzbQZulVtfEZJ7OBKLJDcMecvTdGeueKVhAUvfYrJDUUZGEE9UIDGg3z?= =?us-ascii?Q?KZzK2FRuF0UzgYqm1DJLt3GriasMLz0g9CUSp5OL3xMbauBGfk7MniURufWp?= =?us-ascii?Q?UAvskKLlbHyoDZRSERdEdo8DKlvqeZeG6GEFQEK9sT2gEsZDFjwUijvLukLH?= =?us-ascii?Q?aHOZZnn2l5CNIVQlnhN5X4TLCTLmQp0P8l9jK7nk9Fuj4WJ6hcDp9xQ83Pv/?= =?us-ascii?Q?h4zPDSXnww2goOrWvPOsCqK0vR5nl8GMoPMQ37MS8zFmrsQ1nh/0pwOOe6iv?= =?us-ascii?Q?XrAosvqk5RdEdxCpuPJq8GHBpYGncKEtKBc8KxuZ+AfvEo3mcZCoYfLV2U0t?= =?us-ascii?Q?C2rRj27DYaz+IbXBuJfcQ/b9wz0D51Apl1sergaoy4k6w2Nada3MdpsYjKov?= =?us-ascii?Q?JEWMAn73Di5EcBFMQNPK3ba6EkFQw4gkUpCxmghC2FdhVI8pafFOmKct/l3u?= =?us-ascii?Q?rrE=3D?= 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: a8d0e84a-6b7c-4933-8ebf-08d96848628c X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Aug 2021 04:17:14.8146 (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: 6Z5F/sINhO1BffOPQ+ADXpxVi0Zle9WpV4ephRbTpanNQqo+LDeNQV5OAOHezevIQ76mpeRTKFl8JFWkSkgSeg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5099 X-Spam-Status: No, score=-3.6 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_PASS, TXREP, T_SPF_HELO_TEMPERROR 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, 26 Aug 2021 04:17:27 -0000 [AMD Official Use Only] A gentle reminder. Regards Nitika -----Original Message----- From: Achra, Nitika=20 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. */=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