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 E86C63858C2D for ; Tue, 11 Jul 2023 21:58:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E86C63858C2D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com 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 36BID4UZ015542; Tue, 11 Jul 2023 21:58:52 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-03-30; bh=EcqY8q1V/r7ZBnCuOB7MSRps8qxG162F8+EO9sfhGpY=; b=eC+lOS21jo7z2EcqKC/7hrNRrA1qZz+pRcNc2DsMdd0qxjKt6+iHre6ygWE2bmg0ga4b R2up4rnL8COcb449axydgh7DIoIm30YbRDH0xevYkjSXbhsTCOzTURYfc1uXN1qezjc+ oiG+CoG6ArhavbsVcdyc+OOFTdrq1BFBeHWOoHepHeOav5aCXjLjJ9Nq4UaQ/DSxKapz Fg6c0RupUb3uHkhy7uNfRtOJ8THnVulx2Tqe4L4Vgt8n7j4f+P/xBm/SZzvfVG9SDuc3 lvH1Hox+4bbbCuFwMnkPxUUgrNUevldRb725i5O7+/Ii75x+o/h1228X4OSMOQd6cPY+ qA== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rr8xumfn9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:58:52 +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 36BLw8RL027105; Tue, 11 Jul 2023 21:58:51 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2046.outbound.protection.outlook.com [104.47.56.46]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rpx85hhuw-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:58:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nqyZWrywtadjAsrBC62dHdAaSm32h2ICbLT8zUbZoURJOMRrE5xmEkgFUY9682y/6LAgzYAQqVPgNM2p+jO4q7bifh3itvqFKWC+2zQJ3PrWi3mTzZAUHQmiXVVBvTWIh/Jwtr4eu6CdfWKjOt1p92VXOgho3D4dDgN6XUNySNWm04TGgkkYer84w117y+BfvCqo4Z3Ru06z0QSw+5LOZ5tII1SAB4RXaCKfEIqQksdz1zzUALfSJwONltWgfLVt4jGFZnlaegMC/dRd6OZpgFFcd/J9o1CfoNO8vZvvKeL9z8vCHgU8LNm2bsMI2UXNjjHNlsAZDEhqYazXAg6v0w== 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=EcqY8q1V/r7ZBnCuOB7MSRps8qxG162F8+EO9sfhGpY=; b=TQtcov9yt6b+Hcfyqe2Y6duUHz8NC2Guh6BgpoiAnxeowBISLjQNTzRKKW1HDm716R7mr/A19siw9KxVVcwoeX0j4RDWsDAhb7lXSUO8q595Wv9D0v5ZxT/7A9RuIl+phE4eR0vtGQl8+Z7v1x7hrv9GFUjZeKcyiqFFkzxp6uRsjB2D1N0fbrxFdLpkPSFcD0N5NlBWU3mT/kOO6vB7JFPrB2ChUkovSJ0+8Np6kGc3cuNuW4KhdAx/ou6jxFl98L7hlqzIt12gaVrju53dJLZ/NqQC9qycRa86swxaV9vuXCq0tBeJZZwTiK9lK5Bzg7dWQ2HN/Fx/B2aWoe4oBA== 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=EcqY8q1V/r7ZBnCuOB7MSRps8qxG162F8+EO9sfhGpY=; b=w4HApBtoH+teK5bqlRd8iSFUqWAmPHfXlB79b2Jtrjkmlwn3igMdUASE5H6yblhw1CVEuwwLzG5nW9Q/AmWZpVClciRTo00Bgz3+h87BZ0Npv8gtbQ1s7mYBcvI3DL1bmREKi2K4EppY2nHAKwHyaVZPmUyAFZtNx84csi/sHPY= Received: from MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) by CO6PR10MB5650.namprd10.prod.outlook.com (2603:10b6:303:14f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Tue, 11 Jul 2023 21:58:48 +0000 Received: from MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::1797:59c3:a40e:f8ab]) by MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::1797:59c3:a40e:f8ab%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:58:48 +0000 From: David Faust To: gcc-patches@gcc.gnu.org Cc: jose.marchesi@oracle.com, yhs@meta.com Subject: [PATCH 6/9] dwarf2ctf: convert annotation DIEs to CTF types Date: Tue, 11 Jul 2023 14:57:13 -0700 Message-Id: <20230711215716.12980-7-david.faust@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230711215716.12980-1-david.faust@oracle.com> References: <20230711215716.12980-1-david.faust@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SA0PR13CA0025.namprd13.prod.outlook.com (2603:10b6:806:130::30) To MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR10MB3213:EE_|CO6PR10MB5650:EE_ X-MS-Office365-Filtering-Correlation-Id: dcb6a588-6f56-49ec-c178-08db825a0105 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GZfvx2YzQaIqp2S5nhH44aoxgzCI2geVTs6izw95aWikUcQmgMAkYVB7GFsIGhOKWB3nCHJPWgxksh6rpH6eSQMQpGMekjaEJjSK6CQ6TREvHHOc4PoAHBTAxUVf7w6ryKX6Lld8WSXYCGBSScV+B/0aIQnw7fml/n877kwdDK8mRVHF4m4Ame5dfE6RnycEu5iooQ5J2NZ+xCogI35VS3OmnpN7uxDtsKydbpQuJGXTi3b1B4umEVPuC+nZn83c2RsJ6YcjI3tfEd8MG89/b5PqG1nBFC70K795xdwfG9yetscTbOPE+pBZXiKZ6rMaJFf5OUe77KYrLoqFge9T7b+8FeMr2YaqjHOa0EaI7ZOObJJYOY2pPH1fprUwepvBOpORA0TNuQEEbLYcwb/Ql6WHwtY4BgjZ9vyYJFXz+kWcgofppvmsHFmCz2fodvE2dAgv7teMEiYYJsGecuiG/yqEjU9C0YvKZhz4HwSmX7YkfbQZxemALRYZbkGP7fhtQgv8IdgqwIIybESMKrFVzhCbesv7kDfvggpOg+3o236z7aKUaowk9hTcf0MsNYCS X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR10MB3213.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(39860400002)(346002)(136003)(376002)(396003)(366004)(451199021)(86362001)(38100700002)(36756003)(6486002)(6666004)(6506007)(26005)(186003)(1076003)(6512007)(2616005)(5660300002)(2906002)(316002)(66556008)(66946007)(66476007)(8676002)(44832011)(8936002)(83380400001)(4326008)(478600001)(6916009)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?75B7NAe/mkRlmpnY0DdsdxjCXlgz7m8e4iWizY5dzKZf7MblNxAw4O3apu60?= =?us-ascii?Q?dwbsaf6OXzlZgUzZNPkobpgz6I+tRb2SzjbDtuJQMVeCVvZRPLiItuh+uJlc?= =?us-ascii?Q?o2XTIdPnozuHtwCysw2SQ17VkSdmbLtPMfUT7x6HPSzafB+w04hvhmhfZr/c?= =?us-ascii?Q?AMb/0Yg/COaVKqwksQLlWiNT3NOTOArxh6+/2ea9Ve78Y+l81h/7R3OTleqn?= =?us-ascii?Q?jnSOsJI4zeb5iiDzPYDKyEsrCvNWpcgublvJpXStjMZu4U8ap3bK6MkQlnAP?= =?us-ascii?Q?Fc4r/3ol10vVsG6NC9qhKeGXTu8RY+1xcjhyZJFV9omiluxb6xtX2M4Xd/21?= =?us-ascii?Q?dFxH7LLKcs9fpJ+fnGr1vtgHjWyNh9PGHNa2MWth6p/LIXqfjQAzzXhVTSD9?= =?us-ascii?Q?vIyk1ILX/FSGrlriNelrZCYw4c7IrRknNVOMFO2SL1q65fWn5+KxuhEn6Jz0?= =?us-ascii?Q?/YvdlQLchZ9ACSA8PFpOjWP2Fo8axZuAmIhShsFpwlbAsYBQApwm8Po9S37i?= =?us-ascii?Q?NuiWO/EF8LbeLbDywEqQoOeMYcHzt+2VJx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EMmrO22p63kA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: dcb6a588-6f56-49ec-c178-08db825a0105 X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB3213.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:58:48.1196 (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: niWVOiMgyr43ytfCRNIHXxp3UxSi6WnPozNwEUXm552VB5Mxp463awxuRKnVNkFezq+AjGgD4WbWre7JU8mzqQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5650 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 spamscore=0 phishscore=0 mlxlogscore=832 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110200 X-Proofpoint-GUID: GW7P7c167FduYjEFZ0SiruMSKQmBWP5k X-Proofpoint-ORIG-GUID: GW7P7c167FduYjEFZ0SiruMSKQmBWP5k X-Spam-Status: No, score=-13.3 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_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 List-Id: This patch makes the DWARF-to-CTF conversion process aware of the new DW_TAG_GNU_annotation DIEs. The DIEs are converted to CTF_K_DECL_TAG types and added to the compilation unit CTF container to be translated to BTF and output. gcc/ * dwarf2ctf.cc (handle_btf_tags): New function. (gen_ctf_sou_type): Don't try to create member types for children which are not DW_TAG_member. Call handle_btf_tags if appropriate. (gen_ctf_function_type): Call handle_btf_tags if appropriate. (gen_ctf_variable): Likewise. (gen_ctf_type): Likewise. --- gcc/dwarf2ctf.cc | 71 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/gcc/dwarf2ctf.cc b/gcc/dwarf2ctf.cc index 549b0cb2dc1..b051aef45a8 100644 --- a/gcc/dwarf2ctf.cc +++ b/gcc/dwarf2ctf.cc @@ -32,6 +32,9 @@ along with GCC; see the file COPYING3. If not see static ctf_id_t gen_ctf_type (ctf_container_ref, dw_die_ref); +static void +handle_btf_tags (ctf_container_ref, dw_die_ref, ctf_id_t, int); + /* All the DIE structures we handle come from the DWARF information generated by GCC. However, there are three situations where we need to create our own created DIE structures because GCC doesn't @@ -547,6 +550,7 @@ gen_ctf_sou_type (ctf_container_ref ctfc, dw_die_ref sou, uint32_t kind) /* Now process the struct members. */ { dw_die_ref c; + int idx = 0; c = dw_get_die_child (sou); if (c) @@ -559,6 +563,9 @@ gen_ctf_sou_type (ctf_container_ref ctfc, dw_die_ref sou, uint32_t kind) c = dw_get_die_sib (c); + if (dw_get_die_tag (c) != DW_TAG_member) + continue; + field_name = get_AT_string (c, DW_AT_name); field_type = ctf_get_AT_type (c); field_location = ctf_get_AT_data_member_location (c); @@ -626,6 +633,12 @@ gen_ctf_sou_type (ctf_container_ref ctfc, dw_die_ref sou, uint32_t kind) field_name, field_type_id, field_location); + + /* Handle BTF tags on the member. */ + if (btf_debuginfo_p ()) + handle_btf_tags (ctfc, c, sou_type_id, idx); + + idx++; } while (c != dw_get_die_child (sou)); } @@ -718,6 +731,9 @@ gen_ctf_function_type (ctf_container_ref ctfc, dw_die_ref function, arg_type = gen_ctf_type (ctfc, ctf_get_AT_type (c)); /* Add the argument to the existing CTF function type. */ ctf_add_function_arg (ctfc, function, arg_name, arg_type); + + if (btf_debuginfo_p ()) + handle_btf_tags (ctfc, c, function_type_id, i - 1); } else /* This is a local variable. Ignore. */ @@ -833,6 +849,11 @@ gen_ctf_variable (ctf_container_ref ctfc, dw_die_ref die) /* Skip updating the number of global objects at this time. This is updated later after pre-processing as some CTF variable records although generated now, will not be emitted later. [PR105089]. */ + + /* Handle any BTF tags on the variable. */ + if (btf_debuginfo_p ()) + handle_btf_tags (ctfc, die, CTF_NULL_TYPEID, -1); + } /* Add a CTF function record for the given input DWARF DIE. */ @@ -850,8 +871,13 @@ gen_ctf_function (ctf_container_ref ctfc, dw_die_ref die) counter. Note that DWARF encodes function types in both DW_TAG_subroutine_type and DW_TAG_subprogram in exactly the same way. */ - (void) gen_ctf_function_type (ctfc, die, true /* from_global_func */); + function_type_id + = gen_ctf_function_type (ctfc, die, true /* from_global_func */); ctfc->ctfc_num_global_funcs += 1; + + /* Handle any BTF tags on the function itself. */ + if (btf_debuginfo_p ()) + handle_btf_tags (ctfc, die, function_type_id, -1); } /* Add CTF type record(s) for the given input DWARF DIE and return its type id. @@ -928,6 +954,10 @@ gen_ctf_type (ctf_container_ref ctfc, dw_die_ref die) break; } + /* Handle any BTF tags on the type. */ + if (btf_debuginfo_p () && !unrecog_die) + handle_btf_tags (ctfc, die, type_id, -1); + /* For all types unrepresented in CTF, use an explicit CTF type of kind CTF_K_UNKNOWN. */ if ((type_id == CTF_NULL_TYPEID) && (!unrecog_die)) @@ -936,6 +966,45 @@ gen_ctf_type (ctf_container_ref ctfc, dw_die_ref die) return type_id; } +/* BTF support. Handle any BTF tags attached to a given DIE, and generate + intermediate CTF types for them. */ + +static void +handle_btf_tags (ctf_container_ref ctfc, dw_die_ref die, ctf_id_t type_id, + int component_idx) +{ + dw_die_ref c; + const char * name = NULL; + const char * value = NULL; + + c = dw_get_die_child (die); + if (c) + do + { + if (dw_get_die_tag (c) != DW_TAG_GNU_annotation) + { + c = dw_get_die_sib (c); + continue; + } + + name = get_AT_string (c, DW_AT_name); + + /* BTF decl tags add an arbitrary annotation to the thing they + annotate. The annotated thing could be a variable or a type. */ + if (strcmp (name, "btf_decl_tag") == 0) + { + value = get_AT_string (c, DW_AT_const_value); + if (!ctf_type_exists (ctfc, c, NULL)) + (void) ctf_add_reftype (ctfc, CTF_ADD_ROOT, value, + type_id, CTFC_INT_K_DECL_TAG, c); + ctf_dtdef_ref dtd = ctf_dtd_lookup (ctfc, c); + dtd->dtd_u.dtu_btfnote.component_idx = component_idx; + } + c = dw_get_die_sib (c); + } + while (c != dw_get_die_child (die)); +} + /* Prepare for output and write out the CTF debug information. */ static void -- 2.40.1