From patchwork Tue Jul 30 15:36:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 94786 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 D8EB0385DDC8 for ; Tue, 30 Jul 2024 15:38:15 +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 B42173858294 for ; Tue, 30 Jul 2024 15:37:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B42173858294 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 B42173858294 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=1722353844; cv=pass; b=D9x0KRRaXyRH6Cs0Tp9cIwltpGayO/fF/Oa9Yw6RVLcHTuCfP5JIjUlEA/Kd55ERthZIdDYM1hxly/PcGceGC/aLbVe2OiqervBvb7frxorlHKmLE76pQRBDlQN5SKdm5gjbo0xymikVtuvFryZ31/i4iv6sV97XNPSUaoh6Ef4= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1722353844; c=relaxed/simple; bh=D507dkG2kjz+K4a0QAJrPvGxjedN4LZQRqx1TIU6Dd0=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=R0r/uYd9XW2W4qdkFzRpUdmKEBD0j/0qCc0aEHNgpWdqxnrgxNlD3Na7G9F+jY25Gm+eHk2P0MKZLWtroFazWTkQjoCKGA8cE0Z9ReoqD7ykaZmBq3d/8rFH92yW8Y8EfPOCa72HBR5LZgpV+0Mj79Bhi9CLSW1uJ2rK/BUqzII= 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 46UFMl8F025630 for ; Tue, 30 Jul 2024 15:37:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=gIYeZdYfWiAcOJpNwemEbe50Wfj8MdIK4+iKpj5pMGo=; b= Jn0kg6QwbavN6m8HEY965uh8wEAqamQA6Se1iFv0PXmd3cG5r6uz/GOTIrwwfzAl JeS7osFK8D+MLGqEmXsvM44YkpHm0+R3RXDGytIpmlWICViLfkexlTau2BffJtSA AA3+7KwLPQb+n3sAPIognlpIt2167wkMXz85+ytUvgtmpY7LcywAq7gMOAYamJli TTTz1NX5KFNVQF4cifnbXsmdZATWK8HqK70f/B8xRd9gVBSbKUlhDz9cnWUA1vfk EG74R+Y9Uk3iKzKGez+Xei1NRpBmUsaYQ+Wt9vykM1izPHpLdxro35/EI++mubsz c4yAUeJ2JjqchGeQD+vwLw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mrxbwee4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:37: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 46UF74uN003780 for ; Tue, 30 Jul 2024 15:37:20 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2048.outbound.protection.outlook.com [104.47.70.48]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 40p4c09662-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:37:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dkPdTmc41gLsL5p3XlWAdOfHxtLA9KT2e0yUnml+Zaevsxr4DoNU1I9dqCQCAIcVOr8j9Yd8hAdiOsj7ciEoawT8pa8fkc+VvguSBGBR6+ZrusR6ZuGeorUyHlak1hKOkQXPEJ+cN9Ktm91/3MVW7K50YBIt+RMdeqI9zBVVk5j8z2W0XVKpj6EvXhsfFG9ulrOiEt4tQFIo3NJmmNXo1DgV67PJPOZSZGQQ3MaW1RYyty98J4uSGwnQVg7ngILY4wnn/XQ7CcEPML+IsDf6E7ku7q26Y3IUUSwkzcdyHKzixOlLdF+sEULylDCxgYqnLzSEtBMsoiQwMP8NKpo63A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=gIYeZdYfWiAcOJpNwemEbe50Wfj8MdIK4+iKpj5pMGo=; b=JqZPeNGyvp/6snBXrkGrKeyWlyqwZp4gtq3ioh8ilmNxm7k9JDTZ9AwQ3mL86ADyeOQgXyXKet9jLYwXpo20tj0mM7v708FSOvLmfQ+8Aq0wQVdxNOvqkgh0E3vkVgzWUUpAPvas9hnyhuHvkbdfIPfXOsAnRa6VK/3q14DbC2GXY0+mCZ74BsOLCyzQcGcGsp5YulmCTUrFT2J+V5jTjbJV083iOzyv3fYG1otzQC9jC4Np5as1skenphb/IRqVPyv7b25/G6CaoYTypZrlTbMEEBl/xE/rJ0n2hrkufDoPy84Gs5Cb7LhXMSQjW47j+xo/O9ml3rapskC974jQ8A== 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=gIYeZdYfWiAcOJpNwemEbe50Wfj8MdIK4+iKpj5pMGo=; b=n5L2J/7LaQxVBJbSD6ScH2U8jcLzoIiBK8qCJHovJZ3y6iG3Ng96F8GQ157xpz1ZFdXQqGGWlqhlmOiFMGDe7qN/gukiOWG9Uu6q6NxXnRrqKUhPmirxpyqkl6UZbifuzEs7Y8wbf4bsIyvjmv7zTVn9ge/w8gxJ6focQKbDBM8= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by DM4PR10MB7476.namprd10.prod.outlook.com (2603:10b6:8:17d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.28; Tue, 30 Jul 2024 15:37:18 +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.7807.026; Tue, 30 Jul 2024 15:37:18 +0000 From: Nick Alcock To: binutils@sourceware.org Subject: [PATCH 01/19] libctf: we do in fact support foreign-endian old versions Date: Tue, 30 Jul 2024 16:36:49 +0100 Message-ID: <20240730153707.168357-2-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.2.276.g4ac82df17e In-Reply-To: <20240730153707.168357-1-nick.alcock@oracle.com> References: <20240730153707.168357-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO2P265CA0475.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a2::31) To MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR10MB6608:EE_|DM4PR10MB7476:EE_ X-MS-Office365-Filtering-Correlation-Id: 2f305334-66e6-4eb5-cbb9-08dcb0ad7e7f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: jBQksm+/QmDCxrA1SKwAFaHFAdK6JXIB7XjdzcR+9jz/VJZpgMhg6/6kTrqSiDBd9uUBiqT4rax2I95iEfXywGLpEBAt4WbqSKrz2KVV5uI+rO98i1DQnTgCeulyuplPlvbiCMkQEtI3E0kdSmK169FToWO/mpBE/g5Cx/e62IF7mBmaZg39ulVODB9s2M8bUO2TMHRTNEDdfx0nor1GA1esN9ftgxoMh5FoNgHyNIWBxAZc0CNTxKGOXKdlGfjbVz/QvPkBoxAcbV5fcJ+RZsl8LvMW3oWOB02b+7kN/fII5Z4s6hLoL43hf0897b+RhFJEaY199lyZPCXSnQOOyF1pKsEAj8iFgM7fp16hNNvxrm6XFBnrCKjRtzfNPl6dY050jWKIYpYdnlP0U0LV+REYDJH6KadnBwAafO6byxA1LkQcvbfslCZe8NGnk3JkZkI1yU7GKallDfCifhxaNJjFXMl7Cb3Jcm+uwVXEOFKbHAvvHURPhsLPdi2ZEXGDxQVxTzADdKL28piYojkkGUwLWkw+ea1WsPpaIo+9TTk+343ijRRRPXE10xKQk8Qcp6W2E+tl6teENrx68keyJyK9GGwpF7VIYkjkG5OZGmHIryknwZmvMvNTr9AOcDuhLxYSG4pLKupZIDZks5xM9B6PYRHbJuJp4O1WtQOQyJU+MGxpMJWzyUvDLUj2+4OejDVSFPuL/EdKR1vUVpKoXgpfutDo19928/b9u4spzKQCRz8pmOxvnb9O2U09EF20KqVSzoG3sw1G/WII2R9xr2cAXn5uds3PT/TksM+Yw7mZmlTgEO0e67RmUnTJUbO6eBzzmvMYbzQr0xZqCIJBjXMCnLdTAyZq0DwchyRUQd1L23HDGDSD7spampx2N2ZYAcIEjUG/lUR3f6PCU8E5BwPbrZ+9lSlucw2COn4vqVUbYoyLxlAYh9DnrdoGXIASrS0IbqJ8xS2fkmjPqZwPK2vi26mXdETOFPC/a5mk3kEpGzmcuTkKGmkb1K3/ErN+qwjS7WbHpsWWu4bFM3m6hhv1zaN9dqi4of8GixEjvtIStelLJ7Nbm9JHXRMe4RYMrMK1BF6jpsqoe4gzl2KtoHUTiDgiJBLEBvPUuWKjVNdba1JED1xf65IHCysmvcElvu/Cj+lwRHJAxD3u+e4l40WerdvpQpp1xZo0w0/CZQkE0XZCga3/Wf77nh1ywx4CIjUOUdOXR0ZCycDrfBv5sPNoHCJdTxk32Tj6SbwQvYWlURW205iBO1YBRuo7Fiiuk0azKMJgENetHy9R/YRCetRZvoawO2UafR6wsdvSJ7vDNEJZG8niGUvftZQ8DN+JA87NUaRXsfm5OWLw8C3MQg== 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:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: my7mC9oe22cllHXu0K+p9ZhlZMSU2B6gsxkSLCWGk1t4Hln2z2DeC4FANJxLW+vOCpwm8lxPY9LDAr4pU78ZUFQT9NSDDgmqAmo70dvVwK610Axo+Bo4w7Ny43CvNciFRMSrBiu8PQnIJtTfe6Cwz4f9JuEqvNTmedq2if66wNJVp8K8+ieriQgIkQ3SMyD/Kc3gmiLj/ZGNYfViYaTluOmcVNyjKPbo5xkIc4qdv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FCKQeg1mFi4actFUCWnKNuF7TXKi1hbseqTmUF2VoHHSnX8P69y6vxyJZFMGDN7w3OQXPmcXWmdYOWjeRINh8XwHKvkHonmen69AvpBOrDzJEhiKQKUg/nWWnyyG0ADtyI+MqShRsPslT59OLEZlg/Gi6kqsdZbF2WdeM8143gpxt//SJOm4Efmb00szAB6to8qWsaZsUmpMR2w4s90+CY9S0Yd8W0kcznBXJIIpEmAygtJKwV4Am5tnYmWvN8ORk6LGlGTAwgoaY//07pTWpWudEIhyFikDSMMI2XW96bzyU5H7KA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 53Fiua3ONEZRQBF2KR9oCkcMHL9f1byyiLXgIZ3sLzuLyUoRCM/gvRdpdOMm4ZjGfcUMlKQKCKAh3RBF4KgJsWZITeoGtb4f+kFrd2Qk0rfbDMSA/Z86kNkHq2OMOmZtKc8jCAxt82TtgAwsv8FO6ujcOaQcCCShhoDF3rYaAn/j+B8g6z9BXRCKp+JGMEwvvSZcKPMIaJAKmBje5hbRDvShWKMAQJq9lTp8KzTLcQ8XE5u1W6x9V5sHIG845czsGfX+5Gtpm5vy0aq4vpUWpjv0jK93xzHZnsxlcVCyQM8PxERrV64iNJM6qdv6J59Teebe/3HOZqnl2ntf6lZnIn/OU/SToZ4de6++EdxNYgR7dJhISc+XuU6C7NL3EkL7lSrlwgjtsV/86Es7/8ZCYEP5qNV36B42w+keRUSfTwecXwLYHSOd/9baeMuaPDr8KvTRrqJjd2CGNhxsu8M6wto8wfyi5QOy3AiW1aAXnLxYX5nDLjQ+zPk0N1H+FDsJgoxZnsvnCEztVkf69sMIBE3/eXCAkl4c9RH+TYNF2JuW+7bqHL5RemCpJm2taEcdmfwCWulNTKDC9K1Iyxlt5rTqhhO+ZXuNqjV+IrFrNT0= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2f305334-66e6-4eb5-cbb9-08dcb0ad7e7f X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2024 15:37:18.0114 (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: y2u+JOB18eEHcL8wZ+Mt/fuPcR+1Q+P9XqxIeCUXnDUI+ekpZYR1Uj8elcHgh089Ph5yqqdyS9KA+HHrEt8MVQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB7476 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-07-30_13,2024-07-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 adultscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2407300106 X-Proofpoint-GUID: _zso3o0RNBDBFVNQWJQV6885fN1kiV7f X-Proofpoint-ORIG-GUID: _zso3o0RNBDBFVNQWJQV6885fN1kiV7f 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 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 worry that caused this to not be supported was because we don't bother endian-flipping version-related fields before checking them. But they're all unsigned chars anyway, and don't need any flipping at all. This should be supported and should already work. Enable it. libctf/ * ctf-open.c (ctf_bufopen): Don't prohibit foreign-endian upgrades. --- libctf/ctf-open.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/libctf/ctf-open.c b/libctf/ctf-open.c index 2ae0a696c3a..fd6d36edc46 100644 --- a/libctf/ctf-open.c +++ b/libctf/ctf-open.c @@ -1474,18 +1474,12 @@ ctf_bufopen (const ctf_sect_t *ctfsect, const ctf_sect_t *symsect, First, we validate the preamble (common to all versions). At that point, we know the endianness and specific header version, and can validate the - version-specific parts including section offsets and alignments. - - We specifically do not support foreign-endian old versions. */ + version-specific parts including section offsets and alignments. */ if (_libctf_unlikely_ (pp->ctp_magic != CTF_MAGIC)) { if (pp->ctp_magic == bswap_16 (CTF_MAGIC)) - { - if (pp->ctp_version != CTF_VERSION_3) - return (ctf_set_open_errno (errp, ECTF_CTFVERS)); - foreign_endian = 1; - } + foreign_endian = 1; else return (ctf_set_open_errno (errp, ECTF_NOCTFBUF)); } From patchwork Tue Jul 30 15:36:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 94787 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 4F3F2385DDC8 for ; Tue, 30 Jul 2024 15:38:20 +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 DB0043858289 for ; Tue, 30 Jul 2024 15:37:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DB0043858289 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 DB0043858289 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=1722353849; cv=pass; b=huNvjX7VhQvjHw4o/NofoPIjla9A/UbVf3bdUboG8DQj1EWupJonGNsbKfflQuLOz0FkqCtQrHiT8VFep2j6P8jWB9MlOR7EP7tgeQSp/c9lxCoZqsG59SaecMV6Ns362+NmswNVylvDKLFgKSVFk2YgQ1IE+s+YF+nA1QjWgBA= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1722353849; c=relaxed/simple; bh=848Mg5fLqTONhzwBzM/qCU4epijmsNU9oHo0WXiKWvc=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=Pn51KrErUx6glryplA9fKXVou1ciyaTv+K9acI/F/Ffkq/z4esSjkXEHyLNwAEHcSlErnK2ifzrN78MB5N6EHa61lO+ZRX0cSHqa/K+BjmJWPt6IlFNFaRjpUpwaXeNIjTUpxuW3MlrZzunLhtYydEcT85tX+Sjga1F81Pe+H4o= 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 46UFMXtx024750 for ; Tue, 30 Jul 2024 15:37:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=0r2oEMzJJQZBqTsSeASyR6Fx7ZvtibyUOC5mQ3qQtO0=; b= gvidIS9jH1V8Ny9iJNrcDiETaJOtfLpjKSxyX9FPhsNMQtsn2PC04lqMIZYfKt5h VRo5E4A5MIv7DYcxaZQIozH3C6NeC3b8JgkkMcfgZQAd6LY6u82cRAsqddTaebHY mssI+x+56ptDsPfsviB5DGN5gJykJVGd8kLODO/HqgYl7ITAhvtDnXI/LPvbu2yX opBkC5sS00Ym7zbSPtZcLH7FhlPMP6jjz+4xr0j4PcXxvvDJXA1G4W4rAZCcOvI8 AL2WH/C00FyTrnKMnRcn04t0T/fPrfy98yNA+9mSwg5cU5qGQs8oxSxTYr07w2r5 PIFDemL318KjG7Ulkkeztw== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40msesnaww-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:37:25 +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 46UFQIen037975 for ; Tue, 30 Jul 2024 15:37:25 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2044.outbound.protection.outlook.com [104.47.70.44]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 40pm83eapx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:37:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rYW6heZhu/u2qOylobA8sZ4XdkH+wqPndff76vqrvO3XcgtqkW+3BnFDeuEQ957fmWFJJHITybkVz5PaiWfvIUb1OAsUIOpdCE+8hDyldscy8IiA+E50D+QhbmDBd2OfqJPciWHmrzlLRNOIrjGr/l+94nHgOzIH659GB957qqKhn1RymNq5E2LNmjEqnxdk8zKZ9w1v2jIlKiIB87kC1BO/1dmtYJa/npRbv99N/wXRDnJIna0FJ0KlJO9LhYankseZUSPf9j/1756uOBbOXKZ5AhQCZqMuba+He7kortP222ElLlcdnUyzllJL7UrJXAs2uRiFKszY2FcCd8JFZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=0r2oEMzJJQZBqTsSeASyR6Fx7ZvtibyUOC5mQ3qQtO0=; b=L8ZyeHq1LG5QAbr8/oOTKnHOve49roMrPkuq9sYpapxGTTGS2AiNwdkHA66i3LvLfFKdpn/Zwhw+jw3ajVwj/1K7CQ1gIg4FvG7JWxC8IpKe9bsMZQLRJHJ4Ikj+kqJlC2Mo4UhGVWU3rA58hXmsKiH1fF/d1TT4LqqfGmienSP33pRDpkjA+GvwlQMOAebIzGDZedjO+ddsTFtMTOBbbUpO0ArTBSDoEYcjKYVhFGS31d2lGO5QVjslpZcIjZIhLQ1B+FLuPyJICIEDu6Ppzkurk866sfW4+gT9wXUj5SgwOl5GZeJJUlVxqYHqXSTooGOeWajBSZZCqVJAAthqtQ== 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=0r2oEMzJJQZBqTsSeASyR6Fx7ZvtibyUOC5mQ3qQtO0=; b=EkfhN79YEhFDtkdn+8UA6MVH0/Fr2VJAg2fgFS4Ho2wNc1bu+/s3HO5CU1kt+zvYKzGDZSFV9Ivwrtr3FEt1V34i5jds84Pp2XKEuBvPRkoZwQ/XJNfmxIexxKcvWhrhKUApmbV7HV2ZxwIoGd3WZ0WtKcxrfOJYR5kTfpXw5AE= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by DM4PR10MB7476.namprd10.prod.outlook.com (2603:10b6:8:17d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.28; Tue, 30 Jul 2024 15:37:22 +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.7807.026; Tue, 30 Jul 2024 15:37:22 +0000 From: Nick Alcock To: binutils@sourceware.org Subject: [PATCH 02/19] libctf, dedup: drop unnecessary arg from ctf_dedup() Date: Tue, 30 Jul 2024 16:36:50 +0100 Message-ID: <20240730153707.168357-3-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.2.276.g4ac82df17e In-Reply-To: <20240730153707.168357-1-nick.alcock@oracle.com> References: <20240730153707.168357-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO4P123CA0157.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:188::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_|DM4PR10MB7476:EE_ X-MS-Office365-Filtering-Correlation-Id: 8ea08d48-910e-4bc7-199f-08dcb0ad80f0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: 8MAT2ZXXl7fr65P10kU9PDb4X8GDJtWB2JRtOJnH789fal8WoefBhuoFturqJCuNs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8ybAFd308cM5NG5LQnSTFMVul0R/Pwd44HuFgYxkuUzi0W3RrVPyMqsdZUimj6TE0KVazHkCo4rv+K77PvREU9Yo3ujWDC3t/rSgLnO1fDG72C2R0dMRCNdgseZwaPwvghB62iw2ZExIHoIpAOlR+d6QWQ4MmplT2cclihfAjX9IFe7RfxhZwTMhG32M3aKSkd8MiVUBfQv0hHQ32F0mEga8sk+4xEEflzyBGvFXM/FQ== 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:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vNsAgyER81ThTuHM0BZe8DzsRFNQ18JC5TNWJfszz4SoTSXHZ9noOHA2qKji5FP21FYvICy8gcaiuQGh3d66jWVgYtzkvtdWZEtGqqyk0bfdsh6kXCG0sTr3T8zU+g9JzsruVzY6lgJpJtL0zqusry9frR9tiafxubcHe/aHMIMzDJpfnXTU/+vOCGBa0zLRZzXa+kMg/AnfydAB9s1IvNdCsOR4kQgDle7lqwUavchdF4qM/hThOpUsFSFxagPkAb2gkyGLNd9oxA6+U2PBLTmGy/8q0OEZb4NDdSvzDZhIbBerRTHRW6GBeYSlZmpVosRv9Lk8kufL61bjSopr2eCC854dx3fLX3Y37u9Jqa137JRUaJ3EJNjpDvx6p4HdXTGaqa8M1Roetokmlici9l1Xm6Ot6td3y++ObZWMA3AztwrO8uF1Z1N+TqDO7MX9y3ZnJjLKEiXLT99wacsRf8jqRmEpvAFHCfvT5s7xSy22u9uPOfIm27lMf3/kXpBGu+dViQu/DRqSSOpoRmolwo0izUYo70fQvpwScfcfDFuzxKMNueDgTKt5qRrjLFVklaXWh6xxycxUUVTOI0oAM6OywE+2otCt0JH3ETkaeI1bM5zYVKqCykFBOIULhdGRVPEkoCkZbzjzJ6lWAqtac6ueHykGQW46+IO0BFViMl7/LxCVwnbNTpMO5VbppAp/yqUCUK5Nzj08zSF6slQd9tvLPWKODQnY62DrCkFCFDn8v3WA63pZLHuKGYSRk1LJ3n0MVzuNagN/dRfsmzzsnlnRxX2Gz8lXDhlF7uavWpE11+RmrUaH2IN9YheA8B5esnEelDGObBAL4nAZczEGpZy/d/+VdhpFX4idCF60+vicp2rO5IggEKRLPfgBh1iFjmRP5tDDVFLBe3tI7Z4z74kxBS1DaA+6g/4/JdhmHGvPV0kddboIPmZcGUgdJNLYbluspBN3NfXH//eBRkwirGVGYs6iGqz85W/lyeY1wH7lqADYkpmRNs23wrzWUO0qVgsdNTdURzn7PEKqqf3vNObvEghFw6t8Avk50NY4Qmx9YAfXmWkcYg0yQbRIanmJ18QG7mph9CwsYwDe4ia/5wTKssDsiAvAObvxrMgAbH4+lb3WpCFPYvcaIuo5z5lOUqYgXW5TzMpcMSG+7Xb2sEptNs6AjuWuGO+hUjE7fPiSxTaI3MyDpHRRWJMpPGxYyz+rW0rMQxwvFv3n2lbaQQ3wujL4yk2Wff4dImmaitkyY5WWrm4vztXBicfssBYn+Tn9yAaGLlLzW08vyB97YjkLAODXpHMhaC2531/fuYkw0+xuahJL3lW5Hl6/KJBkjhdAE8RfgnM3/a+K0whpshaTwtGy9oqY8+YmJc9FsovlwSucSeVqVQL60kqlP2p3yKwJsYgsUajnf/wHobJl8x3WYR48RXBEkUfvI7wOKQnxxe6p8CfhYOATwPqGJl1icWQpk7APK0/kMhpQdEinQBT3ruztBNi5LxlRgc/aUz+sM5Gelt3Pu52tsfeBdahCVrAxFXsFaOpQRuh1UYvnv6LTIkqeF3T8zInvH5vwH83N72SLMTnZlBGypP2C3gL/x7nv9pMWF0gftmDpGQ25eQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 1rnt+tBr+tc0yJQeaxcJdIyJUYE6O7OSq43cwbB0wy+6EQKuieO1Ld2IQknzzNzYNsnOQlUr5P5osk8bwNnJpnOAmluLdmKZoFIOEcYap/znhw40F/qqVD+CldsczxhprflwvTd24SM/NynxBKHxFHU1hljnZMJbMZeH/64/dEFe7TuvvuCtubH3e6AJ0O+8bTxzB6UoRfu/OR6rRT/FLadl4Pyu3lh9krdmfOoP+uCDXrirOTxvuIW0Knf/A1Ckrghs1VbvXjGZ6PxggSnPetwN+QgfH/6gVlf2rP8vtFV5owzU1CvcuvOed0KFdAWwvjmAl0RRUgItcRE0HI5Xdgj8aeFeB7BfVHgWUXmqEZU+YRZuZ32zkPh48Hdi04swsE21cnYbKt4LtmqvatixTySjm6UqXDvZNowsJyjVgspB0VvW7/hI4Ry1mNcA12Q7uAnXdvg6H4P5/lNcfQLvr8DU4z8PbDPQNQwj8gpv+H5fd+yxm6AQWwbJvy7p+zYzk9IGIuDLy1EAIjEK49PAtC8JZNJVTydXSsaxD9oNbE21m49ZKPZvr1rr5Zj5ZrHLQ1UPHppiV4qb3ZfEUXDnbRbJhlVgQg9Ay8vFQ6feSrc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8ea08d48-910e-4bc7-199f-08dcb0ad80f0 X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2024 15:37:22.0858 (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: TDXfC6CfSHhMreVLJpe5qgeeHDnytwO61gVTlfRYSOS6GzkpFfcENUIoIo+zjj57LasDND3soPjACRz10N42zg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB7476 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-07-30_13,2024-07-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 mlxscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2407300106 X-Proofpoint-ORIG-GUID: tqyhldOulRu142xs_7ArEhw5TmxV_KsR X-Proofpoint-GUID: tqyhldOulRu142xs_7ArEhw5TmxV_KsR 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 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 PARENTS arg is carefully passed down through all the layers of hash functions and then never used for anything. (In the distant past it was used for cycle detection, but the algorithm eventually committed doesn't need to do cycle detection...) The PARENTS arg is still used by ctf_dedup_emit(), but even there we can loosen the requirements and state that you can just leave entries corresponding to dicts with no parents at zero (which will be useful in an upcoming commit). libctf/ * ctf-dedup.c (ctf_dedup_hash_type): Drop PARENTS arg. (ctf_dedup_rhash_type): Likewise. (ctf_dedup): Likewise. (ctf_dedup_emit_struct_members): Mention what you can do to PARENTS entries for parent dicts. * ctf-impl.h (ctf_dedup): Adjust accordingly. * ctf-link.c (ctf_link_deduplicating_per_cu): Likewise. (ctf_link_deduplicating): Likewise. --- libctf/ctf-dedup.c | 58 +++++++++++++++++++++------------------------- libctf/ctf-impl.h | 4 ++-- libctf/ctf-link.c | 4 ++-- 3 files changed, 30 insertions(+), 36 deletions(-) diff --git a/libctf/ctf-dedup.c b/libctf/ctf-dedup.c index dd234945462..6c58daae324 100644 --- a/libctf/ctf-dedup.c +++ b/libctf/ctf-dedup.c @@ -485,9 +485,8 @@ ctf_dedup_sha1_add (ctf_sha1_t *sha1, const void *buf, size_t len, static const char * ctf_dedup_hash_type (ctf_dict_t *fp, ctf_dict_t *input, - ctf_dict_t **inputs, uint32_t *parents, - int input_num, ctf_id_t type, int flags, - unsigned long depth, + ctf_dict_t **inputs, int input_num, + ctf_id_t type, int flags, unsigned long depth, int (*populate_fun) (ctf_dict_t *fp, ctf_dict_t *input, ctf_dict_t **inputs, @@ -552,8 +551,8 @@ ctf_dedup_record_origin (ctf_dict_t *fp, int input_num, const char *decorated, static const char * ctf_dedup_rhash_type (ctf_dict_t *fp, ctf_dict_t *input, ctf_dict_t **inputs, - uint32_t *parents, int input_num, ctf_id_t type, - void *type_id, const ctf_type_t *tp, const char *name, + int input_num, ctf_id_t type, void *type_id, + const ctf_type_t *tp, const char *name, const char *decorated, int kind, int flags, unsigned long depth, int (*populate_fun) (ctf_dict_t *fp, @@ -711,9 +710,8 @@ ctf_dedup_rhash_type (ctf_dict_t *fp, ctf_dict_t *input, ctf_dict_t **inputs, case CTF_K_POINTER: /* Hash the referenced type, if not already hashed, and mix it in. */ child_type = ctf_type_reference (input, type); - if ((hval = ctf_dedup_hash_type (fp, input, inputs, parents, input_num, - child_type, flags, depth, - populate_fun)) == NULL) + if ((hval = ctf_dedup_hash_type (fp, input, inputs, input_num, child_type, + flags, depth, populate_fun)) == NULL) { whaterr = N_("error doing referenced type hashing"); goto err; @@ -740,7 +738,7 @@ ctf_dedup_rhash_type (ctf_dict_t *fp, ctf_dict_t *input, ctf_dict_t **inputs, ctf_get_ctt_size (input, tp, &size, &increment); ctf_dedup_sha1_add (&hash, &size, sizeof (ssize_t), "size", depth); - if ((hval = ctf_dedup_hash_type (fp, input, inputs, parents, input_num, + if ((hval = ctf_dedup_hash_type (fp, input, inputs, input_num, child_type, flags, depth, populate_fun)) == NULL) { @@ -773,7 +771,7 @@ ctf_dedup_rhash_type (ctf_dict_t *fp, ctf_dict_t *input, ctf_dict_t **inputs, goto input_err; } - if ((hval = ctf_dedup_hash_type (fp, input, inputs, parents, input_num, + if ((hval = ctf_dedup_hash_type (fp, input, inputs, input_num, ar.ctr_contents, flags, depth, populate_fun)) == NULL) { @@ -784,7 +782,7 @@ ctf_dedup_rhash_type (ctf_dict_t *fp, ctf_dict_t *input, ctf_dict_t **inputs, depth); ADD_CITER (citers, hval); - if ((hval = ctf_dedup_hash_type (fp, input, inputs, parents, input_num, + if ((hval = ctf_dedup_hash_type (fp, input, inputs, input_num, ar.ctr_index, flags, depth, populate_fun)) == NULL) { @@ -811,7 +809,7 @@ ctf_dedup_rhash_type (ctf_dict_t *fp, ctf_dict_t *input, ctf_dict_t **inputs, goto input_err; } - if ((hval = ctf_dedup_hash_type (fp, input, inputs, parents, input_num, + if ((hval = ctf_dedup_hash_type (fp, input, inputs, input_num, fi.ctc_return, flags, depth, populate_fun)) == NULL) { @@ -841,8 +839,8 @@ ctf_dedup_rhash_type (ctf_dict_t *fp, ctf_dict_t *input, ctf_dict_t **inputs, } for (j = 0; j < fi.ctc_argc; j++) { - if ((hval = ctf_dedup_hash_type (fp, input, inputs, parents, - input_num, args[j], flags, depth, + if ((hval = ctf_dedup_hash_type (fp, input, inputs, input_num, + args[j], flags, depth, populate_fun)) == NULL) { free (args); @@ -900,8 +898,8 @@ ctf_dedup_rhash_type (ctf_dict_t *fp, ctf_dict_t *input, ctf_dict_t **inputs, #ifdef ENABLE_LIBCTF_HASH_DEBUGGING ctf_dprintf ("%lu: Traversing to member %s\n", depth, mname); #endif - if ((hval = ctf_dedup_hash_type (fp, input, inputs, parents, - input_num, membtype, flags, depth, + if ((hval = ctf_dedup_hash_type (fp, input, inputs, input_num, + membtype, flags, depth, populate_fun)) == NULL) { whaterr = N_("error doing struct/union member type hashing"); @@ -990,8 +988,7 @@ ctf_dedup_rhash_type (ctf_dict_t *fp, ctf_dict_t *input, ctf_dict_t **inputs, /* Hash a TYPE in the INPUT: FP is the eventual output, where the ctf_dedup state is stored. INPUT_NUM is the number of this input in the set of inputs. - Record its hash in FP's cd_type_hashes once it is known. PARENTS is - described in the comment above ctf_dedup. + Record its hash in FP's cd_type_hashes once it is known. (The flags argument currently accepts only the flag CTF_DEDUP_HASH_INTERNAL_CHILD, an implementation detail used to prevent @@ -1011,9 +1008,8 @@ ctf_dedup_rhash_type (ctf_dict_t *fp, ctf_dict_t *input, ctf_dict_t **inputs, static const char * ctf_dedup_hash_type (ctf_dict_t *fp, ctf_dict_t *input, - ctf_dict_t **inputs, uint32_t *parents, - int input_num, ctf_id_t type, int flags, - unsigned long depth, + ctf_dict_t **inputs, int input_num, ctf_id_t type, + int flags, unsigned long depth, int (*populate_fun) (ctf_dict_t *fp, ctf_dict_t *input, ctf_dict_t **inputs, @@ -1103,7 +1099,7 @@ ctf_dedup_hash_type (ctf_dict_t *fp, ctf_dict_t *input, Hash this type, and call ourselves recursively. (The hashing part is optional, and is disabled if overidden_hval is set.) */ - if ((hval = ctf_dedup_rhash_type (fp, input, inputs, parents, input_num, + if ((hval = ctf_dedup_rhash_type (fp, input, inputs, input_num, type, type_id, tp, name, decorated, kind, flags, depth, populate_fun)) == NULL) return NULL; /* errno is set for us. */ @@ -1911,13 +1907,11 @@ ctf_dedup_conflictify_unshared (ctf_dict_t *output, ctf_dict_t **inputs) return ctf_set_errno (output, err); } -/* The core deduplicator. Populate cd_output_mapping in the output ctf_dedup - with a mapping of all types that belong in this dictionary and where they - come from, and cd_conflicting_types with an indication of whether each type - is conflicted or not. OUTPUT is the top-level output: INPUTS is the array of - input dicts; NINPUTS is the size of that array; PARENTS is an NINPUTS-element - array with each element corresponding to a input which is a child dict set to - the number in the INPUTS array of that input's parent. +/* The core deduplicator. Populate cd_output_mapping in the output ctf_dedup with a + mapping of all types that belong in this dictionary and where they come from, and + cd_conflicting_types with an indication of whether each type is conflicted or not. + OUTPUT is the top-level output: INPUTS is the array of input dicts; NINPUTS is the + size of that array. If CU_MAPPED is set, this is a first pass for a link with a non-empty CU mapping: only one output will result. @@ -1927,7 +1921,7 @@ ctf_dedup_conflictify_unshared (ctf_dict_t *output, ctf_dict_t **inputs) int ctf_dedup (ctf_dict_t *output, ctf_dict_t **inputs, uint32_t ninputs, - uint32_t *parents, int cu_mapped) + int cu_mapped) { ctf_dedup_t *d = &output->ctf_dedup; size_t i; @@ -1973,7 +1967,7 @@ ctf_dedup (ctf_dict_t *output, ctf_dict_t **inputs, uint32_t ninputs, while ((id = ctf_type_next (inputs[i], &it, NULL, 1)) != CTF_ERR) { if (ctf_dedup_hash_type (output, inputs[i], inputs, - parents, i, id, 0, 0, + i, id, 0, 0, ctf_dedup_populate_mappings) == NULL) goto err; /* errno is set for us. */ } @@ -3085,7 +3079,7 @@ ctf_dedup_emit_struct_members (ctf_dict_t *output, ctf_dict_t **inputs, OUTPUT, on which the ctf_dedup function must have already been called. The PARENTS array contains the INPUTS index of the parent dict for every child dict at the corresponding index in the INPUTS (for non-child dicts, the value - is undefined). + is undefined and can just be left at zero). Return an array of fps with content emitted into them (starting with OUTPUT, which is the parent of all others, then all the newly-generated outputs). diff --git a/libctf/ctf-impl.h b/libctf/ctf-impl.h index 0a362b6b17c..cd93a187aca 100644 --- a/libctf/ctf-impl.h +++ b/libctf/ctf-impl.h @@ -715,11 +715,11 @@ extern int ctf_add_funcobjt_sym_forced (ctf_dict_t *, int is_function, extern int ctf_dedup_atoms_init (ctf_dict_t *); extern int ctf_dedup (ctf_dict_t *, ctf_dict_t **, uint32_t ninputs, - uint32_t *parents, int cu_mapped); -extern void ctf_dedup_fini (ctf_dict_t *, ctf_dict_t **, uint32_t); + int cu_mapped); extern ctf_dict_t **ctf_dedup_emit (ctf_dict_t *, ctf_dict_t **, uint32_t ninputs, uint32_t *parents, uint32_t *noutputs, int cu_mapped); +extern void ctf_dedup_fini (ctf_dict_t *, ctf_dict_t **, uint32_t); extern ctf_id_t ctf_dedup_type_mapping (ctf_dict_t *fp, ctf_dict_t *src_fp, ctf_id_t src_type); diff --git a/libctf/ctf-link.c b/libctf/ctf-link.c index 801b6ee599d..42b2911e4f2 100644 --- a/libctf/ctf-link.c +++ b/libctf/ctf-link.c @@ -1242,7 +1242,7 @@ ctf_link_deduplicating_per_cu (ctf_dict_t *fp) dictionary. */ ctf_cuname_set (out, out_name); - if (ctf_dedup (out, inputs, ninputs, parents, 1) < 0) + if (ctf_dedup (out, inputs, ninputs, 1) < 0) { ctf_set_errno (fp, ctf_errno (out)); ctf_err_warn (fp, 0, 0, _("CU-mapped deduplication failed for %s"), @@ -1401,7 +1401,7 @@ ctf_link_deduplicating (ctf_dict_t *fp) if (ninputs == 1 && ctf_cuname (inputs[0]) != NULL) ctf_cuname_set (fp, ctf_cuname (inputs[0])); - if (ctf_dedup (fp, inputs, ninputs, parents, 0) < 0) + if (ctf_dedup (fp, inputs, ninputs, 0) < 0) { ctf_err_warn (fp, 0, 0, _("deduplication failed for %s"), ctf_link_input_name (fp)); From patchwork Tue Jul 30 15:36:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 94791 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 B296B385B50B for ; Tue, 30 Jul 2024 15:40:05 +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 9CCDA385C6CD for ; Tue, 30 Jul 2024 15:37:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9CCDA385C6CD 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 9CCDA385C6CD 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=1722353855; cv=pass; b=Kps8pM2vEBMOT9S8miEJnKu3lEpXymU4Nyy7yqBNFebcqhQd4jcSSGwC38yd8mCpAmg90IGKPu6TfNoeqfDEbSAluhM7an4yoSJJwnzRwZPRRAhULRKS3dRTj4zf/45S+NgTx7iH0QqCoKqtb2C2jwWGzCyvuBpyRJ9XMCHC6ak= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1722353855; c=relaxed/simple; bh=chWGBYils+ZrMjiDVi+dZr7vDQigcAAWBkIs07PvgM0=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=qTgBLpAC5K+UT3tPg2+jiDs8m0PiHCvsMe/kg7A1wCPBqC0rR7bs1rBWrA3+6FsDudBCTWoKjpTy/V7XfX24KMpqMf6exB2MFp+HWFLQ29D/Xaeoj2c67ZwsInJ/Bn4YWbbVh1U62vgFSslRcgl27JIuj9hH3jXd25uLnHBYrmg= 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 46UFMXrA006674 for ; Tue, 30 Jul 2024 15:37:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=KJFpiWCKMC/lZw/C7mRxOQpG8NHkcWCVY/PyfpGZUbg=; b= EvRLCwMFzjQaFs1xEEha3N69O6jFTASaW2Ao63TjFYR8TzABHhpIMfmScnrfHuIr jIOrARRkKPRoTQX/Lw6Vor2v3ym0zvAPmHrYjbj4anAR5tAExewTYjqNYYLMQvrN fDrIanli9BPoWUUMbEWBERmI3LVkyn6ACmpKcCJ3DzxljFOVye823Y+zHA57liQb XiLYZWSDz6AeFLZ9kZOVMyKT7HpHSF6I+uAssoYCJ870+NY2qGQAixvjBFgmwYoK mW25rxNnJ01xYTDXtM6xvcb+IZFVrsWw7RzcDxhqfzt1ywMnYjU+6AD+PelBmnw1 buekSh3SqS9GGKffQJyWlQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mrs8n9ya-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:37:30 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 46UFTqE6012452 for ; Tue, 30 Jul 2024 15:37:29 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2042.outbound.protection.outlook.com [104.47.55.42]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 40nkh6spv6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:37:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UnxWVi888nEHFvmii63SpKKkG64jJTegWJA+srwkQ5F3ZiYGE3P70b1C01dfSn+L++24QSvcyhiqbCw2UfS50c13eQjHNaepcKptUa/75xaiJXktbYHD2aQsLiKQC/379iiFsuCZOXMgfLlMC0rupfv/VGOOp3iUgskuaRYlFPTV8BEypYm7puXfEK7ojcYJ0+Qrn+QMlARAqrSYr6g3b0GgC0jisudckXvizZElAoLrLaNZ+acxV6CWciQBB7jqDAmSDpZ+zl/1oy5/Z8wCJsaXYq4bJgrKrli0NM0i8uQxSe7ETrUxPY03xCfi/ULsjjXhZBB3AqM+LEhGYzeQFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=KJFpiWCKMC/lZw/C7mRxOQpG8NHkcWCVY/PyfpGZUbg=; b=RV0BOyKGfa/q/0RZtoDcPErLcUyoc2c9KvCOvBXPWL2FeSVhDe020LV2ScmVE0Jxz9kv2YdUe6HDudtiGZ6M8IdXeT36n9B1WOU3vHYT1qVMd8RFIXtTRNGtvO5bUT8nKk1NA8EbJ0KxyHyiyZbLWtu9JzoVuqPFh1iJcuzA/CJPlYAW/F01FIgZLJCiwZj3H5LQyqyVGgqhl/V7Ekr7gSPZWPLCdKLl/Nsk3hMtV+v6ZDEjKvRVSrcoWrqyf6O9k+MK2ajUbPhuRoZb9kQaaHSY6Xye4C4x0rY7Vr6+YhWGrvRF8ndN5+wwFyKFtZBltARoLXuvgEzpBMA9D1fxUw== 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=KJFpiWCKMC/lZw/C7mRxOQpG8NHkcWCVY/PyfpGZUbg=; b=ivGvwDmspUn8xwczg76WwAhTEDElYN4kxjWLSseGLBxhXAZQneWpR/Ki4lobSjFFQbE501aTjCIj+raIihX2AyuE8d1JOpgosj3lm/II0sLxXd0Wg+/GhxBNzJqZawIvd79Qv1uwBg6feS+YNSJJcYlr1tsW4mIwlbpo0nVA19M= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by DM4PR10MB7476.namprd10.prod.outlook.com (2603:10b6:8:17d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.28; Tue, 30 Jul 2024 15:37:26 +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.7807.026; Tue, 30 Jul 2024 15:37:26 +0000 From: Nick Alcock To: binutils@sourceware.org Subject: [PATCH 03/19] libctf, string: split the movable refs out of the ref list Date: Tue, 30 Jul 2024 16:36:51 +0100 Message-ID: <20240730153707.168357-4-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.2.276.g4ac82df17e In-Reply-To: <20240730153707.168357-1-nick.alcock@oracle.com> References: <20240730153707.168357-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO4P265CA0223.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:315::9) To MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR10MB6608:EE_|DM4PR10MB7476:EE_ X-MS-Office365-Filtering-Correlation-Id: 4664abc7-d209-4f8f-74cd-08dcb0ad837a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: I2AaMch7y9R9dacwRAlbXgaR7umtYILDzJQ5F6giQEQjBu3l4dmDLPELJmDQyEvqQtkMh74HGBgPwOGtQfbQMVEoY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Nf2LfRsefF9I8As61d8jTdySw2HmrfPM4/JEd6x1jhS6qlL/JvIOH4CiOKK4C8YCBIJLd7P4nKyn/GMgC+WyV4hA+llqJz3BrpnrFotELGdJZnpu/3MXhEOiYuuQqsWblS5mwhO3fF/bdimP4SdCjPYZVPRZyKHkM2PHDSkXT3qle8w1wgN3fEwJ+3G3yoK76IlriXe4pISQ== 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:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3muef0kl63jSyTasDpzmdtq1C2I/3S0NX+YQgBhP+V+eZBPPOTJkENJyYUoyUYxpcv7K6eh0+k4muvXC8q0CjdlVJbSquiZx8o4Ba34Q714hHSSLTb9FqnEAvtHZhYydcBXKnmpuaM/KplyphYLyTwc6hkC8HfeFi1GhrSMxzVe5ZfUkTmtfhng4Git2UtDlQnFoJdcqMv/alcLjJ9AM4uFyN2uiMnPJ3nVY1gvCP1dUFKzcEhXdBVPSx9DcSIu/9SV0VX4bTOh4CgXxdgOAKvAZDcIl+cUEZe9xMoOsV6wRKHJqAX9Pb1awVrWNFXllWwj8BqA+MU0w6i6Hw1qF/74AbR8xe7r4fRKmjrY1YJdAV7A+pUOFwv/+E5MM6lw+5+ndYp2ZXPotXUF5AyeHf3eTqBt/zJapvX7XXDhlga/t16WI/uu+bTmu4kpH3kwJ/Grmvl/UqxzbTpSZ7mpcmRxqk/zWN6kJKJ+X6ai5LL2WGPwdUL/Apfa5zUFlsxaQ/DO41xPlHGAeKxODkMhVlLJt8lQ8LyHEny4L5M8m4gJRifDBiKbt0zASl5gRrPx2vM4k9/8p0IHWXWbBMsDSBKHXWcuug4GZyOJvOuW6fCFbLq5UORYocl3eeMwauxbE7NjNczqv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wfwM82qDAnSDl4JwtpdZO343bThx8QwvEtaxcnuxTpuHlpT6DpQRopLLyKbUbY3dlp7EDcjHAIL1PD7f1DHHmEtjOzcBjf3pvTUaNi5793I75f/gzvbH4uk/1mO6nfyfSnlSExRU0EDXAjfLFnD+gerSXmsQedWSUZQz23aDvn+yW+mc1VwGaUnAXou0Tn4Gzy7EBRlWQbFsif1wAmX/qSDVr3bN5sgd+fYG9kDfrpmd81oVV+piKkK+L6fn3Sw1RmLNZUxXlIMfrfYkPJ13sYsN4uPYUt0JG6G6pfLc3pCpQFRL1UdauIDLWlHmKVafzjKG4VfV3Es0jwHAycGiNl7BMsO1Udgcj7hkj8hDNUGMBgB+MpnSwFcb6jGc65P0wrYHBLE80kA+PK2DwnSqDCJH1XKaT65qXgMvmdXmbfk/XbHNu5ZQzDI0GE3f7m15e1BHxZ4E6MKJdMnlYVEN2ZquUcEd/elSYdKCcChy+rCXbWZkjuWR7UhjyMIjkMKtSxGts3Ufcqn17pQvMHOXIIXD5yvA++xTMEqLKyL751Md33nEXfO5kvKeFdy4tNcXIVK7Gqte21sJv2nFlFt2Iskw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4664abc7-d209-4f8f-74cd-08dcb0ad837a X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2024 15:37:26.2233 (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: 9HrsCglgPonMB5labwu26GqKG8Udo9L0PvLdKOgAcfZGqwGKoSaIUQ3iHOR99jgADzv/zTAQxrRlU85jOZgt+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB7476 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-07-30_12,2024-07-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 malwarescore=0 suspectscore=0 mlxscore=0 spamscore=0 adultscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2407300106 X-Proofpoint-GUID: WXDw5cziaUkiKIvnEcVfQxCQbhIej5Xx X-Proofpoint-ORIG-GUID: WXDw5cziaUkiKIvnEcVfQxCQbhIej5Xx 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 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 In commit 149ce5c263616e65 we introduced the concept of "movable" refs, which are refs that can be moved in batches, to let us maintain valid ref lists even when adding refs to blocks of memory that can be realloced (which is any type containing a vlen which can expand, like names contained within enum or struct members). Movable refs need a backpointer to the movable refs dynhash for this dict; since non-movable refs are very common, we tried to save memory by having a slightly bigger struct for moveable refs with a backpointer in it, and casting appropriately, indicating which sort of ref we were dealing with via a flag on the atom. Unfortunately this doesn't work reliably, because you can perfectly well have a string ("foo", say) which has both non-movable refs (say, an external symbol and a variable name) and movable refs (say, a structure member name) to the same atom. Indicate which struct we're dealing with with an atom flag and suddenly you're casting a ctf_str_atom_ref to a ctf_str_atom_ref_movable (which is bigger) and dereferencing random memory off the end of it and interpreting it as a backpointer to the movable refs dynhash. This is unlikely to work well. So bite the bullet and split refs into two separate lists, one for movable refs, one for immovable refs. It means some annoying code duplication, but there's not very much of it, and it means we can keep the movable refs hashtab (which in turn means we don't have to do linear searches to find all relevant refs when moving refs, which in turn means that structure/union/enum member additions remain amortized O(n) time, not O(n^2). Callers can now purge movable and non-movable refs independently of each other. We don't use this yet, but a use is coming. libctf/ * ctf-impl.h (CTF_STR_ATOM_MOVABLE): Delete. (struct ctf_str_atom) [csa_movable_refs]: New. (struct ctf_dict): Adjust comment. (ctf_str_purge_refs): Add MOVABLE arg. * ctf-string.c (ctf_str_purge_movable_atom_refs): Split out of... (ctf_str_purge_atom_refs): ... this. (ctf_str_free_atom): Call it. (ctf_str_purge_one_atom_refs): Likewise. (aref_create): Adjust accordingly. (ctf_str_move_refs): Likewise. (ctf_str_remove_ref): Remove movable refs too, including deleting the ref from ctf_str_movable_refs. (ctf_str_purge_refs): Add MOVABLE arg. (ctf_str_update_refs): Update movable refs. (ctf_str_write_strtab): Check, and purge, movable refs. --- libctf/ctf-impl.h | 7 +++--- libctf/ctf-string.c | 60 +++++++++++++++++++++++++++++++++------------ 2 files changed, 47 insertions(+), 20 deletions(-) diff --git a/libctf/ctf-impl.h b/libctf/ctf-impl.h index cd93a187aca..b17a2d8699d 100644 --- a/libctf/ctf-impl.h +++ b/libctf/ctf-impl.h @@ -208,13 +208,13 @@ typedef struct ctf_err_warning the csa_refs in all entries are purged. */ #define CTF_STR_ATOM_FREEABLE 0x1 -#define CTF_STR_ATOM_MOVABLE 0x2 typedef struct ctf_str_atom { char *csa_str; /* Pointer to string (also used as hash key). */ ctf_list_t csa_refs; /* This string's refs. */ - uint32_t csa_offset; /* Strtab offset, if any. */ + ctf_list_t csa_movable_refs; /* This string's movable refs. */ + uint32_t csa_offset; /* Offset in this strtab, if any. */ uint32_t csa_external_offset; /* External strtab offset, if any. */ unsigned long csa_snapshot_id; /* Snapshot ID at time of creation. */ int csa_flags; /* CTF_STR_ATOM_* flags. */ @@ -393,7 +393,7 @@ struct ctf_dict 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. */ ctf_dynhash_t *ctf_str_atoms; /* Hash table of ctf_str_atoms_t. */ - ctf_dynhash_t *ctf_str_movable_refs; /* Hash table of void * -> ctf_str_atom_ref_t. */ + ctf_dynhash_t *ctf_str_movable_refs; /* Hash table of void * -> ctf_str_atom_ref_movable_t. */ uint32_t ctf_str_prov_offset; /* Latest provisional offset assigned so far. */ unsigned char *ctf_base; /* CTF file pointer. */ unsigned char *ctf_dynbase; /* Freeable CTF file pointer. */ @@ -746,7 +746,6 @@ extern int ctf_str_move_refs (ctf_dict_t *fp, void *src, size_t len, void *dest) extern int ctf_str_add_external (ctf_dict_t *, const char *, uint32_t offset); extern void ctf_str_remove_ref (ctf_dict_t *, const char *, uint32_t *ref); extern void ctf_str_rollback (ctf_dict_t *, ctf_snapshot_id_t); -extern void ctf_str_purge_refs (ctf_dict_t *); extern const ctf_strs_writable_t *ctf_str_write_strtab (ctf_dict_t *); extern struct ctf_archive_internal * diff --git a/libctf/ctf-string.c b/libctf/ctf-string.c index 2d96e45617c..4e1fd620ff1 100644 --- a/libctf/ctf-string.c +++ b/libctf/ctf-string.c @@ -109,20 +109,25 @@ static void ctf_str_purge_atom_refs (ctf_str_atom_t *atom) { ctf_str_atom_ref_t *ref, *next; + ctf_str_atom_ref_movable_t *movref, *movnext; for (ref = ctf_list_next (&atom->csa_refs); ref != NULL; ref = next) { next = ctf_list_next (ref); ctf_list_delete (&atom->csa_refs, ref); - if (atom->csa_flags & CTF_STR_ATOM_MOVABLE) - { - ctf_str_atom_ref_movable_t *movref; - movref = (ctf_str_atom_ref_movable_t *) ref; - ctf_dynhash_remove (movref->caf_movable_refs, ref); - } - free (ref); } + + for (movref = ctf_list_next (&atom->csa_movable_refs); + movref != NULL; movref = movnext) + { + movnext = ctf_list_next (movref); + ctf_list_delete (&atom->csa_movable_refs, movref); + + ctf_dynhash_remove (movref->caf_movable_refs, movref); + + free (movref); + } } /* Free an atom. */ @@ -263,9 +268,10 @@ aref_create (ctf_dict_t *fp, ctf_str_atom_t *atom, uint32_t *ref, int flags) free (aref); return NULL; } + ctf_list_append (&atom->csa_movable_refs, movref); } - - ctf_list_append (&atom->csa_refs, aref); + else + ctf_list_append (&atom->csa_refs, aref); return aref; } @@ -489,7 +495,7 @@ ctf_str_move_refs (ctf_dict_t *fp, void *src, size_t len, void *dest) for (p = (uintptr_t) src; p - (uintptr_t) src < len; p++) { - ctf_str_atom_ref_t *ref; + ctf_str_atom_ref_movable_t *ref; if ((ref = ctf_dynhash_lookup (fp->ctf_str_movable_refs, (ctf_str_atom_ref_t *) p)) != NULL) @@ -514,6 +520,7 @@ void ctf_str_remove_ref (ctf_dict_t *fp, const char *str, uint32_t *ref) { ctf_str_atom_ref_t *aref, *anext; + ctf_str_atom_ref_movable_t *amovref, *amovnext; ctf_str_atom_t *atom = NULL; atom = ctf_dynhash_lookup (fp->ctf_str_atoms, str); @@ -529,6 +536,18 @@ ctf_str_remove_ref (ctf_dict_t *fp, const char *str, uint32_t *ref) free (aref); } } + + for (amovref = ctf_list_next (&atom->csa_movable_refs); + amovref != NULL; amovref = amovnext) + { + amovnext = ctf_list_next (amovref); + if (amovref->caf_ref == ref) + { + ctf_list_delete (&atom->csa_movable_refs, amovref); + ctf_dynhash_remove (fp->ctf_str_movable_refs, ref); + free (amovref); + } + } } /* A ctf_dynhash_iter_remove() callback that removes atoms later than a given @@ -558,11 +577,12 @@ ctf_str_purge_one_atom_refs (void *key _libctf_unused_, void *value, void *arg _libctf_unused_) { ctf_str_atom_t *atom = (ctf_str_atom_t *) value; + ctf_str_purge_atom_refs (atom); } /* Remove all the recorded refs from the atoms table. */ -void +static void ctf_str_purge_refs (ctf_dict_t *fp) { ctf_dynhash_iter (fp->ctf_str_atoms, ctf_str_purge_one_atom_refs, NULL); @@ -573,10 +593,15 @@ static void ctf_str_update_refs (ctf_str_atom_t *refs, uint32_t value) { ctf_str_atom_ref_t *ref; + ctf_str_atom_ref_movable_t *movref; for (ref = ctf_list_next (&refs->csa_refs); ref != NULL; ref = ctf_list_next (ref)) *(ref->caf_ref) = value; + + for (movref = ctf_list_next (&refs->csa_movable_refs); + movref != NULL; movref = ctf_list_next (movref)) + *(movref->caf_ref) = value; } /* Sort the strtab. */ @@ -664,8 +689,9 @@ ctf_str_write_strtab (ctf_dict_t *fp) if (!ctf_assert (fp, atom)) goto err_strtab; - if (atom->csa_str[0] == 0 || ctf_list_empty_p (&atom->csa_refs) || - atom->csa_external_offset) + if (atom->csa_str[0] == 0 || atom->csa_external_offset + || (ctf_list_empty_p (&atom->csa_refs) + && ctf_list_empty_p (&atom->csa_movable_refs))) continue; strtab->cts_len += strlen (atom->csa_str) + 1; @@ -700,8 +726,9 @@ ctf_str_write_strtab (ctf_dict_t *fp) if (!ctf_assert (fp, atom)) goto err_sorttab; - if (atom->csa_str[0] == 0 || ctf_list_empty_p (&atom->csa_refs) || - atom->csa_external_offset) + if (atom->csa_str[0] == 0 || atom->csa_external_offset + || (ctf_list_empty_p (&atom->csa_refs) + && ctf_list_empty_p (&atom->csa_movable_refs))) continue; sorttab[i++] = atom; @@ -747,7 +774,8 @@ ctf_str_write_strtab (ctf_dict_t *fp) ctf_str_atom_t *atom = (ctf_str_atom_t *) v; uint32_t offset; - if (ctf_list_empty_p (&atom->csa_refs)) + if (ctf_list_empty_p (&atom->csa_refs) && + ctf_list_empty_p (&atom->csa_movable_refs)) continue; if (atom->csa_external_offset) From patchwork Tue Jul 30 15:36:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 94788 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 AB2A4385DDCC for ; Tue, 30 Jul 2024 15:38:48 +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 E699E3858282 for ; Tue, 30 Jul 2024 15:37:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E699E3858282 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 E699E3858282 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=1722353856; cv=pass; b=XGA+vpOBc7O3Jkp1kSR+lVfewuCsH9IBGdHcSt8dWQeCtZ9knMjPIbrxGigmrMX8fV4TtjFXLbyAiAHJviFkf7TDQ4Ow+OZiFbwT2Dz2ZalYc7W446PJ/hy3AQkXlihyAXi9Qnpv46Hv3XREuLDeVXEJeYiT/U2QpYHnkT2Uw8c= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1722353856; c=relaxed/simple; bh=T0GhCoHr7DaE0V3FSD/wn71O4mJTj/EInDbcp8lAsJQ=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=lzqSsIdi29noS5S3os/cRKUZZmZjtmsABJuHPZHxvaaWX6L0xXfGWweUGIUgbxd9h76LoJul62vVG5uwBF1ldvRC1dla+WOAI1nxVZ9dFERkAjeBJ+rz+Hkch17yPW8oqfcJNuW2PwNvYOe3jG7psGV9W+tFcUXedLxQIiYTDjw= 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 46UFMWVm006639 for ; Tue, 30 Jul 2024 15:37:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=uM/cnluH2/koHW7nQlYTyxsRirbz/ckIVbYxFMWvWeQ=; b= dIF4Ij1OlW3pmYZlsZtyjDv1H1kDt7YCZjFfsIZp+RvXcv88WiXk8Ji7foLSsVQJ yfIHhFyFWtTMEAB8UjA4l51J0ujg4g8ZcuGbjlwy+ZDN0oDjG/Tlu/7w3ZFPvQRP 1y8VeL4494Fd1k3EVZnv258TleIzZV8vLTmkAhoo0rPm8LoD3aTvDSV+OBDdAB7m oK8WSUceFdVYEo905Zhg9cSy+ePNOv8aFeWQvALLogREk5cczP+kayLP1YLJwNAx XTI9xs8BJOsz2tCeP9a1Axv5Lew6tz9wrkUWKa8MfENgym/Ylbcva5TnhJ7jAG7U yvfHUl5+ufX5HSAvl8PiHA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mrs8n9yk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:37: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 46UEW8Mq035624 for ; Tue, 30 Jul 2024 15:37:32 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2048.outbound.protection.outlook.com [104.47.70.48]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 40nvnwdy0n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:37:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nVGutpgh4bIjaq4JzvPKvMizrhOlXUKtkgvO0KWjUw9KQAlQAa7eRehADT5MqFgWcYWlj2EQ2W+LSdDTM6ILlsFINDfo//G1C0BEF/2zwyyoHk/w/KoHYfvYpaTIql1MevEKVVFg3BMWjhyumTK5/vrbJx4fdJArfUbDBsr8Zd4KSTzMfMaSHUJi1lVDQjAV6t+rktV9fa+2O9N5frd74XlwtOYRJSE0sMXXm0kP0J8ParinHC6u2SkYORdQmbUpQNB0hWpO4HzUbU5ZPYDH3cq8VAFP9RzTVn5JvPAhkksSuz6XQFYKi5FujrBXNL/1XNZnfId+oUWxBmcN31dVNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=uM/cnluH2/koHW7nQlYTyxsRirbz/ckIVbYxFMWvWeQ=; b=iRRV5pIwwR/4zOgSUwPWkUAxSUpXxC1mM/A3TR4knt9NhPKgi5w0ZW9GcBmwMX2px8VCASHDnT4ATU7futA6/0ZGK9QV+HPtTqosFoGzUYkza3ZTqQyW442QBvNO1RyZ2oVuLmburXsU87A99a7moy96yCFGLLMnqoTEBu+sRUvT/6RbOq1YITWYK3J15qorlfPBXwtnpTkXfhrVVmMu+FOcd4Xh5HuXIvUw73qpqWZ0JF2+gzAUib0/2wGLVPdlJbuJK9WxnCiAJhGnpszLPu5L0Dvn+1XvRuG2Ln6Ztw3jXn5f2pDwPDHHuLnRJgwsvYXi89h1mgGqV0bBx46+IA== 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=uM/cnluH2/koHW7nQlYTyxsRirbz/ckIVbYxFMWvWeQ=; b=B808AivRTdX5YYuXjZ0+DTdpwGTf4E88MeZKDrtKyzkL3TKea3M8upa5JmMTwzlc63WIG5r/43JBu6VZyZY+tU0mMS69KiYFMWG2EEaYG37lEAoFpdNphb0+cHyIl3EfCWsVnMQkQlISfESLOOW+6PuQotD8aDv6U3hxbvmriC0= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by DM4PR10MB7476.namprd10.prod.outlook.com (2603:10b6:8:17d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.28; Tue, 30 Jul 2024 15:37: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.7807.026; Tue, 30 Jul 2024 15:37:29 +0000 From: Nick Alcock To: binutils@sourceware.org Subject: [PATCH 04/19] libctf, dump: correctly dump non-root-visible types Date: Tue, 30 Jul 2024 16:36:52 +0100 Message-ID: <20240730153707.168357-5-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.2.276.g4ac82df17e In-Reply-To: <20240730153707.168357-1-nick.alcock@oracle.com> References: <20240730153707.168357-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO4P265CA0225.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:315::10) To MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR10MB6608:EE_|DM4PR10MB7476:EE_ X-MS-Office365-Filtering-Correlation-Id: 015dfff5-8886-4ce4-5b87-08dcb0ad8572 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: uKjfF1z04+TtHBIz6f9JtgZL5EynktXOmVqIwFAI15u4CF8R43vVPIA4nLU8v93pyr7+9DaVZXwVj1ghKM13rW2GFnYRTcraAs2UiiJM65dhx++4S5EPJdG1snzJoowotVJ2z3JaXepd91LFKlpT9wPOWOwX+C8lPAqcFJOjfvtlfpBDUni2c3EkMvghouJ3YDmD0KYzPMcTpSveileTRrXtvsxI05FOv5Lw4mpksTxgpH0BelaiTi1oRdS9bM0nNOVRrjKMuaibQrkiBSng4KUVtznJsuThkqKWh6WE9EzhAgEUnZhUs/+U4D6gp2JOjZ0c/TYrp9WqfdMhL8VLnxzFehlDMqe4lQ6Asmr7F8yxDcIguL6e2IiOfKncJNYAAaecyXXkveXRYN9TF2a075dm0z88oyOSJEOJeiuocBgSpfhILI/MXm12gTTyVU9YezrNlqkdJhbBF2ukjhawBYYa4eGRE1lsYwjPVclTv/SnuUcNObiDT0EdEpmv57f+x8o5McElpcDqm7IFrVxBONpT9q12s/JkDD7z77qCVtIOhxT/QP7XCYMWD3HAGeRJu1gR5VhakplGoqim4jA4Mlp9nrXdV9tXwTzfmLTKXdVSMrdPwGBjZlTtSp6QPY01zrQ9QPGmCCpa+5133njTbsU5HYYcI4fpZwUFY7Ed2HbizvjEJS8XDMRrmvvUnaMO6x8fn4sn9H/QAOZDIRPUAeXsSRdP6poYg8zeJWpcUD717gvEtYVH/ojYOo1XkdXihsXDbpkzKG8pBJkR7e8h0K8OhsByjqYNZsOcQSwUnDaSp0WRpiUfg/d+8y5DfNsD3wSDtq2i/4FgkeTjpE+kSNXaJzqgLWMpxAAJeZuXg/f6NBVHtagZIYmQYQmzLWwJbbLc16xHf32/K9Ft3eChPQ2dzyJiCGh65ft1KRTCbKi57mQc0SbE91YwJDBrFVD8FsDYUtG4cvES/nXjp6pKlk9Vg0Ws7ROWOjOkw01m1yMA74CAaEEmzO7hv6Fpnoa7Zkk8JAftpZGLwKEOxonKAXCw3h2UwouPpJoBsAfHAyG6xw9Ys4dTJv2Dpev6YfrRDMNSoz16Be9+hcuQa+MJ+LBQOGbX2RQq6MuOJNSZpEkm9ZeBe5j+cVW7o8tVaHtDVV0/ZHJPrZE1hM2LtU02/MnUONRDlHTxQrfbA5T6unw+c2abvTILx3heErygICIGegW1x8LoD8XNblFvv41CdqMkhhnuZG4/rTBPDUCk6F0tFJj9V3ng1aUpSIRr4RmsrP4OW2BFkRJvB1GqPDeNyBk7fzsdmITzqK80iFoDadPHg9yXOKdD3KRyVVmVblIMSGWk0vpE7Dht0VjtR1f+TA== 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:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zThFGAaT4zcrt/thFZiW3meRBSwaPlrrSF+xUteCt1XViPxgHDRl/cfGqS88M7Twc6ns0DeIf7tMKyZyaKqkEZr+faP8UPVYnvJe7EUvhlzc6rJjyb2zlSgXlz/J/aFzipCRzv//2CNUKqiwCnXRDJpFi+bYspSxFITZDgtEH27DDsFvKIQL41+yZ5UClJLsHEEQXLHu4yVUPMrp4trcjVBA8i3+xX5GtcHot1DHiJDElai405CfaUiTx3QibWs2lJmiXsooMFFEywIouA4d1XijmBDW/AbmlqnWhc6UBIIJNEG9tS+MQJ6AKLHqZRyS2rOdvzecM1c1t0TNNfrfhJiTk2lfkxHgx/yB4b4m1fswhuzz1SOagtTBzV+boz43ClCc0u7Ws/4gM0vB3L98CZbYyVgwl52KpJEfXfp2+Uf4xR3+tmVSMyrIw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rakb1zowtLIXYKSIXNJ3p7iswNUa42ihreA5mEco4oAvzjjGb+P4ftTVodiLEeVhIFLP/y9wu9sB6DtqfbhBuX/OshoC6wfDEKFPv7+oNwA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: KOmGU9IGhqroPBX0hSpbulao4SPRPCqMNDZ2qHMyj7u+jVJ0SFDKR7Dk1V4AIIdlOyHS33mg5x7K1B8jX8EsLY/U1Sb5GkrT6u/o/5GAXTNyXHofZ02GsdVB13894kCgOnDJfazwI91hluHeUY/J5SRCuubDzw8R03Ee3lyCo8aST5XFXcvU7Rjnp8geBJy6g9auPgV8f66wt3t2LHCU8TcXxurWUY9c6KWDWh8e0kGCRnZG5Q4UAcufOcXdmZW2A7UcGJG7s6ThpO9ZruHyQLQ4N1DpWz0kobNHSETbIdNgtyjlc9/Z68kJQgfb5dzDz4T4AGV3BupeLFHPt2jJr6lmdnPcm0dMS7kBB5jNCN2SXmjXg8sMCAiZdCJFbgEfBiOQ1ORFG5VQYqAfJmQdd+suD/3WUoUG/lL6q6+fUFVesRC28IOjrBegOE9DcntYe6ml9odd60L3xOitFxNLIrEQsClF6ZSEs1Y3jGBXsrTRsSQlkUd8KbIhnsyDYfvdvs8WN+GVVWZpN18IRb9JZBFHRJJtqYul06y8qW5wtjTSHRe7udORPrC5VRd9QsLEsQ4I0SD/D2BAm3u6vLgbT52VsSvAigKrtaIQW1G8d+A= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 015dfff5-8886-4ce4-5b87-08dcb0ad8572 X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2024 15:37:29.5271 (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: hdOMWfC9e22ktUBIW/QzpSXDv5g9s/2vBqK6e2CshqMSDhIO0YjC2LhQ1r9WTzduUEjAg/xGtnY03EBz1eojTg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB7476 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-07-30_12,2024-07-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 malwarescore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2407300106 X-Proofpoint-GUID: 5XHLrabQmMeFqz1gKDCNBOl5PRlWHAFS X-Proofpoint-ORIG-GUID: 5XHLrabQmMeFqz1gKDCNBOl5PRlWHAFS 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 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 flag test when dumping non-root-visible tyeps was doubly wrong: the flags word is a *bitfield* containing CTF_ADD_ROOT as one possible value, so needs | and & testing, not just ==, and CTF_ADD_NONROOT is 0, so cannot be tested for this way: one must check for the non-presence of CTF_ADD_ROOT. libctf/ * ctf-dump.c (ctf_dump_format_type): Fix non-root flag test. --- libctf/ctf-dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libctf/ctf-dump.c b/libctf/ctf-dump.c index 80a3b265297..cd41996084d 100644 --- a/libctf/ctf-dump.c +++ b/libctf/ctf-dump.c @@ -106,7 +106,7 @@ ctf_dump_format_type (ctf_dict_t *fp, ctf_id_t id, int flag) const char *idstr = ""; id = new_id; - if (flag == CTF_ADD_NONROOT) + if (!(flag & CTF_ADD_ROOT)) { nonroot_leader = "{"; nonroot_trailer = "}"; From patchwork Tue Jul 30 15:36:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 94796 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 D2940385DDDE for ; Tue, 30 Jul 2024 15:41:47 +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 9D023385840F for ; Tue, 30 Jul 2024 15:37:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9D023385840F 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 9D023385840F 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=1722353861; cv=pass; b=HEax3793Z0cHNLr0ADIqeevCKoc98i5iyNbVp8E4794NxQHxnesfC1GWtNSfwIQMSTVy1WsXd3+mWdVYZs27Akv18xn9puJiQESCEmWlpAdaeNf7R/A1u2xoIueWZFEoHsyKp4JA2nVrrjHFEHkvWOEhWvJVlnX4dorKCRwYZkA= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1722353861; c=relaxed/simple; bh=EOasx6JgMEJekzBUuuXMWhXL53+S2D9EhPDZUJKqs0E=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=FPtZlY0LoVkYiolYe3mjGL4rhSSALRvIHkiMkJQyr8dqrZ7z13VTfF+qw/9g9gwW4IlNYXQyhXhEbDoH91RADKipLYZbaGov0qwffnHrwUrRLjanHXXOjbyFwTookF+mkbk1U3/HzjxHYGEDc9XKNNvmnY6LlmjzjnI0IQ9vHN4= 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 46UFMXrD006674 for ; Tue, 30 Jul 2024 15:37:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=9daVSGhLoIutCKRFjmVP2Goydw3WL0tp0SONh8Cys0o=; b= hH4im5YzZY8sRL3pHDn+dKb29N9xwwuy69e1R9QiI098YXoEM8mMFS+7X6g+208d 9TpHv0QkknHsxK3qsXKDb5RNNgacDPUTWw9G1vC4eyUYS9NTHNTe6l3WKVqgxHVl oJwR8KZ7xvSJjgKhWDTSdwQ85gMnisCfrzRBxCNwK94jE6X9JEdvRuchigAgOuQm RpRnHvKZk5Y8SnPNIocj8C6PN4gXAenJj9g164tpQIdF9G3Ql52xkAIrk1Rdb449 m+D0EoiQepa47PhNa9NdSj8hAnlD4oOj9WDYhnVK9aF9h8Nga1666GlI8yduq/PQ NjrIdZEE1GbzoRhZN/iEYQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mrs8n9yt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:37:37 +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 46UEtOUS030693 for ; Tue, 30 Jul 2024 15:37:35 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2048.outbound.protection.outlook.com [104.47.70.48]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 40neht6s34-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:37:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qPfTC+HiRjwEiIVpHogyJSI2N3UaDzRKyoiD+PVCFd36SZhiWTNCpEfgJ2f2dD9eashBBnLQ8IZ/v4/nI7/rG9lrsH+ShPnVyhyEwyxEPnDHP5gcf+ZHMAmIsf736POjxeHd4iJy1eJ+XFwnLGACIU0h5R2Ff11AxOqqgIvEWe/xM7MerOWq+2f7IY+rtYZAdVwueWJoAXPxDGvpp7ZGy6EmTQZApKloyaezdJIls40b1lHLHmvZwfL2nKtRR/3sz8QYE53FJvQ4EeWUTS7CrgtCaGqf9rfrIhEYkUZXGDxLDFTjO3FsOlF1xTbUxLghbmbO64BPAcI2w08WARO6jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=9daVSGhLoIutCKRFjmVP2Goydw3WL0tp0SONh8Cys0o=; b=PFFfhxmeQ0mS/GqVx/iX94m2srKeXP3Xa4EmqD2cSrf83nDVBGMp0rO5IX6DecI9DaIKtdF8t6N5LEUjiXDQkNsekpCf4v2RmGr0UrB3rZOhpoobUWvFOz/AxRL91NfIBWk12SXzmXPqWCyfzqdnt0FrljWSd6QlCf6BG8Ve7DgJcv5soGPSmTCZuizGOVirOU0WoIGo66+M0yamVrlwDLmY35KRiX0nYG2BTbJB8NYHfDCckXgFVAjH/auJqUxXTK4y3XfivHxoNwE/dTgaBbASo5RuZCenbsEyj0smDNFVk6do+1yRxhfw2bT7jPPSUpfS5JpGmQgVrlrodiQN0A== 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=9daVSGhLoIutCKRFjmVP2Goydw3WL0tp0SONh8Cys0o=; b=qj0/dKwE/4CaaRXsa93Yn0lxxpNWBBZRwSEpfQmh8JOXg0Mz6Idf9TPBYyVCkoxmd/b16CwQP+g6XNe/s+MGBhihjRlgJpIeD8JGfTCRTI7x6y5gHZAPe2ysiEVty7g60acOLRznNhteZovclifGx1qahFHZKq8V7ppPyp7OvGg= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by DM4PR10MB7476.namprd10.prod.outlook.com (2603:10b6:8:17d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.28; Tue, 30 Jul 2024 15:37:33 +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.7807.026; Tue, 30 Jul 2024 15:37:33 +0000 From: Nick Alcock To: binutils@sourceware.org Subject: [PATCH 05/19] libctf: fix linking of non-root-visible types Date: Tue, 30 Jul 2024 16:36:53 +0100 Message-ID: <20240730153707.168357-6-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.2.276.g4ac82df17e In-Reply-To: <20240730153707.168357-1-nick.alcock@oracle.com> References: <20240730153707.168357-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO4P123CA0320.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:197::19) To MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR10MB6608:EE_|DM4PR10MB7476:EE_ X-MS-Office365-Filtering-Correlation-Id: b69acd3a-a577-4f17-b94a-08dcb0ad8795 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: WwgB4ctwSGNqs1TDt6xMlHdMfD6vNN2DTtMU3vsOURmFNFzBZZRH6Dz+wOU9AA3NqQetMf7THUQLeGvpExkD5Ysyh/jPoU8L2Z6f8/DqIGuD47q1xLCz/UbHE2mtIeOZyHGq93X5KHJ+F7hSBlNCCc27ZHYFMdQbhwhTV3VZ2CqFqTvTWFKYa1yrQjjESxAt32U0VWLi6DFf3czeCa6a4oTRvNCSaPJEoIjOzln1fgOr07gAqAvEYHmuZ59XqBxpmcSAL/3DLHA2kscxLUq5uIYb9aqdZ3+q8XntWW8NHe4+YkAZMOODpq0kzLi65Hos4g3nwW765E5zbmL0nfrfIJHIG6d2OHdWWUslT2vgbvmOB9llZTPSKBmnAtOuYEqApa072SRYm+Eevm6vEG5h27MFjdXxZidbtGJaYCrBI/doxCIqsqP7CyQY5bOYT+5vN288COEUYAM1xy5rfrsA410sW9unXLnw9SqrTKigVowrX5cLz9D/4PtodEYRzT2+/hXMZqsbLt1coOckuXwzF9dn3c5aJ5Gz3OdLg0wAK8yVP5spXuUhmn9BrqgXjslpzvCa8udbweSBYugL4JPDcVFybw+IrtBSNdBRQHxxBRQpm4AyNFlqfiS42zSPO1OkVPhhuV3YMT3AG0EhkArzc3EAv72EaHy3ObXfElmacpfx1a0ESS4e6AGbFDAwU94WNSVjLAravLmcmqgsUZVkMusjqaw/Zek4/+f7GuMqFP+x9OJTCVvBqThOgEyqC9djHN2k+sAELNtPdv8QYw2sjwHSwetnxW6WmeOHysxvqEqqR4nCfdihMS2y1pVrj16H365emTkDjf5HGzR+UCTZe6owHsK98CFFiqQ/hOzU8txxO7vdHhmXHzEJ81dPb6ipdTvT8NiJb5nSUaJ6MCgaOwg7jNZ4R4H62z3y81MXZGDtuqeroNTDO3tuJstoedpZNypD7+VTjYZCRIY/O5fxJvFYpcEtZ0IZv1WjwtXr9H0VOi7bxJ7Up2FMB6YvaDBL/5w18U2SNgduoKb8hfOMrUWmGKGKhVJ8ILzjZPLxkBucmEW/1mVSjlWZfKhOqbWfmTN2z2ZiA1ON52N6UJBzIRDoOSupdt2sx4U/ZKF/oXDPz8cpzyjs3BVV1kgkoDtWVzu+u9W8vtRyrR/qMfLYxZ1KSFC+qO3MtJqckAyZAQEg/SCXZ16MIdPzwcmWomKYF2/GJm5cORRh35C+2cCi2FOSFPSjtSi67rT4L4Q9bERdDMm9OFGOA7idt+Xx2jg/M9fH25kx6SDMEvbOcb51roIPcPKJT7lypJ3nF/3rshA= 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:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Z6V1Lgom9QT5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mrvzn9+ZfOEjoR1k+ycP/6Nf4bxc6JECez/BWs8U8x4zqyXgvLZhHolsActMmreNisjV+Pp/8Y+Rpt0ah5XBhsXtimZfA7epyCtrPAtrQN6iExoVAujqH9KQAySaf8efCXP03KENwsLpczCmwZIaMxGYgGJWj4VoU9M4dKFHuOWtOnGn8IwCAzsUaPw0W1XjY9aye7K/U1HiJIOY9CDsebtaMo9lVCmQh1GygDtULCnCObyNRwIgWbBXxweykeWSlFylz2/pGktG1mL98ywjLIzaH7f8iOe1RFez3vVkgbmIHyDrbCpq+zswwKe1BNxBFEXS+4FHtu+cL5KzLfMenith2Y60vLeuC/2c3/Vq2NsY/q5kkhgwyFF2VNaNGuLEaKlZA/YcgbCTu7vDqxGxmqUO5PORniDibYnhA5SvcBwEMi2q3e5a1mFPghGN3HTmAfjVgELJcNt4pIo5UwL4DIK19JpEzWyaaskHx17TVezQW+vHX1uP868zZWW12EHRM3XMnNP2f387ocKAL1FA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: PJi+Ju0yrbYmzj7fQOr1ZCLsKlD2uObQdZkdaDiqziMMlSvlEEhE24GLgxxk83MtBuW/fyXqnbnfTpJ0+s+qm3y15Gewrv79nM9/AIcHnx5JuUZSOrSrZDPdD2zECVYmignxbkcsG/dyr3iTXQ8lAXMzcwyptai+/gq8iBZfDBtiFOxes3++HbtK6jG+E++FwmDW9WaINe2pO8J85BZwzJlfbuS4Nyau7BTeqLzs8cLrZWsmw+bk5qICCQ2REDZY422hDg+M2ZEkQzilIIdkkttjJEHJ1SmxVYuWHLoFQ6PCWbbmTUXpPa1GWMNZrucfL7wD59B5H8nkrRVZtxm02d6NnhzCXL83Sn8I2WvBYu+YJF1XSu+CiX6BRCKs8at/m9ncyc0ZEt8+V6Hpxq5vqImukxO+W3bwdm76XkSeXBWSG3xh8DThKesbmVmWYExeQ86kO5A+6kiSinEc+m+3KrpZGW1ipx+bEDUAHrizfddNW60AU0LZvf6ADvUIA7fTGkY8P1N/TK6S1EaQgE1Y7e6DwC/tK8cPfRUhVvlakbzoQie8udq2LfGQRISvv9mXG6pVm93IfjvQf2S4BRFWbT0wFSx47GmrA8+Bfe7BTAI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b69acd3a-a577-4f17-b94a-08dcb0ad8795 X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2024 15:37:33.2400 (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: 120SOIyjeDRfqqkaTbuSbtmH5kQO5bQ/tOCZyfRsgtJJIz9U1qQuExJyH0OCMhXytyiXMv48b+GTOjQHe6rA1w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB7476 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-07-30_13,2024-07-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 spamscore=0 mlxlogscore=879 suspectscore=0 bulkscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2407300106 X-Proofpoint-GUID: 6ySgKiARu8FMtCUs3qTQAKU4zK3pkl6Z X-Proofpoint-ORIG-GUID: 6ySgKiARu8FMtCUs3qTQAKU4zK3pkl6Z 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 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 you deduplicate non-root-visible types, the resulting type should still be non-root-visible! We were promoting all such types to root-visible, and re-demoting them only if their names collided (which might happen on cu-mapped links if multiple compilation units with conflicting types are fused into one child dict). This "worked" before now, in that linking at least didn't fail (if you don't mind having your non-root flag value destroyed if you're adding non-root-visible types), but now that conflicting enumerators cause their containing enums to become conflicted (enums which might have *different names*), this caused the linker to crash when it hit two enumerators with conflicting values. Not testable in ld because cu-mapped links are not exposed to ld, but can be tested via direct creation of libraries and calls to ctf_link directly. (This also tests the ctf_dump non-root type printout, which before now was untested.) libctf/ * ctf-dedup.c (ctf_dedup_emit_type): Non-root-visible input types should be emitted as non-root-visible output types. * testsuite/libctf-writable/ctf-nonroot-linking.c: New test. * testsuite/libctf-writable/ctf-nonroot-linking.lk: New test. --- libctf/ctf-dedup.c | 6 +- .../libctf-writable/ctf-nonroot-linking.c | 127 ++++++++++++++++++ .../libctf-writable/ctf-nonroot-linking.lk | 1 + 3 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 libctf/testsuite/libctf-writable/ctf-nonroot-linking.c create mode 100644 libctf/testsuite/libctf-writable/ctf-nonroot-linking.lk diff --git a/libctf/ctf-dedup.c b/libctf/ctf-dedup.c index 6c58daae324..8bfd839524e 100644 --- a/libctf/ctf-dedup.c +++ b/libctf/ctf-dedup.c @@ -2640,7 +2640,7 @@ ctf_dedup_emit_type (const char *hval, ctf_dict_t *output, ctf_dict_t **inputs, int input_num = CTF_DEDUP_GID_TO_INPUT (id); int output_num = (uint32_t) -1; /* 'shared' */ int cu_mapped = *(int *)arg; - int isroot = 1; + int isroot; int is_conflicting; ctf_next_t *i = NULL; @@ -2708,9 +2708,11 @@ ctf_dedup_emit_type (const char *hval, ctf_dict_t *output, ctf_dict_t **inputs, } name = ctf_strraw (real_input, tp->ctt_name); + isroot = LCTF_INFO_ISROOT (real_input, tp->ctt_info); /* Hide conflicting types, if we were asked to: also hide if a type with this - name already exists and is not a forward. */ + name already exists and is not a forward, or if this type is hidden on the + input. */ if (cu_mapped && is_conflicting) isroot = 0; else if (name diff --git a/libctf/testsuite/libctf-writable/ctf-nonroot-linking.c b/libctf/testsuite/libctf-writable/ctf-nonroot-linking.c new file mode 100644 index 00000000000..6edd189b360 --- /dev/null +++ b/libctf/testsuite/libctf-writable/ctf-nonroot-linking.c @@ -0,0 +1,127 @@ +/* Make sure linking a non-root-visible type emits a non-root-visible + type, rather than silently promoting it to root-visible. Do it by dumping, + thus also testing the {non-root sigils} you get when dumping + non-root-visible types. */ + +#include +#include +#include +#include + +int +main (int argc, char *argv[]) +{ + ctf_dict_t *in1; + ctf_dict_t *fp; + ctf_dict_t *dump_fp; + ctf_archive_t *arc1; + ctf_archive_t *final_arc; + ctf_sect_t s; + ctf_encoding_t encoding = { CTF_INT_SIGNED, 0, sizeof (char) }; + unsigned char *buf1, *buf2; + size_t buf1_sz, buf2_sz; + ctf_dump_state_t *dump_state = NULL; + ctf_next_t *i = NULL; + int err; + + /* Linking does not currently work on mingw because of an unreliable tmpfile + implementation on that platform (see + https://github.com/msys2/MINGW-packages/issues/18878). Simply skip for + now. */ + +#ifdef __MINGW32__ + printf ("UNSUPPORTED: platform bug breaks ctf_link\n"); + return 0; +#else + + if ((fp = ctf_create (&err)) == NULL) + goto create_err; + + if ((in1 = ctf_create (&err)) == NULL) + goto create_err; + + /* A non-root addition. */ + + if ((ctf_add_integer (in1, CTF_ADD_NONROOT, "foo", &encoding)) == CTF_ERR) + { + fprintf (stderr, "Cannot add: %s\n", ctf_errmsg (ctf_errno (in1))); + return 1; + } + + /* Write it out and read it back in, to turn it into an archive. + This would be unnecessary if ctf_link_add() were public :( */ + if ((buf1 = ctf_write_mem (in1, &buf1_sz, -1)) == NULL) + { + fprintf (stderr, "Cannot serialize: %s\n", ctf_errmsg (ctf_errno (in1))); + return 1; + } + + s.cts_name = "foo"; + s.cts_data = (void *) buf1; + s.cts_size = buf1_sz; + s.cts_entsize = 64; /* Unimportant. */ + + if ((arc1 = ctf_arc_bufopen (&s, NULL, NULL, &err)) == NULL) + goto open_err; + + ctf_dict_close (in1); + + /* Link! Even a one-file link does deduplication. */ + + if (ctf_link_add_ctf (fp, arc1, "a") < 0) + goto link_err; + + if (ctf_link (fp, 0) < 0) + goto link_err; + + /* Write it out. We need a new buf here, because the archive is still + using the other buf. */ + + if ((buf2 = ctf_link_write (fp, &buf2_sz, 4096)) == NULL) + goto link_err; + + /* Read it back in. */ + + s.cts_data = (void *) buf2; + s.cts_size = buf2_sz; + + if ((final_arc = ctf_arc_bufopen (&s, NULL, NULL, &err)) == NULL) + goto open_err; + + /* Dump the types, and search for the {sigils of non-rootedness}. */ + while ((dump_fp = ctf_archive_next (final_arc, &i, NULL, 0, &err)) != NULL) + { + char *dumpstr; + + while ((dumpstr = ctf_dump (dump_fp, &dump_state, CTF_SECT_TYPE, + NULL, NULL)) != NULL) + { + if (strchr (dumpstr, '{') != NULL && strchr (dumpstr, '}') != NULL) + printf ("Non-root type found.\n"); + free (dumpstr); + } + ctf_dict_close (dump_fp); + } + if (err != ECTF_NEXT_END) + { + fprintf (stderr, "Archive iteration error: %s\n", ctf_errmsg (err)); + return 1; + } + + ctf_arc_close (final_arc); + free (buf1); + free (buf2); + ctf_dict_close (fp); + return 0; + + create_err: + fprintf (stderr, "Cannot create: %s\n", ctf_errmsg (err)); + return 1; + open_err: + fprintf (stderr, "Cannot open: %s\n", ctf_errmsg (err)); + return 1; + link_err: + fprintf (stderr, "Cannot link: %s\n", ctf_errmsg (ctf_errno (fp))); + return 1; +#endif +} diff --git a/libctf/testsuite/libctf-writable/ctf-nonroot-linking.lk b/libctf/testsuite/libctf-writable/ctf-nonroot-linking.lk new file mode 100644 index 00000000000..e3edda05c5c --- /dev/null +++ b/libctf/testsuite/libctf-writable/ctf-nonroot-linking.lk @@ -0,0 +1 @@ +Non-root type found. From patchwork Tue Jul 30 15:36:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 94789 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 2453F3858424 for ; Tue, 30 Jul 2024 15:39:35 +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 0FF173858C56 for ; Tue, 30 Jul 2024 15:37:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0FF173858C56 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 0FF173858C56 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=1722353865; cv=pass; b=Ep9YAar6tGxRTw7d7R4iB08rZq9XnMQZ90lp+b6fq/UHXCd4vZZnB9WxXm1agF5DmaAnxhfLOayPDbxW9wjjlzHQ07OEC5bFMgrFLVcTKVB40WBQMU/UYuWTW3tr5spUHk+t+hZGJpDxOJjY2JEznXniJbP9PSQISKoK0nBGO88= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1722353865; c=relaxed/simple; bh=THw/zEBqr+HYn9R/wK89pTgTr2dG/kvlsPnGgIsbkwo=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=QkyCIjFJK+4N95H8UeJ7QPTGfGCWfiSRq3bhRTm/Fh4yxdgLsovVt9V0Zfl5K3eFY0rnlnTo6vKYUVLpRysdgmPg/RkT5NatdKT9Xl9RQERSuo2RAf6FlFYnwXDPyoDniincXYutmvyHwz9O3zdiCNsWFBlWO0zi+p7TWuytQWI= 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 46UFMXu4024750 for ; Tue, 30 Jul 2024 15:37:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=/yGBiSNh+sett+/kp5NHjbRXechSWZjN4gO+qzAvKOw=; b= SdSEaHzk2Ou8uuZZcZtPE+iWRj0l2niuPA6mDCdXy5X8tyob0TRQ4Mz3XvQlFfXi AeR8l5ycAhoSzthigJ7BxUU3NXcWAJfNflzt/70gGRPwCiNCXWWAlqcvWZHQ3Nfz mjVJuNZdfeIIJ/CecooJh30eRLimYqOgvGwywguH/1G3vA7yzn23oRTezS01nZWd 8WLS9wLHe0RUJPeqcGQh63B4RyAmY96i3yTpZklkbEv+V2rwcNos35+5/aEWdELn Ap6Bak7nAgn6GFuz4dyYxtZWJPWMfvcKOQtVMeeerXFxGIH0rQzKXwfSFA/xxuaX RzU+ze5nsZ1qbbXc/r9rKg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40msesnaxs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:37:39 +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 46UF4BZs030945 for ; Tue, 30 Jul 2024 15:37:38 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2041.outbound.protection.outlook.com [104.47.56.41]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 40neht6s4s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:37:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hUM0Z/6kH4xTxGg4Jp1J6gQD1P6vKAbxNaVqyaHOvQzr/2zIlbF4uWLRZleKYnFY9yUc5jHTzXOrIE5FPV/f8byWZudysgTCXflsIIc3yFFkWuMo8AzgJim9itM7s4WUMgjvC3q/wFh0aaloISG+WjTlJd0HUzhyKXDclDeF/NVxEoU3cthJbUPYfQ9isdJQqsLkV/1Go+4dljsef268ugeF2p46yU4XZvi++OcNvimQHVRfX3ZnxkafLVD5oz0eT5OuweZN5aiy67eZQb7rWu706tkCGYECeIoirnbXXd+ltDhDeKSfLEz4vrtsUxDC+3ktqeSYr7s9mXOCPVnzzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=/yGBiSNh+sett+/kp5NHjbRXechSWZjN4gO+qzAvKOw=; b=DwdcnDCRfMZrYYH9Y3wSI7/fpz+x27/Q9cqFL4LIrt8MLvO492ERmK5d4zYVIq9ZjbWV5Gy+dzlLLT2zhH0yAfEOmFX3pLxByY/dyoe3Y5DV8xfNYGIxzLp1e4+42EU3G5wodw5hGLrs5XRWvJERXft8WJ149RTbfsngO0oAZqxFYaiYuhs0qN8WiIS8OVyTrGmo3aeqENDBCMqWoFRVbOXcOspyUp9nZWrVybEcgEfHj7fW1Howt3pmhE9RNLQbBlxFgPd3PPuaHfwF6dXXLtuTbHxQfk0gRDZF8K+0R7zFtW4jXc++s7NXhpjBQbN11pZFXIbWs8nQ/i3bo8wStA== 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=/yGBiSNh+sett+/kp5NHjbRXechSWZjN4gO+qzAvKOw=; b=n266Ty8f66Dfz6tunAPSXhr3JrJN++0e/XjzYm+u5QMfmNr0dr2prkON6HK76rxXsRE6Jkr0Jz3M9FrqCnzmLXmfW2LxGL1ztwWy+7B8FXn/RmAuODIXPfOQEqyY4tqeQqjegewSxkCY0qICppV26eIS0khKLVJUgtieIAXM/wc= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by DM4PR10MB7476.namprd10.prod.outlook.com (2603:10b6:8:17d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.28; Tue, 30 Jul 2024 15:37:36 +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.7807.026; Tue, 30 Jul 2024 15:37:36 +0000 From: Nick Alcock To: binutils@sourceware.org Subject: [PATCH 06/19] libctf: fix CTF dict compression Date: Tue, 30 Jul 2024 16:36:54 +0100 Message-ID: <20240730153707.168357-7-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.2.276.g4ac82df17e In-Reply-To: <20240730153707.168357-1-nick.alcock@oracle.com> References: <20240730153707.168357-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO4P265CA0072.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2af::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_|DM4PR10MB7476:EE_ X-MS-Office365-Filtering-Correlation-Id: 2cc559ed-af7e-4af6-19c3-08dcb0ad894b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: JpB1SqRpZU728ixfCbtJOuaygvgpR1z2f/RzK6AXNXJCPpvnB/XJdMlCiKqdbXY07gnKuLme7vBSGtjQ1GbnMeBBxWzFOJ0yUP4CbSMpC8CUij4QQXAozUneS8/xxcyWO6AbRuRAEt0+u4hSMMka2EzbjaDAzmZTIs70pZ0HEQJLoOTgB0H+CJnxiaNT20J8oK7YcO1HfDmGsr9L7rJlssXWEdlpIDtTBhtR1fOVEvdkIKEE3orr6NOPs13cGuufMzVUBPAvWvg3DodIEMqjFj+IRtYtxuaj73ZMYrrgVKXVfhSBK4t2x/mHrTnbyxMCjivFJB86xOlGzLUskyqYTLsM/MqaAwDgkCIGqIEcCwEcTNQsTERIhgX2m4loMuNIOiIlKw5sAi2rVuZ2IrRb9MBMPHyp4urtEMvJBWLvMwNuq59rhGls2YyKVKSwzQTql6Pg5UF6jr0qkWIMJ9acAq3EVxDUpNHFZ1ZbuA2DWOyexJ8nMGOY41hXftI6+zRSX4YyCiwjBLw9g33xZT0CTVb55DQ1k8oCqKt7QjclM95dyuvZV/QdGHPKQayUz+pY9YaLFfdQyZMdYGKzIh9P3HNGcZZ7VkdKI6Y4LSlTN7/XvNs/DI04S78bz81ZFJJ6yRng5xzja+b8KGu6OUBy8DtsVi8CKicEoSbPCi3Etp9fBfXWOft+QUOVyPHggS9LW3z4mlKsvI1J8CcgkXm+WFaPwYXnDzZxpXxLPwy1pbXh800c2sy0kECyXLUnPOpf3M3wgVhRamFcQn07VXILRabA3GM335Eza615STTUgPuEup1/39xcth5vIArKsz0Ux0pbCspqBjYd7EhIsAFhHW/sBswuT2oBgmbTR0EUwTdtdRvPJCMKUMBacy3JmharH5MeBBCL5BHJHph7r9ZzSn9MwoqrzYL0EzhOe+wA08C6fGLQx4TDfDjFibkn/5vVcNghRgQbUVDDnrYHUcsi4bXbFD3J6/rJv7vUcf4yPcxvOmzxktzTAZenJAaS7cT1dXoIrSXZYAyuloYug4Y98NXni7h4TmnyGSD7mQQosErojBvQqzGit0EH4ciSxarLzJM0KH5rR7S5SaoOFu4uZm0AuXWxaN3v2s44VBHViQ6PKIjan1kZ+eMQHAwHf+tzcaReV3ornpptJ+oyuxPQdeaHvxNb1G0zYq+xokgs4Tz+3kP2E/8XR8S3w3SRYMXaLBNpm2MVslsQB8om1WM2wvs1W+e6JkrsMqeuYJR4Z/8KgibqnMv1MpAOWfqbn9eyanHdbzn5KMiF4rUoOxbzlhFfHOB/c2T+nGhpCsBetL4= 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:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Q5ND0CegEXvK1zPKzuUtzeRHFRNaLT1tnPDUCyFKflwxFJZ/DBTwmNB5n3zr9SqkKARo6Mlq6DcVr45MhM+lLxId5znpjwaaDGLQHcJyqy+hBOv9yKeryPmRI0YBsPdHQuKD30suUh01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2myQyipuYSh1qbZoid/9Mk= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2cc559ed-af7e-4af6-19c3-08dcb0ad894b X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2024 15:37:36.1103 (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: gj2BmRcGe3hF1TD2joXxPHIWViVZ12O8KYL2y1W4DVchKk0nbOtVMvrUCwPcDJTJCOLc9f5RoF3MREmlbnZ2Jw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB7476 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-07-30_13,2024-07-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2407300106 X-Proofpoint-ORIG-GUID: Gdz27grtKA7fWpglikRvq8VsOzhwjPlz X-Proofpoint-GUID: Gdz27grtKA7fWpglikRvq8VsOzhwjPlz 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 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 Commit 483546ce4f3 ("libctf: make ctf_serialize() actually serialize") accidentally broke dict compression. There were two bugs: - ctf_arc_write_one_ctf was still making its own decision about whether to compress the dict via direct ctf_size comparison, which is unfortunate because now that it no longer calls ctf_serialize itself, ctf_size is always zero when it does this: it should let the writing functions decide on the threshold, which they contain code to do which is simply not used for lack of one trivial wrapper to write to an fd and also provide a compression threshold - ctf_write_mem, the function underlying all writing as of the commit above, was calling zlib's compressBound and avoiding compression if this returned a value larger than the input. Unfortunately compressBound does not do a trial compression and determine whether the result is compressible: it just adds zlib header sizes to the value passed in, so our test would *always* have concluded that the value was incompressible! Avoid by simply always compressing if the raw size is larger than the threshold: zlib is quite clever enough to avoid actually compressing if the data is incompressible. Add a testcase for this. libctf/ * ctf-impl.h (ctf_write_thresholded): New... * ctf-serialize.c (ctf_write_thresholded): ... defined here, a wrapper around... (ctf_write_mem): ... this. Don't check compressibility. (ctf_compress_write): Reimplement as a ctf_write_thresholded wrapper. (ctf_write): Likewise. * ctf-archive.c (arc_write_one_ctf): Just call ctf_write_thresholded rather than trying to work out whether to compress. * testsuite/libctf-writable/ctf-compressed.*: New test. --- libctf/ctf-archive.c | 8 +- libctf/ctf-impl.h | 2 + libctf/ctf-serialize.c | 51 ++---- .../libctf-writable/ctf-compressed.c | 158 ++++++++++++++++++ .../libctf-writable/ctf-compressed.lk | 2 + 5 files changed, 179 insertions(+), 42 deletions(-) create mode 100644 libctf/testsuite/libctf-writable/ctf-compressed.c create mode 100644 libctf/testsuite/libctf-writable/ctf-compressed.lk diff --git a/libctf/ctf-archive.c b/libctf/ctf-archive.c index c602705b310..0034bf0982a 100644 --- a/libctf/ctf-archive.c +++ b/libctf/ctf-archive.c @@ -265,16 +265,10 @@ arc_write_one_ctf (ctf_dict_t *f, int fd, size_t threshold) uint64_t ctfsz = 0; char *ctfszp; size_t ctfsz_len; - int (*writefn) (ctf_dict_t * fp, int fd); if ((off = lseek (fd, 0, SEEK_CUR)) < 0) return errno * -1; - if (f->ctf_size > threshold) - writefn = ctf_compress_write; - else - writefn = ctf_write; - /* This zero-write turns into the size in a moment. */ ctfsz_len = sizeof (ctfsz); ctfszp = (char *) &ctfsz; @@ -287,7 +281,7 @@ arc_write_one_ctf (ctf_dict_t *f, int fd, size_t threshold) ctfszp += writelen; } - if (writefn (f, fd) != 0) + if (ctf_write_thresholded (f, fd, threshold) != 0) return f->ctf_errno * -1; if ((end_off = lseek (fd, 0, SEEK_CUR)) < 0) diff --git a/libctf/ctf-impl.h b/libctf/ctf-impl.h index b17a2d8699d..0d88e639884 100644 --- a/libctf/ctf-impl.h +++ b/libctf/ctf-impl.h @@ -762,6 +762,8 @@ extern int ctf_flip (ctf_dict_t *, ctf_header_t *, unsigned char *, int); extern int ctf_import_unref (ctf_dict_t *fp, ctf_dict_t *pfp); +extern int ctf_write_thresholded (ctf_dict_t *fp, int fd, size_t threshold); + _libctf_malloc_ extern void *ctf_mmap (size_t length, size_t offset, int fd); extern void ctf_munmap (void *, size_t); diff --git a/libctf/ctf-serialize.c b/libctf/ctf-serialize.c index 2d1f014db28..9efdb16e0d6 100644 --- a/libctf/ctf-serialize.c +++ b/libctf/ctf-serialize.c @@ -1180,10 +1180,10 @@ ctf_write_mem (ctf_dict_t *fp, size_t *size, size_t threshold) alloc_len = compressBound (rawbufsiz - sizeof (ctf_header_t)) + sizeof (ctf_header_t); - /* Trivial operation if the buffer is incompressible or too small to bother - compressing, and we're not doing a forced write-time flip. */ + /* Trivial operation if the buffer is too small to bother compressing, and + we're not doing a forced write-time flip. */ - if (rawbufsiz < threshold || rawbufsiz < alloc_len) + if (rawbufsiz < threshold) { alloc_len = rawbufsiz; uncompressed = 1; @@ -1248,10 +1248,10 @@ err: return NULL; } -/* Compress the specified CTF data stream and write it to the specified file - descriptor. */ +/* Write the compressed CTF data stream to the specified file descriptor, + possibly compressed. Internal only (for now). */ int -ctf_compress_write (ctf_dict_t *fp, int fd) +ctf_write_thresholded (ctf_dict_t *fp, int fd, size_t threshold) { unsigned char *buf; unsigned char *bp; @@ -1260,7 +1260,7 @@ ctf_compress_write (ctf_dict_t *fp, int fd) ssize_t len; int err = 0; - if ((buf = ctf_write_mem (fp, &tmp, 0)) == NULL) + if ((buf = ctf_write_mem (fp, &tmp, threshold)) == NULL) return -1; /* errno is set for us. */ buf_len = tmp; @@ -1283,36 +1283,17 @@ ret: return err; } +/* Compress the specified CTF data stream and write it to the specified file + descriptor. */ +int +ctf_compress_write (ctf_dict_t *fp, int fd) +{ + return ctf_write_thresholded (fp, fd, 0); +} + /* Write the uncompressed CTF data stream to the specified file descriptor. */ int ctf_write (ctf_dict_t *fp, int fd) { - unsigned char *buf; - unsigned char *bp; - size_t tmp; - ssize_t buf_len; - ssize_t len; - int err = 0; - - if ((buf = ctf_write_mem (fp, &tmp, (size_t) -1)) == NULL) - return -1; /* errno is set for us. */ - - buf_len = tmp; - bp = buf; - - while (buf_len > 0) - { - if ((len = write (fd, bp, buf_len)) < 0) - { - err = ctf_set_errno (fp, errno); - ctf_err_warn (fp, 0, 0, _("ctf_compress_write: error writing")); - goto ret; - } - buf_len -= len; - bp += len; - } - -ret: - free (buf); - return err; + return ctf_write_thresholded (fp, fd, (size_t) -1); } diff --git a/libctf/testsuite/libctf-writable/ctf-compressed.c b/libctf/testsuite/libctf-writable/ctf-compressed.c new file mode 100644 index 00000000000..4769cdb97f2 --- /dev/null +++ b/libctf/testsuite/libctf-writable/ctf-compressed.c @@ -0,0 +1,158 @@ +/* Make sure linking and writing an archive with a low threshold correctly + compresses it. (This tests for two bugs, one where archives weren't + serialized regardless of their threshold, and another where nothing was.) */ + +#include +#include +#include +#include + +int +main (int argc, char *argv[]) +{ + ctf_dict_t *in1; + ctf_dict_t *in2; + ctf_dict_t *fp; + ctf_dict_t *dump_fp; + ctf_archive_t *arc1, *arc2; + ctf_archive_t *final_arc; + ctf_sect_t s1, s2; + ctf_encoding_t encoding = { CTF_INT_SIGNED, 0, sizeof (char) }; + ctf_encoding_t encoding2 = { CTF_INT_SIGNED, 0, sizeof (long long) }; + unsigned char *buf1, *buf2, *buf3; + size_t buf1_sz, buf2_sz, buf3_sz; + ctf_dump_state_t *dump_state = NULL; + ctf_next_t *i = NULL; + int err; + + /* Linking does not currently work on mingw because of an unreliable tmpfile + implementation on that platform (see + https://github.com/msys2/MINGW-packages/issues/18878). Simply skip for + now. */ + +#ifdef __MINGW32__ + printf ("UNSUPPORTED: platform bug breaks ctf_link\n"); + return 0; +#else + + if ((fp = ctf_create (&err)) == NULL) + goto create_err; + + if ((in1 = ctf_create (&err)) == NULL) + goto create_err; + + if ((in2 = ctf_create (&err)) == NULL) + goto create_err; + + /* Force a conflict to get an archive created. */ + + if ((ctf_add_integer (in1, CTF_ADD_ROOT, "foo", &encoding)) == CTF_ERR) + { + fprintf (stderr, "Cannot add: %s\n", ctf_errmsg (ctf_errno (in1))); + return 1; + } + + if ((ctf_add_integer (in2, CTF_ADD_ROOT, "foo", &encoding2)) == CTF_ERR) + { + fprintf (stderr, "Cannot add: %s\n", ctf_errmsg (ctf_errno (in2))); + return 1; + } + + /* Write them out and read them back in, to turn them into archives. + This would be unnecessary if ctf_link_add() were public :( */ + if ((buf1 = ctf_write_mem (in1, &buf1_sz, -1)) == NULL) + { + fprintf (stderr, "Cannot serialize: %s\n", ctf_errmsg (ctf_errno (in1))); + return 1; + } + + if ((buf2 = ctf_write_mem (in2, &buf2_sz, -1)) == NULL) + { + fprintf (stderr, "Cannot serialize: %s\n", ctf_errmsg (ctf_errno (in2))); + return 1; + } + + s1.cts_name = "foo"; + s2.cts_name = "bar"; + s1.cts_data = (void *) buf1; + s2.cts_data = (void *) buf2; + s1.cts_size = buf1_sz; + s2.cts_size = buf2_sz; + s1.cts_entsize = 64; /* Unimportant. */ + s2.cts_entsize = 64; /* Unimportant. */ + + if ((arc1 = ctf_arc_bufopen (&s1, NULL, NULL, &err)) == NULL || + (arc2 = ctf_arc_bufopen (&s2, NULL, NULL, &err)) == NULL) + goto open_err; + + ctf_dict_close (in1); + ctf_dict_close (in2); + + /* Link them together. */ + + if (ctf_link_add_ctf (fp, arc1, "a") < 0 || + ctf_link_add_ctf (fp, arc2, "b") < 0) + goto link_err; + + if (ctf_link (fp, 0) < 0) + goto link_err; + + /* Write them out. We need a new buf here, because the archives are still + using the other two bufs. */ + + if ((buf3 = ctf_link_write (fp, &buf3_sz, 1)) == NULL) + goto link_err; + + /* Read them back in. */ + + s1.cts_data = (void *) buf3; + s1.cts_size = buf3_sz; + + if ((final_arc = ctf_arc_bufopen (&s1, NULL, NULL, &err)) == NULL) + goto open_err; + + if (ctf_archive_count (final_arc) != 2) + { + fprintf (stderr, "Archive is the wrong length: %zi.\n", ctf_archive_count (final_arc)); + return -1; + } + + /* Dump the header of each archive member, and search for CTF_F_COMPRESS in + the resulting dump. */ + while ((dump_fp = ctf_archive_next (final_arc, &i, NULL, 0, &err)) != NULL) + { + char *dumpstr; + + while ((dumpstr = ctf_dump (dump_fp, &dump_state, CTF_SECT_HEADER, + NULL, NULL)) != NULL) + { + if (strstr (dumpstr, "CTF_F_COMPRESS") != NULL) + printf ("Output is compressed.\n"); + free (dumpstr); + } + ctf_dict_close (dump_fp); + } + if (err != ECTF_NEXT_END) + { + fprintf (stderr, "Archive iteation error: %s\n", ctf_errmsg (err)); + return 1; + } + + ctf_arc_close (final_arc); + free (buf1); + free (buf2); + free (buf3); + ctf_dict_close (fp); + return 0; + + create_err: + fprintf (stderr, "Cannot create: %s\n", ctf_errmsg (err)); + return 1; + open_err: + fprintf (stderr, "Cannot open: %s\n", ctf_errmsg (err)); + return 1; + link_err: + fprintf (stderr, "Cannot link: %s\n", ctf_errmsg (ctf_errno (fp))); + return 1; +#endif +} diff --git a/libctf/testsuite/libctf-writable/ctf-compressed.lk b/libctf/testsuite/libctf-writable/ctf-compressed.lk new file mode 100644 index 00000000000..cf611c36f97 --- /dev/null +++ b/libctf/testsuite/libctf-writable/ctf-compressed.lk @@ -0,0 +1,2 @@ +Output is compressed. +Output is compressed. From patchwork Tue Jul 30 15:36:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 94793 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 95708385C6CA for ; Tue, 30 Jul 2024 15:40:40 +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 00F27385B503 for ; Tue, 30 Jul 2024 15:37:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 00F27385B503 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 00F27385B503 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=1722353866; cv=pass; b=k5LEAGm9Vn8uJIORRQzE4klC41tlCqf0rwPbVjDWAvYVg3RVAYdCxqtpsmFIO8Hwm3wpi6zf5ej+GQsUI2vJH9AsjpTWWDcgIfTEMfz7cvbliK/B4T/0KiJYivB4OKOghiZTG2/WkZlAjSudcO3BTYsANiRUAckM7g621ufQGH8= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1722353866; c=relaxed/simple; bh=c+QuiZwd9BXJAms3NdwJ8ytaEP/puq9uM4y38Lf88FE=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=MTvLF8ccAJEkoyvkhG3xBV150F7yQK2qTlZ8WwuVX9RR5tSrdJWsOty3E07wJlp18jAjPN6FX48g+WLB8nMdLwUAs4Wze3pAcybGa/ug+kV9iGNq3Y/EUJgoBKA6ufWyf43U8F1G2q5w2TerXBnoVD8azV1IswFarMxA47prsl4= 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 46UFMbnC010403 for ; Tue, 30 Jul 2024 15:37:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=p1UF5dkS4lLLYV50LlDUK6JSqeiqLlCVmC53cWmj5LE=; b= gRR6eJjCGOFcLlA++P3bp4VpLkkjDdwcCroQA4xpTwN0F1AEUpLm1A8IIjNMg7jF JeY0vFilHlSJ4za7xFlP+sWGaIqSKkFNjw7PVUWBCRUr5cmvVtPqaEjxT8fwmAxI NGdvejUnGL/aanZ8zZFE2c6UcHlpA6qFWpl9m1oSa2uXHh+xKLvlOGRWCXqTUSpx 7Pv/XWCxhX13A3VpgBA2p0T9oJZ7k3OwhgyNSXfBzRw8KwILFx14N09g7f5Eg3jJ NqaZXIjqtzlwX5HwiqvQQ5Cl0xjZeNqU1bn5KQRcm/jJjL6g9NBmXy5gV0CNrZIi Wz1+u+arYrcK3h86pCaAjg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mqtanc40-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:37:42 +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 46UF0YTX002828 for ; Tue, 30 Jul 2024 15:37:41 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2041.outbound.protection.outlook.com [104.47.56.41]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 40nrn7c3k6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:37:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZBwQ12pPFZShjuKwEWr8hUF00eHGHZFPPD1i2YlU9VUvBPapaXB8h4S+sLbs3N/DuCiE+fMxk1MuhsAfGfjmOI7L9SpyNzv7eo6ISgsUgU16O3Yku79/DEXLeRvGo/fVlVBJx26gWjdvC4KaWBn9uUpj3LgaCb6eji3FB8ucWUNsHul0nRDsydlGnfAbXd0sbPQdBZt4a1PQ1io7JCXxyLWa14sN/CrfYXOsNd/bLPWVU2J8yLGr9zlPzytQ/ZfMT7qaQ7+XrHBUFgnV7OXOxstsF3eY3Oi+PyWoRd9dFSmLsQ0sC8a7Y/miZWt3/cfTGgW2u5QbYOjxPyB7TGNrBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=p1UF5dkS4lLLYV50LlDUK6JSqeiqLlCVmC53cWmj5LE=; b=l2Y/QIrwcgqNHcBorXmyQdQq+J34uIzu9kFnzxMtE+NGz0WCaBWJuA+BTNySCC1rejiqoHqk3Vnvcx8ex5N58IFZGYivjirTcSMCnj0rJHnjQoOf6BvPn7/CcJa0pp5O+QELOEA/Lt3mfHV/8F/aF3iNex8dTYwhG+1e6xF0s2ScC/ZpdEFbKTybiWQPJOqsN8rbZtO9Q9lBTxgL2nxUGzhl+zA4APmIgF3/2JeSUuvrwwhNAtsjeV0unmVh72ta8EEv6CJTR33URGdBhw/cBek/nKmZHK60aSMnUkaz/lExGMXh9nMFE97gACdopEUarIyLd2DJGSfq1cvzHAcG5w== 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=p1UF5dkS4lLLYV50LlDUK6JSqeiqLlCVmC53cWmj5LE=; b=UdHF+Y1g97dqECFwJM6cAzelayDcMb17CeK7gifhML9pzXX6RyCwxinNwCkTWzE/6nyE7w1o8w50W2yeletrAHYtHeozn1YCJ6ssrEhzfUR2BoH5iT2YAgyvXqeLXlKy7+MABIbCXnDJI6eW18py9U4XdjSOgs8Ommp/FxzWqUI= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by DM4PR10MB7476.namprd10.prod.outlook.com (2603:10b6:8:17d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.28; Tue, 30 Jul 2024 15:37:39 +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.7807.026; Tue, 30 Jul 2024 15:37:39 +0000 From: Nick Alcock To: binutils@sourceware.org Subject: [PATCH 07/19] libctf: improve ECTF_NOPARENT error message Date: Tue, 30 Jul 2024 16:36:55 +0100 Message-ID: <20240730153707.168357-8-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.2.276.g4ac82df17e In-Reply-To: <20240730153707.168357-1-nick.alcock@oracle.com> References: <20240730153707.168357-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO4P265CA0063.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2af::16) To MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR10MB6608:EE_|DM4PR10MB7476:EE_ X-MS-Office365-Filtering-Correlation-Id: 09b9dc24-4974-4d1c-2683-08dcb0ad8b2b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: bX6dI97d5NIKjB0UknoTwTuMVpnMQZm1VvTKWC41HlmBo5s+NJ27CoZmswP5rN+7e8YWXf77c2aaVUi2x5zn2rx8EV6tPt87dAiE7r4V7xV2uLdj+c2TlY8JclVRbOtXHk+9qKMZcg63tJ+wSvCHsPD66QDiTyv4EixlhR3KuOZfn0kS2corzEF2z4yBegIqq6XnW/bYbbFUOpZp5GkIKTgKt0n41dNRgVcekP8N9ojyJfMl5dGhNEvUDieUPlRmqUiR6pgJGAB/rTYEalllNBxl4cO7lU9pwSSY0vtrhRZcRf6PvXSHLrop0rJ2uIVphiZH03Mb/56egxCYw6sUWuPM9fLHDqQUo8nBN2St6VzpQgyjWGnVbaUv8HWazbBKHhpTB2ehg7Ne+sQ6mYhpIzLAgQvH+vctF8wAyJPIkSqAMR2AsK1ItIjYw6qjj7kibRO+CHoPLl6QJfuCE9iGRTMVGsc4gEmrHtlP5QAaGe0RludwJb0NDU2OL/GmsCw8htAH0KTxrh9LdbSpz1SPVB1sXJX2KRC8BivOi9fUfc5HLBmF1gKKX31ic/oG2cpIo7CzUnGJo/ReeVBqAnyCZbLNT5gEc4mLsrUJ62Pg0dhHr8WsErlC9QKpDDr/SnA7k++leQQyU4/pv74r/98R8/Dwcgg9sZ8QmhQiQlpTHWcheKUwP14ewrrjFHXJ/G/WucJJCxlP6qM3G866BqY0TqjWzhcLPX7K+KyWRTKCPgpQ7TXVaQkXxEjv52PcG5srtPSzC0NO3vHgJ4w/psDn2Qh8988zlS0S4BmJPD3PQVFs//dhDhkAoPignYcBXxombY0hdPhuWiKJSg2LsVyoUf68lV9rS6n31R6UOX9iQ7GaeQ0xXOs7aJ3u1rhMxvA19tLBiuMlkXOtWuRVcS8sZAbDBzyRISmlNnoGG/zi2Moshr2eSnpYH730Zubs9xgH92UU7rrDuX9Jga+/5yc7O7cCBJGwdMlKF8k1ALGc7SUX25Lxo73E5IPrxvEOaOSdx9umfD5Uq3EcoL+IeyJ02qPLQFj+AIrBA2GaFmKZWwIN6JqQTJVS7nFPJ7cBLJmAKIAdKtdMzgYW+jG6z4xEiAokIW/1PmaESkDW/8Nr3HQ8n0w7hCSc8XRztJuBaKUsvLOEarv1tbDXjvTGiUNWnYjhU3FN8wWUt2MeNlD4qofNabga6nymgcSR2MA6h113RmrEV8HPlGi4ZlqnU4k9oG71nmInexrGZxuwdhUPGyV6o16eAPRjIb5i+da6t+mXiOf6Uwc+4kvwOmFGy0dXrH/h4uEtK03xA+Th5AXT5kQ7/VY2B05P1U03UnXFyPObm/Y+6yAAKEj8JATI00GVbw== 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:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZoIq3wl+9f9pU7JcujmJ1cNrO5UnWTQqSdw5ljT6ypw2l70ZpyKiZyo6BlIgjRI5J41hyo8rmK3F6qOuCfUHIi2J/S9f3szWH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o8lwmCMk4zdn57oTXEKx/89WJj9FSxd3s99RoiXFIYo2tTlmWPNxe2A++ysjImCAc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 09b9dc24-4974-4d1c-2683-08dcb0ad8b2b X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2024 15:37:39.2595 (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: A75lphD4TVUZGUcqz9PNpT5kUzJNvXqaMSh5KHxd3lRK3GvAm0VVJHKoInu9KoY2AsVtVHswP/Ad1RodmYn9Yw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB7476 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-07-30_12,2024-07-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=864 suspectscore=0 bulkscore=0 phishscore=0 adultscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2407300106 X-Proofpoint-GUID: Wt5FUsejHiLIa7vExsHhilSSi5mpiDuK X-Proofpoint-ORIG-GUID: Wt5FUsejHiLIa7vExsHhilSSi5mpiDuK 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 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 erorr doesn't just indicate that there is no parent dictionary (that's routine, and true of all dicts that are parents themselves) but that a parent is *needed* but wasn't found. include/ * ctf-api.h (_CTF_ERRORS) [ECTF_NOPARENT]: Improve error message. ld/ * testsuite/ld-ctf/diag-parname.d: Adjust. --- include/ctf-api.h | 2 +- ld/testsuite/ld-ctf/diag-parname.d | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ctf-api.h b/include/ctf-api.h index f1087bc0542..ad5add23706 100644 --- a/include/ctf-api.h +++ b/include/ctf-api.h @@ -196,7 +196,7 @@ typedef struct ctf_snapshot_id _CTF_ITEM (ECTF_NOCTFDATA, "File does not contain CTF data.") \ _CTF_ITEM (ECTF_NOCTFBUF, "Buffer does not contain CTF data.") \ _CTF_ITEM (ECTF_NOSYMTAB, "Symbol table information is not available.") \ - _CTF_ITEM (ECTF_NOPARENT, "The parent CTF dictionary is unavailable.") \ + _CTF_ITEM (ECTF_NOPARENT, "The parent CTF dictionary is needed but unavailable.") \ _CTF_ITEM (ECTF_DMODEL, "Data model mismatch.") \ _CTF_ITEM (ECTF_LINKADDEDLATE, "File added to link too late.") \ _CTF_ITEM (ECTF_ZALLOC, "Failed to allocate (de)compression buffer.") \ diff --git a/ld/testsuite/ld-ctf/diag-parname.d b/ld/testsuite/ld-ctf/diag-parname.d index f8fcd683a9d..4672f71ae9b 100644 --- a/ld/testsuite/ld-ctf/diag-parname.d +++ b/ld/testsuite/ld-ctf/diag-parname.d @@ -2,4 +2,4 @@ #source: diag-parname.s #ld: -shared --ctf-variables #name: Diagnostics - No parent dictionary -#warning: CTF linking failed; output will have no CTF section: The parent CTF dictionary is unavailable +#warning: CTF linking failed; output will have no CTF section: The parent CTF dictionary is needed but unavailable From patchwork Tue Jul 30 15:36:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 94797 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 8E7EB3857000 for ; Tue, 30 Jul 2024 15:42:16 +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 71DCF385DDC1 for ; Tue, 30 Jul 2024 15:37:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 71DCF385DDC1 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 71DCF385DDC1 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=1722353868; cv=pass; b=hQOAgNisCbomYyDlVBDtZFAZO5dRP4XtsN5XgbmqO6vFNiG0WVDG4EP55NSf5DbvyAgdhoojfoNoB6esiIlCG1L9SrN9YZal7TX7JSYHseUtgKdwb7O634vGJYXmFhrBXSzTD2WRrEI0SPNt52NvNPQzibmOazq79rwjPnj9Hnw= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1722353868; c=relaxed/simple; bh=DgosR7iDYNKrIP84XDZAXXWr1b4oMQWJW9dTZ8iCFF4=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=QlgwiiqEHNpQ8tm6a4bVrFAcg0z2V18Tslyx9pej8C229nX7FYFBpMBQPdAKqpjGmjXg3hLmrEw8L2Brc7OVJJgMHYeT2XoxRUI95svMxwJOTF6tsUEF/+G87iDM5Hv/fuoC6EJY756T3t4OHGBPdGgcGblGOHahrfcZsHotP9k= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46UFMVI1014115 for ; Tue, 30 Jul 2024 15:37:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=sw9B+EsnD1R2V6aJrizLBX+Zv2a0yaQ864T2seiRp4Q=; b= VOoEclGLuVimUtqEoPWgOJGYZBNAUVce2d7pg7w9IP4ZnRnNgISYwPuvhHbo0gQF 03Yx/M1Nff2rpPDwZ1Jmz3J78rh/eb+6Cy3a9R1uOJDEqSvypxC9AlXaOjAqLk+2 S36x+8/n5r5LgUvGsPnfbxNLLlzMun6SFNo40YQ142mCvVKj7hjgdQA+7LRa0APM 4rwBZWLAJ6zHTNJFYNvyrd36C7hdYwXPfXBpU2o2PT4XEPZyMR/kqa+DnujfWg1Z YbUATi2kd9YcgDg1F1HH5j2SzG307P5P2OsZuOj1e6/hhBuzoawnzhVJiwQfF3IM 85QLZDQVevpU38ccwZq0qg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mqfydc4g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:37: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 46UF9JJ6003827 for ; Tue, 30 Jul 2024 15:37:44 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 40p4c096n1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:37:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=g0hWWuIB8e6YdPiWqGUYRMc33NM6DecPwV2LDg8ILP7t6Qb8g4RTYun1AVnqrIL2BUcB85r6B3Dp1oj1HlwiSOZPW+gg7CUR4lsjI3dHNSP3VDhwEEWxs4i59b5TBF8IMX3h3BNA44jS9PR4o9O9s1PKxdzeAyaaI+8/8sTtewS1MyWHHGLlyUpleVXK1Nk62TWR+rXbuN+sLSqDU/xh3JfvNf8BUqpqPip7CR6FchQxGUG4zg6J65WvOBqRNopPvbIR5IbAm+Zxy3gyzOIs8bV8WcvZO3xsgjP0sBcoJQzQMnB7JxYRxeDXVVJLLBk5WsJ8eKSwlx5oy/zShatc5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=sw9B+EsnD1R2V6aJrizLBX+Zv2a0yaQ864T2seiRp4Q=; b=aLDtJnuDw14/iuQDnLLc+23XZX1brWg5hXzsfJ/SW3e/i6YdxU6qFIuUdAPBCpY3nJ9tDswi4iJEFA9Kt/7crSuPcw+j0eNv8Rh0E7+BP6WyUCC3TuGh6ZhcliSeaZU2WhMQrx5fWzt6ud3/SXIN80wvNb5Eu2onIQt/svhbWqqQjVjHoQf8plT0KurdeHpopIpX7uY6d6+LKy5Qjk4t3k3a386aP5uWvipNsUntNP/y7VxSUIHe1KBOx1AWFc8U+VCnxXo6LN7NOOlRCFxEgs0Lmumdv5l7Swi+B9iyNPzaFBHVGWqW07VIr+mMvQki0TzyxciiIiZbtHjgWmVnPQ== 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=sw9B+EsnD1R2V6aJrizLBX+Zv2a0yaQ864T2seiRp4Q=; b=nzLq3/bfSAJz6xUJdAeDZDF4Wvlm0xctPjpLKcFdfeA493Cl9uR8AJDFbbntMYI2spBP6ptTZ4NPqxm8iaNZ8yuI8TiKLXe5D6ZX16Jyv8r5uie8RPh5D+zhcN9Ep2qrCPGrgJNRz/qwdtJP2RXe+WHPkf8hXpd0O11wPaJANVs= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by DM4PR10MB7476.namprd10.prod.outlook.com (2603:10b6:8:17d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.28; Tue, 30 Jul 2024 15:37:42 +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.7807.026; Tue, 30 Jul 2024 15:37:42 +0000 From: Nick Alcock To: binutils@sourceware.org Subject: [PATCH 08/19] libctf: dedup: tiny tweaks Date: Tue, 30 Jul 2024 16:36:56 +0100 Message-ID: <20240730153707.168357-9-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.2.276.g4ac82df17e In-Reply-To: <20240730153707.168357-1-nick.alcock@oracle.com> References: <20240730153707.168357-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO4P123CA0340.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18c::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_|DM4PR10MB7476:EE_ X-MS-Office365-Filtering-Correlation-Id: c2e20216-cd5e-4356-3dc1-08dcb0ad8cdf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: LkO4ExoYXqkedJVIUFnLiATq/+JYNTuJy133b2/WZrUR5WxLEjujwjJ9+WAuAP9OfYdiiBhK/NXEoB3xOBW0ON7GibgsB9o1eM24Dfk9zV3YuhnT7nNAJdsEk1c21Qm/pgeG3swSCKf/1dUxHeWS4NiRtlaKaYccGvDtp/9UwExk5zBOjTeuHkvs+fGFLlDzEwonXBzFuz2UAD1SzAo3rQXiaUIRi01GGs9CLFbHh4jQzikv6zTp++Uayr8CNJjTLNuBS8qqEcoXBqLs6c7Xr2S2lXyb/V5zfyHFp5ABNfyXO1/AUEllri4VF/yOzd74yInoyEbtSaAWVXRs5y5zv8FTg8XghYyRlEQNELGnuqQklcg+rIrlrBC+IymHTFYD3z/eWl2OvEabyJF8F7JzLsf30xWFXGuuX4OXyhHlA8grQy1SnEcCNsNPh2Vj7wjyKiSrTXeQQsZhEhmm9dZXcOVoVu+BLMd7mxfRuBDF8eAAZ7uhi7APVsle7/zXu4Lmc159UpTIq+GN4/v2oJKUsHzSu8Is89YoktCc7qhgfTuwnF1+D0F9Bu1hbVvbzbTbA4iqTvMsCCLlchXsI+mAHZTzG+kPf6qOGIvGWs4yAd1ZCMRj768vTCzhhgpG1zC4A13Oy1myASOH4RRob1y+Bj3ps6uUoQLqr0qgUo3i68SNAYLvsINcbjiIvdpJiEor07ktt3wVl79Lb0UWtUWhGUZAVMJiYUHVVIug/co+11V0QpPjX7SWRK+05lcXT8yl6QxJYswFodNHjxLtAegjrzXVKT3JJPjzWQlGGc0XP5uUqe2TQvqx8A1w5vyYylPG1BgRev7JUMv8NVWk/umd9w50tZgGaIvvTX6nURpNsj2UFfinjUOak7l7MFNapDDz5wjyH8dqVewgafT+KlMEoB6Ych8rfzj4PhJUhFBhCgZCCLi9qVbtmtt76am0nCb16wN7pP0xN8ZUBTPFGxY3HoO47+mIaIyiVJttsTbYOvP4JPoIlvVxoIjJCx4vdCyj35FJQgFypwq7LxQeVQNk4W4S3VtgorUR15kzug+GhkAHfwg5Y3up49u6f4nqD+BbKUj7+b/Br3nWGASICBtAAFbOAy9CM6A4Iup6SS/nkgjbEmuoJaQ2KCUlSJXz1RlKwwUXTI2G2V2QvUTKEn9XRqwaqnyhFf58yZYX04nOEDgk53lzJO+wUuUbrjAmA+WWHLYhah3/1L3MU+hWv8A66gyA2wWqTEMoIoEO58Bg6u7voTnHZfzIUxF1bWIcqBoR8qrg7pZA91OqytPCEB9Q4eGH4ky4j7N/5o4r/o7U+SX/LUgrIOudpAVzedNGiLg9pp/EDuBdeTcqOaKyssbDRg== 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:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BOQVtiH3vv+R/Xm8wEzHt3hak6EnaYnoNzS7uIj/WKYUAK+bxRZBCwnw63nstx9+DMUAoOWWUdGZcruo9pTQbJDr0PWPlLypYrlv99UPvPyeRdUSvXBgd9xBC0NMYyYhfnbjPWyeHUQvYVlefjur37X1JZrueJF0b4hAnCbujxqEg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cN0/+px8QSREjbPQtXCDMoh7iPrdN2+hWCjSAssv2LrsMXmlhLi2AUczQTfXC9VnU0ut13Gc5oRIqkBrbpsbuQLwWQ9vm4ulOMzrtQhsmdir1aF/VxXGaYsYaJC3DmjdXUo5rDd8BZL+nm5HBLDn5QBX6rpSFXdKkVs+skWKN0UJlV/eTu4qcU+UGM0QcDW8XEpr3uzmri15lXidbNTJQ+vHHVOC58OJDdFED+p2CIncUfQIxZcIK4/lPxibUC8ignvxZZdR+MjeR31mCxofh7fayP/9mqpRqRz5qdJKSud4gvSK0msWE0XI02IvNZ25wD1zgvXP+Q3RLcrHjWPZIBXGBo/UZJwCR/FhigujDQQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: bdcU6uw2TqG2fNnTgvIPaWCsgaqGr5JngDonCU/tOsLtVcDY416JDHm3pKQuHtNYfspc6yIoxXrNh0Q9muzfQbc2TiogOq06EUs0qKVJJWuAcVS6TbodlvaOo7UtsabG15X++BXH5B7h/XtvddrGf0qOIz/mHhP/21DsV6rCecAF1kM0zysW4MceH3CScaKoM7qEPg+Qiv6izS4kEb7YVD51M+nTFUUjrtTeAQKDH2e/v46wAWdt+LeLE2sfkJ8Ngz4jMow3MnKxY+M7AgSiEAGP9hOY2H7GfNuLTDZVSiJIUl23xxGxnnALcUsf7vj++IcovLBGGujK4u9pTVf8V5I0ml+Wr3wqk3omgUUDiyCVYQ6oEDJlZ/NOWAQRaTpEDozFgKfE6KKRwK12yK2ClLoFWbZ4TzPVJjSoKkcIN342BVfnKMM/RRcLMmntcv2wBU831rRxv5GtVdCq/j/IGc9/RSbAbH24fPdb97k6JzyYThwEElSvOQffalF2hOjWBSDv1/oOddhYpfQr7Idj3OOkvcF55jSYdHYD170v5DlOnuMuT+hiHArDfCMTeBfPYpMVyfzOJIrY0b/FF07U3DslwicoebrNp7wvGMpDhwU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c2e20216-cd5e-4356-3dc1-08dcb0ad8cdf X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2024 15:37:42.1197 (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: UkHIiZK3Abhw69BvrUfLUSRbTuwlsKuoamYZ0dJAzlKXEh1aVglfWGPb8EewWcmH9adZJLSCxO8JtdBnfwcWhw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB7476 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-07-30_13,2024-07-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 adultscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2407300106 X-Proofpoint-GUID: 3RpJf8_zTnkv6c4hy_bOzH5365Sz83v- X-Proofpoint-ORIG-GUID: 3RpJf8_zTnkv6c4hy_bOzH5365Sz83v- 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 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 Drop an unnecessary variable, and fix a buggy comment. No effect on generated code. libctf/ * ctf-dedup.c (ctf_dedup_detect_name_ambiguity): Drop unnecessary variable. (ctf_dedup_rwalk_output_mapping): Fix comment. --- libctf/ctf-dedup.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libctf/ctf-dedup.c b/libctf/ctf-dedup.c index 8bfd839524e..4243bde16f7 100644 --- a/libctf/ctf-dedup.c +++ b/libctf/ctf-dedup.c @@ -1470,9 +1470,8 @@ ctf_dedup_detect_name_ambiguity (ctf_dict_t *fp, ctf_dict_t **inputs) if (decorated[0] != '\0' && decorated[1] == ' ') { ctf_dedup_type_counter_t counters = { fp, inputs, 0 }; - ctf_dynhash_t *counts = (ctf_dynhash_t *) v; - ctf_dynhash_iter_find (counts, ctf_dedup_count_types, &counters); + ctf_dynhash_iter_find (name_counts, ctf_dedup_count_types, &counters); /* Check for assertion failure and pass it up. */ if (ctf_errno (fp) == ECTF_INTERNAL) @@ -1482,7 +1481,7 @@ ctf_dedup_detect_name_ambiguity (ctf_dict_t *fp, ctf_dict_t **inputs) { const void *hval_; - while ((err = ctf_dynhash_cnext (counts, &j, &hval_, NULL)) == 0) + while ((err = ctf_dynhash_cnext (name_counts, &j, &hval_, NULL)) == 0) { const char *hval = (const char *) hval_; ctf_dynset_t *type_ids; @@ -2265,7 +2264,7 @@ ctf_dedup_rwalk_output_mapping (ctf_dict_t *output, ctf_dict_t **inputs, } /* If this type is marked conflicted, traverse members and call - ctf_dedup_rwalk_output_mapping_once on all the unique ones: otherwise, just + ctf_dedup_rwalk_one_output_mapping on all the unique ones: otherwise, just pick a random one and use it. */ if (!ctf_dynset_exists (d->cd_conflicting_types, hval, NULL)) From patchwork Tue Jul 30 15:36:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 94790 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 D3121385DDC1 for ; Tue, 30 Jul 2024 15:40:02 +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 63C4F385DC20 for ; Tue, 30 Jul 2024 15:37:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 63C4F385DC20 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 63C4F385DC20 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=1722353875; cv=pass; b=kwBHJDamm1JSAR1tFgYrXlhZtOBJW3kuU2/Pij0+bJLjp7wnk8+ZdoMoNbKEnervNSBESEloPiyWl7nXI6EsV6ApE2a27Nxx5NgAQzMdrlOic8RNsxvHMHAvJfpQ+r08uws/uXyW+M6OsTr9L4NQGpKI3tUSaXdHjJ5Tqf3QoXE= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1722353875; c=relaxed/simple; bh=/+jHcx9PgHeHRpxQCcamRVRgXb+fwGJXBhQnIMZHAWk=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=Yq1qWjUpXUuEhBcq9ylk8xpYoFlSuOJ2Px929PAfxSwqOzdotjyCvTwKJY3FYULbnMPK1Ivite8/M3uB68vB+ecN+23SFcfpk0AUMidMBYQSTPjcksFhqZDOUSi/5bGtZX3bdUicMb6M9P0/5lmiDtg33e2bnB91e4IYram5LZ0= 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 46UFMiYk000672 for ; Tue, 30 Jul 2024 15:37:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=XhY267FpIMYJTpxuwPdbAPydlDG6banPBAR7fvP8v0c=; b= I8CfiHJjywvqs6gxI8+O+yr6bjrefDpcjB/bLepGWugkBttZU5G6JZjxP/2UT1i1 kmekC2eUIUe9LoYIj7Ygnw9UbNp5ZmKf7Agx093L+fWc0FOqoxMS+hEC3L49/i58 sSTL9NM743sot8QNvGbgcpD6JIjBj58EkOPbfUKSVHQnhbaFDPAXxkzhGt9uvlO7 DCg1oL5JkwXz1UWisuto1jpQjxaPc/eaXmKPWIoFhtdmGSWXcO8CaBcppkzUsuKb xTEflJUe7fJRsvVJuANGVf20879w3bPD1DCmEXnwJWdqmD/3acjg0YK8denDCoUm QsNJiHWLplZQnV1ZUK94Hg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mrgs5bv8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:37:50 +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 46UEcPc0003791 for ; Tue, 30 Jul 2024 15:37:49 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2043.outbound.protection.outlook.com [104.47.70.43]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 40p4c096qr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:37:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pjEhnIT3oh190wWqDsIhTKteRkACchjAOfKpbiWT4ybnHsPXH0A2Uw/vDItS7bpjvNHRzn8eMFY+e5LTcs7JJl2iSC/j6yupy5fmkzuSxAr48xX0dATmR5Ho2hRhRIxWilNr8RH0fu7xfAmJ2TCnewaZNHCMn/pm0WsFNk64F7A5pAQFwTBnEiUX39viupduZZxZYnje/jjm9VFgl4kmPnuxIRfsuCzb66GMpfODaftbG2+33SvwjWhXCQMvaMG4A4cwl63GKlur5XH5hxSDxeFmUXSFOOaFOWfsTmKKNemRg1tnzRneS5y8KTrfzHqOgevNK/drzMWFS9vkyIs3PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=XhY267FpIMYJTpxuwPdbAPydlDG6banPBAR7fvP8v0c=; b=rssCDXTL1u6nXqWUmbfGAd1pDMIqthrWWDs1qol4kYY5B4+zhI4HRQjlGvvo/vRvHvd5YhMgrz5sZovqAwUx7G8rbqzBB4ARBy3n4MzHiJCmergGnxrIeEBcasXtvhWtqF7Vl80B1H92OK2E2KQRfYoJ3cDLzfxQZvZFRECDI5P42nqNhZPnt1s5dOUK8NVX5dcDv88TU9ICi8lKbGkqte+eVM/je0he+y+DMba4wWWKmQgCmCXz1wxT0bo0oitny0drOxrJT562RuL+ZxQl8UOY+mZyIEoH4C+TMBIWYxQS5sjpMzccXzYCRymxjCdz6wnwDAx2x/KkFstHK3nzjA== 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=XhY267FpIMYJTpxuwPdbAPydlDG6banPBAR7fvP8v0c=; b=H6MNjvsczzo03miPIKjBdUglEuN4eGx9yE4ofcn/ZWHhvnNNMoBZBI0xd7VdzL2a1J2fhSIgy+dXz2kl/SkxZ6ONpQbWjTg8tXUrT24pUaQNJCs04elvjQ0Rmd4YP34UWFpNWzf32uNd9fyaYw+nLkOESJMQyL8AgX8HsslCht4= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by DM4PR10MB7476.namprd10.prod.outlook.com (2603:10b6:8:17d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.28; Tue, 30 Jul 2024 15:37: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.7807.026; Tue, 30 Jul 2024 15:37:45 +0000 From: Nick Alcock To: binutils@sourceware.org Subject: [PATCH 09/19] libctf: fix dynset insertion Date: Tue, 30 Jul 2024 16:36:57 +0100 Message-ID: <20240730153707.168357-10-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.2.276.g4ac82df17e In-Reply-To: <20240730153707.168357-1-nick.alcock@oracle.com> References: <20240730153707.168357-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO4P123CA0117.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:192::14) To MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR10MB6608:EE_|DM4PR10MB7476:EE_ X-MS-Office365-Filtering-Correlation-Id: 170b25da-722b-47f1-c9ce-08dcb0ad8f3e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: JOcIaqyb+HCWDHTWCKu9zF8M/Dh+L6sA31UyDPwJURaN/fH5k2x5u0ZiuR5TcD5ivz3bYofIGvsaMQDjwxgaUpsD7KMNM8Bu62NOBqzq/464PHr9hr/xR/lFPME1jDOSJKpy8WgmovZ+DtEtAR4/RsNdBy0jS7Dm+KjFmnAUQH9bEtqpMh8/h2AXpw2emBTViR8JEQeE61UqhnaDHCTnKjpsKtd4O9KagvTYgWnLQVu+BmAwkcQH5bPSg6qrYd5RIrkgMLILIUU4b5oTAErlpvl2mSgeG74b2TC1oP5/FCyOGcKB2/WJVS9fp7VgqqjRTKCzytkAsOSneQhA9BC7e/ICKAenZGEIRy8GJ7p56mYTnqYykUfxJCoqzs+lgWVE5xSrL0AUiPgsFE+PjfxO4Qfs36F9I9bx9MgzTR/a6J1F9LGTTpMvnW6UiK6V2MAukAPAQfRkuCe7VSokTmbe+XKdc6nLKmrN5Yo9Bl3K0IY2coPOxn41kLvH+BHFt+oROBkcI/6VftkhVqGUdyOe7WjW8Hm/XbmKAmZqffZWaK0eHTypyhkMgAZflFgg30cfPdsa5jKNPRdykF+JLVWn0poyUKBIK4nWv9c+1+WawT+7C6d2vtqsa0ArAU+6hUVNgzZWNd84RMe6xQIi3FUjAfFRE1bMPHAs6YfHZsS1ctz3cFhGLkOjbjC33ps/n6Lw0Z6rmcmryT9m+77gnubDmQh1Dj0KcY9gU2qdG5h+b8A2C6Rpb2zwbMkENIK8vkoW65wgIE0VAN1LmOvoN+LH2lkjDBZHx9VS27PeAt/zHI/aevczDXBN10lBd/JTRS1d1gAHf/UIEVB7s3/cJNIEpfaWIeqVZ/qn91loTBHSg/TDH75Lvp5BfO7AhF79JntL770wchLyO4sOZEEWNuHh+o/b33XcRFaIzIi4If1iHbY0oHU57pPuln2iAFY5c4ZzDh9Nw7beO+4EEQs1NRWsVEUgoeQHjg4m5OGSCmVity2Segi0TXwYdMtXNzWAokiiTx9ILKbdbQdgItR4Iv0UL6djeJDWnw7kLC/1XFO1KFYnqqUWvu4LQrYPKvz6l9POygeNxHDiICvHoJaaKJlpOX4e8vS0yWTGDoeiWux+FSTZMYjGpoL4KZ/XkzMdEJ2Z9B/U84BlQBapS8FwVWT/BsKY33VvI6JxGw2viz11yYtRdHLw5xFqpTILIiHDWxURRSErEaNQVXwRVeZj7UJbCKS/tsli4Ugrcol8jmNGtXBUzMHktv8wL9Fcwa1s+8yDGPC8m8+321u8uz0hUOIYerP1xgAJYelCIs2QIjmweUQ7cWnoO5CBgqb7pxXYA+/veqMdlm1jfQD9VHOcZoZJlg== 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:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: C9KhHAYE9H4GslQjlhyu7VHGp9/M99wWiDZg8fSzVgaBe6e8608lXwyiwdUcRlcBNS5RQ/U6CsHl4eOO5EOYAPmvNMMlJAhKawPKB8b6KBAspxrnSJ7hlH2X3bLHI/sXR4Yb8KCkhPZPO29KQFw8CLWUYiyZwrlci3kT/YRyKN3gCMZP/AwkYJpsmGmFyUQ7QlGoSSuDD/cwGjtqTLQMq2Xx693hDdX+EGZG2CQ7eE+3S3kvLa+TOVO/qAKp8Q4HLMfZiHc5uNdnsvtBDyPCIRF/fKDd9s0KYnn7POoniaxWYadWTQuHeU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cGTE6u1vZx81UqmCNeD9YJ6fdcbCAU8GlHkoRzNNn0Maw723PCucXf7Dmd/0gM00If+Y69/WrM56xR4FIj2Shk/zM5By0ZuG0fYGwY7no3Wa+rfLYNRChnmg3CFOtBqzzfQK91S0xjpYn65PWhc8kp/OYHonzTgNz6g40EYi+vvW7Ugszs2ipWUzLK7W5/UREiL+rw5f564j9lNDclp7mLn+cpDmQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 4UKhZRWXwgMEZL+5oVNw7b1Pb02oziWUq5snFjBoERrgEu28cvk8cNtW1v449bdDiRb9rrnBITtI+ZMrUZAOtY0npkGz5FZbnRKyqVv0yWAAimAzA7R9AWCR5Qg299H0YFjRc+JI9AFb2vbQYta+K0tlxAF5kvG6RdmfwgOci0VS/ENWtID1FB62HlRO4cLU3A73s74DJqPFlz2BJBTs/OQ0KiXiC+gswkNjIoH7TX9FNmT/9goGiRchdfZitDcIFcTAKIBMyK0Kb0RXcOCZhs/D92FCJhnNXtACodgI7W2WBowgVipKCgW71WsQXX/Gzms76O9iq1X/3oqZXOTAmjQ8/mhSw7K5LkCXs1rTvsCZzwG/K9CUogEPRLPRLKS8FP0xj4BfruETQrNuaQpcE9t0SMAtvSb5qz99FqXmf827Btbw/27LPJhorfXFYCjIRHrUL1yKQeprdVzsaxeyat8MiGkOgt2wwsKsm+3m1qKPul+S2UsfqbMR1zrpdWKHrGokN7T/uuFxemr0+cNL1h/7w8oS4W8e/MffppzieHiSo4253HDdDMk231BGHYTixmxhd0Ylw9MREDBNOeqhwM/ARl411Xrm5I0kyF6ju+Q= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 170b25da-722b-47f1-c9ce-08dcb0ad8f3e X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2024 15:37:45.9566 (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: IbsTyKnywPcZAJH/5qldyEyafEbDqwZZpdzVjuq8WVnQ6v8kCLRjBiKcP44A6pJt57J2z41S9xiYWsXLnNwKYg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB7476 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-07-30_13,2024-07-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 adultscore=0 bulkscore=0 spamscore=0 mlxlogscore=988 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2407300106 X-Proofpoint-GUID: OvfXynoadJukG6KHL7UwnP4HmmZjIgaU X-Proofpoint-ORIG-GUID: OvfXynoadJukG6KHL7UwnP4HmmZjIgaU 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 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's dynsets are a straight wrapper around libiberty hashtab, storing the key directly in the hashtab slot. However, we'd often like to be able to store 0 and 1 (HTAB_EMPTY_ENTRY and HTAB_DELETED_ENTRY) in there, so we move them out of the way and replace them with huge unlikely values instead. Unfortunately we failed to do this replacement in one place, so insertion of 0 or 1 ended up misinforming the hashtab machinery that an entry was empty or deleted when it wasn't. libctf/ * ctf-hash.c (ctf_dynset_insert): Call key_to_internal properly. --- libctf/ctf-hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libctf/ctf-hash.c b/libctf/ctf-hash.c index a52f96db105..7f291e3ac27 100644 --- a/libctf/ctf-hash.c +++ b/libctf/ctf-hash.c @@ -626,7 +626,7 @@ ctf_dynset_insert (ctf_dynset_t *hp, void *key) struct htab *htab = (struct htab *) hp; void **slot; - slot = htab_find_slot (htab, key, INSERT); + slot = htab_find_slot (htab, key_to_internal (key), INSERT); if (!slot) { From patchwork Tue Jul 30 15:36:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 94795 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 39757385C6E1 for ; Tue, 30 Jul 2024 15:41:44 +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 00AEB3857022 for ; Tue, 30 Jul 2024 15:37:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 00AEB3857022 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 00AEB3857022 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=1722353876; cv=pass; b=OeVMuVJgqyguLeZZ8ekbIybD9QH3+ZqrtiloNiDBWesJQ4+u4B2j78nNqIVZQzCCQPxdUG7DnyoGzUcd6BwrjlgvbFunvWkrR03bt8xZx1oesszkEo3a3UI9paVBwGEUWr2REsIYiD7o+bBxczL+RiSeSVfxdHYr/j84I/VbsVU= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1722353876; c=relaxed/simple; bh=X0HiRjzgMCJyZCq+/lIOF3pDFqHxiAVtPAEQzbZ/lrQ=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=CQaY4eGOsbA765k1LFxdzjqJOYk3TL5bCqA3cT8lUXs9CTsfuSrOOqDinDCqpo5KeqF25nnirk4wYS8eFpRd/zya5i4WwTieMjqWelLvsdR8p69m3JdMk/rwiVQ4rs5oookIW0WpBZrfBkeTnSmYhsz8j/HH1M8i6s6o+0eeRzw= 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 46UFMWhx006633 for ; Tue, 30 Jul 2024 15:37:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=f5WigU7TBC8bvMsejo20jW+Sk8tL7xUHJdBkZHoXug8=; b= WkpJ62sQxcwF9oXGx9zUz4YdV0CpE15AWb5XFNZZYCrAQL7vwVHrqimtALPWhGMr XDd9diRoc5k3Ha/dcYWftyGjkHpJeODn0Nhtpp7iXwwb416moirsgwBK73zwn7bz fWl1ONlumY13lKYd16KII7vASuOqnIPaUSqdmIInC7FshB7TqZZgNuG9WRvyUnpI jEHk5PjVIv58CCSWh9edkLZv+cYZ+gbUAHfPk3OCtaWdI/zFcmOrL/qJksuPrb/F qk4WUaOkgO6LaXrnD4gIMOrEHJntmVO7Py8Uyv238SZr4pTqAqgeS8zNb4SPHyIP irK8o1XVzJORAIhswVHEIw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mrs8na0r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:37:53 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 46UFIvJP012274 for ; Tue, 30 Jul 2024 15:37:52 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2041.outbound.protection.outlook.com [104.47.57.41]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 40nkh6sqb9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:37:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dhs503THiIzSRWcFMjEkRR8em601WlUrpn98yiFJJEeS1P65qRPwNMgbKD/gDLeoTreWv62DCKBEBRK+uYNTab8iYs7UaqKZREnz50kDPx3Yehi5QA/H8JkN74ibjHuYQn74VcS7BWAztS8dsvpelVcEYNSNZpIAvd8fau1YFAVCfahjITjkO6IX5QgapS1rQe96j+bMQnS61Ycu11jTtlyKOQGIb/bX2eYtzwcf5WaoDBu/n4ZIEUCwgmsXi0tDzyctn9Rc1I4M5k55CaMxkjcG0zsxmvPIepFA5434AiZocaUGR0yr7Vaz1vfFHfoN4z0EFsrpm0+FbSyctRGSvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=f5WigU7TBC8bvMsejo20jW+Sk8tL7xUHJdBkZHoXug8=; b=lq5jGF2LxmK7cnoVcbJWKw8aGvfGtiPaXmLmHofuEfisqm7ps+0IKZ3hkMGezVw+mV4YFFBkEOWlht27OWiW3Iogp08t+bszx5PhQXe/vFjRReAXiF5vSWrAYvgf47k8wItm2APaW39Te4e50F27pgGSVU+eskDbtrbyFALD75Epc7nUywww02WZdz1XlKTs20Am54p8KlihwED08eklVZ58J+lUnmQVVj741oPpZVTmghvp5mWVgLSSAu0j+q7E9SA/NGZYaRPnkWcy80nC95BJ8KZektlxuVSuZJsJLDHFFXby/NwTxughkjGmS27Vs4ZQ7O48DhbnISRqvlTTVg== 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=f5WigU7TBC8bvMsejo20jW+Sk8tL7xUHJdBkZHoXug8=; b=Nxy+g2gZhbO5L+32/j60Mh1uRLW8w/2UKplY/nFtT8jOzZS+qnhz95QLdjTTUW0a2CWEDqfmtdBinLnNwGwNVmpbzl5y6vHH39DolylTLBF2xks/2SuRVdIa6pAkWvB6q+zf0h1r/DtNiMRFREV+FpVLITNb9ctOIL1YDnnKUbE= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by DM4PR10MB7476.namprd10.prod.outlook.com (2603:10b6:8:17d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.28; Tue, 30 Jul 2024 15:37:49 +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.7807.026; Tue, 30 Jul 2024 15:37:49 +0000 From: Nick Alcock To: binutils@sourceware.org Subject: [PATCH 10/19] libctf, subr: don't mix up errors and warnings Date: Tue, 30 Jul 2024 16:36:58 +0100 Message-ID: <20240730153707.168357-11-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.2.276.g4ac82df17e In-Reply-To: <20240730153707.168357-1-nick.alcock@oracle.com> References: <20240730153707.168357-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO4P123CA0645.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:296::16) To MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR10MB6608:EE_|DM4PR10MB7476:EE_ X-MS-Office365-Filtering-Correlation-Id: 5171ea29-8100-44e3-eaa2-08dcb0ad9173 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: tlG0fvXh5+wXFo/DBX4jvO+C2LVS9IVom9LFDiJda6v9ghTho6AhB6S4TEC21jm+dlGxlT8vzrKbH1rJkcVudgcBbMtHOTwN7GLWLa22ruuxSqTf61KZ6t8xC9+Bp7umMoZrujLbdsNCO7fe4idjktY8cpUh+hGzf6+AJamSjyLT0sG9f6TFQaSVA46lJqUghcjQZ17XhpJk0hjLgIkxPLpp6w5fgvkV9R6N8qOXrGLV2Fia1iwzxoXD0wh+BQ7ie3FiDmoFNQxlkSwXsg3WUb8eqK727ljfTqoJzPW2OoYt3LNLWXnazN79muyOvX2P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G:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW4PR10MB6608.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: h/9pKLI2eA3WgNw5U8IQrpv21oVHNq2/qxhpJZ/jlQeBhYIBzdtsrG0/KapwuCuZrEvg1nAOxzEnAgSDgH3XjU2YYOEGo9Z7k6ExQbg+jANEUGWoXHdZpRixlROIHqM3zYa9QQt3K4A85JQLEgTd7frSkLBaiV/O7dsRYs1ize3XIRknN0OluNOqBVMNvQNCJAR0XS1UHxtAMyiJ4Q8v45aouypm0cDVaRoeVPhjq7x/o4KVE7BPS6uag07TcUaenVRlz4i3/ABJ86vNSPS2LoYzRK9XhKNox/pgXa4NxeftbOWyJsJNKlygTp6IscV4JsmvZrMihbkbv+CDV5kcRjqxJVCrDn3YSoE6M8ivswbmfdLJM9BnU4aKeQWTreNN6GLlpD9Yl2a377BGMK7rxobEPvxuboZle3wojLKdIFgHu67lKolzZAaiJJFqvqWPOuukH0743FNG4dR26yDbx/uypzcNyHNz+G+aLNlW0fkUisVjGTg4241kQzEtWc5wkJi4bA4UOyFun5nzCG/tbirPFrUlhMxRTJK3gtuqU2/kYGHOtfpjN8Xr7tXsCzGC9Sto/0powKrEFCIQsHdg5seuTx7evR0X6IhEjPDpOiz5Zqhpj1WEp/OJ8uJWATlQbxpcO62kVoRQGg7cI0hsWZKQt3oQU1wphjnDzCf1jqZkm2pn+Yau17Q5boQBVl74npplJjJJ20ThJ/q5lzvXdypOfsYJ5kMwJ3Lvy52TBwFrh7UT+ZqR4zqocHsHBxcd8ITQ4raeDrEoE6VXdyHJ8GjqsIJOryRMM/2hifQ0gm8I3fYHWHY9yQyLtpAlrhxT++2JSiPjkXoveh4u98QvgFrExQHXX4DVU4KWuGYYml3OVn2F1Za31YVQ2M54m0zu2cJ5gjoPXZbX8obxLGXB7Mc99h6e1OvvSBnSmfxYk98Iq1yb/U2c+DAb0Z4ZnjE8Y3ktieek+xv+atJinZrF96iC2ms4TA2Vie3G2RbnVhWcns2epvpHhFEqXWevul44O6JALzsz2jeJAiskDgZjUPWe+rcldndzh/zlpTOPYwKqQbqn44AuUc6uXLQUPRn1RWRz6mbxjOldyouIPJrGkiYhZ+1jCRphnqFFJg9IQnEzx/22Kh3FUZVQfJZDiYx3sF/UD3ik4yv5DEllEc62pj968yH1ejwFcg5j68quqKZy5ISnMwBRecv/wOPCjJ180g8LE7N7A5sQ+ztOaKT/Bku9jI28LDfmBfDbeJelDzC55bS6LNOLtj+RgruKoiZSadobo3htKSwfEY8bvISxQ1Epdc/QEV8jMU6hRuIdObjjTDCDmlemjpLELrdCVVF/mnXoFsX6WODK6zpDULCZiE7FFa8fk+o/8XARu+Fd2R1FbyfQ+Y6crxHbFrqFeJhbyrppsXen3h434XX4R+C2DbzV9/unLzbCtSATAU8bjKl8t6PcyzhHOL7HDosrHQxcdKUDX+zpw5J+1aCHbjQTir54jwa+PSgj9c1X/olcHf4VkoTOvBPThD73kSa97toldnl4SWDtutgJTy4CGzJ/oHe5I1+luWSWbuI3M5uFo9BEOCTWCU3cFG0XSRZ6UFDaohviUt8ywBKqosAidSPaoQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: RD/bY6lFjkC2baymYpPJBkTb9Im5qwWVJfqzuVjMVoLpSCHzNgRXFzc96v6NzqEF/Q6Oj1Eogb5+/VpvetJD5RghtqH76j2lNsPPvyDfMmZS/OQyT6dFhqHgurYVwf6jV4vRLT0r6GvU6xc1d41OwrV/iBsLvtRsSELcJ7Ccd985S6C2zpGz8tDESgvEc1kIXoizPkDSTdeUCDtykZAlK6230QrqTnmCScbPzlehqatAseSfdQ+6Ki+5kFUU7cG6WqAYpaCFScaJqjEoKlNlO+RIDkroWyNiCh4nl6de8uyPmsDTK7dct4cpo6fFhZvebLoUCK1JOvw4wtRTyC3Cq/35nAMeV58Gl2gT7QVDNhIiq6ZWTLspKdL6E0iX4nJm+D4IY1cTeEt0FR7Vi0e5fLC81mqhGS9i5j5a0F5B59FZrhDyW0gqHlZ2JxP3SzpP+WGd3PFtmW3bDE45JOMoIqyd7BNyGtPEThh3ATw2ro7cu8DbQ/9aR2LkBuZ237JlTlHTwq5bCZq7ZrD0j2IkkOyRfttA444psHmBNyVtZ7HUjFbiun1HelLLVtdWuLx6Y3UiDG0sjwv9NCMrwnKfZ0I2FDFRs2TGPxtushv6pCo= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5171ea29-8100-44e3-eaa2-08dcb0ad9173 X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2024 15:37:49.7076 (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: /4IFVSln2SR9VVP8kQY+vnp++9hsfboKPVHX0DGtNyPknvcOON+HLe/3RhHYkKhZMIVYTPrTrUkef9MTo2KAFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB7476 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-07-30_12,2024-07-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=927 malwarescore=0 suspectscore=0 mlxscore=0 spamscore=0 adultscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2407300106 X-Proofpoint-GUID: g4ZYMrZ27iJgG89Xoox6sFfb7WzjPRjb X-Proofpoint-ORIG-GUID: g4ZYMrZ27iJgG89Xoox6sFfb7WzjPRjb 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 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_err_warn() was debug-logging warnings as if they were errors and vice versa. libctf/ * ctf-subr.c (ctf_err_warn): Fix debugging thinko. --- libctf/ctf-subr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libctf/ctf-subr.c b/libctf/ctf-subr.c index deb9e0ba5c4..6dbf3e7231a 100644 --- a/libctf/ctf-subr.c +++ b/libctf/ctf-subr.c @@ -231,11 +231,11 @@ ctf_err_warn (ctf_dict_t *fp, int is_warning, int err, lead to unwinding up to the user.) */ if ((!is_warning && (err != 0 || (fp && ctf_errno (fp) != 0))) || (is_warning && err != 0)) - ctf_dprintf ("%s: %s (%s)\n", is_warning ? _("error") : _("warning"), + ctf_dprintf ("%s: %s (%s)\n", is_warning ? _("warning") : _("error"), cew->cew_text, err != 0 ? ctf_errmsg (err) : ctf_errmsg (ctf_errno (fp))); else - ctf_dprintf ("%s: %s\n", is_warning ? _("error") : _("warning"), + ctf_dprintf ("%s: %s\n", is_warning ? _("warning") : _("error"), cew->cew_text); if (fp != NULL) From patchwork Tue Jul 30 15:36:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 94792 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 0222B385DDCA for ; Tue, 30 Jul 2024 15:40:22 +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 37A2D385B82F for ; Tue, 30 Jul 2024 15:37:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 37A2D385B82F 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 37A2D385B82F 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=1722353880; cv=pass; b=VWAu9MgL6ONih8kg09pL154ItRJBcTmbdHCbaca/QELSTXVieHmmPLhQ1v4+YtNFCZ0YAJ4W9a64GcOOyFnBr3QDhh699tYG1Q3NoX6wY+eExl5kdYlXfaeyM1hdkIvA3/nZr75S7xDwjelaj28PMtz6TujpRzFIYtF6+DS81fI= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1722353880; c=relaxed/simple; bh=IdCERtImTz+OKn2YM+fx2FOU5f/pCzZrr+YTr9qDWNI=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=io4EpcTr2af2DBbkkVqeGEzU5d1JnIMB0nRVV3IXZmNN6f+3GpETaBWNDOcKhct78yOXUZdtmeg1KAMtsNsiQI9tdyJOOqb7rGfflERQHF1linNfElTgdMt0sKuHamchuoK0d1Mkiq/bROT3uGaJJG9SePUXDsj525Arso2CttQ= 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 46UFMce4010457 for ; Tue, 30 Jul 2024 15:37:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=rlogmZ0eDySltn9Y49mWdahXbdqcvj1wnIDnYxisT8w=; b= KRFHya1vntanrV8Ib4Jf2DMe5culUfWedvsHhOTZNHyI2jkYNTEjV04+LPH0SIwY BQ/8XbWxIDYEsNRKdrxeFiabyVCUv4DWdxDnImqRXuq++elAEj02FVYg6EN5c8XZ 8W6OzzJGH0qvbWs0nDR3OP2ph69gyU7ECBYxxFR23Yf6hXRtMitO7JHFPAdyVdof TpTcMpz8ESI506qEN8qw4ajh4GlHL9zTtUqm9RDZPWHGAUwGItJU9iC9uLp5L5VM kuPZg+fSkonQ+hXumV3M7fJxC9sFYsfjygbKGWFOv3Em7cQjhoHXce7uGWGJQ5Y4 l9194nv2q6Am3qGxgaausg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mqtanc4t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:37:56 +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 46UEe0NE031079 for ; Tue, 30 Jul 2024 15:37:54 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2044.outbound.protection.outlook.com [104.47.70.44]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 40neht6ser-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:37:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UgBcn60NQ+rVr49Zt7InQ2T//idpD3q+N0Oon4F1SAFV40ocuY75ZZO9bIumTl5daPKmyobm7ZnO21NaIAfkoBkW8SXiR1L0SyI+LaAK8k1/RzbKa9nlOC8sxGFxy3SVl9rXw3LZHTCdaYigUA3lQRABgH2oSzpsEUuLh3DIZPCVQ5OQ9oP0NNIS+ydRqa1Rl2fgNy8tkr1raKCtdqRM6/vYYZHY3tAx7ABXWpWqr/VYU/tQ0pXhd++BMrXyWJMUrvPuFRjSXZsGg7d4HE8nkYofg3/dpp3iH+X32ygZm/Wh5A1/QEGFO8pZuFKy7iVBaIAvn3Lsli7mLmkkIBYrHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=rlogmZ0eDySltn9Y49mWdahXbdqcvj1wnIDnYxisT8w=; b=YbLdZnoNy97esqyau2JoQ4T97Cdfn9iscW7rhZgt79VTvwd9qM2mpnXBzuHWWkIkgA3WGi/ptwZOoLwuONm5C+GtD95tYe57XM5GZM5gwF/dzvXz96ob9z8wcgr0pgbQ1tbqiax++hga7zCoCqExw7j5Ugno1sVsX6rnkgZ4fFIaHEsnp1oxvdQE9v7F/tG2j5rZ5e4sdgbhFULYWsHCeDuAI3fVOJYac9i6HbRSUgzy2KjU7FXaz7q5/IanecBcA70QLFKTvw9t0W/2QWTMz3sjSyG5E7IosfYdh6qNmeCsXpet+n2v3R34gDont1DNx797ZuFWZvpn4RqTJBTe8w== 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=rlogmZ0eDySltn9Y49mWdahXbdqcvj1wnIDnYxisT8w=; b=KODY1IHtAAlqSoTFq6oHiYaUMc2AZ50JS3pIakv49Hz70/N3dmxOiMGCHePwxK9EXvGTqgG4ACwLLiL1VriGKv8Dd4dMvjBcK+TUPcUfWN+lmIyGiOhUKCAqFDfABRw0vvYmZS3lwtc9L3zHXeZebLjX4kPxKGB2mXwtJYriXFU= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by DM4PR10MB7476.namprd10.prod.outlook.com (2603:10b6:8:17d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.28; Tue, 30 Jul 2024 15:37:52 +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.7807.026; Tue, 30 Jul 2024 15:37:52 +0000 From: Nick Alcock To: binutils@sourceware.org Subject: [PATCH 11/19] libctf, open: Fix enum error handling path Date: Tue, 30 Jul 2024 16:36:59 +0100 Message-ID: <20240730153707.168357-12-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.2.276.g4ac82df17e In-Reply-To: <20240730153707.168357-1-nick.alcock@oracle.com> References: <20240730153707.168357-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO4P123CA0144.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:193::23) To MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR10MB6608:EE_|DM4PR10MB7476:EE_ X-MS-Office365-Filtering-Correlation-Id: 0e5bb54a-5b04-4c75-ce1c-08dcb0ad934e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: gAzoawd0Pxg+zKRXQzdY7dwHaVeSddnexg0Q+DuOKdHNDQPFKxk9vMdrMoyw1cwd9oIfzypnfCzPjbfgzYhXTE6dCoFYjaYKN50GylaM8V1yMAlmiKiZyPUUC9dXb/fYYiuwEjdxXuJDmEebcLmCOClkPIZP1KuG7XBXQKXEwzCjhaGjND0EiGnN2pprTYnbKbyFMAmhVYOB//91+WqKLvbkfxtT6DvlDyO61ljhPUj7dL2LuNpDkgwbboyCtcTrpDlTgYUmwU+mSKG/P7NUKM3gSa3k0fDyZogqRzCtJGPT/Cmg3knj9W1lrqkdBSsDwRzyr6BN7TP43qw9o1mj6yg8oHAw+LrRji8bzKZ9/BTgDKM8rEnJzeUGHFCRvz/DxkEWUxvJbOoqfLbWKus+f2FN6rwQsHan7WHzaN7dQnFURYBCdeqIlqi28u8XlLipbBL/i+Wx4GOJkvxZzku+xqLZ94g4szhRfaFaVh7TVwsyJ+Fm45HETtNhgw/Op7AzJ22FxukgY65PQ+Ck3/gU809GCtbZK5zovPkQ5sJS3iuXCcXE4r5rVWplYkwbDaeH63DdwZc8IfgRVyb7xcj+ZEy19VdGziMcw/N2GOzsKTiBhtdL5c5Z9pEiuaQ4J9ouQV7WmB3TKSyc3C8H3YLyUD6sVNGy7sOa2s4WKPyuo9WeTXSgqzcpgWhmE1DWOorU6qT2SeQ/WCnncrc56m03HTwCFGJEvmMYYOyibi2wEWkKmGIBQsDcJ16tbf6vm88wgvHPpqyHmtD6lYTd91au2OFZAjKdCIGi+Mwd+sSHNcy56Wap/ratuuvzNu2mEReWQWc7+sjbkKVCd3ofaak+a2+zTeHpCu/vP8UcuUHXlO6Sj1noUt5eH1PPBo/WCAJIT+KfaQlTyUGaqecMcYQOequZ5fZzG8WtfGSeGGgncLnpNyusn21avrpMWxxiadrclbvFlZJZA5GIIpNJarxER6J5dSJGO0QV76RP0QBhfGcaM7eTA6FF3gKHLbFZiH99eFtZVMTC/EGL4psP/ZrZgF8vGKrVso2QNu4oczs2LkFicYtQW65iuorx3/u8KQBAX+pB0CelkYHVDi4O1T2WNEF53RxItntgiODBb2AwIG0ClngKTaoYo9RzbHBROw+xCFECa1bq/C6TkFY2IR34m69yVskgBKvjUgatZpeL7gyZqAuv7X/CCVfsOgMz5rfTQVCCDu4njRTnU5qlewbwTWInAHc2kJb6cvGHGDOzt0KDy2TI+c/GoF5xommWvUelzgqqDCEanCg+iZZREoyqvRDe9WU4uJeYraaG7WRpeP/LaiF2Uh6Pec5xgvYSSyJb4mKuUkICfKPb004Fx6tuiA== 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:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kV/at+ahNpldG3EqSwTgV+iovfbiNrUbiFENGt4yz9NBpz1zmWI9qldaxkfrBDI8RPl+qUaXRs7D/cQ322u5Vp6s0Y2348lhItth0Yn8DP7vxkGjlTw2msHSTitBEiiH5CcF8aHOUCuVvKc10YRHvw8Idh5JeurJjwNoq90nmVaSYj6pVVQfhaMFOBgZww4Mkf7wu44QTBrtRK3lBDWJkcO4krFWZ3WpkuH5IVqIU1GPp958ZPX4D4YbgSg1MGNwA+K6B+/wKMhQfQ5H/50dOkYcjMaAhBfW8iFaB/bp5F9P/2ZtS9Kang65bpTGUVLCyBQncmSZDroyp+xmCJ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QLqSDBiXyozDfMc0C+73GoddoJa8+mPIaTD5SC0Ppb/Q9axcLnlnKpQgREaflZaYIAecssOgLyWtT6dePM4qDG/1APlFa+/pv+dHoH5TNaY94KIbQSEI8T4HleqRdYc5+Uuf6FDBCik4vQxvJ4TT7TB8Wb8geS6pTXz6tX07Kz2rFBBXKJST4t1PLm05crs0e7jveg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 8wOz+52eL9jm7WisS6fv0WTfLX7YtgsfO7QAFptGEuz8deUOFZcaSEcAO2NuG93X4upsM6hH8uB/o/DLWnZtubrxMLNrN8wBR95gKThk04amFIVS8dIiAx0dMBvytAbBLrAaMvGgJEmqxufYAct5vkaNGm87p6QZbaphjaN9wdMJtSaRw9jC+EF58AzqLxLLPJoP9rdt+s74CIf1iHdTkqCxeG4yPHGnF1fcvsIGg+fgncPkEu2r6OCPUGF1+lyX7i+461xajkHrSbm2/CgJufSkOx6mwvvcwx8x3AFMO3iekS6sSELN6CJNv0M0YXHnhCIpy6D6ZQN69wA0cltP7qZOPDaKQlV+IgOnSJsxEgxxpOTpZgEhcZx9BFwtqEaNIFI+8HCvxb04ABgOSemi6BXKhMcJZSRiX+NpORjLdwU54JyN+3X5F9uzgpJCP6UHJSASHiiDFbTloxJY0lYsaQfOwfpgqJ+6VYg+WOInq+4F395Ggn4hABOOWHb2sYcpdMWi7K2uEEMq+3UsWszcUyp/flsNWAx7t03+W4y8tUPBCjWmUA18wePiP6v7ddfTOaK+L68PibNQM7i494wqO2B458kA0gA7/zm+Ju53/eU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0e5bb54a-5b04-4c75-ce1c-08dcb0ad934e X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2024 15:37:52.8087 (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: vUceCoATt+LCvO+sk6v/1AQ593mOk3us6YsMuda1ZadYKQmH1IVJNY1j1xig6tO+myd/za9lQ67ShCOv2PNykA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB7476 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-07-30_13,2024-07-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 spamscore=0 mlxlogscore=851 suspectscore=0 bulkscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2407300106 X-Proofpoint-GUID: RkA2OtCGk1VBU1mFDWn5IFpA67AMrEqv X-Proofpoint-ORIG-GUID: RkA2OtCGk1VBU1mFDWn5IFpA67AMrEqv 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 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 new error-handling path was not properly initializing the fp's errno. libctf/ * ctf-open.c (init_static_types_internal): Set errno properly. --- libctf/ctf-open.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libctf/ctf-open.c b/libctf/ctf-open.c index fd6d36edc46..ab97cde3ebf 100644 --- a/libctf/ctf-open.c +++ b/libctf/ctf-open.c @@ -1066,6 +1066,7 @@ init_static_types_internal (ctf_dict_t *fp, ctf_header_t *cth, continue; enum_err: + ctf_set_errno (fp, err); ctf_next_destroy (i_constants); ctf_next_destroy (i); return ctf_errno (fp); From patchwork Tue Jul 30 15:37:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 94794 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 DC9B0385DDD2 for ; Tue, 30 Jul 2024 15:41:26 +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 D9742385C6CE for ; Tue, 30 Jul 2024 15:38:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D9742385C6CE 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 D9742385C6CE 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=1722353882; cv=pass; b=t9U3Pk1jCG//XRs174hzQJ8OPlX7EL4sWE/HpbNnLVGTUiwke6CO0XMnJI/FoHTH+zF6wyiW7EbIjn/M7RyA3/wWMWpdv5mQf9uA7874kHzJqo1pDBTiB+4pivjekzzYqSlc8PKuth53gtncCohUU8Iayqz8umERgFK2HLCrYcE= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1722353882; c=relaxed/simple; bh=IrM4MqugrqfJsA7ULcfLxQ2LIyytLSrfF5ign2WaOu0=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=Yah96oS9lLISQck7tOhZPgx4/ZomE5hJH50Ju6NLv+bIl84M56ntMRgpxvMpbuM719BbRJ1xDFGjzBnUG8/zD99RMVBRS8B6RYx3y486fw9cokfyus21rDjnw3I1jwhwJckQvMXro4Oz0zAauNQmi3NpXSGA1dpQLhlulfevds0= 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 46UFMbRj010418 for ; Tue, 30 Jul 2024 15:38:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=kXrRNUMg/3j5r6FJPWwA5nnqg34uucbmkOIn7veJ/7E=; b= LHiN9u3XOx5alB/dL6itc0mT7JWUZzh0Y1oMpOg3JGG6OrMD6xiRGVHyKsZOLn5F j7kBjdCBO3XY+ctAn54wzAJuEZ71akhSWubPpCfxoECCyeYRv3RDgnvadM+ZgPv1 ElC+l98RFtPq0Cuf5sVXS180ChOG53AZke5zYT2kUDv2qYzhL45RFxCxMwZ4E+P2 nMbBGnd4pQ3D4REmoGclzJTQ5xOzWTdVjCPomqbzrmJrPhNvCTzmxAJCPQ1mDO9V SYamjYaIkkB1upUi2in9yvKMhcmGrh/h1+27kCehxWVvxYW56mwjp7T/of2EGHeI XIyvqb5iqPGgiwUnfLzT0A== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mqtanc52-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:37:59 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 46UFV3lp012341 for ; Tue, 30 Jul 2024 15:37:58 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 40nkh6sqeg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:37:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Wcgi2mbDvegtjYNRiLZfY8hTYp7SnoBDLyYt1j3JCbDLp5SYRbefVJBGM/OVLRtv/j4vGwnFMt8ELnzCME099OXloNiwn/G7cZO9JV2Rq/SFCOUtm6nDe6G+5sz0ejWbMMC7TNQU9PlNQU09vdmlfmUp7I5h7b8hxf4Gab8TJDSnbcq5XOS7jh7N23QPPLfl3lU+G4/UEI6DQA4aIbfRROu8MWTef7RP+xNdHaN5Wk2ygvtLqTsduV48gdYAwgfi0wlBzg+15Yv8V/oyOf12uhdganNJ0fmiBhms2Uk9mS1ZJbXZF1ELCgcQUNPBjFsnwQsYeQsUNkA+z2bvixKFmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=kXrRNUMg/3j5r6FJPWwA5nnqg34uucbmkOIn7veJ/7E=; b=htrzXMGR5k5Tz3WL6lNXs3iYtqWV3viVa/YFHadq3d4I5U6TLdOlpof+V4sTHR3LJQay5FruKqa2aPmxTMDptbtHHUTJdC8Df92loSgRwfGGsQEvbPq+QGjpxNHVUhU4fNbuDi1qsDJTcZa7gMqodz2ljv4uyrnWu7xp9kIh7ElXES0Ms0fW/qjuj/ISCK1gfeKv1dtarv1IaZq32HyJusydjjYmpFo2+ZdBVWlHwLtifrz+Tl2lqkMYjN/Cy4Vip4Q964dZCbRz2j2P2BUb3T8i9QBJe6lieK663Scxu41k3/jwO7QqRJAgqR4Q/Fc0xFIImcD0qkMzzWBCW0wXVA== 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=kXrRNUMg/3j5r6FJPWwA5nnqg34uucbmkOIn7veJ/7E=; b=hOUGMHwpT2XwhpIe4M1+aRivTKzIY9R1sFdYaOIfssEx0hcWukP7xbDRN8l397LhoToby8Dw8MThUZLQhN2wQONjfeKRH5seW95+v6ay3HGLEic4SLogNu6arR8ZsEulOAUeNep20qdU8RdJRIE64CdpeIHPB/Qy0yLvksICGgs= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by DM4PR10MB7476.namprd10.prod.outlook.com (2603:10b6:8:17d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.28; Tue, 30 Jul 2024 15:37:56 +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.7807.026; Tue, 30 Jul 2024 15:37:56 +0000 From: Nick Alcock To: binutils@sourceware.org Subject: [PATCH 12/19] libctf: link: fix error handling Date: Tue, 30 Jul 2024 16:37:00 +0100 Message-ID: <20240730153707.168357-13-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.2.276.g4ac82df17e In-Reply-To: <20240730153707.168357-1-nick.alcock@oracle.com> References: <20240730153707.168357-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO4P123CA0448.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a9::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_|DM4PR10MB7476:EE_ X-MS-Office365-Filtering-Correlation-Id: 365f17ce-4a0e-49a0-7760-08dcb0ad9575 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: bx4/Nhz4yL7KlppWWqZhD9SXLGCoaqodXXZwmqLSpuZ/ciPhk8O9W+ADuis3q/QvHa/WUUeAzT45p3weciyMqDcVOzZvRPxOW2CroZ+8XE8FgvJOHI3IFVeDlVprkYa+CswemLb9PLGms14ostWWuCxkkkU1LeL73fQJiKDZaQc2Eqc/oxuEswaT8+qSLIP19xvwKXOmjNsXfwfKzH105tn2yqfhVHAIfyjGM38gXllYLfmw5LZTQL0FsnyNl8WZ/FCAPrqnkVlAoZXTSEu/NKfrbyRx3HbO8Zx25RqBSlvNuoZVXq2ljy1HB7mkM13ESp9dH3F/hVyE4uNVwsjXJJ3sW1axGK0byW3oiurj9bKOaHpUZ5gWkzuIQZhmBci8rBts7TGje+Vq1p6X81URibuu/K9fvzYTVhxeMTCHM5R3JEk5qJ2AnPGKgK2xT+Ly60NIdWnY+hiyhbAKcFDBWEDLHZP0ocNfwMewAfbvxYfp6V1aqCoS4TsmW38yUdMxhXKbDkD7OABxZZFMF4mL/kcPtFOwpBrduX72/I6LbheMDgjbwCG6CQ4RIDZ9e72yBHjofpBlbAwuXMyGedn/45Lrexnzx0f9VOcAoUEEKmcsM1j4dGbzE+xgDCBQSL+6rMmdl2kWMXqHHZC2KzVwLzDV1rhlZTbPn2vE/ZcXOeD1QHzqFurBTwq/p7wWkc76zFXSbyBQaYgi3zRsLDZof/WWo0WInzFvbryTdvqiy/ksSbVpQgeusI3C0ezF2NAgqTmdktOlYXn/82LTLjZXJqnP5m6Kz3xjs2gB3lFbYKvWUGbsNPyd0cRrMoP1UFOvizCJbeY6xWvWOzv9MR/cjzJIRZvMoE+jkUjEuxmlpoWMuCQakK/70NhXooajjwmcbw9dl50/EUxjp7C3USMhvHpXSZFSX33FtLU0VtA4uwwbzLHOGdw01I/qbRfbwVQk1NDzaDLM3nL/g70OHFiXo8Ge3MCJ7J6NQT1a+Lz1kMsqfWcMmDhYs00CJcwUxNDAxy542A/CPClNmfH6BJNlYGsUoPhNwixboKbkhxiaDk5lJw7kSa9gMOt/iJgJloDjK69cFPegA8OvZGaRlPTG2ORfJigU2i5XNVhczKxGO/IvVKEp5ulFvGr9tRW/Eis6OX/UBpn8YejVKlnTGwh/yz5Cc2RwXy/BjGWh9w5zz8eOntQBJg15oHFgP91Wj3YmfeP9J69Sn+79NWTQNU2NZMSSNlWPmcvpjw+hKmC4VYX0h9+l+56ac7JGfG/khNqYxIGzXB8SO/ePKX/0uBKP9wzVMFPvkFlE/818xBolkn8DiLYQv9QoJoUywMrreayHiN4NrMDD4lP0dxhpXFAiyA== 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:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PRePk+T2nPUn0ePQ6CIYqJi6HKiICmVTJ9hx4z5KCY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UAaQ16XeSnwlED5s8V0mE1afXSLyJc3CFxrECr8GKnw1peTKgwX7vOPSXc5ixxUOHL9GG0Zpz2n3QRZHBdd3aFx+OSCxjqXmcm4m+8JeZSJ8ng/Zt547zE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 365f17ce-4a0e-49a0-7760-08dcb0ad9575 X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2024 15:37:56.4006 (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: lRancBZbDq6a9pvx9L3J7elKkIUWbl8aM5l7Y7W9TQyaN50eitXMSINACI4/wNe5C4FyV1+XevovyC3tRcbKXw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB7476 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-07-30_12,2024-07-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 malwarescore=0 suspectscore=0 mlxscore=0 spamscore=0 adultscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2407300106 X-Proofpoint-GUID: NrGxqiP72cVp6NHd_SoghIa0h_VwQJj- X-Proofpoint-ORIG-GUID: NrGxqiP72cVp6NHd_SoghIa0h_VwQJj- 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 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 We were calling the wrong error function if opening failed, causing leaks. libctf/ * ctf-link.c (ctf_link_deduplicating_per_cu): Fix error handling. --- libctf/ctf-link.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libctf/ctf-link.c b/libctf/ctf-link.c index 42b2911e4f2..7b68d709628 100644 --- a/libctf/ctf-link.c +++ b/libctf/ctf-link.c @@ -1221,7 +1221,7 @@ ctf_link_deduplicating_per_cu (ctf_dict_t *fp) &parents)) == NULL) { ctf_next_destroy (i); - goto err_inputs; + goto err_open_inputs; } if ((out = ctf_create (&err)) == NULL) From patchwork Tue Jul 30 15:37:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 94801 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 B5BAB385C6CE for ; Tue, 30 Jul 2024 15:43:48 +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 279E53858424 for ; Tue, 30 Jul 2024 15:38:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 279E53858424 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 279E53858424 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=1722353884; cv=pass; b=fdVRqfBj/OSEiJ0J0RTaI+h9jaP9fnC7PXqirtfYqbSy4YcGAzJhF0r7GeVQJZzKt4WXdYKssLcW32nij4FjaGi5N8V2az1lSVGEjOAbIxlHCwyULBFo1ZpjHzjGKws+yywz0C0+bNxBcdJToA4hBzwKarG2PObeFc7u//DtXYg= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1722353884; c=relaxed/simple; bh=mKoqwZ78cLvk0u11JrC2ZICJ0jqpeosJuADv0Jj+c5g=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=w1vXeRpYGDzPmVR5LzHSEJLeL+NJZkGYjBNJvQX23lHmNfcFIMeHLS7YnHTFM1STTT/hKGNsbh/hiKQ5ydDSdr55YkzJ0qE3kpXdwGbiR1KsRjWA2jErT2gRqIVZJszj4IgA1e4hURQEJNNsjSFhL0jK9heY387qmYHWD289reE= 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 46UFMbqT010404 for ; Tue, 30 Jul 2024 15:38:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=Z2egVMNH/3eAIh+ezRhR0DZFxySgCnqJLdguMZim/RQ=; b= mXJUqhKc8gKjhCMSI237SyznhjHSjhgzU7uRvMGiGm6Het/FfP82xARPERL42x2x Ab9EBOtFhO7XistwDErvoWUochvl722jEI0uPXPyEODN15DqTBNULkUGe+pGk/z4 e+VoWA6nLwJAoNBmeVr0kYPuRc/dY9MoUWh5dHukDGNc6NTvXxY1rwCEeFMHEbTc 0cMs+K+WL8upMRyhL1FxoDlrNgbBiYJCaFYJlUZ9mDuWMCtAZnIjk/z1MtW90cvJ aYJZQRg28za6s8PYRB7VmM/ZXZCqvvIB/QcrmAKIuX9AnVuVbxpZlm74N9qL8xdd z19kxNa+0YPLpobju7Xfew== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mqtanc5c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:38:02 +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 46UF7d8D037936 for ; Tue, 30 Jul 2024 15:38:01 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 40pm83ebc2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:38:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=J+ppp0jVUAfufmGK/P2vQGupHkjbCVXOgDclxRUnZLqXqiAYcZb/i4OAgA8Kid5UY1w9QFtAqNcTNJnCDH8yat9eVFQnk95AoAqzJ22TPtxXyLk2zwvVNwQhXzxQ3AbR1iFiHql2u7ncqn+vq8qNRrqljhCihwQ6gg+J/SBbYfjyiexxEY4i9HEAycPYBZzPLAwF61rbGVgRJ6K9ie7yEtKiWNeTTGA78vcsQDyUzkMuF3OQmqsPABb2MPc0WBPygQaj8pKJpCYtltqbgAjtEzoqOPLxxlEZoy4NhIdPjY/Mdua2u8d2uY/5SxgG9UfAFnE9q5nrtBFZBaLIQCMkpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=Z2egVMNH/3eAIh+ezRhR0DZFxySgCnqJLdguMZim/RQ=; b=wdzVc/PzXR3vuWKirdQ9DFG3E8xeB/QVHpWkislkmWXqYs+h1aKU0gisKmsD91BZI8W1H3Y15zZrvoMe4voJW6hyva4xh4pzFYrTtUWdoZCuiJC0KotlPT20E49W/26MSahIajgFGUrrdodZ6rDJs4miCTaXaGGcTXQgnKUSaJQpLLF5Ctq6ql6V6+STaqdYfNMz9xQC2xrus9p3A3LzKHjxuTDj89C7EajwgXvGo1DhNj6Akp3qLbOr8gP4EzrmuIN3O3jm5n3riUexh3y0vtkSoZFt+SEBmgc3SzT3OhTLQA027vJDPVZudEtp1J8q/8LL/4So37tsHNZGrX/w7A== 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=Z2egVMNH/3eAIh+ezRhR0DZFxySgCnqJLdguMZim/RQ=; b=EREgtTddDq4eu5LI2LtYr1KTUWvKFoaad3JGhMmNbHjJCFo5P8146JxTsdfCTniPs3cXg+UCd1/Pz8gF4yMKIF2K8cpV9UWXONlXee1zkhhzcxh/k+9amp/2A2ovRc7htcNaQfZYrgx4FptezqV/KPGpuN2DF/hSeN0bRutlA0g= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by DM4PR10MB7476.namprd10.prod.outlook.com (2603:10b6:8:17d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.28; Tue, 30 Jul 2024 15:37: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.7807.026; Tue, 30 Jul 2024 15:37:59 +0000 From: Nick Alcock To: binutils@sourceware.org Subject: [PATCH 13/19] libctf: link: remember to turn off the LCTF_LINKING flag after ctf_link_write Date: Tue, 30 Jul 2024 16:37:01 +0100 Message-ID: <20240730153707.168357-14-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.2.276.g4ac82df17e In-Reply-To: <20240730153707.168357-1-nick.alcock@oracle.com> References: <20240730153707.168357-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO0P123CA0009.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:354::14) To MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR10MB6608:EE_|DM4PR10MB7476:EE_ X-MS-Office365-Filtering-Correlation-Id: 7acf7806-cbd9-4e8d-83d1-08dcb0ad972e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: Jrq/e3STBQhxLWFgnsPxD/bpuvfZow+T058WO/UdNdNfmtVv6LuMQq8m1SQ4Xg95h2Shzm1KprHU6mAwFi9/+6NxC1aU6pSEXtgwjpp0j9E+kqW4HUwLIyEViRxCnPgtyTsoKBY3mMCo3cg1gubmXWQqd+tWXYYQzpaHxYkQTpSfV9tG34uOLLADmO1TtvYm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pGomUwyxdSHug70OFbqmDbhV8zAAfB1rR0B+MoEHIlj09lU3tQ/dSIBHYXdNUPnYIc5GAqYT+ADhQA7OqPgJkxg4ivtMAw== 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:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4Z5Y1yl1zKkxa40VGTeAtVBNaRjFSmQjWATXlfnoEOlNayeaatHsT4YorVTcUz9xCloKb/O3IH1ZTVymAytVWP5ZlECzGgPVnay6ML10Dl59Jn+2Jp9nHLnUNnTodfcYTXcPtloCbGMRhTSyvSVx4k52Kj8/4p3CwK/SrgnS+wUcTk/8byDQVRcybC0CtAK/v4ATsF3Xyt2x5zgewrTjFmnSxzBaTk99mNJI3s4sDBPzLbimMI45dpwoDAATC3CrniKC/Py9uwyqqvNLtG2Cb/iX/bfiphPQcu3I5vlRW/A43kFAXgaDFmw+ubLKXhp4Iap262OJIo95MKNCTc1dyk8ltprqInZPutVoFr2pZsjpo2nOeyXK167T4fP93gYLWCFK12wenmDuj9TyOocNo/tjgeZ18+nmVYoVieEPxXO4gP89yVuhBXp8wW317Ttmiz6uHqBXeBl2ZeNNFn6atgcQ1rvo4p91k0pCLIW+BDOHpOEAO+AAoZdq5ODP7oHlGuEyP9g5DipaarouoHsjQdrAVm4IhNCbdSXwb7Ww9Fr8m+J95uN2ojii0i82vIvBmQDb4b/+eU6W0GWdy3p4vEoYkJUhb3RZkw6ytRxAsglhUgnYwm0/YyT/4LJf3sAVyDLS1eGnPuEqXS9W+Q4nje1MIajZlQwhO5c1iXgP46qXhLkCJa7GZLWpXXFr1/9+MbhFgX6QjV0sBGUjq/8iUs4VWCgG/EciOQUcYFC7ArEdLGijWEnBQhT1wDXdIOF1P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SfLfbvPRt9h7GAh/IFUjkVNo+b/+AhPgR2d5iS9wKYfRNsKV13c32sUWbaarzmkMSx21sTR23iQnBkN7bdSA+vulOXX4LdW0g779ioE/ho2Rnxj5D0sQ4Ujik9N+bZNysoTr3S0ff/vwi3sS618KzVDA0l62g1Lg+q0PtfG3bfH5hKtghikHDeddoVvV7mAp3ryAjyQsxX3wsI9FVCwF8ZQvfTvjkS8qHiPYgvQ8m+Yyy753HjBGJFF3V6aAeojXS9frNVyeBo4M+M1vGWeMNU9U+AeHwdKb54fZWHrvPn7vzXPO6d/mhHFfJQ4QIL65JJA4i8neZliHv6AFVVFucLo0ZfzFbNQrlbipG9mDzposxoBPZi3/H6x2sXd4IydLp/CD5OEkFb6QpwfVvNFGDwUX967nQd+T7+qv+qW1y2H+uTrNnWPn7bdIIOSCAJH3USA1uSc4G7Ce2QxBCZA9/B0CcaNJNSgM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7acf7806-cbd9-4e8d-83d1-08dcb0ad972e X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2024 15:37:59.2750 (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: ZcG0sZuYWg7Irku8O3KA0y05JLQeL7HNSZRcgxlj/r1W2gJRGXBD0lIisR/+v92CubTk5X8gRoRmLEtVWrdxKA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB7476 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-07-30_13,2024-07-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 mlxscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxlogscore=680 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2407300106 X-Proofpoint-GUID: rUqDHY8enTLlr-f74zSyUkBgaKSeRw74 X-Proofpoint-ORIG-GUID: rUqDHY8enTLlr-f74zSyUkBgaKSeRw74 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 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 We set this flag at the top of ctf_link_write (to tell ctf_serialize, way down under the archive file writing functions, to do the various link- time serialization things like symbol filtering and the like), but we never remember to clear it except on error. This is probably bad if you want to serialize the dict yourself directly in the future after linking it (which is... definitely a *possible* use of the API, if rather strange). libctf/ * ctf-link.c (ctf_link_write): Clear LCTF_LINKING before exit. --- libctf/ctf-link.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libctf/ctf-link.c b/libctf/ctf-link.c index 7b68d709628..3bfc36ed9e1 100644 --- a/libctf/ctf-link.c +++ b/libctf/ctf-link.c @@ -2040,6 +2040,10 @@ ctf_link_write (ctf_dict_t *fp, size_t *size, size_t threshold) goto err_no; } + /* Turn off the is-linking flag on all the dicts in this link. */ + for (i = 0; i < arg.i; i++) + arg.files[i]->ctf_flags &= ~LCTF_LINKING; + *size = fsize; free (arg.names); free (arg.files); From patchwork Tue Jul 30 15:37:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 94803 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 A7BAC3857011 for ; Tue, 30 Jul 2024 15:45:00 +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 BD91C385B50C for ; Tue, 30 Jul 2024 15:38:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BD91C385B50C 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 BD91C385B50C 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=1722353887; cv=pass; b=GiqqrIaGTEz7sHlN8ObypqpFQ3dUSmlu/XWbrLNY0lps9KeREBMbknyvQcn+9doWaionBsK0MrOfqU/RpQYLflledUpPHa6ZK1aapQ/nWP4rhdg2NzBkZwehlJLP4Iyd6Zi8JL4UQzUMgYS+yPDN4c0KrLGJBi+GYdPxKVedytk= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1722353887; c=relaxed/simple; bh=mDQDDQCgNtJbjMdpeokNT/HlHJT4RsQqaaa5sPTnGWQ=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=XFaugIgJyuWA5XhFvtF6ay5ITawyJ7DwTH5fGLze5QjNmzsVPYCuUhYtElZOMAUGFRxeCeKwsN7tQ6Qcpyfq5OdI8KtxJrmlgOwbgRwc04Ao/f7X7skQ6iM9RDJZPM9ULAFiy1PyCxy0uYRTcEioyeb0hBTdAnnt4q7TzYKH7Ro= 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 46UFMW6w032644 for ; Tue, 30 Jul 2024 15:38:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=darFDuIty9EhYqohmTaw75ZLmbWxwqykWih1EIs+I/c=; b= CM9ko7TVM8BBPANcATb5M2JjXOV0Ob1S0TbpQ/mpITIJoUltRjmY0NCzVrXlIzuz haR2Zd2olhtA0dF6VNNemmudbQP/B5iG71mqUV/KB0kdua1DJtj9rztGmh1c03fS hYWXikqUe9ujpyq2dK3ymmCS3X5w9477bDBZgk4NBp1TWRQyURMoCdjW53QLLaGM C5a8k6EzyNHwacEF73unbwE3Onpk9BRCulZloRSoBzhLekIuUSta8Ee4FfJc4Tau o1Q4X5mVoXEAC9D+4iUCgQxVnD6bX+sz08L3njfZs1iLCJ2h36PkeZKO1P77QRu+ iKSkeMQawo5u8WVOc0CcdQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mrgs5bvu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:38:05 +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 46UEuGsS037961 for ; Tue, 30 Jul 2024 15:38:04 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 40pm83ebde-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:38:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=q8aDMiUxCxjpp68YWy2iJX7qYvcA+rRR3yneODlEUUZqakUvJZIPiRMjRqKlq6JYH2VcSZhWQR4I7bxIsu5NvZwMGFvC6mcRI4iO2dyESn4FdmVPLoDtKqmhK6cAaWvaD2ZIr3Kvt5/n7icihH8Y3Z164Rg5ZB7awiJR1GagasDd/VxDwGoKMnq4fiZaIlJQ533HDxQBiH1wMUA5CTnqv4EmuHc/OIrtsl0KHXDJt329Hf9dysQ/aJRQcQ6LDTC5RruJHNDSMmLQbOZtQoAnab9+QCglOpY6ZdjeBN3094EZC3H6uAwacbqOi3zUhYIyAyjAcLCwB7Zb41qTsPIbnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=darFDuIty9EhYqohmTaw75ZLmbWxwqykWih1EIs+I/c=; b=HKsjL2Me3yaWz5e9mINUI/ov+DTJHFa0+95V7qYB2Ca9Asv8yGvXwJw+XV9AbG/0kjRY8reSIOqkAN15/bdebbFxwOkel7Z6ijBw1dkiJkd0C2xN7kDxXf4pnbEYueZdNVqFs0fLawOkpghR+L1FY40ldGky2KmIa6XuaZz2hLPIdDTWclM5NaZf/v5Z/+w31OLRRK/qJsDj9pscq02H52BDJlkE1VtFJeqS7A0z9POG3hQoX+NGFGvv7JIyA8aubxEiY/Prg2178BT/tO7TTdDpsKXK0XMphZ2Rv1HBXdxL0zRLe3s1r0ynLrFzw367BdaF1JoNVN4Zdy3ssmzfzg== 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=darFDuIty9EhYqohmTaw75ZLmbWxwqykWih1EIs+I/c=; b=N0EmgbjFJvARABtGGCL+6HCmBjIPcgHr0P8XzTSgotJvt3UMFxKQItZ0QPlE1WRVphrKR5Li5MJ20L/5fqYtdO5vbk25Awobr5KM+BBqNn7uN/wQoKEXUGUglZhfkbTjPFU335lY9AYaicWEOluXtk94F0YmSIIfTiA1+MPHzMQ= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by DM4PR10MB7476.namprd10.prod.outlook.com (2603:10b6:8:17d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.28; Tue, 30 Jul 2024 15:38:01 +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.7807.026; Tue, 30 Jul 2024 15:38:01 +0000 From: Nick Alcock To: binutils@sourceware.org Subject: [PATCH 14/19] include, libctf: improve ECTF_DUPLICATE error message Date: Tue, 30 Jul 2024 16:37:02 +0100 Message-ID: <20240730153707.168357-15-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.2.276.g4ac82df17e In-Reply-To: <20240730153707.168357-1-nick.alcock@oracle.com> References: <20240730153707.168357-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO0P123CA0009.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:354::14) To MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR10MB6608:EE_|DM4PR10MB7476:EE_ X-MS-Office365-Filtering-Correlation-Id: 133d246a-b2cb-43fc-d7da-08dcb0ad98bd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: XY9VTZqb0pBuFiubUd0FcORGGe7u6CxEFxNY/Ssi8qISPWfJ3iOXGfI9L/iA91Q8V3pcjCIjTCu8uyPrfz4M8cyJCw/LK0YbWMvK84OaVsMNlBAfvHtbUGKo7CryrbQIlotI6HDtWQ1woY3KmPRfV33iTKmiHhtGCGkbhF0VObJZe8sHy7931NJQHlF4797B8YItQyCtuvwe3oPSzD0TQcFAhlDQqUEYW5F5wDPZ7IEXH33w+ZO2sdDuFd0y9tyMmRccxAr8FYUQpU8Ski7jxudBP6DSclbBcSgxaIFIRyXTZ+dyUyl8mcwsjie6oGp2vnLLWTfRB4igVwJZPnJXSiRlSiJXuGgO7jphLHHLDWkpf7Pvhyw0bgUEZx4ARTL885DKUHhHJ/aHgTxnsJ+zlY3GN7vrpdy0V9hui1jmmNPAG74apiRnbY1fZ/eGC5b76imu2lLiKtmBAKjUGxy8QiJmxDzx3311LH+IQfHtc2yYED453tQuOn5ox3VGiazweqLfquh0kfleTOVvpqkoVCF21ZpTx2xr3yYLOKUz9dPJXcBHchFIfRSW2j5MO37aU904XlQCNgJr7at7Dekat4B2I70wNfEkI23sRQyIFFjtK5YBriNRcy86PNIp8ofuQt01QXhlOGg0Ax8nbnKXNPqLlCeBDh0v2bRZB5kHiKMfs2T0k4D9zupLi/456nkG5WwijZxRhQDfOjfvuxNEzOGyuctQySRthTe95XYoWlIKZH/jlmkvk9WDhEBPeVN/JTzjmAi2bPkIJvBuwR+VmWV52+04C7cujKvShjR8ztZ+0hY07YvOvfWdRN/ksqUnYVhcjNuqTfIRXK04jt4cve/qADjtAmhOPqyMzWtQLU5lKBdUJDsjQHFRjzbr+s855+HWIkGlLExvQn0SymEfsrjg+mY1JWsFQALrj3iwW0lmDDzADxQzkYqrSKJIKFVIPRcfxtZV2Jq5qCgu7bI1Ka/68qQUS6Vlo/vdG+CHZ7QdaaAjnP9NVO4Vw1s87SN7MODseHLjqPWcZxkUl6tOpdRO4fGCrKgYJG/LrajgtFDEobqb8o9d6JT9MJGKuw6HGckP5u6vaMGzfEYqT16iNjansDlu8sEfG/DDGd4FhEc+szYZPOTcbkPBGJEDH6pUrzWRqgkOFMR4yL5hFaFxIN8q7eQFRZwb2QT4ozmkWI/EhwKbE7VwkWFP3vA6Z3eUNGuYv66VvMcZCZpuq2dUnFN7WDGWbJxiOUWjZoLxOT6rdhILYi6F0fH0S1rdTt29TcF2yrULRM1J3QeUZ0OJDaac0u60zWif+0KeX6TGyw4PEVdX6g4w/JU1KWQQOPsBwV9sXcqxKZwohf+FgGqxbg== 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:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /SAYcnyMqJptuj1Th1mT4kTNYiL6Dz6jhdNO8cqSUE/8VDTywYFYb08bARfEz+aoCnx9U3uo9uIvi9SAeBNff3ct5KmPM4gUReC4vXx8cMvAwzjg8sJA7SOjqg4cOhkESNA7gk6ZboyzLaGs80TzXPJfIJQVXSsVDp3857cwryenZ7pRo0cjWLdJYcXexS/AYOt0mfB8HAIv55U27gncv/MWwnVhnyjNqUHqrWDW3tKvIiYXaBkc6pEk8ukEa0vskC38PHJP5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v2rnB5+PPmr+oz4ThCofdf8p64WtLtzj0OGtLwxL8oicXD+ta/NeLBvHiFgV5IDuOqJS5oDnaa/lL0icKSLdeuV4+fwYF41ixIkaJxEuzGTeBMdNBcIoGF/kdqbstun38UaAqdk0AZhVmja/xClR6AxHc52ri8GWSJ3Hph4ET0dyvBanVaDBUC144hmFAJ+d6uB4fV4Jj/fGSt6E0hvtOFigUZKrla7TvGLe8N4CX7Ao2FoN6mShTIMgniD9fcZHF8BHCnNtTCOmUasqK/Hrod1IfJaERGA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: XS1d0LDNsjnwQTYc5BMe36NbtdGs09J4myhM8IczSQOAr1G4sWRuj/qS5tvHjHldPwbBH0/VJX36KFKjbXXGPQOCy31w8Uatk4fo3330Jqqo7+9wzYWOlzcBZxc70ShwE8fMSpVTJXyLnDd+FbEreFmq2nvS/SEHC/BC6+fT5fFZ+MRKtuZVmJNsiawrDu6n5Bxl+A5+ePHsOt9mIT/jdYZweph6cbvc/GTJQJ6y06A/tUNDQmcHISMv3K+2bvdNwwqnMltpXpzdLg0BnM5FQpBDcsU9yDR6Exqn9uO52Qs727j1+NqTlq2TFakyAueyJspU4Q+luzNa/SoxtIg1FNQYJilD0wT5DbrPvnN9DF6R+2bnte1Vf3krms7ZcZiNJakjHW1qKuEaqgv68zSb3vC6zdwAX9qLmYztByX2/dscdljMylXMLBpseja4mTbzwkFqBUgenlj0iLuSAupdQtDg7zIWfqCfgB81GjgfBFD/3DWY8tmriP9fMK+jSMPhwfHHwXf2G5zZPMxIDRhxA1AcZbgR1L21pJyhyesuvk3z6VNCeTHYIj90KJwgi65SuzmKoP6/31Tp8f47MPifOtunmes2H4DKTvjJ6p2OeZs= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 133d246a-b2cb-43fc-d7da-08dcb0ad98bd X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2024 15:38:01.8814 (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: mn2CdDHLBXfLoGQU2Wp2zM+5o9XwTFaqchH4sw+GtN7yxoOdinxYBS13TUTuVNI57LtrhlJDdUYnhiHC71LCCA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB7476 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-07-30_13,2024-07-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 mlxscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxlogscore=948 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2407300106 X-Proofpoint-GUID: CDW_3ug7zJrH4z5UcVLdhVuTZWgSm-lQ X-Proofpoint-ORIG-GUID: CDW_3ug7zJrH4z5UcVLdhVuTZWgSm-lQ 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 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 It applies to enums now, so it should mention them. include/ * ctf-api.h (_CTF_ERRORS) ECTF_DUPLICATE]: Mention enums. --- 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 ad5add23706..d3d8dbfacf5 100644 --- a/include/ctf-api.h +++ b/include/ctf-api.h @@ -225,7 +225,7 @@ typedef struct ctf_snapshot_id _CTF_ITEM (ECTF_RDONLY, "CTF container is read-only.") \ _CTF_ITEM (ECTF_DTFULL, "CTF type is full (no more members allowed).") \ _CTF_ITEM (ECTF_FULL, "CTF container is full.") \ - _CTF_ITEM (ECTF_DUPLICATE, "Duplicate member or variable name.") \ + _CTF_ITEM (ECTF_DUPLICATE, "Duplicate member, enumerator, or variable name.") \ _CTF_ITEM (ECTF_CONFLICT, "Conflicting type is already defined.") \ _CTF_ITEM (ECTF_OVERROLLBACK, "Attempt to roll back past a ctf_update.") \ _CTF_ITEM (ECTF_COMPRESS, "Failed to compress CTF data.") \ From patchwork Tue Jul 30 15:37:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 94804 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 0A84E3857349 for ; Tue, 30 Jul 2024 15:46:12 +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 01854385C6CC for ; Tue, 30 Jul 2024 15:38:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 01854385C6CC 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 01854385C6CC 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=1722353894; cv=pass; b=cX+GGi3BuHg9otlbgRAB6vI4dubOt4lPdZJE+Y3KzMhtXukM7WzSjg6WannscKK1dhhllwKuWmlrdvcxFdDgHD19/7eBhTjcsYSoXua+jheG1imfok2USKh59C+1S+T8chJIFrzZcZB8GIt2PyQq6/7G+HXfLCFP0ovq4NHGF9I= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1722353894; c=relaxed/simple; bh=poJ4W0seBVp2z7FuNS5aDGGBOAv4/F2MI8kdWHwySDI=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=XQSeoM/7BaynF1vQTVv9uuh28o4Ej7hnyd5EryuQTF0aLT75z8Lgy/ZYL3N9OL/vURPkcWJRAPiEx0V/c29vQkibozwl9FQocObbOoAHf4tcOc8SuZywphFytg/yqJYnbttOlVAySR42wdBNEuYV/RZe9fMl/8uk8tDh191w7os= 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 46UFMjKf018702 for ; Tue, 30 Jul 2024 15:38:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=aragLe/AOu88H2eM08RUuyU1bIWaPjqBHtoifqEjTMc=; b= YRoZGa0YLI/6Oj7gA84mDw29Ec/96o5ohpSzxzrJ/fYIuTHbgh1pzJyNJ4yArPpJ w8z8dJaE02zGLMNBl2xXPl7faazL1UlM/DCRkPO9zqJM06iqbv+AHl15pyuap1EW InTUMSS+8W1MFBramG/hMftJBbszhWaWDO5UN2nQaiNE38m2S1X5RrEdBBfxZFjx zeAPPvGcyaAPZxILrGoTjT7I2TgH8TMDLtnoDfSP6hXLMPKyF6Yr/FPsXqXzV6nm vtP57n+sSC40tHeJmaHj/YSB0UKcfZJZECn01DAu56mP7WS8STPQWFL1hSi8WvdT qoDTmu/apOGFyY+0odayIQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mqp1we3k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:38:08 +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 46UEtPwm038581 for ; Tue, 30 Jul 2024 15:38:07 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 40pm83ebfr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:38:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dRNDs41GERDJxyqbP/z6BWhfH9ElbDQ3eE6hLFqGeTyuN5MBD/IMQBpYIa1G3r17TA151E/wIyr0EeD2LvGX//3UT5WLXuFR2E0lrKv/55BfFnpSJKOoXrvQ6wKR1sk4mZbsG2lesGcQmePt6JDjeXiTlw5NTCQGJUa0vzQIi4N7CHHy0ADuJjfTfUv0wOBouhhHGvhZzzWH+U24XCLwQMpqNfFBhScbZ1lJqCl70cAzCSOYPbSQmXKqjfOzVX9RgIIea3D4E85TeB1Y9xLJ/sMEhRtQNbIGdGHVQ1WxktrIh8Mhkad9e+lHTtvCsBximEpSnqUakaFggcI5S6bzrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=aragLe/AOu88H2eM08RUuyU1bIWaPjqBHtoifqEjTMc=; b=O7zMYg+upbywuet6M9jJgj50RoPZ+Bq+xfQdZfftRZyotOdoJrdQ5rIB9y/137NI33FLmEzn+PepcjSDSLVZndK+DYwYJFcfJs+hWNn5PNJtrsMD/dDlmAe4ANUmwtB2r7czXHakk0YD1ouM/Zb0/Jrknw2Uo76hb2fsN8Axm2HfvzmJ0ykcOhdFUZzC1hfYc6aFLlIaKtRaQ22OqeafSl3WUuiT7y6dmitSm8VVibWZQmJBLG/HB68vyttm5GC7UyyjF6prZKq1SdYEU9wqJbD8itkY+eRaCqZTFByssXqYHk0U4udclddWhsjlX2a1ZvVzkcipYmqPpI0NRXfvSA== 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=aragLe/AOu88H2eM08RUuyU1bIWaPjqBHtoifqEjTMc=; b=GGlArU9SNhas4fJu/gAw7bbjGo/odAsZTdt5YUgVpWwOpReB2Oz1MwahMOP/Lr6ysW2Th6VtE8f1T9B0TsJdznPeppqM3APau++9RfwbMYEkkzTG/Xj64NnEqFpuLjxZI0dKcxXLmgyNFwBMOocpotmoh6A07pUEXtB4n3J8j78= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by DM4PR10MB7476.namprd10.prod.outlook.com (2603:10b6:8:17d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.28; Tue, 30 Jul 2024 15:38:04 +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.7807.026; Tue, 30 Jul 2024 15:38:04 +0000 From: Nick Alcock To: binutils@sourceware.org Subject: [PATCH 15/19] libctf, include: add ctf_dict_set_flag: less enum dup checking by default Date: Tue, 30 Jul 2024 16:37:03 +0100 Message-ID: <20240730153707.168357-16-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.2.276.g4ac82df17e In-Reply-To: <20240730153707.168357-1-nick.alcock@oracle.com> References: <20240730153707.168357-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO4P123CA0054.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:152::23) To MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR10MB6608:EE_|DM4PR10MB7476:EE_ X-MS-Office365-Filtering-Correlation-Id: e30a6b7e-8c5e-4424-7152-08dcb0ad9a4c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: Q4nPWPKv1IRut+vyH+VdjsmDJJU8qLXf15EZ+W91SrQxqjo9InIXVjjQaIG8xknYIBI0cxBy77HqTzm2P93m80HOp6aoP8UJeMsCyvRyC5pk+CB87r2Nd8u/r8/T1uT3B81eIE6YKMcWcNzDD85+iNcFUa2B/8VNrj5vtKo9///xwCcbn5O9bje1CxtG0G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JeOKZqAwroSSl5gxsv+WsetCw08akvrl9/MCeqhJubCEh19aaPNrIA5eH6KCqL9Vtl0c56PY4hixeOC/Gi4JiPH+UstjpajglZA9rQ== 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:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1P++FHRBTt3Ip5tDJB/pFz0V/EWbn/13MhjZkbQnkxuOEGAMAQSnQXRFbTvg1rLMADxxxQTOHx6Xcokf7kfAGSkc21xBS4KfKrRltuSLT4kBSeDK2qtMPqToObtV8ACsHikvIKiGux8BlG/rFeENdRZIySK/MzWBJGyDaVCYJ7V1J4MxIDIrDpYOJ5UKZfMeOeu0EthAV4Q6Ho4syZS9zFDVfgt1g8fSjJ+lk6Yv0MLxmCT7Rky0oRVPF+4Hck3nToQxHHYoUpqnI4H81Arto1qad1p9MmCNLNydXhFOVLmCuvuwpCiQJVC6oi8vHk/pG/fp26VB2c35VdrAJ/IEe+QYmJuGhjWMHUUDXUTRlfdRaDjgslSYqPUGJvqppfWKD3BXVeLibzKKsZVbWs9tDXMnNdqTDmoNRJI+yAJfa8UfY2FE74+HqOfVvGwukjwvkHfYZVMC74nsK+amkbimrR59oALjXjRi/arZ8OYJe9OmgReT5f3MVkIMz0vZ99Jb+FnLlOUMD0/vExbbb0cN9l5PR7J2iu0CmcCDFrBB1lyLLGz2CGIwkQQNg7M/V6OFeKHRsLQ29V/v5hKWsGztmuV4r37gPHpJgrxlMNSp1uhaa4HJU+HH8D7LRyPcabli9S1Qquj/SGRW2+twomXKl2Ro/5mFUy24N+1XmtIpxN1Q+ALhJzbvvGZTJpN9kergYqXuuK7bvcGVzIJFG7oIOk50tIFdT/fxHLgGrGeSJRy6nOcBxgYp8Q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aHzG2Rlh7LHauUZ6OOzX2cEZIfI3ImjEV4Cy1ui2sFqjd22tFoeCHIUiTvOdo/yEQAPCdCQ0kCigwLKgrZnzO8blVVpWs2z3R4eyFJLJMdpZQj8Id8XMH/m6flDshZ096/0Ti8U1ZGElBsdILzWU5o2TFq8llm1Pva/cSj6XxNsjyjSiI9rAXCegipK+c9ZuqOl82VQql8ix6IL8qtKkMbkEjwIK31ThIu1uAUVlRukm0S7/YFIqbONKL6sBW6QIQqQpQxI10AtTAvQc/87/2WXpwqlljw3+NP/rbeAab8ZMZK/2HJUYQo64t/k3Lx4rrykPso2Zky5yzedrR1nmHwDJ8wFFg1rTmokizL9ndF81Bn0Haf9PtcaC9FjdiSRkYI/X4gfoWC7uyKEYQC7oWzIqipdxzmQm8JHZCmLpq+1TzEMAWHbOxkbklf6t6VGGp7VjwcNUYsigcv8IAzhLTqw2fZc3HTBVFxE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e30a6b7e-8c5e-4424-7152-08dcb0ad9a4c X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2024 15:38:04.6605 (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: gRwbo4T8BvcPX0AaadhAvCUQ3RP/KNgSSdItFpg1vBWP3O7NncKIstzodhwr+g6Y8GJH/9qmAIQS/CL0PpMo8g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB7476 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-07-30_13,2024-07-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 mlxscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2407300106 X-Proofpoint-ORIG-GUID: 32dF2iSyaRVbt_89WiGe-cUZO2qxT6Yu X-Proofpoint-GUID: 32dF2iSyaRVbt_89WiGe-cUZO2qxT6Yu 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 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 recent change to detect duplicate enum values and return ECTF_DUPLICATE when found turns out to perturb a great many callers. In particular, the pahole-created kernel BTF has the same problem we historically did, and gleefully emits duplicated enum constants in profusion. Handling the resulting duplicate errors from BTF -> CTF converters reasonably is unreasonably difficult (it amounts to forcing them to skip some types or reimplement the deduplicator). So let's step back a bit. What we care about mostly is that the deduplicator treat enums with conflicting enumeration constants as conflicting types: programs that want to look up enumeration constant -> value mappings using the new APIs to do so might well want the same checks to apply to any ctf_add_* operations they carry out (and since they're *using* the new APIs, added at the same time as this restriction was imposed, there is likely to be no negative consequence of this). So we want some way to allow processes that know about duplicate detection to opt into it, while allowing everyone else to stay clear of it: but we want ctf_link to get this behaviour even if its caller has opted out. So add a new concept to the API: dict-wide CTF flags, set via ctf_dict_set_flag, obtained via ctf_dict_get_flag. They are not bitflags but simple arbitrary integers and an on/off value, stored in an unspecified manner (the one current flag, we translate into an LCTF_* flag value in the internal ctf_dict ctf_flags word). If you pass in an invalid flag or value you get a new ECTF_BADFLAG error, so the caller can easily tell whether flags added in future are valid with a particular libctf or not. We check this flag in ctf_add_enumerator, and set it around the link (including on child per-CU dicts). The newish enumerator-iteration test is souped up to check the semantics of the flag as well. The fact that the flag can be set and unset at any time has curious consequences. You can unset the flag, insert a pile of duplicates, then set it and expect the new duplicates to be detected, not only by ctf_add_enumerator but also by ctf_lookup_enumerator. This means we now have to maintain the ctf_names and conflicting_enums enum-duplication tracking as new enums are added, not purely as the dict is opened. Move that code out of init_static_types_internal and into a new ctf_track_enumerator function that addition can also call. (None of this affects the file format or serialization machinery, which has to be able to handle duplicate enumeration constants no matter what.) include/ * ctf-api.h (CTF_ERRORS) [ECTF_BADFLAG]: New. (ECTF_NERR): Update. (CTF_STRICT_NO_DUP_ENUMERATORS): New flag. (ctf_dict_set_flag): New function. (ctf_dict_get_flag): Likewise. libctf/ * ctf-impl.h (LCTF_STRICT_NO_DUP_ENUMERATORS): New flag. (ctf_track_enumerator): Declare. * ctf-dedup.c (ctf_dedup_emit_type): Set it. * ctf-link.c (ctf_create_per_cu): Likewise. (ctf_link_deduplicating_per_cu): Likewise. (ctf_link): Likewise. (ctf_link_write): Likewise. * ctf-subr.c (ctf_dict_set_flag): New function. (ctf_dict_get_flag): New function. * ctf-open.c (init_static_types_internal): Move enum tracking to... * ctf-create.c (ctf_track_enumerator): ... this new function. (ctf_add_enumerator): Call it. * libctf.ver: Add the new functions. * testsuite/libctf-lookup/enumerator-iteration.c: Test them. --- include/ctf-api.h | 16 ++++- libctf/ctf-create.c | 46 ++++++++++++- libctf/ctf-dedup.c | 1 + libctf/ctf-impl.h | 5 +- libctf/ctf-link.c | 31 ++++++--- libctf/ctf-open.c | 37 ++-------- libctf/ctf-subr.c | 37 ++++++++++ libctf/libctf.ver | 2 + .../libctf-lookup/enumerator-iteration.c | 67 ++++++++++++++++++- 9 files changed, 195 insertions(+), 47 deletions(-) diff --git a/include/ctf-api.h b/include/ctf-api.h index d3d8dbfacf5..dd719d11129 100644 --- a/include/ctf-api.h +++ b/include/ctf-api.h @@ -243,7 +243,8 @@ typedef struct ctf_snapshot_id _CTF_ITEM (ECTF_FLAGS, "CTF header contains flags unknown to libctf.") \ _CTF_ITEM (ECTF_NEEDSBFD, "This feature needs a libctf with BFD support.") \ _CTF_ITEM (ECTF_INCOMPLETE, "Type is not a complete type.") \ - _CTF_ITEM (ECTF_NONAME, "Type name must not be empty.") + _CTF_ITEM (ECTF_NONAME, "Type name must not be empty.") \ + _CTF_ITEM (ECTF_BADFLAG, "Invalid CTF dict flag specified.") #define ECTF_BASE 1000 /* Base value for libctf errnos. */ @@ -256,7 +257,7 @@ _CTF_ERRORS #undef _CTF_FIRST }; -#define ECTF_NERR (ECTF_NONAME - ECTF_BASE + 1) /* Count of CTF errors. */ +#define ECTF_NERR (ECTF_BADFLAG - ECTF_BASE + 1) /* Count of CTF errors. */ /* The CTF data model is inferred to be the caller's data model or the data model of the given object, unless ctf_setmodel is explicitly called. */ @@ -282,6 +283,12 @@ _CTF_ERRORS #define CTF_MN_RECURSE 0x1 /* Recurse into unnamed members. */ +/* Flags for ctf_dict_set_flag. */ + +/* If set, duplicate enumerators in a single dict fail with ECTF_DUPLICATE. */ + +#define CTF_STRICT_NO_DUP_ENUMERATORS 0x1 + /* These typedefs are used to define the signature for callback functions that can be used with the iteration and visit functions below. There is also a family of iteration functions that do not require callbacks. */ @@ -350,6 +357,11 @@ extern ctf_archive_t *ctf_open (const char *filename, const char *target, int *errp); extern void ctf_close (ctf_archive_t *); +/* Set or unset dict-wide boolean flags, and get the value of these flags. */ + +extern int ctf_dict_set_flag (ctf_dict_t *, uint64_t flag, int set); +extern int ctf_dict_get_flag (ctf_dict_t *, uint64_t flag); + /* Return the data, symbol, or string sections used by a given CTF dict. */ extern ctf_sect_t ctf_getdatasect (const ctf_dict_t *); extern ctf_sect_t ctf_getsymsect (const ctf_dict_t *); diff --git a/libctf/ctf-create.c b/libctf/ctf-create.c index d6746030918..a7544955212 100644 --- a/libctf/ctf-create.c +++ b/libctf/ctf-create.c @@ -1071,7 +1071,13 @@ ctf_add_enumerator (ctf_dict_t *fp, ctf_id_t enid, const char *name, 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 (fp->ctf_flags & LCTF_STRICT_NO_DUP_ENUMERATORS) + return (ctf_set_errno (ofp, ECTF_DUPLICATE)); + + if (ctf_track_enumerator (fp, enid, name) < 0) + return (ctf_set_errno (ofp, ctf_errno (fp))); + } if (kind != CTF_K_ENUM) return (ctf_set_errno (ofp, ECTF_NOTENUM)); @@ -1094,7 +1100,7 @@ ctf_add_enumerator (ctf_dict_t *fp, ctf_id_t enid, const char *name, non-root-visible types, since the duplicate detection above does the job for root-visible types just fine. */ - if (root == CTF_ADD_NONROOT) + if (root == CTF_ADD_NONROOT && (fp->ctf_flags & LCTF_STRICT_NO_DUP_ENUMERATORS)) { size_t i; @@ -1429,6 +1435,42 @@ ctf_add_func_sym (ctf_dict_t *fp, const char *name, ctf_id_t id) return (ctf_add_funcobjt_sym (fp, 1, name, id)); } +/* Add an enumeration constant observed in a given enum type as an identifier. + They appear as names that cite the enum type. + + Constants that appear in more than one enum, or which are already the names + of types, appear in ctf_conflicting_enums as well. + + This is done for all enumeration types at open time, and for newly-added ones + as well: if the strict-enum flag is turned on, this table must be kept up to + date with enums added in the interim. */ + +int +ctf_track_enumerator (ctf_dict_t *fp, ctf_id_t type, const char *cte_name) +{ + int err; + + if (ctf_dynhash_lookup_type (fp->ctf_names, cte_name) == 0) + { + uint32_t name = ctf_str_add (fp, cte_name); + + if (name == 0) + return -1; /* errno is set for us. */ + + err = ctf_dynhash_insert_type (fp, fp->ctf_names, type, name); + } + else + { + err = ctf_dynset_insert (fp->ctf_conflicting_enums, (void *) + cte_name); + if (err != 0) + ctf_set_errno (fp, err * -1); + } + if (err != 0) + return -1; /* errno is set for us. */ + return 0; +} + typedef struct ctf_bundle { ctf_dict_t *ctb_dict; /* CTF dict handle. */ diff --git a/libctf/ctf-dedup.c b/libctf/ctf-dedup.c index 4243bde16f7..be423c43b5c 100644 --- a/libctf/ctf-dedup.c +++ b/libctf/ctf-dedup.c @@ -2683,6 +2683,7 @@ ctf_dedup_emit_type (const char *hval, ctf_dict_t *output, ctf_dict_t **inputs, return ctf_set_errno (output, err); } + target->ctf_flags |= LCTF_STRICT_NO_DUP_ENUMERATORS; ctf_import_unref (target, output); if (ctf_cuname (input) != NULL) ctf_cuname_set (target, ctf_cuname (input)); diff --git a/libctf/ctf-impl.h b/libctf/ctf-impl.h index 0d88e639884..6373ecb7a79 100644 --- a/libctf/ctf-impl.h +++ b/libctf/ctf-impl.h @@ -602,7 +602,8 @@ struct ctf_next ((fp)->ctf_dictops->ctfo_get_vbytes(fp, kind, size, vlen)) #define LCTF_CHILD 0x0001 /* CTF dict is a child. */ -#define LCTF_LINKING 0x0002 /* CTF link is underway: respect ctf_link_flags. */ +#define LCTF_LINKING 0x0002 /* CTF link is underway: respect ctf_link_flags. */ +#define LCTF_STRICT_NO_DUP_ENUMERATORS 0x0004 /* Duplicate enums prohibited. */ extern ctf_dynhash_t *ctf_name_table (ctf_dict_t *, int); extern const ctf_type_t *ctf_lookup_by_id (ctf_dict_t **, ctf_id_t); @@ -713,6 +714,8 @@ extern int ctf_add_variable_forced (ctf_dict_t *, const char *, ctf_id_t); extern int ctf_add_funcobjt_sym_forced (ctf_dict_t *, int is_function, const char *, ctf_id_t); +extern int ctf_track_enumerator (ctf_dict_t *, ctf_id_t, const char *); + extern int ctf_dedup_atoms_init (ctf_dict_t *); extern int ctf_dedup (ctf_dict_t *, ctf_dict_t **, uint32_t ninputs, int cu_mapped); diff --git a/libctf/ctf-link.c b/libctf/ctf-link.c index 3bfc36ed9e1..0d122e6d366 100644 --- a/libctf/ctf-link.c +++ b/libctf/ctf-link.c @@ -336,6 +336,8 @@ ctf_create_per_cu (ctf_dict_t *fp, ctf_dict_t *input, const char *cu_name) return NULL; } + /* The deduplicator is ready for strict enumerator value checking. */ + cu_fp->ctf_flags |= LCTF_STRICT_NO_DUP_ENUMERATORS; ctf_import_unref (cu_fp, fp); if ((dynname = ctf_new_per_cu_name (fp, ctf_name)) == NULL) @@ -1233,6 +1235,9 @@ ctf_link_deduplicating_per_cu (ctf_dict_t *fp) goto err_inputs; } + /* The deduplicator is ready for strict enumerator value checking. */ + out->ctf_flags |= LCTF_STRICT_NO_DUP_ENUMERATORS; + /* Share the atoms table to reduce memory usage. */ out->ctf_dedup_atoms = fp->ctf_dedup_atoms_alloc; @@ -1498,6 +1503,7 @@ int ctf_link (ctf_dict_t *fp, int flags) { int err; + int oldflags = fp->ctf_flags; fp->ctf_link_flags = flags; @@ -1515,9 +1521,9 @@ ctf_link (ctf_dict_t *fp, int flags) if (fp->ctf_link_outputs == NULL) return ctf_set_errno (fp, ENOMEM); - fp->ctf_flags |= LCTF_LINKING; + fp->ctf_flags |= LCTF_LINKING & LCTF_STRICT_NO_DUP_ENUMERATORS; ctf_link_deduplicating (fp); - fp->ctf_flags &= ~LCTF_LINKING; + fp->ctf_flags = oldflags; if ((ctf_errno (fp) != 0) && (ctf_errno (fp) != ECTF_NOCTFDATA)) return -1; @@ -1537,14 +1543,14 @@ ctf_link (ctf_dict_t *fp, int flags) const char *to = (const char *) k; if (ctf_create_per_cu (fp, NULL, to) == NULL) { - fp->ctf_flags &= ~LCTF_LINKING; + fp->ctf_flags = oldflags; ctf_next_destroy (i); return -1; /* Errno is set for us. */ } } if (err != ECTF_NEXT_END) { - fp->ctf_flags &= ~LCTF_LINKING; + fp->ctf_flags = oldflags; ctf_err_warn (fp, 1, err, _("iteration error creating empty CUs")); return ctf_set_errno (fp, err); } @@ -2040,9 +2046,14 @@ ctf_link_write (ctf_dict_t *fp, size_t *size, size_t threshold) goto err_no; } - /* Turn off the is-linking flag on all the dicts in this link. */ + /* Turn off the is-linking flag on all the dicts in this link: if the strict enum + checking flag is off on the parent, turn it off on all the children too. */ for (i = 0; i < arg.i; i++) - arg.files[i]->ctf_flags &= ~LCTF_LINKING; + { + arg.files[i]->ctf_flags &= ~LCTF_LINKING; + if (!(fp->ctf_flags & LCTF_STRICT_NO_DUP_ENUMERATORS)) + arg.files[i]->ctf_flags &= ~LCTF_STRICT_NO_DUP_ENUMERATORS; + } *size = fsize; free (arg.names); @@ -2061,9 +2072,13 @@ ctf_link_write (ctf_dict_t *fp, size_t *size, size_t threshold) err_no: ctf_set_errno (fp, errno); - /* Turn off the is-linking flag on all the dicts in this link. */ + /* Turn off the is-linking flag on all the dicts in this link, as above. */ for (i = 0; i < arg.i; i++) - arg.files[i]->ctf_flags &= ~LCTF_LINKING; + { + arg.files[i]->ctf_flags &= ~LCTF_LINKING; + if (!(fp->ctf_flags & LCTF_STRICT_NO_DUP_ENUMERATORS)) + arg.files[i]->ctf_flags &= ~LCTF_STRICT_NO_DUP_ENUMERATORS; + } err: free (buf); if (f) diff --git a/libctf/ctf-open.c b/libctf/ctf-open.c index ab97cde3ebf..3f624987f90 100644 --- a/libctf/ctf-open.c +++ b/libctf/ctf-open.c @@ -1024,9 +1024,8 @@ init_static_types_internal (ctf_dict_t *fp, ctf_header_t *cth, 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). + /* In the third pass, we traverse the enums we spotted earlier and track all + the enumeration constants to aid in future detection of duplicates. 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, @@ -1040,36 +1039,12 @@ init_static_types_internal (ctf_dict_t *fp, ctf_header_t *cth, 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) + if (ctf_track_enumerator (fp, enum_id, 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); + ctf_next_destroy (i_constants); + ctf_next_destroy (i); + return ctf_errno (fp); } - else - { - err = ctf_dynset_insert (fp->ctf_conflicting_enums, (void *) - cte_name); - - if (err != 0) - goto enum_err; - } - continue; - - enum_err: - ctf_set_errno (fp, err); - ctf_next_destroy (i_constants); - ctf_next_destroy (i); - return ctf_errno (fp); } if (ctf_errno (fp) != ECTF_NEXT_END) { diff --git a/libctf/ctf-subr.c b/libctf/ctf-subr.c index 6dbf3e7231a..cdcbe960bde 100644 --- a/libctf/ctf-subr.c +++ b/libctf/ctf-subr.c @@ -152,6 +152,43 @@ ctf_version (int version) return _libctf_version; } +/* Get and set CTF dict-wide flags. We are fairly strict about returning + errors here, to make it easier to determine programmatically which flags are + valid. */ + +int +ctf_dict_set_flag (ctf_dict_t *fp, uint64_t flag, int set) +{ + if (set < 0 || set > 1) + return (ctf_set_errno (fp, ECTF_BADFLAG)); + + switch (flag) + { + case CTF_STRICT_NO_DUP_ENUMERATORS: + if (set) + fp->ctf_flags |= LCTF_STRICT_NO_DUP_ENUMERATORS; + else + fp->ctf_flags &= ~LCTF_STRICT_NO_DUP_ENUMERATORS; + break; + default: + return (ctf_set_errno (fp, ECTF_BADFLAG)); + } + return 0; +} + +int +ctf_dict_get_flag (ctf_dict_t *fp, uint64_t flag) +{ + switch (flag) + { + case CTF_STRICT_NO_DUP_ENUMERATORS: + return (fp->ctf_flags & LCTF_STRICT_NO_DUP_ENUMERATORS) != 0; + default: + return (ctf_set_errno (fp, ECTF_BADFLAG)); + } + return 0; +} + void libctf_init_debug (void) { diff --git a/libctf/libctf.ver b/libctf/libctf.ver index e6c31ff37aa..1c85624cfc8 100644 --- a/libctf/libctf.ver +++ b/libctf/libctf.ver @@ -204,4 +204,6 @@ LIBCTF_1.3 { ctf_lookup_enumerator; ctf_lookup_enumerator_next; ctf_arc_lookup_enumerator_next; + ctf_dict_set_flag; + ctf_dict_get_flag; } LIBCTF_1.2; diff --git a/libctf/testsuite/libctf-lookup/enumerator-iteration.c b/libctf/testsuite/libctf-lookup/enumerator-iteration.c index 78cb5a3cc0d..9d26421c92c 100644 --- a/libctf/testsuite/libctf-lookup/enumerator-iteration.c +++ b/libctf/testsuite/libctf-lookup/enumerator-iteration.c @@ -56,19 +56,40 @@ main (int argc, char *argv[]) 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 + /* Look for all instances of ENUMSAMPLE2_2, 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. */ + ctf_lookup_enumerator() in the presence of hidden types. + + This also tests that you can add to enums under iteration without causing + disaster. */ 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; + int dynadd2_value; + int old_dynadd2_flag; + + /* Make sure that getting and setting a garbage flag, and setting one to a + garbage value, fails properly. */ + if (ctf_dict_set_flag (fp, CTF_STRICT_NO_DUP_ENUMERATORS, 666) >= 0 + || ctf_errno (fp) != ECTF_BADFLAG) + fprintf (stderr, "Invalid flag value setting did not fail as it ought to\n"); + + if (ctf_dict_set_flag (fp, 0, 1) >= 0 || ctf_errno (fp) != ECTF_BADFLAG) + fprintf (stderr, "Invalid flag setting did not fail as it ought to\n"); + + if (ctf_dict_get_flag (fp, 0) >= 0 || ctf_errno (fp) != ECTF_BADFLAG) + fprintf (stderr, "Invalid flag getting did not fail as it ought to\n"); + + /* Set it strict for now. */ + if (ctf_dict_set_flag (fp, CTF_STRICT_NO_DUP_ENUMERATORS, 1) < 0) + goto set_flag_err; printf ("IENUMSAMPLE2_2 in %s has value %li\n", foo = ctf_type_aname (fp, type), (long int) val); @@ -79,8 +100,10 @@ main (int argc, char *argv[]) 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; + dynadd2_value = counter; /* Make sure that overlapping enumerator addition fails as it should. */ @@ -88,6 +111,32 @@ main (int argc, char *argv[]) || ctf_errno (fp) != ECTF_DUPLICATE) fprintf (stderr, "Duplicate enumerator addition did not fail as it ought to\n"); + /* Make sure that it still fails if you set an enum value to the value it + already has. */ + if (ctf_add_enumerator (fp, type, "DYNADD2", dynadd2_value) >= 0 + || ctf_errno (fp) != ECTF_DUPLICATE) + fprintf (stderr, "Duplicate enumerator addition did not fail as it ought to\n"); + + /* Flip the strict flag and try again. This time, it should succeed. */ + + if ((old_dynadd2_flag = ctf_dict_get_flag (fp, CTF_STRICT_NO_DUP_ENUMERATORS)) < 0) + goto get_flag_err; + + if (ctf_dict_set_flag (fp, CTF_STRICT_NO_DUP_ENUMERATORS, 0) < 0) + goto set_flag_err; + + if (ctf_add_enumerator (fp, type, "DYNADD2", dynadd2_value) < 0) + goto enumerator_add_err; + + /* Flip it again and try *again*. This time it should fail again. */ + + if (ctf_dict_set_flag (fp, CTF_STRICT_NO_DUP_ENUMERATORS, old_dynadd2_flag) < 0) + goto set_flag_err; + + if (ctf_add_enumerator (fp, type, "DYNADD2", dynadd2_value) >= 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; @@ -104,12 +153,18 @@ main (int argc, char *argv[]) if (ctf_add_enumerator (fp, type, "DYNADD2", counter += 10) < 0) goto enumerator_add_err; - /* Look them up via ctf_lookup_enumerator. */ + /* Look them up via ctf_lookup_enumerator. DYNADD2 should fail because + it has duplicate enumerators. */ if (ctf_lookup_enumerator (fp, "DYNADD", &val) == CTF_ERR) goto enumerator_lookup_err; printf ("direct lookup: DYNADD value: %i\n", (int) val); + if ((err = ctf_lookup_enumerator (fp, "DYNADD2", &val)) >= 0 || + ctf_errno (fp) != ECTF_DUPLICATE) + fprintf (stderr, "Duplicate enumerator lookup did not fail as it ought to: %i, %s\n", + err, ctf_errmsg (ctf_errno (fp))); + if ((type = ctf_lookup_enumerator (fp, "DYNADD3", &val) != CTF_ERR) || ctf_errno (fp) != ECTF_NOENUMNAM) { @@ -164,4 +219,10 @@ main (int argc, char *argv[]) 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; + get_flag_err: + fprintf (stderr, "ctf_dict_get_flag failed: %s\n", ctf_errmsg (ctf_errno (fp))); + return 1; + set_flag_err: + fprintf (stderr, "ctf_dict_set_flag failed: %s\n", ctf_errmsg (ctf_errno (fp))); + return 1; } From patchwork Tue Jul 30 15:37:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 94799 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 D7543385DDD8 for ; Tue, 30 Jul 2024 15:43:10 +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 AE79B385B532 for ; Tue, 30 Jul 2024 15:38:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AE79B385B532 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 AE79B385B532 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=1722353894; cv=pass; b=HWFk+d5aSpaUbfK6OrNKn0G1APhzV/XjwC9ciEL1/aT50DgY7Wb6zTN2ICdXJrqtlGNNKIy65RwK6PYLWyZHch5iMY52WIeVvLsg3omCg7sx1FmVILwQbvAIkYlWKYGYtIFVuUsdNHKhouN3FUfG0ivHdjfltAq/3FrZfvbP9Bg= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1722353894; c=relaxed/simple; bh=ceJRhz+DSWeOsH4XaXZ57dJQ42PCR4vq0NlC0KJ+KX8=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=dvsVVMd2kMae0vlJrcWK5K6p/qtOO1T3dkh5dofpZkTqM1j/uawj7+ZScB16/jxi2T+rH3zWaqeoQxgTC3SXfaoLp56Qt5AyKXAyY2Ed3Fp+YQewIA0HI8t9GA5EnsInMJQWlnXoUIa+CNlWUDt4JuDbsOjU52H/v2uYqjKvM3Y= 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 46UFMXcX032652 for ; Tue, 30 Jul 2024 15:38:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=ZRKnDCwOVOfeeOfAuwp2oVsCls9SxZOnAy/VBlCrgZs=; b= efR4SNPV3xM+tLWpZ4nV+49sWih/cs2xu/ADb191BQahv2zJFG6N6pysgN5TShno 2XGdOLm7KkG0cyHW9eVyU+scJ9C1OU8e3ptv5jannLpxL0egV9r0BTsOLBdCaAjV HbliiswTjSY50atfoER8QtKG7TSjUKyFIMGV5Z8m7uNZ/0zR+tPuD89AQgWQAziy k/72Qga+i2HGpwTbLZOrtoAAe5JzdO4nHsMU2fd/izNt+TpiSUmzb/duoOaIcGW1 fRtwR/bxQolMBYJnFIWB1XXT8hKWf9pxD8i991VuF9qAFyZZ9XHFVkYYhoLmTJOm j5Xrharpwx8P9fTSNA7peg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mrgs5bw3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:38:10 +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 46UFDK7a005913 for ; Tue, 30 Jul 2024 15:38:09 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 40p4c0975j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:38:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pc2IShURQIVphTJAOeckXqARfJ2pumn4wafEGr5rSMET6fUcA0opejO1e9uP/BqY/v9yHiXGF/jbE+YA/rSu7SdubywZWeNMzAAErxi7XgCq9I1TkmrMNLZu4WDOUR3EkJAzA9/jIje8kDinFBPMnaln2LNdpCRcNWIUAqF+RK/L/cJ2QResRlzluNQZfxOus1fY9V4AJQY4FdpD+Zf+hw2zRpvIWOZlRVb2Hy81PZmsXOQaAu/QYvd02PTsrP+EkOtoSS97th9PJAMydKuvBwzfFvrFd0Tzxzt8dHkIYSysyB+8BZ2Z1wUyqjarCYnrEyT6KCWF0aPd86iFwVvkLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=ZRKnDCwOVOfeeOfAuwp2oVsCls9SxZOnAy/VBlCrgZs=; b=YK8zAZzHbVuxFwPUMVLfeo/yVezpktvT64kHqCrmPZr1N9jfKYTWiE7MG0zYVdHTCET55UIVBBanrZ5Wz+Fn9yjdQQuDeXPXx9rsjBYzpZbA0HpLZpO5C7LAvGqLa5gQHN6KOgfSthZ1RbXCE0nwHsEk1u/LzyzLdD9CyoOVO3Cxo990d6V/tMmnEmG7htLhMKfEysZXgFuGBLrb2gBCa5VTSU9/nMNA3IgHdg1LLo9OZzf1Pr+QMvdDbS55JLMwJDBPHfrgYYRK2uoKrnsIk/iD3cTdsNu85B32QvDPIB9uVhEwH19O8ellnq6Xh4AeHZKx4lCJotEFHFZYzQibHA== 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=ZRKnDCwOVOfeeOfAuwp2oVsCls9SxZOnAy/VBlCrgZs=; b=ig0H6vW9bzdhaZgjff3jFIJ/xhx5GlS0AKXgHD3+yvVqrm2ddRYltHF/EOnTPfwO2sB9cIBlnpyo3ZvI3A8Fopso76EeAyHoVCA8rym4qQ0LoZ0mPxY1goQuiDTKNUvGGrAEahVYQoGVMXgjAJP4SzyCDyY7QR3aN7pRJRyMpMk= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by DM4PR10MB7476.namprd10.prod.outlook.com (2603:10b6:8:17d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.28; Tue, 30 Jul 2024 15:38:07 +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.7807.026; Tue, 30 Jul 2024 15:38:07 +0000 From: Nick Alcock To: binutils@sourceware.org Subject: [PATCH 16/19] libctf: clean up hashtab error handling mess Date: Tue, 30 Jul 2024 16:37:04 +0100 Message-ID: <20240730153707.168357-17-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.2.276.g4ac82df17e In-Reply-To: <20240730153707.168357-1-nick.alcock@oracle.com> References: <20240730153707.168357-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO4P123CA0138.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:193::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_|DM4PR10MB7476:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b2742a1-7865-4f74-5c28-08dcb0ad9c06 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: oYiE7/2Hlfz1caSTX86rCAUMajWlWDzjMJpVr8bBdJKBWTc/kb3xLgHaCkJrgFkomiSwWxB5olzD3nxs1UqABYEFCDuT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ghjA+uC6eIcLs2WG6Ahv7wckWHo/I3AVbLLP4lEHribNOPwwx7uBBj1gaQiV9MsrkHjFIKiqLIcTbumDdzdA4GD7KbVirNxOiqd8H1kCfIqilgro2Sogq+hLRUj/Ccn32CGk83TOVFyg4vxPrGG0APsDGjvKQN5wy3pmdM6S9hlB+ZucMw== 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:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: H2A5H/aVnFsLMnI+0IiwMEOlWbciJFkIjVuuxCo5dnYaM6pEokd92hqPz+FEan6sqwZPNzujlq4rpT5iv0IN9qT5+2iy3DLSr1pbhV8gXzbG59IKBZ/zVng36/llRH8K/8XBcoDEw/9ojgEp9dxTpH1USYETTmMRyAP/+FNeRGHKX+H+qbwWQVmvOAzfcMhbTj4Ebyrz94d7xLOxS78OSVF1p8xeKBhcH2GsfC3EJLEJmx1fxGTMEwSXykceGdV+nMzgAZPbTmTb84r1E5CbsVsHv56krOX9i+AipidsWVIwq7MuLyF8Vt1pK+vEQMU5OxUmJVjlkZFOfLU43MtVmJv0obKEN5Xs+0VkLr3r1vTMbAEk/+avCHdMEL5whR4C/ochkE1HgVECpzHbiXTu+gRt+ISv+Gat4vaYeRL21q3fw9h/rKBOc2jQ1tyRVaVSugGydQ73U8P64t0xBhX24R09wsiRIhRKAg+4LTUd5kb6HIkZsnc3/o4w+FN2RJPmUvM3Aal/xDbGz01IT+6SzpIkKoOt6M+VMGuHsXtXsp6XwLJXtmMmbkgaGpjTTvlbBK6EVU0Y3XiDvDvOPpZQ7UBw+8Ls/Oi8zjAiP3Ro7CWB+og5A4J0g5jdPw6bBDfdBn4m+0pLkoO4/16FfA11NbpQ08rIB4EqWw5A22G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/qAZ3bCPGeeb0qWZSPTe8yZovnMBcbq5o/Uqax1Nz7K7PK8c8Zyh7KtgjUiLxv4OQwRBlKA/wI35XRHRgKdfsqVKQDgyYMVtAT0q/AvdfuFJUlmPGdSyBCZcC5WCG/4NdPTB+rwBt0V3Ufj6kgHi/yj12P2uyM+wbGfhBEu6Jo92RnjPFhfpf9myyQ/EJRIKVlZGqjv4LlF5sAUB3ayUP417m57cOJcdg2hGMll5qHQKLyDXq5PJaYvNvvAvZa/t12eyKhHZwhhUpYVywmEcsJfncjlH8HXrz2F0yKh6wkAVd3rO5TC0dVRT685qfx7o2ozh2/ThIC83LRGGqKtXby8g+lfeRG5W9lph0xFSpO98SXYY3McGLEv6Xd1Y3y9RXUkQM7Z3LRTAXdMGtvJkQpgHy8rPPUuCYpBebUB1Rb/WcFE5nRVuojoKmcLIpjTQQQ6gV4Q3dQSShhaE9t2QIi3NhkW/N7okHbD5KKMzEjuyPWlv+xYHQuQnT2BHK38A/Ke3FklQfPTOjBqDNhxkyLXfs4G10XUTyayfOLVoM69PnUHRzY/7U= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b2742a1-7865-4f74-5c28-08dcb0ad9c06 X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2024 15:38:07.5429 (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: 67mTj4sjqCAWHN654c1IL3LV5Z1rBkikgR/1JP1vFnqCMzcQTOpWoD8IdKGnGIa5iahe0xeCALaFds3XW2nIAA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB7476 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-07-30_13,2024-07-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 adultscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2407300106 X-Proofpoint-GUID: TQw9GE2ZEutGl7w9fMjPRIznurMpGGL6 X-Proofpoint-ORIG-GUID: TQw9GE2ZEutGl7w9fMjPRIznurMpGGL6 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 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 dict and archive opening code in libctf is somewhat unusual, because unlike everything else, it cannot report errors by setting an error on the dict, because in case of error there isn't one. They get passed an error integer pointer that is set on error instead. Inside ctf_bufopen this is implemented by calling ctf_set_open_errno and passing it a positive error value. In turn this means that most things it calls (including init_static_types) return zero on success and a *positive* ECTF_* or errno value on error. This trickles down to ctf_dynhash_insert_type, which is used by init_static_types to add newly-detected types to the name tables. This was returning the error value it received from a variety of functions without alteration. ctf_dynhash_insert conformed to this contract by returning a positive value on error (usually OOM), which is unfortunate for multiple reasons: - ctf_dynset_insert returns a *negative* value - ctf_dynhash_insert and ctf_dynset_insert don't take an fp, so the value they return is turned into the errno, so it had better be right, callers don't just check for != 0 here - more or less every single caller of ctf_dyn*_insert in libctf other than ctf_dynhash_insert_type (and there are a *lot*, mostly in the deduplicator) assumes that ctf_dynhash_insert returns a negative value on error, even though it doesn't. In practice the only possible error is OOM, but if OOM does happen we end up with a nonsense error value. The simplest fix for this seems to be to make ctf_dynhash_insert and ctf_dynset_insert conform to the usual interface contract: negative values are errors. This in turn means that ctf_dynhash_insert_type needs to change: let's make it consistent too, returning a negative value on error, putting the error on the fp in non-negated form. init_static_types_internal adapts to this by negating the error return from ctf_dynhash_insert_type, so the value handed back to ctf_bufopen is still positive: the new call site in ctf_track_enumerator does not need to change. (The existing tests for this reliably detect when I get it wrong. I know, because they did.) libctf/ChangeLog: * ctf-hash.c (ctf_dynhash_insert): Negate return value. (ctf_dynhash_insert_type): Set de-negated error on the dict: return negated error. * ctf-open.c (init_static_types_internal): Adapt to this change. --- libctf/ctf-hash.c | 7 +++++-- libctf/ctf-open.c | 20 +++++++++++--------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/libctf/ctf-hash.c b/libctf/ctf-hash.c index 7f291e3ac27..cd7473419cb 100644 --- a/libctf/ctf-hash.c +++ b/libctf/ctf-hash.c @@ -256,7 +256,7 @@ ctf_dynhash_insert (ctf_dynhash_t *hp, void *key, void *value) key_free, value_free); if (!slot) - return errno; + return -errno; /* Keep track of the owner, so that the del function can get at the key_free and value_free functions. Only do this if one of those functions is set: @@ -786,7 +786,7 @@ ctf_dynhash_insert_type (ctf_dict_t *fp, ctf_dynhash_t *hp, uint32_t type, return EINVAL; if ((str = ctf_strptr_validate (fp, name)) == NULL) - return ctf_errno (fp); + return ctf_errno (fp) * -1; if (str[0] == '\0') return 0; /* Just ignore empty strings on behalf of caller. */ @@ -795,6 +795,9 @@ ctf_dynhash_insert_type (ctf_dict_t *fp, ctf_dynhash_t *hp, uint32_t type, (void *) (ptrdiff_t) type)) == 0) return 0; + /* ctf_dynhash_insert returns a negative error value: negate it for + ctf_set_errno. */ + ctf_set_errno (fp, err * -1); return err; } diff --git a/libctf/ctf-open.c b/libctf/ctf-open.c index 3f624987f90..942a53a8f2c 100644 --- a/libctf/ctf-open.c +++ b/libctf/ctf-open.c @@ -681,6 +681,8 @@ init_static_types_internal (ctf_dict_t *fp, ctf_header_t *cth, the latest supported representation in the process, if needed, and if this recension of libctf supports upgrading. + Returns zero on success and a *positive* ECTF_* or errno value on error. + This is a wrapper to simplify memory allocation on error in the _internal function that does all the actual work. */ @@ -886,7 +888,7 @@ init_static_types_internal (ctf_dict_t *fp, ctf_header_t *cth, LCTF_INDEX_TO_TYPE (fp, id, child), tp->ctt_name); if (err != 0) - return err; + return err * -1; } break; } @@ -905,7 +907,7 @@ init_static_types_internal (ctf_dict_t *fp, ctf_header_t *cth, LCTF_INDEX_TO_TYPE (fp, id, child), tp->ctt_name); if (err != 0) - return err; + return err * -1; break; case CTF_K_STRUCT: @@ -920,7 +922,7 @@ init_static_types_internal (ctf_dict_t *fp, ctf_header_t *cth, tp->ctt_name); if (err != 0) - return err; + return err * -1; break; @@ -936,7 +938,7 @@ init_static_types_internal (ctf_dict_t *fp, ctf_header_t *cth, tp->ctt_name); if (err != 0) - return err; + return err * -1; break; case CTF_K_ENUM: @@ -949,14 +951,14 @@ init_static_types_internal (ctf_dict_t *fp, ctf_header_t *cth, tp->ctt_name); if (err != 0) - return err; + return err * -1; /* 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; + return err * -1; break; } @@ -968,7 +970,7 @@ init_static_types_internal (ctf_dict_t *fp, ctf_header_t *cth, LCTF_INDEX_TO_TYPE (fp, id, child), tp->ctt_name); if (err != 0) - return err; + return err * -1; break; case CTF_K_FORWARD: @@ -985,7 +987,7 @@ init_static_types_internal (ctf_dict_t *fp, ctf_header_t *cth, err = ctf_dynhash_insert_type (fp, h, LCTF_INDEX_TO_TYPE (fp, id, child), tp->ctt_name); if (err != 0) - return err; + return err * -1; } break; } @@ -1010,7 +1012,7 @@ init_static_types_internal (ctf_dict_t *fp, ctf_header_t *cth, LCTF_INDEX_TO_TYPE (fp, id, child), tp->ctt_name); if (err != 0) - return err; + return err * -1; break; default: ctf_err_warn (fp, 0, ECTF_CORRUPT, From patchwork Tue Jul 30 15:37:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 94805 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 7AF6D3858420 for ; Tue, 30 Jul 2024 15:47:21 +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 8E5F0385C6E1 for ; Tue, 30 Jul 2024 15:38:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8E5F0385C6E1 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 8E5F0385C6E1 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=1722353895; cv=pass; b=dbiavj5Lksl40IvcI5TPHLsD44UN7OPX4caL+j62EYsLu2arfcNbQD8NtTsnrNx4plMVszb22FjZg5oOXgX5Mlj+xWGzoylUuFpAhaiJVkHdg+/2cHjkrM00bRYo30qbNRlnj7oG50HQjVeQCW2dFFbFsC27mgT1oY/0GoEh32A= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1722353895; c=relaxed/simple; bh=CLsnWHICEvsyyDdN9U1KiPovxj5WSORDzT2AvDRArWw=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=e2XSlSmyk+n49HjGSQ6KRauGKuzFYM404eSUZ2Ca3QdIcFAPJlfLSeo6F3vn3IXt0LKHpcgdmunMsBfrNZeSU9BRxfH36H8mb/nvpt9w7NJ6FnO6GfRtZECjm4n8evZf0V3pR0O6KfmKLxxXDERguWur+TqeN/A1Fa4eFu+PCtE= 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 46UFMU8P018582 for ; Tue, 30 Jul 2024 15:38:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=G9rsnThtVRUsKcFWxbrBEgSMTiEPtV8AD4c3wuzwuts=; b= gIxV+v6TeGFwZ/EZb0QGkwZ4vqW+DjRc9iQuBVdNwOm2AyLkh+vUwkdkdO9icZ6P k8Wyp8hVG8JMQG6n9ERTOxA35ihyv4vqH1wuASnSGavs6F25RLyHXBhdTSysKYe7 jOQEoA6KAyq1JR4DJGi1YnBW2dnNummN5MK4Pa1YCxsmX/enBtkuWIsdM1GRpIqG ITzlbDYqZwm2dKN3mD0LafOpFkOPTuiasl8xJ/FILKwZfiNYzIhQnq2H3cpC6S7J 4bd2wO6qFbZ2q1PGSF5Gpi4udTxa+qyssP3OT4If0tb96+lL2TR10UN9l2YYrsUI 1T9I44bzK/quS1QP54XN+Q== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mqp1we3x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:38:13 +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 46UF4vhN030903 for ; Tue, 30 Jul 2024 15:38:12 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 40neht6st1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:38:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fwqO0zaQGM3cMm8v6I7nTghgMjxeC5w63OOZkrKYA1gn6M+OhscxH6Tbu0lNW8+RbrTb9VW+uhRI7gooUhSeWMgKAOApXrJITCIsaeoBgFrnL0e2z/EzLtuEa90IS6ES5qF/KJGyFB1aS+xKLe74Avlx8QouEc2qehtR9FGA0WN3JLShkVy8YXvUGRqLPqULwR/GTWU1PjC80VNPrUrYYFMQETLZ06t4pECvakAnvE8czj0sOOG/T30hYIGB9ClxhE8xyewftjmSiH/SfytVCW8ZTEsUIXrKnJ6pVxiDbA6yoKuvzI39ZBfXBB+kDpRwsTkfJlShe7Wxx5IVZwSqYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=G9rsnThtVRUsKcFWxbrBEgSMTiEPtV8AD4c3wuzwuts=; b=QUmzhRCO6jEaygdcJhVX29tfpnoHN0GcMykPmfZlcB2d7GTini4MSFgSszZPusJUASWa9WXP1e9T950qBT2Dsxcj3ULKk9DyvVwoKgcrbeqnUV87mSP5EARP1RC99VTaX1e0ts7k4zSgC4wLOZ17lz85mlKJlLrIIMzc63VFolanLniw49F0Y0JI3oTdqdCGqupwCByjkvjbs6wjBd54IehYPrqIHbQBRI8R5Ua4V4GLmp+MyA3iPGKLNnaDvU44Yhn3LKP6oGJlnm0Xu+8hFW4T3QXosROolk0s2BBxGSr7X9eOzjv6KlsBnBoOpcwYcEcoymtFNOU8FCbGoLIDJA== 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=G9rsnThtVRUsKcFWxbrBEgSMTiEPtV8AD4c3wuzwuts=; b=eI/cj2wxPYv9YOeFfN2uG64RiT1Ts9yolzULLGd7beA0SJFwfZ+6G5RCIQ32Eruj1oaHkkYLtT3oYNQvqPttg/J2gkwZr8TonlUIfbPMZM3z4QnwO7Hxf/TbP5JbILGWhg1MFFZt+asYy6a4Df3XMbFGPc19AWq6nTXdtGHQlSc= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by DM4PR10MB7476.namprd10.prod.outlook.com (2603:10b6:8:17d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.28; Tue, 30 Jul 2024 15:38: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.7807.026; Tue, 30 Jul 2024 15:38:10 +0000 From: Nick Alcock To: binutils@sourceware.org Subject: [PATCH 17/19] libctf: fix ref leak of names of newly-inserted non-root-visible types Date: Tue, 30 Jul 2024 16:37:05 +0100 Message-ID: <20240730153707.168357-18-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.2.276.g4ac82df17e In-Reply-To: <20240730153707.168357-1-nick.alcock@oracle.com> References: <20240730153707.168357-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO4P123CA0048.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:152::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_|DM4PR10MB7476:EE_ X-MS-Office365-Filtering-Correlation-Id: de863924-7db4-4e9c-2de3-08dcb0ad9dc0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: lV4BLgiOlCP1Ry3PrmqLNId0+cX/VwSq8Y//gjdaAOnhjBUBLGY70Xg1whS0Rv9sh3Q1/+4x/BLVI3ShQ+fIiYvBA6KRs9bxFyDAIt2e2M4bQQEyNvrNap4BKVNiMAY/nudwuivtgGrSNtXRA+eXI4s7madWtzRVuc2NEw05kM1KkYhOkzgFkBN7ran2Oi33NtTSGf7SAEje80QupEyidoswhu+1bphTXqXH2FYd38AQvEfkj4doqQSQ4KzxImgWbJ21AI2iKqLsjqyFcCWASZxXso2/KhzHOMgCsZmYCvbvgDtRHkaEyTv5xYFVll6hLsbAULKZlCsCyohampd6Nf5vKPECWGsjMVVk3MqCvErks1py5RYWVnTJ8ZsJKeEJIew2x2UEJH1kd+RU5jEGdgBIn8sMZYznpNvAd1rV5htuH6NVMyK/5Fp5j7WshCVNW7vW09Qdlij9JS92d5zcZlXYJr74+6xCYTSVIxC8IecJtFl7kwwtkLdVA1q1tW8obWDS45Xu5Pi6TXz4oQkQQdUVvbVP+OFeLEafKetFMo6itPsrABkuepH7yPGl8N6lEURrawWubUuvfDTiBdxw0RBOcjXcH5wno2Wu2XPNMXCnM3YuYRkhjM8ieJ10uAJMUmNdKv+K0l5ipj7FQH+SpE0t3vP5qNWW2t2YrCTH/E9KcaqHkURp/00aZgs+GnxIBlx5Vphy3X8oog/nVeZL+0VbM7xJI6VifIC7MpXwBf8GL+Bh1WnZB+CKzai7Y5jgc3bY0adC5pvamzszsQEJFbs2eX532BkKZYQbJ85W4G73dN8L32Vua4R642gcIKn8UU/sipx+DGM23fMPFMV6M8LF9WwdLGKThbIySvJqXfbSviApCeXlmlLYyecHgWEG8IRP78LxLEBUpS3wAadvdEK283gQPkoNZvCgjaWDGYKl7w4wz+KEjrZbiiA7M/BqCjSw/NImemmOxJ9ur7oFopWtxknqCyHdMk5cz8Er4iKQ/hf3rivspjJh+DOJfc/rxrwfEz1fFMhtq+aWT0ZbfxlD/s8sH/l9MEpyIQczpwiimwuvzgvtJgJJxMVi+J2zK/7wfPi7Egtl35cY1LB3DJGpK8eUXd8/dWdvB+A6LuAZ3fCPhrocYKduke5lCYifcngwbRw0nl+4uSTJIK/jTvVswVMHFhlRjaEie+SvJhWGY/fGUpRzx2jxyiZppSnoypCNBQEeqTcr9MN+UJkXbgQfvNVMsfLNteLqA1S21AKamaJySv45ITnKyLyOCml0PY4osXFgjuZEeYpQXTUw5Cajz6uMVMRBTkPHzHNo+KtaB2FSkpTggM8yIZ7uCTfbduFYBNxabWVhVWhnRvD5SQ== 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:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uqdTscUAchtFiVGuklLGR20cdovctySsGxa+pnWTscf7MUrKFecLQ6hcH5v5p38eh92YdXfQFlEdrtZ5qyqSIEVmxAvSepRGIIT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8rc+x2TozFbdveNPwKGG+rKjv8fXGLFqu02iBSLiMLpCqiGjWAglH+zwgv1NvumElxdw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: de863924-7db4-4e9c-2de3-08dcb0ad9dc0 X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2024 15:38:10.4437 (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: pDJgOxNlBdChvBxyZOQjWL9Qg6Zn70NWvGmL+BcfBC8m0YwpPkgCXCcLAmwVDEQqBK12wMvTDMZhlb81EyYH6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB7476 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-07-30_13,2024-07-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2407300106 X-Proofpoint-ORIG-GUID: SOxaEQju1ZWkZ21QLXEV8n6jK8I1j4hb X-Proofpoint-GUID: SOxaEQju1ZWkZ21QLXEV8n6jK8I1j4hb 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 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 A bug in ctf_dtd_delete led to refs in the string table to the names of non-root-visible types not being removed when the DTD was. This seems harmless, but actually it would lead to a write down a pointer into freed memory if such a type was ctf_rollback()ed over and then the dict was serialized (updating all the refs as the strtab was serialized in turn). Bug introduced in commit fe4c2d55634c700ba527ac4183e05c66e9f93c62 ("libctf: create: non-root-visible types should not appear in name tables") which is included in binutils 2.35. libctf/ * ctf-create.c (ctf_dtd_delete): Remove refs for all types with names, not just root-visible ones. --- libctf/ctf-create.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libctf/ctf-create.c b/libctf/ctf-create.c index a7544955212..0c8959a997e 100644 --- a/libctf/ctf-create.c +++ b/libctf/ctf-create.c @@ -258,10 +258,10 @@ ctf_dtd_delete (ctf_dict_t *fp, ctf_dtdef_t *dtd) dtd->dtd_vlen_alloc = 0; if (dtd->dtd_data.ctt_name - && (name = ctf_strraw (fp, dtd->dtd_data.ctt_name)) != NULL - && LCTF_INFO_ISROOT (fp, dtd->dtd_data.ctt_info)) + && (name = ctf_strraw (fp, dtd->dtd_data.ctt_name)) != NULL) { - ctf_dynhash_remove (ctf_name_table (fp, name_kind), name); + if (LCTF_INFO_ISROOT (fp, dtd->dtd_data.ctt_info)) + ctf_dynhash_remove (ctf_name_table (fp, name_kind), name); ctf_str_remove_ref (fp, name, &dtd->dtd_data.ctt_name); } From patchwork Tue Jul 30 15:37:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 94802 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 289D7385C6E1 for ; Tue, 30 Jul 2024 15:44:20 +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 9F288385C6C0 for ; Tue, 30 Jul 2024 15:38:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9F288385C6C0 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 9F288385C6C0 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=1722353900; cv=pass; b=xJ8BU22B+UPPIwiWxsOMW/ry/BvkYBhqOec9ONIeMgJWurkSX4qL/2TxWuHtglK/MMpAlYHtxDU0FZrIBaFtDp7Udc5NWJEqixUq/qkhtim+3peE8Zr44dP/TGenCKSnq7o08GYNseMutSGJS9JKtPJx+8cweX5YFufn1KrdH+w= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1722353900; c=relaxed/simple; bh=GediFsevsbB1Utv5PcJqX+7NHqRJu9TFrmggWt/cW2E=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=BqdJnTXO92FFhv6sJUZKzoOfAu/qT6JxDRYulCHlDGRmL9RAtG9ozusHChrdQ9340VX9OQwrCx41l+kf78uGfm+RXLv1L+PWN6X+eZ7HglTfhWEXBr2aGPfWQr+1Oh6nkWXzzMNeeEHY/pihtxcgLFW6fQeQee20Vel4Pd1aDfk= 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 46UFMWII006626 for ; Tue, 30 Jul 2024 15:38:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=WeUucV+26aPCcgUB88XwU1h2JnpU9RKQiA7t9N8jZHA=; b= hyznvApbQQjzebKRuHTt3N8FAWhALPfTTWnMhSvEcc4uiMdfj6bx6XoZqXSHlblJ sr+ol8Qr9FKR98is08q+GdImnbsOKoz0Ndd7KwbH7uja0/JELt4LNbT2ClXLWxbp 2hjsOkHKhFoCzg57t1JyyQJivdkutFnoCDtkBbhwxFX51oZkLPihGDgk8F07OMfF 4uHNphjtBVyU8HbZdrw1Z0qwu21j7ZLLCD2wpM1IRrBIS7dFO2iIWLlb0YzSPdSd JMZUscUtmJEwYX3hhnWLC1z64HIqQC6wPCVoYhXXNFT8LIny2rgieco0ex3nAypt 13rZAjhNGO83GhC4nWL02w== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mrs8na1j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:38:16 +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 46UEYuuw035608 for ; Tue, 30 Jul 2024 15:38:15 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2043.outbound.protection.outlook.com [104.47.55.43]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 40nvnwdyv7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:38:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=zBRixqRphtWvurRCw2JClv6SQIc9pCSMjivp9mx51L40DJyEp9EDh/+5hs3M9c5dwbzKh2dnVWO4poQE3APV1C82eSpOQgtbCBw0a1y1lBfPppyTQl/evhUlKwubtVu/5RerIgum32ZVoxM3Mc7jfUkppkbKYnS/QschciG1TO9PYtHeKFD7rnAnlZv9Y9MrAttqwdMDZPSN9TIsKO0hgiYfV1YCegWRVc3OHKMIJhwOc3qibrqQ8NXfGnGRgQ1PihmlvSnh0PrrUMnNVoOcmS7Y7fpXcLcZyIkzc5VMjK3VDD4vMbJXKfvHsgJsYpjJrU9YHpsNMsMbpXoxSC3sig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=WeUucV+26aPCcgUB88XwU1h2JnpU9RKQiA7t9N8jZHA=; b=SlBiy1/ZUEoLJo7c02S6tDrH9rDSR+R0YCNIIRJM3R5FcSYCXhGILG95tMFIrbsVXZSNj5iaUOX+3tjndlDAE9tBzgk2394tvqqvs0UwUBHT9TILr6WWo71+XP6xVTJeniCMk8XtVV1Sud9NNsLDXHIZxrnHi4lJZRpfkk+FSeqptoHiXUKQMRBO1CctqepJr4+UbYwGXY/d4U8Oaufnx4pLsVJBdn7jkaBd/9ulzdXH3j68jfB7Y5CxEVXTns4R2SLctCpaFjxR6Xt9jaqBzoneoxRv9e4s0E9CDwlDXSjZ+tCj2xRHedNpddQLVKfYDce9wXE05FKMBbZkqxFRXA== 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=WeUucV+26aPCcgUB88XwU1h2JnpU9RKQiA7t9N8jZHA=; b=JoYZJadc/QLkzQQjEhRfNLbBOc13Cek8S22h84FRVZBwMYu6OGUwA8CzhmSMuD0NIibA8yHXeKf+NFXz0U4+dyal68s2zR7G8Af0WTunblO2rf9mE3XZg4w66Ps2AhkpDYPZYf7A1E+wsCwPATOAmfCYSMPpAVP/0lASQep9NtQ= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by DM4PR10MB7476.namprd10.prod.outlook.com (2603:10b6:8:17d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.28; Tue, 30 Jul 2024 15:38:13 +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.7807.026; Tue, 30 Jul 2024 15:38:13 +0000 From: Nick Alcock To: binutils@sourceware.org Subject: [PATCH 18/19] libctf: dump: fix small leak Date: Tue, 30 Jul 2024 16:37:06 +0100 Message-ID: <20240730153707.168357-19-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.2.276.g4ac82df17e In-Reply-To: <20240730153707.168357-1-nick.alcock@oracle.com> References: <20240730153707.168357-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO4P123CA0505.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:272::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_|DM4PR10MB7476:EE_ X-MS-Office365-Filtering-Correlation-Id: 423fd2bd-30bd-43f1-c0e2-08dcb0ad9fb1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: 6GNfCxOB1VDG9NyVacfAJivCisaZagSC8e1V0pKfu2NRowmj72tg3pguS8Myl0vxEfLb06sY95GVqL1OLR9tSHfFbrSyxDNoGVvoI2mTp4Tt4tYoY2cFtsMIi98x66Z2jSgigQrxpzkF1Jta51vQfYSvlFEJVO2XZwmbyzL3B5L4t6HT/gKZ+WdGhiIyAJpl/0Nmks1c5I//7Jm7qYcch1Zhju8SQYBWO/wah5KYvyOW9K8YdcsK37lM0rBNBPLf5DAAw6AftdH10BrAHIFEEHzQcMAlk0yP5qpDxNJj2FrWaSo83ilQ3tSrSvpG9Obnq28E4qXZgFeHAFwMN90MnZXKfjDHDE2RIzZpl4sG93NvGoX2LD3C3S8GJZ2A3BNVBFYrzO3psmTLvwZ4NbbVcf7sq7KT9BDt39LC9wJog81uhmYDx+cqguRU0cNVLKCQAA0yruR0MhJf8maKsdFzF6kq3vgVjimqhrTw7ooycOW4CmsFTRAS73p2ktPoF+cvDjeGdH/gPMzgG66GwSmNNDwLewbOKbHYhqSG4HJn0kCXL693TIr766wES9mVdNtYHVJq76mmvAmRTdkoM1Wcbd9Fd6aWPixG7OkFMjzM8oIETawG3fmNnAv+6xll6UfttivTMryXLNfNB0LYWLtVhFcbgl8/EsRo6OBAimceyUIsnfGP81L7dDNPuHI0KEt9zgk2DwPo/7MNweed6yOI7sN0torfZnQ9/DPQdOoLidUvWfTW4XGFmgfehsGwQEgZQFmotn4yefD4ngvtyhJYF0yeBPQEzif2x90o/FWu4VygLbNsCbWx64KRSfrCAU8h1/PadOptdDVU80tcTwxPcz2/gNE0PfoEvHuJAWt4cNTF1AJ6CZal6Vpk10Q+4wQOlNNNn09fswh856RFrMRFGrPCokv/7CaPsNwVVPK/4xCRqOmkMk5p1F8svXAidGsGe9SVQAr/FXMKOwdV3okgJaoA58bzdi6BfA0ssbFakMv6VhEM+rKVugjNT8oU0QvuGQryw9/7ChzLGbIHi2zh3AIrClghKMvB4S4K+MZ14CJ/nEddgbwPW2y99fEETJZDvkAyaTRWP6gYeUNRsp4KsisiMEqg/rN6AiDo8HvcV/fC5ljNGrTLW1yRmi6Nazvvcxdh1xghXvyMt7dGgru7i/FR1Hf33bFG5rbmmZhaH7Gv5xFJQWil2m+fmgnK1HURBby7/dl9YPUm+zIuaGZATK9e5u4o7dl4aFGSCtpMNGvl24842CofMxAwq8QzH11AyI79uSuJzjMN+mm43r6bPWIdMjvkx6Kw8rxHNVFL4Zxvbl9ZHargkIdjYKbW9Pgw//y1akDfa+61DBUHww/J8w== 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:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4wMqyoVJ+bSyOlIyaySPRG+UTzPkaylNh9a6lo9fwV0YUfkYULm4oTQxUraf7bsKy++b4wpyNeHjOySeu0zKQGe9/y9fReJrhGH5ZbkMc0Ni8wsXZi5br/AhK2PzvoRNsvDlze7cw5NIvqV0cmcq77rJr49hc1W6ubLoutIMYVimRfTfOO5oEYjXxBf8g9EJEEDXiEjb/k6wY/G0Bj9qLkzs6EYgtguHTESSypIhwnLP//0h/Um66bx0leQCGEogmwQ+bQ1gygfN3R6b0vuq4JR5R5nUNvfDeSjP1pAkZMQIuYj4plNZfMkO/ROokZEU6mkPU6OscD/aZxVTIosGqvXni87rRpwtJ9mw6JoTOmpk/YRz4XOHPpVaBML3hMcvqXUTdN2WjbMzRSh5mZxRQp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w1AEEiq5YOxMyczc0lg5oZm3e5lLKUayPjuGDfseiNxWDLf/oqfaAa8XgVaY/YpLPcIef0L/cD7cTwdRLbxtr7+2Yt18jnNteSqvFPglBsyCLF7T5Emfv4+JOXaG67gY32oRoW0au5new== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: OJ5uW12I7KnWEYunGFiH+RO7PiLSbF7YsftFGpvtoBecgTvgUuGSq7fbCLdOCInE1HMgqLwUZSsfCh3SvGIpleLK3Qc4i6b2cuqlswf5kqwtJCw8bazonofUB8S+DKTSM1p+tLnb2uZbaBwsC6wfwzYypmpU2L5qe6MNpf9yMyoV9IAYvx1IeawxjC4ZTmb1OaUxs8stVE2n5yDQr9tZVqb76eKo9zIqEx9cSKM9E7DQuoU96wvzNSMCbXVujhfevIu4FAN2+3dsFrcvykFhLT/y/7NoxAgF3ppah8Daep+YWWwimJJQuDvXWm4CRMBsSI5oQbb7ZeF/VSCW4FLAaCCZ5Xgfxk+Q5juOclwqdwzyHq5l7hE/bGfaLKHtxL2WJEK6wwz7xC1fYvFbJN4NopuCl3rdj8AEvY+8H4s+qGQ2ZSyfiTQ227rRQyHl6HPATWLsRlFM8Zn8L/pRFX510mSlH2NYw5lKmXHx7kVUnmF0O8TYJycagze9SXpGjYkH4xdT1y5yqoLWks56C4TB/HuntO7aWwSbFiQxvcP8qtvlNT85nBzKU2RWJSfwu8J6gxKDhHE1u1QTgKJ6cyoTqn2JH2S/MrCb6m28ANRfbmk= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 423fd2bd-30bd-43f1-c0e2-08dcb0ad9fb1 X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2024 15:38:13.5892 (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: Q6v2WzHB1LSftIgKe5jlYYJJyCwYmlo7e2KGxSmFfjp66iVoQsHrt5Qp/SWCP8C0y6V7+mov+/hyxByt5EDbBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB7476 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-07-30_12,2024-07-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 mlxlogscore=616 mlxscore=0 suspectscore=0 malwarescore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2407300106 X-Proofpoint-GUID: w9Zlw64h9Ue4Q7kiPTrMi4uOwdZzudot X-Proofpoint-ORIG-GUID: w9Zlw64h9Ue4Q7kiPTrMi4uOwdZzudot X-Spam-Status: No, score=-12.0 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 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 you asprintf something and then use it only as input to another asprintf, it helps to free it afterwards. libctf/ * ctf-dump.c (ctf_dump_header): Free the flagstr after use. (ctf_dump): Make a NULL return slightly clearer. --- libctf/ctf-dump.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libctf/ctf-dump.c b/libctf/ctf-dump.c index cd41996084d..a37d4b75d45 100644 --- a/libctf/ctf-dump.c +++ b/libctf/ctf-dump.c @@ -349,6 +349,7 @@ ctf_dump_header (ctf_dict_t *fp, ctf_dump_state_t *state) if (asprintf (&str, "Flags: 0x%x (%s)", fp->ctf_openflags, flagstr) < 0) goto err; + free (flagstr); ctf_dump_append (state, str); } @@ -814,7 +815,7 @@ ctf_dump (ctf_dict_t *fp, ctf_dump_state_t **statep, ctf_sect_names_t sect, if (!str) { ctf_set_errno (fp, ENOMEM); - return str; + return NULL; } } From patchwork Tue Jul 30 15:37:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 94806 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 8A8DF3858430 for ; Tue, 30 Jul 2024 15:48:38 +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 263F6385DC1B for ; Tue, 30 Jul 2024 15:38:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 263F6385DC1B 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 263F6385DC1B 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=1722353901; cv=pass; b=K+hrnzM4dBWKKRw9W5Q5EGc+D7dDZCMF1SZJQGcqvjJGh7nIrKRwYy/EcHAYV2ldsnygHSIeZj163B6Ci9tRwNNLznWV+CTOhuP3SBEauYM1tYzzuSxT7YVqRwKhqnRKDDvqRxnq0sa5Ridzle9lyLdEqPeXBDvhLG6T5dEHwnQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1722353901; c=relaxed/simple; bh=/+ZPq4xQ4C7mRNhSetyy6wKMMI3ypNW2wGfiuHdfEqA=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=WKHNBx/b4NWORx91rt1Lh3PLmtRAGXHF6nL2Gbfe/hkNjnCin0v6NCBWeqWMQ7AlO4cXB26yJwCuk26X+npm0YIAXSQG3ncMTLgYGYJgt95e8Wy4/N7Xnj9A3F5YUbY10zoB+Rwyi0lWO0MqbwZae4yXNTJNhz7TkCKA7ou/U9w= 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 46UFMjKh018702 for ; Tue, 30 Jul 2024 15:38:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=uastqaasM/ETJBuSmIt303E8XEA79FCmoNn5Xt3JfQg=; b= E4iKyAJX3uyMyqfWuTPlGHOFGIyZfgIAggiF9dUhmUn5VSJKhcxK/K4iRen4IjCq q5Q00TqYqMVX4HbWPo3ra5Wj5LC5p8R2161Nrlq3hbA9yxRi3lB/J8gqhQtBOUPb h1mKA3dmu7/1uzptYIwgY2Sa6eY7l5tNulvs4FZvDbIZMA+3+CO+d+eBKUFBO/u+ cQG/deZYqXA0r80RLlgE6pMvH0fyDdUxdgQSxnJ4rM3gJ4XIYEn9xCvFIQjgaI8p 84Hfoneoh+8vKXXdXTPYIHadCxFdE7LH190uwIXV+z1XpMON6U783fXKR/11FD8R B1Vb5PhdGaI6ebbNO/h2dA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40mqp1we47-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:38: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 46UF52oO038116 for ; Tue, 30 Jul 2024 15:38:18 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 40pm83ebpd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 30 Jul 2024 15:38:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=R4Y+TjH7x8xPMr4Qev3Vwi9lb5/HwMogrcpvFyuXSkEzBBrniygIWiqyL/gZ/A1PnYHFInoTY/or1Ef11dY8DSdtTAA9ajThqMmPUjERZzevJ9eYNdbQi3T9kWjuV0WkqxpjxHCpvk4XytlNZcV67R2NEKLfnpULe3FclsQ/2vbp1dQDinnTLZjV+wftyX2wWqigyc/dgwo1J4CU0y/sQoBFTKpZukLX3PSldyBIvncFKZQH4F8S1qYql08fF2MRNT8G72m/4jBDdnfu+CdVVaCYkH3/Vm5zNE3ChlgtONN15xPP9q+4bqDRVKkQp8DdiiF9MH9xzfz9HuiranxGHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=uastqaasM/ETJBuSmIt303E8XEA79FCmoNn5Xt3JfQg=; b=SjNcGDHkiDSyeMtoi3nl5aim6AoiFKzYBkS8ezyvzm2CQXloQO3ugsYfIqhwY/eHj5bta4n5K1JiYynhTg0U7Kle8QCuEFltrSzyIaCn5W4NfLVPx9Qx3aco2vNkIw6/Oo83RYLqeG0haul3QXASQNca+v+7HEZ5Pd8dbyky2nGUkacDvrQudQiWlNeOSxSPSTm3RH+2aPmo8Bub6A9rju6mZ79nFl3B17+bxXttraes1V4g1T/Ca7S8ckv2l4/bX8vsh0Gen+8g1P7Q8uLudLr1F9uvOgzQqriy9vwjln1nzgNLF2q/dcTKvXwRm3hMAf6eCmJ8L0tNgprYSw8Rdg== 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=uastqaasM/ETJBuSmIt303E8XEA79FCmoNn5Xt3JfQg=; b=Njd6D26P1MbSpyOFYTdRJjB/8M8Ahhv719ci5VqlpWO2jyHoAivPSdRjlLtF9bKFULgTwTgUEv2ExVxJZdwHsouUAFdLRNTRLKNQrxKkAeft2nDYgHwnHzT8xPlVJneAm6njzkKz5KcShKRHVkzyrcB727KbLtmBmL0UOIL5epk= Received: from MW4PR10MB6608.namprd10.prod.outlook.com (2603:10b6:303:22e::8) by DM4PR10MB7476.namprd10.prod.outlook.com (2603:10b6:8:17d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.28; Tue, 30 Jul 2024 15:38: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.7807.026; Tue, 30 Jul 2024 15:38:16 +0000 From: Nick Alcock To: binutils@sourceware.org Subject: [PATCH 19/19] libctf: fix ctf_archive_count return value on big-endian Date: Tue, 30 Jul 2024 16:37:07 +0100 Message-ID: <20240730153707.168357-20-nick.alcock@oracle.com> X-Mailer: git-send-email 2.45.2.276.g4ac82df17e In-Reply-To: <20240730153707.168357-1-nick.alcock@oracle.com> References: <20240730153707.168357-1-nick.alcock@oracle.com> X-ClientProxiedBy: LO2P265CA0162.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9::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_|DM4PR10MB7476:EE_ X-MS-Office365-Filtering-Correlation-Id: be027d34-54c6-42a3-c03b-08dcb0ada162 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: IcQoyD2ircNipSYyN9KVrrCoOWu3uceR0DGzHzgrTnBP4iWRj8hxpIdKOlrOFod2u+dj28fBeRjRIwgNT7/F+BXyvlsowsOwRodfFTolfJ6oWtTUOZgJKTI0shT9beTG6+Pu4abYTEckbsOdS3/1PaHOHvJnSNSCy8UojeIbdo+Wul9fy8LPLKC2YT3f+zotjeBZ117t6c5+YIGcgnf/NJSFdWrPKLZJKekgJrjZ4T6CITXw1nBid5xDd0/fKNNqZYaniDMBYZQmUofVsbD6BfLZ4IG+oxkVwu4bLts9B97hUPk7I34fAkFaov2NqMXnQmYPotnkwpDkE6wPzknQouPud/n0NBKbcFUILMv82LIHRsStwiRQp6g1P7SyRUa8S+VK6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TNI6kfOwOgHF3kzRu7bitFPbzRpe5N0D78Uk9Cx0NEGvr9ql6Vxq5YhvVbGz9iLbH7dg+xJDORWadohwQNJNmx5U8OPXGDkYl1JpUgkZHytDf/0pTUPn1W9eKYy2JMha+qvlcoNMUxfFPzRgLAxgfDkZZkKomV0a2gUCXTUdVX3bUmiW2q0ZVbebV0OjcGYg8BoFWfA858TgnGl7W1Aa2YMP1L2/ddq3knFE7n8L0AeyfYYcGVE0RgUedr0gMpSaUkdXN3mc0cvz8EDz+qYNUpcHwi26x16+SdY4+NxKNsQA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: be027d34-54c6-42a3-c03b-08dcb0ada162 X-MS-Exchange-CrossTenant-AuthSource: MW4PR10MB6608.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2024 15:38:16.3874 (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: oCaOr5nq8ndTknQ2pzgcWSGheG2Is/cKi0gQVGeZdKWu1NPc/cEPwaSOFodONswssev9uYsDQcXDXKyyQ4fqPw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB7476 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-07-30_13,2024-07-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 mlxscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxlogscore=704 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2407300106 X-Proofpoint-ORIG-GUID: I2OhFQc7Qtoeyjk_4j23pVV7KxHcQhsW X-Proofpoint-GUID: I2OhFQc7Qtoeyjk_4j23pVV7KxHcQhsW X-Spam-Status: No, score=-12.4 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 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 failed to properly byteswap its return value. The ctf_archive format predates the idea of "just write natively and flip on open", and byteswaps all over the place. It's too easy to forget one. The next revision of the archive format (not versioned, so we just tweak the magic number instead) should be native-endianned like the dicts inside it are. libctf/ * ctf-archive.c (ctf_archive_count): Byteswap return value. --- libctf/ctf-archive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libctf/ctf-archive.c b/libctf/ctf-archive.c index 0034bf0982a..b73999cacb5 100644 --- a/libctf/ctf-archive.c +++ b/libctf/ctf-archive.c @@ -785,7 +785,7 @@ ctf_archive_count (const ctf_archive_t *wrapper) if (!wrapper->ctfi_is_archive) return 1; - return wrapper->ctfi_archive->ctfa_ndicts; + return le64toh (wrapper->ctfi_archive->ctfa_ndicts); } /* Look up a symbol in an archive by name or index (if the name is set, a lookup