From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 17E133858D28 for ; Wed, 28 Sep 2022 21:07:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 17E133858D28 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 (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28SKcs6D006884 for ; Wed, 28 Sep 2022 21:07:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=message-id : date : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2022-7-12; bh=rZZc1CIQ0e85UYGp9h81jK1M/d+pU2d98UWgFnagqYE=; b=cNpOiDbtJtBhUg1rb497OXi5NaJxyLW8uz/yc8fBis2gUPBD/4VLCtgXbxEAEkLLcVTU t1uNCHkZkV6vZ1Z5ArAWJ4HubJSL8BNTtmjSZ/2bZl8wpMUTbg21K4IZKMYpAR3bQqP1 sdF/04qqCg4jkWinhbcqClaJ8CM8GisRTPgPRoA1EbbxoUnuEDJipD57gfSyWrCIA7s/ w7W2+YQdG1Sh10L+s2QbLeFWyW50HbfMTM8TK7KWw+jVqiJaIQOzJFMaHmTztAY9K7u3 tdkMlL0G7NnPDIgBTgTbHeOnM4S0xkWPJetvjpXuQSmuM3Pcc/OutFclJWeKB9c6kUrk fg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jstet3dhm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 28 Sep 2022 21:07:41 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28SJOca2033541 for ; Wed, 28 Sep 2022 21:07:40 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3jtpv1w1tv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 28 Sep 2022 21:07:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gTLC583vgma1vVPA6nIU3rVDUSsmtpPojhhHFYoBZGO5ByAvIQ/TqNMDRDR/tN/O6r/C4c+b5uU9a6uE83YLABv8VDqWDOfrBV+WLqA1pvdM07f3HoqaS5YVTPGasXVlKY7v0YGYYu6wQy50ztG21MtSEPDzdZaP07bbJflllCa6QjWny+RXM7aHsl3gB4F8F4gNsDvXTabZgzFd2jc2ZOoGZ9xEtui7rF+RxDRx4ZvaPtalZLrFZ+uJ6s/UKM8vSR2yZR3oHcGj63NUHmrNB1B/AzR4XH8BdQh9kMvzD0xj4ZCZiN+cpjJthIMhAJFkykzKTjuQr/ZeTvg5jfqpVg== 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=rZZc1CIQ0e85UYGp9h81jK1M/d+pU2d98UWgFnagqYE=; b=VlNZBFmOUNUU3CfRvXJkIgf/JVchwvrCKh7d5wTLjv+J2xpIvMDq4DbYMI4qb6sUpAb+e0UCZ6FA2pV2pDpJ1CSk4MxyfSn/tFA3V8um1SSrBQtdjrEtAfg51EO52r+rJ9dV9tYnHsUWr+stz1UXzvSWrcE9KGY4cowiny4m6NoTBHYwWlgHCL4GP0s6LMeDHeNLfLbviPjZdGwe4xrVBl0nNTsl+PIUYgjYrssIGrcrwI3WGPOY4MnsfYk1K6eRad2kL5TRw4ltKleTnR8VhlskwZCXjAjnALgd1Elz8N4btnzv90Z9DL8Oc0Ke0dTDrQnLdyL6+lH/mt+ALLGWSw== 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=rZZc1CIQ0e85UYGp9h81jK1M/d+pU2d98UWgFnagqYE=; b=N/NVZ3eTQALlfLEBMFhT+TvcbXnIKDjN5kMx9hWyhxiPXJZlI6sOeNb9sLClR7Cw5ysjeTGrz5mPalpy/0S2Qu8hNnyF/MBhw8XpZzXWx3pVrvLjWuVGXKPFIdrvh+dTPgxDaoKFaNG9FjegH/TKFKk13ogi9zJokjywrU5nGmk= Received: from MWHPR10MB1407.namprd10.prod.outlook.com (2603:10b6:300:23::20) by SJ0PR10MB5720.namprd10.prod.outlook.com (2603:10b6:a03:3ef::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.24; Wed, 28 Sep 2022 21:07:39 +0000 Received: from MWHPR10MB1407.namprd10.prod.outlook.com ([fe80::d05e:773d:2a05:eaed]) by MWHPR10MB1407.namprd10.prod.outlook.com ([fe80::d05e:773d:2a05:eaed%2]) with mapi id 15.20.5676.017; Wed, 28 Sep 2022 21:07:38 +0000 Message-ID: Date: Wed, 28 Sep 2022 16:07:33 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH] btf: Add support to BTF_KIND_ENUM64 type Content-Language: en-US To: David Faust Cc: gcc-patches@gcc.gnu.org, Indu Bhagat References: <20220829211106.427267-1-guillermo.e.martinez@oracle.com> <2debbcea-96b5-f89c-191b-5787bbb2b048@oracle.com> From: "Guillermo E. Martinez" Organization: Oracle Corporation In-Reply-To: <2debbcea-96b5-f89c-191b-5787bbb2b048@oracle.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BYAPR02CA0014.namprd02.prod.outlook.com (2603:10b6:a02:ee::27) To MWHPR10MB1407.namprd10.prod.outlook.com (2603:10b6:300:23::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR10MB1407:EE_|SJ0PR10MB5720:EE_ X-MS-Office365-Filtering-Correlation-Id: 6002b246-6aeb-40ef-dd02-08daa195797c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: X414Qe2oFpWwTIn9+wN7P7lhBbophjoFZYaP2d0KhDEtv1UBQksbkDXEL2DmJz04gvjnS6mr9O7Apgcd1DUy7f55bl5VLZ3Kc+SxJpsUbYfTuwDNOUfuuNP++/ubVGNvU8FMEQk5FoC6D6kHOjnQ4Ju+D7eF301DqMao3M3VXUGL7h1ogIJDQg3mcLdFW8omIjozRPCK3O1im1P5oSHLwIF9qq8opnhL8pBopvX9gmBYNrZZCOUjI/q/Hk/qbW4ed0I9kV4b1YCFE1zAp13WhmQd2te/dexpMLMbtC9TiF5FLquuuXoBkOhfIVZwJjGmq1CO9Q4/iQo1Cv+zY6xTh4g122/Zl0yasjxIPABhk3eQ59/Ti2XAkti9I3QF9aA9NHWLLo3v5qZ+vsRaYxB+oGzx/SHVcjBgzUr8ZjNxvHp3dLjN6q1PZNsbIb543CIKnyeQLqpUYBo9QDyQ8iXkTTAFZRgEPRIHvma5T+oeOZ0KH52NvUBYqxEuGS5mnTs64lm0/nUV9nQIIW7cFQ/Hl3NAdLC5InmjsD4C2bAEYYAo2Tq78uJkBXaIGVFk8sNqcZGJqi2GgSiipPAh/4Ilhpmzjd1piEpnyT+9KOxZm0NokwJHyhHjHRbzpE9m/OHsJgWbcvWrLecPZ1Sy91DGDuL7xVYKLFbtBiYEptowx6ehZv/5KKcMu1lnACkSjv+TbjDfEsZ/z9lvaEriXJyn5yT3eStFQr/Gwu5N5R2ovRjAtfMADdMNXxs1Y7xn/pjUATAm1j13+2yrrmR7q7zvh+MFD7LKvn79U2Ljz2z8E49+uq9wy9h+XZnfcRDxYv+vQDg3048lrOanNB15kHCoP6yF84c7pnecc2vaGcRtuz2hpn8HIgI8HatE/bAKbXZF X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR10MB1407.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(136003)(39860400002)(346002)(396003)(366004)(451199015)(84970400001)(6512007)(31686004)(83380400001)(8676002)(86362001)(38100700002)(36756003)(66946007)(66476007)(66556008)(8936002)(2906002)(4326008)(5660300002)(316002)(6636002)(6506007)(37006003)(66899015)(53546011)(36916002)(2616005)(478600001)(6862004)(31696002)(6666004)(41300700001)(186003)(107886003)(6486002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?dkZQV0FnR3hTMGg3dUpEaGlZWmh1QWhLOVI2eXhvUlFZenlGZFhSbXdnRUZG?= =?utf-8?B?OE1BNFVzbEl6UUNkVlpVdEg2aDBJTEJwanNZeXFvTXlnYW1TREljMDZxcU5I?= =?utf-8?B?QWYzUHFFc0ExS2lSOHRWckoyL1Nt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=?utf-8?B?aFhLeTFRRklRL2orUVc2QkdMNlA2cFgrZVVDUm9jN3hJRmlLbGRVNi81V3dC?= =?utf-8?B?dkozNkpIY0crM2U5WUdEc3g5U2lYNWZuQ2JVVUtWaWI5NXlvN3RxTmQ4amxm?= =?utf-8?B?RDlRRmFVbm9Vbjlyb1NhYkV0NmwxYUpxN041VUR4N0hKaFNhRFg2U2JRWnhD?= =?utf-8?B?VnI3K2NGc2Jkb1JDWENnejF2UGl2K3VzY0VUdG12amZhaDVqd0RYL29ralpt?= =?utf-8?Q?HD+FsG/ycamp9PQPyH7uzxQsj2HNaNM0VANMt9gSrhv3?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6002b246-6aeb-40ef-dd02-08daa195797c X-MS-Exchange-CrossTenant-AuthSource: MWHPR10MB1407.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2022 21:07:38.8646 (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: uizKTEMTlGbB3r4OIu7R4dSvVPKPvky+0k8/5mmB5PrYotlbWzHe98695q/tlt0tv6XnnU+g1ipptOlQ9ujEFZk0TJbE5+umzob6fdywdfY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5720 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-28_09,2022-09-28_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 phishscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209280124 X-Proofpoint-GUID: Wv7pZN3ZREaipJeHavRQ2SQXUrmMIKd6 X-Proofpoint-ORIG-GUID: Wv7pZN3ZREaipJeHavRQ2SQXUrmMIKd6 X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,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 List-Id: On 9/28/22 13:45, David Faust wrote: > Hi Guillermo, > Hi David, > Thanks for the patch. Just a couple of small nits on the changelog > entries below but otherwise very nice, LGTM. > > But, please wait a couple of days before pushing to give Indu time > to raise any objections about the changes in ctfc/dwarf2ctf. > OK. Thanks for your comments!. > Thanks! > David > > On 8/29/22 14:11, Guillermo E. Martinez via Gcc-patches wrote: >> Hello GCC team, >> >> The following patch update BTF/CTF backend to support >> BTF_KIND_ENUM64 type. >> >> Comments will be welcomed and appreciated!, >> >> Kind regards, >> guillermo >> -- >> >> BTF supports 64-bits enumerators with following encoding: >> >> struct btf_type: >> name_off: 0 or offset to a valid C identifier >> info.kind_flag: 0 for unsigned, 1 for signed >> info.kind: BTF_KIND_ENUM64 >> info.vlen: number of enum values >> size: 1/2/4/8 >> >> The btf_type is followed by info.vlen number of: >> >> struct btf_enum64 >> { >> uint32_t name_off; /* Offset in string section of enumerator name. */ >> uint32_t val_lo32; /* lower 32-bit value for a 64-bit value Enumerator */ >> uint32_t val_hi32; /* high 32-bit value for a 64-bit value Enumerator */ >> }; >> >> So, a new btf_enum64 structure was added to represent BTF_KIND_ENUM64 >> and a new field in ctf_dtdef to represent specific type's properties, in >> the particular case for CTF enums it helps to distinguish when its >> enumerators values are signed or unsigned, later that information is >> used to encode the BTF enum type. >> >> gcc/ChangeLog: >> >> * btfout.cc (btf_calc_num_vbytes): Compute enumeration size depending of >> enumerator type btf_enum{,64}. >> (btf_asm_type): Update btf_kflag according to enumerators sign, >> using correct BPF type in BTF_KIND_ENUMi{,64}. >> (btf_asm_enum_const): New argument to represent the size of >> the BTF enum type. >> * ctfc.cc (ctf_add_enum): Use and initialization of flag field to >> CTF_ENUM_F_NONE. >> (ctf_add_enumerator): New argument to represent CTF flags, >> updating the comment and flag vaue according to enumerators >> sing. >> * ctfc.h (ctf_dmdef): Update dmd_value to HOST_WIDE_INT to allow >> use 32/64 bits enumerators. >> (ctf_dtdef): Add flags to to describe specifyc type's properties. > > typo: specific > Fixed in v2. >> * dwarf2ctf.cc (gen_ctf_enumeration_type): Update flags field >> depending when a signed enumerator value is found. >> include/btf.h (btf_enum64): Add new definition and new symbolic >> constant to BTF_KIND_ENUM64 and BTF_KF_ENUM_{UN,}SIGNED. > > Missing an * here for include/btf.h > Fixed in v2. >> >> gcc/testsuite/ChangeLog: >> >> gcc.dg/debug/btf/btf-enum-1.c: Update testcase, with correct >> info.kflags encoding. >> gcc.dg/debug/btf/btf-enum64-1.c: New testcase. > > Likewise for these ChangeLog entries. > Fixed in v2. > You can use contrib/gcc-changelog/git_check_commit.py to check the > formatting of the entries. > Oh. thanks for mention it, really useful. >> --- >> gcc/btfout.cc | 24 ++++++++--- >> gcc/ctfc.cc | 14 ++++--- >> gcc/ctfc.h | 9 +++- >> gcc/dwarf2ctf.cc | 9 +++- >> gcc/testsuite/gcc.dg/debug/btf/btf-enum-1.c | 2 +- >> gcc/testsuite/gcc.dg/debug/btf/btf-enum64-1.c | 41 +++++++++++++++++++ >> include/btf.h | 19 +++++++-- >> 7 files changed, 99 insertions(+), 19 deletions(-) >> create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-enum64-1.c >> >> diff --git a/gcc/btfout.cc b/gcc/btfout.cc >> index 997a33fa089..4b11c867c23 100644 >> --- a/gcc/btfout.cc >>[...] Regards, guillermo