From patchwork Tue Feb 27 19:04:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cupertino Miranda X-Patchwork-Id: 86472 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9961F3858286 for ; Tue, 27 Feb 2024 19:05:40 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 97D8D3858C54 for ; Tue, 27 Feb 2024 19:04:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 97D8D3858C54 Authentication-Results: sourceware.org; dmarc=pass (p=none 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 97D8D3858C54 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1709060698; cv=pass; b=XfVv9WXWQhpoL+IOneZ/kL/goQ73uIuXwkinIvkXft7+85QJ8AF+ZYSPuTORycNB6TZnHMG6x0M+ri/YfPD3n4mmzbWXEyN9t+lPQQbjobKd9prXtgcpMrPpsNPJTXu3lTnWTVOcXCCLGyeYKmV7p31oMw3CiaX8Ou9iYGmzUnI= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1709060698; c=relaxed/simple; bh=rWZGAz2IKVzR+3TEmeOqPMTeoGKFKbixXXYTtvkwyoc=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-Id: MIME-Version; b=YC4k0pTW483OV/5g+eU+UDAf+EXaioPKEWQKh+72JgHlxt/Hw+pucPdMdLCVDff5p5q4ecU8AJLzBDHskN4vbSI0MNqWhElP3QlLq8HWtDZoWb30rZk0trnVRUdZauXRkETU0FPSXNl920eUO1XNhGkqTpeN8DVCqC1Jy7ic7sM= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41RFXsb6022493 for ; Tue, 27 Feb 2024 19:04:56 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=c8ua++/qof35FygHIWZaI1t460PEsuA5g/MXbayYdR0=; b=Jfcp1uG7Tyea691cb9dyatwde/pn4UYuK3sstwPD543clLl9M2T5bKrbEVDsoQi6PpdZ ndvZOkhgkBtpbs6klxcNY3Kq0Fd0SXMuqFNc/rKsdEvt+ZgTo43/06ELrFJ61yFXrUUE 6/YkaX+Xtyc4ogG2+4fkIqe4Mr5bWqDuqYnhDfZ/4sy25fa4H7aRQAoPuIBsV4Z2n8bu qlVmg34GrU6QycCQvEmfbe1r2mq5IGug9aloZopavpx+8GOUT7eNkujkwaNi7qv8xTeJ aNscEQi3bXceF9kIMR+3kDs2aLkIaqRiu0lDIOaVeFq17RxT2lvS6aruYNg63GfcVXv9 aA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wf784g9u4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 27 Feb 2024 19:04:55 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41RIxaSb001694 for ; Tue, 27 Feb 2024 19:04:54 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2100.outbound.protection.outlook.com [104.47.55.100]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wf6w7qhqw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 27 Feb 2024 19:04:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=atUrR3bShjVlz5idhxEf7eQ3nnO+Q5by8itl8ZLPM/TA9thpMH2ldA3CRfBPF3vXlN5K9pRA5EsoclNvzFG0EtGG4WNTOQDlMOpF+mCDBhtnBCKKYALBIBVUDLkgzO6A8E09sBiVbhIOej02y+x0gVNbJkBoetp00DMNDnyXOanxOELnyPV+4Q82IpL8EMyrUSW5V986EpV0zcX7Y/z5a/uqHbEKyH8pbg99DiHQWF6xH+N3HzzNHsK6Lj6O1M1c+Z1evoIMfcQ/6w0CvPN7teplAW3oxpBPjdHDHGtl17TuL2QAj9AVHAnjLmjnv40kfCP31u23oIQyUkUjhOzNNw== 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=c8ua++/qof35FygHIWZaI1t460PEsuA5g/MXbayYdR0=; b=BvIgmGv3nvGrB/dwQq1uJXJCJJv3uf0Da+2s3zkTi9DNc0NPsK6C4ossXcllnQR+o0JudgEk9vD11bZDD6taBokyfc0Zpp8CKcVSV+FOgiHH9Myg0eC7llp7O4Y4r27dCnNgraLEgO3lhZVweMYVAGRAkDyC+5IBPCSPBJaDzSI8FIxYU2+DnOcyJSmyMprtsM74a/Brj9YPiUTFD+znCpOahdVPdi/ntzqGExDL6GnZmIIwy8cjaqGeYsFCnlUVerSqrHo2KJMPiJZD9VxqA3J+J2zOUlpEQpyJX0FTzpoNcoUvXyWmuvuatwjNAbMTKqalnnj56cqa3b5KcIHUIQ== 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=c8ua++/qof35FygHIWZaI1t460PEsuA5g/MXbayYdR0=; b=S0FfsDpLCOK0JJ9zrvqVPuBCLNIgi0YSHkqu5vjrETjhmmf5lAUO8w/kJwTxx7yXJ5IWzhJ39Qor3vNYMzyb0cKFEBIIGXW7vb7R/C3UIRhikprrhbGSswh6bZ1ageCeObOFWBge7bp/QbRrYpkt7nAt7dM4RsW2MYI7XTz+cWQ= Received: from MN2PR10MB4382.namprd10.prod.outlook.com (2603:10b6:208:1d7::13) by SJ0PR10MB4416.namprd10.prod.outlook.com (2603:10b6:a03:2ae::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.36; Tue, 27 Feb 2024 19:04:52 +0000 Received: from MN2PR10MB4382.namprd10.prod.outlook.com ([fe80::8aee:c094:84e2:9401]) by MN2PR10MB4382.namprd10.prod.outlook.com ([fe80::8aee:c094:84e2:9401%4]) with mapi id 15.20.7316.037; Tue, 27 Feb 2024 19:04:52 +0000 From: Cupertino Miranda To: gcc-patches@gcc.gnu.org Cc: jose.marchesi@oracle.com, david.faust@oracle.com, elena.zannoni@oracle.com, indu.bhagat@oracle.com, Cupertino Miranda Subject: [PATCH v2 3/5] bpf: Always emit .BTF.ext section if generating BTF Date: Tue, 27 Feb 2024 19:04:33 +0000 Message-Id: <20240227190435.35750-4-cupertino.miranda@oracle.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240227190435.35750-1-cupertino.miranda@oracle.com> References: <20240227190435.35750-1-cupertino.miranda@oracle.com> X-ClientProxiedBy: LO4P123CA0104.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:191::19) To MN2PR10MB4382.namprd10.prod.outlook.com (2603:10b6:208:1d7::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR10MB4382:EE_|SJ0PR10MB4416:EE_ X-MS-Office365-Filtering-Correlation-Id: 0bd19eae-e1e1-48bc-5eb4-08dc37c6fa20 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M/j4DRCFAsvsOGzCchDBgiGTBXzdir/M5S1iEn3fKXBg8MbQk4lWCD7pIw5f0dXdQGRBbqycUv8TOhqDVP3wJxs0xPkntqhxSe7WgeCNW/TZAbiC6zSeuQNvoWG+DFzGWviBJi/VrfB8qand055vykzekrwCc5UW6YTIDzIjjVoCsJJr7SEjGApDEN56bP43g+rLxQ/r/8x7e+d8tsiRa7wttuQDbKm2cAyXNcy61kwe3spSD1qeAAm/AmzL96PIVwr2wFTMH0S4lkDhejyyo+yf7FAON6MIZXuhBl24AR/S/6D3EMKmM4aFmRFsQOVslHUVzxuZ0pcMOhHsBmtWKEzfjYX4zRPW6L/SMIZKceRRzm/ysLZRpOzBbhEv4mnOfbzmlHi7qwQAev8gh6C2cyh8fIvFPEG39G9Dv8Hag4uWvv6HNIJWukCjYPZgRCRi5EZ6WG0c/wavwQY5N2zQorWsYvxcgX3W+u9LPV5G2JyCgtnLhHtyCD+sU/fbmfablyeDtVwRdRCKnjduZcQLNFXmw8xF0dEzqanLcQ3X3SgXvVVslQUgwQmjEozPwQxxaq1wgizOOYue5N7Pv3gT6jnNqsImZ+aD8yoEqyFTIIHtSilnq1LJ5bw+laeIj7Py X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR10MB4382.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HUc380B/LYvxZpKlDRycZ/cKaAilpNRTcm6Wh9hv72Zv43fH/mkQjO8g+Kpne7xLv/Igm+TPR30caSsC5uYvzF6FJqwXkloxzSY90iKAHvjPZ7zD1meXrhakYKT3UPdhYpDTJ5ieebzqu065mDvl94m+DL5lcyWxhafzisKRo2taW2R59EU+lODMAEI1MZ2pn98vJnRDJYjSZ/7rUdONk/mqM3QWYPhwvX83yJcM20XPCp1vSLIbLcEZbcZxE/tlEgoR4wHxwRKKVYaxI0mqN+QU4FG5qzB5sPE4JtZ6TottsxmeYnRNzCo/aRzSX8JBAtTDqQ1X0G22sYnsSoEKQS4MCSmafQpc5oKl8Qu3FHnBoe5cWNrd/Ve1capU+eptJFUb2+vKEUpcWJKggOby6BwseOWj3fr56uQoKK/bDu51NpwG3RFQVAuSF201N+k4jjoSQrNclwyywtdoqiWdkbpAYwthppGgg2fPM1NpSh/n3G/ACklg9+GSAom3t5F9sFdsgcyyBVgXB/i+QQx5Co8772nfW59sgBjYwRV1wjuYrVqRgdlCk3Tfs87wTJynTc/xRFbGCAGD1qPLrbIu0cs3Keh/5lOeo4EKKV4TRmh6hqPRbfeZ8H+sA6JeBpR4TQVP7qVhkEoInjox3bU3HFgOPqidEdTRH2Hf9SNg3xSCZ8vgPx7rk+j5iQbYv8eP632oIj9HRtmhAn5rnlDTy7ad/TciEV4WqGDi4e2yLkxyPqEnY5rDMMIX/9rH/1/EwHp8IIRow8tby/Gj+948xQWpTufYPu4uVCJ/6NQCnZxA8a3Wnm4B3EBB17j2kjmhrxE3PETeTgro4ArX4Da3BaKvOkzhTWDjlyhfL59uj2NfcO9kzfwqvODxsmFVdThT53v3QdDKDgErduLIqwBFLBIMp/rkD2edL32fgbPANtvFMtKgP0TR+eAbuZ45ryjLofcKMrtJIgldfH7Q0AsmrUGFq+LgpdVYamU3ixyi+A0LVlku8Sqta5XJwcnP/KtxmbLE+NINXfEdU3KRnNwF2vnOpZWv26DhWTb3EjX5pf0++NzJ76SZar/wUEOEc24TdY6JLvltdTTVRxUm7acHCp0XBAu4iZVm3nVGj2ZGHHXHQZoa0vMk/ul2KKQc2LiaV+fmR5ycDefwsGrlBH2gtENVhDtBiykoZEERy1iblUvpr4JjOKm8hEJiWLg9yAk3Gh/ygRQ+maWDKkZJPHBwXA9obyKcIJa9M8+1+prSk4Ml617eIu+CXw4Qt8sotRZE06XMZtkHeKSfaiVDtSev4/0ebDq8dPo6wCEOQPyFlQ1+tupFcd0Vqa4vh7RZzhTMD84FZ0/AT165IjoW2qQy6783xS/wKLsYFFiGdusA465+I+5FIRxIDDo8M0YKGgDjHHyLgyXmdPSyJ6ZanKVk+CXsz21h2zmUQapInb7pO8csG0ier6iqEh3xelNKN2qGtEPhDL2JjkapMCIkSrlPqbpwKa9dyAShC7Qi0qOXF1GSI8t0XPfSw5f5HAI2HV0Ef9HnY/OiIB0Ss+OjiNOgMHZeNFPVKqsoV4cPgTXQPgCx8Txiya68sp08ImJPSkIQhHSiqsX3RkO4vVJAIu0CscFAODRuE+MjXVxj+taEp5Y= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 1oL5V723VcmxK9dkCQppZJW/ou/PM1+V8Ob2k2WMpaJOV7g4e2Fgg2eS687SDOKGUxd2FdFJqpGRGdizOzoOh7hafDkyyHDL5wqGQQ5omvGRkimrBBc6CP8d5QGALjGJHcGr7fSuUZsBrTqeRKwu7HEz/JMbsJEt9gGwRVcCWf+84kPNfvEbUnUB/BwJ6jkFvt8YvyMrFx/s18lRz0jTwzrK1kADxv8vzIHjGc3qAtxkGBnrgjQlMRG/hV3MfIU+yjxJWVuF1T6un9epC9BZdJGBYOlrSyEx37PsI01xMrg/BjWhX/2rYjFJd1YcVyySRwlee90m1BA6vmhuw7VH99NdzZymXfmCFLKuBjRykTMzRdJE1pNKbJWL9Kn1GTCnnIh5SwSoABv6BYZzcyV5pOVpHZzeirgQyuM/fKGklVkEWYFTO9yiMCfOrjwqNaVb5W8m/3XZnZVS8/hoWwc0tDuoSlOh9JwUAvc5z9+VV5+WQitzd/dyXAtgpuILr8HwaayrTD+uGiEQUwOIarxlLfL7rTPxWLV01iohEbRe1ZcGGAJfQvfIUA3G5SGo9+Y1MjCStMiI6tbljv2EGcx9rYZXjt/WFG9smR4m+PRSyKo= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0bd19eae-e1e1-48bc-5eb4-08dc37c6fa20 X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB4382.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2024 19:04:52.0764 (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: yEds0DuWqYWS2+EALtce9FBK9NPBC4ZTXwzFvddzR/g3CpXXvxPNf3/loqtoUv3HIYvJam6fKVl2UlM1HmB6rHb6IW37sPnVqVvZg9NtEz8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4416 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-27_06,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 adultscore=0 mlxscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402270148 X-Proofpoint-GUID: 6MMcg8W7ynGd5utFT0cD09VWvSpCbVO7 X-Proofpoint-ORIG-GUID: 6MMcg8W7ynGd5utFT0cD09VWvSpCbVO7 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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+patchwork=sourceware.org@gcc.gnu.org BPF applications, when generating BTF information should always create a .BTF.ext section. Current implementation was only creating it when -mco-re option was used. This patch makes .BTF.ext always be generated for BPF target objects. The patch also adds conditions around btf_finalize function call such that BTF deallocation happens later for BPF target. For BPF, btf_finalize is only called after .BTF.ext is generated. gcc/ChangeLog: * config/bpf/bpf.cc (bpf_option_override): Make .BTF.ext enabled by default for BPF. (bpf_file_end): Call BTF deallocation. * dwarf2ctf.cc (ctf_debug_finalize): Conditionally execute BTF deallocation. --- gcc/config/bpf/bpf.cc | 20 +++++++++----------- gcc/dwarf2ctf.cc | 12 ++++++------ 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/gcc/config/bpf/bpf.cc b/gcc/config/bpf/bpf.cc index d6ca47eeecbe..4318b26b9cda 100644 --- a/gcc/config/bpf/bpf.cc +++ b/gcc/config/bpf/bpf.cc @@ -195,10 +195,8 @@ bpf_option_override (void) if (TARGET_BPF_CORE && !btf_debuginfo_p ()) error ("BPF CO-RE requires BTF debugging information, use %<-gbtf%>"); - /* To support the portability needs of BPF CO-RE approach, BTF debug - information includes the BPF CO-RE relocations. */ - if (TARGET_BPF_CORE) - write_symbols |= BTF_WITH_CORE_DEBUG; + /* BPF applications always generate .BTF.ext. */ + write_symbols |= BTF_WITH_CORE_DEBUG; /* Unlike much of the other BTF debug information, the information necessary for CO-RE relocations is added to the CTF container by the BPF backend. @@ -218,10 +216,7 @@ bpf_option_override (void) /* -gbtf implies -mcore when using the BPF backend, unless -mno-co-re is specified. */ if (btf_debuginfo_p () && !(target_flags_explicit & MASK_BPF_CORE)) - { - target_flags |= MASK_BPF_CORE; - write_symbols |= BTF_WITH_CORE_DEBUG; - } + target_flags |= MASK_BPF_CORE; /* Determine available features from ISA setting (-mcpu=). */ if (bpf_has_jmpext == -1) @@ -267,7 +262,7 @@ bpf_option_override (void) static void bpf_asm_init_sections (void) { - if (TARGET_BPF_CORE) + if (btf_debuginfo_p () && btf_with_core_debuginfo_p ()) btf_ext_init (); } @@ -279,8 +274,11 @@ bpf_asm_init_sections (void) static void bpf_file_end (void) { - if (TARGET_BPF_CORE) - btf_ext_output (); + if (btf_debuginfo_p () && btf_with_core_debuginfo_p ()) + { + btf_ext_output (); + btf_finalize (); + } } #undef TARGET_ASM_FILE_END diff --git a/gcc/dwarf2ctf.cc b/gcc/dwarf2ctf.cc index 93e5619933fa..dca86edfffa9 100644 --- a/gcc/dwarf2ctf.cc +++ b/gcc/dwarf2ctf.cc @@ -944,7 +944,10 @@ ctf_debug_finalize (const char *filename, bool btf) if (btf) { btf_output (filename); - btf_finalize (); + /* 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 @@ -1027,11 +1030,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_with_core_debuginfo_p ()) - { - gcc_assert (btf_debuginfo_p ()); - ctf_debug_finalize (filename, btf_debuginfo_p ()); - } + if (btf_debuginfo_p () && btf_with_core_debuginfo_p ()) + ctf_debug_finalize (filename, btf_debuginfo_p ()); } #include "gt-dwarf2ctf.h"