From patchwork Thu May 2 17:11:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Faust X-Patchwork-Id: 1930746 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2023-11-20 header.b=fxmRLJHL; dkim=pass (1024-bit key; unprotected) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-oracle-onmicrosoft-com header.b=LtgweA5f; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VVgQj41Q0z20fb for ; Fri, 3 May 2024 03:09:32 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1BC083849AC9 for ; Thu, 2 May 2024 17:09:30 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 6BC2B3858408 for ; Thu, 2 May 2024 17:09:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6BC2B3858408 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6BC2B3858408 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1714669742; cv=pass; b=lP3uAqeXH8xMzUGgZSk2z0ptVa5zvnvRTByf8gRwLyCCOu33skYj3riATv7mVZtR1tgU6IPyR5pi7TIzJpYBGmGU1sjCSwL7iUC+LgbZ0ysfQTaTGg/50aXHJ+018KRFtXVy+RiRUV/+tX6+EbJG0S+gdW8z+ssAR+ZMiegbM88= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1714669742; c=relaxed/simple; bh=LzQp9etUaKyJEnTgLkb5IkyPUBpW+LFECdI5VULUBXg=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=nX0JGD0r0qi7K81jcZpa4i0M9DH9OJOJlRQ5ZmN0FhWaenoPncUlMeqxO16fmewxcixihYIXioSnurTV1Fz4xJZ5LEs3N3jp/RZc8ujxo0UQZXGliHHxol18psQVRLVcdAVJ47abMKkVBaV8wE/OPBxgVQs/or0DR5kh1H6UbpA= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 442FiRxH027557 for ; Thu, 2 May 2024 17:08:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=bQpMtIlY/nOoQNUYf7CJq+Z5dTvr2I+jQMvflhhpcvQ=; b=fxmRLJHL9SHFV7rwc/2GOdf3FiOw3rX1CARS8G2UxO8RtfHD3tJyTQI5uAR05IA6suEg 9oO2P637EUfJxBibJXaC8QkuMdwIWS/KRFFwu8ZTn7TztB1ZNO7XlNHiOTU3VNGXg55p 37Y4A0ZzyjhptttsmYjdLcoIqAOKmFugj/Aq4lQFWoPzxYkkTZTTA+LlKM35Ed03TOP1 cI0sggXIuM42+0AoygdeZ7RLEsRVmWtclBOyZG+x9L4olMlyEYYbRHfG9VDEf2plT8Zj OsYiG/G3HwzlqBSMTmk4e8V7sbKb9GmJlIFOgVCSt3SM0AkN6i8HKH8zVQbDjvX4vm7Z 4Q== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xrqy36t2m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 02 May 2024 17:08:59 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 442FeNck008839 for ; Thu, 2 May 2024 17:08:57 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2168.outbound.protection.outlook.com [104.47.73.168]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3xu4c2gv7j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 02 May 2024 17:08:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RJCTLmAmwaaeDCuP6p6/a3ai49yP0COY9lteXamKesGi9m48+IMX/upDDlTEsG6rBCLxOyDGzTTJLRdPk5UTuO7g1MmEx6aGdTCEX1CmSMSaee/fbBe5KR9QWnmv75Pw+hZh+cphNKhJKD5vqX3wj/NmJloQNw4C6jMexGOyx67cBKWOKejajirPTKdvkY6mizK9uOVWTWWitT76FQe82Qorq5TmOif0oP9ov1WVXzovozGU2np2TNjtLRwFJczrdXBGL7L3gTIc4+khGU/PyTmSOaI+ogz9razZ5by4Q+epOH8SljT8mVIxnX9brakHQ6SmR32a64w+G9d+OsSoMQ== 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=bQpMtIlY/nOoQNUYf7CJq+Z5dTvr2I+jQMvflhhpcvQ=; b=ThXBV1h93n0YIv93hWUnwRFs/pvZeIxQb4vhzUl1GpaSyP93iXRn7GWM3hFX3wVl2y1s/GEGxUKl2ON93vjexKV0y+ELfeLUqjwnY3QniV2l1slE0bRLM+9Njns6qMpwu4WySSnHCYaOO4SdH5bJJxhwPLMQcW38lF0S3FO4+PqQtiMRnXGdjESehYJQTwXsdsD0mpaIlQCgPnTJuHRXuctTcfswwEWfnP/Ia8Ljlk6OFJVngQy3iYb8lVvnw5nKbRNAWYOASrycrgT90zOudDF34QvHedtXzp3kvTibH99qbW3n2BHf9YNEhgY7pBQ7vnwiJj0eHC3BBtJPRZ9u3g== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bQpMtIlY/nOoQNUYf7CJq+Z5dTvr2I+jQMvflhhpcvQ=; b=LtgweA5fLHYOtX/adDa4XyXLFsmS7G2Kd5sA1GSOamhKCyKs9G4i/ZVwX3n36ka3/Gyv8mNQ9HgdV5c2ouk6EtEF0AdJwrz9EPcfRnJd5vfEZE7zm/usbuonRBErJZl8TNP805cLhJLwRYfPv+gFx1REyhrA+D5gA8aJjRolPu0= Received: from DS0PR10MB7953.namprd10.prod.outlook.com (2603:10b6:8:1a1::22) by CYXPR10MB7898.namprd10.prod.outlook.com (2603:10b6:930:dd::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.30; Thu, 2 May 2024 17:08:55 +0000 Received: from DS0PR10MB7953.namprd10.prod.outlook.com ([fe80::ddec:934d:1117:499d]) by DS0PR10MB7953.namprd10.prod.outlook.com ([fe80::ddec:934d:1117:499d%3]) with mapi id 15.20.7544.029; Thu, 2 May 2024 17:08:55 +0000 From: David Faust To: gcc-patches@gcc.gnu.org Cc: indu.bhagat@oracle.com, jose.marchesi@oracle.com, cupertino.miranda@oracle.com Subject: [PATCH v2 1/6] ctf, btf: restructure CTF/BTF emission Date: Thu, 2 May 2024 10:11:26 -0700 Message-ID: <20240502171132.95601-2-david.faust@oracle.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240502171132.95601-1-david.faust@oracle.com> References: <20240502171132.95601-1-david.faust@oracle.com> X-ClientProxiedBy: BY3PR04CA0021.namprd04.prod.outlook.com (2603:10b6:a03:217::26) To DS0PR10MB7953.namprd10.prod.outlook.com (2603:10b6:8:1a1::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR10MB7953:EE_|CYXPR10MB7898:EE_ X-MS-Office365-Filtering-Correlation-Id: d361aafc-f44b-472c-fe3a-08dc6aca8c43 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|1800799015|376005; X-Microsoft-Antispam-Message-Info: +OdQndsfywj62V5eLhPzDZpUKsHqg8zYt2/IrM31QJsUdjZ00LYVUkao3pvkwcKkcq3A5+Hp7PX2trPmxNiYD0SxrHYfZn+RunuxoD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DfF/7avpbU9x96jqtRtlSgPhSpWz5esktR+NVosmT0Rs6/otNfthfIoutXTVTtRR2wAnbwNyW1PkivcIhM/5Q+RAa7Etru4WIdION4ciHz7TmYFaEu59AMK13EopJ5tZ2mAMw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR10MB7953.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pLLjTsqu6ii6mG2QHe/cqK7n2w+CNAcHj7sexdbF8tW+Ypda+eShT1LDZKwgJxpWFv1TyVTSs0A8gFuofFwffSIIeQeqFjXMBh/SvjqIBDghf/IMCuQ2E3j3PGDX9jVymKuZbjEEG16Vpf0BTh46vbVtUuCvKqw70PyPQw69FcBgCZa5GxGVstVyPgo7qCj8gnRsksf0+77t8BBp/1kVybP/YhR+ghrbDVIpuEok9ASnCMVICoRlQREYQpUcUQLY6S7AomfjqX7mJJznQSzv4KAShva4Lr68gxq2tQMxuMXqfB5l74t9uLkzVzpkjifgpZBcfspEkcMW41/XWvkBw7RuLPQivQTuXlJlLU+U3c9pcIVI1L2PTN3+q4S1ikX18uG7kAmrZb84ozw58XMPTOCv19wxe3o6VzVcpa63inDfqkZpVI+vODdjbgOP+mb/CkCRQ4LLGozE9jDXlqti0UUoicj/Sz4mwsxos9uh1tg47cQFu08nvgyWaydRp6VlWVcE/cK1tF6JimZDD1yFueT4zUeccKvzHl8dUfRNNXKoXNwJez+18N7Rmds66EFOvZrZFfisXAn6rHHHqFAfFXOnqKwbjP0c4yrNjLe7HukzmgYhLy8Rrac4d2jP8elJimJP3msi/7r5vItfLFunjKQIivHfMBggcR5hYuCDipqz/X3K8GHtUh44wXhkk88JXMvqTVE1rz1sanXSdeC+ydaziocugPYmaG2hYZP1O10y6GnMDIy8OxJ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CHoSAWqLh45w7isu8ectDVKjt91E8wv0+YPBTpTtP1KpiOh0SQ55qJPS7DrLg3FOjMYsCLvGnqH4VtPT2J2/pYWYUKR/6kg2aO4n5H2gUo/NXW8kd7oIDGd6AJQViiK0l+b8MTvKJfcj4CtHAjC5PciZcZ09JMMU9/leIWVExEwKpb0sj9l38U9JISH1FkVbrc5Quv17t2FDneLeXX/x8Ka/D2XZEvk+1niMgwB7bvXvvd93zP0rrhI6c1yWdiF+TDqNhWupHSVUw2qLFZOO4/YrMh5qitgP6lluSn74IRgFDPQLqipcrC7Ft3WqpG4u1Fb8XtJreCZwsq9qNmgDgjtK7mOTPhxvKQzjnyP5K4VUiZELTJIwFlPcy9Jo5vVoAUhFZocWGVL0zxA8ZvvJDmp0tL1v7i03Vh8rfOwDXJOhpZZ1j3Hyy7PELgJ+3e3PG+4UvoVkPiYyZztaDeP+LtX/TaWA76u7T/tpA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d361aafc-f44b-472c-fe3a-08dc6aca8c43 X-MS-Exchange-CrossTenant-AuthSource: DS0PR10MB7953.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 May 2024 17:08:55.0505 (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: Dxv16bFvTXoPqk2oTzs7Kbws7CMXirz3ovU0Cp6n006vziCPaX/L+Ioded/SbqGvpxZz2EBnq+PNb8OELOdlWA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYXPR10MB7898 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-02_08,2024-05-02_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 mlxscore=0 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2405020112 X-Proofpoint-ORIG-GUID: hLWYqYe-tKvcvaoJ23dQDUQg_yHjoRxm X-Proofpoint-GUID: hLWYqYe-tKvcvaoJ23dQDUQg_yHjoRxm X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org This commit makes some structural changes to the CTF/BTF debug info emission. In particular: a) CTF is new always fully generated and emitted before any BTF-related procedures are run. This means that BTF-related functions can change, even irreversibly, the shared in-memory representation used by the two formats without issue. b) BTF generation has fewer entry points, and is cleanly divided into early_finish and finish. c) BTF is now always emitted at finish (called from dwarf2out_finish), rather than being emitted at early_finish for targets other than BPF CO-RE. Note that this change alone does not alter the contents of BTF at all, regardless of whether it would have previously been emitted at early_finish or finish. The changes are transparent to both CTF and BTF emission. gcc/ * btfout.cc (btf_init_postprocess): Rename to... (btf_early_finish): ...this. (btf_output): Rename to... (btf_finish): ...this. * ctfc.h: Analogous changes. * dwarf2ctf.cc (ctf_debug_early_finish): Conditionally call btf_early_finish or ctf_finalize as appropriate. (ctf_debug_finish): Always call btf_finish here if generating BTF info. (ctf_debug_finalize, ctf_debug_init_postprocess): Delete. * dwarf2out.cc (dwarf2out_early_finish): Remove call to ctf_debug_init_postprocess. --- gcc/btfout.cc | 28 +++++++++++++++++++++++++ gcc/ctfc.h | 4 ++-- gcc/dwarf2ctf.cc | 54 +++++++++++------------------------------------- gcc/dwarf2out.cc | 2 -- 4 files changed, 42 insertions(+), 46 deletions(-) diff --git a/gcc/btfout.cc b/gcc/btfout.cc index 07f066a4706..1b6a9ed811f 100644 --- a/gcc/btfout.cc +++ b/gcc/btfout.cc @@ -1491,6 +1491,34 @@ btf_finalize (void) tu_ctfc = NULL; } +/* Initial entry point of BTF generation, called at early_finish () after + CTF information has possibly been output. Translate all CTF information + to BTF, and do any processing that must be done early, such as creating + BTF_KIND_FUNC records. */ + +void +btf_early_finish (void) +{ + btf_init_postprocess (); +} + +/* Late entry point for BTF generation, called from dwarf2out_finish (). + Complete and emit BTF information. */ + +void +btf_finish (const char * filename) +{ + btf_output (filename); + + /* If compiling for BPF with CO-RE info, we cannot deallocate until after + CO-RE information is created, which happens very late in BPF backend. + Therefore, the deallocation (i.e. btf_finalize ()) is delayed until + TARGET_ASM_FILE_END for BPF CO-RE. */ + if (!btf_with_core_debuginfo_p ()) + btf_finalize (); +} + + /* Traversal function for all BTF_KIND_FUNC type records. */ bool diff --git a/gcc/ctfc.h b/gcc/ctfc.h index fa188bf2f5a..e7bd93901cf 100644 --- a/gcc/ctfc.h +++ b/gcc/ctfc.h @@ -384,8 +384,8 @@ extern void ctf_init (void); extern void ctf_output (const char * filename); extern void ctf_finalize (void); -extern void btf_output (const char * filename); -extern void btf_init_postprocess (void); +extern void btf_early_finish (void); +extern void btf_finish (const char * filename); extern void btf_finalize (void); extern ctf_container_ref ctf_get_tu_ctfc (void); diff --git a/gcc/dwarf2ctf.cc b/gcc/dwarf2ctf.cc index dc59569fe56..ec94982e4b1 100644 --- a/gcc/dwarf2ctf.cc +++ b/gcc/dwarf2ctf.cc @@ -933,30 +933,6 @@ gen_ctf_type (ctf_container_ref ctfc, dw_die_ref die) return type_id; } -/* Prepare for output and write out the CTF debug information. */ - -static void -ctf_debug_finalize (const char *filename, bool btf) -{ - if (btf) - { - btf_output (filename); - /* btf_finalize when compiling BPF applciations gets deallocated by the - BPF target in bpf_file_end. */ - if (btf_debuginfo_p () && !btf_with_core_debuginfo_p ()) - btf_finalize (); - } - - else - { - /* Emit the collected CTF information. */ - ctf_output (filename); - - /* Reset the CTF state. */ - ctf_finalize (); - } -} - bool ctf_do_die (dw_die_ref die) { @@ -996,27 +972,21 @@ ctf_debug_init (void) add_name_attribute (ctf_unknown_die, "unknown"); } -/* Preprocess the CTF debug information after initialization. */ - -void -ctf_debug_init_postprocess (bool btf) -{ - /* Only BTF requires postprocessing right after init. */ - if (btf) - btf_init_postprocess (); -} - /* Early finish CTF/BTF debug info. */ void ctf_debug_early_finish (const char * filename) { - /* Emit CTF debug info early always. */ - if (ctf_debug_info_level > CTFINFO_LEVEL_NONE - /* Emit BTF debug info early if CO-RE relocations are not - required. */ - || (btf_debuginfo_p () && !btf_with_core_debuginfo_p ())) - ctf_debug_finalize (filename, btf_debuginfo_p ()); + /* Emit the collected CTF information. */ + if (ctf_debug_info_level > CTFINFO_LEVEL_NONE) + ctf_output (filename); + + if (btf_debuginfo_p ()) + /* If BTF will also be emitted, start translation to BTF. */ + btf_early_finish (); + else + /* Otherwise, done with the CTF container. */ + ctf_finalize (); } /* Finish CTF/BTF debug info emission. */ @@ -1027,8 +997,8 @@ ctf_debug_finish (const char * filename) /* Emit BTF debug info here when CO-RE relocations need to be generated. BTF with CO-RE relocations needs to be generated when CO-RE is in effect for the BPF target. */ - if (btf_debuginfo_p () && btf_with_core_debuginfo_p ()) - ctf_debug_finalize (filename, btf_debuginfo_p ()); + if (btf_debuginfo_p ()) + btf_finish (filename); } #include "gt-dwarf2ctf.h" diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index 1b0e8b5a5b2..1664934ccc3 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -33168,8 +33168,6 @@ dwarf2out_early_finish (const char *filename) ctf_debug_do_cu (comp_unit_die ()); for (limbo_die_node *node = limbo_die_list; node; node = node->next) ctf_debug_do_cu (node->die); - /* Post process the debug data in the CTF container if necessary. */ - ctf_debug_init_postprocess (btf_debuginfo_p ()); ctf_debug_early_finish (filename); }