From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from aserp2130.oracle.com (aserp2130.oracle.com [141.146.126.79]) by sourceware.org (Postfix) with ESMTPS id C83E13848407 for ; Thu, 29 Apr 2021 22:08:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C83E13848407 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13TM6xGG098444; Thu, 29 Apr 2021 22:08:59 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 385afq5yb0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 29 Apr 2021 22:08:58 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13TM7w7Y036020; Thu, 29 Apr 2021 22:08:58 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2105.outbound.protection.outlook.com [104.47.70.105]) by aserp3020.oracle.com with ESMTP id 384b5b1ue2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 29 Apr 2021 22:08:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mgjlJm5DajQ869aoaLDOCTaEYd/lnMYXSd42kb4Lu83p/sBUXyDLaGrmjPig2OU7KvmVU/dqsjURxNCU0S+OJ15+NqiyZemhBaktSJujnvBJoz2+mofrzj4gxD4evlDPPA29Pm6qJ+d8WBLfjR7rz4Kr22xSnu13q7lcLK863CPhzDMyB8YIKVoLgG6B2qtbm9PvnlRqT4++SahGTGuv7hTTB/wzDV7L08KON6pIxXLpo1RTYdc3T5LClTTbNXikR2M0PuRBg8MK9KnJ3fkfuAhkLlAqrjbAcPteQZRK/S0C+cfa4bxoufNQEVRurALe5lEeKFyVkdnT7dfKaHKzTw== 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=NwLqzcDUzntEIeYBkpkjTwtB8RnfLQ+nptyT7TjPQq8=; b=WR/y5izF66emSbS32tJ0utyjM52OHxRcY735VjEW1RtCu7CWH42eX8AO6MrlVaf6LMYA1qpudUNXAKh/xd19LVLCWNMorm1KWEhOPo1Ady65rBRphwzUtipBtomA/8Z3LqVIhSSKMSBESprd96zW57pyQntofLeHHyNiJNVwCIOKynt9irDoeCQuhsrNakcMn/Asjht2bJecHkIQXxU9r7kA0hehmHj/Mi+wQ6/920eCDO9cBpWCsCzFOoRm+rezyFkIDG91mZuFQuzUvS1yHWrrTlYeza5GkUqBzRljcq/qKBWrfC7TBJeVUlqfOogScoSeC8wB8yg9SQUsB9l0xA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.27; Thu, 29 Apr 2021 22:08:56 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::38f0:2cf9:7238:9ffa]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::38f0:2cf9:7238:9ffa%6]) with mapi id 15.20.4065.027; Thu, 29 Apr 2021 22:08:56 +0000 Subject: Re: [PATCH V7 4/7] CTF/BTF debug formats From: Indu Bhagat To: Richard Biener , gcc-patches@gcc.gnu.org References: Message-ID: <046f7827-6b92-ddea-c189-91682d5092ef@oracle.com> Date: Thu, 29 Apr 2021 15:08:51 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [2606:b400:8004:44::16] X-ClientProxiedBy: SA0PR11CA0094.namprd11.prod.outlook.com (2603:10b6:806:d1::9) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [IPv6:2606:b400:2001:91:8000::5d4] (2606:b400:8004:44::16) by SA0PR11CA0094.namprd11.prod.outlook.com (2603:10b6:806:d1::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.27 via Frontend Transport; Thu, 29 Apr 2021 22:08:54 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e09f23d7-3acb-4250-3abf-08d90b5b61a2 X-MS-TrafficTypeDiagnostic: MWHPR1001MB2365: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nOa3KlOZfj3BftDL71TR32DdkBkI/FH1zWUxu6dXUvpg6wNep6mS2ZJQGYzcU9fSMbFmj5EPtZ5YNGspqRY0Yibf2y0JImPgKWvmIxUiN180MGHfrrDiqSu/X4RKpMf4+x4kZQSu0vKNqzzxvxIdmuq7Jgy0xvX7LAIPkqKy8VAXTVy36NhGGFKWbe12LfXVdzQKUNYaHXjgtNwZQHEVyxfB6VMr3mUTAsz6XgpfD62Rtqv2A49CsMFpoIspidraNH2z2gjgPjlq0tnUJcM1imR3Q29zLxKmf9rDs/fniD/Vsgr/IlW/AWE9Qt/X6QshYnh3LO6Pli5kvlL0zgrnEeXD4YCVvR1xHSK231CmMEtdfYJ0TJGXn40n4cV8xRHPDPvBaSZ+XOAszH3yrJv4/4RLz3qpWdb/3DL2ha1u0g7y4s1dqIl+ex1CHk4Xn77XUtjynNWP3Hohn646EH/bZIfFwxcExu3SQEGd8RUKDDNp2cYUUIQbJ4LfSHO6W/Ws5VeGquiD63j/xZiczuz0DBc3ZOz8BAWGp3Mnp9604X2UhI+1yXmlJYJ8Yokv/T/KgP98XS+XPLV+kCYsMVQ5oGTRXgGtGKjrNaJCzQyLG/T3pGthXj6ZNHM6065zbeXK7FQG/7pQO6K2mPJN1zQfg8xhrLjq19KcSmvYWdhBoLad31eSJMpEgkKwDLy9QSCN X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2158.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(346002)(39860400002)(366004)(376002)(396003)(136003)(53546011)(83380400001)(8936002)(2906002)(478600001)(31696002)(316002)(8676002)(16526019)(186003)(38100700002)(6486002)(66476007)(66946007)(2616005)(44832011)(86362001)(31686004)(5660300002)(36756003)(6666004)(66556008)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?NWpnOHNsamMzSGdLc1YyZEYvb3VqUXpKUFNsZysyQStSbnp1MG9FWlJyYjkz?= =?utf-8?B?MlBSWkhOelE0U0lYUTJPWnRUekhGS0VPd0J0Y2kvOW9hbTluazV3MHhTSHpp?= =?utf-8?B?L2ZETVl2bzVwSDRiMXdkOExGcTJhVkRZdyszeWlQY0phTjdwOVcwckQyVlBW?= =?utf-8?B?c21JU1U3V3QrMm9TRVhWT085UytRbXg2bVhEMlRxMjNrR3FEcXBmdlkvdno3?= =?utf-8?B?ZlBRT05hU0R0OTA2QmFibHllcHk2anJZbWFVcjVlaXZtQVVaeDF5cG5pcXFh?= =?utf-8?B?V1dOclF2YTRSTmgzUXFkQ0Jnb1J4andOa3ZoeVFDK3hNVmtYM2xyVlJ4TCs3?= =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hrRmVBb2lnSkN4eVNF?= =?utf-8?B?QWNaYjMyaFMxLzVkb1h3WitHQlBGTG5VclZaZGZ2cS9iMlpXakFMT1NvQkVn?= =?utf-8?B?TkZUZUd0Y21DQWNNNmlORXlQc2dnOWlueGlidFIvQXB3YUZkQXhDdStTU2Vz?= =?utf-8?B?WUxseU1ZcW5QN2RhUEYwd1hxQWtiZjV4RlVMckMyQnJMN25QYklUcVNpMzVz?= =?utf-8?B?MlUxWG1vMUxzeUtySlFJeXVZa21veFBrVGhkSDhndkdqLzNGSElFVGUvblJK?= =?utf-8?B?NnIzM2FlRStnKysyUDg5eWRzMmkvMHZ6aFVLd2RaeE1EVWR4NnorK2VkaDJy?= =?utf-8?B?Yk14UzY5Vmk3WnYyenp6UFp0Yy82WnRWOTQ4MC9UQkJMUjRiazV2Zlh4Zmdx?= =?utf-8?B?aTdxNFRzeXg5UGRzd0hzdTNhRDV2ZVNrM2N2V0IzbTR2eFBXV1JJZVhUSk13?= =?utf-8?B?YndoTy9HMFVOVk8wV0U1eldTbzdGZW5zc0p4TjFxUXhyMnBabHE4K1ZKWUg0?= =?utf-8?B?TFcwL2w4bEpUc01mV0VSektMM2Npc2VCSUx6dXdCSlYzbXU3NmxOckNmWVYz?= =?utf-8?B?SFNXMVQ1ZkpudkNyejVWZz09?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e09f23d7-3acb-4250-3abf-08d90b5b61a2 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2021 22:08:56.0895 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: v4nM0Z6tWXygXzpd7VX8vkd0w9nDOAVwmsOlXNndCKmI7M8f+Lb9ROZscRIVY0imHJXMlsnpiF33kYl7ZevaWA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1001MB2365 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9969 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 mlxscore=0 malwarescore=0 phishscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104290139 X-Proofpoint-ORIG-GUID: 2Vt1Z2hOtMjCRrhCmnW5D-llqDVr0t33 X-Proofpoint-GUID: 2Vt1Z2hOtMjCRrhCmnW5D-llqDVr0t33 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9969 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 phishscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 malwarescore=0 impostorscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104290139 X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, MSGID_FROM_MTA_HEADER, NICE_REPLY_A, SPF_HELO_PASS, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Apr 2021 22:09:03 -0000 On 4/29/21 1:02 PM, Indu Bhagat wrote: > >>> +{ >>> +  dw_die_ref c; >>> + >>> +  if (!ctf_do_die (die)) >>> +    return; >>> + >>> +  FOR_EACH_CHILD (die, c, ctf_do_die (c)); >>> +} >>> + >>>   /* Perform any cleanups needed after the early debug generation pass >>>      has run.  */ >>> @@ -32471,6 +32491,16 @@ dwarf2out_early_finish (const char *filename) >>>         print_die (comp_unit_die (), dump_file); >>>       } >>> +  /* Generate CTF debug info.  */ >>> +  if ((ctf_debug_info_level > CTFINFO_LEVEL_NONE >>> +       || btf_debug_info_level > BTFINFO_LEVEL_NONE) && lang_GNU_C ()) >>> +    { >>> +      ctf_debug_init (); >>> +      debug_format_do_cu (comp_unit_die ()); >>> +      for (limbo_die_node *node = limbo_die_list; node; node = >>> node->next) >>> +    debug_format_do_cu (node->die); >>> +    } >>> + >> >> Since you have support to copy .ctf sections for LTO you have to write >> those here.  And you have to care for fat LTO objects which for dwarf >> results in two sets of .debug_info - I suppose for CTF you can share >> the section for the fat and the LTO part though?  So why are you >> writing the CFT debug in dwarf2out_finish now? > > The change to writing CTF/BTF debug information in dwarf2out_finish > instead of dwarf2out_early_finish, at this time, was driven by the needs > of BTF. A BTF section has entries of kind BTF_KIND_DATASEC which > essentially give information about which section a variable is in (.bss, > .rodata, .text). This information is available later on in the > compilation process and hence, BTF needed a longer lifetime of the CTF > container to update the information in the CTF container. In general, > keeping any future needs that may come up, it seemed like a better > design point to defer the ctf_debug_finalize to dwarf2out_finish > (assuming we work out it out with LTO). Umm..what I wrote wrt BTF was incorrect. The larger lifetime of CTF container is currently needed specifically for the BPF CO-RE relocations. They will be generated in the BPF backend, but only at 'expand' time, which is much later than when dwarf2out_early_finish happens. Strictly speaking, for BTF only (without BPF CO-RE support, which will go in .BTF.ext) it is not necessary. > > Can you elaborate on what it means to say "we have two sets of > .debug_info for fat LTO objects" ? > > I am also lost a bit by the comment on "share the section for the fat > and LTO part though". If it helps, from what I can reason, I can add > that I do not see how in LTO mode, the CTF of a compilation unit will > shift at all between the compile phase and the LTO phase. This should be > true for CTF V3 atleast. But for V4, this may not be true... > > For a moment, for the sake of this question, if we establish that > CTF/BTF generation always feeds off DWARF DIEs (so there is no need to > access type/decl tree nodes), what will it take to keep LTO support > while keeping ctf_debug_finalize in dwarf2out_finish ?