From patchwork Thu Nov 17 03:43:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guillermo E. Martinez" X-Patchwork-Id: 60730 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 12CFA3959CB0 for ; Thu, 17 Nov 2022 03:43:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 12CFA3959CB0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668656617; bh=o55H0Ag3hget5Of5GlpMC4pPuKLnaLDhdw/Td9J6yOM=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Help:List-Subscribe:From: Reply-To:From; b=EZwTp58Qb6g8PAZCAboqU0uRxm/RdJVpmSXk5l7N/5Zxo40J46XKCqhByWxLo6oEm M3skUT7E1neD9rspbqcKgscvB6XJizwH/kFRGKoPhE767yJerwL5kEEzvv6AjERGnU Ax9lhCwtoGO161DUo0UGllfQzfVuVYsRRuOSUKM8= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 828083887F76 for ; Thu, 17 Nov 2022 03:43:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 828083887F76 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AH25QLK032463 for ; Thu, 17 Nov 2022 03:43:26 GMT Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kv3ns7npa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 17 Nov 2022 03:43:25 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2AH37wu6012420 for ; Thu, 17 Nov 2022 03:43:24 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2174.outbound.protection.outlook.com [104.47.56.174]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kt1xes4d3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 17 Nov 2022 03:43:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B3643OTadVPt+G32w9t+P1RkWEXYhJ3yY0ssNGs0cSjqt51tiBLPKaxaPqPBzBRAgEXorXcaw2AS7/15u0Id73pOMWHn6NDBUnqxl6zIcqD4PJdFgrbtqIyq9rlb8pxvc4QhG4gPYOtSE7ZDJXzvMMOxdD5yiDHjMdAiUZ6fOAGQSqjN3FP64s1146dO63j1310yEUHoQ1deeS+wMMz1eBqJ6UksGWHSff4Cf9bM++106fT1NEP6xRi9iOhX3UovRgFNY8URTzu6qi+Z12ZkYlM6H21gCfsya7CAVrGhXRuazCf8s7ji+t2fpPYR+lBi/5lcH9BUIx37l7EJxO+/aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=o55H0Ag3hget5Of5GlpMC4pPuKLnaLDhdw/Td9J6yOM=; b=N5wmVHHaTtLlmSDk/xWhr8O/UhishP6mRwESm8brF5cufcu19VDeSuFSFEbL8jONzjnJLOwurr3rf2Scb9go5ayXCQ9IQikfuCUxbHHgcQ4M6YruNtibNWYGfBSThA62ZurESBGZE0x77XJi+s/ePlWPSs0lOvdIkdIPpBU5cqiaOWM+xfBmHXk8gLPH2BOeNFOyckvc0hy4KDzyx/UYYXf3ChbO4EwquDMkb9g59avb/lIXz0ISZ9QlWKt+26FtDzH9Prrjwn+LhMG5DhiJZLFhyFlih8+/aIyVneCClVNSL61d/7c2BJSqyo7VUrzi7nWC1IJDAmuhYMnTVAoGmw== 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 Received: from MWHPR10MB1407.namprd10.prod.outlook.com (2603:10b6:300:23::20) by CH0PR10MB4843.namprd10.prod.outlook.com (2603:10b6:610:cb::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.20; Thu, 17 Nov 2022 03:43:20 +0000 Received: from MWHPR10MB1407.namprd10.prod.outlook.com ([fe80::1800:88c1:fae8:13b4]) by MWHPR10MB1407.namprd10.prod.outlook.com ([fe80::1800:88c1:fae8:13b4%10]) with mapi id 15.20.5813.020; Thu, 17 Nov 2022 03:43:20 +0000 To: libabigail@sourceware.org Cc: "Guillermo E. Martinez" Subject: [PATCH 1/5] ctf-front-end: Set alignment-in-bits property to 0 Date: Wed, 16 Nov 2022 21:43:01 -0600 Message-Id: <20221117034305.184864-2-guillermo.e.martinez@oracle.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221117034305.184864-1-guillermo.e.martinez@oracle.com> References: <20221117034305.184864-1-guillermo.e.martinez@oracle.com> X-ClientProxiedBy: SN4PR0501CA0018.namprd05.prod.outlook.com (2603:10b6:803:40::31) To MWHPR10MB1407.namprd10.prod.outlook.com (2603:10b6:300:23::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR10MB1407:EE_|CH0PR10MB4843:EE_ X-MS-Office365-Filtering-Correlation-Id: 2ff0e0ef-0a22-441b-2117-08dac84ddd16 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: abKWLV8a1mh4syqasAlePmodCihgFdH5ztBb4hs7eX7SoZLGAIVlvG9QdJLSQHKAfpmD6aBuiXB6luBJoIqHp1IBY2wL/YjLvCfIT0Ve1t316BR5xD3AfmEQIfvMuzcFMdVEgUhK9VXS+jlVj4Gm81z3AQzp3xeDaNtQYZfqPjANHr1o+w+7QNireiM+uoolpG+VfdQ6ThZDG0idLMVP4S6Cu2FJGdAOPmXzciZQNAwaM2Z0b5ANkY7D2HX3p1akd6yQLAuQvs5YBZS5et0yUi+mqLOckaE/Hbe7g/IGEc5G8MuAs4UluszNUvwJL1K+QvlvS9pumJU5A6+6GzFnS4h1+O8hk+fX2mrzJf3XmILBhSG9WemqSFVGr6xjcKSi6b3ziUssWDxxoc7/dfSJ6UpwQ0eGbnVc/aGyqofXbITyeugyIuzFff/eh8/umZd9vG+LbYC/CPNiGy2z3U501e55n4lT4tQRm7VBNq5wP6Q7J0xWXpfRyq3C/+R7OJ5hWsiGray1i3nOPUDf9qQtBqyOs4QI81MeIdUWzO4UCqhoIlPh1n0+DG6xv/Lbn0K+OC7TDloKBHwePIW66Vd531s30TF60WFFPTto/Go5ebVYMZi2lLL4SIKUIBOHLKifTipHBo1dDupwTZwzBxJ2WePxscHuXrKpHuA6Hzje14kNE7vQcASceKmkS0O1WnSeh0JqaVFOt2C8di3kzL3qdQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR10MB1407.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(136003)(346002)(39860400002)(376002)(396003)(366004)(451199015)(86362001)(36756003)(103116003)(41300700001)(2616005)(66946007)(66476007)(66556008)(4326008)(8676002)(30864003)(1076003)(186003)(8936002)(5660300002)(107886003)(6666004)(478600001)(6486002)(19627235002)(316002)(6512007)(6506007)(6916009)(38100700002)(83380400001)(2906002)(559001)(579004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sAZDwJUvmY3hQmKvPPB3cV8LgtsCLCCIIFAEIr7LxIPGiSnBTZ7ziJOBLA1yqgcDSsSUncH2Ra01GorM3KctJ+qUQ5j5WcYDhg3oetDTecvF5UWywva3zP7M7yHe83fd0qhiDKTMRpkqB04ZLnyvWIYY4iUiHq7BSWFVy516Fw2bKli4NdqMl5ps5tq8PP9YP10Vx6NSf603AX9TZEKRFU3wzp0cuEKqiwHcG9oNi47IHJUijAdxKtzS2teoEfCepwWH5vV2aQlrbZDJmJCKAcF6rJSMCFvR7atu68devAEbW3HKUkR+QdqxjLpu8+rTxQTvmb/qFxtCgym1ss4VRL5t3Zgt0mJP7OTmbonE4m6iST/EOX23UWBsnawne9AlQeU7e9TfR9n8gWNdR4u74zp9nuFEXigrDsCpF9aFKEeDYtBfyfJrDgg+bQm4rC6d23bnulm0NmW1ikQLJ9V2l2TRgkVtdQ27FXOGKfvfSoxxYqoeM7ZErs2QmHq0wfWVJoSGxN+L9tMxgO1rmonOMsBIAsTrOxXR6BlKpB4H+JcRy3ZlVPF1etNnvhq1Q6PYfn7cIAJV8hQVPacI2agtmHPZP3uRgXdG9sLIWjk+L16UUDXbsrrpuomxYIo3zqMzinRXq+f5mLeVMwCTk3GQ0VmXn95AcS3ppESRBLPe3I4bLCtbijG7dCyJE1ez2XgBDma6P3vwT2Kl5ZggtSfBw1pdQFgkCjSZN1OhbH5Rzyc5drWBKN/+LoxFOvVj7QVYU/NGt7xqTSMBqsawZew9C6m6iOuBb3cwgOQkkKkl4GuyUpQOShmruZnqC+5cfrABH3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KvpwqL4S6zWvjaBZ2iOwwbqaRNFcX8UL8OZ056DV4IAWcLSp/2zX6/N1v+X6MK+kAo2R1LOmnCCdPtO1P948b85cPWJ0mRBIywyacJY1/H0B+38naY5kC2gfDHynmRhLpP7J2d1OI1zDR7sl1wDmAYKUeMb9mlhZKFUbefMIIOkQCC7ha+NKqYMf60cFd/R248ocS47Hk5cTmWtnJ1mUv9ioB4BqkiaMXSouXGts8FugyNic4B0+HJpvqZkKNs39riCfpZ40ZxUYRdnxZns247XJSO6rJkYLK3+ws+yHnTwqlv9sBRV8lNUpHT7RqIbC/qj31mXshhPgnU3vplpNgwZs/zxy2NAE142nrM9mvXN0F2zFnNRnvqK7JYxt+/gzykIy+/eoXhoZOxvRDOa3r0eP5xPX1SYoUl1dqTRJs7Zpnbcy6IC2mKKmLmn1bvQztGu+lsC2dvcsItKSsjNWHZfNYSn0xMrpLMAk+50XXTF1q53LQjhcZU72y0050EL9+ff8LhjiKpIcBTne3coQYgl3xBpZFVzSeYxkRCqP6sQ2mqbDNUbSpDkyDml24VY0eFsnatYHC2ouRhiA/5Kfa7ji2n0aQqtDPMJu3se2PLNXjzquKXJAd990y62eqw//HeGq547tbwkiLphurG9w== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2ff0e0ef-0a22-441b-2117-08dac84ddd16 X-MS-Exchange-CrossTenant-AuthSource: MWHPR10MB1407.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2022 03:43:19.5003 (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: KE/r8lt3o1pui0B+WADwh9lVwjJjietYuEGv375SqhNgo4/X0k6yViQHOQelC59ZG8o6f80as5sAxRD0gNNv6xVRm+OQGhmZ0s8hR/AyWPc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB4843 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-16_03,2022-11-16_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 mlxscore=0 phishscore=0 suspectscore=0 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211170024 X-Proofpoint-GUID: 9VuRnd1fCS13VuAkOutC65n6BnyOv6k6 X-Proofpoint-ORIG-GUID: 9VuRnd1fCS13VuAkOutC65n6BnyOv6k6 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SCC_10_SHORT_WORD_LINES, SCC_20_SHORT_WORD_LINES, SCC_5_SHORT_WORD_LINES, 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: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: "Guillermo E. Martinez via Libabigail" From: "Guillermo E. Martinez" Reply-To: "Guillermo E. Martinez" Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" When comparing IR generated with DWARF and CTF fron-ends the report of different shows changes in the `alignment-in-bits' ABI XML propery: 1 Changed variable: [C] 'int a' was changed at test-abi.c:8:1: type of variable changed: type size hasn't changed type alignment changed from 32 to 0 So, CTF set the alignment to `0' to base types, function types and struct types similarly as DWARF front-end does. * src/abg-ctf-reader.cc (process_ctf_base_type) (process_ctf_function_type, process_ctf_struct_type): Adjust `align_in_bits' argument to `0'. * tests/data/test-diff-pkg-ctf/dirpkg-3-report-1.txt: Adjust test. * tests/data/test-diff-pkg-ctf/dirpkg-3-report-2.txt: Likewise. * tests/data/test-diff-pkg-ctf/gmp-6.x.x86_64-report-0.txt: Likewise. * tests/data/test-read-ctf/PR27700/test-PR27700.abi: Likewise. * tests/data/test-read-ctf/test-PR26568-1.o.abi: Likewise. * tests/data/test-read-ctf/test-PR26568-2.o.abi: Likewise. * tests/data/test-read-ctf/test-ambiguous-struct-A.o.hash.abi: Likewise. * tests/data/test-read-ctf/test-ambiguous-struct-B.o.hash.abi: Likewise. * tests/data/test-read-ctf/test-anonymous-fields.o.abi: Likewise. * tests/data/test-read-ctf/test-array-of-pointers.abi: Likewise. * tests/data/test-read-ctf/test-callback.abi: Likewise. * tests/data/test-read-ctf/test-callback2.abi: Likewise. * tests/data/test-read-ctf/test-conflicting-type-syms-a.o.hash.abi: Likewise. * tests/data/test-read-ctf/test-conflicting-type-syms-b.o.hash.abi: Likewise. * tests/data/test-read-ctf/test-dynamic-array.o.abi: Likewise. * tests/data/test-read-ctf/test-fallback.abi: Likewise. * tests/data/test-read-ctf/test-forward-type-decl.abi: Likewise. * tests/data/test-read-ctf/test-functions-declaration.abi: Likewise. * tests/data/test-read-ctf/test-linux-module.abi: Likewise. * tests/data/test-read-ctf/test-linux-module.abi: Likewise. * tests/data/test-read-ctf/test-list-struct.abi: Likewise. * tests/data/test-read-ctf/test0.abi: Likewise. * tests/data/test-read-ctf/test0.hash.abi: Likewise. * tests/data/test-read-ctf/test1.so.abi: Likewise. * tests/data/test-read-ctf/test1.so.hash.abi: Likewise. * tests/data/test-read-ctf/test2.so.abi: Likewise. * tests/data/test-read-ctf/test2.so.hash.abi: Likewise. * tests/data/test-read-ctf/test3.so.abi: Likewise. * tests/data/test-read-ctf/test3.so.hash.abi: Likewise. * tests/data/test-read-ctf/test4.so.abi: Likewise. * tests/data/test-read-ctf/test4.so.hash.abi: Likewise. * tests/data/test-read-ctf/test5.o.abi: Likewise. * tests/data/test-read-ctf/test7.o.abi: Likewise. * tests/data/test-read-ctf/test8.o.abi: Likewise. * tests/data/test-read-ctf/test9.o.abi: Likewise. Signed-off-by: Guillermo E. Martinez Signed-off-by: Guillermo E. Martinez Signed-off-by: Dodji Seketeli --- src/abg-ctf-reader.cc | 7 +++--- .../test-diff-pkg-ctf/dirpkg-3-report-1.txt | 1 - .../test-diff-pkg-ctf/dirpkg-3-report-2.txt | 1 - .../gmp-6.x.x86_64-report-0.txt | 1 + .../test-read-ctf/PR27700/test-PR27700.abi | 2 +- tests/data/test-read-ctf/test-PR26568-1.o.abi | 12 +++++----- tests/data/test-read-ctf/test-PR26568-2.o.abi | 10 ++++---- .../test-ambiguous-struct-A.o.hash.abi | 10 ++++---- .../test-ambiguous-struct-B.o.hash.abi | 6 ++--- .../test-read-ctf/test-anonymous-fields.o.abi | 10 ++++---- .../test-read-ctf/test-array-of-pointers.abi | 10 ++++---- tests/data/test-read-ctf/test-callback.abi | 8 +++---- tests/data/test-read-ctf/test-callback2.abi | 6 ++--- .../test-conflicting-type-syms-a.o.hash.abi | 2 +- .../test-conflicting-type-syms-b.o.hash.abi | 2 +- .../test-read-ctf/test-dynamic-array.o.abi | 10 ++++---- tests/data/test-read-ctf/test-fallback.abi | 2 +- .../test-read-ctf/test-forward-type-decl.abi | 6 ++--- .../test-functions-declaration.abi | 10 ++++---- .../data/test-read-ctf/test-linux-module.abi | 18 +++++++------- tests/data/test-read-ctf/test-list-struct.abi | 4 ++-- tests/data/test-read-ctf/test0.abi | 24 +++++++++---------- tests/data/test-read-ctf/test0.hash.abi | 24 +++++++++---------- tests/data/test-read-ctf/test1.so.abi | 4 ++-- tests/data/test-read-ctf/test1.so.hash.abi | 4 ++-- tests/data/test-read-ctf/test2.so.abi | 8 +++---- tests/data/test-read-ctf/test2.so.hash.abi | 8 +++---- tests/data/test-read-ctf/test3.so.abi | 2 +- tests/data/test-read-ctf/test3.so.hash.abi | 2 +- tests/data/test-read-ctf/test4.so.abi | 6 ++--- tests/data/test-read-ctf/test4.so.hash.abi | 6 ++--- tests/data/test-read-ctf/test5.o.abi | 18 +++++++------- tests/data/test-read-ctf/test7.o.abi | 10 ++++---- tests/data/test-read-ctf/test8.o.abi | 2 +- tests/data/test-read-ctf/test9.o.abi | 20 ++++++++-------- 35 files changed, 137 insertions(+), 139 deletions(-) diff --git a/src/abg-ctf-reader.cc b/src/abg-ctf-reader.cc index 9950de57..9c41edf4 100644 --- a/src/abg-ctf-reader.cc +++ b/src/abg-ctf-reader.cc @@ -788,7 +788,6 @@ process_ctf_base_type(reader *rdr, translation_unit_sptr tunit = rdr->cur_transl_unit(); type_decl_sptr result; - ssize_t type_alignment = ctf_type_align(ctf_dictionary, ctf_type); const char *type_name = ctf_type_name_raw(ctf_dictionary, ctf_type); /* Get the type encoding and extract some useful properties of @@ -827,7 +826,7 @@ process_ctf_base_type(reader *rdr, result.reset(new type_decl(rdr->env(), type_name, type_encoding.cte_bits, - type_alignment * 8 /* in bits */, + /*alignment=*/0, location(), type_name /* mangled_name */)); @@ -936,7 +935,7 @@ process_ctf_function_type(reader *rdr, result.reset(new function_type(ret_type, function_parms, tunit->get_address_size(), - ctf_type_align(ctf_dictionary, ctf_type))); + /*alignment=*/0)); if (result) { @@ -1095,7 +1094,7 @@ process_ctf_struct_type(reader *rdr, result.reset(new class_decl(rdr->env(), struct_type_name, ctf_type_size(ctf_dictionary, ctf_type) * 8, - ctf_type_align(ctf_dictionary, ctf_type) * 8, + /*alignment=*/0, true /* is_struct */, location(), decl_base::VISIBILITY_DEFAULT, diff --git a/tests/data/test-diff-pkg-ctf/dirpkg-3-report-1.txt b/tests/data/test-diff-pkg-ctf/dirpkg-3-report-1.txt index 4938d221..aa1d7732 100644 --- a/tests/data/test-diff-pkg-ctf/dirpkg-3-report-1.txt +++ b/tests/data/test-diff-pkg-ctf/dirpkg-3-report-1.txt @@ -8,7 +8,6 @@ parameter 1 of type 'S1*' has sub-type changes: in pointed to type 'struct S1': type size changed from 0 to 32 (in bits) - type alignment changed from 0 to 32 1 data member insertion: 'int mem2', at offset 0 (in bits) diff --git a/tests/data/test-diff-pkg-ctf/dirpkg-3-report-2.txt b/tests/data/test-diff-pkg-ctf/dirpkg-3-report-2.txt index 4938d221..aa1d7732 100644 --- a/tests/data/test-diff-pkg-ctf/dirpkg-3-report-2.txt +++ b/tests/data/test-diff-pkg-ctf/dirpkg-3-report-2.txt @@ -8,7 +8,6 @@ parameter 1 of type 'S1*' has sub-type changes: in pointed to type 'struct S1': type size changed from 0 to 32 (in bits) - type alignment changed from 0 to 32 1 data member insertion: 'int mem2', at offset 0 (in bits) diff --git a/tests/data/test-diff-pkg-ctf/gmp-6.x.x86_64-report-0.txt b/tests/data/test-diff-pkg-ctf/gmp-6.x.x86_64-report-0.txt index d3915f14..171d6490 100644 --- a/tests/data/test-diff-pkg-ctf/gmp-6.x.x86_64-report-0.txt +++ b/tests/data/test-diff-pkg-ctf/gmp-6.x.x86_64-report-0.txt @@ -133,6 +133,7 @@ underlying type 'const mp_limb_t*' changed: entity changed from 'const mp_limb_t*' to 'unsigned long int' type size hasn't changed + type alignment changed from 64 to 0 parameter 2 of type 'typedef mp_size_t' changed: typedef name changed from mp_size_t to mp_limb_t underlying type 'long int' changed: diff --git a/tests/data/test-read-ctf/PR27700/test-PR27700.abi b/tests/data/test-read-ctf/PR27700/test-PR27700.abi index fe3a897d..4f34eb8a 100644 --- a/tests/data/test-read-ctf/PR27700/test-PR27700.abi +++ b/tests/data/test-read-ctf/PR27700/test-PR27700.abi @@ -12,7 +12,7 @@ - + diff --git a/tests/data/test-read-ctf/test-PR26568-1.o.abi b/tests/data/test-read-ctf/test-PR26568-1.o.abi index 7df180d4..60017457 100644 --- a/tests/data/test-read-ctf/test-PR26568-1.o.abi +++ b/tests/data/test-read-ctf/test-PR26568-1.o.abi @@ -3,19 +3,19 @@ - - - + + + - + - + @@ -29,7 +29,7 @@ - + diff --git a/tests/data/test-read-ctf/test-PR26568-2.o.abi b/tests/data/test-read-ctf/test-PR26568-2.o.abi index 44f72263..d038316a 100644 --- a/tests/data/test-read-ctf/test-PR26568-2.o.abi +++ b/tests/data/test-read-ctf/test-PR26568-2.o.abi @@ -3,14 +3,14 @@ - - - + + + - + @@ -24,7 +24,7 @@ - + diff --git a/tests/data/test-read-ctf/test-ambiguous-struct-A.o.hash.abi b/tests/data/test-read-ctf/test-ambiguous-struct-A.o.hash.abi index 91ddf181..42ce36de 100644 --- a/tests/data/test-read-ctf/test-ambiguous-struct-A.o.hash.abi +++ b/tests/data/test-read-ctf/test-ambiguous-struct-A.o.hash.abi @@ -3,11 +3,11 @@ - + - - + + @@ -21,13 +21,13 @@ - + - + diff --git a/tests/data/test-read-ctf/test-ambiguous-struct-B.o.hash.abi b/tests/data/test-read-ctf/test-ambiguous-struct-B.o.hash.abi index cba10afd..351483de 100644 --- a/tests/data/test-read-ctf/test-ambiguous-struct-B.o.hash.abi +++ b/tests/data/test-read-ctf/test-ambiguous-struct-B.o.hash.abi @@ -3,8 +3,8 @@ - - + + @@ -15,7 +15,7 @@ - + diff --git a/tests/data/test-read-ctf/test-anonymous-fields.o.abi b/tests/data/test-read-ctf/test-anonymous-fields.o.abi index 2df54c3b..987daa57 100644 --- a/tests/data/test-read-ctf/test-anonymous-fields.o.abi +++ b/tests/data/test-read-ctf/test-anonymous-fields.o.abi @@ -3,18 +3,18 @@ - - + + - + - + @@ -27,7 +27,7 @@ - + diff --git a/tests/data/test-read-ctf/test-array-of-pointers.abi b/tests/data/test-read-ctf/test-array-of-pointers.abi index 47135315..c521bbec 100644 --- a/tests/data/test-read-ctf/test-array-of-pointers.abi +++ b/tests/data/test-read-ctf/test-array-of-pointers.abi @@ -6,27 +6,27 @@ - + - + - + - + - + diff --git a/tests/data/test-read-ctf/test-callback.abi b/tests/data/test-read-ctf/test-callback.abi index 7f9b6c5f..3c90e737 100644 --- a/tests/data/test-read-ctf/test-callback.abi +++ b/tests/data/test-read-ctf/test-callback.abi @@ -4,12 +4,12 @@ - - - + + + - + diff --git a/tests/data/test-read-ctf/test-callback2.abi b/tests/data/test-read-ctf/test-callback2.abi index c2ffdb18..87b43d06 100644 --- a/tests/data/test-read-ctf/test-callback2.abi +++ b/tests/data/test-read-ctf/test-callback2.abi @@ -3,8 +3,8 @@ - - + + @@ -12,7 +12,7 @@ - + diff --git a/tests/data/test-read-ctf/test-conflicting-type-syms-a.o.hash.abi b/tests/data/test-read-ctf/test-conflicting-type-syms-a.o.hash.abi index 85e780a9..79079b04 100644 --- a/tests/data/test-read-ctf/test-conflicting-type-syms-a.o.hash.abi +++ b/tests/data/test-read-ctf/test-conflicting-type-syms-a.o.hash.abi @@ -4,7 +4,7 @@ - + diff --git a/tests/data/test-read-ctf/test-conflicting-type-syms-b.o.hash.abi b/tests/data/test-read-ctf/test-conflicting-type-syms-b.o.hash.abi index 400606dd..74b25d36 100644 --- a/tests/data/test-read-ctf/test-conflicting-type-syms-b.o.hash.abi +++ b/tests/data/test-read-ctf/test-conflicting-type-syms-b.o.hash.abi @@ -4,7 +4,7 @@ - + diff --git a/tests/data/test-read-ctf/test-dynamic-array.o.abi b/tests/data/test-read-ctf/test-dynamic-array.o.abi index a9849d49..a8978c0c 100644 --- a/tests/data/test-read-ctf/test-dynamic-array.o.abi +++ b/tests/data/test-read-ctf/test-dynamic-array.o.abi @@ -3,11 +3,11 @@ - - + + - + @@ -18,10 +18,10 @@ - + - + diff --git a/tests/data/test-read-ctf/test-fallback.abi b/tests/data/test-read-ctf/test-fallback.abi index e7d30594..9f09cd56 100644 --- a/tests/data/test-read-ctf/test-fallback.abi +++ b/tests/data/test-read-ctf/test-fallback.abi @@ -3,7 +3,7 @@ - + diff --git a/tests/data/test-read-ctf/test-forward-type-decl.abi b/tests/data/test-read-ctf/test-forward-type-decl.abi index 026e7d32..c239187b 100644 --- a/tests/data/test-read-ctf/test-forward-type-decl.abi +++ b/tests/data/test-read-ctf/test-forward-type-decl.abi @@ -3,7 +3,7 @@ - + @@ -11,12 +11,12 @@ - + - + diff --git a/tests/data/test-read-ctf/test-functions-declaration.abi b/tests/data/test-read-ctf/test-functions-declaration.abi index dd8516fd..193221e4 100644 --- a/tests/data/test-read-ctf/test-functions-declaration.abi +++ b/tests/data/test-read-ctf/test-functions-declaration.abi @@ -4,19 +4,19 @@ - - + + - + - + - + diff --git a/tests/data/test-read-ctf/test-linux-module.abi b/tests/data/test-read-ctf/test-linux-module.abi index e8081f16..933b9f82 100644 --- a/tests/data/test-read-ctf/test-linux-module.abi +++ b/tests/data/test-read-ctf/test-linux-module.abi @@ -7,8 +7,8 @@ - - + + @@ -16,17 +16,17 @@ - + - + - + @@ -50,13 +50,13 @@ - - + + - + - + diff --git a/tests/data/test-read-ctf/test-list-struct.abi b/tests/data/test-read-ctf/test-list-struct.abi index ecd4d08b..3fdc6aec 100644 --- a/tests/data/test-read-ctf/test-list-struct.abi +++ b/tests/data/test-read-ctf/test-list-struct.abi @@ -4,8 +4,8 @@ - - + + diff --git a/tests/data/test-read-ctf/test0.abi b/tests/data/test-read-ctf/test0.abi index 2129de41..05430067 100644 --- a/tests/data/test-read-ctf/test0.abi +++ b/tests/data/test-read-ctf/test0.abi @@ -20,21 +20,21 @@ - - - - - + + + + + - - - + + + - + @@ -42,7 +42,7 @@ - + @@ -53,11 +53,11 @@ - + - + diff --git a/tests/data/test-read-ctf/test0.hash.abi b/tests/data/test-read-ctf/test0.hash.abi index e98c97db..4aa9a93c 100644 --- a/tests/data/test-read-ctf/test0.hash.abi +++ b/tests/data/test-read-ctf/test0.hash.abi @@ -20,21 +20,21 @@ - - - - - + + + + + - - - + + + - + @@ -42,7 +42,7 @@ - + @@ -53,11 +53,11 @@ - + - + diff --git a/tests/data/test-read-ctf/test1.so.abi b/tests/data/test-read-ctf/test1.so.abi index 4d0895a3..822b57a5 100644 --- a/tests/data/test-read-ctf/test1.so.abi +++ b/tests/data/test-read-ctf/test1.so.abi @@ -12,7 +12,7 @@ - + @@ -21,7 +21,7 @@ - + diff --git a/tests/data/test-read-ctf/test1.so.hash.abi b/tests/data/test-read-ctf/test1.so.hash.abi index 89bbb528..b3ace158 100644 --- a/tests/data/test-read-ctf/test1.so.hash.abi +++ b/tests/data/test-read-ctf/test1.so.hash.abi @@ -12,7 +12,7 @@ - + @@ -21,7 +21,7 @@ - + diff --git a/tests/data/test-read-ctf/test2.so.abi b/tests/data/test-read-ctf/test2.so.abi index 53001972..f2fb069d 100644 --- a/tests/data/test-read-ctf/test2.so.abi +++ b/tests/data/test-read-ctf/test2.so.abi @@ -7,12 +7,12 @@ - + - + @@ -23,11 +23,11 @@ - + - + diff --git a/tests/data/test-read-ctf/test2.so.hash.abi b/tests/data/test-read-ctf/test2.so.hash.abi index 84fcaa96..1efd533a 100644 --- a/tests/data/test-read-ctf/test2.so.hash.abi +++ b/tests/data/test-read-ctf/test2.so.hash.abi @@ -7,12 +7,12 @@ - + - + @@ -23,11 +23,11 @@ - + - + diff --git a/tests/data/test-read-ctf/test3.so.abi b/tests/data/test-read-ctf/test3.so.abi index 25fe7685..8e2492f3 100644 --- a/tests/data/test-read-ctf/test3.so.abi +++ b/tests/data/test-read-ctf/test3.so.abi @@ -11,7 +11,7 @@ - + diff --git a/tests/data/test-read-ctf/test3.so.hash.abi b/tests/data/test-read-ctf/test3.so.hash.abi index 07dd9601..f991d33a 100644 --- a/tests/data/test-read-ctf/test3.so.hash.abi +++ b/tests/data/test-read-ctf/test3.so.hash.abi @@ -11,7 +11,7 @@ - + diff --git a/tests/data/test-read-ctf/test4.so.abi b/tests/data/test-read-ctf/test4.so.abi index 21241d30..9f4e9255 100644 --- a/tests/data/test-read-ctf/test4.so.abi +++ b/tests/data/test-read-ctf/test4.so.abi @@ -6,14 +6,14 @@ - - + + - + diff --git a/tests/data/test-read-ctf/test4.so.hash.abi b/tests/data/test-read-ctf/test4.so.hash.abi index 40ab7069..1e952c75 100644 --- a/tests/data/test-read-ctf/test4.so.hash.abi +++ b/tests/data/test-read-ctf/test4.so.hash.abi @@ -6,14 +6,14 @@ - - + + - + diff --git a/tests/data/test-read-ctf/test5.o.abi b/tests/data/test-read-ctf/test5.o.abi index 84eb34d7..6d72d7ab 100644 --- a/tests/data/test-read-ctf/test5.o.abi +++ b/tests/data/test-read-ctf/test5.o.abi @@ -8,39 +8,39 @@ - + - - - + + + - + - + - + - + - + diff --git a/tests/data/test-read-ctf/test7.o.abi b/tests/data/test-read-ctf/test7.o.abi index 85468e11..65371cf5 100644 --- a/tests/data/test-read-ctf/test7.o.abi +++ b/tests/data/test-read-ctf/test7.o.abi @@ -3,8 +3,8 @@ - - + + @@ -18,16 +18,16 @@ - + - + - + diff --git a/tests/data/test-read-ctf/test8.o.abi b/tests/data/test-read-ctf/test8.o.abi index b6996c29..430bc128 100644 --- a/tests/data/test-read-ctf/test8.o.abi +++ b/tests/data/test-read-ctf/test8.o.abi @@ -4,7 +4,7 @@ - + diff --git a/tests/data/test-read-ctf/test9.o.abi b/tests/data/test-read-ctf/test9.o.abi index c983d17f..331bfc70 100644 --- a/tests/data/test-read-ctf/test9.o.abi +++ b/tests/data/test-read-ctf/test9.o.abi @@ -3,31 +3,31 @@ - + - + - - + + - + - + - + - + @@ -44,12 +44,12 @@ - + - + From patchwork Thu Nov 17 03:43:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guillermo E. Martinez" X-Patchwork-Id: 60731 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 3A5003887F76 for ; Thu, 17 Nov 2022 03:43:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3A5003887F76 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668656623; bh=643c6J+zS1A3YvMHJVj0DlJgFKp8Cy+EvSyhQvWfpz8=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Help:List-Subscribe:From: Reply-To:From; b=SLOoSMfAdkfN12yaTt2vUaOI0ltn0ysV3KCqH64K53hTE/bxYxFY5GOyZoEfQDUrN DKCLf+JpRfc+3zLV3MUeLtec+6VfP/K5y+epgZmHANVg2wWCzSoyn3Biezz1h/NDuI DZQTzii8OCF9O7KldllXToCXoBtjPcpMEHBMoni4= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id A41E03954C5D for ; Thu, 17 Nov 2022 03:43:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A41E03954C5D Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AH25QLL032463 for ; Thu, 17 Nov 2022 03:43:32 GMT Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kv3ns7npd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 17 Nov 2022 03:43:32 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2AH3Nwc9027035 for ; Thu, 17 Nov 2022 03:43:31 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2171.outbound.protection.outlook.com [104.47.56.171]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kt1x8e6db-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 17 Nov 2022 03:43:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AtBZtjV5JBlY9+Io3XNtzwFHUXgZtXAOXqmNrqJkZFjf/5wro9XKEFoN3isU5P3UXEFxNlJp7e++bBYkI01JI28GIeBFmeLw1Fyi+RugYAai8O5yidFGSUHuJG+BuwNj6UVxlevoCDEv1/eK3rFYrHgHfly3NrEYqFhWwuXGCReACs7op9hYSLFYaKcfEBDJByg56oVokLzFe576R32zq2GpSkbNZHqbGZq45VGaT46RzPV7Qe/RApqfkczguh68HCivE5wCcbnSgtOcOPVJKLbwahGZUPhjwtPN6v3XTqKeET9WSfEOzYf/7kCKVk8L7dh8sEvJcyYl5sGxJ6imuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=643c6J+zS1A3YvMHJVj0DlJgFKp8Cy+EvSyhQvWfpz8=; b=Dc+2EWu1q9yzcfA0oUhGi5mIaBFHzNPByAkEK49LlxF1THBtm6OfwlWoVDg10IiJ6B4+I2KGy5mZvaa+M5OC4cynIBLveyFiSaoT+aOp0CDkts2vrcQRd1j6z6fqLDkYwVxwQM6GKK+NNa1eWBK9lyaeeKXGp9xGx+26ZJfNzyufmjljEMQG8u1LleP4mt2ZZuPwFJe+DbGXjVLWihYCmcNDr0wBw4+gHspGZiJxkpxvxONbRasTs8R3z5BaTwl+kepjsaj4NwyAD0ixAE5HGQlszj5Uu1P9Sr3BlCK4JHmCEKZZ0DmqJQbJ4XQihTFl9A/wKzhEGt6t0Pn5ok8iRQ== 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 Received: from MWHPR10MB1407.namprd10.prod.outlook.com (2603:10b6:300:23::20) by CH0PR10MB4843.namprd10.prod.outlook.com (2603:10b6:610:cb::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.20; Thu, 17 Nov 2022 03:43:28 +0000 Received: from MWHPR10MB1407.namprd10.prod.outlook.com ([fe80::1800:88c1:fae8:13b4]) by MWHPR10MB1407.namprd10.prod.outlook.com ([fe80::1800:88c1:fae8:13b4%10]) with mapi id 15.20.5813.020; Thu, 17 Nov 2022 03:43:27 +0000 To: libabigail@sourceware.org Cc: "Guillermo E. Martinez" Subject: [PATCH 2/5] ctf-front-end: Fix size and name for underlying types Date: Wed, 16 Nov 2022 21:43:02 -0600 Message-Id: <20221117034305.184864-3-guillermo.e.martinez@oracle.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221117034305.184864-1-guillermo.e.martinez@oracle.com> References: <20221117034305.184864-1-guillermo.e.martinez@oracle.com> X-ClientProxiedBy: SA0PR11CA0028.namprd11.prod.outlook.com (2603:10b6:806:d3::33) To MWHPR10MB1407.namprd10.prod.outlook.com (2603:10b6:300:23::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR10MB1407:EE_|CH0PR10MB4843:EE_ X-MS-Office365-Filtering-Correlation-Id: 11d2d365-a4d6-4114-bf89-08dac84de091 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bsZe5KB7kalz+oHsOonbkoKJr2aes0DAB29EVW7gCRXrg+5aJKC73tQ0gVtR9c2xREngqLTXz2FF+kwF1LXdSqxY0c1Do95j5ayamSoSDr1yXqEtU+ytGriI8Fmx2ZGH13XSIr7KJuzi44kV66xR7euSd+H2ZM5zss8MjpoMzMGNfC0jADdrYiCv7cKmU8tsbk65KCMztfW2vaZNi2VjrEeYLXh3+pKRaOLzFlpqJxNIS2UlV7icEXwPWF0TiUzA9Df3mafNyd7I7gssTAM4KV/6p5gzp7LMOUQv6xaKQEfvJjRE0QrhAus+Iis27+3vJxRcF+WO84n4VFWDXejmCNQKxexZitugfdXalN/9hFrbdTUFslyOFVn62po1BFlYRrptIN+b9LTeb1UysptM4FLDhwR1B+pj72EVp20cDMIl6SmjB40K13wd+ikqL7bEqgNpD6FliV8tkYuS4UiApIlgvxadLvv1m5Fpcy6j8imkI+fQ5+t0cnchR/TH8RHJnwAvM9Jb1joJgPvR9Eixz9YD5StX1gEp7bVgjUBZ4oijt9jOfdGQozCYAESaNdTtpDG9HF29V4JjodP1b+MVafrnyY3KOZsKuRD4z6Ckt7t4aV/YCVb2pgx7OK6LONQ11zOFAeFCxJKrlkfcUTT74cCX0z2hSmmMFDeJEP6UXoaNueH8CjouzfppbVsHq1oyYmgwYMF3ri/hsoKUmvnNcg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR10MB1407.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(136003)(346002)(39860400002)(376002)(396003)(366004)(451199015)(86362001)(36756003)(103116003)(41300700001)(2616005)(66946007)(66476007)(66556008)(4326008)(8676002)(30864003)(1076003)(186003)(8936002)(5660300002)(107886003)(6666004)(478600001)(6486002)(19627235002)(316002)(6512007)(6506007)(6916009)(38100700002)(83380400001)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IBDWlxncwgC/Gsp2rueFfTpA9SZp7hL9tWvy/tY08cPop1TT3JOCj3vb1ecHJb0x61jQRmuDc2QEGzjW3yfBzk8agUTjmjnjxOXQmbawFw5DJQ8U2un0JXhWBKD/gtJpAtNW4CtPh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YXK+K0N62C5PQHqVbXHHXWfhyiV0wq61YqQUnbS8fx/RWatBFfu4BgOURLOiVa9IyT4lQJrKE2zb/sUIobzDZhutaDOsGpPds7iPfKdr/c9VCEOPkqGLRY6bOMd+0erP366uei9YagKS7UT1jyv7Y4/IferTYzrzjYbn1HsCmc+IV0XMniSVHHntKPY3ksydxO14BHy/l8gkx93+VjwRhgdcpveJxM35M1FJWCNYLuzjEBLCjZRkUcKnlo2Mivn2KHQdlsuiw0/aurYhADgWRgioDgzW/CakG960n02/kA7x6xg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11d2d365-a4d6-4114-bf89-08dac84de091 X-MS-Exchange-CrossTenant-AuthSource: MWHPR10MB1407.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2022 03:43:26.5466 (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: xxq7LHZ7Xfsn7e3rt7HsrwTOeRhXbv3gcgN4rznv6rTdL1emP9L4j/TjxNGTBoThhhFyfa3pHRvX/wD6g3cNM4ubsyNPLWtp49jruKet6ms= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB4843 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-16_03,2022-11-16_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 spamscore=0 adultscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211170024 X-Proofpoint-GUID: hbWHWoMCsuJhWeuSc5ZMJqST-q4LtavT X-Proofpoint-ORIG-GUID: hbWHWoMCsuJhWeuSc5ZMJqST-q4LtavT X-Spam-Status: No, score=-11.5 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_H2, SCC_10_SHORT_WORD_LINES, SCC_5_SHORT_WORD_LINES, 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: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: "Guillermo E. Martinez via Libabigail" From: "Guillermo E. Martinez" Reply-To: "Guillermo E. Martinez" Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" It fixed an incorrect representation in size and name for underlying enum and struct types when it has a bitfield members: struct foo { unsigned bar : 2; unsigned baz : 1; }; So, `name' empty property, no showing the right enumerator's type and size in bits: * src/abg-ctf-reader.cc (process_ctf_{base_type,enum_type}): Look at ctf refence type to build the underlying type if present. * tests/data/Makefile.am: New test cases. * tests/data/test-read-ctf/PR27700/test-PR27700.abi: New test input. * tests/data/test-read-ctf/test-bitfield-enum.abi: Likewise. * tests/data/test-read-ctf/test-bitfield-enum.c: Likewise. * tests/data/test-read-ctf/test-bitfield-enum.o: Likewise. * tests/data/test-read-ctf/test-bitfield.abi: Likewise. * tests/data/test-read-ctf/test-bitfield.c: Likewise. * tests/data/test-read-ctf/test-bitfield.o: Likewise. * tests/data/test-read-ctf/test-enum-many.o.hash.abi: Adjust. * tests/data/test-read-ctf/test-enum-symbol.o.hash.abi: Likewise. * tests/data/test-read-ctf/test-enum.o.abi: Likewise: * tests/data/test-read-ctf/test0.abi: Likewise. * tests/data/test-read-ctf/test0.hash.abi: Likewise. * tests/data/test-read-ctf/test1.so.abi: Likewise. * tests/data/test-read-ctf/test1.so.hash.abi: Likewise. * tests/data/test-read-ctf/test5.o.abi: Likewise. * tests/test-read-ctf.cc: Update test suite. Signed-off-by: Guillermo E. Martinez Signed-off-by: Guillermo E. Martinez Signed-off-by: Dodji Seketeli Signed-off-by: Dodji Seketeli --- src/abg-ctf-reader.cc | 31 +++++++---- tests/data/Makefile.am | 6 +++ .../test-read-ctf/PR27700/test-PR27700.abi | 4 +- .../data/test-read-ctf/test-bitfield-enum.abi | 18 +++++++ tests/data/test-read-ctf/test-bitfield-enum.c | 12 +++++ tests/data/test-read-ctf/test-bitfield-enum.o | Bin 0 -> 1336 bytes tests/data/test-read-ctf/test-bitfield.abi | 28 ++++++++++ tests/data/test-read-ctf/test-bitfield.c | 15 ++++++ tests/data/test-read-ctf/test-bitfield.o | Bin 0 -> 1488 bytes .../test-read-ctf/test-enum-many.o.hash.abi | 6 +-- .../test-read-ctf/test-enum-symbol.o.hash.abi | 4 +- tests/data/test-read-ctf/test-enum.o.abi | 10 ++-- tests/data/test-read-ctf/test0.abi | 48 +++++++++--------- tests/data/test-read-ctf/test0.hash.abi | 10 ++-- tests/data/test-read-ctf/test1.so.abi | 8 +-- tests/data/test-read-ctf/test1.so.hash.abi | 4 +- tests/data/test-read-ctf/test5.o.abi | 12 ++--- tests/test-read-ctf.cc | 18 +++++++ 18 files changed, 171 insertions(+), 63 deletions(-) create mode 100644 tests/data/test-read-ctf/test-bitfield-enum.abi create mode 100644 tests/data/test-read-ctf/test-bitfield-enum.c create mode 100644 tests/data/test-read-ctf/test-bitfield-enum.o create mode 100644 tests/data/test-read-ctf/test-bitfield.abi create mode 100644 tests/data/test-read-ctf/test-bitfield.c create mode 100644 tests/data/test-read-ctf/test-bitfield.o new file mode 100644 index 00000000..4231ba3e index 116325f9..9119525b 100644 diff --git a/src/abg-ctf-reader.cc b/src/abg-ctf-reader.cc index 9c41edf4..feafc91d 100644 --- a/src/abg-ctf-reader.cc +++ b/src/abg-ctf-reader.cc @@ -788,15 +788,17 @@ process_ctf_base_type(reader *rdr, translation_unit_sptr tunit = rdr->cur_transl_unit(); type_decl_sptr result; - const char *type_name = ctf_type_name_raw(ctf_dictionary, ctf_type); + ctf_id_t ctf_ref = ctf_type_reference(ctf_dictionary, ctf_type); + const char *type_name = ctf_type_name_raw(ctf_dictionary, + (ctf_ref != CTF_ERR) ? ctf_ref : ctf_type); /* Get the type encoding and extract some useful properties of the type from it. In case of any error, just ignore the type. */ ctf_encoding_t type_encoding; if (ctf_type_encoding(ctf_dictionary, - ctf_type, - &type_encoding)) + (ctf_ref != CTF_ERR) ? ctf_ref : ctf_type, + &type_encoding)) return result; /* Create the IR type corresponding to the CTF type. */ @@ -1369,7 +1371,10 @@ process_ctf_enum_type(reader *rdr, { translation_unit_sptr tunit = rdr->cur_transl_unit(); enum_type_decl_sptr result; - std::string enum_name = ctf_type_name_raw(ctf_dictionary, ctf_type); + ctf_id_t ctf_ref = ctf_type_reference(ctf_dictionary, ctf_type); + std::string enum_name = ctf_type_name_raw(ctf_dictionary, + (ctf_ref != CTF_ERR) + ? ctf_ref : ctf_type); if (!enum_name.empty()) if (corpus_sptr corp = rdr->should_reuse_type_from_corpus_group()) @@ -1379,18 +1384,24 @@ process_ctf_enum_type(reader *rdr, /* Build a signed integral type for the type of the enumerators, aka the underlying type. The size of the enumerators in bytes is specified in the CTF enumeration type. */ - size_t utype_size_in_bits = ctf_type_size(ctf_dictionary, ctf_type) * 8; - type_decl_sptr utype; + size_t utype_size_in_bits = ctf_type_size(ctf_dictionary, + (ctf_ref != CTF_ERR) + ? ctf_ref : ctf_type) * 8; + string underlying_type_name = + build_internal_underlying_enum_type_name(enum_name, true, + utype_size_in_bits); + type_decl_sptr utype; utype.reset(new type_decl(rdr->env(), - "", - utype_size_in_bits, - utype_size_in_bits, - location())); + underlying_type_name, + utype_size_in_bits, + utype_size_in_bits, + location())); utype->set_is_anonymous(true); utype->set_is_artificial(true); if (!utype) return result; + add_decl_to_scope(utype, tunit->get_global_scope()); canonicalize(utype); diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 4b6e9305..b89a4dd8 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -704,6 +704,12 @@ test-read-ctf/test-linux-module.ko \ test-read-ctf/test-fallback.abi \ test-read-ctf/test-fallback.c \ test-read-ctf/test-fallback.o \ +test-read-ctf/test-bitfield.abi \ +test-read-ctf/test-bitfield.c \ +test-read-ctf/test-bitfield.o \ +test-read-ctf/test-bitfield-enum.abi \ +test-read-ctf/test-bitfield-enum.c \ +test-read-ctf/test-bitfield-enum.o \ \ test-annotate/test0.abi \ test-annotate/test1.abi \ diff --git a/tests/data/test-read-ctf/PR27700/test-PR27700.abi b/tests/data/test-read-ctf/PR27700/test-PR27700.abi index 4f34eb8a..1a7c229e 100644 --- a/tests/data/test-read-ctf/PR27700/test-PR27700.abi +++ b/tests/data/test-read-ctf/PR27700/test-PR27700.abi @@ -3,14 +3,14 @@ - - + + diff --git a/tests/data/test-read-ctf/test-bitfield-enum.abi b/tests/data/test-read-ctf/test-bitfield-enum.abi new file mode 100644 index 00000000..b95f1781 --- /dev/null +++ b/tests/data/test-read-ctf/test-bitfield-enum.abi @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-ctf/test-bitfield-enum.c b/tests/data/test-read-ctf/test-bitfield-enum.c new file mode 100644 index 00000000..502ec06a --- /dev/null +++ b/tests/data/test-read-ctf/test-bitfield-enum.c @@ -0,0 +1,12 @@ +/* gcc -gctf -c test-bitfield-enum.c -o test-bitfield-enum.o */ +enum event_kind +{ + NO_EVENT, +}; + +struct input +{ + enum event_kind kind : 16; +}; + +struct input e; diff --git a/tests/data/test-read-ctf/test-bitfield-enum.o b/tests/data/test-read-ctf/test-bitfield-enum.o new file mode 100644 index 0000000000000000000000000000000000000000..2c532f50c724f7bf4327b7c36699a432ca08eab1 GIT binary patch literal 1336 zcmbVL&2G~`5T1lkeh>7}s)CE@g;e0R6E4sLvQ&j4gu(@SLuGAm(^c(tWN#ojAvp0! z9C;I-0bT%R?A>IwlnWz$p1CWILVPqFR91M(XDu?Oo)5*zX`UV!NkuxRoKq?JV%@-P4f`I6}Dn*p8(p6N|JS#-h)LB%> zl&5mWWf3azG18*ZO_X!Z+c2yJ&%;cgby+I)nG{7H3biO%25@|IbQlber*98}(PI{~ zI2gy{@n{r34TfSl7qu+$io7^zuZ#~n=T(eR27Ty#cjm*{y1bjws{Z!WAHdJwerFd8 z+wJDN&iZT`EcEX$09dmsHBZs&y7T8Y(qgHB(Jp|cO#=+~fRC!AnSiNE3x+dXW>y>}E|H<#6h-TgL#EF;N)Zg2EY*3B9Ki3jBabjQp0DJUp|4YB#uQ|id zA7R};lc)(j(00A1m%<1+REvr1*oh%NbZQh@z4eDq&82>}1h;qz_a)Y@A?Uwz?W@uI y_o7|7Ml@eb{clG9!jNwmp4IO;b$|D5%N%NXhQ6NP=Gz!trr$IAca~_pzm`9z|8lDU literal 0 HcmV?d00001 diff --git a/tests/data/test-read-ctf/test-bitfield.abi b/tests/data/test-read-ctf/test-bitfield.abi --- /dev/null +++ b/tests/data/test-read-ctf/test-bitfield.abi @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-ctf/test-bitfield.c b/tests/data/test-read-ctf/test-bitfield.c new file mode 100644 index 00000000..7d76d2f4 --- /dev/null +++ b/tests/data/test-read-ctf/test-bitfield.c @@ -0,0 +1,15 @@ +/* gcc -gctf -c test-bitfield.c -o test-bitfield.o */ +struct foo +{ + unsigned bar : 2; + unsigned baz : 1; +}; + +struct foobar +{ + unsigned char bar : 2; + unsigned char baz : 1; +}; + +struct foo f; +struct foobar fb; diff --git a/tests/data/test-read-ctf/test-bitfield.o b/tests/data/test-read-ctf/test-bitfield.o new file mode 100644 index 0000000000000000000000000000000000000000..c23c8188d880587f2ba78b8b852cdb067607e4b6 GIT binary patch literal 1488 zcmbVM&2G~`5FVEh3S3$$Arvm|iB=FhNe{FYLXj${gb+85NZ8IMu}JL7-in3`cOC%o z6g&e@fw=Ju@B%QOcgITo!uG)6&AoRG-bD`2A&r_o-G&p09E`K4Wl85nozDt2 z3G+fznpCWBK)`LeY~B!-q-jd=yj-d{U8SqItdeY@;=0P>MV=;UK1=dNzfiAZt!iDz zlSC(t+pknI>1TRsqBPgjTrDP1Ms#{|avbiRK6}0&4iBP1Gzdq7(P%gv9EE%8;!IWf zQWZK`?3+=|PD2i`S1#kBgHPD4NMK{^Ex?a#H?BG57>6;et?}c5t yf_wP2;14bM5&_FqRzOmJ3m^+{fA_#Y*n0dAb4BJB4DaMm^&f5h3rV!rum1@|M0T$L literal 0 HcmV?d00001 diff --git a/tests/data/test-read-ctf/test-enum-many.o.hash.abi b/tests/data/test-read-ctf/test-enum-many.o.hash.abi --- a/tests/data/test-read-ctf/test-enum-many.o.hash.abi +++ b/tests/data/test-read-ctf/test-enum-many.o.hash.abi @@ -4,14 +4,13 @@ - - + - + @@ -61,6 +60,7 @@ + diff --git a/tests/data/test-read-ctf/test-enum-symbol.o.hash.abi b/tests/data/test-read-ctf/test-enum-symbol.o.hash.abi index f4911bc4..da68828c 100644 --- a/tests/data/test-read-ctf/test-enum-symbol.o.hash.abi +++ b/tests/data/test-read-ctf/test-enum-symbol.o.hash.abi @@ -3,13 +3,13 @@ - - + + diff --git a/tests/data/test-read-ctf/test-enum.o.abi b/tests/data/test-read-ctf/test-enum.o.abi index bd3a55be..e13ebdd0 100644 --- a/tests/data/test-read-ctf/test-enum.o.abi +++ b/tests/data/test-read-ctf/test-enum.o.abi @@ -4,19 +4,19 @@ - - - + + - + - + + diff --git a/tests/data/test-read-ctf/test0.abi b/tests/data/test-read-ctf/test0.abi index 05430067..60d3cf1e 100644 --- a/tests/data/test-read-ctf/test0.abi +++ b/tests/data/test-read-ctf/test0.abi @@ -20,47 +20,47 @@ - - - - - - + + + + + - - - + + + - + - + - + - + - - - - - + + + + + + - - + + - + - + - + - + diff --git a/tests/data/test-read-ctf/test0.hash.abi b/tests/data/test-read-ctf/test0.hash.abi index 4aa9a93c..76dd581e 100644 --- a/tests/data/test-read-ctf/test0.hash.abi +++ b/tests/data/test-read-ctf/test0.hash.abi @@ -20,7 +20,6 @@ - @@ -34,14 +33,15 @@ - + - + - + + @@ -49,7 +49,7 @@ - + diff --git a/tests/data/test-read-ctf/test1.so.abi b/tests/data/test-read-ctf/test1.so.abi index 822b57a5..2ecd5826 100644 --- a/tests/data/test-read-ctf/test1.so.abi +++ b/tests/data/test-read-ctf/test1.so.abi @@ -6,9 +6,8 @@ - - - + + @@ -17,8 +16,9 @@ - + + diff --git a/tests/data/test-read-ctf/test1.so.hash.abi b/tests/data/test-read-ctf/test1.so.hash.abi index b3ace158..4f8633dd 100644 --- a/tests/data/test-read-ctf/test1.so.hash.abi +++ b/tests/data/test-read-ctf/test1.so.hash.abi @@ -6,9 +6,8 @@ - - + @@ -19,6 +18,7 @@ + diff --git a/tests/data/test-read-ctf/test5.o.abi b/tests/data/test-read-ctf/test5.o.abi index 6d72d7ab..814aff7f 100644 --- a/tests/data/test-read-ctf/test5.o.abi +++ b/tests/data/test-read-ctf/test5.o.abi @@ -7,10 +7,9 @@ - - - - + + + @@ -18,7 +17,8 @@ - + + @@ -37,7 +37,7 @@ - + diff --git a/tests/test-read-ctf.cc b/tests/test-read-ctf.cc index 14e63ef0..5d0e7435 100644 --- a/tests/test-read-ctf.cc +++ b/tests/test-read-ctf.cc @@ -345,6 +345,24 @@ static InOutSpec in_out_specs[] = "output/test-read-ctf/test-fallback.abi", NULL, }, + { + "data/test-read-ctf/test-bitfield.o", + "", + "", + SEQUENCE_TYPE_ID_STYLE, + "data/test-read-ctf/test-bitfield.abi", + "output/test-read-ctf/test-bitfield.abi", + "--ctf", + }, + { + "data/test-read-ctf/test-bitfield-enum.o", + "", + "", + SEQUENCE_TYPE_ID_STYLE, + "data/test-read-ctf/test-bitfield-enum.abi", + "output/test-read-ctf/test-bitfield-enum.abi", + "--ctf", + }, // This should be the last entry. {NULL, NULL, NULL, SEQUENCE_TYPE_ID_STYLE, NULL, NULL} }; From patchwork Thu Nov 17 03:43:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guillermo E. Martinez" X-Patchwork-Id: 60732 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 0D3B43887F76 for ; Thu, 17 Nov 2022 03:43:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0D3B43887F76 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668656626; bh=p0CJsi6bAnyUnbMI9zUIKQhtSvC7ajHpznM63x7+fZ8=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Help:List-Subscribe:From: Reply-To:From; b=Q3z1MY/9dMhXU+4GFCJ6tYbnH2hzo+X4a5SHDi/G1aXYCbuXmqqhchpxMPHQuhX8k GKGYdVFkz/p3vKzSFRlr43QtKP0QHKdBgq3+JZqdI0YzcmECOu+FBzQSukWC4QZN3A iRcL176JSQeoKeNLM19wCdZ6uAGuWF4cXDRbjnws= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 6130A395445C for ; Thu, 17 Nov 2022 03:43:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6130A395445C Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AH1uM3m010282 for ; Thu, 17 Nov 2022 03:43:39 GMT Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kv8ykq9qd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 17 Nov 2022 03:43:39 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2AH30PMi000376 for ; Thu, 17 Nov 2022 03:43:37 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2172.outbound.protection.outlook.com [104.47.56.172]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ku3k99tcx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 17 Nov 2022 03:43:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YgFFY3MaeS9PLjJ6qUWX7T3yVG4ENTH+2NExTPwt6LLx1AakZ5kn/s3jEC9nqNvvYouVz49LssHhSID1qeGsy9FphH9z/RWvA557QvINWczEASTw2U8/DIxrbRfGfA/5Z0k3Ty22vZ9APUj4LQP1HjNvfBxIqYUtJeYshf+KsI5s4MEQibNUJDtRVdrjcu73RqYinOPIgQUnOikpg9Cnst08WdEuJp9T26SN6vpKskl+SfnWCqr+FJCUj7kY1lQ1/oS+eOKyeBkgag8D5bLAMQ+Endg/rATc4rjRRLQ+far5s75iURddPE1U/xeDpw95Mn/TbZToniQ2bb9YBzZTxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=p0CJsi6bAnyUnbMI9zUIKQhtSvC7ajHpznM63x7+fZ8=; b=ocljxUrJqe33iiifgkMN8mHc2vLYEMeNPD+1dOZfNxr2H3ROf0ZfbovBkouI9wNDa6d31rYd+K27r9nuQFPP+eUFiwNX7ejj5itvIeNQu/jIduquKCdA9dOv1dMs42Ul10OQJ9zyjv+MckuRY5SwG3gl1HdFdo6B1R4q/MVR22b0dJB8mG1OKIfjKqS349xmQOq2wwdUZ1mpVEdYqBA0nZORMS30QhVTvsa9onM7oNpvudU+VnDYSL5yNqTNnZnsKoPgdtuJ5Ve40Iq7m1uR/ySyy/kRr8bn7KxWMI1mmg+KTfNjDb/PtovqbH8xzK8b588F4qJ31z0dr+UpLMZrqA== 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 Received: from MWHPR10MB1407.namprd10.prod.outlook.com (2603:10b6:300:23::20) by CH0PR10MB4843.namprd10.prod.outlook.com (2603:10b6:610:cb::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.20; Thu, 17 Nov 2022 03:43:35 +0000 Received: from MWHPR10MB1407.namprd10.prod.outlook.com ([fe80::1800:88c1:fae8:13b4]) by MWHPR10MB1407.namprd10.prod.outlook.com ([fe80::1800:88c1:fae8:13b4%10]) with mapi id 15.20.5813.020; Thu, 17 Nov 2022 03:43:34 +0000 To: libabigail@sourceware.org Cc: "Guillermo E. Martinez" Subject: [PATCH 3/5] ctf-front-end: Strip qualification from a qualified array type Date: Wed, 16 Nov 2022 21:43:03 -0600 Message-Id: <20221117034305.184864-4-guillermo.e.martinez@oracle.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221117034305.184864-1-guillermo.e.martinez@oracle.com> References: <20221117034305.184864-1-guillermo.e.martinez@oracle.com> X-ClientProxiedBy: SN4PR0501CA0059.namprd05.prod.outlook.com (2603:10b6:803:41::36) To MWHPR10MB1407.namprd10.prod.outlook.com (2603:10b6:300:23::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR10MB1407:EE_|CH0PR10MB4843:EE_ X-MS-Office365-Filtering-Correlation-Id: dd3a94cf-3cb5-43bd-709d-08dac84de54a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UN2UrOjmUKXDgFaomT7NuY1o8CsHFMvHGYgTxHo1nS8RpCzKixp3uKA7i5qnXxJYMKUHxrCtc+sJADEcKrr0dLVl/JLPg6X1L7RMk5xVfGzMXVpCaI43JOaKIlsjyVhJyKz2wnTWl/XMsOOiOQ6n2TXgndM6Ed1xVAOLieBtxjS0vaLJJwb7PnsBPwV0EOrwhC5tNmBbTksR95U6mkKS5sQjU+mIEEhOe2BDP7TjPUx8jIO1mtRDatQ5JHsQkLr5WMjhSxkhd89Fj97Ay8zJ7cd/S9KaJ/aRfd1Q1mA2PlIWUYolAbF6wbwYkpBBPtVOV0CFpGEb0B9T4uniXFoz+duL0n3lhWMghxxWZD8nhRKZQHNehfh9g9WIQiLye37oF8wcOPcBS8z1Hif9BlVisoJwbAMXbhNEbVpUpnLe0fz7Nfwd87P6RIpxKuLLdoFxPdYnoZtFwJB/bELwutC6bCGUi66fmqQ0X5yqdct3Q7/7E9ImQjp7oLZgE8RfwKCOqeFD0IYyjjtIVSXHC2zI2myDGIz+EXPKRvypuUbH2/hKlRTYk4xzQHREBsKD7aU3buvoLeBOqPAApbaLcXvYP0Ho9OFgNY6K8coWRbOjwUdN9hhjJ+/7vRvbWhf/E3eV9m8H2tRVHURoyy127IEo9tXw8qiWgPinGlDDan7p2g4gYgViI5Pz/GHIS/vscrTs X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR10MB1407.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(136003)(346002)(39860400002)(376002)(396003)(366004)(451199015)(86362001)(36756003)(103116003)(41300700001)(2616005)(66946007)(66476007)(66556008)(4326008)(8676002)(1076003)(186003)(8936002)(5660300002)(107886003)(6666004)(478600001)(6486002)(316002)(6512007)(6506007)(6916009)(38100700002)(83380400001)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iRoa/FkNgkaphh/3wEyvrpundzz5RV3P3uRgI6SeAbjJmZ4XqMNtscgVDgk3YATKN6YkYWkmwqiVYDWMDgb3oWsLN06TdF/hUuCN/4DPvxAkvOntaCAePh5daSgWnsqTYir8aldicSR+We9K+JTj6eYA/w7gqwebqf8oM4GyTpN9AcWnm6ivsXxhHMPOppLwPfhFahVFsdT7DcDj9JTy90ilIPYvoFxQMW/iHlkOG7dGhKXaMtqBty0+x7Vl8gB/DQEB1Io5GCQ0Ks12HFsCM5VBQvwqXuxPLUVHKRm8qKbvz+A5rUakaiQlXMY7v/Onq4MZrZXb9nAnCMhplxUMgY3EMUXraVqROYsp8FrfmQHmvjAjUH0DHywOIc1Yqmhw3m0tTOu3hd7P4rlDZFPxoJes0exdBK1LT2VZyaKTQokbskRt1tuVZBfGrbaMMDGfPYW+5++hBVvVEODnak84R5AOE6OdTeHEUQLqftko4cNICcAdqti1lPoo6wN8467Tg5LKgLbNg1ER1Ez1dlNKgRpRLw/L4MQDCRjxbcx487J87X6zM54E1XEsXA+WX2l3aEMsZXpiqE0gmuffLvY+Y3+dZ70VC72DlnTynzU7PqQQ409r2MnsMyjq5paXBwlMGuitzYV+sPVoCg7rwPlNQM9m2uAlQ7B9Mwpy3xF0syLpnN6IOpWKszwXBkYspMLzNB/KGMmBnswO11HpsylNaMhVpU5HO9xBC48PXYOUfmVgJVS2gmuU6IyqGeaUSQMeebH2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sxr01RXBfJJRTB4VXhYzH+9lUtuwNdsf9RvI0yLBRb58pOLOJGgt6sPiNfdPwIhwYgcxe3BToI5el82F1ZhqsWX9weED+AQF/3A5QFStxE+UwuHAsFeU483rgg7lGb2ZWeTYyCvK699xaRIbwfZ+KHt+2Il6B6bTsYSn87Ln6BtuD5MC2mvudm5NzGHcAu2NpILVCjtPBTCzg8K5TsorMzT9/CB07CIJwZeRhK/yUq9sf+M/TuC1hcNT8b4ul3Uy5wBs2to4HU4Zmk38CEukkmRzD538m35js1ABpeq5AEyVSSuFJ4O+28HMqNexdUAAnq71dapqRICoPlcMBuEG/13toD4xejrJPELnED5B8s4nozjcdnNiXj6IE+KgE+nnTO0uAuqgt/r6O+o28RREuMk2dxnwIiPH1l+/YmrApwnQI0z7OHdB5wosu6dRzdAwlC32JVy37vh82JR1tLaZFzhtjYO8nGNiFC1qxvTApktDtLw6VMBhtBtkva6ZqqGfdGj43UdLp8/wjHeI9lY2ksbdZmSpgtyAu/kWrmRdEfo4hHw+Qdi/LBDMH4qvCvp7yIKxbd/ZJRNRWqH20rAOcNTMAWo+BLrL3+mNqKcxeODYqQNaDpZGvXNtDPBwqTz5i48sXR3Q2Mw9bJjT91mquL+mon412yCBwvLPSO7bL15Sxw4GAnfaRSk1z1DAP1ORjAks4KbVNC+Fn86PNF0Q== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: dd3a94cf-3cb5-43bd-709d-08dac84de54a X-MS-Exchange-CrossTenant-AuthSource: MWHPR10MB1407.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2022 03:43:34.0304 (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: 5R9Qxk8DPCyDLROFVl47vmzUGsSx0wLtU5Rx1gS8UBOcZEJFMYGnnQ/ZsSnufDtN/hSURoR0y6TYNzvqy4yLWFMN5hspSUli4zRNlYWtEjs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB4843 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-16_03,2022-11-16_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 adultscore=0 phishscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211170024 X-Proofpoint-GUID: mqDtJz1ZgTj1yJ7lJD8_bynop61Dag2I X-Proofpoint-ORIG-GUID: mqDtJz1ZgTj1yJ7lJD8_bynop61Dag2I X-Spam-Status: No, score=-12.6 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_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: "Guillermo E. Martinez via Libabigail" From: "Guillermo E. Martinez" Reply-To: "Guillermo E. Martinez" Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" Redundant qualifier is emitted by CTF frond-end building IR for array definitions: const char a[32]; Thus the diff reports: [C] 'const char[32] const a' So, It strips the qualifiers from the array types. * src/abg-ctf-reader.cc (maybe_strip_qualification): New definition. (process_ctf_qualified_type): Strip redundant qualifiers. * tests/data/test-read-ctf/test-const-array.abi: New test. * tests/data/test-read-ctf/test-const-array.c: Likewise. * tests/data/test-read-ctf/test-const-array.o: Likewise. Signed-off-by: Guillermo E. Martinez Signed-off-by: Guillermo E. Martinez Signed-off-by: Dodji Seketeli --- src/abg-ctf-reader.cc | 57 +++++++++++++++++- tests/data/Makefile.am | 3 + tests/data/test-read-ctf/test-const-array.abi | 14 +++++ tests/data/test-read-ctf/test-const-array.c | 2 + tests/data/test-read-ctf/test-const-array.o | Bin 0 -> 1416 bytes tests/test-read-ctf.cc | 9 +++ 6 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 tests/data/test-read-ctf/test-const-array.abi create mode 100644 tests/data/test-read-ctf/test-const-array.c create mode 100644 tests/data/test-read-ctf/test-const-array.o index 5d0e7435..61a5682c 100644 diff --git a/src/abg-ctf-reader.cc b/src/abg-ctf-reader.cc index feafc91d..7c267bb1 100644 --- a/src/abg-ctf-reader.cc +++ b/src/abg-ctf-reader.cc @@ -1261,6 +1261,51 @@ process_ctf_array_type(reader *rdr, return result; } +/// Strip qualification from a qualified type, when it makes sense. +/// +/// CTF constructs "const const char [N]" for "const char foo[N]" +/// definition; This redundant types then causes bad diagnostics +/// when it is compared with an DWARF IR. +/// +/// This function thus strips the const qualifier from the type in +/// that case. It might contain code to strip other cases like this +/// in the future. +/// +/// @param t the type to strip const qualification from. +/// +/// @param rdr the @ref reader to use. +/// +/// @return the stripped type or just return @p t. +static decl_base_sptr +maybe_strip_qualification(const qualified_type_def_sptr t, + reader *rdr) +{ + if (!t) + return t; + + decl_base_sptr result = t; + type_base_sptr u = t->get_underlying_type(); + + if (is_array_type(u) || is_typedef_of_array(u)) + { + array_type_def_sptr array = is_array_type(u); + ABG_ASSERT(array); + // We should not be editing types that are already canonicalized. + ABG_ASSERT(!array->get_canonical_type()); + type_base_sptr element_type = array->get_element_type(); + + if (qualified_type_def_sptr qualified = is_qualified_type(element_type)) + { + qualified_type_def::CV quals = qualified->get_cv_quals(); + quals |= t->get_cv_quals(); + qualified->set_cv_quals(quals); + result = is_decl(u); + } + } + + return result; +} + /// Build and return a qualified type libabigail IR. /// /// @param rdr the read context. @@ -1304,8 +1349,16 @@ process_ctf_qualified_type(reader *rdr, result.reset(new qualified_type_def(utype, qualifiers, location())); if (result) { - decl_base_sptr qualified_type_decl = get_type_declaration(result); - add_decl_to_scope(qualified_type_decl, tunit->get_global_scope()); + // Strip some potentially redundant type qualifiers from + // the qualified type we just built. + decl_base_sptr d = maybe_strip_qualification(is_qualified_type(result), + rdr); + if (!d) + d = get_type_declaration(result); + ABG_ASSERT(d); + + add_decl_to_scope(d, tunit->get_global_scope()); + result = is_type(d); rdr->add_type(ctf_dictionary, ctf_type, result); } diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index b89a4dd8..8d4a2b8f 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -710,6 +710,9 @@ test-read-ctf/test-bitfield.o \ test-read-ctf/test-bitfield-enum.abi \ test-read-ctf/test-bitfield-enum.c \ test-read-ctf/test-bitfield-enum.o \ +test-read-ctf/test-const-array.abi \ +test-read-ctf/test-const-array.c \ +test-read-ctf/test-const-array.o \ \ test-annotate/test0.abi \ test-annotate/test1.abi \ diff --git a/tests/data/test-read-ctf/test-const-array.abi b/tests/data/test-read-ctf/test-const-array.abi new file mode 100644 index 00000000..bd60b098 --- /dev/null +++ b/tests/data/test-read-ctf/test-const-array.abi @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/tests/data/test-read-ctf/test-const-array.c b/tests/data/test-read-ctf/test-const-array.c new file mode 100644 index 00000000..4ffecf87 --- /dev/null +++ b/tests/data/test-read-ctf/test-const-array.c @@ -0,0 +1,2 @@ +/* gcc -gctf -c test-const-array.c -o test-const-array.o */ +const char a[32]; diff --git a/tests/data/test-read-ctf/test-const-array.o b/tests/data/test-read-ctf/test-const-array.o new file mode 100644 index 0000000000000000000000000000000000000000..b50e2fe5a7f7c86b3220c08782ee1d72035cc4d3 GIT binary patch literal 1416 zcmbtU&2H2%5T3NlQhpA!LRAG4GACL=oNPFi1B$4i91sU2?sc+eH)__YY*#cVu1LM` zNPQEY0bT%R5__|?Rz1K- z(X#SrfWQcS(k-VC(4L^4qTWK?b4tG3Z%h{Pn`lTfipQM`W9pOlKCL^n(8dI2s7^B4 z6Uw>JP&aDE&XuWVN={j&EC@*E%|a$cTeL}|MOn+l=rXCRLKM|ZRCTQ6*ThO=O)?c$ zbZ)Grn8v03(nn>ZjE#lXqUELE_6B==bo7etAAkIOz$Pzw%2Sr5SvHxZhiqS7oJn0R zq_Uzu=zGxl87kcil5oc8s+$R8lE}q$H#Z5@NAT-UhIZhHAE6P(B&(t|T(+y5rQxoPq9on|M)yQ_fB9#{xhu88~s=Q3*?49Y0I1zl<-4_*a>1N zxBM{@2_<(x)T|2m%XP^$*iV?djT)Z+hvSFm zqPt!df`weFUpfAJ2fpiYo=^WnBzI85Z%6qp*L0VH6$!`M#@agm6UUb;TyjJHU(J X-Patchwork-Id: 60733 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 039043954C5B for ; Thu, 17 Nov 2022 03:43:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 039043954C5B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668656636; bh=tPaQpdz3rBTCbQ4/pkBJ3JEsmWkRo6vf1AH5RW9cfiA=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Help:List-Subscribe:From: Reply-To:From; b=DWB39LYV4U8jWWDjH3MJV7bgwiVDBzJhaG0tKVXwrxaAd5sQbnQNoUNzEug2wFKOS xGWG1fmJS+QgZu6vuNEQuXjVZCDADdswUeQ6SmRdpWjR3RObaiu+Nb5mStFzvj/qTA 36VdscJIoNSeAjzh9k7slG4f4S6+8xvS459zfPMs= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id BA9123887F76 for ; Thu, 17 Nov 2022 03:43:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BA9123887F76 Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AH1ps9x010256 for ; Thu, 17 Nov 2022 03:43:48 GMT Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kv8ykq9qk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 17 Nov 2022 03:43:46 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2AH3Dobd012513 for ; Thu, 17 Nov 2022 03:43:44 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2170.outbound.protection.outlook.com [104.47.56.170]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kt1xes4qa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 17 Nov 2022 03:43:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hv9as9liSAccn8MsfgSyYyROIqmtUpad6pko5tT2NH4mXF6+ItqThhaWwl2eJBvnVRH7Jo7B4jkFNHMawbcUogpabyOrmclTqrZbSVTHFVqZaS4/dHjsS29gaPzDXgyLgwZbsH5n9kB2WV8sxa+BjpjcrRsvGOBCtlqLY9RIASEvqT0X69jTi57HrBh+voWq88l2rhCa2iNozZ83vbkubPJ0wVVBLE1+1bzPlzn+f1R3LsAlgLX4evrFG9qLJtXDJoOLjHNKjABPqjN4i05pd9cMLV9pq4g6F/Wi3fa2oZ8p7GHiHJ1r9EjJq1uN/qA+QNBXbIwBlXsM2Neu3N8iMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tPaQpdz3rBTCbQ4/pkBJ3JEsmWkRo6vf1AH5RW9cfiA=; b=YQ4e/0snbL2xBkre7cFGrM88ZxHLRoJLWkxIo4XweNSJmNU85oJcnKwabfjgDaUXyeTtW08ViYY7yNL2o0/JPbGko6f/bG1qDeTytC5L1zY6ILjfoFj7r03wikIGeY/utwCT/Rj7pgF6YqsfbimWxokXK0SFBGAcUqOqY4AGr3CaTy8cbOQtO3IsfeFXlm18PopX5AHit41xO428+EYr/hnaaS6CKrr0Xfo/RusbJHz85jiiuRJRrrmhI9m56En1G2esEF53yuZFV4q5WC9qUzs40PTZRDIOgGxd7tj4QI2QfCMFVdd6XzOgLqgZU3M3wB4hgHGFRdTi4413v/4uug== 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 Received: from MWHPR10MB1407.namprd10.prod.outlook.com (2603:10b6:300:23::20) by CH0PR10MB4843.namprd10.prod.outlook.com (2603:10b6:610:cb::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.20; Thu, 17 Nov 2022 03:43:41 +0000 Received: from MWHPR10MB1407.namprd10.prod.outlook.com ([fe80::1800:88c1:fae8:13b4]) by MWHPR10MB1407.namprd10.prod.outlook.com ([fe80::1800:88c1:fae8:13b4%10]) with mapi id 15.20.5813.020; Thu, 17 Nov 2022 03:43:40 +0000 To: libabigail@sourceware.org Cc: "Guillermo E. Martinez" Subject: [PATCH 4/5] ctf-front-end: Fix representation for multidimensional array type Date: Wed, 16 Nov 2022 21:43:04 -0600 Message-Id: <20221117034305.184864-5-guillermo.e.martinez@oracle.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221117034305.184864-1-guillermo.e.martinez@oracle.com> References: <20221117034305.184864-1-guillermo.e.martinez@oracle.com> X-ClientProxiedBy: SN6PR01CA0012.prod.exchangelabs.com (2603:10b6:805:b6::25) To MWHPR10MB1407.namprd10.prod.outlook.com (2603:10b6:300:23::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR10MB1407:EE_|CH0PR10MB4843:EE_ X-MS-Office365-Filtering-Correlation-Id: 07fe90e3-8174-4931-383e-08dac84de9d8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 27zryDtlu8Lqon4tW8G/RViQDK4iiH6V00B4267jBBDcxlDlDYksavalEWpy9JzDyS0/K80FrjEW6iTIDmFgilH501ELfeXpMBitKTz8Bkl3fBoqWgnuS8hmtim69kG9dR9oVslW2Xbzm2Jqp2E3YfLj13KwfTxYuani8WB/jfuvKCCKahB/OlLNo7ZwQ1QPqR5Ap2fbFX3Ykb+pcUbPZUQ4qQna1TQqNIG+wIgAs3xRMyqa+hpdoFQMIYQSGlBFQQkJSFkv9uHLRFJ76TdyTNXvsx5maua+GoHjxurQXj7vOmR1gnpjfiI7iRR+7GUGpQW4sfSnnz+eIFnMmS++m06AkU/ZhEeIRW260ZAlCbOVbreMJptt9oTk5rkHXkC8qm+HF73SA1DerbrB7ENnplc9lruoXwOkNLluPBUXxFvGVrn0g1RmsEpFF2IyLHRS6Kbdb7xyUTkphwiAjePpGZYyloPjFJWHWe9ZKUnrKX/SgAwmjjYY1sPOIcge5a7w8lNUzwrEUHCtAwhbQtCrji/4U10cvzQJFVemeOOzHDKfX0hkIPty/68yhTJNwLcgIiKhG/e5N9JgEEG9S3k5tdkTtbOf3aStYES3XCYgF4XW8YyM03eU5OFP8bgMEtitwVI9DVEUXNgkWLY1ChtXCOXX6vKe3fuquSwVgxoDHD8O0vWXwRlaq5WQ4+TXxawZ3Jj1Ddbb5d8kOZtJPmnOOg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR10MB1407.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(136003)(346002)(39860400002)(376002)(396003)(366004)(451199015)(86362001)(36756003)(103116003)(41300700001)(2616005)(66946007)(66476007)(66556008)(4326008)(8676002)(30864003)(1076003)(186003)(8936002)(5660300002)(107886003)(6666004)(478600001)(6486002)(316002)(6512007)(6506007)(6916009)(38100700002)(83380400001)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: y4uwfnpgWfu6cohuvKGW5BZPeFHwtMNF5u8DEZwRBln5V7fbcAiX/EOHi2/X07nfFxTuRZ+xKdwFYowRK8lSSeFIXfUaHdk/XL064h7hBNggmvNG4GCN4DYwRWMmKQr3KPnDLVE3TJJqDyIV1t9vOhHrRJngQbVUcrxU3PEJth1dfY3yE+Qr0WZ5ATJVUVDTE1Cb+Dxl7qMG017zheSQmun6wGKX9/CCeJ9T+L+ardd7kWk4mwg1XkfIwh9DW1ZkyK6qrHQnn4HPPcxQyqjMASESeujkudWo8izHRt1M9PSeOxJ2g2+/VtQSlCj++ltZO7YQyHK49Sq6XA5EcmaFlKfuqlFFWxQf/fGlgm+TOeYiMgvUq1YlyaTGySV84IWt3ZzR1MVToBCTg89cYVX0UvS7mQqnJ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W2a0uFVP18FMrBZmCiVEU58AsuWDiUFwCi9veOPHNRCx7hIDLCbca4qx/O7lSO/NIxgHdHCCTLkAXQRY9v5H0qK0QQvhxcEt0wVsmY9HLU8J0o5kM8O4/D5KxC4gLC5cVm6XBuCdWosJG+l4XSQcyQwQDAcfQVhEQQwXsPiWCbU5mNc8HGgUVshkQBSP3PWEV19JH0MQguBuTtedtgqTBfg= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Bv7fqYuQmMQCerYC/y/NcSYXW35QZ3bs83L6cWCzEpPftLSvL5oFRGfibgCQSF+Az+WDnQKdcO4DSaRfYeX/1Ud0A1DC2GmV8YZ7cszbtXGv11kAC589Ahps2OrUbHKje+kHRTw+92eB4J5beGA5BFD12/4By3SmCYHOAgdY250ZmgtSWBSERG7TBLMHXDGYvPTuLFYAtRJtrQQbdcsOpoLn7tUUgMSfvxf5x6HG/FiycNxEkefiOpIJtPWNUDe39yd0QSGabsdhTNejUenih0cD9EcHrx2hXRi76lQhkscYi4vY8HWc7wMqFpw5Veii5oUf7dpOdzSXwYgYHUCPVBiIdYIM6QHrNKxe7fgYiNUPHUyTS99Z16j+XfmO1wg9MXt0OQRz+j5EzLrRseP9SM05tL2RApU46D14jpsz58Y9j5bpxBg/9v50BOGTUbiEpRUNv27y7xlme5tNCEu8c49SrD0I2x30lY9MgolAPz9nb1CDsID1uepuU9m4M/P24pmnM9rgccyp0Ecxvjh3SluVpUXF4EWOmVNZ221sa+kE7cdcVfL7dYpO3ORDGsjQarmJCcvq2qlPcvDmx0AWhWKLqMcEb7ZezGicWLng6YPcWClttCZDvJM6IvkynYrf+9H3Q1Les7SjjlekJ0OMm4Pxd1jfFID9OW1iYNwnltrEBJvDWpdF89OdcZ1XLuPFLMhQwgx1IuEcF5wycTE2wwT4DPiVmOBVM4bopumGEpWxFCVgTwRxf+SK31BDkPCh+p0KHLDm1UQW9b+PwR91KQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 07fe90e3-8174-4931-383e-08dac84de9d8 X-MS-Exchange-CrossTenant-AuthSource: MWHPR10MB1407.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2022 03:43:40.4050 (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: 8xGoth2OkPAzAuTl+zKRnvB2HkJop8nx2D/3/GsXkTZ46WvckUErn4gKzpqxaYmUoJQdNcl9pP4AQS8hKRP4GxF65o73kAHMVH91YxxZEpU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB4843 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-16_03,2022-11-16_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 mlxscore=0 phishscore=0 suspectscore=0 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211170024 X-Proofpoint-GUID: NBbM847K0WQOnx175Q7YLKkrXLuSLB4W X-Proofpoint-ORIG-GUID: NBbM847K0WQOnx175Q7YLKkrXLuSLB4W X-Spam-Status: No, score=-12.6 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_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: "Guillermo E. Martinez via Libabigail" From: "Guillermo E. Martinez" Reply-To: "Guillermo E. Martinez" Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" To build an IR for multidimensional array the CTF front-end iterates over the element types recursively, so a definition as follows: char a[2][3][4][5]; Produces: 'char[2][3][4] a[5]' instead of 'char a[2][3][4][5]', it considers always multidimensional arrays as unidimensional creating a `array-type-def' node for each dimension: ... Instead of: ... * src/abg-ctf-reader.cc (+build_array_ctf_range): New definition. * tests/data/Makefile.am: Add new testcase. * tests/data/test-read-ctf/test-array-mdimension.abi: New testcase. * tests/data/test-read-ctf/test-array-mdimension.c: Likewise. * tests/data/test-read-ctf/test-array-mdimension.o: Likewise. * tests/data/test-read-ctf/test9.o.abi: Adjust. * tests/test-read-ctf.cc: Update testsuite. Signed-off-by: Guillermo E. Martinez Signed-off-by: Guillermo E. Martinez Signed-off-by: Dodji Seketeli --- src/abg-ctf-reader.cc | 119 ++++++++++++------ tests/data/Makefile.am | 3 + .../test-read-ctf/test-array-mdimension.abi | 16 +++ .../test-read-ctf/test-array-mdimension.c | 2 + .../test-read-ctf/test-array-mdimension.o | Bin 0 -> 1360 bytes tests/data/test-read-ctf/test9.o.abi | 36 +++--- tests/test-read-ctf.cc | 27 ++-- 7 files changed, 135 insertions(+), 68 deletions(-) create mode 100644 tests/data/test-read-ctf/test-array-mdimension.abi create mode 100644 tests/data/test-read-ctf/test-array-mdimension.c create mode 100644 tests/data/test-read-ctf/test-array-mdimension.o index 331bfc70..9f5a7466 100644 diff --git a/src/abg-ctf-reader.cc b/src/abg-ctf-reader.cc index 7c267bb1..ba4eed16 100644 --- a/src/abg-ctf-reader.cc +++ b/src/abg-ctf-reader.cc @@ -1171,6 +1171,58 @@ process_ctf_union_type(reader *rdr, return result; } +/// Build and return an array subrange. +/// +/// @param rdr the read context. +/// +/// @param ctf_dictionary the CTF dictionary where @ref index +/// will be found. +/// +/// @param index the CTF type ID for the array index. +/// +/// @param nelems the elements number of the array. +/// +/// @return a shared pointer to subrange built. +static array_type_def::subrange_sptr +build_array_ctf_range(reader *rdr, ctf_dict_t *dic, + ctf_id_t index, uint64_t nelems) +{ + bool is_infinite = false; + corpus_sptr corp = rdr->corpus(); + translation_unit_sptr tunit = rdr->cur_transl_unit(); + array_type_def::subrange_sptr subrange; + array_type_def::subrange_type::bound_value lower_bound; + array_type_def::subrange_type::bound_value upper_bound; + + type_base_sptr index_type = rdr->lookup_type(corp, tunit, + dic, index); + if (!index_type) + return nullptr; + + lower_bound.set_unsigned(0); /* CTF supports C only. */ + upper_bound.set_unsigned(nelems > 0 ? nelems - 1 : 0U); + + /* for VLAs number of array elements is 0 */ + if (upper_bound.get_unsigned_value() == 0) + is_infinite = true; + + subrange.reset(new array_type_def::subrange_type(rdr->env(), + "", + lower_bound, + upper_bound, + index_type, + location(), + translation_unit::LANG_C)); + if (!subrange) + return nullptr; + + subrange->is_infinite(is_infinite); + add_decl_to_scope(subrange, tunit->get_global_scope()); + canonicalize(subrange); + + return subrange; +} + /// Build and return an array type libabigail IR. /// /// @param rdr the read context. @@ -1189,64 +1241,51 @@ process_ctf_array_type(reader *rdr, translation_unit_sptr tunit = rdr->cur_transl_unit(); array_type_def_sptr result; ctf_arinfo_t ctf_ainfo; - bool is_infinite = false; /* First, get the information about the CTF array. */ if (static_cast(ctf_array_info(ctf_dictionary, - ctf_type, - &ctf_ainfo)) == CTF_ERR) + ctf_type, + &ctf_ainfo)) == CTF_ERR) return result; ctf_id_t ctf_element_type = ctf_ainfo.ctr_contents; ctf_id_t ctf_index_type = ctf_ainfo.ctr_index; uint64_t nelems = ctf_ainfo.ctr_nelems; + array_type_def::subrange_sptr subrange; + array_type_def::subranges_type subranges; + + int type_array_kind = ctf_type_kind(ctf_dictionary, ctf_element_type); + while (type_array_kind == CTF_K_ARRAY) + { + if (static_cast(ctf_array_info(ctf_dictionary, + ctf_element_type, + &ctf_ainfo)) == CTF_ERR) + return result; + + subrange = build_array_ctf_range(rdr, ctf_dictionary, + ctf_ainfo.ctr_index, + ctf_ainfo.ctr_nelems); + subranges.push_back(subrange); + ctf_element_type = ctf_ainfo.ctr_contents; + type_array_kind = ctf_type_kind(ctf_dictionary, ctf_element_type); + } + + std::reverse(subranges.begin(), subranges.end()); /* Make sure the element type is generated. */ type_base_sptr element_type = rdr->lookup_type(corp, tunit, - ctf_dictionary, - ctf_element_type); + ctf_dictionary, + ctf_element_type); if (!element_type) return result; - /* Ditto for the index type. */ - type_base_sptr index_type = rdr->lookup_type(corp, tunit, - ctf_dictionary, - ctf_index_type); - if (!index_type) - return result; - result = dynamic_pointer_cast(rdr->lookup_type(ctf_dictionary, - ctf_type)); + ctf_type)); if (result) return result; - /* The number of elements of the array determines the IR subranges - type to build. */ - array_type_def::subranges_type subranges; - array_type_def::subrange_sptr subrange; - array_type_def::subrange_type::bound_value lower_bound; - array_type_def::subrange_type::bound_value upper_bound; - - lower_bound.set_unsigned(0); /* CTF supports C only. */ - upper_bound.set_unsigned(nelems > 0 ? nelems - 1 : 0U); - - /* for VLAs number of array elements is 0 */ - if (upper_bound.get_unsigned_value() == 0) - is_infinite = true; - - subrange.reset(new array_type_def::subrange_type(rdr->env(), - "", - lower_bound, - upper_bound, - index_type, - location(), - translation_unit::LANG_C)); - if (!subrange) - return result; - - subrange->is_infinite(is_infinite); - add_decl_to_scope(subrange, tunit->get_global_scope()); - canonicalize(subrange); + subrange = build_array_ctf_range(rdr, ctf_dictionary, + ctf_index_type, nelems); subranges.push_back(subrange); /* Finally build the IR for the array type and return it. */ diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 8d4a2b8f..d04ecf3f 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -713,6 +713,9 @@ test-read-ctf/test-bitfield-enum.o \ test-read-ctf/test-const-array.abi \ test-read-ctf/test-const-array.c \ test-read-ctf/test-const-array.o \ +test-read-ctf/test-array-mdimension.abi \ +test-read-ctf/test-array-mdimension.c \ +test-read-ctf/test-array-mdimension.o \ \ test-annotate/test0.abi \ test-annotate/test1.abi \ diff --git a/tests/data/test-read-ctf/test-array-mdimension.abi b/tests/data/test-read-ctf/test-array-mdimension.abi new file mode 100644 index 00000000..177284d2 --- /dev/null +++ b/tests/data/test-read-ctf/test-array-mdimension.abi @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-ctf/test-array-mdimension.c b/tests/data/test-read-ctf/test-array-mdimension.c new file mode 100644 index 00000000..317fc589 --- /dev/null +++ b/tests/data/test-read-ctf/test-array-mdimension.c @@ -0,0 +1,2 @@ +/* gcc -gctf -c test-array-mdimension.c -o test-array-mdimension.o */ +char a[2][3][4][5]; diff --git a/tests/data/test-read-ctf/test-array-mdimension.o b/tests/data/test-read-ctf/test-array-mdimension.o new file mode 100644 index 0000000000000000000000000000000000000000..5b392d89439a1e39111c350ba2ee8baf7cdb4a14 GIT binary patch literal 1360 zcmbVM&2G~`5T3Ll{9P!g0vB_l6?pBWT<8H=s-OrVZX7wRoh7mGPqf~u@rhUH8^ELR z2)qH$051SD_N=`u;lfDcnf>Pbc6Y{3KD~JJa&IyLYZG`5CeM+!_aC%?gd2jdm`27QKp$WA$*H=~IBeZtUYq)jO6?Jfo4(1F9D03E*17)7=Y zr#ldrB3p-F!v*0KAzMogMP03ei>k?2m0AXQWk5o-u1giAZQ4e)mRX^qMrToxr!vh~ zGB3hPT}DPVriqr)$Sw`FlFKkNANrNlTDD=i%u9uP*OkZs&d<(HgQN4e?~a4{iHJoU zEaJstK98RTM{2uKn#e{L$Njwnz9$Os&XccBFF22Wz3ZJ(Yu2bfg&)7{+QxgB9KblW ztu0Vj;f~8o0MWFikts%_`?$85QCkCoW&t8?8W1=KeAFd11fr^q64*xA7@2+K^{ToM z8(m}DrnRU4cYJ_K>XpBtVV`8k{!IM2J;X9$<3xIX(ucpEzWxz1=)3)wewZ)s6mYcR z2`2uYR7>cA_S7qSOPC{vu$ah>874k - + + - - + + + - - - + + - - - - + - + - + - + - + - + - - + + - - + + diff --git a/tests/test-read-ctf.cc b/tests/test-read-ctf.cc index 61a5682c..a2193303 100644 --- a/tests/test-read-ctf.cc +++ b/tests/test-read-ctf.cc @@ -362,15 +362,24 @@ static InOutSpec in_out_specs[] = "data/test-read-ctf/test-bitfield-enum.abi", "output/test-read-ctf/test-bitfield-enum.abi", "--ctf", - }, - { - "data/test-read-ctf/test-const-array.o", - "", - "", - SEQUENCE_TYPE_ID_STYLE, - "data/test-read-ctf/test-const-array.abi", - "output/test-read-ctf/test-const-array.abi", - "--ctf", + }, + { + "data/test-read-ctf/test-const-array.o", + "", + "", + SEQUENCE_TYPE_ID_STYLE, + "data/test-read-ctf/test-const-array.abi", + "output/test-read-ctf/test-const-array.abi", + "--ctf", + }, + { + "data/test-read-ctf/test-array-mdimension.o", + "", + "", + SEQUENCE_TYPE_ID_STYLE, + "data/test-read-ctf/test-array-mdimension.abi", + "output/test-read-ctf/test-array-mdimension.abi", + "--ctf", }, // This should be the last entry. {NULL, NULL, NULL, SEQUENCE_TYPE_ID_STYLE, NULL, NULL} From patchwork Thu Nov 17 03:43:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guillermo E. Martinez" X-Patchwork-Id: 60734 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 4D1CF396DC1D for ; Thu, 17 Nov 2022 03:44:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4D1CF396DC1D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668656648; bh=xZVD4DHuTQef0ivvIs3qG93P3EgdacnGr4kSVb6Qj30=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Help:List-Subscribe:From: Reply-To:From; b=kkZV7h0BUhUBkg2/9H2x4kicUZI9k/42GdPvFItdl2Hgv5w+SQN7zWl/gx9geoPm/ OlhJsJYFAtg3KA3IIe7+ZwyS0vpYrrnfJ/IglnhnN6+rX+TSeafRbXs00PRe+fn8BQ s3M4CzvEXdTf0PuAyIfa+2tL1IAEvDoP4lBOO0Kk= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 9B54C3954C5B for ; Thu, 17 Nov 2022 03:44:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9B54C3954C5B Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AH25wcZ005401 for ; Thu, 17 Nov 2022 03:44:01 GMT Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kv3jsqh9e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 17 Nov 2022 03:44:00 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2AH2o206040921 for ; Thu, 17 Nov 2022 03:43:59 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ku3k99ttg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 17 Nov 2022 03:43:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c6Nhczn7uyy1owhVPdm5QSTTRddcCNZwlmXHMCZsgYEfA2coTbGJILP6rTkdGKHC0PLd2u3OeLeKoZl3wLzdz9VGbZwUY75/4hQ36iEnbHr+9UM8L37MqG7IPJ3gi1Uv0U7P52Kj25nuCNPY5lNlQWNv4K+lXrsc0MyqFhcaUagRy3Zc4DiNQEnhQXae2u9SFP7EHr1X3PRWT4Ow4OQlmhYs/qQBIvumMspwvwWiKGhwXLmpIxMbz3ERZEpak2lgg4fHkBhqPvNIApWfkHC3o2zuLGCe4PIrpGO69Y4XP9F1BWhgFNGjCqbEUcJ4XbPEX78ezAEuWB2QoBIwV6SWeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xZVD4DHuTQef0ivvIs3qG93P3EgdacnGr4kSVb6Qj30=; b=jF74w//473+QOs9KmoNlHq9J4RZ0+DhsOHaVXuKzO3Gj90RKWsy2CwIVTtlXCqE82HPDNNXw89EAFS/ahdZdEn01LCe0LPIrlALcCsXR85prNdCzD6umyOFAm7jy3lGOntWB8wptuu7q2kmt7xm9R3s/6abQPRuym8ejlgqdYq0AaKhmwru3nhitgzAygpzj2jYfInK+gJdW8JOoGpHdbavVIBJDtahGdFDEhoGJw7w44Mw59DpIHm7aE+PngMeGh8Yi9yPj/JOt/vzZYaQQ3b00N3dY2W43DJh3txpwgnUAa7GgR+uS8bIs03XWW39itTPWv77Jht1kHt/onSMiCQ== 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 Received: from MWHPR10MB1407.namprd10.prod.outlook.com (2603:10b6:300:23::20) by CH0PR10MB4843.namprd10.prod.outlook.com (2603:10b6:610:cb::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.20; Thu, 17 Nov 2022 03:43:57 +0000 Received: from MWHPR10MB1407.namprd10.prod.outlook.com ([fe80::1800:88c1:fae8:13b4]) by MWHPR10MB1407.namprd10.prod.outlook.com ([fe80::1800:88c1:fae8:13b4%10]) with mapi id 15.20.5813.020; Thu, 17 Nov 2022 03:43:55 +0000 To: libabigail@sourceware.org Cc: "Guillermo E. Martinez" Subject: [PATCH 5/5] ctf-front-end: Fix array size representation Date: Wed, 16 Nov 2022 21:43:05 -0600 Message-Id: <20221117034305.184864-6-guillermo.e.martinez@oracle.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221117034305.184864-1-guillermo.e.martinez@oracle.com> References: <20221117034305.184864-1-guillermo.e.martinez@oracle.com> X-ClientProxiedBy: SA9PR13CA0051.namprd13.prod.outlook.com (2603:10b6:806:22::26) To MWHPR10MB1407.namprd10.prod.outlook.com (2603:10b6:300:23::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR10MB1407:EE_|CH0PR10MB4843:EE_ X-MS-Office365-Filtering-Correlation-Id: 35ed0f12-b0ca-45e7-b274-08dac84df0ab X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5cROemL/8XEQyAnM+DavdhoeHoclVnbrKsYEsTpKyrTqlzkge9KlNomZRcDngTndsLNoWczTMs3xsrrpdTEFqG4mTf4rmgQxkNHtKiqUFDqggPUOajQeFhn69M9i0GCeLDqPQkPtWnkiMSS0ZL8/zQDw41DAVPl8iukFKVg44stZdwj0QSjQeD8R81l+lJutHk+G5dMrTGd1DSGy4gGaETbO7al9o4/Uu2VtSdMhWBtzyeOjU570J09iidSkqHiWtVxhwdLrL9OlmYvzu1z08asumTJg4fc1J8tVyhgEScW1NQCdPv9Wd/qICNZ7StgCPDXa+Yd8a2GRdWjncK4GhNnTBSWcRZg0bDsziLVFNFx/IH/Z0d7GZZA0Cj16mmVIIKeabLjNPoCZMv5F81pMs/8xpZ3LtCOOZW/KmFJ+k/LClD0th5C01HiW4mgGa7tW8Mee0a+RSmgszG0xmgDUQtAbI0qNpgWy3v4pU2ALydjlBTqvs2riDwgGJChpVo+XzLW3R3svdu/sV6dbCqbDUGZKj2e2sHRbgkzJ7ls3ncSo1xi0GtLETCzXhSG/5aeXFVLKdqIOUEYTNHzOMdunle1gMSTRHlwh18n13Jci8ROB1zxDxDI7W9/5L5FHYlc0H6mkCx09EcIBAFIM1tPO2fjDx30lAoQmj+y3UarAOW+GX5kGjHsoIVuc0jrryfP9h4chqHCAxtXe/PiG5+gDZA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR10MB1407.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(136003)(346002)(39860400002)(376002)(396003)(366004)(451199015)(86362001)(36756003)(103116003)(41300700001)(2616005)(66946007)(66476007)(66556008)(4326008)(8676002)(1076003)(186003)(8936002)(5660300002)(107886003)(6666004)(478600001)(6486002)(316002)(6512007)(6506007)(6916009)(38100700002)(83380400001)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RtdQF7OXZaRWWrLlE0bXkZk8DmiAAKM9c9xmZoN9rTZYc2UL7ucWVTTXSfJb0jL5FUUMbShQBOZf1f0AuC+ohL6MhwJZ9VvXZjgyUB61qLuauvbx+sYdlFRy1E8lJuD5GFQh5aHNe5mM4Rltu9wnqxAdBAJZWRd7Gym7JkbrblR7YvVo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Ozk518+q1nSAaQQujbU+XeryeKXmtLRvSEnSu+VxDtlmbq34Kw2l143ypLCGMq/h7wrxzkl3bTW8KkJsWTcA9lmn9aagqy2vkjuM+eMJCW2b7+CFdLmvgEyJMp5AX1vXv+Mrb+/DInqukY4TKY42GGuFxtYP+SqbMCp8OvRuGuAio4QGCCIsXYoOXfruYxF+0b5Vdl7eMTaBnt8teItk6iyKQv/fGZHwMhgmWY/Qr6k81/xH/ItOnkNQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 35ed0f12-b0ca-45e7-b274-08dac84df0ab X-MS-Exchange-CrossTenant-AuthSource: MWHPR10MB1407.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2022 03:43:53.7633 (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: 0D7etWH54DOfBJ/dGOcE0y/cp1JLAORalA/EF22ByfvHZiRWs8MGi7L3wLRRQCpL9IPp++td1S5jBzCw4JYZyEyUVpcv/cDjx3NGC6Rd/N0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB4843 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-16_03,2022-11-16_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 adultscore=0 phishscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211170024 X-Proofpoint-ORIG-GUID: 3A6rW-duOZcsA68zt74O58cziSMhxat5 X-Proofpoint-GUID: 3A6rW-duOZcsA68zt74O58cziSMhxat5 X-Spam-Status: No, score=-12.6 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_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: "Guillermo E. Martinez via Libabigail" From: "Guillermo E. Martinez" Reply-To: "Guillermo E. Martinez" Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" Array with a single element is represented as infinite array. * src/abg-ctf-reader.cc (build_array_ctf_range): Use * tests/data/Makefile.am: Add new test. `upper_bound' and number of elements to indicate infinite array size. * tests/data/test-read-ctf/test-array-size.abi: New test. * tests/data/test-read-ctf/test-array-size.c: Likewise. * tests/data/test-read-ctf/test-array-size.o: Likewise. * tests/test-read-ctf.cc: Update testsuite. Signed-off-by: Guillermo E. Martinez Signed-off-by: Guillermo E. Martinez Signed-off-by: Dodji Seketeli --- src/abg-ctf-reader.cc | 2 +- tests/data/Makefile.am | 3 +++ tests/data/test-read-ctf/test-array-size.abi | 23 +++++++++++++++++++ tests/data/test-read-ctf/test-array-size.c | 4 ++++ tests/data/test-read-ctf/test-array-size.o | Bin 0 -> 1432 bytes tests/data/test-read-ctf/test9.o.abi | 4 ++-- tests/test-read-ctf.cc | 9 ++++++++ 7 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 tests/data/test-read-ctf/test-array-size.abi create mode 100644 tests/data/test-read-ctf/test-array-size.c create mode 100644 tests/data/test-read-ctf/test-array-size.o index 9f5a7466..5c89f821 100644 diff --git a/src/abg-ctf-reader.cc b/src/abg-ctf-reader.cc index ba4eed16..18217d81 100644 --- a/src/abg-ctf-reader.cc +++ b/src/abg-ctf-reader.cc @@ -1203,7 +1203,7 @@ build_array_ctf_range(reader *rdr, ctf_dict_t *dic, upper_bound.set_unsigned(nelems > 0 ? nelems - 1 : 0U); /* for VLAs number of array elements is 0 */ - if (upper_bound.get_unsigned_value() == 0) + if (upper_bound.get_unsigned_value() == 0 && nelems == 0) is_infinite = true; subrange.reset(new array_type_def::subrange_type(rdr->env(), diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index d04ecf3f..e994aff3 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -716,6 +716,9 @@ test-read-ctf/test-const-array.o \ test-read-ctf/test-array-mdimension.abi \ test-read-ctf/test-array-mdimension.c \ test-read-ctf/test-array-mdimension.o \ +test-read-ctf/test-array-size.abi \ +test-read-ctf/test-array-size.c \ +test-read-ctf/test-array-size.o \ \ test-annotate/test0.abi \ test-annotate/test1.abi \ diff --git a/tests/data/test-read-ctf/test-array-size.abi b/tests/data/test-read-ctf/test-array-size.abi new file mode 100644 index 00000000..3fbc65b6 --- /dev/null +++ b/tests/data/test-read-ctf/test-array-size.abi @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-ctf/test-array-size.c b/tests/data/test-read-ctf/test-array-size.c new file mode 100644 index 00000000..fe2f3fef --- /dev/null +++ b/tests/data/test-read-ctf/test-array-size.c @@ -0,0 +1,4 @@ +/* gcc -gctf -c test-array-size.c -o test-array-size.o */ +char foo[2]; +char bar[1]; +char baz[0]; diff --git a/tests/data/test-read-ctf/test-array-size.o b/tests/data/test-read-ctf/test-array-size.o new file mode 100644 index 0000000000000000000000000000000000000000..8e4d8b147bcf9ae2fcfe3d6f2caca05868f6b341 GIT binary patch literal 1432 zcmbVM&2G~`5T29}elMj5kU+vnNVEd4op7QDWT}Em2ysK=!eQ-f6AQ<#?5!I20*}Ev zaN!Yn3~ulW@B%QOvzx3};lfDc`R1E%Ry$)SA78wFxic7$wE;b+O=el5?>ifubTFYC zbe(?x7_KW1HxjzZ7=Fii%<(h3W*@R&V!zCOj~$x8VAOz70}q|K&j|4KsGEI2Ehd{(Myke8ZHs)|ysr1FBId9_ec+NNz( z)iNto)YMs2iS!^vNodbuHVl$uE@1h>nkr4uk#U zH*XJu@lz3tIGDtf$#@(;3-;CWRMq)Hm0A`D-3`0l1q`ttZsIuy->@@l1Cu**+EOo~ zKBQlNdL$=%?7Q98R~5U*+lIHfJ^!xZ@t%5y9fZA6-8GVE+J%-WM_sSt+#;=(ngq5- zB5fKHyg7bU3oL>}S!pGB^svz~`(W}}c_vQlir1yv-ZlO=!CaWpd~54tk~QiByAR7g zU;xhFOJW6H^!p!i9pCrA`rUVqqx}9STR7+vJlGPi!Aoh(8gTgCy7tKkAG;)D+i&Bc z!@1HgR^XCbw6B=E!fwAeEB|Wx{d-|ou0iJaqW;tLFOB$`(b<0d=fJ@Gy9fWy9C{y# UWBypXT-(-vZu;Lly?}oIUzApI#Q*>R literal 0 HcmV?d00001 diff --git a/tests/data/test-read-ctf/test9.o.abi b/tests/data/test-read-ctf/test9.o.abi --- a/tests/data/test-read-ctf/test9.o.abi +++ b/tests/data/test-read-ctf/test9.o.abi @@ -7,8 +7,8 @@ - - + + diff --git a/tests/test-read-ctf.cc b/tests/test-read-ctf.cc index a2193303..f561f7fa 100644 --- a/tests/test-read-ctf.cc +++ b/tests/test-read-ctf.cc @@ -381,6 +381,15 @@ static InOutSpec in_out_specs[] = "output/test-read-ctf/test-array-mdimension.abi", "--ctf", }, + { + "data/test-read-ctf/test-array-size.o", + "", + "", + SEQUENCE_TYPE_ID_STYLE, + "data/test-read-ctf/test-array-size.abi", + "output/test-read-ctf/test-array-size.abi", + "--ctf", + }, // This should be the last entry. {NULL, NULL, NULL, SEQUENCE_TYPE_ID_STYLE, NULL, NULL} };