From patchwork Thu Jun 13 18:54:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 92107 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 81B52388267E for ; Thu, 13 Jun 2024 18:56:54 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id E638F3882059 for ; Thu, 13 Jun 2024 18:54:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E638F3882059 Authentication-Results: sourceware.org; dmarc=pass (p=reject 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 E638F3882059 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1718304888; cv=pass; b=KLdAT7XJDZyWf/TO8/8TzcSDLisXX0QTWmdZ9a6dTOpBOiN9EGCdx1e+OMaHt1GhBXQdu7/e9cJozFexmmqwnC5MUumhHl5Gsns/uSGUvROOD6j0B0oN+POZtcZ5B/4O0qP8KuVA3XNmtYwKcJ5PNVpa2BwnxdNsoRiZCH++H0I= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1718304888; c=relaxed/simple; bh=swdExyHeGCl6Xo+JB6RqaLZoFfqfEFsW3lxO7DlvWOk=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=dUoiR6AzI0eT2eW2OiseQ7LqUAxhdjNr0fhjf1yFWiHMphEu/MgvFduoLENlnnkK3s/D85GVhUH4SClcc4hoBsNDuid9Hh8wv1tXxOH6NJg3k8ZvMlykFRNF8T+dshKeDpwVet9uddLsMxbo57RJzfd7ilJ1eIDUJ39z2CIiqlY= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DEtTBK003182 for ; Thu, 13 Jun 2024 18:54:46 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=50rFjeR+8/mQvuSLJlQwI9KthR0C1HvqSPsihxWYh9M=; b= giTho2HX/D/XjQJVykVI1SL91AzYBfN+Kc+gmoDSp0Z0kHUHRBptPHht++l0tcNs xxT89W6t1UU9gHMRUXmwmNBf+LgGnW2vxj3MOoRVXwAdzCnWuwSht9+ctK0Xcpoz x9J6/VoBuUp01tDSCHrALEKd8gQR4oxxmg37BI4vd8FQjvaevDG8VQhXvAaszXAP nKNwJB8Ij1E3cXP1Id8ndKvupJyXHTV6aXeblcZ/P67SwVx6/kX6Wsk3vprR/sPH CfXOWtsC1meU4Q6YkLEQ6HQJef+P12NVBnimCd2+7z5Hf7yIUizxcJOPE4Iv0jWF OKq8tgLBgq0lH7ObhfS/Dw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ymhf1j8eu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 13 Jun 2024 18:54:45 +0000 (GMT) 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 45DHPtQR020372 for ; Thu, 13 Jun 2024 18:54:45 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2045.outbound.protection.outlook.com [104.47.66.45]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3ync91kh4p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 13 Jun 2024 18:54:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hpaR4Q+SGajaFqlLZ8QCV1gsEnEiz82TI5mygOKERXkmwqisbRpxQ4k8k/eZsctzDz/w2GmtQw+Eaa323q5HCVjAaNGlOiCCtmgwRdZgwo593J45HF4b9fHhx+IHnKuidwZvkJi+g16hnXxomDRe0y0+RN+/G+PSJTQJgyD+t5NYuSDmBSyM4LghN29VA7gzbxPJVW+RmexCbOVC8KPqoNLLPLbi0aCqQaQLEv4PpoWKBvTwFISfNirr64gd0mn4DL4Yd+A/Ubx8J7tnmS0nOXY2Eb+yHg8xWCaXHVt0BaLSNYnA6NtUrM1DDYvqRL5kUxbWe4K/EZqGB+e6epgw0A== 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=50rFjeR+8/mQvuSLJlQwI9KthR0C1HvqSPsihxWYh9M=; b=eVuMV8ojxQ8b4J3Wr5ArQ4TUv5tCsAFuwSR1ZyTOn2j3ovxGoxCrrNdMU5GNH2CGnaqGD+PRwTpLzYz3r3RNRuEJmhCkvx9S8/JyT4kAwAMLlTgAjmf0RRxk5UCnRQRnFGsDJ1MWZDwZaewNZEls+mXsocY/gEq3hC4V98JuY4c7aXsP0/NvPzCUM+LceXuIvFhkwNCaJCvZY8i2BOtVe32rx7Nt/jOn9Wp7YztQ0kdv72zzwApyqH7AbpSWmmMRA2clbS8cUkHJnAOo3h1J14w3Jo8NuaFpcYN2i+ccpAPHK7/nOmBc6CfDp5JKUjNp0/wHfhEY31s9U0ImGl3Qxg== 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=50rFjeR+8/mQvuSLJlQwI9KthR0C1HvqSPsihxWYh9M=; b=niRSEVX7WTb0r2dif9MdrDF3ZKv3xyCJ5Pd3FlIAybyrWdmh0apZtg/jJNnvXGMtKMLm9pA8koSyYiBMYMelvvgC5iHA2Vx/BJhnrGNzQPAVp2jQpybqsnaEhAGKavSpTYC/CXwNsWtP0tazyyb82SZJwtExZb/j3mJDgIT5qdc= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by CO1PR10MB4451.namprd10.prod.outlook.com (2603:10b6:303:96::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.20; Thu, 13 Jun 2024 18:54:43 +0000 Received: from MW4PR10MB6608.namprd10.prod.outlook.com ([fe80::b53a:ccc1:c190:c5df]) by MW4PR10MB6608.namprd10.prod.outlook.com ([fe80::b53a:ccc1:c190:c5df%6]) with mapi id 15.20.7677.024; Thu, 13 Jun 2024 18:54:43 +0000 From: Nick Alcock To: binutils@sourceware.org Cc: stephen.brennan@oracle.com Subject: [PATCH 01/11] libctf: strtab corruption when strings are added to ctf_open()ed dicts Date: Thu, 13 Jun 2024 19:54:20 +0100 Message-ID: <20240613185430.85352-2-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.1.275.g567cb0950c In-Reply-To: <20240613185430.85352-1-nick.alcock@oracle.com> References: <20240613185430.85352-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO4P123CA0282.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:195::17) To MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR10MB6608:EE_|CO1PR10MB4451:EE_ X-MS-Office365-Filtering-Correlation-Id: 27a31a84-6b75-4e52-9d65-08dc8bda495e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230035|376009|1800799019|366011; X-Microsoft-Antispam-Message-Info: 4sdr+ohS+bGjJqa2/eFYcGox1qDQdDecJAqYYXaKYHx436Nlexl/c/xamICZKGK8BhOqCczNGU7h8AKnDEOBYFKsAUcFY4/TCQ17EkRh0Vg4t3id7121TBUzosQvP7YmXsp6R7WLgrT96PaRCZ8Q5DbKXTZpCzrfrnJ5UPkQtDTNqDGVdM+deSJ/+aftWjs0zxgxq4XPV40OilBafZhYykskuPSl6DVS0FQ1zCAhKfuO6w3WBeyPwAaU3EJ5hfDX50CXzRgxnlndWrsRNIKsYghPyODYzmP+6zJ7gMDgZSHjZlzOS0v3G6lKbxcX2MJb82ZSNi09i2AdqH4ulRI61L2aO4db/iDGb3cpDyWHhCsD1hfYROEq5NsXqIFqP8uHLVxtG8SHdroktEbcUizDV4r1WNGRURLP1hzmAZnwZX20+3T1xRU+gDg3MKqX0ekWz34Mljn0vuFD2WTV8uNmeQ5HpgRvIMGWUNtJ5BZVOtsFV5UOASnJaVAMYyg/5JpTXf65rUflnGA6fC9tZFTI7FvTCPxTcpn2NrO3RbPs3TgmQ64OND4N9q/BxvaFoyvpDb2NV6dc9bLO8ROonTcSvu3P8RHYVyika3AbiXFoaV/jDByOUWGpWRD/1me51MkBcgmYt/lV4/T7OTmUnwWvYxKb7oz1ioWvC69KTtbv0O75aWrfUj7ioErlynuVvh7NWoW4G4wdEp3G6+xZ/BHWSSy0gp0Fzloa47pZn+8fksRp9HpN1K1fPdLxK+1VZFuSAA/app73cVsem6V2dxsTBM41NQFA6DBFwsMscOwCBm0UwECLMPzBpD1NPk6xpvH/ZBdnSdUsXbbDOXkDdEptKqjQxjRnt8GwUKtYBGf01bMkihLnUgOXUK2R9eVdFf0KEQUKUY0AUofHMsZZLIlexHHeXx9KLhI+2HWk4HYAo/eEW9y/hdgw64K5iaKaBFVx7DiaTZ564ZXL7kYwT9I3yMePDhhl0/EZYH/fC3R7uSvIYBSTCtyT7W+ouv4PZzmVkb4J+ylcIL8KiAlWMI8T75eBfKBhqK0y5jvWdg+IfRTwG1ZQsVvhbl29rWVH0oP6yDljVO8c4WLrfKVqOQAnsTZYRfqJMuMm+Sw5pUXtLffkoZuJ+Tww5tq6V+EAYRDrzZ2wijZK5m8AKi+TtJQnuE2UsN656Zhg1xve+MA3LqDEKsA7kjN6Ovz071kxVV9T2M8IKgP0sJZfWJ4WOERvt+ejxeVJR/5yEAVd1YA6DYpwA/SBdTfZLCBmr8aGybG93jU9fzcUhdsAEVSUaax+Jw7kjxY5R6Jb4Gc6+rQwabkj2sQ7bRnbYWSleRVsrhFJ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW4PR10MB6608.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230035)(376009)(1800799019)(366011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fky3KYhwW8bqS6tZAqPuIKAlE7xlzkdDCjmyIWzIc2FWZJXqkf1XqWSz2L7ZG1v8hokXxWfh04/FDrl3ILwxFRGQTYT7uFpCtogOffvZTkQMyyqfL4jgL+1a0T0Ku8MbdSNLzm2DZta3M1qJ4GXdUOTAiE9UR6G+KKCZK23ebRlcaxK4wL/zT0dWupsNRah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qI4BEs5cQiFq0Ol/QrlaZVlXuXhgsDZG/NBrxq8bABKm6Hf2gxsxciReiWyPIC+GUJqlbHZ+NpUgruxOxYW9mtUBJ3pDSinDMVSxvg8SeDvOZB85Z73wM1axB5OvEZAfwMCyKJmydO3cez4Ch0V3QKNr/l0+ExEQw933luKKbKLjM10sFyl9wQoR4NcpavfCbDTqjuvxjyG3IPd28GzVwht98EbZi2GgFGSH7OgPsgohOICUFG6n1nTTQ+t6ugy6UIhNSmDg2d+XoJfVJtkuVjVMiQNiSuSS+LowO3iAwvdCwBryY8+M8xkCLIRmfa3ne6FQUIkauDd7XpP+PmG6He22A== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 6xiew20UDYdimCDv1/39KPJq8nX6qrusADngeupQCtgnBdctIvONuB9/e6bZL9khnWFCd+zf/UDMXH7LoWkl/X8oeGYLqpuz7K0rIk/4fhE919WtXKPHChlKqkk8oVcalOAeg+LssLpdnlVi6nZMwzBdrUowXo/akmQR6d+YJrDvoZo2TkpNzFfbtyTD7qwTSbC0XhrP0uLlPpoEqWBogahZ+uNHejrRsdrWjCtI2cj70lw+vTLbP7HdYr2Wd7xJE8mYHp4Oir6xJeD3tBTMSBFZSMnA+k08/86VHOcGfFkrjj2+FcYo+qhyhcqWvcGs9/BVkggLeltuTlD8A8fcZhNzgOfzmFRNAcz2cgeg98WYMDIiD3i9CPD2ClqZS4owh7eQBOvSwWYM41OKfmD85wTodxSbEnEOJu7dTXj2YC6oIY5S/tbTCJ28yD+Pz4+k8Hps3gSPHv4koxZFFLysmKpNX3CKvozF7p9NJ13nHrOfLkM8D8VJfTUdD1FLwQr8wfdF8A5JOeG1DqenKtCl3iOadONaGVapX1jWQKhAryrN2tQVyLx5bGJiDyqOFRSXa8/DJxTfiFQpO28fiKLuNNrs+OMhCLCFiaaB1lNTwCI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 27a31a84-6b75-4e52-9d65-08dc8bda495e X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2024 18:54:43.1925 (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: tny1v76dYFgysgsUluL9j7YMGxycFHSvM14V1fdG9vuzwKpnXJwEaVIp0jBqLdeNFXi83bZvygsBGGiy/XQmKw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4451 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-13_11,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 spamscore=0 phishscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406130134 X-Proofpoint-ORIG-GUID: LVjrepUp6H7QKfMYHIUPt2Dr4fsx3YC- X-Proofpoint-GUID: LVjrepUp6H7QKfMYHIUPt2Dr4fsx3YC- X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, 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: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org ctf_str_add_ref and ctf_str_add_movable_ref take a string and are supposed to return a strtab offset. These offsets are "provisional": the ref mechanism records the address of the location in which the ref is stored and modifies it when the strtab is finally written out. Provisional refs in new dicts start at 0 and go up via strlen() as new refs are added: this is fine, because the strtab is empty and none of these values will overlap any existing string offsets (since there are none). Unfortunately, when a dict is ctf_open()ed, we fail to set the initial provisional strtab offset to a higher value than any existing string offset: it starts at zero again! It's a shame that we already *have* strings at those offsets... This is all fixed up once the string is reserialized, but if you look up newly-added strings before serialization, you get corrupted partial string results from the existing ctf_open()ed dict. Observed (and thus regtested) by an upcoming test (in this patch series). Exposed by the recently-introduced series that permits modification of ctf_open()ed dicts, which has not been released anywhere. Before that, any attempt to do such things would fail with ECTF_RDONLY. libctf/ * ctf-string.c (ctf_str_create_atoms): Initialize ctf_str_prov_offset. --- libctf/ctf-string.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libctf/ctf-string.c b/libctf/ctf-string.c index 0c5bd58cdaf..2d96e45617c 100644 --- a/libctf/ctf-string.c +++ b/libctf/ctf-string.c @@ -195,6 +195,8 @@ ctf_str_create_atoms (ctf_dict_t *fp) atom->csa_offset = i; } + fp->ctf_str_prov_offset = fp->ctf_str[CTF_STRTAB_0].cts_len + 1; + return 0; oom_str_add: From patchwork Thu Jun 13 18:54:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 92105 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 D5EA53882643 for ; Thu, 13 Jun 2024 18:55:43 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id B828E388215A for ; Thu, 13 Jun 2024 18:54:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B828E388215A Authentication-Results: sourceware.org; dmarc=pass (p=reject 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 B828E388215A Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1718304893; cv=pass; b=fOD7aph679e40B3+IYEJaC/f4+K+BksT+uX/2/+gEaEe1w+ApUImj9amlgc5JU5aocKO8q81k49BFkKSRSocsNXbC3ihnVroHPB4SwAgQby9Y34b9Uj4ezmn3SDcw5nscJCtX7Zm9zO0qrsvOnKbzKfG8RFO9wSDziHfv7kvOio= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1718304893; c=relaxed/simple; bh=W/R4nYEVJKpVdSbfC93gUsAFN7GVrmlJ/a2Q/qZg+H4=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=S6grj3OwHPi0IoxzNWXFkwfvVPHFo/lZ3DpvilrRw+HM58VtgJ26Gw7NlQMZNPgnAuliGvkGroJH/2dZGXrI/tRQ/0drraslgRQvF7PKNajbd4D/QlZ2oe2l7/pO3/Kw2q4OcO6VAiG1FGyKD9mfI7vEDX0zv2NWZjSPuvT6ffA= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DEtTqB003178 for ; Thu, 13 Jun 2024 18:54:48 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=gNrHvyMF7NpRw1JZuPX6J96kxOlnKUiDloaRhxT1rv8=; b= V1eAGyO/1Z30hX56cIYNxvctRDkGv3bdh9P8+wpVmIk+Ia3p1++QOLVvXAp2Vf1G SRqwufMbZdJ8xa4raRCK9X+vUZ19QRGHswg9R8ttNzd/0KVdcXs8ExblzexErL2n m2KWUXzv5SsHiGFHn8Tayez3lGu9OqYLeIzRx8cxKN+sjYLCVEQUo9A2vd4kBYWV vGnc7Vu7qyKcwBqbTBe0CLMZcPfvu7iIZCKj1sJq/O1EYCnamdDSneMf9HUPSu7X 9d3jnETfQsxRioxKvxoeLF316J/akMtaDsZw1uAm7MUn9xock5Orvqf1ch1cAMoF KdYjOeObRMS14xUIAGZBjA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ymhf1j8ex-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 13 Jun 2024 18:54:48 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 45DI7BXG014230 for ; Thu, 13 Jun 2024 18:54:47 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2041.outbound.protection.outlook.com [104.47.66.41]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3yncexb9jh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 13 Jun 2024 18:54:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ElfLDy68t0/I3B49DQuBSwHa7S/1V8PiPOx9w8VmauIMrhqDUxkHab8M4GYoe8d9sD7SDSx0y3RqTfka6QZwzl0kscAm6Y7Rvm448OEF0ZyNwoFScGY5UOE3Pa6ylbGqB8yFn7+qmjq0c53eb5QgDORPMXJKGwafHkC7RkStshJmDHjgh64YufEKWiBQUpuO1NojDxtXVAk3tNKyQlXdhh4qIa3cbcIzAypP9/pBnIT3K9RvRcOkwsZGJdTlvcgyjDVCH7w5QPSPGpCPmbQlqh6Vf7fkdBXvy1HeRAD40Qk4J4eqRUHOmGMWafGTp/hNIdyE9y4I03tBFxxx+9UBIA== 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=gNrHvyMF7NpRw1JZuPX6J96kxOlnKUiDloaRhxT1rv8=; b=BvR4Y5l8Xtx6Sq0HB9TQ/qwUbtrlQMTmqGb2PZlY3O+cbC02/Cs3mN/YKa6peXNLfho9p6tRAxl7KNZIHPezSGATmdX0F3GHkdtRbNont7N1aI+hVvx7nKmkrCiTrzdvqXJEyJmt47boacLbJU+Plg0OtuF7lrenn2ijNLx091f/jXaEjUb/oApALUs0du/dMnJaQF/F6l2lac10Pl2ueYkpSSs53/p/itgH6b3r1l37Lkv1C92tcO4oe+iF7SU37vSWaHBzwSCoHr9xA9ie84ZXOOSij3Gb5RfIEiXLQYsHY0OKePKMgpFLJocOi2d6nFCA3dOlaOFL6RXea7ln+w== 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=gNrHvyMF7NpRw1JZuPX6J96kxOlnKUiDloaRhxT1rv8=; b=fsUBbXQ2dwi3VEzFpVkFmLPxoAgrBdhy9HvfkZnN/zifvBo94r+OA10D4TXI2R1QjQJvUQ/CnNMqqzgySC2bYDjbWL7hJxJIe6Yqz57DZLJ6vc2zFohWUWQSb6cVjCbHGIrhaC7EYyfhaK2hdi9rCPbH7VBLvkpkrgvdmeKraDE= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by CO1PR10MB4451.namprd10.prod.outlook.com (2603:10b6:303:96::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.20; Thu, 13 Jun 2024 18:54:46 +0000 Received: from MW4PR10MB6608.namprd10.prod.outlook.com ([fe80::b53a:ccc1:c190:c5df]) by MW4PR10MB6608.namprd10.prod.outlook.com ([fe80::b53a:ccc1:c190:c5df%6]) with mapi id 15.20.7677.024; Thu, 13 Jun 2024 18:54:46 +0000 From: Nick Alcock To: binutils@sourceware.org Cc: stephen.brennan@oracle.com Subject: [PATCH 02/11] include: fix libctf ECTF_NOENUMNAM error message Date: Thu, 13 Jun 2024 19:54:21 +0100 Message-ID: <20240613185430.85352-3-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.1.275.g567cb0950c In-Reply-To: <20240613185430.85352-1-nick.alcock@oracle.com> References: <20240613185430.85352-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO4P123CA0358.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18d::21) To MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR10MB6608:EE_|CO1PR10MB4451:EE_ X-MS-Office365-Filtering-Correlation-Id: 94becffc-f386-4c73-ba80-08dc8bda4b27 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230035|376009|1800799019|366011; X-Microsoft-Antispam-Message-Info: ts2qdWXATnVPmizBym+fIt2ZcTRa4BqtAVr6Dx8Fz34nvAh4/FyZJBzMkZHAz4QwPznmOzLza0QB/P+mtP/40JrjaS0JooLQp1BsjPSTzHnVvWguxDZpysadJPhC8eAfDVkgVjPmj89RxQnc0SAFah83AAWGsXb6k4Fgh+U1hMDH066XJTkiuvGIoBAESMoY13tVWbVYgbKhrZEq0HkMZMQTBlRuUDieA+vvpOISewwZrIcBWl+l5hTPdmGfd1Lf+thptgzyXDl/enaeYC6OVbOVAEBxIzgj6BApp/kLmzUWVBAUW3P6IPhZfEHdr4hnZFELjYq2CVok2GNO8pLgLH4bzUBIcxqO1p+ygR/dKY25UAjLXOoehBzjxX5kwO5cC0jwltxTCduTzv0LmbOdaU3HDXlpDzRLkozT7HYOV4NjTHEYnGwtoAtzus+Sr4vJpVVzVPvdWG1keqOofGn+iLBmCJSPbmW3cLSIgPlztSyaxzNpsC0BU9AVp/Rm0W0HHaIc0QunHaFATd/7o7E8maQLVMwqreHZjeS9yKr1wpYBjArs4OWFek3SwMtwAurpMBdQU6DCPp4XmRnULjVS71atkyOBbDf/+qJUXLa8irMY5a79UjgzKRM2t4CixE9cxiFTb8aGu4Ga9/1lNa96A7MnXs5zq1mJtaYMmMLSzssA3h2ogVZktUH4+2L9OAojb6mXXmT2lhWDJ8/MK1PfiRdiAOE4B2hnrCkIiMS/v6/VFjasC4tZy8F3wX5IjwLeEKo7SAtnPgyE3KXJ2BywEc6AeAwU+ewwgfXJVkJjVEdzy+rmcxVl3UTxlBtJ2DAxtWVLbOQAaOgN9Or/zmFU82OiISxgou63xL8jyqcqlC/k0ALceVWiylpbDaliEa3eAitmVmXV2tF9Df+k02NV7JYIgbKl3dYbmLT+20tMXIfr76ORiLF3YFYHRejZlBGvYiBTy9+QJHgaNW039qjb5GXnrPrds/dJEIqEYBtxTxdSxQITQGMMfVY2IQTaigpE1Gl9mRdXObbxqG6sFWQuOnC8SGKLTarGSJTir1nrHUVq9a0WQvleljEpM3orzFUGC+cMsigXzSEdBC93T0RltKuIA5Kt9VVf9jT4GxAYBeoFY+9lQezrEiQjurIgHNKqkSVY8L1pvpVt1MItbtep/P9JUqkNvLh/8eDZE2ILi/l5tdP+2/bo+ECVdmPacE/rvJAuqvjucd/LggVrzDnt1E1vhtewtTZl5CJhWywcAjdBYYhIgQ9jw3Z5vMi4nNo7wtI/Q1XCCnYgghlDpvkromG72aTP7NTeSu/fQNhHLrIcuTrH8DAOACWzwnpuANsc X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW4PR10MB6608.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230035)(376009)(1800799019)(366011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8E1ebQS7g7jDA6STbYa6wCLdsIeiIEprpPFGm7vchSDRL0wfB2YTHeiGOZpcJE49DfgwcM7nVOfW3h7qU0E3Eio+AQ3pofiaLNo791ykQ+OO4YQrXUVGRzlYvQKfP8yR064zmzAMJBaLQB5ccOj1sTXmnH0S6dzeMyYZY/aWW4WMr8e2Gfhye7p6+3nHdrXqfLRECR2JAVveXL5sUwAj8l/k+8agjkeYxKGVkGRyYred+XgZTCe/hzQRXwql9Q3Lq+NOLi1833hXb6mwYVL8i3CCrmwea2iCLsYKMOfJ/lRSq/a2SQqeAvhrLaXmgHNH1zfYKMVdMVi6j9F/s1/V4Eugergt8x1rIetrHJYm/o8i5zl5hnNHCfdZctmumd1HyJtiB918N8sVsgoAIzE/O4i/gOksuqxTLtarGN0HfwZLC6HCEGtnDXHgGREkwwWEwzd5XBuDbDOLFsnfo+pXBGYhaJ2+zHAfiaxXdwX7qtLjHvxJzROqaGXAcXoE+P2jR3ysBgOF1LypWhzvY0a/1LqADuy9VCK7xYfPEbg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exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: w5jIDTYQRZsv98cgEew6QW8Xv0L34uf+6YDgmvNLjE9qSUG66A+9k5DRMR4Sqpuhnul+Q/GnLZsKfF+DNo26vtNKWeoH+ddUF0Nv6CK2hbjQAiSZ1FDK5el8MvQMHztc2RutuClm3W5fVxH6Q2CdAwlVa7VTqzQUgKG6om4AJIqNwItWOOy1J3SDEaR8ybWRwEKqPWbIPhrA1qu9cuZVUYDjLUUwVwvD30sumk0rNdvmHkA+kquQYc+kIzD+vr6/W7qoDIRxvb2G8+BOqH2AVMjyW4eLsueQatM1Ks5CnmQ5cwjUzKeaFRoksFhx5Mb7XV4Blu7e0ZPNvAgjhBgSLl3Q2HS8bCkW2Ln6YOiftuQeYe/DEfzFwNqbrP/njgissgGUQSzL4OEHJQOKCszgOjaxJXMGwdONQnEVxQgaC9QHzOKtmksWrnhvos+63dcByYalqmz4Z3V/LB4oR736/K0zJrrgpvpdn+WXKcpVhnv2MJ0MWN8EgP7fh7NGZmc46pkHzBufR23pgR48RDoz3LbQC1ou43NyJy8TugOlgSfsVGR2KmzLiBKn4WVzIjxlhsso4wfmE0/DyhCabMZ88e49tI2hNaDHss4PHeGcbKA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 94becffc-f386-4c73-ba80-08dc8bda4b27 X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2024 18:54:46.0402 (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: p+aXtJzujA0iWgGxC/SesonkAcfH0boiwQFlKqXJzPNAwJ2r0xI/Ocj/itmDIDY4yo/6BqM1JZk9Gujt1teAIQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4451 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-13_11,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 mlxscore=0 mlxlogscore=950 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406130134 X-Proofpoint-ORIG-GUID: _CnV6ZWABGA_3LmmjP6OmNVEizk5PqcJ X-Proofpoint-GUID: _CnV6ZWABGA_3LmmjP6OmNVEizk5PqcJ X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, 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: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org ECTF_NOENUMNAM is emitted when enumerator constant names don't exist. Call them that, not 'enum elements'. include/ * ctf-api.h (ECTF_NOENUMNAM): fix error message. --- include/ctf-api.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ctf-api.h b/include/ctf-api.h index 392964a4ac9..85734afcac2 100644 --- a/include/ctf-api.h +++ b/include/ctf-api.h @@ -219,7 +219,7 @@ typedef struct ctf_snapshot_id _CTF_ITEM (ECTF_NOLABEL, "No label found corresponding to name.") \ _CTF_ITEM (ECTF_NOLABELDATA, "File does not contain any labels.") \ _CTF_ITEM (ECTF_NOTSUP, "Feature not supported.") \ - _CTF_ITEM (ECTF_NOENUMNAM, "Enum element name not found.") \ + _CTF_ITEM (ECTF_NOENUMNAM, "Enumerator name not found.") \ _CTF_ITEM (ECTF_NOMEMBNAM, "Member name not found.") \ _CTF_ITEM (ECTF_RDONLY, "CTF container is read-only.") \ _CTF_ITEM (ECTF_DTFULL, "CTF type is full (no more members allowed).") \ From patchwork Thu Jun 13 18:54:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 92104 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 AE7053882130 for ; Thu, 13 Jun 2024 18:55:43 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 8A6BD3882120 for ; Thu, 13 Jun 2024 18:54:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8A6BD3882120 Authentication-Results: sourceware.org; dmarc=pass (p=reject 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 8A6BD3882120 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=1718304894; cv=pass; b=CqvbvsZsuICD6MrXHjipdDaLNcN8UuTYWiQOzLmgHx7JkTDJhVd2JtWkExAqCaCL6aq8ZUW5pGkcs+Kdr/5D6CRa9FJG4fS6vjGlXJC6+pm7U/+JuNkvu9Ikke1ep/CGgdFlp0wrFLV2an4r08d+RmenbtHLA9HQnGcQcTBHgTI= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1718304894; c=relaxed/simple; bh=K+3h8xZ38IlpSfBxYk5e5eS/2dCKgzbPI5NwhLjZFr8=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=vYyiEun8bNMsfYOPCsJCgytW4oj9VLU9nhqU2tnDWVamCvb4jVG3TwtZraYWHiDtp3bZ6ACJrdLrgxnK+PsCIitJ4Wlz15AYDuf6F1ZaGo6UYaRAYtjIRZiTQYXAook5RSPsITHaSeb2WSh7XdzdzFCgwA52iJ3sNj3vIhcpEXU= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DEtO7G014978 for ; Thu, 13 Jun 2024 18:54:53 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=AK2EBrUWDcP7lt4l8HlD2YWrW08U/z80B8AHipr0B1o=; b= YwML6FdHihb8oySQvoatvMHJzFsmvHsKw1E934U8lXjs3ZODsCMkzWy0orYqW5fc WCvz4ZFopoBgndWr9GvqzPFsUtpNOuqiwMWvBNH+S8TYmJMd3FBLGWv+52XGepGF y/VDEJb9wZK1d77154l2XPAIk7+b+k9abce0/tOj0huUp1FM+HHZ33277XsAxC9p yRBnw30Ypc95gIxS+7zqva9FJYFJFI+EdQoJNhjsB5e4ydNxP6umlgVOexUwgSUD qHRu0bGql0hufsQxDcR0pWsSdbruZhSQz2T/k1kcycd22uJIlsEZ1g1Xdk/jAaUK vJ9yZNm7WAgvQ+vgHPM9Yg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ymh1gjck9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 13 Jun 2024 18:54:52 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 45DI839W021545 for ; Thu, 13 Jun 2024 18:54:52 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2048.outbound.protection.outlook.com [104.47.66.48]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3yncaxx9ay-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 13 Jun 2024 18:54:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q/EsWmOHvh3vma/j0q07+psmE8jD2QW/m45p0I8/LdGg2+xZyAL/0LVpCMRDDv30FEvlmMKI0vz8Bm73WIeNiiW0Y3jhJJ2lN9GcHqRC6W/xwS/tMiBMvUfJ8A0PL2XwEGXCqb/+AfRVKwlnHHcY5Om5nPSyphUSYoYJbrPY7ho/5CngGmIBSFER4FWl4cjq/7uX7hXaqyeu/R9+nHrHgRHgXHZYynudNLMq7uoJ2m0tjc0WVq2E0x4nPV/yWkjmsUi9pYwkY2wl9AaNUNQReKYpypmevuBpwRGTyOhuRvKP4y8YpC35MZZW5vTTcxZ7+toObJ8tiXRCI4RFqPUmxQ== 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=AK2EBrUWDcP7lt4l8HlD2YWrW08U/z80B8AHipr0B1o=; b=XFlH805qZBqqL42uVRGgQv+pXOLBvyedGwaQcnx7lVZMZ7dlbDkl5uDSJ//0okcCttZtHqb/ivaVTaUpXm/w2lc8T/pnB7+dnzOsD0aXAwfTVeS9c7fLm0421pmQVougiGs/k/V1p+vgTqUDuVUgnUOK9efgovmBi/ZCqZqxHqgJwF6YXUmuFLofeYKKrT7HXPu3S7pzerjj0AGY4o8FOpElua40ne6BLzG/mzzjNqUc1Rzqll+zExkx1of2dUkkAKi3V76YbBYr19uOgCdfD53t8pIaQ00hZBevHWDXctVn2i8WQyPEBAIK1rWO2zDOu8vOQum4+EtGETaHt37hcA== 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=AK2EBrUWDcP7lt4l8HlD2YWrW08U/z80B8AHipr0B1o=; b=BFCWY3+woXa61vjzsQnbgefvzM8AGsFsNluDH4us4GHc4S1EQTQfbyDavC7TUJJ1sr6I6lliugDX0uffViavgPpykC5lzkpYOtQq2fvMcD5743m4tf36GgdxwfkWxY3y4W8f95Zu0bYXpWTrzdx9Ni6A1bZ8qIDv7nthTtLQeaI= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by CO1PR10MB4451.namprd10.prod.outlook.com (2603:10b6:303:96::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.20; Thu, 13 Jun 2024 18:54:50 +0000 Received: from MW4PR10MB6608.namprd10.prod.outlook.com ([fe80::b53a:ccc1:c190:c5df]) by MW4PR10MB6608.namprd10.prod.outlook.com ([fe80::b53a:ccc1:c190:c5df%6]) with mapi id 15.20.7677.024; Thu, 13 Jun 2024 18:54:50 +0000 From: Nick Alcock To: binutils@sourceware.org Cc: stephen.brennan@oracle.com Subject: [PATCH 03/11] libctf: doc: fix ctf_stype_t typedef string in spec Date: Thu, 13 Jun 2024 19:54:22 +0100 Message-ID: <20240613185430.85352-4-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.1.275.g567cb0950c In-Reply-To: <20240613185430.85352-1-nick.alcock@oracle.com> References: <20240613185430.85352-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO2P265CA0414.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a0::18) To MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR10MB6608:EE_|CO1PR10MB4451:EE_ X-MS-Office365-Filtering-Correlation-Id: a0fe3ee3-6892-4832-62d7-08dc8bda4da3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230035|376009|1800799019|366011; X-Microsoft-Antispam-Message-Info: oEq2FbC7SbOKmWaUvdFt5nkreozFN3dTr2FwW3MJ2WjxFBly+hPElqV11CS9xIPhUMzrBafp+iKthFkGfBzH+hrzFC37Re45nI8YK8BhLDziTQaTHB1kGp1DWYtxgtNubNS4F28BgZqV8foaqdB3fylY2Ci9tUA+31zgUVeooSZyZMZUWsv8pCxbzuGvwlp8bGf40l0sdX4A+2wPvqrBG+Ui4lOCSfK1S2zCoV7mvjvJhrrUle/Q3UDw9oSAZwlncGybV5qgOjwO3jHz8508rLi2e5ytHZ834nSboRn13NYDaWUUiTX/bVSzF/XSX5GgeTnIVMYXJ3vBL1M7TcUeADSlfHhex/Hin9nT3euvMQBe8e8jXjIoNQjGHWpjQtQy4MH9u01aCQejt0VQ2zalTTzEf8LE2m8jVNcyVGCaXfxNv1jX2PyXi50mWbyZC07E7mWspoZjxZ7fTSQNJ/tfbE2nUZ8ggOBjiFkCBlxglHHHn0RgT4tMiB6HHyPUWdo16QQ4U2nydtoAdyiiJQianW1HEzYx8VldPNR9k6Vnp7gEbh/zmFBd8eNWM/oG/ZuEN7eZL5EVxX7f4QDYLvAP77EBQZXlEkk+GNn/sMeq0cN62Jr4GKVA58UHJHRiv8eqXMDLRTsw7AKifaC2w/ab1LGAAnpaRh7keUmXyRBZvdcQrnsdr5ic0d0PpQHE/R+M6Jmtjz6IuNJU39uKo1JgsxYzWaKj/MpNdmw98tg89ntCBqE5utQ3Kji86rAdm6x+4xPCivTmKiIaZR+lu9JvX/185NZk0JTV5DEha5/Mz1bHT59AbOkj0jt9jiS+tI9dd0gHxIMJLhSvQ9TOyXBfNjlDi7GT4fqBwJn3Z+xBw/6v8JlIcN+3sYEI04OqZystDkD3YR5X6yawTFdxQ9NtRZow3cxXasrgJRhpBRzqhZC2TYYp5kSTvYtK8pk5itaxZJ3N5MMAIqFIoKEA7uGHy5VTdSBLsPd0NX8kvVgam5qophVD8ly/iltnJiPJB8QAVSNbtIha6+v39o67r+sD4QpCEOq5LPJvOhSPTpsK/LxuC8SKWowZMKyyJjOXJixyPRRWiQAey+dD3Lp0S1a9IKXIkNkal6qfiiJWKKbTbrz4pZ4ACblMz6yZx31j7SVtgO5XCc84/xNOlhElpefebUe6rTS3rbKrCRcP0sZjDxBcjHEdOEyXkkIAJkZOCyWa2Lyhi0sQ0QB5pxzs6QaM5RWWHpGOZAL56DcvUJfuqmniI1xEuGqcg46djy8sFQAARTVwvGHjKsXSgCXlFxrq+FASmpWC9IcfHPbmDNcN5wXtx9yokz0h5Sq2F144zgjb X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW4PR10MB6608.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230035)(376009)(1800799019)(366011); DIR:OUT; SFP:1101; X-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2sywRJsj4/ApFIsEeM1M9jOUkuVYbl1OBiJUUdHO8Qne8gwHHP16lhVFMNim1MrrcrAmO8ehs2tmggl4deEXMZHDscL6cswi2FeCOcsGHyW2IHA/6DOKVJHW6XC+mlgxqff2J/JH6wtap4DTjn09AL1Hy5pEjOH7l1GsmoAh9UqEsqB5P8MXidansyF+JKRfh7jUoqBSaKRYnvbsS79NWTmzbhOYu46A2O7i8uEwx0BPw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a0fe3ee3-6892-4832-62d7-08dc8bda4da3 X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2024 18:54:50.2218 (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: xiwUZuiZmA9h1CA0N8VyjZv9VGoRFOOYt40gnY0295TaISVdgiNo0BKit37el0gf8LiiW330ttX4Aw7B4GusJg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4451 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-13_11,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 mlxscore=0 phishscore=0 mlxlogscore=931 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406130134 X-Proofpoint-ORIG-GUID: D2pPB441xcNlIDTA_pfA6S9DRZH8hB4S X-Proofpoint-GUID: D2pPB441xcNlIDTA_pfA6S9DRZH8hB4S 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, 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: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org --- libctf/doc/ctf-spec.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libctf/doc/ctf-spec.texi b/libctf/doc/ctf-spec.texi index 37f84e74a54..78d8310d67e 100644 --- a/libctf/doc/ctf-spec.texi +++ b/libctf/doc/ctf-spec.texi @@ -582,7 +582,7 @@ typedef struct ctf_stype uint32_t ctt_size; uint32_t ctt_type; }; -} ctf_type_t; +} ctf_stype_t; @end verbatim If @code{ctt_size} is the #define @code{CTF_LSIZE_SENT}, 0xffffffff, this type From patchwork Thu Jun 13 18:54:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 92110 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 82BB03882678 for ; Thu, 13 Jun 2024 18:58:14 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id C1F953882123 for ; Thu, 13 Jun 2024 18:54:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C1F953882123 Authentication-Results: sourceware.org; dmarc=pass (p=reject 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 C1F953882123 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1718304903; cv=pass; b=F+fS7eEegWpoE2zEvmpFqciBicOde1Dy/V3RJwWPA38VMRHLoLt9c6vA+6lb0A/9SeC1YOR+ovITFJcnquGHIZGaNLifsiSFFsFoFDenI+M5eID6sIyLNV6RL8ilqXFd3G8eJNYrRaQmB47EwRQBQcJVfcZ42CohnUJ8Zg6Qtc4= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1718304903; c=relaxed/simple; bh=UCjV7bSgyNSas1zPj2J2gVRUNq4V0hIUQ/5zEmNI4Ws=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=jxdPwhpS13HVti8XSatBiOe8Ycdl0cZz+lveNdGYXEvBpe3Lnd6nN9G/NMUqxhkCY22bZFcCnXLJxlb/1bv1KvGcyHshlIpypXas47LXMjlI5ONTeSSB7pt1ujhe2i1PKa60zFr+3fOSYlsnOYkAspb1wdhTifF52KOZvDm/R4U= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DEtPtd000850 for ; Thu, 13 Jun 2024 18:54:57 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=L19xQOyttqruf2SIWbtU3mwatCGd1awsIQ/BnTVSet0=; b= cH6gFegkBZgzqPZh4MiQbPgcU77mNCapsUDOEYK2dY2yhB1S84s+u+J3Su73o4KM yiX81ECq4yulUCv2nEonMmyoqx1FhleGS8BBCMNiMdY9hSEAMPpU6Bg4ld/dLaFb geF0lxj/X58Yyr5twJQ94s3XvLPSTYoU2idxVUwm7ez1BaUUwLibA4dHquLcxhsI fB6sZWx+lEucPcS6/gbufzYvsem7ikxutsCGZ0h3W6S8PXKqMrINwur5BlynYs9S dWY8cL+bz5W2xTEQDzimcy+XFZkrQWAyj7P+Vtmbj4LnitvEAFug6gIYCYP6jrWU 2oVJ4x7prZIIc6RLwOOqgQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ymhaja9cx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 13 Jun 2024 18:54:57 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 45DIRcwX014165 for ; Thu, 13 Jun 2024 18:54:56 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2044.outbound.protection.outlook.com [104.47.66.44]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3yncexb9ps-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 13 Jun 2024 18:54:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jieArV9+QA1YZcW2UVuNEcG7ULlrbcgbZTDOq2v/dPnhT8O1zxBJabL0nE3ehbjcDV9Hk9GpoSp1gYvRF12rVVFBTokp9y+x5H4lDTfxiDeoXF6H4lPFQPOwQmGDO/5N3clac+Bklr7toMHsNOOILwS7C9QuP9IVbn3pEgBzZ2m5Tk1IuJyhj0P5IUxjkX7wrwmCE81T74VtyLCA/WmXFvafDO3I/lx/wap2lBxHaISNdksj//2sAFqO7/hxr9tEgyBdCmEfEeLhCuHtrLew5XZuqbXLzWb0evOvi2jLZqf44Vu8YrtMQIN6SopcDpj9OPOIBOtcBqyJRDwUQPFrhw== 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=L19xQOyttqruf2SIWbtU3mwatCGd1awsIQ/BnTVSet0=; b=d0eQGYpry2ls+LjfkMhLYjwgYVy7QT2oYoSCSPY2EDe/wGCCnLHZd6tNHni/Qhn8iUz+0oBoATqrrJUcL6JiQR6Lp164TaAKNCYdHQDsdQ4KLWQ4usToSjpfGP1V3pzDCTuEJOeNs2drpUEQ6G59ZovqDuJDnNlvATbsQlv1/MDsDlU0S0gmPVZwdabAVivMtquAjAUzMTgOuwW8TuHpaqZbc4ryryMDaYKAy3XzZn2Ccz2rL2NcTM/8retqr7y9PmKERGOLbvx7onrh1W2VYXdIMPWsObma8P4HFttrvZKXFXuL2rHmcUVqInNF1mR4uzVd9rLVNRr0vxz8Yaejgg== 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=L19xQOyttqruf2SIWbtU3mwatCGd1awsIQ/BnTVSet0=; b=C34jOnGCGhXl0CO4b3QAj10MgBHdD66TQdHfjtbu6pHyzZPTsAShJHnFf5ABuJCwVkSNhpldkWvuGZeo6JHRFo6HI83cpA/UzZNimMogg24zMBInoUcOps4YidH3/JNAPTble7GBvms9/Il9MI6cWtil9vQlygG4rKlvZsT9Nzw= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by CO1PR10MB4451.namprd10.prod.outlook.com (2603:10b6:303:96::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.20; Thu, 13 Jun 2024 18:54:55 +0000 Received: from MW4PR10MB6608.namprd10.prod.outlook.com ([fe80::b53a:ccc1:c190:c5df]) by MW4PR10MB6608.namprd10.prod.outlook.com ([fe80::b53a:ccc1:c190:c5df%6]) with mapi id 15.20.7677.024; Thu, 13 Jun 2024 18:54:54 +0000 From: Nick Alcock To: binutils@sourceware.org Cc: stephen.brennan@oracle.com Subject: [PATCH 04/11] libctf: dedup: enums with overlapping enumerators are conflicting Date: Thu, 13 Jun 2024 19:54:23 +0100 Message-ID: <20240613185430.85352-5-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.1.275.g567cb0950c In-Reply-To: <20240613185430.85352-1-nick.alcock@oracle.com> References: <20240613185430.85352-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO2P265CA0426.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a0::30) To MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR10MB6608:EE_|CO1PR10MB4451:EE_ X-MS-Office365-Filtering-Correlation-Id: a0bb1bdd-56e4-4614-0cdf-08dc8bda5070 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230035|376009|1800799019|366011; X-Microsoft-Antispam-Message-Info: YXz2ctZa5/afkMvLtt/XKE9F2mChMjr8TTv4TqB6DiFAyAeMvI17DELj2Lm7q09MJw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okp24jFT5GnAcKGJ1IZM8etyTj8v2Fdvi1eYNj8eJEPK+ElJvnqR0rhc4KZt2PcQthtHcSRX+NhVBJ+mAjnQvYaz9mCcwg1pW/OcBKSHNsyl/KO4NNenm4mn2WMmrV/2mM71gRAqy2KKqf79Kr8+SODo8pKsUHXXslaZXw86wmpDZR6hYWnURy9QJ3XBF0z1Trzbu6avY1nr X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW4PR10MB6608.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230035)(376009)(1800799019)(366011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4gUoT+BviGDyAIicNBb2AKNjs+JXByle8BrCasyTGD+7tE3WBR/6cUkSuTYaAP1zRELfhfEZu8JVLyW1lBj5+d9Swe1HC03GJKTCFx23FNI8ALiZw6BpN4V6U3MgyAVHZ2ldLfVbO+1dkNMHTEDIErav4MY3WNrmJEDxJur4BPABIY0F1wIKhN81/4Ky/gez5U4h0F+p3qltVQpU3OjYYXdIx5F8jboQPWlXn7SOs3TKL5RCgP5VvS5qJE/82jzWzr8biWvMoPC1VWxykmE2rj6eGyWCn7haHPOAf2Fzum0fWpQpFHLWUkvlK4ztwMwXB2OTpVWODhvccKOpnS6eTSoxi7vk/PhkpK2O3qVs+CGF0GW0JOQlfqn4HTUZAp6Sk1e+y7yWC8Uf3AOuLqgPumriAB7wfiakS9lQjjNzYTKl8NI/V9ROo51Z5HAnikLSQmBaGxzPti99mAhajaaXGwq/wpAV6QGiyrpwrTSic9d/YAdcjdJX3Ff9TQrqTS6tMzkK35KEMyif/3cPj50/uY5s0pghdWT0gihR+NJB3CvsgSrpdI2tBPB0BEZ51dnGn8BZAJGJxWzY6lSM58go3EYZjSqhaDA3wde8tTNlIie4/WNfaXqQXhuMi793ONohovMrJ81VX6OVrEimgIbp+x2C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gfdBFfHwbKOjLhI3YhtMr7HT6v+83s9ciRENBHzTuKTKXOdkh8oIwPa2omP3Qr6Pm/LylTwiHLXoJLkJTMfzw0Sz/2UE6qPRUnCjoNPkB4k78blXH9k08FIC7nckuB/KKdDYPeihzmUjLLLbiyS62ZCCiRraUs1v4rIZh9UCUSj9kBjrma3foXLOPTZ12yyG53jqqTk6ZRAZBJToVUCfle8Ju+9g1AHmR5BW0vdqCJFK6KiKTqfuiOfKtFhJ2o0qiLM9vio08QlgkkkI2e6J6AsraPXEb7uSGCLYLZhF5lWWF7pz3zDaN07bjC//4Y3Xi+sDRY0wgfNkJGMWmjVJ4rF11E/nBd5sLbVX1juM2lxyrK+PThpDfKbOmCyQFck+USDlANsvz2KxY/oFAsexpqmlFUmfRYvEZuv6ONCOQlv2D7BNuoOhFCK9gyy7MR25EPD34ckQvi245pziJowH3Kq2WgeoPg1wEwmoatXvRDM6OGXjiF7jW4roSfTIHUYcZ9wka24ugf5Ls937YewnkVT+cV5Il8u2PE0l0oTDHxZ0huZxM/NJ7d0Du0GXfufM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a0bb1bdd-56e4-4614-0cdf-08dc8bda5070 X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2024 18:54:54.9331 (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: ZR1uEA4jzfs/57pBqEzKX5nuEFyzxyXq2AXmdlIKDkxiI4LY4yWZejiaG0Wvrkyfw1WkHLMMQP73LxbeshFOoQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4451 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-13_11,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406130134 X-Proofpoint-GUID: Ixp7AeeA7iOPqu1HT8B-d60MV4YAsFpd X-Proofpoint-ORIG-GUID: Ixp7AeeA7iOPqu1HT8B-d60MV4YAsFpd X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, 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: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org The CTF deduplicator was not considering enumerators inside enum types to be things that caused type conflicts, so if the following two TUs were linked together, you would end up with the following in the resulting dict: 1.c: enum foo { A, B }; 2.c: enum bar { A, B }; linked: enum foo { A, B }; enum bar { A, B }; This does work -- but it's not something that's valid C, and the general point of the shared dict is that it is something that you could potentially get from any valid C TU. So consider such types to be conflicting, but obviously don't consider actually identical enums to be conflicting, even though they too have (all) their identifiers in common. This involves surprisingly little code. The deduplicator detects conflicting types by counting types in a hash table of hash tables: decorated identifier -> (type hash -> count) where the COUNT is the number of times a given hash has been observed: any name with more than one hash associated with it is considered conflicting (the count is used to identify the most common such name for promotion to the shared dict). Before now, those identifiers were all the identifiers of types (possibly decorated with their namespace on the front for enumerator identifiers), but we can equally well put *enumeration constant names* in there, undecorated like the identifiers of types in the global namespace, with the type hash being the hash of each enum containing that enumerator. The existing conflicting-type-detection code will then accurately identify distinct enums with enumeration constants in common. The enum that contains the most commonly-appearing enumerators will be promoted to the shared dict. libctf/ * ctf-impl.h (ctf_dedup_t) : Extend comment. * ctf-dedup.c (ctf_dedup_count_name): New, split out of... (ctf_dedup_populate_mappings): ... here. Call it for all * enumeration constants in an enum as well as types. ld/ * testsuite/ld-ctf/enum-3.c: New test CTF. * testsuite/ld-ctf/enum-4.c: Likewise. * testsuite/ld-ctf/overlapping-enums.d: New test. * testsuite/ld-ctf/overlapping-enums-2.d: Likewise. --- ld/testsuite/ld-ctf/enum-3.c | 3 ++ ld/testsuite/ld-ctf/enum-4.c | 3 ++ ld/testsuite/ld-ctf/overlapping-enums-2.d | 36 +++++++++++++++++++ ld/testsuite/ld-ctf/overlapping-enums.d | 35 +++++++++++++++++++ libctf/ctf-dedup.c | 42 +++++++++++++++++++---- libctf/ctf-impl.h | 3 +- 6 files changed, 115 insertions(+), 7 deletions(-) create mode 100644 ld/testsuite/ld-ctf/enum-3.c create mode 100644 ld/testsuite/ld-ctf/enum-4.c create mode 100644 ld/testsuite/ld-ctf/overlapping-enums-2.d create mode 100644 ld/testsuite/ld-ctf/overlapping-enums.d diff --git a/ld/testsuite/ld-ctf/enum-3.c b/ld/testsuite/ld-ctf/enum-3.c new file mode 100644 index 00000000000..c365aaff564 --- /dev/null +++ b/ld/testsuite/ld-ctf/enum-3.c @@ -0,0 +1,3 @@ +enum first_day_of_the_week {Sunday = 0}; + +static enum first_day_of_the_week day __attribute__((used)); diff --git a/ld/testsuite/ld-ctf/enum-4.c b/ld/testsuite/ld-ctf/enum-4.c new file mode 100644 index 00000000000..00634244107 --- /dev/null +++ b/ld/testsuite/ld-ctf/enum-4.c @@ -0,0 +1,3 @@ +enum intersecting_days_of_the_week {Montag = 1, Tuesday = 2}; + +static enum intersecting_days_of_the_week day __attribute__((used)); diff --git a/ld/testsuite/ld-ctf/overlapping-enums-2.d b/ld/testsuite/ld-ctf/overlapping-enums-2.d new file mode 100644 index 00000000000..1adfd86b89b --- /dev/null +++ b/ld/testsuite/ld-ctf/overlapping-enums-2.d @@ -0,0 +1,36 @@ +#as: +#source: enum.c +#source: enum-4.c +#objdump: --ctf +#ld: -shared +#name: Semioverlapping enumerators + +.*: +file format .* + +Contents of CTF section .ctf: + + Header: + Magic number: 0xdff2 + Version: 4 \(CTF_VERSION_3\) +#... + Types: + 0x1: \(kind 8\) enum day_of_the_week \(size 0x[0-9a-f]*\) \(aligned at 0x[0-9a-f]*\) + Monday: 0 + Tuesday: 1 + Wednesday: 2 + Thursday: 3 + Friday: 4 + Saturday: 5 + Sunday: 6 +#... + Strings: +#... +CTF archive member: .*enum.*\.c: +#... + Types: + 0x80000001: \(kind 8\) enum intersecting_days_of_the_week \(size 0x[0-9a-f]*\) \(aligned at 0x[0-9a-f]*\) + Montag: 1 + Tuesday: 2 + + Strings: +#... diff --git a/ld/testsuite/ld-ctf/overlapping-enums.d b/ld/testsuite/ld-ctf/overlapping-enums.d new file mode 100644 index 00000000000..7cf57d62452 --- /dev/null +++ b/ld/testsuite/ld-ctf/overlapping-enums.d @@ -0,0 +1,35 @@ +#as: +#source: enum.c +#source: enum-3.c +#objdump: --ctf +#ld: -shared +#name: Overlapping enumerators + +.*: +file format .* + +Contents of CTF section .ctf: + + Header: + Magic number: 0xdff2 + Version: 4 \(CTF_VERSION_3\) +#... + Types: + 0x1: \(kind 8\) enum day_of_the_week \(size 0x[0-9a-f]*\) \(aligned at 0x[0-9a-f]*\) + Monday: 0 + Tuesday: 1 + Wednesday: 2 + Thursday: 3 + Friday: 4 + Saturday: 5 + Sunday: 6 +#... + Strings: +#... +CTF archive member: .*enum.*\.c: +#... + Types: + 0x80000001: \(kind 8\) enum first_day_of_the_week \(size 0x[0-9a-f]*\) \(aligned at 0x[0-9a-f]*\) + Sunday: 0 + + Strings: +#... diff --git a/libctf/ctf-dedup.c b/libctf/ctf-dedup.c index c7db6ab4965..dd234945462 100644 --- a/libctf/ctf-dedup.c +++ b/libctf/ctf-dedup.c @@ -1149,6 +1149,9 @@ ctf_dedup_hash_type (ctf_dict_t *fp, ctf_dict_t *input, return NULL; } +static int +ctf_dedup_count_name (ctf_dict_t *fp, const char *name, void *id); + /* Populate a number of useful mappings not directly used by the hashing machinery: the output mapping, the cd_name_counts mapping from name -> hash -> count of hashval deduplication state for a given hashed type, and the @@ -1164,8 +1167,6 @@ ctf_dedup_populate_mappings (ctf_dict_t *fp, ctf_dict_t *input _libctf_unused_, { ctf_dedup_t *d = &fp->ctf_dedup; ctf_dynset_t *type_ids; - ctf_dynhash_t *name_counts; - long int count; #ifdef ENABLE_LIBCTF_HASH_DEBUGGING ctf_dprintf ("Hash %s, %s, into output mapping for %i/%lx @ %s\n", @@ -1258,24 +1259,53 @@ ctf_dedup_populate_mappings (ctf_dict_t *fp, ctf_dict_t *input _libctf_unused_, && ctf_dynset_insert (type_ids, id) < 0) return ctf_set_errno (fp, errno); + if (ctf_type_kind_unsliced (input, type) == CTF_K_ENUM) + { + ctf_next_t *i = NULL; + const char *enumerator; + + while ((enumerator = ctf_enum_next (input, type, &i, NULL)) != NULL) + { + if (ctf_dedup_count_name (fp, enumerator, id) < 0) + { + ctf_next_destroy (i); + return -1; + } + } + if (ctf_errno (input) != ECTF_NEXT_END) + return ctf_set_errno (fp, ctf_errno (input)); + } + /* The rest only needs to happen for types with names. */ if (!decorated_name) return 0; + if (ctf_dedup_count_name (fp, decorated_name, id) < 0) + return -1; /* errno is set for us. */ + + return 0; +} + +static int +ctf_dedup_count_name (ctf_dict_t *fp, const char *name, void *id) +{ + ctf_dedup_t *d = &fp->ctf_dedup; + ctf_dynhash_t *name_counts; + long int count; + const char *hval; + /* Count the number of occurrences of the hash value for this GID. */ hval = ctf_dynhash_lookup (d->cd_type_hashes, id); /* Mapping from name -> hash(hashval, count) not already present? */ - if ((name_counts = ctf_dynhash_lookup (d->cd_name_counts, - decorated_name)) == NULL) + if ((name_counts = ctf_dynhash_lookup (d->cd_name_counts, name)) == NULL) { if ((name_counts = ctf_dynhash_create (ctf_hash_string, ctf_hash_eq_string, NULL, NULL)) == NULL) return ctf_set_errno (fp, errno); - if (ctf_dynhash_cinsert (d->cd_name_counts, decorated_name, - name_counts) < 0) + if (ctf_dynhash_cinsert (d->cd_name_counts, name, name_counts) < 0) { ctf_dynhash_destroy (name_counts); return ctf_set_errno (fp, errno); diff --git a/libctf/ctf-impl.h b/libctf/ctf-impl.h index 03e1a66416a..eb89f8b4645 100644 --- a/libctf/ctf-impl.h +++ b/libctf/ctf-impl.h @@ -294,7 +294,8 @@ typedef struct ctf_dedup ctf_dynhash_t *cd_decorated_names[4]; /* Map type names to a hash from type hash value -> number of times each value - has appeared. */ + has appeared. Enumeration constants are tracked via the enum they appear + in. */ ctf_dynhash_t *cd_name_counts; /* Map global type IDs to type hash values. Used to determine if types are From patchwork Thu Jun 13 18:54:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 92106 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 F1AC6388216F for ; Thu, 13 Jun 2024 18:55:54 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 469D73882066 for ; Thu, 13 Jun 2024 18:55:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 469D73882066 Authentication-Results: sourceware.org; dmarc=pass (p=reject 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 469D73882066 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1718304904; cv=pass; b=i5cHiV/1oX8WVkxqZPQhQH9onHKsj/DvNMl7G0ylq8rJK/BKfgvZrZkf3Ox7PBe3JHYo1cmY0wBFkWXVB9rDpxKeTCbQ5B3fX4dnUbDJQYSFDl0zJPZ8T/CVVYniXyPQcARJEe5QMtuz+eyz3b3EXOKKoxcX4R9RsBW8i9mvxig= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1718304904; c=relaxed/simple; bh=veRShiHHqcUndFMjMt6PJKit4rLnErJzWnoHntJNV60=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=jlY1N5gV6H8XxNFMSFYfjEoA9uMmE8KsRT4qjqr9T8pJ07tS+Fuf2E6e7+GZn/Tt9GQD0ygpcDgRum4ONzeF0Wm9+QS9ljnjWZ0WTUvBHhSSeENitn/S+NA2Pvpwk1AnUDJ3j9VMLiD7D8M2ZWcCEBelNsvTot+XStFIOlZaiEc= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DEtTBM003182 for ; Thu, 13 Jun 2024 18:55:02 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=IwqLVsXzBzfy4UGs6VPHrs/iqshnsw3rYhwCmQeugZE=; b= Nkcu+94tCY6OpuGKOoTpGEbyK8wYFSMvBMVIYlG5c1N8sIkxE4Loa6sZKEwA1MEQ 0l7gA7WEb8RfulCCW0uaIiMNc8pqz/GxVW499qkCPjedL/WBLDRYYr/Td6UJt9Ed aBaK4Zqfjcak1VZTJ4pjgms7HO/FywIBQ1HOj0w73ICIakqV731cZG3io9L5aoP8 lSZUKjnzo7+GL6ytBppG8DG+A9f4gt1K8f3Uv/7v9KA0SaVpx3Z2m/6IDkxxXHRN bAFkqQXfNDqgA1jfzeTBcWLmHgQtQ0NHzbls2zuzpW1yE7s1gvJNtJ3JEmCJrRZm KBzqh8XRGfzBsfORfMrEWA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ymhf1j8fp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 13 Jun 2024 18:55:02 +0000 (GMT) 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 45DIDSPO036618 for ; Thu, 13 Jun 2024 18:55:00 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2172.outbound.protection.outlook.com [104.47.58.172]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ynce0ps53-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 13 Jun 2024 18:55:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T2VZRADskUkzGi51U9u/hQH1z//2tKeOtPx/tldr/fyuhu24YoaGbQgwLkzmJHCzzPQZuGqO6vi264idy2IDK7Vofeod09nwXN+qnGgY6qKKcVv2JriT5uCnewc2/NPOlr3aTXkpxy4YG69JWlk+8raNCkw7yiArDndwOTZTStTYxhxSe8n6ZevnDOtD0lhEKyZc4NzjxgLfq8LLNyKkYBnclvatvTAjQMbC76SnxK/Fw+s2pRN2+Q3A+AaiGvOLu36ag+Sd0AdAiC3S8ig8ebO5klWvwsOGwTPnZLM7Vg/8AdD7cQl16Lp9XVgE3jACS+GYkccVRiG9nccZ+iwZhw== 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=IwqLVsXzBzfy4UGs6VPHrs/iqshnsw3rYhwCmQeugZE=; b=H4kaXi/nL4MD6+0ppx4IbpRcruAfCCuxq5yrHjNkJufQRAxwcaPQ1s7WO1tmspBRDyY7KiyGfMKUSjaQkvlOZ8gudTwUjmpzKeoQxld0IFnoR+KaM2dKnY4p0gQZgUsBzLbhoph7CbyFwI5pLOSUjKvlEUfZSczE4CFX4Dn9YLaeAmG8Dfi7Zd7gq6YJnQf1iAhD8at9qKkNfwX/X2EcaAvx9wJopvX8ks5DvCJ/f8wYRubrdMnrA6EZf8vgpyGVsZWfU4c5T9jn/D1W8p9bxEMlaCYJfTBggCKQMi3S6Kr+61SJF3zdH9Z1AxTvCBB1TVFE67YGk47JSa/+C+36BQ== 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=IwqLVsXzBzfy4UGs6VPHrs/iqshnsw3rYhwCmQeugZE=; b=VJ13eEijmDNGZzlxz3KUGIeAfLCgDU+Z8d3+cc8MyEeV9n9MuTb3MuDw4rPlC0XSix6OOVjpHsTjdLMTIJ/ZMdcQn4JkwJOnj3B36vaqdY/yl0DrJryt6pCjmavsHOQ/n4FHrS6ZGfEfyQu47HJVxn3+vYMZM49n+xOPjnHyhSY= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by CO1PR10MB4451.namprd10.prod.outlook.com (2603:10b6:303:96::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.20; Thu, 13 Jun 2024 18:54:59 +0000 Received: from MW4PR10MB6608.namprd10.prod.outlook.com ([fe80::b53a:ccc1:c190:c5df]) by MW4PR10MB6608.namprd10.prod.outlook.com ([fe80::b53a:ccc1:c190:c5df%6]) with mapi id 15.20.7677.024; Thu, 13 Jun 2024 18:54:58 +0000 From: Nick Alcock To: binutils@sourceware.org Cc: stephen.brennan@oracle.com Subject: [PATCH 05/11] libctf: don't leak enums if ctf_add_type fails Date: Thu, 13 Jun 2024 19:54:24 +0100 Message-ID: <20240613185430.85352-6-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.1.275.g567cb0950c In-Reply-To: <20240613185430.85352-1-nick.alcock@oracle.com> References: <20240613185430.85352-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO4P123CA0341.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18c::22) To MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR10MB6608:EE_|CO1PR10MB4451:EE_ X-MS-Office365-Filtering-Correlation-Id: dc92431b-a5c8-427a-018e-08dc8bda52c0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230035|376009|1800799019|366011; X-Microsoft-Antispam-Message-Info: hH0s6MT6se1URFltBEI878YqD7YXoI7JA2u52jWF2tKbOldqIThSTiZmspgib/9SjZB5eqY2FYypJ3NBT8rMr/7DQwzjfJ1l8nfi2YGV0l69KN49lTdQOljF0fyly/TRiuiiv3DE90gpZ2KyaJUQhBnJw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i9u4le4uoNyONWF6RtttHZVepwbCahv5zouS3ZV+Q9hL9A0jZO5+4/ACTeKN5yqDfgauTr8c= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW4PR10MB6608.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230035)(376009)(1800799019)(366011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6XXtAxadQoEEIt4l5MgEOER6kQrUH/xHQs30ITSam+hjgoltuqghzAh3U0nWKeSxP63Zs9+xMF0HIqDMB3weR+3omgLe6Q0Gl1nrFCbkqInsQXtTgvRyDU6RrliXmEScwb6qCDFq3+fNZHsnXFG2GKe21c57ibiPh3Wq6giN/sdSaPZChUnqDbKceppGLov+oiqTOF3nG3gbWvkEnV2gb/0Cez+7Nh9fjj1qBoBvelGC/GHpiEL29UfYomIEYQQamYgzlrgubsZlRuR8AdN29nw5ePFGChPl2nGcKTJ/7SHQrfPFVCW7oMQAtk043+D+5Uwwci/RdB1M7pY187JFcDtXgH1K/U0BC9YvD+URuxaAeVRl5uMYsKkkJUyIk1etQoDRpqWuV3TYQ1sHunW0+CSbEH6vIiCOprAuKFy4Bw0B0RNG+jERDMBvbbWNiFbPtNVGY45P97pO7thgtEQrtxVSrFIHU+IfRVtlZpas1E/TibaA+C9aU+S2iFYDyFVg0Z2xa1lrERF7RrUYVYvslWqMmywgBr5GIeJmZ0+4Xwc6rBZQXHktOn4QeYwESxyYtrgmoasAcw85HOIYJhVGrN/SQy3BIiopmWCysFDSq79TbRGNw0bQUAfj1Ugo60MV9xJuDKStjPmCrZrCG4avV4OFpK0XLwo9jnIpif9scu5MIj/JHoz47awLGwuJ1TAVhONFulksatlg5TIak38zuacb+N7wvsLpT2oLU0B43ATynt//2aIwz+Jz81utATuuYQ5hFwt9do8XISt9hF8urAS+hfxt1Ffx461cz4SMrjp6f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6ndZgycrEJQMohuheo6j4ctSWH7bcS9brjkUVG9mED0oX+swR1ZeOiMaPlnWNDKw1gyZAKczqGrPToeeCb91zSzoZ81bJC4ZaU7QuRXiowDaaaucdpczTrhfUMe0ke/XWOlH7W4qoAI+Qt1xaKWkM5E7DYXYDHkq6V2OeZjvzAgxjJ1kmdb1WJWuEs9Wy6S6Agx5DENKkgfKUPQq0sMObEB5RihmNOeVbBwkp8UGps5EhwHUJHg3o2zufWmMVN/UKtWWxqXp4SFnTI9NF3mZBlcJhcVReErptEYyEtQiyLZp4ZItotD0pxfqlpEYzChwdaBaFAUn8y+Rtx8eyRCwgr55kOuxXp1UQ+HC6XNNvleMhOlXQc+JpoMo6Ym10zmnGVP45VDWYNLdJV7qAwAKtXeXrYOasK4YQ= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: dc92431b-a5c8-427a-018e-08dc8bda52c0 X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2024 18:54:58.9215 (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: aV6I/fcHFZEVbj4EEEdCOL1UtR+QuUXq2pN1IGX3kVSUjXDAb8EKWYGMixQ0eOz3h3S6eEA35LfhEqB70E08ww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4451 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-13_11,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 adultscore=0 mlxscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406130134 X-Proofpoint-ORIG-GUID: kVZYRju95fbVRJMJUC5CEiLN162rSy0L X-Proofpoint-GUID: kVZYRju95fbVRJMJUC5CEiLN162rSy0L X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, 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: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org If ctf_add_type failed in the middle of enumerator addition, the destination would end up containing the source enum type and some but not all of its enumerator constants. Use snapshots to roll back the enum addition as a whole if this happens. Before now, it's been pretty unlikely, but in an upcoming commit we will ban addition of enumerators that already exist in a given dict, making failure of ctf_add_enumerator and thus of this part of ctf_add_type much more likely. libctf/ * ctf-create.c (ctf_add_type_internal): Roll back if enum or enumerator addition fails. --- libctf/ctf-create.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libctf/ctf-create.c b/libctf/ctf-create.c index ee79e49794d..073006b24ea 100644 --- a/libctf/ctf-create.c +++ b/libctf/ctf-create.c @@ -1944,10 +1944,15 @@ ctf_add_type_internal (ctf_dict_t *dst_fp, ctf_dict_t *src_fp, ctf_id_t src_type } else { + ctf_snapshot_id_t snap = ctf_snapshot (dst_fp); + dst_type = ctf_add_enum (dst_fp, flag, name); if ((dst.ctb_type = dst_type) == CTF_ERR || ctf_enum_iter (src_fp, src_type, enumadd, &dst)) - return CTF_ERR; /* errno is set for us */ + { + ctf_rollback (dst_fp, snap); + return CTF_ERR; /* errno is set for us */ + } } break; From patchwork Thu Jun 13 18:54:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 92109 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 710203882165 for ; Thu, 13 Jun 2024 18:57:10 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 435943882168 for ; Thu, 13 Jun 2024 18:55:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 435943882168 Authentication-Results: sourceware.org; dmarc=pass (p=reject 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 435943882168 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1718304908; cv=pass; b=A9yt/iY1fwt/EQFfWC2OmmEVh9ncdND0PkxsBqBbwueF5CWbcEoV3hC1EmigSL9SsRT03mCZtZ68S7wdbvfmtkWjCGE1CNo+q6zh8L9qc7L2L8eoQWckoZjjwxx34Qj1zdYdrdKma6kKXazrLJTz8Y/+SWgad9Cb+3t9ybCefgw= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1718304908; c=relaxed/simple; bh=DlAM6iXOiQ6UxGw59LeSFcdPAsAOM3a0CLKQsrQ8ymY=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=rynnvJ2LXmKj5KfxU1apJ8rMtCcOcyZ9lShUE1z3nGmyfaCn4uOojjrPPvqRsrEIWJKxg48k0mi1z2+MyZgzg9S/4wQsgvH6zHk3EBj9s9GujsZOn91Q6X5Aqhp9j0ez9iIOD0oJkSVhOp1hdp2ZPWwW13/vsVBEoqHosDhhD54= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DEtUhU009751 for ; Thu, 13 Jun 2024 18:55:06 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=7SIRcFCzsHp9G8G27o7LADPOgJU7NPRUUte9rxPMBCA=; b= oRkPdxXJLAGl2NV/xye3juoNVjcV5JeunBDgcIR0XTyb5Ht9ODNPWJGJR6erTPtV USYKJ8UWpWPOj6o4+gw/NqwyEuBqXwYeXe6Hbmo/5N1CiVhHosh3Sft5LUKCS0SO pBm9vZ44YsAAFRkZQzQciQEaIia/laOOBJIWU8m47USAcwobZ1nZ9x+iiyOErWAG ykm9d0wAuE8PcuHhl506yS1gyVKmx9mvf4/UL88WXRp8uX+8hLw5p0wn56J+RKxF Bei4rpdhL8ntPj/jYkczvqYeVKSXnbdl6YZxEI9GfcCr/K++tYAxBmqP8ezClngg Q/VlEjtJvdkVHXoiXPhxjA== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ymh7ft4ja-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 13 Jun 2024 18:55:06 +0000 (GMT) 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 45DIsG24020031 for ; Thu, 13 Jun 2024 18:55:05 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2042.outbound.protection.outlook.com [104.47.66.42]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3ync91khf4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 13 Jun 2024 18:55:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jYkYN9tEzhO9Ah1IuoDGL0NmMzVdQyXZCuudwk5GEXCfco2YRLzfgUHlFJg22h7mes7eSYVX5RxGRvkKXhZ6tomXL3mtgbm6oZHTOiLcWby7h6w28fOqux+HIOkwew6syTip1RhquvZR5OwSu0c4I6M9Wsrv0wbnee2Z2HJAQIcDmZoDWZE4YpuW3JyF2g+6UkGd1q5fFA0tAkSHfkYLWXC5XK2jIO+xeOJf4KzBCw7CcWnKze7+frXMbSd8JSeJ0QPMcGCDN/Zvq15Ke88/EgQWSUzSW0TXC9y5Qk5pV2d8+19+uU611NJQgD8KEw+YdaEI4PKa04WlwDT7BwE++w== 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=7SIRcFCzsHp9G8G27o7LADPOgJU7NPRUUte9rxPMBCA=; b=OeZH1stxDqbK9hmnmto7uwz9s8ZULd2CshEt0fIaCQcQe8nsnc+l/SElMkEZ5lLMtlldlialcIMFnEa+mZ3pjmyHPJLm+ZOiHgV9QB6RGG6FSo/rkWLeke3mQlG5QiUsf8wPvJ/rxoBO9M9HUKT97QtLxo8rJY+9tvNlDoA4hskj8gWI7/OLYugztCd3rh2EV7PjPBJOc4Ny+lgwUydJKVuGU0dhmo+DzxgbG0I2bRgjcsoJCGeaa6F/lz1wsiN3bqh+XaSz9IeZxohB0EHXWdvC4LWbKqIMyCjhiBlHiZvxwC1/O9W1p/jiqN2qNze7GeZoyvw9/Lbls24JaiaOMg== 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=7SIRcFCzsHp9G8G27o7LADPOgJU7NPRUUte9rxPMBCA=; b=C2Vvy1oK10nBKTY7sP8nVD3ckcYEha4kpC01pdk+2QPyWmuBunqhHGifAQwphLMF5NG0kcwx5NWF20+ad+XcQZ0AS7ZQ4E+gtKg/1anKRdId6RPeuziMRLWD0s1jbYTjnMJvGJA/mAy81YlAXA//dqhT0WNJVqyP9eyCcj/MIU0= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by CO1PR10MB4451.namprd10.prod.outlook.com (2603:10b6:303:96::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.20; Thu, 13 Jun 2024 18:55:03 +0000 Received: from MW4PR10MB6608.namprd10.prod.outlook.com ([fe80::b53a:ccc1:c190:c5df]) by MW4PR10MB6608.namprd10.prod.outlook.com ([fe80::b53a:ccc1:c190:c5df%6]) with mapi id 15.20.7677.024; Thu, 13 Jun 2024 18:55:03 +0000 From: Nick Alcock To: binutils@sourceware.org Cc: stephen.brennan@oracle.com Subject: [PATCH 06/11] libctf: fix dict leak on archive-wide symbol lookup error path Date: Thu, 13 Jun 2024 19:54:25 +0100 Message-ID: <20240613185430.85352-7-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.1.275.g567cb0950c In-Reply-To: <20240613185430.85352-1-nick.alcock@oracle.com> References: <20240613185430.85352-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO4P123CA0330.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18c::11) To MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR10MB6608:EE_|CO1PR10MB4451:EE_ X-MS-Office365-Filtering-Correlation-Id: 1a194b82-c23a-45bf-6b05-08dc8bda55aa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230035|376009|1800799019|366011; X-Microsoft-Antispam-Message-Info: HJ4ynX1F3vbRBYrY2mtKX2z04SNxRiWALK3yCt9QnevOt6zmCoYxjzIVVQehgXlCY/dZym/QV4SPrZySW9KSySVUW1yIR0lj3RKVesBTwo0fbJTjRHVh7WJ3tEBnU5Jt/Sli7mK52t+NVxCJi3l2CE5UiKHzn5TBxlH4JRDJ2FnzP7mXDs+XwD2FyZksfmeEInA5xWx0aC0bbDgV1zCDZnexcRHV3k4T4HZxGd0e+4gqul290qJ+eTqfXCby39rn6uF9P80/JEbaBe7+bcX+Hb6uQ+chKhJnxLRN106nrje6fwsxibbp4I56qw/ALvqCG1xra/BD8q5NvEATbROW8vS0W17UNG8vQy85cheAZBwQX7nKw3qnc7g+wbUzyWfCr76+KFxZx6X7a04PTfIZ2ko5K2LGkzxciaCPkaa2zGS+00O/S5X5gIWKqwcz0zIE1KeszvwFeI4l6UhXEzVsl6Dyzl+aB0zZMA2v8Nyl6oUKgCw6X1tLk0Sx5bOrpCzBrHCEEcPgLUxIwx4CW/zBqBCe7ERUDjiaF9e6Cq82lcTicLJSQ9kZwS1BHT3QwX81MBWEutmVx/vyAtsaei5a1smnbbOC4A3XIxpBeuz9U1wbzVlLv+vpEdIwYnoqhgTcSX/pD1g26gsQ4+13KZJNqHrYga6MyRgzOkEIceutZIzRPvNrF6y9zbWo+aiwXvbm9FKnOVMh983vxCbFaoCOm2EkZhA/Igc1rPaWcCVLSvUOe5QwR7Hg0NhYkB5zRuZkq7DAbif6ibUrDC1p+owzvtUZJGnUoj/MkyyNprbnjsH6Iu2NQVhv1uQuw9JJbOVcGXUZEIC6BHMqaaaGAywl7XvMLCB5qbYU3Lg4y7ZETbTlb5BrvXYP9b4xi7WiacyC+F+EsW0a6F7qruvUtsOxnkzfBz/gwTKOtQocQulyjgNh2t9cyep3EyPj/ExFPJfUNwSmZOJBTEv7ppQTCc3weUcQpgRsdaRqhL+Wixpiw30v5EUXo5jF2OWynanQ3t3mk/mcPND0ePDj/tpbrK41fEb35zkxmkSgABUgXwvg0pPjPQoiqlnqrcTVDvDF2J9ZTTaOLDCxBOKh/Un0TZ14K3yYoTBQQxA7Jw3KnN7sR9tnT8lKmXfvScJbL4O2bjl8r5XDN+h2VXj+3ER40OR0i2mv1fX04JPpdFtni8L+vfQM2Q1pCFntgqJwlsQoAUeVMCvZfNYytYq9LaJ5pdezmWaKBPhIetaCrLrSEQwFEGNozLd3qgvnO56DXGOSjhDdJoZ4aTiyKJeNDRDO+2R2L5cc1vPyNAFt/vzO94qwC/HiXVS/gzOskRCxFqNOz8Hw X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW4PR10MB6608.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230035)(376009)(1800799019)(366011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: l6gzqWWtg2E6QWltl/B25NvnF2oPpUsgZ5B+r4M5yiWKqZncNvgfEk6TZZ02yw2wWx0fhN2Swz0YSOr3QN1pc3zX6/z9Gm9DsquH7qHD9KGHfFQ1Qrn/F8Yk82+Y1YtLPkzGI72oSC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x20Ap9tgalCYWZeHXwUGIZRG8bVurdixhTVqzo0QtcPwz/DVVBNoC/s7s8z05+A6H1CKwbQJBcvz2T5FHIA5o6lczHxwnoAuIIQe4jy88LhN6hoOdLaAnV5xq1s0UVDZDdU9FhRJbO6XjvmJT+oHyXhNSJIXjQY1ZownK/cL8KKmNZKyZwwrvM+prBzF/uDiyAbMfWRZLMJMfV8UongBT5xForWaA6Gw5ktCXMvUnW03dTssJEclpZythSmlWCYzX5GUxbC96kNEeKFrw0ApLrhR7a08niW1U0ENWdt3x6xuZzZ9jS5xPN54vu0PImJVcbJ0M9YZE4dTYjf3TneRsQSrgwS+lGI1NmXrAY3hGqgikki0zEAxkXxXehcNeYkxV18S60ih2neo3OLLR4C3/Q== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: wg7bQ/SUjMYfXHwselx7BIA2Wgb3ieJu0GrA4m/dLigtoXmnlC97ZcUhPp81OayRI6T43JeRBv/eyG6ardNmsJsgqF97Vi9qUlsjCyOohXE0vSIz1Zhdi/RTk7PDneTbJyA+4aXTofDtAEkRNCaW1nA1tvEIqmVVu5oiVMdOcmpEK/gf//hbPe93GHiulrBb3CudVrxIUMDyJ1F/UcVX3aWpSixqx84/sORdFWqXzDzbcTlWJ4OFLM/nhPwQKSPJ0rDaIPQBgWbBqOpOhd1e+FkadbtgaTi6QDm/Bj8tO567rYBHuMvkZEd0607aHX2iuxgETjkiVeFtV6LRiGvqIK3aGEVrOCgMRRm9J2oip9SSbnFpFTSDc7wipbt1AqF4/nc17WgGnyIulHFLRe8Wlzo6YAH2JYMZFxY2S3eo1PRo36FnmOd72pKCGrlMiWm92Marc8MlzPDKz+PnHc/2Bv4154/uqwgEK056l4riewnTjTslxI1PHAZwmyKqmwjiguS7fs6DJLM/A0nY6oInPvOc5+pbNRVOly38yhBlfE287FLfzwExUza7cL6J9TKwwMIJh4vRrYL6+irrfyXZR35FlolNdCAh3fs0mIGJeaw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1a194b82-c23a-45bf-6b05-08dc8bda55aa X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2024 18:55:03.6882 (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: rvKgrv2X7NHlYRuF/XWfCnhdkfYIYKVYIbyb0TjoOdCvLgCV3EdUdazYacbK+xicxHvVkeiPifU2cgWThGoyPg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4451 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-13_11,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=755 bulkscore=0 malwarescore=0 spamscore=0 phishscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406130134 X-Proofpoint-GUID: L0bcR0YoQt3ygHQY4Plee9a1M6-zI_mG X-Proofpoint-ORIG-GUID: L0bcR0YoQt3ygHQY4Plee9a1M6-zI_mG X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, 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: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org If a lookup fails for a reason unrelated to a lack of type data for this symbol, we return with an error; but we fail to close the dict we opened most recently, which is leaked. libctf/ * ctf-archive.c (ctf_arc_lookup_sym_or_name): Close dict. --- libctf/ctf-archive.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libctf/ctf-archive.c b/libctf/ctf-archive.c index f459c02e702..4744cb7a828 100644 --- a/libctf/ctf-archive.c +++ b/libctf/ctf-archive.c @@ -957,6 +957,7 @@ ctf_arc_lookup_sym_or_name (ctf_archive_t *wrapper, unsigned long symidx, { if (errp) *errp = ctf_errno (fp); + ctf_dict_close (fp); ctf_next_destroy (i); return NULL; /* errno is set for us. */ } From patchwork Thu Jun 13 18:54:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 92108 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 AD4B93882653 for ; Thu, 13 Jun 2024 18:56:59 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id E104D3882648 for ; Thu, 13 Jun 2024 18:55:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E104D3882648 Authentication-Results: sourceware.org; dmarc=pass (p=reject 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 E104D3882648 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=1718304917; cv=pass; b=cAlyi4CIJU0C3DzKN6GZynOdbnJohid2KtDN8EyWvv4XfjSPHY2zgHmSzmsEgMkjLGw3DzC6xzIzR22ErGy21xZ9sjRzh3E4BWleH+HOVaQdp4CktRkHxyJoogXOduYJQ79ALJ2s4pcDuDZDz8miGzE1yUXj/MXzmPtE/gXPgHc= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1718304917; c=relaxed/simple; bh=g1gCMAYfPiuqJtwGFt5YNQer5+FkCQelUq/XeJb92Rw=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=YgxhTJ1rXnJuvUBF2OtcJkD/T2kck8HRar9z8EYPaLWJCAlSqZZ6xrgZIy8XVqAKh4cyVc0Lt7w7G3jdlsuASvBlBrFl0xhdk5xL+/X+nZMsceLTb3rNrfdKpo2qCGhtm4XBx57ZxADaGUyK1xZdX3kJxiGglJX8wp+K5nKfof8= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DEtPuO014999 for ; Thu, 13 Jun 2024 18:55:14 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=esiMQb2sBmRfu2+yWXcfdxpaC9k7VGC37GWfA6g3weY=; b= YSa+YXmwf3XEw1xetaGjMby6UeIfcnF96NYFilGEJwGN45DH1ekzwYQIhu4WtirK Wg7EXFl431F7yCBntS6RX62qfneQi9wa5FlAgVUnrLFqjd3N7irbfl7JQr1l0ZYt 3LF+rbaSfrFTc8+9L944O+/QUqn+SH/kfM1gxa83PPLNni95l8RGBwuebwbU5ZMt VVrAteCuI+kg10qpCkM6izVdAUHMeWjmxW+niv+9WRuJViV+k1QDO+5UJZm1dkJc JqTwwcdoFWFIuaH2J5YZbK3BeP3ZqGRMa+dwUSFRkWgS87lihoTW7PzWo0MTFJpg bMNDD/nuEeOwOgkt71n98g== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ymh1gjckw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 13 Jun 2024 18:55:14 +0000 (GMT) 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 45DILeGk020099 for ; Thu, 13 Jun 2024 18:55:13 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3ync91khnx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 13 Jun 2024 18:55:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nmndodKNScrpytS6YPLD/iG7BQJOrU9DswEFQHFVyyjq9rm3JDIGNsqzbKa1Cv23TIXA5gdLGFSG/1mvzE5Usizht9FMUzvLTMG0PkAeHdnngMVad4goytj9O0jPRjuNH5YD1I74BLPEy91I5botiNNlAhgOsIBooJKNYazvO6kmr3lbTg/f0Nv+UlLxvgfke3qBvbFUY1474spx6jA3k/oV2HRHbT893AexwmQ2SWjOUPYrIM1L/DnUMvQuq0XLdyJPWtKyU+DdxrHkiHjoQZ7UJTuEMXxkQNNDWGnhk7hiwc1j6qeZBEjgTacH1FfxwEB51zGk0/Kr9DUJc6Lo9g== 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=esiMQb2sBmRfu2+yWXcfdxpaC9k7VGC37GWfA6g3weY=; b=Um4HZhsTTYa/v96FlRVZmS6OG5lXb/zTE2ePrJpTWbCml6dsjlToURgVI7yCpvIkGMANTJhiUGDmZ7d+byP7eT9yfGwABbdjLqZ4ENCPY9nN58/TnJKs1RvQ5C4fugtZ9IYelVqacDGPFXWBVeBubgr4GxUdUcurqzKsnJmABYaQEpIczo4t0dh8H0qS82ZnfYBhOyybPC/FvWgxXPatz5je4KLdxDrAOulHaeL8DFzbLI+yxqrjJ2ucyTj3zE6oxygbhJMuJxu0P+OMRQhU17F+WScdgg7rkK4yafxNGbMaH60HYtmtnrMO3Yqfa2NYAJI3BCFhbdcXgTOpBKCpgg== 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=esiMQb2sBmRfu2+yWXcfdxpaC9k7VGC37GWfA6g3weY=; b=dJSXPXf+5WTR0+2K+wtYx52Xr340tD5iBUNX4HDOTzovjSd/MAwInGCiXg/hNyz24es6JWcVBm9yv8d7gToR57z83sEuMcFQIbtlbXOLHyaEbpr55YSwba/QPVTD71sWEnAYgCXGoI6Ts+WnnKdb2zp2YmQp88ffajH3Yd570SQ= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by CO1PR10MB4451.namprd10.prod.outlook.com (2603:10b6:303:96::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.20; Thu, 13 Jun 2024 18:55:10 +0000 Received: from MW4PR10MB6608.namprd10.prod.outlook.com ([fe80::b53a:ccc1:c190:c5df]) by MW4PR10MB6608.namprd10.prod.outlook.com ([fe80::b53a:ccc1:c190:c5df%6]) with mapi id 15.20.7677.024; Thu, 13 Jun 2024 18:55:07 +0000 From: Nick Alcock To: binutils@sourceware.org Cc: stephen.brennan@oracle.com Subject: [PATCH 07/11] libctf: suppress spurious failure of malloc-counting tests under valgrind Date: Thu, 13 Jun 2024 19:54:26 +0100 Message-ID: <20240613185430.85352-8-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.1.275.g567cb0950c In-Reply-To: <20240613185430.85352-1-nick.alcock@oracle.com> References: <20240613185430.85352-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO2P123CA0048.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600::36) To MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR10MB6608:EE_|CO1PR10MB4451:EE_ X-MS-Office365-Filtering-Correlation-Id: 53f2f262-afa0-483d-1e37-08dc8bda57a9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230035|376009|1800799019|366011; X-Microsoft-Antispam-Message-Info: dfKpCnfWc/8YlXrRqBM4CXR59Ko1HR7nZnDVaxjOq2rekbsvJB7rp9ZGhA0bfODDTY6F86Ox8KGMEfOufwUJphyKPacMuwnsIT9Yz/VCJaTxpMd7qHF/YKIVTmy5zOepJANAA6xJEDS6qAEXGvy17F6+I7+i6nBauhAnWavTDWOjalkcfpkRGedttMJj8t+DDXSNxPZsZjP5QA1sPzRb/n/W/bqdHQenWdjQqx4n81ZY1ZuluOidt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Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW4PR10MB6608.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230035)(376009)(1800799019)(366011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: id/4m7mRWMZ8QeReX15bVFno/+7sBaptGnCyK1TaO76s2/hGIjxcA+ckxcqf0TfOjrFGfWUVqUOhR5kWKYncnF2p3ZhuZ+bsS//q+HNrWfEjat9sLGKo+Caowaq9KMp0WwAcsfcqZ6V0JBDKjMkQZxkAIFll5ojOy6UcJQcxEUql1TolC1rr85Uf9JrPhb/ZCMFr3+0pamLjgT/K652J+Flys+cOoexVMQ/hW4k922SDCkJQrHPo+vX5f6lBniZOQR2zuY3VRl3J1qztwKboSkIK5hWW+jJq7i1eRwHFcDGEAUiyheDnUZGkKr4+so1xAtn7/CUN34a4oOZvOUUlwqB17V0pE85yT32rEaGSbAq52Gd8lCPaK4UJ63OSqvelsFtegWUr+jCnqmiRAnD3CTPPFVMiQ/MCJZ1GvDCSWa7nD35cAiVjsDPJYLUgfdLaihQuvOmNr44DANkEggKungTMuUxLIfao/mmmMP5cR0BeFZeJw/D/kDtZMB2YBvuqC2KTAWf5mt4EIOTlZvU8Vp0/4Y/r/wdk8jna3kHTMLPQXneTug5TrAU3tO+Lnm9aMonEHpDmLRIVfJ5lV5ncuypm6s2qhbLn5j4NrjWY1doNtI+Rkz8n2BtpvDECPVhYj8sL2Y/tN/uJLOmAvIb1drAj4KRkL71sceDY8xwRbtIsPjtDOsAWaDZb+rr/7DxaECXfamSNaUrPfyCRSoG/DDWp2z2WOY3aUGQPXE5Yk/zKiOSV7GU2XasSEDc0yFa9MNNfGedwfSPZe+7e/19zalSoMnTqhv856xVxkQmHYTSJz7aiMEvkZ8//m6ABNas6luegnAcgqx5PQ9WBfGXq8DI3OyCUm5IdN9UMgTb9uh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Y/PLMzlOXnbMYPsXZXuASpdEW/JchQkkC3X2T5tO9YVL0dtnbFb7cZpmlzTRipzQHtPxTKSvA8zcstgJHU/7kr6NMfGcTYvMl+3pJOTJhMIlJ/H6m67igmMqkXRMArWbQa1CEvDInrRHYxM/FqamFK2QpZtXxa1gXtp23a/+DS6Tc/RpY9qA04eMxwwRvOAirNdwsRunskKFCvwb5EJJtS5TgXmp6OLro3QmsgJpe6vPr1DZ8qpk7u+QvXzCE2b1+Zz7gSAuzUJHaFtNU21gqGQQ3M4ky+9Sx0pJEqc+YSrCNqAUOE44bjEGLI10vh+9gYFeWacXZgSBTPGZgmplwhZOfg2vljGzfmYGpU4IynIMrT+PU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 53f2f262-afa0-483d-1e37-08dc8bda57a9 X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2024 18:55:07.1618 (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: yKXlMHXbJls5TUFV44y2p8ez/iIcsRNzCMJvoIXEmI38SADCZpz2k/uf73fdHEuuipKo4rCatKh5+OU++V8/lw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4451 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-13_11,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 spamscore=0 phishscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406130134 X-Proofpoint-ORIG-GUID: IE9gFFwi3VJYVLi6qRJFZSe93FngwtlD X-Proofpoint-GUID: IE9gFFwi3VJYVLi6qRJFZSe93FngwtlD 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, 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: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org The libctf-regression/open-error-free.c test works by interposing malloc and counting mallocs and frees across libctf operations. This only works under suitably-interposable mallocs on systems supporting dlsym (RTLD_NEXT, ...), so its operation is restricted to glibc systems for now, but also it interacts badly with valgrind, which interposes malloc itself. Detect a running valgrind and skip the test. Add new facilities allowing libctf lookup tests to declare themselves unsupported, by printing "UNSUPPORTED: " and then some meaningful message instead of their normal output. libctf/ * configure.ac: Check for . * config.h.in: Regenerate. * configure: Likewise. * testsuite/lib/ctf-lib.exp (run_lookup_test): Add support for UNSUPPORTED tests. * testsuite/libctf-regression/open-error-free.c: When running under valgrind, this test is unsupported. --- libctf/config.h.in | 3 +++ libctf/configure | 2 +- libctf/configure.ac | 2 +- libctf/testsuite/lib/ctf-lib.exp | 5 +++++ .../testsuite/libctf-regression/open-error-free.c | 13 +++++++++++++ 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/libctf/config.h.in b/libctf/config.h.in index 794779eab5a..359f1f5ae1d 100644 --- a/libctf/config.h.in +++ b/libctf/config.h.in @@ -115,6 +115,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H +/* Define to 1 if you have the header file. */ +#undef HAVE_VALGRIND_VALGRIND_H + /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR diff --git a/libctf/configure b/libctf/configure index 1faadefa068..7466d56a18b 100755 --- a/libctf/configure +++ b/libctf/configure @@ -16552,7 +16552,7 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac -for ac_header in byteswap.h endian.h +for ac_header in byteswap.h endian.h valgrind/valgrind.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" diff --git a/libctf/configure.ac b/libctf/configure.ac index cf0e988f7fb..64544b83a9f 100644 --- a/libctf/configure.ac +++ b/libctf/configure.ac @@ -109,7 +109,7 @@ if test $ac_cv_libctf_bfd_elf = yes; then fi AC_C_BIGENDIAN -AC_CHECK_HEADERS(byteswap.h endian.h) +AC_CHECK_HEADERS(byteswap.h endian.h valgrind/valgrind.h) AC_CHECK_FUNCS(pread) dnl Check for bswap_{16,32,64} diff --git a/libctf/testsuite/lib/ctf-lib.exp b/libctf/testsuite/lib/ctf-lib.exp index eb2b738498d..cfd36bee339 100644 --- a/libctf/testsuite/lib/ctf-lib.exp +++ b/libctf/testsuite/lib/ctf-lib.exp @@ -270,6 +270,11 @@ proc run_lookup_test { name } { set results [run_host_cmd "$opts(wrapper) tmpdir/lookup" $lookup_output] } + if { [regexp {^UNSUPPORTED: (.*)$} $results -> reason] } { + unsupported "$testname: $reason" + return 0 + } + set f [open "tmpdir/lookup.out" "w"] puts $f $results close $f diff --git a/libctf/testsuite/libctf-regression/open-error-free.c b/libctf/testsuite/libctf-regression/open-error-free.c index 5e4874444e4..edc5f348d5f 100644 --- a/libctf/testsuite/libctf-regression/open-error-free.c +++ b/libctf/testsuite/libctf-regression/open-error-free.c @@ -1,6 +1,7 @@ /* Make sure that, on error, an opened dict is properly freed. */ #define _GNU_SOURCE 1 +#include "config.h" #include #include #include @@ -8,6 +9,10 @@ #include #include +#ifdef HAVE_VALGRIND_VALGRIND_H +#include +#endif + static unsigned long long malloc_count; static unsigned long long free_count; @@ -111,6 +116,14 @@ int main (void) ctf_next_t *it = NULL; unsigned long long frozen_malloc_count, frozen_free_count; +#ifdef HAVE_VALGRIND_VALGRIND_H + if (RUNNING_ON_VALGRIND) + { + printf ("UNSUPPORTED: valgrind interferes with malloc counting\n"); + return 0; + } +#endif + if ((fp = ctf_create (&err)) == NULL) goto open_err; From patchwork Thu Jun 13 18:54:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 92111 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 B28433882643 for ; Thu, 13 Jun 2024 18:58:29 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 61DA33882169 for ; Thu, 13 Jun 2024 18:55:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 61DA33882169 Authentication-Results: sourceware.org; dmarc=pass (p=reject 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 61DA33882169 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=1718304924; cv=pass; b=CR3+BgV2cuyUmfTAeEPomr97g3UHVJkKUV/Qnw3lj/tCJzrC6AB3JyRW1AKNRw8NdOSjmSDh780YmgfyrbEdLXTq4MSV7GWIqVt0gepUl5GwZ9ucMb2Wdk5iwFQvpw2YJAxstDNDeuRKWu23VKB5sGVast+hOf351NHB/KxxWkg= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1718304924; c=relaxed/simple; bh=iDhpDC/cJgHCbQY5by+wLxWrdyyYs4qo6adoborkFmI=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=pmZ/CBBNV/Ne9EsSnzbH8/TGUkTzDjUhI51OhcaqHNfAicHNIfEg2pAmkMxeM6QQj7/KMUQK8TBlN19OYxXl7Yy0GxhXxr0oxbFR5e1k3P1FK0oHhbXZ9Vjtp4BclbXV5mv21NhAx7OAHDh2WrOUzyn1sF57F8QS+d/MTUlx0cM= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DEtUDY015072 for ; Thu, 13 Jun 2024 18:55:20 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=KoQG90uJHYWg79UEh419/m751U4Ql8VFNq8+7PlQjSk=; b= CmMvt5WyLalqg1PjLvIor9WIaus+M/JfNdEvOBLQKmx8jQ+LOEeSj2LBia0yCOMn 3ay2CZzUDSm78X7GJYBEj5pnMPzXlBjuKPGN7fcNDZZLVu4Kyv27mGEjmdvr1tcW ybbADsYUjWONd0voGV/jYzeE7KSHYqsdCaB4yq8vRCoaD0MooFFHalUSmZrZeimN 6rBJeU/Ao4YQwuR5Aiq4fqj5qHlJd2nin9u4+JLoK3JaK75zk3T9Io807Qtqfqfq BGRyYezFunBx/Z4sBYP1iVkTV9+ravHkNfAOjm3VX+5Q4uVafX5AzxGcRmI08CNA 5nM/L04Jsd2Iqtldl1TxhQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ymh1gjcm3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 13 Jun 2024 18:55:19 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 45DIP7oK014436 for ; Thu, 13 Jun 2024 18:55:18 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3yncexba5h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 13 Jun 2024 18:55:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=enQysr2uI76meEGu7k2lxPuXWLwBUcjJcR6OEADg0WsIBTMaLe2HQu+zgygRdxIEBxLMp8AgbOqJm/IJa/gE0dgnEciaeP6jYRrzi+udbgcW1uAfFSmElKxAit9XUro1kM73gb9UpcZzOZknd0mA1frb+YeHUKo0NFXptXvDbVGcJaIWnRssg+rjwuK2RWPmLm8rlWwN8y1g7mkuocrZtJpyqmfYZjwy729FxioxEkoZhmbMSYDKxx7Mgz4JcuwKneDn/DRnz/nod7oh+UM8TXGtHL8FzDVqxh9ibB/HImtXt7+CVodbpWu4uKl0njsk1DMtKydG4aEYeRpFpBoHHA== 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=KoQG90uJHYWg79UEh419/m751U4Ql8VFNq8+7PlQjSk=; b=DuXMH2xCLqxZfi1G2MSek4QHv8TFQSpH5QkvPSJN7muvbr4R8vKSTfFRw6dpv4gMMW7kg1XpUlOWoJgusVlcz5wjaqTX2vc9k0yhuTF3/ng7EL6Xqemlb6hsx1xXxplHdl9nyR3Ulc4li8jbwx2lhcxz+QW1GxnSNGkPXDsN8XcSXd6fc+xtHNC2AkjyyMStsW6RdKnPJEv83uLT4yZyCLFRLRiJXXz1iAbrO0WisDR8kw+1HFYIDyzeef45pBvASBTTd/pwdoJ/d5X2rAjvWJl3iA05zs0v9y9yVk2BNFgJ6cKpYogvDQqDEEFlzWwVsJ5xQwQD9xaUV7tj+ZLepQ== 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=KoQG90uJHYWg79UEh419/m751U4Ql8VFNq8+7PlQjSk=; b=Sh0S6psQM+rBG7dmU6xJEMji0C+pWTyUx7uyBLflfaMvL2gbW9gGZMZke8Ax8sAzeGBnxo+KLS2DZc/pe0cDi4Wv9BMir4uYDqrPFwYq+BSA5LgeRdy4O4G5Z3QDt6Fe4lIsgg7qVBS2tlTSSVRLm5LW0Npm2Q9/r+yUvOlD/Pk= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by CO1PR10MB4451.namprd10.prod.outlook.com (2603:10b6:303:96::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.20; Thu, 13 Jun 2024 18:55:16 +0000 Received: from MW4PR10MB6608.namprd10.prod.outlook.com ([fe80::b53a:ccc1:c190:c5df]) by MW4PR10MB6608.namprd10.prod.outlook.com ([fe80::b53a:ccc1:c190:c5df%6]) with mapi id 15.20.7677.024; Thu, 13 Jun 2024 18:55:16 +0000 From: Nick Alcock To: binutils@sourceware.org Cc: stephen.brennan@oracle.com Subject: [PATCH 08/11] libctf: prohibit addition of enums with overlapping enumerator constants Date: Thu, 13 Jun 2024 19:54:27 +0100 Message-ID: <20240613185430.85352-9-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.1.275.g567cb0950c In-Reply-To: <20240613185430.85352-1-nick.alcock@oracle.com> References: <20240613185430.85352-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO2P265CA0473.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a2::29) To MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR10MB6608:EE_|CO1PR10MB4451:EE_ X-MS-Office365-Filtering-Correlation-Id: a07b15ec-da71-4a9e-624d-08dc8bda5ce2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230035|376009|1800799019|366011; X-Microsoft-Antispam-Message-Info: 5mw8NlFjBS5WwNIFCfwSICKDcKjHaegRIgmNxfi/BpQMmcQfGUfQ6Grb4itQFv0voU+gFWbkFoSfThNwPwb0SE+l2/iM13mavTr+Shy0rFXDuUOcMF0akO1fnjSvyTsEDKx+mSByFTxbZTqA2rHcaCBplg5isxAqKZOgvR1zJR69dGzQkMyW8F4gMyN5+IJcL4qd25oxMjnmFpIUKeZ1KwFkY+lFk6+6vwbFsjGKhM0DVTSu3dNzf/UZ1h5jvrRh+y+uU1Bq7nhPoZEbH6RCXgnCzkmqMN2eQPsgRN5EY8Se4wRd/lvh38Kb6W3Dn484lrcld1b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IPV:NLI; SFV:NSPM; H:MW4PR10MB6608.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230035)(376009)(1800799019)(366011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VxQQmUt+ENhcDyLs24XwJ6z/br8mZk2luIBNqd6gLfXI+68WEBbkg+hSFPhcRdxt2GK7cVfMvU/akfEZFbRi4vWGnEOvYVtjCYai4YsFP/0JU05g9MX62c1bm8LNepfpFbtn0MTR+ZJMggqbabQxbOBWaBCCXIBGbXTwEG6FzARmQ4xAxdX766ePmkxteCm3tXK3cpS24p7PeLPsd1pV+1utICZpOeG69t1AFXSAv2+6tFw8koVSbH+8aYZmkMNhCymVkqEUeUtJquBw6Z2F8wI3PsmeoW7wpAGZW0swMScIuv3MSFEPYa6OEKoFtO1XqieMPC7U05llIGBQz/1QKQsSCNar9iAlNLyYLzlI6Db3p3z1YOzt1LIJqaG0744UsMOyOs6F5Obr0OmUW+PhEXitWKULU+9zphh5wcXZPciVSSh2WMWlyJCnINwJQrh2SAGd0MG4cjuTd1HM/TFEmHUi+mDEIF5b8fsyo3ufZ6/nS/8dk0cLZmWJIEP+3m/xGBMhHZ0a+5wZW+qcorPtszlDlYsOmXSC7EI4uHJU2ivh7+wKF9UKNq3apynd6MZwXaQjztT9qAPnjkjBM/Qsp2wWvwkxwlwCjCdSI+quy+JrAeHStMA13xaxP1LlK/LC4HpfwQYCo2X19RQ2QaEgeAWf5WnBs44JOM/n5b6FUdsWitKB4wVNbdtFO69c9/JnmaRQFvutvjfwcdsCT8V1NlIYj+uSAwllWVEGtcAxdJ4X+Ns5ItMcbXMntmtBN8kduzjxFbQQXBpS8xiL51VSzERYZT6XLJvmjt6d0OZvbC4oKNMjEJZQUPd2VBggSqyhdSPRkvwxXoNaZif82vnypVnYVaORQj/izgDkSIyp6g9KPUBmjmzfzWOUl4xWFJk+hlnxqHd6viW48f/94v30Io1OM5CrGA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hHtVNKdBVYPAbEaDTp8yflAGOb9nbwGzVmpgmoy3Uj/mcquJP7MmIj7Evdth1nS6eqB7nYx6sTkzzxtm6Bu/r1ZnDfVlL1Sy2XkuoJ32JkBRlM4w1rgMgVDBTmITSvKXVHD/6ckjOMt/tz1nJMxgDE/BWyWcim3Yw+fs9QYYwcMxt7dBecqVMrqB/a60syzgClxhaAZFZjBd/U8YGFLaKUnYpAVHyTF6OO/LFVyxi5p6EGEXdN1w/C4LZIeFGK2hNtXJawe5nJ5EYDm2Hqo88e/rE4ciJo8X/q5Of0yBE7hUreJCY11E= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a07b15ec-da71-4a9e-624d-08dc8bda5ce2 X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2024 18:55:15.9635 (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: e7stqvqV+e08HYdeD29Fv36njdCPQtIrvE2duOHyL8Pkz5iPMACrE5W2nmpaiZ+TR5LTdqJ5MoiStP0ogfOriA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4451 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-13_11,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406130134 X-Proofpoint-ORIG-GUID: Re5S1h_q02jg19CEGtCKnSMbnWn6yACW X-Proofpoint-GUID: Re5S1h_q02jg19CEGtCKnSMbnWn6yACW X-Spam-Status: No, score=-12.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_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: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org libctf has long prohibited addition of enums with overlapping constants in a single enum, but now that we are properly considering enums with overlapping constants to be conflciting types, we can go further and prohibit addition of enumeration constants to a dict if they already exist in any enum in that dict: the same rules as C itself. We do this in a fashion vaguely similar to what we just did in the deduplicator, by considering enumeration constants as identifiers and adding them to the core type/identifier namespace, ctf_dict_t.ctf_names. This is a little fiddly, because we do not want to prohibit opening of existing dicts into which the deduplicator has stuffed enums with overlapping constants! We just want to prohibit the addition of *new* enumerators that violate that rule. Even then, it's fine to add overlapping enumerator constants as long as at least one of them is in a non-root type. (This is essential for proper deduplicator operation in cu-mapped mode, where multiple compilation units can be smashed into one dict, with conflicting types marked as hidden: these types may well contain overlapping enumerators.) So, at open time, keep track of all enums observed, then do a third pass through the enums alone, adding each enumerator either to the ctf_names table as a mapping from the enumerator name to the enum it is part of (if not already present), or to a new ctf_conflicting_enums hashtable that tracks observed duplicates. (The latter is not used yet, but will be soon.) (We need to do a third pass because it's quite possible to have an enum containing an enumerator FOO followed by a type FOO: since they're processed in order, the enumerator would be processed before the type, and at that stage it seems nonconflicting. The easiest fix is to run through the enumerators after all type names are interned.) At ctf_add_enumerator time, if the enumerator to which we are adding a type is root-visible, check for an already-present name and error out if found, then intern the new name in the ctf_names table as is done at open time. (We retain the existing code which scans the enum itself for duplicates because it is still an error to add an enumerator twice to a non-root-visible enum type; but we only need to do this if the enum is non-root-visible, so the cost of enum addition is reduced.) Tested in an upcoming commit. libctf/ * ctf-impl.h (ctf_dict_t) : Augment comment. : New. (ctf_dynset_elements): New. * ctf-hash.c (ctf_dynset_elements): Implement it. * ctf-open.c (init_static_types): Split body into... (init_static_types_internal): ... here. Count enumerators; keep track of observed enums in pass 2; populate ctf_names and ctf_conflicting_enums with enumerators in a third pass. (ctf_dict_close): Free ctf_conflicting_enums. * ctf-create.c (ctf_add_enumerator): Prohibit addition of duplicate enumerators in root-visible enum types. include/ * ctf-api.h (CTF_ADD_NONROOT): Describe what non-rootness means for enumeration constants. (ctf_add_enumerator): The name is not a misnomer. We now require that enumerators have unique names. Document the non-rootness of enumerators. --- include/ctf-api.h | 13 +++-- libctf/ctf-create.c | 41 +++++++++++--- libctf/ctf-hash.c | 6 ++ libctf/ctf-impl.h | 5 +- libctf/ctf-open.c | 134 +++++++++++++++++++++++++++++++++++++++----- 5 files changed, 171 insertions(+), 28 deletions(-) diff --git a/include/ctf-api.h b/include/ctf-api.h index 85734afcac2..d7bdbdd0dac 100644 --- a/include/ctf-api.h +++ b/include/ctf-api.h @@ -268,9 +268,11 @@ _CTF_ERRORS #endif /* Dynamic CTF containers can be created using ctf_create. The ctf_add_* - routines can be used to add new definitions to the dynamic container. - New types are labeled as root or non-root to determine whether they are - visible at the top-level program scope when subsequently doing a lookup. */ + routines can be used to add new definitions to the dynamic container. New + types are labeled as root or non-root to determine whether they are visible + at the top-level program scope when subsequently doing a lookup. + (Identifiers contained within non-root types, like enumeration constants, are + also not visible.) */ #define CTF_ADD_NONROOT 0 /* Type only visible in nested scope. */ #define CTF_ADD_ROOT 1 /* Type visible at top-level scope. */ @@ -785,9 +787,8 @@ extern ctf_id_t ctf_add_union_sized (ctf_dict_t *, uint32_t, const char *, extern ctf_id_t ctf_add_unknown (ctf_dict_t *, uint32_t, const char *); extern ctf_id_t ctf_add_volatile (ctf_dict_t *, uint32_t, ctf_id_t); -/* Add an enumerator to an enum (the name is a misnomer). We do not currently - validate that enumerators have unique names, even though C requires it: in - future this may change. */ +/* Add an enumerator to an enum. If the enum is non-root, so are all the + constants added to it by ctf_add_enumerator. */ extern int ctf_add_enumerator (ctf_dict_t *, ctf_id_t, const char *, int); diff --git a/libctf/ctf-create.c b/libctf/ctf-create.c index 073006b24ea..d6746030918 100644 --- a/libctf/ctf-create.c +++ b/libctf/ctf-create.c @@ -1048,7 +1048,6 @@ ctf_add_enumerator (ctf_dict_t *fp, ctf_id_t enid, const char *name, ctf_dtdef_t *dtd = ctf_dtd_lookup (fp, enid); unsigned char *old_vlen; ctf_enum_t *en; - size_t i; uint32_t kind, vlen, root; @@ -1068,6 +1067,12 @@ ctf_add_enumerator (ctf_dict_t *fp, ctf_id_t enid, const char *name, root = LCTF_INFO_ISROOT (fp, dtd->dtd_data.ctt_info); vlen = LCTF_INFO_VLEN (fp, dtd->dtd_data.ctt_info); + /* Enumeration constant names are only added, and only checked for duplicates, + if the enum they are part of is a root-visible type. */ + + if (root == CTF_ADD_ROOT && ctf_dynhash_lookup (fp->ctf_names, name)) + return (ctf_set_errno (ofp, ECTF_DUPLICATE)); + if (kind != CTF_K_ENUM) return (ctf_set_errno (ofp, ECTF_NOTENUM)); @@ -1075,24 +1080,46 @@ ctf_add_enumerator (ctf_dict_t *fp, ctf_id_t enid, const char *name, return (ctf_set_errno (ofp, ECTF_DTFULL)); old_vlen = dtd->dtd_vlen; + if (ctf_grow_vlen (fp, dtd, sizeof (ctf_enum_t) * (vlen + 1)) < 0) return -1; /* errno is set for us. */ + en = (ctf_enum_t *) dtd->dtd_vlen; /* Remove refs in the old vlen region and reapply them. */ ctf_str_move_refs (fp, old_vlen, sizeof (ctf_enum_t) * vlen, dtd->dtd_vlen); - for (i = 0; i < vlen; i++) - if (strcmp (ctf_strptr (fp, en[i].cte_name), name) == 0) - return (ctf_set_errno (ofp, ECTF_DUPLICATE)); + /* Check for constant duplication within any given enum: only needed for + non-root-visible types, since the duplicate detection above does the job + for root-visible types just fine. */ - en[i].cte_name = ctf_str_add_movable_ref (fp, name, &en[i].cte_name); - en[i].cte_value = value; + if (root == CTF_ADD_NONROOT) + { + size_t i; - if (en[i].cte_name == 0 && name != NULL && name[0] != '\0') + for (i = 0; i < vlen; i++) + if (strcmp (ctf_strptr (fp, en[i].cte_name), name) == 0) + return (ctf_set_errno (ofp, ECTF_DUPLICATE)); + } + + en[vlen].cte_name = ctf_str_add_movable_ref (fp, name, &en[vlen].cte_name); + en[vlen].cte_value = value; + + if (en[vlen].cte_name == 0 && name != NULL && name[0] != '\0') return (ctf_set_errno (ofp, ctf_errno (fp))); + /* Put the newly-added enumerator name into the name table if this type is + root-visible. */ + + if (root == CTF_ADD_ROOT) + { + if (ctf_dynhash_insert (fp->ctf_names, + (char *) ctf_strptr (fp, en[vlen].cte_name), + (void *) (uintptr_t) enid) < 0) + return ctf_set_errno (fp, ENOMEM); + } + dtd->dtd_data.ctt_info = CTF_TYPE_INFO (kind, root, vlen + 1); return 0; diff --git a/libctf/ctf-hash.c b/libctf/ctf-hash.c index 77b8478479e..a52f96db105 100644 --- a/libctf/ctf-hash.c +++ b/libctf/ctf-hash.c @@ -651,6 +651,12 @@ ctf_dynset_remove (ctf_dynset_t *hp, const void *key) htab_remove_elt ((struct htab *) hp, key_to_internal (key)); } +size_t +ctf_dynset_elements (ctf_dynset_t *hp) +{ + return htab_elements ((struct htab *) hp); +} + void ctf_dynset_destroy (ctf_dynset_t *hp) { diff --git a/libctf/ctf-impl.h b/libctf/ctf-impl.h index eb89f8b4645..ec0b4feb328 100644 --- a/libctf/ctf-impl.h +++ b/libctf/ctf-impl.h @@ -387,7 +387,8 @@ struct ctf_dict ctf_dynhash_t *ctf_structs; /* Hash table of struct types. */ ctf_dynhash_t *ctf_unions; /* Hash table of union types. */ ctf_dynhash_t *ctf_enums; /* Hash table of enum types. */ - ctf_dynhash_t *ctf_names; /* Hash table of remaining type names. */ + ctf_dynhash_t *ctf_names; /* Hash table of remaining types, plus + enumeration constants. */ ctf_lookup_t ctf_lookups[5]; /* Pointers to nametabs for name lookup. */ ctf_strs_t ctf_str[2]; /* Array of string table base and bounds. */ ctf_strs_writable_t *ctf_dynstrtab; /* Dynamically allocated string table, if any. */ @@ -407,6 +408,7 @@ struct ctf_dict uint32_t *ctf_pptrtab; /* Parent types pointed to by child dicts. */ size_t ctf_pptrtab_len; /* Num types storable in pptrtab currently. */ uint32_t ctf_pptrtab_typemax; /* Max child type when pptrtab last updated. */ + ctf_dynset_t *ctf_conflicting_enums; /* Tracks enum constants that conflict. */ uint32_t *ctf_funcidx_names; /* Name of each function symbol in symtypetab (if indexed). */ uint32_t *ctf_objtidx_names; /* Likewise, for object symbols. */ @@ -669,6 +671,7 @@ extern int ctf_dynhash_next_sorted (ctf_dynhash_t *, ctf_next_t **, extern ctf_dynset_t *ctf_dynset_create (htab_hash, htab_eq, ctf_hash_free_fun); extern int ctf_dynset_insert (ctf_dynset_t *, void *); extern void ctf_dynset_remove (ctf_dynset_t *, const void *); +extern size_t ctf_dynset_elements (ctf_dynset_t *); extern void ctf_dynset_destroy (ctf_dynset_t *); extern void *ctf_dynset_lookup (ctf_dynset_t *, const void *); extern int ctf_dynset_exists (ctf_dynset_t *, const void *key, diff --git a/libctf/ctf-open.c b/libctf/ctf-open.c index 59c6ed0622a..2ae0a696c3a 100644 --- a/libctf/ctf-open.c +++ b/libctf/ctf-open.c @@ -670,24 +670,50 @@ upgrade_types (ctf_dict_t *fp, ctf_header_t *cth) return 0; } +static int +init_static_types_internal (ctf_dict_t *fp, ctf_header_t *cth, + ctf_dynset_t *all_enums); + /* Populate statically-defined types (those loaded from a saved buffer). Initialize the type ID translation table with the byte offset of each type, and initialize the hash tables of each named type. Upgrade the type table to the latest supported representation in the process, if needed, and if this - recension of libctf supports upgrading. */ + recension of libctf supports upgrading. + + This is a wrapper to simplify memory allocation on error in the _internal + function that does all the actual work. */ static int init_static_types (ctf_dict_t *fp, ctf_header_t *cth) +{ + ctf_dynset_t *all_enums; + int err; + + if ((all_enums = ctf_dynset_create (htab_hash_pointer, htab_eq_pointer, + NULL)) == NULL) + return ENOMEM; + + err = init_static_types_internal (fp, cth, all_enums); + ctf_dynset_destroy (all_enums); + return err; +} + +static int +init_static_types_internal (ctf_dict_t *fp, ctf_header_t *cth, + ctf_dynset_t *all_enums) { const ctf_type_t *tbuf; const ctf_type_t *tend; unsigned long pop[CTF_K_MAX + 1] = { 0 }; + int pop_enumerators = 0; const ctf_type_t *tp; uint32_t id; uint32_t *xp; unsigned long typemax = 0; + ctf_next_t *i = NULL; + void *k; /* We determine whether the dict is a child or a parent based on the value of cth_parname. */ @@ -706,8 +732,10 @@ init_static_types (ctf_dict_t *fp, ctf_header_t *cth) tbuf = (ctf_type_t *) (fp->ctf_buf + cth->cth_typeoff); tend = (ctf_type_t *) (fp->ctf_buf + cth->cth_stroff); - /* We make two passes through the entire type section. In this first - pass, we count the number of each type and the total number of types. */ + /* We make two passes through the entire type section, and one third pass + through part of it. In this first pass, we count the number of each type + and type-like identifier (like enumerators) and the total number of + types. */ for (tp = tbuf; tp < tend; typemax++) { @@ -728,6 +756,9 @@ init_static_types (ctf_dict_t *fp, ctf_header_t *cth) tp = (ctf_type_t *) ((uintptr_t) tp + increment + vbytes); pop[kind]++; + + if (kind == CTF_K_ENUM) + pop_enumerators += vlen; } if (child) @@ -765,11 +796,16 @@ init_static_types (ctf_dict_t *fp, ctf_header_t *cth) pop[CTF_K_POINTER] + pop[CTF_K_VOLATILE] + pop[CTF_K_CONST] + - pop[CTF_K_RESTRICT], + pop[CTF_K_RESTRICT] + + pop_enumerators, ctf_hash_string, ctf_hash_eq_string, NULL, NULL)) == NULL) return ENOMEM; + if ((fp->ctf_conflicting_enums + = ctf_dynset_create (htab_hash_string, htab_eq_string, NULL)) == NULL) + return ENOMEM; + /* The ptrtab and txlate can be appropriately sized for precisely this set of types: the txlate because it is only used to look up static types, so dynamic types added later will never go through it, and the ptrtab @@ -793,6 +829,8 @@ init_static_types (ctf_dict_t *fp, ctf_header_t *cth) /* In the second pass through the types, we fill in each entry of the type and pointer tables and add names to the appropriate hashes. + (Not all names are added in this pass, only type names. See below.) + Bump ctf_typemax as we go, but keep it one higher than normal, so that the type being read in is considered a valid type and it is at least barely possible to run simple lookups on it. */ @@ -902,16 +940,25 @@ init_static_types (ctf_dict_t *fp, ctf_header_t *cth) break; case CTF_K_ENUM: - if (!isroot) + { + if (!isroot) + break; + + err = ctf_dynhash_insert_type (fp, fp->ctf_enums, + LCTF_INDEX_TO_TYPE (fp, id, child), + tp->ctt_name); + + if (err != 0) + return err; + + /* Remember all enums for later rescanning. */ + + err = ctf_dynset_insert (all_enums, (void *) (ptrdiff_t) + LCTF_INDEX_TO_TYPE (fp, id, child)); + if (err != 0) + return err; break; - - err = ctf_dynhash_insert_type (fp, fp->ctf_enums, - LCTF_INDEX_TO_TYPE (fp, id, child), - tp->ctt_name); - - if (err != 0) - return err; - break; + } case CTF_K_TYPEDEF: if (!isroot) @@ -976,13 +1023,71 @@ init_static_types (ctf_dict_t *fp, ctf_header_t *cth) assert (fp->ctf_typemax == typemax); ctf_dprintf ("%lu total types processed\n", fp->ctf_typemax); + + /* In the third pass, we traverse the enums we spotted earlier and add all + the enumeration constants therein either to the types table (if no + type exists with that name) or to ctf_conflciting_enums (otherwise). + + Doing this in a third pass is necessary to avoid the case where an + enum appears with a constant FOO, then later a type named FOO appears, + too late to spot the conflict by checking the enum's constants. */ + + while ((err = ctf_dynset_next (all_enums, &i, &k)) == 0) + { + ctf_id_t enum_id = (uintptr_t) k; + ctf_next_t *i_constants = NULL; + const char *cte_name; + + while ((cte_name = ctf_enum_next (fp, enum_id, &i_constants, NULL)) != NULL) + { + /* Add all the enumeration constants as identifiers. They all appear + as types that cite the original enum. + + Constants that appear in more than one enum, or which are already + the names of types, appear in ctf_conflicting_enums as well. */ + + if (ctf_dynhash_lookup_type (fp->ctf_names, cte_name) == 0) + { + uint32_t name = ctf_str_add (fp, cte_name); + + if (name == 0) + goto enum_err; + + err = ctf_dynhash_insert_type (fp, fp->ctf_names, enum_id, name); + } + else + { + err = ctf_dynset_insert (fp->ctf_conflicting_enums, (void *) + cte_name); + + if (err != 0) + goto enum_err; + } + continue; + + enum_err: + ctf_next_destroy (i_constants); + ctf_next_destroy (i); + return ctf_errno (fp); + } + if (ctf_errno (fp) != ECTF_NEXT_END) + { + ctf_next_destroy (i); + return ctf_errno (fp); + } + } + if (err != ECTF_NEXT_END) + return err; + ctf_dprintf ("%zu enum names hashed\n", ctf_dynhash_elements (fp->ctf_enums)); + ctf_dprintf ("%zu conflicting enumerators identified\n", + ctf_dynset_elements (fp->ctf_conflicting_enums)); ctf_dprintf ("%zu struct names hashed (%d long)\n", ctf_dynhash_elements (fp->ctf_structs), nlstructs); ctf_dprintf ("%zu union names hashed (%d long)\n", ctf_dynhash_elements (fp->ctf_unions), nlunions); - ctf_dprintf ("%zu base type names hashed\n", + ctf_dprintf ("%zu base type names and identifiers hashed\n", ctf_dynhash_elements (fp->ctf_names)); return 0; @@ -1786,6 +1891,7 @@ ctf_dict_close (ctf_dict_t *fp) } ctf_dynhash_destroy (fp->ctf_dthash); + ctf_dynset_destroy (fp->ctf_conflicting_enums); ctf_dynhash_destroy (fp->ctf_structs); ctf_dynhash_destroy (fp->ctf_unions); ctf_dynhash_destroy (fp->ctf_enums); From patchwork Thu Jun 13 18:54:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 92113 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 30DF83882168 for ; Thu, 13 Jun 2024 18:59:47 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 66A4A3882059 for ; Thu, 13 Jun 2024 18:55:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 66A4A3882059 Authentication-Results: sourceware.org; dmarc=pass (p=reject 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 66A4A3882059 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=1718304924; cv=pass; b=uTtKheHzcQ+LYJ/c1yixH1sl7WOsfd2Ka2ff/s15j8n/clPGatwPECDAAJossGPiJ2DU46vys23D47uDzSnahJOW1MK9ex8WL9vbapmmQ3rjVSgzNFLyCUDFrp4rZV43R4w4Kx6xtE+hn6ypGWHYHyWTpH/6HjjQ+jKfjcCoFBA= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1718304924; c=relaxed/simple; bh=lUENVQ7piF0HRNlmPjnAmWvQrQFfHEiHa6H7sY6m5NY=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=sOHr6TCb3ZQvQNeY5suZsBkdihTUQ8WSlXFaOpRTwDiM9rvhdpvNzSZ8Xqdwsgkvg/CIauS7nm6hvYncRbQ7KlrSfndYFj1X7G82APuA1C/IDCdBBCyeGfW9BfQS/Mk9D5az7E4RBGQW2N6sMxlVxnetAK/n9K4Qneo/oBRUO78= 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.18.1.2/8.18.1.2) with ESMTP id 45DEtZwL004809 for ; Thu, 13 Jun 2024 18:55:23 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=tM9nrdrUTGifEQUR1RU4L4dF+AgKT8isjV0y5EaPLOQ=; b= kKOzbuhAjKmJEmnyUnhqZrFVJgJ0NNiMuJ7aYGHYjDFjln3dLkpvshXtL8AdiQv+ KdfoGP8IW3OfxaRkGcL55aB7HSxahj1meYMKva8nyAkRRmgmxlOUhzfRZ59G512v ZGwwFRY6pyMs4OC63E95YBpfGboPUThFaYhq1dQLMdRmyFrrL8XNIi8ig2yAY75X pWmw92bnbuZ3aSw2Ly1Gqcqi1WztKFHh3AYvw4cAEf+LbxIL0xQafKRkxdg0YWWR HkspT038OwEGQxqNuJxy7oTPh6MxYmFJ+Nsfl28XxM+xyPpQW66QBRDw3hWLEGJg 9sv0Rmj3S8NL4UNnw/DAzQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ymh19a79q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 13 Jun 2024 18:55:22 +0000 (GMT) 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 45DHRXCV020152 for ; Thu, 13 Jun 2024 18:55:21 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2040.outbound.protection.outlook.com [104.47.55.40]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3ync91khvn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 13 Jun 2024 18:55:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K4plHEq3+5vyphdMsM1Lg8qSAojsLZPmTmJVFuKKlmWbyXMPmzSaK5UMYpRoDn08BB3NsbxC/rO/6N59/nVkC/gTFF+TeVpfsueLJmvk8PVbxr4KTItvqvyu3KS8m0DkAqGuKHJilKqV5YHnW8af2NgpE7xbuyO935eL2f0tMvxD2Pl8CIlHoYRVfBYP3iHjS0B65FL9SdzeffqGsEfamS8Mr6Bhhhf2zFou5NiRH2Ihm6Qkh0dUMUrto5F2fOmT3drqYVJI4SUuEOJFQx53QuI0vs5hZGW7AZeigVala3H1Lx6M+A20nTGPWADy6TBM9j8EILjvUhq6Lpp/u+wv1w== 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=tM9nrdrUTGifEQUR1RU4L4dF+AgKT8isjV0y5EaPLOQ=; b=kNOdW87bUm1RNnquTzP7s0JOB1ghmCE4xJqgYyod+Hxiuf1thm2vLPBDGCZyPPfQHdJuKbyjE9y3R3jRhrwdqSWULi+dtRLOTTlBR/yNMff8M8nnM/nBJld3FLWCEtSc6Q4T8nKkF4Ou/d393K68IehsTk0QQmuViMydIKf+2QHh8NFwUwUl6NO8Q/+xVGJTfo+DTyBGC1xTsRimc+N2pAHDWaQBDRaWIwW4BZXvPsnYcOhm7gymz5VEgUXZZIGVVstKOQEWOEkRihcNmiKL2CCq1VE5SwgYEXJdPab+xNpUuwTNfB+2XaV9zrMbP0EIcofN/Q0fmg9ILGDwAh5Y7g== 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=tM9nrdrUTGifEQUR1RU4L4dF+AgKT8isjV0y5EaPLOQ=; b=TtGvx+evKFxvsKFCN7ipLbjW+9vaDMIxv9J0pa14bUq1FGP3wE+0h183TjqLJaxCiE2ey+l2mNMeZNrQN8vrXqYIq5yp1VO+jKFByCGyX+nwnyz2BO/0vOKAW5NJYSCPOnS4qSrobHN7GfWw6JbAhycw1/aMOgLVrTl3YvND35E= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by CH0PR10MB5116.namprd10.prod.outlook.com (2603:10b6:610:d9::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.21; Thu, 13 Jun 2024 18:55:19 +0000 Received: from MW4PR10MB6608.namprd10.prod.outlook.com ([fe80::b53a:ccc1:c190:c5df]) by MW4PR10MB6608.namprd10.prod.outlook.com ([fe80::b53a:ccc1:c190:c5df%6]) with mapi id 15.20.7677.024; Thu, 13 Jun 2024 18:55:19 +0000 From: Nick Alcock To: binutils@sourceware.org Cc: stephen.brennan@oracle.com Subject: [PATCH 09/11] libctf: make the ctf_next ctn_fp non-const Date: Thu, 13 Jun 2024 19:54:28 +0100 Message-ID: <20240613185430.85352-10-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.1.275.g567cb0950c In-Reply-To: <20240613185430.85352-1-nick.alcock@oracle.com> References: <20240613185430.85352-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO4P123CA0105.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:191::20) To MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR10MB6608:EE_|CH0PR10MB5116:EE_ X-MS-Office365-Filtering-Correlation-Id: 7058de22-c141-405b-dfc6-08dc8bda5f3a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230035|376009|1800799019|366011; X-Microsoft-Antispam-Message-Info: MwaaXYJgpaa0TOyDJJUf7gkvtArQBF0z/bDoe6nL2HQAOvoc4ZnDFXT8mL9/whV4le0wlfd4tpYqumtWVVvUdOdAPENlIMcVjmx6g9DKtBzFR4o3MuqAhpH9uysu39OrgcLLRuz6O4C1zz71r9pluaFG+8sMxtk4zecPV26URLcLjIIz1GoT6xX0mjNv/65NqiR/E5vKfo1MYsWfZfcPuLpvY9AzD5fuKhcasE7Fjjhqjv6rr3UOEI7SBMcs0BWLRo5m8RXqyNEsbBVZ5EKGqkOs1C8ma3IWTL2F+h24DtBO1AuejNdvRFt/pLeYefGNbrw+4BtjTsGZ2v+8MUhnOtp4WhrpKEt9sa+SssWNXX6cc+xOBtVKgeVUARlPra+HkGT4XNr2PRX+thda7Nv8l4nIOYsiDC3rlo3fsHI9GjZe7kPP9fyBnRseV9HfePAxyXZpizWuFJcg6wPatC/O37/Y7pwtLY+dN0r7yHTveuSY++YmMiiUfrZ+TBLoOGND/PfupPvFxZAsNlOyCzGb9R4GF9bC60tvCE/FCIogKHNz+6+HewzfKVrbBRsNlke+arE6GYExtyMeWXvNObAUuULA0hP+1p1CTCihW9u2b26aHQaRy+NguJnsxwJQltmrCjHT1FHzJ33ZU06OWoGdjYEqxkoG9N5R7uvFMN30E17myiytv8xY7sh6H0oBtcDiHy8ifXzeXAZ6anZZSm7E90C/s+IJ+swhDXugCh0MKg/M1oyKa9tycz5D6zkQ7jCuxqWrScvwuFexatXkgPVkAVTuIhzpfhSNjIRlaFa5Ngah8aukfGVEr0nxpBs0zODXFhM1FACsIKuBtt6aFdMVX6XpOYM6HmeIgFi5NGvFTnCVC9PGwKygk9ZY+D5CiWoyBcg8nI56z5V0/5m3GyzBN2Qn9mGwbbiQEMBMbPYR/+EE/iIHYAi6F0lBBZYY2a4hw6XfyezUvBVwdoVcC118oJrO3WWw1rFQLFD2a8pZRsDpQT6HP2TVuOoiYu10Cu0DkNafm6juYz0ZEetF6pWyUlrdYZ5ycwDqgwlyV9sUqT3cGIailVkCor4SPQnY7JK64uWtK4dO+mucOAHlsjHuI84biuBNpWRdn0tSBLH5CUJTfQ0zRYX2cTKz5qfdVPahq1BDtmkNV2q0JPCWJjPs7qqFbY11+d5lW2LAEfqo0vzCII8xsEPWK7KeTBnEVpuVRXIphT+06PYGonGy365gSsEa9GUts4NTzwc5LnDpf1wk+vkEmitgERF2mnPPWewb0wBss8jLqoirVH/JfSGWjmg7NJCdFGWSQlY5gVtb9iddb3HWZwXWsoo01CIWTh+7 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW4PR10MB6608.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230035)(376009)(1800799019)(366011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IQHRTSgrFcR5yUPFKOwQ/TTlLdaGtNgAC7yF4+j0jIK3NcQnDJmIz6CR7o+gNHPjviH7SGFYqk7reaPRbx55olYvbGS6SYkzuH2wZQ5AQGe3OzEcjWEZ3s9PO+vLJLxKDt/uQELkmrTssUO5FfpigPBGP3AhjqCNrJK6ayCs3l0PgUnq976eJ79Fo1ibtt48DVtXD/ufxWNed8gWcSWapu+o/repM8BXFTIGkzZoErTdpx0Oj1cEsZTgaYSrxNno+nUSlLreuBqK471kgRL6Z8/PaxW7zwXbFh25i+u8/H0UcXhnboALcvbgos6lUde5EB5gKuYOsrqVjbvtpR18N7M8WR1hfTQT7oiE+BjWz9Ttk217zVPuEBFkxTnnHNGsvPKodog0bzkX+0Y6qTYoz2bgQtYYuxanBcFFUuIUZmXSt+rdeZaeytx87MJ5lV7RKQ2ydiduN7OG3UknJr9bYCoBmc1QdzU/fo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qfnRblmkC9G7E5LGS1qJzG5s9obeMcyZ38/kitrbhixJR8QbA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: rvNeitvQgLz7qwrxPHXyEV62OTbXKeXyQfpMBggZiTVGO0YHLwS0PfpviBQJK6CSY5cKQvQivJQn+VMQwi+BzcC/ZJZJK6fjpggyxiKk48Wegr3z7cZw/pOTnEC+5kCbw6kAl563VbaYfWDcGECKpQaBTPIxDqd7omgzADWoPhUNuAlamN+Q7bkxl4a8EbnBlBr0vmpHStj640jHWNH1tLvlAjnIJWTuTfYqKDCSs04ZtRgS9cSau99NTZo8i/gd0erH6DQd9E+cgToaonE2LB32rGNTLMfe6Gw8//fhagz8R+Rn5w1AwH0SM9vB0JBOw5nwTD9DH7uJVx01wxBtp3ptanpvnQgadf5Z9kR84CF2LVSCs3GfbkjNFOQyOQZXjEpaBHWzgH032gKcwgvHrRHyt7Fyhf/WEW1WDUtc8ZGYQFQ6MCZqv5URm8Jdc6kh2vaYcPwH7wrd1hNRv+J48j6/tcNmSk/kmLg4leX5aljJPpbG6+pcKrMSSkK9CBsA3lv8hXQVagrtuQyab0+5ajT+6Zx8H7nE7p738Mj2KFPh6Ne9im5csBn9AB3XLTu+ZgmwgkPq56QqAHvAcvu8XPLz8CCo2Fitjz3t2s9IEGw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7058de22-c141-405b-dfc6-08dc8bda5f3a X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2024 18:55:19.7217 (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: 1S98nQsT2UotpUn6yDttnCuSumL/vtFQr+ZldT8pUhzkM+YjOZN0KW48soSGlJCcfLX3wftSfRJH4AZCIfifWg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5116 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-13_11,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 spamscore=0 phishscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406130134 X-Proofpoint-GUID: o4hyzlKmvhuEqfB14XWA3_ONVIfTGQ0K X-Proofpoint-ORIG-GUID: o4hyzlKmvhuEqfB14XWA3_ONVIfTGQ0K X-Spam-Status: No, score=-12.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_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: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org This was always an error, because the ctn_fp routinely has errors set on it, which is not something you can (or should) do to a const object. libctf/ * ctf-impl.h (ctf_next_) : Make non-const. --- libctf/ctf-impl.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libctf/ctf-impl.h b/libctf/ctf-impl.h index ec0b4feb328..299d981a718 100644 --- a/libctf/ctf-impl.h +++ b/libctf/ctf-impl.h @@ -560,11 +560,13 @@ struct ctf_next void **ctn_hash_slot; } u; - /* This union is of various sorts of dict we can iterate over: - currently dictionaries and archives, dynhashes, and dynsets. */ + /* This union is of various sorts of dict we can iterate over: currently + archives, dictionaries, dynhashes, and dynsets. ctn_fp is non-const + because we need to set errors on it. */ + union { - const ctf_dict_t *ctn_fp; + ctf_dict_t *ctn_fp; const ctf_archive_t *ctn_arc; const ctf_dynhash_t *ctn_h; const ctf_dynset_t *ctn_s; From patchwork Thu Jun 13 18:54:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 92112 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 9A2AC388265C for ; Thu, 13 Jun 2024 18:58:34 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 346063882123 for ; Thu, 13 Jun 2024 18:55:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 346063882123 Authentication-Results: sourceware.org; dmarc=pass (p=reject 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 346063882123 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=1718304930; cv=pass; b=Hirvf7SpY2gd42DLdYs/j9kh99j+izXGH0QReZy/sp2rcSX/jIeXOnzqwa+yMpndKb//jUwWGXteqB1dmYON87hNtJgsiPxff54kcoOcxjl8L8AAYt+rbdQb6uqqvN7UeXkBkOagFN8Am2IT+H8KBzsKIjre6Gi7YBpuAMDoD5Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1718304930; c=relaxed/simple; bh=ZUFUAroKOy23h19obm+w+Z22uma4UDHhWktVE7wtUww=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=FP5kvcA7rvHVF0Yy+jwF/Uou8hcJdVJwWO44/O6YklYnCiFVAQPLlXPIQOKZmelC5NAMaQOAc1JMplGToeOU6VMVF1nohP0fT9fX9OmisXQeQpBkWBUwLxVLDw8zfsORQA9LezcIYImYR/qvFnbrve/hix/aGVgvbkSq+EVlYRk= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DEtPvu015002 for ; Thu, 13 Jun 2024 18:55:27 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=612BaANdK/V7HIQjRrn+KUFAQvJt6kqsown4DsIdE3I=; b= Wn+ixRQ6JH3v3oWjhODuejM0G0/8+OjlErlnZV0gvK8u/W+FakPioesFuyl1/doN 7tBwYbGIbedp81xYSAGdPSlPgdaCM7kz+IIY3Gu03nSpgH60pbfv0xWCx0eUtvK7 lUCbwWcPknto6mAg+t/kOvUe1L30RnjPdj//oEEFiUIsGahoEt/JkVx++kFUx8QE 7gOidL3gbfPT6Agp4NgyZLM/pjl6W8BSbZgJYmJ+BKk36SUhK2WDZbwUBc3tcH6t azwKv+AUsC8l66VJiwXp+ODT1Up3VV/HDmAfdcYQTflV/8uexDs3fxK3V+/y5kiW bwmr/T1cXguXdrad+ICA7w== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ymh1gjcmb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 13 Jun 2024 18:55:27 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 45DIGD07012575 for ; Thu, 13 Jun 2024 18:55:26 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2046.outbound.protection.outlook.com [104.47.55.46]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3ynca1f5bt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 13 Jun 2024 18:55:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hAsGRzXqa+z+GzPw4SqGp08BemR3xK0b/fQ9z2to8Pwj5HwhZRkHYRwk0PpWW2psfHm5FXWK0gkvuuH4NNb5KzUpg9Dtj8ZAM1NT55izJsyfgzaLmVrJlYocxPH1BCHVEKiimqJb/AX2S4LZf9UtR3wwetMd7uf0OcnU3nCUm96OQQ2ovlt2LS/VXmTtmT/khKOZzW09KL1IPzeJBhqRz6MkcZeILbg7dkb7xBhmA7FUT1XdCkZrwAIdylmecEByrst8wsRPl51jpk6eRAbYo9AJMPFMgrZ6PFtwjsrkpuOFxp/mCLrcXtpirVbseLVRQGxHorpoP4UkxVmAAikckA== 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=612BaANdK/V7HIQjRrn+KUFAQvJt6kqsown4DsIdE3I=; b=NJVGy5vT3I20BGl1E/ByFMGnkn/NT2baq0Evf541T6AtOOrnjndka4PnVyTdwgZPorUE9em4axca7pBQqvH3kacmFM9rsbppbbKouIguwlkJQHY2HYdeEiDbeelyn5rTqETdkbAJrYZgF6PAbicVJOTXiyCRc4vbQauw3r/SQ6P6HSnNTKqTZj+ZxR5r/U7Ipf5JHD9mG//Kj6mm/OnyCz0+lqv9ur5glEm5Twb9x64IE+a57bROt+BUGp7lJgtzwqpQcs1wXNO06S9bo0i+SLLy0KzjqVNAlQizk/i1rZ5K+Zrwgba0eROo6uVWBGxkQTV2nTaZKuRcHz8OU14hdg== 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=612BaANdK/V7HIQjRrn+KUFAQvJt6kqsown4DsIdE3I=; b=If16oMLgvOJtLg5GCGETIIPSh2utVzHb1l1YxuLrnKK+Bz4xmv4+BKGf3zYmErPigDV8MFrsQM5zPsYZWHaFOoYZ7HXQTrJyBvu0DsB3Tt8xcOQOmTGm0FdeWk7LSY52DVn9adZS0Gcbm1yoYp/5eTcRKpQRIyZBQjvrL6cz/RI= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by CH0PR10MB5116.namprd10.prod.outlook.com (2603:10b6:610:d9::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.21; Thu, 13 Jun 2024 18:55:24 +0000 Received: from MW4PR10MB6608.namprd10.prod.outlook.com ([fe80::b53a:ccc1:c190:c5df]) by MW4PR10MB6608.namprd10.prod.outlook.com ([fe80::b53a:ccc1:c190:c5df%6]) with mapi id 15.20.7677.024; Thu, 13 Jun 2024 18:55:24 +0000 From: Nick Alcock To: binutils@sourceware.org Cc: stephen.brennan@oracle.com Subject: [PATCH 10/11] include: libctf: comment improvements Date: Thu, 13 Jun 2024 19:54:29 +0100 Message-ID: <20240613185430.85352-11-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.1.275.g567cb0950c In-Reply-To: <20240613185430.85352-1-nick.alcock@oracle.com> References: <20240613185430.85352-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO4P123CA0106.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:191::21) To MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR10MB6608:EE_|CH0PR10MB5116:EE_ X-MS-Office365-Filtering-Correlation-Id: 37b20330-c8d2-4930-2623-08dc8bda61f9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230035|376009|1800799019|366011; X-Microsoft-Antispam-Message-Info: ml++nlIjwPuEfRRRE0tzLIlGTrPjeJMFQ4sWyCRwAHInn0RmThx1EKpptMBWjCtthbddywsvPtdSGE2JvCiYWOzuX6uer5mV8jcHe5L+VUjaIhU1ZQ3RxK42m0lABn95qeLItkdhrO/yut7QIMQWEqKft85q1CNO6FMCopNOhO/mJi2jgFGlggD2cvEbWVs7hDCV1yP28pqfU3YJSHLxYjStZEkSNYPvLczAc/XrQvXf36RFGW86ubRmoD1Rj2GszMlXGhA73AgmoCVg5KW5+KryDSQ3wzJ/zdjxH37ii3cJ0D4EqtRZSHTwRZ1II73/ZRSasX7rnufYgWeu2bfXcwbteiMFbcM87jB/EhCFdBfOhr0cjtrv163FVerm2gQ+dsohIDzkl5suqWKAC0jcDmoYFz3AJCrbnjq3BO/AnJS2Bovwt9jljWTbwN84RCyTbaTIQcLiii0I57CINUKWrzVMARf0gA2iGT90Kx8Q8YzDQuFj84PhoxnOGIMGDAWbmwcD1ngMTBC7Mu/TalMNMNkQjEpJTD2NsvEvyldKmWeR3m/JlyvhUo3If5AObMKLROwa+UQ+TbJp3NUOb9kaBFjl24/+OljqCLrGg/YlUYtgy8iS6QtWFQfj1mN6lj5BxKkLG+Apl4bpRlzPG047K7ADWozdE52rgADFRp7EIebSY88f6AWbxrNLXpOGYtx7oOOLjkkTAzdoQ/YYfYlvWUraAKmKuxJLXyn6kktWgw4aIZOJjADQ+3kVjIoYJpHEb6mbxMKiL4ltLy2qNKAduVq8QxmmhMshRXXil3B8KByTFAJZHYCIxfySz2/i6Y69DOc86+zBn3yu3QQ2RuoHW2wAKqwSGQW1SBpNifqni8XyqaqlvIQd3K0+pCh29n4FNdwILajP8PTvGk+SXrQiT3pBAYNHcyJlUaO7Gd15oQX1A+YRuXfCWsGfCXK34CP1XrEVlvwdl1ZjJVjygO6pggKb4GtvMZYVUXr5TR9E7Dv/hJ3Jy7LhDgAR0Oy/mLbCVYmxPPfJtfMBf7LM0NYMYPSF2toyxw0jTPd2RaMR1Q97h09W5QcTg1rN1yrFOFZzz+dfRur0my+6hkRvcc0tVkgZJ1JPfrfLKGRl57q36cJzl5Ue8wDnkO7MA7zVEZ0KAKnnoX58JZJH0m2sekea2PEr0tilX35yXwPgZFTFl08+vcB13gkgVOHaSf6eDp8fk3GyPt67167945lrZFreZlePWaY0zmFiq0aEv3gJUChJ2JZoaIQgEmBN7c0xHW/V6aFquC5MvTdr/I12e13JzQ/u3KOUBSlvkCa5tN0IMpiETIgHpZFdFe2d2ii5Pata X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW4PR10MB6608.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230035)(376009)(1800799019)(366011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: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2tE6Lvev3CJC4mLFJb2kaYew8UjECaI6Ti9WWsESsjy0HxPY4bW1eUQSPtJTGmiTiSGkwE/N4IDwpb40nL6ieiLTV0w0drTeXN48yQFU+Ch2aWY/UN8L4EazGW5zfOciyTnvlIc8KZ6YQ0MIA5XfTHzfnTGRdxg4aN4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 37b20330-c8d2-4930-2623-08dc8bda61f9 X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2024 18:55:24.4836 (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: lZ2sJ+6+FmBO4bt5cAK9UdsMOlz7wEnGFQqMRLaK9/wA0j/f0gYGuBZm12cuEZVEYOr3GhiOPQo9ZqsKoGcvNw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5116 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-13_11,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 phishscore=0 suspectscore=0 malwarescore=0 mlxscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406130134 X-Proofpoint-ORIG-GUID: _xV3qbPygW5z74jhvHpGSu6ls5-WAw4_ X-Proofpoint-GUID: _xV3qbPygW5z74jhvHpGSu6ls5-WAw4_ X-Spam-Status: No, score=-12.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_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: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org Describe a bit more clearly what effects a type being non-root- visible has. More consistently use the term non-root-visible rather than hidden. Document ctf_enum_iter. include/ * ctf-api.h (ctf_enum_iter): Document. (ctf_type_iter): Hidden, not non-root. Mention that parent dictionaries are not traversed. --- include/ctf-api.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/ctf-api.h b/include/ctf-api.h index d7bdbdd0dac..d67db8be13f 100644 --- a/include/ctf-api.h +++ b/include/ctf-api.h @@ -663,6 +663,8 @@ extern int ctf_member_iter (ctf_dict_t *, ctf_id_t, ctf_member_f *, void *); extern ssize_t ctf_member_next (ctf_dict_t *, ctf_id_t, ctf_next_t **, const char **name, ctf_id_t *membtype, int flags); + +/* Return all enumeration constants in a given enum type. */ extern int ctf_enum_iter (ctf_dict_t *, ctf_id_t, ctf_enum_f *, void *); extern const char *ctf_enum_next (ctf_dict_t *, ctf_id_t, ctf_next_t **, int *); @@ -672,8 +674,9 @@ extern const char *ctf_enum_next (ctf_dict_t *, ctf_id_t, ctf_next_t **, CTF_ADD_ROOT was passed). All such types are returned, even if they are things like pointers that intrinsically have no name: this is the only effect of CTF_ADD_ROOT for such types. ctf_type_next allows you to choose whether - to see hidden types or not with the want_hidden arg: if set, the flag (if - passed) returns the hidden state of each type in turn. */ + to see non-root types or not with the want_hidden arg: if set, the flag (if + passed) returns the non-root state of each type in turn. Types in parent + dictionaries are not returned. */ extern int ctf_type_iter (ctf_dict_t *, ctf_type_f *, void *); extern int ctf_type_iter_all (ctf_dict_t *, ctf_type_all_f *, void *); From patchwork Thu Jun 13 18:54:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 92114 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 92CB9388211C for ; Thu, 13 Jun 2024 19:00:52 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 3EEB53882053 for ; Thu, 13 Jun 2024 18:55:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3EEB53882053 Authentication-Results: sourceware.org; dmarc=pass (p=reject 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 3EEB53882053 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=1718304939; cv=pass; b=GDHAq278X2QUPs6Q1cjRkgv0cDlE1CkhWlH5WzUyn1BeHDU4gNlddnbcSfcrN43JotZZlcPFDj0KAMX+GCmxUa6B3LSkK4YPvneyQk5ftuQExEYEiiQ2MtLCvB2rPte4zTG6iCiN2J/FDji6lL9V0bkuhh/dfuE/F4jrHbAtWwc= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1718304939; c=relaxed/simple; bh=G/txFiR7pqjOMekgqIcZio7ahD9iUmt9skX4vFa+Hps=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=nnVnVv3XDe1MS/qHFFbAkX7l/sxvKfQ5P0laajhIx82iprZyg9IxglJQnz5fs18GdNxia1/DpNz3Xvb6BlLxZWwz46OzqidYN97728eHMsyvJY4JFNzlS+iUMRs2KZpHnjKJzC6DHoSFW9E+eFpV9lyagHwxQJwZMwm1PI21QnY= 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.18.1.2/8.18.1.2) with ESMTP id 45DEtQ0U029007 for ; Thu, 13 Jun 2024 18:55:32 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=Z9N7YrunnY2y9PbWC1sck+eEwdf0qzN3JybqVQHt5gE=; b= cdQeaiT2+zJn87Y2BNNV/c+Pkgk+qWQkN54Le6EUg3ljop1oSMYKAzLqxLR+0cqO FWbA+X8KlDWjLpOOtSln914gcfrNJ6UcttpdwJ8BpSkMRo3biZVHcvZ8oL/eKe1O 4mGrzyLVxb31DwXaMGkYbvQFkXZBpQPeglCUC2zP08tBxR/CpIxWEA6Bj8fCVI9A pPlusEd72gekks6gapdgr9y3sz8a+o2guA1lFDjRRLwORyq1NCu7T4f5nDS259oP /JBmnLSQxDQOnrneQQKdd62yitTDQrX5ykarqbRU2DvaoXaVTzIQwpI5ksHo5fi6 KjMDKTgWTFv1H8DNHe0fig== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ymh1mj9ax-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 13 Jun 2024 18:55:32 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 45DHoNDE012563 for ; Thu, 13 Jun 2024 18:55:31 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2045.outbound.protection.outlook.com [104.47.55.45]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3ynca1f5fa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 13 Jun 2024 18:55:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VIdUJNQFLbd81qQQVrS4qZXHFpRwWQ+4lg02pdW5SJEa2U5QpVI8VJKSgVa6IwSkseksMIxr4r1uNqXLMN6I1UTs4OH/K/crqIzmEzWsVua7BE0WSGG043S+Mbwwyl5dOTFyJFG/YMtU5jtjKZnbD+WWbpmkV2ypmsQWoA1Bc3frF/GkFL67dd4lNjBXtDHjQsKA8Dxvu3SUQLWjHcXMLosfTDDblP9N0X/C/fjAu0E5A2FN8PhUELVl7Nn4zvVXBEw2FccPHVx9vCdeeDfrT5Pz1+AquneD3I/dEC9b4n/XEx1k5cHD8/Ft+o6IJTZiScFtiDOOGgwg1CI87SkrYg== 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=Z9N7YrunnY2y9PbWC1sck+eEwdf0qzN3JybqVQHt5gE=; b=kMq2DVMo6i95aAdF4YnnmO9UfKe3a8yl27Vd2kTDfZ9LyhAhfGn3Sr/S+th+3pSXds5YadJpD18l8tYyG3Es4amz9HyHKxq/YfuXQ7RwiCmB6f/G6OkrxtgDTfQm9EXLtkFK8HGmcgZ3DW+PLrTD0cZUASdFsQNA21HZogfAXC/hjMCPzUzVR9z6y6aulbI92rsKO4x1vbrsuRBS7rj7r7sloDVhhYovjrzgBooCnETlf9uK4XspzaXPeJCYzNM1bz7eh/OTssHdbEXnzJe7Pa6CEflNQYfAPEeOA+BwhDSowQ74AA38z5AjIBx6ewjBqqDUh23Tu6SJyH3VDIoKcg== 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=Z9N7YrunnY2y9PbWC1sck+eEwdf0qzN3JybqVQHt5gE=; b=FiiyJePW8mreXWUJJPy00Tt92gzZCf0ZaE0OrNjfmS6n2ndKCrLa5pLKDdjWDQKz77I3ViN8mgYoCfu8t3OkhZdtHmTA2uvLWcakFXvpbfS0xYJEAe1NhrvhN4U27w0uU97ER/yfhfHFLgHGDnQOJzBzma0krDTXjXwhpElVQ7g= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by CH0PR10MB5116.namprd10.prod.outlook.com (2603:10b6:610:d9::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.21; Thu, 13 Jun 2024 18:55:29 +0000 Received: from MW4PR10MB6608.namprd10.prod.outlook.com ([fe80::b53a:ccc1:c190:c5df]) by MW4PR10MB6608.namprd10.prod.outlook.com ([fe80::b53a:ccc1:c190:c5df%6]) with mapi id 15.20.7677.024; Thu, 13 Jun 2024 18:55:29 +0000 From: Nick Alcock To: binutils@sourceware.org Cc: stephen.brennan@oracle.com Subject: [PATCH 11/11] libctf, include: new functions for looking up enumerators Date: Thu, 13 Jun 2024 19:54:30 +0100 Message-ID: <20240613185430.85352-12-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.1.275.g567cb0950c In-Reply-To: <20240613185430.85352-1-nick.alcock@oracle.com> References: <20240613185430.85352-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO6P265CA0006.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:339::15) To MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR10MB6608:EE_|CH0PR10MB5116:EE_ X-MS-Office365-Filtering-Correlation-Id: 865d5eeb-0e06-4836-b5ad-08dc8bda64b7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230035|376009|1800799019|366011; X-Microsoft-Antispam-Message-Info: cPIwDmFZaMWAuxpaMPKNYx2RjRjO9YFGCC9QU2LPnqjy0Bx4IaL/gKjb8lenmwqm++Xh5caaYk/7+miPhMUJ05WbKG0rt+NW5aUo5MvduvbVpLDLJAsahsF/ADAeUh0alA7csvNB/RBvwFvUyU6kyuIZNDgpk0qLfhQpyWF8SwgUccsqSTrShezLVMsNbgnQ9vXD6UKZ2s3WkPtjvydz4FVwVotv3F1jGbuI7PVmFgnNjFedLRT6nu+xAoNd1ObRIadGtCxIOPjXVCBk7t271w3htuK7a46MrpxP5wkAlOnOUKDMRb6eNbterBb0ckV9Y2foxZWoxVD9ta+4OUK0AW/c0MQEbXMcSKCb+430PPMDMmx/RNAh1LcDf9a2X0kAgCLb/d8Ph7ljL6ZaA9v4I42OspMYsHcJmmKtCxvFTkA5nI+OtaWdPWsE2j5TGMNJ+7jvNPeHYBfDuxH6RAnZl/9msD3sstFEIaOliZPWlcGkj7NDHSyzpIUZQcSqcAy1ZXAQlz7HmdEBndh9X2AUtfuAwJ/Aq6Wo9Wh82Z0VYBWQvvB+sIhmNzxQKCWTr5fSnEtaIAstlE+M2CVKw5ewIBOKcjSPmExbzkI6ksv7Oc30yYAwk9bXmBT2Ksv51T4SB3DkKNuVgjaMWCqHYhvlznEPb9CPJ+CYoR87ezN8sGq/543oA2xf16Gs4T8jbqA1TD8lcHHbbH0SpZecGvGDz+vtQ7FmR3Mn3HAthA0vgI93DwmLuosHybYvrocaGilhly7xRqDnqE0LQcz35roFfjTt/XmCU22xJ0fpzGWAGFagqqPTEt+TE6Rgl4o2F41lTGjyYdceN/288C1ZSs3j93MmOGv6tXzJiE9s5wCjk/iPaT9YQfJNtoY8e40WrwynUSFGoqgvZzJUsf2725ddVQsbGLxUfJHbqBtBcLT3IYN7KIBgCvP2NXHGLIeKfG8HZFrCeaKwAiSe8gDfQ1fP4KVObPqw0E4zsxDwRr4KiBkoV37Rfe3umlCCBdiJvHjjCGpDK/fAKHEWt06R4WEoiXJMjmKV6qCIaYmosQmf+2HF0+hj2tJ1GPxyyUuz0ypThxwP9dWHTtmORwgiAgB7e00P7MX+zVL2oJ5z0xdlU2//3noAxnTB4MZKr0nZMd0wQBvaxrOudhzn+o1Ba1qAdMyPSHLathEgqeVwjjivbKlpJd6iB0tmL8mlzqxdSo8aNTZhwfJXcFu1Uf587S5t9F61YPO4HOAyzKp/GJiSPb2IL5fvtXVOaJtmx7pGUy9kTdRJ8I4/NZJQcXOBcZ8omjqsFT/tFZvwIAoHLCvcgPst1L9/vbjarI91hO4WqmQP X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW4PR10MB6608.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230035)(376009)(1800799019)(366011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gwLeCpYPiqsWzrr45qHm19BQ6A1oE7jWbb2jb7yw7ZlB2tVQbzP3O5d9/kQ0uzrv6VFp4YWxB5WqkBfQKNjgduseQRgiy/IHdlMYt0mGbTC4NHVbEPAuuIikPqP/CuvBCa9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kuD+dohvfax/pQpu0DqemJqrKcGdUjkaBz+XQNDljg= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 865d5eeb-0e06-4836-b5ad-08dc8bda64b7 X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2024 18:55:28.9592 (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: bzo2vmRhzr1jwvJJxDmsq28IBTV1F4tiKNIUotRwgOYwMWTGdO6Bs3P1ZWd1kDg14p1JfdFpkWwT/DqOLy0HLw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5116 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-13_11,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 phishscore=0 suspectscore=0 malwarescore=0 mlxscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406130134 X-Proofpoint-ORIG-GUID: NarLSmSnqfrq3OKXJ5W0b3uKzCqIFNqE X-Proofpoint-GUID: NarLSmSnqfrq3OKXJ5W0b3uKzCqIFNqE X-Spam-Status: No, score=-12.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_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: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org Three new functions for looking up the enum type containing a given enumeration constant, and optionally that constant's value. The simplest, ctf_lookup_enumerator, looks up a root-visible enumerator by name in one dict: if the dict contains multiple such constants (which is possible for dicts created by older versions of hte libctf deduplicator), ECTF_DUPLICATE is returned. The next simplest, ctf_lookup_enumerator_next, is an iterator which returns all enumerators with ag iven name in a given dict, whether root-visible or not. The most elaborate, ctf_arc_lookup_enumerator_next, finds all enumerators with a given name across all dicts in an entire CTF archive, whether root-visible or not, starting looking in the shared parent dict; opened dicts are cached (as with all other ctf_arc_*lookup functions) so that repeated use does not incur repeated opening costs. All three of these return enumerator values as int64_t: unfortunately, API compatibilty concerns prevent us from doing the same with the other older enum-related functions, which all return enumerator constant values as ints. We may be forced to add symbol-versioning compatibility aliases that fix the other functions in due course, bumping the soname for platforms that do not support such things. ctf_arc_lookup_enumerator_next is implemented as a nested ctf_archive_next iterator, and inside that, a nested ctf_lookup_enumerator_next iterator within each dict. To aid in this, add support to ctf_next_t iterators for iterators that are implemented in terms of two simultaneous nested iterators at once. (It has always been possible for callers to use as many nested or semi-overlapping ctf_next_t iterators as they need, which is one of the advantages of this style over the _iter style that calls a function for each thing iterated over: the iterator change here permits *ctf_next_t iterators themselves* to be implemented by iterating using multiple other iterators as part of their internal operation, transparently to the caller.) Also add a testcase that tests all these functions (which is fairly easy because ctf_arc_lookup_enumerator_next is implemented in terms of ctf_lookup_enumerator_next) in addition to enumeration addition in ctf_open()ed dicts, ctf_add_enumerator duplicate enumerator addition, and conflicting enumerator constant deduplication. include/ * ctf-api.h (ctf_lookup_enumerator): New. (ctf_lookup_enumerator_next): Likewise. (ctf_arc_lookup_enumerator_next): Likewise. libctf/ * libctf.ver: Add them. * ctf-impl.h (ctf_next_t) : New. * ctf-util.c (ctf_next_copy): Copy it. (ctf_next_destroy): Destroy it. * ctf-lookup.c (ctf_lookup_enumerator): New. (ctf_lookup_enumerator_next): New. * ctf-archive.c (ctf_arc_lookup_enumerator_next): New. * testsuite/libctf-lookup/enumerator-iteration.*: New test. * testsuite/libctf-lookup/enum-ctf-2.c: New test CTF, used by the above. --- include/ctf-api.h | 37 ++++ libctf/ctf-archive.c | 107 +++++++++++ libctf/ctf-impl.h | 12 +- libctf/ctf-lookup.c | 145 +++++++++++++++ libctf/ctf-util.c | 29 ++- libctf/libctf.ver | 7 + libctf/testsuite/libctf-lookup/enum-ctf-2.c | 6 + .../libctf-lookup/enumerator-iteration.c | 168 ++++++++++++++++++ .../libctf-lookup/enumerator-iteration.lk | 17 ++ 9 files changed, 519 insertions(+), 9 deletions(-) create mode 100644 libctf/testsuite/libctf-lookup/enum-ctf-2.c create mode 100644 libctf/testsuite/libctf-lookup/enumerator-iteration.c create mode 100644 libctf/testsuite/libctf-lookup/enumerator-iteration.lk diff --git a/include/ctf-api.h b/include/ctf-api.h index d67db8be13f..d3bd1b586d8 100644 --- a/include/ctf-api.h +++ b/include/ctf-api.h @@ -25,6 +25,7 @@ #define _CTF_API_H #include +#include #include #include @@ -538,6 +539,16 @@ extern ctf_id_t ctf_lookup_by_name (ctf_dict_t *, const char *); extern ctf_id_t ctf_lookup_variable (ctf_dict_t *, const char *); +/* Look up a single enumerator by enumeration constant name. Returns the ID of + the enum it is contained within and optionally its value. Error out with + ECTF_DUPLICATE if multiple exist (which can happen in some older dicts). See + ctf_lookup_enumerator_next in that case. Enumeration constants in non-root + types are not returned, but constants in parents are, if not overridden by + an enum in the child. */ + +extern ctf_id_t ctf_lookup_enumerator (ctf_dict_t *, const char *, + int64_t *enum_value); + /* Type lookup functions. */ /* Strip qualifiers and typedefs off a type, returning the base type. @@ -669,6 +680,32 @@ extern int ctf_enum_iter (ctf_dict_t *, ctf_id_t, ctf_enum_f *, void *); extern const char *ctf_enum_next (ctf_dict_t *, ctf_id_t, ctf_next_t **, int *); +/* Return all enumeration constants with a given name in a given dict, similar + to ctf_lookup_enumerator above but capable of returning multiple values. + Enumerators in parent dictionaries are not returned: enumerators in non-root + types *are* returned. This operation internally iterates over all types in + the dict, so is relatively expensive in large dictionaries. + + There is nothing preventing NAME from being changed by the caller in the + middle of iteration: the results might be slightly confusing, but they are + well-defined. */ + +extern ctf_id_t ctf_lookup_enumerator_next (ctf_dict_t *, const char *name, + ctf_next_t **, int64_t *enum_value); + +/* Likewise, across all dicts in an archive (parent first). The DICT and ERRP + arguments are not optional: without the one you can't tell which dict the + returned type is in, and without the other you can't distinguish real errors + from end-of-iteration. DICT should be NULL before the first call and is set + to NULL after the last and on error: on successful call it is the caller's + responsibility to ctf_dict_close() it. The caller should otherwise pass it + back in unchanged (do not reassign it during iteration, just as with the + ctf_next_t iterator itself). */ + +extern ctf_id_t ctf_arc_lookup_enumerator_next (ctf_archive_t *, const char *name, + ctf_next_t **, int64_t *enum_value, + ctf_dict_t **dict, int *errp); + /* Iterate over all types in a dict. ctf_type_iter_all recurses over all types: ctf_type_iter recurses only over types with user-visible names (for which CTF_ADD_ROOT was passed). All such types are returned, even if they are diff --git a/libctf/ctf-archive.c b/libctf/ctf-archive.c index 4744cb7a828..3ba6a3efabb 100644 --- a/libctf/ctf-archive.c +++ b/libctf/ctf-archive.c @@ -1011,6 +1011,113 @@ ctf_arc_lookup_symbol_name (ctf_archive_t *wrapper, const char *symname, return ctf_arc_lookup_sym_or_name (wrapper, 0, symname, typep, errp); } +/* Return all enumeration constants with a given name across all dicts in an + archive, similar to ctf_lookup_enumerator_next. The dict is cached, so + opening costs are paid only once, but (unlike ctf_arc_lookup_symbol* + above) the results of the iterations are not cached. dict and errp are + not optional. */ + +ctf_id_t +ctf_arc_lookup_enumerator_next (ctf_archive_t *arc, const char *name, + ctf_next_t **it, int64_t *enum_value, + ctf_dict_t **dict, int *errp) +{ + ctf_next_t *i = *it; + ctf_id_t type; + int opened_this_time = 0; + int err; + + /* We have two nested iterators in here: ctn_next tracks archives, while + within it ctn_next_inner tracks enumerators within an archive. We + keep track of the dict by simply reusing the passed-in arg: if it's + changed by the caller, the caller will get an ECTF_WRONGFP error, + so this is quite safe and means we don't have to track the arc and fp + simultaneously in the ctf_next_t. */ + + if (!i) + { + if ((i = ctf_next_create ()) == NULL) + { + err = ENOMEM; + goto err; + } + i->ctn_iter_fun = (void (*) (void)) ctf_arc_lookup_enumerator_next; + i->cu.ctn_arc = arc; + *it = i; + } + + if ((void (*) (void)) ctf_arc_lookup_enumerator_next != i->ctn_iter_fun) + { + err = ECTF_NEXT_WRONGFUN; + goto err; + } + + if (arc != i->cu.ctn_arc) + { + err = ECTF_NEXT_WRONGFP; + goto err; + } + + /* Prevent any earlier end-of-iteration on this dict from confusing the + test below. */ + if (i->ctn_next != NULL) + ctf_set_errno (*dict, 0); + + do + { + /* At end of one dict, or not started any iterations yet? + Traverse to next dict. If we never returned this dict to the + caller, close it ourselves: the caller will never see it and cannot + do so. */ + + if (i->ctn_next == NULL || ctf_errno (*dict) == ECTF_NEXT_END) + { + if (opened_this_time) + { + ctf_dict_close (*dict); + *dict = NULL; + opened_this_time = 0; + } + + *dict = ctf_archive_next (arc, &i->ctn_next, NULL, 0, &err); + if (!*dict) + goto err; + opened_this_time = 1; + } + + type = ctf_lookup_enumerator_next (*dict, name, &i->ctn_next_inner, + enum_value); + } + while (type == CTF_ERR && ctf_errno (*dict) == ECTF_NEXT_END); + + if (type == CTF_ERR) + { + err = ctf_errno (*dict); + goto err; + } + + /* If this dict is being reused from the previous iteration, bump its + refcnt: the caller is going to close it and has no idea that we didn't + open it this time round. */ + if (!opened_this_time) + ctf_ref (*dict); + + return type; + + err: /* Also ECTF_NEXT_END. */ + if (opened_this_time) + { + ctf_dict_close (*dict); + *dict = NULL; + } + + ctf_next_destroy (i); + *it = NULL; + if (errp) + *errp = err; + return CTF_ERR; +} + /* Raw iteration over all CTF files in an archive. We pass the raw data for all CTF files in turn to the specified callback function. */ static int diff --git a/libctf/ctf-impl.h b/libctf/ctf-impl.h index 299d981a718..0a362b6b17c 100644 --- a/libctf/ctf-impl.h +++ b/libctf/ctf-impl.h @@ -544,13 +544,15 @@ struct ctf_next uint32_t ctn_n; /* Some iterators contain other iterators, in addition to their other - state. */ + state. We allow for inner and outer iterators, for two-layer nested loops + like those found in ctf_arc_lookup_enumerator_next. */ ctf_next_t *ctn_next; + ctf_next_t *ctn_next_inner; - /* We can save space on this side of things by noting that a dictionary is - either dynamic or not, as a whole, and a given iterator can only iterate - over one kind of thing at once: so we can overlap the DTD and non-DTD - members, and the structure, variable and enum members, etc. */ + /* We can save space on this side of things by noting that a type is either + dynamic or not, as a whole, and a given iterator can only iterate over one + kind of thing at once: so we can overlap the DTD and non-DTD members, and + the structure, variable and enum members, etc. */ union { unsigned char *ctn_vlen; diff --git a/libctf/ctf-lookup.c b/libctf/ctf-lookup.c index e4d18bec112..8accb2ed99e 100644 --- a/libctf/ctf-lookup.c +++ b/libctf/ctf-lookup.c @@ -413,6 +413,151 @@ ctf_lookup_variable (ctf_dict_t *fp, const char *name) return type; } +/* Look up a single enumerator by enumeration constant name. Returns the ID of + the enum it is contained within and optionally its value. Error out with + ECTF_DUPLICATE if multiple exist (which can happen in some older dicts). See + ctf_lookup_enumerator_next in that case. Enumeration constants in non-root + types are not returned, but constants in parents are, if not overridden by + an enum in the child.. */ + +ctf_id_t +ctf_lookup_enumerator (ctf_dict_t *fp, const char *name, int64_t *enum_value) +{ + ctf_id_t type; + int enum_int_value; + + if (ctf_dynset_lookup (fp->ctf_conflicting_enums, name)) + return (ctf_set_typed_errno (fp, ECTF_DUPLICATE)); + + /* CTF_K_UNKNOWN suffices for things like enumeration constants that aren't + actually types at all (ending up in the global name table). */ + type = ctf_lookup_by_rawname (fp, CTF_K_UNKNOWN, name); + /* Nonexistent type? It may be in the parent. */ + if (type == 0 && fp->ctf_parent) + { + if ((type = ctf_lookup_enumerator (fp->ctf_parent, name, enum_value)) == 0) + return ctf_set_typed_errno (fp, ECTF_NOENUMNAM); + return type; + } + + /* Nothing more to do if this type didn't exist or we don't have to look up + the enum value. */ + if (type == 0) + return ctf_set_typed_errno (fp, ECTF_NOENUMNAM); + + if (enum_value == NULL) + return type; + + if (ctf_enum_value (fp, type, name, &enum_int_value) < 0) + return CTF_ERR; + *enum_value = enum_int_value; + + return type; +} + +/* Return all enumeration constants with a given name in a given dict, similar + to ctf_lookup_enumerator above but capable of returning multiple values. + Enumerators in parent dictionaries are not returned: enumerators in + hidden types *are* returned. */ + +ctf_id_t +ctf_lookup_enumerator_next (ctf_dict_t *fp, const char *name, + ctf_next_t **it, int64_t *val) +{ + ctf_next_t *i = *it; + int found = 0; + + /* We use ctf_type_next() to iterate across all types, but then traverse each + enumerator found by hand: traversing enumerators is very easy, and it would + probably be more confusing to use two nested iterators than to do it this + way. We use ctn_next to work over enums, then ctn_en and ctn_n to work + over enumerators within each enum. */ + if (!i) + { + if ((i = ctf_next_create ()) == NULL) + return ctf_set_typed_errno (fp, ENOMEM); + + i->cu.ctn_fp = fp; + i->ctn_iter_fun = (void (*) (void)) ctf_lookup_enumerator_next; + i->ctn_increment = 0; + i->ctn_tp = NULL; + i->u.ctn_en = NULL; + i->ctn_n = 0; + *it = i; + } + + if ((void (*) (void)) ctf_lookup_enumerator_next != i->ctn_iter_fun) + return (ctf_set_typed_errno (fp, ECTF_NEXT_WRONGFUN)); + + if (fp != i->cu.ctn_fp) + return (ctf_set_typed_errno (fp, ECTF_NEXT_WRONGFP)); + + do + { + const char *this_name; + + /* At end of enum? Traverse to next one, if any are left. */ + + if (i->u.ctn_en == NULL || i->ctn_n == 0) + { + const ctf_type_t *tp; + ctf_dtdef_t *dtd; + + do + i->ctn_type = ctf_type_next (i->cu.ctn_fp, &i->ctn_next, NULL, 1); + while (i->ctn_type != CTF_ERR + && ctf_type_kind_unsliced (i->cu.ctn_fp, i->ctn_type) + != CTF_K_ENUM); + + if (i->ctn_type == CTF_ERR) + { + /* Conveniently, when the iterator over all types is done, so is the + iteration as a whole: so we can just pass all errors from the + internal iterator straight back out.. */ + ctf_next_destroy (i); + *it = NULL; + return CTF_ERR; /* errno is set for us. */ + } + + if ((tp = ctf_lookup_by_id (&fp, i->ctn_type)) == NULL) + return CTF_ERR; /* errno is set for us. */ + i->ctn_n = LCTF_INFO_VLEN (fp, tp->ctt_info); + + dtd = ctf_dynamic_type (fp, i->ctn_type); + + if (dtd == NULL) + { + (void) ctf_get_ctt_size (fp, tp, NULL, &i->ctn_increment); + i->u.ctn_en = (const ctf_enum_t *) ((uintptr_t) tp + + i->ctn_increment); + } + else + i->u.ctn_en = (const ctf_enum_t *) dtd->dtd_vlen; + } + + this_name = ctf_strptr (fp, i->u.ctn_en->cte_name); + + i->ctn_n--; + + if (strcmp (name, this_name) == 0) + { + if (val) + *val = i->u.ctn_en->cte_value; + found = 1; + + /* Constant found in this enum: try the next one. (Constant names + cannot be duplicated within a given enum.) */ + + i->ctn_n = 0; + } + + i->u.ctn_en++; + } + while (!found); + + return i->ctn_type; +} + typedef struct ctf_symidx_sort_arg_cb { ctf_dict_t *fp; diff --git a/libctf/ctf-util.c b/libctf/ctf-util.c index 3ea6de9e86f..f75b1bfb01a 100644 --- a/libctf/ctf-util.c +++ b/libctf/ctf-util.c @@ -262,6 +262,8 @@ ctf_next_destroy (ctf_next_t *i) free (i->u.ctn_sorted_hkv); if (i->ctn_next) ctf_next_destroy (i->ctn_next); + if (i->ctn_next_inner) + ctf_next_destroy (i->ctn_next_inner); free (i); } @@ -276,16 +278,35 @@ ctf_next_copy (ctf_next_t *i) return NULL; memcpy (i2, i, sizeof (struct ctf_next)); + if (i2->ctn_next) + { + i2->ctn_next = ctf_next_copy (i2->ctn_next); + if (i2->ctn_next == NULL) + goto err_next; + } + + if (i2->ctn_next_inner) + { + i2->ctn_next_inner = ctf_next_copy (i2->ctn_next_inner); + if (i2->ctn_next_inner == NULL) + goto err_next_inner; + } + if (i2->ctn_iter_fun == (void (*) (void)) ctf_dynhash_next_sorted) { size_t els = ctf_dynhash_elements ((ctf_dynhash_t *) i->cu.ctn_h); if ((i2->u.ctn_sorted_hkv = calloc (els, sizeof (ctf_next_hkv_t))) == NULL) - { - free (i2); - return NULL; - } + goto err_sorted_hkv; memcpy (i2->u.ctn_sorted_hkv, i->u.ctn_sorted_hkv, els * sizeof (ctf_next_hkv_t)); } return i2; + + err_sorted_hkv: + ctf_next_destroy (i2->ctn_next_inner); + err_next_inner: + ctf_next_destroy (i2->ctn_next); + err_next: + ctf_next_destroy (i2); + return NULL; } diff --git a/libctf/libctf.ver b/libctf/libctf.ver index 6e7345be66b..e6c31ff37aa 100644 --- a/libctf/libctf.ver +++ b/libctf/libctf.ver @@ -198,3 +198,10 @@ LIBCTF_1.2 { ctf_arc_lookup_symbol_name; ctf_add_unknown; } LIBCTF_1.1; + +LIBCTF_1.3 { + global: + ctf_lookup_enumerator; + ctf_lookup_enumerator_next; + ctf_arc_lookup_enumerator_next; +} LIBCTF_1.2; diff --git a/libctf/testsuite/libctf-lookup/enum-ctf-2.c b/libctf/testsuite/libctf-lookup/enum-ctf-2.c new file mode 100644 index 00000000000..39c9865e528 --- /dev/null +++ b/libctf/testsuite/libctf-lookup/enum-ctf-2.c @@ -0,0 +1,6 @@ +enum e { ENUMSAMPLE_1 = 6, ENUMSAMPLE_2 = 7 }; + +enum ie2 { IENUMSAMPLE2_1 = -10, IENUMSAMPLE2_2 }; + +enum e baz; +enum ie2 quux; diff --git a/libctf/testsuite/libctf-lookup/enumerator-iteration.c b/libctf/testsuite/libctf-lookup/enumerator-iteration.c new file mode 100644 index 00000000000..e46dad6dc70 --- /dev/null +++ b/libctf/testsuite/libctf-lookup/enumerator-iteration.c @@ -0,0 +1,168 @@ +/* Test enumerator iteration and querying. Because + ctf_arc_lookup_enumerator_next uses ctf_lookup_enumerator_next internally, we + only need to test the former. */ + +#include "config.h" +#include +#include +#include +#include +#include + +static void +print_constants (ctf_archive_t *ctf, const char *name) +{ + ctf_next_t *i = NULL; + int err; + ctf_dict_t *fp; + ctf_id_t type; + int64_t val; + + while ((type = ctf_arc_lookup_enumerator_next (ctf, name, &i, + &val, &fp, &err)) != CTF_ERR) + { + char *foo; + + printf ("%s in %s has value %i\n", name, + foo = ctf_type_aname (fp, type), val); + free (foo); + + ctf_dict_close (fp); + } + if (err != ECTF_NEXT_END) + { + fprintf (stderr, "iteration failed: %s\n", ctf_errmsg (err)); + exit (1); + } +} + +int +main (int argc, char *argv[]) +{ + ctf_archive_t *ctf; + ctf_dict_t *fp; + int err; + ctf_id_t type; + ctf_next_t *i = NULL; + const char *name; + int64_t val; + int counter = 0; + + if (argc != 2) + { + fprintf (stderr, "Syntax: %s PROGRAM\n", argv[0]); + exit(1); + } + + if ((ctf = ctf_open (argv[1], NULL, &err)) == NULL) + goto open_err; + + /* Look for all instances of ENUMSAMPLE2_1, and add some new enums to all + dicts found, to test dynamic enum iteration as well as static. + + Add two enums with a different name and constants to any that should + already be there (one hidden), and one with the same constants, but hidden, + to test ctf_lookup_enumerator_next()'s multiple-lookup functionality and + ctf_lookup_enumerator() in the presence of hidden types. */ + + printf ("First iteration: addition of enums.\n"); + while ((type = ctf_arc_lookup_enumerator_next (ctf, "IENUMSAMPLE2_2", &i, + &val, &fp, &err)) != CTF_ERR) + { + char *foo; + + printf ("IENUMSAMPLE2_2 in %s has value %i\n", + foo = ctf_type_aname (fp, type), val); + free (foo); + + if ((type = ctf_add_enum (fp, CTF_ADD_ROOT, "ie3")) == CTF_ERR) + goto enum_add_err; + + if (ctf_add_enumerator (fp, type, "DYNADD", counter += 10) < 0) + goto enumerator_add_err; + if (ctf_add_enumerator (fp, type, "DYNADD2", counter += 10) < 0) + goto enumerator_add_err; + + /* Make sure that overlapping enumerator addition fails as it should. */ + + if (ctf_add_enumerator (fp, type, "IENUMSAMPLE2_2", 666) >= 0 + || ctf_errno (fp) != ECTF_DUPLICATE) + fprintf (stderr, "Duplicate enumerator addition did not fail as it ought to\n"); + + if ((type = ctf_add_enum (fp, CTF_ADD_NONROOT, "ie4_hidden")) == CTF_ERR) + goto enum_add_err; + + if (ctf_add_enumerator (fp, type, "DYNADD3", counter += 10) < 0) + goto enumerator_add_err; + if (ctf_add_enumerator (fp, type, "DYNADD4", counter += 10) < 0) + goto enumerator_add_err; + + if ((type = ctf_add_enum (fp, CTF_ADD_NONROOT, "ie3_hidden")) == CTF_ERR) + goto enum_add_err; + + if (ctf_add_enumerator (fp, type, "DYNADD", counter += 10) < 0) + goto enumerator_add_err; + if (ctf_add_enumerator (fp, type, "DYNADD2", counter += 10) < 0) + goto enumerator_add_err; + + /* Look them up via ctf_lookup_enumerator. */ + + if (ctf_lookup_enumerator (fp, "DYNADD", &val) == CTF_ERR) + goto enumerator_lookup_err; + printf ("direct lookup: DYNADD value: %i\n", (int) val); + + if ((type = ctf_lookup_enumerator (fp, "DYNADD3", &val) != CTF_ERR) || + ctf_errno (fp) != ECTF_NOENUMNAM) + { + if (type != CTF_ERR) + { + char *foo; + printf ("direct lookup: hidden lookup did not return ECTF_NOENUMNAM but rather %i in %s\n", + val, foo = ctf_type_aname (fp, type)); + free (foo); + } + else + printf ("direct lookup: hidden lookup did not return ECTF_NOENUMNAM but rather %s\n", + ctf_errno (fp)); + } + + ctf_dict_close (fp); + } + if (err != ECTF_NEXT_END) + { + fprintf (stderr, "iteration failed: %s\n", ctf_errmsg (err)); + return 1; + } + + /* Look for (and print out) some enumeration constants. */ + + printf ("Second iteration: printing of enums.\n"); + + print_constants (ctf, "ENUMSAMPLE_1"); + print_constants (ctf, "IENUMSAMPLE_1"); + print_constants (ctf, "ENUMSAMPLE_2"); + print_constants (ctf, "DYNADD"); + print_constants (ctf, "DYNADD3"); + + ctf_close (ctf); + + printf ("All done.\n"); + + return 0; + + open_err: + fprintf (stderr, "%s: cannot open: %s\n", argv[0], ctf_errmsg (err)); + return 1; + enum_add_err: + fprintf (stderr, "Cannot add enum to dict \"%s\": %s\n", + ctf_cuname (fp) ? ctf_cuname (fp) : "(null: parent)", ctf_errmsg (ctf_errno (fp))); + return 1; + enumerator_add_err: + fprintf (stderr, "Cannot add enumerator to dict \"%s\": %s\n", + ctf_cuname (fp) ? ctf_cuname (fp) : "(null: parent)", ctf_errmsg (ctf_errno (fp))); + return 1; + enumerator_lookup_err: + fprintf (stderr, "Cannot look up enumerator in dict \"%s\": %s\n", + ctf_cuname (fp) ? ctf_cuname (fp) : "(null: parent)", ctf_errmsg (ctf_errno (fp))); + return 1; +} diff --git a/libctf/testsuite/libctf-lookup/enumerator-iteration.lk b/libctf/testsuite/libctf-lookup/enumerator-iteration.lk new file mode 100644 index 00000000000..0c3cbfbf15f --- /dev/null +++ b/libctf/testsuite/libctf-lookup/enumerator-iteration.lk @@ -0,0 +1,17 @@ +# lookup: enumerator-iteration.c +# source: enum-ctf.c +# source: enum-ctf-2.c +# link: on +First iteration: addition of enums. +IENUMSAMPLE2_2 in enum ie2 has value -9 +direct lookup: DYNADD value: 10 +Second iteration: printing of enums. +ENUMSAMPLE_1 in enum e has value 6 +ENUMSAMPLE_1 in enum e has value 0 +IENUMSAMPLE_1 in enum ie has value -10 +ENUMSAMPLE_2 in enum e has value 7 +ENUMSAMPLE_2 in enum e has value 1 +DYNADD in enum ie3 has value 10 +DYNADD in enum ie3_hidden has value 50 +DYNADD3 in enum ie4_hidden has value 30 +All done.