From patchwork Thu Jun 8 04:49:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 104819 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp42989vqr; Wed, 7 Jun 2023 21:51:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6ldjtnhc9g7NywyLQv/9Mw/tjOU++thEmbjOwNiNAPGhg8z/51JMhUZwutxCCOKw/ar5pf X-Received: by 2002:a17:907:eaa:b0:973:e69d:c720 with SMTP id ho42-20020a1709070eaa00b00973e69dc720mr9827955ejc.51.1686199886069; Wed, 07 Jun 2023 21:51:26 -0700 (PDT) Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id k19-20020a170906129300b00977d16c6a5dsi206305ejb.129.2023.06.07.21.51.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 21:51:26 -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=qouUsP2M; 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 A9F663855592 for ; Thu, 8 Jun 2023 04:50:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A9F663855592 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1686199859; bh=tQpv3x/gT8F7NO0w+HTbglwlSCZo4fMKqcPYGN/GTmo=; 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=qouUsP2M4sdRJM0ZvAZjFLJ/rbo+N66WYZ2QkgoFG090fHal4G45NsZUTfLHQ3SmE 4NrfwcDJQP+L2R/c9jvGEO0YTdsCyXgAHCYZt8eap770Hvh53xnvwK+BpeRx6uLOKV uo+NpMp9eyL1dDYW4VdhOggR3RzV/lm9ZDgeb4wY= 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 45C773856DCB for ; Thu, 8 Jun 2023 04:49:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 45C773856DCB Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 357N31IN008057 for ; Thu, 8 Jun 2023 04:49:53 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 3r2a6rkb01-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 08 Jun 2023 04:49:53 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3582A4hF038509 for ; Thu, 8 Jun 2023 04:49:52 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r2a6kkvva-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 08 Jun 2023 04:49:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LhAKwSqFa5pMj94a7kP7GPchLaZQ5faQBN5dDZwvk/xfY3RIL9RIRIkGBOqhwxuSJiauyqBc6BitnCJi5tPbm7QklL6gTvmarYlORn0kizZ7Uh8OSrD2ZL9doovSs4sGaWjzXzCXlnFZP9nsHjj7pFRT4hR1rTFUv8sCW1/qfHcEtWlwhl/1lX3tEYz6FXI/g6G95m3mxm/HGOq44igx14BYqt3vPlifF05iZwbZIUQi3YMgei+n3+wP+/hDIi0XdHKoPIIIE4JNYQI2zA8VrU98v/6ETqxC32H+937k0NtpDankeVccEn3WeKVPz9GSZ6cxJnLq5PfiXY4RWbW6RA== 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=tQpv3x/gT8F7NO0w+HTbglwlSCZo4fMKqcPYGN/GTmo=; b=BjDrFlXaymec6Muvb+PHQubi6B+T1ZHHJaJRX4OLdQZPX/UpomBAB2jAZXMfx1dSOCSIRhc9cXGh7uVvAp+ecup7BZvd1Nu7NrImsg1A0Fphj1D+BXtcpP7IqU8QJE6uqWZjwleG3/HWoqquYikAdDZ4flxzeZKt9ZD+HqAQgP4r5N628DQETd7OLiZA18K43d2TTrCDn/vOZ+idmjWyhSdmBUKxktEjIMpD1yCQYOEne6gPiosy84uLTLaoyPjCrCkyLlicYTk5KpO3jl6P1B0Nzgh2zjXgP9w8scQhrgG8umXXBQq1S4yxKJc+3N+p53lYB+vFDZyMX0H5xKsZjg== 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 SJ0PR10MB4461.namprd10.prod.outlook.com (2603:10b6:a03:2d8::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.36; Thu, 8 Jun 2023 04:49:50 +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.6455.028; Thu, 8 Jun 2023 04:49:50 +0000 To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH 2/2] libsframe: update the semantics of sframe_fre_get_fp_offset Date: Wed, 7 Jun 2023 21:49:35 -0700 Message-Id: <20230608044935.4183325-3-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230608044935.4183325-1-indu.bhagat@oracle.com> References: <20230608044935.4183325-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4P222CA0011.NAMP222.PROD.OUTLOOK.COM (2603:10b6:303:114::16) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|SJ0PR10MB4461:EE_ X-MS-Office365-Filtering-Correlation-Id: 59222feb-020b-4fbe-52e9-08db67dbcafd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Y1bIfpRmXEuKb12X1QnEzD1y/+90d2YV7eJ6T0wZrJ2qVyc/tZ5XjcZnpvGUYDKPGiuJRF7shgAmZl30KxUqNQAYyhs7MSXYzYqavk5fazkYG9QIM4jUgeMKXrvITzYqS0hjjnNH0o/jDlg/7sAXnLKXCL7hjWqi5jvCUopFiU38ziVfC0+5/0M0P+zVODYm6dq3A5QjriebrbUVMct7rYWQSWl14pyso54UIqYABRKRZNqEiBosjXUnW91U+/9D1mhw+oejrt/YCm5RviTgr9t5PCd9fiRd+eZxX+znKOuTBaXfr96ET+EJOzJMk5SN8zOHMSCYSjm4ZLje6tNJjmWzEejwIyhDr8b5EQ2CXR7Fu0hZnfBbv5wFYJveghuyMyPl1/0krRW4s7rKnzszzitOUrLSqMxIkVLWsT4bgMxg2GRbEX0hgE40xycMl5ok3gCusVDEycb+yYAT0YbzuiwUF9gP3Sz87FPnizBL5kTFyUwCnR1ev5m9b95vhbXv8XX7oWmdOgx2JVQrFvu+Dq5Yr//62QqOzCjmIBeObD6QnCdzqFkxwn27FUwl241N 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)(136003)(39860400002)(346002)(366004)(376002)(396003)(451199021)(6486002)(478600001)(6666004)(36756003)(2616005)(186003)(38100700002)(86362001)(83380400001)(26005)(6512007)(1076003)(6506007)(107886003)(8936002)(5660300002)(8676002)(41300700001)(44832011)(2906002)(316002)(4326008)(6916009)(66556008)(66476007)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mFWoZpgoGa2xmAAF8oNOe+5/lnAx77erdkux3FXbH1m3bpPskVpUjnQKt3CuhxLf2RTbNcxf2beiLy33pMdBR9arhhM4TvBqZB/gAKpMWemcoa62xPNfGstVLNgNyv+7ZMlLIUyYoFHYspFpaSq6EZav9awRoPkd87yBhAGS22wQ/9vOjvlXsGCh/lZuqwNwzOjpd2p2nMugUgXrIL/xongSTuzI37vU+swCvTtjUf1DFOaAGdNWgnx6KC7Tu+MZ7eWH+fIq4Rd5jNCD6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lhPK5b9Vs8UHzCjB3Qa/yS/ry6/BoNja88jjSGw X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 59222feb-020b-4fbe-52e9-08db67dbcafd X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2023 04:49:50.5142 (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: qIsNbU+MNxSFfsmdj33BwLzVSlLlDrDZVLw7MZC9mCt12N1V9ivYDnvaTJSSkF4aadZa5N5pr40IuuguxX/THg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4461 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-08_02,2023-06-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 suspectscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306080038 X-Proofpoint-ORIG-GUID: kkLtGRPNkwEMQjYNPPG7kGFh9zkLnFh5 X-Proofpoint-GUID: kkLtGRPNkwEMQjYNPPG7kGFh9zkLnFh5 X-Spam-Status: No, score=-13.1 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?1768108731646450946?= X-GMAIL-MSGID: =?utf-8?q?1768108731646450946?= 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 is deemed a compatible ABI change, because it should not break consumers unless they were relying on the error; the latter seems unlikely. Hence, this change of semantics of the API does not require symbol versioning to accompany. 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 8d9d194a8a8..ba70bba294f 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);