From patchwork Sun Oct 30 07:44:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 12950 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1685275wru; Sun, 30 Oct 2022 00:45:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4U5zs0BclgXwm3Am8GxrZVUH7ukNkIJVBZ+tTG4Xm8/iyMnludBGyhEjc2fFK7m/TbpaaI X-Received: by 2002:a17:907:7e87:b0:78e:1a4:130 with SMTP id qb7-20020a1709077e8700b0078e01a40130mr7293538ejc.101.1667115932997; Sun, 30 Oct 2022 00:45:32 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id ev13-20020a056402540d00b0045878eab247si3593371edb.193.2022.10.30.00.45.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 00:45:32 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=DVgusGYQ; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7739E3857BB0 for ; Sun, 30 Oct 2022 07:45:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7739E3857BB0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667115927; bh=clFo+zS4Gi7uNG8vKpMFSx1+9p6zrgWi5JJreHoyfL4=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=DVgusGYQXxBggDI5qVM3VwQpalVvQzuHBGT6AE6OvLJaL/bkhzacpiz+ml+trwqsg sd5uKVNkxOWxkU8P4UPBUHT+i6ZIBPmFNS7IJvSjQ0MaYpx2MFzRhJXNCwevfosVFN 0PBKOu01sfm8/w0AmW66SKsNEa4lB9ZQQ8l58j98= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 4F3953858424 for ; Sun, 30 Oct 2022 07:45:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4F3953858424 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 29TKK0w9020445 for ; Sun, 30 Oct 2022 07:45:07 GMT Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgv2a99tf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:45:07 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 29U60HIB024563 for ; Sun, 30 Oct 2022 07:45:06 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2169.outbound.protection.outlook.com [104.47.59.169]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kgtm29eep-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:45:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CzlJ7tDeQSlkLVAKghXytme3YxmHEBp/lREXzoz51HQjjabHuzuaKoxBemWrt7dcgb74xD10+N2xdizT+DsEvh6UYWWwB5FdQU/pqfis/xOHL4PrCeO0eagxROPvKGgpFJFhgBoIaVjsOQtBeupCQ+58kdip7SGQWpuF6YWqkzb163v88JEWuL5mnzCXKo1H0BPkTdyfBsKPDDCTp18niQf5Bg16XjJaxOk0nm0jFUizOH2L9ivNxMQusPA5GsHsYYC5pMo7REM3RzcxTX5mitTUV7MQnsf+UvTRQbXOF71vuO93U1tFokWxvZsTn+/K/coS4IT9f+XwS28MWOfE7A== 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=clFo+zS4Gi7uNG8vKpMFSx1+9p6zrgWi5JJreHoyfL4=; b=bYJrwPpl8c/Bao92c4/3mr85q+1rdNVo/x0NKRWvgC1xfOfFoM+aE/F+b82jt6QTumAcoKeuvyLVATKzBRwlpt4oo31sCKfo9CxPI/xp9pE8lhPrVDVtcJ2ZYFWicF9STdtlmzXuZeP1DYjtJo+d2eXCUWcwUxJlQ0bUerQgCpBuoCeQqGYi9zNA2sIAr7BlDvaH+wP6jqEyHgW4tzv7l7EaT/LbXuxQgeKO0GUddVPdrwFhn+HcePBeYNaj8LD53A5phwNMHNwuy39LB644zIM4oYVJ9i6j7qswien+migeeHoQ97RRcm3bzbO6GlwLMzJlIppUoo5M9bQSI2tMUg== 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 MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by BY5PR10MB4289.namprd10.prod.outlook.com (2603:10b6:a03:20c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.19; Sun, 30 Oct 2022 07:45:04 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2%7]) with mapi id 15.20.5723.033; Sun, 30 Oct 2022 07:45:04 +0000 To: binutils@sourceware.org Subject: [PATCH,V3 01/15] sframe.h: Add SFrame format definition Date: Sun, 30 Oct 2022 00:44:36 -0700 Message-Id: <20221030074450.1956074-2-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221030074450.1956074-1-indu.bhagat@oracle.com> References: <20221030074450.1956074-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR03CA0100.namprd03.prod.outlook.com (2603:10b6:303:b7::15) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|BY5PR10MB4289:EE_ X-MS-Office365-Filtering-Correlation-Id: 41b0d9d6-181b-4a49-f66b-08daba4aa835 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HAa5tO2dtUVWp6yF+gmtu6fRiJCL+2jEd3EtWAt4keiISav6FX3SpU4XLFHmWvKQok7hhVBoA10+nIDmmb5HR/xY8bYcLbUz4oLnXgDo1iHtjz/D1RcxLHvr55+xgLlwVbaoeFheujOHHxV5RL6U+WOFCC7fwe1KMRilb0aRw+l9YDBgP/GE3o9AOzj/w6YsraTuV6ODPcDTqO9IQw9OVC9oYlZcgeUgk4ZnRMZEOSKSHc+wCCuAWKwYzvy6gIcNiLnObpmSl9L9+lxKxWj09JKmSSOszzn7o8C79L8YlmM+EyiiWEipyA5NSwReJ21bNnauRqi+Uoz7PXkIoO7Jw4LpRQoFBdSmw7eOgjeomapI685v9hlTSAd/lQ1s3Kaq2Bxw736g87lwHMsCEoyFqWoqIrGCNjhRjDBWoYJgeCB72XX3GT8LHu6p8rskRuzeuAwM32T18D4C61IeH3wOCc4/gFr5tlRBj2+8/rtpK0Jms+l+/Tz3O6mD0n3F8qOVmQiivfzXx8PfXBpMoDhzy9EG7QZGTyq6fb/x3OEdjYv74UIHInPdRJBYohxa1vt83vCXRnMaN+PXOSzQJo4H03ocI3/FfEi0e/NxfmrEgh0Lz7m7AfhYjV7X/8AGAgX//Btdmr8E/2BIm8nhDVTZHwONdjCY6z3MFcjkSkbj4HpobxGOrjzaanbBeEWSVo0sW6TeSxZMllhTjBf1RcKQho28Zz5F2kwTTxq6QAnD5s/vDtebZUDsJeBaveDT8PqUDNGfX9d5LIANdn5lZ4HqvyxfONBe6WDgQooohe9Zk24= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2158.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(366004)(39850400004)(376002)(346002)(136003)(451199015)(316002)(66556008)(4326008)(66476007)(36756003)(6916009)(66946007)(30864003)(6486002)(38100700002)(6666004)(8936002)(41300700001)(86362001)(107886003)(478600001)(5660300002)(1076003)(186003)(83380400001)(8676002)(2616005)(44832011)(2906002)(6512007)(6506007)(2004002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vwUnOd6AHVB7a9R/Zxia+gHn18DV/EVa/MyGtD2mConYF8mGzfCxJGi/FXKc2ois+I9Qvd5wmMjSmvhltL+5rScrKXEAiuxkvM9lsRogpcQk5N2gpU+sReNdf3+YPcllqtWBFVFR2ZGZAInExvjaoNAmN7VuO45IvffFD57lk9nwHWHGdehOzx9yfqY0rYQOHHKkZIBP14GeDOG6mECAe4QRlgw6myuI3a67C2ud9inZc/RPaCNBzZQf3f/CIf6aHo2cnAi9Dha2JotSQrWjxCQRHmI9cuOJo0GfYUceoNvb44UZNLG8MFJ85OnFd1CDgfQRVPTGGSw8WwXUVyn4B2NngVM4i2aLKYFO7RlVRtGZDzIhLtdkwTN1PTb0B8xbkyVZ3xVG1rEi9koLS38NOqM872jecHtSAHHVKUrbnycOmJNmmOIaspqYbd0s1aAjwM2Hd+RitP8wg20rlMZFWjeUksZjw5VHkNL0b3GP/xldV+rcnDuRvAD5pTVA+wKuVZyXogftbDKKtFH2dCnX05S52O3UNhoLviz3M1z80D2PoHzGYyA3FjCRTswRpUvfB4TPcuXQlo/Exe4w8ES4GqgZ5dG7YCAsOerF7Jze2S9pKjG1/vgqfauruh1TgucGRe3pS0ET+QgR+wVfE2aCVC44EBoXlgi0ZpLKSPWIPa1pwFkzyjbq35jzGFRVWzgLvH0SEc3eoWrB3q4AxT1847olYn8QT4+iNSgDm3QDq+u6nZpOjZBLwOeQRY7wrBV25qls8DSMmDDEeKKosk/q3IWNznZ02g57Sv/V1LwnhDQK45p0pberM+HbTlA1nzJe1o04FmyULbeCYLhyQaNMvypOG43iZ5/CGG0ypxAgGwWHZwwek3qcz/erv4nK+0itLTy4xvN1O4tcvYpQVcLoafiWxp/7IWjyzOP2PjZG/E6B4quQqtmyTJ0hfmm4OJTDM/M1+TQ5y+7ew+bN9xEhr8eAjXMQu1WARzfnvIu2ovrQqVjQx2Za0fNc6kzpuWMzw/Z2aS+l000DiVzAmKyfYGRVoM2eszCD2PB+VIiGs835AaEKH7NUVM7ZuJLTU+SIBXWGhXOjk4hWmHZ5LnX6Rir0nwaYZlSAsw1/sEmki/exWXBy79rjGCPvPCcqbIbgUTL4JgPMe4W4sRt9frWNfKx1kLHEAi+PR01AcKWnu5VhGFrg3ZZe0UZO2SzZ8akqcElhiCb/zZdXFerhoPU0Y+amATl4cZ5dzmVqYBqZVSFJEe2ni7Irp5ljLQ/s3+hX1PigTSNIOH6OtLD6pNRw3MnybxOpVF9AjpFI2lFnojFOpM4fh2yqPsM54Q/a37Jffbohu9M7Ame3jaq1SYHpixpFfh9JTMvV++wQiZJGF41OaEYlPlA7FEkj825L4o8zCe7LvR5xghoqYH2SxdsgLtYVhsPlvwQH0nVKzFmWJscun9VXbwg+gOeN0VQZYoIg3KYEsjcalf5DF0nqZHw9f8BUOI3kORVcsNEEMxmi52F5xrx7jAX9sdiHpYoUnRpUu540FsyqDx1NfMxWBf8yZhTadtMM8XlJxbH55KaVJC7m2yoTm3IVlfLNKNAsNdjBFLBM9OA93x/UuEOtUPFrhJH8lLAYEaJ0paftF+bRoJE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 41b0d9d6-181b-4a49-f66b-08daba4aa835 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2022 07:45:04.1144 (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: UkJEEHd/K4EhZ492PQTK+FY7Cq7fI45G25tMHrP2atv/RG1X5voZf9zbFG0wQWsM8FgkqQX2PtbJWzGFk+HTJw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4289 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-30_02,2022-10-27_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2210300049 X-Proofpoint-ORIG-GUID: FGjyglkX5ZuKd0IkCM0v18G9J1ennJB3 X-Proofpoint-GUID: FGjyglkX5ZuKd0IkCM0v18G9J1ennJB3 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, KAM_SHORT, 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Indu Bhagat via Binutils From: Indu Bhagat Reply-To: Indu Bhagat Cc: Indu Bhagat Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748097756454077455?= X-GMAIL-MSGID: =?utf-8?q?1748097756454077455?= [Changes in V3] - Update documentation regarding the order of offsets in the variable length bytes following the SFrame FRE. [End of changes in V3] [Changes in V2] - Added an unsigned 8-bit integral field to SFrame header for supporting auxilliary SFrame header. This helps make provisions to support any future ABI/arch by allowing each ABI/arch to add information specific to them in a flexible manner. - Changed the constants for SFRAME_FRE_TYPE_ADDR1/SFRAME_FRE_TYPE_ADDR2/SFRAME_FRE_TYPE_ADDR4 from 1/2/3 to 0/1/2. - Other minor code formatting fixups. [End of changes in V2] The header sframe.h defines the SFrame format. The SFrame format is the Simple Frame format. It can be used to represent the minimal necessary unwind information required for backtracing. The current version supports AMD64 and AARCH64. More details of the SFrame format are included in the documentation of the header file in this patch. include/ChangeLog: * sframe.h: New file. --- include/sframe.h | 303 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 303 insertions(+) create mode 100644 include/sframe.h diff --git a/include/sframe.h b/include/sframe.h new file mode 100644 index 00000000000..7e31284e4d8 --- /dev/null +++ b/include/sframe.h @@ -0,0 +1,303 @@ +/* SFrame format description. + Copyright (C) 2022 Free Software Foundation, Inc. + + This file is part of libsframe. + + libsframe is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation; either version 3, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not see + . */ + +#ifndef _SFRAME_H +#define _SFRAME_H + +#include +#include +#include + +#include "ansidecl.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* SFrame format. + + SFrame format is a simple format to represent the information needed + for vanilla virtual stack unwinding. SFrame format keeps track of the + minimal necessary information needed for stack unwinding: + - Canonical Frame Address (CFA) + - Frame Pointer (FP) + - Return Address (RA) + + The SFrame section itself has the following structure: + + +--------+------------+---------+ + | file | function | frame | + | header | descriptor | row | + | | entries | entries | + +--------+------------+---------+ + + The file header stores a magic number and version information, flags, and + the byte offset of each of the sections relative to the end of the header + itself. The file header also specifies the total number of Function + Descriptor Entries, Frame Row Entries and length of the FRE sub-section. + + Following the header is a list of Function Descriptor Entries (FDEs). + This list may be sorted if the flags in the file header indicate it to be + so. The sort order, if applicable, is the order of functions in the + .text.* sections in the resulting binary artifact. Each Function + Descriptor Entry specifies the start PC of a function, the size in bytes + of the function and an offset to its first Frame Row Entry (FRE). Each FDE + additionally also specifies the type of FRE it uses to encode the unwind + information. + + Next, the Frame Row Entry section is a list of variable size records, + each of which represent SFrame unwind information for a set of PCs. A + singular Frame Row Entry is a self-sufficient record with information on + how to virtually unwind the stack for the applicable set of PCs. + + */ + + +/* SFrame format versions. */ +#define SFRAME_VERSION_1 1 +/* SFrame magic number. */ +#define SFRAME_MAGIC 0xdee2 +/* Current version of SFrame format. */ +#define SFRAME_VERSION SFRAME_VERSION_1 + +/* Various flags for SFrame. */ + +/* Function Descriptor Entries are sorted on PC. */ +#define SFRAME_F_FDE_SORTED 0x1 +/* Frame-pointer based unwinding. */ +#define SFRAME_F_FRAME_POINTER 0x2 + +#define SFRAME_CFA_FIXED_FP_INVALID 0 +#define SFRAME_CFA_FIXED_RA_INVALID 0 + +/* Supported ABIs/Arch. */ +#define SFRAME_ABI_AARCH64_ENDIAN_BIG 1 /* AARCH64 big endian. */ +#define SFRAME_ABI_AARCH64_ENDIAN_LITTLE 2 /* AARCH64 little endian. */ +#define SFRAME_ABI_AMD64_ENDIAN_LITTLE 3 /* AMD64 little endian. */ + +/* SFrame FRE types. */ +#define SFRAME_FRE_TYPE_ADDR1 0 +#define SFRAME_FRE_TYPE_ADDR2 1 +#define SFRAME_FRE_TYPE_ADDR4 2 + +/* SFrame Function Descriptor Entry types. + + The SFrame format has two possible representations for functions. The + choice of which type to use is made according to the instruction patterns + in the relevant program stub. + + An SFrame FDE of type SFRAME_FDE_TYPE_PCINC is an indication + that the PCs in the FREs should be treated as increments in bytes. This is + used for a bulk of the executable code of a program, which contains + instructions with no specific pattern. + + An SFrame FDE of type SFRAME_FDE_TYPE_PCMASK is an indication + that the PCs in the FREs should be treated as masks. This type is useful + for the cases when a small pattern of instructions in a program stub is + repeatedly to cover a specific functionality. Typical usescases are pltN + entries, trampolines etc. */ + +/* Unwinders perform a (PC >= FRE_START_ADDR) to look up a matching FRE. */ +#define SFRAME_FDE_TYPE_PCINC 0 +/* Unwinders perform a (PC & FRE_START_ADDR_AS_MASK >= FRE_START_ADDR_AS_MASK) + to look up a matching FRE. */ +#define SFRAME_FDE_TYPE_PCMASK 1 + +typedef struct sframe_preamble +{ + uint16_t sfp_magic; /* Magic number (SFRAME_MAGIC). */ + uint8_t sfp_version; /* Data format version number (SFRAME_VERSION). */ + uint8_t sfp_flags; /* Flags. */ +} ATTRIBUTE_PACKED sframe_preamble; + +typedef struct sframe_header +{ + sframe_preamble sfh_preamble; + /* Information about the arch (endianness) and ABI. */ + uint8_t sfh_abi_arch; + /* Offset for the Frame Pointer (FP) from CFA may be fixed for some + ABIs (e.g, in AMD64 when -fno-omit-frame-pointer is used). When fixed, + this field specifies the fixed stack frame offset and the individual + FREs do not need to track it. When not fixed, it is set to + SFRAME_CFA_FIXED_FP_INVALID, and the individual FREs may provide + the applicable stack frame offset, if any. */ + int8_t sfh_cfa_fixed_fp_offset; + /* Offset for the Return Address from CFA is fixed for some ABIs + (e.g., AMD64 has it as CFA-8). When fixed, the header specifies the + fixed stack frame offset and the individual FREs do not track it. When + not fixed, it is set to SFRAME_CFA_FIXED_RA_INVALID, and individual + FREs provide the applicable stack frame offset, if any. */ + int8_t sfh_cfa_fixed_ra_offset; + /* Number of bytes making up the auxilliary header, if any. + Some ABI/arch, in the future, may use this space for extending the + information in SFrame header. Auxilliary header is contained in + bytes sequentially following the sframe_header. */ + uint8_t sfh_auxhdr_len; + /* Number of SFrame FDEs in this SFrame section. */ + uint32_t sfh_num_fdes; + /* Number of SFrame Frame Row Entries. */ + uint32_t sfh_num_fres; + /* Number of bytes in the SFrame Frame Row Entry section. */ + uint32_t sfh_fre_len; + /* Offset of SFrame Function Descriptor Entry section. */ + uint32_t sfh_fdeoff; + /* Offset of SFrame Frame Row Entry section. */ + uint32_t sfh_freoff; +} ATTRIBUTE_PACKED sframe_header; + +#define SFRAME_V1_HDR_SIZE(sframe_hdr) \ + ((sizeof (sframe_header) + (sframe_hdr).sfh_auxhdr_len)) + +typedef struct sframe_func_desc_entry +{ + /* Function start address. Encoded as a signed offset, relative to the + beginning of the current FDE. */ + int32_t sfde_func_start_address; + /* Size of the function in bytes. */ + uint32_t sfde_func_size; + /* Offset of the first SFrame Frame Row Entry of the function, relative to the + beginning of the SFrame Frame Row Entry sub-section. */ + uint32_t sfde_func_start_fre_off; + /* Number of frame row entries for the function. */ + uint32_t sfde_func_num_fres; + /* Additional information for deciphering the unwind information for the + function. + - 4-bits: Identify the FRE type used for the function. + - 1-bit: Identify the FDE type of the function - mask or inc. + - 3-bits: Unused. + -------------------------------------------- + | Unused | FDE type | FRE type | + -------------------------------------------- + 8 5 4 0 */ + uint8_t sfde_func_info; +} ATTRIBUTE_PACKED sframe_func_desc_entry; + +/* Macros to compose and decompose function info in FDE. */ + +#define SFRAME_V1_FUNC_INFO(fde_type, fre_enc_type) \ + (((fde_type) & 0x1) << 4 | (fre_enc_type)) + +#define SFRAME_V1_FUNC_FRE_TYPE(data) ((data) & 0xf) +#define SFRAME_V1_FUNC_FDE_TYPE(data) ((data >> 4) & 0x1) + +/* Size of stack frame offsets in an SFrame Frame Row Entry. A single + SFrame FRE has all offsets of the same size. Offset size may vary + across frame row entries. */ +#define SFRAME_FRE_OFFSET_1B 0 +#define SFRAME_FRE_OFFSET_2B 1 +#define SFRAME_FRE_OFFSET_4B 2 + +/* An SFrame Frame Row Entry can be SP or FP based. */ +#define SFRAME_BASE_REG_FP 0 +#define SFRAME_BASE_REG_SP 1 + +/* The index at which a specific offset is presented in the variable length + bytes of an FRE. */ +#define SFRAME_FRE_CFA_OFFSET_IDX 0 +/* The RA stack offset, if present, will always be at index 1 in the variable + length bytes of the FRE. */ +#define SFRAME_FRE_RA_OFFSET_IDX 1 +/* The FP stack offset may appear at offset 1 or 2, depending on the ABI as RA + may or may not be tracked. */ +#define SFRAME_FRE_FP_OFFSET_IDX 2 + +typedef struct sframe_fre_info +{ + /* Information about + - 1 bit: base reg for CFA + - 4 bits: Number of offsets (N). A value of upto 3 is allowed to track + all three of CFA, FP and RA (fixed implicit order). + - 2 bits: information about size of the offsets (S) in bytes. + Valid values are SFRAME_FRE_OFFSET_1B, SFRAME_FRE_OFFSET_2B, + SFRAME_FRE_OFFSET_4B + - 1 bit: Unused. + ----------------------------------------------------------------------- + | Unused | Size of offsets | Number of offsets | base_reg | + ----------------------------------------------------------------------- + 8 7 5 1 0 + + */ + uint8_t fre_info; +} sframe_fre_info; + +/* Macros to compose and decompose FRE info. */ + +#define SFRAME_V1_FRE_INFO(base_reg_id, offset_num, offset_size) \ + ((offset_size << 5) | (offset_num << 1) | (base_reg_id)) + +#define SFRAME_V1_FRE_CFA_BASE_REG_ID(data) ((data) & 0x1) +#define SFRAME_V1_FRE_OFFSET_COUNT(data) (((data) >> 1) & 0xf) +#define SFRAME_V1_FRE_OFFSET_SIZE(data) (((data) >> 5) & 0x3) + +/* SFrame Frame Row Entry definitions. + + Used for both AMD64 and AARCH64. + + An SFrame Frame Row Entry is a self-sufficient record containing SFrame + unwind info for a range of addresses, starting at the specified offset in + the function. Each SFrame Frame Row Entry is followed by S*N bytes, where: + S is the size of the stack frame offset for the FRE, and + N is the number of stack frame offsets in the FRE + + The offsets are interpreted in order as follows: + + offset1 (interpreted as CFA = BASE_REG + offset1) + + if RA is being tracked + offset2 (interpreted as RA = CFA + offset2) + if FP is being tracked + offset3 (intrepreted as FP = CFA + offset2) + fi + else + if FP is being tracked + offset2 (intrepreted as FP = CFA + offset2) + fi + fi +*/ + +typedef struct sframe_frame_row_entry_addr1 +{ + /* Start address of the frame row entry. Encoded as an 1-byte unsigned + offset, relative to the start address of the function. */ + uint8_t sfre_start_address; + sframe_fre_info sfre_info; +} ATTRIBUTE_PACKED sframe_frame_row_entry_addr1; + +typedef struct sframe_frame_row_entry_addr2 +{ + /* Start address of the frame row entry. Encoded as an 2-byte unsigned + offset, relative to the start address of the function. */ + uint16_t sfre_start_address; + sframe_fre_info sfre_info; +} ATTRIBUTE_PACKED sframe_frame_row_entry_addr2; + +typedef struct sframe_frame_row_entry_addr4 +{ + /* Start address of the frame row entry. Encoded as a 4-byte unsigned + offset, relative to the start address of the function. */ + uint32_t sfre_start_address; + sframe_fre_info sfre_info; +} ATTRIBUTE_PACKED sframe_frame_row_entry_addr4; + +#ifdef __cplusplus +} +#endif + +#endif /* _SFRAME_H */ From patchwork Sun Oct 30 07:44:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 12952 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1685887wru; Sun, 30 Oct 2022 00:47:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6pz/CP+dDEU2vLONIcv6G7fMyNYaMl8PRkgfXuDAVCbaSQqpGo1rIzMO4bxoNKKjRsPna1 X-Received: by 2002:a05:6402:5ca:b0:43b:6e01:482c with SMTP id n10-20020a05640205ca00b0043b6e01482cmr7841257edx.189.1667116047397; Sun, 30 Oct 2022 00:47:27 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id ne13-20020a1709077b8d00b0078d45e9d485si4349743ejc.709.2022.10.30.00.47.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 00:47:27 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=OOH2lupG; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2733C3857B8B for ; Sun, 30 Oct 2022 07:46:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2733C3857B8B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667115998; bh=tfDt+CPpRW+Je9AkshLdEixSllOrbXWiLyWzWz/Z97Q=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=OOH2lupG0UWatALp3G532qRLSptOhwqRIg1E34u6pkl4ysDq9vsW1h57V1YDW7L+z O/3sBsp/9aidizlBEAdA34bBzjHm0TTwZcCYXiEb9sb9Vn/wZQkZhsvTG7WI2WWR2Q 4WY4Q+ECjIvnCnOLnLgMlyO8uy4QS2gqJiGORaig= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 72C2F3858027 for ; Sun, 30 Oct 2022 07:45:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 72C2F3858027 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29U3bJ8J023053 for ; Sun, 30 Oct 2022 07:45:15 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 3kgtkd1da6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:45:14 +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 29U6j2Xc035963 for ; Sun, 30 Oct 2022 07:45:14 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2174.outbound.protection.outlook.com [104.47.59.174]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kgtm8hgbv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:45:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JoTYG1SI1tjGjzCYNpruDWJQ1t4uKaeInPYxYFT9mS9DaZOV3iyMSwKJLx8JWkZ6PCzNe75bt8mevJvvAV+s/gnTIM0GiHyfw2W0wuFsoOkEhjLyJ5cwr0gV9m8b9wz0UgC4kI7d60pgw1s8Bt1hCPcSUJC+HQpf3feTdIPecxNMBUbGT+6Mmg1nThiJ+FVE/Yk20rtyxvWRTf0WZrJRV27qQiGKSZXIbwY92RBOEU7iGwEChbajH1dPU7J1+EN9HijruZMEfBwEQMnhJzo9fYBe0BxF9Go33HYq1v81sb4tusmpHibzIUPaxJRAPTzAIbKKaHKn9dlk7kE+AY3W0A== 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=tfDt+CPpRW+Je9AkshLdEixSllOrbXWiLyWzWz/Z97Q=; b=aXL5fy1phnUBACbeammO8+wFgO0kELCH3x/80B7OIhrEYER/coa8pYCh1SIW9iCfT5pzbzUvAOGcn+depL8xoju4IvESnxhWYP8sMRG0EHAK8/C225O1KtPtD/JTbeAB9XfrP5TBedP582LwzlJFeywEsf4skFv0KAnFjKp/uWWckgt2V9cLIJFV2YVSoTLhTTcl2gwHljmyDGypbqVCXpSqb1aYEdugcK6wPY//bRa14+CRw0Mqtv9e6JkuJvCYiNWrN8Q1q9G48OIfvjornqaxPxXGJm92UI0ZrRJYuUWHkk+ZGIRr14fInPKczCQuQnsUxHfQRo9fFGhhl5ByzA== 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 MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by BY5PR10MB4289.namprd10.prod.outlook.com (2603:10b6:a03:20c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.19; Sun, 30 Oct 2022 07:45:07 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2%7]) with mapi id 15.20.5723.033; Sun, 30 Oct 2022 07:45:07 +0000 To: binutils@sourceware.org Subject: [PATCH,V3 02/15] gas: add new command line option --gsframe Date: Sun, 30 Oct 2022 00:44:37 -0700 Message-Id: <20221030074450.1956074-3-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221030074450.1956074-1-indu.bhagat@oracle.com> References: <20221030074450.1956074-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR04CA0095.namprd04.prod.outlook.com (2603:10b6:303:83::10) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|BY5PR10MB4289:EE_ X-MS-Office365-Filtering-Correlation-Id: b3410654-f9a8-428b-9223-08daba4aaa2a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7/4UKAp7INhJlhxfMeCsKYe7W0nQKpg4YjXc211OhI3FXSoES1PKpF1Bqs8qYpEHXNgqvg5gsUs+uHN7NBNm9j/HrNxCrLQYjqJlyOfUP9L8Fj/f11yREMf/A5AaozWZ+J17+IHZuTSGwLLaJfAb8YA/2xergyVhqyDmuCMxb5Njyk1xDcP+u8ZxOw43QW+s/4un0oF8ullf3Jm/dxz2LU2vIR+jrtQ+xeB0qVyP+OKfTlKl5LGrYjgFY49oXyaiyYvhMAE2dLB/QLkfPjE+DYavaWUykQBIM/auE5SM8XcNnirVG+ya35bCBugwDZF+Cm37OcP4o/GEnQhzb1R8MAlzJ8FetHswZOLyS1hLIIjwLebsQJbdku0kKQisLU0hi6cXdXLCFw/Hvbee23WCRI6h6DhKbtH1jqcngZfUyj2I0NweJJaJGRDUuZpOQIJQoBgDsIXfYV+wecirnsn6Hb1Bk7e47cLQHqd4D7MiKsIOtR3BArtn3KeVu1iWyfewL9V+8ZHGC0yn/KBcGtnar3dHxuFanNQJ+xxJl81cEhixjFMlksiH2E7SoiSFE+I4RAvKImRCFBya5xd9P7el92UbqU+u8f/z5aacOqTNPaE4LteCg71cPqI7eT981Pghag8p6MHTAmjAi3fNhT9iPKE4rXgRb+YlHCDgAgzu0QkqGGGs2Ir8ftLggjlFuZuaq1pU8pIxya45d2BSrgLjAw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2158.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(366004)(39850400004)(376002)(346002)(136003)(451199015)(316002)(66556008)(4326008)(66476007)(36756003)(6916009)(66946007)(6486002)(38100700002)(6666004)(8936002)(41300700001)(86362001)(107886003)(478600001)(5660300002)(1076003)(186003)(83380400001)(8676002)(2616005)(44832011)(2906002)(6512007)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Eblyggj0TwMjk0f9JOCLtcElquSbWXJyjccSL1Sja+veXRqec+2LUhulVJ5ran09LUScXqKphSH28YguBjoF04NJHcMJrnAhcweN3W455pcXpriWz7UFcCRanL2vCMQ5EGDcrkOXR1Kl9K/vteCeZGVLOaRyxNGCrAokePsYOodFjF/bvWCO7MT6V41yYNQwJqYGEERsQQVOZlVlXlLKyZi76KAHLTzZJSqlviG0qHroZw0g1unLgIJe7X8vpI8bS6o/fTgMI9Scy5gIab60l/ff/Qaus3p4zK6QY+KPi9O5icvaBAAxiK7bD0WMMTlp/U4X5LiVs/EjYkUoLfq+/oEn/wZ5GdHEIt4AF/zzPuPMf/Nq42EG6UMsJVcDabHqEPbhQkX+2qKGP7IZZRqJnGmJQQ3V74MM3ttersr5KKijXS3Zxk0v7JRjsoHlZxxJYhZN8dH++6wOooudgWZ5GSx25zVoN0KzzIvcvPWqt25llPIIza6VRrgYQDFf2pwch4Oo++13alYOKIk0fdU/YqugYczKvIR7yoOO00bPcKRNolQ9+Oiv2VyT89UIEVyDFK1x5Zw1K8Mdb+r3KObRFP6XMwpFeG/8elsQjSw482nMSQsSerJPkD2RvU4YTqWAOOf4pfUsfD0eFJrRLUPmAaxu1qKyCjGk2ISb6PbjJeqVpD+I0lei9xZFo48krEpcIvq5tM8/fEWMKQ3/0zobY9Oln3SIq9S9OhdnFndySMS13dgp1n/JBPp6zAmRpFSN3pvm07Xc7jLGuSPLpZ8VpTkrxFhqSyZQ/nPYufzKWMifaFL67wzV58IE9/ym+jGMg/G7n789CStzq1FRgQ5r9MyyqJF2Qi/SciHLV67t282U5p2PmBD2GbWkV0A4EDURnnFT/5PsDFF4e9BWnmDYhb8dotdKBW7n5TJgJXnwzCiv1bv0acrqLO0zRnBXCmoaR5stcPFXd71hMBIj7kkVbB/YlF95RuXpRUS9zZhIyfIHvri60BZqrRyiEwvYepk3ti+oieNxTp2gF6SwlQ5Zb64DeYRnjRFTck+sudqlm4qMEaBQKHKBvejBajXmShfxH2yCSFDAj5iYBw4RpjrfcF2CiGJKMLiStKXOix8Q2VMtzKbjAYFWQ5HM7zC3vbyHRZtcPSDbFTJwZ6wP9P5EfY+LqUQffu2ep7zh4xgK6ub/Fj6xGXx9DhjXuYcM7EMIrFA89JIeCCdEo5BsqFqXEXpGQ7/APvPdDlyFvjESxQ+aSKw7rUacQ86bFs07VNqFZrhk0NWN2tNPS+uCnzt0S8psVVbRLHuD0rnQ18oWZjLU3UrB0xCvrLa1NQBBhd1Ic8B9mEgcJxRaLyM/x6BzWZdP+KabcsfGl53oOt72OChjzIkYq8iiJTLFZI1SQT8HAD0Aj2z6XLChfnlJSGYuKMwioHU/vkbZkMBj/mBSOx8ETowWPAMPSrbXkU79LOpW1ORK3kH0OwdTs1ACCRjRobyUXqCLZ98juv9qs+heveHgn85+2iPLtP+0uKiUs481ecep+MEDbFVW6nQen6dTCjtm61Pf1tirO9jt9NG6RWsyGqTEZWG+YwYfhBrtO/R1cvRbPDnGVepMNYbzpG1SR4WHjqBtlKQeEuLSOKMHPwo= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b3410654-f9a8-428b-9223-08daba4aaa2a X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2022 07:45:07.3015 (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: JSxnkCqL/ETYrFAiPcjQ25Z3K4l0jYrjyEiLTHxvuaAXfaLrinCnvfnZCkNBw2+sTy0xzH2fDgKvoLMgX3RTiQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4289 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-30_02,2022-10-27_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 suspectscore=0 phishscore=0 malwarescore=0 spamscore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2210300049 X-Proofpoint-ORIG-GUID: KeOIakbA2FpMkWisnrPB_bBNEYxEUiBj X-Proofpoint-GUID: KeOIakbA2FpMkWisnrPB_bBNEYxEUiBj X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Indu Bhagat via Binutils From: Indu Bhagat Reply-To: Indu Bhagat Cc: Indu Bhagat Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748097876563740297?= X-GMAIL-MSGID: =?utf-8?q?1748097876563740297?= [No changes in V3, V2] When --gsframe is specified, the assembler will generate a .sframe section from the CFI directives in the assembly. ChangeLog: * gas/as.c (parse_args): Parse args and set flag_gen_sframe. * gas/as.h: Introduce skeleton for --gsframe. * gas/doc/as.texi: document --gsframe. --- gas/as.c | 10 +++++++++- gas/as.h | 3 +++ gas/doc/as.texi | 6 ++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gas/as.c b/gas/as.c index d42dd5394b5..80a2cb9a418 100644 --- a/gas/as.c +++ b/gas/as.c @@ -315,6 +315,8 @@ Options:\n\ #endif fprintf (stream, _("\ generate GNU Build notes if none are present in the input\n")); + fprintf (stream, _("\ + --gsframe generate SFrame unwind info\n")); #endif /* OBJ_ELF */ fprintf (stream, _("\ @@ -499,7 +501,8 @@ parse_args (int * pargc, char *** pargv) OPTION_COMPRESS_DEBUG, OPTION_NOCOMPRESS_DEBUG, OPTION_NO_PAD_SECTIONS, - OPTION_MULTIBYTE_HANDLING /* = STD_BASE + 40 */ + OPTION_MULTIBYTE_HANDLING, /* = STD_BASE + 40 */ + OPTION_SFRAME /* When you add options here, check that they do not collide with OPTION_MD_BASE. See as.h. */ }; @@ -530,6 +533,7 @@ parse_args (int * pargc, char *** pargv) ,{"elf-stt-common", required_argument, NULL, OPTION_ELF_STT_COMMON} ,{"sectname-subst", no_argument, NULL, OPTION_SECTNAME_SUBST} ,{"generate-missing-build-notes", required_argument, NULL, OPTION_ELF_BUILD_NOTES} + ,{"gsframe", no_argument, NULL, OPTION_SFRAME} #endif ,{"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL} ,{"gdwarf-2", no_argument, NULL, OPTION_GDWARF_2} @@ -993,6 +997,10 @@ This program has absolutely no warranty.\n")); optarg); break; + case OPTION_SFRAME: + flag_gen_sframe = 1; + break; + #endif /* OBJ_ELF */ case 'Z': diff --git a/gas/as.h b/gas/as.h index 730e134dce6..1b924071938 100644 --- a/gas/as.h +++ b/gas/as.h @@ -337,6 +337,9 @@ COMMON int flag_execstack; /* TRUE if .note.GNU-stack section with SEC_CODE should be created */ COMMON int flag_noexecstack; +/* TRUE if .sframe section should be created. */ +COMMON int flag_gen_sframe; + /* name of emitted object file */ COMMON const char *out_file_name; diff --git a/gas/doc/as.texi b/gas/doc/as.texi index a0384cf1f77..83f49c518d7 100644 --- a/gas/doc/as.texi +++ b/gas/doc/as.texi @@ -240,6 +240,7 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}. [@b{--gdwarf-}] [@b{--gdwarf-sections}] [@b{--gdwarf-cie-version}=@var{VERSION}] [@b{--generate-missing-build-notes=[no|yes]}] + [@b{--gsframe}] [@b{--hash-size}=@var{N}] [@b{--help}] [@b{--target-help}] [@b{-I} @var{dir}] @@ -847,6 +848,11 @@ These options control whether the ELF assembler should generate GNU Build attribute notes if none are present in the input sources. The default can be controlled by the @option{--enable-generate-build-notes} configure option. + +@item --gsframe +@itemx --gsframe +Create @var{.sframe} section from CFI directives. + @end ifset @item --hash-size @var{N} From patchwork Sun Oct 30 07:44:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 12951 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1685462wru; Sun, 30 Oct 2022 00:46:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6k+RqmnGnzmF7jLuafE6UYYEs03m/plEj5bFa66CBxXD4TSa2vEUqZy61aG24OApgq7xS8 X-Received: by 2002:a17:907:80d:b0:73d:1e3f:3d83 with SMTP id wv13-20020a170907080d00b0073d1e3f3d83mr6818930ejb.372.1667115968151; Sun, 30 Oct 2022 00:46:08 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id n5-20020a17090625c500b0078da856a4ecsi3134355ejb.391.2022.10.30.00.46.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 00:46:08 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="Lgsx/kle"; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 55C74385117F for ; Sun, 30 Oct 2022 07:45:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 55C74385117F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667115947; bh=OKE0+zyQRxc8L7s+irfj0raSmgLxJDtYLUQY7MH2DyA=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Lgsx/kleOOAlZIIRgh4dLOnIC7RsnqvbZ1e6xVoKWTbSC2T7usQQkLr+axzwwiRrr wToXJqmrTizlYSCDSpzYwEBdU2NzvVBpIiypVED8ouHgmgoUnW/jBsTYupWnQLyrYF gX6SP84bla34KnZRPMTiYTGejTh+whZfeJIixNhc= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id EB8BB38582B4 for ; Sun, 30 Oct 2022 07:45:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EB8BB38582B4 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 29TKLkQ4024048 for ; Sun, 30 Oct 2022 07:45:20 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 3kgv2a99tk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:45:19 +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 29U6qwqe036121 for ; Sun, 30 Oct 2022 07:45:17 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2169.outbound.protection.outlook.com [104.47.59.169]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kgtm8hgfv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:45:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AiGN9lEe2L+Q82pKGy5d/Lmu2ErAfFXm6/PFhRTWhuptWBeZ6FXXpTPegWpo1SlRPxlMDoRMf0WxRZR7lGAOuhg9kKo0lH2HF0dWi5POj9nnh6vR1AAKRWCya6gnGc23mPy0ZnJo9aNghWU4B1qu1AVxv3Ky3KSRhkh1yJaUUrMUUlyueQakJhwblaj6P6hOwXLiuBamP0iQI1ZLrjpXPS0kZb2Dp4/A37uysE3QyBUaPFVe+GZWmTXDWSHgfH1umwghKGtkCJYlnww9WJmPeup3d4p2Zl6FMrxqgXK99VK3GvZSYKCLy+o4cActZk2/X3LXxDyyoQRFVfytXPCKIA== 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=OKE0+zyQRxc8L7s+irfj0raSmgLxJDtYLUQY7MH2DyA=; b=msWhHKX3j0pZ2RrY1SGnzR2detx49tec0vGblHiEjMgadCuERc764pepzWHRXMrvbfToDYXoXkFy6074os9z3c4qwRR4lZ+SN/u6Ub0SAMtEzMbRZRRl7hq9GCPMG8hjcPw611rZ99oauXNox1e9H/BWWxtglpGc6txikPn2htVvRE0xgvfJxaM5KXH4yoP4PBCB7hFPCNs35vegox0ER/T47fIsbCBkmc/y2DKKY7yCFdRZDmcVXT9z4rSfGwV+gXGsRpVNVLIdPuBaQniSXsgbp8M58V4m3LsyQvCxTFhMZbTN5N83cmGSTqTxvyV98eIftbaMFQyCPO+DBXOPJw== 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 MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by BY5PR10MB4289.namprd10.prod.outlook.com (2603:10b6:a03:20c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.19; Sun, 30 Oct 2022 07:45:13 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2%7]) with mapi id 15.20.5723.033; Sun, 30 Oct 2022 07:45:13 +0000 To: binutils@sourceware.org Subject: [PATCH,V3 03/15] gas: generate .sframe from CFI directives Date: Sun, 30 Oct 2022 00:44:38 -0700 Message-Id: <20221030074450.1956074-4-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221030074450.1956074-1-indu.bhagat@oracle.com> References: <20221030074450.1956074-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR04CA0327.namprd04.prod.outlook.com (2603:10b6:303:82::32) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|BY5PR10MB4289:EE_ X-MS-Office365-Filtering-Correlation-Id: 40835518-7d2a-4e01-48ce-08daba4aadad X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z5Og7gM6xabsL1+zD/uP2tnijMuKaZFuumgjD7cqKTD0KaU+AaUzBz5lz2mp1b7kogUI3lvrJlnB93b9vBw2xApvaPQubRkng8lRzGPUvU8br8aOXVq3TohIUOoStkVC/CizjN8vKnIc31Q5ugTEcqpyj5R5oyuWTxshaNHaYavstaQ+WFMIP2sWIbRQ2WyQzYNxjA6/Xjq3abDzYEQ0hiwl3SrzMCtLyy3aWjOZsfdCFBTybFi0X1S5NKeyrCET9mL305vxjdTjs942fyvTFat2ICNyxJ+yhFyjS4oMMVxfxNYTnEH6EOOBXG/AWhBHXmyWodQRk/dX41UkyoOgEfUEoZHop+BlVPx+ppgZJPi1SFqbIZwcgOAWJDGYUIuLCste86v/PxqG1lePuzpZnt8PCD+un4HgwjQZe6Xc9OTt+D+jG9TRxEfwDwosqFk1z86uT8hoGPGEF//RvhZfkODU8QGhKaew86RPv0dYQIjqquvXeiN468lp/GwHExTXkeplYPB6GQ4+gfpy2l5mVn/b+HoS/SNdlQZ2wYp6pMs9t7r0sv5vsMM5IpAnRwHJbWR33tlJR8FLjYsw30f1Qsnu0PWzeAg+zu31qv1PuGbotgQVWd+DoEDxR4xNqxgFXB1TUPy73yfzx+Ox9rKssznBkb3XtqMPRnlD1MtgqdNZksPtMRSCAw8IgJXfdafakAJXSMXmrOiXag68bJxaBvKvOIxm4KpDeUIZtk/W4g/FGPUq2VKd9ga6IUKJfaaBMdGefMeWPO4t0wQk4dgm6A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2158.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(366004)(39850400004)(376002)(346002)(136003)(451199015)(316002)(66556008)(4326008)(66476007)(45080400002)(36756003)(6916009)(66946007)(66899015)(30864003)(6486002)(38100700002)(6666004)(8936002)(41300700001)(86362001)(107886003)(478600001)(5660300002)(1076003)(186003)(83380400001)(8676002)(2616005)(44832011)(2906002)(6512007)(6506007)(142923001)(2004002)(579004)(559001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pQWHeTw/frAjHjjnvp+dNTsDMZZ5b3kiSwVC4YPepfpFGDBfVEZEhHbwCpcLWdCQ9z5JSEC5sZvbkdf1ZM+OFWwSrhQxm7dcDPdu1RRPf1PqlHy2WF4XiFD9oqwLIZUkZMOpzAGvmhWSyOJr/vBQk415Rho4LHLyFNYLD6GGld0NxARrneDFfscMEubSdFZrZD7OH6f0sl5DT3XHBFOQYkeNmtv1KqdfDkoXx9uegZwsUWQ7h/6/8E6f6nnldDZGj8rcUiVJlLuQ7ttgY5y5VlQRoyjExHlSn317DO3o7XmzWrUCSVezk3I3rQ7n45avHhVpk6Y8WSIKSIA/2ixi55arxP7DWWtsOYC0UT4S1rxhC9oyOj5LJvIHJs1DA8mmn9zEABwlLk2ZBUvAdnCgcHH3aG3CPcnLPFM5jUPnfB7rSmKWRwESj+lXYkKjwaIlfOl4bPJFTiIfvOkUe5GjHYv1PNpA7aPtgF4uM0gsncDd+nDQVcwdlp5BWOU9gpMIj/A0nFOZ5OKAZV9H6s4h8kRNp3jfFedwLfu2MlzJnS0XMDr6l0Ww4xMzjFhmAqv6tRRjL/2QolAZJOngE53g7qAJoD5QO65L0H4ka+N+Go4E5oRVb3OPuOTJKXOIpwq79+hCGvVGC/87hZwy90DBJAET9R+MNOYPzTZo3NU3JeChKMxeyuX+ujEVJRIjP/jIooAxN3zUI1SHjWj5RIYATAMYS2ib94IFWM+I35QfpmZFr+C5ZqehG9P4QxQnmE/LPWgDI4QP6xmcsEJI227JUe/Oc5up28iOyGZMfydGV0XSqkBhRLd+ugL01r680k7xi5SHOEaZ3UlOSynMqgnbSWQWJLbuFdwKyfzc4oOWfb745L0FaTL+YGyiuzd0eKe8kpS4RzKytll9Wjk3gHNFYrvZwW1k6jyVJ0BOBE/rOaoEWUOTQzUDJ1ONL8cx0nAn/aH4n8scquY4AELtMUOgdcJfFfDg9cKGaVPbGMqh6Effj+nUl1TC3zXJzw7LeaHxWvZxEDwCGVLYnpdIT+hwPFg0YJyHTxkp0uyRF5s5BzP6uUqnBNEbUy15PQNFxt/MX1gVNvpRaeJz2mAl0VkORD+nBaHXtMsJT97d5RhZp0d0xtTFy076jm0KQDtSST2TfMkwutik1T/crxZqCTWRfa7UTTUWZq++e4pDCOd6hmpLNjrkGefKjWK0oWuypEx/zzrvd4wmV0FByMxEV85yKKMt1nlavpI5EkHlYO0m1bMsrfTNjJpzBc3KLpMdUbYOpCII0yEouUwXj/z5iz5iRulKENfc95/POuIIHP8WwnmIUVQHOwxHfhJm6II4BTijiyfWIMEz2wKwx7OoK1E60lxkx2ndaqHfy7Qwo91sgZpZNpzprXuGT4b+FWe7YdOB+aeMuHLaIamfkQ6ZvYM+YuWqbdu5DpqtlnAwelZ/FjvgjPWQCbI9pR23W/cNOcmXT4G4jcFjH7Rw9SPAjhT5eksm9xuFI6oXqar9ETxM2a4+5jNVG5Hh4AwFXnZ1ru/kHPth2Vav0HaKFgbFy4AbroN5fUYHs+f2NoHvELK0PH3uCnPBlSHX2tLoeCy5zUWYALU34IF777N2AJOahXgXauYzyNO98gNwq7ZBQsrfyD4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 40835518-7d2a-4e01-48ce-08daba4aadad X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2022 07:45:13.2850 (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: v34q0OzBLiCpUZdw8cNuQ4QghnGvXnGHQNlC615NHecWGeJqoEjAhoeWhl+dVZrSQ84ZmZNbMJbAG9VLG9hyMA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4289 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-30_02,2022-10-27_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 suspectscore=0 phishscore=0 malwarescore=0 spamscore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2210300049 X-Proofpoint-ORIG-GUID: 1SBaqT1t9Cx-9t_rrqpOyQu4AJoyQxtZ X-Proofpoint-GUID: 1SBaqT1t9Cx-9t_rrqpOyQu4AJoyQxtZ X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Indu Bhagat via Binutils From: Indu Bhagat Reply-To: Indu Bhagat Cc: Indu Bhagat Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748097793684278067?= X-GMAIL-MSGID: =?utf-8?q?1748097793684278067?= [Changes in V3] - Use constant SFRAME_CFA_FIXED_RA_INVALID instead of magic number 0 in aarch64 backend. - bugfix: SFrame header on AMD64 has incorrect fixed RA offset. - Fix the creation of FRE offsets in the expected order. [End of changes in V3] [Changes in V2] - Fixed compilation issues on i686. - Added support for auxilliary SFrame header length field. - The assembler errors out if the target does not support SFrame format and --gsframe is used in the command line options. [End of changes in V2] Currently supported for x86_64 and aarch64 only. [PS: Currently, the compiler has not been adapted to generate ".cfi_sections" with ".sframe" in it. The newly added command line option of --gsframe provides an easy way to try out .sframe support in the toolchain.] gas interprets the CFI directives to generate DWARF-based .eh_frame info. These internal DWARF structures are now consumed by gen-sframe.[ch] sub-system to, in turn, create the SFrame unwind information. These internal DWARF structures are read-only for the purpose of SFrame unwind info generation. SFrame unwind info generation does not impact .eh_frame unwind info generation. Both .eh_frame and .sframe can co-exist in an ELF file, if so desired by the user. Recall that SFrame unwind information only contains the minimal necessary information to generate backtraces and does not provide information to recover all callee-saved registers. The reason being that callee-saved registers other than FP are not needed for stack unwinding, and hence are not included in the .sframe section. Consequently, gen-sframe.[ch] only needs to interpret a subset of DWARF opcodes in gas. More details follow. [Set 1, Interpreted] The following opcodes are interpreted: - DW_CFA_advance_loc - DW_CFA_def_cfa - DW_CFA_def_cfa_register - DW_CFA_def_cfa_offset - DW_CFA_offset - DW_CFA_remember_state - DW_CFA_restore_state - DW_CFA_restore [Set 2, Bypassed] The following opcodes are acknowledged but are not necessary for generating SFrame unwind info: - DW_CFA_undefined - DW_CFA_same_value Anything else apart from the two above-mentioned sets is skipped altogether. This means that any function containing a CFI directive not in Set 1 or Set 2 above, will not have any SFrame unwind information generated for them. Holes in instructions covered by FREs of a single FDE are not representable in the SFrame unwind format. As few examples, following opcodes are not processed for .sframe generation, and are skipped: - .cfi_personality* - .cfi_*lsda - .cfi_escape - .cfi_negate_ra_state - ... Not processing .cfi_escape, .cfi_negate_ra_state will cause SFrame unwind information to be absent for SFrame FDEs that contain these CFI directives, hence affecting the asynchronicity. x86-64 and aarch64 backends need to have a few new definitions and functions for .sframe generation. These provide gas with architecture specific information like the SP/FP/RA register numbers and an SFrame-specific ABI marker. Lastly, the patch also implements an optimization for size, where specific fragments containing SFrame FRE start address and SFrame FDE function are fixed up. This is similar to other similar optimizations in gas, where fragments are sized and fixed up when the associated symbols can be resolved. This optimization is controlled by a #define SFRAME_FRE_TYPE_SELECTION_OPT and should be easy to turn off if needed. The optimization is on by default for both x86_64 and aarch64. ChangeLog: * gas/Makefile.am: Include gen-sframe.c and sframe-opt.c. * gas/Makefile.in: Regenerated. * gas/as.h (enum _relax_state): Add new state rs_sframe. (sframe_estimate_size_before_relax): New function. (sframe_relax_frag): Likewise. (sframe_convert_frag): Likewise. * gas/config/tc-aarch64.c (aarch64_support_sframe_p): New definition. (aarch64_sframe_ra_tracking_p): Likewise. (aarch64_sframe_cfa_ra_offset): Likewise. (aarch64_sframe_get_abi_arch): Likewise. (md_begin): Set values of sp/fp/ra registers. * gas/config/tc-aarch64.h (aarch64_support_sframe_p): New declaration. (support_sframe_p): Likewise. (SFRAME_CFA_SP_REG): Likewise. (SFRAME_CFA_FP_REG): Likewise. (SFRAME_CFA_RA_REG): Likewise. (aarch64_sframe_ra_tracking_p): Likewise. (sframe_ra_tracking_p): Likewise. (aarch64_sframe_cfa_ra_offset): Likewise. (sframe_cfa_ra_offset): Likewise. (aarch64_sframe_get_abi_arch): Likewise. (sframe_get_abi_arch): Likewise. * gas/config/tc-i386.c (x86_support_sframe_p): New definition. (x86_sframe_ra_tracking_p): Likewise. (x86_sframe_cfa_ra_offset): Likewise. (x86_sframe_get_abi_arch): Likewise. * gas/config/tc-i386.h (x86_support_sframe_p): New declaration. (support_sframe_p): Likewise. (SFRAME_CFA_SP_REG): Likewise. (SFRAME_CFA_FP_REG): Likewise. (x86_sframe_ra_tracking_p): Likewise. (sframe_ra_tracking_p): Likewise. (x86_sframe_cfa_ra_offset): Likewise. (sframe_cfa_ra_offset): Likewise. (x86_sframe_get_abi_arch): Likewise. (sframe_get_abi_arch): Likewise. * gas/config/tc-xtensa.c (unrelaxed_frag_max_size): Add case for rs_sframe. * gas/doc/as.texi: Add .sframe to the documentation for .cfi_sections. * gas/dw2gencfi.c (cfi_finish): Create a .sframe section. * gas/dw2gencfi.h (CFI_EMIT_sframe): New definition. * gas/write.c (cvt_frag_to_fill): Handle rs_sframe. (relax_segment): Likewise. * gas/gen-sframe.c: New file. * gas/gen-sframe.h: New file. * gas/sframe-opt.c: New file. --- gas/Makefile.am | 3 + gas/Makefile.in | 22 +- gas/as.h | 10 +- gas/config/tc-aarch64.c | 52 ++ gas/config/tc-aarch64.h | 29 + gas/config/tc-i386.c | 44 ++ gas/config/tc-i386.h | 26 + gas/config/tc-xtensa.c | 1 + gas/doc/as.texi | 14 +- gas/dw2gencfi.c | 30 + gas/dw2gencfi.h | 1 + gas/gen-sframe.c | 1306 +++++++++++++++++++++++++++++++++++++++ gas/gen-sframe.h | 141 +++++ gas/sframe-opt.c | 158 +++++ gas/write.c | 13 + 15 files changed, 1836 insertions(+), 14 deletions(-) create mode 100644 gas/gen-sframe.c create mode 100644 gas/gen-sframe.h create mode 100644 gas/sframe-opt.c diff --git a/gas/Makefile.am b/gas/Makefile.am index 5f0f24abf8d..f92bfd0a0c8 100644 --- a/gas/Makefile.am +++ b/gas/Makefile.am @@ -70,6 +70,8 @@ GAS_CFILES = \ atof-generic.c \ compress-debug.c \ cond.c \ + sframe-opt.c \ + gen-sframe.c \ depend.c \ dwarf2dbg.c \ dw2gencfi.c \ @@ -105,6 +107,7 @@ HFILES = \ bit_fix.h \ cgen.h \ compress-debug.h \ + gen-sframe.h \ dwarf2dbg.h \ dw2gencfi.h \ ecoff.h \ diff --git a/gas/Makefile.in b/gas/Makefile.in index 5a4dd702252..f62d2af2afe 100644 --- a/gas/Makefile.in +++ b/gas/Makefile.in @@ -162,14 +162,15 @@ CONFIG_CLEAN_FILES = gdb.ini .gdbinit po/Makefile.in CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) am__objects_1 = app.$(OBJEXT) as.$(OBJEXT) atof-generic.$(OBJEXT) \ - compress-debug.$(OBJEXT) cond.$(OBJEXT) depend.$(OBJEXT) \ - dwarf2dbg.$(OBJEXT) dw2gencfi.$(OBJEXT) ecoff.$(OBJEXT) \ - ehopt.$(OBJEXT) expr.$(OBJEXT) flonum-copy.$(OBJEXT) \ - flonum-konst.$(OBJEXT) flonum-mult.$(OBJEXT) frags.$(OBJEXT) \ - hash.$(OBJEXT) input-file.$(OBJEXT) input-scrub.$(OBJEXT) \ - listing.$(OBJEXT) literal.$(OBJEXT) macro.$(OBJEXT) \ - messages.$(OBJEXT) output-file.$(OBJEXT) read.$(OBJEXT) \ - remap.$(OBJEXT) sb.$(OBJEXT) stabs.$(OBJEXT) subsegs.$(OBJEXT) \ + compress-debug.$(OBJEXT) cond.$(OBJEXT) sframe-opt.$(OBJEXT) \ + gen-sframe.$(OBJEXT) depend.$(OBJEXT) dwarf2dbg.$(OBJEXT) \ + dw2gencfi.$(OBJEXT) ecoff.$(OBJEXT) ehopt.$(OBJEXT) \ + expr.$(OBJEXT) flonum-copy.$(OBJEXT) flonum-konst.$(OBJEXT) \ + flonum-mult.$(OBJEXT) frags.$(OBJEXT) hash.$(OBJEXT) \ + input-file.$(OBJEXT) input-scrub.$(OBJEXT) listing.$(OBJEXT) \ + literal.$(OBJEXT) macro.$(OBJEXT) messages.$(OBJEXT) \ + output-file.$(OBJEXT) read.$(OBJEXT) remap.$(OBJEXT) \ + sb.$(OBJEXT) stabs.$(OBJEXT) subsegs.$(OBJEXT) \ symbols.$(OBJEXT) write.$(OBJEXT) am_as_new_OBJECTS = $(am__objects_1) am__dirstamp = $(am__leading_dot)dirstamp @@ -556,6 +557,8 @@ GAS_CFILES = \ atof-generic.c \ compress-debug.c \ cond.c \ + sframe-opt.c \ + gen-sframe.c \ depend.c \ dwarf2dbg.c \ dw2gencfi.c \ @@ -590,6 +593,7 @@ HFILES = \ bit_fix.h \ cgen.h \ compress-debug.h \ + gen-sframe.h \ dwarf2dbg.h \ dw2gencfi.h \ ecoff.h \ @@ -1302,6 +1306,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flonum-konst.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flonum-mult.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frags.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen-sframe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/input-file.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/input-scrub.Po@am__quote@ @@ -1316,6 +1321,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/remap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sframe-opt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stabs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/subsegs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symbols.Po@am__quote@ diff --git a/gas/as.h b/gas/as.h index 1b924071938..23542e452b6 100644 --- a/gas/as.h +++ b/gas/as.h @@ -261,7 +261,10 @@ enum _relax_state rs_cfa, /* Cross-fragment dwarf2 line number optimization. */ - rs_dwarf2dbg + rs_dwarf2dbg, + + /* SFrame FRE type selection optimization. */ + rs_sframe }; typedef enum _relax_state relax_stateT; @@ -528,6 +531,11 @@ int eh_frame_relax_frag (fragS *); void eh_frame_convert_frag (fragS *); int generic_force_reloc (struct fix *); +/* SFrame FRE optimization. */ +int sframe_estimate_size_before_relax (fragS *); +int sframe_relax_frag (fragS *); +void sframe_convert_frag (fragS *); + #include "expr.h" /* Before targ-*.h */ /* This one starts the chain of target dependent headers. */ diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index f6fa1585832..006b950e2d2 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -30,6 +30,9 @@ #ifdef OBJ_ELF #include "elf/aarch64.h" +#include "dw2gencfi.h" +#include "sframe.h" +#include "gen-sframe.h" #endif #include "dw2gencfi.h" @@ -72,6 +75,11 @@ enum aarch64_abi_type AARCH64_ABI_LLP64 = 3 }; +unsigned int aarch64_sframe_cfa_sp_reg; +/* The other CFA base register for SFrame unwind info. */ +unsigned int aarch64_sframe_cfa_fp_reg; +unsigned int aarch64_sframe_cfa_ra_reg; + #ifndef DEFAULT_ARCH #define DEFAULT_ARCH "aarch64" #endif @@ -8401,6 +8409,44 @@ aarch64_init_frag (fragS * fragP, int max_chars) break; } } + +/* Whether SFrame unwind info is supported. */ + +bool +aarch64_support_sframe_p (void) +{ + /* At this time, SFrame is supported for aarch64 only. */ + return (aarch64_abi == AARCH64_ABI_LP64); +} + +/* Specify if RA tracking is needed. */ + +bool +aarch64_sframe_ra_tracking_p (void) +{ + return true; +} + +/* Specify the fixed offset to recover RA from CFA. + (useful only when RA tracking is not needed). */ + +offsetT +aarch64_sframe_cfa_ra_offset (void) +{ + return (offsetT)SFRAME_CFA_FIXED_RA_INVALID; +} + +/* Get the abi/arch indentifier for SFrame. */ + +unsigned char +aarch64_sframe_get_abi_arch (void) +{ + if (aarch64_support_sframe_p ()) + return sframe_get_abi_arch_callback ("aarch64", target_big_endian); + else + return 0; +} + #endif /* OBJ_ELF */ /* Initialize the DWARF-2 unwind information for this procedure. */ @@ -9686,6 +9732,12 @@ md_begin (void) mach = bfd_mach_aarch64; bfd_set_arch_mach (stdoutput, TARGET_ARCH, mach); +#ifdef OBJ_ELF + /* FIXME - is there a better way to do it ? */ + aarch64_sframe_cfa_sp_reg = 31; + aarch64_sframe_cfa_fp_reg = 29; /* x29. */ + aarch64_sframe_cfa_ra_reg = 30; +#endif } /* Command line processing. */ diff --git a/gas/config/tc-aarch64.h b/gas/config/tc-aarch64.h index 2d514ff610a..91412ce8292 100644 --- a/gas/config/tc-aarch64.h +++ b/gas/config/tc-aarch64.h @@ -239,6 +239,35 @@ struct aarch64_segment_info_type /* We want .cfi_* pseudo-ops for generating unwind info. */ #define TARGET_USE_CFIPOP 1 +/* Whether SFrame unwind info is supported. */ +extern bool aarch64_support_sframe_p (void); +#define support_sframe_p aarch64_support_sframe_p + +/* The stack-pointer register number for SFrame unwind info. */ +extern unsigned int aarch64_sframe_cfa_sp_reg; +#define SFRAME_CFA_SP_REG aarch64_sframe_cfa_sp_reg + +/* The base-pointer register number for CFA unwind info. */ +extern unsigned int aarch64_sframe_cfa_fp_reg; +#define SFRAME_CFA_FP_REG aarch64_sframe_cfa_fp_reg + +/* The return address register number for CFA unwind info. */ +extern unsigned int aarch64_sframe_cfa_ra_reg; +#define SFRAME_CFA_RA_REG aarch64_sframe_cfa_ra_reg + +/* Specify if RA tracking is needed. */ +extern bool aarch64_sframe_ra_tracking_p (void); +#define sframe_ra_tracking_p aarch64_sframe_ra_tracking_p + +/* Specify the fixed offset to recover RA from CFA. + (useful only when RA tracking is not needed). */ +extern offsetT aarch64_sframe_cfa_ra_offset (void); +#define sframe_cfa_ra_offset aarch64_sframe_cfa_ra_offset + +/* The abi/arch indentifier for SFrame. */ +unsigned char aarch64_sframe_get_abi_arch (void); +#define sframe_get_abi_arch aarch64_sframe_get_abi_arch + /* CFI hooks. */ #define tc_regname_to_dw2regnum tc_aarch64_regname_to_dw2regnum #define tc_cfi_frame_initial_instructions tc_aarch64_frame_initial_instructions diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index df83d4b79c0..9c62321dfa2 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -30,6 +30,7 @@ #include "subsegs.h" #include "dwarf2dbg.h" #include "dw2gencfi.h" +#include "gen-sframe.h" #include "elf/x86-64.h" #include "opcodes/i386-init.h" #include @@ -587,6 +588,12 @@ static int use_big_obj = 0; #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) /* 1 if generating code for a shared library. */ static int shared = 0; + +unsigned int x86_sframe_cfa_sp_reg; +/* The other CFA base register for SFrame unwind info. */ +unsigned int x86_sframe_cfa_fp_reg; +unsigned int x86_sframe_cfa_ra_reg; + #endif /* 1 for intel syntax, @@ -3073,6 +3080,10 @@ md_begin (void) x86_dwarf2_return_column = 16; #endif x86_cie_data_alignment = -8; +#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) + x86_sframe_cfa_sp_reg = 7; + x86_sframe_cfa_fp_reg = 6; +#endif } else { @@ -9094,6 +9105,39 @@ x86_cleanup (void) if (seg && subseg) subseg_set (seg, subseg); } + +bool +x86_support_sframe_p (void) +{ + /* At this time, SFrame unwind is supported for AMD64 ABI only. */ + return (x86_elf_abi == X86_64_ABI); +} + +bool +x86_sframe_ra_tracking_p (void) +{ + /* In AMD64, return address is always stored on the stack at a fixed offset + from the CFA (provided via x86_sframe_cfa_ra_offset ()). + Do not track explicitly via an SFrame Frame Row Entry. */ + return false; +} + +offsetT +x86_sframe_cfa_ra_offset (void) +{ + gas_assert (x86_elf_abi == X86_64_ABI); + return (offsetT)-8; +} + +unsigned char +x86_sframe_get_abi_arch (void) +{ + if (x86_support_sframe_p ()) + return sframe_get_abi_arch_callback ("x86-64", target_big_endian); + else + return 0; +} + #endif static unsigned int diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h index a6e096ee110..90037269eea 100644 --- a/gas/config/tc-i386.h +++ b/gas/config/tc-i386.h @@ -362,6 +362,32 @@ extern bfd_vma x86_64_section_letter (int, const char **); #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) extern void x86_cleanup (void); #define md_cleanup() x86_cleanup () + +/* Whether SFrame unwind info is supported. */ +extern bool x86_support_sframe_p (void); +#define support_sframe_p x86_support_sframe_p + +/* The stack-pointer register number for SFrame unwind info. */ +extern unsigned int x86_sframe_cfa_sp_reg; +#define SFRAME_CFA_SP_REG x86_sframe_cfa_sp_reg + +/* The frame-pointer register number for CFA unwind info. */ +extern unsigned int x86_sframe_cfa_fp_reg; +#define SFRAME_CFA_FP_REG x86_sframe_cfa_fp_reg + +/* Specify if RA tracking is needed. */ +extern bool x86_sframe_ra_tracking_p (void); +#define sframe_ra_tracking_p x86_sframe_ra_tracking_p + +/* Specify the fixed offset to recover RA from CFA. + (useful only when RA tracking is not needed). */ +extern offsetT x86_sframe_cfa_ra_offset (void); +#define sframe_cfa_ra_offset x86_sframe_cfa_ra_offset + +/* The abi/arch indentifier for SFrame. */ +extern unsigned char x86_sframe_get_abi_arch (void); +#define sframe_get_abi_arch x86_sframe_get_abi_arch + #endif #ifdef TE_PE diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c index b7403ac45d4..f7a28d32d0c 100644 --- a/gas/config/tc-xtensa.c +++ b/gas/config/tc-xtensa.c @@ -8616,6 +8616,7 @@ unrelaxed_frag_max_size (fragS *fragP) case rs_leb128: case rs_cfa: case rs_dwarf2dbg: + case rs_sframe: /* No further adjustments needed. */ break; case rs_machine_dependent: diff --git a/gas/doc/as.texi b/gas/doc/as.texi index 83f49c518d7..32300d73dcb 100644 --- a/gas/doc/as.texi +++ b/gas/doc/as.texi @@ -4883,11 +4883,15 @@ Each expression is assembled into the next byte. @subsection @code{.cfi_sections @var{section_list}} @cindex @code{cfi_sections} directive @code{.cfi_sections} may be used to specify whether CFI directives -should emit @code{.eh_frame} section and/or @code{.debug_frame} section. -If @var{section_list} is @code{.eh_frame}, @code{.eh_frame} is emitted, -if @var{section_list} is @code{.debug_frame}, @code{.debug_frame} is emitted. -To emit both use @code{.eh_frame, .debug_frame}. The default if this -directive is not used is @code{.cfi_sections .eh_frame}. +should emit @code{.eh_frame} section, @code{.debug_frame} section and/or +@code{.sframe} section. If @var{section_list} contains @code{.eh_frame}, +@code{.eh_frame} is emitted, if @var{section_list} contains +@code{.debug_frame}, @code{.debug_frame} is emitted, and finally, if +@var{section_list} contains @code{.sframe}, @code{.sframe} is emitted. +To emit multiple sections, specify them together in a list. For example, to +emit both @code{.eh_frame} and @code{.debug_frame}, use +@code{.eh_frame, .debug_frame}. The default if this directive is not used +is @code{.cfi_sections .eh_frame}. On targets that support compact unwinding tables these can be generated by specifying @code{.eh_frame_entry} instead of @code{.eh_frame}. diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c index 6be8cb50495..ffa542153a5 100644 --- a/gas/dw2gencfi.c +++ b/gas/dw2gencfi.c @@ -23,6 +23,7 @@ #include "dw2gencfi.h" #include "subsegs.h" #include "dwarf2dbg.h" +#include "gen-sframe.h" #ifdef TARGET_USE_CFIPOP @@ -1231,6 +1232,8 @@ dot_cfi_sections (int ignored ATTRIBUTE_UNUSED) else if (strcmp (name, tc_cfi_section_name) == 0) sections |= CFI_EMIT_target; #endif + else if (startswith (name, ".sframe")) + sections |= CFI_EMIT_sframe; else { *input_line_pointer = c; @@ -2471,6 +2474,33 @@ cfi_finish (void) flag_traditional_format = save_flag_traditional_format; } + cfi_sections_set = true; + // FIXME - remove this commented line once the compiler can specify + // .sframe for .cfi_sections directive + // if ((all_cfi_sections & CFI_EMIT_sframe) != 0) + if (flag_gen_sframe || (all_cfi_sections & CFI_EMIT_sframe) != 0) + { +#ifdef support_sframe_p + if (support_sframe_p ()) + { + segT sframe_seg; + int alignment = ffs (DWARF2_ADDR_SIZE (stdoutput)) - 1; + + if (!SUPPORT_FRAME_LINKONCE) + sframe_seg = get_cfi_seg (NULL, ".sframe", + (SEC_ALLOC | SEC_LOAD | SEC_DATA + | DWARF2_EH_FRAME_READ_ONLY), + alignment); + output_sframe (sframe_seg); + } + else + as_bad (_(".sframe not supported for target")); + +#else + as_bad (_(".sframe not supported for target")); +#endif + } + cfi_sections_set = true; if ((all_cfi_sections & CFI_EMIT_debug_frame) != 0) { diff --git a/gas/dw2gencfi.h b/gas/dw2gencfi.h index d570cdb8db3..3863ec37a53 100644 --- a/gas/dw2gencfi.h +++ b/gas/dw2gencfi.h @@ -200,5 +200,6 @@ extern struct fde_entry *all_fde_data; #define CFI_EMIT_debug_frame (1 << 1) #define CFI_EMIT_target (1 << 2) #define CFI_EMIT_eh_frame_compact (1 << 3) +#define CFI_EMIT_sframe (1 << 4) #endif /* DW2GENCFI_H */ diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c new file mode 100644 index 00000000000..2b24f2b5af3 --- /dev/null +++ b/gas/gen-sframe.c @@ -0,0 +1,1306 @@ +/* gen-sframe.c - Support for generating SFrame section. + Copyright (C) 2021 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ + +#include "as.h" +#include "subsegs.h" +#include "sframe.h" +#include "gen-sframe.h" +#include "dw2gencfi.h" + +#ifdef support_sframe_p + +/* By default, use 32-bit relocations from .sframe into .text. */ +#ifndef SFRAME_RELOC_SIZE +# define SFRAME_RELOC_SIZE 4 +#endif + +/* Whether frame row entries track RA. + + A target may not need return address tracking for stack unwinding. If it + does need the same, SFRAME_CFA_RA_REG must be defined with the return + address register number. */ + +#if defined (sframe_ra_tracking_p) && defined (SFRAME_CFA_RA_REG) +# ifndef SFRAME_FRE_RA_TRACKING +# define SFRAME_FRE_RA_TRACKING 1 +# endif +#endif + +/* SFrame FRE type selection optimization is an optimization for size. + + There are three flavors of SFrame FRE representation in the binary format: + - sframe_frame_row_entry_addr1 where the FRE start address is 1 byte. + - sframe_frame_row_entry_addr2 where the FRE start address is 2 bytes. + - sframe_frame_row_entry_addr4 where the FRE start address is 4 bytes. + + Note that in the SFrame format, all SFrame FREs of a function use one + single representation. The SFrame FRE type itself is identified via the + information in the SFrame FDE function info. + + Now, to select the minimum required one from the list above, one needs to + make a decision based on the size (in bytes) of the function. + + As a result, for this optimization, some fragments (generated with a new + type rs_sframe) for the SFrame section are fixed up later. + + This optimization (for size) is enabled by default. */ + +#ifndef SFRAME_FRE_TYPE_SELECTION_OPT +# define SFRAME_FRE_TYPE_SELECTION_OPT 1 +#endif + +/* Emit a single byte into the current segment. */ + +static inline void +out_one (int byte) +{ + FRAG_APPEND_1_CHAR (byte); +} + +/* Emit a two-byte word into the current segment. */ + +static inline void +out_two (int data) +{ + md_number_to_chars (frag_more (2), data, 2); +} + +/* Emit a four byte word into the current segment. */ + +static inline void +out_four (int data) +{ + md_number_to_chars (frag_more (4), data, 4); +} + +/* Get the start address symbol from the DWARF FDE. */ + +static symbolS* +get_dw_fde_start_addrS (const struct fde_entry *dw_fde) +{ + return dw_fde->start_address; +} + +/* Get the start address symbol from the DWARF FDE. */ + +static symbolS* +get_dw_fde_end_addrS (const struct fde_entry *dw_fde) +{ + return dw_fde->end_address; +} + +/* Callback to create the abi/arch identifier for SFrame section. */ + +unsigned char +sframe_get_abi_arch_callback (const char *target_arch, + int big_endian_p) +{ + unsigned char sframe_abi_arch = 0; + + if (strcmp (target_arch, "aarch64") == 0) + { + sframe_abi_arch = big_endian_p + ? SFRAME_ABI_AARCH64_ENDIAN_BIG + : SFRAME_ABI_AARCH64_ENDIAN_LITTLE; + } + else if (strcmp (target_arch, "x86-64") == 0) + { + gas_assert (!big_endian_p); + sframe_abi_arch = SFRAME_ABI_AMD64_ENDIAN_LITTLE; + } + else + { + /* Other abi/arch are not supported. Should be unreachable. */ + printf (_("SFrame Unsupported abi or arch\n")); + abort (); + } + + return sframe_abi_arch; +} + +/* SFrame Frame Row Entry (FRE) related functions. */ + +static void +sframe_fre_set_begin_addr (struct sframe_row_entry *fre, symbolS *beginS) +{ + fre->pc_begin = beginS; +} + +static void +sframe_fre_set_end_addr (struct sframe_row_entry *fre, symbolS *endS) +{ + fre->pc_end = endS; +} + +static void +sframe_fre_set_cfa_base_reg (struct sframe_row_entry *fre, + unsigned int cfa_base_reg) +{ + fre->cfa_base_reg = cfa_base_reg; + fre->merge_candidate = false; +} + +static void +sframe_fre_set_cfa_offset (struct sframe_row_entry *fre, + offsetT cfa_offset) +{ + fre->cfa_offset = cfa_offset; + fre->merge_candidate = false; +} + +#ifdef SFRAME_FRE_RA_TRACKING +static void +sframe_fre_set_ra_track (struct sframe_row_entry *fre, offsetT ra_offset) +{ + fre->ra_loc = SFRAME_FRE_ELEM_LOC_STACK; + fre->ra_offset = ra_offset; + fre->merge_candidate = false; +} +#endif + +static void +sframe_fre_set_bp_track (struct sframe_row_entry *fre, offsetT bp_offset) +{ + fre->bp_loc = SFRAME_FRE_ELEM_LOC_STACK; + fre->bp_offset = bp_offset; + fre->merge_candidate = false; +} + +/* All stack offset values within an FRE are uniformly encoded in the same + number of bytes. The size of the stack offset values will, however, vary + across FREs. */ + +#define VALUE_8BIT 0x7f +#define VALUE_16BIT 0x7fff +#define VALUE_32BIT 0x7fffffff +#define VALUE_64BIT 0x7fffffffffffffff + +/* Given a signed offset, return the size in bytes needed to represent it. */ + +static unsigned int +get_offset_size_in_bytes (offsetT value) +{ + unsigned int size = 0; + + if (value <= VALUE_8BIT && value >= (offsetT)-VALUE_8BIT) + size = 1; + else if (value <= VALUE_16BIT && value >= (offsetT)-VALUE_16BIT) + size = 2; + else if (value <= VALUE_32BIT && value >= (offsetT)-VALUE_32BIT) + size = 4; + else if ((sizeof (offsetT) > 4) + && (value <= (offsetT)VALUE_64BIT && value >= (offsetT)-VALUE_64BIT)) + size = 8; + + return size; +} + +#define SFRAME_FRE_OFFSET_FUNC_MAP_INDEX_1B 0 /* SFRAME_FRE_OFFSET_1B. */ +#define SFRAME_FRE_OFFSET_FUNC_MAP_INDEX_2B 1 /* SFRAME_FRE_OFFSET_2B. */ +#define SFRAME_FRE_OFFSET_FUNC_MAP_INDEX_4B 2 /* SFRAME_FRE_OFFSET_4B. */ +#define SFRAME_FRE_OFFSET_FUNC_MAP_INDEX_8B 3 /* Not supported in SFrame. */ +#define SFRAME_FRE_OFFSET_FUNC_MAP_INDEX_MAX SFRAME_FRE_OFFSET_FUNC_MAP_INDEX_8B + +/* Helper struct for mapping offset size to output functions. */ + +struct sframe_fre_offset_func_map +{ + unsigned int offset_size; + void (*out_func)(int); +}; + +/* Given an OFFSET_SIZE, return the size in bytes needed to represent it. */ + +static unsigned int +sframe_fre_offset_func_map_index (unsigned int offset_size) +{ + unsigned int index = SFRAME_FRE_OFFSET_FUNC_MAP_INDEX_MAX; + + switch (offset_size) + { + case SFRAME_FRE_OFFSET_1B: + index = SFRAME_FRE_OFFSET_FUNC_MAP_INDEX_1B; + break; + case SFRAME_FRE_OFFSET_2B: + index = SFRAME_FRE_OFFSET_FUNC_MAP_INDEX_2B; + break; + case SFRAME_FRE_OFFSET_4B: + index = SFRAME_FRE_OFFSET_FUNC_MAP_INDEX_4B; + break; + default: + /* Not supported in SFrame. */ + break; + } + + return index; +} + +/* Mapping from offset size to the output function to emit the value. */ + +static const +struct sframe_fre_offset_func_map +fre_offset_func_map[SFRAME_FRE_OFFSET_FUNC_MAP_INDEX_MAX+1] = +{ + { SFRAME_FRE_OFFSET_1B, out_one }, + { SFRAME_FRE_OFFSET_2B, out_two }, + { SFRAME_FRE_OFFSET_4B, out_four }, + { -1, NULL } /* Not Supported in SFrame. */ +}; + +/* SFrame version specific operations access. */ + +static struct sframe_version_ops sframe_ver_ops; + +/* SFrame (SFRAME_VERSION_1) set FRE info. */ + +static unsigned char +sframe_v1_set_fre_info (unsigned int base_reg, unsigned int num_offsets, + unsigned int offset_size) +{ + unsigned char fre_info; + fre_info = SFRAME_V1_FRE_INFO (base_reg, num_offsets, offset_size); + return fre_info; +} + +/* SFrame (SFRAME_VERSION_1) set function info. */ +static unsigned char +sframe_v1_set_func_info (unsigned int fde_type, unsigned int fre_type) +{ + unsigned char func_info; + func_info = SFRAME_V1_FUNC_INFO (fde_type, fre_type); + return func_info; +} + +/* SFrame version specific operations setup. */ + +static void +sframe_set_version (uint32_t sframe_version __attribute__((unused))) +{ + sframe_ver_ops.format_version = SFRAME_VERSION_1; + + sframe_ver_ops.set_fre_info = sframe_v1_set_fre_info; + + sframe_ver_ops.set_func_info = sframe_v1_set_func_info; +} + +/* SFrame set FRE info. */ + +static unsigned char +sframe_set_fre_info (unsigned int base_reg, unsigned int num_offsets, + unsigned int offset_size) +{ + return sframe_ver_ops.set_fre_info (base_reg, num_offsets, + offset_size); +} + +/* SFrame set func info. */ + +ATTRIBUTE_UNUSED static unsigned char +sframe_set_func_info (unsigned int fde_type, unsigned int fre_type) +{ + return sframe_ver_ops.set_func_info (fde_type, fre_type); +} + +/* Get the number of SFrame FDEs for the current file. */ + +static unsigned int +get_num_sframe_fdes (void); + +/* Get the number of SFrame frame row entries for the current file. */ + +static unsigned int +get_num_sframe_fres (void); + +/* Get CFA base register ID as represented in SFrame Frame Row Entry. */ + +static unsigned int +get_fre_base_reg_id (struct sframe_row_entry *sframe_fre) +{ + unsigned int cfi_insn_cfa_base_reg = sframe_fre->cfa_base_reg; + unsigned fre_base_reg = SFRAME_BASE_REG_SP; + + if (cfi_insn_cfa_base_reg == SFRAME_CFA_FP_REG) + fre_base_reg = SFRAME_BASE_REG_FP; + + /* Only one bit is reserved in SFRAME_VERSION_1. */ + gas_assert (fre_base_reg == SFRAME_BASE_REG_SP + || fre_base_reg == SFRAME_BASE_REG_FP); + + return fre_base_reg; +} + +/* Get number of offsets necessary for the SFrame Frame Row Entry. */ + +static unsigned int +get_fre_num_offsets (struct sframe_row_entry *sframe_fre) +{ + /* Atleast 1 must always be present (to recover CFA). */ + unsigned int fre_num_offsets = 1; + + if (sframe_fre->bp_loc == SFRAME_FRE_ELEM_LOC_STACK) + fre_num_offsets++; +#ifdef SFRAME_FRE_RA_TRACKING + if (sframe_fre->ra_loc == SFRAME_FRE_ELEM_LOC_STACK) + fre_num_offsets++; +#endif + return fre_num_offsets; +} + +/* Get the minimum necessary offset size (in bytes) for this + SFrame frame row entry. */ + +static unsigned int +sframe_get_fre_offset_size (struct sframe_row_entry *sframe_fre) +{ + unsigned int max_offset_size = 0; + unsigned int cfa_offset_size = 0; + unsigned int bp_offset_size = 0; + unsigned int ra_offset_size = 0; + + unsigned int fre_offset_size = 0; + + /* What size of offsets appear in this frame row entry. */ + cfa_offset_size = get_offset_size_in_bytes (sframe_fre->cfa_offset); + if (sframe_fre->bp_loc == SFRAME_FRE_ELEM_LOC_STACK) + bp_offset_size = get_offset_size_in_bytes (sframe_fre->bp_offset); +#ifdef SFRAME_FRE_RA_TRACKING + if (sframe_ra_tracking_p () + && sframe_fre->ra_loc == SFRAME_FRE_ELEM_LOC_STACK) + ra_offset_size = get_offset_size_in_bytes (sframe_fre->ra_offset); +#endif + + /* Get the maximum size needed to represent the offsets. */ + max_offset_size = cfa_offset_size; + if (bp_offset_size > max_offset_size) + max_offset_size = bp_offset_size; + if (ra_offset_size > max_offset_size) + max_offset_size = ra_offset_size; + + gas_assert (max_offset_size); + + switch (max_offset_size) + { + case 1: + fre_offset_size = SFRAME_FRE_OFFSET_1B; + break; + case 2: + fre_offset_size = SFRAME_FRE_OFFSET_2B; + break; + case 4: + fre_offset_size = SFRAME_FRE_OFFSET_4B; + break; + default: + /* Offset of size 8 bytes is not supported in SFrame format + version 1. */ + printf (_("SFrame unsupported offset value\n")); + abort (); + break; + } + + return fre_offset_size; +} + +#if SFRAME_FRE_TYPE_SELECTION_OPT + +/* Create a composite exression CEXP (for SFrame FRE start address) such that: + + exp = OP_absent , where, + + - and are themselves expressionS. + - stores the expression which when evaluated gives the value of the + start address offset of the FRE. + - stores the expression when when evaluated gives the number of + bytes needed to encode the start address offset of the FRE. + + The use of OP_absent as the X_op_symbol helps identify this expression + later when fragments are fixed up. */ + +static void +create_fre_start_addr_exp (expressionS *cexp, symbolS *fre_pc_begin, + symbolS *fde_start_address, + symbolS *fde_end_address) +{ + expressionS val; + expressionS width; + + /* val expression stores the FDE start address offset from the start PC + of function. */ + val.X_op = O_subtract; + val.X_add_symbol = fre_pc_begin; + val.X_op_symbol = fde_start_address; + val.X_add_number = 0; + + /* width expressions stores the size of the function. This is used later + to determine the number of bytes to be used to encode the FRE start + address of each FRE of the function. */ + width.X_op = O_subtract; + width.X_add_symbol = fde_end_address; + width.X_op_symbol = fde_start_address; + width.X_add_number = 0; + + cexp->X_op = O_absent; + cexp->X_add_symbol = make_expr_symbol (&val); + cexp->X_op_symbol = make_expr_symbol (&width); + cexp->X_add_number = 0; +} + +#endif + +static void +output_sframe_row_entry (symbolS *fde_start_addr, + symbolS *fde_end_addr, + struct sframe_row_entry *sframe_fre) +{ + unsigned char fre_info; + unsigned int fre_num_offsets; + unsigned int fre_offset_size; + unsigned int fre_base_reg; + expressionS exp; + unsigned int fre_addr_size; + + unsigned int index = 0; + unsigned int fre_write_offsets = 0; + + fre_addr_size = 4; /* 4 bytes by default. FIXME tie it to fre_type? */ + + /* SFrame FRE Start Address. */ +#if SFRAME_FRE_TYPE_SELECTION_OPT + create_fre_start_addr_exp (&exp, sframe_fre->pc_begin, fde_start_addr, + fde_end_addr); + frag_grow (fre_addr_size); + frag_var (rs_sframe, fre_addr_size, 0, (relax_substateT) 0, + make_expr_symbol (&exp), 0, (char *) frag_now); +#else + gas_assert (fde_end_addr); + exp.X_op = O_subtract; + exp.X_add_symbol = sframe_fre->pc_begin; /* to. */ + exp.X_op_symbol = fde_start_addr; /* from. */ + exp.X_add_number = 0; + emit_expr (&exp, fre_addr_size); +#endif + + /* Create the fre_info using the CFA base register, number of offsets and max + size of offset in this frame row entry. */ + fre_base_reg = get_fre_base_reg_id (sframe_fre); + fre_num_offsets = get_fre_num_offsets (sframe_fre); + fre_offset_size = sframe_get_fre_offset_size (sframe_fre); + fre_info = sframe_set_fre_info (fre_base_reg, fre_num_offsets, + fre_offset_size); + out_one (fre_info); + + index = sframe_fre_offset_func_map_index (fre_offset_size); + gas_assert (index < SFRAME_FRE_OFFSET_FUNC_MAP_INDEX_MAX); + + /* Write out the offsets in order - cfa, bp, ra. */ + fre_offset_func_map[index].out_func (sframe_fre->cfa_offset); + fre_write_offsets++; + +#ifdef SFRAME_FRE_RA_TRACKING + if (sframe_fre->ra_loc == SFRAME_FRE_ELEM_LOC_STACK) + { + fre_offset_func_map[index].out_func (sframe_fre->ra_offset); + fre_write_offsets++; + } +#endif + if (sframe_fre->bp_loc == SFRAME_FRE_ELEM_LOC_STACK) + { + fre_offset_func_map[index].out_func (sframe_fre->bp_offset); + fre_write_offsets++; + } + + /* Check if the expected number offsets have been written out + in this FRE. */ + gas_assert (fre_write_offsets == fre_num_offsets); +} + +static void +output_sframe_funcdesc (symbolS *start_of_fre_section, + symbolS *fre_symbol, + struct sframe_func_entry *sframe_fde) +{ + expressionS exp; + unsigned int addr_size; + symbolS *dw_fde_start_addrS, *dw_fde_end_addrS; + + addr_size = SFRAME_RELOC_SIZE; + dw_fde_start_addrS = get_dw_fde_start_addrS (sframe_fde->dw_fde); + dw_fde_end_addrS = get_dw_fde_end_addrS (sframe_fde->dw_fde); + + /* Start address of the function. */ + exp.X_op = O_subtract; + exp.X_add_symbol = dw_fde_start_addrS; /* to location. */ + exp.X_op_symbol = symbol_temp_new_now (); /* from location. */ + exp.X_add_number = 0; + emit_expr (&exp, addr_size); + + /* Size of the function in bytes. */ + exp.X_op = O_subtract; + exp.X_add_symbol = dw_fde_end_addrS; + exp.X_op_symbol = dw_fde_start_addrS; + exp.X_add_number = 0; + emit_expr (&exp, addr_size); + + /* Offset to the first frame row entry. */ + exp.X_op = O_subtract; + exp.X_add_symbol = fre_symbol; /* Minuend. */ + exp.X_op_symbol = start_of_fre_section; /* Subtrahend. */ + exp.X_add_number = 0; + emit_expr (&exp, addr_size); + + /* Number of FREs. */ + out_four (sframe_fde->num_fres); + + /* SFrame FDE function info. */ +#if SFRAME_FRE_TYPE_SELECTION_OPT + expressionS width; + width.X_op = O_subtract; + width.X_add_symbol = dw_fde_end_addrS; + width.X_op_symbol = dw_fde_start_addrS; + width.X_add_number = 0; + frag_grow (1); /* Size of func info is unsigned char. */ + frag_var (rs_sframe, 1, 0, (relax_substateT) 0, + make_expr_symbol (&width), 0, (char *) frag_now); +#else + unsigned char func_info; + func_info = sframe_set_func_info (SFRAME_FDE_TYPE_PCINC, + SFRAME_FRE_TYPE_ADDR4); + out_one (func_info); +#endif +} + +static void +output_sframe_internal (void) +{ + expressionS exp; + unsigned int i = 0; + + symbolS *end_of_frame_hdr; + symbolS *end_of_frame_section; + symbolS *start_of_func_desc_section; + symbolS *start_of_fre_section; + struct sframe_func_entry *sframe_fde; + struct sframe_row_entry *sframe_fre; + unsigned char abi_arch = 0; + int fixed_bp_offset = SFRAME_CFA_FIXED_FP_INVALID; + int fixed_ra_offset = SFRAME_CFA_FIXED_RA_INVALID; + unsigned int addr_size; + + addr_size = SFRAME_RELOC_SIZE; + + /* The function desciptor entries as dumped by the assembler are not + sorted on PCs. */ + unsigned char sframe_flags = 0; + sframe_flags |= !SFRAME_F_FDE_SORTED; + + unsigned int num_fdes = get_num_sframe_fdes (); + unsigned int num_fres = get_num_sframe_fres (); + symbolS **fre_symbols = XNEWVEC (symbolS *, num_fres); + for (i = 0; i < num_fres; i++) + fre_symbols[i] = symbol_temp_make (); + + end_of_frame_hdr = symbol_temp_make (); + start_of_fre_section = symbol_temp_make (); + start_of_func_desc_section = symbol_temp_make (); + end_of_frame_section = symbol_temp_make (); + + /* Output the preamble of SFrame section. */ + out_two (SFRAME_MAGIC); + out_one (SFRAME_VERSION); + out_one (sframe_flags); + /* abi/arch. */ +#ifdef sframe_get_abi_arch + abi_arch = sframe_get_abi_arch (); +#endif + gas_assert (abi_arch); + out_one (abi_arch); + + /* Offset for the BP register from CFA. Neither of the AMD64 or AAPCS64 + ABIs have a fixed offset for the BP register from the CFA. This may be + useful in future (but not without additional support in the toolchain) + for specialized handling/encoding for cases where, for example, + -fno-omit-frame-pointer is used. */ + out_one (fixed_bp_offset); + + /* Offset for the return address from CFA is fixed for some ABIs + (e.g., AMD64), output a zero otherwise. */ +#ifdef sframe_ra_tracking_p + if (!sframe_ra_tracking_p ()) + fixed_ra_offset = sframe_cfa_ra_offset (); +#endif + out_one (fixed_ra_offset); + + /* None of the AMD64, or AARCH64 ABIs need the auxilliary header. + When the need does arise to use this field, the appropriate backend + must provide this information. */ + out_one (0); /* Auxilliary SFrame header length. */ + + out_four (num_fdes); /* Number of FDEs. */ + out_four (num_fres); /* Number of FREs. */ + + /* FRE sub-section len. */ + exp.X_op = O_subtract; + exp.X_add_symbol = end_of_frame_section; + exp.X_op_symbol = start_of_fre_section; + exp.X_add_number = 0; + emit_expr (&exp, addr_size); + + /* Offset of Function Index sub-section. */ + exp.X_op = O_subtract; + exp.X_add_symbol = end_of_frame_hdr; + exp.X_op_symbol = start_of_func_desc_section; + exp.X_add_number = 0; + emit_expr (&exp, addr_size); + + /* Offset of FRE sub-section. */ + exp.X_op = O_subtract; + exp.X_add_symbol = start_of_fre_section; + exp.X_op_symbol = end_of_frame_hdr; + exp.X_add_number = 0; + emit_expr (&exp, addr_size); + + symbol_set_value_now (end_of_frame_hdr); + symbol_set_value_now (start_of_func_desc_section); + + /* Output the SFrame function descriptor entries. */ + i = 0; + for (sframe_fde = all_sframe_fdes; sframe_fde; sframe_fde = sframe_fde->next) + { + output_sframe_funcdesc (start_of_fre_section, + fre_symbols[i], sframe_fde); + i += sframe_fde->num_fres; + } + + symbol_set_value_now (start_of_fre_section); + + /* Output the SFrame FREs. */ + i = 0; + sframe_fde = all_sframe_fdes; + + for (sframe_fde = all_sframe_fdes; sframe_fde; sframe_fde = sframe_fde->next) + { + for (sframe_fre = sframe_fde->sframe_fres; + sframe_fre; + sframe_fre = sframe_fre->next) + { + symbol_set_value_now (fre_symbols[i]); + output_sframe_row_entry (get_dw_fde_start_addrS (sframe_fde->dw_fde), + get_dw_fde_end_addrS (sframe_fde->dw_fde), + sframe_fre); + i++; + } + } + + symbol_set_value_now (end_of_frame_section); + + gas_assert (i == num_fres); + + free (fre_symbols); + fre_symbols = NULL; +} + +/* List of SFrame FDE entries. */ + +struct sframe_func_entry *all_sframe_fdes; + +/* Tail of the list to add to. */ + +static struct sframe_func_entry **last_sframe_fde = &all_sframe_fdes; + +static unsigned int +get_num_sframe_fdes (void) +{ + struct sframe_func_entry *sframe_fde; + unsigned int total_fdes = 0; + + for (sframe_fde = all_sframe_fdes; sframe_fde ; sframe_fde = sframe_fde->next) + total_fdes++; + + return total_fdes; +} + +/* Get the total number of SFrame row entries across the FDEs. */ + +static unsigned int +get_num_sframe_fres (void) +{ + struct sframe_func_entry *sframe_fde; + unsigned int total_fres = 0; + + for (sframe_fde = all_sframe_fdes; sframe_fde ; sframe_fde = sframe_fde->next) + total_fres += sframe_fde->num_fres; + + return total_fres; +} + +/* Allocate an SFrame FDE. */ + +static struct sframe_func_entry* +sframe_fde_alloc (void) +{ + struct sframe_func_entry *sframe_fde = XCNEW (struct sframe_func_entry); + return sframe_fde; +} + +/* Link the SFrame FDE in. */ + +static int +sframe_fde_link (struct sframe_func_entry *sframe_fde) +{ + *last_sframe_fde = sframe_fde; + last_sframe_fde = &sframe_fde->next; + + return 0; +} + +/* Free up the SFrame FDE. */ + +static void +sframe_fde_free (struct sframe_func_entry *sframe_fde) +{ + XDELETE (sframe_fde); + sframe_fde = NULL; +} + +/* SFrame translation context functions. */ + +/* Allocate a new SFrame translation context. */ + +static struct sframe_xlate_ctx* +sframe_xlate_ctx_alloc (void) +{ + struct sframe_xlate_ctx* xlate_ctx = XCNEW (struct sframe_xlate_ctx); + return xlate_ctx; +} + +/* Initialize the given SFrame translation context. */ + +static void +sframe_xlate_ctx_init (struct sframe_xlate_ctx *xlate_ctx) +{ + xlate_ctx->dw_fde = NULL; + xlate_ctx->first_fre = NULL; + xlate_ctx->last_fre = NULL; + xlate_ctx->cur_fre = NULL; + xlate_ctx->remember_fre = NULL; + xlate_ctx->num_xlate_fres = 0; +} + +/* Cleanup the given SFrame translation context. */ + +static void +sframe_xlate_ctx_cleanup (struct sframe_xlate_ctx *xlate_ctx) +{ + struct sframe_row_entry *fre, *fre_next; + + if (xlate_ctx->num_xlate_fres) + { + fre = xlate_ctx->first_fre; + while (fre) + { + fre_next = fre->next; + XDELETE (fre); + fre = fre_next; + } + } + + sframe_xlate_ctx_init (xlate_ctx); +} + +/* Transfer the state from the SFrame translation context to the SFrame FDE. */ + +static void +sframe_xlate_ctx_finalize (struct sframe_xlate_ctx *xlate_ctx, + struct sframe_func_entry *sframe_fde) +{ + sframe_fde->dw_fde = xlate_ctx->dw_fde; + sframe_fde->sframe_fres = xlate_ctx->first_fre; + sframe_fde->num_fres = xlate_ctx->num_xlate_fres; +} + +static struct sframe_row_entry* +sframe_row_entry_new (void) +{ + struct sframe_row_entry *fre = XCNEW (struct sframe_row_entry); + /* Reset cfa_base_reg to -1. A value of 0 will imply some valid register + for the supported arches. */ + fre->cfa_base_reg = -1; + fre->merge_candidate = true; + + return fre; +} + +/* Add the given FRE in the list of frame row entries in the given FDE + translation context. */ + +static void +sframe_xlate_ctx_add_fre (struct sframe_xlate_ctx *xlate_ctx, + struct sframe_row_entry *fre) +{ + gas_assert (xlate_ctx && fre); + + /* Add the frame row entry. */ + if (!xlate_ctx->first_fre) + xlate_ctx->first_fre = fre; + else if (xlate_ctx->last_fre) + xlate_ctx->last_fre->next = fre; + + xlate_ctx->last_fre = fre; + + /* Keep track of the total number of SFrame frame row entries. */ + xlate_ctx->num_xlate_fres++; +} + +/* A SFrame Frame Row Entry is self-sufficient in terms of unwind information + for a given PC. It contains information assimilated from multiple CFI + instructions, and hence, a new SFrame FRE is initialized with the data from + the previous known FRE, if any. + + Understandably, not all information (especially the instruction begin + and end boundaries) needs to be relayed. Hence, the caller of this API + must set the pc_begin and pc_end as applicable. */ + +static void +sframe_row_entry_initialize (struct sframe_row_entry *cur_fre, + struct sframe_row_entry *prev_fre) +{ + gas_assert (prev_fre); + cur_fre->cfa_base_reg = prev_fre->cfa_base_reg; + cur_fre->cfa_offset = prev_fre->cfa_offset; + cur_fre->bp_loc = prev_fre->bp_loc; + cur_fre->bp_offset = prev_fre->bp_offset; + cur_fre->ra_loc = prev_fre->ra_loc; + cur_fre->ra_offset = prev_fre->ra_offset; +} + +static int +sframe_xlate_do_advance_loc (struct sframe_xlate_ctx *xlate_ctx, + struct cfi_insn_data *cfi_insn) +{ + struct sframe_row_entry *last_fre = xlate_ctx->last_fre; + /* Get the scratchpad FRE currently being updated as the cfi_insn's + get interpreted. This FRE eventually gets linked in into the + list of FREs for the specific function. */ + struct sframe_row_entry *cur_fre = xlate_ctx->cur_fre; + + if (cur_fre) + { + if (!cur_fre->merge_candidate) + { + sframe_fre_set_end_addr (cur_fre, cfi_insn->u.ll.lab2); + + sframe_xlate_ctx_add_fre (xlate_ctx, cur_fre); + last_fre = xlate_ctx->last_fre; + + xlate_ctx->cur_fre = sframe_row_entry_new (); + cur_fre = xlate_ctx->cur_fre; + + if (last_fre) + sframe_row_entry_initialize (cur_fre, last_fre); + } + else + { + sframe_fre_set_end_addr (last_fre, cfi_insn->u.ll.lab2); + gas_assert (last_fre->merge_candidate == false); + } + } + else + { + xlate_ctx->cur_fre = sframe_row_entry_new (); + cur_fre = xlate_ctx->cur_fre; + } + + gas_assert (cur_fre); + sframe_fre_set_begin_addr (cur_fre, cfi_insn->u.ll.lab2); + + return 0; +} + +static int +sframe_xlate_do_def_cfa (struct sframe_xlate_ctx *xlate_ctx, + struct cfi_insn_data *cfi_insn) + +{ + /* Get the scratchpad FRE. This FRE will eventually get linked in. */ + struct sframe_row_entry *cur_fre = xlate_ctx->cur_fre; + if (!cur_fre) + { + xlate_ctx->cur_fre = sframe_row_entry_new (); + cur_fre = xlate_ctx->cur_fre; + sframe_fre_set_begin_addr (cur_fre, + get_dw_fde_start_addrS (xlate_ctx->dw_fde)); + } + /* Define the current CFA rule to use the provided register and + offset. */ + sframe_fre_set_cfa_base_reg (cur_fre, cfi_insn->u.ri.reg); + sframe_fre_set_cfa_offset (cur_fre, cfi_insn->u.ri.offset); + cur_fre->merge_candidate = false; + + return 0; +} + +static int +sframe_xlate_do_def_cfa_register (struct sframe_xlate_ctx *xlate_ctx, + struct cfi_insn_data *cfi_insn) +{ + struct sframe_row_entry *last_fre = xlate_ctx->last_fre; + /* Get the scratchpad FRE. This FRE will eventually get linked in. */ + struct sframe_row_entry *cur_fre = xlate_ctx->cur_fre; + gas_assert (cur_fre); + /* Define the current CFA rule to use the provided register (but to + keep the old offset). */ + sframe_fre_set_cfa_base_reg (cur_fre, cfi_insn->u.ri.reg); + sframe_fre_set_cfa_offset (cur_fre, last_fre->cfa_offset); + cur_fre->merge_candidate = false; + + return 0; +} + +static int +sframe_xlate_do_def_cfa_offset (struct sframe_xlate_ctx *xlate_ctx, + struct cfi_insn_data *cfi_insn) +{ + /* The scratchpad FRE currently being updated with each cfi_insn + being interpreted. This FRE eventually gets linked in into the + list of FREs for the specific function. */ + struct sframe_row_entry *cur_fre = xlate_ctx->cur_fre; + + gas_assert (cur_fre); + /* Define the current CFA rule to use the provided offset (but to keep + the old register). However, if the old register is not FP/SP, + skip creating SFrame unwind info for the function. */ + if ((cur_fre->cfa_base_reg == SFRAME_CFA_FP_REG) + || (cur_fre->cfa_base_reg == SFRAME_CFA_SP_REG)) + { + sframe_fre_set_cfa_offset (cur_fre, cfi_insn->u.i); + cur_fre->merge_candidate = false; + } + else + return -1; + + return 0; +} + +static int +sframe_xlate_do_offset (struct sframe_xlate_ctx *xlate_ctx, + struct cfi_insn_data *cfi_insn) +{ + /* The scratchpad FRE currently being updated with each cfi_insn + being interpreted. This FRE eventually gets linked in into the + list of FREs for the specific function. */ + struct sframe_row_entry *cur_fre = xlate_ctx->cur_fre; + + gas_assert (cur_fre); + /* Change the rule for the register indicated by the register number to + be the specified offset. */ + if (cfi_insn->u.r == SFRAME_CFA_FP_REG) + { + gas_assert (!cur_fre->base_reg); + sframe_fre_set_bp_track (cur_fre, cfi_insn->u.ri.offset); + cur_fre->merge_candidate = false; + } +#ifdef SFRAME_FRE_RA_TRACKING + else if (sframe_ra_tracking_p () + && cfi_insn->u.r == SFRAME_CFA_RA_REG) + { + sframe_fre_set_ra_track (cur_fre, cfi_insn->u.ri.offset); + cur_fre->merge_candidate = false; + } +#endif + /* This is used to track changes to non-rsp registers, skip all others + except FP / RA for now. */ + return 0; +} + +static int +sframe_xlate_do_val_offset (struct sframe_xlate_ctx *xlate_ctx ATTRIBUTE_UNUSED, + struct cfi_insn_data *cfi_insn) +{ + /* Previous value of register is CFA + offset. However, if the specified + register is not interesting (FP or RA reg), the current DW_CFA_val_offset + instruction can be safely skipped without sacrificing the asynchonicity of + unwind information. */ + if (cfi_insn->u.r == SFRAME_CFA_FP_REG) + return 1; /* Not represented. */ +#ifdef SFRAME_FRE_RA_TRACKING + else if (sframe_ra_tracking_p () + && cfi_insn->u.r == SFRAME_CFA_RA_REG) + return 1; /* Not represented. */ +#endif + + /* Safe to skip. */ + return 0; +} + + +static int +sframe_xlate_do_remember_state (struct sframe_xlate_ctx *xlate_ctx) +{ + struct sframe_row_entry *last_fre = xlate_ctx->last_fre; + + /* If there is no FRE state to remember, nothing to do here. Return + early with non-zero error code, this will cause no SFrame unwind info + for the function involved. */ + if (!last_fre) + return -1; + + if (!xlate_ctx->remember_fre) + xlate_ctx->remember_fre = sframe_row_entry_new (); + sframe_row_entry_initialize (xlate_ctx->remember_fre, last_fre); + + return 0; +} + +static int +sframe_xlate_do_restore_state (struct sframe_xlate_ctx *xlate_ctx) +{ + /* The scratchpad FRE currently being updated with each cfi_insn + being interpreted. This FRE eventually gets linked in into the + list of FREs for the specific function. */ + struct sframe_row_entry *cur_fre = xlate_ctx->cur_fre; + + gas_assert (xlate_ctx->remember_fre); + gas_assert (cur_fre && cur_fre->merge_candidate); + + /* Get the CFA state from the DW_CFA_remember_state insn. */ + sframe_row_entry_initialize (cur_fre, xlate_ctx->remember_fre); + /* The PC boundaries of the current SFrame FRE are updated + via other machinery. */ + cur_fre->merge_candidate = false; + return 0; +} + +static int +sframe_xlate_do_restore (struct sframe_xlate_ctx *xlate_ctx, + struct cfi_insn_data *cfi_insn) +{ + struct sframe_row_entry *cie_fre = xlate_ctx->first_fre; + /* The scratchpad FRE currently being updated with each cfi_insn + being interpreted. This FRE eventually gets linked in into the + list of FREs for the specific function. */ + struct sframe_row_entry *cur_fre = xlate_ctx->cur_fre; + + /* Change the rule for the indicated register to the rule assigned to + it by the initial_instructions in the CIE. */ + gas_assert (cie_fre); + /* SFrame FREs track only CFA and FP / RA for backtracing purposes; + skip the other .cfi_restore directives. */ + if (cfi_insn->u.r == SFRAME_CFA_FP_REG) + { + gas_assert (cur_fre); + cur_fre->bp_loc = cie_fre->bp_loc; + cur_fre->bp_offset = cie_fre->bp_offset; + cur_fre->merge_candidate = false; + } +#ifdef SFRAME_FRE_RA_TRACKING + else if (sframe_ra_tracking_p () + && cfi_insn->u.r == SFRAME_CFA_RA_REG) + { + gas_assert (cur_fre); + cur_fre->ra_loc = cie_fre->ra_loc; + cur_fre->ra_offset = cie_fre->ra_offset; + cur_fre->merge_candidate = false; + } +#endif + return 0; +} + +/* Process CFI_INSN and update the translation context with the FRE + information. + + Returns an error code if CFI_INSN is not successfully processed. */ + +static int +sframe_do_cfi_insn (struct sframe_xlate_ctx *xlate_ctx, + struct cfi_insn_data *cfi_insn) +{ + int err = 0; + + /* Atleast one cfi_insn per FDE is expected. */ + gas_assert (cfi_insn); + int op = cfi_insn->insn; + + switch (op) + { + case DW_CFA_advance_loc: + err = sframe_xlate_do_advance_loc (xlate_ctx, cfi_insn); + break; + case DW_CFA_def_cfa: + err = sframe_xlate_do_def_cfa (xlate_ctx, cfi_insn); + break; + case DW_CFA_def_cfa_register: + err = sframe_xlate_do_def_cfa_register (xlate_ctx, cfi_insn); + break; + case DW_CFA_def_cfa_offset: + err = sframe_xlate_do_def_cfa_offset (xlate_ctx, cfi_insn); + break; + case DW_CFA_offset: + err = sframe_xlate_do_offset (xlate_ctx, cfi_insn); + break; + case DW_CFA_val_offset: + err = sframe_xlate_do_val_offset (xlate_ctx, cfi_insn); + break; + case DW_CFA_remember_state: + err = sframe_xlate_do_remember_state (xlate_ctx); + break; + case DW_CFA_restore_state: + err = sframe_xlate_do_restore_state (xlate_ctx); + break; + case DW_CFA_restore: + err = sframe_xlate_do_restore (xlate_ctx, cfi_insn); + break; + case DW_CFA_undefined: + case DW_CFA_same_value: + break; + default: + { + /* Other CFI opcodes are not processed at this time. + These do not impact the coverage of the basic stack unwinding + information as conveyed in the SFrame format. + - DW_CFA_register, + - ... + + Following skipped operations do, however, impact the asynchronicity: + - CFI_escape, + - DW_CFA_GNU_window_save, + - DW_CFA_AARCH64_negate_ra_state (multiplexed with + DW_CFA_GNU_window_save) */ + + err = 1; + // printf (_("SFrame Unsupported or unknown Dwarf CFI number: %#x\n"), op); + } + } + + return err; +} + +static int sframe_do_fde (struct sframe_xlate_ctx *xlate_ctx, + const struct fde_entry *dw_fde) +{ + struct cfi_insn_data *cfi_insn; + + xlate_ctx->dw_fde = dw_fde; + + /* If the return column is not RIP, SFrame format cannot represent it. */ + if (xlate_ctx->dw_fde->return_column != DWARF2_DEFAULT_RETURN_COLUMN) + return 1; + + /* Iterate over the CFIs and create SFrame FREs. */ + for (cfi_insn = dw_fde->data; cfi_insn; cfi_insn = cfi_insn->next) + { + /* Translate each CFI, and buffer the state in translation context. */ + if (sframe_do_cfi_insn (xlate_ctx, cfi_insn)) + { + /* Skip generating SFrame unwind info for the function if any + offending CFI is encountered by sframe_do_cfi_insn (). */ + /* FIXME - get a detailed look at the individual cases. */ + // printf ("WATCH THIS ONE! sframe_do_cfi_insn skipped. \n"); + return 1; /* Error. */ + } + } + + /* No errors encountered. */ + + /* Link in the scratchpad FRE that the last few CFI insns helped create. */ + if (xlate_ctx->cur_fre) + { + sframe_xlate_ctx_add_fre (xlate_ctx, xlate_ctx->cur_fre); + xlate_ctx->cur_fre = NULL; + } + /* Designate the end of the last SFrame FRE. */ + if (xlate_ctx->last_fre) + { + xlate_ctx->last_fre->pc_end + = get_dw_fde_end_addrS (xlate_ctx->dw_fde); + } + + return 0; +} + +/* Create SFrame unwind info for all functions. + + This function consumes the already generated FDEs (by dw2gencfi) and + generates unwind data in SFrame format. */ + +static void create_sframe_all (void) +{ + struct fde_entry *dw_fde = NULL; + struct sframe_func_entry *sframe_fde = NULL; + + struct sframe_xlate_ctx *xlate_ctx = sframe_xlate_ctx_alloc (); + + for (dw_fde = all_fde_data; dw_fde ; dw_fde = dw_fde->next) + { + /* FIXME - enable this assert once the compiler is generating + .cfi_sections with .sframe enabled. */ + // gas_assert ((fde->sections & CFI_EMIT_sframe)); + sframe_fde = sframe_fde_alloc (); + /* Initialize the translation context with information anew. */ + sframe_xlate_ctx_init (xlate_ctx); + + /* Process and link SFrame FDEs if no error. Also skip adding an SFrame + FDE if it does not contain any SFrame FREs. There is little use of an + SFrame FDE if there is no unwind information about the function. */ + int err = sframe_do_fde (xlate_ctx, dw_fde); + if (err || xlate_ctx->num_xlate_fres == 0) + { + sframe_xlate_ctx_cleanup (xlate_ctx); + sframe_fde_free (sframe_fde); + } + else + { + /* All done. Transfer the state from the SFrame translation + context to the SFrame FDE. */ + sframe_xlate_ctx_finalize (xlate_ctx, sframe_fde); + sframe_fde_link (sframe_fde); + } + } +} + +void output_sframe (segT sframe_seg) +{ + (void) sframe_seg; + + /* Setup the version specific access functions. */ + sframe_set_version (SFRAME_VERSION_1); + + /* Process all fdes and create SFrame unwind information. */ + create_sframe_all (); + + output_sframe_internal (); +} + +#else /* support_sframe_p */ + +/* Callback to create the abi/arch identifier for SFrame section. */ + +unsigned char +sframe_get_abi_arch_callback (const char *tarch __attribute__((unused)), + int big_endian_p __attribute__((unused))) +{ + unsigned char sframe_abi_arch = 0; + + return sframe_abi_arch; +} + +void output_sframe (segT sframe_seg __attribute__((unused))) +{ +} + +#endif /* support_sframe_p */ diff --git a/gas/gen-sframe.h b/gas/gen-sframe.h new file mode 100644 index 00000000000..3cd1fa2a643 --- /dev/null +++ b/gas/gen-sframe.h @@ -0,0 +1,141 @@ +/* gen-sframe.h - Support for generating SFrame. + Copyright (C) 2021 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ + +#ifndef GENSFRAME_H +#define GENSFRAME_H + +#define SFRAME_FRE_ELEM_LOC_REG 0 +#define SFRAME_FRE_ELEM_LOC_STACK 1 + +/* SFrame Frame Row Entry (FRE). + + A frame row entry is a slice of the frame and can be valid for a set of + program instructions. It keeps all information needed to retrieve the CFA + and the Return Address (RA) if tracked. + + A frame row entry effectively stores accumulated information gathered by + interpreting multiple CFI instructions. More precisely, it is a + self-sufficient record in its own right. Only the subset of information + necessary for unwinding is stored: Given a PC, how to retrieve the CFA and + the RA. +*/ + +struct sframe_row_entry +{ + /* A linked list. */ + struct sframe_row_entry *next; + + /* Start and end of the frame row entry. */ + symbolS *pc_begin; + symbolS *pc_end; + + /* A frame row entry is a merge candidate if new information can be updated + on it. */ + bool merge_candidate; + + /* Track CFA base (architectural) register ID. */ + unsigned int cfa_base_reg; + /* Offset from the CFA base register for recovering CFA. */ + offsetT cfa_offset; + + /* Track the other register used as base register for CFA. Specify whether + it is in register or memory. */ + unsigned int base_reg; + unsigned int bp_loc; + /* If the other register is stashed on stack, note the offset. */ + offsetT bp_offset; + + /* Track RA location. Specify whether it is in register or memory. */ + unsigned int ra_loc; + /* If RA is stashed on stack, note the offset. */ + offsetT ra_offset; +}; + +/* SFrame Function Description Entry. */ + +struct sframe_func_entry +{ + /* A linked list. */ + struct sframe_func_entry *next; + + /* Reference to the FDE created from CFI in dw2gencfi. Some information + like the start_address and the segment is made available via this + member. */ + const struct fde_entry *dw_fde; + + /* Reference to the first FRE for this function. */ + struct sframe_row_entry *sframe_fres; + + unsigned int num_fres; +}; + +/* SFrame Function Description Entry Translation Context. */ + +struct sframe_xlate_ctx +{ + /* Reference to the FDE created from CFI in dw2gencfi. Information + like the FDE start_address, end_address and the cfi insns are + made available via this member. */ + const struct fde_entry *dw_fde; + + /* List of FREs in the current FDE translation context, bounded by first_fre + and last_fre. */ + + /* Keep track of the first FRE for the purpose of restoring state if + necessary (for DW_CFA_restore). */ + struct sframe_row_entry *first_fre; + /* The last FRE in the list. */ + struct sframe_row_entry *last_fre; + + /* The current FRE under construction. */ + struct sframe_row_entry *cur_fre; + /* Remember FRE for an eventual restore. */ + struct sframe_row_entry *remember_fre; + + unsigned num_xlate_fres; +}; + +/* Callback to create the abi/arch identifier for SFrame section. */ + +unsigned char +sframe_get_abi_arch_callback (const char *target_arch, + int big_endian_p); + +/* The list of all FDEs with data in SFrame internal representation. */ + +extern struct sframe_func_entry *all_sframe_fdes; + +/* SFrame version specific operations structure. */ + +struct sframe_version_ops +{ + unsigned char format_version; /* SFrame format version. */ + /* set SFrame FRE info. */ + unsigned char (*set_fre_info) (unsigned int, unsigned int, unsigned int); + /* set SFrame Func info. */ + unsigned char (*set_func_info) (unsigned int, unsigned int); +}; + +/* Generate SFrame unwind info and prepare contents for the output. + outout_sframe () is called at the end of file. */ + +extern void output_sframe (segT sframe_seg); + +#endif /* GENSFRAME_H */ diff --git a/gas/sframe-opt.c b/gas/sframe-opt.c new file mode 100644 index 00000000000..c17fd6b8332 --- /dev/null +++ b/gas/sframe-opt.c @@ -0,0 +1,158 @@ +/* sframe-opt.c - optimize FRE and FDE information in SFrame. + Copyright (C) 2022 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ + +#include "as.h" +#include "sframe.h" + +/* The function estimates the size of a rs_sframe variant frag based on + the current values of the symbols. It is called before the + relaxation loop. We set fr_subtype{0:2} to the expected length. */ + +int +sframe_estimate_size_before_relax (fragS *frag) +{ + offsetT width; + expressionS *exp; + symbolS *widthS; + int ret; + + /* We are dealing with two different kind of fragments here which need + to be fixed up: + - first, FRE start address in each FRE, and + - second, Function info in each FDE (function info stores the FRE type) + The two kind of fragments can be differentiated based on the opcode + of the symbol. */ + exp = symbol_get_value_expression (frag->fr_symbol); + gas_assert ((exp->X_op == O_subtract) || (exp->X_op == O_absent)); + /* Fragment for function info in an SFrame FDE will always write + only one byte. */ + if (exp->X_op == O_subtract) + ret = 1; + /* Fragment for the start address in an SFrame FRE may write out + 1/2/4 bytes depending on the value of the diff. */ + else + { + /* Get the width expression from the symbol. */ + widthS = exp->X_op_symbol; + width = resolve_symbol_value (widthS); + + if (width < 0x100) + ret = 1; + else if (width < 0x10000) + ret = 2; + else + ret = 4; + } + + frag->fr_subtype = (frag->fr_subtype & ~7) | (ret & 7); + + return ret; +} + +/* This function relaxes a rs_sframe variant frag based on the current + values of the symbols. fr_subtype{0:2} is the current length of + the frag. This returns the change in frag length. */ + +int +sframe_relax_frag (fragS *frag) +{ + int oldsize, newsize; + + oldsize = frag->fr_subtype & 7; + if (oldsize == 7) + oldsize = -1; + newsize = sframe_estimate_size_before_relax (frag); + return newsize - oldsize; +} + +/* This function converts a rs_sframe variant frag into a normal fill + frag. This is called after all relaxation has been done. + fr_subtype{0:2} will be the desired length of the frag. */ + +void +sframe_convert_frag (fragS *frag) +{ + offsetT fsize; + offsetT diff; + offsetT value; + unsigned char func_info = SFRAME_FRE_TYPE_ADDR4; + expressionS *exp; + symbolS *fsizeS, *diffS; + + /* We are dealing with two different kind of fragments here which need + to be fixed up: + - first, FRE start address in each FRE, and + - second, Function info in each FDE (function info stores the FRE type) + The two kind of fragments can be differentiated based on the opcode + of the symbol. */ + exp = symbol_get_value_expression (frag->fr_symbol); + gas_assert ((exp->X_op == O_subtract) || (exp->X_op == O_absent)); + /* Fragment for function info in an SFrame FDE. */ + if (exp->X_op == O_subtract) + { + fsizeS = frag->fr_symbol; + fsize = resolve_symbol_value (fsizeS); + if (fsize < 0x100) + func_info = SFRAME_FRE_TYPE_ADDR1; + else if (fsize < 0x10000) + func_info = SFRAME_FRE_TYPE_ADDR2; + else + func_info = SFRAME_FRE_TYPE_ADDR4; + value = func_info; + + frag->fr_literal[frag->fr_fix] = value; + } + /* Fragment for the start address in an SFrame FRE. */ + else + { + /* Get the fsize expression from the symbol. */ + fsizeS = exp->X_op_symbol; + fsize = resolve_symbol_value (fsizeS); + /* Get the diff expression from the symbol. */ + diffS= exp->X_add_symbol; + diff = resolve_symbol_value (diffS); + value = diff; + + switch (frag->fr_subtype & 7) + { + case 1: + gas_assert (fsize < 0x100); + frag->fr_literal[frag->fr_fix] = diff; + break; + case 2: + gas_assert (fsize < 0x10000); + md_number_to_chars (frag->fr_literal + frag->fr_fix, diff, 2); + break; + case 4: + md_number_to_chars (frag->fr_literal + frag->fr_fix, diff, 4); + break; + default: + abort (); + } + } + + frag->fr_fix += frag->fr_subtype & 7; + frag->fr_type = rs_fill; + frag->fr_subtype = 0; + frag->fr_offset = 0; + /* FIXME do this now because we have evaluated and fixed up the fragments + manually ? */ + frag->fr_symbol = 0; +} diff --git a/gas/write.c b/gas/write.c index 1c1b8104222..4f9b600cd37 100644 --- a/gas/write.c +++ b/gas/write.c @@ -487,6 +487,10 @@ cvt_frag_to_fill (segT sec ATTRIBUTE_UNUSED, fragS *fragP) dwarf2dbg_convert_frag (fragP); break; + case rs_sframe: + sframe_convert_frag (fragP); + break; + case rs_machine_dependent: md_convert_frag (stdoutput, sec, fragP); @@ -2788,6 +2792,11 @@ relax_segment (struct frag *segment_frag_root, segT segment, int pass) address += dwarf2dbg_estimate_size_before_relax (fragP); break; + case rs_sframe: + /* Initial estimate can be set to atleast 1 byte. */ + address += sframe_estimate_size_before_relax (fragP); + break; + default: BAD_CASE (fragP->fr_type); break; @@ -3131,6 +3140,10 @@ relax_segment (struct frag *segment_frag_root, segT segment, int pass) growth = dwarf2dbg_relax_frag (fragP); break; + case rs_sframe: + growth = sframe_relax_frag (fragP); + break; + default: BAD_CASE (fragP->fr_type); break; From patchwork Sun Oct 30 07:44:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 12956 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1686493wru; Sun, 30 Oct 2022 00:49:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Rs8XcN18TzeZLAU1uOa6uyRHgXY3xHoDj87sPzDH7Ai/0RKZwLE2wtdAMh/4nOiFrUizW X-Received: by 2002:a17:907:724c:b0:7ad:8f76:1fb8 with SMTP id ds12-20020a170907724c00b007ad8f761fb8mr7178605ejc.582.1667116176139; Sun, 30 Oct 2022 00:49:36 -0700 (PDT) Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id ss24-20020a170907c01800b007809c50fd78si3633201ejc.262.2022.10.30.00.49.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 00:49:36 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=BnYDd0VL; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E28F6388460F for ; Sun, 30 Oct 2022 07:47:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E28F6388460F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667116068; bh=k7JCUCyuGfU9Mo2aakmr84MsxxX/0e14U5NxJ8N93gc=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=BnYDd0VLYTRBOumMJEl3ZoX4++mORCWxCSAaddRCkRwbbLSpcoemSHIjGRiuOmfr8 gHT1TEfn9No6xatwLsLsJ7F1W6BsymGzj4ewA9fwq5aH73BrED/l34ucYGL7uDoyiH VCcbOqcRosnWhSWFosd3JGnlbJVPNaSAF15BbRik= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 2A94A3857B95 for ; Sun, 30 Oct 2022 07:45:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2A94A3857B95 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29TKKT3P030823 for ; Sun, 30 Oct 2022 07:45:21 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 3kgvqt999k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:45:21 +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 29U6sLfw035958 for ; Sun, 30 Oct 2022 07:45:19 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2171.outbound.protection.outlook.com [104.47.59.171]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kgtm8hgge-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:45:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ikqBL/d6OGUdISjdAqtA4KNZ8Tfpj7XnMN/3K9dKZyNx92ZzCQKCcIUudTphZ7R4eJUh9rXnUMepo6XjqFqfmVtEiCGlhfYY4TqNLIojOtpTkIlKhNdcl0fj2NfMeHyNEck+Hv5FcPDN9oOPr4fkpJkftam1git2G1yqv6axJddjAha4s/oW07pyk0eGIL8m8EVZi88BRcoky6+FUeRSnEDwYAObmnDFl9OUSySHgmHR1iql8h9GX1tLoRxZAIVIYk+jHo2zKCrj05ARkQeinBgXcvi73QPK5TPT/qgBlUzMhDhPFLQYc0w7B1jpkAtk/VK8LG4vICZbxoUWX+LAJg== 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=k7JCUCyuGfU9Mo2aakmr84MsxxX/0e14U5NxJ8N93gc=; b=ZiXt4OpqItXsGmk5mz8VGFxoEraox8Mn09qdkMAbe3R6OCjHoa/G/YX58cIYiD+9SzElBskwe8jDGajV3zfWKBInf97knP80BAhqZNinbjeEzTkfwM8UL7lSYfdjH3pR4gkKSf3Iq+ly50m8DdKo9z3LXloga+qvht+pxeXMJnKTg+osMOG9AAXaBMCYV1h+VcPiRizokx53OoZJCghklFFLVZ1bf4ZPzK/5buJvo2VddoFYmtaJ/Wc80sbkLRz25UYw9CHMWvt/7g37n9ZRxxiz+Q3ngCOhp3qLggE0E8aoLTmQO4PfV8l6qQUDb7ztfVK8g0iYS7aVtdf3DxSs+g== 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 MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by BY5PR10MB4289.namprd10.prod.outlook.com (2603:10b6:a03:20c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.19; Sun, 30 Oct 2022 07:45:16 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2%7]) with mapi id 15.20.5723.033; Sun, 30 Oct 2022 07:45:16 +0000 To: binutils@sourceware.org Subject: [PATCH, V3 04/15] gas: testsuite: add new tests for SFrame unwind info Date: Sun, 30 Oct 2022 00:44:39 -0700 Message-Id: <20221030074450.1956074-5-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221030074450.1956074-1-indu.bhagat@oracle.com> References: <20221030074450.1956074-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR04CA0246.namprd04.prod.outlook.com (2603:10b6:303:88::11) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|BY5PR10MB4289:EE_ X-MS-Office365-Filtering-Correlation-Id: 1d711e1b-1299-409a-4663-08daba4aafa4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lSFVh4hlrLd8tDERMWxNa0PPWZBeiwTQhWz7uOcaIRHw3K+DlJ4tnyMxwPg2SY4WaF7g9JhArRGU3YSD3xqvILq1ARA9IHAFUKuHxR/dMhZZnqFjm3RAX2/78B/hvdvl23eWuJK9x4cO2KMfAFv4DlQtxiqOAgCGBNWkQl2AXOEUxb1Rry+ayRr1C+/flqgi/yM/0zyTRtjaeMz+lHI6TPiA+HsVPIVk/iEh28boTTE+JPe+8n1ID918Xes+vsitGncy2HgajooLlyN9q8vyQZTFjdLHIUfgnsq7XHGcLoHQKTy/ZZx0BDHNKDq3rTPH6ITnkMMJJxSZbeXvAugTn76BHER5yH6vZF8xAW2oIN6eU52QlJDcZ/6mJBW4P9fLivJial3YIYpbwfutC82BVxNe0zWZR6s9R7Ek5YUInw7RWtw//eOPfIB4gSYH9n32w3AruFb5QCmWAsgfkGwA8h3a4EaMZ3N8aIyngNv8D8T5lfdWMmlZrIx8a1NeCktGdNBypRtzA5NVTyRx4D3vd/7m6pgG6j+1bIeTH6JSuTFzRqVHFNX/80xxeHx47yG4mAQaGHnZcimMEtARTMaez5Hz0eOlScO4yotgMW0ElYo/+g9ZfjkQwHYs/dZwrp3dVsU3OIJwxo9PWyaSPLf3e51mT0UDR8OUIc8s0ZS6A29QiXHgFf5IAQOmWmfBs20vuoIR1+WV6i7jDkRSsCJm9LeFBDy5GZsW0tcdJeeTo+0YHgki9sYy7hmQPCEkW1L3 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2158.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(366004)(39850400004)(376002)(346002)(136003)(451199015)(316002)(66556008)(4326008)(66476007)(36756003)(6916009)(66946007)(30864003)(6486002)(38100700002)(6666004)(8936002)(41300700001)(86362001)(107886003)(478600001)(5660300002)(1076003)(186003)(83380400001)(8676002)(2616005)(44832011)(2906002)(6512007)(6506007)(2004002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: c5czR71gS7xM962Yvy0FwmxGFAmiXH3eQoz0rjEK2undXb2zvTl9zZvPnUSt1kQJOKGVcWL9dZIHddNRp+oxd0JvLlXmP4HLgKWYqyoiUQI5Y3657/KSUF4tPEEEi0U5N4LGSFlRYLHCVXDpPUVzYAb3fFXZGpQfluZB651AFLYwim+gPQdfl3Q/6l+OSCv8H0W2sCdAdJbPNcH+6/AhADrB/WAIjkr//RFpvcGDSTKMI7BNI/mfrISvpTYzfec90aE9yiitWlyIbfXfDU8DDkTDezfMprtlwCEVDN0iO5ZPvwBtVhkJbt/7cQ0H4AxxgFeX1xfY9X1FIwiqX6ZNErnEdGir4SuqmOdQi2qMjGhpyh/W2TqB6l8tpE/IztPicdUsgR68LsS6ofCBoB2TFvz6Iu8BFOuAK5H9+LrTkIuc4/mb4foCLSVHK+eGComI43QatQC6BeuFS0VNNm/M1fKgPLO/Ilg7l6U9iQ+WSWttYY2pZES49FHAy0IA6B7qXbc5cyTbJqagR4geUGch8Q8NFX5lCHdLq2GlFiyQYCDSrxfvLrT1MYkwW3bV0VZC6RnVzfwBjDoK9hVWyoTHfSNjXPE/0UUhIowvnX6xh+PL7CJX2CwLsC7MW4c7jtYsMwmLQ2QkC14U4qKmQ0k4gNtWKgfGW53YoW6YkFJpQv+Ns9nY9IxxiSX7uZ/4ehjcqjbBgwxwyUcUngH9R2kBcjHdJXJ7sYswPsXdEpxKH8pN4Y+VjaWdXeF+fWPMhgKjZ1SvgfsGGZEM33+kLn12JBXu9JzcV2Lgm08siayzTKEoCUs4sYY9Wzd6npJfBH5or/hF7RTGTVp5LDrKLSyyT2G1vSCUiaoGYjjuFHj2wIjbjGZAybyWeVck8G39vOLUXY9JtiGxRh7DJNql47WLRMlJuD9rR2X9Afrvd8+zr/gph+YpSvGcCSEdOBvibWzVCRMjE2JxW6f2YdmR3nxL2aVyDDIPN9bhFt9gmQ+OnuhybWQokvqdAxcCMhotYP+55pEv4U4EDceFi8JAuEEW7KYDWpYq7L9NmOUt76xfhWoBNFfTSGvD/Qh4pYw0beXsZkZ621MuuwZk+k8vU4371zvLX3m0nTUsO/OHsyEXdJy1Cmz3lSE/jmb8g6SO1EvSUQHaMjgI0D3b34V7jLxh5z5tp8h0uPiPCouPwy1Ykt7bXa+axY3oZsTiNWB6YzJCGVkXBabjE0PfCTtzfqlauGGJJ8DjrxFI/ntdh8QhFvdCMCOIMEdFBZpXCm3GbtAI6JZHa4JzpA5GHRw7qtEPLyCocgVHjd85UD1bRfFtSLOG7xFAipu7eL+s2qv1564oC+a//0iJ0UrCNxqBM84qXedf5YO4uTVQ0u3ybZmVeVLoWv/aq/xCSeIc+nu3y3t4L8oPnVKRt/9dJYQ+KZx7Cjc2gUPDslNXbxA9INjYyC+EKVFgtpiHQnz77PmO8wA+HLuLenwuhUkBnFGn0ZinGLuEC9qWEzShOwm2t9Tb8DgRVsZq+h9My+Wzy1kLTacNPIZozIoUXK5exFF+hUgIu4w9DF+kAOwEFwnFqvl/zowyNBR/TbOBGR6WJ5gQQUHwDiHEwNusOn7B6ySdSycWin7YRnniLRkYf6x6iVbhRtc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d711e1b-1299-409a-4663-08daba4aafa4 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2022 07:45:16.5346 (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: 8vEyegyurvLl/+5hGjJp7jripR9LgXceEWj+F8ml2r4ZAgHJ6h0Gki2Qe9L2tgXDCINCeTKLzokDNiGjOtQOZQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4289 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-30_02,2022-10-27_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 suspectscore=0 phishscore=0 malwarescore=0 spamscore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2210300049 X-Proofpoint-GUID: pjOlL1s5UyZJSWNwRDbzx8dkmrepa3mI X-Proofpoint-ORIG-GUID: pjOlL1s5UyZJSWNwRDbzx8dkmrepa3mI X-Spam-Status: No, score=-12.7 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_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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Indu Bhagat via Binutils From: Indu Bhagat Reply-To: Indu Bhagat Cc: Indu Bhagat Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748098011649775575?= X-GMAIL-MSGID: =?utf-8?q?1748098011649775575?= [No chnages in V3] [Changes in V2] - fixed the string to match aarch64_be-*-* in cfi-sframe.exp. Prior to this, cfi-sframe testsuite was not running when --target=aarch64_be-linux-gnu - Also added new proc to check if as supports SFrame. Prior to this fix, cfi-sframe testsuite was also running when --target=aarch64_be-linux-gnu_ilp32. SFrame is not supported for this ABI/arch. [End of changes in V2] Earlier these tests were in the same commit as previous which adds the support in GNU assembler to generate .sframe section from CFI directives. Splitting this out here for ease of applying and testing. ChangeLog: * gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-1.d: New file. * gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-1.s: Likewise. * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d: Likewise. * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.s: Likewise. * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.d: Likewise. * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.s: Likewise. * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.d: Likewise. * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.s: Likewise. * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.d: Likewise. * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.s: Likewise. * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.d: Likewise. * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.s: Likewise. * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.d: Likewise. * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.s: Likewise. * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.d: Likewise. * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.s: Likewise. * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.d: Likewise. * gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.s: Likewise. * gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.d: Likewise. * gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.s: Likewise. * gas/testsuite/gas/cfi-sframe/cfi-sframe.exp: Likewise. * gas/testsuite/gas/cfi-sframe/common-empty-1.d: Likewise. * gas/testsuite/gas/cfi-sframe/common-empty-1.s: Likewise. * gas/testsuite/gas/cfi-sframe/common-empty-2.d: Likewise. * gas/testsuite/gas/cfi-sframe/common-empty-2.s: Likewise. * gas/testsuite/gas/cfi-sframe/common-empty-3.d: Likewise. * gas/testsuite/gas/cfi-sframe/common-empty-3.s: Likewise. * gas/testsuite/gas/cfi-sframe/common-empty-4.d: Likewise. * gas/testsuite/gas/cfi-sframe/common-empty-4.s: Likewise. --- .../gas/cfi-sframe/cfi-sframe-aarch64-1.d | 20 ++++ .../gas/cfi-sframe/cfi-sframe-aarch64-1.s | 61 ++++++++++++ .../gas/cfi-sframe/cfi-sframe-common-1.d | 17 ++++ .../gas/cfi-sframe/cfi-sframe-common-1.s | 3 + .../gas/cfi-sframe/cfi-sframe-common-2.d | 17 ++++ .../gas/cfi-sframe/cfi-sframe-common-2.s | 2 + .../gas/cfi-sframe/cfi-sframe-common-3.d | 17 ++++ .../gas/cfi-sframe/cfi-sframe-common-3.s | 4 + .../gas/cfi-sframe/cfi-sframe-common-4.d | 21 ++++ .../gas/cfi-sframe/cfi-sframe-common-4.s | 8 ++ .../gas/cfi-sframe/cfi-sframe-common-5.d | 21 ++++ .../gas/cfi-sframe/cfi-sframe-common-5.s | 7 ++ .../gas/cfi-sframe/cfi-sframe-common-6.d | 21 ++++ .../gas/cfi-sframe/cfi-sframe-common-6.s | 7 ++ .../gas/cfi-sframe/cfi-sframe-common-7.d | 21 ++++ .../gas/cfi-sframe/cfi-sframe-common-7.s | 7 ++ .../gas/cfi-sframe/cfi-sframe-common-8.d | 20 ++++ .../gas/cfi-sframe/cfi-sframe-common-8.s | 12 +++ .../gas/cfi-sframe/cfi-sframe-x86_64-1.d | 22 +++++ .../gas/cfi-sframe/cfi-sframe-x86_64-1.s | 30 ++++++ gas/testsuite/gas/cfi-sframe/cfi-sframe.exp | 96 +++++++++++++++++++ gas/testsuite/gas/cfi-sframe/common-empty-1.d | 14 +++ gas/testsuite/gas/cfi-sframe/common-empty-1.s | 5 + gas/testsuite/gas/cfi-sframe/common-empty-2.d | 14 +++ gas/testsuite/gas/cfi-sframe/common-empty-2.s | 8 ++ gas/testsuite/gas/cfi-sframe/common-empty-3.d | 14 +++ gas/testsuite/gas/cfi-sframe/common-empty-3.s | 9 ++ gas/testsuite/gas/cfi-sframe/common-empty-4.d | 14 +++ gas/testsuite/gas/cfi-sframe/common-empty-4.s | 17 ++++ 29 files changed, 529 insertions(+) create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-1.d create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-1.s create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.s create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.d create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.s create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.d create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.s create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.d create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.s create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.d create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.s create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.d create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.s create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.d create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.s create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.d create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.s create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.d create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.s create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe.exp create mode 100644 gas/testsuite/gas/cfi-sframe/common-empty-1.d create mode 100644 gas/testsuite/gas/cfi-sframe/common-empty-1.s create mode 100644 gas/testsuite/gas/cfi-sframe/common-empty-2.d create mode 100644 gas/testsuite/gas/cfi-sframe/common-empty-2.s create mode 100644 gas/testsuite/gas/cfi-sframe/common-empty-3.d create mode 100644 gas/testsuite/gas/cfi-sframe/common-empty-3.s create mode 100644 gas/testsuite/gas/cfi-sframe/common-empty-4.d create mode 100644 gas/testsuite/gas/cfi-sframe/common-empty-4.s diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-1.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-1.d new file mode 100644 index 00000000000..aeefbc9cdef --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-1.d @@ -0,0 +1,20 @@ +#as: +#objdump: --sframe=.sframe +#name: SFrame generation on aarch64 +#... +Contents of the SFrame section .sframe: + Header : + + Version: SFRAME_VERSION_1 + Flags: NONE + Num FDEs: 1 + Num FREs: 3 + + Function Index : + + func idx \[0\]: pc = 0x0, size = 80 bytes + STARTPC +CFA +FP +RA + + 0+0000 +sp\+0 +u +u + + 0+0004 +sp\+144 +u +u + + 0+004c +sp\+0 +u +u + +#pass diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-1.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-1.s new file mode 100644 index 00000000000..082c8a32046 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-1.s @@ -0,0 +1,61 @@ + .cfi_sections .sframe + .cfi_startproc + stp x19, x20, [sp, -144]! + .cfi_def_cfa_offset 144 + .cfi_offset 19, -144 + .cfi_offset 20, -136 + stp x21, x22, [sp, 16] + stp x23, x24, [sp, 32] + stp x25, x26, [sp, 48] + stp x27, x28, [sp, 64] + stp d8, d9, [sp, 80] + stp d10, d11, [sp, 96] + stp d12, d13, [sp, 112] + stp d14, d15, [sp, 128] + .cfi_offset 21, -128 + .cfi_offset 22, -120 + .cfi_offset 23, -112 + .cfi_offset 24, -104 + .cfi_offset 25, -96 + .cfi_offset 26, -88 + .cfi_offset 27, -80 + .cfi_offset 28, -72 + .cfi_offset 72, -64 + .cfi_offset 73, -56 + .cfi_offset 74, -48 + .cfi_offset 75, -40 + .cfi_offset 76, -32 + .cfi_offset 77, -24 + .cfi_offset 78, -16 + .cfi_offset 79, -8 + nop + ldp x21, x22, [sp, 16] + ldp x23, x24, [sp, 32] + ldp x25, x26, [sp, 48] + ldp x27, x28, [sp, 64] + ldp d8, d9, [sp, 80] + ldp d10, d11, [sp, 96] + ldp d12, d13, [sp, 112] + ldp d14, d15, [sp, 128] + ldp x19, x20, [sp], 144 + .cfi_restore 20 + .cfi_restore 19 + .cfi_restore 78 + .cfi_restore 79 + .cfi_restore 76 + .cfi_restore 77 + .cfi_restore 74 + .cfi_restore 75 + .cfi_restore 72 + .cfi_restore 73 + .cfi_restore 27 + .cfi_restore 28 + .cfi_restore 25 + .cfi_restore 26 + .cfi_restore 23 + .cfi_restore 24 + .cfi_restore 21 + .cfi_restore 22 + .cfi_def_cfa_offset 0 + ret + .cfi_endproc diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d new file mode 100644 index 00000000000..7d97383bb90 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d @@ -0,0 +1,17 @@ +#as: --gsframe +#objdump: --sframe=.sframe +#name: SFrame generation using CFI directive .cfi_sections +#... +Contents of the SFrame section .sframe: + + Header : + + Version: SFRAME_VERSION_1 + Flags: NONE + Num FDEs: 1 + Num FREs: 1 + + Function Index : + func idx \[0\]: pc = 0x0, size = 0 bytes + STARTPC + CFA + FP + RA + +#pass diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.s new file mode 100644 index 00000000000..ac9c6ca2cf3 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.s @@ -0,0 +1,3 @@ + .cfi_sections .sframe + .cfi_startproc + .cfi_endproc diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.d new file mode 100644 index 00000000000..fc7d5c440db --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.d @@ -0,0 +1,17 @@ +#as: --gsframe +#objdump: --sframe=.sframe +#name: Command line option for generating SFrame +#... +Contents of the SFrame section .sframe: + + Header : + + Version: SFRAME_VERSION_1 + Flags: NONE + Num FDEs: 1 + Num FREs: 1 + + Function Index : + func idx \[0\]: pc = 0x0, size = 0 bytes + STARTPC + CFA + FP + RA + +#pass diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.s new file mode 100644 index 00000000000..659b3b9d99b --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.s @@ -0,0 +1,2 @@ + .cfi_startproc + .cfi_endproc diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.d new file mode 100644 index 00000000000..95954508e3d --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.d @@ -0,0 +1,17 @@ +#as: +#objdump: --sframe=.sframe +#name: SFrame can co-exist with EH Frame +#... +Contents of the SFrame section .sframe: + + Header : + + Version: SFRAME_VERSION_1 + Flags: NONE + Num FDEs: 1 + Num FREs: 1 + + Function Index : + func idx \[0\]: pc = 0x0, size = 0 bytes + STARTPC + CFA + FP + RA + +#pass diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.s new file mode 100644 index 00000000000..36d31fe5348 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.s @@ -0,0 +1,4 @@ + .cfi_sections .eh_frame + .cfi_sections .sframe + .cfi_startproc + .cfi_endproc diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.d new file mode 100644 index 00000000000..b835980ecbd --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.d @@ -0,0 +1,21 @@ +#as: --gsframe +#objdump: --sframe=.sframe +#name: SFrame cfi_def_cfa_offset test +#... +Contents of the SFrame section .sframe: + + Header : + + Version: SFRAME_VERSION_1 + Flags: NONE + Num FDEs: 1 + Num FREs: 3 + + Function Index : + func idx \[0\]: pc = 0x0, size = 12 bytes + STARTPC + CFA + FP + RA + +#... + 0+0004 +sp\+16 +u +u + + 0+0008 +sp\+32 +u +u + + +#pass diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.s new file mode 100644 index 00000000000..0d026bba71a --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.s @@ -0,0 +1,8 @@ +## Testcase for cfi_def_cfa_offset + .cfi_startproc + .long 0 + .cfi_def_cfa_offset 16 + .long 0 + .cfi_def_cfa_offset 32 + .long 0 + .cfi_endproc diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.d new file mode 100644 index 00000000000..d2bef7507c2 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.d @@ -0,0 +1,21 @@ +#as: --gsframe +#objdump: --sframe=.sframe +#name: SFrame cfi_adjust_cfa_offset test +#... +Contents of the SFrame section .sframe: + + Header : + + Version: SFRAME_VERSION_1 + Flags: NONE + Num FDEs: 1 + Num FREs: 3 + + Function Index : + func idx \[0\]: pc = 0x0, size = 12 bytes + STARTPC + CFA + FP + RA + +#... + 0+0004 +sp\+16 +u +u + + 0+0008 +sp\+24 +u +u + + +#pass diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.s new file mode 100644 index 00000000000..c985c39af9d --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.s @@ -0,0 +1,7 @@ + .cfi_startproc + .long 0 + .cfi_def_cfa_offset 16 + .long 0 + .cfi_adjust_cfa_offset 8 + .long 0 + .cfi_endproc diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.d new file mode 100644 index 00000000000..f915ac5f234 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.d @@ -0,0 +1,21 @@ +#as: --gsframe +#objdump: --sframe=.sframe +#name: SFrame cfi_offset test +#... +Contents of the SFrame section .sframe: + + Header : + + Version: SFRAME_VERSION_1 + Flags: NONE + Num FDEs: 1 + Num FREs: 3 + + Function Index : + func idx \[0\]: pc = 0x0, size = 12 bytes + STARTPC + CFA + FP + RA + +#... + 0+0004 +sp\+8 +u +u + + 0+0008 +sp\+8 +u +u + + +#pass diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.s new file mode 100644 index 00000000000..389f324dc5f --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.s @@ -0,0 +1,7 @@ + .cfi_startproc + .long 0 + .cfi_def_cfa_offset 8 + .long 0 + .cfi_offset 0, 8 + .long 0 + .cfi_endproc diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.d new file mode 100644 index 00000000000..cab19d5bc25 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.d @@ -0,0 +1,21 @@ +#as: --gsframe +#objdump: --sframe=.sframe +#name: SFrame cfi_rel_offset test +#... +Contents of the SFrame section .sframe: + + Header : + + Version: SFRAME_VERSION_1 + Flags: NONE + Num FDEs: 1 + Num FREs: 3 + + Function Index : + func idx \[0\]: pc = 0x0, size = 12 bytes + STARTPC + CFA + FP + RA + +#... + 0+0004 +sp\+8 +u +u + + 0+0008 +sp\+8 +u +u + + +#pass diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.s new file mode 100644 index 00000000000..21fa031fb30 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.s @@ -0,0 +1,7 @@ + .cfi_startproc + .long 0 + .cfi_def_cfa_offset 8 + .long 0 + .cfi_rel_offset 1, 8 + .long 0 + .cfi_endproc diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.d new file mode 100644 index 00000000000..c0a4a8de250 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.d @@ -0,0 +1,20 @@ +#as: --gsframe +#objdump: --sframe=.sframe +#name: SFrame cfi_val_offset test +#... +Contents of the SFrame section .sframe: + + Header : + + Version: SFRAME_VERSION_1 + Flags: NONE + Num FDEs: 1 + Num FREs: 2 + + Function Index : + func idx \[0\]: pc = 0x0, size = 8 bytes + STARTPC + CFA + FP + RA + +#... + 0+0004 +sp\+16 +u +u + + +#pass diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.s new file mode 100644 index 00000000000..f2083e6a106 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.s @@ -0,0 +1,12 @@ +## cfi_val_offset when used with "not interesting" registers (from the +## perspective of SFrame section, non FP/RA registers are not +## interesting) does not affect the asynchronicity of the SFrame +## unwind information. Such CFI directives can be skipped for SFrame +## unwind info generation. + .cfi_startproc + .long 0 + .cfi_def_cfa_offset 16 + .cfi_val_offset 1, 8 + .cfi_val_offset 2, -32 + .long 0 + .cfi_endproc diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.d b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.d new file mode 100644 index 00000000000..bba3b5920f1 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.d @@ -0,0 +1,22 @@ +#as: -O0 +#objdump: --sframe=.sframe +#name: SFrame generation on x86_64 +#... +Contents of the SFrame section .sframe: + + Header : + + Version: SFRAME_VERSION_1 + Flags: NONE + Num FDEs: 1 + Num FREs: 4 + + Function Index : + + func idx \[0\]: pc = 0x0, size = 25 bytes + STARTPC +CFA +FP +RA + + 0+0000 +sp\+8 +u +u + + 0+0001 +sp\+16 +c\-16 +u + + 0+0004 +fp\+16 +c\-16 +u + + 0+0018 +sp\+8 +c\-16 +u + +#pass diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.s b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.s new file mode 100644 index 00000000000..77f3578f0d8 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.s @@ -0,0 +1,30 @@ + .cfi_sections .sframe + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + movq %rsp, %rbp + .cfi_def_cfa_register 6 + pushq %r15 + pushq %r14 + pushq %r13 + pushq %r12 + pushq %rbx + ## These CFI opcodes are not interesting + ## for SFrame generation and will be + ## skipped. + .cfi_offset 15, -24 + .cfi_offset 14, -32 + .cfi_offset 13, -40 + .cfi_offset 12, -48 + .cfi_offset 3, -56 + nop + popq %rbx + popq %r12 + popq %r13 + popq %r14 + popq %r15 + popq %rbp + .cfi_def_cfa 7, 8 + ret + .cfi_endproc diff --git a/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp b/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp new file mode 100644 index 00000000000..7a8e6e10ce4 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/cfi-sframe.exp @@ -0,0 +1,96 @@ +# Copyright (C) 2022 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + +if { ![is_elf_format] } then { + return +} + +proc gas_sframe_check { } { + global check_as_sframe_result + global AS + global ASFLAGS + if [info exists check_as_sframe_result] { + return $check_as_sframe_result + } + + set as_file "tmpdir/check_as_sframe.s" + set as_fh [open $as_file w 0666] + puts $as_fh "# Generated file. DO NOT EDIT" + puts $as_fh "\t.cfi_startproc" + puts $as_fh "\t.cfi_endproc" + close $as_fh + remote_download host $as_file + verbose -log "Checking SFrame support in AS:" + + set old_ASFLAGS "$ASFLAGS" + set ASFLAGS "$ASFLAGS --gsframe" + + global comp_output + + set output_file "tmpdir/check_as_sframe.out" + set status [gas_host_run "$AS $ASFLAGS $as_file" "2>$output_file"] + set comp_output [file_contents "$output_file"] + set ASFLAGS "$old_ASFLAGS" + + if { ![string match "" $comp_output] + || [string match "*sframe not supported for target*" $comp_output] } then { + verbose -log "SFrame not supported in AS" + return 0 + } else { + verbose -log "SFrame supported in AS" + return 1 + } +} + +proc gas_x86_64_check { } { + global NM + global NMFLAGS + + set status [gas_host_run "$NM $NMFLAGS --help" ""] + return [regexp "targets:.*x86-64" [lindex $status 1]]; +} + +if { ([istarget "x86_64-*-*"] || [istarget "aarch64*-*-*"]) \ + && [gas_sframe_check] } then { + + global ASFLAGS + set old_ASFLAGS "$ASFLAGS" + + run_dump_test "cfi-sframe-common-1" + run_dump_test "cfi-sframe-common-2" + run_dump_test "cfi-sframe-common-3" + run_dump_test "cfi-sframe-common-4" + run_dump_test "cfi-sframe-common-5" + run_dump_test "cfi-sframe-common-6" + run_dump_test "cfi-sframe-common-7" + run_dump_test "cfi-sframe-common-8" + + run_dump_test "common-empty-1" + run_dump_test "common-empty-2" + run_dump_test "common-empty-3" + run_dump_test "common-empty-4" + + if { [gas_x86_64_check] } then { + set ASFLAGS "$ASFLAGS --64" + run_dump_test "cfi-sframe-x86_64-1" + set ASFLAGS "$old_ASFLAGS" + } +} + +# aarch64 specific tests +if { [istarget "aarch64*-*-*"] && [gas_sframe_check] } then { + run_dump_test "cfi-sframe-aarch64-1" +} diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-1.d b/gas/testsuite/gas/cfi-sframe/common-empty-1.d new file mode 100644 index 00000000000..0b09799826c --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/common-empty-1.d @@ -0,0 +1,14 @@ +#as: --gsframe +#objdump: --sframe=.sframe +#name: Uninteresting cfi directives generate an empty SFrame section +#... +Contents of the SFrame section .sframe: + + Header : + + Version: SFRAME_VERSION_1 + Flags: NONE + Num FDEs: 0 + Num FREs: 0 + +#pass diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-1.s b/gas/testsuite/gas/cfi-sframe/common-empty-1.s new file mode 100644 index 00000000000..e26e998189f --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/common-empty-1.s @@ -0,0 +1,5 @@ + .cfi_sections .sframe + .cfi_startproc + .cfi_remember_state + .cfi_restore_state + .cfi_endproc diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-2.d b/gas/testsuite/gas/cfi-sframe/common-empty-2.d new file mode 100644 index 00000000000..e566c078249 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/common-empty-2.d @@ -0,0 +1,14 @@ +#as: --gsframe +#objdump: --sframe=.sframe +#name: SFrame supports only FP/SP based CFA +#... +Contents of the SFrame section .sframe: + + Header : + + Version: SFRAME_VERSION_1 + Flags: NONE + Num FDEs: 0 + Num FREs: 0 + +#pass diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-2.s b/gas/testsuite/gas/cfi-sframe/common-empty-2.s new file mode 100644 index 00000000000..146c53de785 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/common-empty-2.s @@ -0,0 +1,8 @@ +## CFA register is not defined to be SP/FP. +## No SFrame unwind info for this function will be generated. + .cfi_startproc simple + .long 0 + .long 0 + .cfi_adjust_cfa_offset 16 + .long 0 + .cfi_endproc diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-3.d b/gas/testsuite/gas/cfi-sframe/common-empty-3.d new file mode 100644 index 00000000000..f7a6062d392 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/common-empty-3.d @@ -0,0 +1,14 @@ +#as: --gsframe +#objdump: --sframe=.sframe +#name: SFrame supports only default return column +#... +Contents of the SFrame section .sframe: + + Header : + + Version: SFRAME_VERSION_1 + Flags: NONE + Num FDEs: 0 + Num FREs: 0 + +#pass diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-3.s b/gas/testsuite/gas/cfi-sframe/common-empty-3.s new file mode 100644 index 00000000000..982fe0c851d --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/common-empty-3.s @@ -0,0 +1,9 @@ +## The return column is not the default value. +## No SFrame unwind info for this function will be generated. + .cfi_startproc + .cfi_return_column 0 + .long 0 + .long 0 + .cfi_adjust_cfa_offset 16 + .long 0 + .cfi_endproc diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-4.d b/gas/testsuite/gas/cfi-sframe/common-empty-4.d new file mode 100644 index 00000000000..f7a6062d392 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/common-empty-4.d @@ -0,0 +1,14 @@ +#as: --gsframe +#objdump: --sframe=.sframe +#name: SFrame supports only default return column +#... +Contents of the SFrame section .sframe: + + Header : + + Version: SFRAME_VERSION_1 + Flags: NONE + Num FDEs: 0 + Num FREs: 0 + +#pass diff --git a/gas/testsuite/gas/cfi-sframe/common-empty-4.s b/gas/testsuite/gas/cfi-sframe/common-empty-4.s new file mode 100644 index 00000000000..f97ca2f7ff9 --- /dev/null +++ b/gas/testsuite/gas/cfi-sframe/common-empty-4.s @@ -0,0 +1,17 @@ +## ARMv8.3 addded support a new security feature named Pointer Authentication. The +## main idea behind this is to use the unused bits in the pointer values. +## Each pointer is patched with a PAC before writing to memory, and is verified +## before using it. +## When the pointers are mangled, the unwinder needs to know so it can mask off +## the PAC from the pointer value to recover the return address, and +## conversely, skip doing so if the pointers are not mangled. +## +## .cfi_negate_ra_state CFI directive is used to convey this information. +## +## SFrame does not have any means to represent this information at this time. + .cfi_startproc + .long 0 + .cfi_def_cfa_offset 16 + .cfi_negate_ra_state + .long 0 + .cfi_endproc From patchwork Sun Oct 30 07:44:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 12955 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1686465wru; Sun, 30 Oct 2022 00:49:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5LSTBMTO6iE9dURrL8GCQAipybzXWwLHp0TEfbJksINZrpQVgOR8CUVmiDpV7bRfe51S16 X-Received: by 2002:a17:907:7637:b0:7ad:b869:2cc7 with SMTP id jy23-20020a170907763700b007adb8692cc7mr4113227ejc.159.1667116171551; Sun, 30 Oct 2022 00:49:31 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id q10-20020a056402518a00b0045d8bff7b1asi4679276edd.403.2022.10.30.00.49.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 00:49:31 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=VYCBSNsB; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 130FF3895FC2 for ; Sun, 30 Oct 2022 07:47:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 130FF3895FC2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667116066; bh=AZVj4P/dmrX3gyBvPheiWs/uQRcA7yOfhTg72VPS5Bo=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=VYCBSNsBogS8awDb93ByCdXp5q0bN/48D5AZmWO3bXjX94LJGE0uus6+om4XyKxGq 57VQFA6bRv9ZIgN8C9YTWg9xbinMVqRhgS6fvV/R7YG2NOjJeEDvLOl3Gp6h1atlTH KYdEYd9fMSpnRw21fgoQLgIDruyFGXnZlH0C9SFk= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 754723857370 for ; Sun, 30 Oct 2022 07:45:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 754723857370 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29U3bNNv012135 for ; Sun, 30 Oct 2022 07:45:40 GMT Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgusshc4j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:45:39 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 29U744vu023921 for ; Sun, 30 Oct 2022 07:45:38 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2168.outbound.protection.outlook.com [104.47.59.168]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kgtm29err-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:45:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R6Tc1Dnx21h9pcNLgXEwdZB+QdpovfLOqjxyCYHFMg4jJPafTi3eBL8XnR6NE32MdXPTfBhLXtAe50Z/nxI/jVbulSdbsBxiA/+eWD2BZREVE6PqJc1XcRwEvQnA+QsaHrnVYpbPCJJH+q6P9yK6gLUovxXTlC9WMAk7XjiNpZIymne4zrRK5oYTRT/ysHtK2g7j9HBdFhOqBM1Fwi5TviCoGRI9xVbfSHH/t6zFgvRlkyFouq37Nvz5ZUWTgCLqAPZC1iVH6TUBl+puHnB5ToVSLcExkpl4bOnw0usAfKlXLTrmvDur+g6TXrxeHpiNXlKpbD2qp7ZAdHv/vIITXQ== 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=AZVj4P/dmrX3gyBvPheiWs/uQRcA7yOfhTg72VPS5Bo=; b=iFAhz1kzAq0Ux1Ai9XazgCh4vILVMiqtNgRE+W+JPhPCjdQmQw9ACy7IlJcF3Wa4ASv/FTJluuLb4CKsn75e6XHASMQatZc83+jhLCk+zu70OscwrhvGgZfqXTmy6LhNmFF0UCovKypitrxOu+5AxyGvu+ooUkZobh+6wj9VYYbKB1jCHs9Icef7v30t8Zbf+mIFLgvyWeca1qyjjCghB6HtrvKdJ/BkHqAcKYZu4rLDT6rRFC6h4Rt2jsnDZ99i7/Zc/8/Xeeia3onjmDs3PKUGnRnoDqvaQJQApMFQ4auWhOSxgfQQ6q8TRb/nY57DvgqkzbfOdZY2FH2ELVzysw== 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 MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by BY5PR10MB4289.namprd10.prod.outlook.com (2603:10b6:a03:20c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.19; Sun, 30 Oct 2022 07:45:30 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2%7]) with mapi id 15.20.5723.033; Sun, 30 Oct 2022 07:45:30 +0000 To: binutils@sourceware.org Subject: [PATCH,V3 05/15] libsframe: add the SFrame library Date: Sun, 30 Oct 2022 00:44:40 -0700 Message-Id: <20221030074450.1956074-6-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221030074450.1956074-1-indu.bhagat@oracle.com> References: <20221030074450.1956074-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4P220CA0014.NAMP220.PROD.OUTLOOK.COM (2603:10b6:303:115::19) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|BY5PR10MB4289:EE_ X-MS-Office365-Filtering-Correlation-Id: 421f060d-e0b3-4b2b-88bf-08daba4ab7cc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /L4b4PrK9/KOuzYpBmxVLn0FbeiGWKL2tR+o0Tmdv2nfQ29H7vngnJ8uLLdBBPPIzR5O7BPVM9EF79F4u0FNrulcePxzhXOgoEVsJko2IcF0TeGRqC3+AltHq684qtgn9H+kz/vh+kEYdsmZv2OpgKHp53DEV7g+bOwGpd87fMxK1AFCd5WUKHHxfoPRrY/x4JFG2IAtmo2IoAf+9v/hgOsampCxEYPR5Mzh2/Z0YefhflEMV4qoA5OyfiFhxyo42yJInBwNg0ftvIkqkn9ovav3hzjA48WMJsx4qKtStcDXpqLjUjfgCYMEEmG2YYkxdwMYyF6Kqd0z9FQsRsrmrayAtAB1cd/IE5ZZ1wKryeZIlE2xndqj16TTIlKBUamXxSvFDXnyr9zAo5OwMEaFdBLb8E5Kn2+yakIkHrD9Gd94dBQHz73DXzMHzPf3x003x3cCM6IFUrQ2Rx+daLz4LLxFAqKI0Ycw3HEkkqHGyoO56B6JhPEy5bVXUZetWyeQcJeTATpuFph5Y19NK9PP/w9QAo+g9W+Cb38+J/yuAK3Dzb5aAP9TTbRlWlocwbdqzjReCbD9A7+PhYs3HxiShyb6CrRNh8iDgNUO9LUlDakzcrrOCLDtZXRz+lltZyryUJkLhrYBIx0Obg00m7uRjHnSbFgHL15NmB7ohuf6P0q9UgwavG7CYUODwyhbdySjTPbNqRfs0/vYCQtn0OJUM25s6YGGmKC3U3Fy7JGKWCO5cUSohgamz8PXwbFB8n/N4Ht4u96Lz1Si/TFZxe1IubfxZQ06Y5WoP8V0HUufcUfh0dVAiHD9j8IVengchXfUD+RiYPpzqpoC2dHJPdu0tN9+PkKaBcjdlDoV7+3FYD7LUTrKXs7605KJz8XIw99X X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2158.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(366004)(39850400004)(376002)(346002)(136003)(451199015)(316002)(66556008)(4326008)(66476007)(45080400002)(36756003)(6916009)(66946007)(66899015)(30864003)(6486002)(38100700002)(6666004)(8936002)(41300700001)(966005)(86362001)(107886003)(478600001)(15188155005)(84970400001)(5660300002)(1076003)(16799955002)(186003)(83380400001)(8676002)(2616005)(44832011)(2906002)(6512007)(6506007)(2004002)(547064002)(579004)(559001)(19623215001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xQjv0h1KRBOivtwRNLCFoPfjq8v+2L9mq4b2qOxVUaf9Ttk58AJ+dqUHbNKfKWDBEeOxd76Qv+x5BvF+j/r3iBt5v2oFAmzk3Y2HeLsSQpaqp+bW9JCgLWinHGDWhb2PJMCInhh0TfJ7tKNL2LUUjNY8quW+a1ELV7qaupCcLvgvo8N5PMEmTUYNf5q7bsHn21Brn0G7s5536YedAWeZXDh9a23/vYvIUFTUYYuK+QHJ/uWQBSdDYU46nT4W+lc96IQjmy88TSwmZHn0JtQnWVam5WOD61fja7+aIIwBnm3EaozjM53HvxwccAaMEjGZNVYs+qcb+qgVd/14DhMZnO7PGw+udhV++SNMFGRKlJWTiTnU4cuGLJPEaWQ51HmnBu3Zafksad/fclgjbuOvoi8aQoWxm8ch/hpARIEJLvqF4b4Sf//MUtsUfNSqvjpuH5saKfLBJorPp4ItKYk3fWPwgQKDtjNwlEiCfH6/R/0LtTvk9eomQ10jSDIc3JXSvfL1dfTaobMK50VAtczsnS2RkYPbt8XVnKybjPh8ztUeYtNB22QK+HSYZ1luT/nJXNPcGG5pJ+EJx3Hku8CcNLu++u+VoD8uOw0qHbvf+9s6YxofQVmPPwVKObvqdTTlpdEix45prIXbJf7mIfEhyMtZ8wDo95Menw94wPaSHayPiF6oM+Dt9wNw3EVIqBZHfWrKkaLTqeIVfH0RpDxTh1E0zg7KTu6iCX3gOomhsusGgknZjWMYTXxDTfsVReaqerUum4x3aYY6uWoQAyBS4CVdut5bGyuE9lEPI63n4F586x9K7smiW3kTFYdeltDtW7OIp4SuyTrHDs7vWGPFF69MU27HtZAuPm9HM8/YkgmwDMjpka9YQ+WZPwICYaZqaD39QM+lC4gEy8TJuTgVL7xbhzfkREqX0mqXuIW6u2JV5syMafnyLMYwjHs1JNGGYyIK9gYCuwvbVoA36KlymZie1irUxnpxkP2lqHnrdwtvIP3z1sgOSPAWl8royhq4xRfFCfpfckbRSAn5f7RCAiqOdj697cuHpZ10fac1uC6YWO2b8FFLaEqlM3kNo0rmKAqtHrlWcq9qENEp+YjDkHfYKhpvmCWQcezOGO2JO6RBx/31pTFYD7hEVNAZpu4/KklTod5VrRdA7IBrVzRYxFgEGLX6BwP9lIItwdrVeu9ODJ+ZyzfEz3iU4Nm/Q5nM3o72tnoVUI8Xtod3tuGvw7vQGyDcr+cZefMJkkaE4YtTtXfbsrsOQytCJsS8VlT9G3VFTn0n96DrhyonJKyijXHjd03nvb/lSruot1YYymVJ1vzUWd6WtS8UJL3btiA/7PPQwN9G12H6FINlfrInYy/S7RIu6NBOtycUGic5REIh1Xdq4I3WScCaXyBpVJcuv8ozdAWfPuZ36dvOpkqbeu6d0/leW6ctu2oGGUmbR51Vw5PmcCs7eUM3qWvj22LqPM5Oep0NGx4t5wtoEBj/TEBzoiJ5NlSMdQS8D7+TEo7mAxrd2xOEKcr4EBeEa0mdzWf5pfiGKtLLSpytNDDIM+T9JGxaT/ctfdv00jpkMKA1I8yVo05rd8N4zj6K+H9C16g9jugqLkoeqa/vpq0r630v5yOolNPxI51ARdwdgzM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 421f060d-e0b3-4b2b-88bf-08daba4ab7cc X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2022 07:45:30.3608 (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: h2i79OOHRSTYqWDPhFHmSdFRs/cgG3Q1WJTwGnpNPm8724RQuoiFpvqD01Ae0YdAWsxrX8ZJf2Auo/OsQiIFjA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4289 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-30_02,2022-10-27_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2210300049 X-Proofpoint-ORIG-GUID: PcFvNgY0oAm73aNrF4voUVbonq93wGiF X-Proofpoint-GUID: PcFvNgY0oAm73aNrF4voUVbonq93wGiF X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Indu Bhagat via Binutils From: Indu Bhagat Reply-To: Indu Bhagat Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748098006823656782?= X-GMAIL-MSGID: =?utf-8?q?1748098006823656782?= From: Weimin Pan [Changes in V3] - Address buildsystem related review comments by Mike Frysinger. - Removed usage of "error.h" from libsframe. - sframe_encode () API has explicit arguments for the fixed RA and fixed FP offsets. - testsuite: some bugfixes, and minor fixups for readability. [End of changes in V3] [Changes in V2] - Several bugfixes for issues uncovered with testing with --target=aarch64_be-linux-gnu. Most of the issues seen were in the endian-flipping code. - Bugfix and minor adjustments around libsframe error messages. - Support for auxilliary SFrame header field. - The libsframe testsuite has had some improvements as well: - Testsuite now checks for a compatible dejagnu gcc pair before attempting to run the testsuite. libsframe testsuite uses dejagnu.h and was running into https://lists.gnu.org/archive/html/dejagnu/2014-10/msg00011.html [End of changes in V2] libsframe is a library that allows you to: - decode a .sframe section - probe and inspect a .sframe section - encode (and eventually write) a .sframe section. This library is currently being used by the linker, readelf, objdump and the unwinder. The file include/sframe-api.h defines the user-facing APIs for decoding, encoding and probing .sframe sections. A set of error codes together with their error message strings are also defined. Endian flipping is performed automatically at read and write time, if cross-endianness is detected. PS: libsframe/configure has NOT been included in the patch. Please regenerate. ChangeLog: * Makefile.def: Add libsframe as new module with its dependencies. * Makefile.in: Regenerated. * binutils/Makefile.am: Add libsframe. * binutils/Makefile.in: Regenerated. * configure: Regenerated * configure.ac: Add libsframe to host_libs. * libsframe/Makefile.am: New file. * libsframe/Makefile.in: New file. * libsframe/aclocal.m4: New file. * libsframe/config.h.in: New file. * libsframe/configure: New file. <-- [REMOVED FROM THE PATCH. PLEASE REGENERATE. ] * libsframe/configure.ac: New file. * libsframe/sframe-error.c: New file. * libsframe/sframe-impl.h: New file. * libsframe/sframe.c: New file. include/ChangeLog: * sframe-api.h: New file. testsuite/ChangeLog: * libsframe/testsuite/Makefile.am: New file. * libsframe/testsuite/Makefile.in: Regenerated. * libsframe/testsuite/libsframe.decode/Makefile.am: New file. * libsframe/testsuite/libsframe.decode/Makefile.in: Regenerated. * libsframe/testsuite/libsframe.decode/decode.exp: New file. * libsframe/testsuite/libsframe.encode/Makefile.am: Likewise. * libsframe/testsuite/libsframe.encode/Makefile.in: Regenerated. * libsframe/testsuite/libsframe.encode/encode.exp: New file. * libsframe/testsuite/libsframe.encode/encode-1.c: Likewise. * libsframe/testsuite/libsframe.decode/be-flipping.c: Likewise. * libsframe/testsuite/libsframe.decode/frecnt-1.c: Likewise. * libsframe/testsuite/libsframe.decode/frecnt-2.c: Likewise. * libsframe/testsuite/libsframe.decode/DATA-BE: New file. * libsframe/testsuite/libsframe.decode/DATA1: Likewise. * libsframe/testsuite/libsframe.decode/DATA2: Likewise. --- Makefile.def | 2 + Makefile.in | 1288 ++++++++++++- binutils/Makefile.am | 2 + binutils/Makefile.in | 1 + config/dejagnu.m4 | 22 + configure | 2 +- configure.ac | 2 +- include/sframe-api.h | 231 +++ libsframe/Makefile.am | 39 + libsframe/Makefile.in | 1158 ++++++++++++ libsframe/aclocal.m4 | 1242 ++++++++++++ libsframe/config.h.in | 132 ++ libsframe/configure.ac | 75 + libsframe/sframe-error.c | 49 + libsframe/sframe-impl.h | 55 + libsframe/sframe.c | 1657 +++++++++++++++++ libsframe/testsuite/config/default.exp | 54 + libsframe/testsuite/libsframe.decode/DATA-BE | Bin 0 -> 64 bytes libsframe/testsuite/libsframe.decode/DATA1 | Bin 0 -> 60 bytes libsframe/testsuite/libsframe.decode/DATA2 | Bin 0 -> 92 bytes .../testsuite/libsframe.decode/be-flipping.c | 115 ++ .../testsuite/libsframe.decode/decode.exp | 50 + .../testsuite/libsframe.decode/frecnt-1.c | 99 + .../testsuite/libsframe.decode/frecnt-2.c | 104 ++ libsframe/testsuite/libsframe.decode/local.mk | 16 + .../testsuite/libsframe.encode/encode-1.c | 177 ++ .../testsuite/libsframe.encode/encode.exp | 37 + libsframe/testsuite/libsframe.encode/local.mk | 7 + libsframe/testsuite/local.mk | 24 + 29 files changed, 6633 insertions(+), 7 deletions(-) create mode 100644 config/dejagnu.m4 create mode 100644 include/sframe-api.h create mode 100644 libsframe/Makefile.am create mode 100644 libsframe/Makefile.in create mode 100644 libsframe/aclocal.m4 create mode 100644 libsframe/config.h.in create mode 100644 libsframe/configure.ac create mode 100644 libsframe/sframe-error.c create mode 100644 libsframe/sframe-impl.h create mode 100644 libsframe/sframe.c create mode 100644 libsframe/testsuite/config/default.exp create mode 100644 libsframe/testsuite/libsframe.decode/DATA-BE create mode 100644 libsframe/testsuite/libsframe.decode/DATA1 create mode 100644 libsframe/testsuite/libsframe.decode/DATA2 create mode 100644 libsframe/testsuite/libsframe.decode/be-flipping.c create mode 100644 libsframe/testsuite/libsframe.decode/decode.exp create mode 100644 libsframe/testsuite/libsframe.decode/frecnt-1.c create mode 100644 libsframe/testsuite/libsframe.decode/frecnt-2.c create mode 100644 libsframe/testsuite/libsframe.decode/local.mk create mode 100644 libsframe/testsuite/libsframe.encode/encode-1.c create mode 100644 libsframe/testsuite/libsframe.encode/encode.exp create mode 100644 libsframe/testsuite/libsframe.encode/local.mk create mode 100644 libsframe/testsuite/local.mk new file mode 100644 index 0000000000000000000000000000000000000000..2b3ef8e4e727ac30c993903a320698bbd6e098b9 GIT binary patch literal 60 zcmaEKkCBm?;RgdF0|NsK5c2~u2nYgk+K2!DrNKOi90LP02P3P%2No8A4^pfg9{?Oh B35Eaw literal 0 HcmV?d00001 new file mode 100644 index 00000000000..d915f9bb278 diff --git a/Makefile.def b/Makefile.def index acdcd625ed6..1b39c910447 100644 --- a/Makefile.def +++ b/Makefile.def @@ -149,6 +149,7 @@ host_modules= { module= lto-plugin; bootstrap=true; host_modules= { module= libcc1; extra_configure_flags=--enable-shared; }; host_modules= { module= gotools; }; host_modules= { module= libctf; bootstrap=true; }; +host_modules= { module= libsframe; bootstrap=true; }; target_modules = { module= libstdc++-v3; bootstrap=true; @@ -478,6 +479,7 @@ dependencies = { module=all-binutils; on=all-intl; }; dependencies = { module=all-binutils; on=all-gas; }; dependencies = { module=all-binutils; on=all-libctf; }; dependencies = { module=all-ld; on=all-libctf; }; +dependencies = { module=all-binutils; on=all-libsframe; }; // We put install-opcodes before install-binutils because the installed // binutils might be on PATH, and they might need the shared opcodes diff --git a/Makefile.in b/Makefile.in index cb39e4790d6..b26f778a94a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1109,7 +1109,8 @@ configure-host: \ maybe-configure-lto-plugin \ maybe-configure-libcc1 \ maybe-configure-gotools \ - maybe-configure-libctf + maybe-configure-libctf \ + maybe-configure-libsframe .PHONY: configure-target configure-target: \ maybe-configure-target-libstdc++-v3 \ @@ -1290,6 +1291,9 @@ all-host: maybe-all-gotools @if libctf-no-bootstrap all-host: maybe-all-libctf @endif libctf-no-bootstrap +@if libsframe-no-bootstrap +all-host: maybe-all-libsframe +@endif libsframe-no-bootstrap .PHONY: all-target @@ -1396,6 +1400,7 @@ info-host: maybe-info-lto-plugin info-host: maybe-info-libcc1 info-host: maybe-info-gotools info-host: maybe-info-libctf +info-host: maybe-info-libsframe .PHONY: info-target @@ -1487,6 +1492,7 @@ dvi-host: maybe-dvi-lto-plugin dvi-host: maybe-dvi-libcc1 dvi-host: maybe-dvi-gotools dvi-host: maybe-dvi-libctf +dvi-host: maybe-dvi-libsframe .PHONY: dvi-target @@ -1578,6 +1584,7 @@ pdf-host: maybe-pdf-lto-plugin pdf-host: maybe-pdf-libcc1 pdf-host: maybe-pdf-gotools pdf-host: maybe-pdf-libctf +pdf-host: maybe-pdf-libsframe .PHONY: pdf-target @@ -1669,6 +1676,7 @@ html-host: maybe-html-lto-plugin html-host: maybe-html-libcc1 html-host: maybe-html-gotools html-host: maybe-html-libctf +html-host: maybe-html-libsframe .PHONY: html-target @@ -1760,6 +1768,7 @@ TAGS-host: maybe-TAGS-lto-plugin TAGS-host: maybe-TAGS-libcc1 TAGS-host: maybe-TAGS-gotools TAGS-host: maybe-TAGS-libctf +TAGS-host: maybe-TAGS-libsframe .PHONY: TAGS-target @@ -1851,6 +1860,7 @@ install-info-host: maybe-install-info-lto-plugin install-info-host: maybe-install-info-libcc1 install-info-host: maybe-install-info-gotools install-info-host: maybe-install-info-libctf +install-info-host: maybe-install-info-libsframe .PHONY: install-info-target @@ -1942,6 +1952,7 @@ install-dvi-host: maybe-install-dvi-lto-plugin install-dvi-host: maybe-install-dvi-libcc1 install-dvi-host: maybe-install-dvi-gotools install-dvi-host: maybe-install-dvi-libctf +install-dvi-host: maybe-install-dvi-libsframe .PHONY: install-dvi-target @@ -2033,6 +2044,7 @@ install-pdf-host: maybe-install-pdf-lto-plugin install-pdf-host: maybe-install-pdf-libcc1 install-pdf-host: maybe-install-pdf-gotools install-pdf-host: maybe-install-pdf-libctf +install-pdf-host: maybe-install-pdf-libsframe .PHONY: install-pdf-target @@ -2124,6 +2136,7 @@ install-html-host: maybe-install-html-lto-plugin install-html-host: maybe-install-html-libcc1 install-html-host: maybe-install-html-gotools install-html-host: maybe-install-html-libctf +install-html-host: maybe-install-html-libsframe .PHONY: install-html-target @@ -2215,6 +2228,7 @@ installcheck-host: maybe-installcheck-lto-plugin installcheck-host: maybe-installcheck-libcc1 installcheck-host: maybe-installcheck-gotools installcheck-host: maybe-installcheck-libctf +installcheck-host: maybe-installcheck-libsframe .PHONY: installcheck-target @@ -2306,6 +2320,7 @@ mostlyclean-host: maybe-mostlyclean-lto-plugin mostlyclean-host: maybe-mostlyclean-libcc1 mostlyclean-host: maybe-mostlyclean-gotools mostlyclean-host: maybe-mostlyclean-libctf +mostlyclean-host: maybe-mostlyclean-libsframe .PHONY: mostlyclean-target @@ -2397,6 +2412,7 @@ clean-host: maybe-clean-lto-plugin clean-host: maybe-clean-libcc1 clean-host: maybe-clean-gotools clean-host: maybe-clean-libctf +clean-host: maybe-clean-libsframe .PHONY: clean-target @@ -2488,6 +2504,7 @@ distclean-host: maybe-distclean-lto-plugin distclean-host: maybe-distclean-libcc1 distclean-host: maybe-distclean-gotools distclean-host: maybe-distclean-libctf +distclean-host: maybe-distclean-libsframe .PHONY: distclean-target @@ -2579,6 +2596,7 @@ maintainer-clean-host: maybe-maintainer-clean-lto-plugin maintainer-clean-host: maybe-maintainer-clean-libcc1 maintainer-clean-host: maybe-maintainer-clean-gotools maintainer-clean-host: maybe-maintainer-clean-libctf +maintainer-clean-host: maybe-maintainer-clean-libsframe .PHONY: maintainer-clean-target @@ -2727,7 +2745,8 @@ check-host: \ maybe-check-lto-plugin \ maybe-check-libcc1 \ maybe-check-gotools \ - maybe-check-libctf + maybe-check-libctf \ + maybe-check-libsframe .PHONY: check-target check-target: \ @@ -2865,7 +2884,8 @@ install-host-nogcc: \ maybe-install-lto-plugin \ maybe-install-libcc1 \ maybe-install-gotools \ - maybe-install-libctf + maybe-install-libctf \ + maybe-install-libsframe .PHONY: install-host install-host: \ @@ -2921,7 +2941,8 @@ install-host: \ maybe-install-lto-plugin \ maybe-install-libcc1 \ maybe-install-gotools \ - maybe-install-libctf + maybe-install-libctf \ + maybe-install-libsframe .PHONY: install-target install-target: \ @@ -3032,7 +3053,8 @@ install-strip-host: \ maybe-install-strip-lto-plugin \ maybe-install-strip-libcc1 \ maybe-install-strip-gotools \ - maybe-install-strip-libctf + maybe-install-strip-libctf \ + maybe-install-strip-libsframe .PHONY: install-strip-target install-strip-target: \ @@ -44044,6 +44066,1146 @@ maintainer-clean-libctf: +.PHONY: configure-libsframe maybe-configure-libsframe +maybe-configure-libsframe: +@if gcc-bootstrap +configure-libsframe: stage_current +@endif gcc-bootstrap +@if libsframe +maybe-configure-libsframe: configure-libsframe +configure-libsframe: + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/libsframe/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libsframe; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/libsframe; \ + cd "$(HOST_SUBDIR)/libsframe" || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libsframe/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + module_srcdir=libsframe; \ + $(SHELL) \ + $$s/$$module_srcdir/configure \ + --srcdir=$${topdir}/$$module_srcdir \ + $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ + --target=${target_alias} \ + || exit 1 +@endif libsframe + + + +.PHONY: configure-stage1-libsframe maybe-configure-stage1-libsframe +maybe-configure-stage1-libsframe: +@if libsframe-bootstrap +maybe-configure-stage1-libsframe: configure-stage1-libsframe +configure-stage1-libsframe: + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libsframe + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGE1_TFLAGS)"; \ + test ! -f $(HOST_SUBDIR)/libsframe/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + CFLAGS="$(STAGE1_CFLAGS)"; export CFLAGS; \ + CXXFLAGS="$(STAGE1_CXXFLAGS)"; export CXXFLAGS; \ + LIBCFLAGS="$(LIBCFLAGS)"; export LIBCFLAGS; \ + echo Configuring stage 1 in $(HOST_SUBDIR)/libsframe; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libsframe; \ + cd $(HOST_SUBDIR)/libsframe || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libsframe/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + module_srcdir=libsframe; \ + $(SHELL) $$s/$$module_srcdir/configure \ + --srcdir=$${topdir}/$$module_srcdir \ + $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ + --target=${target_alias} \ + \ + $(STAGE1_CONFIGURE_FLAGS) +@endif libsframe-bootstrap + +.PHONY: configure-stage2-libsframe maybe-configure-stage2-libsframe +maybe-configure-stage2-libsframe: +@if libsframe-bootstrap +maybe-configure-stage2-libsframe: configure-stage2-libsframe +configure-stage2-libsframe: + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libsframe + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGE2_TFLAGS)"; \ + test ! -f $(HOST_SUBDIR)/libsframe/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + CFLAGS="$(STAGE2_CFLAGS)"; export CFLAGS; \ + CXXFLAGS="$(STAGE2_CXXFLAGS)"; export CXXFLAGS; \ + LIBCFLAGS="$(STAGE2_CFLAGS)"; export LIBCFLAGS; \ + echo Configuring stage 2 in $(HOST_SUBDIR)/libsframe; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libsframe; \ + cd $(HOST_SUBDIR)/libsframe || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libsframe/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + module_srcdir=libsframe; \ + $(SHELL) $$s/$$module_srcdir/configure \ + --srcdir=$${topdir}/$$module_srcdir \ + $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ + --target=${target_alias} \ + --with-build-libsubdir=$(HOST_SUBDIR) \ + $(STAGE2_CONFIGURE_FLAGS) +@endif libsframe-bootstrap + +.PHONY: configure-stage3-libsframe maybe-configure-stage3-libsframe +maybe-configure-stage3-libsframe: +@if libsframe-bootstrap +maybe-configure-stage3-libsframe: configure-stage3-libsframe +configure-stage3-libsframe: + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libsframe + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGE3_TFLAGS)"; \ + test ! -f $(HOST_SUBDIR)/libsframe/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + CFLAGS="$(STAGE3_CFLAGS)"; export CFLAGS; \ + CXXFLAGS="$(STAGE3_CXXFLAGS)"; export CXXFLAGS; \ + LIBCFLAGS="$(STAGE3_CFLAGS)"; export LIBCFLAGS; \ + echo Configuring stage 3 in $(HOST_SUBDIR)/libsframe; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libsframe; \ + cd $(HOST_SUBDIR)/libsframe || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libsframe/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + module_srcdir=libsframe; \ + $(SHELL) $$s/$$module_srcdir/configure \ + --srcdir=$${topdir}/$$module_srcdir \ + $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ + --target=${target_alias} \ + --with-build-libsubdir=$(HOST_SUBDIR) \ + $(STAGE3_CONFIGURE_FLAGS) +@endif libsframe-bootstrap + +.PHONY: configure-stage4-libsframe maybe-configure-stage4-libsframe +maybe-configure-stage4-libsframe: +@if libsframe-bootstrap +maybe-configure-stage4-libsframe: configure-stage4-libsframe +configure-stage4-libsframe: + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libsframe + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGE4_TFLAGS)"; \ + test ! -f $(HOST_SUBDIR)/libsframe/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + CFLAGS="$(STAGE4_CFLAGS)"; export CFLAGS; \ + CXXFLAGS="$(STAGE4_CXXFLAGS)"; export CXXFLAGS; \ + LIBCFLAGS="$(STAGE4_CFLAGS)"; export LIBCFLAGS; \ + echo Configuring stage 4 in $(HOST_SUBDIR)/libsframe; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libsframe; \ + cd $(HOST_SUBDIR)/libsframe || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libsframe/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + module_srcdir=libsframe; \ + $(SHELL) $$s/$$module_srcdir/configure \ + --srcdir=$${topdir}/$$module_srcdir \ + $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ + --target=${target_alias} \ + --with-build-libsubdir=$(HOST_SUBDIR) \ + $(STAGE4_CONFIGURE_FLAGS) +@endif libsframe-bootstrap + +.PHONY: configure-stageprofile-libsframe maybe-configure-stageprofile-libsframe +maybe-configure-stageprofile-libsframe: +@if libsframe-bootstrap +maybe-configure-stageprofile-libsframe: configure-stageprofile-libsframe +configure-stageprofile-libsframe: + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libsframe + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGEprofile_TFLAGS)"; \ + test ! -f $(HOST_SUBDIR)/libsframe/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + CFLAGS="$(STAGEprofile_CFLAGS)"; export CFLAGS; \ + CXXFLAGS="$(STAGEprofile_CXXFLAGS)"; export CXXFLAGS; \ + LIBCFLAGS="$(STAGEprofile_CFLAGS)"; export LIBCFLAGS; \ + echo Configuring stage profile in $(HOST_SUBDIR)/libsframe; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libsframe; \ + cd $(HOST_SUBDIR)/libsframe || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libsframe/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + module_srcdir=libsframe; \ + $(SHELL) $$s/$$module_srcdir/configure \ + --srcdir=$${topdir}/$$module_srcdir \ + $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ + --target=${target_alias} \ + --with-build-libsubdir=$(HOST_SUBDIR) \ + $(STAGEprofile_CONFIGURE_FLAGS) +@endif libsframe-bootstrap + +.PHONY: configure-stagetrain-libsframe maybe-configure-stagetrain-libsframe +maybe-configure-stagetrain-libsframe: +@if libsframe-bootstrap +maybe-configure-stagetrain-libsframe: configure-stagetrain-libsframe +configure-stagetrain-libsframe: + @[ $(current_stage) = stagetrain ] || $(MAKE) stagetrain-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libsframe + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGEtrain_TFLAGS)"; \ + test ! -f $(HOST_SUBDIR)/libsframe/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + CFLAGS="$(STAGEtrain_CFLAGS)"; export CFLAGS; \ + CXXFLAGS="$(STAGEtrain_CXXFLAGS)"; export CXXFLAGS; \ + LIBCFLAGS="$(STAGEtrain_CFLAGS)"; export LIBCFLAGS; \ + echo Configuring stage train in $(HOST_SUBDIR)/libsframe; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libsframe; \ + cd $(HOST_SUBDIR)/libsframe || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libsframe/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + module_srcdir=libsframe; \ + $(SHELL) $$s/$$module_srcdir/configure \ + --srcdir=$${topdir}/$$module_srcdir \ + $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ + --target=${target_alias} \ + --with-build-libsubdir=$(HOST_SUBDIR) \ + $(STAGEtrain_CONFIGURE_FLAGS) +@endif libsframe-bootstrap + +.PHONY: configure-stagefeedback-libsframe maybe-configure-stagefeedback-libsframe +maybe-configure-stagefeedback-libsframe: +@if libsframe-bootstrap +maybe-configure-stagefeedback-libsframe: configure-stagefeedback-libsframe +configure-stagefeedback-libsframe: + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libsframe + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGEfeedback_TFLAGS)"; \ + test ! -f $(HOST_SUBDIR)/libsframe/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + CFLAGS="$(STAGEfeedback_CFLAGS)"; export CFLAGS; \ + CXXFLAGS="$(STAGEfeedback_CXXFLAGS)"; export CXXFLAGS; \ + LIBCFLAGS="$(STAGEfeedback_CFLAGS)"; export LIBCFLAGS; \ + echo Configuring stage feedback in $(HOST_SUBDIR)/libsframe; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libsframe; \ + cd $(HOST_SUBDIR)/libsframe || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libsframe/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + module_srcdir=libsframe; \ + $(SHELL) $$s/$$module_srcdir/configure \ + --srcdir=$${topdir}/$$module_srcdir \ + $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ + --target=${target_alias} \ + --with-build-libsubdir=$(HOST_SUBDIR) \ + $(STAGEfeedback_CONFIGURE_FLAGS) +@endif libsframe-bootstrap + +.PHONY: configure-stageautoprofile-libsframe maybe-configure-stageautoprofile-libsframe +maybe-configure-stageautoprofile-libsframe: +@if libsframe-bootstrap +maybe-configure-stageautoprofile-libsframe: configure-stageautoprofile-libsframe +configure-stageautoprofile-libsframe: + @[ $(current_stage) = stageautoprofile ] || $(MAKE) stageautoprofile-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libsframe + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGEautoprofile_TFLAGS)"; \ + test ! -f $(HOST_SUBDIR)/libsframe/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + CFLAGS="$(STAGEautoprofile_CFLAGS)"; export CFLAGS; \ + CXXFLAGS="$(STAGEautoprofile_CXXFLAGS)"; export CXXFLAGS; \ + LIBCFLAGS="$(STAGEautoprofile_CFLAGS)"; export LIBCFLAGS; \ + echo Configuring stage autoprofile in $(HOST_SUBDIR)/libsframe; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libsframe; \ + cd $(HOST_SUBDIR)/libsframe || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libsframe/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + module_srcdir=libsframe; \ + $(SHELL) $$s/$$module_srcdir/configure \ + --srcdir=$${topdir}/$$module_srcdir \ + $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ + --target=${target_alias} \ + --with-build-libsubdir=$(HOST_SUBDIR) \ + $(STAGEautoprofile_CONFIGURE_FLAGS) +@endif libsframe-bootstrap + +.PHONY: configure-stageautofeedback-libsframe maybe-configure-stageautofeedback-libsframe +maybe-configure-stageautofeedback-libsframe: +@if libsframe-bootstrap +maybe-configure-stageautofeedback-libsframe: configure-stageautofeedback-libsframe +configure-stageautofeedback-libsframe: + @[ $(current_stage) = stageautofeedback ] || $(MAKE) stageautofeedback-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libsframe + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGEautofeedback_TFLAGS)"; \ + test ! -f $(HOST_SUBDIR)/libsframe/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + CFLAGS="$(STAGEautofeedback_CFLAGS)"; export CFLAGS; \ + CXXFLAGS="$(STAGEautofeedback_CXXFLAGS)"; export CXXFLAGS; \ + LIBCFLAGS="$(STAGEautofeedback_CFLAGS)"; export LIBCFLAGS; \ + echo Configuring stage autofeedback in $(HOST_SUBDIR)/libsframe; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libsframe; \ + cd $(HOST_SUBDIR)/libsframe || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/libsframe/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + module_srcdir=libsframe; \ + $(SHELL) $$s/$$module_srcdir/configure \ + --srcdir=$${topdir}/$$module_srcdir \ + $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ + --target=${target_alias} \ + --with-build-libsubdir=$(HOST_SUBDIR) \ + $(STAGEautofeedback_CONFIGURE_FLAGS) +@endif libsframe-bootstrap + + + + + +.PHONY: all-libsframe maybe-all-libsframe +maybe-all-libsframe: +@if gcc-bootstrap +all-libsframe: stage_current +@endif gcc-bootstrap +@if libsframe +TARGET-libsframe=all +maybe-all-libsframe: all-libsframe +all-libsframe: configure-libsframe + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS) \ + $(TARGET-libsframe)) +@endif libsframe + + + +.PHONY: all-stage1-libsframe maybe-all-stage1-libsframe +.PHONY: clean-stage1-libsframe maybe-clean-stage1-libsframe +maybe-all-stage1-libsframe: +maybe-clean-stage1-libsframe: +@if libsframe-bootstrap +maybe-all-stage1-libsframe: all-stage1-libsframe +all-stage1: all-stage1-libsframe +TARGET-stage1-libsframe = $(TARGET-libsframe) +all-stage1-libsframe: configure-stage1-libsframe + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGE1_TFLAGS)"; \ + $(HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libsframe && \ + \ + $(MAKE) $(BASE_FLAGS_TO_PASS) \ + CFLAGS="$(STAGE1_CFLAGS)" \ + GENERATOR_CFLAGS="$(STAGE1_GENERATOR_CFLAGS)" \ + CXXFLAGS="$(STAGE1_CXXFLAGS)" \ + LIBCFLAGS="$(LIBCFLAGS)" \ + CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ + CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ + LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ + $(EXTRA_HOST_FLAGS) \ + $(STAGE1_FLAGS_TO_PASS) \ + TFLAGS="$(STAGE1_TFLAGS)" \ + $(TARGET-stage1-libsframe) + +maybe-clean-stage1-libsframe: clean-stage1-libsframe +clean-stage1: clean-stage1-libsframe +clean-stage1-libsframe: + @if [ $(current_stage) = stage1 ]; then \ + [ -f $(HOST_SUBDIR)/libsframe/Makefile ] || exit 0; \ + else \ + [ -f $(HOST_SUBDIR)/stage1-libsframe/Makefile ] || exit 0; \ + $(MAKE) stage1-start; \ + fi; \ + cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(EXTRA_HOST_FLAGS) \ + $(STAGE1_FLAGS_TO_PASS) clean +@endif libsframe-bootstrap + + +.PHONY: all-stage2-libsframe maybe-all-stage2-libsframe +.PHONY: clean-stage2-libsframe maybe-clean-stage2-libsframe +maybe-all-stage2-libsframe: +maybe-clean-stage2-libsframe: +@if libsframe-bootstrap +maybe-all-stage2-libsframe: all-stage2-libsframe +all-stage2: all-stage2-libsframe +TARGET-stage2-libsframe = $(TARGET-libsframe) +all-stage2-libsframe: configure-stage2-libsframe + @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGE2_TFLAGS)"; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libsframe && \ + \ + $(MAKE) $(BASE_FLAGS_TO_PASS) \ + CFLAGS="$(STAGE2_CFLAGS)" \ + GENERATOR_CFLAGS="$(STAGE2_GENERATOR_CFLAGS)" \ + CXXFLAGS="$(STAGE2_CXXFLAGS)" \ + LIBCFLAGS="$(STAGE2_CFLAGS)" \ + CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ + CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ + LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ + $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + TFLAGS="$(STAGE2_TFLAGS)" \ + $(TARGET-stage2-libsframe) + +maybe-clean-stage2-libsframe: clean-stage2-libsframe +clean-stage2: clean-stage2-libsframe +clean-stage2-libsframe: + @if [ $(current_stage) = stage2 ]; then \ + [ -f $(HOST_SUBDIR)/libsframe/Makefile ] || exit 0; \ + else \ + [ -f $(HOST_SUBDIR)/stage2-libsframe/Makefile ] || exit 0; \ + $(MAKE) stage2-start; \ + fi; \ + cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) clean +@endif libsframe-bootstrap + + +.PHONY: all-stage3-libsframe maybe-all-stage3-libsframe +.PHONY: clean-stage3-libsframe maybe-clean-stage3-libsframe +maybe-all-stage3-libsframe: +maybe-clean-stage3-libsframe: +@if libsframe-bootstrap +maybe-all-stage3-libsframe: all-stage3-libsframe +all-stage3: all-stage3-libsframe +TARGET-stage3-libsframe = $(TARGET-libsframe) +all-stage3-libsframe: configure-stage3-libsframe + @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGE3_TFLAGS)"; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libsframe && \ + \ + $(MAKE) $(BASE_FLAGS_TO_PASS) \ + CFLAGS="$(STAGE3_CFLAGS)" \ + GENERATOR_CFLAGS="$(STAGE3_GENERATOR_CFLAGS)" \ + CXXFLAGS="$(STAGE3_CXXFLAGS)" \ + LIBCFLAGS="$(STAGE3_CFLAGS)" \ + CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ + CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ + LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ + $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + TFLAGS="$(STAGE3_TFLAGS)" \ + $(TARGET-stage3-libsframe) + +maybe-clean-stage3-libsframe: clean-stage3-libsframe +clean-stage3: clean-stage3-libsframe +clean-stage3-libsframe: + @if [ $(current_stage) = stage3 ]; then \ + [ -f $(HOST_SUBDIR)/libsframe/Makefile ] || exit 0; \ + else \ + [ -f $(HOST_SUBDIR)/stage3-libsframe/Makefile ] || exit 0; \ + $(MAKE) stage3-start; \ + fi; \ + cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) clean +@endif libsframe-bootstrap + + +.PHONY: all-stage4-libsframe maybe-all-stage4-libsframe +.PHONY: clean-stage4-libsframe maybe-clean-stage4-libsframe +maybe-all-stage4-libsframe: +maybe-clean-stage4-libsframe: +@if libsframe-bootstrap +maybe-all-stage4-libsframe: all-stage4-libsframe +all-stage4: all-stage4-libsframe +TARGET-stage4-libsframe = $(TARGET-libsframe) +all-stage4-libsframe: configure-stage4-libsframe + @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGE4_TFLAGS)"; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libsframe && \ + \ + $(MAKE) $(BASE_FLAGS_TO_PASS) \ + CFLAGS="$(STAGE4_CFLAGS)" \ + GENERATOR_CFLAGS="$(STAGE4_GENERATOR_CFLAGS)" \ + CXXFLAGS="$(STAGE4_CXXFLAGS)" \ + LIBCFLAGS="$(STAGE4_CFLAGS)" \ + CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ + CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ + LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ + $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + TFLAGS="$(STAGE4_TFLAGS)" \ + $(TARGET-stage4-libsframe) + +maybe-clean-stage4-libsframe: clean-stage4-libsframe +clean-stage4: clean-stage4-libsframe +clean-stage4-libsframe: + @if [ $(current_stage) = stage4 ]; then \ + [ -f $(HOST_SUBDIR)/libsframe/Makefile ] || exit 0; \ + else \ + [ -f $(HOST_SUBDIR)/stage4-libsframe/Makefile ] || exit 0; \ + $(MAKE) stage4-start; \ + fi; \ + cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) clean +@endif libsframe-bootstrap + + +.PHONY: all-stageprofile-libsframe maybe-all-stageprofile-libsframe +.PHONY: clean-stageprofile-libsframe maybe-clean-stageprofile-libsframe +maybe-all-stageprofile-libsframe: +maybe-clean-stageprofile-libsframe: +@if libsframe-bootstrap +maybe-all-stageprofile-libsframe: all-stageprofile-libsframe +all-stageprofile: all-stageprofile-libsframe +TARGET-stageprofile-libsframe = $(TARGET-libsframe) +all-stageprofile-libsframe: configure-stageprofile-libsframe + @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGEprofile_TFLAGS)"; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libsframe && \ + \ + $(MAKE) $(BASE_FLAGS_TO_PASS) \ + CFLAGS="$(STAGEprofile_CFLAGS)" \ + GENERATOR_CFLAGS="$(STAGEprofile_GENERATOR_CFLAGS)" \ + CXXFLAGS="$(STAGEprofile_CXXFLAGS)" \ + LIBCFLAGS="$(STAGEprofile_CFLAGS)" \ + CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ + CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ + LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ + $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + TFLAGS="$(STAGEprofile_TFLAGS)" \ + $(TARGET-stageprofile-libsframe) + +maybe-clean-stageprofile-libsframe: clean-stageprofile-libsframe +clean-stageprofile: clean-stageprofile-libsframe +clean-stageprofile-libsframe: + @if [ $(current_stage) = stageprofile ]; then \ + [ -f $(HOST_SUBDIR)/libsframe/Makefile ] || exit 0; \ + else \ + [ -f $(HOST_SUBDIR)/stageprofile-libsframe/Makefile ] || exit 0; \ + $(MAKE) stageprofile-start; \ + fi; \ + cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) clean +@endif libsframe-bootstrap + + +.PHONY: all-stagetrain-libsframe maybe-all-stagetrain-libsframe +.PHONY: clean-stagetrain-libsframe maybe-clean-stagetrain-libsframe +maybe-all-stagetrain-libsframe: +maybe-clean-stagetrain-libsframe: +@if libsframe-bootstrap +maybe-all-stagetrain-libsframe: all-stagetrain-libsframe +all-stagetrain: all-stagetrain-libsframe +TARGET-stagetrain-libsframe = $(TARGET-libsframe) +all-stagetrain-libsframe: configure-stagetrain-libsframe + @[ $(current_stage) = stagetrain ] || $(MAKE) stagetrain-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGEtrain_TFLAGS)"; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libsframe && \ + \ + $(MAKE) $(BASE_FLAGS_TO_PASS) \ + CFLAGS="$(STAGEtrain_CFLAGS)" \ + GENERATOR_CFLAGS="$(STAGEtrain_GENERATOR_CFLAGS)" \ + CXXFLAGS="$(STAGEtrain_CXXFLAGS)" \ + LIBCFLAGS="$(STAGEtrain_CFLAGS)" \ + CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ + CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ + LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ + $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + TFLAGS="$(STAGEtrain_TFLAGS)" \ + $(TARGET-stagetrain-libsframe) + +maybe-clean-stagetrain-libsframe: clean-stagetrain-libsframe +clean-stagetrain: clean-stagetrain-libsframe +clean-stagetrain-libsframe: + @if [ $(current_stage) = stagetrain ]; then \ + [ -f $(HOST_SUBDIR)/libsframe/Makefile ] || exit 0; \ + else \ + [ -f $(HOST_SUBDIR)/stagetrain-libsframe/Makefile ] || exit 0; \ + $(MAKE) stagetrain-start; \ + fi; \ + cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) clean +@endif libsframe-bootstrap + + +.PHONY: all-stagefeedback-libsframe maybe-all-stagefeedback-libsframe +.PHONY: clean-stagefeedback-libsframe maybe-clean-stagefeedback-libsframe +maybe-all-stagefeedback-libsframe: +maybe-clean-stagefeedback-libsframe: +@if libsframe-bootstrap +maybe-all-stagefeedback-libsframe: all-stagefeedback-libsframe +all-stagefeedback: all-stagefeedback-libsframe +TARGET-stagefeedback-libsframe = $(TARGET-libsframe) +all-stagefeedback-libsframe: configure-stagefeedback-libsframe + @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGEfeedback_TFLAGS)"; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libsframe && \ + \ + $(MAKE) $(BASE_FLAGS_TO_PASS) \ + CFLAGS="$(STAGEfeedback_CFLAGS)" \ + GENERATOR_CFLAGS="$(STAGEfeedback_GENERATOR_CFLAGS)" \ + CXXFLAGS="$(STAGEfeedback_CXXFLAGS)" \ + LIBCFLAGS="$(STAGEfeedback_CFLAGS)" \ + CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ + CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ + LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ + $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + TFLAGS="$(STAGEfeedback_TFLAGS)" \ + $(TARGET-stagefeedback-libsframe) + +maybe-clean-stagefeedback-libsframe: clean-stagefeedback-libsframe +clean-stagefeedback: clean-stagefeedback-libsframe +clean-stagefeedback-libsframe: + @if [ $(current_stage) = stagefeedback ]; then \ + [ -f $(HOST_SUBDIR)/libsframe/Makefile ] || exit 0; \ + else \ + [ -f $(HOST_SUBDIR)/stagefeedback-libsframe/Makefile ] || exit 0; \ + $(MAKE) stagefeedback-start; \ + fi; \ + cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) clean +@endif libsframe-bootstrap + + +.PHONY: all-stageautoprofile-libsframe maybe-all-stageautoprofile-libsframe +.PHONY: clean-stageautoprofile-libsframe maybe-clean-stageautoprofile-libsframe +maybe-all-stageautoprofile-libsframe: +maybe-clean-stageautoprofile-libsframe: +@if libsframe-bootstrap +maybe-all-stageautoprofile-libsframe: all-stageautoprofile-libsframe +all-stageautoprofile: all-stageautoprofile-libsframe +TARGET-stageautoprofile-libsframe = $(TARGET-libsframe) +all-stageautoprofile-libsframe: configure-stageautoprofile-libsframe + @[ $(current_stage) = stageautoprofile ] || $(MAKE) stageautoprofile-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGEautoprofile_TFLAGS)"; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libsframe && \ + $$s/gcc/config/i386/$(AUTO_PROFILE) \ + $(MAKE) $(BASE_FLAGS_TO_PASS) \ + CFLAGS="$(STAGEautoprofile_CFLAGS)" \ + GENERATOR_CFLAGS="$(STAGEautoprofile_GENERATOR_CFLAGS)" \ + CXXFLAGS="$(STAGEautoprofile_CXXFLAGS)" \ + LIBCFLAGS="$(STAGEautoprofile_CFLAGS)" \ + CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ + CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ + LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ + $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + TFLAGS="$(STAGEautoprofile_TFLAGS)" \ + $(TARGET-stageautoprofile-libsframe) + +maybe-clean-stageautoprofile-libsframe: clean-stageautoprofile-libsframe +clean-stageautoprofile: clean-stageautoprofile-libsframe +clean-stageautoprofile-libsframe: + @if [ $(current_stage) = stageautoprofile ]; then \ + [ -f $(HOST_SUBDIR)/libsframe/Makefile ] || exit 0; \ + else \ + [ -f $(HOST_SUBDIR)/stageautoprofile-libsframe/Makefile ] || exit 0; \ + $(MAKE) stageautoprofile-start; \ + fi; \ + cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) clean +@endif libsframe-bootstrap + + +.PHONY: all-stageautofeedback-libsframe maybe-all-stageautofeedback-libsframe +.PHONY: clean-stageautofeedback-libsframe maybe-clean-stageautofeedback-libsframe +maybe-all-stageautofeedback-libsframe: +maybe-clean-stageautofeedback-libsframe: +@if libsframe-bootstrap +maybe-all-stageautofeedback-libsframe: all-stageautofeedback-libsframe +all-stageautofeedback: all-stageautofeedback-libsframe +TARGET-stageautofeedback-libsframe = $(TARGET-libsframe) +all-stageautofeedback-libsframe: configure-stageautofeedback-libsframe + @[ $(current_stage) = stageautofeedback ] || $(MAKE) stageautofeedback-start + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGEautofeedback_TFLAGS)"; \ + $(HOST_EXPORTS) \ + $(POSTSTAGE1_HOST_EXPORTS) \ + cd $(HOST_SUBDIR)/libsframe && \ + \ + $(MAKE) $(BASE_FLAGS_TO_PASS) \ + CFLAGS="$(STAGEautofeedback_CFLAGS)" \ + GENERATOR_CFLAGS="$(STAGEautofeedback_GENERATOR_CFLAGS)" \ + CXXFLAGS="$(STAGEautofeedback_CXXFLAGS)" \ + LIBCFLAGS="$(STAGEautofeedback_CFLAGS)" \ + CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ + CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ + LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ + $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + TFLAGS="$(STAGEautofeedback_TFLAGS)" PERF_DATA=perf.data \ + $(TARGET-stageautofeedback-libsframe) + +maybe-clean-stageautofeedback-libsframe: clean-stageautofeedback-libsframe +clean-stageautofeedback: clean-stageautofeedback-libsframe +clean-stageautofeedback-libsframe: + @if [ $(current_stage) = stageautofeedback ]; then \ + [ -f $(HOST_SUBDIR)/libsframe/Makefile ] || exit 0; \ + else \ + [ -f $(HOST_SUBDIR)/stageautofeedback-libsframe/Makefile ] || exit 0; \ + $(MAKE) stageautofeedback-start; \ + fi; \ + cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) clean +@endif libsframe-bootstrap + + + + + +.PHONY: check-libsframe maybe-check-libsframe +maybe-check-libsframe: +@if libsframe +maybe-check-libsframe: check-libsframe + +check-libsframe: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) $(EXTRA_HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_BOOTSTRAP_FLAGS) check) + +@endif libsframe + +.PHONY: install-libsframe maybe-install-libsframe +maybe-install-libsframe: +@if libsframe +maybe-install-libsframe: install-libsframe + +install-libsframe: installdirs + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif libsframe + +.PHONY: install-strip-libsframe maybe-install-strip-libsframe +maybe-install-strip-libsframe: +@if libsframe +maybe-install-strip-libsframe: install-strip-libsframe + +install-strip-libsframe: installdirs + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(FLAGS_TO_PASS) install-strip) + +@endif libsframe + +# Other targets (info, dvi, pdf, etc.) + +.PHONY: maybe-info-libsframe info-libsframe +maybe-info-libsframe: +@if libsframe +maybe-info-libsframe: info-libsframe + +info-libsframe: \ + configure-libsframe + @[ -f ./libsframe/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in libsframe"; \ + (cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + info) \ + || exit 1 + +@endif libsframe + +.PHONY: maybe-dvi-libsframe dvi-libsframe +maybe-dvi-libsframe: +@if libsframe +maybe-dvi-libsframe: dvi-libsframe + +dvi-libsframe: \ + configure-libsframe + @[ -f ./libsframe/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in libsframe"; \ + (cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + dvi) \ + || exit 1 + +@endif libsframe + +.PHONY: maybe-pdf-libsframe pdf-libsframe +maybe-pdf-libsframe: +@if libsframe +maybe-pdf-libsframe: pdf-libsframe + +pdf-libsframe: \ + configure-libsframe + @[ -f ./libsframe/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing pdf in libsframe"; \ + (cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + pdf) \ + || exit 1 + +@endif libsframe + +.PHONY: maybe-html-libsframe html-libsframe +maybe-html-libsframe: +@if libsframe +maybe-html-libsframe: html-libsframe + +html-libsframe: \ + configure-libsframe + @[ -f ./libsframe/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in libsframe"; \ + (cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + html) \ + || exit 1 + +@endif libsframe + +.PHONY: maybe-TAGS-libsframe TAGS-libsframe +maybe-TAGS-libsframe: +@if libsframe +maybe-TAGS-libsframe: TAGS-libsframe + +TAGS-libsframe: \ + configure-libsframe + @[ -f ./libsframe/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in libsframe"; \ + (cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + TAGS) \ + || exit 1 + +@endif libsframe + +.PHONY: maybe-install-info-libsframe install-info-libsframe +maybe-install-info-libsframe: +@if libsframe +maybe-install-info-libsframe: install-info-libsframe + +install-info-libsframe: \ + configure-libsframe \ + info-libsframe + @[ -f ./libsframe/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in libsframe"; \ + (cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + install-info) \ + || exit 1 + +@endif libsframe + +.PHONY: maybe-install-dvi-libsframe install-dvi-libsframe +maybe-install-dvi-libsframe: +@if libsframe +maybe-install-dvi-libsframe: install-dvi-libsframe + +install-dvi-libsframe: \ + configure-libsframe \ + dvi-libsframe + @[ -f ./libsframe/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-dvi in libsframe"; \ + (cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + install-dvi) \ + || exit 1 + +@endif libsframe + +.PHONY: maybe-install-pdf-libsframe install-pdf-libsframe +maybe-install-pdf-libsframe: +@if libsframe +maybe-install-pdf-libsframe: install-pdf-libsframe + +install-pdf-libsframe: \ + configure-libsframe \ + pdf-libsframe + @[ -f ./libsframe/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-pdf in libsframe"; \ + (cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + install-pdf) \ + || exit 1 + +@endif libsframe + +.PHONY: maybe-install-html-libsframe install-html-libsframe +maybe-install-html-libsframe: +@if libsframe +maybe-install-html-libsframe: install-html-libsframe + +install-html-libsframe: \ + configure-libsframe \ + html-libsframe + @[ -f ./libsframe/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in libsframe"; \ + (cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + install-html) \ + || exit 1 + +@endif libsframe + +.PHONY: maybe-installcheck-libsframe installcheck-libsframe +maybe-installcheck-libsframe: +@if libsframe +maybe-installcheck-libsframe: installcheck-libsframe + +installcheck-libsframe: \ + configure-libsframe + @[ -f ./libsframe/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in libsframe"; \ + (cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + installcheck) \ + || exit 1 + +@endif libsframe + +.PHONY: maybe-mostlyclean-libsframe mostlyclean-libsframe +maybe-mostlyclean-libsframe: +@if libsframe +maybe-mostlyclean-libsframe: mostlyclean-libsframe + +mostlyclean-libsframe: + @[ -f ./libsframe/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in libsframe"; \ + (cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + mostlyclean) \ + || exit 1 + +@endif libsframe + +.PHONY: maybe-clean-libsframe clean-libsframe +maybe-clean-libsframe: +@if libsframe +maybe-clean-libsframe: clean-libsframe + +clean-libsframe: + @[ -f ./libsframe/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in libsframe"; \ + (cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + clean) \ + || exit 1 + +@endif libsframe + +.PHONY: maybe-distclean-libsframe distclean-libsframe +maybe-distclean-libsframe: +@if libsframe +maybe-distclean-libsframe: distclean-libsframe + +distclean-libsframe: + @[ -f ./libsframe/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in libsframe"; \ + (cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + distclean) \ + || exit 1 + +@endif libsframe + +.PHONY: maybe-maintainer-clean-libsframe maintainer-clean-libsframe +maybe-maintainer-clean-libsframe: +@if libsframe +maybe-maintainer-clean-libsframe: maintainer-clean-libsframe + +maintainer-clean-libsframe: + @[ -f ./libsframe/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in libsframe"; \ + (cd $(HOST_SUBDIR)/libsframe && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + maintainer-clean) \ + || exit 1 + +@endif libsframe + + + # --------------------------------------- # Modules which run on the target machine # --------------------------------------- @@ -59280,6 +60442,11 @@ stage1-start:: mkdir stage1-libctf; \ mv stage1-libctf libctf @endif libctf +@if libsframe + @cd $(HOST_SUBDIR); [ -d stage1-libsframe ] || \ + mkdir stage1-libsframe; \ + mv stage1-libsframe libsframe +@endif libsframe @[ -d stage1-$(TARGET_SUBDIR) ] || \ mkdir stage1-$(TARGET_SUBDIR); \ mv stage1-$(TARGET_SUBDIR) $(TARGET_SUBDIR) @@ -59405,6 +60572,11 @@ stage1-end:: cd $(HOST_SUBDIR); mv libctf stage1-libctf; \ fi @endif libctf +@if libsframe + @if test -d $(HOST_SUBDIR)/libsframe; then \ + cd $(HOST_SUBDIR); mv libsframe stage1-libsframe; \ + fi +@endif libsframe @if test -d $(TARGET_SUBDIR); then \ mv $(TARGET_SUBDIR) stage1-$(TARGET_SUBDIR); \ fi @@ -59597,6 +60769,12 @@ stage2-start:: mv stage2-libctf libctf; \ mv stage1-libctf prev-libctf || test -f stage1-lean @endif libctf +@if libsframe + @cd $(HOST_SUBDIR); [ -d stage2-libsframe ] || \ + mkdir stage2-libsframe; \ + mv stage2-libsframe libsframe; \ + mv stage1-libsframe prev-libsframe || test -f stage1-lean +@endif libsframe @[ -d stage2-$(TARGET_SUBDIR) ] || \ mkdir stage2-$(TARGET_SUBDIR); \ mv stage2-$(TARGET_SUBDIR) $(TARGET_SUBDIR); \ @@ -59747,6 +60925,12 @@ stage2-end:: mv prev-libctf stage1-libctf; : ; \ fi @endif libctf +@if libsframe + @if test -d $(HOST_SUBDIR)/libsframe; then \ + cd $(HOST_SUBDIR); mv libsframe stage2-libsframe; \ + mv prev-libsframe stage1-libsframe; : ; \ + fi +@endif libsframe @if test -d $(TARGET_SUBDIR); then \ mv $(TARGET_SUBDIR) stage2-$(TARGET_SUBDIR); \ mv prev-$(TARGET_SUBDIR) stage1-$(TARGET_SUBDIR); : ; \ @@ -59963,6 +61147,12 @@ stage3-start:: mv stage3-libctf libctf; \ mv stage2-libctf prev-libctf || test -f stage2-lean @endif libctf +@if libsframe + @cd $(HOST_SUBDIR); [ -d stage3-libsframe ] || \ + mkdir stage3-libsframe; \ + mv stage3-libsframe libsframe; \ + mv stage2-libsframe prev-libsframe || test -f stage2-lean +@endif libsframe @[ -d stage3-$(TARGET_SUBDIR) ] || \ mkdir stage3-$(TARGET_SUBDIR); \ mv stage3-$(TARGET_SUBDIR) $(TARGET_SUBDIR); \ @@ -60113,6 +61303,12 @@ stage3-end:: mv prev-libctf stage2-libctf; : ; \ fi @endif libctf +@if libsframe + @if test -d $(HOST_SUBDIR)/libsframe; then \ + cd $(HOST_SUBDIR); mv libsframe stage3-libsframe; \ + mv prev-libsframe stage2-libsframe; : ; \ + fi +@endif libsframe @if test -d $(TARGET_SUBDIR); then \ mv $(TARGET_SUBDIR) stage3-$(TARGET_SUBDIR); \ mv prev-$(TARGET_SUBDIR) stage2-$(TARGET_SUBDIR); : ; \ @@ -60385,6 +61581,12 @@ stage4-start:: mv stage4-libctf libctf; \ mv stage3-libctf prev-libctf || test -f stage3-lean @endif libctf +@if libsframe + @cd $(HOST_SUBDIR); [ -d stage4-libsframe ] || \ + mkdir stage4-libsframe; \ + mv stage4-libsframe libsframe; \ + mv stage3-libsframe prev-libsframe || test -f stage3-lean +@endif libsframe @[ -d stage4-$(TARGET_SUBDIR) ] || \ mkdir stage4-$(TARGET_SUBDIR); \ mv stage4-$(TARGET_SUBDIR) $(TARGET_SUBDIR); \ @@ -60535,6 +61737,12 @@ stage4-end:: mv prev-libctf stage3-libctf; : ; \ fi @endif libctf +@if libsframe + @if test -d $(HOST_SUBDIR)/libsframe; then \ + cd $(HOST_SUBDIR); mv libsframe stage4-libsframe; \ + mv prev-libsframe stage3-libsframe; : ; \ + fi +@endif libsframe @if test -d $(TARGET_SUBDIR); then \ mv $(TARGET_SUBDIR) stage4-$(TARGET_SUBDIR); \ mv prev-$(TARGET_SUBDIR) stage3-$(TARGET_SUBDIR); : ; \ @@ -60795,6 +62003,12 @@ stageprofile-start:: mv stageprofile-libctf libctf; \ mv stage1-libctf prev-libctf || test -f stage1-lean @endif libctf +@if libsframe + @cd $(HOST_SUBDIR); [ -d stageprofile-libsframe ] || \ + mkdir stageprofile-libsframe; \ + mv stageprofile-libsframe libsframe; \ + mv stage1-libsframe prev-libsframe || test -f stage1-lean +@endif libsframe @[ -d stageprofile-$(TARGET_SUBDIR) ] || \ mkdir stageprofile-$(TARGET_SUBDIR); \ mv stageprofile-$(TARGET_SUBDIR) $(TARGET_SUBDIR); \ @@ -60945,6 +62159,12 @@ stageprofile-end:: mv prev-libctf stage1-libctf; : ; \ fi @endif libctf +@if libsframe + @if test -d $(HOST_SUBDIR)/libsframe; then \ + cd $(HOST_SUBDIR); mv libsframe stageprofile-libsframe; \ + mv prev-libsframe stage1-libsframe; : ; \ + fi +@endif libsframe @if test -d $(TARGET_SUBDIR); then \ mv $(TARGET_SUBDIR) stageprofile-$(TARGET_SUBDIR); \ mv prev-$(TARGET_SUBDIR) stage1-$(TARGET_SUBDIR); : ; \ @@ -61138,6 +62358,12 @@ stagetrain-start:: mv stagetrain-libctf libctf; \ mv stageprofile-libctf prev-libctf || test -f stageprofile-lean @endif libctf +@if libsframe + @cd $(HOST_SUBDIR); [ -d stagetrain-libsframe ] || \ + mkdir stagetrain-libsframe; \ + mv stagetrain-libsframe libsframe; \ + mv stageprofile-libsframe prev-libsframe || test -f stageprofile-lean +@endif libsframe @[ -d stagetrain-$(TARGET_SUBDIR) ] || \ mkdir stagetrain-$(TARGET_SUBDIR); \ mv stagetrain-$(TARGET_SUBDIR) $(TARGET_SUBDIR); \ @@ -61288,6 +62514,12 @@ stagetrain-end:: mv prev-libctf stageprofile-libctf; : ; \ fi @endif libctf +@if libsframe + @if test -d $(HOST_SUBDIR)/libsframe; then \ + cd $(HOST_SUBDIR); mv libsframe stagetrain-libsframe; \ + mv prev-libsframe stageprofile-libsframe; : ; \ + fi +@endif libsframe @if test -d $(TARGET_SUBDIR); then \ mv $(TARGET_SUBDIR) stagetrain-$(TARGET_SUBDIR); \ mv prev-$(TARGET_SUBDIR) stageprofile-$(TARGET_SUBDIR); : ; \ @@ -61481,6 +62713,12 @@ stagefeedback-start:: mv stagefeedback-libctf libctf; \ mv stagetrain-libctf prev-libctf || test -f stagetrain-lean @endif libctf +@if libsframe + @cd $(HOST_SUBDIR); [ -d stagefeedback-libsframe ] || \ + mkdir stagefeedback-libsframe; \ + mv stagefeedback-libsframe libsframe; \ + mv stagetrain-libsframe prev-libsframe || test -f stagetrain-lean +@endif libsframe @[ -d stagefeedback-$(TARGET_SUBDIR) ] || \ mkdir stagefeedback-$(TARGET_SUBDIR); \ mv stagefeedback-$(TARGET_SUBDIR) $(TARGET_SUBDIR); \ @@ -61631,6 +62869,12 @@ stagefeedback-end:: mv prev-libctf stagetrain-libctf; : ; \ fi @endif libctf +@if libsframe + @if test -d $(HOST_SUBDIR)/libsframe; then \ + cd $(HOST_SUBDIR); mv libsframe stagefeedback-libsframe; \ + mv prev-libsframe stagetrain-libsframe; : ; \ + fi +@endif libsframe @if test -d $(TARGET_SUBDIR); then \ mv $(TARGET_SUBDIR) stagefeedback-$(TARGET_SUBDIR); \ mv prev-$(TARGET_SUBDIR) stagetrain-$(TARGET_SUBDIR); : ; \ @@ -61847,6 +63091,12 @@ stageautoprofile-start:: mv stageautoprofile-libctf libctf; \ mv stage1-libctf prev-libctf || test -f stage1-lean @endif libctf +@if libsframe + @cd $(HOST_SUBDIR); [ -d stageautoprofile-libsframe ] || \ + mkdir stageautoprofile-libsframe; \ + mv stageautoprofile-libsframe libsframe; \ + mv stage1-libsframe prev-libsframe || test -f stage1-lean +@endif libsframe @[ -d stageautoprofile-$(TARGET_SUBDIR) ] || \ mkdir stageautoprofile-$(TARGET_SUBDIR); \ mv stageautoprofile-$(TARGET_SUBDIR) $(TARGET_SUBDIR); \ @@ -61997,6 +63247,12 @@ stageautoprofile-end:: mv prev-libctf stage1-libctf; : ; \ fi @endif libctf +@if libsframe + @if test -d $(HOST_SUBDIR)/libsframe; then \ + cd $(HOST_SUBDIR); mv libsframe stageautoprofile-libsframe; \ + mv prev-libsframe stage1-libsframe; : ; \ + fi +@endif libsframe @if test -d $(TARGET_SUBDIR); then \ mv $(TARGET_SUBDIR) stageautoprofile-$(TARGET_SUBDIR); \ mv prev-$(TARGET_SUBDIR) stage1-$(TARGET_SUBDIR); : ; \ @@ -62190,6 +63446,12 @@ stageautofeedback-start:: mv stageautofeedback-libctf libctf; \ mv stageautoprofile-libctf prev-libctf || test -f stageautoprofile-lean @endif libctf +@if libsframe + @cd $(HOST_SUBDIR); [ -d stageautofeedback-libsframe ] || \ + mkdir stageautofeedback-libsframe; \ + mv stageautofeedback-libsframe libsframe; \ + mv stageautoprofile-libsframe prev-libsframe || test -f stageautoprofile-lean +@endif libsframe @[ -d stageautofeedback-$(TARGET_SUBDIR) ] || \ mkdir stageautofeedback-$(TARGET_SUBDIR); \ mv stageautofeedback-$(TARGET_SUBDIR) $(TARGET_SUBDIR); \ @@ -62340,6 +63602,12 @@ stageautofeedback-end:: mv prev-libctf stageautoprofile-libctf; : ; \ fi @endif libctf +@if libsframe + @if test -d $(HOST_SUBDIR)/libsframe; then \ + cd $(HOST_SUBDIR); mv libsframe stageautofeedback-libsframe; \ + mv prev-libsframe stageautoprofile-libsframe; : ; \ + fi +@endif libsframe @if test -d $(TARGET_SUBDIR); then \ mv $(TARGET_SUBDIR) stageautofeedback-$(TARGET_SUBDIR); \ mv prev-$(TARGET_SUBDIR) stageautoprofile-$(TARGET_SUBDIR); : ; \ @@ -63259,6 +64527,16 @@ all-stagetrain-ld: maybe-all-stagetrain-libctf all-stagefeedback-ld: maybe-all-stagefeedback-libctf all-stageautoprofile-ld: maybe-all-stageautoprofile-libctf all-stageautofeedback-ld: maybe-all-stageautofeedback-libctf +all-binutils: maybe-all-libsframe +all-stage1-binutils: maybe-all-stage1-libsframe +all-stage2-binutils: maybe-all-stage2-libsframe +all-stage3-binutils: maybe-all-stage3-libsframe +all-stage4-binutils: maybe-all-stage4-libsframe +all-stageprofile-binutils: maybe-all-stageprofile-libsframe +all-stagetrain-binutils: maybe-all-stagetrain-libsframe +all-stagefeedback-binutils: maybe-all-stagefeedback-libsframe +all-stageautoprofile-binutils: maybe-all-stageautoprofile-libsframe +all-stageautofeedback-binutils: maybe-all-stageautofeedback-libsframe install-binutils: maybe-install-opcodes install-strip-binutils: maybe-install-strip-opcodes install-libctf: maybe-install-bfd diff --git a/binutils/Makefile.am b/binutils/Makefile.am index b249af721ae..6d974fd3f8a 100644 --- a/binutils/Makefile.am +++ b/binutils/Makefile.am @@ -176,6 +176,8 @@ LIBCTF = LIBCTF_NOBFD = endif +LIBSFRAME = ../libsframe/libsframe.la + LIBIBERTY = ../libiberty/libiberty.a POTFILES = $(CFILES) $(DEBUG_SRCS) $(HFILES) diff --git a/binutils/Makefile.in b/binutils/Makefile.in index 51d504ad241..05aca3d3965 100644 --- a/binutils/Makefile.in +++ b/binutils/Makefile.in @@ -741,6 +741,7 @@ OPCODES = ../opcodes/libopcodes.la @ENABLE_LIBCTF_TRUE@LIBCTF = ../libctf/libctf.la @ENABLE_LIBCTF_FALSE@LIBCTF_NOBFD = @ENABLE_LIBCTF_TRUE@LIBCTF_NOBFD = ../libctf/libctf-nobfd.la +LIBSFRAME = ../libsframe/libsframe.la LIBIBERTY = ../libiberty/libiberty.a POTFILES = $(CFILES) $(DEBUG_SRCS) $(HFILES) EXPECT = expect diff --git a/config/dejagnu.m4 b/config/dejagnu.m4 new file mode 100644 index 00000000000..0606e42cb53 --- /dev/null +++ b/config/dejagnu.m4 @@ -0,0 +1,22 @@ +# DEJAGNU_CHECK_VERSION DEJAGNU_CHECK_VERSION +# -------------------------------------------------------------- +# Test whether there is an incompatibility between DejaGnu and GCC versions. +# Older versions ( <= 1.5.1 ) of dejagnu.h use GNU inline semantics improperly. +# The issue presents itself as link-time errors complaining about undefined +# references to 'pass' and 'fail'. +AC_DEFUN([DEJAGNU_CHECK_VERSION], +[ + AC_MSG_CHECKING([for incompatibility between DejaGnu and GCC]) + AC_MSG_RESULT([$ac_cv_dejagnu_compat]) + + AC_TRY_LINK([#include ], + [pass ("test foo"); + return 0;], + [ac_cv_dejagnu_compat=yes], + [ac_cv_dejagnu_compat=no]) + AC_MSG_RESULT([$ac_cv_dejagnu_compat]) + + if test "$ac_cv_dejagnu_compat}" = no ; then + AC_MSG_RESULT([detected incompatibility between dejagnu version and gcc]) + fi +]) diff --git a/configure b/configure index 7bcb894d1fe..80b2b02fe7e 100755 --- a/configure +++ b/configure @@ -2821,7 +2821,7 @@ build_tools="build-texinfo build-flex build-bison build-m4 build-fixincludes" # these libraries are used by various programs built for the host environment #f -host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktrace libcpp libcody libdecnumber gmp mpfr mpc isl libiconv libctf" +host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktrace libcpp libcody libdecnumber gmp mpfr mpc isl libiconv libctf libsframe" # these tools are built for the host environment # Note, the powerpc-eabi build depends on sim occurring before gdb in order to diff --git a/configure.ac b/configure.ac index aab451467bd..36267d85785 100644 --- a/configure.ac +++ b/configure.ac @@ -133,7 +133,7 @@ build_tools="build-texinfo build-flex build-bison build-m4 build-fixincludes" # these libraries are used by various programs built for the host environment #f -host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktrace libcpp libcody libdecnumber gmp mpfr mpc isl libiconv libctf" +host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktrace libcpp libcody libdecnumber gmp mpfr mpc isl libiconv libctf libsframe" # these tools are built for the host environment # Note, the powerpc-eabi build depends on sim occurring before gdb in order to diff --git a/include/sframe-api.h b/include/sframe-api.h new file mode 100644 index 00000000000..ededf703320 --- /dev/null +++ b/include/sframe-api.h @@ -0,0 +1,231 @@ +/* Public API to SFrame. + + Copyright (C) 2022 Free Software Foundation, Inc. + + This file is part of libsframe. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef _SFRAME_API_H +#define _SFRAME_API_H + +#include + +#ifdef __cplusplus +extern "C" +{ +#endif + +typedef struct sframe_decoder_ctx sframe_decoder_ctx; +typedef struct sframe_encoder_ctx sframe_encoder_ctx; + +#define MAX_OFFSET_BYTES (SFRAME_FRE_OFFSET_4B * 2 * 3) + +/* User interfacing SFrame Row Entry. + An abstraction provided by libsframe so the consumer is decoupled from + the binary format representation of the same. */ + +typedef struct sframe_frame_row_entry +{ + uint32_t fre_start_addr; + unsigned char fre_info; + unsigned char fre_offsets[MAX_OFFSET_BYTES]; +} sframe_frame_row_entry; + +#define SFRAME_ERR ((int) -1) + +/* This macro holds information about all the available SFrame + errors. It is used to form both an enum holding all the error + constants, and also the error strings themselves. To use, define + _SFRAME_FIRST and _SFRAME_ITEM to expand as you like, then + mention the macro name. See the enum after this for an example. */ +#define _SFRAME_ERRORS \ + _SFRAME_FIRST (ESFRAME_VERSION_INVAL, "SFrame version not supported.") \ + _SFRAME_ITEM (ESFRAME_NOMEM, "Out of Memory.") \ + _SFRAME_ITEM (ESFRAME_INVAL, "Corrupt SFrame.") \ + _SFRAME_ITEM (ESFRAME_BUF_INVAL, "Buffer does not contain SFrame data.") \ + _SFRAME_ITEM (ESFRAME_DCTX_INVAL, "Corrupt SFrame decoder.") \ + _SFRAME_ITEM (ESFRAME_ECTX_INVAL, "Corrupt SFrame encoder.") \ + _SFRAME_ITEM (ESFRAME_FDE_INVAL, "Corrput FDE.") \ + _SFRAME_ITEM (ESFRAME_FRE_INVAL, "Corrupt FRE.") \ + _SFRAME_ITEM (ESFRAME_FDE_NOTFOUND,"FDE not found.") \ + _SFRAME_ITEM (ESFRAME_FDE_NOTSORTED, "FDEs not sorted.") \ + _SFRAME_ITEM (ESFRAME_FRE_NOTFOUND,"FRE not found.") \ + _SFRAME_ITEM (ESFRAME_FREOFFSET_NOPRESENT,"FRE offset not present.") + +#define ESFRAME_BASE 2000 /* Base value for libsframe errnos. */ + +enum + { +#define _SFRAME_FIRST(NAME, STR) NAME = ESFRAME_BASE +#define _SFRAME_ITEM(NAME, STR) , NAME +_SFRAME_ERRORS +#undef _SFRAME_ITEM +#undef _SFRAME_FIRST + }; + +/* Count of SFrame errors. */ +#define ESFRAME_NERR (ESFRAME_FREOFFSET_NOPRESENT - ESFRAME_BASE + 1) + +/* Get the error message string. */ + +extern const char * +sframe_errmsg (int error); + +/* Get FDE function info given a FRE_TYPE. */ + +extern unsigned char +sframe_fde_func_info (unsigned int fre_type, unsigned int fde_type); + +/* Gather the FRE type given the function size. */ + +extern unsigned int +sframe_calc_fre_type (unsigned int func_size); + +/* The SFrame Decoder. */ + +/* Decode the specified SFrame buffer CF_BUF of size CF_SIZE and return the + new SFrame decoder context. Sets ERRP for the caller if any error. */ +extern sframe_decoder_ctx * +sframe_decode (const char *cf_buf, size_t cf_size, int *errp); + +/* Free the decoder context. */ +extern void +sframe_decoder_free (sframe_decoder_ctx **dctx); + +/* Get the size of the SFrame header from the decoder context DCTX. */ +extern unsigned int +sframe_decoder_get_hdr_size (sframe_decoder_ctx *dctx); + +/* Get the SFrame's abi/arch info. */ +extern unsigned char +sframe_decoder_get_abi_arch (sframe_decoder_ctx *dctx); + +/* Return the number of function descriptor entries in the SFrame decoder + DCTX. */ +unsigned int +sframe_decoder_get_num_fidx (sframe_decoder_ctx *dctx); + +/* Get the fixed FP offset from the decoder context DCTX. */ +extern int8_t +sframe_decoder_get_fixed_fp_offset (sframe_decoder_ctx *dctx); + +/* Get the fixed RA offset from the decoder context DCTX. */ +extern int8_t +sframe_decoder_get_fixed_ra_offset (sframe_decoder_ctx *dctx); + +/* Find the function descriptor entry which contains the specified address. */ +extern sframe_func_desc_entry * +sframe_get_funcdesc_with_addr (sframe_decoder_ctx *dctx, + int32_t addr, int *errp); + +/* Find the SFrame Frame Row Entry which contains the PC. Returns + SFRAME_ERR if failure. */ + +extern int +sframe_find_fre (sframe_decoder_ctx *ctx, int32_t pc, + sframe_frame_row_entry *frep); + +/* Get the FRE_IDX'th FRE of the function at FUNC_IDX'th function + index entry in the SFrame decoder CTX. Returns error code as + applicable. */ +extern int +sframe_decoder_get_fre (sframe_decoder_ctx *ctx, + unsigned int func_idx, + unsigned int fre_idx, + sframe_frame_row_entry *fre); + +/* Get the data (NUM_FRES, FUNC_START_ADDRESS) from the function + descriptor entry at index I'th in the decoder CTX. If failed, + return error code. */ +extern int +sframe_decoder_get_funcdesc (sframe_decoder_ctx *ctx, + unsigned int i, + uint32_t *num_fres, + uint32_t *func_size, + int32_t *func_start_address, + unsigned char *func_info); + + +/* Get the base reg id from the FRE info. Sets errp if fails. */ +extern unsigned int +sframe_fre_get_base_reg_id (sframe_frame_row_entry *fre, int *errp); + +/* Get the CFA offset from the FRE. If the offset is invalid, sets errp. */ +extern int32_t +sframe_fre_get_cfa_offset (sframe_decoder_ctx *dtcx, + sframe_frame_row_entry *fre, int *errp); + +/* Get the FP offset from the FRE. If the offset is invalid, sets errp. */ +extern int32_t +sframe_fre_get_fp_offset (sframe_decoder_ctx *dctx, + sframe_frame_row_entry *fre, int *errp); + +/* Get the RA offset from the FRE. If the offset is invalid, sets errp. */ +extern int32_t +sframe_fre_get_ra_offset (sframe_decoder_ctx *dctx, + sframe_frame_row_entry *fre, int *errp); + +/* The SFrame Encoder. */ + +/* Create an encoder context with the given SFrame format version VER, FLAGS + and ABI information. Sets errp if failure. */ +extern sframe_encoder_ctx * +sframe_encode (unsigned char ver, unsigned char flags, int abi, + int8_t fixed_fp_offset, int8_t fixed_ra_offset, int *errp); + +/* Free the encoder context. */ +extern void +sframe_free_encoder (sframe_encoder_ctx *encoder); + +/* Get the size of the SFrame header from the encoder ctx ENCODER. */ +extern unsigned int +sframe_encoder_get_hdr_size (sframe_encoder_ctx *encoder); + +/* Get the abi/arch info from the SFrame encoder context CTX. */ +extern unsigned char +sframe_encoder_get_abi_arch (sframe_encoder_ctx *encoder); + +/* Return the number of function descriptor entries in the SFrame encoder + ENCODER. */ +extern unsigned int +sframe_encoder_get_num_fidx (sframe_encoder_ctx *encoder); + +/* Add an FRE to function at FUNC_IDX'th function descriptor index entry in + the encoder context. */ +extern int +sframe_encoder_add_fre (sframe_encoder_ctx *encoder, + unsigned int func_idx, + sframe_frame_row_entry *frep); + +/* Add a new function descriptor entry with START_ADDR, FUNC_SIZE and NUM_FRES + to the encoder. */ +extern int +sframe_encoder_add_funcdesc (sframe_encoder_ctx *encoder, + int32_t start_addr, + uint32_t func_size, + unsigned char func_info, + uint32_t num_fres); + +/* Serialize the contents of the encoder and return the buffer. ENCODED_SIZE + is updated to the size of the buffer. Sets ERRP if failure. */ +extern char * +sframe_encoder_write (sframe_encoder_ctx *encoder, + size_t *encoded_size, int *errp); + +#ifdef __cplusplus +} +#endif + +#endif /* _SFRAME_API_H */ diff --git a/libsframe/Makefile.am b/libsframe/Makefile.am new file mode 100644 index 00000000000..940494dba1e --- /dev/null +++ b/libsframe/Makefile.am @@ -0,0 +1,39 @@ +## Process this file with automake to produce Makefile.in. +# +# Copyright (C) 2022 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not see +# . +# +ACLOCAL_AMFLAGS = -I .. -I ../config -I ../bfd + +AUTOMAKE_OPTIONS = dejagnu foreign no-texinfo.tex subdir-objects + +INCDIR = $(srcdir)/../include +# include libctf for swap.h +AM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../libctf +AM_CFLAGS = @ac_libsframe_warn_cflags@ + +if INSTALL_LIBBFD +lib_LTLIBRARIES = libsframe.la +include_HEADERS = $(INCDIR)/sframe.h $(INCDIR)/sframe-api.h +else +include_HEADERS = +noinst_LTLIBRARIES = libsframe.la +endif + +libsframe_la_SOURCES = sframe.c sframe-error.c +libsframe_la_CPPFLAGS = $(AM_CPPFLAGS) + +include testsuite/local.mk diff --git a/libsframe/Makefile.in b/libsframe/Makefile.in new file mode 100644 index 00000000000..2d1ea896471 --- /dev/null +++ b/libsframe/Makefile.in @@ -0,0 +1,1158 @@ +# Makefile.in generated by automake 1.15.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2017 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +check_PROGRAMS = $(am__EXEEXT_1) +@HAVE_COMPAT_DEJAGNU_TRUE@am__append_1 = testsuite/libsframe.decode/be-flipping \ +@HAVE_COMPAT_DEJAGNU_TRUE@ testsuite/libsframe.decode/frecnt-1 \ +@HAVE_COMPAT_DEJAGNU_TRUE@ testsuite/libsframe.decode/frecnt-2 \ +@HAVE_COMPAT_DEJAGNU_TRUE@ testsuite/libsframe.encode/encode-1 +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \ + $(top_srcdir)/../config/acx.m4 \ + $(top_srcdir)/../config/dejagnu.m4 \ + $(top_srcdir)/../config/depstand.m4 \ + $(top_srcdir)/../config/jobserver.m4 \ + $(top_srcdir)/../config/lead-dot.m4 \ + $(top_srcdir)/../config/override.m4 \ + $(top_srcdir)/../config/warnings.m4 \ + $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \ + $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \ + $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ + $(am__configure_deps) $(am__include_HEADERS_DIST) \ + $(am__DIST_COMMON) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" +LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) +libsframe_la_LIBADD = +am_libsframe_la_OBJECTS = libsframe_la-sframe.lo \ + libsframe_la-sframe-error.lo +libsframe_la_OBJECTS = $(am_libsframe_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +@INSTALL_LIBBFD_FALSE@am_libsframe_la_rpath = +@INSTALL_LIBBFD_TRUE@am_libsframe_la_rpath = -rpath $(libdir) +@HAVE_COMPAT_DEJAGNU_TRUE@am__EXEEXT_1 = testsuite/libsframe.decode/be-flipping$(EXEEXT) \ +@HAVE_COMPAT_DEJAGNU_TRUE@ testsuite/libsframe.decode/frecnt-1$(EXEEXT) \ +@HAVE_COMPAT_DEJAGNU_TRUE@ testsuite/libsframe.decode/frecnt-2$(EXEEXT) \ +@HAVE_COMPAT_DEJAGNU_TRUE@ testsuite/libsframe.encode/encode-1$(EXEEXT) +am__dirstamp = $(am__leading_dot)dirstamp +am_testsuite_libsframe_decode_be_flipping_OBJECTS = testsuite/libsframe.decode/testsuite_libsframe_decode_be_flipping-be-flipping.$(OBJEXT) +testsuite_libsframe_decode_be_flipping_OBJECTS = \ + $(am_testsuite_libsframe_decode_be_flipping_OBJECTS) +testsuite_libsframe_decode_be_flipping_DEPENDENCIES = \ + ${top_builddir}/libsframe.la +am_testsuite_libsframe_decode_frecnt_1_OBJECTS = testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_1-frecnt-1.$(OBJEXT) +testsuite_libsframe_decode_frecnt_1_OBJECTS = \ + $(am_testsuite_libsframe_decode_frecnt_1_OBJECTS) +testsuite_libsframe_decode_frecnt_1_DEPENDENCIES = \ + ${top_builddir}/libsframe.la +am_testsuite_libsframe_decode_frecnt_2_OBJECTS = testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_2-frecnt-2.$(OBJEXT) +testsuite_libsframe_decode_frecnt_2_OBJECTS = \ + $(am_testsuite_libsframe_decode_frecnt_2_OBJECTS) +testsuite_libsframe_decode_frecnt_2_DEPENDENCIES = \ + ${top_builddir}/libsframe.la +am_testsuite_libsframe_encode_encode_1_OBJECTS = testsuite/libsframe.encode/testsuite_libsframe_encode_encode_1-encode-1.$(OBJEXT) +testsuite_libsframe_encode_encode_1_OBJECTS = \ + $(am_testsuite_libsframe_encode_encode_1_OBJECTS) +testsuite_libsframe_encode_encode_1_DEPENDENCIES = \ + ${top_builddir}/libsframe.la +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/../depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libsframe_la_SOURCES) \ + $(testsuite_libsframe_decode_be_flipping_SOURCES) \ + $(testsuite_libsframe_decode_frecnt_1_SOURCES) \ + $(testsuite_libsframe_decode_frecnt_2_SOURCES) \ + $(testsuite_libsframe_encode_encode_1_SOURCES) +DIST_SOURCES = $(libsframe_la_SOURCES) \ + $(testsuite_libsframe_decode_be_flipping_SOURCES) \ + $(testsuite_libsframe_decode_frecnt_1_SOURCES) \ + $(testsuite_libsframe_decode_frecnt_2_SOURCES) \ + $(testsuite_libsframe_encode_encode_1_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__include_HEADERS_DIST = $(INCDIR)/sframe.h $(INCDIR)/sframe-api.h +HEADERS = $(include_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ + $(LISP)config.h.in +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +CSCOPE = cscope +AM_RECURSIVE_TARGETS = cscope +DEJATOOL = $(PACKAGE) +RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(srcdir)/testsuite/libsframe.decode/local.mk \ + $(srcdir)/testsuite/libsframe.encode/local.mk \ + $(srcdir)/testsuite/local.mk $(top_srcdir)/../ar-lib \ + $(top_srcdir)/../compile $(top_srcdir)/../config.guess \ + $(top_srcdir)/../config.sub $(top_srcdir)/../depcomp \ + $(top_srcdir)/../install-sh $(top_srcdir)/../ltmain.sh \ + $(top_srcdir)/../missing $(top_srcdir)/../mkinstalldirs +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__post_remove_distdir = $(am__remove_distdir) +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +DIST_TARGETS = dist-gzip +distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COMPAT_DEJAGNU = @COMPAT_DEJAGNU@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_libsframe_warn_cflags = @ac_libsframe_warn_cflags@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_noncanonical = @host_noncanonical@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +target_noncanonical = @target_noncanonical@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# +# Copyright (C) 2022 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not see +# . +# +ACLOCAL_AMFLAGS = -I .. -I ../config -I ../bfd +AUTOMAKE_OPTIONS = dejagnu foreign no-texinfo.tex subdir-objects +INCDIR = $(srcdir)/../include +# include libctf for swap.h +AM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../libctf +AM_CFLAGS = @ac_libsframe_warn_cflags@ +@INSTALL_LIBBFD_TRUE@lib_LTLIBRARIES = libsframe.la +@INSTALL_LIBBFD_FALSE@include_HEADERS = +@INSTALL_LIBBFD_TRUE@include_HEADERS = $(INCDIR)/sframe.h $(INCDIR)/sframe-api.h +@INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libsframe.la +libsframe_la_SOURCES = sframe.c sframe-error.c +libsframe_la_CPPFLAGS = $(AM_CPPFLAGS) + +# Setup the testing framework +EXPECT = expect +RUNTEST = runtest +RUNTESTFLAGS = +testsuite_libsframe_decode_be_flipping_SOURCES = testsuite/libsframe.decode/be-flipping.c +testsuite_libsframe_decode_be_flipping_LDADD = ${top_builddir}/libsframe.la +testsuite_libsframe_decode_be_flipping_CPPFLAGS = -I${top_srcdir}/../include -Wall +testsuite_libsframe_decode_frecnt_1_SOURCES = testsuite/libsframe.decode/frecnt-1.c +testsuite_libsframe_decode_frecnt_1_LDADD = ${top_builddir}/libsframe.la +testsuite_libsframe_decode_frecnt_1_CPPFLAGS = -I${top_srcdir}/../include -Wall +testsuite_libsframe_decode_frecnt_2_SOURCES = testsuite/libsframe.decode/frecnt-2.c +testsuite_libsframe_decode_frecnt_2_LDADD = ${top_builddir}/libsframe.la +testsuite_libsframe_decode_frecnt_2_CPPFLAGS = -I${top_srcdir}/../include -Wall +testsuite_libsframe_encode_encode_1_SOURCES = testsuite/libsframe.encode/encode-1.c +testsuite_libsframe_encode_encode_1_LDADD = ${top_builddir}/libsframe.la +testsuite_libsframe_encode_encode_1_CPPFLAGS = -I${top_srcdir}/../include -Wall +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +am--refresh: Makefile + @: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/testsuite/local.mk $(srcdir)/testsuite/libsframe.decode/local.mk $(srcdir)/testsuite/libsframe.encode/local.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; +$(srcdir)/testsuite/local.mk $(srcdir)/testsuite/libsframe.decode/local.mk $(srcdir)/testsuite/libsframe.encode/local.mk $(am__empty): + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): + +config.h: stamp-h1 + @test -f $@ || rm -f stamp-h1 + @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libsframe.la: $(libsframe_la_OBJECTS) $(libsframe_la_DEPENDENCIES) $(EXTRA_libsframe_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(am_libsframe_la_rpath) $(libsframe_la_OBJECTS) $(libsframe_la_LIBADD) $(LIBS) + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +testsuite/libsframe.decode/$(am__dirstamp): + @$(MKDIR_P) testsuite/libsframe.decode + @: > testsuite/libsframe.decode/$(am__dirstamp) +testsuite/libsframe.decode/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) testsuite/libsframe.decode/$(DEPDIR) + @: > testsuite/libsframe.decode/$(DEPDIR)/$(am__dirstamp) +testsuite/libsframe.decode/testsuite_libsframe_decode_be_flipping-be-flipping.$(OBJEXT): \ + testsuite/libsframe.decode/$(am__dirstamp) \ + testsuite/libsframe.decode/$(DEPDIR)/$(am__dirstamp) + +testsuite/libsframe.decode/be-flipping$(EXEEXT): $(testsuite_libsframe_decode_be_flipping_OBJECTS) $(testsuite_libsframe_decode_be_flipping_DEPENDENCIES) $(EXTRA_testsuite_libsframe_decode_be_flipping_DEPENDENCIES) testsuite/libsframe.decode/$(am__dirstamp) + @rm -f testsuite/libsframe.decode/be-flipping$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(testsuite_libsframe_decode_be_flipping_OBJECTS) $(testsuite_libsframe_decode_be_flipping_LDADD) $(LIBS) +testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_1-frecnt-1.$(OBJEXT): \ + testsuite/libsframe.decode/$(am__dirstamp) \ + testsuite/libsframe.decode/$(DEPDIR)/$(am__dirstamp) + +testsuite/libsframe.decode/frecnt-1$(EXEEXT): $(testsuite_libsframe_decode_frecnt_1_OBJECTS) $(testsuite_libsframe_decode_frecnt_1_DEPENDENCIES) $(EXTRA_testsuite_libsframe_decode_frecnt_1_DEPENDENCIES) testsuite/libsframe.decode/$(am__dirstamp) + @rm -f testsuite/libsframe.decode/frecnt-1$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(testsuite_libsframe_decode_frecnt_1_OBJECTS) $(testsuite_libsframe_decode_frecnt_1_LDADD) $(LIBS) +testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_2-frecnt-2.$(OBJEXT): \ + testsuite/libsframe.decode/$(am__dirstamp) \ + testsuite/libsframe.decode/$(DEPDIR)/$(am__dirstamp) + +testsuite/libsframe.decode/frecnt-2$(EXEEXT): $(testsuite_libsframe_decode_frecnt_2_OBJECTS) $(testsuite_libsframe_decode_frecnt_2_DEPENDENCIES) $(EXTRA_testsuite_libsframe_decode_frecnt_2_DEPENDENCIES) testsuite/libsframe.decode/$(am__dirstamp) + @rm -f testsuite/libsframe.decode/frecnt-2$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(testsuite_libsframe_decode_frecnt_2_OBJECTS) $(testsuite_libsframe_decode_frecnt_2_LDADD) $(LIBS) +testsuite/libsframe.encode/$(am__dirstamp): + @$(MKDIR_P) testsuite/libsframe.encode + @: > testsuite/libsframe.encode/$(am__dirstamp) +testsuite/libsframe.encode/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) testsuite/libsframe.encode/$(DEPDIR) + @: > testsuite/libsframe.encode/$(DEPDIR)/$(am__dirstamp) +testsuite/libsframe.encode/testsuite_libsframe_encode_encode_1-encode-1.$(OBJEXT): \ + testsuite/libsframe.encode/$(am__dirstamp) \ + testsuite/libsframe.encode/$(DEPDIR)/$(am__dirstamp) + +testsuite/libsframe.encode/encode-1$(EXEEXT): $(testsuite_libsframe_encode_encode_1_OBJECTS) $(testsuite_libsframe_encode_encode_1_DEPENDENCIES) $(EXTRA_testsuite_libsframe_encode_encode_1_DEPENDENCIES) testsuite/libsframe.encode/$(am__dirstamp) + @rm -f testsuite/libsframe.encode/encode-1$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(testsuite_libsframe_encode_encode_1_OBJECTS) $(testsuite_libsframe_encode_encode_1_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + -rm -f testsuite/libsframe.decode/*.$(OBJEXT) + -rm -f testsuite/libsframe.encode/*.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsframe_la-sframe-error.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsframe_la-sframe.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_be_flipping-be-flipping.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_frecnt_1-frecnt-1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_frecnt_2-frecnt-2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@testsuite/libsframe.encode/$(DEPDIR)/testsuite_libsframe_encode_encode_1-encode-1.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +libsframe_la-sframe.lo: sframe.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsframe_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libsframe_la-sframe.lo -MD -MP -MF $(DEPDIR)/libsframe_la-sframe.Tpo -c -o libsframe_la-sframe.lo `test -f 'sframe.c' || echo '$(srcdir)/'`sframe.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsframe_la-sframe.Tpo $(DEPDIR)/libsframe_la-sframe.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sframe.c' object='libsframe_la-sframe.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsframe_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsframe_la-sframe.lo `test -f 'sframe.c' || echo '$(srcdir)/'`sframe.c + +libsframe_la-sframe-error.lo: sframe-error.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsframe_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libsframe_la-sframe-error.lo -MD -MP -MF $(DEPDIR)/libsframe_la-sframe-error.Tpo -c -o libsframe_la-sframe-error.lo `test -f 'sframe-error.c' || echo '$(srcdir)/'`sframe-error.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsframe_la-sframe-error.Tpo $(DEPDIR)/libsframe_la-sframe-error.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sframe-error.c' object='libsframe_la-sframe-error.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsframe_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsframe_la-sframe-error.lo `test -f 'sframe-error.c' || echo '$(srcdir)/'`sframe-error.c + +testsuite/libsframe.decode/testsuite_libsframe_decode_be_flipping-be-flipping.o: testsuite/libsframe.decode/be-flipping.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testsuite_libsframe_decode_be_flipping_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testsuite/libsframe.decode/testsuite_libsframe_decode_be_flipping-be-flipping.o -MD -MP -MF testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_be_flipping-be-flipping.Tpo -c -o testsuite/libsframe.decode/testsuite_libsframe_decode_be_flipping-be-flipping.o `test -f 'testsuite/libsframe.decode/be-flipping.c' || echo '$(srcdir)/'`testsuite/libsframe.decode/be-flipping.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_be_flipping-be-flipping.Tpo testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_be_flipping-be-flipping.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='testsuite/libsframe.decode/be-flipping.c' object='testsuite/libsframe.decode/testsuite_libsframe_decode_be_flipping-be-flipping.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testsuite_libsframe_decode_be_flipping_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testsuite/libsframe.decode/testsuite_libsframe_decode_be_flipping-be-flipping.o `test -f 'testsuite/libsframe.decode/be-flipping.c' || echo '$(srcdir)/'`testsuite/libsframe.decode/be-flipping.c + +testsuite/libsframe.decode/testsuite_libsframe_decode_be_flipping-be-flipping.obj: testsuite/libsframe.decode/be-flipping.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testsuite_libsframe_decode_be_flipping_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testsuite/libsframe.decode/testsuite_libsframe_decode_be_flipping-be-flipping.obj -MD -MP -MF testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_be_flipping-be-flipping.Tpo -c -o testsuite/libsframe.decode/testsuite_libsframe_decode_be_flipping-be-flipping.obj `if test -f 'testsuite/libsframe.decode/be-flipping.c'; then $(CYGPATH_W) 'testsuite/libsframe.decode/be-flipping.c'; else $(CYGPATH_W) '$(srcdir)/testsuite/libsframe.decode/be-flipping.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_be_flipping-be-flipping.Tpo testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_be_flipping-be-flipping.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='testsuite/libsframe.decode/be-flipping.c' object='testsuite/libsframe.decode/testsuite_libsframe_decode_be_flipping-be-flipping.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testsuite_libsframe_decode_be_flipping_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testsuite/libsframe.decode/testsuite_libsframe_decode_be_flipping-be-flipping.obj `if test -f 'testsuite/libsframe.decode/be-flipping.c'; then $(CYGPATH_W) 'testsuite/libsframe.decode/be-flipping.c'; else $(CYGPATH_W) '$(srcdir)/testsuite/libsframe.decode/be-flipping.c'; fi` + +testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_1-frecnt-1.o: testsuite/libsframe.decode/frecnt-1.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testsuite_libsframe_decode_frecnt_1_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_1-frecnt-1.o -MD -MP -MF testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_frecnt_1-frecnt-1.Tpo -c -o testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_1-frecnt-1.o `test -f 'testsuite/libsframe.decode/frecnt-1.c' || echo '$(srcdir)/'`testsuite/libsframe.decode/frecnt-1.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_frecnt_1-frecnt-1.Tpo testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_frecnt_1-frecnt-1.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='testsuite/libsframe.decode/frecnt-1.c' object='testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_1-frecnt-1.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testsuite_libsframe_decode_frecnt_1_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_1-frecnt-1.o `test -f 'testsuite/libsframe.decode/frecnt-1.c' || echo '$(srcdir)/'`testsuite/libsframe.decode/frecnt-1.c + +testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_1-frecnt-1.obj: testsuite/libsframe.decode/frecnt-1.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testsuite_libsframe_decode_frecnt_1_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_1-frecnt-1.obj -MD -MP -MF testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_frecnt_1-frecnt-1.Tpo -c -o testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_1-frecnt-1.obj `if test -f 'testsuite/libsframe.decode/frecnt-1.c'; then $(CYGPATH_W) 'testsuite/libsframe.decode/frecnt-1.c'; else $(CYGPATH_W) '$(srcdir)/testsuite/libsframe.decode/frecnt-1.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_frecnt_1-frecnt-1.Tpo testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_frecnt_1-frecnt-1.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='testsuite/libsframe.decode/frecnt-1.c' object='testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_1-frecnt-1.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testsuite_libsframe_decode_frecnt_1_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_1-frecnt-1.obj `if test -f 'testsuite/libsframe.decode/frecnt-1.c'; then $(CYGPATH_W) 'testsuite/libsframe.decode/frecnt-1.c'; else $(CYGPATH_W) '$(srcdir)/testsuite/libsframe.decode/frecnt-1.c'; fi` + +testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_2-frecnt-2.o: testsuite/libsframe.decode/frecnt-2.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testsuite_libsframe_decode_frecnt_2_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_2-frecnt-2.o -MD -MP -MF testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_frecnt_2-frecnt-2.Tpo -c -o testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_2-frecnt-2.o `test -f 'testsuite/libsframe.decode/frecnt-2.c' || echo '$(srcdir)/'`testsuite/libsframe.decode/frecnt-2.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_frecnt_2-frecnt-2.Tpo testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_frecnt_2-frecnt-2.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='testsuite/libsframe.decode/frecnt-2.c' object='testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_2-frecnt-2.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testsuite_libsframe_decode_frecnt_2_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_2-frecnt-2.o `test -f 'testsuite/libsframe.decode/frecnt-2.c' || echo '$(srcdir)/'`testsuite/libsframe.decode/frecnt-2.c + +testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_2-frecnt-2.obj: testsuite/libsframe.decode/frecnt-2.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testsuite_libsframe_decode_frecnt_2_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_2-frecnt-2.obj -MD -MP -MF testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_frecnt_2-frecnt-2.Tpo -c -o testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_2-frecnt-2.obj `if test -f 'testsuite/libsframe.decode/frecnt-2.c'; then $(CYGPATH_W) 'testsuite/libsframe.decode/frecnt-2.c'; else $(CYGPATH_W) '$(srcdir)/testsuite/libsframe.decode/frecnt-2.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_frecnt_2-frecnt-2.Tpo testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_frecnt_2-frecnt-2.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='testsuite/libsframe.decode/frecnt-2.c' object='testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_2-frecnt-2.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testsuite_libsframe_decode_frecnt_2_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testsuite/libsframe.decode/testsuite_libsframe_decode_frecnt_2-frecnt-2.obj `if test -f 'testsuite/libsframe.decode/frecnt-2.c'; then $(CYGPATH_W) 'testsuite/libsframe.decode/frecnt-2.c'; else $(CYGPATH_W) '$(srcdir)/testsuite/libsframe.decode/frecnt-2.c'; fi` + +testsuite/libsframe.encode/testsuite_libsframe_encode_encode_1-encode-1.o: testsuite/libsframe.encode/encode-1.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testsuite_libsframe_encode_encode_1_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testsuite/libsframe.encode/testsuite_libsframe_encode_encode_1-encode-1.o -MD -MP -MF testsuite/libsframe.encode/$(DEPDIR)/testsuite_libsframe_encode_encode_1-encode-1.Tpo -c -o testsuite/libsframe.encode/testsuite_libsframe_encode_encode_1-encode-1.o `test -f 'testsuite/libsframe.encode/encode-1.c' || echo '$(srcdir)/'`testsuite/libsframe.encode/encode-1.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) testsuite/libsframe.encode/$(DEPDIR)/testsuite_libsframe_encode_encode_1-encode-1.Tpo testsuite/libsframe.encode/$(DEPDIR)/testsuite_libsframe_encode_encode_1-encode-1.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='testsuite/libsframe.encode/encode-1.c' object='testsuite/libsframe.encode/testsuite_libsframe_encode_encode_1-encode-1.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testsuite_libsframe_encode_encode_1_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testsuite/libsframe.encode/testsuite_libsframe_encode_encode_1-encode-1.o `test -f 'testsuite/libsframe.encode/encode-1.c' || echo '$(srcdir)/'`testsuite/libsframe.encode/encode-1.c + +testsuite/libsframe.encode/testsuite_libsframe_encode_encode_1-encode-1.obj: testsuite/libsframe.encode/encode-1.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testsuite_libsframe_encode_encode_1_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testsuite/libsframe.encode/testsuite_libsframe_encode_encode_1-encode-1.obj -MD -MP -MF testsuite/libsframe.encode/$(DEPDIR)/testsuite_libsframe_encode_encode_1-encode-1.Tpo -c -o testsuite/libsframe.encode/testsuite_libsframe_encode_encode_1-encode-1.obj `if test -f 'testsuite/libsframe.encode/encode-1.c'; then $(CYGPATH_W) 'testsuite/libsframe.encode/encode-1.c'; else $(CYGPATH_W) '$(srcdir)/testsuite/libsframe.encode/encode-1.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) testsuite/libsframe.encode/$(DEPDIR)/testsuite_libsframe_encode_encode_1-encode-1.Tpo testsuite/libsframe.encode/$(DEPDIR)/testsuite_libsframe_encode_encode_1-encode-1.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='testsuite/libsframe.encode/encode-1.c' object='testsuite/libsframe.encode/testsuite_libsframe_encode_encode_1-encode-1.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testsuite_libsframe_encode_encode_1_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o testsuite/libsframe.encode/testsuite_libsframe_encode_encode_1-encode-1.obj `if test -f 'testsuite/libsframe.encode/encode-1.c'; then $(CYGPATH_W) 'testsuite/libsframe.encode/encode-1.c'; else $(CYGPATH_W) '$(srcdir)/testsuite/libsframe.encode/encode-1.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + -rm -rf testsuite/libsframe.decode/.libs testsuite/libsframe.decode/_libs + -rm -rf testsuite/libsframe.encode/.libs testsuite/libsframe.encode/_libs + +distclean-libtool: + -rm -f libtool config.lt +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscope: cscope.files + test ! -s cscope.files \ + || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) +clean-cscope: + -rm -f cscope.files +cscope.files: clean-cscope cscopelist +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + -rm -f cscope.out cscope.in.out cscope.po.out cscope.files +site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG) + @echo 'Making a new site.exp file ...' + @echo '## these variables are automatically generated by make ##' >site.tmp + @echo '# Do not edit here. If you wish to override these values' >>site.tmp + @echo '# edit the last section' >>site.tmp + @echo 'set srcdir "$(srcdir)"' >>site.tmp + @echo "set objdir `pwd`" >>site.tmp + @echo 'set build_alias "$(build_alias)"' >>site.tmp + @echo 'set build_triplet $(build_triplet)' >>site.tmp + @echo 'set host_alias "$(host_alias)"' >>site.tmp + @echo 'set host_triplet $(host_triplet)' >>site.tmp + @list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \ + echo "## Begin content included from file $$f. Do not modify. ##" \ + && cat `test -f "$$f" || echo '$(srcdir)/'`$$f \ + && echo "## End content included from file $$f. ##" \ + || exit 1; \ + done >> site.tmp + @echo "## End of auto-generated content; you can edit from here. ##" >> site.tmp + @if test -f site.exp; then \ + sed -e '1,/^## End of auto-generated content.*##/d' site.exp >> site.tmp; \ + fi + @-rm -f site.bak + @test ! -f site.exp || mv site.exp site.bak + @mv site.tmp site.exp + +distclean-DEJAGNU: + -rm -f site.exp site.bak + -l='$(DEJATOOL)'; for tool in $$l; do \ + rm -f $$tool.sum $$tool.log; \ + done + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d "$(distdir)" || mkdir "$(distdir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r "$(distdir)" +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz + $(am__post_remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__post_remove_distdir) + +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz + $(am__post_remove_distdir) + +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + $(am__post_remove_distdir) + +dist-tarZ: distdir + @echo WARNING: "Support for distribution archives compressed with" \ + "legacy program 'compress' is deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__post_remove_distdir) + +dist-shar: distdir + @echo WARNING: "Support for shar distribution archives is" \ + "deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz + $(am__post_remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__post_remove_distdir) + +dist dist-all: + $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' + $(am__post_remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir) + chmod u+w $(distdir) + mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build/sub \ + && ../../configure \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + --srcdir=../.. --prefix="$$dc_install_base" \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__post_remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) config.h +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -rm -f testsuite/libsframe.decode/$(DEPDIR)/$(am__dirstamp) + -rm -f testsuite/libsframe.decode/$(am__dirstamp) + -rm -f testsuite/libsframe.encode/$(DEPDIR)/$(am__dirstamp) + -rm -f testsuite/libsframe.encode/$(am__dirstamp) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libtool clean-noinstLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf ./$(DEPDIR) testsuite/libsframe.decode/$(DEPDIR) testsuite/libsframe.encode/$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-DEJAGNU distclean-compile \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includeHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -rf ./$(DEPDIR) testsuite/libsframe.decode/$(DEPDIR) testsuite/libsframe.encode/$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES + +.MAKE: all check-am install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--refresh check check-DEJAGNU \ + check-am clean clean-checkPROGRAMS clean-cscope clean-generic \ + clean-libLTLIBRARIES clean-libtool clean-noinstLTLIBRARIES \ + cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ + dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ + distcheck distclean distclean-DEJAGNU distclean-compile \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-includeHEADERS install-info install-info-am \ + install-libLTLIBRARIES install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-includeHEADERS \ + uninstall-libLTLIBRARIES + +.PRECIOUS: Makefile + + +check-DEJAGNU: site.exp + srcroot=`cd $(srcdir) && pwd`; export srcroot; \ + r=`pwd`; export r; \ + LC_ALL=C; export LC_ALL; \ + EXPECT=$(EXPECT); export EXPECT; \ + runtest=$(RUNTEST); \ + if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ + $$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \ + CC="$(CC)" \ + CROSS_COMPILE="$(CROSS_COMPILE)" \ + COMPAT_DEJAGNU="$(COMPAT_DEJAGNU)" \ + CFLAGS="$(CFLAGS) -I$(top_srcdir)/../include -I$(top_srcdir) -I$(top_builddir)" \ + $(RUNTESTFLAGS); \ + else echo "WARNING: could not find \`runtest'" 1>&2; :;\ + fi + +# libsframe encoder/decoder testsuite + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libsframe/aclocal.m4 b/libsframe/aclocal.m4 new file mode 100644 index 00000000000..b0cdd6b184d --- /dev/null +++ b/libsframe/aclocal.m4 @@ -0,0 +1,1242 @@ +# generated automatically by aclocal 1.15.1 -*- Autoconf -*- + +# Copyright (C) 1996-2017 Free Software Foundation, Inc. + +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, +[m4_warning([this file was generated for autoconf 2.69. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically 'autoreconf'.])]) + +# Copyright (C) 2002-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.15' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.15.1], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.15.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# Copyright (C) 2011-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_AR([ACT-IF-FAIL]) +# ------------------------- +# Try to determine the archiver interface, and trigger the ar-lib wrapper +# if it is needed. If the detection of archiver interface fails, run +# ACT-IF-FAIL (default is to abort configure with a proper error message). +AC_DEFUN([AM_PROG_AR], +[AC_BEFORE([$0], [LT_INIT])dnl +AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl +AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([ar-lib])dnl +AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false]) +: ${AR=ar} + +AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface], + [AC_LANG_PUSH([C]) + am_cv_ar_interface=ar + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])], + [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([am_ar_try]) + if test "$ac_status" -eq 0; then + am_cv_ar_interface=ar + else + am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([am_ar_try]) + if test "$ac_status" -eq 0; then + am_cv_ar_interface=lib + else + am_cv_ar_interface=unknown + fi + fi + rm -f conftest.lib libconftest.a + ]) + AC_LANG_POP([C])]) + +case $am_cv_ar_interface in +ar) + ;; +lib) + # Microsoft lib, so override with the ar-lib wrapper script. + # FIXME: It is wrong to rewrite AR. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__AR in this case, + # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something + # similar. + AR="$am_aux_dir/ar-lib $AR" + ;; +unknown) + m4_default([$1], + [AC_MSG_ERROR([could not determine $AR interface])]) + ;; +esac +AC_SUBST([AR])dnl +]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to +# '$srcdir', '$srcdir/..', or '$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is '.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ([2.52])dnl + m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + + +# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], + [$1], [CXX], [depcc="$CXX" am_compiler_list=], + [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], + [$1], [UPC], [depcc="$UPC" am_compiler_list=], + [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES. +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE([dependency-tracking], [dnl +AS_HELP_STRING( + [--enable-dependency-tracking], + [do not reject slow dependency extractors]) +AS_HELP_STRING( + [--disable-dependency-tracking], + [speeds up one-time build])]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +AC_SUBST([am__nodep])dnl +_AM_SUBST_NOTMAKE([am__nodep])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named 'Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running 'make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "$am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each '.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. +m4_define([AC_PROG_CC], +m4_defn([AC_PROG_CC]) +[_AM_PROG_CC_C_O +]) + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.65])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[AC_DIAGNOSE([obsolete], + [$0: two- and three-arguments forms are deprecated.]) +m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if( + m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + [ok:ok],, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) + AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) +AM_MISSING_PROG([AUTOCONF], [autoconf]) +AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) +AM_MISSING_PROG([AUTOHEADER], [autoheader]) +AM_MISSING_PROG([MAKEINFO], [makeinfo]) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +AC_SUBST([mkdir_p], ['$(MKDIR_P)']) +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES([CC])], + [m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES([CXX])], + [m4_define([AC_PROG_CXX], + m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES([OBJC])], + [m4_define([AC_PROG_OBJC], + m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], + [_AM_DEPENDENCIES([OBJCXX])], + [m4_define([AC_PROG_OBJCXX], + m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl +]) +AC_REQUIRE([AM_SILENT_RULES])dnl +dnl The testsuite driver may need to know about EXEEXT, so add the +dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This +dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) + fi +fi +dnl The trailing newline in this macro's definition is deliberate, for +dnl backward compatibility and to allow trailing 'dnl'-style comments +dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. +]) + +dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST([install_sh])]) + +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- +# From Jim Meyering + +# Copyright (C) 1996-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MAINTAINER_MODE([DEFAULT-MODE]) +# ---------------------------------- +# Control maintainer-specific portions of Makefiles. +# Default is to disable them, unless 'enable' is passed literally. +# For symmetry, 'disable' may be passed as well. Anyway, the user +# can override the default with the --enable/--disable switch. +AC_DEFUN([AM_MAINTAINER_MODE], +[m4_case(m4_default([$1], [disable]), + [enable], [m4_define([am_maintainer_other], [disable])], + [disable], [m4_define([am_maintainer_other], [enable])], + [m4_define([am_maintainer_other], [enable]) + m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) +AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode's default is 'disable' unless 'enable' is passed + AC_ARG_ENABLE([maintainer-mode], + [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], + am_maintainer_other[ make rules and dependencies not useful + (and sometimes confusing) to the casual installer])], + [USE_MAINTAINER_MODE=$enableval], + [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST([MAINT])dnl +] +) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from 'make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it is modern enough. +# If it is, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + AC_MSG_WARN(['missing' script is too old or missing]) +fi +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# -------------------- +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) + +# _AM_SET_OPTIONS(OPTIONS) +# ------------------------ +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Copyright (C) 1999-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_PROG_CC_C_O +# --------------- +# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC +# to automatically call this. +AC_DEFUN([_AM_PROG_CC_C_O], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +AC_LANG_PUSH([C])dnl +AC_CACHE_CHECK( + [whether $CC understands -c and -o together], + [am_cv_prog_cc_c_o], + [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i]) +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +AC_LANG_POP([C])]) + +# For backward compatibility. +AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) + +# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_RUN_LOG(COMMAND) +# ------------------- +# Run COMMAND, save the exit status in ac_status, and log it. +# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) +AC_DEFUN([AM_RUN_LOG], +[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken + alias in your environment]) + fi + if test "$[2]" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT([yes]) +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi +AC_CONFIG_COMMANDS_PRE( + [AC_MSG_CHECKING([that generated files are newer than configure]) + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + AC_MSG_RESULT([done])]) +rm -f conftest.file +]) + +# Copyright (C) 2009-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_SILENT_RULES([DEFAULT]) +# -------------------------- +# Enable less verbose build rules; with the default set to DEFAULT +# ("yes" being less verbose, "no" or empty being verbose). +AC_DEFUN([AM_SILENT_RULES], +[AC_ARG_ENABLE([silent-rules], [dnl +AS_HELP_STRING( + [--enable-silent-rules], + [less verbose build output (undo: "make V=1")]) +AS_HELP_STRING( + [--disable-silent-rules], + [verbose build output (undo: "make V=0")])dnl +]) +case $enable_silent_rules in @%:@ ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; +esac +dnl +dnl A few 'make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + dnl Using '$V' instead of '$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl +AC_SUBST([AM_DEFAULT_VERBOSITY])dnl +AM_BACKSLASH='\' +AC_SUBST([AM_BACKSLASH])dnl +_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl +]) + +# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor 'install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in "make install-strip", and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# -------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004-2017 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of 'v7', 'ustar', or 'pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +# +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' + +m4_if([$1], [v7], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], + + [m4_case([$1], + [ustar], + [# The POSIX 1988 'ustar' format is defined with fixed-size fields. + # There is notably a 21 bits limit for the UID and the GID. In fact, + # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 + # and bug#13588). + am_max_uid=2097151 # 2^21 - 1 + am_max_gid=$am_max_uid + # The $UID and $GID variables are not portable, so we need to resort + # to the POSIX-mandated id(1) utility. Errors in the 'id' calls + # below are definitely unexpected, so allow the users to see them + # (that is, avoid stderr redirection). + am_uid=`id -u || echo unknown` + am_gid=`id -g || echo unknown` + AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) + if test $am_uid -le $am_max_uid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi + AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) + if test $am_gid -le $am_max_gid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi], + + [pax], + [], + + [m4_fatal([Unknown tar format])]) + + AC_MSG_CHECKING([how to create a $1 tar archive]) + + # Go ahead even if we have the value already cached. We do so because we + # need to set the values for the 'am__tar' and 'am__untar' variables. + _am_tools=${am_cv_prog_tar_$1-$_am_tools} + + for _am_tool in $_am_tools; do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works. + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi + done + rm -rf conftest.dir + + AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) + AC_MSG_RESULT([$am_cv_prog_tar_$1])]) + +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([../bfd/acinclude.m4]) +m4_include([../config/acx.m4]) +m4_include([../config/dejagnu.m4]) +m4_include([../config/depstand.m4]) +m4_include([../config/jobserver.m4]) +m4_include([../config/lead-dot.m4]) +m4_include([../config/override.m4]) +m4_include([../config/warnings.m4]) +m4_include([../libtool.m4]) +m4_include([../ltoptions.m4]) +m4_include([../ltsugar.m4]) +m4_include([../ltversion.m4]) +m4_include([../lt~obsolete.m4]) diff --git a/libsframe/config.h.in b/libsframe/config.h.in new file mode 100644 index 00000000000..74810fd30df --- /dev/null +++ b/libsframe/config.h.in @@ -0,0 +1,132 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_BYTESWAP_H + +/* Define to 1 if you have the declaration of `bswap_16', and to 0 if you + don't. */ +#undef HAVE_DECL_BSWAP_16 + +/* Define to 1 if you have the declaration of `bswap_32', and to 0 if you + don't. */ +#undef HAVE_DECL_BSWAP_32 + +/* Define to 1 if you have the declaration of `bswap_64', and to 0 if you + don't. */ +#undef HAVE_DECL_BSWAP_64 + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ENDIAN_H + +/* Define to 1 if you have the `getpagesize' function. */ +#undef HAVE_GETPAGESIZE + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif + + +/* Version number of package */ +#undef VERSION + +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* Define to 1 if on MINIX. */ +#undef _MINIX + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#undef _POSIX_1_SOURCE + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#undef _POSIX_SOURCE diff --git a/libsframe/configure.ac b/libsframe/configure.ac new file mode 100644 index 00000000000..a6c1d26bbbb --- /dev/null +++ b/libsframe/configure.ac @@ -0,0 +1,75 @@ +dnl -*- Autoconf -*- +dnl Process this file with autoconf to produce a configure script. +dnl +dnl Copyright (C) 2022 Free Software Foundation, Inc. +dnl +dnl This file is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; see the file COPYING. If not see +dnl . +dnl + +AC_INIT([libsframe], BFD_VERSION) +AC_CONFIG_SRCDIR(sframe.c) +AC_USE_SYSTEM_EXTENSIONS +AM_INIT_AUTOMAKE + +# Checks for programs. +AC_PROG_MAKE_SET +AC_PROG_CC +AC_PROG_RANLIB +AM_PROG_AR + +dnl Default to a non shared library. This may be overridden by the +dnl configure option --enable-shared. +AC_DISABLE_SHARED + +LT_INIT +AC_SYS_LARGEFILE + +MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing +AC_CHECK_PROGS([ACLOCAL], [aclocal], [$MISSING aclocal]) +AC_CHECK_PROGS([AUTOCONF], [autoconf], [$MISSING autoconf]) +AC_CHECK_PROGS([AUTOHEADER], [autoheader], [$MISSING autoheader]) + +dnl Figure out what compiler warnings we can enable. +dnl See config/warnings.m4 for details. + +ACX_PROG_CC_WARNING_OPTS([-Wall -Wextra -Wwrite-strings \ + -Wmissing-format-attribute \ + -Wstrict-prototypes -Wmissing-prototypes], + [ac_libsframe_warn_cflags]) + +dnl The libsframe testsuite uses dejagnu.h. +dnl If the version of dejagnu and gcc are incompatible then the libsframe +dnl testsuite is not built. + +DEJAGNU_CHECK_VERSION +AM_CONDITIONAL([HAVE_COMPAT_DEJAGNU], [test "x$ac_cv_dejagnu_compat" = "xyes"]) + +COMPAT_DEJAGNU=$ac_cv_dejagnu_compat +AC_SUBST(COMPAT_DEJAGNU) + +AM_MAINTAINER_MODE +AM_INSTALL_LIBBFD + +AC_FUNC_MMAP +AC_CHECK_HEADERS(byteswap.h endian.h) + +dnl Check for bswap_{16,32,64} +AC_CHECK_DECLS([bswap_16, bswap_32, bswap_64], [], [], [[#include ]]) + +AC_CONFIG_FILES(Makefile) +AC_CONFIG_HEADERS(config.h) +AC_OUTPUT + +GNU_MAKE_JOBSERVER diff --git a/libsframe/sframe-error.c b/libsframe/sframe-error.c new file mode 100644 index 00000000000..124738f6901 --- /dev/null +++ b/libsframe/sframe-error.c @@ -0,0 +1,49 @@ +/* sframe-error.c - Error messages. + + Copyright (C) 2022 Free Software Foundation, Inc. + + This file is part of libsframe. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include "sframe-api.h" +#include +#include + +/* In this file, we want to treat the first item of the SFrame error + macro like subsequent items. */ +#define _SFRAME_FIRST(NAME, VALUE) _SFRAME_ITEM(NAME, VALUE) + +/* The error message strings, each in a unique structure member precisely big + enough for that error, plus a str member to access them all as a string + table. */ + +static const char *const _sframe_errlist[] = { +#define _SFRAME_ITEM(n, s) s, +_SFRAME_ERRORS +#undef _SFRAME_ITEM +}; + +const char * +sframe_errmsg (int error) +{ + const char *str; + + if (error >= ESFRAME_BASE && (error - ESFRAME_BASE) < ESFRAME_NERR) + str = _sframe_errlist[error - ESFRAME_BASE]; + else + str = (const char *) strerror (error); + + return (str ? str : "Unknown error"); +} diff --git a/libsframe/sframe-impl.h b/libsframe/sframe-impl.h new file mode 100644 index 00000000000..0e61c977886 --- /dev/null +++ b/libsframe/sframe-impl.h @@ -0,0 +1,55 @@ +/* Implementation header. + + Copyright (C) 2022 Free Software Foundation, Inc. + + This file is part of libsframe. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef _SFRAME_IMPL_H +#define _SFRAME_IMPL_H + +#include "sframe-api.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include +#define sframe_assert(expr) (assert (expr)) + +struct sframe_decoder_ctx +{ + sframe_header sfd_header; /* SFrame header. */ + uint32_t *sfd_funcdesc; /* SFrame function desc entries table. */ + void *sfd_fres; /* SFrame FRE table. */ + int sfd_fre_nbytes; /* Number of bytes needed for SFrame FREs. */ +}; + +struct sframe_encoder_ctx +{ + sframe_header sfe_header; /* SFrame header. */ + uint32_t *sfe_funcdesc; /* SFrame function desc entries table. */ + sframe_frame_row_entry *sfe_fres; /* SFrame FRE table. */ + uint32_t sfe_fre_nbytes; /* Number of bytes needed for SFrame FREs. */ + char *sfe_data; /* SFrame data buffer. */ + size_t sfe_data_size; /* Size of the SFrame data buffer. */ +}; + +#ifdef __cplusplus +} +#endif + +#endif /* _SFRAME_IMPL_H */ diff --git a/libsframe/sframe.c b/libsframe/sframe.c new file mode 100644 index 00000000000..a1059baf9ae --- /dev/null +++ b/libsframe/sframe.c @@ -0,0 +1,1657 @@ +/* sframe.c - SFrame decoder/encoder. + + Copyright (C) 2022 Free Software Foundation, Inc. + + This file is part of libsframe. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include "config.h" +#include +#include +#include +#include +#include "sframe-impl.h" +#include "swap.h" + +typedef struct sf_funidx_tbl +{ + unsigned int count; + unsigned int alloced; + sframe_func_desc_entry entry[1]; +} sf_funidx_tbl; + +typedef struct sf_fre_tbl +{ + unsigned int count; + unsigned int alloced; + sframe_frame_row_entry entry[1]; +} sf_fre_tbl; + +#define _sf_printflike_(string_index,first_to_check) \ + __attribute__ ((__format__ (__printf__, (string_index), (first_to_check)))) + +static void debug_printf (const char *, ...); + +static int _sframe_debug; /* Control for printing out debug info. */ +static int number_of_entries = 64; + +static void +sframe_init_debug (void) +{ + static int inited; + + if (!inited) + { + _sframe_debug = getenv ("SFRAME_DEBUG") != NULL; + inited = 1; + } +} + +_sf_printflike_ (1, 2) +static void debug_printf (const char *format, ...) +{ + if (_sframe_debug) + { + va_list args; + + va_start (args, format); + vfprintf (stderr, format, args); + va_end (args); + } +} + +/* Generate bitmask of given size in bytes. This is used for + some checks on the FRE start address. + SFRAME_FRE_TYPE_ADDR1 => 1 byte => [ bitmask = 0xff ] + SFRAME_FRE_TYPE_ADDR2 => 2 byte => [ bitmask = 0xffff ] + SFRAME_FRE_TYPE_ADDR4 => 4 byte => [ bitmask = 0xffffffff ]. */ +#define SFRAME_BITMASK_OF_SIZE(size_in_bytes) \ + (((uint64_t)1 << (size_in_bytes*8)) - 1) + +/* Store the specified error code into errp if it is non-NULL. + Return SFRAME_ERR. */ + +static int +sframe_set_errno (int *errp, int error) +{ + if (errp != NULL) + *errp = error; + return SFRAME_ERR; +} + +/* Store the specified error code into errp if it is non-NULL. + Return NULL. */ + +static void * +sframe_ret_set_errno (int *errp, int error) +{ + if (errp != NULL) + *errp = error; + return NULL; +} + +/* Get the SFrame header size. */ + +static uint32_t +sframe_get_hdr_size (sframe_header *sfh) +{ + return SFRAME_V1_HDR_SIZE (*sfh); +} + +/* Access functions for frame row entry data. */ + +static unsigned int +sframe_fre_get_offset_count (unsigned char fre_info) +{ + return SFRAME_V1_FRE_OFFSET_COUNT (fre_info); +} + +static unsigned int +sframe_fre_get_offset_size (unsigned char fre_info) +{ + return SFRAME_V1_FRE_OFFSET_SIZE (fre_info); +} + +/* Access functions for info from function descriptor entry. */ + +static unsigned int +sframe_get_fre_type (sframe_func_desc_entry *fdep) +{ + unsigned int fre_type = 0; + if (fdep) + fre_type = SFRAME_V1_FUNC_FRE_TYPE (fdep->sfde_func_info); + return fre_type; +} + +static unsigned int +sframe_get_fde_type (sframe_func_desc_entry *fdep) +{ + unsigned int fde_type = 0; + if (fdep) + fde_type = SFRAME_V1_FUNC_FDE_TYPE (fdep->sfde_func_info); + return fde_type; +} + +/* Check if flipping is needed, based on ENDIAN. */ + +static int +need_swapping (int endian) +{ + unsigned int ui = 1; + char *c = (char *)&ui; + int is_little = (int)*c; + + switch (endian) + { + case SFRAME_ABI_AARCH64_ENDIAN_LITTLE: + case SFRAME_ABI_AMD64_ENDIAN_LITTLE: + return !is_little; + case SFRAME_ABI_AARCH64_ENDIAN_BIG: + return is_little; + default: + break; + } + + return 0; +} + +/* Flip the endianness of the SFrame header. */ + +static void +flip_header (sframe_header *sfheader) +{ + swap_thing (sfheader->sfh_preamble.sfp_magic); + swap_thing (sfheader->sfh_preamble.sfp_version); + swap_thing (sfheader->sfh_preamble.sfp_flags); + swap_thing (sfheader->sfh_cfa_fixed_fp_offset); + swap_thing (sfheader->sfh_cfa_fixed_ra_offset); + swap_thing (sfheader->sfh_num_fdes); + swap_thing (sfheader->sfh_num_fres); + swap_thing (sfheader->sfh_fre_len); + swap_thing (sfheader->sfh_fdeoff); + swap_thing (sfheader->sfh_freoff); +} + +static void +flip_fde (sframe_func_desc_entry *fdep) +{ + swap_thing (fdep->sfde_func_start_address); + swap_thing (fdep->sfde_func_size); + swap_thing (fdep->sfde_func_start_fre_off); + swap_thing (fdep->sfde_func_num_fres); +} + +/* Check if SFrame header has valid data. */ + +static int +sframe_header_sanity_check_p (sframe_header *hp) +{ + unsigned char all_flags = SFRAME_F_FDE_SORTED | SFRAME_F_FRAME_POINTER; + /* Check preamble is valid. */ + if ((hp->sfh_preamble.sfp_magic != SFRAME_MAGIC) + || (hp->sfh_preamble.sfp_version != SFRAME_VERSION) + || ((hp->sfh_preamble.sfp_flags | all_flags) + != all_flags)) + return 0; + + /* Check offsets are valid. */ + if (hp->sfh_fdeoff > hp->sfh_freoff) + return 0; + + return 1; +} + +/* Flip the start address pointed to by FP. */ + +static void +flip_fre_start_address (char *fp, unsigned int fre_type) +{ + void *start = (void*)fp; + if (fre_type == SFRAME_FRE_TYPE_ADDR2) + { + unsigned short *start_addr = (unsigned short *)(start); + swap_thing (*start_addr); + } + else if (fre_type == SFRAME_FRE_TYPE_ADDR4) + { + uint32_t *start_addr = (uint32_t *)(start); + swap_thing (*start_addr); + } +} + +static void +flip_fre_stack_offsets (char *fp, unsigned char offset_size, + unsigned char offset_cnt) +{ + int j; + void *offsets = (void *)fp; + + if (offset_size == SFRAME_FRE_OFFSET_2B) + { + unsigned short *ust = (unsigned short *)offsets; + for (j = offset_cnt; j > 0; ust++, j--) + swap_thing (*ust); + } + else if (offset_size == SFRAME_FRE_OFFSET_4B) + { + uint32_t *uit = (uint32_t *)offsets; + for (j = offset_cnt; j > 0; uit++, j--) + swap_thing (*uit); + } +} + +/* Get the FRE start address size, given the FRE_TYPE. */ + +static size_t +sframe_fre_start_addr_size (unsigned int fre_type) +{ + size_t addr_size = 0; + switch (fre_type) + { + case SFRAME_FRE_TYPE_ADDR1: + addr_size = 1; + break; + case SFRAME_FRE_TYPE_ADDR2: + addr_size = 2; + break; + case SFRAME_FRE_TYPE_ADDR4: + addr_size = 4; + break; + default: + /* No other value is expected. */ + sframe_assert (0); + break; + } + return addr_size; +} + +/* Check if the FREP has valid data. */ + +static int +sframe_fre_sanity_check_p (sframe_frame_row_entry *frep) +{ + unsigned int offset_size, offset_cnt; + unsigned int fre_info; + + if (frep == NULL) + return 0; + + fre_info = frep->fre_info; + offset_size = sframe_fre_get_offset_size (fre_info); + + if (offset_size != SFRAME_FRE_OFFSET_1B + && offset_size != SFRAME_FRE_OFFSET_2B + && offset_size != SFRAME_FRE_OFFSET_4B) + return 0; + + offset_cnt = sframe_fre_get_offset_count (fre_info); + if (offset_cnt > 3) + return 0; + + return 1; +} + +/* Get FRE_INFO's offset size in bytes. */ + +static size_t +sframe_fre_offset_bytes_size (unsigned char fre_info) +{ + unsigned int offset_size, offset_cnt; + + offset_size = sframe_fre_get_offset_size (fre_info); + + debug_printf ("offset_size = %u\n", offset_size); + + offset_cnt = sframe_fre_get_offset_count (fre_info); + + if (offset_size == SFRAME_FRE_OFFSET_2B + || offset_size == SFRAME_FRE_OFFSET_4B) /* 2 or 4 bytes. */ + return (offset_cnt * (offset_size * 2)); + + return (offset_cnt); +} + +/* Get total size in bytes to represent FREP in the binary format. This + includes the starting address, FRE info, and all the offsets. */ + +static size_t +sframe_fre_entry_size (sframe_frame_row_entry *frep, unsigned int fre_type) +{ + if (frep == NULL) + return 0; + + unsigned char fre_info = frep->fre_info; + size_t addr_size = sframe_fre_start_addr_size (fre_type); + + return (addr_size + sizeof (frep->fre_info) + + sframe_fre_offset_bytes_size (fre_info)); +} + +static int +flip_fre (char *fp, unsigned int fre_type, size_t *fre_size) +{ + unsigned char fre_info; + unsigned int offset_size, offset_cnt; + size_t addr_size, fre_info_size = 0; + int err = 0; + + if (fre_size == NULL) + return sframe_set_errno (&err, ESFRAME_INVAL); + + flip_fre_start_address (fp, fre_type); + + /* Advance the buffer pointer to where the FRE info is. */ + addr_size = sframe_fre_start_addr_size (fre_type); + fp += addr_size; + + /* FRE info is unsigned char. No need to flip. */ + fre_info = *(unsigned char*)fp; + offset_size = sframe_fre_get_offset_size (fre_info); + offset_cnt = sframe_fre_get_offset_count (fre_info); + + /* Advance the buffer pointer to where the stack offsets are. */ + fre_info_size = sizeof (unsigned char); + fp += fre_info_size; + flip_fre_stack_offsets (fp, offset_size, offset_cnt); + + *fre_size + = addr_size + fre_info_size + sframe_fre_offset_bytes_size (fre_info); + + return 0; +} + +/* Endian flip the contents of FRAME_BUF of size BUF_SIZE. + The SFrame header in the FRAME_BUF must be endian flipped prior to + calling flip_sframe. + + Endian flipping at decode time vs encode time have different needs. At + encode time, the frame_buf is in host endianness, and hence, values should + be read up before the buffer is changed to foreign endianness. This change + of behaviour is specified via TO_FOREIGN arg. + + If an error code is returned, the buffer should not be used. */ + +static int +flip_sframe (char *frame_buf, size_t buf_size, uint32_t to_foreign) +{ + unsigned int i, j, prev_frep_index; + sframe_header *ihp; + char *fdes; + char *fp = NULL; + sframe_func_desc_entry *fdep; + unsigned int num_fdes, num_fres; + unsigned int fre_type; + uint32_t fre_offset; + size_t esz; + int err = 0; + + /* Header must be in host endianness at this time. */ + ihp = (sframe_header *)frame_buf; + + if (!sframe_header_sanity_check_p (ihp)) + return sframe_set_errno (&err, ESFRAME_BUF_INVAL); + + /* The contents of the SFrame header are safe to read. Get the number of + FDEs and the first FDE in the buffer. */ + num_fdes = ihp->sfh_num_fdes; + fdes = frame_buf + sframe_get_hdr_size (ihp) + ihp->sfh_fdeoff; + fdep = (sframe_func_desc_entry *)fdes; + + j = 0; + prev_frep_index = 0; + for (i = 0; i < num_fdes; fdep++, i++) + { + if (to_foreign) + { + num_fres = fdep->sfde_func_num_fres; + fre_type = sframe_get_fre_type (fdep); + fre_offset = fdep->sfde_func_start_fre_off; + } + + flip_fde (fdep); + + if (!to_foreign) + { + num_fres = fdep->sfde_func_num_fres; + fre_type = sframe_get_fre_type (fdep); + fre_offset = fdep->sfde_func_start_fre_off; + } + + fp = frame_buf + sframe_get_hdr_size (ihp) + ihp->sfh_freoff; + fp += fre_offset; + for (; j < prev_frep_index + num_fres; j++) + { + if (flip_fre (fp, fre_type, &esz)) + goto bad; + + if (esz == 0) + goto bad; + fp += esz; + } + prev_frep_index = j; + } + /* All FREs must have been endian flipped by now. */ + if (j != ihp->sfh_num_fres) + goto bad; + /* Contents, if any, must have been processed by now. + Recall that .sframe section with just a SFrame header may be generated by + GAS if no SFrame FDEs were found for the input file. */ + if (ihp->sfh_num_fres && ((frame_buf + buf_size) != (void*)fp)) + goto bad; + + /* Success. */ + return 0; +bad: + return SFRAME_ERR; +} + +/* The SFrame Decoder. */ + +/* Get DECODER's SFrame header. */ + +static sframe_header * +sframe_decoder_get_header (sframe_decoder_ctx *decoder) +{ + sframe_header *hp = NULL; + if (decoder != NULL) + hp = &decoder->sfd_header; + return hp; +} + +/* Compare function for qsort'ing the FDE table. */ + +static int +fde_func (const void *p1, const void *p2) +{ + const sframe_func_desc_entry *aa = p1; + const sframe_func_desc_entry *bb = p2; + + if (aa->sfde_func_start_address < bb->sfde_func_start_address) + return -1; + else if (aa->sfde_func_start_address > bb->sfde_func_start_address) + return 1; + return 0; +} + +/* Get IDX'th offset from FRE. Set errp as applicable. */ + +static int32_t +sframe_get_fre_offset (sframe_frame_row_entry *fre, int idx, int *errp) +{ + int offset_cnt, offset_size; + + if (fre == NULL || !sframe_fre_sanity_check_p (fre)) + return sframe_set_errno (errp, ESFRAME_FRE_INVAL); + + offset_cnt = sframe_fre_get_offset_count (fre->fre_info); + offset_size = sframe_fre_get_offset_size (fre->fre_info); + + if (offset_cnt < idx + 1) + return sframe_set_errno (errp, ESFRAME_FREOFFSET_NOPRESENT); + + if (errp) + *errp = 0; /* Offset Valid. */ + + if (offset_size == SFRAME_FRE_OFFSET_1B) + { + int8_t *sp = (int8_t *)fre->fre_offsets; + return sp[idx]; + } + else if (offset_size == SFRAME_FRE_OFFSET_2B) + { + int16_t *sp = (int16_t *)fre->fre_offsets; + return sp[idx]; + } + else + { + int32_t *ip = (int32_t *)fre->fre_offsets; + return ip[idx]; + } +} + +/* Free the decoder context. */ + +void +sframe_decoder_free (sframe_decoder_ctx **decoder) +{ + if (decoder != NULL) + { + sframe_decoder_ctx *dctx = *decoder; + if (dctx == NULL) + return; + + if (dctx->sfd_funcdesc != NULL) + { + free (dctx->sfd_funcdesc); + dctx->sfd_funcdesc = NULL; + } + if (dctx->sfd_fres != NULL) + { + free (dctx->sfd_fres); + dctx->sfd_fres = NULL; + } + + free (*decoder); + *decoder = NULL; + } +} + +/* Create a FDE function info byte given an FRE_TYPE and an FDE_TYPE. */ +/* FIXME API for linker. Revisit if its better placed somewhere else? */ + +unsigned char +sframe_fde_func_info (unsigned int fre_type, + unsigned int fde_type) +{ + unsigned char func_info; + sframe_assert (fre_type == SFRAME_FRE_TYPE_ADDR1 + || fre_type == SFRAME_FRE_TYPE_ADDR2 + || fre_type == SFRAME_FRE_TYPE_ADDR4); + sframe_assert (fde_type == SFRAME_FDE_TYPE_PCINC + || fde_type == SFRAME_FDE_TYPE_PCMASK); + func_info = SFRAME_V1_FUNC_INFO (fde_type, fre_type); + return func_info; +} + +/* Get the FRE type given the function size. */ +/* FIXME API for linker. Revisit if its better placed somewhere else? */ + +unsigned int +sframe_calc_fre_type (unsigned int func_size) +{ + unsigned int fre_type = 0; + if (func_size <= 0xff) + fre_type = SFRAME_FRE_TYPE_ADDR1; + else if (func_size <= 0xffff) + fre_type = SFRAME_FRE_TYPE_ADDR2; + else if (func_size <= 0xffffffff) + fre_type = SFRAME_FRE_TYPE_ADDR4; + return fre_type; +} + +/* Get the base reg id from the FRE info. Set errp if failure. */ + +unsigned int +sframe_fre_get_base_reg_id (sframe_frame_row_entry *fre, int *errp) +{ + if (fre == NULL) + return sframe_set_errno (errp, ESFRAME_FRE_INVAL); + + unsigned int fre_info = fre->fre_info; + return SFRAME_V1_FRE_CFA_BASE_REG_ID (fre_info); +} + +/* Get the CFA offset from the FRE. If the offset is invalid, sets errp. */ + +int32_t +sframe_fre_get_cfa_offset (sframe_decoder_ctx *dctx ATTRIBUTE_UNUSED, + sframe_frame_row_entry *fre, int *errp) +{ + return sframe_get_fre_offset (fre, SFRAME_FRE_CFA_OFFSET_IDX, errp); +} + +/* Get the FP offset from the FRE. If the offset is invalid, sets errp. */ + +int32_t +sframe_fre_get_fp_offset (sframe_decoder_ctx *dctx, + sframe_frame_row_entry *fre, int *errp) +{ + uint32_t fp_offset_idx = 0; + sframe_header *dhp = sframe_decoder_get_header (dctx); + /* If the FP offset is not being tracked, return an error code so the caller + can gather the fixed FP offset from the SFrame header. */ + if (dhp->sfh_cfa_fixed_fp_offset != SFRAME_CFA_FIXED_FP_INVALID) + return sframe_set_errno (errp, ESFRAME_FREOFFSET_NOPRESENT); + + /* In some ABIs, the stack offset to recover RA (using the CFA) from is + fixed (like AMD64). In such cases, the stack offset to recover FP will + appear at the second index. */ + fp_offset_idx = ((dhp->sfh_cfa_fixed_ra_offset != SFRAME_CFA_FIXED_RA_INVALID) + ? SFRAME_FRE_RA_OFFSET_IDX + : SFRAME_FRE_FP_OFFSET_IDX); + return sframe_get_fre_offset (fre, fp_offset_idx, errp); +} + +/* Get the RA offset from the FRE. If the offset is invalid, sets errp. */ + +int32_t +sframe_fre_get_ra_offset (sframe_decoder_ctx *dctx, + sframe_frame_row_entry *fre, int *errp) +{ + sframe_header *dhp = sframe_decoder_get_header (dctx); + /* If the RA offset was not being tracked, return an error code so the caller + can gather the fixed RA offset from the SFrame header. */ + if (dhp->sfh_cfa_fixed_ra_offset != SFRAME_CFA_FIXED_RA_INVALID) + return sframe_set_errno (errp, ESFRAME_FREOFFSET_NOPRESENT); + + /* Otherwise, get the RA offset from the FRE. */ + return sframe_get_fre_offset (fre, SFRAME_FRE_RA_OFFSET_IDX, errp); +} + +static int +sframe_frame_row_entry_copy (sframe_frame_row_entry *dst, sframe_frame_row_entry *src) +{ + int err = 0; + + if (dst == NULL || src == NULL) + return sframe_set_errno (&err, ESFRAME_INVAL); + + memcpy (dst, src, sizeof (sframe_frame_row_entry)); + return 0; +} + +static int +sframe_decode_fre_start_address (const char *fre_buf, + uint32_t *fre_start_addr, + unsigned int fre_type) +{ + uint32_t saddr = 0; + int err = 0; + + if (fre_type == SFRAME_FRE_TYPE_ADDR1) + { + uint8_t *uc = (uint8_t *)fre_buf; + saddr = (uint32_t)*uc; + } + else if (fre_type == SFRAME_FRE_TYPE_ADDR2) + { + uint16_t *ust = (uint16_t *)fre_buf; + saddr = (uint32_t)*ust; + } + else if (fre_type == SFRAME_FRE_TYPE_ADDR4) + { + uint32_t *uit = (uint32_t *)fre_buf; + saddr = (uint32_t)*uit; + } + else + return sframe_set_errno (&err, ESFRAME_INVAL); + + *fre_start_addr = saddr; + return 0; +} + +/* Decode a frame row entry FRE which starts at location FRE_BUF. The function + updates ESZ to the size of the FRE as stored in the binary format. + + This function works closely with the SFrame binary format. + + Returns SFRAME_ERR if failure. */ + +static int +sframe_decode_fre (const char *fre_buf, sframe_frame_row_entry *fre, + unsigned int fre_type, + size_t *esz) +{ + int err = 0; + void *stack_offsets = NULL; + size_t stack_offsets_sz; + size_t addr_size; + size_t fre_size; + + if (fre_buf == NULL || fre == NULL || esz == NULL) + return sframe_set_errno (&err, ESFRAME_INVAL); + + /* Copy over the FRE start address. */ + sframe_decode_fre_start_address (fre_buf, &fre->fre_start_addr, fre_type); + + addr_size = sframe_fre_start_addr_size (fre_type); + fre->fre_info = *(unsigned char *)(fre_buf + addr_size); + /* Sanity check as the API works closely with the binary format. */ + sframe_assert (sizeof (fre->fre_info) == sizeof (unsigned char)); + + /* Cleanup the space for fre_offsets first, then copy over the valid + bytes. */ + memset (fre->fre_offsets, 0, MAX_OFFSET_BYTES); + /* Get offsets size. */ + stack_offsets_sz = sframe_fre_offset_bytes_size (fre->fre_info); + stack_offsets = (unsigned char *)fre_buf + addr_size + sizeof (fre->fre_info); + memcpy (fre->fre_offsets, stack_offsets, stack_offsets_sz); + + /* The FRE has been decoded. Use it to perform one last sanity check. */ + fre_size = sframe_fre_entry_size (fre, fre_type); + sframe_assert (fre_size == (addr_size + sizeof (fre->fre_info) + + stack_offsets_sz)); + *esz = fre_size; + + return 0; +} + +/* Decode the specified SFrame buffer CF_BUF of size CF_SIZE and return the + new SFrame decoder context. + + Sets ERRP for the caller if any error. Frees up the allocated memory in + case of error. */ + +sframe_decoder_ctx * +sframe_decode (const char *sf_buf, size_t sf_size, int *errp) +{ + const sframe_preamble *sfp; + size_t hdrsz; + sframe_header *sfheaderp; + sframe_decoder_ctx *dctx; + char *frame_buf; + char *tempbuf = NULL; + + int fidx_size; + uint32_t fre_bytes; + int foreign_endian = 0; + + sframe_init_debug (); + + if ((sf_buf == NULL) || (!sf_size)) + return sframe_ret_set_errno (errp, ESFRAME_INVAL); + else if (sf_size < sizeof (sframe_header)) + return sframe_ret_set_errno (errp, ESFRAME_BUF_INVAL); + + sfp = (const sframe_preamble *) sf_buf; + + debug_printf ("sframe_decode: magic=0x%x version=%u flags=%u\n", + sfp->sfp_magic, sfp->sfp_version, sfp->sfp_flags); + + /* Check for foreign endianness. */ + if (sfp->sfp_magic != SFRAME_MAGIC) + { + if (sfp->sfp_magic == bswap_16 (SFRAME_MAGIC)) + foreign_endian = 1; + else + return sframe_ret_set_errno (errp, ESFRAME_BUF_INVAL); + } + + /* Initialize a new decoder context. */ + if ((dctx = malloc (sizeof (sframe_decoder_ctx))) == NULL) + return sframe_ret_set_errno (errp, ESFRAME_NOMEM); + memset (dctx, 0, sizeof (sframe_decoder_ctx)); + + if (foreign_endian) + { + /* Allocate a new buffer and initialize it. */ + tempbuf = (char *) malloc (sf_size * sizeof (char)); + if (tempbuf == NULL) + return sframe_ret_set_errno (errp, ESFRAME_NOMEM); + memcpy (tempbuf, sf_buf, sf_size); + + /* Flip the header. */ + sframe_header *ihp = (sframe_header *) tempbuf; + flip_header (ihp); + /* Flip the rest of the SFrame section data buffer. */ + if (flip_sframe (tempbuf, sf_size, 0)) + { + free (tempbuf); + return sframe_ret_set_errno (errp, ESFRAME_BUF_INVAL); + } + frame_buf = tempbuf; + } + else + frame_buf = (char *)sf_buf; + + /* Handle the SFrame header. */ + dctx->sfd_header = *(sframe_header *) frame_buf; + /* Validate the contents of SFrame header. */ + sfheaderp = &dctx->sfd_header; + if (!sframe_header_sanity_check_p (sfheaderp)) + { + sframe_ret_set_errno (errp, ESFRAME_NOMEM); + goto decode_fail_free; + } + hdrsz = sframe_get_hdr_size (sfheaderp); + frame_buf += hdrsz; + + /* Handle the SFrame Function Descriptor Entry section. */ + fidx_size + = sfheaderp->sfh_num_fdes * sizeof (sframe_func_desc_entry); + dctx->sfd_funcdesc = malloc (fidx_size); + if (dctx->sfd_funcdesc == NULL) + { + sframe_ret_set_errno (errp, ESFRAME_NOMEM); + goto decode_fail_free; + } + memcpy (dctx->sfd_funcdesc, frame_buf, fidx_size); + + debug_printf ("%u total fidx size\n", fidx_size); + + frame_buf += (fidx_size); + + /* Handle the SFrame Frame Row Entry section. */ + dctx->sfd_fres = malloc (sfheaderp->sfh_fre_len); + if (dctx->sfd_fres == NULL) + { + sframe_ret_set_errno (errp, ESFRAME_NOMEM); + goto decode_fail_free; + } + memcpy (dctx->sfd_fres, frame_buf, sfheaderp->sfh_fre_len); + + fre_bytes = sfheaderp->sfh_fre_len; + dctx->sfd_fre_nbytes = fre_bytes; + + debug_printf ("%u total fre bytes\n", fre_bytes); + + return dctx; + +decode_fail_free: + if (foreign_endian && tempbuf != NULL) + free (tempbuf); + sframe_decoder_free (&dctx); + dctx = NULL; + return dctx; +} + +/* Get the size of the SFrame header from the decoder context CTX. */ + +unsigned int +sframe_decoder_get_hdr_size (sframe_decoder_ctx *ctx) +{ + sframe_header *dhp; + dhp = sframe_decoder_get_header (ctx); + return sframe_get_hdr_size (dhp); +} + +/* Get the SFrame's abi/arch info given the decoder context CTX. */ + +unsigned char +sframe_decoder_get_abi_arch (sframe_decoder_ctx *ctx) +{ + sframe_header *sframe_header; + sframe_header = sframe_decoder_get_header (ctx); + return sframe_header->sfh_abi_arch; +} + +/* Get the SFrame's fixed FP offset given the decoder context CTX. */ +int8_t +sframe_decoder_get_fixed_fp_offset (sframe_decoder_ctx *ctx) +{ + sframe_header *dhp; + dhp = sframe_decoder_get_header (ctx); + return dhp->sfh_cfa_fixed_fp_offset; +} + +/* Get the SFrame's fixed RA offset given the decoder context CTX. */ +int8_t +sframe_decoder_get_fixed_ra_offset (sframe_decoder_ctx *ctx) +{ + sframe_header *dhp; + dhp = sframe_decoder_get_header (ctx); + return dhp->sfh_cfa_fixed_ra_offset; +} + +/* Find the function descriptor entry starting which contains the specified + address ADDR. */ + +sframe_func_desc_entry * +sframe_get_funcdesc_with_addr (sframe_decoder_ctx *ctx, + int32_t addr, int *errp) +{ + sframe_header *dhp; + sframe_func_desc_entry *fdp; + int low, high, cnt; + + if (ctx == NULL) + return sframe_ret_set_errno (errp, ESFRAME_INVAL); + + dhp = sframe_decoder_get_header (ctx); + + if (dhp == NULL || dhp->sfh_num_fdes == 0 || ctx->sfd_funcdesc == NULL) + return sframe_ret_set_errno (errp, ESFRAME_DCTX_INVAL); + /* If the FDE sub-section is not sorted on PCs, skip the lookup because + binary search cannot be used. */ + if ((dhp->sfh_preamble.sfp_flags & SFRAME_F_FDE_SORTED) == 0) + return sframe_ret_set_errno (errp, ESFRAME_FDE_NOTSORTED); + + /* Do the binary search. */ + fdp = (sframe_func_desc_entry *) ctx->sfd_funcdesc; + low = 0; + high = dhp->sfh_num_fdes; + cnt = high; + while (low <= high) + { + int mid = low + (high - low) / 2; + + if (fdp[mid].sfde_func_start_address == addr) + return fdp + mid; + + if (fdp[mid].sfde_func_start_address < addr) + { + if (mid == (cnt - 1)) /* Check if it's the last one. */ + return fdp + (cnt - 1) ; + else if (fdp[mid+1].sfde_func_start_address > addr) + return fdp + mid; + low = mid + 1; + } + else + high = mid - 1; + } + + return sframe_ret_set_errno (errp, ESFRAME_FDE_NOTFOUND); +} + +/* Find the SFrame Row Entry which contains the PC. Returns + SFRAME_ERR if failure. */ + +int +sframe_find_fre (sframe_decoder_ctx *ctx, int32_t pc, + sframe_frame_row_entry *frep) +{ + sframe_func_desc_entry *fdep; + uint32_t start_address, i; + sframe_frame_row_entry cur_fre, next_fre; + unsigned char *sp; + unsigned int fre_type, fde_type; + size_t esz; + int err = 0; + size_t size = 0; + /* For regular FDEs (i.e. fde_type SFRAME_FDE_TYPE_PCINC), + where the start address in the FRE is an offset from start pc, + use a bitmask with all bits set so that none of the address bits are + ignored. In this case, we need to return the FRE where + (PC >= FRE_START_ADDR) */ + uint64_t bitmask = 0xffffffff; + + if ((ctx == NULL) || (frep == NULL)) + return sframe_set_errno (&err, ESFRAME_INVAL); + + /* Find the FDE which contains the PC, then scan its fre entries. */ + fdep = sframe_get_funcdesc_with_addr (ctx, pc, &err); + if (fdep == NULL || ctx->sfd_fres == NULL) + return sframe_set_errno (&err, ESFRAME_DCTX_INVAL); + + fre_type = sframe_get_fre_type (fdep); + fde_type = sframe_get_fde_type (fdep); + + /* For FDEs for repetitive pattern of insns, we need to return the FRE + such that (PC & FRE_START_ADDR_AS_MASK >= FRE_START_ADDR_AS_MASK). + so, update the bitmask to the start address. */ + /* FIXME - the bitmask should be picked per ABI or encoded in the format + somehow. For AMD64, the pltN entry stub is 16 bytes. */ + if (fde_type == SFRAME_FDE_TYPE_PCMASK) + bitmask = 0xff; + + sp = (unsigned char *) ctx->sfd_fres + fdep->sfde_func_start_fre_off; + for (i = 0; i < fdep->sfde_func_num_fres; i++) + { + err = sframe_decode_fre ((const char *)sp, &next_fre, + fre_type, &esz); + start_address = next_fre.fre_start_addr; + + if (((fdep->sfde_func_start_address + + (int32_t) start_address) & bitmask) <= (pc & bitmask)) + { + sframe_frame_row_entry_copy (&cur_fre, &next_fre); + + /* Get the next FRE in sequence. */ + if (i < fdep->sfde_func_num_fres - 1) + { + sp += esz; + err = sframe_decode_fre ((const char*)sp, &next_fre, + fre_type, &esz); + + /* Sanity check the next FRE. */ + if (!sframe_fre_sanity_check_p (&next_fre)) + return sframe_set_errno (&err, ESFRAME_FRE_INVAL); + + size = next_fre.fre_start_addr; + } + else size = fdep->sfde_func_size; + + /* If the cur FRE is the one that contains the PC, return it. */ + if (((fdep->sfde_func_start_address + + (int32_t)size) & bitmask) > (pc & bitmask)) + { + sframe_frame_row_entry_copy (frep, &cur_fre); + return 0; + } + } + else + return sframe_set_errno (&err, ESFRAME_FRE_INVAL); + } + return sframe_set_errno (&err, ESFRAME_FDE_INVAL); +} + +/* Return the number of function descriptor entries in the SFrame decoder + DCTX. */ + +unsigned int +sframe_decoder_get_num_fidx (sframe_decoder_ctx *ctx) +{ + unsigned int num_fdes = 0; + sframe_header *dhp = NULL; + dhp = sframe_decoder_get_header (ctx); + if (dhp) + num_fdes = dhp->sfh_num_fdes; + return num_fdes; +} + +/* Get the data (NUM_FRES, FUNC_START_ADDRESS) from the function + descriptor entry at index I'th in the decoder CTX. If failed, + return error code. */ +/* FIXME - consolidate the args and return a + sframe_func_desc_index_elem rather? */ + +int +sframe_decoder_get_funcdesc (sframe_decoder_ctx *ctx, + unsigned int i, + uint32_t *num_fres, + uint32_t *func_size, + int32_t *func_start_address, + unsigned char *func_info) +{ + sframe_func_desc_entry *fdp; + unsigned int num_fdes; + int err = 0; + + if (ctx == NULL || func_start_address == NULL || num_fres == NULL + || func_size == NULL) + return sframe_set_errno (&err, ESFRAME_INVAL); + + num_fdes = sframe_decoder_get_num_fidx (ctx); + if (num_fdes == 0 + || i >= num_fdes + || ctx->sfd_funcdesc == NULL) + return sframe_set_errno (&err, ESFRAME_DCTX_INVAL); + + fdp = (sframe_func_desc_entry *) ctx->sfd_funcdesc + i; + *num_fres = fdp->sfde_func_num_fres; + *func_start_address = fdp->sfde_func_start_address; + *func_size = fdp->sfde_func_size; + *func_info = fdp->sfde_func_info; + + return 0; +} + +/* Get the function descriptor entry at index FUNC_IDX in the decoder + context CTX. */ + +static sframe_func_desc_entry * +sframe_decoder_get_funcdesc_at_index (sframe_decoder_ctx *ctx, + uint32_t func_idx) +{ + /* Invalid argument. No FDE will be found. */ + if (func_idx >= sframe_decoder_get_num_fidx (ctx)) + return NULL; + + sframe_func_desc_entry *fdep; + fdep = (sframe_func_desc_entry *) ctx->sfd_funcdesc; + return fdep + func_idx; +} + +/* Get the FRE_IDX'th FRE of the function at FUNC_IDX'th function + descriptor entry in the SFrame decoder CTX. Returns error code as + applicable. */ + +int +sframe_decoder_get_fre (sframe_decoder_ctx *ctx, + unsigned int func_idx, + unsigned int fre_idx, + sframe_frame_row_entry *fre) +{ + sframe_func_desc_entry *fdep; + sframe_frame_row_entry ifre; + unsigned char *sp; + uint32_t i; + unsigned int fre_type; + size_t esz = 0; + int err = 0; + + if (ctx == NULL || fre == NULL) + return sframe_set_errno (&err, ESFRAME_INVAL); + + /* Get function descriptor entry at index func_idx. */ + fdep = sframe_decoder_get_funcdesc_at_index (ctx, func_idx); + + if (fdep == NULL) + return sframe_set_errno (&err, ESFRAME_FDE_NOTFOUND); + + fre_type = sframe_get_fre_type (fdep); + /* Now scan the FRE entries. */ + sp = (unsigned char *) ctx->sfd_fres + fdep->sfde_func_start_fre_off; + for (i = 0; i < fdep->sfde_func_num_fres; i++) + { + /* Decode the FRE at the current position. Return it if valid. */ + err = sframe_decode_fre ((const char *)sp, &ifre, fre_type, &esz); + if (i == fre_idx) + { + if (!sframe_fre_sanity_check_p (&ifre)) + return sframe_set_errno (&err, ESFRAME_FRE_INVAL); + + sframe_frame_row_entry_copy (fre, &ifre); + + if (fdep->sfde_func_size) + sframe_assert (fre->fre_start_addr < fdep->sfde_func_size); + else + /* A SFrame FDE with func size equal to zero is possible. */ + sframe_assert (fre->fre_start_addr == fdep->sfde_func_size); + + return 0; + } + /* Next FRE. */ + sp += esz; + } + + return sframe_set_errno (&err, ESFRAME_FDE_NOTFOUND); +} + + +/* SFrame Encoder. */ + +/* Get a reference to the ENCODER's SFrame header. */ + +static sframe_header * +sframe_encoder_get_header (sframe_encoder_ctx *encoder) +{ + sframe_header *hp = NULL; + if (encoder) + hp = &encoder->sfe_header; + return hp; +} + +static sframe_func_desc_entry * +sframe_encoder_get_funcdesc_at_index (sframe_encoder_ctx *encoder, + uint32_t func_idx) +{ + sframe_func_desc_entry *fde = NULL; + if (func_idx < sframe_encoder_get_num_fidx (encoder)) + { + sf_funidx_tbl *func_tbl = (sf_funidx_tbl *) encoder->sfe_funcdesc; + fde = func_tbl->entry + func_idx; + } + return fde; +} + +/* Create an encoder context with the given SFrame format version VER, FLAGS + and ABI information. Sets errp if failure. */ + +sframe_encoder_ctx * +sframe_encode (unsigned char ver, unsigned char flags, int abi_arch, + int8_t fixed_fp_offset, int8_t fixed_ra_offset, int *errp) +{ + sframe_header *hp; + sframe_encoder_ctx *fp; + + if (ver != SFRAME_VERSION) + return sframe_ret_set_errno (errp, ESFRAME_VERSION_INVAL); + + if ((fp = malloc (sizeof (sframe_encoder_ctx))) == NULL) + return sframe_ret_set_errno (errp, ESFRAME_NOMEM); + + memset (fp, 0, sizeof (sframe_encoder_ctx)); + + /* Get the SFrame header and update it. */ + hp = sframe_encoder_get_header (fp); + hp->sfh_preamble.sfp_version = ver; + hp->sfh_preamble.sfp_magic = SFRAME_MAGIC; + hp->sfh_preamble.sfp_flags = flags; + + hp->sfh_abi_arch = abi_arch; + hp->sfh_cfa_fixed_fp_offset = fixed_fp_offset; + hp->sfh_cfa_fixed_ra_offset = fixed_ra_offset; + + return fp; +} + +/* Free the encoder context. */ + +void +sframe_free_encoder (sframe_encoder_ctx *encoder) +{ + if (encoder != NULL) + { + free (encoder->sfe_funcdesc); + free (encoder->sfe_fres); + free (encoder->sfe_data); + free (encoder); + } +} + +/* Get the size of the SFrame header from the encoder ctx ENCODER. */ + +unsigned int +sframe_encoder_get_hdr_size (sframe_encoder_ctx *encoder) +{ + sframe_header *ehp; + ehp = sframe_encoder_get_header (encoder); + return sframe_get_hdr_size (ehp); +} + +/* Get the abi/arch info from the SFrame encoder context ENCODER. */ + +unsigned char +sframe_encoder_get_abi_arch (sframe_encoder_ctx *encoder) +{ + unsigned char abi_arch = 0; + sframe_header *ehp; + ehp = sframe_encoder_get_header (encoder); + if (ehp) + abi_arch = ehp->sfh_abi_arch; + return abi_arch; +} + +/* Return the number of function descriptor entries in the SFrame encoder + ENCODER. */ + +unsigned int +sframe_encoder_get_num_fidx (sframe_encoder_ctx *encoder) +{ + unsigned int num_fdes = 0; + sframe_header *ehp = NULL; + ehp = sframe_encoder_get_header (encoder); + if (ehp) + num_fdes = ehp->sfh_num_fdes; + return num_fdes; +} + +/* Add an FRE to function at FUNC_IDX'th function descriptor entry in + the encoder context. */ + +int +sframe_encoder_add_fre (sframe_encoder_ctx *encoder, + unsigned int func_idx, + sframe_frame_row_entry *frep) +{ + sframe_header *ehp; + sframe_func_desc_entry *fdep; + sframe_frame_row_entry *ectx_frep; + size_t offsets_sz, esz; + unsigned int fre_type; + size_t fre_tbl_sz; + int err = 0; + + if (encoder == NULL || frep == NULL) + return sframe_set_errno (&err, ESFRAME_INVAL); + if (!sframe_fre_sanity_check_p (frep)) + return sframe_set_errno (&err, ESFRAME_FRE_INVAL); + + /* Use func_idx to gather the function descriptor entry. */ + fdep = sframe_encoder_get_funcdesc_at_index (encoder, func_idx); + + if (fdep == NULL) + return sframe_set_errno (&err, ESFRAME_FDE_NOTFOUND); + + fre_type = sframe_get_fre_type (fdep); + sf_fre_tbl *fre_tbl = (sf_fre_tbl *) encoder->sfe_fres; + + if (fre_tbl == NULL) + { + fre_tbl_sz = (sizeof (sf_fre_tbl) + + (number_of_entries * sizeof (sframe_frame_row_entry))); + fre_tbl = malloc (fre_tbl_sz); + + if (fre_tbl == NULL) + { + sframe_set_errno (&err, ESFRAME_NOMEM); + goto bad; /* OOM. */ + } + memset (fre_tbl, 0, fre_tbl_sz); + fre_tbl->alloced = number_of_entries; + } + else if (fre_tbl->count == fre_tbl->alloced) + { + fre_tbl_sz = (sizeof (sf_fre_tbl) + + ((fre_tbl->alloced + number_of_entries) + * sizeof (sframe_frame_row_entry))); + fre_tbl = realloc (fre_tbl, fre_tbl_sz); + if (fre_tbl == NULL) + { + sframe_set_errno (&err, ESFRAME_NOMEM); + goto bad; /* OOM. */ + } + + memset (&fre_tbl->entry[fre_tbl->alloced], 0, + number_of_entries * sizeof (sframe_frame_row_entry)); + fre_tbl->alloced += number_of_entries; + } + + ectx_frep = &fre_tbl->entry[fre_tbl->count]; + ectx_frep->fre_start_addr + = frep->fre_start_addr; + ectx_frep->fre_info = frep->fre_info; + + if (fdep->sfde_func_size) + sframe_assert (frep->fre_start_addr < fdep->sfde_func_size); + else + /* A SFrame FDE with func size equal to zero is possible. */ + sframe_assert (frep->fre_start_addr == fdep->sfde_func_size); + + /* frep has already been sanity check'd. Get offsets size. */ + offsets_sz = sframe_fre_offset_bytes_size (frep->fre_info); + memcpy (&ectx_frep->fre_offsets, &frep->fre_offsets, offsets_sz); + + esz = sframe_fre_entry_size (frep, fre_type); + fre_tbl->count++; + + encoder->sfe_fres = (void *) fre_tbl; + encoder->sfe_fre_nbytes += esz; + + ehp = sframe_encoder_get_header (encoder); + ehp->sfh_num_fres = fre_tbl->count; + + /* Update the value of the number of FREs for the function. */ + fdep->sfde_func_num_fres++; + + return 0; + +bad: + if (fre_tbl != NULL) + free (fre_tbl); + encoder->sfe_fres = NULL; + encoder->sfe_fre_nbytes = 0; + return -1; +} + +/* Add a new function descriptor entry with START_ADDR, FUNC_SIZE and NUM_FRES + to the encoder. */ + +int +sframe_encoder_add_funcdesc (sframe_encoder_ctx *encoder, + int32_t start_addr, + uint32_t func_size, + unsigned char func_info, + uint32_t num_fres __attribute__ ((unused))) +{ + sframe_header *ehp; + sf_funidx_tbl *fd_info; + size_t fd_tbl_sz; + int err = 0; + + /* FIXME book-keep num_fres for error checking. */ + if (encoder == NULL) + return sframe_set_errno (&err, ESFRAME_INVAL); + + fd_info = (sf_funidx_tbl *) encoder->sfe_funcdesc; + ehp = sframe_encoder_get_header (encoder); + + if (fd_info == NULL) + { + fd_tbl_sz = (sizeof (sf_funidx_tbl) + + (number_of_entries * sizeof (sframe_func_desc_entry))); + fd_info = malloc (fd_tbl_sz); + if (fd_info == NULL) + { + sframe_set_errno (&err, ESFRAME_NOMEM); + goto bad; /* OOM. */ + } + memset (fd_info, 0, fd_tbl_sz); + fd_info->alloced = number_of_entries; + } + else if (fd_info->count == fd_info->alloced) + { + fd_tbl_sz = (sizeof (sf_funidx_tbl) + + ((fd_info->alloced + number_of_entries) + * sizeof (sframe_func_desc_entry))); + fd_info = realloc (fd_info, fd_tbl_sz); + if (fd_info == NULL) + { + sframe_set_errno (&err, ESFRAME_NOMEM); + goto bad; /* OOM. */ + } + + memset (&fd_info->entry[fd_info->alloced], 0, + number_of_entries * sizeof (sframe_func_desc_entry)); + fd_info->alloced += number_of_entries; + } + + fd_info->entry[fd_info->count].sfde_func_start_address = start_addr; + /* Num FREs is updated as FREs are added for the function later via + sframe_encoder_add_fre. */ + fd_info->entry[fd_info->count].sfde_func_size = func_size; + fd_info->entry[fd_info->count].sfde_func_start_fre_off + = encoder->sfe_fre_nbytes; +#if 0 + // Linker optimization test code cleanup later ibhagat TODO FIXME + unsigned int fre_type = sframe_calc_fre_type (func_size); + + fd_info->entry[fd_info->count].sfde_func_info + = sframe_fde_func_info (fre_type); +#endif + fd_info->entry[fd_info->count].sfde_func_info = func_info; + fd_info->count++; + encoder->sfe_funcdesc = (void *) fd_info; + ehp->sfh_num_fdes++; + return 0; + +bad: + if (fd_info != NULL) + free (fd_info); + encoder->sfe_funcdesc = NULL; + ehp->sfh_num_fdes = 0; + return -1; +} + +static int +sframe_sort_funcdesc (sframe_encoder_ctx *encoder) +{ + sframe_header *ehp; + + ehp = sframe_encoder_get_header (encoder); + /* Sort and write out the FDE table. */ + sf_funidx_tbl *fd_info = (sf_funidx_tbl *) encoder->sfe_funcdesc; + if (fd_info) + { + qsort (fd_info->entry, fd_info->count, + sizeof (sframe_func_desc_entry), fde_func); + /* Update preamble's flags. */ + ehp->sfh_preamble.sfp_flags |= SFRAME_F_FDE_SORTED; + } + return 0; +} + +/* Write a frame row entry pointed to by FREP into the buffer CONTENTS. The + size in bytes written out are updated in ESZ. + + This function works closely with the SFrame binary format. + + Returns SFRAME_ERR if failure. */ + +static int +sframe_encoder_write_fre (char *contents, sframe_frame_row_entry *frep, + unsigned int fre_type, size_t *esz) +{ + size_t fre_size; + size_t fre_start_addr_sz; + size_t fre_stack_offsets_sz; + int err = 0; + + if (!sframe_fre_sanity_check_p (frep)) + return sframe_set_errno (&err, ESFRAME_FRE_INVAL); + + fre_start_addr_sz = sframe_fre_start_addr_size (fre_type); + fre_stack_offsets_sz = sframe_fre_offset_bytes_size (frep->fre_info); + + /* The FRE start address must be encodable in the available number of + bytes. */ + uint64_t bitmask = SFRAME_BITMASK_OF_SIZE (fre_start_addr_sz); + sframe_assert ((uint64_t)frep->fre_start_addr <= bitmask); + + memcpy (contents, + &frep->fre_start_addr, + fre_start_addr_sz); + contents += fre_start_addr_sz; + + memcpy (contents, + &frep->fre_info, + sizeof (frep->fre_info)); + contents += sizeof (frep->fre_info); + + memcpy (contents, + frep->fre_offsets, + fre_stack_offsets_sz); + contents+= fre_stack_offsets_sz; + + fre_size = sframe_fre_entry_size (frep, fre_type); + /* Sanity checking. */ + sframe_assert ((fre_start_addr_sz + + sizeof (frep->fre_info) + + fre_stack_offsets_sz) == fre_size); + + *esz = fre_size; + + return 0; +} + +/* Serialize the core contents of the SFrame section and write out to the + output buffer held in the ENCODER. Return SFRAME_ERR if failure. */ + +static int +sframe_encoder_write_sframe (sframe_encoder_ctx *encoder) +{ + char *contents; + size_t buf_size; + size_t hdr_size; + size_t all_fdes_size; + size_t fre_size; + size_t esz = 0; + sframe_header *ehp; + unsigned char flags; + sf_funidx_tbl *fd_info; + sf_fre_tbl *fr_info; + uint32_t i, num_fdes; + uint32_t j, num_fres; + sframe_func_desc_entry *fdep; + sframe_frame_row_entry *frep; + + unsigned int fre_type; + int err = 0; + + contents = encoder->sfe_data; + buf_size = encoder->sfe_data_size; + num_fdes = sframe_encoder_get_num_fidx (encoder); + all_fdes_size = num_fdes * sizeof (sframe_func_desc_entry); + ehp = sframe_encoder_get_header (encoder); + hdr_size = sframe_get_hdr_size (ehp); + + fd_info = (sf_funidx_tbl *) encoder->sfe_funcdesc; + fr_info = (sf_fre_tbl *) encoder->sfe_fres; + + /* Sanity checks: + - buffers must be malloc'd by the caller. */ + if ((contents == NULL) || (buf_size < hdr_size)) + return sframe_set_errno (&err, ESFRAME_BUF_INVAL); + if (fr_info == NULL) + return sframe_set_errno (&err, ESFRAME_FRE_INVAL); + + /* Write out the FRE table first. + + Recall that read/write of FREs needs information from the corresponding + FDE; the latter stores the information about the FRE type record used for + the function. Also note that sorting of FDEs does NOT impact the order + in which FREs are stored in the SFrame's FRE sub-section. This means + that writing out FREs after sorting of FDEs will need some additional + book-keeping. At this time, we can afford to avoid it by writing out + the FREs first to the output buffer. */ + fre_size = 0; + uint32_t global = 0; + uint32_t fre_index = 0; + + contents += hdr_size + all_fdes_size; + for (i = 0; i < num_fdes; i++) + { + fdep = &fd_info->entry[i]; + fre_type = sframe_get_fre_type (fdep); + num_fres = fdep->sfde_func_num_fres; + + for (j = 0; j < num_fres; j++) + { + fre_index = global + j; + frep = &fr_info->entry[fre_index]; + + sframe_encoder_write_fre (contents, frep, fre_type, &esz); + contents += esz; + fre_size += esz; /* For debugging only. */ + } + global += j; + } + + sframe_assert (fre_size == ehp->sfh_fre_len); + sframe_assert (global == ehp->sfh_num_fres); + sframe_assert ((size_t)(contents - encoder->sfe_data) == buf_size); + + /* Sort the FDE table */ + sframe_sort_funcdesc (encoder); + + /* Sanity checks: + - the FDE section must have been sorted by now on the start address + of each function. */ + flags = ehp->sfh_preamble.sfp_flags; + if (!(flags & SFRAME_F_FDE_SORTED) + || (fd_info == NULL)) + return sframe_set_errno (&err, ESFRAME_FDE_INVAL); + + contents = encoder->sfe_data; + /* Write out the SFrame header. The SFrame header in the encoder + object has already been updated with correct offsets by the caller. */ + memcpy (contents, ehp, hdr_size); + contents += hdr_size; + + /* Write out the FDE table sorted on funtion start address. */ + memcpy (contents, fd_info->entry, all_fdes_size); + contents += all_fdes_size; + + return 0; +} + +/* Serialize the contents of the encoder and return the buffer. ENCODED_SIZE + is updated to the size of the buffer. */ + +char * +sframe_encoder_write (sframe_encoder_ctx *encoder, + size_t *encoded_size, int *errp) +{ + sframe_header *ehp; + size_t hdrsize, fsz, fresz, bufsize; + int foreign_endian; + + /* Initialize the encoded_size to zero. This makes it simpler to just + return from the function in case of failure. Free'ing up of + encoder->sfe_data is the responsibility of the caller. */ + *encoded_size = 0; + + if (encoder == NULL || encoded_size == NULL || errp == NULL) + return sframe_ret_set_errno (errp, ESFRAME_INVAL); + + ehp = sframe_encoder_get_header (encoder); + hdrsize = sframe_get_hdr_size (ehp); + fsz = sframe_encoder_get_num_fidx (encoder) + * sizeof (sframe_func_desc_entry); + fresz = encoder->sfe_fre_nbytes; + + /* The total size of buffer is the sum of header, SFrame Function Descriptor + Entries section and the FRE section. */ + bufsize = hdrsize + fsz + fresz; + encoder->sfe_data = (char *) malloc (bufsize); + if (encoder->sfe_data == NULL) + return sframe_ret_set_errno (errp, ESFRAME_NOMEM); + encoder->sfe_data_size = bufsize; + + /* Update the information in the SFrame header. */ + /* SFrame FDE section follows immediately after the header. */ + ehp->sfh_fdeoff = 0; + /* SFrame FRE section follows immediately after the SFrame FDE section. */ + ehp->sfh_freoff = fsz; + ehp->sfh_fre_len = fresz; + + foreign_endian = need_swapping (ehp->sfh_abi_arch); + + /* Write out the FDE Index and the FRE table in the sfe_data. */ + if (sframe_encoder_write_sframe (encoder)) + return sframe_ret_set_errno (errp, ESFRAME_BUF_INVAL); + + /* Endian flip the contents if necessary. */ + if (foreign_endian) + { + if (flip_sframe (encoder->sfe_data, bufsize, 1)) + return sframe_ret_set_errno (errp, ESFRAME_BUF_INVAL); + flip_header ((sframe_header*)encoder->sfe_data); + } + + *encoded_size = bufsize; + return encoder->sfe_data; +} diff --git a/libsframe/testsuite/config/default.exp b/libsframe/testsuite/config/default.exp new file mode 100644 index 00000000000..c45e25d3357 --- /dev/null +++ b/libsframe/testsuite/config/default.exp @@ -0,0 +1,54 @@ +# Basic expect script for libsframe decoder tests. +# Copyright (C) 2022 Free Software Foundation, Inc. +# +# This file is part of the GNU Binutils. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. +# +# Written by Jeffrey Wheat (cassidy@cygnus.com) +# + +if ![info exists ld] then { + set ld [findfile $base_dir/../ld/ld-new $base_dir/../ld/ld-new [transform ld]] +} + +if ![info exists as] then { + set as [findfile $base_dir/../gas/as-new $base_dir/../gas/as-new [transform as]] +} + +remote_exec host "mkdir -p tmpdir" + +# Make symlinks from tmpdir/libsframe to the linker and assembler in the +# build tree, so that we can use a -B option to gcc to force it to use +# the newly built linker and assembler. +if {![file isdirectory tmpdir/libsframe]} then { + catch "exec mkdir tmpdir/libsframe" status + catch "exec ln -s ../../../ld/ld-new tmpdir/libsframe/ld" status + catch "exec ln -s ld tmpdir/libsframe/collect-ld" status + catch "exec ln -s ../../../gas/as-new tmpdir/libsframe/as" status +} +set gcc_B_opt "-B[pwd]/tmpdir/libsframe/" +set ld_L_opt "" + +if {![info exists CC]} { + set CC gcc +} +if {![info exists CFLAGS]} { + set CFLAGS "-g -O2" +} +if {![info exists CFLAGS_FOR_TARGET]} { + set CFLAGS_FOR_TARGET $CFLAGS +} diff --git a/libsframe/testsuite/libsframe.decode/DATA-BE b/libsframe/testsuite/libsframe.decode/DATA-BE new file mode 100644 index 0000000000000000000000000000000000000000..3e19ff48e9c67f30645a9d8bdca0af834dd345f4 GIT binary patch literal 64 tcmccjh>?Mj0SrJCD-a7qxD0|&+677j<(L^**cBeU&|zjU0MQQ23;?AA2E70P literal 0 HcmV?d00001 diff --git a/libsframe/testsuite/libsframe.decode/DATA1 b/libsframe/testsuite/libsframe.decode/DATA1 diff --git a/libsframe/testsuite/libsframe.decode/DATA2 b/libsframe/testsuite/libsframe.decode/DATA2 new file mode 100644 index 0000000000000000000000000000000000000000..68fc2d240cd34878747f552d1b12bbc0e59a5217 GIT binary patch literal 92 zcmaEKkCBm?;Rgc~0|NsG5X%8E2q*!u-G~4GrNKM~1{M$<2^0_j()>US7GPlJU}P2e Sz``Q%L5h{*0}_`X$OQnwj}Q_7 literal 0 HcmV?d00001 diff --git a/libsframe/testsuite/libsframe.decode/be-flipping.c b/libsframe/testsuite/libsframe.decode/be-flipping.c --- /dev/null +++ b/libsframe/testsuite/libsframe.decode/be-flipping.c @@ -0,0 +1,115 @@ +/* be-flipping.c -- Test for handling different endianness in libsframe. + + Copyright (C) 2022 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include "config.h" + +#include +#include +#include + +#include "sframe-api.h" + +/* DejaGnu should not use gnulib's vsnprintf replacement here. */ +#undef vsnprintf +#include + +/* SFrame info from the following source (1 fde 5 fres): + static int cnt; + extern void foo (void); + + int bar() + { + cnt++; + if (cnt == 3) + foo(); + return (cnt); + } + gcc -mbig-endian -Wa,--gsframe -c -O3 t.c + objcopy --dump-section .sframe=DATA-BE t.o + */ +#define DATA "DATA-BE" + +int +main (void) +{ + sframe_decoder_ctx *dctx = NULL; + uint32_t nfres, fsize; + int32_t fstart; + unsigned char finfo; + int err = 0; + FILE *fp; + struct stat st; + char *sf_buf; + size_t sf_size; + +#define TEST(name, cond) \ + do \ + { \ + if (cond) \ + pass (name); \ + else \ + fail (name); \ + } \ + while (0) + + /* Test setup. */ + fp = fopen (DATA, "r"); + if (fp == NULL) + goto setup_fail; + if (fstat (fileno (fp), &st) < 0) + { + perror ("fstat"); + fclose (fp); + goto setup_fail; + } + sf_buf = malloc (st.st_size); + if (sf_buf == NULL) + { + perror ("malloc"); + goto setup_fail; + } + sf_size = fread (sf_buf, 1, st.st_size, fp); + fclose (fp); + if (sf_size == 0) + { + fprintf (stderr, "Decode: Read buffer failed\n"); + goto setup_fail; + } + + /* Execute tests. */ + + /* Call to sframe_decode will endian flip the input buffer (big-endian) if + the host running the test is a little-endian system. This endian-flipped + copy of the buffer is kept internally in dctx. */ + dctx = sframe_decode (sf_buf, sf_size, &err); + TEST ("be-flipping: Decoder setup", dctx != NULL); + + unsigned int fde_cnt = sframe_decoder_get_num_fidx (dctx); + TEST ("be-flipping: Decoder FDE count", fde_cnt == 1); + + err = sframe_decoder_get_funcdesc (dctx, 0, &nfres, &fsize, &fstart, &finfo); + TEST ("be-flipping: Decoder get FDE", err == 0); + TEST ("be-flipping: Decoder FRE count", nfres == 5); + + sframe_decoder_free (&dctx); + return 0; + +setup_fail: + sframe_decoder_free (&dctx); + fail ("be-flipping: Test setup"); + return 1; +} diff --git a/libsframe/testsuite/libsframe.decode/decode.exp b/libsframe/testsuite/libsframe.decode/decode.exp new file mode 100644 index 00000000000..0d859949941 --- /dev/null +++ b/libsframe/testsuite/libsframe.decode/decode.exp @@ -0,0 +1,50 @@ +# Copyright (C) 2022 Free Software Foundation, Inc. +# +# This file is part of the GNU Binutils. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. +# + +load_lib dejagnu.exp + +# Run the tests only if compatible dejagnu gcc pair is found +if [string equal $COMPAT_DEJAGNU "no"] { + verbose -log "SFrame testsuite needs perhaps a more recent DejaGnu" + unsupported be-flipping + unsupported frecnt-1 + unsupported frecnt-2 + return; +} + +catch "exec ln -s $srcdir/libsframe.decode/DATA1 ." status +catch "exec ln -s $srcdir/libsframe.decode/DATA2 ." status +catch "exec ln -s $srcdir/libsframe.decode/DATA-BE ." status + +if { [host_execute "testsuite/libsframe.decode/be-flipping"] ne "" } { + fail "be-flipping" +} + +if { [host_execute "testsuite/libsframe.decode/frecnt-1"] ne "" } { + fail "frecnt-1" +} + +if { [host_execute "testsuite/libsframe.decode/frecnt-2"] ne "" } { + fail "frecnt-2" +} + +catch "exec rm DATA1" status +catch "exec rm DATA2" status +catch "exec rm DATA-BE" status diff --git a/libsframe/testsuite/libsframe.decode/frecnt-1.c b/libsframe/testsuite/libsframe.decode/frecnt-1.c new file mode 100644 index 00000000000..49861ed4f5c --- /dev/null +++ b/libsframe/testsuite/libsframe.decode/frecnt-1.c @@ -0,0 +1,99 @@ +/* frecnt-1.c -- Test for decoder in libsframe. + + Copyright (C) 2022 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include "config.h" + +#include +#include +#include + +#include "sframe-api.h" + +/* DejaGnu should not use gnulib's vsnprintf replacement here. */ +#undef vsnprintf +#include + +/* + * SFrame info from the following source (1 fde 4 fres): + * static int cnt; + * int main() { cnt++; return (cnt); } + */ +#define DATA "DATA1" + +int +main (void) +{ + sframe_decoder_ctx *dctx = NULL; + uint32_t nfres, fsize; + int32_t fstart; + unsigned char finfo; + int err = 0; + FILE *fp; + struct stat st; + char *sf_buf; + size_t sf_size; + +#define TEST(name, cond) \ + do \ + { \ + if (cond) \ + pass (name); \ + else \ + fail (name); \ + } \ + while (0) + + /* Test Setup. */ + fp = fopen (DATA, "r"); + if (fp == NULL) + goto setup_fail; + if (fstat (fileno (fp), &st) < 0) + { + perror ("fstat"); + fclose (fp); + goto setup_fail; + } + sf_buf = malloc (st.st_size); + if (sf_buf == NULL) + { + perror ("malloc"); + goto setup_fail; + } + + /* Execute tests. */ + sf_size = fread (sf_buf, 1, st.st_size, fp); + fclose (fp); + TEST ("frecnt-1: Read data", sf_size != 0); + + dctx = sframe_decode (sf_buf, sf_size, &err); + TEST ("frecnt-1: Decoder setup", dctx != NULL); + + unsigned int fde_cnt = sframe_decoder_get_num_fidx (dctx); + TEST ("frecnt-1: Decoder FDE count", fde_cnt == 1); + + err = sframe_decoder_get_funcdesc (dctx, 0, &nfres, &fsize, &fstart, &finfo); + TEST ("frecnt-1: Decoder get FDE", err == 0); + TEST ("frecnt-1: Decoder FRE count", nfres == 4); + + sframe_decoder_free (&dctx); + return 0; + +setup_fail: + sframe_decoder_free (&dctx); + fail ("frecnt-1: Test setup"); + return 1; +} diff --git a/libsframe/testsuite/libsframe.decode/frecnt-2.c b/libsframe/testsuite/libsframe.decode/frecnt-2.c new file mode 100644 index 00000000000..7c140d88c3a --- /dev/null +++ b/libsframe/testsuite/libsframe.decode/frecnt-2.c @@ -0,0 +1,104 @@ +/* frecnt-2.c -- Test for decoder in libsframe. + + Copyright (C) 2022 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include "config.h" + +#include +#include +#include + +#include "sframe-api.h" + +/* DejaGnu should not use gnulib's vsnprintf replacement here. */ +#undef vsnprintf +#include + +/* + * SFrame info from the following source (2 fde 8 fres): + * static int cnt; + * int foo() { return ++cnt; } + * int main() { return foo(); } + */ +#define DATA "DATA2" + +int +main (void) +{ + sframe_decoder_ctx *dctx = NULL; + uint32_t nfres, fsize; + int32_t fstart; + unsigned char finfo; + unsigned int i; + int err = 0; + FILE *fp; + struct stat st; + char *sf_buf; + size_t sf_size; + +#define TEST(name, cond) \ + do \ + { \ + if (cond) \ + pass (name); \ + else \ + fail (name); \ + } \ + while (0) + + fp = fopen (DATA, "r"); + if (fp == NULL) + goto setup_fail; + if (fstat (fileno (fp), &st) < 0) + { + perror ("fstat"); + fclose (fp); + goto setup_fail; + } + sf_buf = malloc (st.st_size); + if (sf_buf == NULL) + { + perror ("malloc"); + goto setup_fail; + } + + /* Execute tests. */ + sf_size = fread (sf_buf, 1, st.st_size, fp); + fclose (fp); + TEST ("frecnt-2: Read data", sf_size != 0); + + dctx = sframe_decode (sf_buf, sf_size, &err); + TEST ("frecnt-2: Decode setup", dctx != NULL); + + unsigned int fde_cnt = sframe_decoder_get_num_fidx (dctx); + TEST ("frecnt-2: Decode FDE count", fde_cnt == 2); + + for (i = 0; i < fde_cnt; ++i) + { + err = sframe_decoder_get_funcdesc (dctx, i, &nfres, &fsize, &fstart, + &finfo); + TEST ("frecnt-2: Decode get FDE", err == 0); + TEST ("frecnt-2: Decode get FRE", nfres == 4); + } + + sframe_decoder_free (&dctx); + return 0; + +setup_fail: + sframe_decoder_free (&dctx); + fail ("frecnt-2: Test setup"); + return 1; +} diff --git a/libsframe/testsuite/libsframe.decode/local.mk b/libsframe/testsuite/libsframe.decode/local.mk new file mode 100644 index 00000000000..0e4279b8c8e --- /dev/null +++ b/libsframe/testsuite/libsframe.decode/local.mk @@ -0,0 +1,16 @@ +check_PROGRAMS = +if HAVE_COMPAT_DEJAGNU + check_PROGRAMS += %D%/be-flipping %D%/frecnt-1 %D%/frecnt-2 +endif + +%C%_be_flipping_SOURCES = %D%/be-flipping.c +%C%_be_flipping_LDADD = ${top_builddir}/libsframe.la +%C%_be_flipping_CPPFLAGS = -I${top_srcdir}/../include -Wall + +%C%_frecnt_1_SOURCES = %D%/frecnt-1.c +%C%_frecnt_1_LDADD = ${top_builddir}/libsframe.la +%C%_frecnt_1_CPPFLAGS = -I${top_srcdir}/../include -Wall + +%C%_frecnt_2_SOURCES = %D%/frecnt-2.c +%C%_frecnt_2_LDADD = ${top_builddir}/libsframe.la +%C%_frecnt_2_CPPFLAGS = -I${top_srcdir}/../include -Wall diff --git a/libsframe/testsuite/libsframe.encode/encode-1.c b/libsframe/testsuite/libsframe.encode/encode-1.c new file mode 100644 index 00000000000..4075591ffa1 --- /dev/null +++ b/libsframe/testsuite/libsframe.encode/encode-1.c @@ -0,0 +1,177 @@ +/* encode-1.c -- Test for encoder in libsframe. + + Copyright (C) 2022 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include "config.h" + +#include +#include +#include + +#include "sframe-api.h" + +/* DejaGnu should not use gnulib's vsnprintf replacement here. */ +#undef vsnprintf +#include + +static int +add_fde1 (sframe_encoder_ctx *encode, int idx) +{ + int i, err; + /* A contiguous block containing 4 FREs. */ + sframe_frame_row_entry fres[] + = { {0x0, 0x3, {0x8, 0, 0}}, + {0x1, 0x5, {0x10, 0xf0, 0}}, + {0x4, 0x4, {0x10, 0xf0, 0}}, + {0x1a, 0x5, {0x8, 0xf0, 0}} + }; + + unsigned char finfo = sframe_fde_func_info (SFRAME_FRE_TYPE_ADDR1, + SFRAME_FDE_TYPE_PCINC); + err = sframe_encoder_add_funcdesc (encode, 0xfffff03e, 0x1b, finfo, 4); + if (err == -1) + return err; + + for (i = 0; i < 4; i++) + if (sframe_encoder_add_fre (encode, idx,fres+i) == SFRAME_ERR) + return -1; + + return 0; +} + +static int +add_fde2 (sframe_encoder_ctx *encode, int idx) +{ + int i, err; + /* A contiguous block containing 4 FREs. */ + sframe_frame_row_entry fres[] + = { {0x0, 0x3, {0x8, 0, 0}}, + {0x1, 0x5, {0x10, 0xf0, 0}}, + {0x4, 0x4, {0x10, 0xf0, 0}}, + {0xf, 0x5, {0x8, 0xf0, 0}} + }; + + unsigned char finfo = sframe_fde_func_info (SFRAME_FRE_TYPE_ADDR1, + SFRAME_FDE_TYPE_PCINC); + err = sframe_encoder_add_funcdesc (encode, 0xfffff059, 0x10, finfo, 4); + if (err == -1) + return err; + + for (i = 0; i < 4; i++) + if (sframe_encoder_add_fre (encode, idx, fres+i) == SFRAME_ERR) + return -1; + + return 0; +} + +/* + * SFrame info from the following source (2 fdes, 4 fres in each fde): + * static int cnt; + * int foo() { return ++cnt; } + * int main() { return foo(); } + */ +#define DATA "DATA2" + +static int +data_match (char *sframe_buf, size_t sz) +{ + FILE *fp; + struct stat st; + char *sf_buf; + size_t sf_size; + int diffs; + + fp = fopen (DATA, "r"); + if (fp == NULL) + return 0; + if (fstat (fileno (fp), &st) < 0) + { + perror ("fstat"); + fclose (fp); + return 0; + } + sf_buf = malloc (st.st_size); + if (sf_buf == NULL) + { + perror ("malloc"); + return 0; + } + sf_size = fread (sf_buf, 1, st.st_size, fp); + fclose (fp); + if (sf_size == 0 || sf_buf == NULL) + { + fprintf (stderr, "Encode: Read section failed\n"); + return 0; + } + if (sf_size != sz) + return 0; + + diffs = memcmp (sf_buf, sframe_buf, sz); + + free (sf_buf); + return diffs == 0; +} + +int main (void) +{ + sframe_encoder_ctx *encode; + sframe_frame_row_entry frep; + char *sframe_buf; + size_t sf_size; + int err = 0; + unsigned int fde_cnt = 0; + int match_p = 0; + +#define TEST(name, cond) \ + do \ + { \ + if (cond) \ + pass (name); \ + else \ + fail (name); \ + } \ + while (0) + + encode = sframe_encode (SFRAME_VERSION, 0, + SFRAME_ABI_AMD64_ENDIAN_LITTLE, + SFRAME_CFA_FIXED_FP_INVALID, + -8, /* Fixed RA offset for AMD64. */ + &err); + + fde_cnt = sframe_encoder_get_num_fidx (encode); + TEST ("encode-1: Encoder FDE count", fde_cnt == 0); + + err = sframe_encoder_add_fre (encode, 1, &frep); + TEST ("encode-1: Encoder update workflow", err == SFRAME_ERR); + + err = add_fde1 (encode, 0); + TEST ("encode-1: Encoder adding FDE1", err == 0); + + err = add_fde2 (encode, 1); + TEST ("encode-1: Encoder adding FDE2", err == 0); + + fde_cnt = sframe_encoder_get_num_fidx (encode); + TEST ("encode-1: Encoder FDE count", fde_cnt == 2); + + sframe_buf = sframe_encoder_write (encode, &sf_size, &err); + TEST ("encode-1: Encoder write", err == 0); + + match_p = data_match (sframe_buf, sf_size); + TEST ("encode-1: Encode buffer match", match_p == 1); + + sframe_encoder_free (&encode); + return 0; +} diff --git a/libsframe/testsuite/libsframe.encode/encode.exp b/libsframe/testsuite/libsframe.encode/encode.exp new file mode 100644 index 00000000000..60c08e81063 --- /dev/null +++ b/libsframe/testsuite/libsframe.encode/encode.exp @@ -0,0 +1,37 @@ +# Copyright (C) 2022 Free Software Foundation, Inc. +# +# This file is part of the GNU Binutils. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. +# + +load_lib dejagnu.exp + +# Run the tests only if compatible dejagnu gcc pair is found +if [string equal $COMPAT_DEJAGNU "no"] { + verbose -log "SFrame testsuite needs perhaps a more recent DejaGnu" + unsupported encode-1 + return 0; +} + +catch "exec ln -s $srcdir/libsframe.decode/DATA2 ." status + +if { [host_execute "testsuite/libsframe.encode/encode-1"] ne "" } { + fail "encode-1" +} + +catch "exec rm DATA2" status + diff --git a/libsframe/testsuite/libsframe.encode/local.mk b/libsframe/testsuite/libsframe.encode/local.mk new file mode 100644 index 00000000000..477d4b64929 --- /dev/null +++ b/libsframe/testsuite/libsframe.encode/local.mk @@ -0,0 +1,7 @@ +if HAVE_COMPAT_DEJAGNU + check_PROGRAMS += %D%/encode-1 +endif + +%C%_encode_1_SOURCES = %D%/encode-1.c +%C%_encode_1_LDADD = ${top_builddir}/libsframe.la +%C%_encode_1_CPPFLAGS = -I${top_srcdir}/../include -Wall diff --git a/libsframe/testsuite/local.mk b/libsframe/testsuite/local.mk new file mode 100644 index 00000000000..83eca774d41 --- /dev/null +++ b/libsframe/testsuite/local.mk @@ -0,0 +1,24 @@ +# Setup the testing framework +EXPECT = expect +RUNTEST = runtest +RUNTESTFLAGS = + +check-DEJAGNU: site.exp + srcroot=`cd $(srcdir) && pwd`; export srcroot; \ + r=`pwd`; export r; \ + LC_ALL=C; export LC_ALL; \ + EXPECT=$(EXPECT); export EXPECT; \ + runtest=$(RUNTEST); \ + if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ + $$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \ + CC="$(CC)" \ + CROSS_COMPILE="$(CROSS_COMPILE)" \ + COMPAT_DEJAGNU="$(COMPAT_DEJAGNU)" \ + CFLAGS="$(CFLAGS) -I$(top_srcdir)/../include -I$(top_srcdir) -I$(top_builddir)" \ + $(RUNTESTFLAGS); \ + else echo "WARNING: could not find \`runtest'" 1>&2; :;\ + fi + +# libsframe encoder/decoder testsuite +include %D%/libsframe.decode/local.mk +include %D%/libsframe.encode/local.mk From patchwork Sun Oct 30 07:44:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 12959 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1687332wru; Sun, 30 Oct 2022 00:52:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6F/zRsn8/uFfa8UrrWzcs31g7IYQfOR0dxLSzc/s8VAoxWfPJe1veA/3a9+A/tFtQIq6m/ X-Received: by 2002:a17:906:58c9:b0:7a7:dcba:a987 with SMTP id e9-20020a17090658c900b007a7dcbaa987mr7192960ejs.88.1667116337694; Sun, 30 Oct 2022 00:52:17 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id l10-20020a50c10a000000b004617bf36c3csi3482874edf.308.2022.10.30.00.52.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 00:52:17 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=W0octQbK; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2E2C3392AC22 for ; Sun, 30 Oct 2022 07:49:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2E2C3392AC22 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667116149; bh=+gVynUBiuqZBibPMLB+9D+NVGpPkwXJk7alrz3VhtX8=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=W0octQbK3E7JTSZmVRyahdXF2N/pyaiCtUTPWRVbHBJw4NfKivuR+/tOmcfcsgIqI wfZ8HhgogxJTUPDyYe66IduyWqlhBrKOxZZMutOnJjW0QQPP7/HqfiyX4w5skeQAI+ HpiPCt3KdX8mDkWzSrTl9d/W8n/IPZeG+pI2Mlkc= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 4C0E5385617E for ; Sun, 30 Oct 2022 07:45:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4C0E5385617E Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29U3ZvHW007427 for ; Sun, 30 Oct 2022 07:45:40 GMT Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgty2sd57-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:45:39 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 29U744vv023921 for ; Sun, 30 Oct 2022 07:45:38 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2168.outbound.protection.outlook.com [104.47.59.168]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kgtm29err-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:45:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e3sAirMSdDJXg4Swa3rGKXRYlDGVQZF/hDV3vDst+twoWA6CJcVQV5WBdfW2TTyd1UsffrQIiJtOGet1BttBlkeLwKUYoVKMCn+n2fytA+deUlegq09PHnA9vL1XN2OQ18VR6BVMsZsye6CqxLeMLzWWaJjP5oPknZcYBqalESsf8r6Os6+wHDLAS177VL5xZdDVvvmrOjKAcQCQdABjQRlfFBIAiJY5VIkBeFPcmWVWvTFcGayBB3ArLzRJhYtfHyLCpyhMfl7or+8gW3Pw2KpeCvSKOnBuSrGi9HAhodb5CfGYDdoTsFmSIeIhHsWA1kC3UwhTeH3BcHbN6IE3aQ== 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=+gVynUBiuqZBibPMLB+9D+NVGpPkwXJk7alrz3VhtX8=; b=TfVn8kK6sWAmkya8hq435d9pwUBN3IvgjwJswBvEfWaEbAyE2imGNUGPaJd72zG9z9CdTJwe5c2vo0zOyTHDEWf2Lj8V1pGtCnfjRs34o0nJAQb1c8jz4SVg57cwQKc3+wJAKDWOiRxb9BTT6DRDjGSXEjK3Emg81CRElnMytKUXaGJPJYRm/UnreCLrGrgBgwzoITCe013pXeVRypsF/01hyZ7Wh+z5flBT3WMWSTg9m0E9XO3kRd0KlxOtp33bNVtxcnx9fUR9hKsk1tHDkyVi4fx5EYLPl3jB2tdjgp0hIfCM7avlywADWBPCTawEO0C7wMkve6kJX9zegummGA== 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 MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by BY5PR10MB4289.namprd10.prod.outlook.com (2603:10b6:a03:20c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.19; Sun, 30 Oct 2022 07:45:34 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2%7]) with mapi id 15.20.5723.033; Sun, 30 Oct 2022 07:45:34 +0000 To: binutils@sourceware.org Subject: [PATCH,V3 06/15] bfd: linker: merge .sframe sections Date: Sun, 30 Oct 2022 00:44:41 -0700 Message-Id: <20221030074450.1956074-7-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221030074450.1956074-1-indu.bhagat@oracle.com> References: <20221030074450.1956074-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR03CA0280.namprd03.prod.outlook.com (2603:10b6:303:b5::15) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|BY5PR10MB4289:EE_ X-MS-Office365-Filtering-Correlation-Id: 1a3e3b4b-062c-4b2a-dfa5-08daba4aba41 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NEU92tjCbSj1I/495tjLOqTi6P/cWCHw0cVB87jjCCa5IdwapP4wyz73Mb4OMgeQe0aN8GlEXe3hRDVBNieH7C5F3CHBJttMfTW9eD9L0sTKT5N8kSnlFHwdGMPPWVJQbHrMQgm1OSNSY2kEkzSGtngnDQQ/RH0gQbXxDqyYOY/+4Cf/nFcbrmxj+YkjUHA2VypYVjJTJk3jMLrOk8o/3023TAcREuW3HGpTBlopmwgPCjsghjLgh10ruwU1aqPUwiWQuNDUnRRtZkC3xgl3lWR81lKdooatkckoPU6Y0p/5+elkiGzRZmEiK9q4+18bU80qFeOfIS9T8/3316868WUfxl9qdW/ziI6He9Rp74FIxG5s9e9hHzj19emso6EI/IJijKqVRaQM9HBpMxqql6+sqAQuSnxcWuUVpPU4N/JxVjOunbRNTQpYDREnbzBKYW00t5kpkE+xFY3HJX/g6lI9a/38rfCAwk4Je7qBTNA4Q7zsM3HdxY+FsgxGMjklgcemgM56H/qvthZnII5vBiJDdv5wb2POrEZvsodskHXlyq8MH301mpdUcddD/UOJOsDsK6fJewtB3DfOVG6+yCzVeqVqlEInY0MtwQfdldBzIbnAu5F4PltlMmK4K/G+Mh8twjwaGsAYQ07Abb9etLrArvvKnqd/jgXYhuhtdRKRS5P2V4Z7TinW3HGvd0ewIuz4WGaEJvDIaR0rZAHsoyZRKo1BCHjbW4xye/Z8x3EgFtiObH79rJHSYQUvlh+DTNd6PVO9e/0THAVJ1nRz6Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2158.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(366004)(39850400004)(376002)(346002)(136003)(451199015)(316002)(66556008)(4326008)(66476007)(36756003)(6916009)(66946007)(30864003)(6486002)(38100700002)(6666004)(8936002)(41300700001)(86362001)(107886003)(478600001)(5660300002)(1076003)(186003)(83380400001)(8676002)(2616005)(44832011)(2906002)(6512007)(6506007)(142923001)(2004002)(579004)(559001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UgNayQqogLWBoqZBe01KPzYSVW3ZNCKH8RRqkUaEyno5BpcEiuTOdh6UBARj7leJ3wTEvIJMKFiynFVw7uHKGDaqJj/rJGtg1HencDeTQXlWgeDgSz/GsLkNOczQEkoi5naUyUh7j4slix5MiZRx5yiK8hFo0qF6BHP53+vto3ladElpd1DmuMhlodemRtwymX/HewAuUxvG7XGiMkYBWI13CyKVxGAZcWeOn6NY/+r3SvWZInrUvM2PhhjCk9SYtjj/hVpyetJ6HFgPD7JrmFYQUeDRjFrHt4vmLbnl/r8nqDzm8NtTs88YezKzoj5Ivk5/oQ3w1J/pFDW6C48M11emOvNgmDiJHOTTSJA0OMXjPXzuX6RJqG9lUZjQ5wFdyR+1iqjm+AGpCjHRQ3+EedhiFoKrRs+fxXFuKky5ejgiHmKSzTvjFHyZ0mKOon2gWH7rCuQB6aNuRCgJyv4Sukc8fWqZND8wWZENlJn87xgBw4MZTCvaH8AZ4iUWtykLfkSYy0WkiNFOXtqVXNJqgmD5Kod5OAO/GFUX2HWrsl10lHFhP+mRqDzzWpGc8kT1JAmqwKZriuJBofB3zLrWL6NVsFdiGaO/Dztaj2k4GV6NFXmqMMPxIfuHXOMcIt+O0i3HTd0pmWwm+QGCRCvry/1AAfN72JihKqvUDf67PRyQ1u55xKintExW8Sh8IvzlyVt6RE9xjgLPZkkIGbgT4oEJmF6JtDPI+qc8Psos2tDMfroPOYveUIAcHZcRbahEJsN4xzao2S8GrUUMtrtpWJNkM4LlAzMAAXXjBPZi3NhBoU2u1IPyE1xAW6HNzdVb0Wm63MEGkJFsJUTPPZ055BaU8V3VlDUjxh5HHbOLe13P6ZyPJPV1dMVT7KxA1Z5ZSznsDLsLGYLUcAn0o0ieierktGictL+11EvTYTxsPIo49e2+Zd8Bw53ffPhJBRGJ0cshDYm414MLcLWl3a/LhYrz1+5KaQ6J4W4fcsaKt3acOa4QdLHQx30RGm/TKxb1wRPNGWdVSuUPE0aTQy3Ey95mxuWkhD2LK1G7WL216k+URuipp0ZyFEEBrXjS5HD+4qUDZ93zCrBhjoVR0NYiCZgvaRtImSpVDedg4iHhIixl/5UW2RNd8S+W9lPl+pKELnz8eee7kSj5XwKPXr+1OKtCMx2FXJLGBrQqAzBddXEHA2rRJtLEpoxW+g198MZvXa/Es4ipbR5Jry5i7gT3KyqogIVHMlIUyJSfRzREuE1iBBBIhrxYLlnMEEWzsHJiU/vX92ik30DnIFkihj8mM9SMI8vgCEn9LoezHaZswx0vcCHhKDcNcUC8tYk42+p8/ojnsj9om3uaNq6mfsb0vmt4ML+QULe3Le48iF/RBhogurSeUnhD3nhf6obHNxFt/Z6yDolz0+D2qXJrKtKO6VFvSqDcKpiHFIXggexdbZAd2/aMDgPdOkLwxJCjix9KDThKxUIUYK3uQrlh4N0x5sEOS0Xj9fEMMzGQGiozJDwYUuo7H/kH6zQCdxISLUpC0he/O8i7U5wn+8rbahj2cPNkrBle902GsAOFJk4LTlfFPZw8dZ57Iefstg9MABu/40Xvvpg/W2TLPQf0kiVSao7jxpa2t9gbVlgFrrZ2uEI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1a3e3b4b-062c-4b2a-dfa5-08daba4aba41 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2022 07:45:34.4852 (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: 1/TF8tMap8yjDdsgH3a0XptNAr3hzypJUh+ak7JrIQ3F0fbTszXTJoaWzhRcEJbsK78jc0X2RyjvZOcRFYJATQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4289 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-30_02,2022-10-27_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2210300049 X-Proofpoint-ORIG-GUID: i-5ZNoswCtu1gN02W1RfwJSf3uzqwhrU X-Proofpoint-GUID: i-5ZNoswCtu1gN02W1RfwJSf3uzqwhrU X-Spam-Status: No, score=-12.7 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_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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Indu Bhagat via Binutils From: Indu Bhagat Reply-To: Indu Bhagat Cc: Indu Bhagat Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748098180968687164?= X-GMAIL-MSGID: =?utf-8?q?1748098180968687164?= [Changes in V3] - sframe_encode () now has explicit arguments for passing fixed RA and fixed FP offsets. [End of changes in V3] [Changes in V2] - Minor code improvements, formatting touch-ups - ld testsuite: check if as supports SFrame before running sframe tests. - Changes to support auxilliary SFrame header. [End of changes in V2] The linker merges all the input .sframe sections. When merging, the linker verifies that all the input .sframe sections have the same abi/arch. The linker uses libsframe library to perform key actions on the .sframe sections - decode, read, and create output data. This implies buildsystem changes to make and install libsframe before libbfd. The linker places the output .sframe section in a new segment of its own: PT_GNU_SFRAME. A new segment is not added, however, if the generated .sframe section is empty. When a section is discarded from the final link, the corresponding entries in the .sframe section for those functions are also deleted. The linker sorts the SFrame FDEs on start address by default and sets the SFRAME_F_FDE_SORTED flag in the .sframe section. This patch also adds support for generation of SFrame unwind information for the .plt* sections on x86_64. SFrame unwind info is generated for IBT enabled PLT, lazy/non-lazy PLT. The existing linker option --no-ld-generated-unwind-info has been adapted to include the control of whether .sframe unwind information will be generated for the linker generated sections like PLT. Changes to the linker script have been made as necessary. ChangeLog: * Makefile.def: Add install dependency on libsframe for libbfd. * Makefile.in: Regenerated. * bfd/Makefile.am: Add elf-sframe.c * bfd/Makefile.in: Regenerated. * bfd/bfd-in2.h (SEC_INFO_TYPE_SFRAME): Regenerated. * bfd/configure: Regenerate. * bfd/configure.ac: Add elf-sframe.lo. * bfd/elf-bfd.h (struct sframe_func_bfdinfo): New struct. (struct sframe_dec_info): Likewise. (struct sframe_enc_info): Likewise. (struct elf_link_hash_table): New member for encoded .sframe object. (struct output_elf_obj_tdata): New member. (elf_sframe): New access macro. (_bfd_elf_set_section_sframe): New declaration. * bfd/elf.c (get_segment_type): Handle new segment PT_GNU_SFRAME. (bfd_section_from_phdr): Likewise. (get_program_header_size): Likewise. (_bfd_elf_map_sections_to_segments): Likewise. * bfd/elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Add contents to the .sframe sections or .plt* entries. * bfd/elflink.c (elf_section_ignore_discarded_relocs): Handle SEC_INFO_TYPE_SFRAME. (_bfd_elf_default_action_discarded): Handle .sframe section. (elf_link_input_bfd): Merge .sframe section. (bfd_elf_final_link): Write the output .sframe section. (bfd_elf_discard_info): Handle discarding .sframe section. * bfd/elfxx-x86.c (_bfd_x86_elf_size_dynamic_sections): Create .sframe section for .plt and .plt.sec. (_bfd_x86_elf_finish_dynamic_sections): Handle .sframe from .plt* sections. * bfd/elfxx-x86.h (PLT_SFRAME_FDE_START_OFFSET): New definition. (SFRAME_PLT0_MAX_NUM_FRES): Likewise. (SFRAME_PLTN_MAX_NUM_FRES): Likewise. (struct elf_x86_sframe_plt): New structure. (struct elf_x86_link_hash_table): New member. (struct elf_x86_init_table): New members for .sframe creation. * bfd/section.c: Add new definition SEC_INFO_TYPE_SFRAME. * binutils/readelf.c (get_segment_type): Handle new segment PT_GNU_SFRAME. * ld/ld.texi: Update documentation for --no-ld-generated-unwind-info. * ld/scripttempl/elf.sc: Support .sframe sections. * Makefile.am (TESTSFRAMELIB): Use it. (check-DEJAGNU): Likewise. * configure.ac (TESTSFRAMELIB): Set to the .so or .a like TESTBFDLIB. * testsuite/ld-bootstrap/bootstrap.exp: Add SFRAMELIB. * bfd/elf-sframe.c: New file. include/ChangeLog: * elf/common.h (PT_GNU_SFRAME): New definition. * elf/internal.h (struct elf_segment_map): Handle new segment type PT_GNU_SFRAME. ld/testsuite/ChangeLog: * ld/testsuite/ld-aarch64/aarch64-elf.exp: Add new test sframe-simple-1. * ld/testsuite/ld-aarch64/sframe-bar.s: New file. * ld/testsuite/ld-aarch64/sframe-foo.s: Likewise. * ld/testsuite/ld-aarch64/sframe-simple-1.d: Likewise. * ld/testsuite/ld-sframe/sframe-empty.d: New test. * ld/testsuite/ld-sframe/sframe-empty.s: New file. * ld/testsuite/ld-sframe/sframe.exp: New testsuite. * ld/testsuite/ld-x86-64/sframe-bar.s: New file. * ld/testsuite/ld-x86-64/sframe-foo.s: Likewise. * ld/testsuite/ld-x86-64/sframe-simple-1.d: Likewise. * ld/testsuite/ld-x86-64/sframe-plt-1.d: Likewise. * ld/testsuite/ld-x86-64/sframe-simple-1.d: Likewise. * ld/testsuite/ld-x86-64/x86-64.exp: Add new tests - sframe-simple-1, sframe-plt-1. * ld/testsuite/lib/ld-lib.exp: Add new proc to check if assembler supports SFrame section. * ld/testsuite/ld-sframe/discard.d: New file. * ld/testsuite/ld-sframe/discard.ld: Likewise. * ld/testsuite/ld-sframe/discard.s: Likewise. --- Makefile.def | 4 + Makefile.in | 11 + bfd/Makefile.am | 6 +- bfd/Makefile.in | 7 +- bfd/bfd-in2.h | 1 + bfd/configure | 2 +- bfd/configure.ac | 2 +- bfd/elf-bfd.h | 54 +++ bfd/elf-sframe.c | 544 ++++++++++++++++++++++ bfd/elf.c | 32 ++ bfd/elf64-x86-64.c | 97 +++- bfd/elflink.c | 52 +++ bfd/elfxx-x86.c | 375 ++++++++++++++- bfd/elfxx-x86.h | 49 ++ bfd/section.c | 1 + binutils/readelf.c | 1 + include/elf/common.h | 1 + include/elf/internal.h | 1 + include/sframe-api.h | 2 +- ld/Makefile.am | 2 + ld/Makefile.in | 2 + ld/configure | 8 +- ld/configure.ac | 3 + ld/ld.texi | 4 +- ld/scripttempl/elf.sc | 2 + ld/testsuite/ld-aarch64/aarch64-elf.exp | 4 + ld/testsuite/ld-aarch64/sframe-bar.s | 7 + ld/testsuite/ld-aarch64/sframe-foo.s | 10 + ld/testsuite/ld-aarch64/sframe-simple-1.d | 26 ++ ld/testsuite/ld-bootstrap/bootstrap.exp | 8 +- ld/testsuite/ld-sframe/discard.d | 10 + ld/testsuite/ld-sframe/discard.ld | 9 + ld/testsuite/ld-sframe/discard.s | 13 + ld/testsuite/ld-sframe/sframe-empty.d | 10 + ld/testsuite/ld-sframe/sframe-empty.s | 2 + ld/testsuite/ld-sframe/sframe.exp | 47 ++ ld/testsuite/ld-x86-64/sframe-bar.s | 31 ++ ld/testsuite/ld-x86-64/sframe-foo.s | 37 ++ ld/testsuite/ld-x86-64/sframe-plt-1.d | 29 ++ ld/testsuite/ld-x86-64/sframe-simple-1.d | 35 ++ ld/testsuite/ld-x86-64/x86-64.exp | 5 + ld/testsuite/lib/ld-lib.exp | 45 ++ libsframe/sframe.c | 28 +- 43 files changed, 1595 insertions(+), 24 deletions(-) create mode 100644 bfd/elf-sframe.c create mode 100644 ld/testsuite/ld-aarch64/sframe-bar.s create mode 100644 ld/testsuite/ld-aarch64/sframe-foo.s create mode 100644 ld/testsuite/ld-aarch64/sframe-simple-1.d create mode 100644 ld/testsuite/ld-sframe/discard.d create mode 100644 ld/testsuite/ld-sframe/discard.ld create mode 100644 ld/testsuite/ld-sframe/discard.s create mode 100644 ld/testsuite/ld-sframe/sframe-empty.d create mode 100644 ld/testsuite/ld-sframe/sframe-empty.s create mode 100644 ld/testsuite/ld-sframe/sframe.exp create mode 100644 ld/testsuite/ld-x86-64/sframe-bar.s create mode 100644 ld/testsuite/ld-x86-64/sframe-foo.s create mode 100644 ld/testsuite/ld-x86-64/sframe-plt-1.d create mode 100644 ld/testsuite/ld-x86-64/sframe-simple-1.d diff --git a/Makefile.def b/Makefile.def index 1b39c910447..f974565d8ca 100644 --- a/Makefile.def +++ b/Makefile.def @@ -458,11 +458,14 @@ dependencies = { module=all-gdbsupport; on=all-gnulib; }; dependencies = { module=all-gdbsupport; on=all-intl; }; // Host modules specific to binutils. +// build libsframe before bfd for encoder/decoder support for linking +// SFrame sections dependencies = { module=configure-bfd; on=configure-libiberty; hard=true; }; dependencies = { module=configure-bfd; on=configure-intl; }; dependencies = { module=all-bfd; on=all-libiberty; }; dependencies = { module=all-bfd; on=all-intl; }; dependencies = { module=all-bfd; on=all-zlib; }; +dependencies = { module=all-bfd; on=all-libsframe; }; dependencies = { module=configure-opcodes; on=configure-libiberty; hard=true; }; dependencies = { module=all-opcodes; on=all-libiberty; }; @@ -488,6 +491,7 @@ dependencies = { module=install-binutils; on=install-opcodes; }; dependencies = { module=install-strip-binutils; on=install-strip-opcodes; }; // Likewise for ld, libctf, and bfd. +dependencies = { module=install-bfd; on=install-libsframe; }; dependencies = { module=install-libctf; on=install-bfd; }; dependencies = { module=install-ld; on=install-bfd; }; dependencies = { module=install-ld; on=install-libctf; }; diff --git a/Makefile.in b/Makefile.in index b26f778a94a..a425b54e094 100644 --- a/Makefile.in +++ b/Makefile.in @@ -64407,6 +64407,16 @@ all-stagetrain-bfd: maybe-all-stagetrain-zlib all-stagefeedback-bfd: maybe-all-stagefeedback-zlib all-stageautoprofile-bfd: maybe-all-stageautoprofile-zlib all-stageautofeedback-bfd: maybe-all-stageautofeedback-zlib +all-bfd: maybe-all-libsframe +all-stage1-bfd: maybe-all-stage1-libsframe +all-stage2-bfd: maybe-all-stage2-libsframe +all-stage3-bfd: maybe-all-stage3-libsframe +all-stage4-bfd: maybe-all-stage4-libsframe +all-stageprofile-bfd: maybe-all-stageprofile-libsframe +all-stagetrain-bfd: maybe-all-stagetrain-libsframe +all-stagefeedback-bfd: maybe-all-stagefeedback-libsframe +all-stageautoprofile-bfd: maybe-all-stageautoprofile-libsframe +all-stageautofeedback-bfd: maybe-all-stageautofeedback-libsframe configure-opcodes: configure-libiberty configure-stage1-opcodes: configure-stage1-libiberty configure-stage2-opcodes: configure-stage2-libiberty @@ -64539,6 +64549,7 @@ all-stageautoprofile-binutils: maybe-all-stageautoprofile-libsframe all-stageautofeedback-binutils: maybe-all-stageautofeedback-libsframe install-binutils: maybe-install-opcodes install-strip-binutils: maybe-install-strip-opcodes +install-bfd: maybe-install-libsframe install-libctf: maybe-install-bfd install-ld: maybe-install-bfd install-ld: maybe-install-libctf diff --git a/bfd/Makefile.am b/bfd/Makefile.am index b70d8f3ccea..85b6e71140f 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -286,6 +286,7 @@ BFD32_BACKENDS = \ ecofflink.lo \ elf-attrs.lo \ elf-eh-frame.lo \ + elf-sframe.lo \ elf-ifunc.lo \ elf-m10200.lo \ elf-m10300.lo \ @@ -419,6 +420,7 @@ BFD32_BACKENDS_CFILES = \ ecofflink.c \ elf-attrs.c \ elf-eh-frame.c \ + elf-sframe.c \ elf-ifunc.c \ elf-m10200.c \ elf-m10300.c \ @@ -777,8 +779,8 @@ ofiles: stamp-ofiles ; @true # dependency tracking fragments are picked up in the Makefile. libbfd_la_SOURCES = $(BFD32_LIBS_CFILES) EXTRA_libbfd_la_SOURCES = $(CFILES) -libbfd_la_DEPENDENCIES = $(OFILES) ofiles -libbfd_la_LIBADD = `cat ofiles` @SHARED_LIBADD@ $(LIBDL) $(ZLIB) $(ZSTD_LIBS) +libbfd_la_DEPENDENCIES = $(OFILES) ofiles ../libsframe/libsframe.la +libbfd_la_LIBADD = `cat ofiles` @SHARED_LIBADD@ $(LIBDL) $(ZLIB) $(ZSTD_LIBS) ../libsframe/libsframe.la libbfd_la_LDFLAGS += -release `cat libtool-soversion` @SHARED_LDFLAGS@ # libtool will build .libs/libbfd.a. We create libbfd.a in the build diff --git a/bfd/Makefile.in b/bfd/Makefile.in index b906976a1c0..ba1fd1bcc5e 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -755,6 +755,7 @@ BFD32_BACKENDS = \ ecofflink.lo \ elf-attrs.lo \ elf-eh-frame.lo \ + elf-sframe.lo \ elf-ifunc.lo \ elf-m10200.lo \ elf-m10300.lo \ @@ -888,6 +889,7 @@ BFD32_BACKENDS_CFILES = \ ecofflink.c \ elf-attrs.c \ elf-eh-frame.c \ + elf-sframe.c \ elf-ifunc.c \ elf-m10200.c \ elf-m10300.c \ @@ -1207,8 +1209,8 @@ OFILES = $(BFD_BACKENDS) $(BFD_MACHINES) @COREFILE@ @bfd64_libs@ # dependency tracking fragments are picked up in the Makefile. libbfd_la_SOURCES = $(BFD32_LIBS_CFILES) EXTRA_libbfd_la_SOURCES = $(CFILES) -libbfd_la_DEPENDENCIES = $(OFILES) ofiles -libbfd_la_LIBADD = `cat ofiles` @SHARED_LIBADD@ $(LIBDL) $(ZLIB) $(ZSTD_LIBS) +libbfd_la_DEPENDENCIES = $(OFILES) ofiles ../libsframe/libsframe.la +libbfd_la_LIBADD = `cat ofiles` @SHARED_LIBADD@ $(LIBDL) $(ZLIB) $(ZSTD_LIBS) ../libsframe/libsframe.la # libtool will build .libs/libbfd.a. We create libbfd.a in the build # directory so that we don't have to convert all the programs that use @@ -1574,6 +1576,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf-m10300.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf-nacl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf-properties.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf-sframe.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf-strtab.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf-vxworks.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf.Plo@am__quote@ diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index e09259b7eae..0b071dda1e5 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -994,6 +994,7 @@ typedef struct bfd_section #define SEC_INFO_TYPE_JUST_SYMS 4 #define SEC_INFO_TYPE_TARGET 5 #define SEC_INFO_TYPE_EH_FRAME_ENTRY 6 +#define SEC_INFO_TYPE_SFRAME 7 /* Nonzero if this section uses RELA relocations, rather than REL. */ unsigned int use_rela_p:1; diff --git a/bfd/configure b/bfd/configure index 1c1760670cb..28755f555bf 100755 --- a/bfd/configure +++ b/bfd/configure @@ -13582,7 +13582,7 @@ selarchs="$f" tb= elf="elf.lo elflink.lo elf-attrs.lo elf-strtab.lo elf-eh-frame.lo - dwarf1.lo dwarf2.lo" + elf-sframe.lo dwarf1.lo dwarf2.lo" coffgen="coffgen.lo dwarf2.lo" coff="cofflink.lo $coffgen" ecoff="ecofflink.lo $coffgen" diff --git a/bfd/configure.ac b/bfd/configure.ac index 74c0f072225..5d450a4ad25 100644 --- a/bfd/configure.ac +++ b/bfd/configure.ac @@ -383,7 +383,7 @@ selarchs="$f" tb= elf="elf.lo elflink.lo elf-attrs.lo elf-strtab.lo elf-eh-frame.lo - dwarf1.lo dwarf2.lo" + elf-sframe.lo dwarf1.lo dwarf2.lo" coffgen="coffgen.lo dwarf2.lo" coff="cofflink.lo $coffgen" ecoff="ecofflink.lo $coffgen" diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index f00f87b2779..70595a97638 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -490,6 +490,40 @@ struct eh_frame_hdr_info u; }; +/* Additional information for each function (used at link time). */ +struct sframe_func_bfdinfo +{ + /* Whether the function has been discarded from the final output. */ + bool func_deleted_p; + /* Relocation offset. */ + unsigned int func_r_offset; + /* Relocation index. */ + unsigned int func_reloc_index; +}; + +/* SFrame decoder info. + Contains all information for a decoded .sframe section. */ +struct sframe_dec_info +{ + /* Decoder context. */ + struct sframe_decoder_ctx *sfd_ctx; + /* Number of function descriptor entries in this .sframe. */ + unsigned int sfd_fde_count; + /* Additional information for linking. */ + struct sframe_func_bfdinfo *sfd_func_bfdinfo; +}; + +/* SFrame encoder info. + Contains all information for an encoded .sframe section to be + written out. */ +struct sframe_enc_info +{ + /* Encoder context. */ + struct sframe_encoder_ctx *sfe_ctx; + /* Output section. */ + asection *sframe_section; +}; + /* Enum used to identify target specific extensions to the elf_obj_tdata and elf_link_hash_table structures. Note the enums deliberately start from 1 so that we can detect an uninitialized field. The generic value @@ -668,6 +702,9 @@ struct elf_link_hash_table /* Used by eh_frame code when editing .eh_frame. */ struct eh_frame_hdr_info eh_info; + /* Used to link unwind data in .sframe sections. */ + struct sframe_enc_info sfe_info; + /* A linked list of local symbols to be added to .dynsym. */ struct elf_link_local_dynamic_entry *dynlocal; @@ -1941,6 +1978,10 @@ struct output_elf_obj_tdata /* Segment flags for the PT_GNU_STACK segment. */ unsigned int stack_flags; + /* Used to determine if PT_GNU_SFRAME segment header should be + created. */ + asection *sframe; + /* Used to determine if the e_flags field has been initialized */ bool flags_init; }; @@ -2122,6 +2163,7 @@ struct elf_obj_tdata #define elf_link_info(bfd) (elf_tdata(bfd) -> o->link_info) #define elf_next_file_pos(bfd) (elf_tdata(bfd) -> o->next_file_pos) #define elf_stack_flags(bfd) (elf_tdata(bfd) -> o->stack_flags) +#define elf_sframe(bfd) (elf_tdata(bfd) -> o->sframe) #define elf_shstrtab(bfd) (elf_tdata(bfd) -> o->strtab_ptr) #define elf_onesymtab(bfd) (elf_tdata(bfd) -> symtab_section) #define elf_symtab_shndx_list(bfd) (elf_tdata(bfd) -> symtab_shndx_list) @@ -2436,6 +2478,18 @@ extern bool _bfd_elf_eh_frame_entry_present extern bool _bfd_elf_maybe_strip_eh_frame_hdr (struct bfd_link_info *); +extern bool _bfd_elf_sframe_present + (struct bfd_link_info *); +extern bool _bfd_elf_parse_sframe + (bfd *, struct bfd_link_info *, asection *, struct elf_reloc_cookie *); +extern bool _bfd_elf_discard_section_sframe + (asection *, bool (*) (bfd_vma, void *), struct elf_reloc_cookie *); +extern bool _bfd_elf_merge_section_sframe + (bfd *, struct bfd_link_info *, asection *, bfd_byte *); +extern bool _bfd_elf_write_section_sframe + (bfd *, struct bfd_link_info *); +extern bool _bfd_elf_set_section_sframe (bfd *, struct bfd_link_info *); + extern bool _bfd_elf_hash_symbol (struct elf_link_hash_entry *); extern long _bfd_elf_link_lookup_local_dynindx diff --git a/bfd/elf-sframe.c b/bfd/elf-sframe.c new file mode 100644 index 00000000000..8055aa3ea3b --- /dev/null +++ b/bfd/elf-sframe.c @@ -0,0 +1,544 @@ +/* .sframe section processing. + Copyright (C) 2022 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + +#include "sysdep.h" +#include "bfd.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "sframe-api.h" + +/* Return TRUE if the function has been marked for deletion during the linking + process. */ + +static bool +sframe_decoder_func_deleted_p (struct sframe_dec_info *sfd_info, + unsigned int func_idx) +{ + if (func_idx < sfd_info->sfd_fde_count) + return sfd_info->sfd_func_bfdinfo[func_idx].func_deleted_p; + + return false; +} + +/* Mark the function in the decoder info for deletion. */ + +static void +sframe_decoder_mark_func_deleted (struct sframe_dec_info *sfd_info, + unsigned int func_idx) +{ + if (func_idx < sfd_info->sfd_fde_count) + sfd_info->sfd_func_bfdinfo[func_idx].func_deleted_p = true; +} + +/* Get the relocation offset from the decoder info for the given function. */ + +static unsigned int +sframe_decoder_get_func_r_offset (struct sframe_dec_info *sfd_info, + unsigned int func_idx) +{ + BFD_ASSERT (func_idx < sfd_info->sfd_fde_count); + unsigned int func_r_offset + = sfd_info->sfd_func_bfdinfo[func_idx].func_r_offset; + /* There must have been a reloc. */ + BFD_ASSERT (func_r_offset); + return func_r_offset; +} + +/* Bookkeep the function relocation offset in the decoder info. */ + +static void +sframe_decoder_set_func_r_offset (struct sframe_dec_info *sfd_info, + unsigned int func_idx, + unsigned int r_offset) +{ + if (func_idx < sfd_info->sfd_fde_count) + sfd_info->sfd_func_bfdinfo[func_idx].func_r_offset = r_offset; +} + +/* Get the relocation index in the elf_reloc_cookie for the function. */ + +static unsigned int +sframe_decoder_get_func_reloc_index (struct sframe_dec_info *sfd_info, + unsigned int func_idx) +{ + BFD_ASSERT (func_idx < sfd_info->sfd_fde_count); + return sfd_info->sfd_func_bfdinfo[func_idx].func_reloc_index; +} + +/* Bookkeep the relocation index in the elf_reloc_cookie for the function. */ + +static void +sframe_decoder_set_func_reloc_index (struct sframe_dec_info *sfd_info, + unsigned int func_idx, + unsigned int reloc_index) +{ + if (func_idx < sfd_info->sfd_fde_count) + sfd_info->sfd_func_bfdinfo[func_idx].func_reloc_index = reloc_index; +} + +/* Initialize the set of additional information in CFD_INFO, + needed for linking SEC. Returns TRUE if setup is done successfully. */ + +static bool +sframe_decoder_init_func_bfdinfo (asection *sec, + struct sframe_dec_info *sfd_info, + struct elf_reloc_cookie *cookie) +{ + unsigned int fde_count; + unsigned int func_bfdinfo_size, i; + + fde_count = sframe_decoder_get_num_fidx (sfd_info->sfd_ctx); + sfd_info->sfd_fde_count = fde_count; + + /* Allocate and clear the memory. */ + func_bfdinfo_size = (sizeof (struct sframe_func_bfdinfo)) * fde_count; + sfd_info->sfd_func_bfdinfo + = (struct sframe_func_bfdinfo*) bfd_malloc (func_bfdinfo_size); + if (sfd_info->sfd_func_bfdinfo == NULL) + return false; + memset (sfd_info->sfd_func_bfdinfo, 0, func_bfdinfo_size); + + /* For linker generated .sframe sections, we have no relocs. Skip. */ + if ((sec->flags & SEC_LINKER_CREATED) && cookie->rels == NULL) + return true; + + for (i = 0; i < fde_count; i++) + { + cookie->rel = cookie->rels + i; + BFD_ASSERT (cookie->rel < cookie->relend); + /* Bookkeep the relocation offset and relocation index of each function + for later use. */ + sframe_decoder_set_func_r_offset (sfd_info, i, cookie->rel->r_offset); + sframe_decoder_set_func_reloc_index (sfd_info, i, + (cookie->rel - cookie->rels)); + + cookie->rel++; + } + BFD_ASSERT (cookie->rel == cookie->relend); + + return true; +} + +/* Read the value from CONTENTS at the specified OFFSET for the given ABFD. */ + +static bfd_vma +sframe_read_value (bfd *abfd, bfd_byte *contents, unsigned int offset, + unsigned int width) +{ + BFD_ASSERT (contents && offset); + /* Supporting the usecase of reading only the 4-byte relocated + value (signed offset for func start addr) for now. */ + BFD_ASSERT (width == 4); + /* FIXME endianness ?? */ + unsigned char *buf = contents + offset; + bfd_vma value = bfd_get_signed_32 (abfd, buf); + return value; +} + +/* Return true if there is at least one non-empty .sframe section in + input files. Can only be called after ld has mapped input to + output sections, and before sections are stripped. */ + +bool +_bfd_elf_sframe_present (struct bfd_link_info *info) +{ + asection *sframe = bfd_get_section_by_name (info->output_bfd, ".sframe"); + + if (sframe == NULL) + return false; + + /* Count only sections which have at least a single FDE. */ + for (sframe = sframe->map_head.s; sframe != NULL; sframe = sframe->map_head.s) + /* Note that this may become an approximate check in the future when + some ABI/arch begin to use the sfh_auxhdr_len. When sfh_auxhdr_len has + non-zero value, it will need to be accounted for in the calculation of + the SFrame header size. */ + if (sframe->size > sizeof (sframe_header)) + return true; + return false; +} + +/* Try to parse .sframe section SEC, which belongs to ABFD. Store the + information in the section's sec_info field on success. COOKIE + describes the relocations in SEC. + + Returns TRUE if success, FALSE if any error or failure. */ + +bool +_bfd_elf_parse_sframe (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + asection *sec, struct elf_reloc_cookie *cookie) +{ + bfd_byte *sfbuf = NULL; + struct sframe_dec_info *sfd_info; + sframe_decoder_ctx *sfd_ctx; + bfd_size_type sf_size; + int decerr = 0; + + if (sec->size == 0 + || sec->sec_info_type != SEC_INFO_TYPE_NONE) + { + /* This file does not contain .sframe information. */ + return false; + } + + if (bfd_is_abs_section (sec->output_section)) + { + /* At least one of the sections is being discarded from the + link, so we should just ignore them. */ + return false; + } + + /* Read the SFrame unwind information from abfd. */ + if (!bfd_malloc_and_get_section (abfd, sec, &sfbuf)) + goto fail_no_free; + + /* Decode the buffer and keep decoded contents for later use. + Relocations are performed later, but are such that the section's + size is unaffected. */ + sfd_info = bfd_malloc (sizeof (struct sframe_dec_info)); + sf_size = sec->size; + + sfd_info->sfd_ctx = sframe_decode ((const char*)sfbuf, sf_size, &decerr); + sfd_ctx = sfd_info->sfd_ctx; + if (!sfd_ctx) + /* Free'ing up any memory held by decoder context is done by + sframe_decode in case of error. */ + goto fail_no_free; + + if (!sframe_decoder_init_func_bfdinfo (sec, sfd_info, cookie)) + { + sframe_decoder_free (&sfd_ctx); + goto fail_no_free; + } + + elf_section_data (sec)->sec_info = sfd_info; + sec->sec_info_type = SEC_INFO_TYPE_SFRAME; + + goto success; + +fail_no_free: + _bfd_error_handler + (_("error in %pB(%pA); no .sframe will be created"), + abfd, sec); + return false; +success: + free (sfbuf); + return true; +} + +/* This function is called for each input file before the .sframe section + is relocated. It marks the SFrame FDE for the discarded functions for + deletion. + + The function returns TRUE iff any entries have been deleted. */ + +bool +_bfd_elf_discard_section_sframe + (asection *sec, + bool (*reloc_symbol_deleted_p) (bfd_vma, void *), + struct elf_reloc_cookie *cookie) +{ + bool changed; + bool keep; + unsigned int i; + unsigned int func_desc_offset; + unsigned int num_fidx; + struct sframe_dec_info *sfd_info; + + changed = false; + /* FIXME - if relocatable link and changed = true, how does the final + .rela.sframe get updated ?. */ + keep = false; + + sfd_info = (struct sframe_dec_info *) elf_section_data (sec)->sec_info; + + /* Skip checking for the linker created .sframe sections + (for PLT sections). */ + if ((sec->flags & SEC_LINKER_CREATED) == 0 || cookie->rels != NULL) + { + num_fidx = sframe_decoder_get_num_fidx (sfd_info->sfd_ctx); + for (i = 0; i < num_fidx; i++) + { + func_desc_offset = sframe_decoder_get_func_r_offset (sfd_info, i); + + cookie->rel = cookie->rels + + sframe_decoder_get_func_reloc_index (sfd_info, i); + keep = !(*reloc_symbol_deleted_p) (func_desc_offset, cookie); + + if (!keep) + { + sframe_decoder_mark_func_deleted (sfd_info, i); + changed = true; + } + } + } + return changed; +} + +/* Update the reference to the output .sframe section in the output ELF + BFD ABFD. Returns true if no error. */ + +bool +_bfd_elf_set_section_sframe (bfd *abfd, + struct bfd_link_info *info) +{ + asection *cfsec; + + cfsec = bfd_get_section_by_name (info->output_bfd, ".sframe"); + if (!cfsec) + return false; + + elf_sframe (abfd) = cfsec; + + return true; +} + +/* Merge .sframe section SEC. This is called with the relocated + CONTENTS. */ + +bool +_bfd_elf_merge_section_sframe (bfd *abfd, + struct bfd_link_info *info, + asection *sec, + bfd_byte *contents) +{ + struct sframe_dec_info *sfd_info; + struct sframe_enc_info *sfe_info; + sframe_decoder_ctx *sfd_ctx; + sframe_encoder_ctx *sfe_ctx; + unsigned char sfd_ctx_abi_arch; + int8_t sfd_ctx_fixed_fp_offset; + int8_t sfd_ctx_fixed_ra_offset; + int encerr = 0; + + struct elf_link_hash_table *htab; + asection *cfsec; + + /* Sanity check - handle SFrame sections only. */ + if (sec->sec_info_type != SEC_INFO_TYPE_SFRAME) + return false; + + sfd_info = (struct sframe_dec_info *) elf_section_data (sec)->sec_info; + sfd_ctx = sfd_info->sfd_ctx; + + htab = elf_hash_table (info); + sfe_info = &(htab->sfe_info); + sfe_ctx = sfe_info->sfe_ctx; + + /* All input bfds are expected to have a valid SFrame section. Even if + the SFrame section is empty with only a header, there must be a valid + SFrame decoder context by now. The SFrame encoder context, however, + will get set later here, if this is the first call to the function. */ + if (sfd_ctx == NULL || sfe_info == NULL) + return false; + + if (htab->sfe_info.sfe_ctx == NULL) + { + sfd_ctx_abi_arch = sframe_decoder_get_abi_arch (sfd_ctx); + sfd_ctx_fixed_fp_offset = sframe_decoder_get_fixed_fp_offset (sfd_ctx); + sfd_ctx_fixed_ra_offset = sframe_decoder_get_fixed_ra_offset (sfd_ctx); + + /* Valid values are non-zero. */ + if (!sfd_ctx_abi_arch) + return false; + + htab->sfe_info.sfe_ctx = sframe_encode (SFRAME_VERSION_1, + 0, /* SFrame flags. */ + sfd_ctx_abi_arch, + sfd_ctx_fixed_fp_offset, + sfd_ctx_fixed_ra_offset, + &encerr); + /* Handle errors from sframe_encode. */ + if (htab->sfe_info.sfe_ctx == NULL) + return false; + } + sfe_ctx = sfe_info->sfe_ctx; + + if (sfe_info->sframe_section == NULL) + { + /* Make sure things are set for an eventual write. + Size of the output section is not known until + _bfd_elf_write_section_sframe is ready with the buffer + to write out. */ + cfsec = bfd_get_section_by_name (info->output_bfd, ".sframe"); + if (cfsec) + { + sfe_info->sframe_section = cfsec; + // elf_sframe (abfd) = cfsec; + } + else + return false; + } + + /* Check that all .sframe sections being linked have the same + ABI/arch. */ + if (sframe_decoder_get_abi_arch (sfd_ctx) + != sframe_encoder_get_abi_arch (sfe_ctx)) + { + _bfd_error_handler + (_("input SFrame sections with different abi prevent .sframe" + " generation")); + return false; + } + + /* Iterate over the function descriptor entries and the FREs of the + function from the decoder context. Add each of them to the encoder + context, if suitable. */ + unsigned int i = 0, j = 0, cur_fidx = 0; + + unsigned int num_fidx = sframe_decoder_get_num_fidx (sfd_ctx); + unsigned int num_enc_fidx = sframe_encoder_get_num_fidx (sfe_ctx); + + for (i = 0; i < num_fidx; i++) + { + unsigned int num_fres = 0; + int32_t func_start_address; + bfd_vma address; + uint32_t func_size = 0; + unsigned char func_info = 0; + unsigned int r_offset = 0; + bool pltn_reloc_by_hand = false; + unsigned int pltn_r_offset = 0; + + if (!sframe_decoder_get_funcdesc (sfd_ctx, i, &num_fres, &func_size, + &func_start_address, &func_info)) + { + /* If function belongs to a deleted section, skip editing the + function descriptor entry. */ + if (sframe_decoder_func_deleted_p(sfd_info, i)) + continue; + + /* Don't edit function descriptor entries for relocatable link. */ + if (!bfd_link_relocatable (info)) + { + if (!(sec->flags & SEC_LINKER_CREATED)) + { + /* Get relocated contents by reading the value of the + relocated function start address at the beginning of the + function descriptor entry. */ + r_offset = sframe_decoder_get_func_r_offset (sfd_info, i); + } + else + { + /* Expected to land here for SFrame unwind info as created + for the .plt* sections. These sections can have upto two + FDE entries. Although the code should work for > 2, + leaving this assert here for safety. */ + BFD_ASSERT (num_fidx <= 2); + /* For the first entry, we know the offset of the SFrame FDE's + sfde_func_start_address. Side note: see how the value + of PLT_SFRAME_FDE_START_OFFSET is also set to the + same. */ + r_offset = sframe_decoder_get_hdr_size (sfd_ctx); + /* For any further SFrame FDEs, the generator has already put + in an offset in place of sfde_func_start_address of the + corresponding FDE. We will use it by hand to relocate. */ + if (i > 0) + { + pltn_r_offset + = r_offset + (i * sizeof (sframe_func_desc_entry)); + pltn_reloc_by_hand = true; + } + } + + /* Get the SFrame FDE function start address after relocation. */ + address = sframe_read_value (abfd, contents, r_offset, 4); + if (pltn_reloc_by_hand) + address += sframe_read_value (abfd, contents, + pltn_r_offset, 4); + address += (sec->output_offset + r_offset); + + /* FIXME For testing only. Cleanup later. */ + // address += (sec->output_section->vma); + + func_start_address = address; + } + + /* Update the encoder context with updated content. */ + int err = sframe_encoder_add_funcdesc (sfe_ctx, func_start_address, + func_size, func_info, + num_fres); + cur_fidx++; + BFD_ASSERT (!err); + } + + for (j = 0; j < num_fres; j++) + { + sframe_frame_row_entry fre; + if (!sframe_decoder_get_fre (sfd_ctx, i, j, &fre)) + { + int err = sframe_encoder_add_fre (sfe_ctx, + cur_fidx-1+num_enc_fidx, + &fre); + BFD_ASSERT (!err); + } + } + } + /* Free the SFrame decoder context. */ + sframe_decoder_free (&sfd_ctx); + + return true; +} + +/* Write out the .sframe section. This must be called after + _bfd_elf_merge_section_sframe has been called on all input + .sframe sections. */ + +bool +_bfd_elf_write_section_sframe (bfd *abfd, struct bfd_link_info *info) +{ + bool retval = true; + + struct elf_link_hash_table *htab; + struct sframe_enc_info *sfe_info; + sframe_encoder_ctx *sfe_ctx; + asection *sec; + void *contents; + size_t sec_size; + int err = 0; + + htab = elf_hash_table (info); + sfe_info = &htab->sfe_info; + sec = sfe_info->sframe_section; + sfe_ctx = sfe_info->sfe_ctx; + + if (sec == NULL) + return true; + + contents = sframe_encoder_write (sfe_ctx, &sec_size, &err); + sec->size = (bfd_size_type) sec_size; + + if (!bfd_set_section_contents (abfd, sec->output_section, contents, + (file_ptr) sec->output_offset, + sec->size)) + retval = false; + else if (!bfd_link_relocatable (info)) + { + Elf_Internal_Shdr *hdr = &elf_section_data (sec)->this_hdr; + hdr->sh_size = sec->size; + } + /* For relocatable links, do not update the section size as the section + contents have not been relocated. */ + + sframe_encoder_free (&sfe_ctx); + + return retval; +} diff --git a/bfd/elf.c b/bfd/elf.c index 81825b748d7..87ec1623313 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -1673,6 +1673,7 @@ get_segment_type (unsigned int p_type) case PT_GNU_EH_FRAME: pt = "EH_FRAME"; break; case PT_GNU_STACK: pt = "STACK"; break; case PT_GNU_RELRO: pt = "RELRO"; break; + case PT_GNU_SFRAME: pt = "SFRAME"; break; default: pt = NULL; break; } return pt; @@ -3081,6 +3082,10 @@ bfd_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int hdr_index) case PT_GNU_RELRO: return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, "relro"); + case PT_GNU_SFRAME: + return _bfd_elf_make_section_from_phdr (abfd, hdr, hdr_index, + "sframe"); + default: /* Check for any processor-specific program segment types. */ bed = get_elf_backend_data (abfd); @@ -4450,6 +4455,12 @@ get_program_header_size (bfd *abfd, struct bfd_link_info *info) ++segs; } + if (elf_sframe (abfd)) + { + /* We need a PT_GNU_SFRAME segment. */ + ++segs; + } + s = bfd_get_section_by_name (abfd, NOTE_GNU_PROPERTY_SECTION_NAME); if (s != NULL && s->size != 0) @@ -4715,6 +4726,7 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, asection *first_tls = NULL; asection *first_mbind = NULL; asection *dynsec, *eh_frame_hdr; + asection *sframe; size_t amt; bfd_vma addr_mask, wrap_to = 0; /* Bytes. */ bfd_size_type phdr_size; /* Octets/bytes. */ @@ -5210,6 +5222,26 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, pm = &m->next; } + /* If there is a .sframe section, throw in a PT_GNU_SFRAME + segment. */ + sframe = elf_sframe (abfd); + if (sframe != NULL + && (sframe->output_section->flags & SEC_LOAD) != 0 + && sframe->size != 0) + { + amt = sizeof (struct elf_segment_map); + m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); + if (m == NULL) + goto error_return; + m->next = NULL; + m->p_type = PT_GNU_SFRAME; + m->count = 1; + m->sections[0] = sframe->output_section; + + *pm = m; + pm = &m->next; + } + if (elf_stack_flags (abfd)) { amt = sizeof (struct elf_segment_map); diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 2ae8dffba0f..fb872793d5f 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -22,6 +22,7 @@ #include "elfxx-x86.h" #include "dwarf2.h" #include "libiberty.h" +#include "sframe.h" #include "opcode/i386.h" @@ -818,6 +819,87 @@ static const bfd_byte elf_x86_64_eh_frame_non_lazy_plt[] = DW_CFA_nop, DW_CFA_nop, DW_CFA_nop }; +static const sframe_frame_row_entry elf_x86_64_sframe_null_fre = +{ + 0, + SFRAME_V1_FRE_INFO (SFRAME_BASE_REG_SP, 1, SFRAME_FRE_OFFSET_1B), /* FRE info. */ + {16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} /* 12 bytes. */ +}; + +/* .sframe FRE covering the .plt section entry. */ +static const sframe_frame_row_entry elf_x86_64_sframe_plt0_fre1 = +{ + 0, /* SFrame FRE start address. */ + SFRAME_V1_FRE_INFO (SFRAME_BASE_REG_SP, 1, SFRAME_FRE_OFFSET_1B), /* FRE info. */ + {16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} /* 12 bytes. */ +}; + +/* .sframe FRE covering the .plt section entry. */ +static const sframe_frame_row_entry elf_x86_64_sframe_plt0_fre2 = +{ + 6, /* SFrame FRE start address. */ + SFRAME_V1_FRE_INFO (SFRAME_BASE_REG_SP, 1, SFRAME_FRE_OFFSET_1B), /* FRE info. */ + {24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} /* 12 bytes. */ +}; + +/* .sframe FRE covering the .plt section entry. */ +static const sframe_frame_row_entry elf_x86_64_sframe_pltn_fre1 = +{ + 0, /* SFrame FRE start address. */ + SFRAME_V1_FRE_INFO (SFRAME_BASE_REG_SP, 1, SFRAME_FRE_OFFSET_1B), /* FRE info. */ + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} /* 12 bytes. */ +}; + +/* .sframe FRE covering the .plt section entry. */ +static const sframe_frame_row_entry elf_x86_64_sframe_pltn_fre2 = +{ + 11, /* SFrame FRE start address. */ + SFRAME_V1_FRE_INFO (SFRAME_BASE_REG_SP, 1, SFRAME_FRE_OFFSET_1B), /* FRE info. */ + {16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} /* 12 bytes. */ +}; + +/* .sframe FRE covering the second .plt section entry. */ +static const sframe_frame_row_entry elf_x86_64_sframe_sec_pltn_fre1 = +{ + 0, /* SFrame FRE start address. */ + SFRAME_V1_FRE_INFO (SFRAME_BASE_REG_SP, 1, SFRAME_FRE_OFFSET_1B), /* FRE info. */ + {8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} /* 12 bytes. */ +}; + +/* SFrame helper object for non-lazy PLT. Also used for IBT enabled PLT. */ +static const struct elf_x86_sframe_plt elf_x86_64_sframe_non_lazy_plt = +{ + LAZY_PLT_ENTRY_SIZE, + 2, /* Number of FREs for PLT0. */ + /* Array of SFrame FREs for plt0. */ + { &elf_x86_64_sframe_plt0_fre1, &elf_x86_64_sframe_plt0_fre2 }, + LAZY_PLT_ENTRY_SIZE, + 1, /* Number of FREs for PLTn. */ + /* Array of SFrame FREs for plt. */ + { &elf_x86_64_sframe_sec_pltn_fre1, &elf_x86_64_sframe_null_fre }, + 0, + 0, /* There is no second PLT necessary. */ + { &elf_x86_64_sframe_null_fre } +}; + +/* SFrame helper object for lazy PLT. Also used for IBT enabled PLT. */ +static const struct elf_x86_sframe_plt elf_x86_64_sframe_plt = +{ + LAZY_PLT_ENTRY_SIZE, + 2, /* Number of FREs for PLT0. */ + /* Array of SFrame FREs for plt0. */ + { &elf_x86_64_sframe_plt0_fre1, &elf_x86_64_sframe_plt0_fre2 }, + LAZY_PLT_ENTRY_SIZE, + 2, /* Number of FREs for PLTn. */ + /* Array of SFrame FREs for plt. */ + { &elf_x86_64_sframe_pltn_fre1, &elf_x86_64_sframe_pltn_fre2 }, + NON_LAZY_PLT_ENTRY_SIZE, + 1, /* Number of FREs for PLTn for second PLT. */ + /* FREs for second plt ( unwind info for .plt.got is + identical). Used when IBT or non-lazy PLT is in effect. */ + { &elf_x86_64_sframe_sec_pltn_fre1 } +}; + /* These are the standard parameters. */ static const struct elf_x86_lazy_plt_layout elf_x86_64_lazy_plt = { @@ -971,7 +1053,6 @@ static const struct elf_x86_non_lazy_plt_layout elf_x32_non_lazy_ibt_plt = sizeof (elf_x86_64_eh_frame_non_lazy_plt) /* eh_frame_plt_size */ }; - static bool elf64_x86_64_elf_object_p (bfd *abfd) { @@ -5228,6 +5309,20 @@ elf_x86_64_link_setup_gnu_properties (struct bfd_link_info *info) init_table.non_lazy_ibt_plt = &elf_x32_non_lazy_ibt_plt; } + if (ABI_64_P (info->output_bfd)) + { + init_table.sframe_lazy_plt = &elf_x86_64_sframe_plt; + init_table.sframe_non_lazy_plt = &elf_x86_64_sframe_non_lazy_plt; + init_table.sframe_lazy_ibt_plt = &elf_x86_64_sframe_plt; + init_table.sframe_non_lazy_ibt_plt = &elf_x86_64_sframe_non_lazy_plt; + } + else + { + /* SFrame is not supported for non AMD64. */ + init_table.sframe_lazy_plt = NULL; + init_table.sframe_non_lazy_plt = NULL; + } + if (ABI_64_P (info->output_bfd)) { init_table.r_info = elf64_r_info; diff --git a/bfd/elflink.c b/bfd/elflink.c index 89dcf26108c..cff0a0f625e 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -10899,6 +10899,7 @@ elf_section_ignore_discarded_relocs (asection *sec) case SEC_INFO_TYPE_STABS: case SEC_INFO_TYPE_EH_FRAME: case SEC_INFO_TYPE_EH_FRAME_ENTRY: + case SEC_INFO_TYPE_SFRAME: return true; default: break; @@ -10930,6 +10931,9 @@ _bfd_elf_default_action_discarded (asection *sec) if (strcmp (".eh_frame", sec->name) == 0) return 0; + if (strcmp (".sframe", sec->name) == 0) + return 0; + if (strcmp (".gcc_except_table", sec->name) == 0) return 0; @@ -11863,6 +11867,16 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd) return false; } break; + case SEC_INFO_TYPE_SFRAME: + { + /* Merge .sframe sections into the ctf frame encoder + context of the output_bfd's section. The final .sframe + output section will be written out later. */ + if (!_bfd_elf_merge_section_sframe (output_bfd, flinfo->info, + o, contents)) + return false; + } + break; default: { if (! (o->flags & SEC_EXCLUDE)) @@ -13446,6 +13460,9 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) if (! _bfd_elf_write_section_eh_frame_hdr (abfd, info)) goto error_return; + if (! _bfd_elf_write_section_sframe (abfd, info)) + goto error_return; + if (info->callbacks->emit_ctf) info->callbacks->emit_ctf (); @@ -14901,6 +14918,41 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info) _bfd_elf_adjust_eh_frame_global_symbol, NULL); } + o = bfd_get_section_by_name (output_bfd, ".sframe"); + if (o != NULL) + { + asection *i; + + for (i = o->map_head.s; i != NULL; i = i->map_head.s) + { + if (i->size == 0) + continue; + + abfd = i->owner; + if (bfd_get_flavour (abfd) != bfd_target_elf_flavour) + continue; + + if (!init_reloc_cookie_for_section (&cookie, info, i)) + return -1; + + if (_bfd_elf_parse_sframe (abfd, info, i, &cookie)) + { + if (_bfd_elf_discard_section_sframe (i, + bfd_elf_reloc_symbol_deleted_p, + &cookie)) + { + if (i->size != i->rawsize) + changed = 1; + } + } + fini_reloc_cookie_for_section (&cookie, i); + } + /* Update the reference to the output .sframe section. Used to + determine later if PT_GNU_SFRAME segment is to be generated. */ + if (!_bfd_elf_set_section_sframe (output_bfd, info)) + return -1; + } + for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link.next) { const struct elf_backend_data *bed; diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c index 7fb972752b3..c48d0385485 100644 --- a/bfd/elfxx-x86.c +++ b/bfd/elfxx-x86.c @@ -1777,6 +1777,191 @@ elf_x86_relative_reloc_compare (const void *pa, const void *pb) return 0; } +enum dynobj_sframe_plt_type +{ + SFRAME_PLT = 1, + SFRAME_PLT_SEC = 2 +}; + +/* Create SFrame unwind info for the plt entries in the .plt section + of type PLT_SEC_TYPE. */ + +static bool +_bfd_x86_elf_create_sframe_plt (bfd *output_bfd, + struct bfd_link_info *info, + unsigned int plt_sec_type) +{ + struct elf_x86_link_hash_table *htab; + const struct elf_backend_data *bed; + + bool plt0_generated_p; + unsigned int plt0_entry_size; + unsigned char func_info; + unsigned int fre_type; + /* The dynamic plt section for which .sframe unwind information is being + created. */ + asection *dpltsec; + + int err = 0; + + sframe_encoder_ctx **ectx = NULL; + unsigned plt_entry_size = 0; + unsigned int num_pltn_fres = 0; + unsigned int num_pltn_entries = 0; + + bed = get_elf_backend_data (output_bfd); + htab = elf_x86_hash_table (info, bed->target_id); + /* Whether SFrame unwind info for plt0 is to be generated. */ + plt0_generated_p = htab->plt.has_plt0; + plt0_entry_size + = (plt0_generated_p) ? htab->sframe_plt->plt0_entry_size : 0; + + switch (plt_sec_type) + { + case SFRAME_PLT: + { + ectx = &htab->plt_cfe_ctx; + dpltsec = htab->elf.splt; + + plt_entry_size = htab->plt.plt_entry_size; + num_pltn_fres = htab->sframe_plt->pltn_num_fres; + num_pltn_entries + = (htab->elf.splt->size - plt0_entry_size) / plt_entry_size; + + break; + } + case SFRAME_PLT_SEC: + { + ectx = &htab->plt_second_cfe_ctx; + /* FIXME - this or htab->plt_second_sframe ? */ + dpltsec = htab->plt_second_eh_frame; + + plt_entry_size = htab->sframe_plt->sec_pltn_entry_size; + num_pltn_fres = htab->sframe_plt->sec_pltn_num_fres; + num_pltn_entries + = htab->plt_second_eh_frame->size / plt_entry_size; + break; + } + default: + /* No other value is possible. */ + return false; + break; + } + + *ectx = sframe_encode (SFRAME_VERSION_1, + 0, + SFRAME_ABI_AMD64_ENDIAN_LITTLE, + SFRAME_CFA_FIXED_FP_INVALID, + -8, /* Fixed RA offset. */ + &err); + + /* FRE type is dependent on the size of the function. */ + fre_type = sframe_calc_fre_type (dpltsec->size); + func_info = sframe_fde_func_info (fre_type, + SFRAME_FDE_TYPE_PCINC); + + /* Add SFrame FDE and the associated FREs for plt0 if plt0 has been + generated. */ + if (plt0_generated_p) + { + /* Add SFrame FDE for plt0, the function start address is updated later + at _bfd_elf_merge_section_sframe time. */ + sframe_encoder_add_funcdesc (*ectx, + 0, /* func start addr. */ + plt0_entry_size, + func_info, + 0 /* Num FREs. */); + sframe_frame_row_entry plt0_fre; + unsigned int num_plt0_fres = htab->sframe_plt->plt0_num_fres; + for (unsigned int j = 0; j < num_plt0_fres; j++) + { + plt0_fre = *(htab->sframe_plt->plt0_fres[j]); + sframe_encoder_add_fre (*ectx, 0, &plt0_fre); + } + } + + + if (num_pltn_entries) + { + /* pltn entries use an SFrame FDE of type + SFRAME_FDE_TYPE_PCMASK to exploit the repetitive + pattern of the instructions in these entries. Using this SFrame FDE + type helps in keeping the unwind information for pltn entries + compact. */ + func_info = sframe_fde_func_info (fre_type, SFRAME_FDE_TYPE_PCMASK); + /* Add the SFrame FDE for all PCs starting at the first pltn entry (hence, + function start address = plt0_entry_size. As usual, this will be + updated later at _bfd_elf_merge_section_sframe, by when the + sections are relocated. */ + sframe_encoder_add_funcdesc (*ectx, + plt0_entry_size, /* func start addr. */ + dpltsec->size - plt0_entry_size, + func_info, + 0 /* Num FREs. */); + + sframe_frame_row_entry pltn_fre; + /* Now add the FREs for pltn. Simply adding the two FREs suffices due + to the usage of SFRAME_FDE_TYPE_PCMASK above. */ + for (unsigned int j = 0; j < num_pltn_fres; j++) + { + pltn_fre = *(htab->sframe_plt->pltn_fres[j]); + sframe_encoder_add_fre (*ectx, 1, &pltn_fre); + } + } + + return true; +} + +/* Put contents of the .sframe section corresponding to the specified + PLT_SEC_TYPE. */ + +static bool +_bfd_x86_elf_write_sframe_plt (bfd *output_bfd, + struct bfd_link_info *info, + unsigned int plt_sec_type) +{ + struct elf_x86_link_hash_table *htab; + const struct elf_backend_data *bed; + sframe_encoder_ctx *ectx; + size_t sec_size; + asection *sec; + bfd *dynobj; + + int err = 0; + + bed = get_elf_backend_data (output_bfd); + htab = elf_x86_hash_table (info, bed->target_id); + dynobj = htab->elf.dynobj; + + switch (plt_sec_type) + { + case SFRAME_PLT: + ectx = htab->plt_cfe_ctx; + sec = htab->plt_sframe; + break; + case SFRAME_PLT_SEC: + ectx = htab->plt_second_cfe_ctx; + sec = htab->plt_second_sframe; + break; + default: + /* No other value is possible. */ + return false; + break; + } + + BFD_ASSERT (ectx); + + void *contents = sframe_encoder_write (ectx, &sec_size, &err); + + sec->size = (bfd_size_type) sec_size; + sec->contents = (unsigned char *) bfd_zalloc (dynobj, sec->size); + memcpy (sec->contents, contents, sec_size); + + sframe_encoder_free (&ectx); + + return true; +} + bool _bfd_elf_x86_size_relative_relocs (struct bfd_link_info *info, bool *need_layout) @@ -2267,6 +2452,42 @@ _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd, = htab->non_lazy_plt->eh_frame_plt_size; } + /* No need to size the .sframe section explicitly because the write-out + mechanism is different. Simply prep up the FDE/FRE for the + .plt section. */ + if (_bfd_elf_sframe_present (info)) + { + if (htab->plt_sframe != NULL + && htab->elf.splt != NULL + && htab->elf.splt->size != 0 + && !bfd_is_abs_section (htab->elf.splt->output_section)) + { + _bfd_x86_elf_create_sframe_plt (output_bfd, info, SFRAME_PLT); + /* FIXME - Dirty Hack. Set the size to something non-zero for now, + so that the section does not get stripped out below. The precise + size of this section is known only when the contents are + serialized in _bfd_x86_elf_write_sframe_plt. */ + htab->plt_sframe->size = sizeof (sframe_header) + 1; + } + + /* FIXME - generate for .got.plt ? */ + + /* Unwind info for the second PLT. */ + if (htab->plt_second_sframe != NULL + && htab->plt_second != NULL + && htab->plt_second->size != 0 + && !bfd_is_abs_section (htab->plt_second->output_section)) + { + _bfd_x86_elf_create_sframe_plt (output_bfd, info, + SFRAME_PLT_SEC); + /* FIXME - Dirty Hack. Set the size to something non-zero for now, + so that the section does not get stripped out below. The precise + size of this section is known only when the contents are + serialized in _bfd_x86_elf_write_sframe_plt. */ + htab->plt_second_sframe->size = sizeof (sframe_header) + 1; + } + } + /* We now have determined the sizes of the various dynamic sections. Allocate memory for them. */ relocs = false; @@ -2302,6 +2523,8 @@ _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd, || s == htab->plt_eh_frame || s == htab->plt_got_eh_frame || s == htab->plt_second_eh_frame + || s == htab->plt_sframe + || s == htab->plt_second_sframe || s == htab->elf.sdynbss || s == htab->elf.sdynrelro) { @@ -2344,6 +2567,11 @@ _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd, if ((s->flags & SEC_HAS_CONTENTS) == 0) continue; + /* Skip allocating contents for .sframe section as it is written + out differently. See below. */ + if ((s == htab->plt_sframe) || (s == htab->plt_second_sframe)) + continue; + /* NB: Initially, the iplt section has minimal alignment to avoid moving dot of the following section backwards when it is empty. Update its section alignment now since it @@ -2393,6 +2621,21 @@ _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd, + PLT_FDE_LEN_OFFSET)); } + if (_bfd_elf_sframe_present (info)) + { + if (htab->plt_sframe != NULL + && htab->elf.splt != NULL + && htab->elf.splt->size != 0 + && htab->plt_sframe->contents == NULL) + _bfd_x86_elf_write_sframe_plt (output_bfd, info, SFRAME_PLT); + + if (htab->plt_second_sframe != NULL + && htab->elf.splt != NULL + && htab->elf.splt->size != 0 + && htab->plt_second_sframe->contents == NULL) + _bfd_x86_elf_write_sframe_plt (output_bfd, info, SFRAME_PLT_SEC); + } + return _bfd_elf_maybe_vxworks_add_dynamic_tags (output_bfd, info, relocs); } @@ -2607,6 +2850,74 @@ _bfd_x86_elf_finish_dynamic_sections (bfd *output_bfd, } } + /* Make any adjustment if necessary and merge .sframe section to + create the final .sframe section for output_bfd. */ + if (htab->plt_sframe != NULL + && htab->plt_sframe->contents != NULL) + { + if (htab->elf.splt != NULL + && htab->elf.splt->size != 0 + && (htab->elf.splt->flags & SEC_EXCLUDE) == 0 + && htab->elf.splt->output_section != NULL + && htab->plt_sframe->output_section != NULL) + { + bfd_vma plt_start = htab->elf.splt->output_section->vma; + bfd_vma sframe_start = htab->plt_sframe->output_section->vma + + htab->plt_sframe->output_offset + + PLT_SFRAME_FDE_START_OFFSET; +#if 0 /* FIXME Testing only. Remove before review. */ + bfd_vma test_value = (plt_start - sframe_start) + + htab->plt_sframe->output_section->vma + + htab->plt_sframe->output_offset + + PLT_SFRAME_FDE_START_OFFSET; + bfd_put_signed_32 (dynobj, test_value, +#endif + bfd_put_signed_32 (dynobj, plt_start - sframe_start, + htab->plt_sframe->contents + + PLT_SFRAME_FDE_START_OFFSET); + } + if (htab->plt_sframe->sec_info_type == SEC_INFO_TYPE_SFRAME) + { + if (! _bfd_elf_merge_section_sframe (output_bfd, info, + htab->plt_sframe, + htab->plt_sframe->contents)) + return NULL; + } + } + + if (htab->plt_second_sframe != NULL + && htab->plt_second_sframe->contents != NULL) + { + if (htab->plt_second != NULL + && htab->plt_second->size != 0 + && (htab->plt_second->flags & SEC_EXCLUDE) == 0 + && htab->plt_second->output_section != NULL + && htab->plt_second_sframe->output_section != NULL) + { + bfd_vma plt_start = htab->plt_second->output_section->vma; + bfd_vma sframe_start + = (htab->plt_second_sframe->output_section->vma + + htab->plt_second_sframe->output_offset + + PLT_SFRAME_FDE_START_OFFSET); +#if 0 /* FIXME Testing only. Remove before review. */ + bfd_vma test_value = (plt_start - sframe_start) + + htab->plt_second_sframe->output_section->vma + + htab->plt_second_sframe->output_offset + + PLT_SFRAME_FDE_START_OFFSET; + bfd_put_signed_32 (dynobj, test_value, +#endif + bfd_put_signed_32 (dynobj, plt_start - sframe_start, + htab->plt_second_sframe->contents + + PLT_SFRAME_FDE_START_OFFSET); + } + if (htab->plt_second_sframe->sec_info_type == SEC_INFO_TYPE_SFRAME) + { + if (! _bfd_elf_merge_section_sframe (output_bfd, info, + htab->plt_second_sframe, + htab->plt_second_sframe->contents)) + return NULL; + } + } if (htab->elf.sgot && htab->elf.sgot->size > 0) elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize = htab->got_entry_size; @@ -3949,12 +4260,36 @@ _bfd_x86_elf_link_setup_gnu_properties pltsec = htab->elf.splt; - /* If the non-lazy PLT is available, use it for all PLT entries if - there are no PLT0 or no .plt section. */ if (htab->non_lazy_plt != NULL && (!htab->plt.has_plt0 || pltsec == NULL)) + lazy_plt = false; + else + lazy_plt = true; + + if (normal_target) + { + if (use_ibt_plt) + { + if (lazy_plt) + htab->sframe_plt = init_table->sframe_lazy_ibt_plt; + else + htab->sframe_plt = init_table->sframe_non_lazy_ibt_plt; + } + else + { + if (lazy_plt) + htab->sframe_plt = init_table->sframe_lazy_plt; + else + htab->sframe_plt = init_table->sframe_non_lazy_plt; + } + } + else + htab->sframe_plt = NULL; + + /* If the non-lazy PLT is available, use it for all PLT entries if + there are no PLT0 or no .plt section. */ + if (!lazy_plt) { - lazy_plt = false; if (bfd_link_pic (info)) htab->plt.plt_entry = htab->non_lazy_plt->pic_plt_entry; else @@ -3969,7 +4304,6 @@ _bfd_x86_elf_link_setup_gnu_properties } else { - lazy_plt = true; if (bfd_link_pic (info)) { htab->plt.plt0_entry = htab->lazy_plt->pic_plt0_entry; @@ -4145,6 +4479,39 @@ _bfd_x86_elf_link_setup_gnu_properties htab->plt_second_eh_frame = sec; } } + + /* .sframe sections are emitted for AMD64 ABI only. */ + if (ABI_64_P (info->output_bfd) && !info->no_ld_generated_unwind_info) + { + flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY + | SEC_HAS_CONTENTS | SEC_IN_MEMORY + | SEC_LINKER_CREATED); + + sec = bfd_make_section_anyway_with_flags (dynobj, + ".sframe", + flags); + if (sec == NULL) + info->callbacks->einfo (_("%F%P: failed to create PLT .sframe section\n")); + + // FIXME check this + // if (!bfd_set_section_alignment (sec, class_align)) + // goto error_alignment; + + htab->plt_sframe = sec; + + /* Second PLT is generated for Intel IBT / MPX Support + lazy plt. */ + if (htab->plt_second != NULL) + { + sec = bfd_make_section_anyway_with_flags (dynobj, + ".sframe", + flags); + if (sec == NULL) + info->callbacks->einfo (_("%F%P: failed to create second PLT .sframe section\n")); + + htab->plt_second_sframe = sec; + } + /* FIXME - add later for plt_got. */ + } } /* The .iplt section is used for IFUNC symbols in static diff --git a/bfd/elfxx-x86.h b/bfd/elfxx-x86.h index 7d23893938c..83f417acb0c 100644 --- a/bfd/elfxx-x86.h +++ b/bfd/elfxx-x86.h @@ -30,6 +30,7 @@ #include "elf-linker-x86.h" #include "elf/i386.h" #include "elf/x86-64.h" +#include "sframe-api.h" #define X86_64_PCREL_TYPE_P(TYPE) \ ((TYPE) == R_X86_64_PC8 \ @@ -105,6 +106,11 @@ || (TYPE) == R_X86_64_PC32_BND \ || (TYPE) == R_X86_64_PC64) +/* This must be the same as sframe_get_hdr_size (sfh). For x86-64, this value + is the same as sizeof (sframe_header) because there is no SFrame auxilliary + header. */ +#define PLT_SFRAME_FDE_START_OFFSET sizeof (sframe_header) + #define ABI_64_P(abfd) \ (get_elf_backend_data (abfd)->s->elfclass == ELFCLASS64) @@ -388,6 +394,24 @@ struct elf_x86_link_hash_entry bfd_vma tlsdesc_got; }; +#define SFRAME_PLT0_MAX_NUM_FRES 2 +#define SFRAME_PLTN_MAX_NUM_FRES 2 + +struct elf_x86_sframe_plt +{ + unsigned int plt0_entry_size; + unsigned int plt0_num_fres; + const sframe_frame_row_entry *plt0_fres[SFRAME_PLT0_MAX_NUM_FRES]; + + unsigned int pltn_entry_size; + unsigned int pltn_num_fres; + const sframe_frame_row_entry *pltn_fres[SFRAME_PLTN_MAX_NUM_FRES]; + + unsigned int sec_pltn_entry_size; + unsigned int sec_pltn_num_fres; + const sframe_frame_row_entry *sec_pltn_fres[SFRAME_PLTN_MAX_NUM_FRES]; +}; + struct elf_x86_lazy_plt_layout { /* The first entry in a lazy procedure linkage table looks like this. */ @@ -584,6 +608,11 @@ struct elf_x86_link_hash_table asection *plt_got; asection *plt_got_eh_frame; + sframe_encoder_ctx *plt_cfe_ctx; + asection *plt_sframe; + sframe_encoder_ctx *plt_second_cfe_ctx; + asection *plt_second_sframe; + /* Parameters describing PLT generation, lazy or non-lazy. */ struct elf_x86_plt_layout plt; @@ -593,6 +622,10 @@ struct elf_x86_link_hash_table /* Parameters describing non-lazy PLT generation. */ const struct elf_x86_non_lazy_plt_layout *non_lazy_plt; + /* The .sframe helper object for .plt section. + This is used for x86-64 only. */ + const struct elf_x86_sframe_plt *sframe_plt; + union { bfd_signed_vma refcount; @@ -682,6 +715,22 @@ struct elf_x86_init_table /* The non-lazy PLT layout for IBT. */ const struct elf_x86_non_lazy_plt_layout *non_lazy_ibt_plt; + /* The .sframe helper object for lazy .plt section. + This is used for x86-64 only. */ + const struct elf_x86_sframe_plt *sframe_lazy_plt; + + /* The .sframe helper object for non-lazy .plt section. + This is used for x86-64 only. */ + const struct elf_x86_sframe_plt *sframe_non_lazy_plt; + + /* The .sframe helper object for lazy IBT .plt section. + This is used for x86-64 only. */ + const struct elf_x86_sframe_plt *sframe_lazy_ibt_plt; + + /* The .sframe helper object for non-lazy IBT .plt section. + This is used for x86-64 only. */ + const struct elf_x86_sframe_plt *sframe_non_lazy_ibt_plt; + bfd_byte plt0_pad_byte; bfd_vma (*r_info) (bfd_vma, bfd_vma); diff --git a/bfd/section.c b/bfd/section.c index 614570e976e..ba8904d228e 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -409,6 +409,7 @@ CODE_FRAGMENT .#define SEC_INFO_TYPE_JUST_SYMS 4 .#define SEC_INFO_TYPE_TARGET 5 .#define SEC_INFO_TYPE_EH_FRAME_ENTRY 6 +.#define SEC_INFO_TYPE_SFRAME 7 . . {* Nonzero if this section uses RELA relocations, rather than REL. *} . unsigned int use_rela_p:1; diff --git a/binutils/readelf.c b/binutils/readelf.c index 4d8e540b39b..e52060dbf91 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -4604,6 +4604,7 @@ get_segment_type (Filedata * filedata, unsigned long p_type) case PT_GNU_STACK: return "GNU_STACK"; case PT_GNU_RELRO: return "GNU_RELRO"; case PT_GNU_PROPERTY: return "GNU_PROPERTY"; + case PT_GNU_SFRAME: return "GNU_SFRAME"; case PT_OPENBSD_RANDOMIZE: return "OPENBSD_RANDOMIZE"; case PT_OPENBSD_WXNEEDED: return "OPENBSD_WXNEEDED"; diff --git a/include/elf/common.h b/include/elf/common.h index 287526d74ed..16587f6fb06 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -489,6 +489,7 @@ #define PT_GNU_STACK (PT_LOOS + 0x474e551) /* Stack flags */ #define PT_GNU_RELRO (PT_LOOS + 0x474e552) /* Read-only after relocation */ #define PT_GNU_PROPERTY (PT_LOOS + 0x474e553) /* GNU property */ +#define PT_GNU_SFRAME (PT_LOOS + 0x474e554) /* SFrame unwind information */ /* OpenBSD segment types. */ #define PT_OPENBSD_RANDOMIZE (PT_LOOS + 0x5a3dbe6) /* Fill with random data. */ diff --git a/include/elf/internal.h b/include/elf/internal.h index 8affb3d9b2e..de9f67809b3 100644 --- a/include/elf/internal.h +++ b/include/elf/internal.h @@ -339,6 +339,7 @@ struct elf_segment_map || (segment)->p_type == PT_GNU_EH_FRAME \ || (segment)->p_type == PT_GNU_STACK \ || (segment)->p_type == PT_GNU_RELRO \ + || (segment)->p_type == PT_GNU_SFRAME \ || ((segment)->p_type >= PT_GNU_MBIND_LO \ && (segment)->p_type <= PT_GNU_MBIND_HI))) \ /* Any section besides one of type SHT_NOBITS must have file \ diff --git a/include/sframe-api.h b/include/sframe-api.h index ededf703320..0fbed017ecd 100644 --- a/include/sframe-api.h +++ b/include/sframe-api.h @@ -187,7 +187,7 @@ sframe_encode (unsigned char ver, unsigned char flags, int abi, /* Free the encoder context. */ extern void -sframe_free_encoder (sframe_encoder_ctx *encoder); +sframe_encoder_free (sframe_encoder_ctx **encoder); /* Get the size of the SFrame header from the encoder ctx ENCODER. */ extern unsigned int diff --git a/ld/Makefile.am b/ld/Makefile.am index 66e9094e86a..65fef4e1690 100644 --- a/ld/Makefile.am +++ b/ld/Makefile.am @@ -972,6 +972,7 @@ EXTRA_ld_new_SOURCES += $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES) # This is the real libbfd.a and libctf.a created by libtool. TESTBFDLIB = @TESTBFDLIB@ TESTCTFLIB = @TESTCTFLIB@ +TESTSFRAMELIB = @TESTSFRAMELIB@ check-DEJAGNU: site.exp (cd .libs; test -e ldscripts || test ! -e ld-new || $(LN_S) ../ldscripts .) @@ -989,6 +990,7 @@ check-DEJAGNU: site.exp CXX_FOR_TARGET="$(CXX_FOR_TARGET)" \ CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ OFILES="$(OFILES)" BFDLIB="$(TESTBFDLIB)" CTFLIB="$(TESTCTFLIB) $(ZLIB)" \ + SFRAMELIB="$(TESTSFRAMELIB)" \ LIBIBERTY="$(LIBIBERTY) $(LIBINTL)" LIBS="$(LIBS)" \ DO_COMPARE="`echo '$(do_compare)' | sed -e 's,\\$$,,g'`" \ $(RUNTESTFLAGS); \ diff --git a/ld/Makefile.in b/ld/Makefile.in index 5e4787f89b4..ff4c916c27b 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -470,6 +470,7 @@ TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@ # This is the real libbfd.a and libctf.a created by libtool. TESTBFDLIB = @TESTBFDLIB@ TESTCTFLIB = @TESTCTFLIB@ +TESTSFRAMELIB = @TESTSFRAMELIB@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ @@ -2642,6 +2643,7 @@ check-DEJAGNU: site.exp CXX_FOR_TARGET="$(CXX_FOR_TARGET)" \ CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ OFILES="$(OFILES)" BFDLIB="$(TESTBFDLIB)" CTFLIB="$(TESTCTFLIB) $(ZLIB)" \ + SFRAMELIB="$(TESTSFRAMELIB)" \ LIBIBERTY="$(LIBIBERTY) $(LIBINTL)" LIBS="$(LIBS)" \ DO_COMPARE="`echo '$(do_compare)' | sed -e 's,\\$$,,g'`" \ $(RUNTESTFLAGS); \ diff --git a/ld/configure b/ld/configure index 7906f52aadf..f759a76555a 100755 --- a/ld/configure +++ b/ld/configure @@ -634,6 +634,7 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +TESTSFRAMELIB TESTCTFLIB TESTBFDLIB EMULATION_LIBPATH @@ -11624,7 +11625,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11627 "configure" +#line 11628 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11730,7 +11731,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11733 "configure" +#line 11734 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -17487,9 +17488,11 @@ EMULATION_LIBPATH=$all_libpath if test x${enable_static} = xno; then TESTBFDLIB="-Wl,--rpath,../bfd/.libs ../bfd/.libs/libbfd.so" TESTCTFLIB="-Wl,--rpath,../libctf/.libs ../libctf/.libs/libctf.so" + TESTSFRAMELIB="-Wl,--rpath,../libsframe/.libs ../libsframe/.libs/libsframe.so" else TESTBFDLIB="../bfd/.libs/libbfd.a" TESTCTFLIB="../libctf/.libs/libctf.a" + TESTSFRAMELIB="../libsframe/.libs/libsframe.a" fi if test "${enable_libctf}" = no; then TESTCTFLIB= @@ -17497,6 +17500,7 @@ fi + target_vendor=${target_vendor=$host_vendor} case "$target_vendor" in hp) EXTRA_SHLIB_EXTENSION=".sl" ;; diff --git a/ld/configure.ac b/ld/configure.ac index 6123ea78611..1ee40a51b08 100644 --- a/ld/configure.ac +++ b/ld/configure.ac @@ -628,15 +628,18 @@ AC_SUBST(EMULATION_LIBPATH) if test x${enable_static} = xno; then TESTBFDLIB="-Wl,--rpath,../bfd/.libs ../bfd/.libs/libbfd.so" TESTCTFLIB="-Wl,--rpath,../libctf/.libs ../libctf/.libs/libctf.so" + TESTSFRAMELIB="-Wl,--rpath,../libsframe/.libs ../libsframe/.libs/libsframe.so" else TESTBFDLIB="../bfd/.libs/libbfd.a" TESTCTFLIB="../libctf/.libs/libctf.a" + TESTSFRAMELIB="../libsframe/.libs/libsframe.a" fi if test "${enable_libctf}" = no; then TESTCTFLIB= fi AC_SUBST(TESTBFDLIB) AC_SUBST(TESTCTFLIB) +AC_SUBST(TESTSFRAMELIB) target_vendor=${target_vendor=$host_vendor} case "$target_vendor" in diff --git a/ld/ld.texi b/ld/ld.texi index 82527e3652c..3836465730c 100644 --- a/ld/ld.texi +++ b/ld/ld.texi @@ -2837,7 +2837,9 @@ section and ELF @code{PT_GNU_EH_FRAME} segment header. @item --no-ld-generated-unwind-info Request creation of @code{.eh_frame} unwind info for linker generated code sections like PLT. This option is on by default -if linker generated unwind info is supported. +if linker generated unwind info is supported. This option also +controls the generation of @code{.sframe} unwind info for linker +generated code sections like PLT. @kindex --enable-new-dtags @kindex --disable-new-dtags diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc index bf2268bb0ad..5cc364b0c2a 100644 --- a/ld/scripttempl/elf.sc +++ b/ld/scripttempl/elf.sc @@ -601,6 +601,7 @@ cat <sfe_funcdesc); - free (encoder->sfe_fres); - free (encoder->sfe_data); - free (encoder); + sframe_encoder_ctx *ectx = *encoder; + if (ectx == NULL) + return; + + if (ectx->sfe_funcdesc != NULL) + { + free (ectx->sfe_funcdesc); + ectx->sfe_funcdesc = NULL; + } + if (ectx->sfe_fres != NULL) + { + free (ectx->sfe_fres); + ectx->sfe_fres = NULL; + } + if (ectx->sfe_data != NULL) + { + free (ectx->sfe_data); + ectx->sfe_data = NULL; + } + + free (*encoder); + *encoder = NULL; } } From patchwork Sun Oct 30 07:44:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 12961 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1687915wru; Sun, 30 Oct 2022 00:54:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6bzpkavkQ6fZEBoqEJlDZ5KYe5RN7nTgHtz/J2j/2dNyuMtIgISCOdNvYOlUA2KNB7fncK X-Received: by 2002:a05:6402:294f:b0:461:f5ce:31e8 with SMTP id ed15-20020a056402294f00b00461f5ce31e8mr7588833edb.363.1667116447316; Sun, 30 Oct 2022 00:54:07 -0700 (PDT) Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id hr7-20020a1709073f8700b007ad943d0608si4399418ejc.630.2022.10.30.00.54.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 00:54:07 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=BG3lghsD; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8C172382C151 for ; Sun, 30 Oct 2022 07:50:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8C172382C151 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667116230; bh=ZgYV/udassi/Z9xDhKDYkUfYwMP3ofg8ReoVf5dP+Aw=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=BG3lghsD0mGWO5SMK5tC3X6wyaDRlL/HSTtpOZBJBJYtjgED2FAgbqoJ3jIVfSuna 0WfEauWNS5OcS1RtXiGBZwYMl3w6u+t1zH9t8PN36JEt8qNGdUqNxKh4lRHThhdYzc 8XzKojfISFrn0PsIixzeVDWIqKeyG5F/+TLzhpjU= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 6F8D23858424 for ; Sun, 30 Oct 2022 07:45:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6F8D23858424 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29U3bJ8M023053 for ; Sun, 30 Oct 2022 07:45:47 GMT Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgtkd1daj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:45:46 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 29U6S3r2029354 for ; Sun, 30 Oct 2022 07:45:45 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2172.outbound.protection.outlook.com [104.47.59.172]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kgtm28s7y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:45:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G9uQlPPuST1yNVeA4ht6KvxoBu/FYGp0IScKJYHcff5LVNvSTClmnpGPs5ynkL8vu4UZG69OsyyZxiDGNREGtzpfzewBNaiLH//JOcLObbiNMJ2VLzMeei1F7F4LO5nxlvc9+IeBfErG5p8gjyUfcjVHcQTLIebOdovygE2wSKoLrBFwUJRqnnsHcORa3Q8jHPDRUzx5XHREPTFi4dseQ41+FnBN/daZV9vkfGyT7UvOECZcBwpp1Lapos4/3jPGLUMWwkbu1FiDVzzOrNep9FUmfOc1LX7a+VjhvuNxPNvpd91cU3d21gHRzMKUiZI5DsMAOTt4NkKkAIXMGTnE5g== 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=ZgYV/udassi/Z9xDhKDYkUfYwMP3ofg8ReoVf5dP+Aw=; b=bsdfld4SN81R3knjfWfnjtlRn9MA/NgFOHavJvCotv/aqu4sqlNf5H+UtcVTUh6EiFliVxFhRp3r1eX2r2VbL434M5MO2MDaEy5/4OgwATuYVpo/9fl1PstKtXhXQei42t2oCp4ZaMRQZrgb7cO2wf3mErc29oDWsuP9fOrxPEohM7Hc0mEWKXF78RoFSRxul1BuQzTFiPDrzuYkU7g6AWA1kmri2dqrZwOqJK3AeEeuoMjkM7pUg0yOsBAOQ7pSbBWMmDILhOm801Ej9CvWrha8fQN8UBoe6J3smcX0+vTEyjHVPGBTA/GYi1pJ0yIuw1fqvMXFbfWnjbcr8a8PwQ== 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 MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by BY5PR10MB4289.namprd10.prod.outlook.com (2603:10b6:a03:20c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.19; Sun, 30 Oct 2022 07:45:38 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2%7]) with mapi id 15.20.5723.033; Sun, 30 Oct 2022 07:45:38 +0000 To: binutils@sourceware.org Subject: [PATCH,V3 07/15] readelf/objdump: support for SFrame section Date: Sun, 30 Oct 2022 00:44:42 -0700 Message-Id: <20221030074450.1956074-8-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221030074450.1956074-1-indu.bhagat@oracle.com> References: <20221030074450.1956074-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR03CA0098.namprd03.prod.outlook.com (2603:10b6:303:b7::13) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|BY5PR10MB4289:EE_ X-MS-Office365-Filtering-Correlation-Id: f2f6902a-b217-4e2a-272a-08daba4abc85 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bZe78szAECyOWujgDHF4bT5HuECdvceuEYWxFe5SGnyFkgQI7CH7gAT2PutfPOStzKyFMs3HXnG2Rg8gvyDVZmN9F2ejDg5aqG04tsjjSShyTYNpWok0O47DRFT2eK7wgr+gEywZLN+7I77MFQPCay4wqi0Es+IsMFk5PizmqF2vXyPq3zAD2NOG/6YpVKLM9J/t+O57VaEe0GXV+sdB/vTj9krii3q19zfZz/aPz4cAYsmUzGPEC4Jz7IGZaNmqEOtqaiFTMKOmQROzdAOyi4qWyYELQi7jWHL0/KO8BeZW1X7fjGVszImUK2ArjeR3MsT4ENmJhIMVkjmmEpbnYKwo6eopubZbAzYzyL/lwcf7m23jTNcm/+zFFD/jFz7auGjDp7p2YKugAJjy/giDUqGFRknyhiMvsQka50qlwGyV5DFl4xHptCWb8BOZYLmc06zo92LQNMgKugd0J6PNvwPOUvM15N87saCqVbicaWCGSOOU1Hb7mSGOErJZw7qMbSEy3FpOPqKZ2IiSVKTzu/UcKj2Qd/f9k7HYrEm5AKVrDh6SovV6jl9gJ8bog0DSn/0uHXE8aZ+K+K/uwozAZUCjS1vk7xP8EbF/iBKLnCThFFmbcbirBephgszFOguYy7iHgS1JTgmlIme84jpnQG/UBjmSr4nUoOhOhfnm7oadOIKGnFzYOiCbwO4tzp6hkgQFi+kZqjkjZNYw7+lSqDYVy1rIoHF7foyjGNte5g507Vd5E5KkNQBEpOzJ3Vw6v4L0a5tAYEMRNLz/RNk9kdw+zPssIDeQWOa2pmEc15w= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2158.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(366004)(39850400004)(376002)(346002)(136003)(451199015)(316002)(66556008)(4326008)(66476007)(36756003)(6916009)(66946007)(30864003)(6486002)(38100700002)(6666004)(8936002)(41300700001)(86362001)(107886003)(478600001)(5660300002)(1076003)(186003)(83380400001)(8676002)(2616005)(44832011)(2906002)(6512007)(6506007)(2004002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5tpUXYjBiv38yLQ8T3zdghqkOraYai4zbjNSuGjNtrgfNSVVpQe9bn310VWBWPzc9gQHzkuT/SSgYstWIF3RAaC/ndMKq2JcOr1UbZoT4h3fslsBA/10uGNDHKWT+GDDA+qCRsnwnAPYfLsfET2sJ7WI4naJEXqMPJI9MqRh9BJ8hXsOtY+2qIbK3agqofxlXPmwiO8zPuvlgChIiIV1gx/cbZE1hoAGBI3Tjgh3b1QOii1QiiMdfC3IVOcDSbrJ9qwXNgQHQVeBcUyUJKsCUlf6ZpJitd+TYSUCGgPBqUZR4Qa3BLFIf/cOSTN0GKCUzMgJYnaNzqLwjIMiTRSn1UgV70qfvpfRbn8GhYE+LAKJGU3qTK1EVD8L3DSfXcoQFSPG98XIyCah5CLK/gTjYGep+YIXDvpxCgSTQGZdL9V3VmdrYQJm3b2+1DFE7ndMlY8LV1iqZUPnYLzvmy08DYej3AhDYl6M+APhQQLerX67rbWCljyiE/xxgvm2q1PAaMldeO+6S7yrLIS2MPRgFkGjqPXo0bgWy+hSdc/77JQWRXVDv/3ecBZi/b9dWIO4qwVCynV0NxZxSh7CMQXU/Hg+tCytptwkTKFBQKGwsKk9X9Fy7sfluDyDJaeDURd8WFfbjQwX/mECxv/r1JguZXR/jfKZwex1oEteN/zB8UMf1bK6uSJ0v99lq+YgqPN9/MkD2uhrJZWqERVqp5Qe6GqZZoTv7qQWQmsggguvCdztoYEnRttT284PWvFVhCdM6i+40bSCcMgqiXZ0OEOfPm7oDvipWv/WswuJcVnV1IRnOkGilO6p7gOPSw6/n/XxracFOMGEnGFzzX3fS4rp0yKhIPjvWIUzzb5BRPqf8fG+HKC66wdh67NPgUMameuwC/CZSiO4GVX7tYDkZrTd/rwD35Z9NlDg6zdK+4jIaHiZJyispVU1UaRrzlW6RAqbms0KlfDSTR4Wk5S6iEZPD8ROx2n9YqvMzAqlBNWuyBnH+OnLtDAHU+0S0jX4JSK68ws+pRkwMZVcCb8T16oEXrpfYeP5HIHGipoFNHhifuqWC4Un/bzgTfKckpKlb4P2nYRS+PzDJypZPbXy5Rczf+rMe24LrpocDd6FSPHDPtsag2Nxjof0HVpbrjxvokCDsm2TEWBlE5cEV9DRJaI7JPkvjlNlIYuAO6T0LAPhuvO+OZwdu2ZS2Pi6uqr++qn37F8D4OTBnZMAMS/u6pEcDQk9PaFdwjZ7H5c7Z7QiEe5+lcIdSMO7ZsyvpL8akOZjRdWtlzMv17efXZ9wxUUs946MvqSGmdHEFilHJLrAqRwEPMZdXtk7baNpoLJU7JNzbk5ypdjohtBP0frNEaUfSgQuXRBW7S5MWymjDnZsTJqnM+XXLH6uH9zyHW1VUiCwflpxYuEB5lzEEVFHW+0/spdfrBIOpHRIIaGQFNCVuZI8TxU2uwYf4lCy6bgB0QpQ5owqNeJbmah2G/mRNfjc5y/FUjmkCDoQ4hRrWlA2KJSLzSzWyej0iGDgzSqkOUwzZecAVNVCvXXvMz/XQxtqqdPdWiFROXM9Fc3aVqn680NxmTk9EASFnp8b/JtcsQFL8jIHV3yhj9q/HdGBpc0aVbELtFTgQrBm78YFFcl0m9E= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2f6902a-b217-4e2a-272a-08daba4abc85 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2022 07:45:38.0941 (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: nhENaaSPo5Uk43rSNBQsw75kaX7f1aIftZaQG2xcbzLPWCGc9OvHlnoq59I+AdguQKNHS4eOR42scrzcXjtdEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4289 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-30_02,2022-10-27_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 bulkscore=0 suspectscore=0 phishscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2210300049 X-Proofpoint-ORIG-GUID: YZgg8jTZMAc6h_P4Ib0AX8prGVTJIfwx X-Proofpoint-GUID: YZgg8jTZMAc6h_P4Ib0AX8prGVTJIfwx X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, KAM_STOCKGEN, 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Indu Bhagat via Binutils From: Indu Bhagat Reply-To: Indu Bhagat Cc: Indu Bhagat Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748098296023131181?= X-GMAIL-MSGID: =?utf-8?q?1748098296023131181?= [Changes in V3] - Minor changes to uptake API signature changes in libsframe. - Fixed -Wformat warnings in dump_sframe_func_with_fres (). [End of changes in V3] [Changes in V2] - Fixed compilation errors seen on i686. - readelf: bugfix: --sframe=.eh_frame gives no error New behaviour: $ readelf --sframe=.eh_frame readelf: Error: SFrame decode failure: Buffer does not contain SFrame data. $ readelf --sframe=.foo readelf: Warning: Section '.foo' was not dumped because it does not exist - readelf: make --sframe arguments optional (similar to the command line option for objdump) [End of changes in V2] This patch adds support for SFrame in readelf and objdump. include/ChangeLog: * sframe-api.h (dump_sframe): New function declaration. ChangeLog: * binutils/Makefile.am: Add dependency on libsframe for readelf and objdump. * binutils/Makefile.in: Regenerate. * binutils/doc/binutils.texi: Document --sframe=[section]. * binutils/doc/sframe.options.texi: New file. * binutils/objdump.c: Add support for SFrame format. * binutils/readelf.c: Likewise. * include/sframe-api.h: Add new API for dumping .sframe section. * libsframe/Makefile.am: Add sframe-dump.c. * libsframe/Makefile.in: Regenerate. * libsframe/sframe-dump.c: New file. --- binutils/Makefile.am | 8 +- binutils/Makefile.in | 8 +- binutils/doc/binutils.texi | 4 + binutils/doc/sframe.options.texi | 10 ++ binutils/objdump.c | 75 +++++++++++++ binutils/readelf.c | 63 +++++++++++ include/sframe-api.h | 3 + libsframe/Makefile.am | 2 +- libsframe/Makefile.in | 12 +- libsframe/sframe-dump.c | 181 +++++++++++++++++++++++++++++++ 10 files changed, 355 insertions(+), 11 deletions(-) create mode 100644 binutils/doc/sframe.options.texi create mode 100644 libsframe/sframe-dump.c diff --git a/binutils/Makefile.am b/binutils/Makefile.am index 6d974fd3f8a..ce5fa1d39bb 100644 --- a/binutils/Makefile.am +++ b/binutils/Makefile.am @@ -228,7 +228,7 @@ installcheck-local: # which depends on libintl, since we don't know whether LIBINTL_DEP will be # non-empty until configure time. Ugh! size_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB) -objdump_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB) $(OPCODES) $(LIBCTF) $(OBJDUMP_PRIVATE_OFILES) +objdump_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB) $(OPCODES) $(LIBCTF) $(OBJDUMP_PRIVATE_OFILES) $(LIBSFRAME) nm_new_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB) ar_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB) strings_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB) @@ -243,7 +243,7 @@ dlltool_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB) windres_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB) windmc_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB) addr2line_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB) -readelf_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(LIBCTF_NOBFD) +readelf_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(LIBCTF_NOBFD) $(LIBSFRAME) elfedit_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) dllwrap_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) bfdtest1_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB) @@ -258,7 +258,7 @@ objcopy_SOURCES = objcopy.c not-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS) strings_SOURCES = strings.c $(BULIBS) readelf_SOURCES = readelf.c version.c unwind-ia64.c dwarf.c demanguse.c $(ELFLIBS) -readelf_LDADD = $(LIBCTF_NOBFD) $(LIBINTL) $(LIBIBERTY) $(ZLIB) $(ZSTD_LIBS) $(DEBUGINFOD_LIBS) $(MSGPACK_LIBS) +readelf_LDADD = $(LIBCTF_NOBFD) $(LIBINTL) $(LIBIBERTY) $(ZLIB) $(ZSTD_LIBS) $(DEBUGINFOD_LIBS) $(MSGPACK_LIBS) $(LIBSFRAME) elfedit_SOURCES = elfedit.c version.c $(ELFLIBS) elfedit_LDADD = $(LIBINTL) $(LIBIBERTY) @@ -269,7 +269,7 @@ nm_new_SOURCES = nm.c demanguse.c $(BULIBS) objdump_SOURCES = objdump.c dwarf.c prdbg.c demanguse.c $(DEBUG_SRCS) $(BULIBS) $(ELFLIBS) EXTRA_objdump_SOURCES = od-xcoff.c -objdump_LDADD = $(OBJDUMP_PRIVATE_OFILES) $(OPCODES) $(LIBCTF) $(BFDLIB) $(LIBIBERTY) $(LIBINTL) $(DEBUGINFOD_LIBS) +objdump_LDADD = $(OBJDUMP_PRIVATE_OFILES) $(OPCODES) $(LIBCTF) $(BFDLIB) $(LIBIBERTY) $(LIBINTL) $(DEBUGINFOD_LIBS) $(LIBSFRAME) objdump.@OBJEXT@:objdump.c if am__fastdepCC diff --git a/binutils/Makefile.in b/binutils/Makefile.in index 05aca3d3965..30b78a961dd 100644 --- a/binutils/Makefile.in +++ b/binutils/Makefile.in @@ -766,7 +766,7 @@ CC_FOR_TARGET = ` \ # which depends on libintl, since we don't know whether LIBINTL_DEP will be # non-empty until configure time. Ugh! size_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB) -objdump_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB) $(OPCODES) $(LIBCTF) $(OBJDUMP_PRIVATE_OFILES) +objdump_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB) $(OPCODES) $(LIBCTF) $(OBJDUMP_PRIVATE_OFILES) $(LIBSFRAME) nm_new_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB) ar_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB) strings_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB) @@ -781,7 +781,7 @@ dlltool_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB) windres_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB) windmc_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB) addr2line_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB) -readelf_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(LIBCTF_NOBFD) +readelf_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(LIBCTF_NOBFD) $(LIBSFRAME) elfedit_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) dllwrap_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) bfdtest1_DEPENDENCIES = $(LIBINTL_DEP) $(LIBIBERTY) $(BFDLIB) @@ -791,14 +791,14 @@ size_SOURCES = size.c $(BULIBS) objcopy_SOURCES = objcopy.c not-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS) strings_SOURCES = strings.c $(BULIBS) readelf_SOURCES = readelf.c version.c unwind-ia64.c dwarf.c demanguse.c $(ELFLIBS) -readelf_LDADD = $(LIBCTF_NOBFD) $(LIBINTL) $(LIBIBERTY) $(ZLIB) $(ZSTD_LIBS) $(DEBUGINFOD_LIBS) $(MSGPACK_LIBS) +readelf_LDADD = $(LIBCTF_NOBFD) $(LIBINTL) $(LIBIBERTY) $(ZLIB) $(ZSTD_LIBS) $(DEBUGINFOD_LIBS) $(MSGPACK_LIBS) $(LIBSFRAME) elfedit_SOURCES = elfedit.c version.c $(ELFLIBS) elfedit_LDADD = $(LIBINTL) $(LIBIBERTY) strip_new_SOURCES = objcopy.c is-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS) nm_new_SOURCES = nm.c demanguse.c $(BULIBS) objdump_SOURCES = objdump.c dwarf.c prdbg.c demanguse.c $(DEBUG_SRCS) $(BULIBS) $(ELFLIBS) EXTRA_objdump_SOURCES = od-xcoff.c -objdump_LDADD = $(OBJDUMP_PRIVATE_OFILES) $(OPCODES) $(LIBCTF) $(BFDLIB) $(LIBIBERTY) $(LIBINTL) $(DEBUGINFOD_LIBS) +objdump_LDADD = $(OBJDUMP_PRIVATE_OFILES) $(OPCODES) $(LIBCTF) $(BFDLIB) $(LIBIBERTY) $(LIBINTL) $(DEBUGINFOD_LIBS) $(LIBSFRAME) cxxfilt_SOURCES = cxxfilt.c $(BULIBS) ar_SOURCES = arparse.y arlex.l ar.c not-ranlib.c arsup.c rename.c binemul.c \ emul_$(EMULATION).c $(BULIBS) diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi index 6eea08fb91b..0f3860abaaa 100644 --- a/binutils/doc/binutils.texi +++ b/binutils/doc/binutils.texi @@ -2262,6 +2262,7 @@ objdump [@option{-a}|@option{--archive-headers}] [@option{-wE}|@option{--dwarf=do-not-use-debuginfod}] [@option{-L}|@option{--process-links}] [@option{--ctf=}@var{section}] + [@option{--sframe=}@var{section}] [@option{-G}|@option{--stabs}] [@option{-t}|@option{--syms}] [@option{-T}|@option{--dynamic-syms}] @@ -2843,6 +2844,8 @@ Enable additional checks for consistency of Dwarf information. @include ctf.options.texi +@include sframe.options.texi + @item -G @itemx --stabs @cindex stab @@ -4940,6 +4943,7 @@ readelf [@option{-a}|@option{--all}] [@option{--ctf-parent=}@var{section}] [@option{--ctf-symbols=}@var{section}] [@option{--ctf-strings=}@var{section}] + [@option{--sframe=}@var{section}] [@option{-I}|@option{--histogram}] [@option{-v}|@option{--version}] [@option{-W}|@option{--wide}] diff --git a/binutils/doc/sframe.options.texi b/binutils/doc/sframe.options.texi new file mode 100644 index 00000000000..9e23679a3da --- /dev/null +++ b/binutils/doc/sframe.options.texi @@ -0,0 +1,10 @@ +@c This file contains the entry for the --sframe option that is +@c common to both readelf and objdump. + +@item --sframe[=@var{section}] +@cindex SFrame + +Display the contents of the specified SFrame section. + +By default, display the name of the section named @var{.sframe}, which is the +name emitted by @command{ld}. diff --git a/binutils/objdump.c b/binutils/objdump.c index 0825e051ef6..dac5d73009f 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -58,6 +58,7 @@ #include "demanguse.h" #include "dwarf.h" #include "ctf-api.h" +#include "sframe-api.h" #include "getopt.h" #include "safe-ctype.h" #include "dis-asm.h" @@ -108,6 +109,8 @@ static int dump_stab_section_info; /* --stabs */ static int dump_ctf_section_info; /* --ctf */ static char *dump_ctf_section_name; static char *dump_ctf_parent_name; /* --ctf-parent */ +static int dump_sframe_section_info; /* --sframe */ +static char *dump_sframe_section_name; static int do_demangle; /* -C, --demangle */ static bool disassemble; /* -d */ static bool disassemble_all; /* -D */ @@ -316,6 +319,8 @@ usage (FILE *stream, int status) fprintf (stream, _("\ --ctf[=SECTION] Display CTF info from SECTION, (default `.ctf')\n")); #endif + fprintf (stream, _("\ + --sframe[=SECTION] Display SFrame info from SECTION, (default '.sframe')\n")); fprintf (stream, _("\ -t, --syms Display the contents of the symbol table(s)\n")); fprintf (stream, _("\ @@ -462,6 +467,7 @@ enum option_values OPTION_CTF, OPTION_CTF_PARENT, #endif + OPTION_SFRAME, OPTION_VISUALIZE_JUMPS, OPTION_DISASSEMBLER_COLOR }; @@ -516,6 +522,7 @@ static struct option long_options[]= {"reloc", no_argument, NULL, 'r'}, {"section", required_argument, NULL, 'j'}, {"section-headers", no_argument, NULL, 'h'}, + {"sframe", optional_argument, NULL, OPTION_SFRAME}, {"show-raw-insn", no_argument, &show_raw_insn, 1}, {"source", no_argument, NULL, 'S'}, {"source-comment", optional_argument, NULL, OPTION_SOURCE_COMMENT}, @@ -4801,6 +4808,66 @@ dump_ctf (bfd *abfd ATTRIBUTE_UNUSED, const char *sect_name ATTRIBUTE_UNUSED, const char *parent_name ATTRIBUTE_UNUSED) {} #endif +static bfd_byte* +read_section_sframe (bfd *abfd, const char *sect_name, bfd_size_type *size_ptr, + bfd_vma *sframe_vma) +{ + asection *sframe_sect; + bfd_byte *contents; + + sframe_sect = bfd_get_section_by_name (abfd, sect_name); + if (sframe_sect == NULL) + { + printf (_("No %s section present\n\n"), + sanitize_string (sect_name)); + return NULL; + } + + if (!bfd_malloc_and_get_section (abfd, sframe_sect, &contents)) + { + non_fatal (_("reading %s section of %s failed: %s"), + sect_name, bfd_get_filename (abfd), + bfd_errmsg (bfd_get_error ())); + exit_status = 1; + free (contents); + return NULL; + } + + *size_ptr = bfd_section_size (sframe_sect); + *sframe_vma = bfd_section_vma (sframe_sect); + + return contents; +} + +static void +dump_section_sframe (bfd *abfd ATTRIBUTE_UNUSED, + const char * sect_name) +{ + sframe_decoder_ctx *sfd_ctx = NULL; + bfd_size_type sf_size; + bfd_byte *sframe_data = NULL; + bfd_vma sf_vma; + int err = 0; + + if (sect_name == NULL) + sect_name = ".sframe"; + + sframe_data = read_section_sframe (abfd, sect_name, &sf_size, &sf_vma); + + if (sframe_data == NULL) + bfd_fatal (bfd_get_filename (abfd)); + + /* Decode the contents of the section. */ + sfd_ctx = sframe_decode ((const char*)sframe_data, sf_size, &err); + if (!sfd_ctx) + bfd_fatal (bfd_get_filename (abfd)); + + printf (_("Contents of the SFrame section %s:"), + sanitize_string (sect_name)); + /* Dump the contents as text. */ + dump_sframe (sfd_ctx, sf_vma); +} + static void dump_bfd_private_header (bfd *abfd) @@ -5554,6 +5621,8 @@ dump_bfd (bfd *abfd, bool is_mainfile) { if (dump_ctf_section_info) dump_ctf (abfd, dump_ctf_section_name, dump_ctf_parent_name); + if (dump_sframe_section_info) + dump_section_sframe (abfd, dump_sframe_section_name); if (dump_stab_section_info) dump_stabs (abfd); if (dump_reloc_info && ! disassemble) @@ -6051,6 +6120,12 @@ main (int argc, char **argv) dump_ctf_parent_name = xstrdup (optarg); break; #endif + case OPTION_SFRAME: + dump_sframe_section_info = true; + if (optarg) + dump_sframe_section_name = xstrdup (optarg); + seenflag = true; + break; case 'G': dump_stab_section_info = true; seenflag = true; diff --git a/binutils/readelf.c b/binutils/readelf.c index e52060dbf91..8cfa6cb0a5c 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -63,6 +63,7 @@ #include "demanguse.h" #include "dwarf.h" #include "ctf-api.h" +#include "sframe-api.h" #include "demangle.h" #include "elf/common.h" @@ -190,6 +191,7 @@ typedef struct elf_section_list #define STRING_DUMP (1 << 3) /* The -p command line switch. */ #define RELOC_DUMP (1 << 4) /* The -R command line switch. */ #define CTF_DUMP (1 << 5) /* The --ctf command line switch. */ +#define SFRAME_DUMP (1 << 6) /* The --sframe command line switch. */ typedef unsigned char dump_type; @@ -233,6 +235,7 @@ static bool do_version = false; static bool do_histogram = false; static bool do_debugging = false; static bool do_ctf = false; +static bool do_sframe = false; static bool do_arch = false; static bool do_notes = false; static bool do_archive_index = false; @@ -5071,6 +5074,7 @@ enum long_option_values OPTION_CTF_PARENT, OPTION_CTF_SYMBOLS, OPTION_CTF_STRINGS, + OPTION_SFRAME_DUMP, OPTION_WITH_SYMBOL_VERSIONS, OPTION_RECURSE_LIMIT, OPTION_NO_RECURSE_LIMIT, @@ -5133,6 +5137,7 @@ static struct option options[] = {"ctf-strings", required_argument, 0, OPTION_CTF_STRINGS}, {"ctf-parent", required_argument, 0, OPTION_CTF_PARENT}, #endif + {"sframe", optional_argument, 0, OPTION_SFRAME_DUMP}, {"sym-base", optional_argument, 0, OPTION_SYM_BASE}, {0, no_argument, 0, 0} @@ -5273,6 +5278,8 @@ usage (FILE * stream) --ctf-strings=\n\ Use section as the CTF external strtab\n")); #endif + fprintf (stream, _("\ + --sframe[=NAME] Display SFrame info from section NAME, (default '.sframe')\n")); #ifdef SUPPORT_DISASSEMBLY fprintf (stream, _("\ @@ -5546,6 +5553,19 @@ parse_args (struct dump_data *dumpdata, int argc, char ** argv) free (dump_ctf_parent_name); dump_ctf_parent_name = strdup (optarg); break; + case OPTION_SFRAME_DUMP: + do_sframe = true; + /* Providing section name is optional. request_dump (), however, + thrives on non NULL optarg. Handle it explicitly here. */ + if (optarg != NULL) + request_dump (dumpdata, SFRAME_DUMP); + else + { + do_dump = true; + const char *sframe_sec_name = strdup (".sframe"); + request_dump_byname (sframe_sec_name, SFRAME_DUMP); + } + break; case OPTION_DYN_SYMS: do_dyn_syms = true; break; @@ -15857,6 +15877,44 @@ dump_section_as_ctf (Elf_Internal_Shdr * section, Filedata * filedata) } #endif +static bool +dump_section_as_sframe (Elf_Internal_Shdr * section, Filedata * filedata) +{ + void * data = NULL; + sframe_decoder_ctx *sfd_ctx = NULL; + const char *print_name = printable_section_name (filedata, section); + + bool ret = true; + size_t sf_size; + int err = 0; + + if (strcmp (print_name, "") == 0) + { + error (_("Section name must be provided \n")); + ret = false; + return ret; + } + + data = get_section_contents (section, filedata); + sf_size = section->sh_size; + /* Decode the contents of the section. */ + sfd_ctx = sframe_decode ((const char*)data, sf_size, &err); + if (!sfd_ctx) + { + ret = false; + error (_("SFrame decode failure: %s\n"), sframe_errmsg (err)); + goto fail; + } + + printf (_("Contents of the SFrame section %s:"), print_name); + /* Dump the contents as text. */ + dump_sframe (sfd_ctx, section->sh_addr); + + fail: + free (data); + return ret; +} + static bool load_specific_debug_section (enum dwarf_section_display_enum debug, const Elf_Internal_Shdr * sec, @@ -16363,6 +16421,11 @@ process_section_contents (Filedata * filedata) res = false; } #endif + if (dump & SFRAME_DUMP) + { + if (! dump_section_as_sframe (section, filedata)) + res = false; + } } if (! filedata->is_separate) diff --git a/include/sframe-api.h b/include/sframe-api.h index 0fbed017ecd..077985b2017 100644 --- a/include/sframe-api.h +++ b/include/sframe-api.h @@ -157,6 +157,9 @@ sframe_decoder_get_funcdesc (sframe_decoder_ctx *ctx, int32_t *func_start_address, unsigned char *func_info); +/* SFrame textual dump. */ +extern void +dump_sframe (sframe_decoder_ctx *decoder, uint64_t addr); /* Get the base reg id from the FRE info. Sets errp if fails. */ extern unsigned int diff --git a/libsframe/Makefile.am b/libsframe/Makefile.am index 940494dba1e..d8198a166c5 100644 --- a/libsframe/Makefile.am +++ b/libsframe/Makefile.am @@ -33,7 +33,7 @@ include_HEADERS = noinst_LTLIBRARIES = libsframe.la endif -libsframe_la_SOURCES = sframe.c sframe-error.c +libsframe_la_SOURCES = sframe.c sframe-dump.c sframe-error.c libsframe_la_CPPFLAGS = $(AM_CPPFLAGS) include testsuite/local.mk diff --git a/libsframe/Makefile.in b/libsframe/Makefile.in index 2d1ea896471..340bfe88060 100644 --- a/libsframe/Makefile.in +++ b/libsframe/Makefile.in @@ -149,7 +149,7 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) libsframe_la_LIBADD = am_libsframe_la_OBJECTS = libsframe_la-sframe.lo \ - libsframe_la-sframe-error.lo + libsframe_la-sframe-dump.lo libsframe_la-sframe-error.lo libsframe_la_OBJECTS = $(am_libsframe_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -427,7 +427,7 @@ AM_CFLAGS = @ac_libsframe_warn_cflags@ @INSTALL_LIBBFD_FALSE@include_HEADERS = @INSTALL_LIBBFD_TRUE@include_HEADERS = $(INCDIR)/sframe.h $(INCDIR)/sframe-api.h @INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libsframe.la -libsframe_la_SOURCES = sframe.c sframe-error.c +libsframe_la_SOURCES = sframe.c sframe-dump.c sframe-error.c libsframe_la_CPPFLAGS = $(AM_CPPFLAGS) # Setup the testing framework @@ -607,6 +607,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsframe_la-sframe-dump.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsframe_la-sframe-error.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsframe_la-sframe.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_be_flipping-be-flipping.Po@am__quote@ @@ -645,6 +646,13 @@ libsframe_la-sframe.lo: sframe.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsframe_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsframe_la-sframe.lo `test -f 'sframe.c' || echo '$(srcdir)/'`sframe.c +libsframe_la-sframe-dump.lo: sframe-dump.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsframe_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libsframe_la-sframe-dump.lo -MD -MP -MF $(DEPDIR)/libsframe_la-sframe-dump.Tpo -c -o libsframe_la-sframe-dump.lo `test -f 'sframe-dump.c' || echo '$(srcdir)/'`sframe-dump.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsframe_la-sframe-dump.Tpo $(DEPDIR)/libsframe_la-sframe-dump.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sframe-dump.c' object='libsframe_la-sframe-dump.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsframe_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsframe_la-sframe-dump.lo `test -f 'sframe-dump.c' || echo '$(srcdir)/'`sframe-dump.c + libsframe_la-sframe-error.lo: sframe-error.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsframe_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libsframe_la-sframe-error.lo -MD -MP -MF $(DEPDIR)/libsframe_la-sframe-error.Tpo -c -o libsframe_la-sframe-error.lo `test -f 'sframe-error.c' || echo '$(srcdir)/'`sframe-error.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsframe_la-sframe-error.Tpo $(DEPDIR)/libsframe_la-sframe-error.Plo diff --git a/libsframe/sframe-dump.c b/libsframe/sframe-dump.c new file mode 100644 index 00000000000..5b063c9962d --- /dev/null +++ b/libsframe/sframe-dump.c @@ -0,0 +1,181 @@ +/* sframe-dump.c - Textual dump of .sframe. + + Copyright (C) 2022 Free Software Foundation, Inc. + + his file is part of libsframe. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include +#include +#include +#include +#include "sframe-impl.h" + +#define SFRAME_HEADER_FLAGS_STR_MAX_LEN 50 + +static void +dump_sframe_header (sframe_decoder_ctx *sfd_ctx) +{ + const char *verstr = NULL; + const sframe_header *header = &(sfd_ctx->sfd_header); + + /* Prepare SFrame section version string. */ + const char *version_names[] + = { "NULL", + "SFRAME_VERSION_1" }; + unsigned char ver = header->sfh_preamble.sfp_version; + if (ver <= SFRAME_VERSION) + verstr = version_names[ver]; + + /* Prepare SFrame section flags string. */ + unsigned char flags = header->sfh_preamble.sfp_flags; + char *flags_str + = (char*) calloc (sizeof (char), SFRAME_HEADER_FLAGS_STR_MAX_LEN); + if (flags) + { + const char *flag_names[] + = { "SFRAME_F_FDE_SORTED", + "SFRAME_F_FRAME_POINTER" }; + unsigned char flags = header->sfh_preamble.sfp_flags; + if (flags & SFRAME_F_FDE_SORTED) + strcpy (flags_str, flag_names[0]); + if (flags & SFRAME_F_FRAME_POINTER) + { + if (strlen (flags_str) > 0) + strcpy (flags_str, ","); + strcpy (flags_str, flag_names[1]); + } + } + else + strcpy (flags_str, "NONE"); + + const char* subsec_name = "Header"; + printf ("\n"); + printf (" %s :\n", subsec_name); + printf ("\n"); + printf (" Version: %s\n", verstr); + printf (" Flags: %s\n", flags_str); + printf (" Num FDEs: %d\n", header->sfh_num_fdes); + printf (" Num FREs: %d\n", header->sfh_num_fres); + + free (flags_str); +} + +static void +dump_sframe_func_with_fres (sframe_decoder_ctx *sfd_ctx, + unsigned int funcidx, + uint64_t sec_addr) +{ + uint32_t j = 0; + uint32_t num_fres = 0; + uint32_t func_size = 0; + int32_t func_start_address = 0; + unsigned char func_info = 0; + + uint64_t func_start_pc_vma = 0; + uint64_t fre_start_pc_vma = 0; + const char *base_reg_str[] = {"fp", "sp"}; + int32_t cfa_offset = 0; + int32_t fp_offset = 0; + int32_t ra_offset = 0; + unsigned int base_reg_id = 0; + int err[3] = {0, 0, 0}; + + sframe_frame_row_entry fre; + + /* Get the SFrame function descriptor. */ + sframe_decoder_get_funcdesc (sfd_ctx, funcidx, &num_fres, + &func_size, &func_start_address, &func_info); + /* Calculate the virtual memory address for function start pc. */ + func_start_pc_vma = func_start_address + sec_addr; + + /* Mark FDEs with [m] where the FRE start address is interpreted as a + mask. */ + int fde_type_addrmask_p = (SFRAME_V1_FUNC_FDE_TYPE (func_info) + == SFRAME_FDE_TYPE_PCMASK); + const char *fde_type_marker + = (fde_type_addrmask_p ? "[m]" : " "); + + printf ("\n func idx [%d]: pc = 0x%"PRIx64 ", size = %d bytes", + funcidx, + func_start_pc_vma, + func_size); + + char temp[100]; + memset (temp, 0, 100); + + printf ("\n %-7s%-8s %-10s%-10s%-10s", "STARTPC", fde_type_marker, "CFA", "FP", "RA"); + for (j = 0; j < num_fres; j++) + { + sframe_decoder_get_fre (sfd_ctx, funcidx, j, &fre); + + fre_start_pc_vma = (fde_type_addrmask_p + ? fre.fre_start_addr + : func_start_pc_vma + fre.fre_start_addr); + + /* FIXME - fixup the err caching in array. + assert no error for base reg id. */ + base_reg_id = sframe_fre_get_base_reg_id (&fre, &err[0]); + cfa_offset = sframe_fre_get_cfa_offset (sfd_ctx, &fre, &err[0]); + fp_offset = sframe_fre_get_fp_offset (sfd_ctx, &fre, &err[1]); + ra_offset = sframe_fre_get_ra_offset (sfd_ctx, &fre, &err[2]); + + /* Dump CFA info. */ + printf ("\n"); + printf (" %016"PRIx64, fre_start_pc_vma); + sprintf (temp, "%s+%d", base_reg_str[base_reg_id], cfa_offset); + printf (" %-10s", temp); + + /* Dump SP/FP info. */ + memset (temp, 0, 100); + if (err[1] == 0) + sprintf (temp, "c%+d", fp_offset); + else + strcpy (temp, "u"); + printf ("%-10s", temp); + + /* Dump RA info. */ + memset (temp, 0, 100); + if (err[2] == 0) + sprintf (temp, "c%+d", ra_offset); + else + strcpy (temp, "u"); + printf ("%-10s", temp); + } +} + +static void +dump_sframe_functions (sframe_decoder_ctx *sfd_ctx, uint64_t sec_addr) +{ + uint32_t i; + uint32_t num_fdes; + + const char* subsec_name = "Function Index"; + printf ("\n %s :\n", subsec_name); + + num_fdes = sframe_decoder_get_num_fidx (sfd_ctx); + for (i = 0; i < num_fdes; i++) + { + dump_sframe_func_with_fres (sfd_ctx, i, sec_addr); + printf ("\n"); + } +} + +void +dump_sframe (sframe_decoder_ctx *sfd_ctx, uint64_t sec_addr) +{ + dump_sframe_header (sfd_ctx); + dump_sframe_functions (sfd_ctx, sec_addr); +} From patchwork Sun Oct 30 07:44:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 12962 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1688234wru; Sun, 30 Oct 2022 00:55:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6r/k8s+yCph24pOiIrOjGilO1EdFiqph2puPSj1+stSejDsPUUSAxXS3MsLuwWYZl3HvIj X-Received: by 2002:a17:907:1b1f:b0:72f:56db:cce9 with SMTP id mp31-20020a1709071b1f00b0072f56dbcce9mr6844785ejc.605.1667116522596; Sun, 30 Oct 2022 00:55:22 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id r9-20020a1709063d6900b0078198611a45si3087772ejf.980.2022.10.30.00.55.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 00:55:22 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=U0X6bKGn; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C195E38582BB for ; Sun, 30 Oct 2022 07:51:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C195E38582BB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667116294; bh=6yvQi14diKnHSYMx58VQ+44kA1omYq2sVyb0tNcXy9s=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=U0X6bKGngHvvrlcoYomhcXBHHJGBPoNgFs6VqWbyspMI5joHZEXVv64LUWQfnAtPS Gm0x3Hsbo79RqIoTg5jJOtGlC5LcGwA1YChQ8ZCPjida9LIz7rY4+dayylRw+W1leM lAlK8kSSFs463eh0qacBWNNk8VwGTy/rHY3TXZ6k= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id B2D94385117E for ; Sun, 30 Oct 2022 07:45:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B2D94385117E Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29U3Zvaq011301 for ; Sun, 30 Oct 2022 07:45:47 GMT Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgusshc4p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:45:47 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 29U6S3r3029354 for ; Sun, 30 Oct 2022 07:45:46 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2172.outbound.protection.outlook.com [104.47.59.172]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kgtm28s7y-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:45:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TXWpyhOXMW2W6/ptHmMloMdPajYxH5mUtRRLmik5eM8mX+0kSg8jcEwhnsTSRSXF+0407bL92H4/fREm703sCzLGWzjtC9ddYSQdGNibULcIP0Sf3lIfbOOfeYlVjggX/GY9ffgtVo2jnie4EYxJobgSGbC5L16pfBpRJjqd6T0gWtKgX3ZoOoEpVzScijAvgngx39SOVKQh53Ds2BKdGtTMaQwqPSqzGa3EQEA5mLfQ0xHwryZUcHhQXBuIC+wv5kumUHHO7pRrIT83p2AgZ1LxjahK9RVpIL5PwTvVNMJTBNemX9+aXXstvD6V8lP1h36vbfhLNKzcmSALzySLsw== 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=6yvQi14diKnHSYMx58VQ+44kA1omYq2sVyb0tNcXy9s=; b=D4nqpz/7UMSsDp+xTHuyRuIbo0GwmpKaEodTOfmGq7OQs92vNjqFGUiHQ/HrzzbVYB2gUJ0IDzon7c/Q2j1Mvuauuqe+S3e9aypO2Tfap/ggkZKjKCeLfYSkd3QecVKaN+3WU56l42TGtGaZMu8U1K/fyAD6fvVmBLYKp+1IuuIY2lLZzN83+QDvhxoSaLlCHD6qSCzko48p3Nx8wz/DMYoKHiDksF3YmAWNrM8GEUzh3Rg0jjGAgKYQcQYVTZOrirp4Xnfg6s9tgdnLX1ZfomTV7q3fpm+iWRY0wZOa0mtbxvN7S0KnT+F0TzBU54iI53on4wILPiKRTE77wIKMSw== 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 MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by BY5PR10MB4289.namprd10.prod.outlook.com (2603:10b6:a03:20c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.19; Sun, 30 Oct 2022 07:45:43 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2%7]) with mapi id 15.20.5723.033; Sun, 30 Oct 2022 07:45:43 +0000 To: binutils@sourceware.org Subject: [PATCH,V3 08/15] unwinder: generate backtrace using SFrame format Date: Sun, 30 Oct 2022 00:44:43 -0700 Message-Id: <20221030074450.1956074-9-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221030074450.1956074-1-indu.bhagat@oracle.com> References: <20221030074450.1956074-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR03CA0097.namprd03.prod.outlook.com (2603:10b6:303:b7::12) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|BY5PR10MB4289:EE_ X-MS-Office365-Filtering-Correlation-Id: 4985a191-de82-41a0-083e-08daba4abff0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /2Z6vZvKXxDhfL00iK0HJW83L3lhs1MieW7azYjD4Qo6Lg8aNAAMmx9Oy5XVxtHo0PpdIbR63ljYCYBQoivZtn8Ck1KhHZ0UmM358rithbtLEJB0UH00MeIWrIkeDwh5dfXtHN6qv/G0V+M4p51ue2jNWl2jP23cyUQxPPNKUteuhtZN6NUroelNl0ZHyZYaOCVk/2h5XA3X2peesNZR+CPwVFFp1eEyqx2Eqav7PfcT3PFPHyzDr/7KXPv/7gqEWPeLoGRLWTJcFIh/JfXTWQIJasmia90wHiEns7tS/kHkTbw75j25lW/B7q55aIwcXoBYG3e2kJB3d04j49X3CTy2Nc4ix3FpuZNkvs6cf5+uAhMnd84eqhJBnMkhZfaVkuBZCeBU0Mxmpb1of6HrMTJGFhqbTgNOFZc5V7HggObgUG12JCEk1ce7keIpV5jMkqF7e6syvIoZ3WySRGyv3A3oI5Z9A6jObdl+OuFPGOtk5xI21D2bapiye9R0sRZtkBJZbnjK9pDap7RlToiQGUyCeXNEos8BWcQ88cRwVUWsQctiznFBc6qrZRhjVrkzjjNgAEgGZcAdeq0Wgvfgl406CXB/qtwihdMSUPOn9zQ0bJfTxt8NgUJ3JHztj/MvPnRULtjZfSQbk0dgeS+Y2LkiMhEgi4PQFrOTxsz1lkHL5iqrNy1s9OmR/hqLUfkAgjC8fu+xEtuXtpX25JrHUbXbxiXtPwdHXtJ4mh5KW3HvxqAH8nouW5izHGLaMV9nvgDD0pCnAuv3SKVCqHMZRrPId6uUSpN6/AmSXcKTQEY= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2158.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(366004)(39850400004)(376002)(346002)(136003)(451199015)(316002)(66556008)(4326008)(66476007)(36756003)(6916009)(66946007)(30864003)(6486002)(38100700002)(8936002)(41300700001)(86362001)(107886003)(478600001)(5660300002)(1076003)(186003)(83380400001)(8676002)(2616005)(44832011)(2906002)(6512007)(6506007)(2004002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BqVKQJ22vZdKfIoScB7xAJxkAuuPpnlUDTOJWDF1YghxXwyjkvE4QIJZeXBtLL0vrL0x7E5JUBYJXVXUVmvlKsZLYjZpvI9zM2bb+gtypNWEArBqaR3s/sBn7LztoeCRGwgx4KylvWpe99SYaU5VvvcRrqxP6TBMwTgEE+61lu0VXwek0JBGrlhua6EG5cBGAnTA7SQrCi7h4W17q9Lb7Azqx/orQtdiz5/BqSpVTuenWU8luDansSZnGdoMAedEFq9jxf0qvoageYsg99RiUd7oElNEAjR3WXJADS6r8y6+MzEXElVUKRh2Was+nJXUDiSJp7L9tv6n+TLDqVpvib8atvEG/2uqkQnl1iAq8ZUUmUhyDockMQ7f+yLkjeoRa1W+SfdHp1GkTg9sIUfNR8LfQ9xedKZ4PgZ9iBqjGRgS3JGFUniF0mya1JrrlvIq+ML0TeXaP9m/lXyykn4qdcfFnjcSgCrUfVKhOTx3PQfwUqhNaZ8C9XUVIlBzIiT7FvJ9V6G/wooXwjkJ0Z7GyKsGueu3KKCq8icnFBdo7RHf7IfEh6pdoVKJNmv+RtD5pi5mQCluRzJ+NGLIZiIii6cXrwk0CAWeCKKA+DijOxB4raeOcBdphaq8S3mhtZ08udWi4rzGFvnmaXV84tGOdHB5SEuGYlnvtCKicSwaRHAZzpnIV59d+9idFavAgvXPfucZMWc++jW8UlD4gKH2Cus/xxDm+J2F0lcAfmb3uez7QG0/1CDvXYFW9uz+Xe+RmIMhOk2GQFqegXXfLUEkJFG08UvpnYxbJkNUP0E8U0nVqoQXUiFLxm868hIaskTLMsIMtTcgMK2vjdMBQLbYgay4LEeO6pFa/mSIM290B/ljH2VZrr04QaPVyRCsDB6bZx9XZEFK8NwjHqPTsMZxncjIMR3mX1tVvTcdws4j07RW/3VncHhI6dgusGUUnZE7qFBPGe0GBv5s226nDmBcobt9Q9rayzewyYz51rthU6ru6GNhuDyN4SOgmKwZX5Sw3nYZVA1YZz+HqRVOz3uUPmo75yAamiifpktqq4KtepzF1BohEZqvRHg3rG/EkExhQ7Lat2Zdhpy+ne1RXK0hdXh5YxheszP8MyDPpDwamQEoZ77H7zwWmf1vmTz9wzy8VmxGWHJtlU2gvy8covroz+jaKBQnut6p3GJ3ZGOwIu4hQltGp1+qxgw9PBL48lEMiXDUjL/WOuJ0sYnBiV6VZlHQjNZatBxqpRyCLYQ7kJXyJOOrYRCTM/O0L+paXl31qY3Z8loLRh5Iqa9eCANmvWeAZix9u5NFsfp9NPjIPnIVajt35lfqsJOkIlqcCLn868ikpaxtmswPmH47camZHJLQUlsMCdQMh3mhyBdscjBh0yDxqfzPDUNORmSUwPz2KlFoyuEQOu+FVs9gVxPEuys5/sO+DW0wJg7GMRjsmnJ41kokL3G798PUlI2U6dHmq1GItJYVUruV4yVAGC94gYP3Mrx/UjQwz74ZFTucbI2kn5yTbui4p4MMmqpbcUwTRWyNZ2HrK3EPjXnFJPXcFm36tne1aePyj81832kQ+JG+HV3uHNfbT+FEjNj+/3szqBJj93trUVNzCKEDlshXcBrw7lGbUA3DGS/V1D+ATb8= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4985a191-de82-41a0-083e-08daba4abff0 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2022 07:45:43.8746 (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: Lq9jawR1krIaDslbd1E6n4DnLx/blnhLsmEKIQZ97PGNd+WJ3EjNuzIsdWs+w95rvgpGlICM9AOoRE751IDC4A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4289 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-30_02,2022-10-27_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 bulkscore=0 suspectscore=0 phishscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2210300049 X-Proofpoint-ORIG-GUID: Zl1eUpLBW8aaFtEDfzrZYaxPHq-EtGG5 X-Proofpoint-GUID: Zl1eUpLBW8aaFtEDfzrZYaxPHq-EtGG5 X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Indu Bhagat via Binutils From: Indu Bhagat Reply-To: Indu Bhagat Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748098375078754378?= X-GMAIL-MSGID: =?utf-8?q?1748098375078754378?= From: Weimin Pan [Changes in V3] - Use the updated APIs from libsframe. - Use sframe_decoder_get_fixed_ra_offset on AMD64 instead of magic number -8. [End of changes in V3] [Changes in V2] - Minor formatting fixes. [End of changes in V2] A simple unwinder based on SFrame format. The unwinder is made available via libsframebt library. Buildsystem changes have been made to build libsframebt only when --gsframe support is available in the assembler. These buildsystem changes are necessary because the SFrame based unwinder the SFrame unwind info for itself to work. PS: libsframe/configure has NOT been included in the patch. Please regenerate. config/ChangeLog: * sframe.m4: New file. include/ChangeLog: * sframe-backtrace-api.h: New file. ChangeLog: * libsframe/Makefile.am: Build backtrace functionality in its own library. Install libsframebt conditionally. * libsframe/Makefile.in: Regenerate. * libsframe/aclocal.m4: Regenerate. * libsframe/configure: Regenerate. <-- [REMOVED FROM THE PATCH. PLEASE REGENERATE. ] * libsframe/configure.ac: Check if gas supports --gsframe command line option. * libsframe/sframe-backtrace-err.c: New file. * libsframe/sframe-backtrace.c: New file. --- config/sframe.m4 | 16 + include/sframe-backtrace-api.h | 57 +++ libsframe/Makefile.am | 12 + libsframe/Makefile.in | 58 ++- libsframe/aclocal.m4 | 1 + libsframe/configure.ac | 7 + libsframe/sframe-backtrace-err.c | 46 +++ libsframe/sframe-backtrace.c | 626 +++++++++++++++++++++++++++++++ 8 files changed, 816 insertions(+), 7 deletions(-) create mode 100644 config/sframe.m4 create mode 100644 include/sframe-backtrace-api.h create mode 100644 libsframe/sframe-backtrace-err.c create mode 100644 libsframe/sframe-backtrace.c diff --git a/config/sframe.m4 b/config/sframe.m4 new file mode 100644 index 00000000000..9f149fda9ef --- /dev/null +++ b/config/sframe.m4 @@ -0,0 +1,16 @@ +# SFRAME_CHECK_AS_SFRAME +# ---------------------- +# Check whether the assembler supports generation of SFrame +# unwind information. +# +# Defines: +# ac_cv_have_sframe + +AC_DEFUN([SFRAME_CHECK_AS_SFRAME],[ + ac_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wa,--gsframe" + AC_MSG_CHECKING([for as that supports --gsframe]) + AC_TRY_COMPILE([], [return 0;], [ac_cv_have_sframe=yes], [ac_cv_have_sframe=no]) + AC_MSG_RESULT($ac_cv_have_sframe) + CFLAGS="$ac_save_CFLAGS" +]) diff --git a/include/sframe-backtrace-api.h b/include/sframe-backtrace-api.h new file mode 100644 index 00000000000..ad8f6bed024 --- /dev/null +++ b/include/sframe-backtrace-api.h @@ -0,0 +1,57 @@ +/* Public API to SFrame backtrace. + + Copyright (C) 2022 Free Software Foundation, Inc. + + This file is part of libsframebt. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef _SFRAME_BACKTRACE_API_H +#define _SFRAME_BACKTRACE_API_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +enum sframe_bt_errcode +{ + SFRAME_BT_OK, + SFRAME_BT_ERR_NOTPRESENT, + SFRAME_BT_ERR_PHDR, + SFRAME_BT_ERR_ARG, + SFRAME_BT_ERR_MALLOC, + SFRAME_BT_ERR_REALLOC, + SFRAME_BT_ERR_OPEN, + SFRAME_BT_ERR_READLINK, + SFRAME_BT_ERR_LSEEK, + SFRAME_BT_ERR_READ, + SFRAME_BT_ERR_GETCONTEXT, + SFRAME_BT_ERR_DECODE, + SFRAME_BT_ERR_CFA_OFFSET, +}; + +/* Get the backtrace of the calling program by storing return addresses + in BUFFER. The SIZE argument specifies the maximum number of addresses + that can be stored in the buffer. Return the number of return addresses + collected or -1 if there is any error. */ +extern int sframe_backtrace (void **buffer, int size, int *errp); + +extern const char *sframe_bt_errmsg (enum sframe_bt_errcode ecode); + +#ifdef __cplusplus +} +#endif + +#endif /* _SFRAME_BACKTRACE_API_H */ diff --git a/libsframe/Makefile.am b/libsframe/Makefile.am index d8198a166c5..6b27ccdcdf6 100644 --- a/libsframe/Makefile.am +++ b/libsframe/Makefile.am @@ -36,4 +36,16 @@ endif libsframe_la_SOURCES = sframe.c sframe-dump.c sframe-error.c libsframe_la_CPPFLAGS = $(AM_CPPFLAGS) +if HAVE_SFRAME_AS + libsframebt_la_SOURCES = sframe-backtrace.c sframe-backtrace-err.c + libsframebt_la_CPPFLAGS = -I$(srcdir) -I$(srcdir)/../include + libsframebt_la_CFLAGS = -Wa,--gsframe +if INSTALL_LIBBFD + lib_LTLIBRARIES += libsframebt.la + include_HEADERS += $(INCDIR)/sframe-backtrace-api.h +else + noinst_LTLIBRARIES += libsframebt.la +endif +endif + include testsuite/local.mk diff --git a/libsframe/Makefile.in b/libsframe/Makefile.in index 340bfe88060..3d0b26000db 100644 --- a/libsframe/Makefile.in +++ b/libsframe/Makefile.in @@ -89,8 +89,11 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ +@HAVE_SFRAME_AS_TRUE@@INSTALL_LIBBFD_TRUE@am__append_1 = libsframebt.la +@HAVE_SFRAME_AS_TRUE@@INSTALL_LIBBFD_TRUE@am__append_2 = $(INCDIR)/sframe-backtrace-api.h +@HAVE_SFRAME_AS_TRUE@@INSTALL_LIBBFD_FALSE@am__append_3 = libsframebt.la check_PROGRAMS = $(am__EXEEXT_1) -@HAVE_COMPAT_DEJAGNU_TRUE@am__append_1 = testsuite/libsframe.decode/be-flipping \ +@HAVE_COMPAT_DEJAGNU_TRUE@am__append_4 = testsuite/libsframe.decode/be-flipping \ @HAVE_COMPAT_DEJAGNU_TRUE@ testsuite/libsframe.decode/frecnt-1 \ @HAVE_COMPAT_DEJAGNU_TRUE@ testsuite/libsframe.decode/frecnt-2 \ @HAVE_COMPAT_DEJAGNU_TRUE@ testsuite/libsframe.encode/encode-1 @@ -103,6 +106,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \ $(top_srcdir)/../config/jobserver.m4 \ $(top_srcdir)/../config/lead-dot.m4 \ $(top_srcdir)/../config/override.m4 \ + $(top_srcdir)/../config/sframe.m4 \ $(top_srcdir)/../config/warnings.m4 \ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \ @@ -157,6 +161,20 @@ am__v_lt_0 = --silent am__v_lt_1 = @INSTALL_LIBBFD_FALSE@am_libsframe_la_rpath = @INSTALL_LIBBFD_TRUE@am_libsframe_la_rpath = -rpath $(libdir) +libsframebt_la_LIBADD = +am__libsframebt_la_SOURCES_DIST = sframe-backtrace.c \ + sframe-backtrace-err.c +@HAVE_SFRAME_AS_TRUE@am_libsframebt_la_OBJECTS = \ +@HAVE_SFRAME_AS_TRUE@ libsframebt_la-sframe-backtrace.lo \ +@HAVE_SFRAME_AS_TRUE@ libsframebt_la-sframe-backtrace-err.lo +libsframebt_la_OBJECTS = $(am_libsframebt_la_OBJECTS) +libsframebt_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libsframebt_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o \ + $@ +@HAVE_SFRAME_AS_TRUE@@INSTALL_LIBBFD_FALSE@am_libsframebt_la_rpath = +@HAVE_SFRAME_AS_TRUE@@INSTALL_LIBBFD_TRUE@am_libsframebt_la_rpath = \ +@HAVE_SFRAME_AS_TRUE@@INSTALL_LIBBFD_TRUE@ -rpath $(libdir) @HAVE_COMPAT_DEJAGNU_TRUE@am__EXEEXT_1 = testsuite/libsframe.decode/be-flipping$(EXEEXT) \ @HAVE_COMPAT_DEJAGNU_TRUE@ testsuite/libsframe.decode/frecnt-1$(EXEEXT) \ @HAVE_COMPAT_DEJAGNU_TRUE@ testsuite/libsframe.decode/frecnt-2$(EXEEXT) \ @@ -216,12 +234,13 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(libsframe_la_SOURCES) \ +SOURCES = $(libsframe_la_SOURCES) $(libsframebt_la_SOURCES) \ $(testsuite_libsframe_decode_be_flipping_SOURCES) \ $(testsuite_libsframe_decode_frecnt_1_SOURCES) \ $(testsuite_libsframe_decode_frecnt_2_SOURCES) \ $(testsuite_libsframe_encode_encode_1_SOURCES) DIST_SOURCES = $(libsframe_la_SOURCES) \ + $(am__libsframebt_la_SOURCES_DIST) \ $(testsuite_libsframe_decode_be_flipping_SOURCES) \ $(testsuite_libsframe_decode_frecnt_1_SOURCES) \ $(testsuite_libsframe_decode_frecnt_2_SOURCES) \ @@ -231,7 +250,8 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac -am__include_HEADERS_DIST = $(INCDIR)/sframe.h $(INCDIR)/sframe-api.h +am__include_HEADERS_DIST = $(INCDIR)/sframe-backtrace-api.h \ + $(INCDIR)/sframe.h $(INCDIR)/sframe-api.h HEADERS = $(include_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)config.h.in @@ -423,12 +443,17 @@ INCDIR = $(srcdir)/../include # include libctf for swap.h AM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../libctf AM_CFLAGS = @ac_libsframe_warn_cflags@ -@INSTALL_LIBBFD_TRUE@lib_LTLIBRARIES = libsframe.la -@INSTALL_LIBBFD_FALSE@include_HEADERS = -@INSTALL_LIBBFD_TRUE@include_HEADERS = $(INCDIR)/sframe.h $(INCDIR)/sframe-api.h -@INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libsframe.la +@INSTALL_LIBBFD_TRUE@lib_LTLIBRARIES = libsframe.la $(am__append_1) +@INSTALL_LIBBFD_FALSE@include_HEADERS = $(am__append_2) +@INSTALL_LIBBFD_TRUE@include_HEADERS = $(INCDIR)/sframe.h \ +@INSTALL_LIBBFD_TRUE@ $(INCDIR)/sframe-api.h $(am__append_2) +@INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libsframe.la \ +@INSTALL_LIBBFD_FALSE@ $(am__append_3) libsframe_la_SOURCES = sframe.c sframe-dump.c sframe-error.c libsframe_la_CPPFLAGS = $(AM_CPPFLAGS) +@HAVE_SFRAME_AS_TRUE@libsframebt_la_SOURCES = sframe-backtrace.c sframe-backtrace-err.c +@HAVE_SFRAME_AS_TRUE@libsframebt_la_CPPFLAGS = -I$(srcdir) -I$(srcdir)/../include +@HAVE_SFRAME_AS_TRUE@libsframebt_la_CFLAGS = -Wa,--gsframe # Setup the testing framework EXPECT = expect @@ -550,6 +575,9 @@ clean-noinstLTLIBRARIES: libsframe.la: $(libsframe_la_OBJECTS) $(libsframe_la_DEPENDENCIES) $(EXTRA_libsframe_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(am_libsframe_la_rpath) $(libsframe_la_OBJECTS) $(libsframe_la_LIBADD) $(LIBS) +libsframebt.la: $(libsframebt_la_OBJECTS) $(libsframebt_la_DEPENDENCIES) $(EXTRA_libsframebt_la_DEPENDENCIES) + $(AM_V_CCLD)$(libsframebt_la_LINK) $(am_libsframebt_la_rpath) $(libsframebt_la_OBJECTS) $(libsframebt_la_LIBADD) $(LIBS) + clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ @@ -610,6 +638,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsframe_la-sframe-dump.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsframe_la-sframe-error.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsframe_la-sframe.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsframebt_la-sframe-backtrace-err.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsframebt_la-sframe-backtrace.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_be_flipping-be-flipping.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_frecnt_1-frecnt-1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_frecnt_2-frecnt-2.Po@am__quote@ @@ -660,6 +690,20 @@ libsframe_la-sframe-error.lo: sframe-error.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsframe_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsframe_la-sframe-error.lo `test -f 'sframe-error.c' || echo '$(srcdir)/'`sframe-error.c +libsframebt_la-sframe-backtrace.lo: sframe-backtrace.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsframebt_la_CPPFLAGS) $(CPPFLAGS) $(libsframebt_la_CFLAGS) $(CFLAGS) -MT libsframebt_la-sframe-backtrace.lo -MD -MP -MF $(DEPDIR)/libsframebt_la-sframe-backtrace.Tpo -c -o libsframebt_la-sframe-backtrace.lo `test -f 'sframe-backtrace.c' || echo '$(srcdir)/'`sframe-backtrace.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsframebt_la-sframe-backtrace.Tpo $(DEPDIR)/libsframebt_la-sframe-backtrace.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sframe-backtrace.c' object='libsframebt_la-sframe-backtrace.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsframebt_la_CPPFLAGS) $(CPPFLAGS) $(libsframebt_la_CFLAGS) $(CFLAGS) -c -o libsframebt_la-sframe-backtrace.lo `test -f 'sframe-backtrace.c' || echo '$(srcdir)/'`sframe-backtrace.c + +libsframebt_la-sframe-backtrace-err.lo: sframe-backtrace-err.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsframebt_la_CPPFLAGS) $(CPPFLAGS) $(libsframebt_la_CFLAGS) $(CFLAGS) -MT libsframebt_la-sframe-backtrace-err.lo -MD -MP -MF $(DEPDIR)/libsframebt_la-sframe-backtrace-err.Tpo -c -o libsframebt_la-sframe-backtrace-err.lo `test -f 'sframe-backtrace-err.c' || echo '$(srcdir)/'`sframe-backtrace-err.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsframebt_la-sframe-backtrace-err.Tpo $(DEPDIR)/libsframebt_la-sframe-backtrace-err.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sframe-backtrace-err.c' object='libsframebt_la-sframe-backtrace-err.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsframebt_la_CPPFLAGS) $(CPPFLAGS) $(libsframebt_la_CFLAGS) $(CFLAGS) -c -o libsframebt_la-sframe-backtrace-err.lo `test -f 'sframe-backtrace-err.c' || echo '$(srcdir)/'`sframe-backtrace-err.c + testsuite/libsframe.decode/testsuite_libsframe_decode_be_flipping-be-flipping.o: testsuite/libsframe.decode/be-flipping.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(testsuite_libsframe_decode_be_flipping_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT testsuite/libsframe.decode/testsuite_libsframe_decode_be_flipping-be-flipping.o -MD -MP -MF testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_be_flipping-be-flipping.Tpo -c -o testsuite/libsframe.decode/testsuite_libsframe_decode_be_flipping-be-flipping.o `test -f 'testsuite/libsframe.decode/be-flipping.c' || echo '$(srcdir)/'`testsuite/libsframe.decode/be-flipping.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_be_flipping-be-flipping.Tpo testsuite/libsframe.decode/$(DEPDIR)/testsuite_libsframe_decode_be_flipping-be-flipping.Po diff --git a/libsframe/aclocal.m4 b/libsframe/aclocal.m4 index b0cdd6b184d..1bceeeab5a3 100644 --- a/libsframe/aclocal.m4 +++ b/libsframe/aclocal.m4 @@ -1234,6 +1234,7 @@ m4_include([../config/depstand.m4]) m4_include([../config/jobserver.m4]) m4_include([../config/lead-dot.m4]) m4_include([../config/override.m4]) +m4_include([../config/sframe.m4]) m4_include([../config/warnings.m4]) m4_include([../libtool.m4]) m4_include([../ltoptions.m4]) diff --git a/libsframe/configure.ac b/libsframe/configure.ac index a6c1d26bbbb..2775fe88b68 100644 --- a/libsframe/configure.ac +++ b/libsframe/configure.ac @@ -59,6 +59,13 @@ AM_CONDITIONAL([HAVE_COMPAT_DEJAGNU], [test "x$ac_cv_dejagnu_compat" = "xyes"]) COMPAT_DEJAGNU=$ac_cv_dejagnu_compat AC_SUBST(COMPAT_DEJAGNU) +dnl The libsframebt library needs to be built with SFrame info. +dnl If the build assembler is not capable of generate SFrame then +dnl the library is not built. + +SFRAME_CHECK_AS_SFRAME +AM_CONDITIONAL([HAVE_SFRAME_AS], [test "x$ac_cv_have_sframe" = "xyes"]) + AM_MAINTAINER_MODE AM_INSTALL_LIBBFD diff --git a/libsframe/sframe-backtrace-err.c b/libsframe/sframe-backtrace-err.c new file mode 100644 index 00000000000..70bd55ccf35 --- /dev/null +++ b/libsframe/sframe-backtrace-err.c @@ -0,0 +1,46 @@ +/* sframe-backtrace-err.c - SFrame Backtrace Error table. + + Copyright (C) 2022 Free Software Foundation, Inc. + + This file is part of libsframebt. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include "config.h" +#include "sframe-backtrace-api.h" + +/* SFrame backtrace error messages. */ +static const char *const sframe_bt_errlist[] = +{ + "", + "File does not contain SFrame data", + "Iterating shared object reading error", + "Failed to malloc memory space", + "Failed to realloc memory space", + "Failed to open file", + "Failed on resolve canonical file name", + "Failed to reposition file offset", + "Failed to read from a file descriptor", + "Failed to get the user context", + "Failed to set up decode data", + "Illegal CFA offset" +}; + +/* Return the error message associated with the error code. */ + +const char * +sframe_bt_errmsg (enum sframe_bt_errcode ecode) +{ + return sframe_bt_errlist[ecode]; +} diff --git a/libsframe/sframe-backtrace.c b/libsframe/sframe-backtrace.c new file mode 100644 index 00000000000..877bbccfba7 --- /dev/null +++ b/libsframe/sframe-backtrace.c @@ -0,0 +1,626 @@ +/* sframe-backtrace.c - The SFrame backtracer. + + Copyright (C) 2022 Free Software Foundation, Inc. + + This file is part of libsframebt. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif + +#include "config.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ansidecl.h" +#include "sframe-api.h" +#include "sframe-backtrace-api.h" + +#ifndef PT_SFRAME +#define PT_SFRAME 0x6474e554 /* FIXME. */ +#endif + +#define _sf_printflike_(string_index,first_to_check) \ + __attribute__ ((__format__ (__printf__, (string_index), (first_to_check)))) + +static int _sframe_unwind_debug; /* Control for printing out debug info. */ +static int no_of_entries = 32; + +/* SFrame decode data for the main module or a DSO. */ +struct sframe_decode_data +{ + char *sfdd_data; /* SFrame decode data. */ + int sfdd_data_size; /* SFrame decode data size. */ + uint64_t sfdd_text_vma; /* Text segment's virtual address. */ + int sfdd_text_size; /* Text segment's size. */ + uint64_t sfdd_sframe_vma; /* SFrame segment's virtual address. */ + sframe_decoder_ctx *sfdd_sframe_ctx; /* SFrame decoder context. */ +}; + +/* List that holds SFrame info for the shared libraries. */ +struct dso_cfi_list +{ + int alloced; /* Entries allocated. */ + int used; /* Entries used. */ + struct sframe_decode_data *entry; /* DSO's decode data. */ +}; + +/* Data that's passed through sframe_callback. */ +struct sframe_unwind_info +{ + int sui_fd; /* File descriptor. */ + struct sframe_decode_data sui_ctx; /* The decode data. */ + struct dso_cfi_list sui_dsos; /* The DSO list. */ +}; + +static void +sframe_unwind_init_debug (void) +{ + static int inited; + + if (!inited) + { + _sframe_unwind_debug = getenv ("SFRAME_UNWIND_DEBUG") != NULL; + inited = 1; + } +} + +_sf_printflike_ (1, 2) +static void +debug_printf (const char *format, ...) +{ + if (_sframe_unwind_debug) + { + va_list args; + + va_start (args, format); + __builtin_vprintf (format, args); + va_end (args); + } +} + +/* sframe_bt_errno - Check if there is error code in ERRP. */ + +static int +sframe_bt_errno (int *errp) +{ + if (errp == NULL) + return 0; + + return (*errp != SFRAME_BT_OK); +} + +/* sframe_bt_set_errno - Store the specified error code ERROR into ERRP if + it is non-NULL. */ + +static void +sframe_bt_set_errno (int *errp, int error) +{ + if (errp != NULL) + *errp = error; +} + +/* sframe_add_dso - Add .sframe info in D_DATA, which is associated with + a dynamic shared object, to D_LIST. */ + +static void +sframe_add_dso (struct dso_cfi_list *d_list, + struct sframe_decode_data d_data, + int *errp) +{ + if (d_list->alloced == 0) + { + d_list->entry = malloc (no_of_entries * sizeof (struct sframe_decode_data)); + if (d_list->entry == NULL) + { + sframe_bt_set_errno (errp, SFRAME_BT_ERR_MALLOC); + return; + } + memset (d_list->entry, 0, + no_of_entries * sizeof (struct sframe_decode_data)); + d_list->alloced = no_of_entries; + } + else if (d_list->used == d_list->alloced) + { + d_list->entry = realloc (d_list->entry, + ((d_list->alloced + no_of_entries) + * sizeof (struct sframe_decode_data))); + if (d_list->entry == NULL) + { + sframe_bt_set_errno (errp, SFRAME_BT_ERR_REALLOC); + return; + } + + memset (&d_list->entry[d_list->alloced], 0, + no_of_entries * sizeof (struct sframe_decode_data)); + d_list->alloced += no_of_entries; + } + + sframe_bt_set_errno (errp, SFRAME_BT_OK); + d_list->entry[d_list->used++] = d_data; +} + +/* sframe_free_cfi - Free up space allocated for .sframe info for CF. */ + +static void +sframe_free_cfi (struct sframe_unwind_info *sf) +{ + struct dso_cfi_list *d_list; + int i; + + if (sf == NULL) + return; + + free (sf->sui_ctx.sfdd_data); + sframe_decoder_free (&sf->sui_ctx.sfdd_sframe_ctx); + close (sf->sui_fd); + + d_list = &sf-> sui_dsos; + if (d_list == NULL) + return; + + for (i = 0; i < d_list->used; ++i) + { + free (d_list->entry[i].sfdd_data); + sframe_decoder_free (&d_list->entry[i].sfdd_sframe_ctx); + } + + free (d_list->entry); +} + +/* sframe_find_context - Find the decode data that contains ADDR from CF. + Return the pointer to the decode data or NULL. */ + +static struct sframe_decode_data * +sframe_find_context (struct sframe_unwind_info *sf, uint64_t addr) +{ + struct dso_cfi_list *d_list; + struct sframe_decode_data sdec_data; + int i; + + if (sf == NULL) + return NULL; + + if (sf->sui_ctx.sfdd_text_vma < addr + && sf->sui_ctx.sfdd_text_vma + sf->sui_ctx.sfdd_text_size > addr) + return &sf->sui_ctx; + + d_list = &sf->sui_dsos; + for (i = 0; i < sf->sui_dsos.used; ++i) + { + sdec_data = d_list->entry[i]; + if ((sdec_data.sfdd_text_vma <= addr) + && (sdec_data.sfdd_text_vma + sdec_data.sfdd_text_size >= addr)) + return &d_list->entry[i]; + } + + return NULL; +} + +/* sframe_valid_addr - Check if ADDR is valid in CF. The address is considered + invalid, with regards to SFrame, if it's not in any address range of the + main module or any of its DSO's. Return 1 if valid, 0 otherwise. */ + +static int +sframe_valid_addr (struct sframe_unwind_info *sf, uint64_t addr) +{ + struct sframe_decode_data *cdp; + + if (sf == NULL) + return 0; + + cdp = sframe_find_context (sf, addr); + return cdp ? 1 : 0; +} + +/* sframe_load_ctx - Call decoder to create and set up the SFrame info for + either the main module or one of the DSOs from CF, based on the input + RADDR argument. Return the newly created decode context or NULL. */ + +static sframe_decoder_ctx * +sframe_load_ctx (struct sframe_unwind_info *sf, uint64_t raddr) +{ + sframe_decoder_ctx *nctx; + struct sframe_decode_data *cdp; + + if (sf == NULL) + return NULL; + + cdp = sframe_find_context (sf, raddr); + if (cdp == NULL) + return NULL; + + if (cdp->sfdd_sframe_ctx == NULL) + { + int err; + nctx = sframe_decode (cdp->sfdd_data, cdp->sfdd_data_size, &err); + if (nctx == NULL) + return NULL; + cdp->sfdd_sframe_ctx = nctx; + return nctx; + } + + return NULL; +} + +/* sframe_update_ctx - Check if need to do a decode context switch, based on + the input RADDR argument, from CF. A new decode context will be created + and set up if it isn't already done so. Return the new decode context in + CTX and vma in CFI_VMA. */ + +static void +sframe_update_ctx (struct sframe_unwind_info *sf, uint64_t raddr, + sframe_decoder_ctx **ctx, uint64_t *cfi_vma) +{ + sframe_decoder_ctx *nctx; + struct sframe_decode_data *cdp; + + cdp = sframe_find_context (sf, raddr); + if (cdp != NULL) + { + if (cdp->sfdd_sframe_ctx == NULL) + { + int err; + nctx = sframe_decode (cdp->sfdd_data, cdp->sfdd_data_size, &err); + if (nctx == NULL) + { + *ctx = NULL; + return; + } + cdp->sfdd_sframe_ctx = nctx; + } + *ctx = cdp->sfdd_sframe_ctx; + *cfi_vma = cdp->sfdd_sframe_vma; + } +} + +/* get_contents - Return contents at ADDR from file descriptor FD. */ + +static uint64_t +get_contents (int fd, uint64_t addr, int *errp) +{ + uint64_t data; + size_t sz; + + sframe_bt_set_errno (errp, SFRAME_BT_OK); + if (lseek (fd, addr, SEEK_SET) == -1) + { + sframe_bt_set_errno (errp, SFRAME_BT_ERR_LSEEK); + return 0; + } + sz = read (fd, &data, sizeof (uint64_t)); + if (sz != sizeof (uint64_t)) + { + sframe_bt_set_errno (errp, SFRAME_BT_ERR_READ); + return 0; + } + + return data; +} + +/* sframe_fd_open - Open /proc image associated with the process id and return + the file descriptor. */ + +static int +sframe_fd_open (int *errp) +{ + char filename[PATH_MAX]; + pid_t pid; + int fd; + + pid = getpid (); + snprintf (filename, sizeof filename, "/proc/%d/task/%d/mem", pid, pid); + if ((fd = open (filename, O_RDONLY)) == -1) + { + sframe_bt_set_errno (errp, SFRAME_BT_ERR_OPEN); + return -1; + } + + return fd; +} + +/* sframe_callback - The callback from dl_iterate_phdr with header info + in INFO. + Return SFrame info for either the main module or a DSO in DATA. */ + +static int +sframe_callback (struct dl_phdr_info *info, + size_t size ATTRIBUTE_UNUSED, + void *data) +{ + struct sframe_unwind_info *sf = (struct sframe_unwind_info *) data; + int p_type, i, fd, sframe_err; + ssize_t len; + uint64_t text_vma = 0; + int text_size = 0; + + if (data == NULL || info == NULL) + return 1; + + debug_printf ("-- name: %s %14p\n", info->dlpi_name, (void *)info->dlpi_addr); + + for (i = 0; i < info->dlpi_phnum; i++) + { + debug_printf(" %2d: [%14p; memsz:%7lx] flags: 0x%x; \n", i, + (void *) info->dlpi_phdr[i].p_vaddr, + info->dlpi_phdr[i].p_memsz, + info->dlpi_phdr[i].p_flags); + + p_type = info->dlpi_phdr[i].p_type; + if (p_type == PT_LOAD && info->dlpi_phdr[i].p_flags & PF_X) + { + text_vma = info->dlpi_addr + info->dlpi_phdr[i].p_vaddr; + text_size = info->dlpi_phdr[i].p_memsz; + continue; + } + if (p_type != PT_SFRAME) + continue; + + if (info->dlpi_name[0] == '\0') /* the main module. */ + { + fd = sframe_fd_open (&sframe_err); + if (fd == -1) + return 1; + if (lseek (fd, info->dlpi_addr + info->dlpi_phdr[i].p_vaddr, + SEEK_SET) == -1) + { + sframe_bt_set_errno (&sframe_err, SFRAME_BT_ERR_LSEEK); + return 1; + } + + sf->sui_ctx.sfdd_data = (char *) malloc (info->dlpi_phdr[i].p_memsz); + if (sf->sui_ctx.sfdd_data == NULL) + { + sframe_bt_set_errno (&sframe_err, SFRAME_BT_ERR_MALLOC); + return 1; + } + + len = read (fd, sf->sui_ctx.sfdd_data, info->dlpi_phdr[i].p_memsz); + if (len == -1 || len != (ssize_t) info->dlpi_phdr[i].p_memsz) + { + sframe_bt_set_errno (&sframe_err, SFRAME_BT_ERR_READ); + return 1; + } + + assert (text_vma); + sf->sui_ctx.sfdd_data_size = len; + sf->sui_ctx.sfdd_sframe_vma = info->dlpi_addr + info->dlpi_phdr[i].p_vaddr; + sf->sui_fd = fd; + sf->sui_ctx.sfdd_text_vma = text_vma; + sf->sui_ctx.sfdd_text_size = text_size; + text_vma = 0; + return 0; + } + else + { /* a dynamic shared object. */ + struct sframe_decode_data dt; + memset (&dt, 0, sizeof (struct sframe_decode_data)); + assert (sf->sui_fd); + if (lseek (sf->sui_fd, info->dlpi_addr + info->dlpi_phdr[i].p_vaddr, + SEEK_SET) == -1) + { + sframe_bt_set_errno (&sframe_err, SFRAME_BT_ERR_LSEEK); + return 1; + } + + dt.sfdd_data = (char *) malloc (info->dlpi_phdr[i].p_memsz); + if (dt.sfdd_data == NULL) + { + sframe_bt_set_errno (&sframe_err, SFRAME_BT_ERR_MALLOC); + return 1; + } + + len = read (sf->sui_fd, dt.sfdd_data, info->dlpi_phdr[i].p_memsz); + if (len == -1 || len != (ssize_t) info->dlpi_phdr[i].p_memsz) + { + sframe_bt_set_errno (&sframe_err, SFRAME_BT_ERR_READ); + return 1; + } + + assert (text_vma); + dt.sfdd_data_size = len; + dt.sfdd_sframe_vma = info->dlpi_addr + info->dlpi_phdr[i].p_vaddr; + dt.sfdd_text_vma = text_vma; + dt.sfdd_text_size = text_size; + text_vma = 0; + sframe_add_dso (&sf->sui_dsos, dt, &sframe_err); + if (sframe_err != SFRAME_BT_OK) + return 1; + return 0; + } + } + + return 0; +} + +/* sframe_unwind - Unwind the stack backtrace for CF. If successful, + store the return addresses in RA_LST. The RA_SIZE argument specifies + the maximum number of return addresses that can be stored in RA_LST + and contains the number of the addresses collected. */ + +static void +sframe_unwind (struct sframe_unwind_info *sf, void **ra_lst, + int *ra_size, int *errp) +{ + uint64_t cfa, return_addr, ra_stack_loc, rfp_stack_loc; + int8_t fixed_ra_offset; + sframe_decoder_ctx *ctx; + int cfa_offset, rfp_offset, errnum, i, count; + sframe_frame_row_entry fred, *frep = &fred; + uint64_t pc, rfp, rsp, cfi_vma; + ucontext_t context, *cp = &context; + + if (sf == NULL || ra_lst == NULL || ra_size == NULL) + { + sframe_bt_set_errno (errp, SFRAME_BT_ERR_ARG); + return; + } + + /* Get the user context for its registers. */ + if (getcontext (cp) != 0) + { + sframe_bt_set_errno (errp, SFRAME_BT_ERR_GETCONTEXT); + return; + } + sframe_bt_set_errno (errp, SFRAME_BT_OK); + +#ifdef __x86_64__ + pc = cp->uc_mcontext.gregs[REG_RIP]; + rsp = cp->uc_mcontext.gregs[REG_RSP]; + rfp = cp->uc_mcontext.gregs[REG_RBP]; +#else +#ifdef __aarch64__ +#define UNWIND_AARCH64_X29 29 /* 64-bit frame pointer. */ +#define UNWIND_AARCH64_X30 30 /* 64-bit link pointer. */ + pc = cp->uc_mcontext.pc; + rsp = cp->uc_mcontext.sp; + rfp = cp->uc_mcontext.regs[UNWIND_AARCH64_X29]; + uint64_t ra = cp->uc_mcontext.regs[UNWIND_AARCH64_X30]; +#endif +#endif + + /* Load and set up the decoder. */ + ctx = sframe_load_ctx (sf, pc); + if (ctx == NULL) + { + sframe_bt_set_errno (errp, SFRAME_BT_ERR_DECODE); + return; + } + cfi_vma = sf->sui_ctx.sfdd_sframe_vma; + count = *ra_size; + + for (i = 0; i < count; ++i) + { + pc -= cfi_vma; + errnum = sframe_find_fre (ctx, pc, frep); + if (errnum == 0) + { + cfa_offset = sframe_fre_get_cfa_offset (ctx, frep, &errnum); + if (errnum == ESFRAME_FREOFFSET_NOPRESENT) + { + sframe_bt_set_errno (errp, SFRAME_BT_ERR_CFA_OFFSET); + return; + } + + cfa = ((frep->fre_info & 0x1) == SFRAME_BASE_REG_SP + ? rsp : rfp) + cfa_offset; + +#ifdef __x86_64__ + /* For x86, read the return address from the fixed RA offset from + the SFrame header. RA must be at location CFA - 8. */ + fixed_ra_offset = sframe_decoder_get_fixed_ra_offset (ctx); + if (fixed_ra_offset == SFRAME_CFA_FIXED_RA_INVALID) + return; + + ra_stack_loc = cfa + fixed_ra_offset; + return_addr = get_contents (sf->sui_fd, ra_stack_loc, errp); + if (sframe_bt_errno (errp)) + return; +#else +#ifdef __aarch64__ + int ra_offset = sframe_fre_get_ra_offset (ctx, frep, &errnum); + if (errnum == 0) + { + ra_stack_loc = cfa + ra_offset; + return_addr = get_contents (sf->sui_fd, ra_stack_loc, errp); + if (sframe_bt_errno (errp)) + return; + } + else + return_addr = ra; +#endif +#endif + + /* Validate and add return address to the list. */ + if (sframe_valid_addr (sf, return_addr) == 0) + { + i -= 1; + goto find_fre_ra_err; + } + if (i != 0) /* exclude self. */ + ra_lst[i-1] = (void *)return_addr; + + /* Set up for the next frame. */ + rfp_offset = sframe_fre_get_fp_offset (ctx, frep, &errnum); + if (errnum == 0) + { + rfp_stack_loc = cfa + rfp_offset; + rfp = get_contents (sf->sui_fd, rfp_stack_loc, errp); + if (sframe_bt_errno (errp)) + return; + } + rsp = cfa; + pc = return_addr; + + /* Check if need to update the decoder context and vma. */ + sframe_update_ctx (sf, return_addr, &ctx, &cfi_vma); + if (ctx == NULL) + { + sframe_bt_set_errno (errp, SFRAME_BT_ERR_DECODE); + return; + } + } + else + { + i -= 1; + goto find_fre_ra_err; + } + } + +find_fre_ra_err: + *ra_size = i; +} + +/* sframe_backtrace - Main API that user program calls to get a backtrace. + The BUFFER argument provides space for the list of the return addresses + and the SIZE argument specifies the maximum number of addresses that + can be stored in the buffer. Return the number of return addresses + collected or -1 if there is any error. */ + +int +sframe_backtrace (void **buffer, int size, int *errp) +{ + struct sframe_unwind_info sframeinfo; + + sframe_unwind_init_debug (); + + memset (&sframeinfo, 0, sizeof (struct sframe_unwind_info)); + + /* find and set up the .sframe sections. */ + (void) dl_iterate_phdr (sframe_callback, (void *)&sframeinfo); + if (sframeinfo.sui_fd == 0) + { + sframe_bt_set_errno (errp, SFRAME_BT_ERR_NOTPRESENT); + return -1; + } + + /* Do the stack unwinding. */ + sframe_unwind (&sframeinfo, buffer, &size, errp); + if (sframe_bt_errno (errp)) + return -1; + + sframe_free_cfi (&sframeinfo); + + return size; +} From patchwork Sun Oct 30 07:44:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 12963 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1688428wru; Sun, 30 Oct 2022 00:56:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6rqnzhyLxySBvrjfzZ/0NULOMykFC4M85iMBtHohY0b6TkZqmf15ABB3ULiTqJm6MmQnZu X-Received: by 2002:a05:6402:204d:b0:463:153d:6790 with SMTP id bc13-20020a056402204d00b00463153d6790mr4583263edb.293.1667116567237; Sun, 30 Oct 2022 00:56:07 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id dr8-20020a170907720800b00797e151e571si4849139ejc.36.2022.10.30.00.56.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 00:56:07 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=G+mYP+Vz; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 59DFF3885525 for ; Sun, 30 Oct 2022 07:52:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 59DFF3885525 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667116362; bh=ZE7DH9xgwrnLmAodB7yod9Ov9w9X5p3+VebIfkfXFRY=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=G+mYP+Vz1e8lM17V/nJKJvLep/r32SRKeI7vN5AqIq9YRqEP/khH5oFExpGJNZkPJ AJQkOkfrpK8LdcsQ1GSGlEBDluoc5Y7Kbbrl/N6zTUfxEupYkpMgGGWXqRuSYjkll7 fA2CoVjSiZZ0lKwpGtN4pOEYYlm7SEHW/juZKfsU= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 594523857B99 for ; Sun, 30 Oct 2022 07:45:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 594523857B99 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29U3Zvar011301 for ; Sun, 30 Oct 2022 07:45:51 GMT Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgusshc4q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:45:50 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 29U7IhNG023906 for ; Sun, 30 Oct 2022 07:45:49 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2169.outbound.protection.outlook.com [104.47.59.169]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kgtm29eu8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:45:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WDTyvsIozMNsnAltb0iYHF6wAvTmFj3Gpuz1MMtd6oAG1iB2h9huko5tHTiYkHwlMHHOCpi+KgFwT6OVcrtHs8XYUzPgpOSQv9E3Mm6quP87u8f+z2WK34N4CrbPFiw8Fo3FAg1BHv+Flb2m3ZZKYVfYDyrcx1k6E9HWJbU0yOl92aCqooNUxfsIBDyWTEouxPtNLhE4rlaiEtSFh27f21wmnSqVL35fW/I+ljHAQuQSyofEZosyDvUTHBvZ6cE3bOxwN/qoTNsNGzf0RFF3AOqv0BnAM3lWDKLkEU/jlFLEQVu8YMMAJuqgRx4ov4uMIbh4EZKK1qAopZj0Ido4rQ== 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=ZE7DH9xgwrnLmAodB7yod9Ov9w9X5p3+VebIfkfXFRY=; b=DB9erQF5mAXNIxC5qbM3eWmxyuk4K8bFT3DtkiClp6VQitYdmopP76vihqzErv1PkYdJrHZcqvlEu7r0iIVU2txgm8iybAb92DYnAdqzny3Wmh/kq/ajTEH48BwpGEbYjqW0rXZEUsW1j6LZRXS6YlZTRwhAjjDTnHdVq8wjbvedP02DMvNXBOQ/5OjNuGjiLoIjpabAOTtJeeq+1ISpeiRx67EA77kGkMzEO1EfexVGf46CHc6upy/RAXel07RUjaNgN8ArFXnvqqxNC1Qj0n0NaI/+RKyJZJCEPzb20ic0rXWGA8ZqHgrgDtZW/yKVysu1Ru9UNQZ5+oPrOEPIvQ== 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 MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by BY5PR10MB4289.namprd10.prod.outlook.com (2603:10b6:a03:20c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.19; Sun, 30 Oct 2022 07:45:47 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2%7]) with mapi id 15.20.5723.033; Sun, 30 Oct 2022 07:45:47 +0000 To: binutils@sourceware.org Subject: [PATCH,V3 09/15] unwinder: Add SFrame unwinder tests Date: Sun, 30 Oct 2022 00:44:44 -0700 Message-Id: <20221030074450.1956074-10-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221030074450.1956074-1-indu.bhagat@oracle.com> References: <20221030074450.1956074-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR03CA0216.namprd03.prod.outlook.com (2603:10b6:303:b9::11) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|BY5PR10MB4289:EE_ X-MS-Office365-Filtering-Correlation-Id: eab13c45-d10c-4e19-a796-08daba4ac1c5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EVTUoJGKFtpmYyi+prU7eIXl37sVHW11GEaqamFXN3lRO5NO2MjbGp+T7Dz2z1ViN4CRgZcRpaqRqDCIKki1Ca+tN0mNaggCWIZuxwEkUaIvi6PEq2fyRE1b5nX3e12LTDUYv1yAGQknd5/fWxWxOL6NjflBD1+EyPX/6jYyStQefetudTlHJ7apIDnkFaykoyUn3Qv1cLg46SAwlvbQZY53QTFBiiY3XD4VxR3SvdDNKImrSEB/LMsAv4bbFxzYjKxU2lz0r/91XD8cNkjAoHPec2JsUqFJ9TCC4bOuI1bJmFofL3+PuO89XKMu6FygRQIsQAYuLeavKMY8LGtMYpyFEgkUS8b9eCb9NBczWGG0WEKdQaJnVcA++I9aHsdCbmRH/fRk4VAX2sVI2BS/u7z9oEXz2CnhFWojBYLI6VVv8bj2icnwKNedchCv+78lVI7yUOBix2rwJOgxvlo/CIBRovOEzpJu47ytZHHVlQT/oRmn2AZZwwRerI//EihcckAjEYK/pqxW0Um4a96fBtkmmctBcmAeorEcYsQ+FDYyZtgNoiIYIyJPxp5OWnxMnSS+FOnExxHe3H0ayFNmusBBNnGy46gjjWKIZCvNl9Zxp06v8k6a6ZQR0nDsHRijrk1sLtDI2wk+GnTKdrNqKUbLS7Oo9YPTaTwHhTGV1deUh3rM1/cE+nAjgl006LJUc1QQDVBDfA3aiO/wP+lxVsXzbghUhk+69+AtLuvlpi6d+WiZxaOhUQjmnw/ZOwTo5HbXdGFFV2uN7eF/4Feb/k7CZaIeFFmNxSRbiMz+XEM= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2158.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(366004)(39850400004)(376002)(346002)(136003)(451199015)(316002)(66556008)(4326008)(66476007)(36756003)(6916009)(66946007)(30864003)(6486002)(38100700002)(6666004)(8936002)(41300700001)(86362001)(107886003)(478600001)(5660300002)(1076003)(186003)(83380400001)(8676002)(2616005)(44832011)(2906002)(6512007)(6506007)(2004002)(579004)(559001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: A5mnqWlAabB0kYgeWTYzxXq3C3MY/vU3V+QeXfPzvB0FKd0POV/M+fw3YbA7ZobLAZCrX3foQsBq1ELkje2BNuPWVlnNLSr6fRSpvHadRlFOIh3IEVFQ9lhIyNTK5/X1jfVAxyQHmjywvaK9xHj0RuDFiqFKSF7RV4oQUhP+g5kyDVV99k/n2gst2c8UTbean879LDzUdD9kbVSE/92RbtbQGjntUhjCaiPuTgs6i4yAWtRqyJlk99u301QstC1MFPEDabSsE9ZfUmtIf6RcqyNqENadr5nhBOawvvbYCrNe0PZTk6hfBnXKwYFClc5izb/qRMMDg3+CLXP09nZsgDOmN53Thf9i84RKBt3QjEJItRdHpvUc1wfMad8ecTyD8IG8Y7AG65WI2ouUYhtdYvbk3BAa4+R4iFehOjC6EGhPMgVMMDA8I5MdHeqdQpYgYI66C4+Puvzx1EX0E0GnExwHvIIasMvn75qtBNRTwf160oyW2OV3dAkxtxDLQofIP7hDX+ZZnkSCWhLmWu4gsJlOYP86ComG+CZ2LDyMCr8FQL/RuZDCkV4JOt6Gq9LZBxQ+GfV/+W6j3YyZKUn5RhlZz+4Eq0EyVQqX1eevqk+Z5eqIsUYN2jU+ZaBU8+VoXKLyFCp3kJzwknqC3NylITfNYhlBMUcAJcaL4woVh7zQEccOLCiK0odHZhEtRgCBs3kmkVOwwioC52p0D3MlXefFtTf6IP7XtVWgon7BVDzlgx1GBHCNI+WVFVmHxThW6Un673HcO3xwaZ05c9HMHnkeoCQxfvQNWZa7sibBcJaPtFS155hVkXNWaa+66yS4vGoWWQdLPifoV9UDNEEtjANPVROkXTh7JL2InZgIaegOCI0LjUmIJwJSfusCtAIpS9nBBVg4RLwalHk0PLa0/IMMKwTyPIu2iovwLxRk2cy1znRM/a/+saRC6AnaA0GjA5CGDjss6OmJHFqDONx3XOCPy3Y3ZvZbNKEPjNHEsMsaq9WHROeQJyshvtNGWBgaJdVbjApjTxLJe6VKIzKY19Qjd2y6B2GCp4Dx9hneKyJ1yS6sG0di2AjmkDrVZ07ZmUr1v80r7/Nq9R+qtmK5q5/QnLw8GlikhcpXfGriFOc3fnzeekNQfmTHeyaI5WSb1br0U5pxwzVGFbKqwqkCF0Pan9i67+e8ChGheZWXX7jHg+Kc4/ImQDPmhb/9BW2Mlihmpp+6puZ498saOB4cGjfDSzmbowfs96l9rBtQ8bLaFBPEM5I69yh3Q8QqusOFpCXC+3ncDLCs/fDSnof5CSiLsEYJF9pI6IC3rA6tca6WMT9xQ1MDXcJh9BOuWp++Nmlpz85nMY/WlwEzZjNJICQnnlXIRGTuMdgCv9CYGZBcyWs8J+dYt8VUp3n2EH76ALbNI0Yqsj2I+rEK2F1XrkfIboOeINvzvPwqTRXjEQkfoi+srVlvRp8ZAqnTI7ggednZ3vSrqW3cZ0JCM5ragqAcnDneDBxBo8EV7aftVQWAEkOOrZDUea5kmimZuTLNbHl7iSlCH+sJ8W9AmclFSgepWPRPCjzlDVAeFp+B8FxvSR5m1QYsZX7/UyktrRdv8Ae4Pxmy4vDHNLnVAQixKEMoDr1g5jg0wsRepK4VJKY= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: eab13c45-d10c-4e19-a796-08daba4ac1c5 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2022 07:45:46.9367 (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: 2BVnkIfd/sBJZUh9+RhGA5MalpT0ROAxodoQzFMISnkd/Igqg69YKUxR59X9oW8jSKy29DlPFJyBm8NBGBvEvA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4289 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-30_02,2022-10-27_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2210300049 X-Proofpoint-ORIG-GUID: sV2DU1DGUAdHtjOnJjA1-bH5F3yaGnuQ X-Proofpoint-GUID: sV2DU1DGUAdHtjOnJjA1-bH5F3yaGnuQ X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Indu Bhagat via Binutils From: Indu Bhagat Reply-To: Indu Bhagat Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748098421423866180?= X-GMAIL-MSGID: =?utf-8?q?1748098421423866180?= From: Weimin Pan [Changes in V3] - Added two new tests with attributes -f(no-)omit-frame-pointer. - Minor adjustments due to buildsystem changes in libsframe. [End of changes in V3] [Changes in V2] - minor changes in filenames in the testsuite. [End of changes in V2] Add tests for backtracing using SFrame section. PS: libsframe/configure has NOT been included in the patch. Please regenerate. ChangeLog: * libsframe/Makefile.in: Regenerated. * libsframe/configure: Regenerated. <-- [REMOVED FROM THE PATCH. PLEASE REGENERATE. ] * libsframe/configure.ac: Check for cross compilation. * libsframe/testsuite/Makefile.in: Regenerated. * libsframe/testsuite/config/default.exp: Load sframe-lib.exp. * libsframe/testsuite/libsframe.decode/Makefile.in: Regenerated. * libsframe/testsuite/libsframe.encode/Makefile.in: Regenerated. * libsframe/testsuite/lib/sframe-lib.exp: New file. Add procedures for handling unwinder tests. * libsframe/testsuite/libsframe.unwind/backtrace.c: New test. * libsframe/testsuite/libsframe.unwind/backtrace.lk: New test. * libsframe/testsuite/libsframe.unwind/inline-cmds.c: New test. * libsframe/testsuite/libsframe.unwind/inline-cmds.lk: New test. * libsframe/testsuite/libsframe.unwind/inline.c: New test. * libsframe/testsuite/libsframe.unwind/inline.lk: New test. * libsframe/testsuite/libsframe.unwind/solib-lib1.c: New test. * libsframe/testsuite/libsframe.unwind/solib-lib2.c: New test. * libsframe/testsuite/libsframe.unwind/solib-main.c: New test. * libsframe/testsuite/libsframe.unwind/solib-main.d: New test. * libsframe/testsuite/libsframe.unwind/solib.exp: New file. * libsframe/testsuite/libsframe.unwind/solib-lib1.h: New test. * libsframe/testsuite/libsframe.unwind/solib-lib2.h: New test. * libsframe/testsuite/libsframe.unwind/tailcall.c: New test. * libsframe/testsuite/libsframe.unwind/tailcall.lk: New test. * libsframe/testsuite/libsframe.unwind/ttest.c: New test. * libsframe/testsuite/libsframe.unwind/ttest.lk: New test. * libsframe/testsuite/libsframe.unwind/unwind.exp: New file. * libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-1.c: Likewise. * libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-1.lk: Likewise. * libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-2.c: Likewise. * libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-2.lk: Likewise. --- libsframe/Makefile.in | 1 + libsframe/configure.ac | 11 + libsframe/testsuite/config/default.exp | 3 + libsframe/testsuite/lib/sframe-lib.exp | 180 +++++++++++++++ .../libsframe.unwind/backtrace-fp-attr-1.c | 109 ++++++++++ .../libsframe.unwind/backtrace-fp-attr-1.lk | 4 + .../libsframe.unwind/backtrace-fp-attr-2.c | 110 ++++++++++ .../libsframe.unwind/backtrace-fp-attr-2.lk | 4 + .../testsuite/libsframe.unwind/backtrace.c | 145 +++++++++++++ .../testsuite/libsframe.unwind/backtrace.lk | 3 + .../testsuite/libsframe.unwind/inline-cmds.c | 136 ++++++++++++ .../testsuite/libsframe.unwind/inline-cmds.lk | 3 + libsframe/testsuite/libsframe.unwind/inline.c | 97 +++++++++ .../testsuite/libsframe.unwind/inline.lk | 3 + .../testsuite/libsframe.unwind/solib-lib1.c | 8 + .../testsuite/libsframe.unwind/solib-lib1.h | 3 + .../testsuite/libsframe.unwind/solib-lib2.c | 51 +++++ .../testsuite/libsframe.unwind/solib-lib2.h | 3 + .../testsuite/libsframe.unwind/solib-main.c | 47 ++++ .../testsuite/libsframe.unwind/solib-main.d | 3 + .../testsuite/libsframe.unwind/solib.exp | 75 +++++++ .../testsuite/libsframe.unwind/tailcall.c | 103 +++++++++ .../testsuite/libsframe.unwind/tailcall.lk | 3 + libsframe/testsuite/libsframe.unwind/ttest.c | 127 +++++++++++ libsframe/testsuite/libsframe.unwind/ttest.lk | 3 + .../testsuite/libsframe.unwind/unwind.exp | 205 ++++++++++++++++++ 26 files changed, 1440 insertions(+) create mode 100644 libsframe/testsuite/lib/sframe-lib.exp create mode 100644 libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-1.c create mode 100644 libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-1.lk create mode 100644 libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-2.c create mode 100644 libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-2.lk create mode 100644 libsframe/testsuite/libsframe.unwind/backtrace.c create mode 100644 libsframe/testsuite/libsframe.unwind/backtrace.lk create mode 100644 libsframe/testsuite/libsframe.unwind/inline-cmds.c create mode 100644 libsframe/testsuite/libsframe.unwind/inline-cmds.lk create mode 100644 libsframe/testsuite/libsframe.unwind/inline.c create mode 100644 libsframe/testsuite/libsframe.unwind/inline.lk create mode 100644 libsframe/testsuite/libsframe.unwind/solib-lib1.c create mode 100644 libsframe/testsuite/libsframe.unwind/solib-lib1.h create mode 100644 libsframe/testsuite/libsframe.unwind/solib-lib2.c create mode 100644 libsframe/testsuite/libsframe.unwind/solib-lib2.h create mode 100644 libsframe/testsuite/libsframe.unwind/solib-main.c create mode 100644 libsframe/testsuite/libsframe.unwind/solib-main.d create mode 100644 libsframe/testsuite/libsframe.unwind/solib.exp create mode 100644 libsframe/testsuite/libsframe.unwind/tailcall.c create mode 100644 libsframe/testsuite/libsframe.unwind/tailcall.lk create mode 100644 libsframe/testsuite/libsframe.unwind/ttest.c create mode 100644 libsframe/testsuite/libsframe.unwind/ttest.lk create mode 100644 libsframe/testsuite/libsframe.unwind/unwind.exp diff --git a/libsframe/Makefile.in b/libsframe/Makefile.in index 3d0b26000db..a96a7102953 100644 --- a/libsframe/Makefile.in +++ b/libsframe/Makefile.in @@ -316,6 +316,7 @@ CFLAGS = @CFLAGS@ COMPAT_DEJAGNU = @COMPAT_DEJAGNU@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CROSS_COMPILE = @CROSS_COMPILE@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ diff --git a/libsframe/configure.ac b/libsframe/configure.ac index 2775fe88b68..038331dba2e 100644 --- a/libsframe/configure.ac +++ b/libsframe/configure.ac @@ -59,6 +59,17 @@ AM_CONDITIONAL([HAVE_COMPAT_DEJAGNU], [test "x$ac_cv_dejagnu_compat" = "xyes"]) COMPAT_DEJAGNU=$ac_cv_dejagnu_compat AC_SUBST(COMPAT_DEJAGNU) +# Determine if we are cross compiling +AC_CANONICAL_HOST +is_cross_compiler= +if test x"${host}" = x"${target}" ; then + is_cross_compiler=no +else + is_cross_compiler=yes +fi +CROSS_COMPILE=$is_cross_compiler +AC_SUBST([CROSS_COMPILE]) + dnl The libsframebt library needs to be built with SFrame info. dnl If the build assembler is not capable of generate SFrame then dnl the library is not built. diff --git a/libsframe/testsuite/config/default.exp b/libsframe/testsuite/config/default.exp index c45e25d3357..29dacbc2917 100644 --- a/libsframe/testsuite/config/default.exp +++ b/libsframe/testsuite/config/default.exp @@ -52,3 +52,6 @@ if {![info exists CFLAGS]} { if {![info exists CFLAGS_FOR_TARGET]} { set CFLAGS_FOR_TARGET $CFLAGS } + +# load the utility procedures +load_lib sframe-lib.exp diff --git a/libsframe/testsuite/lib/sframe-lib.exp b/libsframe/testsuite/lib/sframe-lib.exp new file mode 100644 index 00000000000..d686d27f371 --- /dev/null +++ b/libsframe/testsuite/lib/sframe-lib.exp @@ -0,0 +1,180 @@ +# Support routines for libsframe testsuite. +# Copyright (C) 2022 Free Software Foundation, Inc. +# +# This file is part of the GNU Binutils. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. + +load_file $srcdir/../../ld/testsuite/lib/ld-lib.exp + +set unwind_test_file_name "" + +proc run_native_host_cmd { command } { + global link_output + global ld + + verbose -log "$command" + set run_output "" + try { + set run_output [exec "sh" "-c" "$command" "2>@1"] + set status 0 + } trap CHILDSTATUS {results options} { + set status [lindex [dict get $options -errorcode] 2] + set run_output $results + } + regsub "\n$" $run_output "" run_output + if { [lindex $status 0] != 0 && [string match "" $run_output] } then { + append run_output "child process exited abnormally" + } + + if [string match "" $run_output] then { + return "" + } + + verbose -log "$run_output" + return "$run_output" +} + +# Compile and link a C source file for execution on the host. +proc compile_link_one_host_cc { src output additional_args } { + global CC + global CFLAGS + + return [run_native_host_cmd "./libtool --quiet --tag=CC --mode=link $CC $CFLAGS $src -o $output $additional_args" ] +} + +proc make_unwind_parallel_path { args } { + global objdir + set joiner [list "file" "join" $objdir] + set joiner [concat $joiner $args] + return [eval $joiner] +} + +proc standard_output_file {basename} { + global objdir subdir unwind_test_file_name + + set dir [make_unwind_parallel_path outputs $subdir $unwind_test_file_name] + file mkdir $dir + return [file join $dir $basename] +} + +proc standard_testfile {args} { + global unwind_test_file_name + global subdir + global unwind_test_file_last_vars + + # Outputs. + global testfile binfile + + set testfile $unwind_test_file_name + set binfile [standard_output_file ${testfile}] + + if {[llength $args] == 0} { + set args .c + } + + # Unset our previous output variables. + # This can help catch hidden bugs. + if {[info exists unwind_test_file_last_vars]} { + foreach varname $unwind_test_file_last_vars { + global $varname + catch {unset $varname} + } + } + # 'executable' is often set by tests. + set unwind_test_file_last_vars {executable} + + set suffix "" + foreach arg $args { + set varname srcfile$suffix + global $varname + + # Handle an extension. + if {$arg == ""} { + set arg $testfile.c + } else { + set first [string range $arg 0 0] + if { $first == "." || $first == "-" } { + set arg $testfile$arg + } + } + + set $varname $arg + lappend unwind_test_file_last_vars $varname + + if {$suffix == ""} { + set suffix 2 + } else { + incr suffix + } + } +} + +# Build a shared object DEST from SOURCES. +proc unwind_compile_so {sources dest} { + global CFLAGS + set obj_options $CFLAGS + lappend obj_options "additional_flags=-fPIC -Wa,--gsframe" + + set outdir [file dirname $dest] + set objects "" + foreach source $sources { + set sourcebase [file tail $source] + set object ${outdir}/${sourcebase}.o + + if {[target_compile $source $object object \ + $obj_options] != ""} { + return -1 + } + + lappend objects $object + } + + set link_options "additional_flags=-shared" + + set destbase [file tail $dest] + lappend link_options "additional_flags=-Wl,-soname,$destbase" + + if {[target_compile "${objects}" "${dest}" executable $link_options] != ""} { + catch "exec rm ${objects}" status + return -1 + } + catch "exec rm ${objects}" status + return "" +} + +# Build a binary of TYPE from SOURCE at path DEST. +proc unwind_compile {source dest type options} { + set new_options "" + + foreach opt $options { + if {[regexp {^shlib=(.*)} $opt dummy_var shlib_name] + && $type == "executable"} { + lappend source "-Wl,$shlib_name" + } else { + lappend new_options $opt + } + } + set options $new_options + + verbose "options are $options" + verbose "source is $source $dest $type $options" + + lappend options "additional_flags=-rdynamic -Wa,--gsframe ./.libs/libsframebt.a ./.libs/libsframe.a" + set result [target_compile $source $dest $type $options] + + return $result +} diff --git a/libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-1.c b/libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-1.c new file mode 100644 index 00000000000..d02e916da7b --- /dev/null +++ b/libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-1.c @@ -0,0 +1,109 @@ +/* Copyright (C) 2022 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* This is a revised version of gdb/testsuite/gdb.base/backtrace.c. */ + +#ifdef __has_attribute +# if !__has_attribute (noclone) +# define ATTRIBUTE_NOCLONE +# endif +#endif +#ifndef ATTRIBUTE_NOCLONE +# define ATTRIBUTE_NOCLONE __attribute__((noclone)) +#endif + +#include +#include +#include +#include +#include +#include "sframe-backtrace-api.h" + +#define BT_BUF_SIZE 100 + +#define BT_EXPECTED_NPTRS 5 +/* Expected funclist. */ +static const char *const func_list[] = +{ + "show_bt", + "baz", + "bar", + "foo", + "main" +}; + +void __attribute__((__noinline__,__optimize__("omit-frame-pointer"))) ATTRIBUTE_NOCLONE +show_bt () +{ + void *buffer[BT_BUF_SIZE]; + int j, nptrs, err; + char **strings; + + /* Call the unwinder to get an array of return addresses. */ + nptrs = sframe_backtrace (buffer, BT_BUF_SIZE, &err); + if (err) + { + printf ("SFrame error: %s (%d)\n", sframe_bt_errmsg (err), nptrs); + return; + } + if (nptrs != BT_EXPECTED_NPTRS) + { + printf ("Backtace nptrs mismatch: expected = %d, generated = %d \n", + BT_EXPECTED_NPTRS, nptrs); + return; + } + + /* Get these addresses symbolically. */ + strings = backtrace_symbols (buffer, nptrs); + if (strings == NULL) { + perror ("backtrace_symbols"); + exit (EXIT_FAILURE); + } + + /* Verify the results. */ + for (j = 0; j < nptrs; j++) + if (!strstr (strings[j], func_list[j])) + break; + + free(strings); + + printf ("%s: backtrace with omit-frame-pointer attr\n", + (j == nptrs) ? "PASS" : "FAIL"); +} + +int __attribute__((__noinline__)) ATTRIBUTE_NOCLONE +baz () +{ + show_bt (); + return 0; +} + +int __attribute__((__noinline__)) ATTRIBUTE_NOCLONE +bar () +{ + return baz (); +} + +int __attribute__((__noinline__)) ATTRIBUTE_NOCLONE +foo () +{ + return bar (); +} + +int __attribute__((__noinline__)) ATTRIBUTE_NOCLONE +main () +{ + return foo (); +} diff --git a/libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-1.lk b/libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-1.lk new file mode 100644 index 00000000000..a26ef7e2d2e --- /dev/null +++ b/libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-1.lk @@ -0,0 +1,4 @@ +# source: backtrace-fp-attr-1.c +# cflags: -fno-omit-frame-pointer +# link: on +PASS: backtrace with omit-frame-pointer attr diff --git a/libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-2.c b/libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-2.c new file mode 100644 index 00000000000..6ac80b73b5d --- /dev/null +++ b/libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-2.c @@ -0,0 +1,110 @@ +/* Copyright (C) 2022 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* This is a revised version of gdb/testsuite/gdb.base/backtrace.c. */ + +#ifdef __has_attribute +# if !__has_attribute (noclone) +# define ATTRIBUTE_NOCLONE +# endif +#endif +#ifndef ATTRIBUTE_NOCLONE +# define ATTRIBUTE_NOCLONE __attribute__((noclone)) +#endif + +#include +#include +#include +#include +#include +#include "sframe-backtrace-api.h" + +#define BT_BUF_SIZE 100 + +#define BT_EXPECTED_NPTRS 5 + +/* Expected funclist. */ +static const char *const func_list[] = +{ + "show_bt", + "baz", + "bar", + "foo", + "main" +}; + +void __attribute__((__noinline__,__optimize__("no-omit-frame-pointer"))) ATTRIBUTE_NOCLONE +show_bt () +{ + void *buffer[BT_BUF_SIZE]; + int j, nptrs, err; + char **strings; + + /* Call the unwinder to get an array of return addresses. */ + nptrs = sframe_backtrace (buffer, BT_BUF_SIZE, &err); + if (err) + { + printf ("SFrame error: %s (%d)\n", sframe_bt_errmsg (err), nptrs); + return; + } + if (nptrs != BT_EXPECTED_NPTRS) + { + printf ("Backtace nptrs mismatch: expected = %d, generated = %d \n", + BT_EXPECTED_NPTRS, nptrs); + return; + } + + /* Get these addresses symbolically. */ + strings = backtrace_symbols (buffer, nptrs); + if (strings == NULL) { + perror ("backtrace_symbols"); + exit (EXIT_FAILURE); + } + + /* Verify the results. */ + for (j = 0; j < nptrs; j++) + if (!strstr (strings[j], func_list[j])) + break; + + free(strings); + + printf ("%s: backtrace with no-omit-frame-pointer attr\n", + (j == nptrs) ? "PASS" : "FAIL"); +} + +int __attribute__((__noinline__)) ATTRIBUTE_NOCLONE +baz () +{ + show_bt (); + return 0; +} + +int __attribute__((__noinline__)) ATTRIBUTE_NOCLONE +bar () +{ + return baz (); +} + +int __attribute__((__noinline__)) ATTRIBUTE_NOCLONE +foo () +{ + return bar (); +} + +int __attribute__((__noinline__)) ATTRIBUTE_NOCLONE +main () +{ + return foo (); +} diff --git a/libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-2.lk b/libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-2.lk new file mode 100644 index 00000000000..97f49ef8c43 --- /dev/null +++ b/libsframe/testsuite/libsframe.unwind/backtrace-fp-attr-2.lk @@ -0,0 +1,4 @@ +# source: backtrace-fp-attr-2.c +# cflags: -fomit-frame-pointer +# link: on +PASS: backtrace with no-omit-frame-pointer attr diff --git a/libsframe/testsuite/libsframe.unwind/backtrace.c b/libsframe/testsuite/libsframe.unwind/backtrace.c new file mode 100644 index 00000000000..072cb2f8f08 --- /dev/null +++ b/libsframe/testsuite/libsframe.unwind/backtrace.c @@ -0,0 +1,145 @@ +/* Copyright (C) 2022 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* This is a revised version of gdb/testsuite/gdb.base/backtrace.c. */ + +#ifdef __has_attribute +# if !__has_attribute (noclone) +# define ATTRIBUTE_NOCLONE +# endif +#endif +#ifndef ATTRIBUTE_NOCLONE +# define ATTRIBUTE_NOCLONE __attribute__((noclone)) +#endif + +#include +#include +#include +#include +#include +#include "sframe-backtrace-api.h" + +#define BT_BUF_SIZE 100 + +/* Expected funclist. */ +static const char *const func_list[] = +{ + "show_bt", + "baz", + "bar", + "foo", + "main" +}; + +void __attribute__((__noinline__,__noclone__)) +show_bt () +{ + void *buffer[BT_BUF_SIZE]; + int j, nptrs, err; + char **strings; + + /* Call the unwinder to get an array of return addresses. */ + nptrs = sframe_backtrace (buffer, BT_BUF_SIZE, &err); + if (nptrs != 5) + { + printf ("SFrame error: %s (%d)\n", sframe_bt_errmsg (err), nptrs); + return; + } + + /* Get these addresses symbolically. */ + strings = backtrace_symbols (buffer, nptrs); + if (strings == NULL) { + perror("backtrace_symbols"); + exit(EXIT_FAILURE); + } + + /* Verify the results. */ + for (j = 0; j < nptrs; j++) + if (!strstr (strings[j], func_list[j])) + break; + + free(strings); + + printf ("%s: backtrace test\n", j == nptrs ? "PASS" : "FAIL"); +} + +int __attribute__((__noinline__,__noclone__)) +baz () +{ + void *buffer[BT_BUF_SIZE]; + int nptrs, err; + + /* Call the unwinder to get an array of return addresses. */ + nptrs = sframe_backtrace (buffer, BT_BUF_SIZE, &err); + if (nptrs == -1) + { + printf ("SFrame error: %s (%d)\n", sframe_bt_errmsg (err), nptrs); + return -1; + } + + show_bt (); + return 0; +} + +int __attribute__((__noinline__,__noclone__)) +bar () +{ + void *buffer[BT_BUF_SIZE]; + int nptrs, err; + + /* Call the unwinder to get an array of return addresses. */ + nptrs = sframe_backtrace (buffer, BT_BUF_SIZE, &err); + if (nptrs == -1) + { + printf ("SFrame error: %s (%d)\n", sframe_bt_errmsg (err), nptrs); + return -1; + } + + return baz (); +} + +int __attribute__((__noinline__,__noclone__)) +foo () +{ + void *buffer[BT_BUF_SIZE]; + int nptrs, err; + + /* Call the unwinder to get an array of return addresses. */ + nptrs = sframe_backtrace (buffer, BT_BUF_SIZE, &err); + if (nptrs == -1) + { + printf ("SFrame error: %s (%d)\n", sframe_bt_errmsg (err), nptrs); + return -1; + } + + return bar (); +} + +int __attribute__((__noinline__,__noclone__)) +main () +{ + void *buffer[BT_BUF_SIZE]; + int nptrs, err; + + /* Call the unwinder to get an array of return addresses. */ + nptrs = sframe_backtrace (buffer, BT_BUF_SIZE, &err); + if (nptrs == -1) + { + printf ("SFrame error: %s (%d)\n", sframe_bt_errmsg (err), nptrs); + return -1; + } + + return foo (); +} diff --git a/libsframe/testsuite/libsframe.unwind/backtrace.lk b/libsframe/testsuite/libsframe.unwind/backtrace.lk new file mode 100644 index 00000000000..fdc78ebe34d --- /dev/null +++ b/libsframe/testsuite/libsframe.unwind/backtrace.lk @@ -0,0 +1,3 @@ +# source: backtrace.c +# link: on +PASS: backtrace test diff --git a/libsframe/testsuite/libsframe.unwind/inline-cmds.c b/libsframe/testsuite/libsframe.unwind/inline-cmds.c new file mode 100644 index 00000000000..a6ceb50a956 --- /dev/null +++ b/libsframe/testsuite/libsframe.unwind/inline-cmds.c @@ -0,0 +1,136 @@ +/* Copyright (C) 2022 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* This is only ever run if it is compiled with a new-enough GCC, but + we don't want the compilation to fail if compiled by some other + compiler. */ + +/* This is a revised version of gdb/testsuite/gdb.opt/inline-cmds.c. */ + +#ifdef __GNUC__ +#define ATTR __attribute__((always_inline)) +#else +#define ATTR +#endif + +#include +#include +#include +#include +#include +#include "sframe-backtrace-api.h" + +#define BT_BUF_SIZE 10 + +int x, y; +volatile int z = 0; +volatile int result; + +void bar(void); +void marker(void); +void noinline(void); + +inline ATTR int func1(void) +{ + bar (); + return x * y; +} + +inline ATTR int func2(void) +{ + return x * func1 (); +} + +inline ATTR void func3(void) +{ + bar (); +} + +inline ATTR void outer_inline1(void) +{ + noinline (); +} + +inline ATTR void outer_inline2(void) +{ + outer_inline1 (); +} + +int main (void) +{ /* start of main */ + int val; + + x = 7; + y = 8; + + outer_inline2 (); + + return 0; +} + + +/* funclist for inline-cmds. */ +const char *const func_list[] = +{ + "noinline", + "main" +}; + +void bar(void) +{ + x += y; +} + +void marker(void) +{ + x += y - z; +} + +inline ATTR void inlined_fn(void) +{ + x += y + z; + + void *buffer[BT_BUF_SIZE]; + char **strings; + /* Call the unwinder to get an array of return addresses. */ + int j, err; + int nptrs = sframe_backtrace (buffer, BT_BUF_SIZE, &err); + if (nptrs == -1 || nptrs != 2) + { + printf ("SFrame error: %s (%d)\n", sframe_bt_errmsg (err), nptrs); + return; + } + + /* Get these addresses symbolically. */ + strings = backtrace_symbols (buffer, nptrs); + if (strings == NULL) + { + perror("backtrace_symbols"); + exit(EXIT_FAILURE); + } + + /* Verify the results. */ + for (j = 0; j < nptrs; j++) + if (!strstr (strings[j], func_list[j])) + break; + + free(strings); + printf ("%s: inline-cmds test\n", j == nptrs ? "PASS" : "FAIL"); +} + +void noinline(void) +{ + inlined_fn (); /* inlined */ +} diff --git a/libsframe/testsuite/libsframe.unwind/inline-cmds.lk b/libsframe/testsuite/libsframe.unwind/inline-cmds.lk new file mode 100644 index 00000000000..053b66bd683 --- /dev/null +++ b/libsframe/testsuite/libsframe.unwind/inline-cmds.lk @@ -0,0 +1,3 @@ +# source: inline-cmds.c +# link: on +PASS: inline-cmds test diff --git a/libsframe/testsuite/libsframe.unwind/inline.c b/libsframe/testsuite/libsframe.unwind/inline.c new file mode 100644 index 00000000000..86c93136b9a --- /dev/null +++ b/libsframe/testsuite/libsframe.unwind/inline.c @@ -0,0 +1,97 @@ +/* Copyright (C) 2022 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* This is a revised version of gdb/testsuite/gdb.opt/inline-bt.c. */ + +#include +#include +#include +#include +#include +#include "sframe-backtrace-api.h" + +#define ATTR __attribute__((always_inline)) + +#define BT_BUF_SIZE 32 + +int x, y; +volatile int z = 0; +volatile int result; + +/* funclist. */ +const char *const flist[] = +{ + "main" +}; + +void bar(void) +{ + x += y; +} + +inline ATTR int func1(void) +{ + bar (); + return x * y; +} + +inline ATTR int func2(void) +{ + void *buffer[BT_BUF_SIZE]; + int ok = 0, nptrs, err; + char **strings; + + /* Call the unwinder to get an array of return addresses. */ + nptrs = sframe_backtrace (buffer, BT_BUF_SIZE, &err); + if (nptrs == -1) + { + printf ("SFrame error: %s\n", sframe_bt_errmsg (err)); + return -1; + } + + /* Get these addresses symbolically. */ + strings = backtrace_symbols (buffer, nptrs); + if (strings == NULL) { + perror("backtrace_symbols"); + exit(EXIT_FAILURE); + } + + /* Verify the results. */ + if (nptrs == 1 && strstr (strings[0], flist[0])) + ok = 1; + + free(strings); + + printf ("%s: unwind test\n", ok == 1 ? "PASS" : "FAIL"); + + return x * func1 (); +} + +int main (void) +{ + int val; + + x = 7; + y = 8; + bar (); + + val = func1 (); + result = val; + + val = func2 (); + result = val; + + return 0; +} diff --git a/libsframe/testsuite/libsframe.unwind/inline.lk b/libsframe/testsuite/libsframe.unwind/inline.lk new file mode 100644 index 00000000000..88f846b0fce --- /dev/null +++ b/libsframe/testsuite/libsframe.unwind/inline.lk @@ -0,0 +1,3 @@ +# source: inline.c +# link: on +PASS: unwind test diff --git a/libsframe/testsuite/libsframe.unwind/solib-lib1.c b/libsframe/testsuite/libsframe.unwind/solib-lib1.c new file mode 100644 index 00000000000..16c77ca53c4 --- /dev/null +++ b/libsframe/testsuite/libsframe.unwind/solib-lib1.c @@ -0,0 +1,8 @@ +#include "solib-lib1.h" + +unsigned int +adder(unsigned int a, unsigned int b, int (*call)(int)) +{ + (void)(*call)(a+b); + return (a+b); +} diff --git a/libsframe/testsuite/libsframe.unwind/solib-lib1.h b/libsframe/testsuite/libsframe.unwind/solib-lib1.h new file mode 100644 index 00000000000..d40eac0769c --- /dev/null +++ b/libsframe/testsuite/libsframe.unwind/solib-lib1.h @@ -0,0 +1,3 @@ +#include + +extern unsigned int adder(unsigned int a, unsigned int b, int (*call)(int)); diff --git a/libsframe/testsuite/libsframe.unwind/solib-lib2.c b/libsframe/testsuite/libsframe.unwind/solib-lib2.c new file mode 100644 index 00000000000..310b9c0ab89 --- /dev/null +++ b/libsframe/testsuite/libsframe.unwind/solib-lib2.c @@ -0,0 +1,51 @@ +#include +#include +#include +#include "sframe-backtrace-api.h" +#include "solib-lib2.h" + +#define BT_BUF_SIZE 100 + +/* funclist for running "ttest.x 3". */ +static const char *const bt_list[] = +{ + "adder2", + "bar", + "adder", + "main" +}; + +unsigned int +adder2 (unsigned int a, unsigned int b, int (*call)(int)) +{ + void *buffer[BT_BUF_SIZE]; + int i, nptrs, err; + char **strings; + + nptrs = sframe_backtrace (buffer, BT_BUF_SIZE, &err); + if (nptrs == -1 || nptrs != 4) + { +/* printf ("bcktrace failed: %d %d\n", nptrs, err); */ + printf ("SFrame error: %s\n", sframe_bt_errmsg (err)); + return(-1); + } + + strings = backtrace_symbols (buffer, nptrs); + if (strings == NULL) + { + perror("backtrace_symbols"); + return(-1); + } + + /* Verify the results. */ + for (i = 0; i < nptrs; i++) + if (!strstr (strings[i], bt_list[i])) + break; + + free (strings); + + printf ("%s: unwind solib test\n", i == nptrs ? "PASS" : "FAIL"); + + (void)(*call) (a+b); + return (a+b); +} diff --git a/libsframe/testsuite/libsframe.unwind/solib-lib2.h b/libsframe/testsuite/libsframe.unwind/solib-lib2.h new file mode 100644 index 00000000000..61b72122771 --- /dev/null +++ b/libsframe/testsuite/libsframe.unwind/solib-lib2.h @@ -0,0 +1,3 @@ +#include + +extern unsigned int adder2(unsigned int a, unsigned int b, int (*call)(int)); diff --git a/libsframe/testsuite/libsframe.unwind/solib-main.c b/libsframe/testsuite/libsframe.unwind/solib-main.c new file mode 100644 index 00000000000..9215b95f759 --- /dev/null +++ b/libsframe/testsuite/libsframe.unwind/solib-main.c @@ -0,0 +1,47 @@ +/* Copyright (C) 2022 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include +#include +#include +#include +#include "sframe-backtrace-api.h" +#include "solib-lib1.h" +#include "solib-lib2.h" + +#define BT_BUF_SIZE 100 + +int foo (int x) +{ + return ++x; +} + +int bar (int x) +{ + x = adder2 (x, x+1, foo); + + return ++x; +} + +int main (void) +{ + unsigned int a = 1; + unsigned int b = 2; + unsigned int result = 0; + + result = adder (a,b, bar); + + return 0; +} diff --git a/libsframe/testsuite/libsframe.unwind/solib-main.d b/libsframe/testsuite/libsframe.unwind/solib-main.d new file mode 100644 index 00000000000..483ded5a1e5 --- /dev/null +++ b/libsframe/testsuite/libsframe.unwind/solib-main.d @@ -0,0 +1,3 @@ +# source: solib-main.c +# link: on +PASS: unwind solib test diff --git a/libsframe/testsuite/libsframe.unwind/solib.exp b/libsframe/testsuite/libsframe.unwind/solib.exp new file mode 100644 index 00000000000..2690ab6ae17 --- /dev/null +++ b/libsframe/testsuite/libsframe.unwind/solib.exp @@ -0,0 +1,75 @@ +# Copyright 2022 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Run the test only if sframebt library exists. +if [catch "exec ls $objdir/.libs/libsframebt.la" status] then { + return; +} + +# Run the tests only if we are not cross compiling. +if [string equal $CROSS_COMPILE "yes"] { + return; +} + +set experimental "" + +# Shared object files. +set libname1 "solib-lib1" +set srcfile_lib1 ${srcdir}/${subdir}/${libname1}.c +set binfile_lib1 ${objdir}/${libname1}.so +set libname2 "solib-lib2" +set srcfile_lib2 ${srcdir}/${subdir}/${libname2}.c +set binfile_lib2 ${objdir}/${libname2}.so + +# Binary file. +set testfile "solib-main" +set srcfile ${srcdir}/${subdir}/${testfile}.c +set binfile [standard_output_file ${testfile}] +set bin_flags [list debug shlib=${binfile_lib1} shlib=${binfile_lib2}] + +if { [unwind_compile_so ${srcfile_lib1} ${binfile_lib1}] != "" + || [unwind_compile_so ${srcfile_lib2} ${binfile_lib2}] != "" + || [unwind_compile ${srcfile} ${binfile} executable $bin_flags] != "" } { + untested "failed to compile" + return -1 +} + +if {[info exists env(LD_LIBRARY_PATH)]} { + set old_ld_lib $env(LD_LIBRARY_PATH) +} +set env(LD_LIBRARY_PATH) "${objdir}" + +set solib_output "${binfile} ${binfile_lib1} ${binfile_lib2}" +set results [run_host_cmd ${binfile} $solib_output] + +set f [open "tmpdir/solib.out" "w"] +puts $f $results +close $f + +if { [regexp_diff "tmpdir/solib.out" "${srcdir}/${subdir}/${testfile}.d"] } then { + fail "$test_name" +} else { + pass "$test_name" +} + +catch "exec rm ${binfile_lib1}" status +catch "exec rm ${binfile_lib2}" status +catch "exec rm tmpdir/solib.out" status + +if {[info exists old_ld_lib]} { + set env(LD_LIBRARY_PATH) $old_ld_lib +} else { + unset env(LD_LIBRARY_PATH) +} diff --git a/libsframe/testsuite/libsframe.unwind/tailcall.c b/libsframe/testsuite/libsframe.unwind/tailcall.c new file mode 100644 index 00000000000..7ffa728a27e --- /dev/null +++ b/libsframe/testsuite/libsframe.unwind/tailcall.c @@ -0,0 +1,103 @@ +/* Copyright (C) 2022 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include +#include +#include +#include +#include +#include "sframe-backtrace-api.h" + +#ifdef __has_attribute +# if !__has_attribute (noclone) +# define ATTRIBUTE_NOCLONE +# endif +#endif +#ifndef ATTRIBUTE_NOCLONE +# define ATTRIBUTE_NOCLONE __attribute__((noclone)) +#endif + +#define BT_BUF_SIZE 16 + +/* funclist for running tailcall. */ +const char *const func_list[] = +{ + "show_bt", + "dec", + "dec", + "main" +}; + +void show_bt () +{ + void *buffer[BT_BUF_SIZE]; + int j, nptrs, err; + char **strings; + + /* Call the unwinder to get an array of return addresses. */ + nptrs = sframe_backtrace (buffer, BT_BUF_SIZE, &err); + if (nptrs == -1 || nptrs != 4) + { + printf ("SFrame error: %s (%d)\n", sframe_bt_errmsg (err), nptrs); + return; + } + + /* Get these addresses symbolically. */ + strings = backtrace_symbols (buffer, nptrs); + if (strings == NULL) { + perror("backtrace_symbols"); + exit(EXIT_FAILURE); + } + + /* Verify the results. */ + for (j = 0; j < nptrs; j++) + if (!strstr (strings[j], func_list[j])) + break; + + free(strings); + + printf ("%s: tailcall test\n", j == nptrs ? "PASS" : "FAIL"); +} + +/* An example of tail recursive function. */ +void __attribute__((__noinline__,__noclone__)) +dec (int n) +{ + void *buffer[BT_BUF_SIZE]; + int nptrs, err; + + /* Call the unwinder to get an array of return addresses. */ + nptrs = sframe_backtrace (buffer, BT_BUF_SIZE, &err); + if (nptrs == -1) + { + printf ("SFrame error: %s (%d)\n", sframe_bt_errmsg (err), nptrs); + return; + } + + if (n < 0) + return; + + if (n == 2) + show_bt (); + + /* The last executed statement is recursive call. */ + dec (n-1); +} + +int +main (void) +{ + dec (3); +} diff --git a/libsframe/testsuite/libsframe.unwind/tailcall.lk b/libsframe/testsuite/libsframe.unwind/tailcall.lk new file mode 100644 index 00000000000..3d7ab98ddba --- /dev/null +++ b/libsframe/testsuite/libsframe.unwind/tailcall.lk @@ -0,0 +1,3 @@ +# source: tailcall.c +# link: on +PASS: tailcall test diff --git a/libsframe/testsuite/libsframe.unwind/ttest.c b/libsframe/testsuite/libsframe.unwind/ttest.c new file mode 100644 index 00000000000..5e245db93c9 --- /dev/null +++ b/libsframe/testsuite/libsframe.unwind/ttest.c @@ -0,0 +1,127 @@ +/* Copyright (C) 2022 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* This is the revised version of the example in "man backtrace". */ + +#include +#include +#include +#include +#include +#include "sframe-backtrace-api.h" + +#ifdef __has_attribute +# if !__has_attribute (noclone) +# define ATTRIBUTE_NOCLONE +# endif +#endif +#ifndef ATTRIBUTE_NOCLONE +# define ATTRIBUTE_NOCLONE __attribute__((noclone)) +#endif + +#define BT_BUF_SIZE 100 + +/* funclist */ +static const char *const func_list[] = +{ + "myfunc3", + "()", + "myfunc", + "myfunc", + "myfunc", + "main" +}; + +void myfunc3 (void) +{ + void *buffer[BT_BUF_SIZE]; + int j, nptrs, err; + char **strings; + + /* Call the unwinder to get an array of return addresses. */ + nptrs = sframe_backtrace (buffer, BT_BUF_SIZE, &err); + if (nptrs == -1 || nptrs != 6) + { + printf ("SFrame error: %s (%d)\n", sframe_bt_errmsg (err), nptrs); + return; + } + + /* Get these addresses symbolically. */ + strings = backtrace_symbols (buffer, nptrs); + if (strings == NULL) { + perror("backtrace_symbols"); + exit(EXIT_FAILURE); + } + + /* Verify the results. */ + for (j = 0; j < nptrs; j++) + if (!strstr (strings[j], func_list[j])) + break; + + free(strings); + + printf ("%s: unwind test\n", j == nptrs ? "PASS" : "FAIL"); +} + +static void __attribute__((__noinline__,__noclone__)) +/* "static" means don't export the symbol. */ +myfunc2 (void) +{ + void *buffer[BT_BUF_SIZE]; + int nptrs, err; + + /* Call the unwinder to get an array of return addresses. */ + nptrs = sframe_backtrace (buffer, BT_BUF_SIZE, &err); + if (nptrs == -1) + { + printf ("SFrame error: %s (%d)\n", sframe_bt_errmsg (err), nptrs); + return; + } + + myfunc3 (); +} + +void __attribute__((__noinline__,__noclone__)) +myfunc (int ncalls) +{ + void *buffer[BT_BUF_SIZE]; + int nptrs, err; + + /* Call the unwinder to get an array of return addresses. */ + nptrs = sframe_backtrace (buffer, BT_BUF_SIZE, &err); + if (nptrs == -1) + { + printf ("SFrame error: %s (%d)\n", sframe_bt_errmsg (err), nptrs); + return; + } + + if (ncalls > 1) + myfunc (ncalls - 1); + else + myfunc2 (); +} + +int +main (int argc, char *argv[]) +{ + int cnt; + if (argc != 2) { + cnt = 3; + } + else + cnt = atoi(argv[1]); + myfunc (cnt); + exit (EXIT_SUCCESS); +} diff --git a/libsframe/testsuite/libsframe.unwind/ttest.lk b/libsframe/testsuite/libsframe.unwind/ttest.lk new file mode 100644 index 00000000000..80aa2241402 --- /dev/null +++ b/libsframe/testsuite/libsframe.unwind/ttest.lk @@ -0,0 +1,3 @@ +# source: ttest.c +# link: on +PASS: unwind test diff --git a/libsframe/testsuite/libsframe.unwind/unwind.exp b/libsframe/testsuite/libsframe.unwind/unwind.exp new file mode 100644 index 00000000000..4169eef1f09 --- /dev/null +++ b/libsframe/testsuite/libsframe.unwind/unwind.exp @@ -0,0 +1,205 @@ +# Copyright (C) 2022 Free Software Foundation, Inc. +# +# This file is part of the GNU Binutils. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. +# + +# Run the tests only if sframebt library exists. + +if [catch "exec ls $objdir/.libs/libsframebt.la" status] then { + verbose -log "$objdir/.libs/libsframebt.la not found."; + verbose -log "Skipping SFrame unwind tests"; + return; +} + +# Run the tests only if we are not cross compiling. +if [string equal $CROSS_COMPILE "yes"] { + return; +} + +if {[info exists env(LC_ALL)]} { + set old_lc_all $env(LC_ALL) +} +set env(LC_ALL) "C" + +proc run_unwind_test { name } { + global CC + global CFLAGS + global copyfile env runtests srcdir subdir verbose + + # Append additional flags for unwinder to work properly + set unwind_cflags "-Wa,--gsframe -rdynamic " + + if ![runtest_file_p $runtests $name] then { + return + } + + if [string match "*/*" $name] { + set file $name + set name [file tail $name] + } else { + set file "$srcdir/$subdir/$name" + } + + set opt_array [slurp_options "${file}.lk"] + if { $opt_array == -1 } { + perror "error reading options from $file.lk" + unresolved $subdir/$name + return + } + set run_ld 0 + set shared "-shared" + set opts(cflags) {} + set opts(link) {} + set opts(link_flags) {} + set opts(nonshared) {} + set opts(unwind) {} + set opts(name) {} + set opts(source) {} + set opts(xfail) {} + + foreach i $opt_array { + set opt_name [lindex $i 0] + set opt_val [lindex $i 1] + if { $opt_name == "" } { + set in_extra 1 + continue + } + if ![info exists opts($opt_name)] { + perror "unknown option $opt_name in file $file.lk" + unresolved $subdir/$name + return + } + + set opts($opt_name) [concat $opts($opt_name) $opt_val] + } + + if { [llength $opts(unwind)] == 0 } { + set opts(unwind) "$file.c" + } else { + set opts(unwind) "[file dirname $file]/$opts(unwind)" + } + + if { [llength $opts(name)] == 0 } { + set opts(name) $opts(unwind) + } + + if { [llength $opts(cflags)] != 0 } { + append unwind_cflags $opts(cflags) + } + + if { [llength $opts(link)] != 0 + || [llength $opts(source)] > 1 } { + set run_ld 1 + } + + if { [llength $opts(nonshared)] != 0 } { + set shared "" + } + + set testname $opts(name) + if { $opts(name) == "" } { + set testname "$subdir/$name" + } + + # Compile and link the unwind program. + set comp_output [compile_link_one_host_cc $opts(unwind) "tmpdir/test_x" "./.libs/libsframebt.la ./.libs/libsframe.la"] + + if { $comp_output != ""} { + send_log "compilation of unwind program $opts(unwind) failed with <$comp_output>" + perror "compilation of unwind program $opts(unwind) failed" + fail $testname + return 0 + } + + # Compile the inputs and posibly link them together. + + set unwind "" + if { [llength $opts(source)] > 0 } { + set unwind "" + if { $run_ld } { + set unwind_output "tmpdir/test_x ./.libs/libsframebt.a ./.libs/libsframe.a" + # set unwind_output "tmpdir/out.so" + # set unwind_flags "-fPIC $shared $opts(link_flags)" + } else { + set unwind_output "tmpdir/out.o" + # set unwind_flags "-fPIC -c" + } + if [board_info [target_info name] exists cflags] { + append unwind_flags " [board_info [target_info name] cflags]" + } + if [board_info [target_info name] exists ldflags] { + append unwind_flags " [board_info [target_info name] ldflags]" + } + set src {} + foreach sfile $opts(source) { + if [is_remote host] { + lappend src [remote_download host [file join [file dirname $file] $sfile]] + } else { + lappend src [file join [file dirname $file] $sfile] + } + } + + set comp_output [run_host_cmd "$CC" "$CFLAGS $unwind_cflags [concat $src] -o $unwind_output"] + + if { $comp_output != ""} { + send_log "compilation of SFrame test program [concat $src] failed with <$comp_output>" + fail $testname + return 0 + } + } + + # Time to setup xfailures. + foreach targ $opts(xfail) { + if [match_target $targ] { + setup_xfail "*-*-*" + break + } + } + + # Invoke the unwind program on the outputs. + + verbose -log "$srcdir" + set results [run_host_cmd tmpdir/test_x $unwind_output] + + set f [open "tmpdir/test_x.out" "w"] + puts $f $results + close $f + + if { [regexp_diff "tmpdir/test_x.out" "${file}.lk"] } then { + fail $testname + if { $verbose == 2 } then { verbose "output is [file_contents tmpdir/test_x.out]" 2 } + return 0 + } + + pass $testname + return 0 +} + +set sframe_test_list [lsort [glob -nocomplain $srcdir/$subdir/*.lk]] + +foreach sframe_test $sframe_test_list { + verbose [file rootname $sframe_test] + verbose running unwind test on $sframe_test + run_unwind_test [file rootname $sframe_test] +} + +if {[info exists old_lc_all]} { + set env(LC_ALL) $old_lc_all +} else { + unset env(LC_ALL) +} From patchwork Sun Oct 30 07:44:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 12964 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1688592wru; Sun, 30 Oct 2022 00:56:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6wr1E1y9B23f8OZhR55xOE1opO/YhEdhUtokwylHPzfHXTQ4Ao0csJ8zNOj29jXOjHKSHe X-Received: by 2002:a17:907:3f96:b0:7ab:34aa:9094 with SMTP id hr22-20020a1709073f9600b007ab34aa9094mr7197278ejc.85.1667116608674; Sun, 30 Oct 2022 00:56:48 -0700 (PDT) Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id gn20-20020a1709070d1400b00757bd7f53dcsi3954500ejc.14.2022.10.30.00.56.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 00:56:48 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=G6QPYCVt; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8E9683857C79 for ; Sun, 30 Oct 2022 07:53:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8E9683857C79 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667116432; bh=Gr6jvu8tvMOvTjGudJz7Rmn/c6iYqX8YCRZYAuKInB4=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=G6QPYCVt+2EQj9bqu/sAGjr3Wfn5RIjgtpE0mQkLH8YGq2LQsN6UTEedHu+fqlKpq x+OKZE8V9HTtVUpP4L3HkPqXPC4YY53swpOZp1fSBmUhxZYMKPOjU3gHWA1dElPQqD rtlB64WEYGji2d2lH9GDGOXztatzUQEImipaabK0= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 7F56E385618D for ; Sun, 30 Oct 2022 07:45:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7F56E385618D 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 29TKLkQ7024048 for ; Sun, 30 Oct 2022 07:45:53 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 3kgv2a99tv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:45:53 +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 29U5TulO019443 for ; Sun, 30 Oct 2022 07:45:51 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2170.outbound.protection.outlook.com [104.47.59.170]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kgtm89dcq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:45:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PCGrCmsjgb1PG31mHfFOlzXG1khE2txQwjbYiNqAWVJ4VGIxSaERx9dKovWqQijbBE8BOTNJwwBpFusSdjO12DLjrX8kk4YXAqAkdbwgqS3jDYMzxPJIX6wIvmXYvd98TCKmt3KZxoG6LtdScI2LHYsO88nvb25IDJFedQLaa9FFLNWUCyWthzl7R8V0CKtZDKg73OBMTw6N/ajdTdX8m8Hfm80MMR2LNScmMHSlqtMMvcMRyOY+o8sA18UEo5vokI458ISWx6Q+cy/S1GkNFsMKSik4GhBGUDVZMT7dWonjdUWSwPirh3cskp74ji+TTjJOfc1bwmpCsoGbLpmDvA== 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=Gr6jvu8tvMOvTjGudJz7Rmn/c6iYqX8YCRZYAuKInB4=; b=Y6LE2ZD91jsjnKQhjSUkdr417l1unYa+pKg9UfDPHkIQwp+Wus9rkIL7hCZD+GQzHMXPm1gKI3ypql1vQ5vxE+kQ/Qxrzj863Xp9lM9jBFCbaOqjZ1iNcrxodY8GLBPZWbbZLMNseix9MvW7vD0a+x79MYkdoZKLyV4aYI5vXhVmHnZap3eDDTQMGGYGJ0+hYVagk6GjwMt6Yu3G32rCP/HtqP/CDWEKasP1BLF6U82i3HXirVlm4ZGxaQh7KP8KdsiwP/WW+WvDv68PmAMQUM3bmqU1qjGOdPrF/vK14PgQT60kiW19CMq4MHIH5YkK9v2NvfOyZmyxVKYuwNZfNw== 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 MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by BY5PR10MB4289.namprd10.prod.outlook.com (2603:10b6:a03:20c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.19; Sun, 30 Oct 2022 07:45:50 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2%7]) with mapi id 15.20.5723.033; Sun, 30 Oct 2022 07:45:50 +0000 To: binutils@sourceware.org Subject: [PATCH, V3 10/15] gdb: sim: buildsystem changes to accommodate libsframe Date: Sun, 30 Oct 2022 00:44:45 -0700 Message-Id: <20221030074450.1956074-11-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221030074450.1956074-1-indu.bhagat@oracle.com> References: <20221030074450.1956074-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR04CA0321.namprd04.prod.outlook.com (2603:10b6:303:82::26) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|BY5PR10MB4289:EE_ X-MS-Office365-Filtering-Correlation-Id: 0eface61-a44a-4130-2039-08daba4ac394 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4mxKVprSmrK1ln07EKntu4YYIWIiq83qAvpIPHqgV9tXXz+aGX3RXunbvS5Vw7g1u+Pcncrsyy7DiRXoluJkVLfmpY+Wyme54DNm47PHN5RaKnTSz2ftUaJKgqYz9iFd6rltSuyJZI6Jh0Um4Bhf4QGu5iG4CJ//RGhOOrJ76HvNj6Zqhp5zyF5DK2xo01GaBSuEKA18Yh023V5GuG7eTGwEonVzk/a2vEGXbIgkhhTX9gPCYKXnd0GpO40bjf5QGHwJhVo5+TghgfQ8erf2aMMSN63cG2n4DhgkZ9hTkW7htLp/4m3J01+SwUbGXsxcNxtZsDxKlzpbgRLL2szilO38jSBWsHh2aXMV11fPb7N4I3M6i3OSjQHGcfjC6IAUGi0QApbaRuo8wEC/tP40x62Hk1SvWwUWgvyDhrhbf1Pc7Hri7rjGTe8uj9z8RxlwWhfJHmd/7/3MsNC0G8FlGuybP92qX1NlJ89wk0GujPDZU5CSc0MJyheFWg1pCoSyhi86K3HimIsZ1P14ha/vYcDBUZxtgunbMBBKK49ERY9k0maSOEab9JRlrctWbxXvn5uJp9LutiEGuC5AJdXOzDelcYFWEpiANhg/HIfwdZ+ydo+V1suzOneBdKhwh1fZPd0x1GcETQeSe41R8WeJYA7mHGC9SrkW+vUC3jAmkU4TRHQELK3GrjJ2YP0eQ3bVmFgCD159zidfqL/CDiGM8w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2158.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(366004)(39850400004)(376002)(346002)(136003)(451199015)(316002)(66556008)(4326008)(66476007)(36756003)(6916009)(66946007)(6486002)(38100700002)(6666004)(8936002)(41300700001)(86362001)(107886003)(478600001)(5660300002)(1076003)(186003)(83380400001)(8676002)(2616005)(44832011)(2906002)(6512007)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LGHQCYtxeaWbgDCb/4fVn5jVA/RWet7nfGjwccna+Y2ioRK27Rfgt29veCeJgiYmpZRDhNq8uJqB4S+U2qNMUozXVnYhdHwrl1vZ/r2lusMDC2hSfBhD/5nNLGjrpYbYo822vQs1THv/ejewQ/58IzsA8MXmdJu5yA5DyzUWxhJvVmGst7TnysNkXYV7FuXk0h9QReYeMBgUdeYmgrpfIa3ORLCzxtHVkA6FfhiPwTR0oNX5i3l+4oS/oExQgMyc6imD2cLVB/RQd9YNonKN2QAMec0dDgIAQOq871KwjIBChCvZB8Gs7BuLKIFC+CBY6THh5PanEWlveMZ+QlEXCKif0/HowE/oI7eXgePMz55n/s3gsmM+/TzBe5NjdyuwamosnXPGZ4ztNFe9EF/02IBJTxDHoqGcwFkM62otpiQ9C5mF5i0qCyv8LbP+A+ylCdWx25RRd51prDyayA25qL/gTSJaplDa2I30t+K1RoHmVH+TtHgfJTzwHd2/PO4/Gx5W42Bb5Q6MaPiOemfa8uok/kzFrWRW8iAW8hwF+4T8SuERm5xTaBEAHH5IefNEk5uZj2zkPNfFA28LT+hsV307tu3MwudkvLV+E1Prrr3/TApSumkt9JzwUefVUrTSSJvgJ6LeH5q4RxBmbtfAOxIoJUjjToq925AEAjJBPwk6vF6VdJc9wrG8FgVh2QziWiFD7kJ5/L2+8talP6vk21EsH4u4SZZaho7KvjheaqxURClQvdtZG1edbuHzi9nkTDriBDT0qwKYWaPWqL9OVT+1TRiWa29zbffiK5t8TyaPTMdNzzJolI0OlhkUL+jOxM8CBL94gMdUxXjEhKNZCGM3riB+XUXJmXH9/fmpwwHLAEoorsPVmNWWrgvxN7ncqCXG9UrsoOpKtmKP2lSDKQQNbCMoZ7UlfdoqJhjNteCKOYKeRO4alctXg4aZA5evyWYGtr7u0aMJwaNYS9B7yyiqFDMAyzppjGgwYMS26b5mCgtnaXjeHst4GghmHI4nW/WN6Wz93hYp/Ak9FST3ktMePMDvbkCiZIHDbtExkAiWg/s932xKFAqd/PugDHp0b0HWrwIwY2yBjr6Ghrxk8nRZGdHDia1rXMbbTRe+oX7uHbQSq9GBmEIWXkCWRSNoC7ZxSozIrhQM5hWhrBghw0XO4R3PnTuDjGYPNvc5BfjLUkzm5OLA45j2Q95zI7I/9Ykciz7cztMWGyILIpQUMpiBQj5O+0HmYErJNGW/VhOt/W6meo8ojs+2UkQ0IA/IoGcR8zWQO/u/IP1isZ5gUwHWIVY97nfjn5/XKBDnQl0b0Jak+SrmB8vKyLhVjHgwAWky49bZ3N9L2tslnwiFTAkswxpr5s72wx3sX6JRuvcg6bmaPqit5XSjPOZ8UOvuLhHlE2ZyE3GU5U/E0IYb4PPxG4nTCYJMbtgfQrqPLduR4fJ1ku4dGBUAtNaySlOJY4vLz5Tx0TA8h7YypXhkwqBdHCkd7uLdKXzr8WRM6/8aiQegam8CVBL6uSyPsYFCKMbTyHeNDHSfM2Khlqih8aJ4Kh7XELB0V/5lXqcgWnAGlWn1FAyx2h7RVT4gl3Q/FOYISLQewgT54WIkHcu/zVqMDnugWCJF9ysY5aVa8HY= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0eface61-a44a-4130-2039-08daba4ac394 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2022 07:45:49.9363 (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: UhUyLUpbmjMYTt1Y3y1PHjfon0MItJNUNe3ij7lyjLxnZEzi15/tN+9RILCCntNLnbhUBieOdUXqnov0798uqQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4289 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-30_02,2022-10-27_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 adultscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2210300049 X-Proofpoint-ORIG-GUID: cPGQSrf7i3VErhkviyaTayiGm6oCgIyY X-Proofpoint-GUID: cPGQSrf7i3VErhkviyaTayiGm6oCgIyY X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Indu Bhagat via Binutils From: Indu Bhagat Reply-To: Indu Bhagat Cc: Indu Bhagat Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748098464984888065?= X-GMAIL-MSGID: =?utf-8?q?1748098464984888065?= [Changes in V3] - Additional diff in sim/ppc/Makefile.in to accommodate libsframe. This is needed to ensure --enable-targets=all continues to build. - Addressed review comments by Mike Frysinger. [End of changes in V3] [No changes in V2] Both gdb and sim need buildsystem fixes to now include libsframe for a successful build. --- gdb/Makefile.in | 7 +++++-- gdb/acinclude.m4 | 4 ++-- gdb/configure | 8 ++++---- sim/common/Make-common.in | 7 +++++-- sim/ppc/Makefile.in | 5 +++-- 5 files changed, 19 insertions(+), 12 deletions(-) mode change 100755 => 100644 gdb/configure diff --git a/gdb/Makefile.in b/gdb/Makefile.in index c528ee5aa80..98157498fdb 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -161,6 +161,9 @@ LIBIBERTY = ../libiberty/libiberty.a LIBCTF = @LIBCTF@ CTF_DEPS = @CTF_DEPS@ +# Where is the SFrame library? Typically in ../libsframe. +LIBSFRAME = ../libsframe/.libs/libsframe.a + # Where is the BFD library? Typically in ../bfd. BFD_DIR = ../bfd BFD = $(BFD_DIR)/libbfd.a @@ -650,7 +653,7 @@ INTERNAL_LDFLAGS = \ # Libraries and corresponding dependencies for compiling gdb. # XM_CLIBS, defined in *config files, have host-dependent libs. # LIBIBERTY appears twice on purpose. -CLIBS = $(SIM) $(READLINE) $(OPCODES) $(LIBCTF) $(BFD) $(ZLIB) $(ZSTD_LIBS) \ +CLIBS = $(SIM) $(READLINE) $(OPCODES) $(LIBCTF) $(BFD) $(LIBSFRAME) $(ZLIB) $(ZSTD_LIBS) \ $(LIBSUPPORT) $(INTL) $(LIBIBERTY) $(LIBDECNUMBER) \ $(XM_CLIBS) $(GDBTKLIBS) $(LIBBACKTRACE_LIB) \ @LIBS@ @GUILE_LIBS@ @PYTHON_LIBS@ \ @@ -658,7 +661,7 @@ CLIBS = $(SIM) $(READLINE) $(OPCODES) $(LIBCTF) $(BFD) $(ZLIB) $(ZSTD_LIBS) \ $(WIN32LIBS) $(LIBGNU) $(LIBGNU_EXTRA_LIBS) $(LIBICONV) \ $(LIBMPFR) $(LIBGMP) $(SRCHIGH_LIBS) $(LIBXXHASH) $(PTHREAD_LIBS) \ $(DEBUGINFOD_LIBS) $(LIBBABELTRACE_LIB) -CDEPS = $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) $(CTF_DEPS) \ +CDEPS = $(NAT_CDEPS) $(SIM) $(BFD) $(LIBSFRAME) $(READLINE_DEPS) $(CTF_DEPS) \ $(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU) \ $(LIBSUPPORT) diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4 index 62fa66c7af3..8bbc5f0739e 100644 --- a/gdb/acinclude.m4 +++ b/gdb/acinclude.m4 @@ -234,9 +234,9 @@ AC_DEFUN([GDB_AC_CHECK_BFD], [ # always want our bfd. CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS" ZLIBDIR=`echo $zlibdir | sed 's,\$(top_builddir)/,,g'` - LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $LDFLAGS" + LDFLAGS="-L../bfd -L../libiberty -L../libsframe/.libs/ $ZLIBDIR $LDFLAGS" intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'` - LIBS="-lbfd -liberty -lz $ZSTD_LIBS $intl $LIBS" + LIBS="-lbfd -liberty -lz -lsframe $ZSTD_LIBS $intl $LIBS" AC_CACHE_CHECK( [$1], [$2], diff --git a/gdb/configure b/gdb/configure old mode 100755 new mode 100644 index 33677262783..71288533efd --- a/gdb/configure +++ b/gdb/configure @@ -17412,9 +17412,9 @@ WIN32LIBS="$WIN32LIBS $WIN32APILIBS" # always want our bfd. CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS" ZLIBDIR=`echo $zlibdir | sed 's,\$(top_builddir)/,,g'` - LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $LDFLAGS" + LDFLAGS="-L../bfd -L../libiberty -L../libsframe/.libs/ $ZLIBDIR $LDFLAGS" intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'` - LIBS="-lbfd -liberty -lz $ZSTD_LIBS $intl $LIBS" + LIBS="-lbfd -liberty -lz -lsframe $ZSTD_LIBS $intl $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ELF support in BFD" >&5 $as_echo_n "checking for ELF support in BFD... " >&6; } if ${gdb_cv_var_elf+:} false; then : @@ -17527,9 +17527,9 @@ fi # always want our bfd. CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS" ZLIBDIR=`echo $zlibdir | sed 's,\$(top_builddir)/,,g'` - LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $LDFLAGS" + LDFLAGS="-L../bfd -L../libiberty -L../libsframe/.libs/ $ZLIBDIR $LDFLAGS" intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'` - LIBS="-lbfd -liberty -lz $ZSTD_LIBS $intl $LIBS" + LIBS="-lbfd -liberty -lz -lsframe $ZSTD_LIBS $intl $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mach-O support in BFD" >&5 $as_echo_n "checking for Mach-O support in BFD... " >&6; } if ${gdb_cv_var_macho+:} false; then : diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in index b07ec96e147..8a49e0b4ef2 100644 --- a/sim/common/Make-common.in +++ b/sim/common/Make-common.in @@ -222,11 +222,14 @@ SIM_HW_DEVICES = cfi core pal glue $(SIM_EXTRA_HW_DEVICES) ZLIB = $(zlibdir) -lz LIBIBERTY_LIB = ../../libiberty/libiberty.a BFD_LIB = ../../bfd/libbfd.a +LIBSFRAME_LIB = ../../libsframe/.libs/libsframe.a OPCODES_LIB = ../../opcodes/libopcodes.a CONFIG_LIBS = $(COMMON_LIBS) @LIBS@ $(ZLIB) $(ZSTD_LIBS) -LIBDEPS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL_DEP) $(LIBIBERTY_LIB) +LIBDEPS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL_DEP) $(LIBIBERTY_LIB) \ + $(LIBSFRAME_LIB) EXTRA_LIBS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL) $(LIBIBERTY_LIB) \ - $(CONFIG_LIBS) $(SIM_EXTRA_LIBS) $(LIBDL) $(LIBGNU) $(LIBGNU_EXTRA_LIBS) + $(LIBSFRAME_LIB) $(CONFIG_LIBS) $(SIM_EXTRA_LIBS) \ + $(LIBDL) $(LIBGNU) $(LIBGNU_EXTRA_LIBS) COMMON_OBJS_NAMES = \ callback.o \ diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in index b0c073b8867..12123d36a66 100644 --- a/sim/ppc/Makefile.in +++ b/sim/ppc/Makefile.in @@ -133,6 +133,7 @@ INCLUDES = -I. -I$(srcdir) $(LIB_INCLUDES) $(BFD_INCLUDES) $(GDB_INCLUDES) -I../ LIBIBERTY_LIB = ../../libiberty/libiberty.a BFD_LIB = ../../bfd/libbfd.a +SFRAME_LIB = ../../libsframe/.libs/libsframe.a ZLIB = $(zlibdir) -lz @@ -521,8 +522,8 @@ PACKAGE_SRC = @sim_pk_src@ PACKAGE_OBJ = @sim_pk_obj@ -psim$(EXEEXT): $(TARGETLIB) main.o $(LIBIBERTY_LIB) $(BFD_LIB) $(LIBINTL_DEP) - $(ECHO_CCLD) $(CC) $(CFLAGS) $(LDFLAGS) -o psim$(EXEEXT) main.o $(TARGETLIB) $(BFD_LIB) $(ZLIB) $(ZSTD_LIBS) $(LIBINTL) $(LIBIBERTY_LIB) $(LIBS) +psim$(EXEEXT): $(TARGETLIB) main.o $(LIBIBERTY_LIB) $(BFD_LIB) $(SFRAME_LIB) $(LIBINTL_DEP) + $(ECHO_CCLD) $(CC) $(CFLAGS) $(LDFLAGS) -o psim$(EXEEXT) main.o $(TARGETLIB) $(BFD_LIB) $(SFRAME_LIB) $(ZLIB) $(ZSTD_LIBS) $(LIBINTL) $(LIBIBERTY_LIB) $(LIBS) run$(EXEEXT): psim$(EXEEXT) $(SILENCE) rm -f $@ From patchwork Sun Oct 30 07:44:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 12957 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1686804wru; Sun, 30 Oct 2022 00:50:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Sgid+HCSEvoitUVcmjKExJp2vMvWBT0l0tWWiNnoiyb5MH4K+nJbLmJ2cAFxeRt4vaYJA X-Received: by 2002:aa7:d858:0:b0:463:12ed:3f86 with SMTP id f24-20020aa7d858000000b0046312ed3f86mr4732721eds.281.1667116248985; Sun, 30 Oct 2022 00:50:48 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id v19-20020a056402349300b0044f288e02edsi4254212edc.15.2022.10.30.00.50.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 00:50:48 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=HHdggu5T; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8496A3829BDA for ; Sun, 30 Oct 2022 07:48:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8496A3829BDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667116103; bh=KB9qaLYzR+uPLLLR1uU74c17AtpNF1YXheHdO9AGh7M=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=HHdggu5TbOKPM8gxJ5ESivzI6+qJekw3BmeqYrFE7yCH6vZxyBLNWRzM+gSkroYJJ W/IBrHPQP2r6xOpAdEo4/wdkHB9FsN/uxDvbLxMIoHuxRPgdfEBvittKweaT2kf7ew uVCoBJDCAChfB7MausRSAqtg9GKixh97VcfquyhM= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id C0AE73851161 for ; Sun, 30 Oct 2022 07:46:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C0AE73851161 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29U3Zv7m007440 for ; Sun, 30 Oct 2022 07:46:05 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 3kgty2sd5t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:46:05 +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 29U5pGHj019682 for ; Sun, 30 Oct 2022 07:46:04 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2176.outbound.protection.outlook.com [104.47.59.176]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kgtm89dg3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:46:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fd38H75jg2FlQVnGChIgAN5vrDvMWTFajtvOBzwikXDhXvZ4xvGxQiOydGrcWOtQsSK/X8GJieENFyzY431D8vMARoI5/jBjMkETbkHNZKfbBEf6noJKnpLWzj5tACoB6FJCXjpemf0wowiBAx6w8HsdQhGJkMZo2BomDoe298uGSefyrk/KPZakXqHEZ4U014M1jIOnVVUvQS/8Aw4GNroASeH9ASMnUOtQTr+i4gUtReX9Wp4u3eBRL7ObIwHXTdh+CaSQT4rG1XC67tCjgK8+5CaOMSXgCTAV51dvJqgLbCBxp0rrRhlH2T0dXoxqCbuURtmQ4mEcYUvBEKGjwQ== 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=KB9qaLYzR+uPLLLR1uU74c17AtpNF1YXheHdO9AGh7M=; b=khPk7Gg2lD+Ss/KeYnWYOvEnvjwMzLkQIs9COmnK0uuf+kuc3LiXEDdC0kSbay5iEDAXFLgC69T3EKdmQSrjm+ngpKwNGnFjS7GDhFbY5ojc0kMa3ag3Ymhd8CV/Y2zkyWxYnHOce2ua6w8ElebJ9w+xDzFVSeJtwQImKHf9DfdPj5fZDrdiTCwKP3glmWxbPggNTu84JQN+TVS3PrimI4aK3YN8O/RdUjeTEUG3tILMiGvZnTA3KAVksNmcP4cz8TxgpQXO+8rBgN05mznqcO7BQ//BKhIHLlQIXHcnDdFxyJbz8wmde+AGNjZAa3a33jbIXlnMJFUsX4FxwkCX4A== 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 MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by BY5PR10MB4289.namprd10.prod.outlook.com (2603:10b6:a03:20c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.19; Sun, 30 Oct 2022 07:46:02 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2%7]) with mapi id 15.20.5723.033; Sun, 30 Oct 2022 07:46:02 +0000 To: binutils@sourceware.org Subject: [PATCH,V3 11/15] libctf: add libsframe to LDFLAGS and LIBS Date: Sun, 30 Oct 2022 00:44:46 -0700 Message-Id: <20221030074450.1956074-12-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221030074450.1956074-1-indu.bhagat@oracle.com> References: <20221030074450.1956074-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR03CA0077.namprd03.prod.outlook.com (2603:10b6:303:b6::22) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|BY5PR10MB4289:EE_ X-MS-Office365-Filtering-Correlation-Id: 3a64ec06-cba5-4708-d507-08daba4acb23 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QKBBnpOZpe3NyA5uh2hbiSy6fBmx/1mVnl6PtMvot/Mu2k75GHOSGfNbJkkAoccrh6Fea/9E4s4HU4golgUoGQoPxAdAE54LyVxpP1QxeMBTbZDqSLkCVjotfwKWEBeaHxHzRwu3/YDnCcndDgwbBtLyFgjA5bzWQvwwSXHnA2I+abkHmr67iNQuwsNNtFMXp3QTsgrVgsK+WoNGLOZ2xxW/Gbcp8PsHQO0mnqr5uqe68JdpsIKSF0p6UPEjk5PQlr7kyfNHch4TWQiKLwxNWXsv1m3uPFnkxyb16n24lKA0TCoHVd0RRbqupQi7/oUvuHInEt3jU4LmUgW9AHl3Sm/XGqoFuLXI20+0R3+lKwq9PLnzGNjA9MhHjaybk/+h24bEdnVAE9RVpzLJz1Ku9z6wlNxTG0KkDw4VsPa0/AmptjmDxeli4UIJ/h/SlUmW/M25d8y1RnTWoxIfXUBkqpfm54JklAYQNA6nPjfxFqSQ3mzoa522zpO4NGHrHEfg+9GhCmYgF8xx2ZzHJUrP10MaFk6wsThLKx3LZdUm9NUvu4sn7QPpdtfjYNoF6dmCp3ud///w7MZBHRtBd00JSepvUd89wk4fUsxtQeXjH1diaRWELHlyRdDNDfcCTXsxCK2nzMWaS+ifM9StuoENBGn8WNNq67jcyH6ZSKhDtXnmy66tzXmMmRPu1OelU+PKwn71X45XmEB1+ZpJtXSX+g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2158.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(366004)(39850400004)(376002)(346002)(136003)(451199015)(316002)(66556008)(4326008)(66476007)(36756003)(6916009)(66946007)(6486002)(38100700002)(6666004)(8936002)(41300700001)(86362001)(107886003)(478600001)(5660300002)(1076003)(186003)(83380400001)(8676002)(2616005)(44832011)(2906002)(6512007)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lo1AWr7HgmvyEE2ZmMHy1VCfiE3BceNh2ryoTPmrQcSmFgc4vExrJ9XFt59RsrQnnHXN5yR6cOelFXs9OD1+yyfcP3xwgQ5RLbeizIc3/gTxSCv6M17DOz+jGC+0mQEI6Bd0nga2mST1nxxynTCxLVgF3A0OGkblFKX2P94iSVB3GJX/jdMwJx0kEdoXtBZUot+8bc4XlVXiF3hD5rHQHTJgUCindmpPMb6osmiEuzRTNOyWMTDjWbYn3dujuIb2BMraAFuYDfl/AwRA71f7XL0mTFGGd775FphoTA0/Uw9pbK43ucd87BKf0thU1YucDMIjjS40xiYy/TA91o/hAbHTOeUaT+r8741QqwNqUd7Huh1rd1ORAqaTxy85SJGzYhFgpL1+6zIFXUeplLGGUIVYp+483zK9Ldc/7bKrBpp3B96IK5uS8S32eH/18/1oVhvIuN1/BlWbLuQjI/YN5uua1/yfASLIPeIY+Ozc5Nj4e3GkayTH2wkmLk75I1SY7ka31TY99yUKkpTH3ySpePw7J+xctIQmoT7uQ8b++Uuil7S1fVNHkk0sQ5RdFMHYtYdAj1+iIJO6MBnuLPI8kc0n3ou2b6xBh+q11Jwuk6NAycNZYUmBSTJiUm5/7luzjDCyaKj6tdC7mXDLDSIn0ZYqjbfwD9ZR/XjglQ3RpYgJR7yN/iQRON4cBdoblDvdiyqiSRR0qOg8+0MMZUuvO7hbOkXGs/RxNmh5U+iFmSBzMcAJ1Vd7hjbLHJ0K2nnCbkqzA7p4WMqR0qxwe895bVNIXTjSmOgW1kMdYT1Q2TiduW/27YLvZFECIyGpqeaoU7ZG0ertC7xsOjvP1uFICCTBkowwVDivvFIij80QjeYJqDsad2mklqiA1WwZbuCbYg7g4SPJrylagNl5QDf7nEvCGjHa3S5qRIBnYatNOVLbN5mVQlXFKriFL9vgfi2RgdUaveF36KjBlp/jkRDHCH9cLSypI4hJWkEd7ccZNablwOwPCgXnDd3O3CWCUGiDuTzCtEG2+44MO93Z938T+gWiG+SSalR1/YRzlt1PJjJK7IfMrppWabv40BF9I+A7p6CS7emxGJZ7TWqEdmkIx4dLv8TwPJlyjofeSDIuwWFZnG4rWQKTnohjmQMnTfbGNkKlTttA9dj7XDUxfZr9Ww9C0PqPw4aikhWY/6Bbfi3W9g4e4xPh62XExyUKIqdz2GvvDLMLUtmseevLj2Hg5oCNaA14abPZWE/IrNg3VuqIRRJwAjGAC10EXpIdtj9ZwqBZYsLZViRq4d1a7xYpRsj109IjqTPrOujvmvXZMna/CFF5zjmf8Ny55KdIN8LMF+W9ulIa89rSGBUb027xU9c66VOJiL8wcCDljh2CSVGfOvkg5GfRFdABXK1MNKaw0puD7+8tigo/Z8nghY0hpoJHsWKmSP4wFcZZrr1poeBXpy1BYt+9mGJG9A5uq1yN8JnvjdXUDHrYPdjGbcRbti2vAGtPmucFfos6c5N3WbCp0VGQxXaKgKttfw87836e3ok6GgfA3yFChBhsyrLzqq98N5Kaz7QcY3h3WjMtMV9bulzZiNZLXemPVc4MYkZN1C1UoZHhNDz2TdF5P1wdaH2IoqwWV42f3WiXrIgFWhc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3a64ec06-cba5-4708-d507-08daba4acb23 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2022 07:46:02.6065 (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: S0fWN64PQH0+7fFFQPwtKRuqlRe674siKMHrrddmPCuykSGjd7vBO+VLiwjItZlk6FPIlJkG+cpgV44Ps3UMFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4289 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-30_02,2022-10-27_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 adultscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2210300049 X-Proofpoint-ORIG-GUID: jtCiSiNF5kgtophMGFIUN6FnV_J3W-m6 X-Proofpoint-GUID: jtCiSiNF5kgtophMGFIUN6FnV_J3W-m6 X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Indu Bhagat via Binutils From: Indu Bhagat Reply-To: Indu Bhagat Cc: Indu Bhagat Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748098087836800414?= X-GMAIL-MSGID: =?utf-8?q?1748098087836800414?= [No changes in V3, V2] bfd now depends on libsframe. ChangeLog: * libctf/configure.ac: * libctf/configure: Regenerated --- libctf/configure | 4 ++-- libctf/configure.ac | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libctf/configure b/libctf/configure index 176b3d6b918..abe4cfe1eff 100755 --- a/libctf/configure +++ b/libctf/configure @@ -13218,9 +13218,9 @@ OLD_LIBS=$LIBS # always want our bfd. CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS" ZLIBDIR=`echo $zlibdir | sed 's,\$(top_builddir)/,,g'` -LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $LDFLAGS" +LDFLAGS="-L../bfd -L../libiberty -L../libsframe/.libs/ $ZLIBDIR $LDFLAGS" intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'` -LIBS="-lbfd -liberty -lz $ZSTD_LIBS $intl $LIBS" +LIBS="-lbfd -liberty -lz -lsframe $ZSTD_LIBS $intl $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ELF support in BFD" >&5 $as_echo_n "checking for ELF support in BFD... " >&6; } if ${ac_cv_libctf_bfd_elf+:} false; then : diff --git a/libctf/configure.ac b/libctf/configure.ac index 2e2ccf4b624..72b2ed7ea31 100644 --- a/libctf/configure.ac +++ b/libctf/configure.ac @@ -88,9 +88,9 @@ OLD_LIBS=$LIBS # always want our bfd. CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS" ZLIBDIR=`echo $zlibdir | sed 's,\$(top_builddir)/,,g'` -LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $LDFLAGS" +LDFLAGS="-L../bfd -L../libiberty -L../libsframe/.libs/ $ZLIBDIR $LDFLAGS" intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'` -LIBS="-lbfd -liberty -lz $ZSTD_LIBS $intl $LIBS" +LIBS="-lbfd -liberty -lz -lsframe $ZSTD_LIBS $intl $LIBS" AC_CACHE_CHECK([for ELF support in BFD], ac_cv_libctf_bfd_elf, [AC_TRY_LINK([#include #include From patchwork Sun Oct 30 07:44:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 12960 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1687844wru; Sun, 30 Oct 2022 00:53:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Oi3d4HFfQC6ho0gjTdUapY0pX5oSGvcb1MTI5VnyyVqQvbd8LoJ/RBgynwwAGhLTgl/hf X-Received: by 2002:a05:6402:440c:b0:43a:1124:e56a with SMTP id y12-20020a056402440c00b0043a1124e56amr7879977eda.134.1667116431490; Sun, 30 Oct 2022 00:53:51 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id dm14-20020a05640222ce00b0044ebf99d6f9si3677154edb.263.2022.10.30.00.53.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 00:53:51 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="xx3Ux/ae"; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E83103851163 for ; Sun, 30 Oct 2022 07:50:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E83103851163 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667116215; bh=wkwv1N4amoIVk7Q3vHrFtbfQmmeiiUovmEwGpgVMPeI=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=xx3Ux/aeE7bXrJMx0lgFmJK5GVBwjeGZhKd9FQsBualP+zayJfAR/Qdb6Ew2Zo1Rj MuDbDLPrdVhdxLrbvMAm6vBQ7bxB/QkGQ5/ESAMvWm/LP1+HCihxp41+fM/MYUjtjT YSfhLYnX/mnnxKciOJAA79TMp5OcZHcsYl6ls5ls= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 343E73857BA6 for ; Sun, 30 Oct 2022 07:46:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 343E73857BA6 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29U3bKcw008253 for ; Sun, 30 Oct 2022 07:46:08 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 3kgty2sd5v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:46:08 +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 29U7Emex017512 for ; Sun, 30 Oct 2022 07:46:07 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2169.outbound.protection.outlook.com [104.47.59.169]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kgtm29kgg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:46:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OMvasc1C7Ea8fybfGS0lx4+qwXVefhpzVLTSqSEPrY23fB81fua6nygRKzc/ENWg5JO9K2LoKmNAT/IsavHUrGxsHwEe1JPAkEMnkbOxnZ/Q3Yrp2dn7tVGAQ6AILnImoAJnPeMuA7UfSnzPe+EZ7FXzMP+hNQfTDYAetfuaasZHbDeKRHfE5PkpLYvDyIZ+n+gz+lDGGKb7Nc5QWERYPs6vXJKRRrHBC7mZFyvwP3M+mXe6JFd2VvTFx/lLGTV7mi0L4dgDbQ7ylO1TnZGLT1a8jkOlDl7bWA8xoxXm6oCdI6ottDb/4mkYzhavwdlTceeSBEWSIWshm21XB8tLcw== 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=wkwv1N4amoIVk7Q3vHrFtbfQmmeiiUovmEwGpgVMPeI=; b=EYLKe+RVVznSwsXVm8aDCUQ4pCDBegIf3ujYFj2FeTr1mE0bg618fSTwhMIXX+FWQAPky7rQuIKQ8mA0TJjH5w8y9jJcpuPXDMHO1X/N8xRr/+p7DyrZtjzKYY6aO2PIDQzQbinzTTsN8jMypqNAPWDjibEYraOaltOAXSrR4DqGmvfLSG5Jkvmxd0vfj+1CbpCHou3mmLTzHbRT0zdGvt262uS7RfuTziADSbrE3ILMBJHTyQoHXiG1Xqcu7w77NJYL7F/YgQqqjo+TC+u2+oEBYROZUURaDVbwrwrA963gvhWSFZt6CvZ4DK2dAlINP1aG31/1npPzFeDtnlXcwA== 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 MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by BY5PR10MB4289.namprd10.prod.outlook.com (2603:10b6:a03:20c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.19; Sun, 30 Oct 2022 07:46:05 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2%7]) with mapi id 15.20.5723.033; Sun, 30 Oct 2022 07:46:05 +0000 To: binutils@sourceware.org Subject: [PATCH,V3 12/15] src-release.sh: Add libsframe Date: Sun, 30 Oct 2022 00:44:47 -0700 Message-Id: <20221030074450.1956074-13-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221030074450.1956074-1-indu.bhagat@oracle.com> References: <20221030074450.1956074-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4P223CA0024.NAMP223.PROD.OUTLOOK.COM (2603:10b6:303:80::29) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|BY5PR10MB4289:EE_ X-MS-Office365-Filtering-Correlation-Id: 2db9871f-80ae-460e-9b8f-08daba4acd00 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qK3KuBPsuR1YkaiiXhVJi6ITUdFcKvvJKsJwBj6ufcOSICNKuoEmG7f1N0QrQOaRtusUy5AFJD69EY1t7/7dYBMl3eACrLYdlzy1Bs9VA0jQuv5BhlYvRq9tYGWAM59ouHA4TogmAmo+2VnqiCBEtR6Me1XQxEuKq7JbJLkUiHKLQh68uuKyAlFq+PYKQTQqgRLSTnA613RrXUJbpI+kPG/3YVKeyHvidg2p+bptekNvRtQbBEqRmqmpM6C1DPrsnMebJZsPG48anGThJmDbKUILmsc2XBre+9mNmdnJge/TeqwABRfaCTcIqdNPlntnsV2aWDuMi85p0kommYHsbBMEX7htNBGU+eaJgf236JanRkzDcImrwUZnA0PxcRVy2W6p+473go86uYy0W8EvQ9QwmoSIFAPm1d7GD6QKNmZi4v7mdHTaxh/bV+0TTtQ+kqLpRLXLS/XGkZ9sztTjvgzamC1V2L5ufdQJ880dGICzCVkSReJjsCTl4HhZcBPVr+jIPADAoOeO9VQtoOHpeARJk+eze5RDyYfOsNdpKyLfjGfYZu978nS5x7miAPUxvwtCMkRXeMmsw1MyO4emvW+2FO7SZ0bj3l7S+odDmMqAb1INQHXe48KyYNrKhaXBfr2e/Rq4Okapitiju9DfS2q/DP3T3ANUaLudtOimYU6lae2YirhONlVcckBZMAS4PUOh5n5MavYXYIHsiXChUg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2158.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(366004)(39850400004)(376002)(346002)(136003)(451199015)(316002)(66556008)(4326008)(66476007)(36756003)(6916009)(66946007)(6486002)(38100700002)(6666004)(8936002)(41300700001)(86362001)(107886003)(478600001)(5660300002)(1076003)(186003)(83380400001)(8676002)(2616005)(44832011)(2906002)(6512007)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FrYqw8kKq8LQI3FvysFKDx1Z+KynrCV+0NCk87khqIQPGgqHwn2TlsK6z/Qbcrd28xsMOuUrT8g2wtFGz46EwRsPnf8U7Q6QIzrk7B62D+kM6xumDlIhSlBNzQdn5MxkwrGLnW9yU+OQdU3xZXXdNC8d/2HtlSkaeubZMPIbOTAwpLbBHFBMJfElp1eM+3BOXIWoZZ689vsF5BmAiHAAX8UhSnGganpqk6XWdAUL/fXgI7GjYiZmvHZhCfuJQemXAucpChArKRfYL3DvKL0r/Ylam0HOL3/1DvlIHTkPnwjMvrxj63+9FHFcYfiCUVnawZKLG9L4bOT8FjMgfI43qJQwCo6May2DXA3ZBs4gi4kR5UB71yX0YGasNWiofwm3Kq3Zu6xFMsVPUHfPIsAMl/l7HEqoekm6+wregKOcKCmcEh8EMEGOxHBU1/16kE0BG6dtq3p65A+zEydRYccNh6WAz1aXuhK4VgFLWxHf2bO0N+dumHLr51okridSUIBg8kS6cYtQe88cHTPBhI3IzKVKavwTlteck0aRNM6pa3iENac+NIJ0QktENTF4ThzdYAedA7u6eLgZiXIEGpAsnAe3umlOPS1NMdJOEzYrsjexjRzMVY0IEtFxw4Vsb+ubJ4Ojvj6Np/9Z5GlJYR2x/Cwvv/IMcCtob3JTyZb3WPYhDwUvMsR0vpusOXuPezkWRKXnPzp452ZkF0yf1LDVFfv0cMNnOl/SETxv2yZ0ay+c0cdAlekiYZbk5GOy1j42SXhjp/TG5piX5FIrKxLY4GPp9kaGc5CtLS/dxKUbIygYce5gS6Bn/TcysUkNPJ78Wn9SJgLijFKB7x8I31NwjMhQffNOFTcPebhwcVY0mM5VM9KJaNKGEqdSxmLnGTNiXDM7ioLNJa6XmdbzhRf3KhVnbimVaz5WwcIb8g0wAdk+8wO5f7MuBB2EgFmhYRTGGck4RzdrtrV1ApNi4E5AEnQ4LV4WvWmRn8WIVa6ccMsRsn9cIQ/2LD9oBD527KIwnffxzHWUXKmSsEJ/gV4T/aBaIoSdY20zU5QPcRe34NJCuIZK1G63U7ry98DutaZ5gjLdhnhY7KqXh2/kmdqBZ1CRK62f5lGQUH/R4OR4MrZK46PJsi1A2hxdFlb12RZlsehvg641NhhTdDt37gh1lIlxuU6KPysoqk3fNenZSZ75BaUNl2SyifRHUbZWooBWqVZa9uyYqCVtSoeo0pUZ/HEFhesG4wSPWvhmlm5zOS9EknpP8uycuoJthaqcEQw8+9b27Fq6xCeKFy1d46CvMu8b9zRovgv64bBesXPZ1NVi2gx569sx7TNm0p2r3jsDamRh+IsyyS0+d1pI8hx/An0UiqNXzlC1Pc8gd1xDjtYNAQnGQ49pugobVlMorHFtDTKtKPPqfQaoJ0ucKBU7dyfSAQtDhZy6SYhyxIRQFPdrs4CwYu2wyq+Att6wD6C14ZW4uxfF0b/mXyiSjkDfR61DNt5wWMYms8xcZcwH6hkiH4BuaHdze8TH1Iu95XpAf0jBZGLCTuLw+vRwy6h+dJsjstUfZ+Tov1ZvWvBLqkl06m2uFGRiypp5FU3PDGAzYmevGNjfXnbDlfoyJjnzmAlF8isLc4RhjlZJgmeSzq4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2db9871f-80ae-460e-9b8f-08daba4acd00 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2022 07:46:05.6999 (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: ivd5DGaokyCebBBzCQYsi7KFR+T2FPZffIWWsEWf6POmUgpTUpBE/s5tk5SmT11jJTCbkHOPah2nDPyl5wbFew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4289 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-30_02,2022-10-27_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 phishscore=0 mlxlogscore=829 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2210300049 X-Proofpoint-ORIG-GUID: pjoLAKC0igMpr4jsmz74u9MJ3aGGOYmI X-Proofpoint-GUID: pjoLAKC0igMpr4jsmz74u9MJ3aGGOYmI X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Indu Bhagat via Binutils From: Indu Bhagat Reply-To: Indu Bhagat Cc: Indu Bhagat Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748098279369650000?= X-GMAIL-MSGID: =?utf-8?q?1748098279369650000?= [No changes in V3, V2] Add libsframe to the list of top level directories that will be included in a release. ChangeLog: * src-release.sh: Add libsframe --- src-release.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src-release.sh b/src-release.sh index 76c355a583c..050a8eb958d 100755 --- a/src-release.sh +++ b/src-release.sh @@ -94,7 +94,7 @@ do_proto_toplev() # built in the gold dir. The disables speed the build a little. enables= disables= - for dir in binutils gas gdb gold gprof gprofng ld libctf libdecnumber readline sim; do + for dir in binutils gas gdb gold gprof gprofng libsframe ld libctf libdecnumber readline sim; do case " $tool $support_files " in *" $dir "*) enables="$enables --enable-$dir" ;; *) disables="$disables --disable-$dir" ;; @@ -304,7 +304,7 @@ gdb_tar_compress() } # The FSF "binutils" release includes gprof and ld. -BINUTILS_SUPPORT_DIRS="bfd gas include libiberty libctf opcodes ld elfcpp gold gprof gprofng intl setup.com makefile.vms cpu zlib" +BINUTILS_SUPPORT_DIRS="libsframe bfd gas include libiberty libctf opcodes ld elfcpp gold gprof gprofng intl setup.com makefile.vms cpu zlib" binutils_release() { compressors=$1 From patchwork Sun Oct 30 07:44:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 12953 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1686169wru; Sun, 30 Oct 2022 00:48:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7WSq6rd5rcbTPy2QkPeLh9OJFwnGdQ7+5gXlvBd8OeFHX1R3pwCN9rlRNgZLJUEzqGISwL X-Received: by 2002:a17:906:cc49:b0:7ad:93d1:5eaf with SMTP id mm9-20020a170906cc4900b007ad93d15eafmr7049251ejb.393.1667116109009; Sun, 30 Oct 2022 00:48:29 -0700 (PDT) Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id m16-20020a056402511000b00457f31c1a10si4501902edd.584.2022.10.30.00.48.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 00:48:29 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Ta4CkZZV; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 13F813857BA2 for ; Sun, 30 Oct 2022 07:47:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 13F813857BA2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667116036; bh=WpmidEnrCAItbPaaqL6mrzCrlipiwq+qxHGLKT3rLms=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Ta4CkZZVuESZsgEbuCcnEDXDH9QMBApCagx+l4KMcnxntJzdezQcQNuheYtiL9icA jlLmUZU4tNosCGvsv8YMOoYd8QWkJNbMWT80o9IS6P5x6Pol4E/JgMHnLCb8JW9yl4 w2/05SHG4dkn6TlUgvX1fS0iXxCjRfPRemI9VemQ= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 49DD4383FBB5 for ; Sun, 30 Oct 2022 07:46:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 49DD4383FBB5 Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29U7TXVL022415 for ; Sun, 30 Oct 2022 07:46:12 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 3kgts11c1c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:46:12 +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 29U5I6lB019596 for ; Sun, 30 Oct 2022 07:46:10 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2174.outbound.protection.outlook.com [104.47.59.174]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kgtm89dhh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:46:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=akxPcLJ8MVI8Op5GqO7jqqN1ypBztD/8XcNgCcrYLtzULZ9yUHjvGl4bhdOh6pZr4NpeV3Wlplvz4UpDgNiGWNk3o+oDOqIg92xzmMczF9tjX2pBB+OeO7VZw0LDeSqfscE8z9ApabQrXH8LGevAPXT0/+P9V9MhpMFM2C2omZhkyLGHi0QP1+5nRHEEJ5mNMSh053/o9U3X1pQaiNrRuxun6N2WTR+CrKvgfrBWGNEonlpd1AyGIT2g1gG0piJKd0rcrlHBN9L7ffq7d9gdEoYjznCnBiaQOPju5Yd+BY04ebznvYeVeFJLzGj9dxMWOqnGvy0dvasfsV2ULS0fpg== 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=WpmidEnrCAItbPaaqL6mrzCrlipiwq+qxHGLKT3rLms=; b=M5JzB4RhajZBbgphKMlE9YrBYIEfn4MEQHUXlNTJpJC+d8xOwnWS3clKlq/xTsAD4RA0mP9CLSOBd5aOvKkEmUcCrf32vEsPNSre6CaToqFz88Ie5Nay/4POkEn54V5cPIpM8QRlIvhM+z8BmY4fQR/9b42SGUEj2BfwTVvaEQotSuMLT9DYIx1d7pFkRseNR6V8fqi3rJdPKVpkgiqFasMFy11D+pDgBZCikpz0X3tfH3HC3a4SRG3ZN5STiSknsMHSdWC48eGYzxkQQI35hXB/G04/GJJzLPjyCNKl8+FJ9vCiEq2nAconqkQs+rz7uPADOfzW4ddlD+7MH5TPLA== 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 MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by BY5PR10MB4289.namprd10.prod.outlook.com (2603:10b6:a03:20c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.19; Sun, 30 Oct 2022 07:46:08 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2%7]) with mapi id 15.20.5723.033; Sun, 30 Oct 2022 07:46:08 +0000 To: binutils@sourceware.org Subject: [PATCH,V3 13/15] binutils/NEWS: add text for SFrame support Date: Sun, 30 Oct 2022 00:44:48 -0700 Message-Id: <20221030074450.1956074-14-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221030074450.1956074-1-indu.bhagat@oracle.com> References: <20221030074450.1956074-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR03CA0273.namprd03.prod.outlook.com (2603:10b6:303:b5::8) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|BY5PR10MB4289:EE_ X-MS-Office365-Filtering-Correlation-Id: 957d6ab2-aaa1-45ad-edc9-08daba4acec7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZSV0uEvFwQOCY7M4UVAyGUS8F+0ersAFhiLcX/nc+n46KgMLfVZSbTNqXF8pghUKXkbepVlDCCNAbPZ5Nln4iBQRka08ULX9l2uFE1b1aUe/ZORsZn2djk1QoUnML3WH2L2EbjkPdmyRY2mZVr3tz1ComFwOMionX31VVY5OvyvXRW3E441KHsFKVCPcudxL0ThEKJvg+MOwHLXsnqHxTmQn2pQA+VuXGstNFC3NHvGbb3CVjdxe9BrmdzOi5I3P7dq6Kd28tbxJcG1nU49nRoZFY3jJx/zP4cW7fbYR1NUgISDRSSeSUP0lpyMeeqv09YZsYfss6jamgSIcgL5GdqX1V2UnaJ5N7xbApE4YU1/rMRCOswFneR4dxYw5yqZoBmtnrINTwGud8XY44zcRkj8aqSTOXHraXRwHdiSKsEq7PbeevIv/2nboNR6frqIkCMwmy5O2jnZvggTAPvAbuj0cbXTn5UOMehUPeDFNi02i7g+OkboLcVrUi7Xz/PC1f8NvkJn66Xbrm2MxqnahJehQFoXOLTsLRFwxHgQKqWfonKrtmxAN/CRsfUCDjl/zJtbW4h/ddu4oZirli1DbzbAMsKk9hae/x4b3soZEsGtK8QOrilD/UxqUp5Azar32Deky5gFbKkWTpMANbxLWVUND8ZKs7gadbVpKL/cTpy2Al/iQfF6OCEzn7L3gvVtQKI9COydN4J9CtVgeVz7Nsg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2158.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(366004)(39850400004)(376002)(346002)(136003)(451199015)(316002)(66556008)(4326008)(66476007)(36756003)(6916009)(66946007)(6486002)(38100700002)(6666004)(8936002)(41300700001)(86362001)(107886003)(478600001)(5660300002)(1076003)(186003)(83380400001)(8676002)(2616005)(4744005)(44832011)(2906002)(6512007)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ozlXN+UZMVkRma69c2TKzGZG73NQ6/uc54khyWcO4AAT1G8QUmYC0w5ut4llzg0+jWjS2pIj9eEGfa2EgKsR7iycB4L6UwjK7xhrAxnvhbkp2XHNNPcYjCehcnV67CA3skJjlxX/JmjkjGZM9NT1RKQOkq1/V31D4opak5inHeiVP6comXj02FhVp5ZxgrDX3dvDXsneoNzJMkj6rWwMJ/QHP4914XCfdIZKgbK6H1XOdBM3M746To/sA3t/Fl4UCYy0a7sUsu4JQbZbVpdmUew2Ipy9ZrY29QPWuKgWpQekUrRk6gbW/UyEXZTr3YDMs8qKx/oBAeQr+ZEwreq5f+RrRCu/X+i8toyGGHpUeugTizsPSRHfvUQinEaBvvkIBaIzmnZU1t9TkcFQXWVipQRWPGAkRu4fQ8sA7mf6r3jsYUeHpa/edCPmsgCQpKTXyOs1FW86jf8V3W0h/MIfpLmLEvjBUdHgcddYUkJeodMyG3tID5rkSgkzV9w6xWIl2GaUUIHpg+fou3d+DsVnGukts95h6FFUIM6+IMKGyeDQmql0GXtAXgSbXOcj5K+rR1Ddnfqo0WrHjf41htCQxoKfaYS1IBFBdb7PQr/rM91LOYQljkv+ahWNja+8KmQuf0SiQr0iMk80EPv2eKS864I2bV/B2FPgVeuqv2Ira+ninlPWx6zIHG+oNY0cBWw7zT62V2L/Q25nYkwNNQQjGE/FQxIdfyo4zKhBWO4magqnDDCZDagWher8HCHLOZ0QbfhdK2Il75iYc/+BNFH1afk69CYkYnwxRoNtR7k7s1kkPHhFORtyAh0PvT0RWotcWJTbI1Yj9sodjv/ezMo9gUcU6lvvgwCkjR18Re65KKlXSGo6ty5MW84qAHle5EvHOHHrX4aAlD10g9fXzvRQVuWhpO/9lrVY33e+dO6dFZb89N1HvN7HadCWJs9fkM7bRcNpfbNVvb8yloAUblmq/NZxhqG3+SNyu3upZ+rKOdtn+0rMcDojh4dchs4FN0DS4EUCaQZUFFY+/pwKgrN0FG4FIABLFiD0cQjoivp4TTPelvDOndPqfQDs1DAP8gL6wrFm/HXAZ+uVFTlGSa7roEgBOnM/18ClqJepoSgKSpsGmXLRINUz4SVtMHwScwV4VYCA8/bVzrp01ryKjZRfDQjXE0YpHF3btAikrJLbCiYB8oJXgo3Al2/WkkASBfep3J2kXZUAKtrhxzwwhisXacQzKkAojKoB59G9ujNLq2F09dgkuRiyRNw7jwqoaDXKhc1xtD6ES8C4DD3Bblfd+SOj5gFPwULoi5IRkf1kpeNBvjUHLsFdujSvn+ZXKnBi0a0nlK65hGE+K7YQvhfC3j6rPLcLSfFNvClqh/2MY99HCkicz6JvryJYjLrMAL8jU4G3dg2CVLUyn8L9vwsRYilkp+4Un0J/CwDb8tT0SzVmtquBfgUWBSPJXXLm65E5+nczDsgv2c1ylm1gJYJjk/JVI6jppgnJ243JAavzXDUr5m+HCgMFRo/uGcXQ8skqwgm4pMK/LAyKvKxGwKF4YEvNdEj8ZSxIT30kn5ddajEiHEO3JU4D/ywJUlBlZV/qnICIjMHbVYVkpcAyfVd0F2EDUf7CfLO5zDiE+26tgBc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 957d6ab2-aaa1-45ad-edc9-08daba4acec7 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2022 07:46:08.6682 (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: 9ImSLy6esOV2l58Rs6B/Z1BJicUQRTvMjhWg5E+6IyKK/k6hEUfT7k7Y0M7MAjmBjzLGAnmB9bgChdSvXW1AxQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4289 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-30_02,2022-10-27_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 adultscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2210300049 X-Proofpoint-GUID: UQxvEMVG1dtrmCRh1Hzla6DoQZewlVUh X-Proofpoint-ORIG-GUID: UQxvEMVG1dtrmCRh1Hzla6DoQZewlVUh X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Indu Bhagat via Binutils From: Indu Bhagat Reply-To: Indu Bhagat Cc: Indu Bhagat Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748097941367715972?= X-GMAIL-MSGID: =?utf-8?q?1748097941367715972?= [No changes in V3] [Changes in V2] - Adjust the message a bit. [End of changes in V2] ChangeLog: * binutils/NEWS: Add item for SFrame support. --- binutils/NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/binutils/NEWS b/binutils/NEWS index 9ccf401027b..a383d481727 100644 --- a/binutils/NEWS +++ b/binutils/NEWS @@ -13,6 +13,9 @@ not it generates deterministic output libraries. If neither of these options are used the default is whatever was set when the binutils were configured. +* readelf and objdump now have a newly added option --sframe which dumps the + SFrame section. + Changes in 2.39: * Add --no-weak/-W option to nm to make it ignore weak symbols. From patchwork Sun Oct 30 07:44:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 12954 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1686204wru; Sun, 30 Oct 2022 00:48:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM63r57Pz2wT9dGkFtRcRp8BRELvApyIy/ju9BM7ZRn1nYmrQZmbf4k0RZZRdhLsdPrbuEiz X-Received: by 2002:a05:6402:3487:b0:45d:2674:d187 with SMTP id v7-20020a056402348700b0045d2674d187mr7752117edc.386.1667116116913; Sun, 30 Oct 2022 00:48:36 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id o3-20020a170906288300b0078c0c866a18si3272929ejd.19.2022.10.30.00.48.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 00:48:36 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Ba9YYNLQ; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9B87D382DE32 for ; Sun, 30 Oct 2022 07:47:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9B87D382DE32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667116040; bh=XQv8Is1uIesWkjcJxwprIoCIICnOAXDzrEjGwT6htIw=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Ba9YYNLQV3VagW/H8lXOZFO8XFq0nOq7QH7B4fs3gweLdv3fXK+qY8MoqSjdxtJo4 ywBIdB1h4iZoNm0wLyHG6ruJxBHg5WvB10HJwNo8wMjn97fuxhNnUfQe8zzw0KtN6r Qf3AcL/vzgQLUuguwmITjF78rBF2Q+KjhcwsNPrA= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id F35703851175 for ; Sun, 30 Oct 2022 07:46:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F35703851175 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29U3bJ8O023053 for ; Sun, 30 Oct 2022 07:46:14 GMT Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgtkd1daw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:46:14 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 29U7OH9m029550 for ; Sun, 30 Oct 2022 07:46:13 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2171.outbound.protection.outlook.com [104.47.59.171]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kgtm28sdv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:46:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nw3Hvlgrk8WeoHuSQq0Rjks9mb3yBurkG4iNu47DnglHlm5drO1poe0tX+IeK8KwSLGLdWJkgKLVsyj/RYhho3Iey0+6/D9hj27IcBNzaBqu0azaPNUcrM0aV3vtW3fS9qaBtDSbmJgYi7lduXBrKAFECBG2+BogVaRbRSUULz4e4oDt4UN/FBR8m9MvTuMC///UFKSig4G10gVbnVniXbjCV8/PV/JLDM7183PlQ6xcDxW8cEon3o+1zqV6Qrisu+79pSG+ULjq8NXvWSfgQFAjGffsaDiBJg6ljnp8LuenS/ylS2JSOMg0G4pTIIMXXkQxu54+DbEN0kLWHszpfQ== 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=XQv8Is1uIesWkjcJxwprIoCIICnOAXDzrEjGwT6htIw=; b=ODdjtGPg4bzFqlYbvyLY7UQkNEWIT6ZTkxqpoG/E8G3jN0GBz7o5HsmaW+5URe2dxtoedVkuIyr3RTyOH3NFoAsWHoTExY/oVhU6qqV9OdDOQHa1zWggS4ywkwmRzThjGHXzFrbzuhhP84lSM66ohwSQegfxCrL/a5i8CIctuhwg8CI8VaYCFE1xtBhrTXDX/hcnPpXd7rQZe89E+W+fOMsVsTtmNkaWFYRpiee3dAkQPsbNSCPRYQ8XpeF3ocKGbL2s5V/ICHvVB0M49kUV9GzCB60t8p6/z1vp0sQIgNLfmK+fMFc5FLEv/w5zgGXel3tyvxnUQWO9hN3QcXeFxw== 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 MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by BY5PR10MB4289.namprd10.prod.outlook.com (2603:10b6:a03:20c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.19; Sun, 30 Oct 2022 07:46:11 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2%7]) with mapi id 15.20.5723.033; Sun, 30 Oct 2022 07:46:11 +0000 To: binutils@sourceware.org Subject: [PATCH, V3 14/15] gas/NEWS: add text about new command line option and SFrame support Date: Sun, 30 Oct 2022 00:44:49 -0700 Message-Id: <20221030074450.1956074-15-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221030074450.1956074-1-indu.bhagat@oracle.com> References: <20221030074450.1956074-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR03CA0355.namprd03.prod.outlook.com (2603:10b6:303:dc::30) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|BY5PR10MB4289:EE_ X-MS-Office365-Filtering-Correlation-Id: 72f61764-ea02-4cc5-cb8c-08daba4ad079 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dcWD1Y99RKCODb+SsDCAFyX9EDMXq3+jjqEcwWcTzdvu3Pvz/1yetvQpn/HiubfLjEE3LvP/4G7QRaVbzmfbnofytjnu0uTU2w9OnsLuXADuifh4JEwv1R0odwGJB7hBuURW9OumwURl83gm+Vs5WmtzdhKI5/UEQKm3YL6E0tLKPjLEcME0U/GvOstrG/KolA8L2NRK+fhFqluYBOGlfm1NbcJZ5YJ4MLMDOGNWHqOzhmo2bwC9MRJVrQXJiL4uSSRV4WLLBTEi1k/6TTlT9gE3Bf4qBrAUBF1Qmi3Oc+EoOgBhcKnxK6AKSema/OIeNUzaNan5OCEgYO8NtV5qElfUTpLImh9uwgR9EmAmyVBLVhpQ8WXl+KpyVfxnGPPSIxYDK2K58BaJNOk2HboEicEcuhu9gCldiXlDHIqNxMPPT4j2O9M/CRF8rIyVfaPt+LnjyjbVfKmbLjuZ1jxB17wrXHH5ZS7pghlfXNlalCjth+jdIKPkZ7I6yyrZSta5FnFfArDTmRf1Wfut5adsjg6bAs9hJmzxcBcfJVkeTk2XZaDjpVUBpQuNJmy6uZZZXWYrYanx+5iKW0MgWqhZuXAjMA2U43gIBVTRTnfG6JU6x8IZwS2p0s1iqT7CTTN0c2BChbi76qxP4W6EsoNaXXOd5MRQQ0GVPhfRsKPaKzjRzJiBHrTEKXFc9jvOz7MZMs1JcsC9yRhiUCc+EnTgWQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2158.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(366004)(39850400004)(376002)(346002)(136003)(451199015)(316002)(66556008)(4326008)(66476007)(36756003)(6916009)(66946007)(6486002)(38100700002)(6666004)(8936002)(41300700001)(86362001)(107886003)(478600001)(5660300002)(1076003)(186003)(8676002)(2616005)(4744005)(44832011)(2906002)(6512007)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: K4dVqlPBbq+RgB5uYC83uG3oZwO7+OrhhEUUaYPU7flolePTs3+xclKgBo3Rbw+otXjfNDLYbM8AEzmILAWICOxmhJaXFUKHTVNs6fPNNjdszWkLJ9sLVe/9F8ZBd/gpG62IRZg+kZVPr7BaaTdo+3gcF1t8ZrPX4dciqkHmVxwT7mGHqNFLj/ATAC8VB2yXZY4BotIQw4igZgfufRQ58fOXp+zIKFqU/ERGIDHc3s7Ac5NwjttSzJ3B1jexsG7pYg6Dk5Mgyq4JTlgQqAt5ZCkqSoXim69mkXD+HPjl81ZTrWCFBW6t0jMcm/Nz5CzaMrXwb4zwq1L+ptF+jUH+81xE4UB3/feo1N1TC4K8V9XNheKJxWJb0X01I7xJiJdqZ6qIk2VTDbwxZ9Cm7OvnNECH18KHw+384XkwSqoVyUlXce3KsXiC/MhvsD3V9pyDiF/W1LrwO5SWCwG48svPoL39Pp0pw6NhbClqIYHUErYKenvqTsaAFpltrUJnHRL6ww54Slq6Ycu0vloHuEpnqoO+ibry4J6r1TI4V4UHWHBmLIJ7kZddfD1lGLfyA36dlkgg4rZF6LVtV6fwRx2tz9cyriEzJLNmXlydJrP/dnas94F643Kb3j23OfG4sJG6mZ+BWpMuzLizGCuBH7loZdBoFmMjwORdshRfCBVFCie7l/ucRi6DGLlmVb7Jxe874xJVBGWzw3comKpUC000pdBrurNTrcS87quaCxjpnn04iCZ6NTJta1+nmeF3j0TxLTXLGSqyhLAW9Zo1pnnMDyGXkZ8r/UaquBTrw5278Rz3ImQA2S9pfQiks4kNpYItvoLHSr3HT7J14VsfyozBkyCkE3rTklZ/fwyize35cpRkQ9WEBc/9atuNLA6tR2cBrq9CiXnOhAGVoo+jQcQiTyW7Oi31L0JK7EhD6xp4uaTt/ghjxXk6ArPQ6OAR3GfZHAStZMImMczVIzEniogwAPC5vxKow/TiAKegRRRQtEwtrCA4zP3Bq3JQ9cgvB5+/ooiMa3JWCr8T0eEGSh+eGTx9aOJq8tfO+Q0OGHoIZnZLLwBGnHltpOJZJzn9JjedzBrxUqMBTWQXwg7l1PuWdPVP58nXZRZZZR8MNvu3jgY74snth8ooWiWBMhc7doqVz1HrsmRTEImcGjoGtulYUUHXozPVE6DUScGw7S4mWkrS4l49lTlbL7FjauHTMQqtleW7CDNk1lN/sb146SAR9dDNG09BaoVFY66Y5uTshUzRNGQR9cmtuZI01R2spVjVd6rGxHK+9nY0AGgGZiTI85L9p0P4tkccLgl+fDNOKVqzqX0GXj1FM2RijzaB2lSJ/mktTvGN17SA+owQEjtqyoVkxm8ZSFliQJObvj8PaN2LQ6GEBikHw37tV1EkI/ynlF3c8/xILeaLJabAUDYYVjJf9nC5xNNyhWLz7s6oGwJogtXCaObD5FVjpAzw3ElEwfltJ3WYMqYpzce9kLtQKyyJH9XvXOCSamxQzFag9TzZtP7EwRKEjddkZrhNE+NTW+cFRf5NRYv/prE9p9dAYTQC90NC8672L3GTWHKicuqBRigLypMkIS9ce63TNakHw/AXsMZNtg8G1KrQmzJP7Xb20ltX2OlxtmLLXfP/T58= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 72f61764-ea02-4cc5-cb8c-08daba4ad079 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2022 07:46:11.5273 (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: Rkq090QvEnHQ799bV7EM0kUX1O+tvxaotwQ71x5bnJXBJYafwucq+Ps+Tt738Ik5RfQCyaG80ktijOK0/lpWgQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4289 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-30_02,2022-10-27_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 bulkscore=0 suspectscore=0 phishscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2210300049 X-Proofpoint-ORIG-GUID: Tak9aFeG-9jmZRTy7FvS4laGCW-7nzJQ X-Proofpoint-GUID: Tak9aFeG-9jmZRTy7FvS4laGCW-7nzJQ X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Indu Bhagat via Binutils From: Indu Bhagat Reply-To: Indu Bhagat Cc: Indu Bhagat Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748097949361334174?= X-GMAIL-MSGID: =?utf-8?q?1748097949361334174?= [No changes in V3, V2] ChangeLog: * gas/NEWS: Add SFrame related news. --- gas/NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gas/NEWS b/gas/NEWS index 31b3b664dff..6d2d4a7221d 100644 --- a/gas/NEWS +++ b/gas/NEWS @@ -13,6 +13,9 @@ XTheadMac, and XTheadSync) from version 2.0 of the T-Head ISA manual, which are implemented in the Allwinner D1. +* New command line option --gsframe to generate SFrame unwind information + on x86_64 and aarch64 targets. + Changes in 2.39: * Remove (rudimentary) support for the x86-64 sub-architectures Intel L1OM and From patchwork Sun Oct 30 07:44:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 12958 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1686883wru; Sun, 30 Oct 2022 00:51:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7QHujey3MK+InIlc/RivWkqJT2jGf+jjj4/Vr/sAYsfWbtOlX+UjcNkyYh3lqIojhi9kZV X-Received: by 2002:a05:6402:1391:b0:459:cb69:9a2b with SMTP id b17-20020a056402139100b00459cb699a2bmr7727281edv.201.1667116262066; Sun, 30 Oct 2022 00:51:02 -0700 (PDT) Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id gt18-20020a1709072d9200b0078db3ce1e59si4951640ejc.38.2022.10.30.00.51.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 00:51:02 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=N+2B2WZC; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EF98F3887F5A for ; Sun, 30 Oct 2022 07:48:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EF98F3887F5A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667116110; bh=kJ4fxZscKAAwL5gQkW6rQd9xLBjb7RzxZy7o16tQeIE=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=N+2B2WZCUoyfGrGnqx+koExdgEbGBNSTB10u2ntc37gDjsCNNvpSFyLHcRJy8PGUM fly64O2/kntMwciAIaG5AZWCgKJcg1CUcGgA2TKsKBb18kXTW6t+SV6g2YSfZCXUnj MOUnGH6Fi5otEpw0c0gB78Oxc87lisM/g3WQOYik= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 16538385783B for ; Sun, 30 Oct 2022 07:46:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 16538385783B 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 29TKLkQC024048 for ; Sun, 30 Oct 2022 07:46:19 GMT Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgv2a99ua-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:46:18 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 29U6noAS029438 for ; Sun, 30 Oct 2022 07:46:18 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2042.outbound.protection.outlook.com [104.47.66.42]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kgtm28sem-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 30 Oct 2022 07:46:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZxEZV1KUfTyfqK01Xn8lrHW9EK4QnaFflNaOGztUq7j7TiwAeW3xv0WY6eBS8bVTtLMZu96gc+DQaiY81JPlznFpt9D8HpVAC/8CZk+ZoICA5+XQOznRU/KeaJTF7WTkFzt42FmZmghaBSXAx8bNMNCLUX8ALvo08Vozuks/HrgezgdumVN+C/IM5R3tTkRHNYXyYWQ+bDUPN6kWz6RCgPVn5i89uWNvkDMj6NdY0PcYxzoYijUlY4z4ACIpsfkPU7veGIOn2BwE4YidnuSFyTezkq7imx2DCUJRekwVPLVzAdAK7ecGJzK5Hsa4OyQW7EyGlvrvw532OD4nM/DwDQ== 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=kJ4fxZscKAAwL5gQkW6rQd9xLBjb7RzxZy7o16tQeIE=; b=cbl6uUJTx6fd+UssCocj0rO10KskXqnfvbRFnL46Tn8rm7PZKBYovEUHXXkBu+QWYEEPPNiq5+BTKlsbJgKjp4irQw9FnlObR2XPL2d00JYmWX0D0nAWo+ZRjL8IBy6T9ECdvpPcfqbSJy2kuJv8Wj7NiqZlGSi6oCYL4+NFRbT8RpOMSqdA7vR8hbFNtp7O4xMYqYCI1igi7sPSho+Dki1LrFfCPtGxDlHcj3x1MBkf/zirmdCzYzzxvMxdd/l0/AoC0Z3Rx2GKJebMulOAcagZDoUPjsX67JovGvnHmhPC4tVdyXtXiY56D6BijynI07XU5pfiGPtJh7sh/3MtUw== 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 MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by SA2PR10MB4746.namprd10.prod.outlook.com (2603:10b6:806:11c::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.19; Sun, 30 Oct 2022 07:46:14 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::a505:15c2:a248:efa2%7]) with mapi id 15.20.5723.033; Sun, 30 Oct 2022 07:46:14 +0000 To: binutils@sourceware.org Subject: [PATCH,V3 15/15] doc: add SFrame spec file Date: Sun, 30 Oct 2022 00:44:50 -0700 Message-Id: <20221030074450.1956074-16-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221030074450.1956074-1-indu.bhagat@oracle.com> References: <20221030074450.1956074-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR03CA0339.namprd03.prod.outlook.com (2603:10b6:303:dc::14) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|SA2PR10MB4746:EE_ X-MS-Office365-Filtering-Correlation-Id: 12ec4b90-970d-4d65-d2bf-08daba4ad213 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: p205VfqS5atD2gZPUgOSDlOcWNhKLeHkiqDy3KQuPOKFfKAJtSiHcf+bQa7WYaFVHuaHTzKzqlNYkO5FCOwZ4wMBQjb2e3jlv/l2nTgGLdQ7cK379lA5ZRWU1MnBt6FziHwb2oFprNCtrDn5SA4RUblcUsk8QmsHt7NiRC3P9zEiwdhPYSw+BtwvdOwNBEaee3Bf0eC3dfLPH+hG5ai2QfXE/6dBNq43R4BK5uI5WMrFL4n7T23cT02iTFBwYkPn0xquavXntMltq/PcQx3tmxmUMNGN+tTcIIL2qWDZI0aC+dYDTuRy00gDvvLeQSSqw1TXyA235sOJUsqgskvqOnDtqWd01szJkuB5T06ZiDOFqH4f2Fu8yEFxmgn19bmcB3atyarMq0QhTPXuwi/5IfToEbBOQJ747S7W6twd76L5fuRVph0CjuQ5BSFVk0mrJnmNsCq9qx9VRbcWH+hKnBZxfE/eyAPXv3v8E6GVGBhYW4tGkPBArED8L3aj7eIX3oRGtshNTBBbp/mUs2trt8BxW9XPLaziI9SK+G7gOZEdtGf7HQLzClltpMJVnWaOuAqujdj2Dcljnv+SuAvnIHOLI/nzMlbvLtAew2/PJN+sIo0IsqMD0bxK4aSCsrmtdbuVnxmBqJPNZc78RivOWmJDyUewHhZd6Woa5eA2rJuiotOhytAt+E3Zq1GnqJE8Ef1GwF+o0DbAeDiCT6eHjwjNtpaYca+uIssgHBFrhh97N58Mb2EdF4+TICUmzgMd2ZLZGzVOdC+uJJDhqZMCIWj7/1OOZ+JGv6i853c4DZk= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2158.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(346002)(39860400002)(376002)(136003)(366004)(451199015)(6486002)(2906002)(44832011)(38100700002)(1076003)(186003)(5660300002)(2616005)(83380400001)(41300700001)(107886003)(86362001)(8936002)(6666004)(478600001)(6512007)(30864003)(6506007)(36756003)(8676002)(316002)(6916009)(4326008)(66476007)(66556008)(66946007)(2004002)(579004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: q7Bqvaj8hW31d54YoXrNsLimLXLkw6CgIsO/izjNZR7p25/KFgec2P9wkFoyjlDXQZRn8sb+koIwYJtaHUpmdMuZU2WLXt41lLeyYAI8wOVeJ81md7ai+b4C2GjFnSD+ttvl7queifOEKZIVznNZfcd6pQNvumQpDcwRDz2J3xU+mubr005XqStuWywoa8OdC5czPgq2/OHhNHmGp6N6JYcAzXw+KxBcG2gnzhhJQP3rJLZnahhU5Kasw9oobA1+75BRQy83CTK+SLoBpvLsmFjnQYRGlJd3VoRssLQ8n/CdwyFp43+xegIIoJ6iK9AUtUcd6mGc6WGtsntMiEM3PKntPHEW4VIMUFZZUMMgrcX/yOtgpgaP0RNBXUE5ko1Plqg9ruXCDjdV/TWyWybUjWihEGAUePyzBXxrP4xil1bEVr6fYD8YUt0wO/h2yTnSOodxpQki/ncinbZB/lfb+tQD+gqMfP2k5+sejaUWunKM/q2V4Y0Rz8RJgxBM7ZWgRD+XVdt1BJCtvNjOHdOrtmTDZcLViShb+FdU93TygqbzUOIrGGLSpT0sLdj3aZC8YhPTFPHVqdrEZeKRwnLOFFyDUmzGkTy37+0WuHqtUapyyv0M2kMawzTJFbhWRXxNOqa5N0ki1b91znrMa8aW6eHi/R7DzR322Xd8EUlR8gtdFS1hdj/RgwuvV1TzA8ipLSN324L4az27AbYGBiDBH++IdVcnFu5iJ4GWcWDtBYnjdKNFRnl8+MAhCxnnDagoCnb6zn7TYEefDoEHmURB+pMHKJhSmUtH4VsN8w8Yz1FMWhbLTsqtSziSniD1Ysyt4f2/4p4QJbS2qlwcnhZ3qdOx/z7v0qTF69oBajGm+lVRjvwd7ZsUarkxhIAA+OrEYTZpUPFDXlnAZ5+KDb8XWvfSM9rMTO4mglfTE3h8RwdWyeJvY0AvxkpFLPWOKIaolC5fc9KD+StkkVerDfqGHFkiFLNdV3Drk3poMA6yb8yiBQS4Ra73xfDpxJWbIAiibBrbug4wjESNb2iYBQmYuSTxI+m3bNOjfCFHoGkUk3iFqUp5FRQBSCdNELQOUMQfCeoJ5xzRcR3h0sRI/Qu7Fnj3K84IQp6FjEjvDfedjEBiSyw8bwj/1Juuwa2o3CsiZY0iw4JZqNmJkaPrmglhWcfL4LCsKP1NEsogTVRyozMIU4v69bIePxCDdXzE2JDjZ58Yy0QpOY5WdOG6b0K+A5sDr7eKMGGdukeCn0moAI7xGPNrMqvzieQC/aCZyLK1lviQ2zFGjAUO3AHguvPOPJSTj/iYjIs3ZzQw5szYTgp2sTAhV5BTkpQA2ZcI71kqlTNkAmG++wWhPpndx9nOfWTjAR2byqH9QB8usVVvjUwzSYPBusSObNjtfd+qu+qDr9rIPJg7RTH/dGKIUHUUSn0ToEfSAYpl/HFdftmc89PDJIN9DT2gOYRCcV/VhD9X0vBPB5DOfSpYWfo5p1fE3Y3y4vbzYEg1UoPGKWu1Z9eUZTRZYsz5sT8csfokieqRweqP2eUu0+gZ3GLPQtesXeXxuDJtofMvZoU3iiuZ39n9iJ2wZj1J/6mVpLhrzpR6RgHQJILn7Qiv8+FS5kc6bSlnj7oB1WzwqKw+oVIemXg= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 12ec4b90-970d-4d65-d2bf-08daba4ad213 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2022 07:46:14.3082 (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: RXvWshpFfowzvOmJsQs2FuDe8j+6P8uHD8wAO33Djo+787Q+uzpnn8T5oeN6hxWELK5rveQoygHJ3EresP+r4w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4746 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-30_02,2022-10-27_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 bulkscore=0 suspectscore=0 phishscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2210300049 X-Proofpoint-ORIG-GUID: Nhb-SbFfv8FqtRl7E-crXS6u4wIAqnis X-Proofpoint-GUID: Nhb-SbFfv8FqtRl7E-crXS6u4wIAqnis X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Indu Bhagat via Binutils From: Indu Bhagat Reply-To: Indu Bhagat Cc: Indu Bhagat Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748098101849432337?= X-GMAIL-MSGID: =?utf-8?q?1748098101849432337?= [Changes in V3] - Update documentation around the implicit order of the FRE offsets. [End of changes in V3] [New addition in V2] PS: libsframe/configure has NOT been included in the patch. Please regenerate. ChangeLog: * libsframe/Makefile.am: Add info-in-builddir to AUTOMAKE_OPTIONS. Include doc/local.mk. * libsframe/Makefile.in: Regenerated. * libsframe/configure: Likewise. <-- [REMOVED FROM THE PATCH. PLEASE REGENERATE. ] * libsframe/configure.ac: Check for makeinfo and set BUILD_INFO. * libsframe/doc/local.mk: New file. * libsframe/doc/sframe-spec.texi: Likewise. --- libsframe/Makefile.am | 9 +- libsframe/Makefile.in | 418 +++++++++++++++++++--- libsframe/configure.ac | 21 ++ libsframe/doc/local.mk | 40 +++ libsframe/doc/sframe-spec.texi | 619 +++++++++++++++++++++++++++++++++ 5 files changed, 1058 insertions(+), 49 deletions(-) create mode 100644 libsframe/doc/local.mk create mode 100644 libsframe/doc/sframe-spec.texi diff --git a/libsframe/Makefile.am b/libsframe/Makefile.am index 6b27ccdcdf6..bc038830172 100644 --- a/libsframe/Makefile.am +++ b/libsframe/Makefile.am @@ -18,7 +18,12 @@ # ACLOCAL_AMFLAGS = -I .. -I ../config -I ../bfd -AUTOMAKE_OPTIONS = dejagnu foreign no-texinfo.tex subdir-objects +AUTOMAKE_OPTIONS = dejagnu foreign no-texinfo.tex info-in-builddir subdir-objects + +# Variables that we might accumulate conditionally or in subdirs. +info_TEXINFOS = +DISTCLEANFILES = +MAINTAINERCLEANFILES = INCDIR = $(srcdir)/../include # include libctf for swap.h @@ -48,4 +53,6 @@ else endif endif +include doc/local.mk + include testsuite/local.mk diff --git a/libsframe/Makefile.in b/libsframe/Makefile.in index a96a7102953..72b2ed12bf9 100644 --- a/libsframe/Makefile.in +++ b/libsframe/Makefile.in @@ -14,6 +14,24 @@ @SET_MAKE@ +# +# Copyright (C) 2019-2022 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not see +# . +# + VPATH = @srcdir@ am__is_gnu_make = { \ @@ -92,8 +110,11 @@ host_triplet = @host@ @HAVE_SFRAME_AS_TRUE@@INSTALL_LIBBFD_TRUE@am__append_1 = libsframebt.la @HAVE_SFRAME_AS_TRUE@@INSTALL_LIBBFD_TRUE@am__append_2 = $(INCDIR)/sframe-backtrace-api.h @HAVE_SFRAME_AS_TRUE@@INSTALL_LIBBFD_FALSE@am__append_3 = libsframebt.la +@BUILD_INFO_TRUE@am__append_4 = doc/sframe-spec.texi +@BUILD_INFO_TRUE@am__append_5 = texput.log +@BUILD_INFO_TRUE@am__append_6 = doc/sframe-spec.info check_PROGRAMS = $(am__EXEEXT_1) -@HAVE_COMPAT_DEJAGNU_TRUE@am__append_4 = testsuite/libsframe.decode/be-flipping \ +@HAVE_COMPAT_DEJAGNU_TRUE@am__append_7 = testsuite/libsframe.decode/be-flipping \ @HAVE_COMPAT_DEJAGNU_TRUE@ testsuite/libsframe.decode/frecnt-1 \ @HAVE_COMPAT_DEJAGNU_TRUE@ testsuite/libsframe.decode/frecnt-2 \ @HAVE_COMPAT_DEJAGNU_TRUE@ testsuite/libsframe.encode/encode-1 @@ -149,7 +170,8 @@ am__uninstall_files_from_dir = { \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(infodir)" \ + "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) libsframe_la_LIBADD = am_libsframe_la_OBJECTS = libsframe_la-sframe.lo \ @@ -245,6 +267,46 @@ DIST_SOURCES = $(libsframe_la_SOURCES) \ $(testsuite_libsframe_decode_frecnt_1_SOURCES) \ $(testsuite_libsframe_decode_frecnt_2_SOURCES) \ $(testsuite_libsframe_encode_encode_1_SOURCES) +AM_V_DVIPS = $(am__v_DVIPS_@AM_V@) +am__v_DVIPS_ = $(am__v_DVIPS_@AM_DEFAULT_V@) +am__v_DVIPS_0 = @echo " DVIPS " $@; +am__v_DVIPS_1 = +AM_V_MAKEINFO = $(am__v_MAKEINFO_@AM_V@) +am__v_MAKEINFO_ = $(am__v_MAKEINFO_@AM_DEFAULT_V@) +am__v_MAKEINFO_0 = @echo " MAKEINFO" $@; +am__v_MAKEINFO_1 = +AM_V_INFOHTML = $(am__v_INFOHTML_@AM_V@) +am__v_INFOHTML_ = $(am__v_INFOHTML_@AM_DEFAULT_V@) +am__v_INFOHTML_0 = @echo " INFOHTML" $@; +am__v_INFOHTML_1 = +AM_V_TEXI2DVI = $(am__v_TEXI2DVI_@AM_V@) +am__v_TEXI2DVI_ = $(am__v_TEXI2DVI_@AM_DEFAULT_V@) +am__v_TEXI2DVI_0 = @echo " TEXI2DVI" $@; +am__v_TEXI2DVI_1 = +AM_V_TEXI2PDF = $(am__v_TEXI2PDF_@AM_V@) +am__v_TEXI2PDF_ = $(am__v_TEXI2PDF_@AM_DEFAULT_V@) +am__v_TEXI2PDF_0 = @echo " TEXI2PDF" $@; +am__v_TEXI2PDF_1 = +AM_V_texinfo = $(am__v_texinfo_@AM_V@) +am__v_texinfo_ = $(am__v_texinfo_@AM_DEFAULT_V@) +am__v_texinfo_0 = -q +am__v_texinfo_1 = +AM_V_texidevnull = $(am__v_texidevnull_@AM_V@) +am__v_texidevnull_ = $(am__v_texidevnull_@AM_DEFAULT_V@) +am__v_texidevnull_0 = > /dev/null +am__v_texidevnull_1 = +INFO_DEPS = doc/sframe-spec.info +am__TEXINFO_TEX_DIR = $(srcdir) +DVIS = doc/sframe-spec.dvi +PDFS = doc/sframe-spec.pdf +PSS = doc/sframe-spec.ps +HTMLS = doc/sframe-spec.html +TEXINFOS = $(am__append_4) +TEXI2DVI = texi2dvi +TEXI2PDF = $(TEXI2DVI) --pdf --batch +MAKEINFOHTML = $(MAKEINFO) --html +AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS) +DVIPS = dvips am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -278,6 +340,7 @@ AM_RECURSIVE_TARGETS = cscope DEJATOOL = $(PACKAGE) RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(srcdir)/doc/local.mk \ $(srcdir)/testsuite/libsframe.decode/local.mk \ $(srcdir)/testsuite/libsframe.encode/local.mk \ $(srcdir)/testsuite/local.mk $(top_srcdir)/../ar-lib \ @@ -439,7 +502,12 @@ top_srcdir = @top_srcdir@ # . # ACLOCAL_AMFLAGS = -I .. -I ../config -I ../bfd -AUTOMAKE_OPTIONS = dejagnu foreign no-texinfo.tex subdir-objects +AUTOMAKE_OPTIONS = dejagnu foreign no-texinfo.tex info-in-builddir subdir-objects + +# Variables that we might accumulate conditionally or in subdirs. +info_TEXINFOS = $(am__append_4) +DISTCLEANFILES = $(am__append_5) +MAINTAINERCLEANFILES = $(am__append_6) INCDIR = $(srcdir)/../include # include libctf for swap.h AM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../libctf @@ -455,6 +523,7 @@ libsframe_la_CPPFLAGS = $(AM_CPPFLAGS) @HAVE_SFRAME_AS_TRUE@libsframebt_la_SOURCES = sframe-backtrace.c sframe-backtrace-err.c @HAVE_SFRAME_AS_TRUE@libsframebt_la_CPPFLAGS = -I$(srcdir) -I$(srcdir)/../include @HAVE_SFRAME_AS_TRUE@libsframebt_la_CFLAGS = -Wa,--gsframe +@BUILD_INFO_TRUE@AM_MAKEINFOFLAGS = --no-split # Setup the testing framework EXPECT = expect @@ -476,10 +545,10 @@ all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: -.SUFFIXES: .c .lo .o .obj +.SUFFIXES: .c .dvi .lo .o .obj .ps am--refresh: Makefile @: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/testsuite/local.mk $(srcdir)/testsuite/libsframe.decode/local.mk $(srcdir)/testsuite/libsframe.encode/local.mk $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/doc/local.mk $(srcdir)/testsuite/local.mk $(srcdir)/testsuite/libsframe.decode/local.mk $(srcdir)/testsuite/libsframe.encode/local.mk $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -501,7 +570,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; -$(srcdir)/testsuite/local.mk $(srcdir)/testsuite/libsframe.decode/local.mk $(srcdir)/testsuite/libsframe.encode/local.mk $(am__empty): +$(srcdir)/doc/local.mk $(srcdir)/testsuite/local.mk $(srcdir)/testsuite/libsframe.decode/local.mk $(srcdir)/testsuite/libsframe.encode/local.mk $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck @@ -771,6 +840,145 @@ clean-libtool: distclean-libtool: -rm -f libtool config.lt +doc/$(am__dirstamp): + @$(MKDIR_P) doc + @: > doc/$(am__dirstamp) + +@BUILD_INFO_TRUE@doc/sframe-spec.info: doc/sframe-spec.texi +@BUILD_INFO_TRUE@ @test -f doc/$(am__dirstamp) || $(MAKE) $(AM_MAKEFLAGS) doc/$(am__dirstamp) +@BUILD_INFO_TRUE@ $(AM_V_MAKEINFO)restore=: && backupdir="$(am__leading_dot)am$$$$" && \ +@BUILD_INFO_TRUE@ rm -rf $$backupdir && mkdir $$backupdir && \ +@BUILD_INFO_TRUE@ if ($(MAKEINFO) --version) >/dev/null 2>&1; then \ +@BUILD_INFO_TRUE@ for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ +@BUILD_INFO_TRUE@ if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \ +@BUILD_INFO_TRUE@ done; \ +@BUILD_INFO_TRUE@ else :; fi && \ +@BUILD_INFO_TRUE@ if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc \ +@BUILD_INFO_TRUE@ -o $@ `test -f 'doc/sframe-spec.texi' || echo '$(srcdir)/'`doc/sframe-spec.texi; \ +@BUILD_INFO_TRUE@ then \ +@BUILD_INFO_TRUE@ rc=0; \ +@BUILD_INFO_TRUE@ else \ +@BUILD_INFO_TRUE@ rc=$$?; \ +@BUILD_INFO_TRUE@ $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ +@BUILD_INFO_TRUE@ fi; \ +@BUILD_INFO_TRUE@ rm -rf $$backupdir; exit $$rc + +doc/sframe-spec.dvi: doc/sframe-spec.texi doc/$(am__dirstamp) + $(AM_V_TEXI2DVI)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \ + $(TEXI2DVI) $(AM_V_texinfo) --build-dir=$(@:.dvi=.t2d) -o $@ $(AM_V_texidevnull) \ + `test -f 'doc/sframe-spec.texi' || echo '$(srcdir)/'`doc/sframe-spec.texi + +doc/sframe-spec.pdf: doc/sframe-spec.texi doc/$(am__dirstamp) + $(AM_V_TEXI2PDF)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \ + $(TEXI2PDF) $(AM_V_texinfo) --build-dir=$(@:.pdf=.t2p) -o $@ $(AM_V_texidevnull) \ + `test -f 'doc/sframe-spec.texi' || echo '$(srcdir)/'`doc/sframe-spec.texi + +doc/sframe-spec.html: doc/sframe-spec.texi doc/$(am__dirstamp) + $(AM_V_MAKEINFO)rm -rf $(@:.html=.htp) + $(AM_V_at)if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc \ + -o $(@:.html=.htp) `test -f 'doc/sframe-spec.texi' || echo '$(srcdir)/'`doc/sframe-spec.texi; \ + then \ + rm -rf $@ && mv $(@:.html=.htp) $@; \ + else \ + rm -rf $(@:.html=.htp); exit 1; \ + fi +.dvi.ps: + $(AM_V_DVIPS)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + $(DVIPS) $(AM_V_texinfo) -o $@ $< + +uninstall-dvi-am: + @$(NORMAL_UNINSTALL) + @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \ + rm -f "$(DESTDIR)$(dvidir)/$$f"; \ + done + +uninstall-html-am: + @$(NORMAL_UNINSTALL) + @list='$(HTMLS)'; test -n "$(htmldir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \ + rm -rf "$(DESTDIR)$(htmldir)/$$f"; \ + done + +uninstall-info-am: + @$(PRE_UNINSTALL) + @if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); then \ + list='$(INFO_DEPS)'; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \ + if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \ + then :; else test ! -f "$(DESTDIR)$(infodir)/$$relfile" || exit 1; fi; \ + done; \ + else :; fi + @$(NORMAL_UNINSTALL) + @list='$(INFO_DEPS)'; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ + (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \ + echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \ + rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ + else :; fi); \ + done + +uninstall-pdf-am: + @$(NORMAL_UNINSTALL) + @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \ + rm -f "$(DESTDIR)$(pdfdir)/$$f"; \ + done + +uninstall-ps-am: + @$(NORMAL_UNINSTALL) + @list='$(PSS)'; test -n "$(psdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \ + rm -f "$(DESTDIR)$(psdir)/$$f"; \ + done + +dist-info: $(INFO_DEPS) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + list='$(INFO_DEPS)'; \ + for base in $$list; do \ + case $$base in \ + $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ + if test -f $$base; then d=.; else d=$(srcdir); fi; \ + base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \ + for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \ + if test -f $$file; then \ + relfile=`expr "$$file" : "$$d/\(.*\)"`; \ + test -f "$(distdir)/$$relfile" || \ + cp -p $$file "$(distdir)/$$relfile"; \ + else :; fi; \ + done; \ + done + +mostlyclean-aminfo: + -rm -rf doc/sframe-spec.t2d doc/sframe-spec.t2p + +clean-aminfo: + -test -z "doc/sframe-spec.dvi doc/sframe-spec.pdf doc/sframe-spec.ps \ + doc/sframe-spec.html" \ + || rm -rf doc/sframe-spec.dvi doc/sframe-spec.pdf doc/sframe-spec.ps \ + doc/sframe-spec.html + +maintainer-clean-aminfo: + @list='$(INFO_DEPS)'; for i in $$list; do \ + i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \ + echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \ + rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \ + done install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ @@ -914,6 +1122,9 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-info -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ @@ -1049,9 +1260,9 @@ check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU check: check-am -all-am: Makefile $(LTLIBRARIES) $(HEADERS) config.h +all-am: Makefile $(INFO_DEPS) $(LTLIBRARIES) $(HEADERS) config.h installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \ + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(infodir)" "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -1080,18 +1291,23 @@ clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -rm -f doc/$(am__dirstamp) -rm -f testsuite/libsframe.decode/$(DEPDIR)/$(am__dirstamp) -rm -f testsuite/libsframe.decode/$(am__dirstamp) -rm -f testsuite/libsframe.encode/$(DEPDIR)/$(am__dirstamp) -rm -f testsuite/libsframe.encode/$(am__dirstamp) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +@BUILD_INFO_FALSE@html-local: clean: clean-am -clean-am: clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \ - clean-libtool clean-noinstLTLIBRARIES mostlyclean-am +clean-am: clean-aminfo clean-checkPROGRAMS clean-generic \ + clean-libLTLIBRARIES clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) @@ -1103,42 +1319,133 @@ distclean-am: clean-am distclean-DEJAGNU distclean-compile \ dvi: dvi-am -dvi-am: +dvi-am: $(DVIS) html: html-am -html-am: +html-am: $(HTMLS) html-local info: info-am -info-am: +info-am: $(INFO_DEPS) -install-data-am: install-includeHEADERS +install-data-am: install-includeHEADERS install-info-am install-dvi: install-dvi-am -install-dvi-am: - +install-dvi-am: $(DVIS) + @$(NORMAL_INSTALL) + @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dvidir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \ + done install-exec-am: install-libLTLIBRARIES install-html: install-html-am -install-html-am: - +install-html-am: $(HTMLS) + @$(NORMAL_INSTALL) + @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \ + $(am__strip_dir) \ + d2=$$d$$p; \ + if test -d "$$d2"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \ + $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ + echo " $(INSTALL_DATA) '$$d2'/* '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d2"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \ + else \ + list2="$$list2 $$d2"; \ + fi; \ + done; \ + test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \ + done; } install-info: install-info-am -install-info-am: - +install-info-am: $(INFO_DEPS) + @$(NORMAL_INSTALL) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \ + fi; \ + for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \ + for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \ + $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \ + if test -f $$ifile; then \ + echo "$$ifile"; \ + else : ; fi; \ + done; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done + @$(POST_INSTALL) + @if $(am__can_run_installinfo); then \ + list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\ + install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\ + done; \ + else : ; fi install-man: install-pdf: install-pdf-am -install-pdf-am: - +install-pdf-am: $(PDFS) + @$(NORMAL_INSTALL) + @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pdfdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)" || exit $$?; done install-ps: install-ps-am -install-ps-am: - +install-ps-am: $(PSS) + @$(NORMAL_INSTALL) + @list='$(PSS)'; test -n "$(psdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(psdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)" || exit $$?; done installcheck-am: maintainer-clean: maintainer-clean-am @@ -1146,48 +1453,63 @@ maintainer-clean: maintainer-clean-am -rm -rf $(top_srcdir)/autom4te.cache -rm -rf ./$(DEPDIR) testsuite/libsframe.decode/$(DEPDIR) testsuite/libsframe.encode/$(DEPDIR) -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic +maintainer-clean-am: distclean-am maintainer-clean-aminfo \ + maintainer-clean-generic mostlyclean: mostlyclean-am -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool +mostlyclean-am: mostlyclean-aminfo mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf: pdf-am -pdf-am: +pdf-am: $(PDFS) ps: ps-am -ps-am: +ps-am: $(PSS) -uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES +uninstall-am: uninstall-dvi-am uninstall-html-am \ + uninstall-includeHEADERS uninstall-info-am \ + uninstall-libLTLIBRARIES uninstall-pdf-am uninstall-ps-am .MAKE: all check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--refresh check check-DEJAGNU \ - check-am clean clean-checkPROGRAMS clean-cscope clean-generic \ - clean-libLTLIBRARIES clean-libtool clean-noinstLTLIBRARIES \ - cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ - dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ - distcheck distclean distclean-DEJAGNU distclean-compile \ - distclean-generic distclean-hdr distclean-libtool \ - distclean-tags distcleancheck distdir distuninstallcheck dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-includeHEADERS install-info install-info-am \ - install-libLTLIBRARIES install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am uninstall-includeHEADERS \ - uninstall-libLTLIBRARIES + check-am clean clean-aminfo clean-checkPROGRAMS clean-cscope \ + clean-generic clean-libLTLIBRARIES clean-libtool \ + clean-noinstLTLIBRARIES cscope cscopelist-am ctags ctags-am \ + dist dist-all dist-bzip2 dist-gzip dist-info dist-lzip \ + dist-shar dist-tarZ dist-xz dist-zip distcheck distclean \ + distclean-DEJAGNU distclean-compile distclean-generic \ + distclean-hdr distclean-libtool distclean-tags distcleancheck \ + distdir distuninstallcheck dvi dvi-am html html-am html-local \ + info info-am install install-am install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-includeHEADERS \ + install-info install-info-am install-libLTLIBRARIES \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-aminfo \ + maintainer-clean-generic mostlyclean mostlyclean-aminfo \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-dvi-am uninstall-html-am uninstall-includeHEADERS \ + uninstall-info-am uninstall-libLTLIBRARIES uninstall-pdf-am \ + uninstall-ps-am .PRECIOUS: Makefile +@BUILD_INFO_TRUE@html-local: doc/sframe-spec/index.html +@BUILD_INFO_TRUE@doc/sframe-spec/index.html: doc/sframe-spec.texi doc/$(am__dirstamp) +@BUILD_INFO_TRUE@ $(AM_V_GEN)$(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) \ +@BUILD_INFO_TRUE@ --split=node -I$(srcdir) --output doc/sframe-spec $(srcdir)/doc/sframe-spec.texi + +# Workaround bug in automake: it can't handle conditionally building info pages +# since GNU projects normally include info pages in the source distributions. +@BUILD_INFO_FALSE@doc/sframe-spec.info: + check-DEJAGNU: site.exp srcroot=`cd $(srcdir) && pwd`; export srcroot; \ r=`pwd`; export r; \ diff --git a/libsframe/configure.ac b/libsframe/configure.ac index 038331dba2e..87b91eab113 100644 --- a/libsframe/configure.ac +++ b/libsframe/configure.ac @@ -70,6 +70,27 @@ fi CROSS_COMPILE=$is_cross_compiler AC_SUBST([CROSS_COMPILE]) +dnl Check for makeinfo for building documentation +build_info= +AC_CHECK_PROGS([MAKEINFO], makeinfo, makeinfo, ) +if test "x$MAKEINFO" = "x"; then + MAKEINFO="@echo makeinfo missing; true" + build_info= +else + BUILD_INFO=info + case "$MAKEINFO" in + */missing\ makeinfo*) + build_info= + AC_MSG_WARN([ +*** Makeinfo is missing. Info documentation will not be built.]) + ;; + *) + build_info=yes + ;; + esac +fi +AM_CONDITIONAL(BUILD_INFO, test "${build_info}" = yes) + dnl The libsframebt library needs to be built with SFrame info. dnl If the build assembler is not capable of generate SFrame then dnl the library is not built. diff --git a/libsframe/doc/local.mk b/libsframe/doc/local.mk new file mode 100644 index 00000000000..bdd1312e040 --- /dev/null +++ b/libsframe/doc/local.mk @@ -0,0 +1,40 @@ +## Process this file with automake to produce Makefile.in. +# +# Copyright (C) 2019-2022 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not see +# . +# + +if BUILD_INFO + +info_TEXINFOS += %D%/sframe-spec.texi + +AM_MAKEINFOFLAGS = --no-split + +DISTCLEANFILES += texput.log +MAINTAINERCLEANFILES += %D%/sframe-spec.info + +html-local: %D%/sframe-spec/index.html +%D%/sframe-spec/index.html: %D%/sframe-spec.texi %D%/$(am__dirstamp) + $(AM_V_GEN)$(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) \ + --split=node -I$(srcdir) --output %D%/sframe-spec $(srcdir)/%D%/sframe-spec.texi + +else + +# Workaround bug in automake: it can't handle conditionally building info pages +# since GNU projects normally include info pages in the source distributions. +%D%/sframe-spec.info: + +endif diff --git a/libsframe/doc/sframe-spec.texi b/libsframe/doc/sframe-spec.texi new file mode 100644 index 00000000000..41f4ba17d83 --- /dev/null +++ b/libsframe/doc/sframe-spec.texi @@ -0,0 +1,619 @@ +\input texinfo @c -*- Texinfo -*- +@setfilename sframe-spec.info +@settitle The SFrame Format +@ifnottex +@xrefautomaticsectiontitle on +@end ifnottex + +@copying +Copyright @copyright{} 2021-2022 Free Software Foundation, Inc. + +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU General Public License, Version 3 or any +later version published by the Free Software Foundation. A copy of the +license is included in the section entitled ``GNU General Public +License''. + +@end copying + +@dircategory Software development +@direntry +* SFrame: (sframe-spec). The Simple Frame format. +@end direntry + +@titlepage +@title The SFrame Format +@subtitle Version 1 +@author Indu Bhagat + +@page +@vskip 0pt plus 1filll +@insertcopying +@end titlepage +@contents + +@ifnottex +@node Top +@top The SFrame format + +This manual describes version 1 of the SFrame file format. SFrame stands for +Simple Frame format. SFrame format keeps track of the minimal necessary +information needed for stack unwinding: + +@itemize @minus +@item +Canonical Frame Address (CFA). +@item +Frame Pointer (FP). +@item +Return Address (RA). +@end itemize + +The reason for existence of the SFrame format is to support fast, online +backtracing using a simple unwinder. + +@menu +* Overview:: +* SFrame section:: +* Index:: +@end menu + +@end ifnottex + +@node Overview +@unnumbered Overview +@cindex Overview +@tindex PT_GNU_SFRAME + +The SFrame unwind information is provided in a loaded section, known as the +@code{.sframe} section. When available, the @code{.sframe} section appears in +a new segment of its own, PT_GNU_SFRAME. + +The SFrame format is currently supported only for select ABIs, namely, AMD64 +and AAPCS64. + +The contents of the SFrame section are stored in the target endianness, i.e., +in the endianness of the system on which the section is targetted to be used. +An SFrame section reader may use the magic number in the SFrame header to +identify the endianness of the SFrame section. + +Addresses in this specification are expressed in bytes. + +The associated API to decode, probe and encode the SFrame section, provided via +@code{libsframe}, is not accompanied here at this time. This will be added +later. + +This document is intended to be in sync with the C code in @file{sframe.h}. +Please report descrepancies between the two, if any. + +@node SFrame section +@chapter SFrame section +@cindex SFrame section + +The SFrame section consists of an SFrame header, starting with a preamble, and +two other sub-sections, namely the SFrame Function Descriptor Entry (SFrame +FDE) sub-section, and the SFrame Frame Row Entry (SFrame FRE) sub-section. + +@menu +* SFrame Preamble:: +* SFrame Header:: +* SFrame Function Descriptor Entries:: +* SFrame Frame Row Entries:: +@end menu + +@node SFrame Preamble +@section SFrame Preamble +@cindex SFrame preamble + +The preamble is a 32-bit packed structure; the only part of the SFrame whose +format cannot vary between versions. + +@example +typedef struct sframe_preamble +@{ + uint16_t sfp_magic; + uint8_t sfp_version; + uint8_t sfp_flags; +@} ATTRIBUTE_PACKED sframe_preamble; +@end example + +All values are stored in the endianness of the target system for which the +SFrame section is intended. Further details: + +@multitable {Offset} {@code{uint8_t sfp_version}} {The magic number for SFrame section: 0xdee2. Defined} +@headitem Offset @tab Name @tab Description +@item 0x00 +@tab @code{uint16_t sfp_magic} +@tab The magic number for SFrame section: 0xdee2. Defined as a macro @code{SFRAME_MAGIC}. +@tindex SFRAME_MAGIC + +@item 0x02 +@tab @code{uint8_t sfp_version} +@tab The version number of this SFrame section. @xref{SFrame version}, for the +set of valid values. Current version is +@code{SFRAME_VERSION_1}. + +@item 0x03 +@tab @code{uint8_t sfp_flags} +@tab Flags (section-wide) for this SFrame section. @xref{SFrame flags}, for the +set of valid values. +@end multitable + +@menu +* SFrame endianness:: +* SFrame version:: +* SFrame flags:: +@end menu + +@node SFrame endianness +@subsection SFrame endianness + +@cindex endianness +SFrame sections are stored in the target endianness of the system that consumes +them. The SFrame library (@code{libsframe}) can, however, detect whether to +endian-flip an SFrame section at decode time, by inspecting the +@code{sfp_magic} field in the SFrame header (If it appears as 0xe2de, +endian-flipping is needed). + +@node SFrame version +@subsection SFrame version + +The version of the SFrame format can be determined by inspecting +@code{sfp_version}. The following versions are currently valid: + +@tindex SFRAME_VERSION_1 +@cindex SFrame versions +@multitable {SFRAME_VERSION_1} {Number} {First version, under development.} +@headitem Version @tab Number @tab Description +@item @code{SFRAME_VERSION_1} +@tab 1 @tab First version, under development. +@end multitable + +This section documents @code{SFRAME_VERSION_1}. + +@node SFrame flags +@subsection SFrame flags +@cindex SFrame flags +@comment @vindex sfp_flags +@comment @vindex SFrame section-wide flags +@comment @subsection SFrame section-wide flags + +The preamble contains bitflags in its @code{sfp_flags} field that +describe various section-wide properties. + +The following flags are currently defined. + +@multitable {@code{SFRAME_F_FRAME_POINTER}} {Versions} {Value} {Function Descriptor Entries} +@headitem Flag @tab Versions @tab Value @tab Meaning +@tindex SFRAME_F_FDE_SORTED +@item @code{SFRAME_F_FDE_SORTED} @tab All @tab 0x1 @tab Function Descriptor +Entries are sorted on PC. +@tindex SFRAME_F_FRAME_POINTER +@item @code{SFRAME_F_FRAME_POINTER} @tab All @tab 0x2 +@tab Functions preserve frame-pointer. +@end multitable + +Further flags may be added in future. + +@node SFrame Header +@section SFrame Header +@cindex SFrame header + +The SFrame header is the first part of an SFrame section. It begins with the +SFrame preamble. All parts of it other than the preamble +(@pxref{SFrame Preamble}) can vary between SFrame file versions. It contains +things that apply to the section as a whole, and offsets to the various other +sub-sections defined in the format. As with the rest of the SFrame section, +all values are stored in the endianness of the target system. + +The two sub-sections tile the SFrame section: each section runs from the offset +given until the start of the next section. An explicit length is given for the +last sub-section, the SFrame Frame Row Entry (SFrame FRE) sub-section. + +@example +typedef struct sframe_header +@{ + sframe_preamble sfh_preamble; + uint8_t sfh_abi_arch; + int8_t sfh_cfa_fixed_fp_offset; + int8_t sfh_cfa_fixed_ra_offset; + uint8_t sfh_auxhdr_len; + uint32_t sfh_num_fdes; + uint32_t sfh_num_fres; + uint32_t sfh_fre_len; + uint32_t sfh_fdeoff; + uint32_t sfh_freoff; +@} ATTRIBUTE_PACKED sframe_header; +@end example + +The sub-section offsets, namely @code{sfh_fdeoff} and @code{sfh_freoff}, in the +SFrame header are relative to the @emph{end} of the SFrame header; they are +each an offset in bytes into the SFrame section where the SFrame FDE +sub-section and the SFrame FRE sub-section respectively start. + +SFrame header allows specifying explicitly the fixed offsets from CFA, if any, +from which FP or RA may be recovered. For example, in AMD64, the stack offset +of the return address is @code{CFA - 8}. Since this offset is in close +vicinity with the CFA in most ABIs, @code{sfh_cfa_fixed_fp_offset} and +@code{sfh_cfa_fixed_ra_offset} are limited to signed 8-bit integers. + +SFrame format has provisioned for future ABIs/architectures that it may +support. The @code{sframe_header} structure provides an unsigned 8-bit +integral field to denote the size of an auxilliary SFrame header. The +auxilliary SFrame header follows right after the @code{sframe_header} +structure. As for the offset calculations, the @emph{end} of SFrame header +must be the end of the auxilliary SFrame header, if the latter is present. + +Tieing it all together: + +@multitable {Offset} {@code{int8_t sfh_cfa_fixed_fp_offset}} {The ABI/arch identifier. See above} +@headitem Offset @tab Name @tab Description +@item 0x00 +@tab @code{sframe_preamble sfh_preamble} +@tab The SFrame preamble. @xref{SFrame Preamble}. + +@item 0x04 +@tab @code{uint8_t sfh_abi_arch} +@tab The ABI/arch identifier. @xref{SFrame ABI/arch identifier}. + +@item 0x05 +@tab @code{int8_t sfh_cfa_fixed_fp_offset} +@tab The CFA fixed FP offset, if any. + +@item 0x06 +@tab @code{int8_t sfh_cfa_fixed_ra_offset} +@tab The CFA fixed RA offset, if any. + +@item 0x07 +@tab @code{uint8_t sfh_auxhdr_len} +@tab Size in bytes of the auxilliary header that follows the +@code{sframe_header} structure. + +@item 0x08 +@tab @code{uint32_t sfh_num_fdes} +@tab The number of SFrame FDEs in the section. + +@item 0xc +@tab @code{uint32_t sfh_num_fres} +@tab The number of SFrame FREs in the section. + +@item 0x10 +@tab @code{uint32_t sfh_fre_len} +@tab The length in bytes of the SFrame FRE sub-section. + +@item 0x14 +@tab @code{uint32_t sfh_fdeoff} +@tab The offset in bytes of the SFrame FDE sub-section. This sub-section +contains @code{sfh_num_fdes} number of fixed-length array elements. The array +element is of type SFrame function desciptor entry, each providing a +high-level function description for backtracing. +@xref{SFrame Function Descriptor Entries}. + +@item 0x18 +@tab @code{uint32_t sfh_freoff} +@tab The offset in bytes of the SFrame FRE sub-section, the core of the SFrame +section, which describes the unwind information using variable-length array +elements. @xref{SFrame Frame Row Entries}. + +@end multitable + +@menu +* SFrame ABI/arch identifier:: +@end menu + +@node SFrame ABI/arch identifier +@subsection SFrame ABI/arch identifier +@cindex SFrame ABI/arch identifier + +SFrame header identifies the ABI/arch of the target system for which the +executable and it's unwind information is intended. There are currently three +identifiable ABI/arch values in the format. + +@multitable {SFRAME_ABI_AARCH64_ENDIAN_LITTLE} {Value} {@code{AARCH64 little-endian}} +@headitem ABI/arch Identifier @tab Value @tab Description + +@tindex SFRAME_ABI_AARCH64_ENDIAN_BIG +@item @code{SFRAME_ABI_AARCH64_ENDIAN_BIG} +@tab 1 @tab AARCH64 big-endian + +@tindex SFRAME_ABI_AARCH64_ENDIAN_LITTLE +@item @code{SFRAME_ABI_AARCH64_ENDIAN_LITTLE} +@tab 2 @tab AARCH64 little-endian + +@tindex SFRAME_ABI_AMD64_ENDIAN_LITTLE +@item @code{SFRAME_ABI_AMD64_ENDIAN_LITTLE} +@tab 3 @tab AMD64 little-endian + +@end multitable + +The presence of an explicit identification of ABI/arch in SFrame may allow +unwinders to make certain ABI-specific decisions. + +@node SFrame Function Descriptor Entries +@section SFrame FDE +@cindex SFrame FDE + +The SFrame Function Descriptor Entry sub-section is a sorted array of +fixed-length SFrame function descriptor entries (SFrame FDEs). Each SFrame FDE +is a packed structure which contains information to describe a function's unwind +information at a high-level. + +@example +typedef struct sframe_func_desc_entry +@{ + int32_t sfde_func_start_address; + uint32_t sfde_func_size; + uint32_t sfde_func_start_fre_off; + uint32_t sfde_func_num_fres; + uint8_t sfde_func_info; +@} ATTRIBUTE_PACKED sframe_func_desc_entry; +@end example + +@code{sfde_func_start_fre_off} is the offset to the first SFrame FRE for the +function. This offset is relative to the @emph{end of the SFrame FDE} +sub-section (unlike the offsets in the SFrame header, which are relative to the +@emph{end} of the SFrame header). + +@code{sfde_func_info} is the "info word", containing information on the FRE +type and the FDE type for the function @xref{The SFrame FDE info word}. + +Following table describes each component of the SFrame FDE structure: + +@multitable {Offset} {@code{uint32_t sfde_func_start_fre_off}} {The ABI/arch identifier. See above} +@headitem Offset @tab Name @tab Description +@item 0x00 +@tab @code{int32_t sfde_func_start_address} +@tab Signed 32-bit integral field denoting the virtual memory address of the +described function. + +@item 0x04 +@tab @code{uint32_t sfde_func_size} +@tab Unsigned 32-bit integral field specifying the size of the function in +bytes. + +@item 0x08 +@tab @code{uint32_t sfde_func_start_fre_off} +@tab Unsigned 32-bit integral field specifying the offset in bytes of the +function's first SFrame FRE in the SFrame section. + +@item 0x0c +@tab @code{uint32_t sfde_func_num_fres} +@tab Unsigned 32-bit integral field specifying the total number of SFrame FREs +used for the function. + +@item 0x10 +@tab @code{uint8_t sfde_func_info} +@tab The SFrame FDE info word. @xref{The SFrame FDE info word}. + +@end multitable + +@menu +* The SFrame FDE info word:: +* The SFrame FDE types:: +* The SFrame FRE types:: +@end menu + +@cindex The SFrame FDE info word +@node The SFrame FDE info word +@subsection The SFrame FDE info word, sfde_func_info + +The info word is a bitfield split into three parts. From MSB to LSB: + +@multitable {Bit offset} {@code{isroot}} {Length of variable-length data for this type (some kinds only).} +@headitem Bit offset @tab Name @tab Description +@item 7--5 +@tab @code{unused} +@tab Unused bits. + +@item 4 +@tab @code{fdetype} +@tab SFRAME_FDE_TYPE_PCMASK (1) or SFRAME_FDE_TYPE_PCINC (0). @xref{The SFrame FDE types}. + +@item 0--3 +@tab @code{fretype} +@tab Choice of three SFrame FRE types. @xref{The SFrame FRE types}. +@end multitable + +@node The SFrame FDE types +@subsection The SFrame FDE types +@tindex SFRAME_FDE_TYPE_PCMASK +@tindex SFRAME_FDE_TYPE_PCINC + +SFrame format defines two types of FDE entries. The choice of which SFrame FDE +type to use is made based on the instruction patterns in the relevant program +stub. + +An SFrame FDE of type @code{SFRAME_FDE_TYPE_PCINC} is an indication that the PCs in the +FREs should be treated as increments in bytes. This is used fo the the bulk of +the executable code of a program, which contains instructions with no specific +pattern. + +In contrast, an SFrame FDE of type @code{SFRAME_FDE_TYPE_PCMASK} is an +indication that the PCs in the FREs should be treated as masks. This type is +useful for the cases where a small pattern of instructions in a program stub is +used repeatedly for a specific functionality. Typical usecases are pltN +entries and trampolines. + +@multitable {Name of SFrame FDE type} {Value} {Unwinders perform a (PC >= FRE_START_ADDR)} +@headitem Name of SFrame FDE type @tab Value @tab Description + +@item SFRAME_FDE_TYPE_PCINC +@tab 0 @tab Unwinders perform a (PC >= FRE_START_ADDR) to look up a matching FRE. + +@item SFRAME_FDE_TYPE_PCMASK +@tab 1 @tab Unwinders perform a (PC & FRE_START_ADDR_AS_MASK >= FRE_START_ADDR_AS_MASK) +to look up a matching FRE. + +@end multitable + +@node The SFrame FRE types +@subsection The SFrame FRE types + +A real world application can have functions of size big and small. SFrame +format defines three types of SFrame FRE entries to represent the unwind +information for such a variety of function sizes. These representations vary +in the number of bits needed to encode the start address offset in the SFrame +FRE. + +The following constants are defined and used to identify the SFrame FRE types: + +@multitable {SFRAME_FRE_TYPE_ADDR1} {@code{Value}} {The start address offset of FRE is an} +@headitem Name @tab Value @tab Description + +@tindex SFRAME_FRE_TYPE_ADDR1 +@item @code{SFRAME_FRE_TYPE_ADDR1} +@tab 0 +@tab The start address offset (in bytes) of the SFrame FRE is an unsigned +8-bit value. + +@tindex SFRAME_FRE_TYPE_ADDR2 +@item @code{SFRAME_FRE_TYPE_ADDR2} +@tab 1 +@tab The start address offset (in bytes) of the SFrame FRE is an unsigned +16-bit value. + +@tindex SFRAME_FRE_TYPE_ADDR4 +@item @code{SFRAME_FRE_TYPE_ADDR4} +@tab 2 +@tab The start address offset (in bytes) of the SFrame FRE is an unsigned +32-bit value. +@end multitable + +A single function must use the same type of FRE throughout. The choice of +which SFrame FRE is used to encode the unwind information of a function, is +stored in the @xref{The SFrame FDE info word}. + +@node SFrame Frame Row Entries +@section SFrame FRE +@cindex SFrame FRE + +The SFrame Frame Row Entry sub-section contains the core of the unwind +information. + +An SFrame Frame Row Entry is a self-sufficient record containing SFrame unwind +info for a range of contiguous addresses, starting at the specified offset from +the start of the function. Each SFrame Frame Row Entry is followed by S*N +bytes, where: + +@itemize @minus +@item +@code{S} is the size of the stack frame offset for the FRE, and +@item +@code{N} is the number of stack frame offsets in the FRE +@end itemize + +The stack offsets, following the FRE, are interpreted in order as follows: + +@itemize @minus +@item +The first offset is always used to locate the CFA, by interpreting it as: +CFA = @code{BASE_REG} + offset1. +@item +If RA is being tracked, the second offset is always used to locate the RA, by +interpreting it as: RA = CFA + offset2. If RA is @emph{not} being tracked +@emph{and} FP is being tracked, the second offset will be used to locate the +FP, by interpreting it as: FP = CFA + offset2. +@item +If both RA and FP are being tracked, the third offset will be used to locate +the FP, by interpreting it as FP = CFA + offset3. +@end itemize + +The entities @code{S}, @code{N} and @code{BASE_REG} are identified using the +SFrame FRE info word, a.k.a. the @code{sframe_fre_info} +@xref{The SFrame FRE info word}. + +Following are the definitions of the allowed SFrame FRE: + +@example +typedef struct sframe_frame_row_entry_addr1 +@{ + uint8_t sfre_start_address; + sframe_fre_info sfre_info; +@} ATTRIBUTE_PACKED sframe_frame_row_entry_addr1; +@end example + +@example +typedef struct sframe_frame_row_entry_addr2 +@{ + uint16_t sfre_start_address; + sframe_fre_info sfre_info; +@} ATTRIBUTE_PACKED sframe_frame_row_entry_addr2; +@end example + +@example +typedef struct sframe_frame_row_entry_addr4 +@{ + uint32_t sfre_start_address; + sframe_fre_info sfre_info; +@} ATTRIBUTE_PACKED sframe_frame_row_entry_addr4; +@end example + +@code{sfre_start_address} is an unsigned 8-bit/16-bit/32-bit integral field +identifies the start address of the range of program counters, for which the +SFrame FRE applies. The value encoded in the @code{sfre_start_address} field +is the offset in bytes of the start address of the SFrame FRE, from the start +address of the function. + +Further FRE types may be added in future. + +@menu +* The SFrame FRE info word:: +@end menu + +@cindex The SFrame FRE info word +@node The SFrame FRE info word +@subsection The SFrame FRE info word, sfre_info + +The SFrame FRE info word is a bitfield split into four parts. From MSB to LSB: + +@multitable {Bit offset} {@code{fre_cfa_base_reg_id}} {Size of stack offsets in bytes. Valid values} +@headitem Bit offset @tab Name @tab Description +@item 7 +@tab @code{unused} +@tab Unused bit. + +@item 5-6 +@tab @code{fre_offset_size} +@tab Size of stack offsets in bytes. Valid values are SFRAME_FRE_OFFSET_1B, +SFRAME_FRE_OFFSET_2B, and SFRAME_FRE_OFFSET_4B. + +@item 1-4 +@tab @code{fre_offset_count} +@tab A value of upto 3 is allowed to track all three of CFA, FP and RA. + +@item 0 +@tab @code{fre_cfa_base_reg_id} +@tab Distinguish between SP or FP based CFA recovery. + +@end multitable + +@multitable {SFRAME_FRE_OFFSET_4B} {@code{Value}} {All stack offsets following the fixed-length} +@headitem Name @tab Value @tab Description + +@tindex SFRAME_FRE_OFFSET_1B +@item @code{SFRAME_FRE_OFFSET_1B} +@tab 0 +@tab All stack offsets following the fixed-length FRE structure are 1 byte +long. + +@tindex SFRAME_FRE_OFFSET_2B +@item @code{SFRAME_FRE_OFFSET_2B} +@tab 1 +@tab All stack offsets following the fixed-length FRE structure are 2 bytes +long. + +@tindex SFRAME_FRE_OFFSET_4B +@item @code{SFRAME_FRE_OFFSET_4B} +@tab 2 +@tab All stack offsets following the fixed-length FRE structure are 4 bytes +long. + +@end multitable + +@node Index +@unnumbered Index + +@syncodeindex tp cp +@printindex cp + +@bye