From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 27BD0385800D for ; Tue, 10 Aug 2021 16:39:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 27BD0385800D Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 17AGbDXG019422; Tue, 10 Aug 2021 16:39:07 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3aaqmuvmcb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Aug 2021 16:39:07 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 17AGaATm137084; Tue, 10 Aug 2021 16:39:06 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2103.outbound.protection.outlook.com [104.47.70.103]) by userp3020.oracle.com with ESMTP id 3aa3xtdt0j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Aug 2021 16:39:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mmjjtdjbb0otTgUsAruJ5yJSzwrPSMGRYgHTyN+CXbLnSHYi3RB5GCE+Ni81tcWj+2exVGEWL6T0m2xniSIM6Vgy3Zf7DrdjIR2N3+SwVIT2h201xB4brg24ErWiVJZqg+8PQLlBUZ+QM2k7AQXBMcM1PDCTolrlY30FYq2UoI57dev1yk/Ts3UhLc5aIwBjkyD6lthQXFrRZzDJd+ZFBXyTySzkEuqgm3C1wmq+kyqDAX3tpWhfM9KcDgPcUE7xY0ZUkP9wT38KQkPg/gWghjgDDSmWwjC3If49HLRlBEw4QcH3Mk1dltD+oTfdwb7wFqCQzxtS4srQ4DGX/AB5Zw== 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=s+YHR3SXy54B1h4eK8CVsEqLB4TZgd0TX6zj0Q1tmqs=; b=mXapu/3bVAS0Jwj0jVfA0+CMInJPMTgt0GXF6CkitF3xnG3dLuGHe7LZiUdf4qFVZZgXCYceKxA4EU/Prje3Ige9JCa3Sk3wGKlR/nyFSwEefGdqMPJqH4xMQu88UIcFxZYLvALXob2Oj0Y+fQEM6Eos9qRHAz54CXHBEkb/Gav5tbzSslV7M7EpaYgS+J/bi8+jnYnNiT12qnuDbLCGU4X5k85SwHR94kwVMq+0TMOjgVflnVfgXSgE9Tx1v8FWH/43xnYwuWS6YH5K4DQj9k0HdodNt2Wu1pCZ0V8DG6C9SXXXS67WAx4PzlSfF248rtD/lY7vEuyu8TOTv7KK9w== 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 SA2PR10MB4458.namprd10.prod.outlook.com (2603:10b6:806:f8::24) by SN6PR10MB2816.namprd10.prod.outlook.com (2603:10b6:805:d5::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.17; Tue, 10 Aug 2021 16:39:03 +0000 Received: from SA2PR10MB4458.namprd10.prod.outlook.com ([fe80::9d08:a59a:abb8:3632]) by SA2PR10MB4458.namprd10.prod.outlook.com ([fe80::9d08:a59a:abb8:3632%5]) with mapi id 15.20.4415.014; Tue, 10 Aug 2021 16:39:03 +0000 Subject: Re: [PATCH, V2 3/3] dwarf2out: Emit BTF in dwarf2out_finish for BPF CO-RE usecase To: Richard Biener , Indu Bhagat Cc: GCC Patches References: <1628124628-28706-1-git-send-email-indu.bhagat@oracle.com> <1628124628-28706-4-git-send-email-indu.bhagat@oracle.com> From: David Faust Message-ID: Date: Tue, 10 Aug 2021 09:39:01 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SA0PR11CA0151.namprd11.prod.outlook.com (2603:10b6:806:1bb::6) To SA2PR10MB4458.namprd10.prod.outlook.com (2603:10b6:806:f8::24) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [IPv6:2606:b400:2001:91:8000::c2c] (2606:b400:8004:44::16) by SA0PR11CA0151.namprd11.prod.outlook.com (2603:10b6:806:1bb::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.17 via Frontend Transport; Tue, 10 Aug 2021 16:39:03 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1e93b8de-1b52-4450-e4f4-08d95c1d5d32 X-MS-TrafficTypeDiagnostic: SN6PR10MB2816: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uzQrmXIRBsz+sb2G22DY4nvfKYqfyuQ2qA25vWO+hdYr4fFFd3Le4QCd+MWW/P4O9O29rwqf4Vf6zxpu26I+Q3w9g2X5RwOxy/6G65hDyXeuHgt8we6l29zzqMLlNwk8Av6MhNcGRjrbdJBaM85yGJv2uBfkaLjR9ao4JTayiaOOoVyycGEU36tG8amD7qVVYk8jQMuABp20kU0tezPPHYeDsM8WL4m7GT6L3JuqbI/TbFjloZiaSnHIfLxl4CN78zl4gjostfE3luRw8zkO73N78jcNTIlOoIQBbCA6AASZca/dT8ynOcbHXeFySnkRg2YAe/3Q4AmmnQ0r6V2gCrQNKCY4bw/iGiGuQbLFtdoH5qf7hp0LCI4P1xPSiD1VLpZhGjT7s/++6sU502qbtU61Z2JO63L8m28CNCrQe1nensOJCCYqNl8hAm6x5ghQELDQBW99dHl9o9plchgzuX0w8dRh7V+2BhxWEPtCamlMU8etYOGOCIU/DrG3YKynDs7WyBaG4tQPOBZbctQk5oCZ0z+Hu3rg1LlRchtuvC8SYAuvVmqlL2t0pdP1jSTft8WOezg35UBYWVzFYNKn4Fi780uRui+83zaWo318p5r1/4FVPHwfo03EvTlV28jDseR3HuXQB1dJ51JFQDsfFDFe4KSO+1lQyw3SCXdMdwU3d0egXFpag0rvrOEGqz4kCygsBLgGwdkc50Wy9kAzF9SHn1E2aj/Ato5NdA1JtNY= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SA2PR10MB4458.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(39860400002)(136003)(396003)(346002)(366004)(376002)(2616005)(478600001)(4326008)(38100700002)(5660300002)(83380400001)(53546011)(186003)(2906002)(66946007)(8936002)(110136005)(6636002)(66476007)(66556008)(6486002)(316002)(8676002)(36756003)(31696002)(86362001)(31686004)(44832011)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?dE5LRlV3R0ExMXNiVThqVC9mNjloTDZucUxsU1VicmhMVW9sWTRyUjNuOWhi?= =?utf-8?B?LzMxaVh3SWdnUHhzWDVwVU1Wa2hreUU4ZStOVWxzSlNnM1pxRWxRZTg4Slk2?= =?utf-8?B?SnRyWGhjbCtLN04xMUoyT2pmc0hBaGJsVmhKc3dWS1hWeXVlMnZwZXhyN1FX?= =?utf-8?B?OUcvL2huenp1eHdsWjdHbS9Ma2l1Vy9wZTNNNHZ3ZXhGZUhMZm5rVFBTOWw0?= =?utf-8?B?bGRBVGY1QXRXeGp4OVVtK3lQZUZkM2hMejEveTUyYnczUjV6M3JHSE95SlNz?= =?utf-8?B?M3BybVVtWUVyWjVRb245T2xjQTlnUTlBd2tLMWlmUlVSdm42enB4cS9PdDI1?= =?utf-8?B?cE4veEF6bjNlZCt5NWdWSmxKMHFZWHFtZXYva0MxNDBPenBRaHBFMStiRzVB?= =?utf-8?B?MzNrTzExS0Q2YTI4T3Frbm5TZ01hbDRpaHdXZzVaVmp0TUsrRDBLaG1iMzg4?= =?utf-8?B?dUJ0S0haOGh1TjBnTTNFS0hLUzFQREtMWkRuV3BPWDloZ2FPWmhhaERqNy9X?= =?utf-8?B?UjVaN1grS2NJSE93cDlwaTlGcm9jNjE4SnBsenNDSk5LRHN3R3JvSkFiZEZa?= =?utf-8?B?QThTNGI0cW8rRk5zQjk4VjZxTzZ2Unl0eUVsbDExMS9FandKd29YUHJ3SWlv?= =?utf-8?B?VDlvZzUvN1YyRXlVMEUra1RiemU3bjlsS3FxVzduWEd1aThycW5ram91RkVV?= =?utf-8?B?U2pRdGFyRVJMbmdqTzZJaEg5eDRwajQ5RG9lK05RZ1JZQjlyU0Q1NVh3RXpP?= =?utf-8?B?T1NwQ2lJMjRycWZ2NVZuSlZaNWtLY0E5ZVpvaFhMelFsZVdtUVJ2cWtiYUdw?= =?utf-8?B?YXNwTmNDSTBtV1h1TmM3d2F0RzJFbFlZZldVbVlxQUhuNm9sRmxxNjRweit3?= =?utf-8?B?eVJOQkJWODlTM3JZa2hUSzhINXJ4VWNQSkMvTVd6TDhuSVM1RHFBWGFVZkE2?= =?utf-8?B?V2hlK3MzODF1NGpjdUl4cnV4b1Z1bmpySEU4ZUhGbDdBUjFGY1hyS3hMUXRa?= =?utf-8?B?OGlrM3orZkcwRlBBQVF6U1RYVzJieXBtS29rcnJ4clgwOTQvTlZ1R1ljMlha?= =?utf-8?B?aDJqVFRJTHowWWxZL0ZmOWhzZjU0V3ovM1Vmc1ZLalRnVG4rMzl1dHF3VGpI?= =?utf-8?B?b3FCWnh1d0FtMU1HNTVWWi83WXZzVTZKcXViMlB1MUtzOU9GOWxoT3l5bXo0?= =?utf-8?B?YXJnQ1FJZG9CUndDUmc1SEZ2dmdpVmN6REp1ZUZtRHpVbHFOcjZkREg4Wk9M?= =?utf-8?B?bitteEVYMXFGVXpzblgrMXlURlZsRVNVYnBybnVSRXZKYW10QktjZXRwQ2Vy?= =?utf-8?B?eVI2bGlTOHBNdnh0Qlh0aUE4MDlwZU5GTE1ZdlVYU3ZDNFU0RHAvMTgycGJw?= =?utf-8?B?eG9nQS9qVk8zZmd2blNibHkyeTNQVk5NdGl1d0c5VVptRjFrY2hiQWNMMkJa?= =?utf-8?B?ODBZV0ZLZTJualVKaHEwTTRVY3NsZExjdWxudTBCZnFpVlYwNTl4ZmVNQVJa?= =?utf-8?B?bU94Sk5KTUM0VXlpdkJrRFVPU1lwYUNiazVuRnFiOERzN0d2SkQ1QS84M1A2?= =?utf-8?B?cENRbkxhSFlEOWVNejV5eFIyQzE4QTJnZXJzMndlWlc3M2NYdjNDOTk3QjdS?= =?utf-8?B?QThkSitySEtNRjFmdXRqU1VmSFlLU1ZLRUZXSFZxL0dIeE5wYTVhdzdhREZh?= =?utf-8?B?ZHpDUHpqaGMva0NzT1JtR1pGclEyT20xNy93OGhVOWRBZDJ5UXV2UGRhWk9z?= =?utf-8?B?TzExOERZR3J2VU1QU3lBSzJNVVhUR2h6TmlLWmxjS2lsMDh1NldFRXpDbTRm?= =?utf-8?B?Z2dUWmNhdExHbXYwUGZsZz09?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e93b8de-1b52-4450-e4f4-08d95c1d5d32 X-MS-Exchange-CrossTenant-AuthSource: SA2PR10MB4458.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2021 16:39:03.9020 (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: 4/Lf4aGdHQfiK7dxkgoTfL5owgqAO+AElhVgujPtD6H/U/tts0K7325fQlbezR19Gd2cqstP6rLQrUSoJoEy2g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR10MB2816 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10072 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108100106 X-Proofpoint-GUID: emSKj0Rnc3ymTDVSNtQHgvTjtj27ajox X-Proofpoint-ORIG-GUID: emSKj0Rnc3ymTDVSNtQHgvTjtj27ajox X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_BL, RCVD_IN_MSPIKE_L3, SPF_HELO_NONE, SPF_NONE, 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: 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: Tue, 10 Aug 2021 16:39:18 -0000 On 8/10/21 5:00 AM, Richard Biener via Gcc-patches wrote: > On Thu, Aug 5, 2021 at 2:53 AM Indu Bhagat via Gcc-patches > wrote: >> >> DWARF generation is split between early and late phases when LTO is in effect. >> This poses challenges for CTF/BTF generation especially if late debug info >> generation is desirable, as turns out to be the case for BPF CO-RE. >> >> In case of BPF CO-RE, the BPF backend adds information about CO-RE relocations >> to the CTF container. This information is what needs to be emitted as a >> separate .BTF.ext section when -more is in effect. Further, each CO-RE >> relocation record holds an offset to a string specifying the access to the >> structure's field. This means that .BTF string table needs to be modified >> "late" in the compilation process. In other words, this implies that the BTF >> sections cannot be finalized in dwarf2out_early_finish when -mcore for the BPF >> backend is in effect. > > OK, it didn't really get any clearer as to why the late annotation > cannot be done > after the early info was output. Something to do with the BTF string table, > but all structure field names must be already present there so I must be missing > something. > > ISTR the CO-RE info is fully contained in a new section .BTF.ext and the > "early" .BTF section is not altered? This is unfortunately not quite the case. The CO-RE relocation records themselves are placed in the .BTF.ext section. But a key component of each record is an "access string," a string which encodes the accessed field via a sequence of field or array indices. The .BTF.ext section does not have a string table of its own, so these "access strings" are placed in the .BTF section string table. The CO-RE relocation records refer to them by offset into the .BTF string table. As a result, the CO-RE information spills into the regular .BTF section, and we need to delay writing out the .BTF section until after these strings can be added. Personally I don't think this way of splitting the CO-RE information is ideal, but hopefully now the issue is more clear? Thank you for your reviews! Example of access string encoding: struct S { int a; union { int _unused; int b; char c; } u[4]; }; struct S *foo = ...; int x = foo->a; /* encoded as "0:0" */ int y = foo[4]->u[2].b /* encoded as "4:1:2:1" */ char z = foo->u[3].c /* encoded as "0:1:3:2" */ > >> Now, the emission of CTF/BTF debug info cannot be moved unconditionally to >> dwarf2out_finish because dwarf2out_finish is not invoked at all for the LTO >> compile phase for slim LTO objects, thus breaking CTF/BTF generation for other >> targets when used with LTO. >> >> The approach taken here in this patch is that - >> >> 1. LTO is disabled for BPF CO-RE >> The reason to disable LTO for BPF CO-RE is that if LTO is in effect, BPF CO-RE >> relocations need to be generated in the LTO link phase _after_ the optimizations >> are done. This means we need to devise way to combine early and late BTF. At >> this time, in absence of linker support for BTF sections, it makes sense to >> steer clear of LTO for BPF CO-RE and bypass the issue. >> >> 2. Use a target hook to allow BPF backend to cleanly convey the case when late >> finalization of the CTF container is desirable. >> >> So, in other words, >> >> dwarf2out_early_finish >> - Always emit CTF here. >> - if (BTF && ctfc_debuginfo_early_finish_p), emit BTF now. >> >> dwarf2out_finish >> - if (BTF && !ctfc_debuginfo_early_finish_p && !in_lto_p) emit BTF now. >> - Use of in_lto_p to make sure LTO link phase does not affect BTF sections >> for other targets. >> >> gcc/ChangeLog: >> >> * dwarf2ctf.c (ctf_debug_finalize): Make it static. >> (ctf_debug_early_finish): New definition. >> (ctf_debug_finish): Likewise. >> * dwarf2ctf.h (ctf_debug_finalize): Remove declaration. >> (ctf_debug_early_finish): New declaration. >> (ctf_debug_finish): Likewise. >> * dwarf2out.c (dwarf2out_finish): Invoke ctf_debug_finish. >> (dwarf2out_early_finish): Invoke ctf_debug_early_finish. >> --- >> gcc/dwarf2ctf.c | 55 +++++++++++++++++++++++++++++++++++++++++++------------ >> gcc/dwarf2ctf.h | 4 +++- >> gcc/dwarf2out.c | 9 +++++++-- >> 3 files changed, 53 insertions(+), 15 deletions(-) >> >> diff --git a/gcc/dwarf2ctf.c b/gcc/dwarf2ctf.c >> index 5e8a725..0fa429c 100644 >> --- a/gcc/dwarf2ctf.c >> +++ b/gcc/dwarf2ctf.c >> @@ -917,6 +917,27 @@ 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 (); >> + } >> + >> + else >> + { >> + /* Emit the collected CTF information. */ >> + ctf_output (filename); >> + >> + /* Reset the CTF state. */ >> + ctf_finalize (); >> + } >> +} >> + >> bool >> ctf_do_die (dw_die_ref die) >> { >> @@ -966,25 +987,35 @@ ctf_debug_init_postprocess (bool btf) >> btf_init_postprocess (); >> } >> >> -/* Prepare for output and write out the CTF debug information. */ >> +/* Early finish CTF/BTF debug info. */ >> >> void >> -ctf_debug_finalize (const char *filename, bool btf) >> +ctf_debug_early_finish (const char * filename) >> { >> - if (btf) >> + /* Emit CTF debug info early always. */ >> + if (ctf_debug_info_level > CTFINFO_LEVEL_NONE >> + /* Emit BTF debug info early if the target does not require late >> + emission. */ >> + || (btf_debuginfo_p () >> + && targetm.ctfc_debuginfo_early_finish_p ())) >> { >> - btf_output (filename); >> - btf_finalize (); >> + /* Emit CTF/BTF debug info. */ >> + ctf_debug_finalize (filename, btf_debuginfo_p ()); >> } >> +} >> >> - else >> - { >> - /* Emit the collected CTF information. */ >> - ctf_output (filename); >> +/* Finish CTF/BTF debug info emission. */ >> >> - /* Reset the CTF state. */ >> - ctf_finalize (); >> - } >> +void >> +ctf_debug_finish (const char * filename) >> +{ >> + /* Emit BTF debug info here when the target needs to update the CTF container >> + (ctfc) in the backend. An example of this, at this time is the BPF CO-RE >> + usecase. */ >> + if (btf_debuginfo_p () >> + && (!in_lto_p && !targetm.ctfc_debuginfo_early_finish_p ())) >> + /* Emit BTF debug info. */ >> + ctf_debug_finalize (filename, btf_debuginfo_p ()); >> } >> >> #include "gt-dwarf2ctf.h" >> diff --git a/gcc/dwarf2ctf.h b/gcc/dwarf2ctf.h >> index a3cf567..9edbde0 100644 >> --- a/gcc/dwarf2ctf.h >> +++ b/gcc/dwarf2ctf.h >> @@ -24,13 +24,15 @@ along with GCC; see the file COPYING3. If not see >> #define GCC_DWARF2CTF_H 1 >> >> #include "dwarf2out.h" >> +#include "flags.h" >> >> /* Debug Format Interface. Used in dwarf2out.c. */ >> >> extern void ctf_debug_init (void); >> extern void ctf_debug_init_postprocess (bool); >> extern bool ctf_do_die (dw_die_ref); >> -extern void ctf_debug_finalize (const char *, bool); >> +extern void ctf_debug_early_finish (const char *); >> +extern void ctf_debug_finish (const char *); >> >> /* Wrappers for CTF/BTF to fetch information from GCC DWARF DIE. Used in >> ctfc.c. >> diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c >> index b91a9b5..708cd1f 100644 >> --- a/gcc/dwarf2out.c >> +++ b/gcc/dwarf2out.c >> @@ -31895,6 +31895,11 @@ dwarf2out_finish (const char *filename) >> unsigned char checksum[16]; >> char dl_section_ref[MAX_ARTIFICIAL_LABEL_BYTES]; >> >> + /* Generate CTF/BTF debug info. */ >> + if ((ctf_debug_info_level > CTFINFO_LEVEL_NONE >> + || btf_debuginfo_p ()) && lang_GNU_C ()) >> + ctf_debug_finish (filename); >> + >> /* Skip emitting DWARF if not required. */ >> if (!dwarf_debuginfo_p ()) >> return; >> @@ -32799,8 +32804,8 @@ dwarf2out_early_finish (const char *filename) >> ctf_debug_do_cu (node->die); >> /* Post process the debug data in the CTF container if necessary. */ >> ctf_debug_init_postprocess (btf_debuginfo_p ()); >> - /* Emit CTF/BTF debug info. */ >> - ctf_debug_finalize (filename, btf_debuginfo_p ()); >> + >> + ctf_debug_early_finish (filename); >> } >> >> /* Do not generate DWARF assembler now when not producing LTO bytecode. */ >> -- >> 1.8.3.1 >>