From patchwork Tue Jun 27 19:51:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 113572 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp8436827vqr; Tue, 27 Jun 2023 12:56:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5uqsS3yIiwIktM6mlBqE1UGetf0MbNnjHTJvUFeLomiVn9v0X5xOZPmvUWRq0yIBsOcDm2 X-Received: by 2002:aa7:d912:0:b0:51d:9110:4b11 with SMTP id a18-20020aa7d912000000b0051d91104b11mr6765243edr.12.1687895783534; Tue, 27 Jun 2023 12:56:23 -0700 (PDT) Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id k21-20020aa7c395000000b0051d972c8c37si3027078edq.141.2023.06.27.12.56.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 12:56:23 -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=IiXR29YV; 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 C3362388202C for ; Tue, 27 Jun 2023 19:54:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C3362388202C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1687895660; bh=LQJPIpdJNsH5MBq43bNzCMQ7f8cRt+30xCqaktLOazI=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=IiXR29YV/dvn7os/ETAczHruEzZVhYntxMBcAkkSjXLxsvwd2QM1MWfozLzTLL1DB UlI0v2x/0+sTwvlLKufz3aTIRA5R2eE0tBb7tzIegk5t36CWsTbt48B/fBTAYI1S0b Cus6TJOCWUZC5QnXLNzwPub5zYuJFWwg9V9P2ShQ= 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 E2C243858000 for ; Tue, 27 Jun 2023 19:52:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E2C243858000 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35REoX3u009890 for ; Tue, 27 Jun 2023 19:52:02 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 3rdpwddw1k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 27 Jun 2023 19:52:02 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35RJdJvu019959 for ; Tue, 27 Jun 2023 19:52:01 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rdpxas25u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 27 Jun 2023 19:52:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EdiBs5FVHsYXE+vMFo8DavDOlV5AywjGgfOdFwR0ZtkQUTjSkva/Ce6+THUiOcUJmQ6L9aguUqFW/A5ROtbaI0PPl/9PPCePzya1cDWIDtvmIOupJbC0pQ8O8tjQnHCQzhdJjaydc1c49tWoWXgd1ky/A1+TR6omdSDfa028Oz6MK28mzNi9pr3a48i4xvomPzE1ZLhLPHDfBckuWPscfq97tBCJezn2A74OY339dRUB7iguuHXZxHGSbzoskFbDnof6LGEilkLeOE9HoTL+oZjBF2e6EEECRkukr+GZQCEfZMDRhWu5UavDvh6Xtrff+A/+0e+MzcmUc3YHex0LBg== 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=LQJPIpdJNsH5MBq43bNzCMQ7f8cRt+30xCqaktLOazI=; b=McqTixe4iINlypqoj+JRBdyDJGl8otqS+KwboDjZo2Hd0IHq2h2DrsPoJ8FgtH16A/4VrUVMh5AMNQ52V993bsg7cmsbZOj3RRnFzH6jd8kpuVXQ2PBi+x1UJaFnUA7yt0HcPsgXYGkDyrXsAMXTG1jLT/+X22+mQz0bfR3Q7cg0v9qP00UPh37hKtRXp+g7H6TxnplgZuZ1hkJCc3A7VTUjtEBL5eeFuPuJs9+luj4LmuXhrnlvXryDwkHXL7ectQ7u9PCGnn1MqiBQOq6f+OhjJhiaQ3it+HY0FN170nW60/Gwi1iX78t8TU2cyuoZwlg2cDKoDKRWtyKHtmAW1w== 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 CY8PR10MB6803.namprd10.prod.outlook.com (2603:10b6:930:9a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.26; Tue, 27 Jun 2023 19:52:00 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fdbb:b921:1ef:2d44]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fdbb:b921:1ef:2d44%4]) with mapi id 15.20.6521.026; Tue, 27 Jun 2023 19:51:59 +0000 To: binutils@sourceware.org Cc: Indu Bhagat Subject: [COMMITTED] libsframe: update the semantics of sframe_fre_get_fp_offset Date: Tue, 27 Jun 2023 12:51:19 -0700 Message-Id: <20230627195126.1955051-5-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230627195126.1955051-1-indu.bhagat@oracle.com> References: <20230627195126.1955051-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR03CA0046.namprd03.prod.outlook.com (2603:10b6:303:8e::21) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|CY8PR10MB6803:EE_ X-MS-Office365-Filtering-Correlation-Id: 722f12ca-b4e3-4cb7-473f-08db7747f873 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VGgnvMQ2fig1YQctVQHTiL8jmqmSKVRHVaVXDefQeSKfrR9Un2rS6mOSchGHT/nJvxz2NS2TF/o21wfYybNs8arvBWJyjRB/ia/zzZCltJ6dSzb/5T6jcMkmjpEuQ+THMmpuu3uyCk1h/Bb6z6FSSODsIi2GB5fRUwzCwwWIb0swY4+E2hKFx9VrWvhRhJ9f+HxL0/TfgJgVoYfXL1hqiP96VEA0/j5j9mOOST+h5XBWQAPqiTdPx3E2wc39xOrql6QaGQSgus89KxJr7E3AeHKpV8aHhHTbfKCLW7vqRMrvCDxo2eakvKSdXFZpuBl52f9Dwnj7FKyJ5UknxH3x2gjC6KUFQNIt5F/HRmk/ayNQh0iOQUf7ZbYwvjbbj2FlziYsalN7QjU0AvZja9CfmiZL1DDK0iALZ+nAtkZw1jL5m4VFmFjM3kafta992cRvcGvua5yv295MIF3OdXvKNKZJwHUrdBXJ78AkSBoZl/CrcUP25EfR2X6mxpglYWV28Ok/Sc7vKjx1AQwSw2sGMfQ28UsR8p1qxhPfD0p42hawbHPhkHOqGSTDE4a0ytBe 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:(13230028)(366004)(346002)(376002)(39860400002)(396003)(136003)(451199021)(2906002)(186003)(6486002)(107886003)(38100700002)(83380400001)(2616005)(6506007)(6512007)(6666004)(86362001)(26005)(1076003)(41300700001)(316002)(478600001)(36756003)(66556008)(4326008)(66946007)(6916009)(66476007)(44832011)(5660300002)(8676002)(8936002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Cp5UND5rS/ErHXk/ieATsEP2+FyCTlqEvdXbohJ1Gt7b2VF6FGcyrAzstx2ReQepNS519lKdDZXwnz0xdsrJTLzhNLNnmWqaC/VA6DU1TAULzABuu1UXI+T7XfVzpX421vsREEAtqxoX7hhQivyzndc62b1UYftKeWexm+imbm2rOB5LAbJuGWUk/E0EkVpiBgyFHxWGyTqkSKa1gMbINLMfMVyBa86Axdnv3f7xCHyG5CA2iYuanJTzVo5mNVsqYJL+1EhUVBQZSUsWMvdcA67RjTVZ5nRcRI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Org: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 722f12ca-b4e3-4cb7-473f-08db7747f873 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jun 2023 19:51:59.9607 (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: c1x9RCea6bx37tpA0JPjqw6gUMZAjF371EpIaSo1n6BJzowFX+gZ5pkW8agRRl870a0TIHWHC0y7NxlEVY4h/Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB6803 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-27_14,2023-06-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 adultscore=0 mlxlogscore=815 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306270180 X-Proofpoint-GUID: TFqv5URNiafKcFVuAkwrgiiQmuoxm83y X-Proofpoint-ORIG-GUID: TFqv5URNiafKcFVuAkwrgiiQmuoxm83y 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_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.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?1769887009317178388?= X-GMAIL-MSGID: =?utf-8?q?1769887009317178388?= Until now, sframe_fre_get_fp_offset () would return SFRAME_ERR_FREOFFSET_NOPRESENT if the ABI uses fixed FP offset. A stack tracer, then, would call an explicit sframe_decoder_get_fixed_fp_offset () to get the FP offset. On second look, it appears to make sense to hide these details of whether the FP offset is fixed or not in an ABI from the consumer. Now, with the changed semantics, the call to sframe_fre_get_fp_offset () will fetch the fixed FP offset if applicable, or get the FP offset from FRE when there is no fixed FP offset. This patch changes the behavior of sframe_fre_get_fp_offset (): it turns an error into non-error. This change will be included with the next release of libsframe, where all the exposed symbols will be versioned with version node LIBSFRAME_1.0 for the first time. libsframe/ * sframe.c (sframe_fre_get_fp_offset): Return the fixed offset, if applicable. Else return the FP offset from the FRE. --- libsframe/sframe.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/libsframe/sframe.c b/libsframe/sframe.c index 3d1b5575f0b..912d34352a1 100644 --- a/libsframe/sframe.c +++ b/libsframe/sframe.c @@ -644,16 +644,21 @@ 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, SFRAME_ERR_FREOFFSET_NOPRESENT); + int8_t fp_offset = sframe_decoder_get_fixed_fp_offset (dctx); + /* If the FP offset is not being tracked, return the fixed FP offset + from the SFrame header. */ + if (fp_offset != SFRAME_CFA_FIXED_FP_INVALID) + { + if (errp) + *errp = 0; + return fp_offset; + } /* 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) + fp_offset_idx = ((sframe_decoder_get_fixed_ra_offset (dctx) + != 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);