From patchwork Wed Apr 27 16:38:28 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: 53275 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 2EB08385742A for ; Wed, 27 Apr 2022 16:38:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2EB08385742A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1651077534; bh=whXfhEkj6nbveAfBv2g0XFrV86eymxHbQUOzMyt8BnY=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=t2tSd6+SGMbkZ1O4jFK/IN7MSxVw3NgpHiYRtYJNzsw/no/v331KeLbneoRqYOHOP yt2o6WFf7+r521YoIJdnL+3i1r3qjOX2bibOnQ/xlxtzm7PvN+8PkwhxVKfhItXo5C +NtVtAPNSjeOy0v30zjzE1WjwyUdzSvOR/i6yktw= 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 A80F53858D28 for ; Wed, 27 Apr 2022 16:38:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A80F53858D28 Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 23RFXVFZ032115 for ; Wed, 27 Apr 2022 16:38:47 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 3fmb1018s8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 27 Apr 2022 16:38:47 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 23RGU71T026223 for ; Wed, 27 Apr 2022 16:38:45 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam08lp2044.outbound.protection.outlook.com [104.47.73.44]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3fm7w53ne5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 27 Apr 2022 16:38:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TWa8pqj+cpVLICekjHwxa2j/j6bi+KbHMmRnCYKvZ5s8lMbxu8BTlQ9rUrGvL7/qPX+6Jgy6fr399/2LG2rEKpO+UfinNq5ixeStjlGwNYynLL/36LRckveytwHQdl7QEtSX7RvPeqxwV/leNP4HFxzt+GScdzY4Q63rhwNJ3lWYBH9GEaNwMIvLdu9Vv1N3JeVps+CWFdt/zfqkpd16qjF/sEBAsFR7QIkirPOgIcU1t5iFet2SFH8w2e0/W7fs9+2nnZP0Zpem/H481fnueI0jbM5kGF2y+USDjQmTJV/dctSaIdkRxnsZ1k1+7wFM8pi97Xw4MeLGKZw9VX3EIQ== 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=whXfhEkj6nbveAfBv2g0XFrV86eymxHbQUOzMyt8BnY=; b=MeAtoUoJp0Trmg2Fl7guTth2oP6mTa0y1EOJg2G6vYtKKPZMhFpBj9tBDc69jFWYB7aM8UQ3ISGq5ORH5F4nBnHmLDvWR8MfRjIp74Q9LISC56hxDaGEPEhjEKaVzIkkkqYGs+3UPxkAp2IW4xsJ47JA6V35Xa5D1UO6NdcabKm1H3JwzyNAn3cxPwoG74Py5YnpXilmV6C+1zXeuZMNzKpOljCydaoVJ+eOchl9bysdQhc65QWe8hZU8Wa5Trf63r1SryZqLBa4aPOb0FyhEsQ2XfyEZq9TU8w2CF0QzhfhUCRuGCwxjKEB6wwgv3odzQF5fU+wXHp2FQ+yiDl5rw== 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 BN6PR1001MB2387.namprd10.prod.outlook.com (2603:10b6:405:31::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.14; Wed, 27 Apr 2022 16:38:43 +0000 Received: from MWHPR10MB1407.namprd10.prod.outlook.com ([fe80::107d:de35:fa5f:3cc0]) by MWHPR10MB1407.namprd10.prod.outlook.com ([fe80::107d:de35:fa5f:3cc0%7]) with mapi id 15.20.5206.013; Wed, 27 Apr 2022 16:38:42 +0000 To: libabigail@sourceware.org Subject: [PATCH] ctf-reader: shows incomplete summary changes Date: Wed, 27 Apr 2022 11:38:28 -0500 Message-Id: <20220427163828.2065797-1-guillermo.e.martinez@oracle.com> X-Mailer: git-send-email 2.35.1 X-ClientProxiedBy: DM6PR07CA0091.namprd07.prod.outlook.com (2603:10b6:5:337::24) To MWHPR10MB1407.namprd10.prod.outlook.com (2603:10b6:300:23::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4c866979-cdc1-4d71-e978-08da286c6387 X-MS-TrafficTypeDiagnostic: BN6PR1001MB2387:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: h9cfxE0mb8+gG6d6kYiKQsbclTGA6/Dt7546PpjUrdVpnhOJwqS0df4ILrUYuORnDJ7pudUhYPAqZ4mA+AoN3nHItoxAHqM3lqgVd4cVmuGbJv9TCUBcfPlu1Scch0s6oLX26K+c9HvvoxUILr387xM/9JgG0ZOw3tdNBpV5hoIewpnxEGkJ2pzLIcgI2bEQWEHtRlgQC1jqk5pXxYffjRA0Troyoh+nXs894uSLrptUEDT3h6c1OwmVsPHXiAFrQUk/UM2MfTTCRiJnZ3rEa0oWh/Ma8JO5R9gXl8MPlZAanoJeh1tVWfmLHwsAMik4uipAnktcknP3VrlILX1suxeLtlnR6ikF9wckjefXEm8uZYwUhUPr6qRG0m465K7op4xxO3O/MpKCzIoRi33VkkD800tbNQYay3qRBzXahS/j8QrDluU9PWp3fKb5vqpVzlT59foA+ULFdxDSOryIRBhxj2JMKg6qiWQnD6X/tpXx72XEZCuIFdZEBP8vhSHZJGrMbZxX7+UhpkHDY/83OU8OgOlHgRQWSFYB4r/C5ACH3PMtUcD6MI0EI7TRxs08coXSl7UL24NMV34EojJ4F0Dq9HDrj+fNKpfqvkO98eI9LzBMfSC0c1D+14GQDXSEEzDHhxH9SWScWkbcGRm99A== 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:(13230001)(366004)(52116002)(2906002)(6666004)(30864003)(66946007)(66556008)(66476007)(6916009)(38100700002)(8676002)(6512007)(6506007)(4326008)(86362001)(508600001)(186003)(8936002)(5660300002)(83380400001)(316002)(107886003)(2616005)(103116003)(1076003)(6486002)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: qHwgL75hty8lV9ja8kf0qJNSr+XEf+5Pm2YycfH/aU9Q9PwbwOK2aGJrdMxRPIv+ZYOMYfGqm68EeEtEg/azVpItw9ROKK2vJ8ZJXqKlmlI9fvAs057I8vLxtJFbDccNwhFhoEFFp+QGIWmcFkwDrokacvZ6pzw3blaUY8oyqXkMz1HhUZKyphTalTsbffp1fkh6DiE9qrXhyjz0z7DE6tDBPM2EZ4m4L/VsPxs8qshJooKv80bHVKv4v+NyMYn0a5cvb3minNcyPfL+BlnUg3mz9+l/JE5nxPbYpZOnYBdfxYmB2QRl64SdCHzaYIFedolACVOejxTn4u84/viyfu2FukxMD/labAkUkjtiCQMufoBFyTFnQFq0tnWVMPWXKuJoFmyRermTY3MyZS6lOPI5yjKOBc/RjOfqrxNV1KBcLfSdNLGNeyMLMGLuAHZR/+BmY0UyL1U9Y03LrmzVk0/83g0fG4W99EdqCsJRSu+pq8FLsT7JRAbxxNvOB1BYdCxW0aFb7W5bPjRWSHPOUiN9tS+kiaWOAPgWClPN90fwDV0lkXlwdWfrXvj6W2MSnb5YEv+osZUxnYTuTdNaWlh4a7HGKRVqbGpyJr6419mZnitpmFpBA9bKgf5iB7uV/6gQ01PuLEY1Sj/tjiW0VP9UVj+qiVkh+jTqu9cSOJV9QPZ+/pqu9MpsR3qdA1Sg+QB9jWut+OqwgYRHiJYXWm9VqTASDMAH8hdtBIe83Dok1arN0jImDu/kIAW/Z1iOubbSutmLI7VZnWabrOgvKpHkmqQ9Pj+/gfw3WXn05TkxkCzQl2xVQ2bF/Hj6NGqqWsVha4a+1yUxjQBDL5KRXmib/JpXebtG5RUQ+21b7zW+K7nI0VZtJEvLISHgLZmg3KPzPrGJVfOV78DJzYWWaYirEBnVTXIRx06PsXsS7kfqbbdrUT5fjnNPKb67czsTvZD4kA5hnGZSBy5ZRbrMHG9eTTWWLjXALceff7+V7KVss3cOONDYlkLBZaV46bcRvoFa1PCI3Qx3yzH9WUNu2N1gCtPkTW+mqEy2zZI9qi5m+e2+7QVul9mt84SVEEot37bOCFSpwFYIk+D7V535LpRe3X9ih0WVFvrk26Ax2TLcXwl0VM0ga8drnUGld0zh8HOn73ThoxyoGDeXpfdo5fHrk1bb8Rsm+cfwvjsbGhBzbkHxIUD6/gzlPaT+0hxaGazBAdRlKxvNc3m6zEYwovfvy6fOxp1gMYN/2tlxusRaoZ7aoc8phnQTpz12rj95ejCfYS0Lw8Ld7AlCvxYLGKtD265uptz7npUFWUjCdncikOvAuR/9Va0pxS3OU9vrfZ0lBnBJVQ89wxZy8/zGtEX90U72LaBaVhNeZV1kTIw0ZH596ImoYG8BPdgBD5Ws/8873Q9ARMEv16FPUbNB2UTxmtMm9AbadehPj9QO6yFTmRJ6EPFDQ2ZQFGiN8dHXEUr71yT5KsGREHETxQ/guHy/LHvbH/v+6E/0rHcMumKmawrdd+6TOGcYBBeQpKug49ixEtPQdoSwynLc9Y+V5qVQH4xp4WbVTTcd+XlKC+BG94czqPK6Seuor4kZskcFJbvpY0vpwuIFHFpcS57LhrqChSukrhGxK3HOYlK4KYpI86KC4U1MQIaLELMzXyFnqkhwU9srvwBZRXEte77kJx6YlFeY5cl04ZS1HDwBpxDRzdWacxZEizFX6OONRIfItiGMbKOTDUHgSEl6oYIHssWgLBjHtbVm7BjrzLUokUlnMqy398TwtpQZEs3cnG7FRftsGB+O X-MS-Exchange-AntiSpam-MessageData-1: 3VjIIkQafI0kiA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c866979-cdc1-4d71-e978-08da286c6387 X-MS-Exchange-CrossTenant-AuthSource: MWHPR10MB1407.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Apr 2022 16:38:41.9651 (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: OofPRs/TgFAz+rGKJfo1DUBfLRTLp1bJldRM81kSahPPOeE3ox0kTQCY4xZe5xPpFjcm1SSL+O8ALLmFfMpJZp8IA7JriPxMrt+3BCvBXmQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1001MB2387 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486, 18.0.858 definitions=2022-04-27_04:2022-04-27, 2022-04-27 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 phishscore=0 bulkscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204270103 X-Proofpoint-ORIG-GUID: g_5SrITS60G1QftKPRCaehpBe4q7BgMR X-Proofpoint-GUID: g_5SrITS60G1QftKPRCaehpBe4q7BgMR X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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" Hello libabigail team, This patch improves the output summary changes using CTF reader, Comments are highly appreciated, Kind Regards, Guillermo During corpus comparison with ctf support, summary changes for functions and variables are shown like to the binaries doesn't have ctf debug information, even though they were compiled with '-gctf' compiler modifier, e.g: 2 Removed function symbols not referenced by debug info: [D] elf32_test_main@@ELFUTILS_1.7 [D] elf64_test_main@@ELFUTILS_1.7 So, expected changes summary should be: 2 Removed functions: [D] 'function long int elf32_test_main()' {elf32_test_main@@ELFUTILS_1.7} [D] 'function long int elf64_test_main()' {elf64_test_main@@ELFUTILS_1.7} * src/abg-ctf-reader.cc (read_context::exported_decls_builder_): Add new data member. (read_context::exported_decls_builder): Add new get/set member functions. (read_context::maybe_add_{fn,var}_to_exported_decls): Likewise. (read_context::initialize): Initialize exported_decls_builder_ member. (read_context::build_ir_node_for_variadic_parameter_type): Add new function. (read_context::process_ctf_function_type): Add additional code to handle function's variadic parameter. (read_context::process_ctf_archive): Rename variable for clarity from `ctf_var_type' to `ctf_sym_type', using new member functions `maybe_add_{fn,var}_to_exported_decls'. (read_context::read_corpus): Set `exported_decls_builder'. * tests/test-read-common.cc (test_task::run_abidw): Fix error message. * tests/data/test-read-ctf/test-PR26568-1.o.abi: Adjust test case. * tests/data/test-read-ctf/test-PR26568-2.o.abi: Likewise. * tests/data/test-read-ctf/test-anonymous-fields.o.abi Likewise. * tests/data/test-read-ctf/test5.o.abi: Likewise. * tests/data/test-read-ctf/test7.o.abi: Likewise. --- src/abg-ctf-reader.cc | 104 ++++++++++++++++-- tests/data/test-read-ctf/test-PR26568-1.o.abi | 32 ++---- tests/data/test-read-ctf/test-PR26568-2.o.abi | 6 - .../test-read-ctf/test-anonymous-fields.o.abi | 18 +-- tests/data/test-read-ctf/test5.o.abi | 1 + tests/data/test-read-ctf/test7.o.abi | 1 + tests/test-read-common.cc | 4 +- 7 files changed, 117 insertions(+), 49 deletions(-) diff --git a/src/abg-ctf-reader.cc b/src/abg-ctf-reader.cc index 8feaf5b2..0337898b 100644 --- a/src/abg-ctf-reader.cc +++ b/src/abg-ctf-reader.cc @@ -84,6 +84,52 @@ public: corpus_sptr cur_corpus_; corpus_group_sptr cur_corpus_group_; + corpus::exported_decls_builder* exported_decls_builder_; + + /// Setter of the exported decls builder object. + /// + /// Note that this @ref read_context is not responsible for the live + /// time of the exported_decls_builder object. The corpus is. + /// + /// @param b the new builder. + void + exported_decls_builder(corpus::exported_decls_builder* b) + {exported_decls_builder_ = b;} + + /// Getter of the exported decls builder object. + /// + /// @return the exported decls builder. + corpus::exported_decls_builder* + exported_decls_builder() + {return exported_decls_builder_;} + + /// If a given function decl is suitable for the set of exported + /// functions of the current corpus, this function adds it to that + /// set. + /// + /// @param fn the function to consider for inclusion into the set of + /// exported functions of the current corpus. + void + maybe_add_fn_to_exported_decls(function_decl* fn) + { + if (fn) + if (corpus::exported_decls_builder* b = exported_decls_builder()) + b->maybe_add_fn_to_exported_fns(fn); + } + + /// If a given variable decl is suitable for the set of exported + /// variables of the current corpus, this variable adds it to that + /// set. + /// + /// @param fn the variable to consider for inclusion into the set of + /// exported variables of the current corpus. + void + maybe_add_var_to_exported_decls(var_decl* var) + { + if (var) + if (corpus::exported_decls_builder* b = exported_decls_builder()) + b->maybe_add_var_to_exported_vars(var); + } /// Getter of the current corpus group being constructed. /// @@ -211,6 +257,7 @@ public: ctfa = NULL; symtab.reset(); cur_corpus_group_.reset(); + exported_decls_builder_ = 0; } ~read_context() @@ -362,6 +409,26 @@ process_ctf_base_type(read_context *ctxt, return result; } +/// Build the IR node for a variadic parameter type. +/// +/// @param ctxt the read context to use. +/// +/// @return the variadic parameter type. +static decl_base_sptr +build_ir_node_for_variadic_parameter_type(read_context &ctxt, + translation_unit_sptr tunit) +{ + + ir::environment* env = ctxt.ir_env; + ABG_ASSERT(env); + type_base_sptr t = env->get_variadic_parameter_type(); + decl_base_sptr type_declaration = get_type_declaration(t); + if (!has_scope(type_declaration)) + add_decl_to_scope(type_declaration, tunit->get_global_scope()); + canonicalize(t); + return type_declaration; +} + /// Build and return a function type libabigail IR. /// /// @param ctxt the read context. @@ -412,11 +479,24 @@ process_ctf_function_type(read_context *ctxt, function_decl::parameter_sptr parm (new function_decl::parameter(arg_type, "", location(), - vararg_p && (i == argc - 1), + false, false /* is_artificial */)); function_parms.push_back(parm); } + if (vararg_p) + { + type_base_sptr arg_type = + is_type(build_ir_node_for_variadic_parameter_type(*ctxt, tunit)); + + function_decl::parameter_sptr parm + (new function_decl::parameter(arg_type, "", + location(), + true, + false /* is_artificial */)); + function_parms.push_back(parm); + } + result = dynamic_pointer_cast(ctxt->lookup_type(ctf_dictionary, ctf_type)); if (result) @@ -1105,22 +1185,22 @@ process_ctf_archive(read_context *ctxt, corpus_sptr corp) for (const auto& symbol : symtab_reader::filtered_symtab(*symtab, filter)) { std::string sym_name = symbol->get_name(); - ctf_id_t ctf_var_type; + ctf_id_t ctf_sym_type; if (corp->get_origin() == corpus::LINUX_KERNEL_BINARY_ORIGIN || ctxt->is_elf_exec) - ctf_var_type= ctf_lookup_variable (ctf_dict, sym_name.c_str()); + ctf_sym_type= ctf_lookup_variable (ctf_dict, sym_name.c_str()); else - ctf_var_type = ctf_lookup_by_symbol_name(ctf_dict, sym_name.c_str()); + ctf_sym_type = ctf_lookup_by_symbol_name(ctf_dict, sym_name.c_str()); - if (ctf_var_type == (ctf_id_t) -1) + if (ctf_sym_type == (ctf_id_t) -1) continue; - if (ctf_type_kind (ctf_dict, ctf_var_type) != CTF_K_FUNCTION) + if (ctf_type_kind (ctf_dict, ctf_sym_type) != CTF_K_FUNCTION) { const char *var_name = sym_name.c_str(); type_base_sptr var_type = lookup_type(ctxt, corp, ir_translation_unit, - ctf_dict, ctf_var_type); + ctf_dict, ctf_sym_type); if (!var_type) /* Ignore variable if its type can't be sorted out. */ continue; @@ -1134,11 +1214,13 @@ process_ctf_archive(read_context *ctxt, corpus_sptr corp) var_declaration->set_symbol(symbol); add_decl_to_scope(var_declaration, ir_translation_unit->get_global_scope()); + var_declaration->set_is_in_public_symbol_table(true); + ctxt->maybe_add_var_to_exported_decls(var_declaration.get()); } else { const char *func_name = sym_name.c_str(); - ctf_id_t ctf_sym = ctf_var_type; + ctf_id_t ctf_sym = ctf_sym_type; type_base_sptr func_type = lookup_type(ctxt, corp, ir_translation_unit, ctf_dict, ctf_sym); if (!func_type) @@ -1154,6 +1236,8 @@ process_ctf_archive(read_context *ctxt, corpus_sptr corp) func_declaration->set_symbol(symbol); add_decl_to_scope(func_declaration, ir_translation_unit->get_global_scope()); + func_declaration->set_is_in_public_symbol_table(true); + ctxt->maybe_add_fn_to_exported_decls(func_declaration.get()); } } @@ -1331,6 +1415,10 @@ read_corpus(read_context *ctxt, elf_reader::status &status) return corp; } + // Set the set of exported declaration that are defined. + ctxt->exported_decls_builder + (ctxt->cur_corpus_->get_exported_decls_builder().get()); + int errp; if (corp->get_origin() == corpus::CTF_ORIGIN) /* Build the ctfa from the contents of the relevant ELF sections, 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 cfb8a50c..832dc1bd 100644 --- a/tests/data/test-read-ctf/test-PR26568-1.o.abi +++ b/tests/data/test-read-ctf/test-PR26568-1.o.abi @@ -7,43 +7,25 @@ - - - - - - - - - - - - - + - + - + - + - - + + - - - - - - - + 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 1163f085..70e0772f 100644 --- a/tests/data/test-read-ctf/test-PR26568-2.o.abi +++ b/tests/data/test-read-ctf/test-PR26568-2.o.abi @@ -19,15 +19,9 @@ - - - - - - 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 0419c29c..2134a86d 100644 --- a/tests/data/test-read-ctf/test-anonymous-fields.o.abi +++ b/tests/data/test-read-ctf/test-anonymous-fields.o.abi @@ -3,14 +3,14 @@ - + - + - + - + @@ -18,16 +18,16 @@ - + - + - + - - + + diff --git a/tests/data/test-read-ctf/test5.o.abi b/tests/data/test-read-ctf/test5.o.abi index f7bcdeb1..1dafd13e 100644 --- a/tests/data/test-read-ctf/test5.o.abi +++ b/tests/data/test-read-ctf/test5.o.abi @@ -32,6 +32,7 @@ + diff --git a/tests/data/test-read-ctf/test7.o.abi b/tests/data/test-read-ctf/test7.o.abi index a13af174..ca572400 100644 --- a/tests/data/test-read-ctf/test7.o.abi +++ b/tests/data/test-read-ctf/test7.o.abi @@ -26,6 +26,7 @@ + diff --git a/tests/test-read-common.cc b/tests/test-read-common.cc index 9681ac27..b441945c 100644 --- a/tests/test-read-common.cc +++ b/tests/test-read-common.cc @@ -95,6 +95,8 @@ test_task::run_abidw(const string& extargs) { string abidw = string(get_build_dir()) + "/tools/abidw"; string drop_private_types; + set_in_abi_path(); + if (!in_public_headers_path.empty()) drop_private_types += "--headers-dir " + in_public_headers_path + " --drop-private-types"; @@ -103,7 +105,7 @@ test_task::run_abidw(const string& extargs) if (system(cmd.c_str())) { error_message = string("ABIs differ:\n") - + in_elf_path + + in_abi_path + "\nand:\n" + out_abi_path + "\n";