From patchwork Thu Nov 30 22:17:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 81061 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 A03193871011 for ; Thu, 30 Nov 2023 22:18:01 +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 880B1385C33A for ; Thu, 30 Nov 2023 22:17:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 880B1385C33A 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 880B1385C33A 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=1701382664; cv=pass; b=ZQfAna00uHlVVW9gIxZAz6bjfxMuoxcdvtx29vrAQ6gPPOElmX/KjbOOUu28qqNTT5h9yRJnZ4PazqJjubzErXVVKgCFoKU3YKCMerN4iOOrIQZKBH33axJTrwEHa1pMDd2Xi4F1ccxMMP9HRmUXI2VE55b0X+jZQUk+HGWFWjo= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1701382664; c=relaxed/simple; bh=9iiBN9YzJH+MonAsLPd/jnnlk+TYe+2sO8vKLgAd+v8=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=wXKIHV4V8A9AR8wB0MSEsOi9Fcvio1R0n1Mmv1a+s6YaYJLsy3YEFgPPbjydTZyhnPvLPg3uMDFA5KdyDTwHpEBiGZLWoqCgI+5Lztmiy7JO3XCgi4i13pqmvH2aY5CK8rxQJnxB6MbwqdvFoat6W9/8o5/U/N7WRMe88sQqvOs= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AUM1QOg010910 for ; Thu, 30 Nov 2023 22:17:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=MuSYyxJtF92xqKGNpou5XXcmrWKV9SZwpFj0nN6VyHQ=; b=Ja4HGBoGtvnOI8BGgx08bFb3wYEkkgztxpj+vkZYFsVeQWLiNEEDx0N3jxXNMdkfl36R PbEM00YF9JnMP7YHGDJC0XixLHqI4dUcfCNGkALrTzw2zFYEFC7aVWoB2Y8TmaXLBtI2 NdmOwRFzoBcSvwXRIEKNUR2hz2qd/TujDCqrs4V/xtkjpG1bsOmVT1S+37t1+zcjxyNR 9JRgcD8p1YNlNMG0E4OW2R5K8Z0CA3KgFOPjxYL9LwpVBnUoVaFUiP+wE/DCzH9+B1Z4 +7rpHPvroSYIuPHcW9NsPg0lb/R8O3uqw218bPYmR9DhLnQX2ZxUSq1NHzT9Fh3zKfGQ mw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3uq2tr81et-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 30 Nov 2023 22:17:41 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3AUKqPc3026490 for ; Thu, 30 Nov 2023 22:17:41 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2100.outbound.protection.outlook.com [104.47.55.100]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3uk7cauf7u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 30 Nov 2023 22:17:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i43UdFQujV7X44yIVTpSoiqI5nK+mrdlKhALpEsdWDPAy4gceFRbMGp02aSLWFjrM7D/y9NVfkpDE9g0dCse7O4fhAey/6xZ/LriusDEKH7aAB1nZrccvgr+YkHJqjjxqmrYXhbh5oY93IJeWHwAcNvpNuLW1OkCrixX3AvXK26odtpml6cs4Volq8Oc6SEWVGInlmgajNXSmNQEbTVAPvyMVW1GMKgQ0IJS9BDBi7ArCG+7d8W2GqAJvWLbdgDjY0EETpXGpEzl8AzGqyOwTK+vwtm3wpg8UnepQ4MCLo10JpFtUNKAAeYNIgUGhlErBP8sYJCTiGuvtZHiMV6Wxw== 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=MuSYyxJtF92xqKGNpou5XXcmrWKV9SZwpFj0nN6VyHQ=; b=SDsWKQjxkP9iJm1cjf4pHqWBIjMqz7U9cQB1sgn4Uu4A8n1nhza4mojhEz6aQFWUGr1X/r6Fecg6BtmdPlhjrszT3m/Z5jJI9ViVMrdV+rkHEGIPo76oJDFZsVP716usQctxmiyKaRUwD7kd2vH67G7AC1mO9W1fb1p+eFe83gXvYcm/1q4DSdR3ZWFR0Y4WwLaqxo3cXWTofVbzVd5bXdz757gmFbI0/NBHu0DGNDc/ZmfzUtKDHQSzSXKTmSxC8pUQtmJCaA2b742Rr17zWrputbhGWnfFvtgyKzaWZ4HIMF/F5GAHTY1hBNUFSxRpzK/O+k5HD8AY5CT1yOG66A== 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=MuSYyxJtF92xqKGNpou5XXcmrWKV9SZwpFj0nN6VyHQ=; b=w5AHGMqioEP1sGk5M0QW9THPjJd28jUkKIRqE98EPMB78RH/OMNlYMOwedItj1C6kiRJyQvozhqGELqOpRJKIMwTneA9ITSEzp4nl16q3T1nXoM6S7Y5VnoOsokGxbEL8r3tPwsyeGdgnFgu1cNceMkgb1/Y3c8KOrNGkDUeMGw= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by IA1PR10MB6242.namprd10.prod.outlook.com (2603:10b6:208:3a2::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.24; Thu, 30 Nov 2023 22:17:38 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::88e2:4a2e:3111:e04]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::88e2:4a2e:3111:e04%7]) with mapi id 15.20.7025.022; Thu, 30 Nov 2023 22:17:38 +0000 From: Indu Bhagat To: gcc-patches@gcc.gnu.org Cc: david.faust@oracle.com, jose.marchesi@oracle.com, Indu Bhagat Subject: [PATCH] btf: fix PR debug/112768 Date: Thu, 30 Nov 2023 14:17:27 -0800 Message-ID: <20231130221727.3044519-1-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 X-ClientProxiedBy: BL1PR13CA0376.namprd13.prod.outlook.com (2603:10b6:208:2c0::21) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|IA1PR10MB6242:EE_ X-MS-Office365-Filtering-Correlation-Id: 92b801dc-9580-4e88-3162-08dbf1f22952 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rmdjh1wM39YNA3Hr0iszrG2iq5mxrCqszxk5NjEFD+cugBjnlHQBc/BXCPZGDrY+3kyDV3VIT5sNavwaNmedgPSYxAxfB2fPsSDE8hg9u4C9Vsm+c5hAG2NoGSuNoVLEWlEVKvTG2SpXPyCg2sA8WIdvPK1tzvAf1HPNeLHV/18BmsVo92wcK0jcy5JQ0rjhwgQVUOriKCOhncrkpWf/zI8RkJuqEYr/524UhMb7lFly1ZeeGJ6chnSBal0YqZ870rBLb37M9YOo71EvtMVtCQiNMCij8gx/VYYWtZknJZVfkxUJcu6aegw6mFwm27NO7Mjhu3lPP1qU3qnUnZIL3E+XBn5cauvxTeaZ2SllizphiciWxBXdRiSAnR6sT5WaRQk1QSA39g9RlW1ew8tk5zK/g1vtykDKpNM3eoniZCzRHCCkKm89+59ZDsya343k3Nxxk5NyrtaNqyEuI8Zl0gATFLbtqbx8j0tR9oqg/03SvUvQLxvDHehEDxKF0K3D45+fr3ygAoCaGvJmfih6JL8tBD1tMW1vOoRRy7bNaNA= 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:(13230031)(376002)(366004)(346002)(136003)(396003)(39860400002)(230922051799003)(1800799012)(451199024)(186009)(64100799003)(478600001)(66476007)(66556008)(6916009)(8936002)(86362001)(8676002)(4326008)(44832011)(6486002)(316002)(41300700001)(66946007)(36756003)(1076003)(2906002)(5660300002)(38100700002)(2616005)(6506007)(6512007)(107886003)(6666004)(83380400001)(84970400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CrOm9cODlrTZaXKug8VAts/KlK2yeT8JcGWULjOYbJp6RBxjPffYw1XJzfzQDT8u7V1Kav6izZ9qMNycIGYJXJ0cDZ+v8UvYoBVUaLMX52nurOo9xgMFf5ya2YwQ5Ymzpm9HQE0oCD6+IpjcW5In+5thztfhNZ554fpZy8HdhGdetn47N49sviPJ+hyF44pmcPJAeiqOdtg2H6n2Qyjvdw8GiqOhBjlRjvSYfCWbhpfRwSWS7JZLy1CYzO3Hty6oeqDP2HKiJ8CXdTMebBvVJNlBoEVG+frC+6nfdKdEM+jP2gbAEfPoFOLXCIOP9TfGtUZIJ/3iYn4bgG7hO4MR0SD5iiOgRwEdFlWNj3w0kaQE7wKL21d3fs2Sj78U7iuEKvVgYAAkbZfP2MJe7zb3qXl8K2YLynOtDSclVMU6tneZbhHef9Ge3T6DsSIXRzBVCn+gdRgCE9SycpUdhGLv580XniavtW9rVOQaGrEeC9EcaBkV34vKuSsbkTnQYLarGiavetsb4I5mInMxoto0KXhAodyeWnP2jWzDSI+voeOWxJ2sL5XW9Vt1BYClP9KoFJqJcqhKlVkIm/BX6Yo8FjaDEIfqnI7r5K71tuhyQ0JydZflrCNelUAfO/9nXnpqi4ijanJmwDvG440mGms8GWKqfTT+7oSN73Jmro8RvASbM7CwLC2g/PUTmkAb6W0JQO9GZtxs8TX8utp0chzlMtxJOobGVCqX5pGh5GUUwFVtVN2U1y3a//F89lZNt1RXtZQN0+8u6ZU8G4utDjwFuMbZ+9SYS4EYDqCdKCi2EFaiOgD1Kq++OoySaOZ6yjC31bhfCu22j69bcjdMIC0E0PW0GP/fHBI3NoO0fkEbrTio+Y9Lt7cHfPMb9ag4j7hiDUmwyuyWAmb0Hqp0cU1PaoI9nBppy7wKNPkRF9iz4+EUVPzwI2E3Dty57ixKfWUdhSqax8T/mTV9fqDBh/2FuUIzHR2w6xwNN8ExCj1v8/0ddIOtZcbqM4lno5EZlNBVJdPnvCjhBRiyiEvVAqBVIwC9isNsOPG+/G9R4IdqWyD1RmhJKoLfrQQpYm/qP7MC3LQcDFuJr9hZyforea1TqvBuv+gep+j5HLdH8mvIKzXegNpC7m442XuosQFXEeyEejk28Fs0GqcR4UfIRIvwiL0zPJlplNW8SkQ+uqSMkj+VuWu2gUdWvIarvmBF1Srwi9phNmy2p+WY49i7QSgfIMtrbe7ZZPXl7BZgcNmKyjyRByLKqUZUbifCPxKJjO6HtwundjBKN4hmiDt1cpKyS/AA7qsYduKyQnfVsHB+giiEB7S1gjnwYdXMGk1n3Q2xnSOD5Ns0PjzOnjCMreJGRHkWac5iXkZnu7KAnuoA9Bs6hkS8Ybhhe9VKsbSSupKaGps4xUNXanzmaNAYOCToUlY1N+Pwcpf9n2vC3/4u07/v7/j7DFYhjEWgrrLdncC87Wp/YHtr06iKUn8T4YAutCpdwqEUBG3t/03Pp3T+CasqAChDemPAeW16BB5j/uKmbXlgdFmlC1FNv1f3nL+7QsbPjrmcgXJaveOdMSsi7uKDNXSSoJw3vnT4fK5fUs6HP8Z/ygRALGdVFvXkK17qgw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: rFOv0yrq79GytSxFBXe1BrVpPh1GfLMJoNnQhlTWcc4ZpAXfgrpg8NPBH6JGJt8ZPJj6QkLUXtLV+6J1Ei2RF1AwFed0tNcVKRbnJxYcWvWbrCW15D0KfsLeNtKg806THNteErnUhRN/fHq3UY+0RSPSuC57LzLCqJJD4ztMMrD22HiBqcgzQaM2hwPDFb0UiZSExtXE4thO6Qk8hSFmCnFnRDtGSQzml/qUkifGZoJkbTnMJ2rbZfPKKiRmwx6lJeMYIWjpW/osXSrYG77IFMIz5wszj4yT1bllSd7k7SaKtcn1VkElyfLLrAwpCiC2z4gFkEsQA8aKXhiIk54D3LhE8y8+rEGuAe2W3vlfihF798yMMRUaIe9OEBY3ZozINFgoN1U0fPSsse+5CaKAfE9xqVRdeZv0+jEzrYWJvoLz1eoYoQvhdwGGjL+BF/8zXViXQocfVp3cGoi8SATNdc8WhpKGMm3+0JvQeoee1xhqMVEJkqHFGFGgeB8FcW00IX8brBG64kbJE9SbIWjGvce3Np8NcPg2vIVVLTIAMYpqpqeQ4+sUx2rY55TTwVfbc/MCDC/3HhaPvsvrvoB04awA/4sia2GZuN5V1V6ymLy6wIIOCEM5cbj78AuTjVMDZudphnIWuiBzPrhvJzQP0YycTk8AV+kQb+MfJG5iSCX/Jm+tlDaEdoA7Jtrzw3PPBcaWagbI2VC2pk+FzTJ0KhO+zzcE4dbOp/+/3yeh7rfaGpBf1+zUmPKOLi8E+OP3 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 92b801dc-9580-4e88-3162-08dbf1f22952 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2023 22:17:38.2761 (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: VCpyODpYumza6bIrEWbKr1n/ZAQJ8VvYcSuXogJUtt7IV/qEh0WjETOkq9Fb6NMYliTB3gkXfvrhIF2bpl4pYA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB6242 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-30_22,2023-11-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 adultscore=0 phishscore=0 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311300164 X-Proofpoint-ORIG-GUID: RYkc1PglIUzfI3o8ild26b_RadwGwt_z X-Proofpoint-GUID: RYkc1PglIUzfI3o8ild26b_RadwGwt_z 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, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5, 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 PR debug/112768 - btf: fix asm comment output for BTF_KIND_FUNC* kinds The patch adds a small function to abstract out the detail and return the name of the type. The patch also fixes the issue of BTF_KIND_FUNC appearing in the comments with a 'null' string. For btf-function-6.c testcase, after the patch: .long 0 # TYPE 2 BTF_KIND_FUNC_PROTO '' .long 0xd000002 # btt_info: kind=13, kflag=0, vlen=2 .long 0x1 # btt_type: (BTF_KIND_INT 'int') .long 0 # farg_name .long 0x1 # farg_type: (BTF_KIND_INT 'int') .long 0 # farg_name .long 0x1 # farg_type: (BTF_KIND_INT 'int') .long 0 # TYPE 3 BTF_KIND_FUNC_PROTO '' .long 0xd000001 # btt_info: kind=13, kflag=0, vlen=1 .long 0x1 # btt_type: (BTF_KIND_INT 'int') .long 0x68 # farg_name .long 0x1 # farg_type: (BTF_KIND_INT 'int') .long 0x5 # TYPE 4 BTF_KIND_FUNC 'extfunc' .long 0xc000002 # btt_info: kind=12, kflag=0, linkage=2 .long 0x2 # btt_type: (BTF_KIND_FUNC_PROTO '') .long 0xd # TYPE 5 BTF_KIND_FUNC 'foo' .long 0xc000001 # btt_info: kind=12, kflag=0, linkage=1 .long 0x3 # btt_type: (BTF_KIND_FUNC_PROTO '') gcc/ChangeLog: PR debug/112768 * btfout.cc (get_btf_type_name): New definition. (btf_collect_datasec): Update dtd_name to the original type name string. (btf_asm_type_ref): Use the new get_btf_type_name function instead. (btf_asm_type): Likewise. (btf_asm_func_type): Likewise. gcc/testsuite/ChangeLog: PR debug/112768 * gcc.dg/debug/btf/btf-function-6.c: Empty string expected with BTF_KIND_FUNC_PROTO. Testing notes: - bootstrapped and reg tested on x86_64 - No regressions in btf.exp on BPF target --- gcc/btfout.cc | 22 +++++++++++++++---- .../gcc.dg/debug/btf/btf-function-6.c | 4 ++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/gcc/btfout.cc b/gcc/btfout.cc index 5f2e99ce472..1c25404b2c0 100644 --- a/gcc/btfout.cc +++ b/gcc/btfout.cc @@ -158,6 +158,19 @@ get_btf_kind (uint32_t ctf_kind) return BTF_KIND_UNKN; } +/* Some BTF types, like BTF_KIND_FUNC_PROTO, are anonymous. The machinery + in btfout to emit BTF, may reset dtd_data->ctti_name, but does not update + the name in the ctf_dtdef_ref type object (deliberate choice). This + interface helps abstract out that state of affairs, while giving access to + the name of the type as intended. */ + +static const char * +get_btf_type_name (ctf_dtdef_ref dtd) +{ + const char *anon = ""; + return (dtd->dtd_data.ctti_name) ? dtd->dtd_name : anon; +} + /* Helper routines to map between 'relative' and 'absolute' IDs. In BTF all records (including variables) are output in one long list, and all @@ -425,6 +438,7 @@ btf_collect_datasec (ctf_container_ref ctfc) func_dtd->dtd_data = dtd->dtd_data; func_dtd->dtd_data.ctti_type = dtd->dtd_type; func_dtd->linkage = dtd->linkage; + func_dtd->dtd_name = dtd->dtd_name; func_dtd->dtd_type = num_types_added + num_types_created; /* Only the BTF_KIND_FUNC type actually references the name. The @@ -722,7 +736,7 @@ btf_asm_type_ref (const char *prefix, ctf_container_ref ctfc, ctf_id_t ref_id) size_t func_id = btf_relative_func_id (ref_id); ctf_dtdef_ref ref_type = (*funcs)[func_id]; dw2_asm_output_data (4, ref_id, "%s: (BTF_KIND_FUNC '%s')", - prefix, ref_type->dtd_name); + prefix, get_btf_type_name (ref_type)); } else { @@ -733,7 +747,7 @@ btf_asm_type_ref (const char *prefix, ctf_container_ref ctfc, ctf_id_t ref_id) dw2_asm_output_data (4, ref_id, "%s: (BTF_KIND_%s '%s')", prefix, btf_kind_name (ref_kind), - ref_type->dtd_name); + get_btf_type_name (ref_type)); } } @@ -809,7 +823,7 @@ btf_asm_type (ctf_container_ref ctfc, ctf_dtdef_ref dtd) dw2_asm_output_data (4, dtd->dtd_data.ctti_name, "TYPE %" PRIu64 " BTF_KIND_%s '%s'", get_btf_id (dtd->dtd_type), btf_kind_name (btf_kind), - dtd->dtd_name); + get_btf_type_name (dtd)); dw2_asm_output_data (4, BTF_TYPE_INFO (btf_kind, btf_kflag, btf_vlen), "btt_info: kind=%u, kflag=%u, vlen=%u", btf_kind, btf_kflag, btf_vlen); @@ -950,7 +964,7 @@ btf_asm_func_type (ctf_container_ref ctfc, ctf_dtdef_ref dtd, ctf_id_t id) ctf_id_t ref_id = dtd->dtd_data.ctti_type; dw2_asm_output_data (4, dtd->dtd_data.ctti_name, "TYPE %" PRIu64 " BTF_KIND_FUNC '%s'", - btf_absolute_func_id (id), dtd->dtd_name); + btf_absolute_func_id (id), get_btf_type_name (dtd)); dw2_asm_output_data (4, BTF_TYPE_INFO (BTF_KIND_FUNC, 0, dtd->linkage), "btt_info: kind=%u, kflag=%u, linkage=%u", BTF_KIND_FUNC, 0, dtd->linkage); diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-function-6.c b/gcc/testsuite/gcc.dg/debug/btf/btf-function-6.c index e014d9990a9..802bc6d1c74 100644 --- a/gcc/testsuite/gcc.dg/debug/btf/btf-function-6.c +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-function-6.c @@ -6,8 +6,8 @@ /* { dg-do compile } */ /* { dg-options "-O0 -gbtf -dA" } */ -/* { dg-final { scan-assembler-times " BTF_KIND_FUNC\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*linkage=2\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_FUNC_PROTO 'extfunc'" 1 } } */ -/* { dg-final { scan-assembler-times " BTF_KIND_FUNC\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*linkage=1\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_FUNC_PROTO 'foo'" 1 } } */ +/* { dg-final { scan-assembler-times " BTF_KIND_FUNC\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*linkage=2\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_FUNC_PROTO ''" 1 } } */ +/* { dg-final { scan-assembler-times " BTF_KIND_FUNC\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*linkage=1\[\\r\\n\]+\[^\\r\\n\]*\\(BTF_KIND_FUNC_PROTO ''" 1 } } */ extern int extfunc(int a, int b);