From patchwork Wed Jan 3 07:15:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 83201 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6C7FA38582A2 for ; Wed, 3 Jan 2024 07:16:25 +0000 (GMT) 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 3C46D3858C2F for ; Wed, 3 Jan 2024 07:15:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3C46D3858C2F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3C46D3858C2F Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266144; cv=pass; b=kS35J6xAFMcgfXeQaLY1bg3Ri6hU17X6Q2E2Ycb3wkqaHHZ/A0oboV4lASHGSZOn6mFj1ykT3CtlB+rwLHxvZC7JiYQ0QGtowVP7FQTH7iwB36ZUieVtL3xn6ENXHzMpFkacMnTEc94VrU4gn8gNj5yLydGEGnx0lzpjEomHvk4= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266144; c=relaxed/simple; bh=URxwiU3FzOmxQv/0MN4xe4iWsxOZ9UWnqh4Uuj5H2dE=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=jS/3eomm4v36xyXhrKjPt7mNA1cVNNh/k1Fmw8m9RjrEumylYwlg+Y+wsJi2fhBhnqtBfu4BRIMXHT/IaXFB6GcGfLGwUEIrMJQt4ZfjzSmMIV1/+7vMVvrzOxhbSnB/6g6tMobJBptz3SVx7WFJLAPD+LEoisjJuyL7dLrQSj4= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4030hr1A012111 for ; Wed, 3 Jan 2024 07:15:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=F/btLiFu18Qgp6A6mHhWtCkLhNShhW+2oWfPVtBz6Gs=; b=K+sdNv2VOSLb78g1nSptXwp1XmfiF8QuZP/zhegQrKlx+YMl6vbSxplpeWotkB8qmRIj W1w81LSvqPpFMwbPykQwa7Jt90AQvHs3XF6B8CZlonbn2UDv6BE9DpHa4isKD0CbnVbI V+qtcVkODM0jQM0o6dv/8CJ8z4Wfcc+BQNUrPFDdO8CeYUsBTQB1VGzhQpnVxS3BBnWS P0ENv/L+5kbKPUpJCZfosO+SKZhzHBd6/1CZtT+YFVa0Ypa5C2/zeUB6oqmSQ4PrxrBb l+pUny07RarkVNcpekmWxeU77KOMZB+N15YdDNUjgZevVwE6SBe0EyfvvjrH2K6b8yhH tg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vab8d4ebq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:15:39 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 40372UOc001700 for ; Wed, 3 Jan 2024 07:15:38 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2041.outbound.protection.outlook.com [104.47.57.41]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3va9n8pdee-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:15:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dSbFcG+vzreQXLGHiYrATlrf6woYDxh9rM+LPAPWZAu6KQin9O6BekNaL0G46Hrkxo6HJpE4Vp1ZToWdndGFyHkXGccOFsNutByTaod4rWweprTFq79iVVDZBdQQwfH9BewuB7UwDk5EmyjqrLnTS6J28ffl5rsGzrNpOfVo1KQGr3Mwt8i4DrhkYD8PpTO9PIgQRKx1g0Aj7UxsALnUhKcUCvMTuKuw/WAYQ9SOn8B7qkeGLrbeXO+//bvMjbkbiC85QO/iJea8xzos6zqTvrvbD1w/IrwIHCG54CfiIzNYsDvIAtn+PHFp6pmRtDlFqs5y0+fjGwtyazlvJmNO3Q== 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=F/btLiFu18Qgp6A6mHhWtCkLhNShhW+2oWfPVtBz6Gs=; b=Mm1Hoi/cgJGB0TsMtIv2CXVNXysklHtkwc3OOORQ0n5WSmYF54Lih+sU8sWqQQx1gZz9g+BTqDDXsee4ZK53o/fVgRjqPcHdE6XeB8SERKBeymBzu1BZLSoOUz9evuhpMXh3oCnq4JlNL9Gv2M4NsKCjL8hBncI8Hkg2NdlmfpmfjJcZvahC17tSjHBEEEDkvxxd06xpnu5SPtJwSEBTwTanFwac80FAgLH32Iw9mkCzZ0d09jirmiBxZwYy2kIUupmyJDy84AWgF1lxohCXBVmehWOv+rGXtQIvUMCRfn+zAz35a2Zm3Hgkx6SbUdvkjK1I9jgo9X2vahbYxh+Hpg== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F/btLiFu18Qgp6A6mHhWtCkLhNShhW+2oWfPVtBz6Gs=; b=DLvlenpVnqArCm6cEj7mvkXE8mqtL2WU4Mqgl58QmUFgy9idxwRszMKBMNitwzE7fsygAzVf9dLw2SJL+B2MfYeBOm1WhlLEwi9PKTkP71Xn/u5XCcvCvg7cA5FGgVV8x+YQzjA/3roIsItcgQd4FO19RmN+pjXISHtY/CAihLk= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by CY8PR10MB6777.namprd10.prod.outlook.com (2603:10b6:930:98::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.25; Wed, 3 Jan 2024 07:15:37 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac%4]) with mapi id 15.20.7159.013; Wed, 3 Jan 2024 07:15:37 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH, V4 01/14] gas: dw2gencfi: minor rejig for cfi_sections_set and all_cfi_sections Date: Tue, 2 Jan 2024 23:15:13 -0800 Message-ID: <20240103071526.3846985-2-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240103071526.3846985-1-indu.bhagat@oracle.com> References: <20240103071526.3846985-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR04CA0342.namprd04.prod.outlook.com (2603:10b6:303:8a::17) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|CY8PR10MB6777:EE_ X-MS-Office365-Filtering-Correlation-Id: 2cc5966d-6a28-4072-d12a-08dc0c2bc8d8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M5sUVgVpsrXh9GE/EpjlO0+i8Yf/tl8TBQFp4jv2Vsr/7P3dS59vbzkKu+uYXlUSj+49gYrvP+UE8CixAH3uamrf7hF1XTm/vZxyKaCII9+SPpnyaod8m0CTPXKfvcEvRpDImTn+UZpCN6m9ZWRefFhWbFsWixN8Tvos0iLVz/7wVFvNRQZ/J9l+5avwEwOs/TgVmjODBv2shQ55X2SN8SXWuB1jCCg2mGJHA7xKYVCodCEryRN+bRF5szQR+aHhI4b91SrWFNFmReM+Ro366UNVye2pLH5y01UobCjCP/Nhiwoc8rf0i0qMckrcDEMYoJ1plN22A7mpJQb+GqrdULd6PyeOVj5QUS7EBsaEddSxiV8nXnJQ+djNazxmKFNuiCwdUz3ca3eVmX9rm/26JURLknqj4jI1DGKtkjJniyIP7KwvmImVUXYmEvaklbtF1z5POU0Ms+xA4x0EBhjdyCK6PoeEZeIm5/o45fv22LDSxo2S/fjVWzsvPcVzaJ3pmD36oxV6e+hViEfybNyTF7/xrQXig5ykftqghU6cXww/yD21Dax2nPfGZVgnsyn7 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:(13230031)(366004)(346002)(396003)(136003)(39860400002)(376002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(36756003)(86362001)(107886003)(1076003)(2616005)(6506007)(6512007)(6666004)(4326008)(478600001)(6486002)(8936002)(8676002)(316002)(66476007)(83380400001)(66556008)(66946007)(6916009)(41300700001)(2906002)(44832011)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ovoy6cEaJFtux+0B/XrYmrRRDV9zhhg9K2FXij6aovzC3yCujrh/m7jFP0bUanQE7ltz3ptXXQoSuFP4PgcHVw/l9Ws7bz58LRuc5x2MdC/dkbKgp6jP4SDRCrgV6EXKuZEXgJ9dZP1uablIHNFdOXP2Jx97tsfV8j1h6aMcdHO48t/fSK5j+YxGMKOXfNvarwM6eZM6RbOaK6fm2H/n7gUj8SdFBhFtQJx3mYfz4fh5tktg5CpXlNXYkg68OfYk/yL9Ts0X8wau2vB+CdCStkAHIUdvIKAbjRqhfS4CkQXlGWyhuI3h/upuaEpOMcv71o4TIoMvgTjPxvuDZP2IfEZ7n7XSKI2vppel01Lv65bGzs5RYJIwYenM9MdMPUIzbOcQISn4hb+xY4CUYLUKzGiTgWTtoRYtg4pYLTrNIlLPnDYWlLTSGHyEADov360G6gE2x+zHWC3M5sRjqr+ZUGtvlnE0w4nXwNfRsoz7qay1LkbY39+0eBrzEtzBBRRAVCPD/YOFfNs2G1Fl3Y60lu5PlBE0m4oiUplQuS7Vf831d3CnHIRMpbfG4Xs78mLCkNWM15eSXyEDysZKAK4+azuWqH8p72at7ZzwhXk1RI/AROBikotiBJ/9tpvSHnSwd+FD1ygsE+6/SOh4ifiaLB0MIbtkLSyiSOLlKmdNDuPlTTvV8rC97xJwLhbo6X2vSjfZjOq9O0tu9wgwkSfO6vX9rhQMXBOCcDDEONEjsaGKdSMJtan5peKoglLdpAASzlyzEUVZyRJ1wsXgLm9Lu+Ga2c2vkUncOk6Fb09rlNRvVX8eCS39V0JpoRwvxzPwATSfu/MnyqiLP3YbLn7FPjsLPzM20ssq4dvx5FTziH4r/UJOQHqxUn9/gVj9c6F7BCMOIwAlxuJCc2aCD7A6FwSU3G+jaHCxngRLm4PR7bbirtQetD4MhHDrfuEOV/SosSmDFDSOLVN8jaLzWTHoeUWcOoLPo7WOJ/5jBgKpt48g/C2CIzxw45mZHveNKY1KIqMswxtLQZQzmzHpxvWiUdkN+hotGQ38t1S1/3ng6KcXqw+t4z8M/NBEhPfunreNtw9NUhgQkiTEVYXO/WzyTI7YmWJDQMscPGq1dY/Er6LIbwU5AXRLKtPHej7yCTHeGOcRF2mB8+fNIAhEAFB9sB3bd1tWmqUYXyv8cpVCgr2V+rbHzQxK7ZmvqMY/oqBA8J75CDZ6qDrjOtcTwfh8trG/N5Dh4w2+RSxJeXkJ3e0+dFY6Coc5hdnDO6Q5boODrMCULYsGoEfnV2rQvrbV95fKzjbr4ItCna7DXrr7OncCTB21NC9TF4fcIjUhmis/2sNkmrHQRWD7S9gJ6qkVhKPvuR9XybIo5lADYuebJSBZWAE3GjoW70rRIypdZ5+Ksosuxfs70g53K18jQdNevFEolmvrQ4l0Stz64RaVyQ3qTk25X6dh/zPuwybxEKZacwIUQsa7UBrycZDB1r7pndB0Dj5d0eh/izbY6ezW9pArzm2lVmH9gFBjuC+W7EJo2++QjpCaIybfPrc2pa+rcVYAYBrvrA+mpCbpJrQbkn3vBNFCeDHUFjJbxyrQBpETMCzormUBqeshp826q1jrr8/dkDesMM/TPmOiQ11C/lI= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: g/Dq4PVjyqLxrycuHoRmYQodKgqxjARrGCPP1ESdW1K+SzbKPndU6tDJoPHZtu/cyQaO1hPelcOEGWM6dijdGXFh6y1SySvRhFlj4y25r9Y0yQ3TpWUmbg90Cw/J4qU9G4g0zng9oizgDgQNiG8nDL97hpM79DK1uQVGAI/8ziX+K1f5K51EQGCaq4VNkhQR7x0WSEav6AEjOYrJ9a9JLYNbwLMFobtu8UWS0be+zillMS2g7s3lfXbvju9JCkZDnNUyNsF/E1KHBua7DHPwKwUvfjipUpegnatYGzCD3zg3953sjxo/NmjHbTxXrZ80bS3XjZd4MZBqHW2Lm2M/bFg20EZWF1/HzP04g/j/ViZfZ0ThO5Zs6+ca7W4aYWUlVzdcBBQBmbe05HTihZ4csRrqJLTTwtwIBKZ8Dwd09vtNfNI0nmRvkaXmOUj5hSz2ba2lezjxwSuYcbtQSz1iPQl/tKvTGgNmtzf86sIuvlsZ2003upWQxPqATigORFJl+lFUa5MMsk5J0rRl4bWzBINbmrOqzNHpnZeN0Wr7DS75UU4ACsmkAASMgJC64L2MGKXo4COE/pItFHCPb/F9qTvBTwm4U0oOguH/P6gdsHM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2cc5966d-6a28-4072-d12a-08dc0c2bc8d8 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2024 07:15:37.3739 (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: Hh6unwUh6hHh0prhRHBvRXg41VRutrGGZo2Q5WLVP0/InE6UDvdDdvDiilSTCG2rkZJzUF1tm50ma/gR2LQeMQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB6777 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-03_02,2024-01-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 bulkscore=0 phishscore=0 suspectscore=0 spamscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401030059 X-Proofpoint-GUID: LT6ZuGNlgtY9a89ITMORwCLKSl6qwt1W X-Proofpoint-ORIG-GUID: LT6ZuGNlgtY9a89ITMORwCLKSl6qwt1W 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, RCVD_IN_DNSWL_NONE, 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.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org [No changes since V2] - cfi_sections_set is best set to true in cfi_dot_startproc (). Setting it to true again in other APIs (dot_cfi_endproc, dot_cfi_fde_data, and cfi_finish) is unnecessary. - move setting the global var all_cfi_sections into cfi_set_sections (). gas/ * dw2gencfi.c (cfi_set_sections): Set cfi_sections_set and cfi_sections here. (dot_cfi_startproc): Remove unnecessarily setting cfi_set_sections to true. (dot_cfi_endproc): Likewise. (dot_cfi_fde_data): Likewise. (cfi_finish): Likewise. --- gas/dw2gencfi.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c index f57479457c4..cbfee0a0169 100644 --- a/gas/dw2gencfi.c +++ b/gas/dw2gencfi.c @@ -492,6 +492,7 @@ cfi_set_return_column (unsigned regno) void cfi_set_sections (void) { + all_cfi_sections |= cfi_sections; frchain_now->frch_cfi_data->cur_fde_data->sections = all_cfi_sections; cfi_sections_set = true; } @@ -1309,9 +1310,8 @@ dot_cfi_startproc (int ignored ATTRIBUTE_UNUSED) } demand_empty_rest_of_line (); - cfi_sections_set = true; - all_cfi_sections |= cfi_sections; cfi_set_sections (); + frchain_now->frch_cfi_data->cur_cfa_offset = 0; if (!simple) tc_cfi_frame_initial_instructions (); @@ -1336,7 +1336,6 @@ dot_cfi_endproc (int ignored ATTRIBUTE_UNUSED) demand_empty_rest_of_line (); - cfi_sections_set = true; if ((cfi_sections & CFI_EMIT_target) != 0) tc_cfi_endproc (last_fde); } @@ -1418,7 +1417,6 @@ dot_cfi_fde_data (int ignored ATTRIBUTE_UNUSED) last_fde = frchain_now->frch_cfi_data->cur_fde_data; - cfi_sections_set = true; if ((cfi_sections & CFI_EMIT_target) != 0 || (cfi_sections & CFI_EMIT_eh_frame_compact) != 0) { @@ -2315,7 +2313,6 @@ cfi_finish (void) if (all_fde_data == 0) return; - cfi_sections_set = true; if ((all_cfi_sections & CFI_EMIT_eh_frame) != 0 || (all_cfi_sections & CFI_EMIT_eh_frame_compact) != 0) { @@ -2502,7 +2499,6 @@ cfi_finish (void) flag_traditional_format = save_flag_traditional_format; } - cfi_sections_set = true; /* Generate SFrame section if the user specifies: - the command line option to gas, or - .sframe in the .cfi_sections directive. */ @@ -2524,7 +2520,6 @@ cfi_finish (void) as_bad (_(".sframe not supported for target")); } - cfi_sections_set = true; if ((all_cfi_sections & CFI_EMIT_debug_frame) != 0) { int alignment = ffs (DWARF2_ADDR_SIZE (stdoutput)) - 1; From patchwork Wed Jan 3 07:15:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 83205 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B5E4B385782C for ; Wed, 3 Jan 2024 07:18:12 +0000 (GMT) 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 C348F3858C33 for ; Wed, 3 Jan 2024 07:15:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C348F3858C33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C348F3858C33 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266144; cv=pass; b=vY3/3sy0A6DJVJCZnhn/jb7YBi7kuXFQV6gDAD+Ue4nXkhEWEo2EvAPYiWisijp/96L4Hf/6vLpp9/jVn1DuCedgiM6h5liS+wlI/cpk0B5AZA6sQMp4ZPZibzq0rj+RRJ5xBFvK1aBLyRd+RTuXBdNJZs90y3HR2c55njyVND8= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266144; c=relaxed/simple; bh=TMEpIwCY6U0EAcVohb004OC2t51mgFP1Vn+hp6uzNc4=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=MaTtlcgMVRJd6QXxtamV3QMLEqamfHDoPkWs5OEW1P6KLFdi0ylYNeTcMqSjQXUztIvcOYEPGOyoSuukdza/qMrNPog8aluhkG3I/jKEwHOnwUYzs6yQR9ehACzfrNH67IZWfVrhghSM49mIj2j2wlJYDOyUXGjpNCJT6DRoFmE= ARC-Authentication-Results: i=2; server2.sourceware.org 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 4030hw5N029204 for ; Wed, 3 Jan 2024 07:15:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=EWG8OTxG3QH0rkl31ekhUQaqgpaYkXbKOb+4u6mDGLY=; b=IHc0qlQLajDkFk6qn7RsBDHBYv6xCXjsgIGOxw1YeiCYPjLt2ALijSo2y89BDLpkB+UI FxPCIzydXMbrlefWdwyZdoUiEChnV2+TE/5GpgTqNzJg7lELMQV7m7/it/eiVt/uPlbM E4xEh18u2zClbIDUgrPQvU+AlKIi9kHRxbVXouGwIX9w5rT83eqRiL2+eA8WG+n5cdMz ZpjY+ykai/eaBIXLOlFLCDtG7xZVVhHln0dGNsBbXAA4/sRYH3bnFfMxGITxrFlcoV61 hvv1Amm4eqdrorLZ5YYm84hZfjBZOnAluD180N80BWwK1/LmtWlURn4sdMQPsmRsx2O0 kg== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3va9me4d3j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:15:41 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 4035ULJX012941 for ; Wed, 3 Jan 2024 07:15:40 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2040.outbound.protection.outlook.com [104.47.51.40]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3va9nexw3b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:15:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gn7kFOZUaY8bHlah576B3w5JzNExNV2zzi1Bc6n5tWImGcJJNX2SBRxr1cFXh479FnIigVwUVLhkgrqVaGOu3an42KR50zGJnnXN9q5TmnO0DcHAIN+ZMpdjkoOd92TpnInYBwSMGLZA+StMKP8OQyQr1kv9X/sWeeDno5pvoqV8zSkj1Pq2blO+sGk8A5JzEF5yRU04X/ISBa32CPIHAFQY+U4YXqvCN4sbKyVycqhUfp71LR9FvJPfXGO1Ngjwp2WsiOVDqOFftIeh0W9KyikaGvMmGo28p7L7an8rPR+OMuMMlGnKjIgSHdyXWdIXr9MRUqbSf9xlmhctzjKqeg== 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=EWG8OTxG3QH0rkl31ekhUQaqgpaYkXbKOb+4u6mDGLY=; b=GP32A7AKsfct/io9wJZkekgh0Cy1eZuna1RXlFqObZKX0iQrQrdfe4UCF75FT9zeg/8xy47dxAhJTfqB3Z+G9UVTvIoIL9sgyLJVBAuefvHn/2lk/dloa+XbhRs9JRv2fJ9TqbQeJVLLQ+RjrFxjmQxVUVXqoAkbnaP37+9gX4hko536U6BzM/I/rJLAjUv9EYP14lTE1TaZiYrHb2BcxYzbnSkpn7eGZjzpO2UJ/VWDYAqtx0alQmokHqrIwgMY82UlWUmlLYmMzW2wi72juki0UWSdhSMLLnvbarF1hK34YGUE8hxrpTHAuYHZF4PJWuR46MiC5gx068wXFNUZOA== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EWG8OTxG3QH0rkl31ekhUQaqgpaYkXbKOb+4u6mDGLY=; b=jOPSxA9RweTEtmWuPnIOWqiGVcvaBNHVGAPvUrTRPLMOseto1cf0B1Uv1XciSdNi5eiAabn8SVo8/XROR75KFKqlQRcV+VB+78nXsjmwgXHxbG7BgDB4jhY2GIX50MjqdOJ72J4eOMUKkJAjxE78VEGln7HGdUTNISIoK39t5UY= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by CY8PR10MB6777.namprd10.prod.outlook.com (2603:10b6:930:98::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.25; Wed, 3 Jan 2024 07:15:39 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac%4]) with mapi id 15.20.7159.013; Wed, 3 Jan 2024 07:15:39 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH, V4 02/14] gas: dw2gencfi: use all_cfi_sections instead of cfi_sections Date: Tue, 2 Jan 2024 23:15:14 -0800 Message-ID: <20240103071526.3846985-3-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240103071526.3846985-1-indu.bhagat@oracle.com> References: <20240103071526.3846985-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR04CA0220.namprd04.prod.outlook.com (2603:10b6:303:87::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_|CY8PR10MB6777:EE_ X-MS-Office365-Filtering-Correlation-Id: 4cd415df-95c5-4121-d801-08dc0c2bc9e3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vtxc65rZpBZ2FraiEnQVtNOosa8hdA9bO1NabL0LeRz8rQ9iOFN1VfiSdg+ztlgsXWgGj052hDeWxOONxjTUKdofcokQb8jNq9vYNx7FI1S9EniddKhZlZYsDZH8ylj6wI+rIxMtGLqOq+pzmRfhwkeqHrIU1VxTiKZGBt2ZnjkbdEczXXo69ifu4Ai1DFA/42qiP2pdxkPfKqfPbgTgzLvxpg4RlWr5fUm7CWGENMDetqjpnxEWEBTY7rmUqgC/GGgKGz0xP6zV8AtyuAfWegEnu8YYmt+hzK6nz/KozninmCgb/vIQjVRly7e93ycYy2/Mvf8QpQ9g99dvXaE4GlCNpc3IZ83AbdKakjAtaAGnnod2pbez7DoeuTDywSPohSdgTe8vG69IkE29EW8Iu8rM3POK7zcl2Yax4y4/BkqT/AimtsDdeBToB5ssqEWOYmeiGLQm7QW7rAopRhfkcR7r2LodsRmw9x3XcCyBKXFxlEeO70vAAFGT8A5xOU4Q35YeIY1xAgyhuAu9lf38wC5Xi26lvu+yaqmHPkDMOLvPHtgP4gxZNiFqXdIvG7x0 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:(13230031)(366004)(346002)(396003)(136003)(39860400002)(376002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(36756003)(86362001)(107886003)(1076003)(2616005)(6506007)(6512007)(6666004)(4326008)(478600001)(6486002)(8936002)(8676002)(316002)(66476007)(83380400001)(66556008)(66946007)(6916009)(41300700001)(2906002)(44832011)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dvNbzvnfXypNQNot2KRzIXL72e+cu9pCvtjtov+F2sSR3hK90xtrt7JZAgjQ0NjP70jbfYlzLP+zalAy2GIpdRce5Xzwk2vwBNFHWA97C10hu/dJlY8YZiCS9mTVSe4cUa0Y0y5zkwkpJZ4GYNVaQuJCOV/2S4CAgQNsrnFfzLHhgiPHRWt75hhXSh1EEyER6qAO7yFH7N5elvu5DCcCN48ISAgokjTi8UsAB3NDu4CImb0R7U3kU+zGmOazd0bFjxoPsl6yWsqY114dj2+nvZ1GDmqYzmyVTJGsiPNlWSf89/Q/uwcidIXI7mDF05B5SeaKrJndytJubZWDayoKslcPlgkOPO3F1mlY9aQBNkQvHAiEoSlEooMLLckzC0EOV2F0b/vxgku7hxTkvs9w2aZK2AQX2W3wi3xh6zBrL9hd2/M8/nS1mIIjMvkmwCLKdam4wiswmuw52xc5w0O8Q0/n1F8MbiKmArhnr1huM9qrH1J0U6+s+26OFhBhHyORWs38HuFbyV/go4ppAgWg5JsC/vF8ddf6GWAvT1OfqdO4yAvyZLDMHjtDYxc7PptCCA4km5FWjvGszVRyM/4iXKki3b06hadSKJJ1IVqRbz9VxzDQuloFqxUoVx1VtU+hZ8+3LBQ7XZNDQ26zHUzlJZ0fW+sJm2LEwjliJPqxVk1qGzazBgz6TBiUbkQ2FCdms8yzswupiDd66DplOWvWExagSpwxg4gEyru/9239Ua+wcFE5nrF6PerHN5ll75R9QXHpobaY8V8w4KQt3rmxibYjsmqPosU5W/D/Yb2m18jKJ6fJN9vqROv9stkv6u/lnR99gwX5v+hk7loqvs96T+BS64aHAayqbYdDlZaY/Rd6+N8YA6+mUhbguDMPb0YHqTm33r8h8O4q6xHs7eASwCXR+tAbpn0muyYEzgw+AfZforOuqgslb51g49GH8+fvd54gYpTUGPaZ3kdgFjJpRXAwBrwtyg3SxTZM+QWzh9LWzdnCemp4peKNx7XMjSyCIrgL83jmWOwGjq1luKIf81lga7Gb4yuNWXNMnnhcS8R19o/qbPXvrWOlyD3LRxYipdU9C8lKG6gOeWh1bmeNJ6LLyycuLpk3eZ64nNHlUrnDo30AjcWFIZv6heeD/pqnp5QE/z8iX19UIJmvmaNc/kjAN3Mk5uOPIKZQYkBCGVQnaJkp7q+kVTuqwHZ3Hqc9YdHPwupL5ICLtWfFBpT/KwbaZIUi/qIwBSZehLQPBOfZ7rSRx52yixE20lLubdkYwib9Y9mNcMsWp8Nso+3M5GDwEOOcOFkdlvoZvc00DK9qji1FO/8Edujz6AbT/mzcL27HkX2jZI3T9K8kxL27y26X5GBbElDEY0LewL1P6JN2ZNFqRHvT+vp6PBD70TAbyO5W/WswqIQrB95GfFXDlK/CKqWuqS8w1DEVSXShqQvS0++K1vrpiznViPwxWxh6ISrtfcQzwIe0D+mkSc3Z8cEDzFR7Of5ks9D48BfUkStv+daukyoxG9wdi6SCySZsTnhEht8MOw0V0SBm9ZQLG1JtOd9TGP1tkH61/88qnqicL+Cof6Vmlwl+p9mEh1TTjKl49DVTZU7tum2EebxQ3vB4oC/vzY4f/La4N/4IDjo= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: S21Vp7qe+d8Z4axh48y7Ak+oV2H7SxaIYL9CQRcqE5j/CJ132lmc/T2GUbdLlcNu7RAIzZSUClcuz00okv8C96PMrWeuzarwOs6zfPHshrvVL6O/RpoSuvb//b+T8kg4inRGGCJbyYyBVCY0o3YeWfJvHyvHXnFg4kJ3SBXqxVvBXohkQDMiOhQxgPM1pMGy4nWdeWKT/Y3hsjhvCFdnaBTnPSny9cBjV9hFL53Mbxvur1i25Jn7IuEC/1Gvkvjd//fZ7NsXF4mp/z7p/vqaGMLIHiigvIXUHXeCyKWYfW6i6KkKAM7dYXFYUi1rlt1ithT8o6IWlgZwi7XvIiDhvxBQiBaD1fo/QqqE1qQbymqDJ4UTEM8jjSMo39xZonknCWirtGelJPrunuMs2snuVsAhTNPnr/0OHWShFc8szQG4+E2tQGTLGmIZlf8du1NeS9eI8+4l8votQaj9qMJP5YnLqoKBa63njco8scuPz5jzGCmGP/AippVglJ2W+5VWoYEgEQFt2ymLyDp9dOiXQryxlaKBL5J9uTMxjA4HdnsX4hnBYnHeaD7Ce+9JDVyBJEaJxzdf74fDZ28KTh81a4IEG7TNMMQ1INf1a/O0E4s= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4cd415df-95c5-4121-d801-08dc0c2bc9e3 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2024 07:15:39.1093 (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: nQH3BESqlOKd9tqqoDPkntcjnrOruF09+89fWB1k8OzCGV7Xs+cMgFvLM69rOgTShkycNULmEGjfr1r8ncBTdA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB6777 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-03_02,2024-01-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 malwarescore=0 mlxscore=0 bulkscore=0 adultscore=0 suspectscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401030059 X-Proofpoint-ORIG-GUID: e1ko03b_V8Ag0Rb0dA7QZ-pkBVlAneYb X-Proofpoint-GUID: e1ko03b_V8Ag0Rb0dA7QZ-pkBVlAneYb 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, RCVD_IN_DNSWL_NONE, 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.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org [No changes since V2] The code in dw2gencfi.c was checking variable cfi_sections and all_cfi_sections seemingly randomly. Accessing all_cfi_sections seems to the correct variable to access. The data in cfi_sections has already been propagated to all_cfi_sections once cfi_dot_startproc () has been called. gas/ * dw2gencfi.c (dot_cfi_startproc): Use all_cfi_sections instead. (dot_cfi_endproc): Likewise. (dot_cfi_fde_data): Likewise. --- gas/dw2gencfi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c index cbfee0a0169..5fcfb373935 100644 --- a/gas/dw2gencfi.c +++ b/gas/dw2gencfi.c @@ -1316,7 +1316,7 @@ dot_cfi_startproc (int ignored ATTRIBUTE_UNUSED) if (!simple) tc_cfi_frame_initial_instructions (); - if ((cfi_sections & CFI_EMIT_target) != 0) + if ((all_cfi_sections & CFI_EMIT_target) != 0) tc_cfi_startproc (); } @@ -1336,7 +1336,7 @@ dot_cfi_endproc (int ignored ATTRIBUTE_UNUSED) demand_empty_rest_of_line (); - if ((cfi_sections & CFI_EMIT_target) != 0) + if ((all_cfi_sections & CFI_EMIT_target) != 0) tc_cfi_endproc (last_fde); } @@ -1417,8 +1417,8 @@ dot_cfi_fde_data (int ignored ATTRIBUTE_UNUSED) last_fde = frchain_now->frch_cfi_data->cur_fde_data; - if ((cfi_sections & CFI_EMIT_target) != 0 - || (cfi_sections & CFI_EMIT_eh_frame_compact) != 0) + if ((all_cfi_sections & CFI_EMIT_target) != 0 + || (all_cfi_sections & CFI_EMIT_eh_frame_compact) != 0) { struct cfi_escape_data *head, **tail, *e; int num_ops = 0; From patchwork Wed Jan 3 07:15:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 83202 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D27423857C56 for ; Wed, 3 Jan 2024 07:16:59 +0000 (GMT) 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 524023858419 for ; Wed, 3 Jan 2024 07:15:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 524023858419 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 524023858419 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266147; cv=pass; b=kBXRwKwU3IJym7wimCvTZRKQdtvi/6qf2s7wfShZlZtP1CiIJi1dS0Y9NDHN+m9S3ApU/Z+2P0W+EPjiLdZamZu0DnBS8TiImmy4r2o3sOxFh5DYkpH1tw2mpNnYuG1y7o4ApHZU50SznvI1VclQUs+kadIhD1pdxscUAF1kHS4= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266147; c=relaxed/simple; bh=67lLzy/PH3NqVuB34tfhICccDVNrVby7yOhI09MzgWA=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=JShssV3hcf0CIEXm3fpTEDhT7iIkOCMIkujzCXkuZ5wOxcz2Uv8BMr/7T7GGb79PuNvmRvcHeCBkACwHvzN42TcC/7edo8X/N9gTe2UakAbtdj677RjkPom7Umzj6AZeTOb8+hV1Qz/lqS7O50OH5D8nD5P2iWT4AidzEHhEerM= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4030imxo022146 for ; Wed, 3 Jan 2024 07:15:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=ErfjLXbZIIBxGDQAco3+ZiP4aH9qH9tYuySWsADW5J8=; b=Mgkrr2qX8JVYPirOXlDy1sn9jQl6jDkhHVOdYRKzEqqFrvFgo/gvMMorFLA7PSR4BMVp hjAuKJ72Op+vG/JJlu9uzh13RYB1gvGGO/ZnW02ApcNaB5zNCgRLm6SSyXKrEYmVx3Zq 37Tta8oIbCjrwhzVM7bmmbNZpaXPQpU/jEE81AlcKFEBU7dfhtjVVZMdVSKA1xzQ4ipU NDVali95wmZYlTVuWmNdFOgCgTlyPJMvB+0CzE0SHE7MFveiGY1GyoUXk8ejs2R9cYRV 0UzluzNZSszV4MUcdQEH9jjYKkikNEv3egUkcEnlF+EBTph8tHxe5xzfKVM9fzQ8//R9 jw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vaatu4cqj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:15:44 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 4036NaHW001796 for ; Wed, 3 Jan 2024 07:15:43 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2040.outbound.protection.outlook.com [104.47.51.40]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3va9n8pdjw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:15:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IeFDjti9o/rov+xSNirxjrFQLwz+dz6rLA0TPDpOO6Jp6/alSw87azAMT3FJt9qf5kQFO8pD+k7CG3dyMF2Zl/AtQc2nzEwt/ueoYklVPMNPMtlWMxorRH+yhVwxIZc7yp+bWgGn6+w8uEss48T+fdcTtIEin3MyYwUYunXVkX9ZtpvOW35qq4XPHtZWbvRpefN2BhJ8gVuBb5FrMd0HMISYMn1MhgAWbQprYYkdGO2fNdY6ZrJS6JaVO7OcmIXUQm3hP+AHvRDtJB06pPJXwLdaWvHm3vNHEbNLPTEeUk/DbLrijbiecD2/jFz63+E3G6HKF+5s8cNqq0ECQcZRGQ== 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=ErfjLXbZIIBxGDQAco3+ZiP4aH9qH9tYuySWsADW5J8=; b=E8Fv4RKhLGjz1vnYaO5YAGZcKogb8tgNzbhoevvzUqcP5IYVSn1a+cmR/vMWdKmPcORFTPSRP3iFEJoC95S3I9JZNPPmzeaeeSbxM6KCyGjNlUNQj6Mptf5m1TX3qux0I++ACGOZqOugFjKBCm24IW28Na5DTLi0LPrBHieU0PtsAm6Ij0NsJhDqJWIsEIXFO+KUuH8Q/fjbNQrqE9yPBtYVkPCmmL269S8wtAz44qkrQzMWobOrhqbpAg/qmvQukeBQ37Eh2GBpdbFCKw/uJwog1YKxCI/a1acEuDX6RW+TB1lS+aVPGx2rUU1csleYIZAy3t9Ug6EmfmT+lSvzHg== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ErfjLXbZIIBxGDQAco3+ZiP4aH9qH9tYuySWsADW5J8=; b=hrlnFj5jWBRHDSoT1PJT7e9nQV4Zls/TJRJUOEJMoVO6KSz7mt50JUmU25XzQwpCiXygOO0pKpuiz4SkQFf36/O/pvmMnGOW7q/trh7dx/I8Eb1I5uUxFP3HhTsZeR3bVvxvfcd8U0QFbkhi+oqOwKyHGHd5pu5W5MO2AD5YLzU= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by CY8PR10MB6777.namprd10.prod.outlook.com (2603:10b6:930:98::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.25; Wed, 3 Jan 2024 07:15:40 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac%4]) with mapi id 15.20.7159.013; Wed, 3 Jan 2024 07:15:40 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH,V4 03/14] gas: dw2gencfi: expose a new cfi_set_last_fde API Date: Tue, 2 Jan 2024 23:15:15 -0800 Message-ID: <20240103071526.3846985-4-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240103071526.3846985-1-indu.bhagat@oracle.com> References: <20240103071526.3846985-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR03CA0111.namprd03.prod.outlook.com (2603:10b6:303:b7::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_|CY8PR10MB6777:EE_ X-MS-Office365-Filtering-Correlation-Id: af395152-fabc-4c69-a548-08dc0c2bcad4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bM30T1sLZmiax+3x8fUum03RIWjIu1SSMs+05u+274B0uxbpGawxbxBVA8me4Nq8Ti9IjSymwtac0I+NHI0cHDY05lkXOpUq+iBytDxikKWo3MAFzBkCF8I2YPRa9Dwgyf2ygatOQoGyqrFrrtMdYSEj/tEinfRJl73pxKJRvQpu7tBmWltiaA7y0YFwmi7z2hTIxSqa34O1LjarXXqoHSrQe0Xp2aDK7q3iChp80+r6GfbswTFnH9DUR7Mmhelbs3IhFv36Q9IEN/OQYeuHYvPR7io6WzlVU2KtNO56Z0u8/jpN2ebF2K26ouls4wTH+4qIsmLoNHe5o61Me3KauDe8/Pwm95MLZ1rotKS0GmuRgspgyFnjdXKbdrdEoN1m9tR2ltDzA6ByVD9EpY0I1+TUB4JyehrJV/8qa+lKMiRGU1ytyp0aSNQqIKYCs9i8lsBl4fcPwsfCBwk3BEQf3Yi1TFjU7KJiFkLA6oR2W1I+WqVSFlgSyr4PMWDDQzy08kFXBnjxiCA2GoAFi+MsVqTxCtHKyM1eWpbqjXLGK7/NxmPq5Ui6UXdvPXaf02uf 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:(13230031)(366004)(346002)(396003)(136003)(39860400002)(376002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(36756003)(86362001)(107886003)(1076003)(2616005)(6506007)(6512007)(6666004)(4326008)(478600001)(6486002)(8936002)(8676002)(316002)(66476007)(83380400001)(66556008)(66946007)(6916009)(41300700001)(2906002)(44832011)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bT160hQuqt2XKrcpWHLJvs5ji3DkHyBNXYMNb2rQ9n/XqqsaWSjDcGPWUpeWrKk+CUAflwfGqsnd7lrL5hgCrsrhRVEGXA0pKV7En1ngKUN9QS+Nh+jIZMQXk4gAbUd3NoQHSGyXzwfOEyb7/mdoqDnw6U+AJ6OSApi6QjX7P8NZ6G67DbuIM2+iLXp+BMfRFz7YSAxeVGJ6Ea4CSYI0CFQ7Q8b9gctZaX7Ah2kTdT+3XAJtWc5ZlzNFwpotVH1940Tj7us3Ji7IgL0Dvb3yZuNRNFGADkzegsufXrZ0qXMPiw2S8iXS5rnxOXRzQyiHMsG7wfAtploeBzEKNG0+d2s5Rrp3M0mgf8xkMDXrAXlI3zwkxNGFoY8IEAWBUZyajHh2+wgMDZsNBOB5TRyNg2XVqZiBva1NsMQ6eRqwzNd2BcSYyP66YKjElW41ZTLXN0kNLoMO5KjKBJnJWyYzcJLIiAFR6dtaVL3WuTpNA3oDEhyx7ROQcEF24EGS0iOFQoeT0yzxtuO5M+hJckdtQ6YdsKLPkT06fxJTv0tFwzR5/geMwsxSLaVgJyN9D3IhESQzmuBmuHjziIHLBm1l7CTvyPsTo9G2mwqLAma/3ZvpRHSiHkdlv0GML3ADrHrWthiwAE1+OX9/uVQlBnfPpabRWf9gFaQWF3i3iO09ZAOXEVj0imag6idXpGzDp6TGex0fkbHXGERhrfWCxplD1II+vvN9o/+eo2x6yGZY/wsRWmjUaMT8MKlKsdpRu4Ap8vkSDLYm5vABhAPjpLaO8nGq0kppsfJ+ct0wO+BuGHztTVS262dJLkmteOSxJurZCAPFSsX+M53TL6vmV6KWpw5syRVWEeufnpfjelJc2QrsEGEDw2fImKXGz4hO8LCDwfJAbofButjnrkUCFdKYqdLoP/I4DJINAK9vravTnDCsnXeFWrA7rHhNRrjhdCXJaSZlv09jMVTxviuEfNRn9Ez1SK29+MuhrT3O+960pHuX0uohOZvjBSIwx0FEZ8x3vEYCE+YJemFyJgu5UqP+/Nu0KdCP0w+uZW0L1b1tO3mPkEYlTXpcUgsXle/ATnp7VzDz2ol8TiXz7yRgnpzpCMRE4xUHP5p1g2ylauKaIc5Je92xbdw0eQKnt3WTKtt/kphUUgDnu3Cj3aQwchVsPkBOkfmtiSl6NzZ2Efeo0mozBClCLkNaYPjNw3MiGPwHQwcJw51N2RTxf3iHHJTxtpCV92MSnbNZRNly68Ni8g4rAChyu3QucnFPj+UU8W0m9xnAuqDi5t8+/FkictE9etMy7IP8GDd+yXfTRFmLFSWlbwP5i65wg+9O+9THrlkJxai6wxpJQSA/NTejVC9BhA0jaEBilKSzWDKFGSwCGIAtvWOqY8VoLwW2xRBQxFz/5VekPdiaFwaKuyHRxkIp313phX2xB79APubNpmh1tg/cMNWRZR8Tkcilut/BG+/wovX37n8GOJLkEGipox/rUH1E2nt32a3iHpVAJZjDrnCn2E2LYz4q1TjBoeswvdhlakS/xPXVu/wJuS7qAIj8uEPXN300NNhN0BN8EF9CRMfZ6UbODaZnPRBYCoPss+zy6362ghqys6i4A9AzTVu6NNayr8aEZEGFwTDMhkY0Dvg= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: FE6r76eCLt0Cq1jPQB5vLW3+aFNPI2rW7ftBBAc3VaIt02lZh7rqBHwAOeWXEhaCRa6LDFL1LQfEjmXdqfTpp7b+LaDHTXFsQPhKUe1UGr1+AxF5cYf8VKZFFEIOZ8lFty8F3/Szwu6RDzc4SQYwi+YxHxDGQsIbqa2QlspklKfRn6CsOju0M0zdbqCqV5qi4J/1mj7Q3Fv/v/lt5MwmXqYODx98RsrKQc+g0DGENdxRC7+T1XHN805SQrLiuz58HcL78CDEQkVRJR2Wa2V7EA5UNZiTHUsu3xQ6Fv9rzFZ7tBgW0Fl4Psn/kjDh1ITAa38BO3N3ACKAuB18oYUrfgqfi8FE5N578KUPNwl9uzokX4FWZUYKWQ37WS9D3I61DfpGv6py/J24IfbITAHrhnvb0VyWkkq/qwoIeiN/NRQGbEi0NXBSeTlhsnLODCsAfKVsVtU3/V0uMsZNYsG1/14aZsRG6emF9R5/433Iq2Qh96PwxxmSP0RTduMCMUzXRjIoGIGa5SOz4yFID/jatyHlvYSeBefiVsuJ6UeXourmIB7vl+T8oURG3LvDY/wZtcGqHPLBTDc625GRl+UGF1YGwmKhyHkiIN4XHlk3PBw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: af395152-fabc-4c69-a548-08dc0c2bcad4 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2024 07:15:40.7236 (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: EpPOPc7uzlP4Jo7r082HniBt734anzBXko83F8uxi8mADlOKlB5kTDiB9HLwAGNbBB/JJHjVAUmANK7r/kgeww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB6777 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-03_02,2024-01-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 bulkscore=0 phishscore=0 suspectscore=0 spamscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401030059 X-Proofpoint-GUID: yV8GrJAOFyEAHU5l9Oq_X3BlfZOLMXbs X-Proofpoint-ORIG-GUID: yV8GrJAOFyEAHU5l9Oq_X3BlfZOLMXbs 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, RCVD_IN_DNSWL_NONE, 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.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org [No changes since V2] gas/ * dw2gencfi.c (cfi_set_last_fde): New definition. (dot_cfi_endproc): Use it. (dot_cfi_fde_data): Likewise. (dot_cfi_inline_lsda): Likewise. * dw2gencfi.h (struct fde_entry): New declaration. (cfi_set_last_fde): Likewise. --- gas/dw2gencfi.c | 13 ++++++++++--- gas/dw2gencfi.h | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c index 5fcfb373935..a69854ddc0c 100644 --- a/gas/dw2gencfi.c +++ b/gas/dw2gencfi.c @@ -481,6 +481,13 @@ cfi_end_fde (symbolS *label) frchain_now->frch_cfi_data = NULL; } +/* Set the last FDE .*/ +void +cfi_set_last_fde (struct fde_entry *fde) +{ + last_fde = fde; +} + /* Set the return column for the current FDE. */ void @@ -1330,7 +1337,7 @@ dot_cfi_endproc (int ignored ATTRIBUTE_UNUSED) return; } - last_fde = frchain_now->frch_cfi_data->cur_fde_data; + cfi_set_last_fde (frchain_now->frch_cfi_data->cur_fde_data); cfi_end_fde (symbol_temp_new_now ()); @@ -1415,7 +1422,7 @@ dot_cfi_fde_data (int ignored ATTRIBUTE_UNUSED) return; } - last_fde = frchain_now->frch_cfi_data->cur_fde_data; + cfi_set_last_fde (frchain_now->frch_cfi_data->cur_fde_data); if ((all_cfi_sections & CFI_EMIT_target) != 0 || (all_cfi_sections & CFI_EMIT_eh_frame_compact) != 0) @@ -1568,7 +1575,7 @@ dot_cfi_inline_lsda (int ignored ATTRIBUTE_UNUSED) if (last_fde->eh_header_type == EH_COMPACT_HAS_LSDA) output_compact_unwind_data (last_fde, align); - last_fde = NULL; + cfi_set_last_fde (NULL); return; } diff --git a/gas/dw2gencfi.h b/gas/dw2gencfi.h index 962fdcaed17..aa8693df342 100644 --- a/gas/dw2gencfi.h +++ b/gas/dw2gencfi.h @@ -25,6 +25,7 @@ #include "dwarf2.h" struct symbol; +struct fde_entry; extern const pseudo_typeS cfi_pseudo_table[]; @@ -35,6 +36,7 @@ extern void cfi_finish (void); /* Entry points for backends to add unwind information. */ extern void cfi_new_fde (struct symbol *); extern void cfi_end_fde (struct symbol *); +extern void cfi_set_last_fde (struct fde_entry *fde); extern void cfi_set_return_column (unsigned); extern void cfi_set_sections (void); extern void cfi_add_advance_loc (struct symbol *); From patchwork Wed Jan 3 07:15:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 83204 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AE85B3857720 for ; Wed, 3 Jan 2024 07:17:53 +0000 (GMT) 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 BAD463858429 for ; Wed, 3 Jan 2024 07:15:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BAD463858429 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BAD463858429 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266147; cv=pass; b=ePAfappjkeP7hMQ+XWXRG5npIg/Fq62+SVn/2LkYk+Tdw1fC9wk12CEMflTRDTelmap28DqxqV0ZeK2lQKo9lsTXL4/Y5qyJavLnqpjC/PP8l45ndaZ7C8cD4ABE2Av0v+mTtHh4L0JsqO397UCDhfKGcOOyNz4LLLEGmYnALdk= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266147; c=relaxed/simple; bh=X/s43mel91IThkwA3EuPJwQ/JvGXhi/Lxv1SE5g9S3Y=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=JatyesauK8Pt83bq2Grlm0qgzqZwFCzaEXi2cfIbyDEUMCNa7NTpfjjOtRXJp9dLSb1iWmoQqf08VcYa3uhaoAxMkDvJFR2JS080OHaXG+IIhrB2kIveznFOq09bZxEGjAleUf34rdjh21YT70QihPDTV3ugAJvZLV21O3WVXbQ= ARC-Authentication-Results: i=2; server2.sourceware.org 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 4030jH8v030230 for ; Wed, 3 Jan 2024 07:15:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=8SKZ72LlztGpIubVd+mSQ7dTY75hgDKODpPUX6vGJsE=; b=DOY8yygNc2WqQ3DYxz6U2Me6sjKtZqC8Xke0shpQlXi4V/RmgCSWpELuJ4QczWguih/A ZO/OmkYr+LBviA1QyZkwQgH/FEPM5hSce+FY2kziymk94+VihYHF52Eqm8Gf8Lmyk5qX VPVfzmO7cuNhDQ4lTv0WxXJhG7/qtEnlZ8r9iJRcvAZsKJw6xtbVfOUlcicVaPI/cdj9 3SKCgb1HYIBUmkTO8ffShkSehSgSQjw/pfGIxJpCokn6Ny4TqiqXU9hG9DUlFjXMTlQv m/ehZpOjlew3C75QNBPU8aRtrAUteBn/KcO4U4FjJJIfQJVV4YlOJkIQ2ZLiFKHt0x6N ow== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3va9me4d3n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:15:45 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 4036NaHX001796 for ; Wed, 3 Jan 2024 07:15:44 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2040.outbound.protection.outlook.com [104.47.51.40]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3va9n8pdjw-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:15:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dt2fdMPTAXvBOV2leFg8c3Fe0nIg4p5TrIFg9N233cDix1YCQEZYr6x5flpsDxQbEGzvsBvMstBCJURXfcS8LVJvA/pwrvy+oDsk5l2fSzwB6K5A/Sfub3laEKR95sr+eQ4Pclz0NZUWR3A9cY2DbAbwJVkc0icIQn9+S63xMOmWVkxgiW4vyImAME0T5yCkuSencQ4rMQZqC5qtNPR72OWsQl2WrAxUfmKlNrKW2Nzy72d8WnV+BiHF7oUMecubBJ8d7Wa8o+mhv/RVsHZwoVXhi5+4TaOOSfIX1A1pZMMSEs/c30n7mKscU57ikGP9MhJfPm9lR1eyqlQ/opwNhA== 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=8SKZ72LlztGpIubVd+mSQ7dTY75hgDKODpPUX6vGJsE=; b=f3ipuR4UprzxFn9RapcL3Otps0R0MjdNEzV4f+Bfro7mpKZgS+uoouYWsFKlscly2GQr09el9xWOH2RH3nQH99aQVe6QuQFK+X43IZtxic/JBLo6El+jqQf0VY8CfotHfagY7OmVawLQpCO3xghiXH+MLj9E2HgRqlZeWcHyqGZTOFc3RQuoe5f0OXW18VqTdc0hMRE5dmgAZoO0l4vsvgsM1fCPGConlvmL3HonsmRFkmRRNjHxXmYLMSJNHlpjjLAOGAs1HW91wSlPq6f9JIP0YePzXe7Gt6YbvSMXApDzq3C0OuUb+9u94OKJw1i+2uLVWqBuLnU5EXy1FKIA/A== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8SKZ72LlztGpIubVd+mSQ7dTY75hgDKODpPUX6vGJsE=; b=zBs17VZT2jfqASI/mQVDc1Ictf3Z2Dl6yjM1zCmp5NG4xazkpGTeQdc1iA5IJRTK38NLqJTMBViifUaDuXYpZrrGkLfN/EAknEBiF+1x3GwaAZD+usbp8dL48tBqCwOlwIZjidM9X5ZykvpZT9uDxoqhXLIGY9VcLoz3I0sxW3k= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by CY8PR10MB6777.namprd10.prod.outlook.com (2603:10b6:930:98::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.25; Wed, 3 Jan 2024 07:15:42 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac%4]) with mapi id 15.20.7159.013; Wed, 3 Jan 2024 07:15:42 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH, V4 04/14] gas: dw2gencfi: move some tc_* defines to the header file Date: Tue, 2 Jan 2024 23:15:16 -0800 Message-ID: <20240103071526.3846985-5-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240103071526.3846985-1-indu.bhagat@oracle.com> References: <20240103071526.3846985-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4P221CA0030.NAMP221.PROD.OUTLOOK.COM (2603:10b6:303:8b::35) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|CY8PR10MB6777:EE_ X-MS-Office365-Filtering-Correlation-Id: 7ea07e3d-e011-4e4a-c005-08dc0c2bcbd3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Dc9LAKfD5LZfU6T6lFEl7QVS2X3GFYE6Jn4QJQ2LNhsiI4GJEun6dYXnMQXcmQHxfinwNW/JlQ9Zjs/N/TutnHE7G8MFoRPu6xyjxxGnUyOIXKRd4crZ05e81XBEK9Q19fU8QRPxcbs3J399Kqj2AzMOexpbdqKsDD1M5MM/y2g2ZDJr112SJxaW5mWTkc5qn+uVJJp8a5AXlH7nRgUL+p3Mc7BHszU6RdyfUj/8L8SpRrdOzNUDx4uj5f61VZkzwolErcAUB+RXbcSNrbOg8wPS1bUIMMCijJY1UGT2MO9VoGLRkw/qKkshQQuN/f+wwV/YnUQOcrXZU295p9/pOEE65nRqpIkmskMSB4W8eAq9s+Z8YVXBbCFFpaAVFUR6xKteMgAJvCrtjwzU2zc4xiiRrsCOKnQXuXGgkwZfi7KfqgaOGZIkSPbseT92WBvG2WGdHOSUP7jWLFlgGZm3sLld3rfQ/jr7hjTyfIlcJDJbF4XUxuWc+vhhrhlhkF+PGt2WEFSeO9Yz6n0B9YN0KQG/iThY3z/1eBS4jPt2BNt/Vv+hEUlg5tRk39S3EHc9 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:(13230031)(366004)(346002)(396003)(136003)(39860400002)(376002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(36756003)(86362001)(107886003)(1076003)(2616005)(6506007)(6512007)(6666004)(4326008)(478600001)(6486002)(8936002)(8676002)(316002)(66476007)(83380400001)(66556008)(66946007)(6916009)(41300700001)(2906002)(44832011)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QcanF0so3NfGk3XwLrAyOlAmHzlELNkAU8l2iiWLbYUomaDEkmmC7BEjv9yMakLqcCv28orsFtNIracK3RO7l3NNXlcNUwtnlFuSyn6tzo8a1ewgJxcOPo22IWkQi1VGxkWc9NNBPdTLpNkXn+/awLhg/74Uropwsoo+871j+duJg9denJLNUQTWLkX7VzCn236t2OIvs/BRLIlzTw5ukNg4oen8FQH/pdtWN3wRsyAEQprz4H889vMDjQfVaXpT0x6WJzGAW3RhOlJrxsdKz28Nhoh3AMQMSj1gqKd3LzFnb/d8JK3ykyEnR/gFlt7Br81N5Q5plZwxtI3MbCPSEh3zHblo04d5hqoNNwy2z45X5Esw28Byj4yww5TIcKCWbBzp4W57Cw+WyYjLPJj4mg0tDbnf/CIUVVGdHQGPCyjJAZ1FzizBvt4r82nPqXqvavDXFgd8OBvostN9EnxP1BlNtJjftr5QhYQ5H9O93Q1DeULN5Bhf8qy8/1eoRL4XloP4OYABdj7U9PAAzqI0Zz2OEUmsyWPKWMXxaT6xzgxe8GvU3gi3vVscBU6WSlNH04WclkASyCCwPyvO94KmyFBli5Z5ZDb1nCV+ZJgyjpswzBsy1ckf0RwgLhPBpc1Cg09sUE8mYeVwB5Uy17omhKmfBrmUNKZn1HLkdtu2adO06foBwaf9f+qmP1JlpQFPuFWyspzi+zmDgpMbWTzMPDUUJ3nzXrMsiVb4lZIod/MVrAAY+ge9wSTS8Eh2UgRbWeT9Sgcl9+2v1dz9z2erjsR3tfkkYx7Klf0J+k7WLO/Ebl1LxXRPhDm9asj/KDC1VEoHaSYT+nhFmNOAsQZQmzODhMY0basUXdLmuUmKnjnP7NG/QIVmtoQdfSQXX3lgp1qBWmOEOAAReIpuNnVVkXx5MVLWaPn05VTkwoRrWRVCVJQw3sAkwfVu+ZbHaG+xf71sc19FvgUrZTCHTxtIYyVePcma+y7Yajgf1J+7Q1FNO/KeTnuE0j2kAynEEPqYN84jK81l8JxnboBRGXfuhGxZM3/e+FWBXCzmxNHR2Be1zz/ddJT3ZKJ8U4idZyCDolsQJfakgUI4FSF6Eb4C63Uh2JxrbdyleS14piw+0b7bH4lqTHmHUy2i8BxC7U3dcn2MI/1iB7lD8gpryQMVH9px3O0ekE6gseMC7NEXYzyEPPszuyPMOzZAv1FaiMDWpN/hJpQUs1ZZPCArVgDuBgNNTo6KY6NGpcdE6eYCECMe7hn21PmofYOpvoXHwJBVp+SCxPWXydPXLGQ9QZr2SFIt4EWcipqTn544eCqlM0K1t7nilPWxQ9u9pzrAAuzNGE0FkHcDuYd9+FG2V13Zoij2dMAa8dfJBsvRyi+VjlKH+n/LZtinZAfv/O2lm2sBozLsm6FuljbNc2yzfe1Sq+Nl62EUJT++q3bzqmvek1D6Nry1xek0hQJFHbl60qIasnv0+Ws+EIOw7yDP6p3t+4ChhLMkuorr2mdM8CimJZSfH8b0pNdnkwTOLh1IqN+tp4siQEr2iOPSG/136VuWZu7gxafxgAQA6v/Hx+zIeEnaJg92PDoIT9obT/lYRiNARfd8g+J+HAU7fSGcL1GTVKQcMS21ycpr6UJnCBgW5GQ= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: jX2joO/RmmOqhZMT3laakYoG2hu5aYc6C2UIvGADFLkw6VIXQK3K4LBSiGLUoUyfFa395ZyTRjIfgLB6fPTDe8tHq2XkUIFjsptDEgr5tiCXrz/vExGT1SVb4ZFVWLC7yRInST1YSrHoXuzas31aIi53Ay1Qcvpw5Obe112F+oIoARa6n2STNCzgTZPQqHDWIlfvrj4S8myU2O7YpLTFgKeScFY5ZrnFCyeAP3THcC/Bw8h34Tq+9w/F3qSXqtjJQ0HyixkULWtGvmVS6/kprtOpOf/e0mnkokrakx5SJSJmGZmIbpfjtpRI0gKzK6frvMcqTcqoNTURdnQVTvzk7eqFZZoZ2Gl8CYWAqDe/25G9kLHK+tUUzitbCegcRyDKqcN3WSwiEw3I43b9M/XU+cKHSOqjCtjjkUNtF7FRRpQKRBD7Xk3dCLrOpBRwPKHl385xHGkJb2r3OJlTsoa2UEHjfgrdp6CH47D2uN65ITtnO2nIoB7zTHVpVmax2MZKZhEB//vRoNuXpRbGq/02XiXOKpGJ8wMbWQ18aCi1ugNQvhVAxjRLkRczC48aQ1xZ/dGH9s0KbwxbZNM7Wz/aYtsI7V5NfDde1VMiGEhtdwI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7ea07e3d-e011-4e4a-c005-08dc0c2bcbd3 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2024 07:15:42.3468 (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: Tbp3SAowtX4miAP07ybMbI+rm/4sXZSFyzAd6gkJjy6DVkp0brSts0oHwMpAz5TFJlgNXjthqKg28BBozQmMEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB6777 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-03_02,2024-01-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 bulkscore=0 phishscore=0 suspectscore=0 spamscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401030059 X-Proofpoint-ORIG-GUID: ex_kkjJFpdx36ZbdqR-_jxFMbgqEUqCr X-Proofpoint-GUID: ex_kkjJFpdx36ZbdqR-_jxFMbgqEUqCr 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, RCVD_IN_DNSWL_NONE, 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.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org [No changes since V2] Move the following three defines to the header file, so the SCFI machinery can use them: - tc_cfi_frame_initial_instructions - tc_cfi_startproc - tc_cfi_endproc Although, the symthesized CFI cannot be emitted when CFI_EMIT_target is set, but in future, we may want to allow synthesized CFI to be emitted to all outputs currently supported by GAS for DWARF CFI. gas/ * dw2gencfi.c: Move from ... * dw2gencfi.h: ... to here. --- gas/dw2gencfi.c | 12 ------------ gas/dw2gencfi.h | 12 ++++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c index a69854ddc0c..cdef8d09978 100644 --- a/gas/dw2gencfi.c +++ b/gas/dw2gencfi.c @@ -64,18 +64,6 @@ #define EH_FRAME_ALIGNMENT (bfd_get_arch_size (stdoutput) == 64 ? 3 : 2) #endif -#ifndef tc_cfi_frame_initial_instructions -#define tc_cfi_frame_initial_instructions() ((void)0) -#endif - -#ifndef tc_cfi_startproc -# define tc_cfi_startproc() ((void)0) -#endif - -#ifndef tc_cfi_endproc -# define tc_cfi_endproc(fde) ((void) (fde)) -#endif - #define EH_FRAME_LINKONCE (SUPPORT_FRAME_LINKONCE || compact_eh \ || TARGET_MULTIPLE_EH_FRAME_SECTIONS) diff --git a/gas/dw2gencfi.h b/gas/dw2gencfi.h index aa8693df342..f574826456a 100644 --- a/gas/dw2gencfi.h +++ b/gas/dw2gencfi.h @@ -29,6 +29,18 @@ struct fde_entry; extern const pseudo_typeS cfi_pseudo_table[]; +#ifndef tc_cfi_frame_initial_instructions +#define tc_cfi_frame_initial_instructions() ((void)0) +#endif + +#ifndef tc_cfi_startproc +# define tc_cfi_startproc() ((void)0) +#endif + +#ifndef tc_cfi_endproc +# define tc_cfi_endproc(fde) ((void) (fde)) +#endif + /* cfi_finish() is called at the end of file. It will complain if the last CFI wasn't properly closed by .cfi_endproc. */ extern void cfi_finish (void); From patchwork Wed Jan 3 07:15:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 83209 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 463D43857007 for ; Wed, 3 Jan 2024 07:20:07 +0000 (GMT) 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 A4AEF3858296 for ; Wed, 3 Jan 2024 07:15:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A4AEF3858296 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A4AEF3858296 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266150; cv=pass; b=w8WywgByrXAnNNGeh6ZhBtulhoxRjdYAuCw4FRX/DMPfuHZde12h3dTXu4fXEHZ8EJQmCsLmVMG74x+sFhc+GLetgPjooCCHq78ThX5Wq4V5NGIvKn2hJH3R5u9DqPO2V8H8oRLgX1fL9gVXyrruWTqFo7M+sfFJ7VKKP5E/EAc= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266150; c=relaxed/simple; bh=Cpz2D+5P7yEeeOqWhcEIF8G3Mz++YGe81qGbeUimz/k=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=HlVzY81kUZLVy9L/aMJJ6BqskygKyz5Mz78RqUomruBTAMUeTe8np3JTCianssETDpwF8DcTL0ubS06SVT0G2WiSwcYcNfvbGG3vMru8Aluc4pvPHwpB9sZQYOALWSuaOcFPfUW0Xb8XpnzMTSKwKOXrYSHOVBOdTFvxQpPjbaU= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4030i6ot012314 for ; Wed, 3 Jan 2024 07:15:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=r0YF/ZaWbBD+vmf9puabAPK3aIvdLzYdJQTzztycyN4=; b=SDTVJCjrZxI5f0dyoX5eJ7el6rpxIiXt/B7ApIhmvHWgXaK41mwjWxE1FzcFJ3kP296H 43VLrKiAuVNop4yW9vTbBbWuYDQJmm4aXpcG7CGugw8JA7pV/nWh/y52wTOZbrxdsm2l LwHh+GfXjJ3UzahGX5LRvxR2tieRci0FtSpeNt3WgDXHXUXCV3Y5Uxx5WXw5jDIJ1/kd v3VN0Dvl8CvZKX/ZzKju6g0CqDoPbLQ2ND8uHmwip/PPqJmL/DLBfHO0VDiXzEJucVtu iUQQbtiXdWY5we2nHn3ick0ofV7AjqFsXTJZcPaYSRBkY45zugfSRBUSc2cNrdUqCNdL RA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vab8d4ec1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:15:47 +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 4036qiuv033552 for ; Wed, 3 Jan 2024 07:15:46 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2041.outbound.protection.outlook.com [104.47.51.41]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3va9n8qaaq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:15:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BxSBl98L0mM5gkByycEOfVNyDMMEl9FZxR5cl595LXpHQX13M7J70swBDoaQ/fB2FRGqG7wcAL/OOGE3gnfassLKiCIPUNT3ZoKJss4ETBEWOWv0yhFzbVAf9rIRH9nKLASjaolkHIVUQIXU9O9WN9AAKJeUVrkhISJPTYYVgVaf9UkxSB0pDoB/v3UHBnrN49RZcCyc4UwAjPUEtZC7hBmLyiJJ67u6TZDDgzrptv0qigUUpjWWZdF6mSR1UcXQG1uSlsh6FNYZnj/FopwE+oU8GqcpDDEQKpxZuivGW6wBKSX+D91QwZxFrNq0OoTz/CqTwptDmtZg/7VbMzDHHw== 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=r0YF/ZaWbBD+vmf9puabAPK3aIvdLzYdJQTzztycyN4=; b=RGZ4iI0ZYx7AbxXbk4qv0HPwey1X+3a6QbbkvNcdekN7UUycKfFIwg4uPIlKD051z8yemxUC90YLq6iHmibxYVDeCsiOAmBASojCgK7BXtKQBF2shq9NaDg5+khBteOpgWIrz0dYa0X1TPtATjSSOixRzkkgUMrs4jEGWA+gGwUTpDmGhII0j4Dbm1K/2IZ1khiURrrjfLbU7fpyEkTtgzyqZX+RZ+VZg4XpFYlJbzVOkDdFMHti+mW4XQB7Xpyshplgdhqz1JQpeTx/37LhKtGGO2CqiO/WkpFdCwqppd5OswC9263NNqITevbfYd6fbkGpCwy7+qoz9QVktCcqVQ== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r0YF/ZaWbBD+vmf9puabAPK3aIvdLzYdJQTzztycyN4=; b=Epnvqfpq5Grrni0Qdh0L7CupyR4/+M4erT+y0qGHA51e/+GKsALyFj7KL/eOScsskS7bAsY0RzS0vhX8JZcAms2bSrD+Ty52QSYA6ld77kIl3Mko8/F4YGgnvkbyFXNNB/72gp3lu9neQ/gOk/9Zcc6c5uGGsRu3gdpTX2F5pdY= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by CY8PR10MB6777.namprd10.prod.outlook.com (2603:10b6:930:98::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.25; Wed, 3 Jan 2024 07:15:44 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac%4]) with mapi id 15.20.7159.013; Wed, 3 Jan 2024 07:15:44 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH, V4 05/14] gas: dw2gencfi: expose dot_cfi_sections for scfidw2gen Date: Tue, 2 Jan 2024 23:15:17 -0800 Message-ID: <20240103071526.3846985-6-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240103071526.3846985-1-indu.bhagat@oracle.com> References: <20240103071526.3846985-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR03CA0091.namprd03.prod.outlook.com (2603:10b6:303:b7::6) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|CY8PR10MB6777:EE_ X-MS-Office365-Filtering-Correlation-Id: 6a957d11-8517-4a2d-3d6e-08dc0c2bccd5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JYAZKELYhyBF4w1xIuF3MWum0GsxEhpYTjNQyVYwjPR3F1KjOvY+ZPo/VNhCwCKziwwulWnGha0dM+Dp7wIu3CTWwqQJk4uvOCbourLMv4l/XEJXfINB40iXkWn8uMsFM65kmTE3WwImEhh6cspu+JNI5gwCF09Hf2/LLW295lJHF668T/deB95NoMHC+jazo9F5wOvDg5jlLdqrb7zEmKL+Y1uRzqVqx5qPogOaSSBqCNsIJubEvFv5zIOECxioFnUBmIOXlTeEHkqVjkEJRexnyYEH7PNVwHnQOo3qpkrEusioMHycHgIk9Wv0wvvQCUidMgkTgOv+ZYISIPNcBnGGXNWiUIgIUQhatq1oDPxOVothBC36ntFV2tcUjD4ipkZXpzqp1GD4x/AKg2+cnoeY7AfsLbqrOW3JrbkUjoMbqOdZRIyEs9FLbeJuMgbkAJLh+r02YM6mn05g9yk5pwznlwGmyS4JADtQjthxCc6A6ZjU19FuJ/iPvUjj2YTRJIWQf/rQpq77koJUprW8Q7qRcAcC+b68PcU8CFa4rJYMw4xovL+8cECPRjFnE6h0mmLllfJLAErObTVR58VMohJrlflu0smWkGEURyRdb7GAUrtA7x2IVaH8xDQ+B79f 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:(13230031)(366004)(346002)(396003)(136003)(39860400002)(376002)(230922051799003)(230173577357003)(230273577357003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(36756003)(86362001)(107886003)(1076003)(2616005)(6506007)(6512007)(6666004)(4326008)(478600001)(6486002)(8936002)(8676002)(316002)(66476007)(83380400001)(66556008)(66946007)(6916009)(41300700001)(2906002)(44832011)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WyZEqRPgQPMBvNcEq5tqMAxfei9REPptq+YlB4/Ep/FPwfF5UlkPk54zA6EnZ7Jd0GMqOX7k5OZhxH7mTRZLO5FO9TaOp/nSG1YQjhbZYSmE+VbnvRUYdgPveANjK33eqcUgR49mc5JIveL2mD9Qcw6uf6sbO17DshfGiYfQk3BD160DgdKkAh6F9dafghg1zuyXLEQdDrMZlB9GQL+jEqkV5DQlIPfDwOi1W7yBR3VyD66eMGd6Hwx9K1X4EIPYL0Asj0blIc/6FpwnJDdYeHwWIzWSbXf2/AAPzR9NDVCPMjDxBziBSh8d+kJDG1cEdjt7DfxCGK50mAZOUpSax3WjFOwSUDo7jlTCy80tEi2FRpNYSQ9Tym7DP8QitU51IYUNXAtxJVyT8DoKbY215158vCKfBekjqST2FPHPUP9DGATqqSnRBP5YK0AtGB+a7OT2iLIhqVRJvrt56pMgdYhr+pvVEChyaPfHH9W3lUdYDhBtApNTUlJKtWtgG2IndIoSy9+R3NGCIULD7yIqDV7DP6D7iGfjvyRhYm+AMQmglMbpnSgvpHNBVZVfy/O+Uaf00ITTArMEcG8NKIK0vVEkHbb5NYNDsq9lDBeeEI73JB7XenY+tP2AhfkwsBAYXQwiPxJsjVopRdZxba3E/tUg7hMjIipvJbo+ihMU+8ec0FyLaWzGs0ePBihEtLZllOdMinEpkDOtB9AlrHYwQdSJ5uVLXxUVVSFQT2kwA2vwDl7tjP3FVUBP42CvbrcmF6C/HrE/cJ/LPpjt2piGcRtDnICx4LRSZepz0dHjjgbo25mIA9C9VGG8yG9XbxZmI6IvZH1GfjbUNugo/m1g727UK62pE7mIJ9BHyIFW6rG+40PQ+pdTjV6HANaOZrwd6f4IJ5HrGjqro+bV4b3hDxDqNb+a62FIbPdSQbJCYflQ26ltNr7Jk5t+lyMzuk9xLlU6z1vHSobNRZKFFoWRxLQMJyObPZ0rRxLb1dkYYxvsUAvZxa2dycZwwfc5iig34BjcjWUYgFXzPmI83rsu5ACDwMr1uucE2PSTtaQu5rOZ3iri6yHAex9jW81Qw4CPzrKeurJb2LyX+xD/2miE6xi1felCPATYCWrJ2J5gSIxjA3edd8eT4ZwlfRGmpT1vidOjFabRspeBbUoFF3NAKLRu6fjraLqyz9DlzoKLEJUvHIW+IbgjDOz6izXyv43CQ238kLSIW1ulGNAqgaPJ4x9hTGXTYthd90xEG34KVm7tkELhDleRvJpvBy+pEZml7ymhQSWK6dO5uxifO09zn0m4eeheDAyOn+qV/aBbwO1KQ3UDeAWZlD4qegMjJfSs2lrh0TTS8dWoNCCzPl1KU9TSJs3Nu1Ew9LWRo5UYs5XgZKuVcIz134JsxVENUeBYY7vwUAFCiYXUFlsRAFyHvLWCQDpuanU0MvRzZPEYW30TIimkPxF8A7/Q+01bHTkQ5XMEO7sT+V+1OQq5IPV0n41E7kHMaomI03TKZu8gJbix57xSh4JKe0CFIr/z6yNkVxPInin90akccK4Yr3mn49E5FrZ0WWCX+qXIXcDwCiQDgRjWqVB2g53nKlqKOBFa1RTJAeVcaO2oBHDvEJhBLnGtMlOKeBaIsuhHQj5L+c8= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: cJAifdHjJXfifMwOK0Zpa+vZPMfUBzy+qu3yq7tzdSEhVx865B9gN+wfBd1jS44290Tsv4dfgjpkTepNmmkDpjCEfgWG2o7SLfI3Jm6dgBmtXYJtgDnx9le5uugEZhjea1vtz8Ecihhhnz7JjBeAI2NL0YxnWdEY/UXCoMHnlDKHiIs4rU+wmw8JVGH10cXNUYYh3LBN/zXT4EZV2nK8opMZMis6vNT4E0zufffsifEZOJ0CElBvgFzIe9Jx5gNrGvGuOtQglwXSfFDQS7lBg/FUQpe9nlf5fghU6CzAZ4eotFHJIsuzLAlORoVZJyu+W7o3PWOIeIx5x/7ZXhLgyKWI4CaIiDQsbd06FC2MFMpIDOiLjNzZP+lQVj93ydvMknSYt4X7gQ188HbGXpkBeWIESNbQxmXy7o3GXyAO0UNZCIcVKCTjc9YME12YALudrDZIGCEDyVJ++BdRiqLaVLTp+DVwaqSWF/rCvRrcgqY281FQCpb7od4B8Qxlbrzjxfjq3Fyxl998bxar4ilHWcEJJqoSboXXiDkAEav1/4Ia85kAmHA3NjFNeAMwJ+Ei+ldRja0aAy/hZisBrMC3W6ng9FWPjmztb5mu0wIn2oE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6a957d11-8517-4a2d-3d6e-08dc0c2bccd5 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2024 07:15:44.0427 (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: DcDbWia86bbv1rNee4oVTlxXnouppIpJ+f3pWWYQtvgPCQ3+YKPoSsxwcHzs4Ktp5GA1SQSk6W+dKPQyZTMLig== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB6777 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-03_02,2024-01-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 mlxscore=0 malwarescore=0 phishscore=0 adultscore=0 suspectscore=0 mlxlogscore=771 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401030059 X-Proofpoint-GUID: Rkbi1-Shhh4Pl_N_Qzf_VDcJ_vxL9hCS X-Proofpoint-ORIG-GUID: Rkbi1-Shhh4Pl_N_Qzf_VDcJ_vxL9hCS 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, RCVD_IN_DNSWL_NONE, 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.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org [No changes from V3 to V4] [New patch in V3] scfidw2gen will use this for processing the .cfi_sections directive. gas/ * dw2gencfi.c (dot_cfi_sections): Not static anymore. * dw2gencfi.h (dot_cfi_sections): Mark as extern. --- gas/dw2gencfi.c | 3 +-- gas/dw2gencfi.h | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c index cdef8d09978..284691cd4c8 100644 --- a/gas/dw2gencfi.c +++ b/gas/dw2gencfi.c @@ -687,7 +687,6 @@ cfi_add_CFA_restore_state (void) static void dot_cfi (int); static void dot_cfi_escape (int); -static void dot_cfi_sections (int); static void dot_cfi_startproc (int); static void dot_cfi_endproc (int); static void dot_cfi_fde_data (int); @@ -1206,7 +1205,7 @@ dot_cfi_label (int ignored ATTRIBUTE_UNUSED) demand_empty_rest_of_line (); } -static void +void dot_cfi_sections (int ignored ATTRIBUTE_UNUSED) { int sections = 0; diff --git a/gas/dw2gencfi.h b/gas/dw2gencfi.h index f574826456a..9e29b55ace3 100644 --- a/gas/dw2gencfi.h +++ b/gas/dw2gencfi.h @@ -41,6 +41,10 @@ extern const pseudo_typeS cfi_pseudo_table[]; # define tc_cfi_endproc(fde) ((void) (fde)) #endif +/* Parse CFI assembler directive .cfi_sections. This is an external function + because SCFI functionality also uses the same implementation. */ +extern void dot_cfi_sections (int); + /* cfi_finish() is called at the end of file. It will complain if the last CFI wasn't properly closed by .cfi_endproc. */ extern void cfi_finish (void); From patchwork Wed Jan 3 07:15:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 83215 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 51022385C6E5 for ; Wed, 3 Jan 2024 07:21:10 +0000 (GMT) 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 173AC3858286 for ; Wed, 3 Jan 2024 07:15:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 173AC3858286 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 173AC3858286 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266150; cv=pass; b=qnLxf1VTYJDB+rDbBH7Uk6gVPmRU3Wkzsm56trTrSXttWHlA5TAve6xFBK9Ci8555uxdz7orblMibthT/1PKuP7UjUSHSD1Z7o0YuaaABggUzeRp27r6OlzTcOeppmvPXyGgrIEYWp/wByHoAd8A86aoDZy9jkltt+YZNJDLWlo= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266150; c=relaxed/simple; bh=FK22tCBjFBTImGt+UlKKhGjCwqVKezqbahRtEK5v4hg=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=mrzjWjmpgS3yfQ6ZNcQLmrFzAfmzDbn57BfqCHZUKOwtmxsfjTfPx+Pmqi2uvcRfW+70w+BokggpUc7EKsua1/p3ovU//WUtr7DiiqicimPSNbfLcqaAwWz2qhrMOdyioMqH0EMpCLolhfMbUq5hSah5X9WQD4t+fmdo4wkBtzc= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4030i0t5012195 for ; Wed, 3 Jan 2024 07:15:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=i9dLUbR7jzggOgOQJsE6w2qeHu0AfltdXe4QsopWuJU=; b=on1jU4OmVYd8YtKSHyisVcEXZF++Wac6H3tUxnn4smBFGNsdn5elDWK6dE+rvCb2K/64 FUY9qnLEa+ccz+eW9R6SyMa/+poL5ulhY1d59vz6ner4JDs0mRyCkOHlmFrUb7u+PcN7 uTkPz17n70Dzsk7aFVeMqgOIsHgZKwlKqhBGZHy9JCBH7tuYLhM6cTDjMPwa5f5VZsDt 3JbaBUCn1VtWDO/yX5LnzjmZNaj20SIJow8hTWFPjlsyJQ+FU4Pf0rDV7aH6swg+wIhQ G0xf5r3LYZm1B21+9J7kWyBPkr3gY46DhxpYRU/bt2KBEtbIamNTeG3T38o5kMTsOrql yg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vab8d4ec4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:15:47 +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 4036avj5001795 for ; Wed, 3 Jan 2024 07:15:47 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2040.outbound.protection.outlook.com [104.47.51.40]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3va9n8pnxd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:15:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eKxitbQBsbfEVTrUBdAt7nNzGcwdDsE4HaB6dDlg0iV4ToIebunjf0TFFn/TmyVhPL1ZZ1hy1oFlpCX0cieCwSH+UZGEifEq3gAsB6qV4P9+4LawyTe6vBn4ks06FBUBJjMhCp5qHfdmZDq6cYwLkfTd1Ix9eaoLFgXWJNuyutzq9xNhjmhaykoDyqOYoqB5PP8thH1DW6cFpJqqURcQHPULFl7vJGKI+3rVWUk5V+dL4JUHb3DdiO6GoqFJuHpL2LPbwxIQojij9PrXCe8JpsdI6wihF2KirPpK5htuB1pGOYm32LNxSCvpLv9RktBFn9ebOLQC4KfVL/3uAwbCTw== 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=i9dLUbR7jzggOgOQJsE6w2qeHu0AfltdXe4QsopWuJU=; b=RmT3YWrkoCbnNcH1FZnODz/f1y2qM4Qyo4ke4cMEQZSeDca8J/Ziid4YSEDih2MJUiTLpT+cCrXiiXJYUnVSbUgLNjpdwRObUS4EF0o3xjwt17WnY4NPynoMBQy/9/yiHPMg0XLBFBpA74CX3N2+FTC3VRiYBL37khPfMesdXJftpTPq/kt1fO8tVZL5ysN045e+OaDj+VGcdh/C4VA9tXZam8ckemOJ18Ty1lELXIrssh64GfJO+AU4Vf48OoHYZF5zTe4FTbWUb9UMbjy8VO4nlbK5v0AIYO/FQN//9C3gdI+zXmBpTPXCyoGg/djZQ6y03W2/ELqivgL+0vUC9A== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i9dLUbR7jzggOgOQJsE6w2qeHu0AfltdXe4QsopWuJU=; b=XACMHNCjT6xSb8TvNx0KTwgkv/WqhIlEWGpOo42KUffoj6ygGbya57MUE735gFzfPWipwsRchlnrkKMazHbqkXoIy7qTITRyGC+rAXt81bjw+Evb7kYbv57X4enAPHxnskqZG5ZZl5l3pzJQNbGjQScRITlugYzHQtBI8KAzgIs= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by CY8PR10MB6777.namprd10.prod.outlook.com (2603:10b6:930:98::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.25; Wed, 3 Jan 2024 07:15:45 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac%4]) with mapi id 15.20.7159.013; Wed, 3 Jan 2024 07:15:45 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH,V4 06/14] gas: dw2gencfi: externalize the all_cfi_sections Date: Tue, 2 Jan 2024 23:15:18 -0800 Message-ID: <20240103071526.3846985-7-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240103071526.3846985-1-indu.bhagat@oracle.com> References: <20240103071526.3846985-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR04CA0079.namprd04.prod.outlook.com (2603:10b6:303:6b::24) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|CY8PR10MB6777:EE_ X-MS-Office365-Filtering-Correlation-Id: 797668da-c4ad-4ed3-bb0a-08dc0c2bcdd6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /a7Aor5LZ6A2fteXjB7bYfK2C30gDjysSgvU3wmwAgyPNSyfeBW3aHhX/MCAadI4Vn+4gKtTiiZmdxzJEp37E7H08UPnSrc6AgaEAGMGso6jLl82ABTyMbsylg3T1xibRVu+VOEXmMsPDJYYZ6zf3x//IF83XLqJJlG8yWM7CsAVgo6cZO/91q4EMHjlXAZ7wRqPnk9ypPclepLCJ4tbZR98Fa0WaBl41DaJicl5pLxT2w7fLQbjgZJELqEsyWfIifL5FMhIrm/Mykv5G0/63rnH15aoOYsgc2D1EoM2e+XrggqwBfQW/sYhO/GW0FwmqwBRGf0TmT9gvuHpbCL3srGP525xTYr5AxiZwJLam+BV85DlykP8693aeGiNwi6tmXm0MlPXR5tGvLF5jVYmHS+bu5Bx1TzSsLiFynp14IbnNYme7gTkJYTiPdzghGRyvGAgCl4EIyGoNeH9qUAmEw13csaMVRikHn+4nirdoZU05Xu1D4Gq4r4nPghXfGIPTiPr3oWg9yN5CHt83K8FjUhNF+skMeIwahRUYravoPH0q5s2D63tnYbBwnUGzxiu 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:(13230031)(366004)(346002)(396003)(136003)(39860400002)(376002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(36756003)(86362001)(107886003)(1076003)(2616005)(6506007)(6512007)(6666004)(4326008)(478600001)(6486002)(8936002)(8676002)(316002)(66476007)(66556008)(66946007)(6916009)(41300700001)(2906002)(44832011)(4744005)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yVK5lv3DHwvi/gcbVT1Dxrf5KdkiVMUec9OUbAfTORCvT5f/e+RTv8SzBFCZ2rRLGRSO3dKBC1cBmxeYlgnQR1KSjy51+ruINMU/mL06K41GWA8Vdv7TYOW5gGoQUoxvfMc9JVnpAEkPDeJpFT2nZ/ZquGjOLedkjUrQK5ImvVAR5+J5fbF39RlTCzWrbypoJrncfNaMLI1o7yCqovgNvVEaksEJYD3ZleIBb75HPoKK3qqFgZ3hvatuXhhv1QIE2knexBUFMbjCD+mw6L2zATOscR1Rm7hIjiLT8D3chdC5z9ugr1aqkSFzrgZPacypxwyqK3xD77BeqOxCrQ+SCbXASsajPEwuCd4TmP3UTqkJy6LVT/OfUYoPOe5Q4KSkjoEM2GWDvvjpQQNRyigJGmo/cg2oI1e9xRHLrC7kdp41WsawRCfZ7v3i890Jhht92iL5mCGzrKTJ2BMewymtPUl9yubWaHIrHxb8JXD+XUcVY7IB0nzKBSxewuf5B2zERMKUGoIqsLk944tRnf5sYHOYFk99ou0CNwnvJ+k5AhoyCtCaRUi7eUgYe7NDTTfnl8y2JEyvK9obSwYVcsxRiUYOLQXt1sYmJOsNRqB7aw98f/RIPvXMfjEbeWLyAxSYOchiSSr4BEZdgQxLcoD1v94p104XHU2wdU7LB0HOeMN7v8W8hfPgszlOEbilAfV4mXty2c0h/blYOIxkw5fQzUSbTxUWDiX5Klz0HCNLhsqKd8Xuf4pjI5JKXWoiYfAYwpqU4L6QQ9om9uUGFzPoUrSArgNGJIXTqU0R/UN9LIATmP1PIWK49reTH5dpkTv076OGXJ9qgSVM8zob6oY6tRgFFBd0txtTEBjTl4g0GGbt9rYBscGYp5q7AL2OFxMI1NSM2AwNNtybgmJIfDjk9oCSrKxLzZ+6EwSdlYwiPf2xiy0Y+etx9Du1Q14c6w3ye9hSHrUMlGITcXL5x5oIbnmr0kZeEEV4cRxonUTP/2SeJQUV+WxvmnKUZBpeRi6DIs8x/q+ZFJ0HxM2dXDpzYKa61s3ClnjWSuhPOCIzwqennO7O5NjUngLjxXi1hJC6mdcWWzDzPVVyTjuzycYshW3G5g3TvRdfJZiDfikxl2YNmA2bi7N8tO3N0Qo1CwL1wd3KW3PfQfoi94Epb3cGg+uEUH3GPJCqmODkXuKfHHIqKnKFIQgAgXIoa3lFf1O+m9z8gbLBb5bN20w9DBCIH1SCqcOYIHdmR0QG15u5Huv02wUx+VVZAOAhLGGdc7wX/M5z6cZFzSsYVmMsnGzzT3pH9iMii67o1YbGLj29dzrqNHYmZ87C7PowXuP22V1yZzcud/6Y49E09xhVQ0qlAEQus/t3nCUshJCZTxHcGWVRkRp/fNHuHwrqGvCMb60w46C2HQ4Po2XeGQPyAUG8grED+TveMCoq6aXMbgjgd+vi+J1Hxq1Kw4prJRfvmcAABvH2o/8s4nOi5uE2ZBTMKwp3u0goQyK3X9x8gTmefKdAPMjapKI8exWvCwuSuZ5DQDSuLmiS+z0nHyjIrtUfkonw4JP0/WkcUDPG8etzTKwvjLFDxB1+owiJRaPNNuZG+imMYduCH+8y3UJx5oj8hmt97fYaNQuw8inZCisIvno= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: tekNTFa+sPw6X+m+9d3NpKOlD3XrfL51NuGqWgvx6JKMvA5jmWaIV3mq6P9vVklE5fw5ihcjvuo3yZvlPu7HDo2suRmXtb5fMEwklUcCp5bgL5+DS0pdA6wQp2SmZ61XQ/DJqJdhD5uPb2Xx4Ixr/vQJMXbXlfXmut6eRKUIK37AS2ptjCH/9RWkB5vuYYy1eUna+y9UdTB6PjffzuQzFiOS/GytGLCKcBT6hJKY2a0X3I60BFa0N+dO6KIyqM9VeGjZ8UyRqaajZ+TlNdpaBHmZ7s9Lirs8FP0saFs4jKYOtC4aySxbgBCdyHX23VAIXvMlqJ0kfeyimgmLZt//J6Ceb7KBfjGLHa9YLGV5ApfxbeHFGO3ks309XO2HjwVZnH9+AD67hL6ZdTYTTIfcQFg3EjkYKOqvosSFpDTjGCMA5Oz3AaroaJzkJMHaBJ1jCl1RmzuNHbRt/4aUzaqDGHbXBOCB0yAblAqgcTZFU3zH4abnke7td7tLSsyucjnQbXKabnpGdiJBGAG6GDzFxqXHDGbnglUzINzGL3OfvEaBRKHrM2x2SXaCMwQyqq8KkKOqw7DDjRwfr6u9VlIpIwhKCbuXWLqJO3g7zCw1Oxo= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 797668da-c4ad-4ed3-bb0a-08dc0c2bcdd6 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2024 07:15:45.7304 (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: P/iZxVFDe9l8oyBnof8zya4ebj14mUiEXRIuLZNhV0lhyKyTisQl3Fdz+DboADj3tIMRW5ZtMA2O32wis2jaeA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB6777 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-03_02,2024-01-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 malwarescore=0 adultscore=0 suspectscore=0 mlxscore=0 phishscore=0 mlxlogscore=909 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401030059 X-Proofpoint-GUID: 1HfOElc8YUq1eBYEw-CMPaWfzHzbz6zE X-Proofpoint-ORIG-GUID: 1HfOElc8YUq1eBYEw-CMPaWfzHzbz6zE 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, RCVD_IN_DNSWL_NONE, 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.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org [No changes from V3 to V4] [New patch in V3] gas/ * dw2gencfi.h: Declare all_cfi_sections as extern. --- gas/dw2gencfi.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gas/dw2gencfi.h b/gas/dw2gencfi.h index 9e29b55ace3..ccf5e3dfc02 100644 --- a/gas/dw2gencfi.h +++ b/gas/dw2gencfi.h @@ -27,6 +27,8 @@ struct symbol; struct fde_entry; +extern int all_cfi_sections; + extern const pseudo_typeS cfi_pseudo_table[]; #ifndef tc_cfi_frame_initial_instructions From patchwork Wed Jan 3 07:15:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 83203 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2AF7D3857C46 for ; Wed, 3 Jan 2024 07:17:28 +0000 (GMT) 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 D0BAF3858006 for ; Wed, 3 Jan 2024 07:15:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D0BAF3858006 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D0BAF3858006 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266153; cv=pass; b=KUXoz4P6a9tlqNr6KrF/Pf6tld0wesweGpXfdLcj5nOWYLqg6+ts3mXATx7vTgIVbc1jyaw5/XKAGIDSP9X/yiIaSLQvEs1Y5p+tfkDM7raitehyWmjefWQiKhSyuIVQaRCZCG1MOOW/+6CNY+B7vXM/rkjTYA7z8ayn98OhyBs= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266153; c=relaxed/simple; bh=/T3Y5HMlCZF45fVKtBvP/w/0wimTBNz/37tdoJ8gUoQ=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=JbHJawlD9illjSL+jH/LGpMCUh6zv56WEh3nPzzz+1vr2W1RvtobPwWrlAbAlXPrSPOqsfGiCZ4m0Qv074D08WkNBu/ZrPYRBRKu+65HYlhe+X5cb6wlC00UIjBcFeGbUrat9eeUhnFasaXzOm4vHWeHltfQd/OFN/WcOWq7+xI= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4030i14a012290 for ; Wed, 3 Jan 2024 07:15:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=N9rATEDwiW7PLmo7lK0Iw09UwP8rbsmIZdZEKf53Cxo=; b=dokgJREjWrwMhaQx1Yi3K3laHnmfXUWdvbNHrcu144/MB9rxyw8brDRfjD9a3CtVRJzI qdcfSGyNe77K8sj5n/Zm5VbIuRfmgQCsp5b3++BrLq1xdAVAVtzs6ILkpikEcwAFf2a1 Is3fLcPRQRS4gcelaQiMNf2C8xTtvj2oJ6p0fuxVfhmJfjpXEC+VprxAHbaIXr7iULuN kFb77gYpKBtoQA3uUbooVmL6BpWv7UIxiuLg6hme/vIK8URVMeFq0pTDOzN6lrD0XD3w iCzRl0vWtRHzvBuLNq281TxqFrOk0DMbp71+wlPOND4Ouz59HSwXt10B2mEvHdnrsDxy OQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vab8d4ec6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:15:50 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 4035pVuW035913 for ; Wed, 3 Jan 2024 07:15:49 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2041.outbound.protection.outlook.com [104.47.57.41]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3va9n8xdsn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:15:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kj0sL4uIcXnA6jHqfo+3v6OS04tf8Y6yxmDEbgZcxEVNvDlLr9LWaYgp9deMDx3jIckK9ofPMNHxBTHVVER+isb0kvtOgaRygvPKm8z/ur6HHy4TwE/ZCiwIFNxafSPlM2I8S1Hi2EDiNxKBcRTGXAKNvKX4Yme+OkTbghEEj1t+JyuhLOQG+iOGUP6cBhXgheedrWFdHSM3p+owf/QFYYupzfM61UALWizwJxMtfGyUrzTeVlxuqJuoS0TJV3SS4xmrGcACB0wTxNNIug82Jx3TWg8/XC9lvATkpEb2j86bvobhLp6PLAFzSs3GvcI2EJSDRRlH3FiEBx2AALYdcw== 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=N9rATEDwiW7PLmo7lK0Iw09UwP8rbsmIZdZEKf53Cxo=; b=GSpXwOk4jZN9NxTbDoMmDpPplBnLCTDexf9yVUilYGDl2pGCHQgAFU5KRvcd00ecAE3I4fDbWZRU0gezl89UO7A6yJDPX0XwaC7wdKK+J/IvXfk2xhQHZJiM+nIcnjIJBqNRyvsSjlybNOfGNXyjevXq5v+Px4wxrR/tm7tSiGFeQKUxtpQJjwXZQ/bZYkH3fFZdGptQY94qTxQP1y1h6l9WcZIbIMIk4QmEnNIemUtu/47d5THxSeNIjvlIIrC8mYByHbeRrnx7VUT4k5DCt5eroh73UWbZK+TarBCl82QfVCoFcPY+kNQWdO/nrUs8OFg6BqZr5Mz56cGAt8l9Rw== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N9rATEDwiW7PLmo7lK0Iw09UwP8rbsmIZdZEKf53Cxo=; b=KYMVK7QK/ebkohh/FQGspwpqBMGlYu76YHow0XMS/81i1zr0/rokJqUUepCu8/N1oEvOMhMDtU0gadt34SlBoWuQyRWp94O9C0iwk1mfBULd7l391fCR1Ls+c9c3UxdbMIozsJCWrs77sEiAmS60Me4nopjzt60+LeelPCMRyLQ= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by CY8PR10MB6777.namprd10.prod.outlook.com (2603:10b6:930:98::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.25; Wed, 3 Jan 2024 07:15:47 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac%4]) with mapi id 15.20.7159.013; Wed, 3 Jan 2024 07:15:47 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH,V4 07/14] gas: add new command line option --scfi[=all,none] Date: Tue, 2 Jan 2024 23:15:19 -0800 Message-ID: <20240103071526.3846985-8-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240103071526.3846985-1-indu.bhagat@oracle.com> References: <20240103071526.3846985-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR04CA0230.namprd04.prod.outlook.com (2603:10b6:303:87::25) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|CY8PR10MB6777:EE_ X-MS-Office365-Filtering-Correlation-Id: dd5a211b-7851-425f-4c80-08dc0c2bcecc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /Sz+vowybpp3mYR8MIPqMOoc4Av0d1cLRJMEeLWOuh8ERhO04EtmURXh9POhSvczvHvh5QOTxgC8VLrumA2vyfdNhYHM1LbDWly6PpEsXR+0r0ef64nBT8VmeoHOBNtvweEcFrm/mKif6pnVjnSwbiWS2U0HqbU/am0XrFpX5sh/hNbh7hpCbhmw7s0XcsS6S2/aeOVoBjbL53wzHA6jE01gH825gsyvkIsAK+5UZ2/HIkcAdv52s4PoQJIBohGC9z/mFvIuJe8Ra8AfboWptsK8S20GZuHR9g2fW+aGZqcsMhn2mq5Nn0AsZuxG73hGk3aKYgcH/perchN0NIAo0VE5CsY6s4tzV+nTiJW7wTvvny/UF2LYnP67ZI+F5M7dqfld2pv/N8lQ4KRIIElSZL7f5TjR74Ryrv/epH+6kvcZoMCCHKj6bPT5nbiEfjXd1dmsWto+fsVGw90kDIT5pSfFbmKEy69rDTAQy3ar9iTYl1eCWUK8hEU6DRm1DKXH1xXwDhT7ra/CNWnXSbIlFiPkZAzZla/FJerFgQrJZXDPxzK0be1jG70hoejuGBbOigvW2zPlaal+vMcmLQMcVzYZIy1s/vFWPGJIQraBsgtDLaEPvY2wYz87BQOKya25 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:(13230031)(366004)(346002)(396003)(136003)(39860400002)(376002)(230922051799003)(230173577357003)(230273577357003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(36756003)(86362001)(107886003)(1076003)(2616005)(6506007)(6512007)(6666004)(4326008)(478600001)(6486002)(8936002)(8676002)(316002)(66899024)(66476007)(83380400001)(66556008)(66946007)(6916009)(41300700001)(2906002)(44832011)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lqGHoLO0hce/CGQqIgYqh10N3daKBQ6j6IWWPzZn7F16vPZ4yvrAiy6eMt4xlQoKJNu53dgA+ykZzwiSx3bDd5u7oGkiBPj1PvDvmy1KqAJAo4p7ykliHGxzSwBz+mhbAnBcTBniymOwhVjL30uTFJmcCdllzE1bIVqdwOrEc030nRj3kXA3aPEcFXMAPIual56535pWMFYkO3kYNKWudoAnbE05NwHqolBlcCWcE1ohNK7/vj/Tkd54hrKMFIQFvjm4Ckff5NnIqXVpCl5/aMIjE47YCFhh1LFR7rAqyb1IJAVls2OzmFc/Btw91+4N78DyHUIHpxdfP9cXRgl9VV/58K7QWHSlBJSX2celf1f5Q13wracqAKhJAbta6PjX/Fz7HpIl2gAOzawsT1K57Y0Gshlz+lhH5jDZGXbjHmyLsdrYzgWxkKQbFXnLjHk6FB6+Fs18zqDKol3wZFIzmtb/MWB9z+lT2ZjzNGuMBy9Rr6tz9H9kkUtalxtIAw1VhsZunp23MRWwXQqCt9C0dQGhUN5nENlD0daLI/8upcuyY/QYw+ZhbB9c1MyD6SRXtxkOIVqtIjw0wZ6XsNTaDLQL86C2DYgptrsxXTSuWw4PEalEsd9Rfvr/CCPIUMYJiaNpt4B4CXLLMvJjb8c6j/v1EApZeUKPmWfwQ3158vNENDTon4EGUo9/vqlBqbtmJjR6WQhQxSfpmbHKV1dSjbFkbddTF4rvtrvcfStgg8XA6eWNFSSliMqSjpVZRHtRYeglPgUTMjv059ACuLhuPcpRGQif2woAiJVsaK1Yh5oMlm5yWUf8j/F5xb/xjHBaxAqpUQNFqwNGSydpI5ZjdT1zu538iAVh4lurpdMIkXOBobBKpEkIlNvMKdu+plyeZr/cyHJw82Nvsia3gc5OLrSIPNxhaVvOEqGALGZ95EclgQneMg0WrlJTXlrxPMjdtxM4Jk4VS9VwpaVhP2v1/kDon91yRvL3wd35DfGHLDiRFXWt8DTtdgFP8mV9R7qcJIjLt3XxCNtpasizDvlJKaWKcHyOKqZt8a3D2tD7tPo4SQ0me4d/DwEkC33ZIxEXEbAvhynJAIRT95FofnCo38DTIiPZWcnHFXIUCb5oE9QF+munHy9YCrnSGqdXIOneodKwoEdtNxTJT9HeP0qz49Tnu7xju3mIyUZtXEwiQiWgvcduudBzYwYjDp1Umx+UDu3u0dbshTqNomGBAdy1sQa6/iXLx3yjBv7vFd++KkQKFrSuWFcCZKTe6JQ+FF0tr5QOAysgD9X7JKNJpWML2YpC5Szp65/j0vIKEDp+WHL/JoZVAaqh0fbM+DrNB6hiOnmLo1HMPiqyM/88fk0xvKC8qNnoN5pIifQpE2E7OeYjEoygvVrsz9IKut3StFzbrR3f0lngSlfyck1GUL2YysKqB/ljAIOH3blH4jF72I0b/JDoxosGCR84Tvv4uJIsXBlbMNT7Vdq5A03RFVHiX2ZTsG5GqHRdXmmORcMypgW2RnqGJTaKCe7BeBSeF8U4jS9zCLdC9l7olYbNGrkWo5hcv74znLO/GWtbmzA7AnJgvkYySFipZnZJpj0HHkFp75lNE51ZXeC1xdBLgJEGl+ERuzxJ40WYwZDLWpatiw8= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: xpy0Td08Mzr0lcxpQxYe4liT8t8NVbks/V5+KFbjgNJklNkXbo3YUj1g+/04KqtwZ/Jj+Z4rl6SkTh8gq6cL+PXY6GJnqRL6N38pXMqeW+0EqGY7oPwj6YdquNf13BowUfIe78rFHBwsuDb2LcNh9OFztLPv0dztCXIgMAJY2faiYTnuvrh79Iow352trSsA1REzHVaIpSt8S2pJldhVvp4m1WqYQtSO2oIGjGKkBeTS1GBZIxCtiGZCo5Jg6vTEDzofWeebRzEpjTo1ey67QGEBU3v+RVhCWhYW3J80MRZZPOXBodLAfwzJ4zc2Oniz/QYnV05JLBAjoX2tVGtshQk9xFQGA2csvNKCcMcTogqZAca+XDXlZWLGnliyzkDtB87d6kw5PVMYE1nO9cgszqAPGLG0khhbsmOOxWnS/r7sCO6LlWVHZATTHmFRB9Ep+7VCnF3fWXhFP5CE5pXcE2c79AQJDJBfjkB58bIOPrRb3HG4NqLHrcC2QJfHx9yS4Tg6MbYwxq/HLW3p0wJ+u8sSYK+SuCmUF0PQQo+KHFwWClvYWhdGFeKwBzwTdNkl48VRHDS0TgHwGzgNAgQj1JZ90ZG+ZkHeEWvuzzbLMA0= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: dd5a211b-7851-425f-4c80-08dc0c2bcecc X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2024 07:15:47.3771 (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: +2VhSEmG9znSTBhqI0jgOmeyeXKdpuvE0OjswOVSAtUc9BP0Rszhatgg209JQ1tN/MNV4201BKVHtVsSGGhnwA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB6777 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-03_02,2024-01-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 bulkscore=0 spamscore=0 adultscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401030059 X-Proofpoint-GUID: DF2g5PXsWKL-_SinCmNWaCPJRh4ZoeNS X-Proofpoint-ORIG-GUID: DF2g5PXsWKL-_SinCmNWaCPJRh4ZoeNS 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, RCVD_IN_DNSWL_NONE, 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.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org [Changes from V3 to V4] - Code restructuring so that --scfi=[all,none] is available for ELF targets only [End of changes from V3 to V4] [No changes from V2] When the command line option --scfi (default is --scfi=all) is passed to the GNU assembler, it will synthesize DWARF call frame information (CFI) for the input assembly. The option --scfi=all will also ignore many of the existing .cfi_* directives, if already contained in the provided input file. Only the following CFI directives will not be ignored: - .cfi_sections, - .cfi_label, - .cfi_signal_frame To use SCFI, a target will need to: - define TARGET_USE_SCFI and TARGET_USE_GINSN, and other necessary definitions, - provide means to help GAS understand the target specific instruction semantics by creating ginsns. The --scfi=[all,none] may see more options added in future. For example, --scfi=inline, for dealing with inline asm may be added in the future. In this option, the GNU assembler will consume (and not ignore) the compiler generated CFI for the code surrounding the inline asm. Also document the option. gas/ * as.c (show_usage): Add support for --scfi. (parse_args): Likewise. * as.h (enum synth_cfi_type): Define new type. * doc/as.texi: Document the new option. --- gas/as.c | 24 ++++++++++++++++++++++-- gas/as.h | 8 ++++++++ gas/doc/as.texi | 12 ++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/gas/as.c b/gas/as.c index 6839c841588..953b9bc0b99 100644 --- a/gas/as.c +++ b/gas/as.c @@ -321,6 +321,11 @@ Options:\n\ generate GNU Build notes if none are present in the input\n")); fprintf (stream, _("\ --gsframe generate SFrame stack trace information\n")); +# if defined (TARGET_USE_SCFI) && defined (TARGET_USE_GINSN) + fprintf (stream, _("\ + --scfi=[all,none] (default: all)\n\ + Synthesize DWARF CFI for hand-written asm\n")); +# endif #endif /* OBJ_ELF */ fprintf (stream, _("\ @@ -511,7 +516,8 @@ parse_args (int * pargc, char *** pargv) OPTION_NOCOMPRESS_DEBUG, OPTION_NO_PAD_SECTIONS, OPTION_MULTIBYTE_HANDLING, /* = STD_BASE + 40 */ - OPTION_SFRAME + OPTION_SFRAME, + OPTION_SCFI /* When you add options here, check that they do not collide with OPTION_MD_BASE. See as.h. */ }; @@ -543,7 +549,10 @@ parse_args (int * pargc, char *** pargv) ,{"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 +# if defined (TARGET_USE_SCFI) && defined (TARGET_USE_GINSN) + ,{"scfi", optional_argument, NULL, OPTION_SCFI} +# endif +#endif /* OBJ_ELF || OBJ_MAYBE_ELF. */ ,{"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL} ,{"gdwarf-2", no_argument, NULL, OPTION_GDWARF_2} ,{"gdwarf-3", no_argument, NULL, OPTION_GDWARF_3} @@ -982,6 +991,17 @@ This program has absolutely no warranty.\n")); flag_execstack = 0; break; +# if defined (TARGET_USE_SCFI) && defined (TARGET_USE_GINSN) + case OPTION_SCFI: + if (!optarg || strcasecmp (optarg, "all") == 0) + flag_synth_cfi = SYNTH_CFI_ALL; + else if (strcasecmp (optarg, "none") == 0) + flag_synth_cfi = SYNTH_CFI_NONE; + else + as_fatal (_("Invalid --scfi= option: `%s'"), optarg); + break; +# endif + case OPTION_SIZE_CHECK: if (strcasecmp (optarg, "error") == 0) flag_allow_nonconst_size = false; diff --git a/gas/as.h b/gas/as.h index 46dd0d0776d..378653e2200 100644 --- a/gas/as.h +++ b/gas/as.h @@ -324,6 +324,14 @@ COMMON int flag_fatal_warnings; /* --fatal-warnings */ are detected. */ COMMON unsigned char flag_always_generate_output; /* -Z */ +enum synth_cfi_type +{ + SYNTH_CFI_NONE = 0, + SYNTH_CFI_ALL, +}; + +COMMON enum synth_cfi_type flag_synth_cfi; + /* This is true if the assembler should output time and space usage. */ COMMON unsigned char flag_print_statistics; diff --git a/gas/doc/as.texi b/gas/doc/as.texi index 52571d95dd2..cfc1078c36b 100644 --- a/gas/doc/as.texi +++ b/gas/doc/as.texi @@ -255,6 +255,7 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}. [@b{--multibyte-handling=[allow|warn|warn-sym-only]}] [@b{--no-pad-sections}] [@b{-o} @var{objfile}] [@b{-R}] + [@b{--scfi=[all,none]}] [@b{--sectname-subst}] [@b{--size-check=[error|warning]}] [@b{--statistics}] @@ -932,6 +933,17 @@ Ignored. Supported for compatibility with tools that apss the same option to both the assembler and the linker. @ifset ELF +@item --scfi=none +@itemx --scfi=all +These options control whether the assembler should synthesize CFI for +hand-written input. If the input already contains some synthesizable CFI +directives, the assembler ignores them and emits a warning. Note that +@code{--scfi=all} is not intended to be used for compiler-generated code, +including inline assembly. + +The input asm must begin with the @code{.type} directive, and should ideally be +closed off using a @code{.size} directive. + @item --sectname-subst Honor substitution sequences in section names. @ifclear man From patchwork Wed Jan 3 07:15:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 83208 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 223983857007 for ; Wed, 3 Jan 2024 07:18:54 +0000 (GMT) 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 76C9138582A8 for ; Wed, 3 Jan 2024 07:15:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 76C9138582A8 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 76C9138582A8 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266157; cv=pass; b=fUfuUoDFnUNWcvpKDEZzqsUtP7HeEofBf8A+3lgxDOGGK2Je43pSXh52mfIK5kjOnaWFUYQ0nCz+cI25L8zoc0mnVtMKHNuhM3VxqAzMd/SZpvcuykHAu2OWUJ+UWphURx+sKxuoKTYnGqIdQT75/TvL+GH/gfF4D4SHMpnw34I= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266157; c=relaxed/simple; bh=+gm9iHPN/uhp85NkIDchtekvL7kNxFMlXtSJVEVVaKs=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=PDHYPo5BdSTh2i9b0opRfsLEtfLrdOQ6Z1J2X7ah6LL5wz+gh8EnP2hy7TaWB44eiKbsDShO3THrQaB6EBL85sydRnzmbWXTsS30rcAZDxJyFvUmXO7DxWX7uJcwreleoiCK9QjA3H6BWNoxnPWyqP58Jx4cYu6rP6G0XN737hw= ARC-Authentication-Results: i=2; server2.sourceware.org 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 4030hvTY020001 for ; Wed, 3 Jan 2024 07:15:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=yAHiG1I4ijPdoB3sCH7SJTVusnEpTZvoXl3N+wkGxwg=; b=NgahfbYEEyBXW6jmcilrB6WDDc4vFpRMyRxOy+8Z03GqDcAKjfSfWkhE2KMp12rlQR9Q 5dska4fT6UGvIEwfvbRc6Fm+sK5mwPXQDJonIwWfdDgTUI8ke8QX+W4x+qt9fQ81i+v6 UHrgm0SupCvRvEmF1YtsMW9KbnKi/MWtGqtCYyMUVuxIkJrBe0PuHicC7xZ0jz2+mJus 3Azl7BoyqHqbQo/rjNF63rHA0Qr3GIZCDUT7F5ieynThq8zRt0a6vyTLf8C8RuoMAsuf kGBA2zvT+3w6ioIaIzA5sNnr2sRk9kHAYNcaHnE13FjDg0O/re/wdMyP90SuUVezhLJa uA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vaa03vepw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:15:52 +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 4036qZH2001582 for ; Wed, 3 Jan 2024 07:15:51 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2041.outbound.protection.outlook.com [104.47.57.41]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3va9n8pp25-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:15:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nXUd6TbpvWjbOiB48pVoKE63kJ3Enie0o3bg+OR2ucOWit1fH0hB0y3TFwPtD1Xwi4BShsNPua79+Fc2JmJH3v1DoNxenA4zJz4Q6cER4VfpcytYvaZhOFuGQ7OgLdTCS0eTiD7MtsZwnEJ6qf3VnMfm+kFhzlMDzAXH7UnKp9aradvqaQ3uaoQPwjvhJt3qdvZ2f3NGCxV0FItbPDWo/+oVTZikRvXP0OcwpNXh3whMBkB74y16gMAUIi0JME0mu7yF2I4xotgXwXw20/vqS2MErquFLtit+x1pDe9KgPWWsExXCpuvE6WERYMTYRC2OLowYJXTrUeQmjABZ/sJ2A== 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=yAHiG1I4ijPdoB3sCH7SJTVusnEpTZvoXl3N+wkGxwg=; b=YOJrQ9C9OmD757Qm0/Q3WZkyqjP+VY0omRW76BVEldsqQxZuoprhdny8gEzaxnDbHHgYz9hmtUXGo6JFu2495t+kMpb69ke+J7E1xpG42zhJSxcPcxQ4FNM9zHV/VsDbhkwj6R/FIMLWBmXerHgUu/Fn8qCIxSs14fsDR+FZ+kYbK4+YE/XduTWsQFStjFmAyBm1DKLRUIRd9sG6xQPD8Ar5xGUP4O+Hqhv4PVlb2KWE5qIUkHGFdndwRUUtD2AE4gqAZeUyJnPLQJsXIO0dA8StEUUhBU22NHluxz1mqzgXr3W4pUb7p+ugFjFQQMZSaxG/Cn1WMftfT41xKPHkMA== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yAHiG1I4ijPdoB3sCH7SJTVusnEpTZvoXl3N+wkGxwg=; b=Zmpmd8UNy0inkkUB8oARBD/h6sBuGAAKMnE+QRbuCykP5H+Vvh0J9TCCV8AV36kEETSdyZgt8keGVItfeZ4Ofy9k7sHlULBmp3M8blH/E28AiSYc36fX3wfuoMWOgHi5jI9rH1aWR7gNpm3VxvOpdehbkNi25qSnB7nA0fkukpY= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by CY8PR10MB6777.namprd10.prod.outlook.com (2603:10b6:930:98::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.25; Wed, 3 Jan 2024 07:15:49 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac%4]) with mapi id 15.20.7159.013; Wed, 3 Jan 2024 07:15:49 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH, V4 08/14] gas: scfidw2gen: new functionality to prepare for SCFI Date: Tue, 2 Jan 2024 23:15:20 -0800 Message-ID: <20240103071526.3846985-9-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240103071526.3846985-1-indu.bhagat@oracle.com> References: <20240103071526.3846985-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR04CA0223.namprd04.prod.outlook.com (2603:10b6:303:87::18) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|CY8PR10MB6777:EE_ X-MS-Office365-Filtering-Correlation-Id: 72d40524-58d6-47ed-2ac9-08dc0c2bcfef X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mSS3Y655ycU/tvHcMluL7IN5+95qO8Og+b3ZUIBpUAkr/nOptGer83fEW3owN7VyEqM2DQV198mdZjNBZizoJEX8HEm2JmbITkpXZJGtANLfGdV+X4jwcYrAxphfVSO1803HxicFK2+aJTI77hWdm9IilIveVNx59PJbMkO5PpXqbCskFcjfb9L1TLWgCUxDQH+BbtN4GHvV9cMbksgqnbht2dI6gBQjTWlKtAs+T8scFtpeUnCSIg4kkS9Vo9m1M0S6jMr/Ymshv7qiuvp259laN3z38lA24ASXt9QAsOHwMSIXQR+vasDJcambELbANVdwutZ/PWXel8Tcb8zUI0X+pKHJiQY/Xvp1PNyQE/xFwUe8+bZAiW8RauOI5nXdLvGBMgKsYgAXpUwqMH6EThk8BxkwXyhggXngatKAHS9BLd8kgfTDoDX7IHx7PNBnS1n9SG9NuAFdZISRkVs2f9lbAtHkjLSzc+2BCnMj0IQTFH2Xj6n4vLyFeyMXuTUFpqU1abfcjVuvSjl2vX7/zXbmSRiL8u9Dp1JZF5MUqTKnUxkN79L8F4fBNCbaFY5aw0nBVMQjRBSij13WoH9xxs9RW9xdPT9Cn1HLFbguj9HOXnKA2Ju1pTVyiwuze5jIRLLqnTu08W5pK4wUDmkfeg== 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:(13230031)(366004)(346002)(396003)(136003)(39860400002)(376002)(230922051799003)(230173577357003)(230273577357003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(36756003)(86362001)(107886003)(1076003)(2616005)(6506007)(6512007)(6666004)(4326008)(478600001)(6486002)(8936002)(8676002)(316002)(66476007)(83380400001)(66556008)(66946007)(6916009)(41300700001)(2906002)(30864003)(44832011)(5660300002)(2004002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8yFBv/gBr91G0ZgZ42dMvWuW5K1LQPw0dXnk63S0KeX93nhgnAw8HAKVukNUuXgPEe3P4sGdvZvdoW6gZIlzh7xPS8M1NWDqBngvc8O4JJVH7GV/pdt+jrYC66SKBoghIked2KBqDBNu61Tw7usWJ54hqOu13xNAUpmhewOWr6rT+6aLkkMeti4Tex5uCVMk8i9Ofl2iLodHLcFJjg7tLIZa2+rTgNgNcQM5bD5wAWGdtGSWD0GndOAm0kPGMF4hD9d84mnGQPyaXEh6qjQG2kdhHOyJFBCXzlnVjKP0We4AkY/PPdhtA9F8Lq9zmLtY4NkuCIMx+/5uQD7NNYfNXbneSa9Ma9MSSUZn0/gOnfreqxYkU4lvHLbETE4Zzoq3in8pKAw0k39DOPGEk7Um6lmpJsZfToUT8KVlIJWVTBTzT13nAkPDUb/VzXY1W0pnoyXso+J3+xS1q0LXcbR9bt7Jf4OfGvjjWT5jpA+EDd2mDJ8kxIep9A6tEpj7Ek9lQeT+K2OZtl70k6j5uIchi9Ck9IyMsyztxMg4fI6AQJWstK61Fqiy1y4x2ex1z8WEyliyF6aMhuLC1wrCE4QNPOKW43u2zkuR5Hj/5/X8J3fZ/pCrzZx5eJCTRBwAi/Cmx6NLiixJNzBtWAkQn9skSEXN+KNNqleQGCKHM7UYt9dhoZdoJ0qyLfKDrUAut7vdhOnhaskeUg9xomimPq067bRvNV6waocFOsRogtd8uiVMlwg8Z2ufUshH0xJ5VZbJneQ9MSrCYo+4sZMz81UbCba7IhRpud1wUGbE+yRiibIoqmAhsyf2Sn71XifS9KPTsHjtBKS5U69/3vuVKQX79WzhcoW9cqJxr0FhkOGRrXa1mw16AHNVB49kI5AzlEoXJODRoEnYxf7FO2WnYQqa2kBf5Ihk2jLB+ZZYYX1RO0EjR+vGyJAs4pDZx44aZnPOSKsaSxRf1C4wKOwGbEyBluZ8XLRJD061FuYy8h/lbziMOs6Lv66yw/8ESQschnBMxGn0cf0uyl0qs4dLPzz7I38nYPoctrUJoQH2hVyMdnJ4K0MJHEgQ4cug1+HNdTv6tX0cuYQoZ5EyIU0E7r9DQqy8+hDcGLlH5wDcHBfojdwtjv4Y1wVqiFO6ywCZCe8q8ofUMRHCEaQvHMSZPOymT27UgOkXzOawM3rYLG80Ald4MDV6isaDCfpYvnQyaHc2mz+j8XorxTsfyZ5DLHiw+xG9tkDYcmA3ahoFDIdA2FYRfLF4gr811+S0EbMScPTdl1xGpM8KbZfB99WgUsJAOacg8eMgwnn6ptGlSReyxZH5kteGyuWrnDmgsb03itBUygHTXGyWQ9G90Qy0bdGoQnRtxRDQ7jLrPoVdjZRQq/oeR8oS5/q3er8YLJJoqjAFREaix6rdb+MNMtGGDAhJhV/mGHV0owHLjTZhK/nh3ct/a6lTq5tLu8dLMuXmCpdi5BxClJqwDfCl8E+8nyYZXPCvh1lKUT/+T9ssE4T79Vc303EP7mbKWWIUMkdOZ4uc/GpgsaZQaPM1kJ6ZM9WPjB2ja6UxMwNSkWwGfsdUbM/AWf/IqT6BPL9N6NIF6Zve3iYdfRg0mVe6bbdZRbHIWjjTUPUlnhC0HAlRfCjDwRM= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: AUMZoAKbPuPw0EZ++OdaCQfo4Koabq9UDGICB8l5SnwoEKbQrQc8edOXrGrUQ3QErGlLNpNNx5aTKeRZcQFZa/F4RlkACfVk2OJx6ZTFP/KVlxDDljh1Z6QygElOFjKq9Ro/at5Vk1r9185BGzqCRxRb2l0+PxXPCdToHUfTEEU0CbTCCia/bw+0T9+k5B8Oe5TzJqCUu3u8+Lo+A9nBuHyDGPTH3caOUGJcdpUFc0LOqSoAS2hD3WZqdOTA0X6x2g1aoLCiAqCmw1D26x+IYbL7TjYyLhNI7D1OuT4wO0B8XynHfkf/2cxbx3p19Uiad8LcwnI1t/motxh70O9ZPNnOLlm2nolZDsvWHow0gl89fFkNbTYLzKSSaFjIV5WrMTZggQ9aAyGfTs3vvzSS+0F6VdTUBCIduY2vWkPqDk6XcZrYrDc1FuysP7tT/0aNv46OvjsNmUkU1CMqFdhfmDGC+FIckL54byBJRLokP+7X73tdh+XXsjC1X87ZwkJYF4/ZNSsGm4Gg+SO43GqnPRke7mx+yXwoX5hVwZ0nHf49O/AiRrS2RyRDsCNqqL2o4s6L8VKvPSm1gZUGQY7vu8ovCQ4BFHg127OUtCKBodY= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 72d40524-58d6-47ed-2ac9-08dc0c2bcfef X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2024 07:15:49.2674 (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: CJV1d0kro9bnKeuqMdCVuhy7cCFepMyu7dB2g7rhb0/Oy9M9mF1iwc+HQ8VvjbAEMyIwvXtuGYKmI6B4kwXziQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB6777 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-03_02,2024-01-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 malwarescore=0 adultscore=0 suspectscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401030059 X-Proofpoint-ORIG-GUID: _hPhtu2yulqR2Xj4D6jVqJpyvV6NuriS X-Proofpoint-GUID: _hPhtu2yulqR2Xj4D6jVqJpyvV6NuriS 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, RCVD_IN_DNSWL_NONE, 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.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org [No Changes from V3 to V4] [Changes from V2 to V3] - Use dot_cfi_sections () from dw2gencfi and do not ignore .cfi_sections CFI directive from user anymore. - Addressed review comments: + Remove dummy functions, use #ifdef in read.c + Move the handlers of 'no ignore' functions together + Move functions around so no need for forward declaration + Use bool for scfi_ignore_warn_once, not int + Reword message around not closed CFI entry + Fix year range + scfidw2gen.c: reword warning message s/some/most/ + ginsn/scfidw2gen: use const with symbolS* [End of changes from V2 to V3] Define a new set of handlers for CFI directives for the purpose of SCFI. The SCFI machinery ignores many of the user-specified CFI direcives when --scfi=all is in effect. A warning ("Warning: --scfi=all ignores most user-specified CFI directives") is issued once per file. The following CFI directives, however, are not ignored: - .cfi_sections - .cfi_label - .cfi_signal_frame The handling of .cfi_label, and .cfi_signal_frame will be added in a follow up patch, as it needs the ginsn implementation. Since the option --scfi=inline still needs to be worked out, the implementation in scfidw2gen may need to be adjusted later. gas/ * Makefile.am: Add new files to GAS_CFILES and HFILES. * Makefile.in: Likewise. * gas/read.c (scfi_pop_insert): New define. (pobegin): Use the SCFI handlers. * scfidw2gen.c: New file. * scfidw2gen.h: New file. --- gas/Makefile.am | 2 + gas/Makefile.in | 9 +- gas/read.c | 19 +++- gas/scfidw2gen.c | 252 +++++++++++++++++++++++++++++++++++++++++++++++ gas/scfidw2gen.h | 35 +++++++ 5 files changed, 312 insertions(+), 5 deletions(-) create mode 100644 gas/scfidw2gen.c create mode 100644 gas/scfidw2gen.h diff --git a/gas/Makefile.am b/gas/Makefile.am index 0e98ca3ec85..e174305ca62 100644 --- a/gas/Makefile.am +++ b/gas/Makefile.am @@ -93,6 +93,7 @@ GAS_CFILES = \ read.c \ remap.c \ sb.c \ + scfidw2gen.c \ sframe-opt.c \ stabs.c \ subsegs.c \ @@ -128,6 +129,7 @@ HFILES = \ output-file.h \ read.h \ sb.h \ + scfidw2gen.h \ subsegs.h \ symbols.h \ tc.h \ diff --git a/gas/Makefile.in b/gas/Makefile.in index 329b651d32e..fe9f4e06195 100644 --- a/gas/Makefile.in +++ b/gas/Makefile.in @@ -176,9 +176,9 @@ am__objects_1 = app.$(OBJEXT) as.$(OBJEXT) atof-generic.$(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) sframe-opt.$(OBJEXT) \ - stabs.$(OBJEXT) subsegs.$(OBJEXT) symbols.$(OBJEXT) \ - write.$(OBJEXT) + remap.$(OBJEXT) sb.$(OBJEXT) scfidw2gen.$(OBJEXT) \ + sframe-opt.$(OBJEXT) stabs.$(OBJEXT) subsegs.$(OBJEXT) \ + symbols.$(OBJEXT) write.$(OBJEXT) am_as_new_OBJECTS = $(am__objects_1) am__dirstamp = $(am__leading_dot)dirstamp as_new_OBJECTS = $(am_as_new_OBJECTS) @@ -592,6 +592,7 @@ GAS_CFILES = \ read.c \ remap.c \ sb.c \ + scfidw2gen.c \ sframe-opt.c \ stabs.c \ subsegs.c \ @@ -626,6 +627,7 @@ HFILES = \ output-file.h \ read.h \ sb.h \ + scfidw2gen.h \ subsegs.h \ symbols.h \ tc.h \ @@ -1348,6 +1350,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)/scfidw2gen.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@ diff --git a/gas/read.c b/gas/read.c index 76ef86c523c..0ae6d830e9c 100644 --- a/gas/read.c +++ b/gas/read.c @@ -38,6 +38,7 @@ #include "obstack.h" #include "ecoff.h" #include "dw2gencfi.h" +#include "scfidw2gen.h" #include "codeview.h" #include "wchar.h" #include "filenames.h" @@ -587,6 +588,10 @@ pop_insert (const pseudo_typeS *table) #define cfi_pop_insert() pop_insert(cfi_pseudo_table) #endif +#ifndef scfi_pop_insert +#define scfi_pop_insert() pop_insert(scfi_pseudo_table) +#endif + static void pobegin (void) { @@ -607,8 +612,18 @@ pobegin (void) pop_insert (potable); /* Now CFI ones. */ - pop_table_name = "cfi"; - cfi_pop_insert (); +#if defined (TARGET_USE_SCFI) && defined (TARGET_USE_GINSN) + if (flag_synth_cfi) + { + pop_table_name = "scfi"; + scfi_pop_insert (); + } + else +#endif + { + pop_table_name = "cfi"; + cfi_pop_insert (); + } } static void diff --git a/gas/scfidw2gen.c b/gas/scfidw2gen.c new file mode 100644 index 00000000000..45fe7787653 --- /dev/null +++ b/gas/scfidw2gen.c @@ -0,0 +1,252 @@ +/* scfidw2gen.c - Support for emission of synthesized Dwarf2 CFI. + Copyright (C) 2023 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 "dw2gencfi.h" +#include "subsegs.h" +#include "scfidw2gen.h" + +#if defined (TARGET_USE_SCFI) && defined (TARGET_USE_GINSN) + +static bool scfi_ignore_warn_once; + +static void +dot_scfi_ignore (int ignored ATTRIBUTE_UNUSED) +{ + gas_assert (flag_synth_cfi); + + if (!scfi_ignore_warn_once) + { + as_warn (_("--scfi=all ignores most user-specified CFI directives")); + scfi_ignore_warn_once = true; + } + ignore_rest_of_line (); +} + +static void +scfi_process_cfi_label (void) +{ + /* To be implemented. */ + return; +} + +static void +scfi_process_cfi_signal_frame (void) +{ + /* To be implemented. */ + return; +} + +static void +dot_scfi (int arg) +{ + switch (arg) + { + case CFI_label: + scfi_process_cfi_label (); + break; + case CFI_signal_frame: + scfi_process_cfi_signal_frame (); + break; + default: + abort (); + } +} + +const pseudo_typeS scfi_pseudo_table[] = + { + { "cfi_sections", dot_cfi_sections, 0 }, /* No ignore. */ + { "cfi_signal_frame", dot_scfi, CFI_signal_frame }, /* No ignore. */ + { "cfi_label", dot_scfi, CFI_label }, /* No ignore. */ + { "cfi_startproc", dot_scfi_ignore, 0 }, + { "cfi_endproc", dot_scfi_ignore, 0 }, + { "cfi_fde_data", dot_scfi_ignore, 0 }, + { "cfi_def_cfa", dot_scfi_ignore, 0 }, + { "cfi_def_cfa_register", dot_scfi_ignore, 0 }, + { "cfi_def_cfa_offset", dot_scfi_ignore, 0 }, + { "cfi_adjust_cfa_offset", dot_scfi_ignore, 0 }, + { "cfi_offset", dot_scfi_ignore, 0 }, + { "cfi_rel_offset", dot_scfi_ignore, 0 }, + { "cfi_register", dot_scfi_ignore, 0 }, + { "cfi_return_column", dot_scfi_ignore, 0 }, + { "cfi_restore", dot_scfi_ignore, 0 }, + { "cfi_undefined", dot_scfi_ignore, 0 }, + { "cfi_same_value", dot_scfi_ignore, 0 }, + { "cfi_remember_state", dot_scfi_ignore, 0 }, + { "cfi_restore_state", dot_scfi_ignore, 0 }, + { "cfi_window_save", dot_scfi_ignore, 0 }, + { "cfi_negate_ra_state", dot_scfi_ignore, 0 }, + { "cfi_escape", dot_scfi_ignore, 0 }, + { "cfi_personality", dot_scfi_ignore, 0 }, + { "cfi_personality_id", dot_scfi_ignore, 0 }, + { "cfi_lsda", dot_scfi_ignore, 0 }, + { "cfi_val_encoded_addr", dot_scfi_ignore, 0 }, + { "cfi_inline_lsda", dot_scfi_ignore, 0 }, + { "cfi_val_offset", dot_scfi_ignore, 0 }, + { NULL, NULL, 0 } + }; + +void +scfi_dot_cfi_startproc (const symbolS *start_sym) +{ + if (frchain_now->frch_cfi_data != NULL) + { + as_bad (_("SCFI: missing previous SCFI endproc marker")); + return; + } + + cfi_new_fde ((symbolS *)start_sym); + + cfi_set_sections (); + + frchain_now->frch_cfi_data->cur_cfa_offset = 0; + + /* By default, SCFI machinery assumes .cfi_startproc is used without + parameter simple. */ + tc_cfi_frame_initial_instructions (); + + if ((all_cfi_sections & CFI_EMIT_target) != 0) + tc_cfi_startproc (); +} + +void +scfi_dot_cfi_endproc (const symbolS *end_sym) +{ + struct fde_entry *fde_last; + + if (frchain_now->frch_cfi_data == NULL) + { + as_bad (_(".cfi_endproc without corresponding .cfi_startproc")); + return; + } + + fde_last = frchain_now->frch_cfi_data->cur_fde_data; + cfi_set_last_fde (fde_last); + + cfi_end_fde ((symbolS *)end_sym); + + if ((all_cfi_sections & CFI_EMIT_target) != 0) + tc_cfi_endproc (fde_last); +} + +void +scfi_dot_cfi (int arg, unsigned reg1, unsigned reg2, offsetT offset, + const char *name, const symbolS *advloc) +{ + if (frchain_now->frch_cfi_data == NULL) + { + as_bad (_("CFI instruction used without previous .cfi_startproc")); + return; + } + + /* If the last address was not at the current PC, advance to current. */ + if (frchain_now->frch_cfi_data->last_address != advloc) + cfi_add_advance_loc ((symbolS *)advloc); + + switch (arg) + { + case DW_CFA_offset: + cfi_add_CFA_offset (reg1, offset); + break; + + case DW_CFA_val_offset: + cfi_add_CFA_val_offset (reg1, offset); + break; + + case CFI_rel_offset: + cfi_add_CFA_offset (reg1, + offset - frchain_now->frch_cfi_data->cur_cfa_offset); + break; + + case DW_CFA_def_cfa: + cfi_add_CFA_def_cfa (reg1, offset); + break; + + case DW_CFA_register: + cfi_add_CFA_register (reg1, reg2); + break; + + case DW_CFA_def_cfa_register: + cfi_add_CFA_def_cfa_register (reg1); + break; + + case DW_CFA_def_cfa_offset: + cfi_add_CFA_def_cfa_offset (offset); + break; + + case CFI_adjust_cfa_offset: + cfi_add_CFA_def_cfa_offset (frchain_now->frch_cfi_data->cur_cfa_offset + + offset); + break; + + case DW_CFA_restore: + cfi_add_CFA_restore (reg1); + break; + + case DW_CFA_remember_state: + cfi_add_CFA_remember_state (); + break; + + case DW_CFA_restore_state: + cfi_add_CFA_restore_state (); + break; + + case CFI_label: + cfi_add_label (name); + break; + + case CFI_signal_frame: + frchain_now->frch_cfi_data->cur_fde_data->signal_frame = 1; + break; + +/* + case DW_CFA_undefined: + for (;;) + { + reg1 = cfi_parse_reg (); + cfi_add_CFA_undefined (reg1); + SKIP_WHITESPACE (); + if (*input_line_pointer != ',') + break; + ++input_line_pointer; + } + break; + + case DW_CFA_same_value: + reg1 = cfi_parse_reg (); + cfi_add_CFA_same_value (reg1); + break; + + case CFI_return_column: + reg1 = cfi_parse_reg (); + cfi_set_return_column (reg1); + break; + + case DW_CFA_GNU_window_save: + cfi_add_CFA_insn (DW_CFA_GNU_window_save); + break; + +*/ + default: + abort (); + } +} + +#endif diff --git a/gas/scfidw2gen.h b/gas/scfidw2gen.h new file mode 100644 index 00000000000..b96ff4848d9 --- /dev/null +++ b/gas/scfidw2gen.h @@ -0,0 +1,35 @@ +/* scfidw2gen.h - Support for emitting synthesized Dwarf2 CFI. + Copyright (C) 2023 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 SCFIDW2GEN_H +#define SCFIDW2GEN_H + +#include "as.h" +#include "dwarf2.h" + +extern const pseudo_typeS scfi_pseudo_table[]; + +void scfi_dot_cfi_startproc (const symbolS *start_sym); +void scfi_dot_cfi_endproc (const symbolS *end_sym); +void scfi_dot_cfi (int arg, unsigned reg1, unsigned reg2, offsetT offset, + const char *name, const symbolS *advloc); + +#endif + From patchwork Wed Jan 3 07:43:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 83218 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2457138582BF for ; Wed, 3 Jan 2024 07:44:40 +0000 (GMT) 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 057AE3858D28 for ; Wed, 3 Jan 2024 07:44:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 057AE3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 057AE3858D28 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704267844; cv=pass; b=FLJrCC5328rC6FZwiJrfhq+4h4LWA91dTojiLkA38deahWaOFv9HbqzKtPF5TIQuU+KtXZxrwLz0LZzWAmAkIf16qeztNyS2+czfaDfIoQyRPfw16aMDNHl/R8X9EGpzS+32bQ1ppuCIiEu3lru+Q9+O/AeNphe5RlCoE6nxo5U= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704267844; c=relaxed/simple; bh=xYh5XDPf061bGg23TPqet8OXFfUvw0pN82B06aCfsy0=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=spw84NfSlV0YGTzJ9Vljbaauhwoiwp7rkFkeqqaM78Tm+ojwdn6PSp2JkTZkAzFFbPzr2n23lCg64eC/B6gF2FjUE23Sbd6KNzU/UmTWPzYf8vjwqsQkmVmyk3uMJMarqbwvL6usV7j14VxBhvL1SxSx9lDGAx67/FKj+bVJ+yc= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4030iq03000853 for ; Wed, 3 Jan 2024 07:43:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=Scs2qjIRNlBGE4d335bhFj5701cgTGlq0eh+aIzZhEc=; b=BOmaKhYdS+oLBCNaOhhUcK54QWutorM4uxJpcu8kxmGdWql6xE3NIKGJWE1pacskL57G FzvV6kG0I+VqHme6Eiin+crANBIT6c8qCD7CFvdaMng+VtMlA4KDEEOtnFE/FmnJ06VH h0TdQgzZ4TQYSAjmkxkL5zZtTJDHkm9baEcQ+XY+JRF6gjFxOX3VjiC+WIPalk+RXza4 V/JlCFJOWeDusZyzqhBP2VmPUjX45YuchwFjNJAauwPEwdku3WkcTLQv0aR2CkZvC0g3 yvTKJmXA8iNAP00Bied1Bb7Z3aDxDZQR4S7wdIFb6kvt5OnPKZV+KIEWIRwTdSvUz2k9 ZQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vaa4cch92-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:43:59 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 4037UHDu035959 for ; Wed, 3 Jan 2024 07:43:46 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2169.outbound.protection.outlook.com [104.47.73.169]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3va9n8yvd1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:43:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KLpHFGZ5kSqKqSEX7vze6FFV3ovaCnv84r6HuZu4NOcpIAHKjo2JBHhdrKEPbvMoQoxIAuaL8NNghogqValHfHksIjcIPtSrqr95V1K02ZUbPbSyFCmjXeX26SlVMA4DnHtINpsZ+2vaOq0HH0U/KmUdrk+38Md6zVBXWn4nY55GCND0uFQjThjImXzvyZOeIWLv9SzIgk0BGYQ2qqe6nPv0SM9QViE2HxY/h1AtF24yW9j4CD883bOQmaphNs6ntdlTCtlbMjQtcFGKqdsNvCKW370VTTLjqwY7jPsVKtYEho6/uxOxbsLryhleddf08eIgowdbBQzodtEIyKapmA== 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=Scs2qjIRNlBGE4d335bhFj5701cgTGlq0eh+aIzZhEc=; b=EwpWoVQ8STUL7vtB8YoXqd9u4s7xk8qxdHJpvksx/9Ezm5WYXgAflif5QMSRk8hGXiSWOGK75Y6g3ThQ9KVfgVnRzPru0R1/HprBTTtKT6oCh3n1tr9qr9eD32rr247bWpPUKLcYKcET8LBkmTk3FnbW4vDItUf0rHV7BIOtdv7RyyUcXq4cp0uJI9jWHvALRq4UEtArh2BPig0nwYyw62SSY3zCnZW0LJKEV2TurmPdB2JGiSL097GbCXMIRwGlXECPFMSb2tY9/0noGvX3Wo5mHSVm2dRiiosgCjtG2f3wGZg5K6D+kJHvJ+dm/o6mRBnQgyL40Kgr575IMGDWVA== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Scs2qjIRNlBGE4d335bhFj5701cgTGlq0eh+aIzZhEc=; b=qBITmpy02lrEtnEtf7sAwXHfB8SNDJdmu2ERVz4nTnBDsrRfxeHuWfC7i8P3jCcRMvuW1VQc5NyLdSX2K92bOeYQmN1Dh6xtoLKXwSWJ79TGRXzd5/2Ef/w63J0VjNM2q4COnzq691VY6p6oX/YgswmC5CzcnRdCbqQxtexUYWw= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by SJ2PR10MB7828.namprd10.prod.outlook.com (2603:10b6:a03:56c::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.25; Wed, 3 Jan 2024 07:43:44 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac%4]) with mapi id 15.20.7159.013; Wed, 3 Jan 2024 07:43:44 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH, V4 09/14] opcodes: i386: new marker for insns that implicitly update stack pointer Date: Tue, 2 Jan 2024 23:43:41 -0800 Message-ID: <20240103074341.3858511-1-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240103071526.3846985-1-indu.bhagat@oracle.com> References: <20240103071526.3846985-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR03CA0088.namprd03.prod.outlook.com (2603:10b6:303:b6::33) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|SJ2PR10MB7828:EE_ X-MS-Office365-Filtering-Correlation-Id: 87b3961d-48cb-4de6-d21c-08dc0c2fb659 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3LAO6atNB/tvyL43DLNKwnoZ/OL8/TD7aH6VOHUwdzxPZQQCq3QEfTJ0VNz8YPDMsrqN8+bOqD0B3GNaP66ioAxgzqCFiAzMniRK27Zb+lZFNMH/Sa6NXpEtp/pXvCgxRDObESsyKaAEhobZHwnNIwG6pja7593fH8dWGEDPNLQ9lXSNhvi7wZuGYcUjJuMEYA1hHXhK63FoYCQyEBlMTdPNJEZEU+MDuBWSaMwYpTd0VsQQOUw7qvVe6xhKx83TNDf6PrdPFrEQIF4IzZS9RvYPQOv5UYZQJinODBPYfh+LFBE+/pRybZsLcbOxysc61OHqBY7LXJYnU18B7fIfI/24Y5dpiQ8JVigmdiPzzf0jb3tq5GAnHASv5W0tQvZFeRIr37BJhyWHDEwBFJa66tEQJ6B07Ew2fCEsnueHs7tSWbnw2iqjV0AqLs+toA9s2W5MHqn0n4kP8O0ewjQ50KJlV2XvtEUTMfp/K9jRuVmLm4la1Px3HpbIHN//fs4qaFMab4elVpARsFi69ab7rYzZGdQXTFAlLHCH8a/f8xET66Cr/26qTwpLJYfgGsqg 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:(13230031)(396003)(346002)(376002)(136003)(39860400002)(366004)(230922051799003)(451199024)(64100799003)(186009)(1800799012)(6666004)(6506007)(6512007)(6486002)(107886003)(83380400001)(2616005)(1076003)(44832011)(30864003)(2906002)(41300700001)(4326008)(316002)(66476007)(15650500001)(8936002)(8676002)(66556008)(66946007)(5660300002)(6916009)(478600001)(38100700002)(86362001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vQktpE7xTK+bjD18uT52CKqMV7VG6SYx1ZSICKN8XoRYq8i4wCrz+d6gO4qJyGMXh1f2UIsOmRDRIT4/FRQSLVRHQ7rrldlVedrxxEQFhv/vfZQe7yMV6f6oFHkVNflz4yBwb8oZp6tI8xjk6N+mkss1dQ2FnMq5R16qW3HDYVX+r4ED7bsfq+bC2qm0Q06nhgEnNdJg+3vMqvSAZFmcX/nU6MtrR2tZiPza+Gl//4o4USgoeGu52xCCxpirA6UkvCPurrs+MrcdpM8tf8KSAu6UD0A02GCw6V8qbDV0kyE50oSy5k4l2lHl0cEJfxqpj4ehx8ySOsX5gfiPlNyB/yWouAcm1AU4OV3wOqM2iIIovv2KlwBWcRz9g45/1C4PPZsY00RfquIjaVaJSjTBPhq9P3cPnl+rZxRhcAlLtkGE9YuzSUO1ecKTMYlE4JK2TsDCImNgYXbrCtVMDZafxXo3zgkmrKnitYfDU6dctO8d9lfsHl6sEtVjPDL0aym4m3OAUrvGHRbjWVjn4/wqEAgmcs2/nCO2HjpETkKmVY4R+mwly/eeimQqHpV4HzO1NdTnkEJrM6t9LqQJsjFyCCrKwhYUDirUqxYQ5I1+Uop0COKdQhPeETj9l9T+ky45ilf8FhyJ63tBwWrFkLCQDYJiINawnZ57k27ranIt1gdC3rQlHMT/1lHGpkQaw0MGjQU/2k9R/4dNcziPB7xqb9uTVQ5fFqtc8fS5I+42AmqxriGeUcxPo5sJphXu6jf1DvdgppaIrFHBCYImqlsxR51yUojLpcCkKW3oh7yUHOF8XTKSpggOAhhiuS5zAMWyac8sABKtHGVwiEPvtu3LdLPEC/mO6jBrUOjMnms3irUfxwFPFaSBc/ltMptVJH58yDqB44EsWAJ/7O1DfPwHMjw9LRKpE5YrOYX0g0LoMSiO+bbtwSrSndtvDnmy+d39ewhMsE8GNXBXxzy+brKSaMj/LeevRAwM790KSlIpGEgYGkXUf4VCqtUtGmIXVgfcfL4O4SeO5o/UwdNVTrH0pYz323l6F0uE7JZcLRxwxXUivGCc193rFgQQTZuR1DjFLT0PxQpCGKzxx+YvDeXkQHwPnardDRW3gee7H+cQT6t81aYwBEvASCdbRkPLQNQsQBlShy1/ADHPI0NCqTjY23hes3PwySKTDuBCrsg35QAk8dg9ARTPIEztwFpmD9SJGSTIC0iK17a4VKRXyArfFFknkDUGptY2JdDS8dCsYO1wLyb/pwUfSKMA8CpxdzD+zT19RxVAjbv7cTUFRGEVwrlHi3YZ9ytEWjR9RRce0eMVGlaLmPvCnWpXGBfvTkXhfZVaxY47GH2OSsIXwQUiGSTRi/K1qIjN8tMx5CccEB4whbXhOZy3yOS6JNTZzEw44k5B07uJkLlrn2rFsD0QoHz42Bonl0Ok54B2K+5biEdWmeh9BF92HVVsdPfDEFm9U7lTz6sVLIxQ/5klAf0xUhcU6PuEHlEdwhCC5EyjNUMf2AB20Pjfzx6PSv2gMo6tMFTEjlRbfo0YlyD6vhFoCsjlTLRSot+rHiO5Thb6m+XT7iEGtbXQqEOApOvgpkD/E3/V2rWJ0uYEM1neQ7g60zliAZTGAeKLqeKfzvUwQTk= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: kSFXp2FnGF4CByK7k7NccW/XmZFeUk+izFYWSipGsEuHpDuCrpazQNM1Pu1agPeb+wkB4z53TwmPhV+fMq0/4iEXpTxzqMDVYSYssWxenR1MhAEcgHHkWXqD2++iaqfjAZZpt+0AG5+s2pe3gY79P8+gbtRMgfq+oZIkySPBFE7ZrKB0ZpIADENu57sceRSXkxFCxkFVvSHl+u241th+cx05t/v/sQff3d6P27Wmrcc0xgFIdYp6s2PoaxYR0CiBJzUzpK6g9ZW+a5Xp7spYFQDleO840ZsBOCM54ija6BLdU2Ybs/7hZpaAGwk8f1zr71sAOvciGhXqeLTVPHL21ZH7jERjZphaEK/cmoOaLHrrcvWbQZiEc8QpLVM4Be/ylWzA1TsPbDPB8vuo0G4VpNUGxkgJ4nSmopCsQtB/sQ8ncN9NWUPdSj1oBe6CIpfa70TNCppI+3W65TyC40ZmDzi8cM5I+KouIGSsyKveIfxqkTohk6eV052/u2Enemn1vkxnVede/SnkIzaX3e3uFqcmpbhDS+pEo3HNocUpFTqrvkCEDsXbFbJ/rCt0Yg1jdHAXDVphoDBlo7BUNDnO783lWlubjdcZZzloAT5Ydc4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 87b3961d-48cb-4de6-d21c-08dc0c2fb659 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2024 07:43:44.3385 (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: kQrxGYAJWvwaG3Bj4a5FewwjJttPrlD327XLcA0jg/r8PehO2PNOWbfGxyonZ6xNuI3SEzFmp96c8eA8aPRqdQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR10MB7828 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-03_02,2024-01-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 bulkscore=0 spamscore=0 adultscore=0 mlxscore=0 mlxlogscore=680 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401030063 X-Proofpoint-GUID: Lf26iRaSvqOnOkzKieEAhg-E4L5AzgEq X-Proofpoint-ORIG-GUID: Lf26iRaSvqOnOkzKieEAhg-E4L5AzgEq 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.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org [New in V4] Some x86 instructions affect the stack pointer implicitly. Add a new marker in the instruction specification for the same. This will be useful for SCFI implmentation to ensure its correctness. Mark all push, pop, call, ret, enter, leave, INT, iret instructions. PS: Removed i386-tbl.h diffs from the patch to keep the message size below 400 KB. opcodes/ * i386-gen.c: Update opcode_modifiers. * i386-opc.h: Add a new marker ImplicitStackOp. * i386-opc.tbl: Update the affected instructions. * i386-tbl.h: Regenerated. --- opcodes/i386-gen.c | 1 + opcodes/i386-opc.h | 4 + opcodes/i386-opc.tbl | 104 +- opcodes/i386-tbl.h | 11655 +++++++++++++++++++++++++++-------------- 4 files changed, 7827 insertions(+), 3937 deletions(-) diff --git a/opcodes/i386-gen.c b/opcodes/i386-gen.c index 508b441a343..f6610952c63 100644 --- a/opcodes/i386-gen.c +++ b/opcodes/i386-gen.c @@ -488,6 +488,7 @@ static bitfield opcode_modifiers[] = BITFIELD (ISA64), BITFIELD (NoEgpr), BITFIELD (NF), + BITFIELD (ImplicitStackOp), }; #define CLASS(n) #n, n diff --git a/opcodes/i386-opc.h b/opcodes/i386-opc.h index 8db6c51538a..8389832e18f 100644 --- a/opcodes/i386-opc.h +++ b/opcodes/i386-opc.h @@ -750,6 +750,9 @@ enum /* No CSPAZO flags update indication. */ NF, + /* Instruction updates stack pointer implicitly. */ + ImplicitStackOp, + /* The last bitfield in i386_opcode_modifier. */ Opcode_Modifier_Num }; @@ -796,6 +799,7 @@ typedef struct i386_opcode_modifier unsigned int isa64:2; unsigned int noegpr:1; unsigned int nf:1; + unsigned int implicitstackop:1; } i386_opcode_modifier; /* Operand classes. */ diff --git a/opcodes/i386-opc.tbl b/opcodes/i386-opc.tbl index edd9f73ae22..5895957aad3 100644 --- a/opcodes/i386-opc.tbl +++ b/opcodes/i386-opc.tbl @@ -223,32 +223,32 @@ movzw, 0xfb7, i386, Modrm|No_bSuf|No_wSuf|No_sSuf, { Reg16|Unspecified|BaseIndex movzx, 0xfb6, i386, W|Modrm|No_lSuf|No_sSuf|No_qSuf, { Reg8|Reg16|Unspecified|BaseIndex, Reg16|Reg32|Reg64 } // Push instructions. -push, 0x50, No64, No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32 } -push, 0xff/6, No64, Modrm|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32|Unspecified|BaseIndex } -push, 0x6a, i186&No64, DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Imm8S } -push, 0x68, i186&No64, DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Imm16|Imm32 } -push, 0x6, No64, DefaultSize|No_bSuf|No_sSuf|No_qSuf, { SReg } +push, 0x50, No64, ImplicitStackOp|No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32 } +push, 0xff/6, No64, Modrm|ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32|Unspecified|BaseIndex } +push, 0x6a, i186&No64, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Imm8S } +push, 0x68, i186&No64, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Imm16|Imm32 } +push, 0x6, No64, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { SReg } // In 64bit mode, the operand size is implicitly 64bit. -push, 0x50, x64, No_bSuf|No_lSuf|No_sSuf|NoRex64, { Reg16|Reg64 } -pushp, 0x50, APX_F, No_bSuf|No_wSuf|No_lSuf|No_sSuf|Rex2, { Reg64 } -push, 0xff/6, x64, Modrm|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { Reg16|Reg64|Unspecified|BaseIndex } -push, 0x6a, x64, DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { Imm8S } -push, 0x68, x64, DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { Imm16|Imm32S } -push, 0xfa0, x64, DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { SReg } +push, 0x50, x64, ImplicitStackOp|No_bSuf|No_lSuf|No_sSuf|NoRex64, { Reg16|Reg64 } +pushp, 0x50, APX_F, ImplicitStackOp|No_bSuf|No_wSuf|No_lSuf|No_sSuf|Rex2, { Reg64 } +push, 0xff/6, x64, Modrm|ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { Reg16|Reg64|Unspecified|BaseIndex } +push, 0x6a, x64, ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { Imm8S } +push, 0x68, x64, ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { Imm16|Imm32S } +push, 0xfa0, x64, ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { SReg } -pusha, 0x60, i186&No64, DefaultSize|No_bSuf|No_sSuf|No_qSuf, {} +pusha, 0x60, i186&No64, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, {} // Pop instructions. -pop, 0x58, No64, No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32 } -pop, 0x8f/0, No64, Modrm|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32|Unspecified|BaseIndex } -pop, 0x7, No64, DefaultSize|No_bSuf|No_sSuf|No_qSuf, { SReg } +pop, 0x58, No64, ImplicitStackOp|No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32 } +pop, 0x8f/0, No64, Modrm|ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Reg16|Reg32|Unspecified|BaseIndex } +pop, 0x7, No64, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { SReg } // In 64bit mode, the operand size is implicitly 64bit. -pop, 0x58, x64, No_bSuf|No_lSuf|No_sSuf|NoRex64, { Reg16|Reg64 } -popp, 0x58, APX_F, No_bSuf|No_wSuf|No_lSuf|No_sSuf|Rex2, { Reg64 } -pop, 0x8f/0, x64, Modrm|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { Reg16|Reg64|Unspecified|BaseIndex } -pop, 0xfa1, x64, DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { SReg } +pop, 0x58, x64, ImplicitStackOp|No_bSuf|No_lSuf|No_sSuf|NoRex64, { Reg16|Reg64 } +popp, 0x58, APX_F, ImplicitStackOp|No_bSuf|No_wSuf|No_lSuf|No_sSuf|Rex2, { Reg64 } +pop, 0x8f/0, x64, Modrm|ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { Reg16|Reg64|Unspecified|BaseIndex } +pop, 0xfa1, x64, ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { SReg } -popa, 0x61, i186&No64, DefaultSize|No_bSuf|No_sSuf|No_qSuf, {} +popa, 0x61, i186&No64, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, {} // Exchange instructions. // xchg commutes: we allow both operand orders. @@ -290,10 +290,10 @@ lahf, 0x9f, No64, NoSuf, {} lahf, 0x9f, LAHF_SAHF, NoSuf, {} sahf, 0x9e, No64, NoSuf, {} sahf, 0x9e, LAHF_SAHF, NoSuf, {} -pushf, 0x9c, No64, DefaultSize|No_bSuf|No_sSuf|No_qSuf, {} -pushf, 0x9c, x64, DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, {} -popf, 0x9d, No64, DefaultSize|No_bSuf|No_sSuf|No_qSuf, {} -popf, 0x9d, x64, DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, {} +pushf, 0x9c, No64, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, {} +pushf, 0x9c, x64, ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, {} +popf, 0x9d, No64, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, {} +popf, 0x9d, x64, ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, {} stc, 0xf9, 0, NoSuf, {} std, 0xfd, 0, NoSuf, {} sti, 0xfb, 0, NoSuf, {} @@ -515,16 +515,16 @@ shrd, 0xad, APX_F, Modrm|CheckOperandSize|No_bSuf|No_sSuf|DstVVVV|EVexMap4|NF, { shrd, 0xfad, i386, Modrm|CheckOperandSize|No_bSuf|No_sSuf, { Reg16|Reg32|Reg64, Reg16|Reg32|Reg64|Unspecified|BaseIndex } // Control transfer instructions. -call, 0xe8, No64, JumpDword|DefaultSize|No_bSuf|No_sSuf|No_qSuf|BNDPrefixOk, { Disp16|Disp32 } -call, 0xe8, x64, Amd64|JumpDword|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64|BNDPrefixOk, { Disp16|Disp32 } -call, 0xe8, x64, Intel64|JumpDword|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64|BNDPrefixOk, { Disp32 } -call, 0xff/2, No64, Modrm|JumpAbsolute|DefaultSize|No_bSuf|No_sSuf|No_qSuf|BNDPrefixOk|NoTrackPrefixOk, { Reg16|Reg32|Unspecified|BaseIndex } -call, 0xff/2, x64, Amd64|Modrm|JumpAbsolute|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64|BNDPrefixOk|NoTrackPrefixOk, { Reg16|Reg64|Unspecified|BaseIndex } -call, 0xff/2, x64, Intel64|Modrm|JumpAbsolute|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64|BNDPrefixOk|NoTrackPrefixOk, { Reg64|Unspecified|BaseIndex } +call, 0xe8, No64, JumpDword|ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf|BNDPrefixOk, { Disp16|Disp32 } +call, 0xe8, x64, Amd64|JumpDword|ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64|BNDPrefixOk, { Disp16|Disp32 } +call, 0xe8, x64, Intel64|JumpDword|ImplicitStackOp|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64|BNDPrefixOk, { Disp32 } +call, 0xff/2, No64, Modrm|JumpAbsolute|ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf|BNDPrefixOk|NoTrackPrefixOk, { Reg16|Reg32|Unspecified|BaseIndex } +call, 0xff/2, x64, Amd64|Modrm|JumpAbsolute|ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64|BNDPrefixOk|NoTrackPrefixOk, { Reg16|Reg64|Unspecified|BaseIndex } +call, 0xff/2, x64, Intel64|Modrm|JumpAbsolute|ImplicitStackOp|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64|BNDPrefixOk|NoTrackPrefixOk, { Reg64|Unspecified|BaseIndex } // Intel Syntax remaining call instances. -call, 0x9a, No64, JumpInterSegment|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Imm16, Imm16|Imm32 } -call, 0xff/3, 0, Amd64|Modrm|JumpAbsolute|DefaultSize|NoSuf, { Dword|Fword|BaseIndex } -call, 0xff/3, x64, Intel64|Modrm|JumpAbsolute|NoSuf, { Dword|Fword|Tbyte|BaseIndex } +call, 0x9a, No64, JumpInterSegment|ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Imm16, Imm16|Imm32 } +call, 0xff/3, 0, Amd64|Modrm|JumpAbsolute|ImplicitStackOp|DefaultSize|NoSuf, { Dword|Fword|BaseIndex } +call, 0xff/3, x64, Intel64|Modrm|JumpAbsolute|ImplicitStackOp|NoSuf, { Dword|Fword|Tbyte|BaseIndex } lcall, 0x9a, No64, JumpInterSegment|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Imm16, Imm16|Imm32 } lcall, 0xff/3, 0, Amd64|Modrm|JumpAbsolute|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Unspecified|BaseIndex } lcall, 0xff/3, x64, Intel64|Modrm|JumpAbsolute|No_bSuf|No_sSuf, { Unspecified|BaseIndex } @@ -542,22 +542,22 @@ ljmp, 0xea, No64, JumpInterSegment|No_bSuf|No_sSuf|No_qSuf, { Imm16, Imm16|Imm32 ljmp, 0xff/5, 0, Amd64|Modrm|JumpAbsolute|No_bSuf|No_sSuf|No_qSuf, { Unspecified|BaseIndex } ljmp, 0xff/5, x64, Intel64|Modrm|JumpAbsolute|No_bSuf|No_sSuf, { Unspecified|BaseIndex } -ret, 0xc3, No64, DefaultSize|No_bSuf|No_sSuf|No_qSuf|RepPrefixOk|BNDPrefixOk, {} -ret, 0xc2, No64, DefaultSize|No_bSuf|No_sSuf|No_qSuf|RepPrefixOk|BNDPrefixOk, { Imm16 } -ret, 0xc3, x64, Amd64|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64|RepPrefixOk|BNDPrefixOk, {} -ret, 0xc2, x64, Amd64|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64|RepPrefixOk|BNDPrefixOk, { Imm16 } -ret, 0xc3, x64, Intel64|Size64|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64|RepPrefixOk|BNDPrefixOk, {} -ret, 0xc2, x64, Intel64|Size64|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64|RepPrefixOk|BNDPrefixOk, { Imm16 } +ret, 0xc3, No64, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf|RepPrefixOk|BNDPrefixOk, {} +ret, 0xc2, No64, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf|RepPrefixOk|BNDPrefixOk, { Imm16 } +ret, 0xc3, x64, Amd64|ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64|RepPrefixOk|BNDPrefixOk, {} +ret, 0xc2, x64, Amd64|ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64|RepPrefixOk|BNDPrefixOk, { Imm16 } +ret, 0xc3, x64, Intel64|ImplicitStackOp|Size64|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64|RepPrefixOk|BNDPrefixOk, {} +ret, 0xc2, x64, Intel64|ImplicitStackOp|Size64|No_bSuf|No_wSuf|No_lSuf|No_sSuf|NoRex64|RepPrefixOk|BNDPrefixOk, { Imm16 } lret, 0xcb, 0, DefaultSize|No_bSuf|No_sSuf, {} lret, 0xca, 0, DefaultSize|No_bSuf|No_sSuf, { Imm16 } // Intel Syntax. retf, 0xcb, 0, DefaultSize|No_bSuf|No_sSuf, {} retf, 0xca, 0, DefaultSize|No_bSuf|No_sSuf, { Imm16 } -enter, 0xc8, i186&No64, DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Imm16, Imm8 } -enter, 0xc8, x64, DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { Imm16, Imm8 } -leave, 0xc9, i186&No64, DefaultSize|No_bSuf|No_sSuf|No_qSuf, {} -leave, 0xc9, x64, DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, {} +enter, 0xc8, i186&No64, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, { Imm16, Imm8 } +enter, 0xc8, x64, ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, { Imm16, Imm8 } +leave, 0xc9, i186&No64, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf|No_qSuf, {} +leave, 0xc9, x64, ImplicitStackOp|DefaultSize|No_bSuf|No_lSuf|No_sSuf|NoRex64, {} @@ -637,11 +637,11 @@ bts, 0xfba/5, i386, Modrm|No_bSuf|No_sSuf|Optimize|HLEPrefixLock, { Imm8, Reg16| // Interrupts & op. sys insns. // See gas/config/tc-i386.c for conversion of 'int $3' into the special // int 3 insn. -int, 0xcd, 0, NoSuf, { Imm8 } -int1, 0xf1, 0, NoSuf, {} -int3, 0xcc, 0, NoSuf, {} -into, 0xce, No64, NoSuf, {} -iret, 0xcf, 0, DefaultSize|No_bSuf|No_sSuf, {} +int, 0xcd, 0, ImplicitStackOp|NoSuf, { Imm8 } +int1, 0xf1, 0, ImplicitStackOp|NoSuf, {} +int3, 0xcc, 0, ImplicitStackOp|NoSuf, {} +into, 0xce, No64, ImplicitStackOp|NoSuf, {} +iret, 0xcf, 0, ImplicitStackOp|DefaultSize|No_bSuf|No_sSuf, {} // i386sl, i486sl, later 486, and Pentium. rsm, 0xfaa, i386, NoSuf, {} @@ -3486,9 +3486,9 @@ uwrmsr, 0xf3f8/0, USER_MSR, Modrm|Vex128|VexMap7|VexW0|NoSuf, { Imm32, Reg64 } // APX Push2/Pop2 instructions. -push2, 0xff/6, APX_F, Modrm|VexW0|EVex128|EVexMap4|VexVVVV|No_bSuf|No_wSuf|No_lSuf|No_sSuf, { Reg64, Reg64 } -push2p, 0xff/6, APX_F, Modrm|VexW1|EVex128|EVexMap4|VexVVVV|No_bSuf|No_wSuf|No_lSuf|No_sSuf, { Reg64, Reg64 } -pop2, 0x8f/0, APX_F, Modrm|VexW0|EVex128|EVexMap4|VexVVVV|No_bSuf|No_wSuf|No_lSuf|No_sSuf, { Reg64, Reg64 } -pop2p, 0x8f/0, APX_F, Modrm|VexW1|EVex128|EVexMap4|VexVVVV|No_bSuf|No_wSuf|No_lSuf|No_sSuf, { Reg64, Reg64 } +push2, 0xff/6, APX_F, Modrm|VexW0|EVex128|EVexMap4|VexVVVV|ImplicitStackOp|No_bSuf|No_wSuf|No_lSuf|No_sSuf, { Reg64, Reg64 } +push2p, 0xff/6, APX_F, Modrm|VexW1|EVex128|EVexMap4|VexVVVV|ImplicitStackOp|No_bSuf|No_wSuf|No_lSuf|No_sSuf, { Reg64, Reg64 } +pop2, 0x8f/0, APX_F, Modrm|VexW0|EVex128|EVexMap4|VexVVVV|ImplicitStackOp|No_bSuf|No_wSuf|No_lSuf|No_sSuf, { Reg64, Reg64 } +pop2p, 0x8f/0, APX_F, Modrm|VexW1|EVex128|EVexMap4|VexVVVV|ImplicitStackOp|No_bSuf|No_wSuf|No_lSuf|No_sSuf, { Reg64, Reg64 } // APX Push2/Pop2 instructions end. From patchwork Wed Jan 3 07:15:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 83211 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 229873857706 for ; Wed, 3 Jan 2024 07:20:30 +0000 (GMT) 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 2F2DD38582BE for ; Wed, 3 Jan 2024 07:16:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2F2DD38582BE Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2F2DD38582BE Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266172; cv=pass; b=GqeXZm1crtwEE6yOGaNDXxA60IpUOSY37xihlVuHUe8uA33o134zrgqtpG0m1KYZipUsotngZ9SZmPrNiuMkHXMsKvHYUJZLOuxTrzzilR1Sour3btFfcNLI7g6MP7p1eq8K0VM06b5N1PciVqFvQJw5tfAZB7kW7gWZzhIeyrQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266172; c=relaxed/simple; bh=RHic3yo3yJ+F1R1I19OZfKtVblpwLIn+hfP1WhIziI4=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=AnGRe//EZPXnRUiZfui3Sf9dQzjQ5TVoCqYeuZFD3HKPW3Qtqz6SbWFKfq2leZLFFvAoCJSd4sUOR5ucMqqZZ1xUOUDjYzL+w5KOhDnIPBru7CmUqEjBxwN2iFCFptb1sTeIBvSPKbG8H3dc/pKbimQ/PJERzj8aWoNzxIZTZZg= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4030iF8H023765 for ; Wed, 3 Jan 2024 07:16:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=vQzGB8VnvQ7nL9kkDcYIjlnq9Tglgdm6nXQ58CtmryE=; b=VkLm4Vler7xz6JFrUmcCwyRCTkVgECzbwRyzc/PfWil48gz7qH4mZKKTjAzPBhsLHB/D u57paUCVxr/4ipk66YWWJFo+8813CXMxVF4bYPt9bPbeg6/IDOAa9IMqWq6JP0OD09DH 8xgsGsuV+0hO0KmoOuPDwvvTw8vAfBKcJh9PcZz/8E8Cd6ZXfsYY8V9aFi+Dw1phmIcy h0Mp97FEsxmMoRkXtBQsW14tHBy61VRyy+8DmqhiA46apGHQ1A1biMTWTfj6bTYVvNut zeLI73t9YdwPuxcv9yt7L587oe6MBjSjcEDo2m7+YnSzHw8iVbv3rlGOXnqNi/GIywwZ 9Q== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3va9t24fh4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:16:02 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 4036KGpi013680 for ; Wed, 3 Jan 2024 07:16:00 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2041.outbound.protection.outlook.com [104.47.57.41]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3va9nexwkr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:16:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iJP1EUf7L27x7VEteL88fcN6lUI6GEi1uSDXxk0dw5XnqQ4grratekiWavJpUpidu3TNYuNQYa1b0TGVZ2WHkA0lvMpZ1kl9GNQn0RX1M/ygu/xTcuos7XWa4oxYRhleLe+DArPy/j+RiXU2hrtA525cUz2uUADdKmZqw5gu0v5DEwVqipqjocDGnvQxXKPTzTLEZ5BlMIoU6kpAIL+tDvvQKMJoOt26MnZ9WCGd7SBrnz3v0IxZ/KYBqidFbDGClmNosS1goVagh7rPUFC+nOP25v0HNyXRPbFVRToVctoA6kXjZbrkOyH6mx1PaTQbMlE6WclXcsJ3uOpmZMF41w== 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=vQzGB8VnvQ7nL9kkDcYIjlnq9Tglgdm6nXQ58CtmryE=; b=XlxPUiPHQ0GE4K2LjrJU8M+p08PNu/GsO4VXoRi1wh8m7eUFIqu7WW2f+MJgo3wP5So8t//Rp9S+PdAlUT+rNwMtyulqabwlmNjwu5jcto+C+Wt/wargPuQrrVai9YqyTVUGZJAqOpof9VVjGCSggRfPXXiMnB6qnDiAFrFDhVIyr5GFRBs9QbfwfNTndFHZJAdx9DCq2uWMkD1HzBvkKD+PFZwoQGryF8ZlE9A9cSyc9w/XoNLKD3NffkfEv8PsmBY2HWo1XyLZQYB5F+NfuzigM3kNj0m0UJtEsLgXoCc7AmwuPFpaawe7aQ5/3LPVY4IM3yNCPCK/GW4OnegBMw== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vQzGB8VnvQ7nL9kkDcYIjlnq9Tglgdm6nXQ58CtmryE=; b=AXl/Hk9Uptwp3ENtbeHAam3FHlcBONwweIs2mHzFb4bWNYIYNIsTDLfIrPXl20zaLB+13rG7s2PONx+DDN3FTrpsNglueXM0IPah5gI+nfsomZdH65mn8KjeFl0ETYvrTWDb5DCtmh4xEq5DknXWe9rltsw1g7zxBz0o/RaxvNE= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by CY8PR10MB6777.namprd10.prod.outlook.com (2603:10b6:930:98::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.25; Wed, 3 Jan 2024 07:15:53 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac%4]) with mapi id 15.20.7159.013; Wed, 3 Jan 2024 07:15:53 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH,V4 10/14] gas: synthesize CFI for hand-written asm Date: Tue, 2 Jan 2024 23:15:22 -0800 Message-ID: <20240103071526.3846985-11-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240103071526.3846985-1-indu.bhagat@oracle.com> References: <20240103071526.3846985-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR04CA0221.namprd04.prod.outlook.com (2603:10b6:303:87::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_|CY8PR10MB6777:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b97831f-6871-4051-324e-08dc0c2bd281 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nzb0DykgCoSG/YTTOKZNl7ZWL38mnROpNHSgQrdsYEH97/A5iEkx3PypKS5Gg7WC9Wr/0P+nfzV8MKiCG47QTV6IJTKH/EXKDpF+SiwnFM6JR7vBWSq4y3ApBWv254IXzm3najOU1aObN1pu+Nc6PZc15BwMcVV6iW1momsKigvbJp7WDht4zdy8uMHSMqvpKJOui/XkDEqIoobx4ux2lb0xIgwdHR47TpGnB+95gv19Mxp9XO9ZCmm4rnt08s8iT1xV8XYRGAShOXhWSifLTuLQmmKGXBjYd+eSTIbfl7kSTHyfX0DFhtddmRpaT+jCdGZ6+uAiK50DwApUavbHXmXfIaYoVwJlB4NArZiqD/l8HH98b/h7IlJ6D070khbbAsgxS2qjYIqw525oJjRstgyWOzSrxinnQGBLA/c+HyaFjVSjtODrpcq1oqGGM2y/Wa1/Ovk8iaKcDJPNsRTS3NNQlo5QhSaizFg5PECgt8G7ZCSpdyBwyoDONaR5ne2h0YPOVXeO3ipfdTQheaa40EAlyD0XT/Le4OpcMhNG9I7He0yx+2m6sYcEQ/VJbHzICRS6zhRebiIDXKg6nZx/MRXtzC59ldw1yBHzUf5/ghq2pDIas6e4Nw0QDH2hphR5iCUjzsoXKhkBd8lhvHYBOA== 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:(13230031)(366004)(346002)(396003)(136003)(39860400002)(376002)(230922051799003)(230173577357003)(230273577357003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(36756003)(86362001)(107886003)(1076003)(2616005)(6506007)(6512007)(6666004)(4326008)(478600001)(6486002)(8936002)(8676002)(316002)(66899024)(66476007)(83380400001)(66556008)(66946007)(6916009)(41300700001)(2906002)(30864003)(44832011)(5660300002)(2004002)(559001)(579004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: E6oyT6Gv0y9XZzO50v4gYkq2JNC+We+c+E3REMafdle3/vKQIKSIjWDMSsNtEAKCZTGvZfhBtiejLiZnQg6gF3TVndmeddmZ0F9J3AhMDFgwP74TyMcCHlnbuMtDswXmwvR3ubtJelvIPJHBqt0ilL4sUyi7XupADY8PnzrMIK/4b5TOZiyvB+3cJ2+n3qiptst6ssfaMA8LIDzNkKuQfgwE7DcQga9LcIHFIPJgiVtVvBGfsbjBzBgnbEMF0Wbx984oEwzPTzPCYw9pdo2kgwkYgKap0atpPjE06xQavl4X7mZguKh2c9Q/7cZQXtUI9lRLLRX89LDTTst3oZdiTkv7r85SW7kGpbevdmGbp+O5njLdxpatCVgg7t7BtrWxrBEDfeuZiqmoXWED0geMgtP8JFZ+x6c8HqKGMSaLQTdegRvDxFiHhemgQnE7yXqllICV/3keGSA18EkDmnqJzbzKUQJ1P5843z2UKZqHCvsiRY6DOohu/QKFtkDiHvW0s1wP057Mz+rPyMe2n8qNl3U7Y6ROSslNnQ8dUE74NIZL8G8qis41gq/RbgKDwp+ep/xOfQOtwZmhuWHumnCoX2c9ANz+E1pdwyi5yeuuBzUYdsfLEwV0aE6r3qacWEHsiL1sOGIpQG1aPZuoAOQFstH6SOl4rX5WHYBvXyeKYUTSEc0SG8OV/e2ra5j9CBxEsQgw89CvoOnxESorZt8dt7Z+rul8GldRcd1LgN3S+xX25Yyj+ZNIpFYqYDjNNV1T53JTrllF8ijeS7AEhaSFS8PiselreknpThnBEt5Il6ukZA1U/InSQcdaxkzDskjUnoAJ3Sgx0g8VG/nB0nGOrGgKXywgCfqURIoVkCkigBBagc5FDkvM01rMjM41zglDKF+Dr3fTPRE5W/l6qNEpo+ihR9skiA5Hnz2ypHRLdbNLCth2t0YFGVnklHBnRZEIHmstXpsWo4AyMUH37/ZstjRbArxnQHrFfwzPbGwM78gH5ZQkipc6CgLG5qkW5AZAsmBHGuiC6rcvxVToRLmj1wrZEdzLyRuY6a7aK4VtO5fRwX3oshR8Z+FTFhEKGLUhfQ9ajYHBcQuWy1G6mc7e/52QKw2Qv5IRQb4YiYBGwXFH/Lpqf3LJ0G1dbaMML+f4yjQnIRAjOLDWKThqkOgFh8tnbuw9J0E2xuzTJhGaVW4CmBQ4bEYY93+LgkgKP3ytv8KdPuOugq2HZ+o+/L0wFq7AHNi1SrY3XDaD1YI3WJIzCVtVrBjWmDRlFvzATmlj4KAGGvgkFp2IMomLTiOi8gviVUowl/OhrRK3+zD0lmD1GODcGIYG5OqpfxKwKwUwSgmD7i99CvP4jLQGUdY9EsM5I7g1g3b8TEbF0YeUfhM/3HDsNQ3AL5BEmQ5IqG6+qzwSdRnQaeOXqK6ScT32T0F82tyMhrZTysqgeFKuNaWdRZuU2sm3pGhq7Mrtdl2tDiLkNn56cR0YgLvjTObW0rY2GJqD3N9+r6qa1lkHJO4MDFjMOrgmI9PznWTIFEDINjVdmmcwyOoTjM0YNmH/Pr76YzN97/AmY/2/MfymIvqvaQU8zRyNmvOth6g6o15aM5n8WS/vWrJLIDl18YJPMxUEbBhpePdsBMmwOKZj2kE= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: tYUWmXhUD5iN1aC1DQGKy6K3jljI+tlvLwXLo2OxU5evA7/RVDGzfyCxN9C/uDg1sF0XQKo/ScWVaAVowzHn05RoqhWGejJyK6FHY7MJvDfw3t8XVSLbvZ6rO6tU9JI0vQX1NRwwDM7aepuZ5AUKnhHUp6PZGguY6Ww7Q6RipJ7xLQ9u0h+v+4Ux4uMRzstmJPFHAUNp7lilL1ZjwOFY3G9yQDiPTFYKAPo4ETxngcSdWmGJuZNvQM5oYr9GAwdl3Ksb/oXa0rPA/M/07hp8yPX5vxgrIcNk3b8RZ+Q1f+TyWTLhmqaXWNxRBYpqu+3qCHnbU5fdu1EXt2Xx4DoAN+ZGanKaVzaRABqcjSc8giJqXJuhT7fi15GI55n8CdyQFJFpRB92khpYOv/LVMh5R8Rwz4TJWLjHcYYExJE/dvhAF3emH/9oniE0xmsgvXCazo0EAQu9BNqg5iEbxppspOnF/GjNZYRTjKDIdPAfffc6ZURrvktcodKt8DjtxXRJhL666coNF5IP1C3xgZJ08NDhuQqU0VVZzkLlZ9PUdrytqdyLRwy9iDRJ1zCbzKoeTxjiUn/++i17zu84KTrD/SgMFN5L7zMW6AYEHiridzc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b97831f-6871-4051-324e-08dc0c2bd281 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2024 07:15:53.7025 (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: kZImHKS4TFEplHm4GLkyRoqyqzXZS4TyTDaYxWG09MvFLwRioStkKzZ07SsVSqxVD64HW64kfIQHrUEJVCmujQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB6777 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-03_02,2024-01-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 malwarescore=0 mlxscore=0 bulkscore=0 adultscore=0 suspectscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401030059 X-Proofpoint-GUID: cVFLdrwgMnf6ob6tRs3fB-GpZ4sBGlw7 X-Proofpoint-ORIG-GUID: cVFLdrwgMnf6ob6tRs3fB-GpZ4sBGlw7 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.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org [Changes from V3 to V4] - x86 backend: detect if any unhandled instuctions affect the stack pointer implicitly. Bail out if so. - x86 backend: get rid of insn as argument in all calls for ginsn creation. - x86 backend: bugfix in add insn translation. - scfi: ginsn: all symbol usages are const. Update args to reflect the same. - scfi: ginsn: print info about GINSN_TYPE_OTHER in ginsn_print (). - scfi: include GINSN_TYPE_OTHER in handling to detect stack pointer update. - scfi: treat failures in SCFI forward and backward passes as errors. - Fix build failure with --target=x86_64-w64-mingw32 (reported by Nick) by guarding the offending construct with (OBJ_ELF || MAYBE_OBJ_ELF). - ginsn: Add new API gcfg_print () to print CFG for (development time) debugging. - gas: hand-crafting instructions with .byte together with SCFI is not supported. - Other code comments fixup. [End of changes from V3 to V4] [Changes from V2 to V3] - Some bugfixes in the SCFI machinery. - Addressed most of Jan's review comments. Few highlights: + Handle more instructions: LOOP*, J{E,R}CXZ, ENTER, opcodes 0x3 and 0x2b and 0x8a, popf. + Removed some gas_assert, now that we have more clarity on how to completely handle all variants of some opcodes. + Handled some specific cases brought up in the review (e.g., add %eax, symbol etc.) + Add operand size override for all push/pop variants: push reg, pop reg, push fs, push gs, push imm, push from mem, pop to mem. + Add a new function to skip some instructions from SCFI: Skip cmp and test insns. + ginsn representation: Use offsetT datatype for imm/disp, use unsigned int for reg. Rename some args from src_val to use a more appropriate name of src_reg. + Other improvements in code layout, code comments and formatting. Added a comment with x86_ginsn_new () for explaining what instructions are necessary to be visited for SCFI and other details. + Other review comments. - Pending items: + "Adjust the config/tc-i386.h such that e.g. COFF targets don't needlessly have a large set of dead code compiled in." + Streamline comments in scfi.c so that all constraints are easy to find. [End of changes from V2 to V3] This patch adds support in GAS to create generic GAS instructions (a.k.a., the ginsn) for the x86 backend (AMD64 ABI only at this time). Using this ginsn infrastructure, GAS can then synthesize CFI for hand-written asm for x86_64. A ginsn is a target-independent representation of the machine instructions. One machine instruction may need one or more ginsn. This patch also adds skeleton support for printing ginsn in the listing output for debugging purposes. Since the current use-case of ginsn is to synthesize CFI, the x86 target needs to generate ginsns necessary for the following machine instructions only: - All change of flow instructions, including all conditional and unconditional branches, call and return from functions. - All register saves and unsaves to the stack. - All instructions affecting the two registers that could potentially be used as the base register for CFA tracking. For SCFI, the base register for CFA tracking is limited to REG_SP and REG_FP only for now. The representation of ginsn is kept simple: - GAS instruction has GINSN_NUM_SRC_OPNDS (defined to be 2 at this time) number of source operands and one destination operand at this time. - GAS instruction uses DWARF register numbers in its representation and does not track register size. - GAS instructions carry location information (file name and line number). - GAS instructions are ID's with a natural number in order of their addtion to the list. This can be used as a proxy for the static program order of the corresponding machine instructions. Note that, GAS instruction (ginsn) format does not support GINSN_TYPE_PUSH and GINSN_TYPE_POP. Some architectures, like aarch64, do not have push and pop instructions, but rather STP/LDP/STR/LDR etc. instructions. Further these instructions have a variety of addressing modes, like offset, pre-indexing and post-indexing etc. Among other things, one of differences in these addressing modes is _when_ the addr register is updated with the result of the address calculation: before or after the memory operation. To best support such needs, the generic instructions like GINSN_TYPE_LOAD, GINSN_TYPE_STORE together with GINSN_TYPE_ADD, and GINSN_TYPE_SUB may be used. The functionality provided in ginsn.c and scfi.c is compiled in when a target defines TARGET_USE_SCFI and TARGET_USE_GINSN. This can be revisited later when there are other use-cases of creating ginsn's in GAS, apart from the current use-case of synthesizing CFI for hand-written asm. Support is added only for AMD64 ABI at this time. If the user specifies, --scfi --32, GAS issues an error: "Fatal error: Synthesizing CFI is not supported for this ABI" For synthesizing (DWARF) CFI, the SCFI machinery requires the programmer to adhere to some pre-requisites for their asm: - Hand-written asm block must begin with a .type foo, @function It is highly recommended to, additionally, also ensure that: - Hand-written asm block ends with a .size foo, .-foo The SCFI machinery encodes some rules which align with the standard calling convention specified by the ABI. Apart from the rules, the SCFI machinery employs some heuristics. For example: - The base register for CFA tracking may be either REG_SP or REG_FP. - If the base register for CFA tracking is REG_SP, the precise amount of stack usage (and hence, the value of REG_SP) must be known at all times. - If using dynamic stack allocation, the function must switch to FP-based CFA. This means using instructions like the following (in AMD64) in prologue: pushq %rbp movq %rsp, %rbp and analogous instructions in epilogue. - Save and Restore of callee-saved registers must be symmetrical. However, the SCFI machinery at this time only warns if any such asymmetry is seen. These heuristics/rules are architecture-independent and are meant to employed for all architectures/ABIs using SCFI in the future. gas/ * Makefile.am: Add new files. * Makefile.in: Regenerated. * as.c (defined): Handle documentation and listing option for ginsns and SCFI. * config/obj-elf.c (obj_elf_size): Invoke ginsn_data_end. (obj_elf_type): Invoke ginsn_data_begin. * config/tc-i386.c (x86_scfi_callee_saved_p): New function. (ginsn_prefix_66H_p): Likewise. (ginsn_dw2_regnum): Likewise. (x86_ginsn_addsub_reg_mem): Likewise. (x86_ginsn_addsub_mem_reg): Likewise. (x86_ginsn_alu_imm): Likewise. (x86_ginsn_move): Likewise. (x86_ginsn_lea): Likewise. (x86_ginsn_jump): Likewise. (x86_ginsn_jump_cond): Likewise. (x86_ginsn_enter): Likewise. (x86_ginsn_safe_to_skip): Likewise. (x86_ginsn_unhandled): Likewise. (x86_ginsn_new): New functionality to generate ginsns. (md_assemble): Invoke x86_ginsn_new. (s_insn): Likewise. (i386_target_format): Add hard error for usage of --scfi with non AMD64 ABIs. * config/tc-i386.h (TARGET_USE_GINSN): New definition. (TARGET_USE_SCFI): Likewise. (SCFI_MAX_REG_ID): Likewise. (REG_FP): Likewise. (REG_SP): Likewise. (SCFI_INIT_CFA_OFFSET): Likewise. (SCFI_CALLEE_SAVED_REG_P): Likewise. (x86_scfi_callee_saved_p): Likewise. * gas/listing.h (LISTING_GINSN_SCFI): New define for ginsn and SCFI. * gas/read.c (read_a_source_file): Close SCFI processing at end of file read. * gas/scfidw2gen.c (scfi_process_cfi_label): Add implementation. (scfi_process_cfi_signal_frame): Likewise. * subsegs.h (struct frch_ginsn_data): New forward declaration. (struct frchain): New member for ginsn data. * gas/subsegs.c (subseg_set_rest): Initialize the new member. * symbols.c (colon): Invoke ginsn_frob_label to convey user-defined labels to ginsn infrastructure. * ginsn.c: New file. * ginsn.h: New file. * scfi.c: New file. * scfi.h: New file. --- gas/Makefile.am | 4 + gas/Makefile.in | 19 +- gas/as.c | 5 + gas/config/obj-elf.c | 16 + gas/config/tc-i386.c | 996 +++++++++++++++++++++++++++++++++ gas/config/tc-i386.h | 21 + gas/ginsn.c | 1259 ++++++++++++++++++++++++++++++++++++++++++ gas/ginsn.h | 384 +++++++++++++ gas/listing.h | 1 + gas/read.c | 10 + gas/scfi.c | 1232 +++++++++++++++++++++++++++++++++++++++++ gas/scfi.h | 38 ++ gas/scfidw2gen.c | 28 +- gas/subsegs.c | 1 + gas/subsegs.h | 2 + gas/symbols.c | 3 + 16 files changed, 4009 insertions(+), 10 deletions(-) create mode 100644 gas/ginsn.c create mode 100644 gas/ginsn.h create mode 100644 gas/scfi.c create mode 100644 gas/scfi.h diff --git a/gas/Makefile.am b/gas/Makefile.am index e174305ca62..b477d74cb53 100644 --- a/gas/Makefile.am +++ b/gas/Makefile.am @@ -82,6 +82,7 @@ GAS_CFILES = \ flonum-mult.c \ frags.c \ gen-sframe.c \ + ginsn.c \ hash.c \ input-file.c \ input-scrub.c \ @@ -94,6 +95,7 @@ GAS_CFILES = \ remap.c \ sb.c \ scfidw2gen.c \ + scfi.c \ sframe-opt.c \ stabs.c \ subsegs.c \ @@ -119,6 +121,7 @@ HFILES = \ flonum.h \ frags.h \ gen-sframe.h \ + ginsn.h \ hash.h \ input-file.h \ itbl-lex.h \ @@ -130,6 +133,7 @@ HFILES = \ read.h \ sb.h \ scfidw2gen.h \ + scfi.h \ subsegs.h \ symbols.h \ tc.h \ diff --git a/gas/Makefile.in b/gas/Makefile.in index fe9f4e06195..90f6bc224de 100644 --- a/gas/Makefile.in +++ b/gas/Makefile.in @@ -173,12 +173,13 @@ am__objects_1 = app.$(OBJEXT) as.$(OBJEXT) atof-generic.$(OBJEXT) \ ecoff.$(OBJEXT) ehopt.$(OBJEXT) expr.$(OBJEXT) \ flonum-copy.$(OBJEXT) flonum-konst.$(OBJEXT) \ flonum-mult.$(OBJEXT) frags.$(OBJEXT) gen-sframe.$(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) scfidw2gen.$(OBJEXT) \ - sframe-opt.$(OBJEXT) stabs.$(OBJEXT) subsegs.$(OBJEXT) \ - symbols.$(OBJEXT) write.$(OBJEXT) + ginsn.$(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) \ + scfidw2gen.$(OBJEXT) scfi.$(OBJEXT) sframe-opt.$(OBJEXT) \ + stabs.$(OBJEXT) subsegs.$(OBJEXT) symbols.$(OBJEXT) \ + write.$(OBJEXT) am_as_new_OBJECTS = $(am__objects_1) am__dirstamp = $(am__leading_dot)dirstamp as_new_OBJECTS = $(am_as_new_OBJECTS) @@ -581,6 +582,7 @@ GAS_CFILES = \ flonum-mult.c \ frags.c \ gen-sframe.c \ + ginsn.c \ hash.c \ input-file.c \ input-scrub.c \ @@ -593,6 +595,7 @@ GAS_CFILES = \ remap.c \ sb.c \ scfidw2gen.c \ + scfi.c \ sframe-opt.c \ stabs.c \ subsegs.c \ @@ -617,6 +620,7 @@ HFILES = \ flonum.h \ frags.h \ gen-sframe.h \ + ginsn.h \ hash.h \ input-file.h \ itbl-lex.h \ @@ -628,6 +632,7 @@ HFILES = \ read.h \ sb.h \ scfidw2gen.h \ + scfi.h \ subsegs.h \ symbols.h \ tc.h \ @@ -1336,6 +1341,7 @@ distclean-compile: @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)/ginsn.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@ @@ -1350,6 +1356,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)/scfi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scfidw2gen.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@ diff --git a/gas/as.c b/gas/as.c index 953b9bc0b99..da85525ab48 100644 --- a/gas/as.c +++ b/gas/as.c @@ -45,6 +45,7 @@ #include "codeview.h" #include "bfdver.h" #include "write.h" +#include "ginsn.h" #ifdef HAVE_ITBL_CPU #include "itbl-ops.h" @@ -245,6 +246,7 @@ Options:\n\ d omit debugging directives\n\ g include general info\n\ h include high-level source\n\ + i include ginsn and synthesized CFI info\n\ l include assembly\n\ m include macro expansions\n\ n omit forms processing\n\ @@ -1089,6 +1091,9 @@ This program has absolutely no warranty.\n")); case 'h': listing |= LISTING_HLL; break; + case 'i': + listing |= LISTING_GINSN_SCFI; + break; case 'l': listing |= LISTING_LISTING; break; diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index 1b77b2715d1..6aa9376c5a7 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -24,6 +24,7 @@ #include "subsegs.h" #include "obstack.h" #include "dwarf2dbg.h" +#include "ginsn.h" #ifndef ECOFF_DEBUGGING #define ECOFF_DEBUGGING 0 @@ -2311,6 +2312,13 @@ obj_elf_size (int ignore ATTRIBUTE_UNUSED) symbol_get_obj (sym)->size = XNEW (expressionS); *symbol_get_obj (sym)->size = exp; } + + /* If the symbol in the directive matches the current function being + processed, indicate end of the current stream of ginsns. */ + if (flag_synth_cfi + && S_IS_FUNCTION (sym) && sym == ginsn_data_func_symbol ()) + ginsn_data_end (symbol_temp_new_now ()); + demand_empty_rest_of_line (); } @@ -2499,6 +2507,14 @@ obj_elf_type (int ignore ATTRIBUTE_UNUSED) elfsym->symbol.flags &= ~mask; } + if (S_IS_FUNCTION (sym) && flag_synth_cfi) + { + /* Wrap up processing the previous block of ginsns first. */ + if (frchain_now->frch_ginsn_data) + ginsn_data_end (symbol_temp_new_now ()); + ginsn_data_begin (sym); + } + demand_empty_rest_of_line (); } diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 694c494edec..d76765c2bb5 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 "scfi.h" #include "gen-sframe.h" #include "sframe.h" #include "elf/x86-64.h" @@ -5287,6 +5288,978 @@ static INLINE bool may_need_pass2 (const insn_template *t) && t->base_opcode == 0x63); } +bool +x86_scfi_callee_saved_p (unsigned int dw2reg_num) +{ + if (dw2reg_num == 3 /* rbx. */ + || dw2reg_num == REG_FP /* rbp. */ + || dw2reg_num == REG_SP /* rsp. */ + || (dw2reg_num >= 12 && dw2reg_num <= 15) /* r12 - r15. */) + return true; + + return false; +} + +/* Check whether a '66H' prefix accompanies the instruction. + The current users of this API are in the handlers for PUSH, POP + instructions. These instructions affect the stack pointer implicitly: the + operand size (16, 32, or 64 bits) determines the amount by which the stack + pointer is decremented (2, 4 or 8). When '66H' prefix is present, the + instruction has a 16-bit operand. */ + +static bool +ginsn_prefix_66H_p (i386_insn insn) +{ + return (insn.prefix[DATA_PREFIX] == 0x66); +} + +/* Get the DWARF register number for the given register entry. + For specific byte/word register accesses like al, cl, ah, ch, r8dyte etc., + there is no valid DWARF register number. This function is a hack - it + relies on relative ordering of reg entries in the i386_regtab. FIXME - it + will be good to allow a more direct way to get this information. */ + +static unsigned int +ginsn_dw2_regnum (const reg_entry *ireg) +{ + /* PS: Note the data type here as int32_t, because of Dw2Inval (-1). */ + int32_t dwarf_reg = Dw2Inval; + const reg_entry *temp = ireg; + + /* ginsn creation is available for AMD64 abi only ATM. Other flag_code + are not expected. */ + gas_assert (flag_code == CODE_64BIT); + + if (ireg <= &i386_regtab[3]) + /* For al, cl, dl, bl, bump over to axl, cxl, dxl, bxl respectively by + adding 8. */ + temp = ireg + 8; + else if (ireg <= &i386_regtab[7]) + /* For ah, ch, dh, bh, bump over to axl, cxl, dxl, bxl respectively by + adding 4. */ + temp = ireg + 4; + + dwarf_reg = temp->dw2_regnum[flag_code >> 1]; + if (dwarf_reg == Dw2Inval) + { + /* The code relies on the relative ordering of the reg entries in + i386_regtab. The assertion here ensures the code does not recurse + indefinitely. */ + gas_assert (temp + 16 < &i386_regtab[i386_regtab_size - 1]); + temp = temp + 16; + dwarf_reg = ginsn_dw2_regnum (temp); + } + + gas_assert (dwarf_reg != Dw2Inval); /* Needs to be addressed. */ + + return (unsigned int) dwarf_reg; +} + +static ginsnS * +x86_ginsn_addsub_reg_mem (const symbolS *insn_end_sym) +{ + unsigned int dw2_regnum; + unsigned int src2_dw2_regnum; + ginsnS *ginsn = NULL; + ginsnS * (*ginsn_func) (const symbolS *, bool, + enum ginsn_src_type, unsigned int, offsetT, + enum ginsn_src_type, unsigned int, offsetT, + enum ginsn_dst_type, unsigned int, offsetT); + uint16_t opcode = i.tm.base_opcode; + + gas_assert (opcode == 0x1 || opcode == 0x29); + ginsn_func = (opcode == 0x1) ? ginsn_new_add : ginsn_new_sub; + + /* op %reg, symbol. */ + if (i.mem_operands == 1 && !i.base_reg && !i.index_reg) + return ginsn; + + /* op reg, reg/mem. */ + dw2_regnum = ginsn_dw2_regnum (i.op[0].regs); + if (i.reg_operands == 2) + { + src2_dw2_regnum = ginsn_dw2_regnum (i.op[1].regs); + ginsn = ginsn_func (insn_end_sym, true, + GINSN_SRC_REG, dw2_regnum, 0, + GINSN_SRC_REG, src2_dw2_regnum, 0, + GINSN_DST_REG, src2_dw2_regnum, 0); + ginsn_set_where (ginsn); + } + /* Other cases where destination involves indirect access are unnecessary + for SCFI correctness. TBD_GINSN_GEN_NOT_SCFI. */ + + return ginsn; +} + +static ginsnS * +x86_ginsn_addsub_mem_reg (const symbolS *insn_end_sym) +{ + unsigned int dw2_regnum; + unsigned int src2_dw2_regnum; + const reg_entry *mem_reg; + int32_t gdisp = 0; + ginsnS *ginsn = NULL; + ginsnS * (*ginsn_func) (const symbolS *, bool, + enum ginsn_src_type, unsigned int, offsetT, + enum ginsn_src_type, unsigned int, offsetT, + enum ginsn_dst_type, unsigned int, offsetT); + uint16_t opcode = i.tm.base_opcode; + + gas_assert (opcode == 0x3 || opcode == 0x2b); + ginsn_func = (opcode == 0x3) ? ginsn_new_add : ginsn_new_sub; + + /* op symbol, %reg. */ + if (i.mem_operands && !i.base_reg && !i.index_reg) + return ginsn; + /* op mem, %reg. */ + dw2_regnum = ginsn_dw2_regnum (i.op[1].regs); + + if (i.mem_operands) + { + mem_reg = (i.base_reg) ? i.base_reg : i.index_reg; + src2_dw2_regnum = ginsn_dw2_regnum (mem_reg); + if (i.disp_operands == 1) + gdisp = i.op[0].disps->X_add_number; + ginsn = ginsn_func (insn_end_sym, true, + GINSN_SRC_INDIRECT, src2_dw2_regnum, gdisp, + GINSN_SRC_REG, dw2_regnum, 0, + GINSN_DST_REG, dw2_regnum, 0); + ginsn_set_where (ginsn); + } + + return ginsn; +} + +static ginsnS * +x86_ginsn_alu_imm (const symbolS *insn_end_sym) +{ + offsetT src_imm; + unsigned int dw2_regnum; + ginsnS *ginsn = NULL; + enum ginsn_src_type src_type = GINSN_SRC_REG; + enum ginsn_dst_type dst_type = GINSN_DST_REG; + + ginsnS * (*ginsn_func) (const symbolS *, bool, + enum ginsn_src_type, unsigned int, offsetT, + enum ginsn_src_type, unsigned int, offsetT, + enum ginsn_dst_type, unsigned int, offsetT); + + /* FIXME - create ginsn where dest is REG_SP / REG_FP only ? */ + /* Map for insn.tm.extension_opcode + 000 ADD 100 AND + 001 OR 101 SUB + 010 ADC 110 XOR + 011 SBB 111 CMP */ + + /* add/sub/and imm, %reg only at this time for SCFI. + Although all three (and, or , xor) make the destination reg untraceable, + and op is handled but not or/xor because we will look into supporting + the DRAP pattern at some point. */ + if (i.tm.extension_opcode == 5) + ginsn_func = ginsn_new_sub; + else if (i.tm.extension_opcode == 4) + ginsn_func = ginsn_new_and; + else if (i.tm.extension_opcode == 0) + ginsn_func = ginsn_new_add; + else + return ginsn; + + /* TBD_GINSN_REPRESENTATION_LIMIT: There is no representation for when a + symbol is used as an operand, like so: + addq $simd_cmp_op+8, %rdx + Skip generating any ginsn for this. */ + if (i.imm_operands == 1 + && i.op[0].imms->X_op != O_constant) + return ginsn; + + /* addq $1, symbol + addq $1, -16(%rbp) + Such instructions are not of interest for SCFI. */ + if (i.mem_operands == 1) + return ginsn; + + gas_assert (i.imm_operands == 1); + src_imm = i.op[0].imms->X_add_number; + /* The second operand may be a register or indirect access. For SCFI, only + the case when the second opnd is a register is interesting. Revisit this + if generating ginsns for a different gen mode TBD_GINSN_GEN_NOT_SCFI. */ + if (i.reg_operands == 1) + { + dw2_regnum = ginsn_dw2_regnum (i.op[1].regs); + /* For ginsn, keep the imm as second src operand. */ + ginsn = ginsn_func (insn_end_sym, true, + src_type, dw2_regnum, 0, + GINSN_SRC_IMM, 0, src_imm, + dst_type, dw2_regnum, 0); + + ginsn_set_where (ginsn); + } + + return ginsn; +} + +static ginsnS * +x86_ginsn_move (const symbolS *insn_end_sym) +{ + ginsnS *ginsn; + unsigned int dst_reg; + unsigned int src_reg; + offsetT src_disp = 0; + offsetT dst_disp = 0; + const reg_entry *dst = NULL; + const reg_entry *src = NULL; + uint16_t opcode = i.tm.base_opcode; + enum ginsn_src_type src_type = GINSN_SRC_REG; + enum ginsn_dst_type dst_type = GINSN_DST_REG; + + if (opcode == 0x8b || opcode == 0x8a) + { + /* mov disp(%reg), %reg. */ + if (i.mem_operands && i.base_reg) + { + src = i.base_reg; + if (i.disp_operands == 1) + src_disp = i.op[0].disps->X_add_number; + src_type = GINSN_SRC_INDIRECT; + } + else + src = i.op[0].regs; + + dst = i.op[1].regs; + } + else if (opcode == 0x89 || opcode == 0x88) + { + /* mov %reg, disp(%reg). */ + src = i.op[0].regs; + if (i.mem_operands && i.base_reg) + { + dst = i.base_reg; + if (i.disp_operands == 1) + dst_disp = i.op[1].disps->X_add_number; + dst_type = GINSN_DST_INDIRECT; + } + else + dst = i.op[1].regs; + } + + src_reg = ginsn_dw2_regnum (src); + dst_reg = ginsn_dw2_regnum (dst); + + ginsn = ginsn_new_mov (insn_end_sym, true, + src_type, src_reg, src_disp, + dst_type, dst_reg, dst_disp); + ginsn_set_where (ginsn); + + return ginsn; +} + +/* Generate appropriate ginsn for lea. + Sub-cases marked with TBD_GINSN_INFO_LOSS indicate some loss of information + in the ginsn. But these are fine for now for GINSN_GEN_SCFI generation + mode. */ + +static ginsnS * +x86_ginsn_lea (const symbolS *insn_end_sym) +{ + offsetT src_disp = 0; + ginsnS *ginsn = NULL; + unsigned int base_reg; + unsigned int index_reg; + offsetT index_scale; + unsigned int dst_reg; + + if (!i.index_reg && !i.base_reg) + { + /* lea symbol, %rN. */ + dst_reg = ginsn_dw2_regnum (i.op[1].regs); + /* TBD_GINSN_INFO_LOSS - Skip encoding information about the symbol. */ + ginsn = ginsn_new_mov (insn_end_sym, false, + GINSN_SRC_IMM, 0xf /* arbitrary const. */, 0, + GINSN_DST_REG, dst_reg, 0); + } + else if (i.base_reg && !i.index_reg) + { + /* lea -0x2(%base),%dst. */ + base_reg = ginsn_dw2_regnum (i.base_reg); + dst_reg = ginsn_dw2_regnum (i.op[1].regs); + + if (i.disp_operands) + src_disp = i.op[0].disps->X_add_number; + + if (src_disp) + /* Generate an ADD ginsn. */ + ginsn = ginsn_new_add (insn_end_sym, true, + GINSN_SRC_REG, base_reg, 0, + GINSN_SRC_IMM, 0, src_disp, + GINSN_DST_REG, dst_reg, 0); + else + /* Generate a MOV ginsn. */ + ginsn = ginsn_new_mov (insn_end_sym, true, + GINSN_SRC_REG, base_reg, 0, + GINSN_DST_REG, dst_reg, 0); + } + else if (!i.base_reg && i.index_reg) + { + /* lea (,%index,imm), %dst. */ + /* TBD_GINSN_INFO_LOSS - There is no explicit ginsn multiply operation, + instead use GINSN_TYPE_OTHER. */ + index_scale = i.log2_scale_factor; + index_reg = ginsn_dw2_regnum (i.index_reg); + dst_reg = ginsn_dw2_regnum (i.op[1].regs); + ginsn = ginsn_new_other (insn_end_sym, true, + GINSN_SRC_REG, index_reg, + GINSN_SRC_IMM, index_scale, + GINSN_DST_REG, dst_reg); + } + else + { + /* lea disp(%base,%index,imm) %dst. */ + /* TBD_GINSN_INFO_LOSS - Skip adding information about the disp and imm + for index reg. */ + base_reg = ginsn_dw2_regnum (i.base_reg); + index_reg = ginsn_dw2_regnum (i.index_reg); + dst_reg = ginsn_dw2_regnum (i.op[1].regs); + /* Generate an ADD ginsn. */ + ginsn = ginsn_new_add (insn_end_sym, true, + GINSN_SRC_REG, base_reg, 0, + GINSN_SRC_REG, index_reg, 0, + GINSN_DST_REG, dst_reg, 0); + } + + ginsn_set_where (ginsn); + + return ginsn; +} + +static ginsnS * +x86_ginsn_jump (const symbolS *insn_end_sym) +{ + ginsnS *ginsn = NULL; + symbolS *src_symbol; + + gas_assert (i.disp_operands == 1); + + /* A non-zero addend in jump target makes control-flow tracking difficult. + Skip SCFI for now. */ + if (i.op[0].disps->X_op == O_symbol && i.op[0].disps->X_add_number) + { + as_bad ("SCFI: jmp insn with non-zero addend to sym not supported"); + return ginsn; + } + + if (i.op[0].disps->X_op == O_symbol) + { + gas_assert (!i.op[0].disps->X_add_number); + src_symbol = i.op[0].disps->X_add_symbol; + ginsn = ginsn_new_jump (insn_end_sym, true, + GINSN_SRC_SYMBOL, 0, src_symbol); + + ginsn_set_where (ginsn); + } + + return ginsn; +} + +static ginsnS * +x86_ginsn_jump_cond (const symbolS *insn_end_sym) +{ + ginsnS *ginsn = NULL; + symbolS *src_symbol; + + gas_assert (i.disp_operands == 1); + + /* A non-zero addend in JCC target makes control-flow tracking difficult. + Skip SCFI for now. */ + if (i.op[0].disps->X_op == O_symbol && i.op[0].disps->X_add_number) + { + as_bad ("SCFI: jcc insn with non-zero addend to sym not supported"); + return ginsn; + } + + if (i.op[0].disps->X_op == O_symbol) + { + gas_assert (i.op[0].disps->X_add_number == 0); + src_symbol = i.op[0].disps->X_add_symbol; + ginsn = ginsn_new_jump_cond (insn_end_sym, true, + GINSN_SRC_SYMBOL, 0, src_symbol); + ginsn_set_where (ginsn); + } + + return ginsn; +} + +static ginsnS * +x86_ginsn_enter (const symbolS *insn_end_sym) +{ + ginsnS *ginsn = NULL; + ginsnS *ginsn_next = NULL; + ginsnS *ginsn_last = NULL; + + gas_assert (i.imm_operands == 2); + + /* For non-zero size operands, bail out as untraceable for SCFI. */ + if ((i.op[0].imms->X_op != O_constant || i.op[0].imms->X_add_symbol != 0) + || (i.op[1].imms->X_op != O_constant || i.op[1].imms->X_add_symbol != 0)) + { + as_bad ("SCFI: enter insn with non-zero operand not supported"); + return ginsn; + } + + /* If the nesting level is 0, the processor pushes the frame pointer from + the BP/EBP/RBP register onto the stack, copies the current stack + pointer from the SP/ESP/RSP register into the BP/EBP/RBP register, and + loads the SP/ESP/RSP register with the current stack-pointer value + minus the value in the size operand. */ + ginsn = ginsn_new_sub (insn_end_sym, false, + GINSN_SRC_REG, REG_SP, 0, + GINSN_SRC_IMM, 0, 8, + GINSN_DST_REG, REG_SP, 0); + ginsn_set_where (ginsn); + ginsn_next = ginsn_new_store (insn_end_sym, false, + GINSN_SRC_REG, REG_FP, + GINSN_DST_INDIRECT, REG_SP, 0); + ginsn_set_where (ginsn_next); + gas_assert (!ginsn_link_next (ginsn, ginsn_next)); + ginsn_last = ginsn_new_mov (insn_end_sym, false, + GINSN_SRC_REG, REG_SP, 0, + GINSN_DST_REG, REG_FP, 0); + ginsn_set_where (ginsn_last); + gas_assert (!ginsn_link_next (ginsn_next, ginsn_last)); + + return ginsn; +} + +static bool +x86_ginsn_safe_to_skip (void) +{ + bool skip_p = false; + uint16_t opcode = i.tm.base_opcode; + + switch (opcode) + { + case 0x39: + if (i.tm.opcode_space != SPACE_BASE) + break; + /* cmp reg, reg. */ + skip_p = true; + break; + case 0x85: + /* test reg, reg/mem. */ + if (i.tm.opcode_space != SPACE_BASE) + break; + skip_p = true; + break; + default: + break; + } + + return skip_p; +} + +#define X86_GINSN_UNHANDLED_NONE 0 +#define X86_GINSN_UNHANDLED_DEST_REG 1 +#define X86_GINSN_UNHANDLED_CFG 2 +#define X86_GINSN_UNHANDLED_STACKOP 3 + +/* Check the input insn for its impact on the correctness of the synthesized + CFI. Returns an error code to the caller. */ + +static int +x86_ginsn_unhandled (void) +{ + int err = X86_GINSN_UNHANDLED_NONE; + const reg_entry *reg_op; + unsigned int dw2_regnum; + + /* Keep an eye out for instructions affecting control flow. */ + if (i.tm.opcode_modifier.jump) + err = X86_GINSN_UNHANDLED_CFG; + /* Also, for any instructions involving an implicit update to the stack + pointer. */ + else if (i.tm.opcode_modifier.implicitstackop) + err = X86_GINSN_UNHANDLED_STACKOP; + /* Finally, also check if the missed instructions are affecting REG_SP or + REG_FP. The destination operand is the last at all stages of assembly + (due to following AT&T syntax layout in the internal representation). In + case of Intel syntax input, this still remains true as swap_operands () + is done by now. + PS: These checks do not involve index / base reg, as indirect memory + accesses via REG_SP or REG_FP do not affect SCFI correctness. + (Also note these instructions are candidates for other ginsn generation + modes in future. TBD_GINSN_GEN_NOT_SCFI.) */ + else if (i.operands && i.reg_operands + && !(i.flags[i.operands - 1] & Operand_Mem)) + { + reg_op = i.op[i.operands - 1].regs; + if (reg_op) + { + dw2_regnum = ginsn_dw2_regnum (reg_op); + if (dw2_regnum == REG_SP || dw2_regnum == REG_FP) + err = X86_GINSN_UNHANDLED_DEST_REG; + } + } + + return err; +} + +/* Generate one or more generic GAS instructions, a.k.a, ginsns for the current + machine instruction. + + Returns the head of linked list of ginsn(s) added, if success; Returns NULL + if failure. + + The input ginsn_gen_mode GMODE determines the set of minimal necessary + ginsns necessary for correctness of any passes applicable for that mode. + For supporting the GINSN_GEN_SCFI generation mode, following is the list of + machine instructions that must be translated into the corresponding ginsns + to ensure correctness of SCFI: + - All instructions affecting the two registers that could potentially + be used as the base register for CFA tracking. For SCFI, the base + register for CFA tracking is limited to REG_SP and REG_FP only for + now. + - All change of flow instructions: conditional and unconditional branches, + call and return from functions. + - All instructions that can potentially be a register save / restore + operation. + - All instructions that perform stack manipulation implicitly: the CALL, + RET, PUSH, POP, ENTER, and LEAVE instructions. + + The function currently supports GINSN_GEN_SCFI ginsn generation mode only. + To support other generation modes will require work on this target-specific + process of creation of ginsns: + - Some of such places are tagged with TBD_GINSN_GEN_NOT_SCFI to serve as + possible starting points. + - Also note that ginsn representation may need enhancements. Specifically, + note some TBD_GINSN_INFO_LOSS and TBD_GINSN_REPRESENTATION_LIMIT markers. + */ + +static ginsnS * +x86_ginsn_new (const symbolS *insn_end_sym, enum ginsn_gen_mode gmode) +{ + int err = 0; + uint16_t opcode; + unsigned int dw2_regnum; + ginsnS *ginsn = NULL; + ginsnS *ginsn_next = NULL; + ginsnS *ginsn_last = NULL; + /* In 64-bit mode, the default stack update size is 8 bytes. */ + int stack_opnd_size = 8; + + /* Currently supports generation of selected ginsns, sufficient for + the use-case of SCFI only. */ + if (gmode != GINSN_GEN_SCFI) + return ginsn; + + opcode = i.tm.base_opcode; + + switch (opcode) + { + case 0x1: + /* add reg, reg/mem. */ + case 0x29: + if (i.tm.opcode_space != SPACE_BASE) + break; + /* sub reg, reg/mem. */ + ginsn = x86_ginsn_addsub_reg_mem (insn_end_sym); + break; + + case 0x3: + /* add reg/mem, reg. */ + case 0x2b: + if (i.tm.opcode_space != SPACE_BASE) + break; + /* sub reg/mem, reg. */ + ginsn = x86_ginsn_addsub_mem_reg (insn_end_sym); + break; + + case 0xa0: + case 0xa8: + /* push fs / push gs have opcode_space == SPACE_0F. */ + if (i.tm.opcode_space != SPACE_0F) + break; + dw2_regnum = ginsn_dw2_regnum (i.op[0].regs); + /* In 64-bit mode, presence of 66H prefix indicates 16-bit op. */ + if (flag_code == CODE_64BIT && ginsn_prefix_66H_p (i)) + stack_opnd_size = 2; + /* push fs / push gs. */ + ginsn = ginsn_new_sub (insn_end_sym, false, + GINSN_SRC_REG, REG_SP, 0, + GINSN_SRC_IMM, 0, stack_opnd_size, + GINSN_DST_REG, REG_SP, 0); + ginsn_set_where (ginsn); + ginsn_next = ginsn_new_store (insn_end_sym, false, + GINSN_SRC_REG, dw2_regnum, + GINSN_DST_INDIRECT, REG_SP, 0); + ginsn_set_where (ginsn_next); + gas_assert (!ginsn_link_next (ginsn, ginsn_next)); + break; + + case 0xa1: + case 0xa9: + /* pop fs / pop gs have opcode_space == SPACE_0F. */ + if (i.tm.opcode_space != SPACE_0F) + break; + dw2_regnum = ginsn_dw2_regnum (i.op[0].regs); + /* In 64-bit mode, presence of 66H prefix indicates 16-bit op. */ + if (flag_code == CODE_64BIT && ginsn_prefix_66H_p (i)) + stack_opnd_size = 2; + /* pop fs / pop gs. */ + ginsn = ginsn_new_load (insn_end_sym, false, + GINSN_SRC_INDIRECT, REG_SP, 0, + GINSN_DST_REG, dw2_regnum); + ginsn_set_where (ginsn); + ginsn_next = ginsn_new_add (insn_end_sym, false, + GINSN_SRC_REG, REG_SP, 0, + GINSN_SRC_IMM, 0, stack_opnd_size, + GINSN_DST_REG, REG_SP, 0); + ginsn_set_where (ginsn_next); + gas_assert (!ginsn_link_next (ginsn, ginsn_next)); + break; + + case 0x50 ... 0x57: + if (i.tm.opcode_space != SPACE_BASE) + break; + /* push reg. */ + dw2_regnum = ginsn_dw2_regnum (i.op[0].regs); + /* In 64-bit mode, presence of 66H prefix indicates 16-bit op. */ + if (flag_code == CODE_64BIT && ginsn_prefix_66H_p (i)) + stack_opnd_size = 2; + ginsn = ginsn_new_sub (insn_end_sym, false, + GINSN_SRC_REG, REG_SP, 0, + GINSN_SRC_IMM, 0, stack_opnd_size, + GINSN_DST_REG, REG_SP, 0); + ginsn_set_where (ginsn); + ginsn_next = ginsn_new_store (insn_end_sym, false, + GINSN_SRC_REG, dw2_regnum, + GINSN_DST_INDIRECT, REG_SP, 0); + ginsn_set_where (ginsn_next); + gas_assert (!ginsn_link_next (ginsn, ginsn_next)); + break; + + case 0x58 ... 0x5f: + if (i.tm.opcode_space != SPACE_BASE) + break; + /* pop reg. */ + dw2_regnum = ginsn_dw2_regnum (i.op[0].regs); + ginsn = ginsn_new_load (insn_end_sym, false, + GINSN_SRC_INDIRECT, REG_SP, 0, + GINSN_DST_REG, dw2_regnum); + ginsn_set_where (ginsn); + /* In 64-bit mode, presence of 66H prefix indicates 16-bit op. */ + if (flag_code == CODE_64BIT && ginsn_prefix_66H_p (i)) + stack_opnd_size = 2; + ginsn_next = ginsn_new_add (insn_end_sym, false, + GINSN_SRC_REG, REG_SP, 0, + GINSN_SRC_IMM, 0, stack_opnd_size, + GINSN_DST_REG, REG_SP, 0); + ginsn_set_where (ginsn_next); + gas_assert (!ginsn_link_next (ginsn, ginsn_next)); + break; + + case 0x6a: + case 0x68: + if (i.tm.opcode_space != SPACE_BASE) + break; + /* push imm8/imm16/imm32. */ + if (opcode == 0x6a) + stack_opnd_size = 1; + /* In 64-bit mode, presence of 66H prefix indicates 16-bit op. + However, this prefix may only be present when opcode is 0x68. */ + else if (flag_code == CODE_64BIT && ginsn_prefix_66H_p (i)) + stack_opnd_size = 2; + else + stack_opnd_size = 4; + /* Skip getting the value of imm from machine instruction + because this is not important for SCFI. */ + ginsn = ginsn_new_sub (insn_end_sym, false, + GINSN_SRC_REG, REG_SP, 0, + GINSN_SRC_IMM, 0, stack_opnd_size, + GINSN_DST_REG, REG_SP, 0); + ginsn_set_where (ginsn); + ginsn_next = ginsn_new_store (insn_end_sym, false, + GINSN_SRC_IMM, 0, + GINSN_DST_INDIRECT, REG_SP, 0); + ginsn_set_where (ginsn_next); + gas_assert (!ginsn_link_next (ginsn, ginsn_next)); + break; + + case 0x70 ... 0x7f: + if (i.tm.opcode_space != SPACE_BASE) + break; + ginsn = x86_ginsn_jump_cond (insn_end_sym); + break; + + case 0x80: + case 0x81: + case 0x83: + if (i.tm.opcode_space != SPACE_BASE) + break; + ginsn = x86_ginsn_alu_imm (insn_end_sym); + break; + + case 0x8a: + case 0x8b: + /* Move reg/mem, reg (8/16/32/64). */ + case 0x88: + case 0x89: + if (i.tm.opcode_space != SPACE_BASE) + break; + /* mov reg, reg/mem. (8/16/32/64). */ + ginsn = x86_ginsn_move (insn_end_sym); + break; + + case 0x8d: + if (i.tm.opcode_space != SPACE_BASE) + break; + /* lea disp(%src), %dst */ + ginsn = x86_ginsn_lea (insn_end_sym); + break; + + case 0x8f: + if (i.tm.opcode_space != SPACE_BASE) + break; + /* pop to mem. */ + gas_assert (i.base_reg); + dw2_regnum = ginsn_dw2_regnum (i.base_reg); + ginsn = ginsn_new_load (insn_end_sym, false, + GINSN_SRC_INDIRECT, REG_SP, 0, + GINSN_DST_INDIRECT, dw2_regnum); + ginsn_set_where (ginsn); + /* In 64-bit mode, presence of 66H prefix indicates 16-bit op. */ + if (flag_code == CODE_64BIT && ginsn_prefix_66H_p (i)) + stack_opnd_size = 2; + ginsn_next = ginsn_new_add (insn_end_sym, false, + GINSN_SRC_REG, REG_SP, 0, + GINSN_SRC_IMM, 0, stack_opnd_size, + GINSN_DST_REG, REG_SP, 0); + ginsn_set_where (ginsn_next); + gas_assert (!ginsn_link_next (ginsn, ginsn_next)); + break; + + case 0x9c: + if (i.tm.opcode_space != SPACE_BASE) + break; + /* pushf / pushfq. */ + /* In 64-bit mode, presence of 66H prefix indicates 16-bit op. */ + if (flag_code == CODE_64BIT && ginsn_prefix_66H_p (i)) + stack_opnd_size = 2; + ginsn = ginsn_new_sub (insn_end_sym, false, + GINSN_SRC_REG, REG_SP, 0, + GINSN_SRC_IMM, 0, stack_opnd_size, + GINSN_DST_REG, REG_SP, 0); + ginsn_set_where (ginsn); + /* Tracking EFLAGS register by number is not necessary. */ + ginsn_next = ginsn_new_store (insn_end_sym, false, + GINSN_SRC_IMM, 0, + GINSN_DST_INDIRECT, REG_SP, 0); + ginsn_set_where (ginsn_next); + gas_assert (!ginsn_link_next (ginsn, ginsn_next)); + break; + + case 0x9d: + if (i.tm.opcode_space != SPACE_BASE) + break; + /* popf / popfq. */ + /* In 64-bit mode, presence of 66H prefix indicates 16-bit op. */ + if (flag_code == CODE_64BIT && ginsn_prefix_66H_p (i)) + stack_opnd_size = 2; + /* FIXME - hardcode the actual DWARF reg number value. As for SCFI + correctness, although this behaves simply a placeholder value; its + just clearer if the value is correct. */ + dw2_regnum = 49; + ginsn = ginsn_new_load (insn_end_sym, false, + GINSN_SRC_INDIRECT, REG_SP, 0, + GINSN_DST_REG, dw2_regnum); + ginsn_set_where (ginsn); + ginsn_next = ginsn_new_add (insn_end_sym, false, + GINSN_SRC_REG, REG_SP, 0, + GINSN_SRC_IMM, 0, stack_opnd_size, + GINSN_DST_REG, REG_SP, 0); + ginsn_set_where (ginsn_next); + gas_assert (!ginsn_link_next (ginsn, ginsn_next)); + break; + + case 0xff: + if (i.tm.opcode_space != SPACE_BASE) + break; + /* push from mem. */ + if (i.tm.extension_opcode == 6) + { + /* In 64-bit mode, presence of 66H prefix indicates 16-bit op. */ + if (flag_code == CODE_64BIT && ginsn_prefix_66H_p (i)) + stack_opnd_size = 2; + ginsn = ginsn_new_sub (insn_end_sym, false, + GINSN_SRC_REG, REG_SP, 0, + GINSN_SRC_IMM, 0, stack_opnd_size, + GINSN_DST_REG, REG_SP, 0); + ginsn_set_where (ginsn); + /* These instructions have no imm, only indirect access. */ + gas_assert (i.base_reg); + dw2_regnum = ginsn_dw2_regnum (i.base_reg); + ginsn_next = ginsn_new_store (insn_end_sym, false, + GINSN_SRC_INDIRECT, dw2_regnum, + GINSN_DST_INDIRECT, REG_SP, 0); + ginsn_set_where (ginsn_next); + gas_assert (!ginsn_link_next (ginsn, ginsn_next)); + } + else if (i.tm.extension_opcode == 4) + { + /* jmp r/m. E.g., notrack jmp *%rax. */ + if (i.reg_operands) + { + dw2_regnum = ginsn_dw2_regnum (i.op[0].regs); + ginsn = ginsn_new_jump (insn_end_sym, true, + GINSN_SRC_REG, dw2_regnum, NULL); + ginsn_set_where (ginsn); + } + else if (i.mem_operands && i.index_reg) + { + /* jmp *0x0(,%rax,8). */ + dw2_regnum = ginsn_dw2_regnum (i.index_reg); + ginsn = ginsn_new_jump (insn_end_sym, true, + GINSN_SRC_REG, dw2_regnum, NULL); + ginsn_set_where (ginsn); + } + else if (i.mem_operands && i.base_reg) + { + dw2_regnum = ginsn_dw2_regnum (i.base_reg); + ginsn = ginsn_new_jump (insn_end_sym, true, + GINSN_SRC_REG, dw2_regnum, NULL); + ginsn_set_where (ginsn); + } + } + else if (i.tm.extension_opcode == 2) + { + /* 0xFF /2 (call). */ + if (i.reg_operands) + { + dw2_regnum = ginsn_dw2_regnum (i.op[0].regs); + ginsn = ginsn_new_call (insn_end_sym, true, + GINSN_SRC_REG, dw2_regnum, NULL); + ginsn_set_where (ginsn); + } + else if (i.mem_operands && i.base_reg) + { + dw2_regnum = ginsn_dw2_regnum (i.base_reg); + ginsn = ginsn_new_call (insn_end_sym, true, + GINSN_SRC_REG, dw2_regnum, NULL); + ginsn_set_where (ginsn); + } + } + break; + + case 0xc2: + case 0xc3: + if (i.tm.opcode_space != SPACE_BASE) + break; + /* Near ret. */ + ginsn = ginsn_new_return (insn_end_sym, true); + ginsn_set_where (ginsn); + break; + + case 0xc8: + if (i.tm.opcode_space != SPACE_BASE) + break; + /* enter. */ + ginsn = x86_ginsn_enter (insn_end_sym); + break; + + case 0xc9: + if (i.tm.opcode_space != SPACE_BASE) + break; + /* The 'leave' instruction copies the contents of the RBP register + into the RSP register to release all stack space allocated to the + procedure. */ + ginsn = ginsn_new_mov (insn_end_sym, false, + GINSN_SRC_REG, REG_FP, 0, + GINSN_DST_REG, REG_SP, 0); + ginsn_set_where (ginsn); + /* Then it restores the old value of the RBP register from the stack. */ + ginsn_next = ginsn_new_load (insn_end_sym, false, + GINSN_SRC_INDIRECT, REG_SP, 0, + GINSN_DST_REG, REG_FP); + ginsn_set_where (ginsn_next); + gas_assert (!ginsn_link_next (ginsn, ginsn_next)); + ginsn_last = ginsn_new_add (insn_end_sym, false, + GINSN_SRC_REG, REG_SP, 0, + GINSN_SRC_IMM, 0, 8, + GINSN_DST_REG, REG_SP, 0); + ginsn_set_where (ginsn_next); + gas_assert (!ginsn_link_next (ginsn_next, ginsn_last)); + break; + + case 0xe0 ... 0xe2: + /* loop / loope / loopne. */ + case 0xe3: + /* jecxz / jrcxz. */ + if (i.tm.opcode_space != SPACE_BASE) + break; + ginsn = x86_ginsn_jump_cond (insn_end_sym); + ginsn_set_where (ginsn); + break; + + case 0xe8: + if (i.tm.opcode_space != SPACE_BASE) + break; + /* PS: SCFI machinery does not care about which func is being + called. OK to skip that info. */ + ginsn = ginsn_new_call (insn_end_sym, true, + GINSN_SRC_SYMBOL, 0, NULL); + ginsn_set_where (ginsn); + break; + + case 0xeb: + /* If opcode_space != SPACE_BASE, this is not a jmp insn. Skip it + for GINSN_GEN_SCFI. */ + if (i.tm.opcode_space != SPACE_BASE) + break; + /* Unconditional jmp. */ + ginsn = x86_ginsn_jump (insn_end_sym); + ginsn_set_where (ginsn); + break; + + default: + /* TBD_GINSN_GEN_NOT_SCFI: Skip all other opcodes uninteresting for + GINSN_GEN_SCFI mode. */ + break; + } + + if (!ginsn && !x86_ginsn_safe_to_skip ()) + { + /* For all unhandled insns that are not whitelisted, check that they do + not impact SCFI correctness. */ + err = x86_ginsn_unhandled (); + switch (err) + { + case X86_GINSN_UNHANDLED_NONE: + break; + case X86_GINSN_UNHANDLED_DEST_REG: + /* Not all writes to REG_FP are harmful in context of SCFI. Simply + generate a GINSN_TYPE_OTHER with destination set to the + appropriate register. The SCFI machinery will bail out if this + ginsn affects SCFI correctness. */ + dw2_regnum = ginsn_dw2_regnum (i.op[i.operands - 1].regs); + ginsn = ginsn_new_other (insn_end_sym, true, + GINSN_SRC_IMM, 0, + GINSN_SRC_IMM, 0, + GINSN_DST_REG, dw2_regnum); + ginsn_set_where (ginsn); + break; + case X86_GINSN_UNHANDLED_CFG: + /* Fall through. */ + case X86_GINSN_UNHANDLED_STACKOP: + as_bad (_("SCFI: unhandled op 0x%x may cause incorrect CFI"), + i.tm.base_opcode); + break; + default: + abort (); + break; + } + } + + return ginsn; +} + /* This is the guts of the machine-dependent assembler. LINE points to a machine dependent instruction. This function is supposed to emit the frags/bytes it assembles to. */ @@ -5299,6 +6272,7 @@ md_assemble (char *line) const char *end, *pass1_mnem = NULL; enum i386_error pass1_err = 0; const insn_template *t; + ginsnS *ginsn; struct last_insn *last_insn = &seg_info(now_seg)->tc_segment_info_data.last_insn; @@ -5830,6 +6804,14 @@ md_assemble (char *line) /* We are ready to output the insn. */ output_insn (last_insn); + /* PS: SCFI is enabled only for AMD64 ABI. The ABI check has been + performed in i386_target_format. */ + if (flag_synth_cfi) + { + ginsn = x86_ginsn_new (symbol_temp_new_now (), frch_ginsn_gen_mode ()); + frch_ginsn_data_append (ginsn); + } + insert_lfence_after (); if (i.tm.opcode_modifier.isprefix) @@ -11333,6 +12315,7 @@ s_insn (int dummy ATTRIBUTE_UNUSED) const char *end; unsigned int j; valueT val; + ginsnS *ginsn; bool vex = false, xop = false, evex = false; struct last_insn *last_insn; @@ -12104,6 +13087,14 @@ s_insn (int dummy ATTRIBUTE_UNUSED) last_insn->name = ".insn directive"; last_insn->file = as_where (&last_insn->line); + /* PS: SCFI is enabled only for AMD64 ABI. The ABI check has been + performed in i386_target_format. */ + if (flag_synth_cfi) + { + ginsn = x86_ginsn_new (symbol_temp_new_now (), frch_ginsn_gen_mode ()); + frch_ginsn_data_append (ginsn); + } + done: *saved_ilp = saved_char; input_line_pointer = line; @@ -15748,6 +16739,11 @@ i386_target_format (void) else as_fatal (_("unknown architecture")); +#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) + if (flag_synth_cfi && x86_elf_abi != X86_64_ABI) + as_fatal (_("Synthesizing CFI is not supported for this ABI")); +#endif + if (cpu_flags_all_zero (&cpu_arch_isa_flags)) cpu_arch_isa_flags = cpu_arch[flag_code == CODE_64BIT].enable; diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h index 44227a8376c..981e45c1786 100644 --- a/gas/config/tc-i386.h +++ b/gas/config/tc-i386.h @@ -407,6 +407,27 @@ extern void i386_elf_section_change_hook (void); extern void i386_solaris_fix_up_eh_frame (segT); #endif +#define TARGET_USE_GINSN 1 +/* Allow GAS to synthesize DWARF CFI for hand-written asm. + PS: TARGET_USE_CFIPOP is a pre-condition. */ +#define TARGET_USE_SCFI 1 +/* Identify the maximum DWARF register number of all the registers being + tracked for SCFI. This is the last DWARF register number of the set + of SP, BP, and all callee-saved registers. For AMD64, this means + R15 (15). Use SCFI_CALLEE_SAVED_REG_P to identify which registers + are callee-saved from this set. */ +#define SCFI_MAX_REG_ID 15 +/* Identify the DWARF register number of the frame-pointer register. */ +#define REG_FP 6 +/* Identify the DWARF register number of the stack-pointer register. */ +#define REG_SP 7 +/* Some ABIs, like AMD64, use stack for call instruction. For such an ABI, + identify the initial (CFA) offset from RSP at the entry of function. */ +#define SCFI_INIT_CFA_OFFSET 8 + +#define SCFI_CALLEE_SAVED_REG_P(dw2reg) x86_scfi_callee_saved_p (dw2reg) +extern bool x86_scfi_callee_saved_p (uint32_t dw2reg_num); + /* Support for SHF_X86_64_LARGE */ extern bfd_vma x86_64_section_letter (int, const char **); #define md_elf_section_letter(LETTER, PTR_MSG) x86_64_section_letter (LETTER, PTR_MSG) diff --git a/gas/ginsn.c b/gas/ginsn.c new file mode 100644 index 00000000000..292ad1a2931 --- /dev/null +++ b/gas/ginsn.c @@ -0,0 +1,1259 @@ +/* ginsn.h - GAS instruction representation. + Copyright (C) 2023 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 "ginsn.h" +#include "scfi.h" + +#ifdef TARGET_USE_GINSN + +static const char *const ginsn_type_names[] = +{ +#define _GINSN_TYPE_ITEM(NAME, STR) STR, + _GINSN_TYPES +#undef _GINSN_TYPE_ITEM +}; + +static ginsnS * +ginsn_alloc (void) +{ + ginsnS *ginsn = XCNEW (ginsnS); + return ginsn; +} + +static ginsnS * +ginsn_init (enum ginsn_type type, const symbolS *sym, bool real_p) +{ + ginsnS *ginsn = ginsn_alloc (); + ginsn->type = type; + ginsn->sym = sym; + if (real_p) + ginsn->flags |= GINSN_F_INSN_REAL; + return ginsn; +} + +static void +ginsn_cleanup (ginsnS **ginsnp) +{ + ginsnS *ginsn; + + if (!ginsnp || !*ginsnp) + return; + + ginsn = *ginsnp; + if (ginsn->scfi_ops) + { + scfi_ops_cleanup (ginsn->scfi_ops); + ginsn->scfi_ops = NULL; + } + + free (ginsn); + *ginsnp = NULL; +} + +static void +ginsn_set_src (struct ginsn_src *src, enum ginsn_src_type type, unsigned int reg, + offsetT immdisp) +{ + if (!src) + return; + + src->type = type; + /* Even when the use-case is SCFI, the value of reg may be > SCFI_MAX_REG_ID. + E.g., in AMD64, push fs etc. */ + src->reg = reg; + src->immdisp = immdisp; +} + +static void +ginsn_set_dst (struct ginsn_dst *dst, enum ginsn_dst_type type, unsigned int reg, + offsetT disp) +{ + if (!dst) + return; + + dst->type = type; + dst->reg = reg; + + if (type == GINSN_DST_INDIRECT) + dst->disp = disp; +} + +static void +ginsn_set_file_line (ginsnS *ginsn, const char *file, unsigned int line) +{ + if (!ginsn) + return; + + ginsn->file = file; + ginsn->line = line; +} + +struct ginsn_src * +ginsn_get_src1 (ginsnS *ginsn) +{ + return &ginsn->src[0]; +} + +struct ginsn_src * +ginsn_get_src2 (ginsnS *ginsn) +{ + return &ginsn->src[1]; +} + +struct ginsn_dst * +ginsn_get_dst (ginsnS *ginsn) +{ + return &ginsn->dst; +} + +unsigned int +ginsn_get_src_reg (struct ginsn_src *src) +{ + return src->reg; +} + +enum ginsn_src_type +ginsn_get_src_type (struct ginsn_src *src) +{ + return src->type; +} + +offsetT +ginsn_get_src_disp (struct ginsn_src *src) +{ + return src->immdisp; +} + +offsetT +ginsn_get_src_imm (struct ginsn_src *src) +{ + return src->immdisp; +} + +unsigned int +ginsn_get_dst_reg (struct ginsn_dst *dst) +{ + return dst->reg; +} + +enum ginsn_dst_type +ginsn_get_dst_type (struct ginsn_dst *dst) +{ + return dst->type; +} + +offsetT +ginsn_get_dst_disp (struct ginsn_dst *dst) +{ + return dst->disp; +} + +void +label_ginsn_map_insert (const symbolS *label, ginsnS *ginsn) +{ + const char *name = S_GET_NAME (label); + str_hash_insert (frchain_now->frch_ginsn_data->label_ginsn_map, + name, ginsn, 0 /* noreplace. */); +} + +ginsnS * +label_ginsn_map_find (const symbolS *label) +{ + const char *name = S_GET_NAME (label); + ginsnS *ginsn + = (ginsnS *) str_hash_find (frchain_now->frch_ginsn_data->label_ginsn_map, + name); + return ginsn; +} + +ginsnS * +ginsn_new_phantom (const symbolS *sym) +{ + ginsnS *ginsn = ginsn_alloc (); + ginsn->type = GINSN_TYPE_PHANTOM; + ginsn->sym = sym; + /* By default, GINSN_F_INSN_REAL is not set in ginsn->flags. */ + return ginsn; +} + +ginsnS * +ginsn_new_symbol (const symbolS *sym, bool func_begin_p) +{ + ginsnS *ginsn = ginsn_alloc (); + ginsn->type = GINSN_TYPE_SYMBOL; + ginsn->sym = sym; + if (func_begin_p) + ginsn->flags |= GINSN_F_FUNC_MARKER; + return ginsn; +} + +ginsnS * +ginsn_new_symbol_func_begin (const symbolS *sym) +{ + return ginsn_new_symbol (sym, true); +} + +ginsnS * +ginsn_new_symbol_func_end (const symbolS *sym) +{ + return ginsn_new_symbol (sym, false); +} + +ginsnS * +ginsn_new_symbol_user_label (const symbolS *sym) +{ + ginsnS *ginsn = ginsn_new_symbol (sym, false); + ginsn->flags |= GINSN_F_USER_LABEL; + return ginsn; +} + +ginsnS * +ginsn_new_add (const symbolS *sym, bool real_p, + enum ginsn_src_type src1_type, unsigned int src1_reg, offsetT src1_disp, + enum ginsn_src_type src2_type, unsigned int src2_reg, offsetT src2_disp, + enum ginsn_dst_type dst_type, unsigned int dst_reg, offsetT dst_disp) +{ + ginsnS *ginsn = ginsn_init (GINSN_TYPE_ADD, sym, real_p); + /* src info. */ + ginsn_set_src (&ginsn->src[0], src1_type, src1_reg, src1_disp); + ginsn_set_src (&ginsn->src[1], src2_type, src2_reg, src2_disp); + /* dst info. */ + ginsn_set_dst (&ginsn->dst, dst_type, dst_reg, dst_disp); + + return ginsn; +} + +ginsnS * +ginsn_new_and (const symbolS *sym, bool real_p, + enum ginsn_src_type src1_type, unsigned int src1_reg, offsetT src1_disp, + enum ginsn_src_type src2_type, unsigned int src2_reg, offsetT src2_disp, + enum ginsn_dst_type dst_type, unsigned int dst_reg, offsetT dst_disp) +{ + ginsnS *ginsn = ginsn_init (GINSN_TYPE_AND, sym, real_p); + /* src info. */ + ginsn_set_src (&ginsn->src[0], src1_type, src1_reg, src1_disp); + ginsn_set_src (&ginsn->src[1], src2_type, src2_reg, src2_disp); + /* dst info. */ + ginsn_set_dst (&ginsn->dst, dst_type, dst_reg, dst_disp); + + return ginsn; +} + +ginsnS * +ginsn_new_call (const symbolS *sym, bool real_p, + enum ginsn_src_type src_type, unsigned int src_reg, + symbolS *src_text_sym) + +{ + ginsnS *ginsn = ginsn_init (GINSN_TYPE_CALL, sym, real_p); + /* src info. */ + ginsn_set_src (&ginsn->src[0], src_type, src_reg, 0); + + if (src_type == GINSN_SRC_SYMBOL) + ginsn->src[0].sym = src_text_sym; + + return ginsn; +} + +ginsnS * +ginsn_new_jump (const symbolS *sym, bool real_p, + enum ginsn_src_type src_type, unsigned int src_reg, + symbolS *src_ginsn_sym) +{ + ginsnS *ginsn = ginsn_init (GINSN_TYPE_JUMP, sym, real_p); + /* src info. */ + ginsn_set_src (&ginsn->src[0], src_type, src_reg, 0); + + if (src_type == GINSN_SRC_SYMBOL) + ginsn->src[0].sym = src_ginsn_sym; + + return ginsn; +} + +ginsnS * +ginsn_new_jump_cond (const symbolS *sym, bool real_p, + enum ginsn_src_type src_type, unsigned int src_reg, + symbolS *src_ginsn_sym) +{ + ginsnS *ginsn = ginsn_init (GINSN_TYPE_JUMP_COND, sym, real_p); + /* src info. */ + ginsn_set_src (&ginsn->src[0], src_type, src_reg, 0); + + if (src_type == GINSN_SRC_SYMBOL) + ginsn->src[0].sym = src_ginsn_sym; + + return ginsn; +} + +ginsnS * +ginsn_new_mov (const symbolS *sym, bool real_p, + enum ginsn_src_type src_type, unsigned int src_reg, offsetT src_disp, + enum ginsn_dst_type dst_type, unsigned int dst_reg, offsetT dst_disp) +{ + ginsnS *ginsn = ginsn_init (GINSN_TYPE_MOV, sym, real_p); + /* src info. */ + ginsn_set_src (&ginsn->src[0], src_type, src_reg, src_disp); + /* dst info. */ + ginsn_set_dst (&ginsn->dst, dst_type, dst_reg, dst_disp); + + return ginsn; +} + +ginsnS * +ginsn_new_store (const symbolS *sym, bool real_p, + enum ginsn_src_type src_type, unsigned int src_reg, + enum ginsn_dst_type dst_type, unsigned int dst_reg, offsetT dst_disp) +{ + ginsnS *ginsn = ginsn_init (GINSN_TYPE_STORE, sym, real_p); + /* src info. */ + ginsn_set_src (&ginsn->src[0], src_type, src_reg, 0); + /* dst info. */ + gas_assert (dst_type == GINSN_DST_INDIRECT); + ginsn_set_dst (&ginsn->dst, dst_type, dst_reg, dst_disp); + + return ginsn; +} + +ginsnS * +ginsn_new_load (const symbolS *sym, bool real_p, + enum ginsn_src_type src_type, unsigned int src_reg, offsetT src_disp, + enum ginsn_dst_type dst_type, unsigned int dst_reg) +{ + ginsnS *ginsn = ginsn_init (GINSN_TYPE_LOAD, sym, real_p); + /* src info. */ + gas_assert (src_type == GINSN_SRC_INDIRECT); + ginsn_set_src (&ginsn->src[0], src_type, src_reg, src_disp); + /* dst info. */ + ginsn_set_dst (&ginsn->dst, dst_type, dst_reg, 0); + + return ginsn; +} + +ginsnS * +ginsn_new_sub (const symbolS *sym, bool real_p, + enum ginsn_src_type src1_type, unsigned int src1_reg, offsetT src1_disp, + enum ginsn_src_type src2_type, unsigned int src2_reg, offsetT src2_disp, + enum ginsn_dst_type dst_type, unsigned int dst_reg, offsetT dst_disp) +{ + ginsnS *ginsn = ginsn_init (GINSN_TYPE_SUB, sym, real_p); + /* src info. */ + ginsn_set_src (&ginsn->src[0], src1_type, src1_reg, src1_disp); + ginsn_set_src (&ginsn->src[1], src2_type, src2_reg, src2_disp); + /* dst info. */ + ginsn_set_dst (&ginsn->dst, dst_type, dst_reg, dst_disp); + + return ginsn; +} + +/* PS: Note this API does not identify the displacement values of + src1/src2/dst. At this time, it is unnecessary for correctness to support + the additional argument. */ + +ginsnS * +ginsn_new_other (const symbolS *sym, bool real_p, + enum ginsn_src_type src1_type, unsigned int src1_val, + enum ginsn_src_type src2_type, unsigned int src2_val, + enum ginsn_dst_type dst_type, unsigned int dst_reg) +{ + ginsnS *ginsn = ginsn_init (GINSN_TYPE_OTHER, sym, real_p); + /* src info. */ + ginsn_set_src (&ginsn->src[0], src1_type, src1_val, src1_val); + /* GINSN_SRC_INDIRECT src2_type is not expected. */ + gas_assert (src2_type != GINSN_SRC_INDIRECT); + ginsn_set_src (&ginsn->src[1], src2_type, src2_val, src2_val); + /* dst info. */ + ginsn_set_dst (&ginsn->dst, dst_type, dst_reg, 0); + + return ginsn; +} + +ginsnS * +ginsn_new_return (const symbolS *sym, bool real_p) +{ + ginsnS *ginsn = ginsn_init (GINSN_TYPE_RETURN, sym, real_p); + return ginsn; +} + +void +ginsn_set_where (ginsnS *ginsn) +{ + const char *file; + unsigned int line; + file = as_where (&line); + ginsn_set_file_line (ginsn, file, line); +} + +int +ginsn_link_next (ginsnS *ginsn, ginsnS *next) +{ + int ret = 0; + + /* Avoid data corruption by limiting the scope of the API. */ + if (!ginsn || ginsn->next) + return 1; + + ginsn->next = next; + + return ret; +} + +bool +ginsn_track_reg_p (unsigned int dw2reg, enum ginsn_gen_mode gmode) +{ + bool track_p = false; + + if (gmode == GINSN_GEN_SCFI && dw2reg <= SCFI_MAX_REG_ID) + { + /* FIXME - rename this to tc_ ? */ + track_p |= SCFI_CALLEE_SAVED_REG_P (dw2reg); + track_p |= (dw2reg == REG_FP); + track_p |= (dw2reg == REG_SP); + } + + return track_p; +} + +static bool +ginsn_indirect_jump_p (ginsnS *ginsn) +{ + bool ret_p = false; + if (!ginsn) + return ret_p; + + ret_p = (ginsn->type == GINSN_TYPE_JUMP + && ginsn->src[0].type == GINSN_SRC_REG); + return ret_p; +} + +static bool +ginsn_direct_local_jump_p (ginsnS *ginsn) +{ + bool ret_p = false; + if (!ginsn) + return ret_p; + + ret_p |= (ginsn->type == GINSN_TYPE_JUMP + && ginsn->src[0].type == GINSN_SRC_SYMBOL); + return ret_p; +} + +static char * +ginsn_src_print (struct ginsn_src *src) +{ + size_t len = 40; + char *src_str = XNEWVEC (char, len); + + memset (src_str, 0, len); + + switch (src->type) + { + case GINSN_SRC_REG: + snprintf (src_str, len, "%%r%d, ", ginsn_get_src_reg (src)); + break; + case GINSN_SRC_IMM: + snprintf (src_str, len, "%lld, ", + (long long int) ginsn_get_src_imm (src)); + break; + case GINSN_SRC_INDIRECT: + snprintf (src_str, len, "[%%r%d+%lld], ", ginsn_get_src_reg (src), + (long long int) ginsn_get_src_disp (src)); + break; + default: + break; + } + + return src_str; +} + +static char* +ginsn_dst_print (struct ginsn_dst *dst) +{ + size_t len = GINSN_LISTING_OPND_LEN; + char *dst_str = XNEWVEC (char, len); + + memset (dst_str, 0, len); + + if (dst->type == GINSN_DST_REG) + { + char *buf = XNEWVEC (char, 32); + sprintf (buf, "%%r%d", ginsn_get_dst_reg (dst)); + strcat (dst_str, buf); + } + else if (dst->type == GINSN_DST_INDIRECT) + { + char *buf = XNEWVEC (char, 32); + sprintf (buf, "[%%r%d+%lld]", ginsn_get_dst_reg (dst), + (long long int) ginsn_get_dst_disp (dst)); + strcat (dst_str, buf); + } + + gas_assert (strlen (dst_str) < GINSN_LISTING_OPND_LEN); + + return dst_str; +} + +static const char* +ginsn_type_func_marker_print (ginsnS *ginsn) +{ + int id = 0; + static const char * const ginsn_sym_strs[] = + { "", "FUNC_BEGIN", "FUNC_END" }; + + if (GINSN_F_FUNC_BEGIN_P (ginsn)) + id = 1; + else if (GINSN_F_FUNC_END_P (ginsn)) + id = 2; + + return ginsn_sym_strs[id]; +} + +static char* +ginsn_print (ginsnS *ginsn) +{ + struct ginsn_src *src; + struct ginsn_dst *dst; + int str_size = 0; + size_t len = GINSN_LISTING_LEN; + char *ginsn_str = XNEWVEC (char, len); + + memset (ginsn_str, 0, len); + + str_size = snprintf (ginsn_str, GINSN_LISTING_LEN, "ginsn: %s", + ginsn_type_names[ginsn->type]); + gas_assert (str_size >= 0 && str_size < GINSN_LISTING_LEN); + + /* For some ginsn types, no further information is printed for now. */ + if (ginsn->type == GINSN_TYPE_CALL + || ginsn->type == GINSN_TYPE_RETURN) + goto end; + else if (ginsn->type == GINSN_TYPE_SYMBOL) + { + if (GINSN_F_USER_LABEL_P (ginsn)) + str_size += snprintf (ginsn_str + str_size, + GINSN_LISTING_LEN - str_size, + " %s", S_GET_NAME (ginsn->sym)); + else + str_size += snprintf (ginsn_str + str_size, + GINSN_LISTING_LEN - str_size, + " %s", ginsn_type_func_marker_print (ginsn)); + goto end; + } + + /* src 1. */ + src = ginsn_get_src1 (ginsn); + str_size += snprintf (ginsn_str + str_size, GINSN_LISTING_LEN - str_size, + " %s", ginsn_src_print (src)); + gas_assert (str_size >= 0 && str_size < GINSN_LISTING_LEN); + + /* src 2. */ + src = ginsn_get_src2 (ginsn); + str_size += snprintf (ginsn_str + str_size, GINSN_LISTING_LEN - str_size, + "%s", ginsn_src_print (src)); + gas_assert (str_size >= 0 && str_size < GINSN_LISTING_LEN); + + /* dst. */ + dst = ginsn_get_dst (ginsn); + str_size += snprintf (ginsn_str + str_size, GINSN_LISTING_LEN - str_size, + "%s", ginsn_dst_print (dst)); + +end: + gas_assert (str_size >= 0 && str_size < GINSN_LISTING_LEN); + return ginsn_str; +} + +static void +gbb_cleanup (gbbS **bbp) +{ + gbbS *bb = NULL; + + if (!bbp && !*bbp) + return; + + bb = *bbp; + + if (bb->entry_state) + { + free (bb->entry_state); + bb->entry_state = NULL; + } + if (bb->exit_state) + { + free (bb->exit_state); + bb->exit_state = NULL; + } + free (bb); + *bbp = NULL; +} + +static void +bb_add_edge (gbbS* from_bb, gbbS *to_bb) +{ + gedgeS *tmpedge = NULL; + gedgeS *gedge; + bool exists = false; + + if (!from_bb || !to_bb) + return; + + /* Create a new edge object. */ + gedge = XCNEW (gedgeS); + gedge->dst_bb = to_bb; + gedge->next = NULL; + gedge->visited = false; + + /* Add it in. */ + if (from_bb->out_gedges == NULL) + { + from_bb->out_gedges = gedge; + from_bb->num_out_gedges++; + } + else + { + /* Get the tail of the list. */ + tmpedge = from_bb->out_gedges; + while (tmpedge) + { + /* Do not add duplicate edges. Duplicated edges will cause unwanted + failures in the forward and backward passes for SCFI. */ + if (tmpedge->dst_bb == to_bb) + { + exists = true; + break; + } + if (tmpedge->next) + tmpedge = tmpedge->next; + else + break; + } + + if (!exists) + { + tmpedge->next = gedge; + from_bb->num_out_gedges++; + } + else + free (gedge); + } +} + +static void +cfg_add_bb (gcfgS *gcfg, gbbS *gbb) +{ + gbbS *last_bb = NULL; + + if (!gcfg->root_bb) + gcfg->root_bb = gbb; + else + { + last_bb = gcfg->root_bb; + while (last_bb->next) + last_bb = last_bb->next; + + last_bb->next = gbb; + } + gcfg->num_gbbs++; + + gbb->id = gcfg->num_gbbs; +} + +static gbbS * +add_bb_at_ginsn (const symbolS *func, gcfgS *gcfg, ginsnS *ginsn, gbbS *prev_bb, + int *errp); + +static gbbS * +find_bb (gcfgS *gcfg, ginsnS *ginsn) +{ + gbbS *found_bb = NULL; + gbbS *gbb = NULL; + + if (!ginsn) + return found_bb; + + if (ginsn->visited) + { + cfg_for_each_bb (gcfg, gbb) + { + if (gbb->first_ginsn == ginsn) + { + found_bb = gbb; + break; + } + } + /* Must be found if ginsn is visited. */ + gas_assert (found_bb); + } + + return found_bb; +} + +static gbbS * +find_or_make_bb (const symbolS *func, gcfgS *gcfg, ginsnS *ginsn, gbbS *prev_bb, + int *errp) +{ + gbbS *found_bb = NULL; + + found_bb = find_bb (gcfg, ginsn); + if (found_bb) + return found_bb; + + return add_bb_at_ginsn (func, gcfg, ginsn, prev_bb, errp); +} + +/* Add the basic block starting at GINSN to the given GCFG. + Also adds an edge from the PREV_BB to the newly added basic block. + + This is a recursive function which returns the root of the added + basic blocks. */ + +static gbbS * +add_bb_at_ginsn (const symbolS *func, gcfgS *gcfg, ginsnS *ginsn, gbbS *prev_bb, + int *errp) +{ + gbbS *current_bb = NULL; + ginsnS *target_ginsn = NULL; + const symbolS *taken_label; + + while (ginsn) + { + /* Skip these as they may be right after a GINSN_TYPE_RETURN. + For GINSN_TYPE_RETURN, we have already considered that as + end of bb, and a logical exit from function. */ + if (GINSN_F_FUNC_END_P (ginsn)) + { + ginsn = ginsn->next; + continue; + } + + if (ginsn->visited) + { + /* If the ginsn has been visited earlier, the bb must exist by now + in the cfg. */ + prev_bb = current_bb; + current_bb = find_bb (gcfg, ginsn); + gas_assert (current_bb); + /* Add edge from the prev_bb. */ + if (prev_bb) + bb_add_edge (prev_bb, current_bb); + break; + } + else if (current_bb && GINSN_F_USER_LABEL_P (ginsn)) + { + /* Create new bb starting at this label ginsn. */ + prev_bb = current_bb; + find_or_make_bb (func, gcfg, ginsn, prev_bb, errp); + break; + } + + if (current_bb == NULL) + { + /* Create a new bb. */ + current_bb = XCNEW (gbbS); + cfg_add_bb (gcfg, current_bb); + /* Add edge for the Not Taken, or Fall-through path. */ + if (prev_bb) + bb_add_edge (prev_bb, current_bb); + } + + if (current_bb->first_ginsn == NULL) + current_bb->first_ginsn = ginsn; + + ginsn->visited = true; + current_bb->num_ginsns++; + current_bb->last_ginsn = ginsn; + + /* Note that BB is _not_ split on ginsn of type GINSN_TYPE_CALL. */ + if (ginsn->type == GINSN_TYPE_JUMP + || ginsn->type == GINSN_TYPE_JUMP_COND + || ginsn->type == GINSN_TYPE_RETURN) + { + /* Indirect Jumps or direct jumps to symbols non-local to the + function must not be seen here. The caller must have already + checked for that. */ + gas_assert (!ginsn_indirect_jump_p (ginsn)); + if (ginsn->type == GINSN_TYPE_JUMP) + gas_assert (ginsn_direct_local_jump_p (ginsn)); + + /* Direct Jumps. May include conditional or unconditional change of + flow. What is important for CFG creation is that the target be + local to function. */ + if (ginsn->type == GINSN_TYPE_JUMP_COND + || ginsn_direct_local_jump_p (ginsn)) + { + gas_assert (ginsn->src[0].type == GINSN_SRC_SYMBOL); + taken_label = ginsn->src[0].sym; + gas_assert (taken_label); + + /* Preserve the prev_bb to be the dominator bb as we are + going to follow the taken path of the conditional branch + soon. */ + prev_bb = current_bb; + + /* Follow the target on the taken path. */ + target_ginsn = label_ginsn_map_find (taken_label); + /* Add the bb for the target of the taken branch. */ + if (target_ginsn) + find_or_make_bb (func, gcfg, target_ginsn, prev_bb, errp); + else + { + *errp = GCFG_JLABEL_NOT_PRESENT; + as_warn_where (ginsn->file, ginsn->line, + _("missing label '%s' in func '%s' may result in imprecise cfg"), + S_GET_NAME (taken_label), S_GET_NAME (func)); + } + /* Add the bb for the fall through path. */ + find_or_make_bb (func, gcfg, ginsn->next, prev_bb, errp); + } + else if (ginsn->type == GINSN_TYPE_RETURN) + { + /* We'll come back to the ginsns following GINSN_TYPE_RETURN + from another path if they are indeed reachable code. */ + break; + } + + /* Current BB has been processed. */ + current_bb = NULL; + } + ginsn = ginsn->next; + } + + return current_bb; +} + +static int +gbbs_compare (const void *v1, const void *v2) +{ + const gbbS *bb1 = *(const gbbS **) v1; + const gbbS *bb2 = *(const gbbS **) v2; + + if (bb1->first_ginsn->id < bb2->first_ginsn->id) + return -1; + else if (bb1->first_ginsn->id > bb2->first_ginsn->id) + return 1; + else if (bb1->first_ginsn->id == bb2->first_ginsn->id) + return 0; + + return 0; +} + +/* Synthesize DWARF CFI and emit it. */ + +static int +ginsn_pass_execute_scfi (const symbolS *func, gcfgS *gcfg, gbbS *root_bb) +{ + int err = scfi_synthesize_dw2cfi (func, gcfg, root_bb); + if (!err) + scfi_emit_dw2cfi (func); + + return err; +} + +/* Traverse the list of ginsns for the function and warn if some + ginsns are not visited. + + FIXME - this code assumes the caller has already performed a pass over + ginsns such that the reachable ginsns are already marked. Revisit this - we + should ideally make this pass self-sufficient. */ + +static int +ginsn_pass_warn_unreachable_code (const symbolS *func, + gcfgS *gcfg ATTRIBUTE_UNUSED, + ginsnS *root_ginsn) +{ + ginsnS *ginsn; + bool unreach_p = false; + + if (!gcfg || !func || !root_ginsn) + return 0; + + ginsn = root_ginsn; + + while (ginsn) + { + /* Some ginsns of type GINSN_TYPE_SYMBOL remain unvisited. Some + may even be excluded from the CFG as they are not reachable, given + their function, e.g., user labels after return machine insn. */ + if (!ginsn->visited + && !GINSN_F_FUNC_END_P (ginsn) + && !GINSN_F_USER_LABEL_P (ginsn)) + { + unreach_p = true; + break; + } + ginsn = ginsn->next; + } + + if (unreach_p) + as_warn_where (ginsn->file, ginsn->line, + _("GINSN: found unreachable code in func '%s'"), + S_GET_NAME (func)); + + return unreach_p; +} + +void +gcfg_get_bbs_in_prog_order (gcfgS *gcfg, gbbS **prog_order_bbs) +{ + uint64_t i = 0; + gbbS *gbb; + + if (!prog_order_bbs) + return; + + cfg_for_each_bb (gcfg, gbb) + { + gas_assert (i < gcfg->num_gbbs); + prog_order_bbs[i++] = gbb; + } + + qsort (prog_order_bbs, gcfg->num_gbbs, sizeof (gbbS *), gbbs_compare); +} + +/* Build the control flow graph for the ginsns of the function. + + It is important that the target adds an appropriate ginsn: + - GINSN_TYPE_JUMP, + - GINSN_TYPE_JUMP_COND, + - GINSN_TYPE_CALL, + - GINSN_TYPE_RET + at the associated points in the function. The correctness of the CFG + depends on the accuracy of these 'change of flow instructions'. */ + +gcfgS * +gcfg_build (const symbolS *func, int *errp) +{ + gcfgS *gcfg; + ginsnS *first_ginsn; + + gcfg = XCNEW (gcfgS); + first_ginsn = frchain_now->frch_ginsn_data->gins_rootP; + add_bb_at_ginsn (func, gcfg, first_ginsn, NULL /* prev_bb. */, errp); + + return gcfg; +} + +void +gcfg_cleanup (gcfgS **gcfgp) +{ + gcfgS *cfg; + gbbS *bb, *next_bb; + gedgeS *edge, *next_edge; + + if (!gcfgp || !*gcfgp) + return; + + cfg = *gcfgp; + bb = gcfg_get_rootbb (cfg); + + while (bb) + { + next_bb = bb->next; + + /* Cleanup all the edges. */ + edge = bb->out_gedges; + while (edge) + { + next_edge = edge->next; + free (edge); + edge = next_edge; + } + + gbb_cleanup (&bb); + bb = next_bb; + } + + free (cfg); + *gcfgp = NULL; +} + +gbbS * +gcfg_get_rootbb (gcfgS *gcfg) +{ + gbbS *rootbb = NULL; + + if (!gcfg || !gcfg->num_gbbs) + return NULL; + + rootbb = gcfg->root_bb; + + return rootbb; +} + +void +gcfg_print (const gcfgS *gcfg, FILE *outfile) +{ + gbbS *gbb = NULL; + gedgeS *gedge = NULL; + uint64_t total_ginsns = 0; + + cfg_for_each_bb(gcfg, gbb) + { + fprintf (outfile, "BB [%" PRIu64 "] with num insns: %" PRIu64, + gbb->id, gbb->num_ginsns); + fprintf (outfile, " [insns: %u to %u]\n", + gbb->first_ginsn->line, gbb->last_ginsn->line); + total_ginsns += gbb->num_ginsns; + bb_for_each_edge(gbb, gedge) + fprintf (outfile, " outgoing edge to %" PRIu64 "\n", + gedge->dst_bb->id); + } + fprintf (outfile, "\nTotal ginsns in all GBBs = %" PRIu64 "\n", + total_ginsns); +} + +void +frch_ginsn_data_init (const symbolS *func, symbolS *start_addr, + enum ginsn_gen_mode gmode) +{ + /* FIXME - error out if prev object is not free'd ? */ + frchain_now->frch_ginsn_data = XCNEW (struct frch_ginsn_data); + + frchain_now->frch_ginsn_data->mode = gmode; + /* Annotate with the current function symbol. */ + frchain_now->frch_ginsn_data->func = func; + /* Create a new start address symbol now. */ + frchain_now->frch_ginsn_data->start_addr = start_addr; + /* Assume the set of ginsn are apt for CFG creation, by default. */ + frchain_now->frch_ginsn_data->gcfg_apt_p = true; + + frchain_now->frch_ginsn_data->label_ginsn_map = str_htab_create (); +} + +void +frch_ginsn_data_cleanup (void) +{ + ginsnS *ginsn = NULL; + ginsnS *next_ginsn = NULL; + + ginsn = frchain_now->frch_ginsn_data->gins_rootP; + while (ginsn) + { + next_ginsn = ginsn->next; + ginsn_cleanup (&ginsn); + ginsn = next_ginsn; + } + + if (frchain_now->frch_ginsn_data->label_ginsn_map) + htab_delete (frchain_now->frch_ginsn_data->label_ginsn_map); + + free (frchain_now->frch_ginsn_data); + frchain_now->frch_ginsn_data = NULL; +} + +/* Append GINSN to the list of ginsns for the current function being + assembled. */ + +int +frch_ginsn_data_append (ginsnS *ginsn) +{ + ginsnS *last = NULL; + ginsnS *temp = NULL; + uint64_t id = 0; + + if (!ginsn) + return 1; + + if (frchain_now->frch_ginsn_data->gins_lastP) + id = frchain_now->frch_ginsn_data->gins_lastP->id; + + /* Do the necessary preprocessing on the set of input GINSNs: + - Update each ginsn with its ID. + While you iterate, also keep gcfg_apt_p updated by checking whether any + ginsn is inappropriate for GCFG creation. */ + temp = ginsn; + while (temp) + { + temp->id = ++id; + + if (ginsn_indirect_jump_p (temp) + || (ginsn->type == GINSN_TYPE_JUMP + && !ginsn_direct_local_jump_p (temp))) + frchain_now->frch_ginsn_data->gcfg_apt_p = false; + + if (listing & LISTING_GINSN_SCFI) + listing_newline (ginsn_print (temp)); + + /* The input GINSN may be a linked list of multiple ginsns chained + together. Find the last ginsn in the input chain of ginsns. */ + last = temp; + + temp = temp->next; + } + + /* Link in the ginsn to the tail. */ + if (!frchain_now->frch_ginsn_data->gins_rootP) + frchain_now->frch_ginsn_data->gins_rootP = ginsn; + else + ginsn_link_next (frchain_now->frch_ginsn_data->gins_lastP, ginsn); + + frchain_now->frch_ginsn_data->gins_lastP = last; + + return 0; +} + +enum ginsn_gen_mode +frch_ginsn_gen_mode (void) +{ + enum ginsn_gen_mode gmode = GINSN_GEN_NONE; + + if (frchain_now->frch_ginsn_data) + gmode = frchain_now->frch_ginsn_data->mode; + + return gmode; +} + +int +ginsn_data_begin (const symbolS *func) +{ + ginsnS *ginsn; + + /* The previous block of asm must have been processed by now. */ + if (frchain_now->frch_ginsn_data) + as_bad (_("GINSN process for prev func not done")); + + /* FIXME - hard code the mode to GINSN_GEN_SCFI. + This can be changed later when other passes on ginsns are formalised. */ + frch_ginsn_data_init (func, symbol_temp_new_now (), GINSN_GEN_SCFI); + + /* Create and insert ginsn with function begin marker. */ + ginsn = ginsn_new_symbol_func_begin (func); + frch_ginsn_data_append (ginsn); + + return 0; +} + +int +ginsn_data_end (const symbolS *label) +{ + ginsnS *ginsn; + gbbS *root_bb; + gcfgS *gcfg = NULL; + const symbolS *func; + int err = 0; + + if (!frchain_now->frch_ginsn_data) + return err; + + /* Insert Function end marker. */ + ginsn = ginsn_new_symbol_func_end (label); + frch_ginsn_data_append (ginsn); + + func = frchain_now->frch_ginsn_data->func; + + /* Build the cfg of ginsn(s) of the function. */ + if (!frchain_now->frch_ginsn_data->gcfg_apt_p) + { + as_warn (_("Untraceable control flow for func '%s'; Skipping SCFI"), + S_GET_NAME (func)); + goto end; + } + + gcfg = gcfg_build (func, &err); + + root_bb = gcfg_get_rootbb (gcfg); + if (!root_bb) + { + as_bad (_("Bad cfg of ginsn of func '%s'"), S_GET_NAME (func)); + goto end; + } + + /* Execute the desired passes on ginsns. */ + err = ginsn_pass_execute_scfi (func, gcfg, root_bb); + if (err) + goto end; + + /* Other passes, e.g., warn for unreachable code can be enabled too. */ + ginsn = frchain_now->frch_ginsn_data->gins_rootP; + err = ginsn_pass_warn_unreachable_code (func, gcfg, ginsn); + +end: + if (gcfg) + gcfg_cleanup (&gcfg); + frch_ginsn_data_cleanup (); + + return err; +} + +/* Add GINSN_TYPE_SYMBOL type ginsn for user-defined labels. These may be + branch targets, and hence are necessary for control flow graph. */ + +void +ginsn_frob_label (const symbolS *label) +{ + ginsnS *label_ginsn; + const char *file; + unsigned int line; + + if (frchain_now->frch_ginsn_data) + { + /* PS: Note how we keep the actual LABEL symbol as ginsn->sym. + Take care to avoid inadvertent updates or cleanups of symbols. */ + label_ginsn = ginsn_new_symbol_user_label (label); + /* Keep the location updated. */ + file = as_where (&line); + ginsn_set_file_line (label_ginsn, file, line); + + frch_ginsn_data_append (label_ginsn); + + label_ginsn_map_insert (label, label_ginsn); + } +} + +const symbolS * +ginsn_data_func_symbol (void) +{ + const symbolS *func = NULL; + + if (frchain_now->frch_ginsn_data) + func = frchain_now->frch_ginsn_data->func; + + return func; +} + +#else + +int +ginsn_data_begin (const symbolS *func ATTRIBUTE_UNUSED) +{ + as_bad (_("ginsn unsupported for target")); + return 1; +} + +int +ginsn_data_end (const symbolS *label ATTRIBUTE_UNUSED) +{ + as_bad (_("ginsn unsupported for target")); + return 1; +} + +void +ginsn_frob_label (const symbolS *sym ATTRIBUTE_UNUSED) +{ + return; +} + +const symbolS * +ginsn_data_func_symbol (void) +{ + return NULL; +} + +#endif /* TARGET_USE_GINSN. */ diff --git a/gas/ginsn.h b/gas/ginsn.h new file mode 100644 index 00000000000..70c2fe57526 --- /dev/null +++ b/gas/ginsn.h @@ -0,0 +1,384 @@ +/* ginsn.h - GAS instruction representation. + Copyright (C) 2023 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 GINSN_H +#define GINSN_H + +#include "as.h" + +/* Maximum number of source operands of a ginsn. */ +#define GINSN_NUM_SRC_OPNDS 2 + +/* A ginsn in printed in the following format: + "ginsn: OPCD SRC1, SRC2, DST" + "<-5-> <--------125------->" + where each of SRC1, SRC2, and DST are in the form: + "%rNN," (up to 5 chars) + "imm," (up to int32_t+1 chars) + "[%rNN+-imm]," (up to int32_t+9 chars) + Hence a max of 19 chars. */ + +#define GINSN_LISTING_OPND_LEN 40 +#define GINSN_LISTING_LEN 156 + +enum ginsn_gen_mode +{ + GINSN_GEN_NONE, + /* Generate ginsns for program validation passes. */ + GINSN_GEN_FVAL, + /* Generate ginsns for synthesizing DWARF CFI. */ + GINSN_GEN_SCFI, +}; + +/* ginsn types. + + GINSN_TYPE_PHANTOM are phantom ginsns. They are used where there is no real + machine instruction counterpart, but a ginsn is needed only to carry + information to GAS. For example, to carry an SCFI Op. + + Note that, ginsns do not have a push / pop instructions. + Instead, following are used: + type=GINSN_TYPE_LOAD, src=GINSN_SRC_INDIRECT, REG_SP: Load from stack. + type=GINSN_TYPE_STORE, dst=GINSN_DST_INDIRECT, REG_SP: Store to stack. +*/ + +#define _GINSN_TYPES \ + _GINSN_TYPE_ITEM (GINSN_TYPE_SYMBOL, "SYM") \ + _GINSN_TYPE_ITEM (GINSN_TYPE_PHANTOM, "PHANTOM") \ + _GINSN_TYPE_ITEM (GINSN_TYPE_ADD, "ADD") \ + _GINSN_TYPE_ITEM (GINSN_TYPE_AND, "AND") \ + _GINSN_TYPE_ITEM (GINSN_TYPE_CALL, "CALL") \ + _GINSN_TYPE_ITEM (GINSN_TYPE_JUMP, "JMP") \ + _GINSN_TYPE_ITEM (GINSN_TYPE_JUMP_COND, "JCC") \ + _GINSN_TYPE_ITEM (GINSN_TYPE_MOV, "MOV") \ + _GINSN_TYPE_ITEM (GINSN_TYPE_LOAD, "LOAD") \ + _GINSN_TYPE_ITEM (GINSN_TYPE_STORE, "STORE") \ + _GINSN_TYPE_ITEM (GINSN_TYPE_RETURN, "RET") \ + _GINSN_TYPE_ITEM (GINSN_TYPE_SUB, "SUB") \ + _GINSN_TYPE_ITEM (GINSN_TYPE_OTHER, "OTH") + +enum ginsn_type +{ +#define _GINSN_TYPE_ITEM(NAME, STR) NAME, + _GINSN_TYPES +#undef _GINSN_TYPE_ITEM +}; + +enum ginsn_src_type +{ + GINSN_SRC_UNKNOWN, + GINSN_SRC_REG, + GINSN_SRC_IMM, + GINSN_SRC_INDIRECT, + GINSN_SRC_SYMBOL, +}; + +/* GAS instruction source operand representation. */ + +struct ginsn_src +{ + enum ginsn_src_type type; + /* DWARF register number. */ + unsigned int reg; + /* Immediate or disp for indirect memory access. */ + offsetT immdisp; + /* Src symbol. May be needed for some control flow instructions. */ + const symbolS *sym; +}; + +enum ginsn_dst_type +{ + GINSN_DST_UNKNOWN, + GINSN_DST_REG, + GINSN_DST_INDIRECT, +}; + +/* GAS instruction destination operand representation. */ + +struct ginsn_dst +{ + enum ginsn_dst_type type; + /* DWARF register number. */ + unsigned int reg; + /* Disp for indirect memory access. */ + offsetT disp; +}; + +/* Various flags for additional information per GAS instruction. */ + +/* Function begin or end symbol. */ +#define GINSN_F_FUNC_MARKER 0x1 +/* Identify real or implicit GAS insn. + Some targets employ CISC-like instructions. Multiple ginsn's may be used + for a single machine instruction in some ISAs. For some optimizations, + there is need to identify whether a ginsn, e.g., GINSN_TYPE_ADD or + GINSN_TYPE_SUB is a result of an user-specified instruction or not. */ +#define GINSN_F_INSN_REAL 0x2 +/* Identify if the GAS insn of type GINSN_TYPE_SYMBOL is due to a user-defined + label. Each user-defined labels in a function will cause addition of a new + ginsn. This simplifies control flow graph creation. + See htab_t label_ginsn_map usage. */ +#define GINSN_F_USER_LABEL 0x4 +/* Max bit position for flags (uint32_t). */ +#define GINSN_F_MAX 0x20 + +#define GINSN_F_FUNC_BEGIN_P(ginsn) \ + ((ginsn != NULL) \ + && (ginsn->type == GINSN_TYPE_SYMBOL) \ + && (ginsn->flags & GINSN_F_FUNC_MARKER)) + +/* PS: For ginsn associated with a user-defined symbol location, + GINSN_F_FUNC_MARKER is unset, but GINSN_F_USER_LABEL is set. */ +#define GINSN_F_FUNC_END_P(ginsn) \ + ((ginsn != NULL) \ + && (ginsn->type == GINSN_TYPE_SYMBOL) \ + && !(ginsn->flags & GINSN_F_FUNC_MARKER) \ + && !(ginsn->flags & GINSN_F_USER_LABEL)) + +#define GINSN_F_INSN_REAL_P(ginsn) \ + ((ginsn != NULL) \ + && (ginsn->flags & GINSN_F_INSN_REAL)) + +#define GINSN_F_USER_LABEL_P(ginsn) \ + ((ginsn != NULL) \ + && (ginsn->type == GINSN_TYPE_SYMBOL) \ + && !(ginsn->flags & GINSN_F_FUNC_MARKER) \ + && (ginsn->flags & GINSN_F_USER_LABEL)) + +typedef struct ginsn ginsnS; +typedef struct scfi_op scfi_opS; +typedef struct scfi_state scfi_stateS; + +/* GAS generic instruction. + + Generic instructions are used by GAS to abstract out the binary machine + instructions. In other words, ginsn is a target/ABI independent internal + representation for GAS. Note that, depending on the target, there may be + more than one ginsn per binary machine instruction. + + ginsns can be used by GAS to perform validations, or even generate + additional information like, sythesizing DWARF CFI for hand-written asm. */ + +struct ginsn +{ + enum ginsn_type type; + /* GAS instructions are simple instructions with GINSN_NUM_SRC_OPNDS number + of source operands and one destination operand at this time. */ + struct ginsn_src src[GINSN_NUM_SRC_OPNDS]; + struct ginsn_dst dst; + /* Additional information per instruction. */ + uint32_t flags; + /* Symbol. For ginsn of type other than GINSN_TYPE_SYMBOL, this identifies + the end of the corresponding machine instruction in the .text segment. + These symbols are created anew by the targets and are not used elsewhere + in GAS. The only exception is some ginsns of type GINSN_TYPE_SYMBOL, when + generated for the user-defined labels. See ginsn_frob_label. */ + const symbolS *sym; + /* Identifier (linearly increasing natural number) for each ginsn. Used as + a proxy for program order of ginsns. */ + uint64_t id; + /* Location information for user-interfacing messaging. Only ginsns with + GINSN_F_FUNC_BEGIN_P and GINSN_F_FUNC_END_P may present themselves with no + file or line information. */ + const char *file; + unsigned int line; + + /* Information needed for synthesizing CFI. */ + scfi_opS **scfi_ops; + uint32_t num_scfi_ops; + + /* Flag to keep track of visited instructions for CFG creation. */ + bool visited; + + ginsnS *next; /* A linked list. */ +}; + +struct ginsn_src *ginsn_get_src1 (ginsnS *ginsn); +struct ginsn_src *ginsn_get_src2 (ginsnS *ginsn); +struct ginsn_dst *ginsn_get_dst (ginsnS *ginsn); + +unsigned int ginsn_get_src_reg (struct ginsn_src *src); +enum ginsn_src_type ginsn_get_src_type (struct ginsn_src *src); +offsetT ginsn_get_src_disp (struct ginsn_src *src); +offsetT ginsn_get_src_imm (struct ginsn_src *src); + +unsigned int ginsn_get_dst_reg (struct ginsn_dst *dst); +enum ginsn_dst_type ginsn_get_dst_type (struct ginsn_dst *dst); +offsetT ginsn_get_dst_disp (struct ginsn_dst *dst); + +/* Data object for book-keeping information related to GAS generic + instructions. */ +struct frch_ginsn_data +{ + /* Mode for GINSN creation. */ + enum ginsn_gen_mode mode; + /* Head of the list of ginsns. */ + ginsnS *gins_rootP; + /* Tail of the list of ginsns. */ + ginsnS *gins_lastP; + /* Function symbol. */ + const symbolS *func; + /* Start address of the function. */ + symbolS *start_addr; + /* User-defined label to ginsn mapping. */ + htab_t label_ginsn_map; + /* Is the list of ginsn apt for creating CFG. */ + bool gcfg_apt_p; +}; + +int ginsn_data_begin (const symbolS *func); +int ginsn_data_end (const symbolS *label); +const symbolS *ginsn_data_func_symbol (void); +void ginsn_frob_label (const symbolS *sym); + +void frch_ginsn_data_init (const symbolS *func, symbolS *start_addr, + enum ginsn_gen_mode gmode); +void frch_ginsn_data_cleanup (void); +int frch_ginsn_data_append (ginsnS *ginsn); +enum ginsn_gen_mode frch_ginsn_gen_mode (void); + +void label_ginsn_map_insert (const symbolS *label, ginsnS *ginsn); +ginsnS *label_ginsn_map_find (const symbolS *label); + +ginsnS *ginsn_new_symbol_func_begin (const symbolS *sym); +ginsnS *ginsn_new_symbol_func_end (const symbolS *sym); +ginsnS *ginsn_new_symbol_user_label (const symbolS *sym); + +ginsnS *ginsn_new_phantom (const symbolS *sym); +ginsnS *ginsn_new_symbol (const symbolS *sym, bool real_p); +ginsnS *ginsn_new_add (const symbolS *sym, bool real_p, + enum ginsn_src_type src1_type, unsigned int src1_reg, offsetT src1_disp, + enum ginsn_src_type src2_type, unsigned int src2_reg, offsetT src2_disp, + enum ginsn_dst_type dst_type, unsigned int dst_reg, offsetT dst_disp); +ginsnS *ginsn_new_and (const symbolS *sym, bool real_p, + enum ginsn_src_type src1_type, unsigned int src1_reg, offsetT src1_disp, + enum ginsn_src_type src2_type, unsigned int src2_reg, offsetT src2_disp, + enum ginsn_dst_type dst_type, unsigned int dst_reg, offsetT dst_disp); +ginsnS *ginsn_new_call (const symbolS *sym, bool real_p, + enum ginsn_src_type src_type, unsigned int src_reg, + symbolS *src_text_sym); +ginsnS *ginsn_new_jump (const symbolS *sym, bool real_p, + enum ginsn_src_type src_type, unsigned int src_reg, + symbolS *src_ginsn_sym); +ginsnS *ginsn_new_jump_cond (const symbolS *sym, bool real_p, + enum ginsn_src_type src_type, unsigned int src_reg, + symbolS *src_ginsn_sym); +ginsnS *ginsn_new_mov (const symbolS *sym, bool real_p, + enum ginsn_src_type src_type, unsigned int src_reg, offsetT src_disp, + enum ginsn_dst_type dst_type, unsigned int dst_reg, offsetT dst_disp); +ginsnS *ginsn_new_store (const symbolS *sym, bool real_p, + enum ginsn_src_type src_type, unsigned int src_reg, + enum ginsn_dst_type dst_type, unsigned int dst_reg, offsetT dst_disp); +ginsnS *ginsn_new_load (const symbolS *sym, bool real_p, + enum ginsn_src_type src_type, unsigned int src_reg, offsetT src_disp, + enum ginsn_dst_type dst_type, unsigned int dst_reg); +ginsnS *ginsn_new_sub (const symbolS *sym, bool real_p, + enum ginsn_src_type src1_type, unsigned int src1_reg, offsetT src1_disp, + enum ginsn_src_type src2_type, unsigned int src2_reg, offsetT src2_disp, + enum ginsn_dst_type dst_type, unsigned int dst_reg, offsetT dst_disp); +ginsnS *ginsn_new_other (const symbolS *sym, bool real_p, + enum ginsn_src_type src1_type, unsigned int src1_val, + enum ginsn_src_type src2_type, unsigned int src2_val, + enum ginsn_dst_type dst_type, unsigned int dst_reg); +ginsnS *ginsn_new_return (const symbolS *sym, bool real_p); + +void ginsn_set_where (ginsnS *ginsn); + +bool ginsn_track_reg_p (unsigned int dw2reg, enum ginsn_gen_mode); + +int ginsn_link_next (ginsnS *ginsn, ginsnS *next); + +enum gcfg_err_code +{ + GCFG_OK = 0, + GCFG_JLABEL_NOT_PRESENT = 1, /* Warning-level code. */ +}; + +typedef struct gbb gbbS; +typedef struct gedge gedgeS; + +/* GBB - Basic block of generic GAS instructions. */ + +struct gbb +{ + ginsnS *first_ginsn; + ginsnS *last_ginsn; + uint64_t num_ginsns; + + /* Identifier (linearly increasing natural number) for each gbb. Added for + debugging purpose only. */ + uint64_t id; + + bool visited; + + uint32_t num_out_gedges; + gedgeS *out_gedges; + + /* Members for SCFI purposes. */ + /* SCFI state at the entry of basic block. */ + scfi_stateS *entry_state; + /* SCFI state at the exit of basic block. */ + scfi_stateS *exit_state; + + /* A linked list. In order of addition. */ + gbbS *next; +}; + +struct gedge +{ + gbbS *dst_bb; + /* A linked list. In order of addition. */ + gedgeS *next; + bool visited; +}; + +/* Control flow graph of generic GAS instructions. */ + +struct gcfg +{ + uint64_t num_gbbs; + gbbS *root_bb; +}; + +typedef struct gcfg gcfgS; + +#define bb_for_each_insn(bb, ginsn) \ + for (ginsn = bb->first_ginsn; ginsn; \ + ginsn = (ginsn != bb->last_ginsn) ? ginsn->next : NULL) + +#define bb_for_each_edge(bb, edge) \ + for (edge = (edge == NULL) ? bb->out_gedges : edge; edge; edge = edge->next) + +#define cfg_for_each_bb(cfg, bb) \ + for (bb = cfg->root_bb; bb; bb = bb->next) + +#define bb_get_first_ginsn(bb) \ + (bb->first_ginsn) + +#define bb_get_last_ginsn(bb) \ + (bb->last_ginsn) + +gcfgS *gcfg_build (const symbolS *func, int *errp); +void gcfg_cleanup (gcfgS **gcfg); +void gcfg_print (const gcfgS *gcfg, FILE *outfile); +gbbS *gcfg_get_rootbb (gcfgS *gcfg); +void gcfg_get_bbs_in_prog_order (gcfgS *gcfg, gbbS **prog_order_bbs); + +#endif /* GINSN_H. */ diff --git a/gas/listing.h b/gas/listing.h index a2cc1f51958..ff89f2219dd 100644 --- a/gas/listing.h +++ b/gas/listing.h @@ -29,6 +29,7 @@ #define LISTING_NOCOND 32 #define LISTING_MACEXP 64 #define LISTING_GENERAL 128 +#define LISTING_GINSN_SCFI 256 #define LISTING_DEFAULT (LISTING_LISTING | LISTING_HLL | LISTING_SYMBOLS) diff --git a/gas/read.c b/gas/read.c index 0ae6d830e9c..7eebe009339 100644 --- a/gas/read.c +++ b/gas/read.c @@ -42,6 +42,7 @@ #include "codeview.h" #include "wchar.h" #include "filenames.h" +#include "ginsn.h" #include @@ -1384,6 +1385,9 @@ read_a_source_file (const char *name) } #endif + if (flag_synth_cfi) + ginsn_data_end (symbol_temp_new_now ()); + #ifdef md_cleanup md_cleanup (); #endif @@ -4198,6 +4202,12 @@ cons_worker (int nbytes, /* 1=.byte, 2=.word, 4=.long. */ if (flag_mri) mri_comment_end (stop, stopc); + + /* Disallow hand-crafting instructions using .byte. FIXME - what about + .word, .long etc ? */ + if (flag_synth_cfi && frchain_now && frchain_now->frch_ginsn_data + && nbytes == 1) + as_bad (_("SCFI: hand-crafting instructions not supported")); } void diff --git a/gas/scfi.c b/gas/scfi.c new file mode 100644 index 00000000000..37cc85cfed7 --- /dev/null +++ b/gas/scfi.c @@ -0,0 +1,1232 @@ +/* scfi.c - Support for synthesizing DWARF CFI for hand-written asm. + Copyright (C) 2023 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 "scfi.h" +#include "subsegs.h" +#include "scfidw2gen.h" +#include "dw2gencfi.h" + +#if defined (TARGET_USE_SCFI) && defined (TARGET_USE_GINSN) + +/* Beyond the target defined number of registers to be tracked + (SCFI_MAX_REG_ID), keep the next register ID, in sequence, for REG_CFA. */ +#define REG_CFA (SCFI_MAX_REG_ID+1) +/* Define the total number of registers being tracked. + Used as index into an array of cfi_reglocS. Note that a ginsn may carry a + register number greater than MAX_NUM_SCFI_REGS, e.g., for the ginsns + corresponding to push fs/gs in AMD64. */ +#define MAX_NUM_SCFI_REGS (REG_CFA+1) + +#define REG_INVALID ((unsigned int)-1) + +enum cfi_reglocstate +{ + CFI_UNDEFINED, + CFI_IN_REG, + CFI_ON_STACK +}; + +/* Location at which CFI register is saved. + + A CFI register (callee-saved registers, RA/LR) are always an offset from + the CFA. REG_CFA itself, however, may have REG_SP or REG_FP as base + register. Hence, keep the base reg ID and offset per tracked register. */ + +struct cfi_regloc +{ + /* Base reg ID (DWARF register number). */ + unsigned int base; + /* Location as offset from the CFA. */ + offsetT offset; + /* Current state of the CFI register. */ + enum cfi_reglocstate state; +}; + +typedef struct cfi_regloc cfi_reglocS; + +struct scfi_op_data +{ + const char *name; +}; + +typedef struct scfi_op_data scfi_op_dataS; + +/* SCFI operation. + + An SCFI operation represents a single atomic change to the SCFI state. + This can also be understood as an abstraction for what eventually gets + emitted as a DWARF CFI operation. */ + +struct scfi_op +{ + /* An SCFI op updates the state of either the CFA or other tracked + (callee-saved, REG_SP etc) registers. 'reg' is in the DWARF register + number space and must be strictly less than MAX_NUM_SCFI_REGS. */ + unsigned int reg; + /* Location of the reg. */ + cfi_reglocS loc; + /* DWARF CFI opcode. */ + uint32_t dw2cfi_op; + /* Some SCFI ops, e.g., for CFI_label, may need to carry additional data. */ + scfi_op_dataS *op_data; + /* A linked list. */ + struct scfi_op *next; +}; + +/* SCFI State - accumulated unwind information at a PC. + + SCFI state is the accumulated unwind information encompassing: + - REG_SP, REG_FP, + - RA, and + - all callee-saved registers. + + Note that SCFI_MAX_REG_ID is target/ABI dependent and is provided by the + backends. The backend must also identify the DWARF register numbers for + the REG_SP, and REG_FP registers. */ + +struct scfi_state +{ + cfi_reglocS regs[MAX_NUM_SCFI_REGS]; + cfi_reglocS scratch[MAX_NUM_SCFI_REGS]; + /* Current stack size. */ + offsetT stack_size; + /* Whether the stack size is known. + Stack size may become untraceable depending on the specific stack + manipulation machine instruction, e.g., rsp = rsp op reg instruction + makes the stack size untraceable. */ + bool traceable_p; +}; + +/* Initialize a new SCFI op. */ + +static scfi_opS * +init_scfi_op (void) +{ + scfi_opS *op = XCNEW (scfi_opS); + + return op; +} + +/* Free the SCFI ops, given the HEAD of the list. */ + +void +scfi_ops_cleanup (scfi_opS **head) +{ + scfi_opS *op; + scfi_opS *next; + + if (!head || !*head) + return; + + op = *head; + next = op->next; + + while (op) + { + free (op); + op = next; + next = op ? op->next : NULL; + } +} + +/* Compare two SCFI states. */ + +static int +cmp_scfi_state (scfi_stateS *state1, scfi_stateS *state2) +{ + int ret; + + if (!state1 || !state2) + ret = 1; + + /* Skip comparing the scratch[] value of registers. The user visible + unwind information is derived from the regs[] from the SCFI state. */ + ret = memcmp (state1->regs, state2->regs, + sizeof (cfi_reglocS) * MAX_NUM_SCFI_REGS); + + /* For user functions which perform dynamic stack allocation, after switching + t REG_FP based CFA tracking, it is perfectly possible to have stack usage + in some control flows. However, double-checking that all control flows + have the same idea of CFA tracking before this wont hurt. */ + gas_assert (state1->regs[REG_CFA].base == state2->regs[REG_CFA].base); + if (state1->regs[REG_CFA].base == REG_SP) + ret |= state1->stack_size != state2->stack_size; + + ret |= state1->traceable_p != state2->traceable_p; + + return ret; +} + +#if 0 +static void +scfi_state_update_reg (scfi_stateS *state, uint32_t dst, uint32_t base, + int32_t offset) +{ + if (dst >= MAX_NUM_SCFI_REGS) + return; + + state->regs[dst].base = base; + state->regs[dst].offset = offset; +} +#endif + +/* Update the SCFI state of REG as available on execution stack at OFFSET + from REG_CFA (BASE). + + Note that BASE must be REG_CFA, because any other base (REG_SP, REG_FP) + is by definition transitory in the function. */ + +static void +scfi_state_save_reg (scfi_stateS *state, unsigned int reg, unsigned int base, + offsetT offset) +{ + if (reg >= MAX_NUM_SCFI_REGS) + return; + + gas_assert (base == REG_CFA); + + state->regs[reg].base = base; + state->regs[reg].offset = offset; + state->regs[reg].state = CFI_ON_STACK; +} + +static void +scfi_state_restore_reg (scfi_stateS *state, unsigned int reg) +{ + if (reg >= MAX_NUM_SCFI_REGS) + return; + + /* Sanity check. See Rule 4. */ + gas_assert (state->regs[reg].state == CFI_ON_STACK); + gas_assert (state->regs[reg].base == REG_CFA); + + state->regs[reg].base = reg; + state->regs[reg].offset = 0; + /* PS: the register may still be on stack much after the restore, but the + SCFI state keeps the state as 'in register'. */ + state->regs[reg].state = CFI_IN_REG; +} + +/* Identify if the given GAS instruction GINSN saves a register + (of interest) on stack. */ + +static bool +ginsn_scfi_save_reg_p (ginsnS *ginsn, scfi_stateS *state) +{ + bool save_reg_p = false; + struct ginsn_src *src; + struct ginsn_dst *dst; + + src = ginsn_get_src1 (ginsn); + dst = ginsn_get_dst (ginsn); + + /* The first save to stack of callee-saved register is deemed as + register save. */ + if (!ginsn_track_reg_p (ginsn_get_src_reg (src), GINSN_GEN_SCFI) + || state->regs[ginsn_get_src_reg (src)].state == CFI_ON_STACK) + return save_reg_p; + + /* A register save insn may be an indirect mov. */ + if (ginsn->type == GINSN_TYPE_MOV + && ginsn_get_dst_type (dst) == GINSN_DST_INDIRECT + && (ginsn_get_dst_reg (dst) == REG_SP + || (ginsn_get_dst_reg (dst) == REG_FP + && state->regs[REG_CFA].base == REG_FP))) + save_reg_p = true; + /* or an explicit store to stack. */ + else if (ginsn->type == GINSN_TYPE_STORE + && ginsn_get_dst_type (dst) == GINSN_DST_INDIRECT + && ginsn_get_dst_reg (dst) == REG_SP) + save_reg_p = true; + + return save_reg_p; +} + +/* Identify if the given GAS instruction GINSN restores a register + (of interest) on stack. */ + +static bool +ginsn_scfi_restore_reg_p (ginsnS *ginsn, scfi_stateS *state) +{ + bool restore_reg_p = false; + struct ginsn_dst *dst; + struct ginsn_src *src1; + + dst = ginsn_get_dst (ginsn); + src1 = ginsn_get_src1 (ginsn); + + if (!ginsn_track_reg_p (ginsn_get_dst_reg (dst), GINSN_GEN_SCFI)) + return restore_reg_p; + + /* A register restore insn may be an indirect mov... */ + if (ginsn->type == GINSN_TYPE_MOV + && ginsn_get_src_type (src1) == GINSN_SRC_INDIRECT + && (ginsn_get_src_reg (src1) == REG_SP + || (ginsn_get_src_reg (src1) == REG_FP + && state->regs[REG_CFA].base == REG_FP))) + restore_reg_p = true; + /* ...or an explicit load from stack. */ + else if (ginsn->type == GINSN_TYPE_LOAD + && ginsn_get_src_type (src1) == GINSN_SRC_INDIRECT + && ginsn_get_src_reg (src1) == REG_SP) + restore_reg_p = true; + + return restore_reg_p; +} + +/* Append the SCFI operation OP to the list of SCFI operations in the + given GINSN. */ + +static int +ginsn_append_scfi_op (ginsnS *ginsn, scfi_opS *op) +{ + scfi_opS *sop; + + if (!ginsn || !op) + return 1; + + if (!ginsn->scfi_ops) + { + ginsn->scfi_ops = XCNEW (scfi_opS *); + *ginsn->scfi_ops = op; + } + else + { + /* Add to tail. Most ginsns have a single SCFI operation, + so this traversal for every insertion is acceptable for now. */ + sop = *ginsn->scfi_ops; + while (sop->next) + sop = sop->next; + + sop->next = op; + } + ginsn->num_scfi_ops++; + + return 0; +} + +static void +scfi_op_add_def_cfa_reg (scfi_stateS *state, ginsnS *ginsn, unsigned int reg) +{ + scfi_opS *op = NULL; + + state->regs[REG_CFA].base = reg; + + op = init_scfi_op (); + + op->dw2cfi_op = DW_CFA_def_cfa_register; + op->reg = REG_CFA; + op->loc = state->regs[REG_CFA]; + + ginsn_append_scfi_op (ginsn, op); +} + +static void +scfi_op_add_cfa_offset_inc (scfi_stateS *state, ginsnS *ginsn, offsetT num) +{ + scfi_opS *op = NULL; + + state->regs[REG_CFA].offset -= num; + + op = init_scfi_op (); + + op->dw2cfi_op = DW_CFA_def_cfa_offset; + op->reg = REG_CFA; + op->loc = state->regs[REG_CFA]; + + ginsn_append_scfi_op (ginsn, op); +} + +static void +scfi_op_add_cfa_offset_dec (scfi_stateS *state, ginsnS *ginsn, offsetT num) +{ + scfi_opS *op = NULL; + + state->regs[REG_CFA].offset += num; + + op = init_scfi_op (); + + op->dw2cfi_op = DW_CFA_def_cfa_offset; + op->reg = REG_CFA; + op->loc = state->regs[REG_CFA]; + + ginsn_append_scfi_op (ginsn, op); +} + +static void +scfi_op_add_def_cfa (scfi_stateS *state, ginsnS *ginsn, unsigned int reg, + offsetT num) +{ + scfi_opS *op = NULL; + + state->regs[REG_CFA].base = reg; + state->regs[REG_CFA].offset = num; + + op = init_scfi_op (); + + op->dw2cfi_op = DW_CFA_def_cfa; + op->reg = REG_CFA; + op->loc = state->regs[REG_CFA]; + + ginsn_append_scfi_op (ginsn, op); +} + +static void +scfi_op_add_cfi_offset (scfi_stateS *state, ginsnS *ginsn, unsigned int reg) +{ + scfi_opS *op = NULL; + + op = init_scfi_op (); + + op->dw2cfi_op = DW_CFA_offset; + op->reg = reg; + op->loc = state->regs[reg]; + + ginsn_append_scfi_op (ginsn, op); +} + +static void +scfi_op_add_cfa_restore (ginsnS *ginsn, unsigned int reg) +{ + scfi_opS *op = NULL; + + op = init_scfi_op (); + + op->dw2cfi_op = DW_CFA_restore; + op->reg = reg; + op->loc.base = REG_INVALID; + op->loc.offset = 0; + + ginsn_append_scfi_op (ginsn, op); +} + +static void +scfi_op_add_cfi_remember_state (ginsnS *ginsn) +{ + scfi_opS *op = NULL; + + op = init_scfi_op (); + + op->dw2cfi_op = DW_CFA_remember_state; + + ginsn_append_scfi_op (ginsn, op); +} + +static void +scfi_op_add_cfi_restore_state (ginsnS *ginsn) +{ + scfi_opS *op = NULL; + + op = init_scfi_op (); + + op->dw2cfi_op = DW_CFA_restore_state; + + /* FIXME - add to the beginning of the scfi_ops. */ + ginsn_append_scfi_op (ginsn, op); +} + +void +scfi_op_add_cfi_label (ginsnS *ginsn, const char *name) +{ + scfi_opS *op = NULL; + + op = init_scfi_op (); + op->dw2cfi_op = CFI_label; + op->op_data = XCNEW (scfi_op_dataS); + op->op_data->name = name; + + ginsn_append_scfi_op (ginsn, op); +} + +void +scfi_op_add_signal_frame (ginsnS *ginsn) +{ + scfi_opS *op = NULL; + + op = init_scfi_op (); + op->dw2cfi_op = CFI_signal_frame; + + ginsn_append_scfi_op (ginsn, op); +} + +static int +verify_heuristic_traceable_reg_fp (ginsnS *ginsn, scfi_stateS *state) +{ + /* The function uses this variable to issue error to user right away. */ + int fp_traceable_p = 0; + struct ginsn_dst *dst; + struct ginsn_src *src1; + struct ginsn_src *src2; + + src1 = ginsn_get_src1 (ginsn); + src2 = ginsn_get_src2 (ginsn); + dst = ginsn_get_dst (ginsn); + + /* Stack manipulation can be done in a variety of ways. A program may + allocate stack statically or may perform dynamic stack allocation in + the prologue. + + The SCFI machinery in GAS is based on some heuristics: + + - Rule 3 If the base register for CFA tracking is REG_FP, the program + must not clobber REG_FP, unless it is for switch to REG_SP based CFA + tracking (via say, a pop %rbp in X86). */ + + /* Check all applicable instructions with dest REG_FP, when the CFA base + register is REG_FP. */ + if (state->regs[REG_CFA].base == REG_FP && ginsn_get_dst_reg (dst) == REG_FP) + { + /* Excuse the add/sub with imm usage: They are OK. */ + if ((ginsn->type == GINSN_TYPE_ADD || ginsn->type == GINSN_TYPE_SUB) + && ginsn_get_src_reg (src1) == REG_FP + && ginsn_get_src_type (src2) == GINSN_SRC_IMM) + fp_traceable_p = 0; + /* REG_FP restore is OK too. */ + else if (ginsn->type == GINSN_TYPE_LOAD) + fp_traceable_p = 0; + /* mov's to memory with REG_FP base do not make REG_FP untraceable. */ + else if (ginsn_get_dst_type (dst) == GINSN_DST_INDIRECT + && (ginsn->type == GINSN_TYPE_MOV + || ginsn->type == GINSN_TYPE_STORE)) + fp_traceable_p = 0; + /* Manipulations of the values possibly on stack are OK too. */ + else if ((ginsn->type == GINSN_TYPE_ADD || ginsn->type == GINSN_TYPE_SUB + || ginsn->type == GINSN_TYPE_AND) + && ginsn_get_dst_type (dst) == GINSN_DST_INDIRECT) + fp_traceable_p = 0; + /* All other ginsns with REG_FP as destination make REG_FP not + traceable. */ + else + fp_traceable_p = 1; + } + + if (fp_traceable_p) + as_bad_where (ginsn->file, ginsn->line, + _("SCFI: usage of REG_FP as scratch not supported")); + + return fp_traceable_p; +} + +static int +verify_heuristic_traceable_stack_manipulation (ginsnS *ginsn, + scfi_stateS *state) +{ + /* The function uses this variable to issue error to user right away. */ + int sp_untraceable_p = 0; + bool possibly_untraceable = false; + struct ginsn_dst *dst; + struct ginsn_src *src1; + struct ginsn_src *src2; + + src1 = ginsn_get_src1 (ginsn); + src2 = ginsn_get_src2 (ginsn); + dst = ginsn_get_dst (ginsn); + + /* Stack manipulation can be done in a variety of ways. A program may + allocate stack statically in prologue or may need to do dynamic stack + allocation. + + The SCFI machinery in GAS is based on some heuristics: + + - Rule 1 The base register for CFA tracking may be either REG_SP or + REG_FP. + + - Rule 2 If the base register for CFA tracking is REG_SP, the precise + amount of stack usage (and hence, the value of rsp) must be known at + all times. */ + + if (ginsn->type == GINSN_TYPE_MOV + && ginsn_get_dst_type (dst) == GINSN_DST_REG + && ginsn_get_dst_reg (dst) == REG_SP + && ginsn_get_src_type (src1) == GINSN_SRC_REG + /* Exclude mov %rbp, %rsp from this check. */ + && ginsn_get_src_reg (src1) != REG_FP) + { + /* mov %reg, %rsp. */ + /* A previous mov %rsp, %reg must have been seen earlier for this to be + an OK for stack manipulation. */ + if (state->scratch[ginsn_get_src_reg (src1)].base != REG_CFA + || state->scratch[ginsn_get_src_reg (src1)].state != CFI_IN_REG) + { + possibly_untraceable = true; + } + } + /* Check add/sub/and insn usage when CFA base register is REG_SP. + Any stack size manipulation, including stack realignment is not allowed + if CFA base register is REG_SP. */ + else if (ginsn_get_dst_type (dst) == GINSN_DST_REG + && ginsn_get_dst_reg (dst) == REG_SP + && (((ginsn->type == GINSN_TYPE_ADD || ginsn->type == GINSN_TYPE_SUB) + && ginsn_get_src_type (src2) != GINSN_SRC_IMM) + || ginsn->type == GINSN_TYPE_AND + || ginsn->type == GINSN_TYPE_OTHER)) + possibly_untraceable = true; + /* If a register save operation is seen when REG_SP is untraceable, + CFI cannot be synthesized for register saves, hence bail out. */ + else if (ginsn_scfi_save_reg_p (ginsn, state) && !state->traceable_p) + { + sp_untraceable_p = 1; + /* If, however, the register save is an REG_FP-based, indirect mov + like: mov reg, disp(%rbp) and CFA base register is REG_BP, + untraceable REG_SP is not a problem. */ + if (ginsn->type == GINSN_TYPE_MOV + && ginsn_get_dst_type (dst) == GINSN_DST_INDIRECT + && (ginsn_get_dst_reg (dst) == REG_FP + && state->regs[REG_CFA].base == REG_FP)) + sp_untraceable_p = 0; + } + else if (ginsn_scfi_restore_reg_p (ginsn, state) && !state->traceable_p) + { + if (ginsn->type == GINSN_TYPE_MOV + && ginsn_get_dst_type (dst) == GINSN_DST_INDIRECT + && (ginsn_get_src_reg (src1) == REG_SP + || (ginsn_get_src_reg (src1) == REG_FP + && state->regs[REG_CFA].base != REG_FP))) + sp_untraceable_p = 1; + } + + if (possibly_untraceable) + { + /* See Rule 2. For SP-based CFA, this makes CFA tracking not possible. + Propagate now to caller. */ + if (state->regs[REG_CFA].base == REG_SP) + sp_untraceable_p = 1; + else if (state->traceable_p) + { + /* An extension of Rule 2. + For FP-based CFA, this may be a problem *if* certain specific + changes to the SCFI state are seen beyond this point, e.g., + register save / restore from stack. */ + gas_assert (state->regs[REG_CFA].base == REG_FP); + /* Simply make a note in the SCFI state object for now and + continue. Indicate an error when register save / restore + for callee-saved registers is seen. */ + sp_untraceable_p = 0; + state->traceable_p = false; + } + } + + if (sp_untraceable_p) + as_bad_where (ginsn->file, ginsn->line, + _("SCFI: unsupported stack manipulation pattern")); + + return sp_untraceable_p; +} + +static int +verify_heuristic_symmetrical_restore_reg (scfi_stateS *state, ginsnS* ginsn) +{ + int sym_restore = true; + offsetT expected_offset = 0; + struct ginsn_src *src1; + struct ginsn_dst *dst; + unsigned int reg; + + /* Rule 4: Save and Restore of callee-saved registers must be symmetrical. + It is expected that value of the saved register is restored correctly. + E.g., + push reg1 + push reg2 + ... + body of func which uses reg1 , reg2 as scratch, + and may be even spills them to stack. + ... + pop reg2 + pop reg1 + It is difficult to verify the Rule 4 in all cases. For the SCFI machinery, + it is difficult to separate prologue-epilogue from the body of the function + + Hence, the SCFI machinery at this time, should only warn on an asymetrical + restore. */ + src1 = ginsn_get_src1 (ginsn); + dst = ginsn_get_dst (ginsn); + reg = ginsn_get_dst_reg (dst); + + /* For non callee-saved registers, calling the API is meaningless. */ + if (!ginsn_track_reg_p (ginsn_get_dst_reg (dst), GINSN_GEN_SCFI)) + return sym_restore; + + /* The register must have been saved on stack, for sure. */ + gas_assert (state->regs[reg].state == CFI_ON_STACK); + gas_assert (state->regs[reg].base == REG_CFA); + + if ((ginsn->type == GINSN_TYPE_MOV + || ginsn->type == GINSN_TYPE_LOAD) + && ginsn_get_src_type (src1) == GINSN_SRC_INDIRECT + && (ginsn_get_src_reg (src1) == REG_SP + || (ginsn_get_src_reg (src1) == REG_FP + && state->regs[REG_CFA].base == REG_FP))) + { + /* mov disp(%rsp), reg. */ + /* mov disp(%rbp), reg. */ + expected_offset = (((ginsn_get_src_reg (src1) == REG_SP) + ? -state->stack_size + : state->regs[REG_FP].offset) + + ginsn_get_src_disp (src1)); + } + + sym_restore = (expected_offset == state->regs[reg].offset); + + return sym_restore; +} + +/* Perform symbolic execution of the GINSN and update its list of scfi_ops. + scfi_ops are later used to directly generate the DWARF CFI directives. + Also update the SCFI state object STATE for the caller. */ + +static int +gen_scfi_ops (ginsnS *ginsn, scfi_stateS *state) +{ + int ret = 0; + offsetT offset; + struct ginsn_src *src1; + struct ginsn_src *src2; + struct ginsn_dst *dst; + + if (!ginsn || !state) + ret = 1; + + /* For the first ginsn (of type GINSN_TYPE_SYMBOL) in the gbb, generate + the SCFI op with DW_CFA_def_cfa. Note that the register and offset are + target-specific. */ + if (GINSN_F_FUNC_BEGIN_P (ginsn)) + { + scfi_op_add_def_cfa (state, ginsn, REG_SP, SCFI_INIT_CFA_OFFSET); + state->stack_size += SCFI_INIT_CFA_OFFSET; + return ret; + } + + src1 = ginsn_get_src1 (ginsn); + src2 = ginsn_get_src2 (ginsn); + dst = ginsn_get_dst (ginsn); + + ret = verify_heuristic_traceable_stack_manipulation (ginsn, state); + if (ret) + return ret; + + ret = verify_heuristic_traceable_reg_fp (ginsn, state); + if (ret) + return ret; + + switch (ginsn->dst.type) + { + case GINSN_DST_REG: + switch (ginsn->type) + { + case GINSN_TYPE_MOV: + if (ginsn_get_src_type (src1) == GINSN_SRC_REG + && ginsn_get_src_reg (src1) == REG_SP + && ginsn_get_dst_reg (dst) == REG_FP + && state->regs[REG_CFA].base == REG_SP) + { + /* mov %rsp, %rbp. */ + scfi_op_add_def_cfa_reg (state, ginsn, ginsn_get_dst_reg (dst)); + } + else if (ginsn_get_src_type (src1) == GINSN_SRC_REG + && ginsn_get_src_reg (src1) == REG_FP + && ginsn_get_dst_reg (dst) == REG_SP + && state->regs[REG_CFA].base == REG_FP) + { + /* mov %rbp, %rsp. */ + state->stack_size = -state->regs[REG_FP].offset; + scfi_op_add_def_cfa_reg (state, ginsn, ginsn_get_dst_reg (dst)); + state->traceable_p = true; + } + else if (ginsn_get_src_type (src1) == GINSN_SRC_INDIRECT + && (ginsn_get_src_reg (src1) == REG_SP + || ginsn_get_src_reg (src1) == REG_FP) + && ginsn_track_reg_p (ginsn_get_dst_reg (dst), GINSN_GEN_SCFI)) + { + /* mov disp(%rsp), reg. */ + /* mov disp(%rbp), reg. */ + if (verify_heuristic_symmetrical_restore_reg (state, ginsn)) + { + scfi_state_restore_reg (state, ginsn_get_dst_reg (dst)); + scfi_op_add_cfa_restore (ginsn, ginsn_get_dst_reg (dst)); + } + else + as_warn_where (ginsn->file, ginsn->line, + _("SCFI: asymetrical register restore")); + } + else if (ginsn_get_src_type (src1) == GINSN_SRC_REG + && ginsn_get_dst_type (dst) == GINSN_DST_REG + && ginsn_get_src_reg (src1) == REG_SP) + { + /* mov %rsp, %reg. */ + /* The value of rsp is taken directly from state->stack_size. + IMP: The workflow in gen_scfi_ops must keep it updated. + PS: Not taking the value from state->scratch[REG_SP] is + intentional. */ + state->scratch[ginsn_get_dst_reg (dst)].base = REG_CFA; + state->scratch[ginsn_get_dst_reg (dst)].offset = -state->stack_size; + state->scratch[ginsn_get_dst_reg (dst)].state = CFI_IN_REG; + } + else if (ginsn_get_src_type (src1) == GINSN_SRC_REG + && ginsn_get_dst_type (dst) == GINSN_DST_REG + && ginsn_get_dst_reg (dst) == REG_SP) + { + /* mov %reg, %rsp. */ + /* Keep the value of REG_SP updated. */ + if (state->scratch[ginsn_get_src_reg (src1)].state == CFI_IN_REG) + { + state->stack_size = -state->scratch[ginsn_get_src_reg (src1)].offset; + state->traceable_p = true; + } +# if 0 + scfi_state_update_reg (state, ginsn_get_dst_reg (dst), + state->scratch[ginsn_get_src_reg (src1)].base, + state->scratch[ginsn_get_src_reg (src1)].offset); +#endif + + } + break; + case GINSN_TYPE_SUB: + if (ginsn_get_src_reg (src1) == REG_SP + && ginsn_get_dst_reg (dst) == REG_SP) + { + /* Stack inc/dec offset, when generated due to stack push and pop is + target-specific. Use the value encoded in the ginsn. */ + state->stack_size += ginsn_get_src_imm (src2); + if (state->regs[REG_CFA].base == REG_SP) + { + /* push reg. */ + scfi_op_add_cfa_offset_dec (state, ginsn, ginsn_get_src_imm (src2)); + } + } + break; + case GINSN_TYPE_ADD: + if (ginsn_get_src_reg (src1) == REG_SP + && ginsn_get_dst_reg (dst) == REG_SP) + { + /* Stack inc/dec offset is target-specific. Use the value + encoded in the ginsn. */ + state->stack_size -= ginsn_get_src_imm (src2); + /* pop %reg affects CFA offset only if CFA is currently + stack-pointer based. */ + if (state->regs[REG_CFA].base == REG_SP) + { + scfi_op_add_cfa_offset_inc (state, ginsn, ginsn_get_src_imm (src2)); + } + } + else if (ginsn_get_src_reg (src1) == REG_FP + && ginsn_get_dst_reg (dst) == REG_SP + && state->regs[REG_CFA].base == REG_FP) + { + /* FIXME - what is this for ? */ + state->stack_size = 0 - (state->regs[REG_FP].offset + ginsn_get_src_imm (src2)); + } + break; + case GINSN_TYPE_LOAD: + /* If this is a load from stack. */ + if (ginsn_get_src_type (src1) == GINSN_SRC_INDIRECT + && (ginsn_get_src_reg (src1) == REG_SP + || (ginsn_get_src_reg (src1) == REG_FP + && state->regs[REG_CFA].base == REG_FP))) + { + /* pop %rbp when CFA tracking is REG_FP based. */ + if (ginsn_get_dst_reg (dst) == REG_FP + && state->regs[REG_CFA].base == REG_FP) + { + scfi_op_add_def_cfa_reg (state, ginsn, REG_SP); + if (state->regs[REG_CFA].offset != state->stack_size) + scfi_op_add_cfa_offset_inc (state, ginsn, + (state->regs[REG_CFA].offset - state->stack_size)); + } + if (ginsn_track_reg_p (ginsn_get_dst_reg (dst), GINSN_GEN_SCFI)) + { + if (verify_heuristic_symmetrical_restore_reg (state, ginsn)) + { + scfi_state_restore_reg (state, ginsn_get_dst_reg (dst)); + scfi_op_add_cfa_restore (ginsn, ginsn_get_dst_reg (dst)); + } + else + as_warn_where (ginsn->file, ginsn->line, + _("SCFI: asymetrical register restore")); + } + } + break; + default: + break; + } + break; + + case GINSN_DST_INDIRECT: + /* Some operations with an indirect access to memory (or even to stack) + may still be uninteresting for SCFI purpose (e.g, addl %edx, -32(%rsp) + in x86). In case of x86_64, these can neither be a register + save / unsave, nor can alter the stack size. + PS: This condition may need to be revisited for other arches. */ + if (ginsn->type == GINSN_TYPE_ADD || ginsn->type == GINSN_TYPE_SUB + || ginsn->type == GINSN_TYPE_AND) + break; + gas_assert (ginsn->type == GINSN_TYPE_MOV + || ginsn->type == GINSN_TYPE_STORE + || ginsn->type == GINSN_TYPE_LOAD); + /* mov reg, disp(%rbp) */ + /* mov reg, disp(%rsp) */ + if (ginsn_scfi_save_reg_p (ginsn, state)) + { + if (ginsn_get_dst_reg (dst) == REG_SP) + { + /* mov reg, disp(%rsp) */ + offset = 0 - state->stack_size + ginsn_get_dst_disp (dst); + scfi_state_save_reg (state, ginsn_get_src_reg (src1), REG_CFA, offset); + scfi_op_add_cfi_offset (state, ginsn, ginsn_get_src_reg (src1)); + } + else if (ginsn_get_dst_reg (dst) == REG_FP) + { + gas_assert (state->regs[REG_CFA].base == REG_FP); + /* mov reg, disp(%rbp) */ + offset = 0 - state->regs[REG_CFA].offset + ginsn_get_dst_disp (dst); + scfi_state_save_reg (state, ginsn_get_src_reg (src1), REG_CFA, offset); + scfi_op_add_cfi_offset (state, ginsn, ginsn_get_src_reg (src1)); + } + } + break; + + default: + /* Skip GINSN_DST_UNKNOWN and GINSN_DST_MEM as they are uninteresting + currently for SCFI. */ + break; + } + + return ret; +} + +/* Recursively perform forward flow of the (unwind information) SCFI state + starting at basic block GBB. + + The forward flow process propagates the SCFI state at exit of a basic block + to the successor basic block. + + Returns error code, if any. */ + +static int +forward_flow_scfi_state (gcfgS *gcfg, gbbS *gbb, scfi_stateS *state) +{ + ginsnS *ginsn; + gbbS *prev_bb; + gedgeS *gedge = NULL; + int ret = 0; + + if (gbb->visited) + { + /* Check that the SCFI state is the same as previous. */ + ret = cmp_scfi_state (state, gbb->entry_state); + if (ret) + as_bad (_("SCFI: Bad CFI propagation perhaps")); + return ret; + } + + gbb->visited = true; + + gbb->entry_state = XCNEW (scfi_stateS); + memcpy (gbb->entry_state, state, sizeof (scfi_stateS)); + + /* Perform symbolic execution of each ginsn in the gbb and update the + scfi_ops list of each ginsn (and also update the STATE object). */ + bb_for_each_insn(gbb, ginsn) + { + ret = gen_scfi_ops (ginsn, state); + if (ret) + goto fail; + } + + gbb->exit_state = XCNEW (scfi_stateS); + memcpy (gbb->exit_state, state, sizeof (scfi_stateS)); + + /* Forward flow the SCFI state. Currently, we process the next basic block + in DFS order. But any forward traversal order should be fine. */ + prev_bb = gbb; + if (gbb->num_out_gedges) + { + bb_for_each_edge(gbb, gedge) + { + gbb = gedge->dst_bb; + if (gbb->visited) + { + ret = cmp_scfi_state (gbb->entry_state, state); + if (ret) + goto fail; + } + + if (!gedge->visited) + { + gedge->visited = true; + + /* Entry SCFI state for the destination bb of the edge is the + same as the exit SCFI state of the source bb of the edge. */ + memcpy (state, prev_bb->exit_state, sizeof (scfi_stateS)); + ret = forward_flow_scfi_state (gcfg, gbb, state); + if (ret) + goto fail; + } + } + } + + return 0; + +fail: + + if (gedge) + gedge->visited = true; + return 1; +} + +static int +backward_flow_scfi_state (const symbolS *func ATTRIBUTE_UNUSED, gcfgS *gcfg) +{ + gbbS **prog_order_bbs; + gbbS **restore_bbs; + gbbS *current_bb; + gbbS *prev_bb; + gbbS *dst_bb; + ginsnS *ginsn; + gedgeS *gedge = NULL; + + int ret = 0; + uint64_t i, j; + + /* Basic blocks in reverse program order. */ + prog_order_bbs = XCNEWVEC (gbbS *, gcfg->num_gbbs); + /* Basic blocks for which CFI remember op needs to be generated. */ + restore_bbs = XCNEWVEC (gbbS *, gcfg->num_gbbs); + + gcfg_get_bbs_in_prog_order (gcfg, prog_order_bbs); + + i = gcfg->num_gbbs - 1; + /* Traverse in reverse program order. */ + while (i > 0) + { + current_bb = prog_order_bbs[i]; + prev_bb = prog_order_bbs[i-1]; + if (cmp_scfi_state (prev_bb->exit_state, current_bb->entry_state)) + { + /* Candidate for .cfi_restore_state found. */ + ginsn = bb_get_first_ginsn (current_bb); + scfi_op_add_cfi_restore_state (ginsn); + /* Memorize current_bb now to find location for its remember state + later. */ + restore_bbs[i] = current_bb; + } + else + { + bb_for_each_edge (current_bb, gedge) + { + dst_bb = gedge->dst_bb; + for (j = 0; j < gcfg->num_gbbs; j++) + if (restore_bbs[j] == dst_bb) + { + ginsn = bb_get_last_ginsn (current_bb); + scfi_op_add_cfi_remember_state (ginsn); + /* Remove the memorised restore_bb from the list. */ + restore_bbs[j] = NULL; + break; + } + } + } + i--; + } + + /* All .cfi_restore_state pseudo-ops must have a corresponding + .cfi_remember_state by now. */ + for (j = 0; j < gcfg->num_gbbs; j++) + if (restore_bbs[j] != NULL) + { + ret = 1; + break; + } + + free (restore_bbs); + free (prog_order_bbs); + + return ret; +} + +/* Synthesize DWARF CFI for a function. */ + +int +scfi_synthesize_dw2cfi (const symbolS *func, gcfgS *gcfg, gbbS *root_bb) +{ + int ret; + scfi_stateS *init_state; + + init_state = XCNEW (scfi_stateS); + init_state->traceable_p = true; + + /* Traverse the input GCFG and perform forward flow of information. + Update the scfi_op(s) per ginsn. */ + ret = forward_flow_scfi_state (gcfg, root_bb, init_state); + if (ret) + { + as_bad (_("SCFI: forward pass failed for func '%s'"), S_GET_NAME (func)); + goto end; + } + + ret = backward_flow_scfi_state (func, gcfg); + if (ret) + { + as_bad (_("SCFI: backward pass failed for func '%s'"), S_GET_NAME (func)); + goto end; + } + +end: + free (init_state); + return ret; +} + +static int +handle_scfi_dot_cfi (ginsnS *ginsn) +{ + scfi_opS *op; + + /* Nothing to do. */ + if (!ginsn->scfi_ops) + return 0; + + op = *ginsn->scfi_ops; + if (!op) + goto bad; + + while (op) + { + switch (op->dw2cfi_op) + { + case DW_CFA_def_cfa_register: + scfi_dot_cfi (DW_CFA_def_cfa_register, op->loc.base, 0, 0, NULL, + ginsn->sym); + break; + case DW_CFA_def_cfa_offset: + scfi_dot_cfi (DW_CFA_def_cfa_offset, op->loc.base, 0, + op->loc.offset, NULL, ginsn->sym); + break; + case DW_CFA_def_cfa: + scfi_dot_cfi (DW_CFA_def_cfa, op->loc.base, 0, op->loc.offset, + NULL, ginsn->sym); + break; + case DW_CFA_offset: + scfi_dot_cfi (DW_CFA_offset, op->reg, 0, op->loc.offset, NULL, + ginsn->sym); + break; + case DW_CFA_restore: + scfi_dot_cfi (DW_CFA_restore, op->reg, 0, 0, NULL, ginsn->sym); + break; + case DW_CFA_remember_state: + scfi_dot_cfi (DW_CFA_remember_state, 0, 0, 0, NULL, ginsn->sym); + break; + case DW_CFA_restore_state: + scfi_dot_cfi (DW_CFA_restore_state, 0, 0, 0, NULL, ginsn->sym); + break; + case CFI_label: + scfi_dot_cfi (CFI_label, 0, 0, 0, op->op_data->name, ginsn->sym); + break; + case CFI_signal_frame: + scfi_dot_cfi (CFI_signal_frame, 0, 0, 0, NULL, ginsn->sym); + break; + default: + goto bad; + break; + } + op = op->next; + } + + return 0; +bad: + as_bad (_("SCFI: Invalid DWARF CFI opcode data")); + return 1; +} + +/* Emit Synthesized DWARF CFI. */ + +int +scfi_emit_dw2cfi (const symbolS *func) +{ + struct frch_ginsn_data *frch_gdata; + ginsnS* ginsn = NULL; + + frch_gdata = frchain_now->frch_ginsn_data; + ginsn = frch_gdata->gins_rootP; + + while (ginsn) + { + switch (ginsn->type) + { + case GINSN_TYPE_SYMBOL: + /* .cfi_startproc and .cfi_endproc pseudo-ops. */ + if (GINSN_F_FUNC_BEGIN_P (ginsn)) + { + scfi_dot_cfi_startproc (frch_gdata->start_addr); + break; + } + else if (GINSN_F_FUNC_END_P (ginsn)) + { + scfi_dot_cfi_endproc (ginsn->sym); + break; + } + /* Fall through. */ + case GINSN_TYPE_ADD: + case GINSN_TYPE_AND: + case GINSN_TYPE_CALL: + case GINSN_TYPE_JUMP: + case GINSN_TYPE_JUMP_COND: + case GINSN_TYPE_MOV: + case GINSN_TYPE_LOAD: + case GINSN_TYPE_PHANTOM: + case GINSN_TYPE_STORE: + case GINSN_TYPE_SUB: + case GINSN_TYPE_OTHER: + case GINSN_TYPE_RETURN: + + /* For all other SCFI ops, invoke the handler. */ + if (ginsn->scfi_ops) + handle_scfi_dot_cfi (ginsn); + break; + + default: + /* No other GINSN_TYPE_* expected. */ + as_bad (_("SCFI: bad ginsn for func '%s'"), + S_GET_NAME (func)); + break; + } + ginsn = ginsn->next; + } + return 0; +} + +#else + +int +scfi_emit_dw2cfi (const symbolS *func ATTRIBUTE_UNUSED) +{ + as_bad (_("SCFI: unsupported for target")); + return 1; +} + +int +scfi_synthesize_dw2cfi (const symbolS *func ATTRIBUTE_UNUSED, + gcfgS *gcfg ATTRIBUTE_UNUSED, + gbbS *root_bb ATTRIBUTE_UNUSED) +{ + as_bad (_("SCFI: unsupported for target")); + return 1; +} + +#endif /* defined (TARGET_USE_SCFI) && defined (TARGET_USE_GINSN). */ diff --git a/gas/scfi.h b/gas/scfi.h new file mode 100644 index 00000000000..07abe99ab27 --- /dev/null +++ b/gas/scfi.h @@ -0,0 +1,38 @@ +/* scfi.h - Support for synthesizing CFI for asm. + Copyright (C) 2023 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 SCFI_H +#define SCFI_H + +#include "as.h" +#include "ginsn.h" + +void scfi_ops_cleanup (scfi_opS **head); + +/* Some SCFI ops are not synthesized and are only added externally when parsing + the assembler input. Two examples are CFI_label, and CFI_signal_frame. */ +void scfi_op_add_cfi_label (ginsnS *ginsn, const char *name); +void scfi_op_add_signal_frame (ginsnS *ginsn); + +int scfi_emit_dw2cfi (const symbolS *func); + +int scfi_synthesize_dw2cfi (const symbolS *func, gcfgS *gcfg, gbbS *root_bb); + +#endif /* SCFI_H. */ diff --git a/gas/scfidw2gen.c b/gas/scfidw2gen.c index 45fe7787653..651a7885cc6 100644 --- a/gas/scfidw2gen.c +++ b/gas/scfidw2gen.c @@ -19,6 +19,8 @@ 02110-1301, USA. */ #include "as.h" +#include "ginsn.h" +#include "scfi.h" #include "dw2gencfi.h" #include "subsegs.h" #include "scfidw2gen.h" @@ -43,15 +45,33 @@ dot_scfi_ignore (int ignored ATTRIBUTE_UNUSED) static void scfi_process_cfi_label (void) { - /* To be implemented. */ - return; + char *name; + ginsnS *ginsn; + + name = read_symbol_name (); + if (name == NULL) + return; + + /* Add a new ginsn. */ + ginsn = ginsn_new_phantom (symbol_temp_new_now ()); + frch_ginsn_data_append (ginsn); + + scfi_op_add_cfi_label (ginsn, name); + /* TODO. */ + // free (name); + + demand_empty_rest_of_line (); } static void scfi_process_cfi_signal_frame (void) { - /* To be implemented. */ - return; + ginsnS *ginsn; + + ginsn = ginsn_new_phantom (symbol_temp_new_now ()); + frch_ginsn_data_append (ginsn); + + scfi_op_add_signal_frame (ginsn); } static void diff --git a/gas/subsegs.c b/gas/subsegs.c index a74db52637a..9e940a72eda 100644 --- a/gas/subsegs.c +++ b/gas/subsegs.c @@ -130,6 +130,7 @@ subseg_set_rest (segT seg, subsegT subseg) newP->frch_frag_now = frag_alloc (&newP->frch_obstack); newP->frch_frag_now->fr_type = rs_fill; newP->frch_cfi_data = NULL; + newP->frch_ginsn_data = NULL; newP->frch_root = newP->frch_last = newP->frch_frag_now; diff --git a/gas/subsegs.h b/gas/subsegs.h index 2bc7adacc56..55e1a2626a2 100644 --- a/gas/subsegs.h +++ b/gas/subsegs.h @@ -40,6 +40,7 @@ #include "obstack.h" struct frch_cfi_data; +struct frch_ginsn_data; struct frchain /* control building of a frag chain */ { /* FRCH = FRagment CHain control */ @@ -52,6 +53,7 @@ struct frchain /* control building of a frag chain */ struct obstack frch_obstack; /* for objects in this frag chain */ fragS *frch_frag_now; /* frag_now for this subsegment */ struct frch_cfi_data *frch_cfi_data; + struct frch_ginsn_data *frch_ginsn_data; }; typedef struct frchain frchainS; diff --git a/gas/symbols.c b/gas/symbols.c index b07ed244142..117410fd1a0 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -25,6 +25,7 @@ #include "obstack.h" /* For "symbols.h" */ #include "subsegs.h" #include "write.h" +#include "scfi.h" #include #ifndef CHAR_BIT @@ -709,6 +710,8 @@ colon (/* Just seen "x:" - rattle symbols & frags. */ #ifdef obj_frob_label obj_frob_label (symbolP); #endif + if (flag_synth_cfi) + ginsn_frob_label (symbolP); return symbolP; } From patchwork Wed Jan 3 07:15:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 83206 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E299E3857B94 for ; Wed, 3 Jan 2024 07:18:27 +0000 (GMT) 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 3FAC938582AF for ; Wed, 3 Jan 2024 07:15:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3FAC938582AF Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3FAC938582AF Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266160; cv=pass; b=G2LUbwyBm8PCO9wLznCvrtoexh2dQRHhAGYiXSMC074V7MYMvAM0ZMRdC33SJ9Xm+OjWHL/aNIdo6Vshwgd1+gLuZufghD2ykWIk5afZJxsoKSvNpBgbMJyAJuGYIVB3/oaN/8vZ9OUJuEPnssx0cTabjmtH9Ni/vOl7ILUlmrU= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266160; c=relaxed/simple; bh=gdS1qPsOc8W+TwdtbriCpLK3WcC7Sv/Ifw4VTxi/wKE=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=ueRmzvDuoj26SZEqrTEBZOmYiFq+i66RsIbivl33aB1550XT2XJ6+rq8NvSLi520nRnzDR8cs96l6T+CWzJ82VA5cRrKoMhTkisPzRZYSz2bm+Jhq77vGcm9FnTMXW2oUe8CRlu0iaZHeaUP50QDbkFklB4uWcCDn7d4kW5lcdA= ARC-Authentication-Results: i=2; server2.sourceware.org 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 4030humR019987 for ; Wed, 3 Jan 2024 07:15:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=XnpP2dcsbgPRJYq8NUxEbp1xXS1lloj4SAFsmfJsA18=; b=arJCPMHDILv3GWDGwhGrEbwO4uizIt94GV19ML/f3fVDeLxHtptKHiV6Lv6AGa3VfuvH x2ej00i5fXpmmoviC1GOhMKpWeoTvFRhgIQiDZWFeYXZELdBOKOaF/vvF5aP8qRix8Ch aTFv0RUX4mwFLOMW58uTngGfbDO2gpKZWWe+dbk2GhQPkZzhq326ZTjLCyO8RPzH282O ZUhxs5HEmaXMC9QwDfgO7Y4/ICETymuhkyZbNSKncA5CiPe8O4rdO4yTFS4hP9D/Oc4k 2PcLKcpCd2tktumtbJchEa9brjJHunCcLhrYZgvdHNnUhsTyQJMgq6DNDDqR7grLLU0l Aw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vaa03veq7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:15:58 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 4036W3sD001706 for ; Wed, 3 Jan 2024 07:15:57 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2040.outbound.protection.outlook.com [104.47.57.40]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3va9n8pdyx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:15:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bAzCBL2+uqb7sAB8h73HdqwrvAfWsRKwJ0vUcLKkxbo1QNvMkjNfgkCWsvwp9n0QmVTTTll6U1l7GI6pKR1NyoTRkHUQOELjukbRdZOVFwUNOVgtMET45ZiZgBz0NaUPbmfXkd2C8if01xCqaw2YDrct002Ging4Z4/XsTnXBtqQfkN8Rtwzs+l3CgfLD8A8VvxnZEtOU8zg/g0mT03pQoQVlbtB5Vav/BFwsKRrbV4qSR6eMnFG0ghL0gqPBAB38IDah+yhdkWNefSMImr/uyF6ZtmMejCxBc2dC6on3eGXwIMXBdq8fOxygPW4ysQz8e6ll6yWZIbxu+Kkk+dY0A== 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=XnpP2dcsbgPRJYq8NUxEbp1xXS1lloj4SAFsmfJsA18=; b=Q71ztxJBR5uNnX251ejIEaYsgWxJYZFgYkB0fkhTVhv5BzpDrA3KMUraWLWurahTzFM8M0C2B0JkTS07abs5tmCGG9wVuMb+qschaujzNuY3NbvoI5yIHex8wgTwp2JplxBYWmnc9OXVrfMlZj50hmyy9H8c4nrfumBZaaBMq7OZmJ0LvrSzuSO6EeCi1OJtRZ5PijAE4DuLuG5edgu0BdDhyFAI5gfyMsfhuVgfu0bmbPX/TTSoC5L2+qusRa94rq+6oXSL+iaSR7u1ZYzkslyeL0pf1nby8Liu+43kyfsY9717+c+1lCFG0CaLyGSzepu2TX32RPJg2f5C5jbNbA== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XnpP2dcsbgPRJYq8NUxEbp1xXS1lloj4SAFsmfJsA18=; b=h8wUCsJCrKqAD7XHpc8shPlsd98kSUHZ6ewHMIbDA5VC9g3VOjqn21VbdZdj9cz1qlvohdUzhQxbWnD39XXetrh/HwiCvXDLPnu3VV5Hzs6WQsQaqORlEdnZpYOY/Cq0Sguy3OX7LUvVYwBGcuX9pLp2Ie/wm+SoBnL3VrkYKW8= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by CY8PR10MB6777.namprd10.prod.outlook.com (2603:10b6:930:98::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.25; Wed, 3 Jan 2024 07:15:55 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac%4]) with mapi id 15.20.7159.013; Wed, 3 Jan 2024 07:15:55 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH, V4 11/14] gas: doc: update documentation for the new listing option Date: Tue, 2 Jan 2024 23:15:23 -0800 Message-ID: <20240103071526.3846985-12-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240103071526.3846985-1-indu.bhagat@oracle.com> References: <20240103071526.3846985-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW2PR16CA0048.namprd16.prod.outlook.com (2603:10b6:907:1::25) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|CY8PR10MB6777:EE_ X-MS-Office365-Filtering-Correlation-Id: 730e807b-63f8-49f2-9b5c-08dc0c2bd38e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2U6F3owuAh0xwJWbLL6jI/DvzzrL+ogTTwN9scBsEidXXbtI3ukOfNgEShsA2iU6BuVcSL2UUaPx6TjYUpxZ7n8TP58O9tIb21TFI58O0w8xNNBrb5kf1Cdj6+CPQcsIoSBIsWOGs0EMXzxlTlhTfKeqdaotKRXJjRLxqM1brBHWPK+jjfHSpZ+LsNWDPgtfRevLfqHCoN7SioCCnl+mRsQCQOpWtTW7CHHcrbYqWofecqiEQ6qZ/gOuxkX8/lBFoYEm5zy1y1/mNQRfH9hESLwbSXTWvKoOlKdt0Z3EYTpr6ZQmochEv4qOw8BvEbJSNcJZO2VY84hpL5zvEBM0CHIMfz+Q1MtGRIaRcKTuAkYS0Dkuwcy0FhfrmvbiqU/7FzznOnKRCHw1ZoUPSbcH0InA/Ddm0t7Y4MFm5vo1mf/IHWir+0uM97ToYJwHk/5l6yVBnpYWTFj8QVOllT25Y2InCr+KNTK7XFcjrJ0xfb2lyTdMSXUoP/+6pkUllg2yqijn9U0Mf9aKZynCgNdIsj/CuMxusUVv//tOvBpciGq9rhqTUkwbtHG8ggT+COPL 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:(13230031)(366004)(346002)(396003)(136003)(39860400002)(376002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(36756003)(86362001)(107886003)(1076003)(2616005)(6506007)(6512007)(6666004)(4326008)(478600001)(6486002)(8936002)(8676002)(316002)(66476007)(83380400001)(66556008)(66946007)(6916009)(41300700001)(2906002)(44832011)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GTi4c1+teDWZ0sMuxHYFiMkwldtFH+hS/ddUqr1QpEhYYQGldx6781XIewKusWOX5OlheUpxnbhAcyte4IM2bvMB4EAUqwO1RBRV2GP7AOIq2vdAE+w+0FrQY15whQA8sONBwOvesl8KImrQ9GJvlWNUbDi0Ol8WFZw1itn0COX+QBu7FCaLwgzygOVSObwt2u6S1KeY7z38MGFfjG25a4Fu4kpkPcr99q7L0mWuB3Zm5f8shSzi5+OoageYsYu6kyC4ZST/Pf71KGIFZJ5OKFc7pCmfjboCVCWsp/Q3hILrpXcDkO6PAuC9tRYVnb/mBAl/tNZ/3svxS5l9TVaI92jMlAjLl3JnvGVMJsjyOoc/pD+iofrN6RqLzkxA7jgNhhwglE+uTfncTf1rhSYpqx+I9EnOovKKfykNYHqj006cirEja/EkrKEL7tV76gepxguFnRLI6ogpnTl+rfJHF9pNPI52rk7amCQKQxNXaeQahD5ngPXZhbKQxFXU/se5cnuqM+/GtHWZONSxj4/bvLsKffKLfDtZ1ssIXa5eth0bmsr/4Szi3zSoaUUwabM+7JlUaZaoJB+XR83lIKdly/c8uY/oPcf+6txPOAfnGNbUfNxe05q02LODoihNLbhGzBfNXjI3SnAYC+aPN83pYseBlLM43slASBQGP21xpDl7LVBMgWBd5ntUubndK2jaatenCctWLefUnFy7Ms2Xy5Vp+eG84XkKrsBgqK9IKJ4pKxBUo1pSkSeSUTCp/aXkUsaa8/Zk1bCa2iwY7YQDCkWeaSyjs+4UfitpBUiBmXTHaytufuQmQBBa/T5kir7P9YgHIj+dPX8T0ImvKvRWW6maVJeaYxrI9zaFb0X/3mLfEc3G3CXcu6H9+7l8O7w7ZkLFuTE/yQrM8EHmCL20iwyLMREqllifJRe0WX1g8U7AtIdB+XCvGo6nsiXN2FAWHrU+zqADFwtnLqwzQFFp1Pkyx7ZAbWhroOMd9m6X7TzKL1u4dJVhodbYs3m5fSXH4tjaHxwlCUgHdKPLU2MWLeW7IE8L4OvqpsRJufPC5ZMfCW5e2ievLArDX1TSwtdDVtadwmCaAvJSjxkcz/4fwsr5sssrVZy/WkOIV4IjNo2ZHY0sxZ5X6hi8oOYKLXw7aH9FkRS5T7KUuSJrz2LCBTEYKRc4pioiWeQpsO00gZdgVpaHpQnFvwPv+v/swBqHYOuoTA+zDmV+Pe28tyuADqa6xiQeeLdw7UPY0mnPiX73yvJF3sugZEUColrzJVk4OGFuCE3jFHe5/Q5rVcu0ndBRG6X1ZHHKe+AG1U5MMUKXyee8zuzEwFyDmw29xlh8MoBMIJpoNmyBQkYqOWW1qWg49vTefXWFe69Im2KMaujip7iEQvOu/cGYtXZhzJetf9q51rYt/tyogR0szdURi4pGaHK5m6xZFoO2hnoJqfO232rWGuzT5IW+Rl87kVv7wa6Uiucla2ylRgF9SHtYahDfpmMWI8GBKYTpaj7YgSRIVymGfVVKaUuudxEF/5zrP8pDRR4l4jrps9A6XCv4sPWDCg37X+dq3MTLt0BTixZBGFOB7bcBVRvaABxSg5oWsPmUUIH4pFVX5VUgqzlda2EL9N5+lG+uW0OIphC5xT8= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Vg4wE6hpbu1C7hVe9PVAB5oTO+SFFfsQHnVGWJcmpFujPdLDKmO462UlPNUBmPqkwmZTblFVgImvmdLArC5nNujA9Mx6DUq7Kz03wfyNT2Mughp3yCP8/a2iyPuzGXw6RZZ5qefnHxQsAl814Eo4bjHNUlcmPEsoyk41BGPy6aY1qDfctOUN8XpWg/1aFN4mHhO4fM1w5mufq8ZMEg7ctbuiZ0ESqr0TlJ2i+/rn5s+QjuMqw4/PVns7GN34RY98eDidA340Tu2uD4I8rdLXK71tq9mjXt4DThoBA3SESQ0wHgMFmbg4KZkIs+S43vOPY1VNzQjez55elbMcuhaj9ZGKWlNBoaNuKkENg4pihAdbayeb7v9x4aj7QaMHT4n7cJOt2exMlNlfUyeEvk0xt3aDksBsiQDilFo9ak9f3/4yxS8blxcCBGfoQx98vRN77wlu4vQawT6u4JwELfI2xzP0UXzFg4pbUMj86CPhBgxuLti3SYsd+E2TFW05ae4nTLKSAFNMmbzGXaVM0df+rL3YHvZfnUTemO9VE3d7QxoyqlMzsr42/j5TeUuYorqm+HtFxkpQgDmNRIWn3CqpUv+TULHGeU/p1YVhpq7n1wM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 730e807b-63f8-49f2-9b5c-08dc0c2bd38e X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2024 07:15:55.3113 (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: pC21gtkR91Y0cIGS7HgsaQrMQxq6SheOgFQE2pRxj3WcuwXRczn7AAR5ceuzssTyc0qJWDb9ar2MUP6kRwFWnw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB6777 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-03_02,2024-01-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 bulkscore=0 phishscore=0 suspectscore=0 spamscore=0 adultscore=0 mlxlogscore=906 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401030059 X-Proofpoint-ORIG-GUID: Q9fcozkIzZobTZYbcG1yyvGBtPTKEyR6 X-Proofpoint-GUID: Q9fcozkIzZobTZYbcG1yyvGBtPTKEyR6 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, RCVD_IN_DNSWL_NONE, 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.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org [No changes since V2] Add a new listing option, -i, to emit ginsn in the listing output. We may also emit other SCFI information if necessary in the future. ginsn are most useful when seen alongside the assembly instructions. Hence, they are emitted when the user includes the assembly instructions in the listing output, i.e., "-ali=FILE". gas/doc/: * as.texi: Add documentation for the new listing option, -i. --- gas/doc/as.texi | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/gas/doc/as.texi b/gas/doc/as.texi index cfc1078c36b..6e0fa618712 100644 --- a/gas/doc/as.texi +++ b/gas/doc/as.texi @@ -226,7 +226,7 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}. @c to be limited to one line for the header. @smallexample @c man begin SYNOPSIS -@value{AS} [@b{-a}[@b{cdghlns}][=@var{file}]] +@value{AS} [@b{-a}[@b{cdghilns}][=@var{file}]] [@b{--alternate}] [@b{--compress-debug-sections}] [@b{--nocompress-debug-sections}] [@b{-D}] @@ -673,7 +673,7 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}. @table @gcctabopt @include at-file.texi -@item -a[cdghlmns] +@item -a[cdghilmns] Turn on listings, in any of a variety of ways: @table @gcctabopt @@ -692,6 +692,9 @@ include high-level source @item -al include assembly +@item -ali +include assembly with ginsn + @item -am include macro expansions @@ -2415,7 +2418,7 @@ assembler.) @c man end @menu -* a:: -a[cdghlns] enable listings +* a:: -a[cdghilns] enable listings * alternate:: --alternate enable alternate macro syntax * D:: -D for compatibility and debugging * f:: -f to work faster @@ -2442,7 +2445,7 @@ assembler.) @end menu @node a -@section Enable Listings: @option{-a[cdghlns]} +@section Enable Listings: @option{-a[cdghilns]} @kindex -a @kindex -ac @@ -2450,6 +2453,7 @@ assembler.) @kindex -ag @kindex -ah @kindex -al +@kindex -ali @kindex -an @kindex -as @cindex listings, enabling @@ -2459,7 +2463,9 @@ These options enable listing output from the assembler. By itself, @samp{-a} requests high-level, assembly, and symbols listing. You can use other letters to select specific options for the list: @samp{-ah} requests a high-level language listing, -@samp{-al} requests an output-program assembly listing, and +@samp{-al} requests an output-program assembly listing, +@samp{-ali} requests an output-program assembly listing along with the +associated ginsn, and @samp{-as} requests a symbol table listing. High-level listings require that a compiler debugging option like @samp{-g} be used, and that assembly listings (@samp{-al}) be requested From patchwork Wed Jan 3 07:15:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 83213 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 701BA385DC28 for ; Wed, 3 Jan 2024 07:20:40 +0000 (GMT) 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 8E4F638582AD for ; Wed, 3 Jan 2024 07:16:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8E4F638582AD Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8E4F638582AD Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266163; cv=pass; b=vE/m/ZG5/2GkJ7N+qY7m/rOVnAvr1YrS1dIQ8tl20jBkr6GNeCwO5t+RrMs/QhbnxyZG8/TUe2Ze4+ecQIwvC1o8JSXr8L9TzAdXyU6IBIbcpDV5wmsWf2lEHgbwenokvpzkSkGYqvvZfGnwvDLCqYNKfjgyUU88i50QHTfDUkM= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266163; c=relaxed/simple; bh=wx7FQQr6lUvNkwz+2TDG6AEEoT7Baet9MbQIyVsdj/M=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=wyB+BGqRkMy5VWdPTp5VOiSu7dt2GMyCsZdGTh/NRQ4nGLD0DN0qM2j8yPM+b7ltkHvohWqW60o8g06KYGkiYJDDRWocFvymmVxgA8BFyFaxW+urgUfKwEbjKUV3EdlWRrirhGz9P4D2j/pod8wpEuKPq+EUMJGnas/dt89VYDU= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4030iNWK023855 for ; Wed, 3 Jan 2024 07:15:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=Jqcx6t4YWX9+ORzbpUeJY9x13XOZEWrAZB8778UBWh4=; b=bazdh5PMfFSvnMjSyUi58SxqrYRExTGyYterX5xQiAs2/zRE7iS3Znfe6ao+G4V+IBu9 QT0HlMGqtlHbb0a1pvuaZc/kLUKDsGW4Sl8NWiGCp80oyB2zIU1uIB79LMh7O160tBjW fPKCxSYrUguumw7je/UgGD3+KIsVYZMXDQ6+ApnSDFe6F6pXLVbiu/Z50lpQ0XDlXDyA TwQiUqbJ4SIkIsO3/16rxzeKzzTdDzJUIxsUbcOF/F1UjSQ44zjiLcTVTd0OHdLvzdCR Sc8PovtILrq2TohZ0RJgXz6inaov7UfwJMEWM5YKKzPIScDbo6xEHrlfnwXhh3iqTtBc Kw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3va9t24fh2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:15:59 +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 4035VX6d033634 for ; Wed, 3 Jan 2024 07:15:58 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2040.outbound.protection.outlook.com [104.47.57.40]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3va9n8qan4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:15:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XxiJ3ly+UHJiY6efzSJeKy/U1N1ULCiSz129HTn19C+F/TESu1CvYw32/k7PbPxTdSf2O+oOLhnlYWNxrhDdHpfRAxBz23gORj18gFGFQktTezCW0vMQjiZigh7nxZXRQ+TDr93DR7BTeJt2caHdl4UvIkrHZ7wjw7MxSrLY6ekJSqBgHeTPxUrKeVHQqbz+11YoY4Ir0SBxB80sVUyYiC32D+uCW9BtEGUrlbD+XDxkXJwcoxLjmupfd327h4+/yH34mJWS2zkMbyG1AxVmNJF5Qabb/uKkyw3gaPR4F14A3zoOdk9eKTIxNPxZ0ajHe0jBxFcUjSbivlWtauL6kQ== 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=Jqcx6t4YWX9+ORzbpUeJY9x13XOZEWrAZB8778UBWh4=; b=I6pid4dmm42e+NqpxoaytPgYJyFKeGsB8AvnNy4vRru1DCskzTEhS7bWtGOXkgPUZ9+gSOhjveuHkl0ACYq722gLNLqJpQoK+/aHwVd6yv+D3YY9uykEy8X0IwtfzejPfSNCn6/TI45HCGeymnKVLUR4HZrXvRx0hjhqN1IBHJavieac2RskM0EP+0BxpGALFtNHwbXDe7KTR3Bhd+vHao7XoJbLfUVKHqW5miEGSu0D4Ke0IGb+q8Pej5MjV5xGscKz1oN1CFiXEWxkbwKke3/MtIaccQVghyGXzoScbG/gahEzwtlNmIxUwvEho/6K2lfgYy7I33Di1bDHjyFefA== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Jqcx6t4YWX9+ORzbpUeJY9x13XOZEWrAZB8778UBWh4=; b=VnwAQmEXe+WDr8AH2t9H6qnlQaPBEhuqGK45Pt2ZZWs6C7IlQZ0zLxuLRIF8WoMLi6iSOZluFCZMIjh7vTFuMEmoz9czF2kaAtdZnjLPhbyk2SJORcTd8iv3wU46+vNg7SinF+lyYom04GMQmxNgWZnHSYvwTZzvTJaR3kOWaks= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by CY8PR10MB6777.namprd10.prod.outlook.com (2603:10b6:930:98::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.25; Wed, 3 Jan 2024 07:15:57 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac%4]) with mapi id 15.20.7159.013; Wed, 3 Jan 2024 07:15:57 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH, V4 12/14] i386-reg.tbl: Add a comment to reflect dependency on ordering Date: Tue, 2 Jan 2024 23:15:24 -0800 Message-ID: <20240103071526.3846985-13-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240103071526.3846985-1-indu.bhagat@oracle.com> References: <20240103071526.3846985-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR03CA0109.namprd03.prod.outlook.com (2603:10b6:303:b7::24) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|CY8PR10MB6777:EE_ X-MS-Office365-Filtering-Correlation-Id: 760f2384-51e9-40d5-7b08-08dc0c2bd492 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: a0u5VgFE/oV8B/2XVx2SblCSNfEpREzr4jRzCa63YboiI+Dco5AxUB/rvLXY5HBk8xxPRKxll2+fPea+gutoH1qmwM8YTxrvHlUSbXHBxkVMjXaKGKxSpcyy/6lgiLTKu4HNg6OBEfimBIzBLk883BJBQwndown/LSDbb31kBo+p2kvb4ob9rEk5M+a1qTwCzLYNpCGjijzZUSv1GcIrJNaIE7jVJzEf5Lqe9Gv8Htt5Vmo+yae60wrfQ+HsiAjyX39xri4NVztOWfjPnpOATtUUbSRBNbhw+fs91W6isaZe/I2jBX13SrNghfRBF8bpOr0FnCrqAGdd91lMZvzhrmFNc70l8CbUeUZB0vyOWg6Ot0EmZqJ4t92A36Df8Qdrhcm3c4M9aa5twWMhJmcwUgv/56RNf5RUxEIGLKqKUUpzmRJlyTtpR5YWA1WCXjmNw3DENKnZ/ZTTGCWcH++Q4gOC5b7hrn/fOuBQfGDEtEn8tAB6cMUXz4OedUNITBh+tfiMc9jhSo1LmO8zi5OcBU3mfmiIQBGO+HwH+yShcWluYfSrNahInVq6e9S9+fpr 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:(13230031)(366004)(346002)(396003)(136003)(39860400002)(376002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(36756003)(86362001)(107886003)(1076003)(2616005)(6506007)(6512007)(6666004)(4326008)(478600001)(6486002)(8936002)(8676002)(316002)(66476007)(83380400001)(66556008)(66946007)(6916009)(41300700001)(2906002)(44832011)(4744005)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cTZ7M/C38+d4l6m5AwX6vSBOwWiULW8aeb9Hhf2MhuMxkA5nPhsUz7Z1bm5FnRdzEkODFEeICd9upv7NqgjLggVgFtRkz8dn6du5yhjnBxE5YRPkqwEV8E7UYApoRr5puXzPF9zlsj/WQ/lDjMTVyLpJAvWlQ3KTi3/GoOxv96T5nBXyKFli5DXCwLPwcGfEdXSxS976+0zlblywYnRBVoOzdWvfYPhIw99/1tE+XtSK+s/iY1osEDLjKFAUpswCqHkieNqZJBoA/y1NX+WBuV+7u37dbHGsRnGPvYa5NM7xyqGDq4pEupCeGjHJsWLmneL4vEzfJy5Yz8GGA6OnLT9t/oYe7DZKeFXSrpVGj/jwHpDCIhoUa+RgW9OtzlXQPXOQOaVvjWwW5QoQc+h+IDofGjFq8VhhQd8xQpYPqKc2CL43SPxR3V5H37V9CCIG2kedIAgip8MwosNiawaWOhO+xDbRjAA5nkxvawjmuq40JkVFy2xA7NWvyxcHKi5d7zJ1KafwYZkwZ97UVlEBY5TMzrmr0qm2p8T+5LsfzH6NCC3/xAFRGDXvj203Q+v67jRhJl6b5jXbsSvCAnAY+KKhGdq/qdDpiw6pkHBMqKxm21JwCvgdRCJ2NkzOhtaefBaz927zliQ4HxgV5FqfRZKhL9xIbNx5Tkiyxlo9AWc3LURAlzqWlmiIgQaoeqcISR2RBhNwdXiVFSXt3XPQSzLJhwgm/35zxLcDFEuVT62EwGqsUZ06UBXgDDlwMH+mn1xqCybu3foUP0D9G7pC+RxuhdVs5J8T7OQWmpYgC3t/x81i5Ud5P3zfIMtLgzXAFOo2n8p5xPLikBzmAIt9Unk/bKDSIXq8yOyRa2u+LWplpwK/RFJtoSCpj1QGTItflqkqzcLgp56UQcQRxrwBnT7OokXWdgmZOxnrzoylrpZv+AEABZwz3hM43PFq4L+Rej+dQOGazZqeLB2H5jk0Px1iBmvjWwJJC7od3fLq6guhwl9pKSU3xMTxjpQD7MEN75bxdxmG6skESvOyE2L3wbo/4nXxUV8VKAL5w3Y6XBnPAojQdD7zBWbfrVl1d+rq194ElrVfW9GTIoEutU5JDzsqm+ch/n9c4LIgt03j/IcA5qBVMFB9Jh4udHHKzWmh5IKSyl14wbE7m0G+f57rY9kYzyM9Jl5lPGC2A8fHNgaI1nbqddUBXWo6+0FBuGbvsrYkTQYJzWHxMDjcA/p45WTnNpjWJLjLDGBNRPEH08rMw24hvNjwfh0+DBOaIq2dRUUinVR//YHQEK9+DS6JxruL+aMERkBm8QDZKCB/sOb1Jly0NCZ2XPkT540E1tXu2k4Jkj9lP8N8evwHH116zCa+qQ5fMNwJlpjmRlOstWI4HicQGXyqR40r74j02JUvgPl6iJAudrQ73yob97/lrg8X7rfR0lAyi4pPx2lKmoeEYLqsbF9DirsB21TDSsYGPwdFcebCGNJYH+Jbg5jVIuMsc+fpzNXQ8xIauZj1m4731S55wiosDzFp09YQlnxBfl2lFhwAWL23EAhuuBp0kI1jlCZ3xVWn54LBdYG59AhSporPcuA377LMR9AKDYz6unfhQEOxQkAEKeCWswpXfhQlpRHUzJ+se34zQ0RJaYA= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: zJHf/bUB3W9LcrSC/siazMfFTFBBG266qdUbViIJ68YtIiOFmig6CDJDUpi+nxsb0xIiRi9Z5/TuEY0SzNGkojCfuXxboPGUyCLflLmTtdGFV9BsFud7aw8D19vRiYUVEVFV8YiytiwyTuhP2e5sAmJckfcFZIulQL+TX5p97DgzLKhIO9t96vpHrqk+FIe33GM8feqKyxrDDdQzTzYuggHfvP8RLIKbZR2n+5ARzdc+tcuQQH4WeWzNZSgCB3zQfiOpu/HLvUimz0SeM2E5dhcc2OpURaUOsx1yNKhrW4xaWkXVyMt5hdHPMDhyDW18KuK2WuAE6Gax+wN5fQ9yqcgqCbtbcFYqhwcdpwJF4Z1d7ooBn88vmJjbmCe1r1EEE++lhsc3QKdCxxjg+Gtpea9teHTv9eXCd3ucasDZXHtHSHNj4EXzCRteALir2D+biuk+OCWVGLQ5TgG88uTDESObZeCgFaMIWFdoVDhdcMto+yKKIsu7jymF5pVHXwua3KpTSz4oi81WTnvn29eMwg73R6yFZRmkbq7L+IKveIP3fReqG+jmP1HJ9X8mD/Rmeq5CpDxx/befekHFoDHdqNByieEW9qhGWWAIiCOtp1Q= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 760f2384-51e9-40d5-7b08-08dc0c2bd492 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2024 07:15:57.0176 (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: 2q1Hvy+3mBv7q0cOxanRGIdsyVofvbbI0Eoz58kANg0nqKUdnFF1gZonObNEUwXCnrPlCe9ANj/49Q++yJRnaw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB6777 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-03_02,2024-01-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 mlxscore=0 malwarescore=0 phishscore=0 adultscore=0 suspectscore=0 mlxlogscore=776 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401030059 X-Proofpoint-GUID: b8YkrVKQUUyETmGkN_pAb4ElQu9ePb5e X-Proofpoint-ORIG-GUID: b8YkrVKQUUyETmGkN_pAb4ElQu9ePb5e 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.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org [New in V3. No changes since V3] The ginsn representation keeps the DWARF register number of the operands. The API ginsn_dw2_regnum relies on the the relative ordering of these register entries in the table. Add a comment to make it clear. opcodes/ * i386-reg.tbl: Add a comment. --- opcodes/i386-reg.tbl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opcodes/i386-reg.tbl b/opcodes/i386-reg.tbl index 8fead35e320..56c7655dd88 100644 --- a/opcodes/i386-reg.tbl +++ b/opcodes/i386-reg.tbl @@ -18,6 +18,9 @@ // Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA // 02110-1301, USA. +// The code in gas backend for SCFI relies on the relative ordering +// of 8 bit / 16 bit / 32 bit / 64 bit regs + // 8 bit regs al, Class=Reg|Instance=Accum|Byte, 0, 0, Dw2Inval, Dw2Inval cl, Class=Reg|Instance=RegC|Byte, 0, 1, Dw2Inval, Dw2Inval From patchwork Wed Jan 3 07:15:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 83207 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BBD2B385AC11 for ; Wed, 3 Jan 2024 07:18:36 +0000 (GMT) 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 F204538582AE for ; Wed, 3 Jan 2024 07:16:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F204538582AE Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F204538582AE Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266174; cv=pass; b=ACh+i/SJAv2hbhCCbjEU6DZgia6zOJKdXMtTYovi1me4SsKxa7jYheIYDk0hmQSzoy8PYpz5RoXedKLRuwpq54p8UyKsmlxtvtSB0FrR9GhLpSAgEo1cZde4DoLdyaAVD/fgVMSUZyXbdtSRCZbkmoP0UTNX6/ykFts15Rad5Bg= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266174; c=relaxed/simple; bh=gpzAOZ8I9DMvgDEqgRv//U+ZVDBlFvPjbAzlPb5IH9c=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=HFVEshZQaCpfP/vO0ITces6XDH01snLkMlTmuZix0XXg3AP8wa1BnFXOXYpfCbERChGm01hkGtQGbKtFOJlbOH+FNWk/OYAJwv31T6pVFcmLDIrXxT3QKQiSvOIkDGjjn+l+q+CNzD8DX0xLkYs/tJfqeXUlKjooAAPRPNLcvYE= ARC-Authentication-Results: i=2; server2.sourceware.org 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 4030i0w7029230 for ; Wed, 3 Jan 2024 07:16:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=02L31Kem3DbOWb+JAqB+CT9nxfp9q/OEzEjuhar9LPk=; b=FQKoJhL2UE0bYB8d0YVEW+eVRku1CXWwuLraz9wcA3i3mFaGmnVr6aGubN1f3nPp8p5X GyC+LuxmDftPMm9R74vHUBLBo0ltwYYnDyS126jynaOtDnmp44yFY78ZHZqfPQKg22WL ta/5LR4LPqvxoN/Z1Wui1DnIPFqAA9NKk/aeHrwizilv1WnoGlefTL87eJVbBnRFxwvz OlODauwaSal0XFQwovvnPEN5cH0Xue0IDW45TLsQizT65n1mFrVUIfeTfbCeLzFOFowj ygVHHyNEJ4iBP1+e7nCShV1ODzIF/PGtguX2pswQA5ifz8FJMv/oh4TNYSfb4cMs8MEh 6w== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3va9me4d4j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:16:05 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 4036niib024180 for ; Wed, 3 Jan 2024 07:16:05 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3va9nf6q9y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:16:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HuWqc07rH9P5WK/Uthw4/cPaK8cK7o09NfJynECh9BLsCy9ffCIOHVTqgr8aPFlst4pjkBbFdKy4MMBf4KEqPkNcagoa9GBc8raB/Zjurg3IZF4ujEksdnZIYEvhgCQLv6uuzg86BqXZtmSpvY99xrlTBwcP/YChYNOwVFqsWqx8tpGvfUjc7QjeAN/87d7NBqHVAiZV2KLtfCDf2WuATw59xnPVXn4wY0z6A7+Dk3VmydTmuLKvcHpiA3ZZqLYGrzua9YvHiyyd3cR4WVn8h+yHczTtJUBa8DNOn/og7DBkTk5jqWbswSBNR+NBhoal9W3m7uNXyLfHVVEhfPwmyw== 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=02L31Kem3DbOWb+JAqB+CT9nxfp9q/OEzEjuhar9LPk=; b=j+dsQyVLNkNwGrVwHBzksUjpeoZi/pBFJ7P59onq7QYJ4pG1Xp2Q7Lx1Zlj6hdSC+2CjSWeQI8ZHTbfvNSaB03y0tOFuOok9lxmpOWFWO/tLjK+lsCEumh/E5ejBm6GlS3BTuREQXn83GZp80rdz12LwWHG8bkD/nzrEQJvUBv+v6dsMjIuxGdaFjH/73ckqUB77EEl5EpgXrIsEMQx7iTln24nOZcfgXXucHimtIwysL3MzEx+Ql5mlsG0mM/3Wdb+nrmZY/Tb5HK9EofccoN3AbrwEU54l1umtzTba/myuFoU5vA7kPhqowqQJj1p594t2d15sjFJlNTH+SD+6HA== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=02L31Kem3DbOWb+JAqB+CT9nxfp9q/OEzEjuhar9LPk=; b=ftWcQxv7L8Patzp7UwVmtgCFGgGwPqN8yxvGuXcStIszmeJPuYjzrkjrXv9z/oR4rZrvUqZ2E+KyWW3aeE+2TO0bSsYsNCBQfxBhcz/dIRSpO86Hf3dTp0y1DVXYGQI9+A4I/5pPSh+bt2RGLBzBZL/hHy+mUP+s7ZuLhoT0brs= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by CY8PR10MB6777.namprd10.prod.outlook.com (2603:10b6:930:98::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.25; Wed, 3 Jan 2024 07:15:58 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac%4]) with mapi id 15.20.7159.013; Wed, 3 Jan 2024 07:15:58 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH,V4 13/14] gas: testsuite: add a x86_64 testsuite for SCFI Date: Tue, 2 Jan 2024 23:15:25 -0800 Message-ID: <20240103071526.3846985-14-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240103071526.3846985-1-indu.bhagat@oracle.com> References: <20240103071526.3846985-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW2PR16CA0062.namprd16.prod.outlook.com (2603:10b6:907:1::39) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|CY8PR10MB6777:EE_ X-MS-Office365-Filtering-Correlation-Id: ee8f9542-8784-4b2f-aa5e-08dc0c2bd585 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P4zi5y4ExP17cs5I6wj0FRVNEAH5qPVWFX2knKrlSJSrbnDf/F0rWdhcIMkRKBllbqygNCTUX+ca3E+ORilBRdUqPcCgXvg+rK+Isc8YtDBIxfPxSEnnjp664+2XA6yTG6GULmgpvdrFOeDlD+RehUW1kYLDvlXciQhRhhWyeUSmeEwAW44EEdWo7GkZDQzDixQxi5M500u1LtdJnqp4smX3fHAsqwBGyE9INpZpmqZBEw0x8nl4g97qGyxqKXLKq352rAglSXUP5RNzecnFh76r2D01NQNRFiRDVumRwmtgdkxIDXSMCMdFaS9rosDKVv4iY6Ymk0zpj1MZ7Y6q76ThNhvYcXUz7rdUUMHtUxbZMlQ25X9BQBabUFZceszUGQeqhpWbGIHVHxNaQgPOYYol3QfEhGS/FmJfP0GHQsz/ygwUMmTSl1wJIVCS3pHljo/df6KW1L1lNpSp/fprKjBhrjbVFWd4yjPPOy/GLgaJCOzPuHAZcLL0TFtJFq/tAOXU2aKfBQtt6+GxBRqsMYGFSQO4yvh1AM7rM84Xe0PBBYwMNEILaLNVsOUDLQIhR6mEileSfHZMhSCag+2irvd27BSJnO5p+jvgkMGBDdfIppC1vnCeIHhE3oBn++RpTIQFHnqai9bKwGqqwI1ixw== 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:(13230031)(366004)(346002)(396003)(136003)(39860400002)(376002)(230922051799003)(230173577357003)(230273577357003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(36756003)(86362001)(107886003)(1076003)(2616005)(6506007)(6512007)(6666004)(4326008)(478600001)(6486002)(8936002)(8676002)(316002)(66899024)(66476007)(83380400001)(66556008)(66946007)(6916009)(41300700001)(2906002)(30864003)(44832011)(5660300002)(2004002)(559001)(579004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qKXjMZ0ei4Egj/kWJE9pAy8L8quz5h/4XdvHw+UqjNnniRCo6kHOY+7B5VbAWUWOjMUWnUMCw0oxtGiu2p5oAAgQ8AveFpNm5JZOH7cbaiOJyRt/mKHpJBp7oF6eaNaFrrKDR39woUal9Wak7a3215wJMQgrQhxiSmpkIMRkvep+RT2z54k7k+fUGHC2n+YRcT1Rojm3uSVS4ZxEFgINsMiEgiJy62wuGPpn9pniF2fbzY0ib7W+NGjXmymzPCcgydT4ShjxzYUvFHSGSgOdGIKzvpIA2LME9RdUM6ISQ+hWUWz6lHHE2wmrz23+16T74drax+1Z/qXPjSBVB7sf5e/AqQKdahmhvh8XVBLoNdObuKUpzqjmCIyEiT/cSnmWKl3E5QvjGtnctFIObxlndmtdOUWVx8BTTZQxVvHihkQ3PCW17itY6dZEY5TfLtVT9tjSV7pcDGbjIQ13vj1gkaANqxNtkHnT+tGvaHbECI7WBD0Se+GQWR2RkndUsKD8sTtA8J9u7QtvoHoMtK/AEgcDGoqECXvVVuFEVcELsJUK6DzSHWYdhPAB/0Big8SxVfK2MQO2sHXUc86dxkl4dIXL8sl1EO0mWEA8hD1Q7pMxqSmkT7taQxsWbQXWRvXZXJb5hsUU8dN1ayHAQpcvPkyumwaxV/LsXXGjeLUSFGR03WVhmef6k+5BMVekcERjPoN6powC7ZX836lC2RrnXUOgWQDQR/c2b4BI+Iext9FX0VjR5w0Cy0GoyLaEl3fiyfsunOf9FOLxMFiSKmt+gGJWCKsqbkrIBijL4/TlmU8nVWopAoQB2vOv+x3+GR/vqzJm5QtHMiJG+PWf4iDKutbcTLZduVUHNcGrOK5FW1UxHlHd/imxt8qV8UTyURu4bzqrTCbFSxFe17WoPX/TLDEnGNloLQSxo8Dm+Fmp7MDH0Ak186GxWwUciJQwaUtKvV8gBYE0SCFx80M2MQSdln1/fPFYY96WvEFrK9orxJ9Drvys8IrC0d4sm7y8pflMnDF0KKq3ay5I16kcGKxQqYXYrf5xN2euFqyUR1+TGDnRCJe5ld4sz7a9Ma/yhWr9jcAprANTzdMQkrIfaLjBPpdv8Ld2v4j58tNJ9F/J8moeqzH8XqXcOiLRGBPoEpP3ZdVuhFAWdB3uyAOUsCswuiKlmVL850FSo0od/F0E6KpwhFwKcKrOpl+irAMNVME3ETYgfyvSTq0o1I30zxyEla5M4Di3L8r9tYvVOXGsa8EwiaAWq8xm8VuWTwKq7pN/0uGv4kyFYiUxW10qYdIJr15ARrbVzL/+uijnp1FUGjY+0RoVmfSwl2Pz7Bft73JnBqe/Crvy62pABMGxUsmbZ3l2DlZZ0q0l6T6BnhD1Scy2uAnytyo1VbpdHMyWVc5jYePOOCr6i2+az38X5rm7m7YpdfnaLnqL5qkATPUzg/0RZKKlzJNyQP4tvIdEcXtmNWkMPK3I7KsIzN923nnkefEkQN6jojLcYSnq4OWRIMuveuLicKX2wI8IfVr6zkKmHaVaVfmr5Kzuk47KjVYbAuVopNunsy2mhha0ES89LWCfh5+23Zd9xPwAaNkr6R7lyBeM5dsMlrjL4eArwzOC9cjLY39Gu6gqwXa5QxDx3hM= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: yNUsuNNJS0OrOdEOx7IZYAYt1VJyy1JvsEmqFKMx3pubGVPomb7H+mwMol9S+rRpNDtF2FGc3DwiCumgLn82r5homEa/daso/mgY90afCjuJxra78/Kzm6NnjcQgdno/4IFFcn7fgIyCZUIgt5r3gsx/H3Iz2KMb/BkA79pyIV0CvECHViglD/XbU/2Mau4L4kKlo+pv5+MrkXf1d8f6uI2Ut1bam0p9bd5jPNlt53k1sZUWSYo/od9BPL0N1q5ScLF+yJkqz1n7zTVVcDpM5/gdl1lkgeHfkdMA2PcfDcXYMls3uL4MpxF2q7Qn342gAnQBYeaXGJJAv77vuTcBJh2X/CXThlLXkEIFkHGh0B9Gi23SOQHvZRjRVKH3D1eg+K/3oc3oEWEbh2SYZLdZXh8tlyWiHmRgb3nHVW5p0/lXbjSoTN9EtFjHMykq0QVZPBseY+gKpqcYil3ESLnyjbU3V+sQeHZU75qhecRDzbp1oFLPxuePjAvaF6DUn0K625qGyRS+gZ1xR5YS+8oE9zYTHgqkd1ZWgAstsJ1jPibfQMcUL0dWDucrFA1K8YPCh18AbjFB6g189zxKvoEqL81ZyO4fAxtneGlve6pZR3Y= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ee8f9542-8784-4b2f-aa5e-08dc0c2bd585 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2024 07:15:58.7798 (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: +AetE6aDsBADHLTkPLmpFL+f+M9BIFQJNSiBw7Wk9VMoLTRSd+0n3dQ7Tvlic2gYSx1U8WWv8KykwUinkS3CCg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB6777 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-03_02,2024-01-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 mlxscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401030059 X-Proofpoint-ORIG-GUID: lQWb-RcgJPONipiQYcQ5vS3q_4yLBJqZ X-Proofpoint-GUID: lQWb-RcgJPONipiQYcQ5vS3q_4yLBJqZ 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, RCVD_IN_DNSWL_NONE, 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.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org [Changes from V3 to V4] - Forward and backward pass failure is an error (was warning in V2). Fix the tests. - Add new test ginsn-add-1. - Add new test scfi-unsupported-insn-1 which includes the new APX instructions (pop2, push2). [End of changes from V3 to V4] [Changes from V2 to V3] - Fix inconsistent indentation across tests. - Fixed some issues in scfi-x86.exp: add scfi-callee-saved-1 to the list (was missing earlier), removed redundant test scfi-ignore-1 - Adjsuted tests for some rewording in the warning messages. - Use register names instead of numbers in some CFI directives. - Run each test with and without --scfi. This will keep the CFI annotations tested. - Run scfi-unsupported-1 with --x32 as well. - Added more tests: + ginsn-dw2-regnum-1 + ginsn-pop-1 + ginsn-push-1 + scfi-enter-1 + scfi-cfi-sections-1, etc. [End of changes from V2 to V3] The testsuite for SCFI contains target-specific tests. As all the tests are executed with --scfi command line option, the CFI annotations in the test .s files are skipped altogether by the GAS for processing. The CFI directives in the assembly files are added with the intention to aid maintainence only: CFI annotations in .s files help convey the expected EH Frame / SFrame data in a format-oblivious way. Some testcases are used to highlight those asm constructs that the SCFI machinery in GAS currently does not support: - Only AMD64 ABI is supported for now. Using --m32 with --scfi results in hard error. See scfi-unsupported-1.s. - Untraceable stack-pointer manipulation in function epilougue and prologue. See scfi-unsupported-2.s. - Using Dynamically Realigned Arguement Pointer (DRAP) register to realign the stack. For SCFI, the CFA must be only REG_SP or REG_FP based. See scfi-unsupported-drap-1.s Some testcases are used to highlight some diagnostics that the SCFI machinery in GAS currently issues, with an intent to help user correct inadvertent errors in their hand-written asm. An error is issued in a situation where GAS is not sure it will be able to synthesize valid CFI. - (#1) "Warning: SCFI: Asymetrical register restore" - (#2) "Error: SCFI: usage of REG_FP as scratch not supported" - (#3) "Error: SCFI: unsupported stack manipulation pattern" In case of (#2) and (#3), SCFI generation is skipped for the respective function. Above is a subset of the warnings/errors implemented in the code. gas/testsuite/: * gas/scfi/README: New test. * gas/scfi/x86_64/ginsn-add-1.l: New test. * gas/scfi/x86_64/ginsn-add-1.s: New test. * gas/scfi/x86_64/ginsn-dw2-regnum-1.l: New test. * gas/scfi/x86_64/ginsn-dw2-regnum-1.s: New test. * gas/scfi/x86_64/ginsn-pop-1.l: New test. * gas/scfi/x86_64/ginsn-pop-1.s: New test. * gas/scfi/x86_64/ginsn-push-1.l: New test. * gas/scfi/x86_64/ginsn-push-1.s: New test. * gas/scfi/x86_64/scfi-add-1.d: New test. * gas/scfi/x86_64/scfi-add-1.l: New test. * gas/scfi/x86_64/scfi-add-1.s: New test. * gas/scfi/x86_64/scfi-add-2.d: New test. * gas/scfi/x86_64/scfi-add-2.l: New test. * gas/scfi/x86_64/scfi-add-2.s: New test. * gas/scfi/x86_64/scfi-asm-marker-1.d: New test. * gas/scfi/x86_64/scfi-asm-marker-1.l: New test. * gas/scfi/x86_64/scfi-asm-marker-1.s: New test. * gas/scfi/x86_64/scfi-asm-marker-2.d: New test. * gas/scfi/x86_64/scfi-asm-marker-2.l: New test. * gas/scfi/x86_64/scfi-asm-marker-2.s: New test. * gas/scfi/x86_64/scfi-asm-marker-3.d: New test. * gas/scfi/x86_64/scfi-asm-marker-3.l: New test. * gas/scfi/x86_64/scfi-asm-marker-3.s: New test. * gas/scfi/x86_64/scfi-bp-sp-1.d: New test. * gas/scfi/x86_64/scfi-bp-sp-1.l: New test. * gas/scfi/x86_64/scfi-bp-sp-1.s: New test. * gas/scfi/x86_64/scfi-bp-sp-2.d: New test. * gas/scfi/x86_64/scfi-bp-sp-2.l: New test. * gas/scfi/x86_64/scfi-bp-sp-2.s: New test. * gas/scfi/x86_64/scfi-callee-saved-1.d: New test. * gas/scfi/x86_64/scfi-callee-saved-1.l: New test. * gas/scfi/x86_64/scfi-callee-saved-1.s: New test. * gas/scfi/x86_64/scfi-callee-saved-2.d: New test. * gas/scfi/x86_64/scfi-callee-saved-2.l: New test. * gas/scfi/x86_64/scfi-callee-saved-2.s: New test. * gas/scfi/x86_64/scfi-callee-saved-3.d: New test. * gas/scfi/x86_64/scfi-callee-saved-3.l: New test. * gas/scfi/x86_64/scfi-callee-saved-3.s: New test. * gas/scfi/x86_64/scfi-callee-saved-4.d: New test. * gas/scfi/x86_64/scfi-callee-saved-4.l: New test. * gas/scfi/x86_64/scfi-callee-saved-4.s: New test. * gas/scfi/x86_64/scfi-cfg-1.d: New test. * gas/scfi/x86_64/scfi-cfg-1.l: New test. * gas/scfi/x86_64/scfi-cfg-1.s: New test. * gas/scfi/x86_64/scfi-cfg-2.d: New test. * gas/scfi/x86_64/scfi-cfg-2.l: New test. * gas/scfi/x86_64/scfi-cfg-2.s: New test. * gas/scfi/x86_64/scfi-cfi-label-1.d: New test. * gas/scfi/x86_64/scfi-cfi-label-1.l: New test. * gas/scfi/x86_64/scfi-cfi-label-1.s: New test. * gas/scfi/x86_64/scfi-cfi-sections-1.d: New test. * gas/scfi/x86_64/scfi-cfi-sections-1.l: New test. * gas/scfi/x86_64/scfi-cfi-sections-1.s: New test. * gas/scfi/x86_64/scfi-cofi-1.d: New test. * gas/scfi/x86_64/scfi-cofi-1.l: New test. * gas/scfi/x86_64/scfi-cofi-1.s: New test. * gas/scfi/x86_64/scfi-diag-1.l: New test. * gas/scfi/x86_64/scfi-diag-1.s: New test. * gas/scfi/x86_64/scfi-diag-2.l: New test. * gas/scfi/x86_64/scfi-diag-2.s: New test. * gas/scfi/x86_64/scfi-dyn-stack-1.d: New test. * gas/scfi/x86_64/scfi-dyn-stack-1.l: New test. * gas/scfi/x86_64/scfi-dyn-stack-1.s: New test. * gas/scfi/x86_64/scfi-enter-1.d: New test. * gas/scfi/x86_64/scfi-enter-1.l: New test. * gas/scfi/x86_64/scfi-enter-1.s: New test. * gas/scfi/x86_64/scfi-fp-diag-2.l: New test. * gas/scfi/x86_64/scfi-fp-diag-2.s: New test. * gas/scfi/x86_64/scfi-indirect-mov-1.d: New test. * gas/scfi/x86_64/scfi-indirect-mov-1.l: New test. * gas/scfi/x86_64/scfi-indirect-mov-1.s: New test. * gas/scfi/x86_64/scfi-indirect-mov-2.d: New test. * gas/scfi/x86_64/scfi-indirect-mov-2.l: New test. * gas/scfi/x86_64/scfi-indirect-mov-2.s: New test. * gas/scfi/x86_64/scfi-indirect-mov-3.d: New test. * gas/scfi/x86_64/scfi-indirect-mov-3.l: New test. * gas/scfi/x86_64/scfi-indirect-mov-3.s: New test. * gas/scfi/x86_64/scfi-indirect-mov-4.d: New test. * gas/scfi/x86_64/scfi-indirect-mov-4.l: New test. * gas/scfi/x86_64/scfi-indirect-mov-4.s: New test. * gas/scfi/x86_64/scfi-indirect-mov-5.s: New test. * gas/scfi/x86_64/scfi-lea-1.d: New test. * gas/scfi/x86_64/scfi-lea-1.l: New test. * gas/scfi/x86_64/scfi-lea-1.s: New test. * gas/scfi/x86_64/scfi-leave-1.d: New test. * gas/scfi/x86_64/scfi-leave-1.l: New test. * gas/scfi/x86_64/scfi-leave-1.s: New test. * gas/scfi/x86_64/scfi-pushq-1.d: New test. * gas/scfi/x86_64/scfi-pushq-1.l: New test. * gas/scfi/x86_64/scfi-pushq-1.s: New test. * gas/scfi/x86_64/scfi-pushsection-1.d: New test. * gas/scfi/x86_64/scfi-pushsection-1.l: New test. * gas/scfi/x86_64/scfi-pushsection-1.s: New test. * gas/scfi/x86_64/scfi-pushsection-2.d: New test. * gas/scfi/x86_64/scfi-pushsection-2.l: New test. * gas/scfi/x86_64/scfi-pushsection-2.s: New test. * gas/scfi/x86_64/scfi-selfalign-func-1.d: New test. * gas/scfi/x86_64/scfi-selfalign-func-1.l: New test. * gas/scfi/x86_64/scfi-selfalign-func-1.s: New test. * gas/scfi/x86_64/scfi-simple-1.d: New test. * gas/scfi/x86_64/scfi-simple-1.l: New test. * gas/scfi/x86_64/scfi-simple-1.s: New test. * gas/scfi/x86_64/scfi-simple-2.d: New test. * gas/scfi/x86_64/scfi-simple-2.l: New test. * gas/scfi/x86_64/scfi-simple-2.s: New test. * gas/scfi/x86_64/scfi-sub-1.d: New test. * gas/scfi/x86_64/scfi-sub-1.l: New test. * gas/scfi/x86_64/scfi-sub-1.s: New test. * gas/scfi/x86_64/scfi-sub-2.d: New test. * gas/scfi/x86_64/scfi-sub-2.l: New test. * gas/scfi/x86_64/scfi-sub-2.s: New test. * gas/scfi/x86_64/scfi-unsupported-1.l: New test. * gas/scfi/x86_64/scfi-unsupported-1.s: New test. * gas/scfi/x86_64/scfi-unsupported-2.l: New test. * gas/scfi/x86_64/scfi-unsupported-2.s: New test. * gas/scfi/x86_64/scfi-unsupported-3.l: New test. * gas/scfi/x86_64/scfi-unsupported-3.s: New test. * gas/scfi/x86_64/scfi-unsupported-4.l: New test. * gas/scfi/x86_64/scfi-unsupported-4.s: New test. * gas/scfi/x86_64/scfi-unsupported-cfg-1.l: New test. * gas/scfi/x86_64/scfi-unsupported-cfg-1.s: New test. * gas/scfi/x86_64/scfi-unsupported-cfg-2.l: New test. * gas/scfi/x86_64/scfi-unsupported-cfg-2.s: New test. * gas/scfi/x86_64/scfi-unsupported-drap-1.l: New test. * gas/scfi/x86_64/scfi-unsupported-drap-1.s: New test. * gas/scfi/x86_64/scfi-unsupported-insn-1.l: New test. * gas/scfi/x86_64/scfi-unsupported-insn-1.s: New test. * gas/scfi/x86_64/scfi-x86-64.exp: New file. --- gas/testsuite/gas/scfi/README | 17 +++ gas/testsuite/gas/scfi/x86_64/ginsn-add-1.l | 47 ++++++++ gas/testsuite/gas/scfi/x86_64/ginsn-add-1.s | 26 ++++ .../gas/scfi/x86_64/ginsn-dw2-regnum-1.l | 55 +++++++++ .../gas/scfi/x86_64/ginsn-dw2-regnum-1.s | 28 +++++ gas/testsuite/gas/scfi/x86_64/ginsn-pop-1.l | 30 +++++ gas/testsuite/gas/scfi/x86_64/ginsn-pop-1.s | 13 ++ gas/testsuite/gas/scfi/x86_64/ginsn-push-1.l | 33 +++++ gas/testsuite/gas/scfi/x86_64/ginsn-push-1.s | 14 +++ gas/testsuite/gas/scfi/x86_64/scfi-add-1.d | 26 ++++ gas/testsuite/gas/scfi/x86_64/scfi-add-1.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-add-1.s | 13 ++ gas/testsuite/gas/scfi/x86_64/scfi-add-2.d | 37 ++++++ gas/testsuite/gas/scfi/x86_64/scfi-add-2.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-add-2.s | 48 ++++++++ .../gas/scfi/x86_64/scfi-asm-marker-1.d | 29 +++++ .../gas/scfi/x86_64/scfi-asm-marker-1.l | 3 + .../gas/scfi/x86_64/scfi-asm-marker-1.s | 27 +++++ .../gas/scfi/x86_64/scfi-asm-marker-2.d | 25 ++++ .../gas/scfi/x86_64/scfi-asm-marker-2.l | 3 + .../gas/scfi/x86_64/scfi-asm-marker-2.s | 11 ++ .../gas/scfi/x86_64/scfi-asm-marker-3.d | 32 +++++ .../gas/scfi/x86_64/scfi-asm-marker-3.l | 2 + .../gas/scfi/x86_64/scfi-asm-marker-3.s | 38 ++++++ gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.d | 32 +++++ gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.s | 21 ++++ gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.d | 58 +++++++++ gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.s | 52 ++++++++ .../gas/scfi/x86_64/scfi-callee-saved-1.d | 41 +++++++ .../gas/scfi/x86_64/scfi-callee-saved-1.l | 2 + .../gas/scfi/x86_64/scfi-callee-saved-1.s | 25 ++++ .../gas/scfi/x86_64/scfi-callee-saved-2.d | 42 +++++++ .../gas/scfi/x86_64/scfi-callee-saved-2.l | 2 + .../gas/scfi/x86_64/scfi-callee-saved-2.s | 41 +++++++ .../gas/scfi/x86_64/scfi-callee-saved-3.d | 43 +++++++ .../gas/scfi/x86_64/scfi-callee-saved-3.l | 3 + .../gas/scfi/x86_64/scfi-callee-saved-3.s | 39 ++++++ .../gas/scfi/x86_64/scfi-callee-saved-4.d | 41 +++++++ .../gas/scfi/x86_64/scfi-callee-saved-4.l | 3 + .../gas/scfi/x86_64/scfi-callee-saved-4.s | 55 +++++++++ gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.d | 37 ++++++ gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.s | 47 ++++++++ gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.d | 29 +++++ gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.s | 21 ++++ .../gas/scfi/x86_64/scfi-cfi-label-1.d | 38 ++++++ .../gas/scfi/x86_64/scfi-cfi-label-1.l | 2 + .../gas/scfi/x86_64/scfi-cfi-label-1.s | 19 +++ .../gas/scfi/x86_64/scfi-cfi-sections-1.d | 24 ++++ .../gas/scfi/x86_64/scfi-cfi-sections-1.l | 2 + .../gas/scfi/x86_64/scfi-cfi-sections-1.s | 22 ++++ gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.d | 5 + gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.l | 3 + gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.s | 24 ++++ gas/testsuite/gas/scfi/x86_64/scfi-diag-1.l | 4 + gas/testsuite/gas/scfi/x86_64/scfi-diag-1.s | 22 ++++ gas/testsuite/gas/scfi/x86_64/scfi-diag-2.l | 4 + gas/testsuite/gas/scfi/x86_64/scfi-diag-2.s | 28 +++++ .../gas/scfi/x86_64/scfi-dyn-stack-1.d | 24 ++++ .../gas/scfi/x86_64/scfi-dyn-stack-1.l | 2 + .../gas/scfi/x86_64/scfi-dyn-stack-1.s | 50 ++++++++ gas/testsuite/gas/scfi/x86_64/scfi-enter-1.d | 36 ++++++ gas/testsuite/gas/scfi/x86_64/scfi-enter-1.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-enter-1.s | 24 ++++ .../gas/scfi/x86_64/scfi-fp-diag-2.l | 3 + .../gas/scfi/x86_64/scfi-fp-diag-2.s | 55 +++++++++ .../gas/scfi/x86_64/scfi-indirect-mov-1.d | 52 ++++++++ .../gas/scfi/x86_64/scfi-indirect-mov-1.l | 2 + .../gas/scfi/x86_64/scfi-indirect-mov-1.s | 48 ++++++++ .../gas/scfi/x86_64/scfi-indirect-mov-2.d | 42 +++++++ .../gas/scfi/x86_64/scfi-indirect-mov-2.l | 2 + .../gas/scfi/x86_64/scfi-indirect-mov-2.s | 38 ++++++ .../gas/scfi/x86_64/scfi-indirect-mov-3.d | 42 +++++++ .../gas/scfi/x86_64/scfi-indirect-mov-3.l | 2 + .../gas/scfi/x86_64/scfi-indirect-mov-3.s | 38 ++++++ .../gas/scfi/x86_64/scfi-indirect-mov-4.d | 64 ++++++++++ .../gas/scfi/x86_64/scfi-indirect-mov-4.l | 3 + .../gas/scfi/x86_64/scfi-indirect-mov-4.s | 68 +++++++++++ .../gas/scfi/x86_64/scfi-indirect-mov-5.s | 35 ++++++ gas/testsuite/gas/scfi/x86_64/scfi-lea-1.d | 38 ++++++ gas/testsuite/gas/scfi/x86_64/scfi-lea-1.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-lea-1.s | 39 ++++++ gas/testsuite/gas/scfi/x86_64/scfi-leave-1.d | 37 ++++++ gas/testsuite/gas/scfi/x86_64/scfi-leave-1.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-leave-1.s | 25 ++++ gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.d | 36 ++++++ gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.s | 23 ++++ .../gas/scfi/x86_64/scfi-pushsection-1.d | 43 +++++++ .../gas/scfi/x86_64/scfi-pushsection-1.l | 2 + .../gas/scfi/x86_64/scfi-pushsection-1.s | 40 +++++++ .../gas/scfi/x86_64/scfi-pushsection-2.d | 40 +++++++ .../gas/scfi/x86_64/scfi-pushsection-2.l | 2 + .../gas/scfi/x86_64/scfi-pushsection-2.s | 41 +++++++ .../gas/scfi/x86_64/scfi-selfalign-func-1.d | 32 +++++ .../gas/scfi/x86_64/scfi-selfalign-func-1.l | 2 + .../gas/scfi/x86_64/scfi-selfalign-func-1.s | 36 ++++++ gas/testsuite/gas/scfi/x86_64/scfi-simple-1.d | 27 +++++ gas/testsuite/gas/scfi/x86_64/scfi-simple-1.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-simple-1.s | 15 +++ gas/testsuite/gas/scfi/x86_64/scfi-simple-2.d | 31 +++++ gas/testsuite/gas/scfi/x86_64/scfi-simple-2.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-simple-2.s | 16 +++ gas/testsuite/gas/scfi/x86_64/scfi-sub-1.d | 26 ++++ gas/testsuite/gas/scfi/x86_64/scfi-sub-1.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-sub-1.s | 12 ++ gas/testsuite/gas/scfi/x86_64/scfi-sub-2.d | 32 +++++ gas/testsuite/gas/scfi/x86_64/scfi-sub-2.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-sub-2.s | 29 +++++ .../gas/scfi/x86_64/scfi-unsupported-1.l | 2 + .../gas/scfi/x86_64/scfi-unsupported-1.s | 9 ++ .../gas/scfi/x86_64/scfi-unsupported-2.l | 3 + .../gas/scfi/x86_64/scfi-unsupported-2.s | 13 ++ .../gas/scfi/x86_64/scfi-unsupported-3.l | 3 + .../gas/scfi/x86_64/scfi-unsupported-3.s | 13 ++ .../gas/scfi/x86_64/scfi-unsupported-4.l | 4 + .../gas/scfi/x86_64/scfi-unsupported-4.s | 22 ++++ .../gas/scfi/x86_64/scfi-unsupported-cfg-1.l | 3 + .../gas/scfi/x86_64/scfi-unsupported-cfg-1.s | 52 ++++++++ .../gas/scfi/x86_64/scfi-unsupported-cfg-2.l | 4 + .../gas/scfi/x86_64/scfi-unsupported-cfg-2.s | 14 +++ .../gas/scfi/x86_64/scfi-unsupported-drap-1.l | 4 + .../gas/scfi/x86_64/scfi-unsupported-drap-1.s | 75 ++++++++++++ .../gas/scfi/x86_64/scfi-unsupported-insn-1.l | 5 + .../gas/scfi/x86_64/scfi-unsupported-insn-1.s | 12 ++ gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp | 113 ++++++++++++++++++ 129 files changed, 3021 insertions(+) create mode 100644 gas/testsuite/gas/scfi/README create mode 100644 gas/testsuite/gas/scfi/x86_64/ginsn-add-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/ginsn-add-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/ginsn-dw2-regnum-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/ginsn-dw2-regnum-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/ginsn-pop-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/ginsn-pop-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/ginsn-push-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/ginsn-push-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-add-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-add-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-add-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-add-2.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-add-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-add-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-2.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-3.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-3.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-3.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfi-label-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfi-label-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfi-label-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfi-sections-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfi-sections-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfi-sections-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-diag-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-diag-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-diag-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-diag-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-enter-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-enter-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-enter-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-fp-diag-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-fp-diag-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-4.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-4.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-4.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-5.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-lea-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-lea-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-lea-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-leave-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-leave-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-leave-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-pushsection-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-pushsection-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-pushsection-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-pushsection-2.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-pushsection-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-pushsection-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-simple-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-simple-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-simple-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-simple-2.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-simple-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-simple-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-sub-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-sub-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-sub-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-sub-2.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-sub-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-sub-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-3.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-3.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-4.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-4.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-drap-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-drap-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-insn-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-insn-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp diff --git a/gas/testsuite/gas/scfi/README b/gas/testsuite/gas/scfi/README new file mode 100644 index 00000000000..75dcebb602d --- /dev/null +++ b/gas/testsuite/gas/scfi/README @@ -0,0 +1,17 @@ +Notes on the SCFI testsuite in GAS: + +* At this time, SCFI machinery is only supported for x86_64. + +* When adding more tests, please keep CFI annotations updated in the .s files. + Recall that user-specified, synthesizable CFI annotations are ignored by the + GAS when --scfi (=all) is in effect. Adding CFI annocations, irrespectively, + makes the testcases clearer in terms of understanding the expected unwind + data. + +* Note that GAS issues a warning: + "Warning: --scfi=all ignores some user-specified CFI directive" + when it encounters CFI directives in the input assembly and --scfi (=all) is + active. To bypass the noise from this warning, while keeping the testcases + useful/understandable, most tests are run twice. E.g., + - run_dump_test "scfi-cfi-add-1" // ignores warnings + - run_list_test "scfi-cfi-add-1" "--scfi --warn" // tests warnings diff --git a/gas/testsuite/gas/scfi/x86_64/ginsn-add-1.l b/gas/testsuite/gas/scfi/x86_64/ginsn-add-1.l new file mode 100644 index 00000000000..5f315d15e8a --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/ginsn-add-1.l @@ -0,0 +1,47 @@ +GAS LISTING .* + + + 1 ## Testcase with a variety of add. + 2 ## Some add insns valid in 64-bit mode may not be processed for SCFI. + 3 .text + 4 .globl foo + 5 .type foo, @function + 5 ginsn: SYM FUNC_BEGIN + 6 foo: + 6 ginsn: SYM foo + 7 0000 54 push %rsp + 7 ginsn: SUB %r7, 8, %r7 + 7 ginsn: STORE %r7, \[%r7\+0\] + 8 0001 4889E5 movq %rsp, %rbp + 8 ginsn: MOV %r7, %r6 + 9 + 10 0004 48010425 addq %rax, symbol + 10 00000000 + 11 000c 03042500 add symbol, %eax + 11 000000 + 12 + 13 0013 670320 add \(%eax\), %esp + 13 ginsn: ADD \[%r0\+0\], %r7, %r7 + 14 0016 67012405 add %esp, \(,%eax\) + 14 00000000 + 15 + 16 001e 4801C3 addq %rax, %rbx + 16 ginsn: ADD %r0, %r3, %r3 + 17 0021 01C3 add %eax, %ebx + 17 ginsn: ADD %r0, %r3, %r3 + 18 + 19 0023 488345F0 addq \$1, -16\(%rbp\) + 19 01 + 20 + 21 0028 67032405 add \(,%eax\), %esp + 21 00000000 + 21 ginsn: ADD \[%r0\+0\], %r7, %r7 + 22 0030 67012405 add %esp, \(,%eax\) + 22 00000000 + 23 + 24 0038 C3 ret + 24 ginsn: RET + 25 .LFE0: + 25 ginsn: SYM .LFE0 + 26 .size foo, .-foo + 26 ginsn: SYM FUNC_END diff --git a/gas/testsuite/gas/scfi/x86_64/ginsn-add-1.s b/gas/testsuite/gas/scfi/x86_64/ginsn-add-1.s new file mode 100644 index 00000000000..5a92bc199e8 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/ginsn-add-1.s @@ -0,0 +1,26 @@ +## Testcase with a variety of add. +## Some add insns valid in 64-bit mode may not be processed for SCFI. + .text + .globl foo + .type foo, @function +foo: + push %rsp + movq %rsp, %rbp + + addq %rax, symbol + add symbol, %eax + + add (%eax), %esp + add %esp, (,%eax) + + addq %rax, %rbx + add %eax, %ebx + + addq $1, -16(%rbp) + + add (,%eax), %esp + add %esp, (,%eax) + + ret +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/ginsn-dw2-regnum-1.l b/gas/testsuite/gas/scfi/x86_64/ginsn-dw2-regnum-1.l new file mode 100644 index 00000000000..8eb62b68c24 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/ginsn-dw2-regnum-1.l @@ -0,0 +1,55 @@ +GAS LISTING .* + + +.*# Testcase for DWARF regnum ginsn API + 2 .text + 3 .globl foo + 4 .type foo, @function + 4 ginsn: SYM FUNC_BEGIN + 5 foo: + 5 ginsn: SYM foo + 6 0000 0408 add \$8, %al + 7 0002 80C108 add \$8, %cl + 7 ginsn: ADD %r2, 8, %r2 + 8 0005 80C208 add \$8, %dl + 8 ginsn: ADD %r1, 8, %r1 + 9 0008 80C408 add \$8, %ah + 9 ginsn: ADD %r0, 8, %r0 + 10 000b 80C508 add \$8, %ch + 10 ginsn: ADD %r2, 8, %r2 + 11 000e 80C608 add \$8, %dh + 11 ginsn: ADD %r1, 8, %r1 + 12 0011 80C708 add \$8, %bh + 12 ginsn: ADD %r3, 8, %r3 + 13 + 14 0014 4080C008 add \$8, %axl + 14 ginsn: ADD %r0, 8, %r0 + 15 0018 4080C408 add \$8, %spl + 15 ginsn: ADD %r7, 8, %r7 + 16 + 17 001c 6683C008 add \$8, %ax + 17 ginsn: ADD %r0, 8, %r0 + 18 0020 664183C0 add \$8, %r8w + 18 08 + 18 ginsn: ADD %r8, 8, %r8 + 19 0025 6683C408 add \$8, %sp + 19 ginsn: ADD %r7, 8, %r7 + 20 + 21 0029 83C008 add \$8, %eax + 21 ginsn: ADD %r0, 8, %r0 + 22 002c 4183C008 add \$8, %r8d + 22 ginsn: ADD %r8, 8, %r8 + 23 0030 81C40040 add \$16384, %esp + 23 0000 + 23 ginsn: ADD %r7, 16384, %r7 + 24 + 25 0036 4883C508 add \$8, %rbp + 25 ginsn: ADD %r6, 8, %r6 + 26 003a C3 ret + 26 ginsn: RET + 27 .LFE0: + 27 ginsn: SYM .LFE0 + 28 .size foo, .-foo + 28 ginsn: SYM FUNC_END + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/ginsn-dw2-regnum-1.s b/gas/testsuite/gas/scfi/x86_64/ginsn-dw2-regnum-1.s new file mode 100644 index 00000000000..284c520af02 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/ginsn-dw2-regnum-1.s @@ -0,0 +1,28 @@ +# Testcase for DWARF regnum ginsn API + .text + .globl foo + .type foo, @function +foo: + add $8, %al + add $8, %cl + add $8, %dl + add $8, %ah + add $8, %ch + add $8, %dh + add $8, %bh + + add $8, %axl + add $8, %spl + + add $8, %ax + add $8, %r8w + add $8, %sp + + add $8, %eax + add $8, %r8d + add $16384, %esp + + add $8, %rbp + ret +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/ginsn-pop-1.l b/gas/testsuite/gas/scfi/x86_64/ginsn-pop-1.l new file mode 100644 index 00000000000..9e96d5337bf --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/ginsn-pop-1.l @@ -0,0 +1,30 @@ +GAS LISTING .* + + + 1 ## Testcase with a variety of pop. + 2 ## all pop insns valid in 64-bit mode must be processed for SCFI. + 3 .text + 4 .globl foo + 5 .type foo, @function + 5 ginsn: SYM FUNC_BEGIN + 6 foo: + 6 ginsn: SYM foo + 7 0000 660FA1 popw %fs + 7 ginsn: LOAD \[%r7\+0\], %r54 + 7 ginsn: ADD %r7, 2, %r7 + 8 0003 660FA9 popw %gs + 8 ginsn: LOAD \[%r7\+0\], %r55 + 8 ginsn: ADD %r7, 2, %r7 + 9 0006 669D popfw + 9 ginsn: LOAD \[%r7\+0\], %r49 + 9 ginsn: ADD %r7, 2, %r7 + 10 0008 66418F42 popw -8\(%r10\) + 10 F8 + 10 ginsn: LOAD \[%r7\+0\], \[%r10\+0\] + 10 ginsn: ADD %r7, 2, %r7 + 11 000d C3 ret + 11 ginsn: RET + 12 .LFE0: + 12 ginsn: SYM .LFE0 + 13 .size foo, .-foo + 13 ginsn: SYM FUNC_END diff --git a/gas/testsuite/gas/scfi/x86_64/ginsn-pop-1.s b/gas/testsuite/gas/scfi/x86_64/ginsn-pop-1.s new file mode 100644 index 00000000000..b88c51d6aeb --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/ginsn-pop-1.s @@ -0,0 +1,13 @@ +## Testcase with a variety of pop. +## all pop insns valid in 64-bit mode must be processed for SCFI. + .text + .globl foo + .type foo, @function +foo: + popw %fs + popw %gs + popfw + popw -8(%r10) + ret +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/ginsn-push-1.l b/gas/testsuite/gas/scfi/x86_64/ginsn-push-1.l new file mode 100644 index 00000000000..17d83542b23 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/ginsn-push-1.l @@ -0,0 +1,33 @@ +GAS LISTING .* + + + 1 ## Testcase with a variety of push. + 2 ## all push insns valid in 64-bit mode must be processed for SCFI. + 3 .text + 4 .globl foo + 5 .type foo, @function + 5 ginsn: SYM FUNC_BEGIN + 6 foo: + 6 ginsn: SYM foo + 7 0000 660FA0 pushw %fs + 7 ginsn: SUB %r7, 2, %r7 + 7 ginsn: STORE %r54, \[%r7\+0\] + 8 0003 660FA8 pushw %gs + 8 ginsn: SUB %r7, 2, %r7 + 8 ginsn: STORE %r55, \[%r7\+0\] + 9 0006 666A28 pushw \$40 + 9 ginsn: SUB %r7, 1, %r7 + 9 ginsn: STORE 0, \[%r7\+0\] + 10 0009 6641FF72 pushw -8\(%r10\) + 10 F8 + 10 ginsn: SUB %r7, 2, %r7 + 10 ginsn: STORE \[%r10\+0\], \[%r7\+0\] + 11 000e 669C pushfw + 11 ginsn: SUB %r7, 2, %r7 + 11 ginsn: STORE 0, \[%r7\+0\] + 12 0010 C3 ret + 12 ginsn: RET + 13 .LFE0: + 13 ginsn: SYM .LFE0 + 14 .size foo, .-foo + 14 ginsn: SYM FUNC_END diff --git a/gas/testsuite/gas/scfi/x86_64/ginsn-push-1.s b/gas/testsuite/gas/scfi/x86_64/ginsn-push-1.s new file mode 100644 index 00000000000..ce469a00d85 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/ginsn-push-1.s @@ -0,0 +1,14 @@ +## Testcase with a variety of push. +## all push insns valid in 64-bit mode must be processed for SCFI. + .text + .globl foo + .type foo, @function +foo: + pushw %fs + pushw %gs + pushw $40 + pushw -8(%r10) + pushfw + ret +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-add-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-add-1.d new file mode 100644 index 00000000000..4d18b7064d0 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-add-1.d @@ -0,0 +1,26 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: Synthesize CFI for add insn 1 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0014 0+001c FDE cie=0+0000 pc=0+0000..0+0005 + DW_CFA_advance_loc: 4 to 0+0004 + DW_CFA_def_cfa_offset: 0 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-add-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-add-1.l new file mode 100644 index 00000000000..b170125896d --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-add-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-add-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-add-1.s new file mode 100644 index 00000000000..99002c5e34e --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-add-1.s @@ -0,0 +1,13 @@ +# Testcase for add instruction. + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + addq $8, %rsp + .cfi_def_cfa_offset 0 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo + diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-add-2.d b/gas/testsuite/gas/scfi/x86_64/scfi-add-2.d new file mode 100644 index 00000000000..57b6975eb76 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-add-2.d @@ -0,0 +1,37 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: Synthesize CFI for add insn 2 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0024 0+001c FDE cie=0+0000 pc=0+0000..0+0035 + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_advance_loc: 3 to 0+0004 + DW_CFA_def_cfa_register: r6 \(rbp\) + DW_CFA_advance_loc: 2 to 0+0006 + DW_CFA_offset: r12 \(r12\) at cfa-24 + DW_CFA_advance_loc: 45 to 0+0033 + DW_CFA_restore: r12 \(r12\) + DW_CFA_advance_loc: 1 to 0+0034 + DW_CFA_def_cfa_register: r7 \(rsp\) + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-add-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-add-2.l new file mode 100644 index 00000000000..20360b4bfcd --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-add-2.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*14: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-add-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-add-2.s new file mode 100644 index 00000000000..a37bc0f828a --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-add-2.s @@ -0,0 +1,48 @@ + .section .rodata + .type simd_cmp_op, @object + .size simd_cmp_op, 8 +simd_cmp_op: + .long 2 + .zero 4 + +# Testcase for add instruction. +# add reg, reg instruction + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + movq %rsp, %rbp + .cfi_def_cfa_register %rbp + pushq %r12 + .cfi_offset %r12, -24 + mov %rsp, %r12 +# Stack manipulation is permitted if the base register for +# tracking CFA has been changed to FP. + addq %rdx, %rsp + addq %rsp, %rax +# Some add instructions may access the stack indirectly. Such +# accesses do not make REG_FP untraceable. + addl %eax, -84(%rbp) +# Other kind of add instructions should not error out in the +# x86_64 -> ginsn translator + addq $simd_cmp_op+8, %rdx + addq $1, symbol + addl %edx, -32(%rsp) + addl $1, fb_low_counter(,%rbx,4) + mov %r12, %rsp +# Popping a callee-saved register. +# RSP must be traceable. + pop %r12 + .cfi_restore %r12 + leave + .cfi_def_cfa_register %rsp + .cfi_restore %rbp + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-1.d new file mode 100644 index 00000000000..a2d02c23c2b --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-1.d @@ -0,0 +1,29 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: Synthesize CFI for demarcated code blocks 1 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +00000018 0+0010 0000001c FDE cie=00000000 pc=0+0000..0+000f + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + +0000002c 0+0010 00000030 FDE cie=00000000 pc=0+0000..0+0006 + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-1.l new file mode 100644 index 00000000000..89bc3e5ca0a --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-1.l @@ -0,0 +1,3 @@ +.*Assembler messages: +.*8: Warning: --scfi=all ignores most user-specified CFI directives +.*10: Warning: missing label '.L3' in func 'foo' may result in imprecise cfg diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-1.s new file mode 100644 index 00000000000..8a98d1edf1c --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-1.s @@ -0,0 +1,27 @@ +# Testcase where a user may define hot and cold areas of function +# Note how the .type, and .size directives may be placed differently +# than a regular function. + + .globl foo + .type foo, @function +foo: + .cfi_startproc + testl %edi, %edi + je .L3 + movl b(%rip), %eax + ret + .cfi_endproc + .section .text.unlikely + .cfi_startproc + .type foo.cold, @function +foo.cold: +.L3: + pushq %rax + .cfi_def_cfa_offset 16 + call abort + .cfi_endproc +.LFE11: + .text + .size foo, .-foo + .section .text.unlikely + .size foo.cold, .-foo.cold diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-2.d b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-2.d new file mode 100644 index 00000000000..eab67bfd149 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-2.d @@ -0,0 +1,25 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: Synthesize CFI for demarcated code blocks 2 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +00000018 0+0014 0000001c FDE cie=00000000 pc=0+0000..0+000f + DW_CFA_nop + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-2.l new file mode 100644 index 00000000000..3a00a264b07 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-2.l @@ -0,0 +1,3 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores most user-specified CFI directives +.*8: Warning: missing label '.L3' in func 'foo' may result in imprecise cfg diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-2.s new file mode 100644 index 00000000000..2046b7e4078 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-2.s @@ -0,0 +1,11 @@ +# A programmer may not bother to set the size of the +# function symbols via an explicit .size directive. + .globl foo + .type foo, @function +foo: + .cfi_startproc + testl %edi, %edi + je .L3 + movl b(%rip), %eax + ret + .cfi_endproc diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-3.d b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-3.d new file mode 100644 index 00000000000..c10d4cdfb0c --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-3.d @@ -0,0 +1,32 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: Synthesize CFI for demarcated code blocks 3 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +00000018 0+001c 0000001c FDE cie=00000000 pc=0+0000..0+0035 + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_advance_loc: 3 to 0+0004 + DW_CFA_def_cfa_register: r6 \(rbp\) + DW_CFA_advance_loc: 48 to 0+0034 + DW_CFA_def_cfa_register: r7 \(rsp\) + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-3.l b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-3.l new file mode 100644 index 00000000000..083c09902f5 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-3.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*7: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-3.s b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-3.s new file mode 100644 index 00000000000..ff5919cb36c --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-3.s @@ -0,0 +1,38 @@ +# Testcase where the input may have interleaved sections, +# possibly even text and data. + .globl main + .type main, @function +main: +.LFB1: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + movq %rsp, %rbp + .cfi_def_cfa_register %rbp + subq $16, %rsp + movl $17, %esi + movl $5, %edi + call add + .section .rodata + .align 16 + .type __test_obj.0, @object + .size __test_obj.0, 24 +__test_obj.0: + .string "test_elf_objs_in_rodata" +.LC0: + .string "the result is = %d\n" + .text + movl %eax, -4(%rbp) + movl -4(%rbp), %eax + movl %eax, %esi + movl $.LC0, %edi + movl $0, %eax + call printf + movl $0, %eax + leave + .cfi_def_cfa_register %rsp + .cfi_restore %rbp + .cfi_def_cfa_offset 8 + ret + .cfi_endproc diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.d new file mode 100644 index 00000000000..fa0292063f1 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.d @@ -0,0 +1,32 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: Synthesize CFI for SP/FP based CFA switching 1 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+001c 0+001c FDE cie=0+0000 pc=0+0000..0+000c + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_advance_loc: 3 to 0+0004 + DW_CFA_def_cfa_register: r6 \(rbp\) + DW_CFA_advance_loc: 6 to 0+000a + DW_CFA_def_cfa_register: r7 \(rsp\) + DW_CFA_advance_loc: 1 to 0+000b + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 8 + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.l new file mode 100644 index 00000000000..b170125896d --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.s new file mode 100644 index 00000000000..44f078d02dc --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.s @@ -0,0 +1,21 @@ +# Testcase for switching between sp/fp based CFA. + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + movq %rsp, %rbp + .cfi_def_cfa_register %rbp + addq %rax, %rdi + mov %rbp, %rsp + .cfi_def_cfa_register %rsp + pop %rbp + .cfi_restore %rbp + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.d b/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.d new file mode 100644 index 00000000000..d0d4b353138 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.d @@ -0,0 +1,58 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: Synthesize CFI for SP/FP based CFA switching 2 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +00000018 0+0044 0000001c FDE cie=00000000 pc=0+0000..0+0021 + DW_CFA_advance_loc: 2 to 0+0002 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r14 \(r14\) at cfa-16 + DW_CFA_advance_loc: 2 to 0+0004 + DW_CFA_def_cfa_offset: 24 + DW_CFA_offset: r13 \(r13\) at cfa-24 + DW_CFA_advance_loc: 2 to 0+0006 + DW_CFA_def_cfa_offset: 32 + DW_CFA_offset: r12 \(r12\) at cfa-32 + DW_CFA_advance_loc: 1 to 0+0007 + DW_CFA_def_cfa_offset: 40 + DW_CFA_offset: r6 \(rbp\) at cfa-40 + DW_CFA_advance_loc: 1 to 0+0008 + DW_CFA_def_cfa_offset: 48 + DW_CFA_offset: r3 \(rbx\) at cfa-48 + DW_CFA_advance_loc: 7 to 0+000f + DW_CFA_def_cfa_offset: 80 + DW_CFA_advance_loc: 3 to 0+0012 + DW_CFA_def_cfa_register: r6 \(rbp\) + DW_CFA_advance_loc: 7 to 0+0019 + DW_CFA_restore: r3 \(rbx\) + DW_CFA_advance_loc: 1 to 0+001a + DW_CFA_def_cfa_register: r7 \(rsp\) + DW_CFA_def_cfa_offset: 40 + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 32 + DW_CFA_advance_loc: 2 to 0+001c + DW_CFA_restore: r12 \(r12\) + DW_CFA_def_cfa_offset: 24 + DW_CFA_advance_loc: 2 to 0+001e + DW_CFA_restore: r13 \(r13\) + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 2 to 0+0020 + DW_CFA_restore: r14 \(r14\) + DW_CFA_def_cfa_offset: 8 +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.l new file mode 100644 index 00000000000..c253bed177e --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*9: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.s new file mode 100644 index 00000000000..816bb0589f9 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.s @@ -0,0 +1,52 @@ +# Testcase for switching between sp/fp based CFA. +# Although there is stack usage between push %rbp and mov %rsp, %rbp, +# this is a valid ABI/calling convention complaint pattern; It ought to +# work for SCFI. + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %r14 + .cfi_def_cfa_offset 16 + .cfi_offset %r14, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset %r13, -24 + pushq %r12 + .cfi_def_cfa_offset 32 + .cfi_offset %r12, -32 + pushq %rbp + .cfi_def_cfa_offset 40 + .cfi_offset %rbp, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset %rbx, -48 + movq %rdi, %rbx + subq $32, %rsp + .cfi_def_cfa_offset 80 + movq %rsp, %rbp + .cfi_def_cfa_register %rbp + xorl %eax, %eax + addq $32, %rsp + popq %rbx + .cfi_restore %rbx +# The SCFI machinery must be able to figure out the offset for CFA +# as it switches back to REG_SP based tracking after this instruction. + popq %rbp + .cfi_def_cfa_register %rsp + .cfi_def_cfa_offset 40 + .cfi_restore %rbp + .cfi_def_cfa_offset 32 + popq %r12 + .cfi_restore %r12 + .cfi_def_cfa_offset 24 + popq %r13 + .cfi_restore %r13 + .cfi_def_cfa_offset 16 + popq %r14 + .cfi_restore %r14 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.d new file mode 100644 index 00000000000..afa2592ec5c --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.d @@ -0,0 +1,41 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: SCFI for callee-saved registers 1 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0002c 0+0001c FDE cie=0+0000 pc=0+0000..0+0007 + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 1 to 0+0002 + DW_CFA_def_cfa_offset: 24 + DW_CFA_offset: r3 \(rbx\) at cfa-24 + DW_CFA_advance_loc: 1 to 0+0003 + DW_CFA_def_cfa_offset: 32 + DW_CFA_offset: r6 \(rbp\) at cfa-32 + DW_CFA_advance_loc: 1 to 0+0004 + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 24 + DW_CFA_advance_loc: 1 to 0+0005 + DW_CFA_restore: r3 \(rbx\) + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 1 to 0+0006 + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.l new file mode 100644 index 00000000000..518dc148f21 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*5: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.s new file mode 100644 index 00000000000..686c3e9ded8 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.s @@ -0,0 +1,25 @@ + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rax + .cfi_def_cfa_offset 16 + push %rbx + .cfi_def_cfa_offset 24 + .cfi_offset %rbx, -24 + pushq %rbp + .cfi_def_cfa_offset 32 + .cfi_offset %rbp, -32 + popq %rbp + .cfi_restore %rbp + .cfi_def_cfa_offset 24 + popq %rbx + .cfi_restore %rbx + .cfi_def_cfa_offset 16 + popq %rax + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.d b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.d new file mode 100644 index 00000000000..fafe133bb7c --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.d @@ -0,0 +1,42 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: SCFI for callee-saved registers 2 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +00000018 0+002c 0000001c FDE cie=00000000 pc=0+0000..0+0017 + DW_CFA_advance_loc: 2 to 0+0002 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r12 \(r12\) at cfa-16 + DW_CFA_advance_loc: 2 to 0+0004 + DW_CFA_def_cfa_offset: 24 + DW_CFA_offset: r13 \(r13\) at cfa-24 + DW_CFA_advance_loc: 9 to 0+000d + DW_CFA_def_cfa_offset: 32 + DW_CFA_advance_loc: 1 to 0+000e + DW_CFA_def_cfa_offset: 40 + DW_CFA_advance_loc: 4 to 0+0012 + DW_CFA_def_cfa_offset: 24 + DW_CFA_advance_loc: 2 to 0+0014 + DW_CFA_restore: r13 \(r13\) + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 2 to 0+0016 + DW_CFA_restore: r12 \(r12\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.l new file mode 100644 index 00000000000..c253bed177e --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*9: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.s new file mode 100644 index 00000000000..def60578384 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.s @@ -0,0 +1,41 @@ +# Testcase for save reg ops for callee-saved registers +# These latter two pushq's of callee-saved regs must NOT generate +# .cfi_offset. + + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset %r12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset %r13, -24 +# The function may use callee-saved registers for its use, and may even +# chose to spill them to stack if necessary. + addq %rax, %r13 + subq $8, %r13 +# These two pushq's of callee-saved regs must NOT generate +# .cfi_offset. + pushq %r13 + .cfi_def_cfa_offset 32 + pushq %rax + .cfi_def_cfa_offset 40 +# Adjust the REG_SP to get rid of local stack usage. + addq $16, %rsp + .cfi_def_cfa_offset 24 +# The SCFI machinery keeps track of where the callee-saved registers +# are on the stack. It generates a restore operation if the stack +# offsets match. + popq %r13 + .cfi_restore %r13 + .cfi_def_cfa_offset 16 + popq %r12 + .cfi_restore %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.d b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.d new file mode 100644 index 00000000000..cc1533e299d --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.d @@ -0,0 +1,43 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: SCFI for callee-saved registers 3 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +00000018 0+002c 0000001c FDE cie=00000000 pc=0+0000..0+0016 + DW_CFA_advance_loc: 2 to 0+0002 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r12 \(r12\) at cfa-16 + DW_CFA_advance_loc: 2 to 0+0004 + DW_CFA_def_cfa_offset: 24 + DW_CFA_offset: r13 \(r13\) at cfa-24 + DW_CFA_advance_loc: 9 to 0+000d + DW_CFA_def_cfa_offset: 32 + DW_CFA_advance_loc: 1 to 0+000e + DW_CFA_def_cfa_offset: 40 + DW_CFA_advance_loc: 1 to 0+000f + DW_CFA_def_cfa_offset: 32 + DW_CFA_advance_loc: 2 to 0+0011 + DW_CFA_def_cfa_offset: 24 + DW_CFA_advance_loc: 2 to 0+0013 + DW_CFA_restore: r13 \(r13\) + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 2 to 0+0015 + DW_CFA_restore: r12 \(r12\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.l b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.l new file mode 100644 index 00000000000..2772fcddb38 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.l @@ -0,0 +1,3 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores most user-specified CFI directives +.*25: Warning: SCFI: asymetrical register restore diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.s b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.s new file mode 100644 index 00000000000..81e020b93ee --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.s @@ -0,0 +1,39 @@ +# Testcase for save reg ops for callee-saved registers + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset %r12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset %r13, -24 +# The program may use callee-saved registers for its use, and may even +# chose to spill them to stack if necessary. + addq %rax, %r13 + subq $8, %r13 +# These two pushq's of callee-saved regs must NOT generate +# .cfi_offset. + pushq %r13 + .cfi_def_cfa_offset 32 + pushq %rax + .cfi_def_cfa_offset 40 + popq %rax + .cfi_def_cfa_offset 32 + popq %r13 + .cfi_def_cfa_offset 24 +# The SCFI machinery keeps track of where the callee-saved registers +# are on the stack. It generates a restore operation if the stack +# offsets match. + popq %r13 + .cfi_restore %r13 + .cfi_def_cfa_offset 16 + popq %r12 + .cfi_restore %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.d b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.d new file mode 100644 index 00000000000..eb17c27c269 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.d @@ -0,0 +1,41 @@ +#as: -W --scfi +#as: +#objdump: -Wf +#name: SCFI for callee-saved registers 4 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +00000018 0+002c 0000001c FDE cie=00000000 pc=0+0000..0+005e + DW_CFA_advance_loc: 5 to 0+0005 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_advance_loc: 3 to 0+0008 + DW_CFA_def_cfa_register: r6 \(rbp\) + DW_CFA_advance_loc: 2 to 0+000a + DW_CFA_offset: r12 \(r12\) at cfa-24 + DW_CFA_advance_loc: 1 to 0+000b + DW_CFA_offset: r3 \(rbx\) at cfa-32 + DW_CFA_advance_loc1: 79 to 0+005a + DW_CFA_restore: r3 \(rbx\) + DW_CFA_advance_loc: 2 to 0+005c + DW_CFA_restore: r12 \(r12\) + DW_CFA_advance_loc: 1 to 0+005d + DW_CFA_def_cfa_register: r7 \(rsp\) + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.l b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.l new file mode 100644 index 00000000000..e2d87cbc825 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.l @@ -0,0 +1,3 @@ +.*Assembler messages: +.*4: Warning: --scfi=all ignores most user-specified CFI directives +.*24: Warning: SCFI: asymetrical register restore diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.s b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.s new file mode 100644 index 00000000000..aa22b3c6816 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.s @@ -0,0 +1,55 @@ + .type byte_insert_op1, @function +byte_insert_op1: +.LFB10: + .cfi_startproc + endbr64 + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + movq %rsp, %rbp + .cfi_def_cfa_register %rbp + pushq %r12 + .cfi_offset %r12, -24 + pushq %rbx + .cfi_offset %rbx, -32 + subq $24, %rsp + movl %edi, -20(%rbp) + movq %rsi, -32(%rbp) + movl %edx, -24(%rbp) + movq %rcx, -40(%rbp) +# The program may use callee-saved registers for its use, and may even +# chose to read them from stack if necessary. The following use should +# not be treated as reg restore for SCFI purposes (because rbx has been +# saved to -16(%rbp). + movq -40(%rbp), %rbx + movq -40(%rbp), %rax + leaq 3(%rax), %r12 + jmp .L563 +.L564: + subq $1, %rbx + subq $1, %r12 + movzbl (%rbx), %eax + movb %al, (%r12) +.L563: + cmpq -32(%rbp), %rbx + jne .L564 + movl -24(%rbp), %edx + movq -32(%rbp), %rcx + movl -20(%rbp), %eax + movq %rcx, %rsi + movl %eax, %edi + call byte_store_op1 + nop + addq $24, %rsp + popq %rbx + .cfi_restore %rbx + popq %r12 + .cfi_restore %r12 + popq %rbp + .cfi_def_cfa_register %rsp + .cfi_restore %rbp + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE10: + .size byte_insert_op1, .-byte_insert_op1 diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.d new file mode 100644 index 00000000000..f20bb79d506 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.d @@ -0,0 +1,37 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: Synthesize CFI in presence of control flow 1 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0024 0000001c FDE cie=00000000 pc=0+0000..0+003a + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r3 \(rbx\) at cfa-16 + DW_CFA_advance_loc: 37 to 0+0026 + DW_CFA_remember_state + DW_CFA_advance_loc: 1 to 0+0027 + DW_CFA_restore: r3 \(rbx\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_advance_loc: 1 to 0+0028 + DW_CFA_restore_state + DW_CFA_advance_loc: 9 to 0+0031 + DW_CFA_restore: r3 \(rbx\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.l new file mode 100644 index 00000000000..8b8b69907b6 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*15: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.s new file mode 100644 index 00000000000..9b09d69a291 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.s @@ -0,0 +1,47 @@ +# Testcase with one dominator bb and two exit bbs +# Something like for: return ferror (f) || fclose (f) != 0; + .text + .section .rodata.str1.1,"aMS",@progbits,1 +.LC0: + .string "w" +.LC1: + .string "conftest.out" + .section .text.startup,"ax",@progbits + .p2align 4 + .globl main + .type main, @function +main: +.LFB11: + .cfi_startproc + pushq %rbx + .cfi_def_cfa_offset 16 + .cfi_offset %rbx, -16 + movl $.LC0, %esi + movl $.LC1, %edi + call fopen + movq %rax, %rdi + movq %rax, %rbx + call ferror + movl %eax, %edx + movl $1, %eax + testl %edx, %edx + je .L7 + .cfi_remember_state + popq %rbx + .cfi_restore %rbx + .cfi_def_cfa_offset 8 + ret +.L7: + .cfi_restore_state + movq %rbx, %rdi + call fclose + popq %rbx + .cfi_restore %rbx + .cfi_def_cfa_offset 8 + testl %eax, %eax + setne %al + movzbl %al, %eax + ret + .cfi_endproc +.LFE11: + .size main, .-main diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.d b/gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.d new file mode 100644 index 00000000000..e501ace2271 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.d @@ -0,0 +1,29 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: Synthesize CFI in presence of control flow 2 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0001c 0+001c FDE cie=00000000 pc=0000000000000000..0000000000000016 + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_advance_loc: 3 to 0+0004 + DW_CFA_def_cfa_register: r6 \(rbp\) + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.l new file mode 100644 index 00000000000..62fd140fae8 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*8: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.s new file mode 100644 index 00000000000..ade9b107954 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.s @@ -0,0 +1,21 @@ +# Testcase for CFG creation of ginsns +# This testcase has no return instruction at the end. + .text + .globl main + .type main, @function +main: +.LFB7: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + movq %rsp, %rbp + .cfi_def_cfa_register %rbp + call foo + shrl $31, %eax + movzbl %al, %eax + movl %eax, %edi + call exit + .cfi_endproc +.LFE7: + .size main, .-main diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cfi-label-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-cfi-label-1.d new file mode 100644 index 00000000000..4aeeb75a5db --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cfi-label-1.d @@ -0,0 +1,38 @@ +#as: --scfi -W +#as: +#objdump: -tWf +#name: SCFI no ignore .cfi_label +#... +.*\.o: file format elf.* + +SYMBOL TABLE: +0+0000 l d \.text 0+0000 \.text +0+002b l \.eh_frame 0+0000 cfi2 +0+0000 g F \.text 0+0008 foo +0+002a g \.eh_frame 0+0000 cfi1 + + +Contents of the .eh_frame section: + + +00000000 0+0014 00000000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: 1b + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +00000018 0+0014 0000001c FDE cie=00000000 pc=0+0000..0+0008 + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_advance_loc: 1 to 0+0002 + DW_CFA_advance_loc: 1 to 0+0003 + DW_CFA_advance_loc: 4 to 0+0007 + DW_CFA_def_cfa_offset: 0 + DW_CFA_nop + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cfi-label-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-cfi-label-1.l new file mode 100644 index 00000000000..b170125896d --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cfi-label-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cfi-label-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-cfi-label-1.s new file mode 100644 index 00000000000..1dfb06b8c75 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cfi-label-1.s @@ -0,0 +1,19 @@ +# Testcase for .cfi_label directives + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + nop + .globl cfi1 + .cfi_label cfi1 + nop + .cfi_label cfi2 + nop + .cfi_label .Lcfi3 + addq $8, %rsp + .cfi_def_cfa_offset 0 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cfi-sections-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-cfi-sections-1.d new file mode 100644 index 00000000000..86a1ac04168 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cfi-sections-1.d @@ -0,0 +1,24 @@ +#as: --scfi -W +#as: +#objdump: --sframe +#name: Synthesize CFI with .cfi_sections +#... +Contents of the SFrame section .sframe: + Header : + + Version: SFRAME_VERSION_2 + Flags: NONE + Num FDEs: 1 + Num FREs: 5 + + Function Index : + + func idx \[0\]: pc = 0x0, size = 12 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+000a +sp\+16 +c\-16 +u + + 0+000b +sp\+8 +u +u + + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cfi-sections-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-cfi-sections-1.l new file mode 100644 index 00000000000..083c09902f5 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cfi-sections-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*7: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cfi-sections-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-cfi-sections-1.s new file mode 100644 index 00000000000..3b0ba46125c --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cfi-sections-1.s @@ -0,0 +1,22 @@ +# Testcase for switching between sp/fp based CFA. + .text + .globl foo + .type foo, @function + .cfi_sections .sframe +foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + movq %rsp, %rbp + .cfi_def_cfa_register %rbp + addq %rax, %rdi + mov %rbp, %rsp + .cfi_def_cfa_register %rsp + pop %rbp + .cfi_restore %rbp + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.d new file mode 100644 index 00000000000..af4fa429339 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.d @@ -0,0 +1,5 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI for add insn + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.l new file mode 100644 index 00000000000..c8812bc6dc5 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.l @@ -0,0 +1,3 @@ +.*Assembler messages: +.*12: Warning: --scfi=all ignores most user-specified CFI directives +.*24: Warning: Untraceable control flow for func 'foo'; Skipping SCFI diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.s new file mode 100644 index 00000000000..961156bb2e3 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.s @@ -0,0 +1,24 @@ +# Testcase with a variety of "change of flow instructions" +# +# Must be run with -W so it remains warning free. +# +# This test does not have much going on wrt synthesis of CFI; +# it just aims to ensure x8_64 -> ginsn decoding behaves +# gracefully for these "change of flow instructions" + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + addq %rdx, %rax + loop foo + notrack jmp *%rax + call *%r8 + jecxz .L179 + jmp *48(%rdi) + jo .L179 +.L179: + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-diag-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-diag-1.l new file mode 100644 index 00000000000..ef33f14dc75 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-diag-1.l @@ -0,0 +1,4 @@ +.*Assembler messages: +.*7: Warning: --scfi=all ignores most user-specified CFI directives +.*14: Error: SCFI: usage of REG_FP as scratch not supported +.*22: Error: SCFI: forward pass failed for func 'foo' diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-diag-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-diag-1.s new file mode 100644 index 00000000000..a79a55fd484 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-diag-1.s @@ -0,0 +1,22 @@ +# Testcase for REG_FP based CFA +# and using REG_FP as scratch. + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + movq %rsp, %rbp + .cfi_def_cfa_register %rbp +# The following add causes REG_FP to become untraceable + addq %rax, %rbp +# CFA cannot be recovered via REG_FP anymore + pop %rbp + .cfi_restore %rbp + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-diag-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-diag-2.l new file mode 100644 index 00000000000..ac232f8eb4b --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-diag-2.l @@ -0,0 +1,4 @@ +.*Assembler messages: +.*5: Warning: --scfi=all ignores most user-specified CFI directives +.*21: Warning: SCFI: asymetrical register restore +.*22: Warning: SCFI: asymetrical register restore diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-diag-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-diag-2.s new file mode 100644 index 00000000000..9e31143fa41 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-diag-2.s @@ -0,0 +1,28 @@ +# Testcase for a diagnostic around asymetrical restore +.type foo, @function +foo: +.LFB10: + .cfi_startproc + endbr64 + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + movq %rsp, %rbp + .cfi_def_cfa_register %rbp + pushq %r12 + pushq %rbx + subq $24, %rsp + .cfi_offset %r12, -24 + .cfi_offset %rbx, -32 + addq $24, %rsp +# Note that the order of r12 and rbx restore does not match +# order of the corresponding save(s). +# The SCFI machinery warns the user. + popq %r12 + popq %rbx + popq %rbp + .cfi_def_cfa %rsp, 8 + ret + .cfi_endproc +.LFE10: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.d new file mode 100644 index 00000000000..51f3d0137ec --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.d @@ -0,0 +1,24 @@ +#as: --scfi --gsframe -W +#as: --gsframe +#objdump: --sframe +#name: SCFI for dynamic alloc stack +#... + +Contents of the SFrame section .sframe: + Header : + + Version: SFRAME_VERSION_2 + Flags: NONE + Num FDEs: 1 + Num FREs: 4 + + Function Index : + + func idx \[0\]: pc = 0x0, size = 87 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+0056 + sp\+8 + u + u + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.l new file mode 100644 index 00000000000..518dc148f21 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*5: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.s new file mode 100644 index 00000000000..d7d9139ec8a --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.s @@ -0,0 +1,50 @@ + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + movq %rsp, %rbp + .cfi_def_cfa_register %rbp + pushq %r13 + pushq %r12 + pushq %rbx + subq $8, %rsp + .cfi_offset %r13, -24 + .cfi_offset %r12, -32 + .cfi_offset %rbx, -40 + call read_user + testl %eax, %eax + jle .L2 + cltq + xorl %ebx, %ebx + leaq 0(,%rax,4), %r13 + .p2align 4,,10 + .p2align 3 +.L3: + leaq 15(%rbx), %rax + movq %rsp, %r12 + addq $4, %rbx + andq $-16, %rax + subq %rax, %rsp + movq %rsp, %rdi + call foo + movq %r12, %rsp + cmpq %r13, %rbx + jne .L3 +.L2: + leaq -24(%rbp), %rsp + xorl %eax, %eax + popq %rbx + popq %r12 + popq %r13 + popq %rbp + .cfi_restore %rbp + .cfi_def_cfa_register %rsp + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-enter-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-enter-1.d new file mode 100644 index 00000000000..c7e62c2bac6 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-enter-1.d @@ -0,0 +1,36 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: Synthesize CFI for enter insn +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0024 0+001c FDE cie=0+0000 pc=0+0000..0+000a + DW_CFA_advance_loc: 4 to 0+0004 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_def_cfa_register: r6 \(rbp\) + DW_CFA_advance_loc: 1 to 0+0005 + DW_CFA_offset: r3 \(rbx\) at cfa-24 + DW_CFA_advance_loc: 3 to 0+0008 + DW_CFA_restore: r3 \(rbx\) + DW_CFA_advance_loc: 1 to 0+0009 + DW_CFA_def_cfa_register: r7 \(rsp\) + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-enter-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-enter-1.l new file mode 100644 index 00000000000..b170125896d --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-enter-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-enter-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-enter-1.s new file mode 100644 index 00000000000..85aaa2ec9e8 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-enter-1.s @@ -0,0 +1,24 @@ +# Testcase for leave insn + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + enter $0,$0 + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + .cfi_def_cfa_register %rbp + push %rbx + .cfi_offset %rbx, -24 + push %rdi + pop %rdi + pop %rbx + .cfi_restore %rbx + leave + .cfi_def_cfa_register %rsp + .cfi_restore %rbp + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-fp-diag-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-fp-diag-2.l new file mode 100644 index 00000000000..9e1d5a15f8a --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-fp-diag-2.l @@ -0,0 +1,3 @@ +.*Assembler messages: +.*7: Warning: --scfi=all ignores most user-specified CFI directives +.*28: Warning: SCFI: asymetrical register restore diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-fp-diag-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-fp-diag-2.s new file mode 100644 index 00000000000..e3a7bd40769 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-fp-diag-2.s @@ -0,0 +1,55 @@ +# Testcase for a diagnostic around asymetrical restore +# Testcase inspired by byte_insert_op1 in libiberty +# False positive for the diagnostic +.type foo, @function +foo: +.LFB10: + .cfi_startproc + endbr64 + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + movq %rsp, %rbp + .cfi_def_cfa_register %rbp + pushq %r12 + pushq %rbx + subq $24, %rsp + .cfi_offset %r12, -24 + .cfi_offset %rbx, -32 + movl %edi, -20(%rbp) + movq %rsi, -32(%rbp) + movl %edx, -24(%rbp) + movq %rcx, -40(%rbp) +# The assembler cannot differentiate that the following +# mov to %rbx is not a true restore operation, but simply +# %rbx register usage as a scratch reg of some sort. +# The assembler merely warns of a possible asymetric restore operation +# In this case, its noise for the user unfortunately. + movq -40(%rbp), %rbx + movq -40(%rbp), %rax + leaq 3(%rax), %r12 + jmp .L563 +.L564: + subq $1, %rbx + subq $1, %r12 + movzbl (%rbx), %eax + movb %al, (%r12) +.L563: + cmpq -32(%rbp), %rbx + jne .L564 + movl -24(%rbp), %edx + movq -32(%rbp), %rcx + movl -20(%rbp), %eax + movq %rcx, %rsi + movl %eax, %edi + call byte_store_op1 + nop + addq $24, %rsp + popq %rbx + popq %r12 + popq %rbp + .cfi_def_cfa %rsp, 8 + ret + .cfi_endproc +.LFE10: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.d new file mode 100644 index 00000000000..828d2e2ad61 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.d @@ -0,0 +1,52 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: Synthesize CFI for indirect mem op to stack 1 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0034 0+001c FDE cie=00000000 pc=0+0000..0+005b + DW_CFA_advance_loc: 4 to 0+0004 + DW_CFA_def_cfa_offset: 64 + DW_CFA_advance_loc: 4 to 0+0008 + DW_CFA_offset: r3 \(rbx\) at cfa-64 + DW_CFA_advance_loc: 5 to 0+000d + DW_CFA_offset: r6 \(rbp\) at cfa-56 + DW_CFA_advance_loc: 5 to 0+0012 + DW_CFA_offset: r12 \(r12\) at cfa-48 + DW_CFA_advance_loc: 5 to 0+0017 + DW_CFA_offset: r13 \(r13\) at cfa-40 + DW_CFA_advance_loc: 5 to 0+001c + DW_CFA_offset: r14 \(r14\) at cfa-32 + DW_CFA_advance_loc: 5 to 0+0021 + DW_CFA_offset: r15 \(r15\) at cfa-24 + DW_CFA_advance_loc: 29 to 0+003e + DW_CFA_restore: r15 \(r15\) + DW_CFA_advance_loc: 5 to 0+0043 + DW_CFA_restore: r14 \(r14\) + DW_CFA_advance_loc: 5 to 0+0048 + DW_CFA_restore: r13 \(r13\) + DW_CFA_advance_loc: 5 to 0+004d + DW_CFA_restore: r12 \(r12\) + DW_CFA_advance_loc: 5 to 0+0052 + DW_CFA_restore: r6 \(rbp\) + DW_CFA_advance_loc: 4 to 0+0056 + DW_CFA_restore: r3 \(rbx\) + DW_CFA_advance_loc: 4 to 0+005a + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.l new file mode 100644 index 00000000000..037d281602e --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*4: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.s new file mode 100644 index 00000000000..62aaedb72bc --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.s @@ -0,0 +1,48 @@ +# An example of static stack allocation by hand + .type foo, @function +foo: + .cfi_startproc + /* Allocate space for 7 registers. */ + subq $56,%rsp + .cfi_adjust_cfa_offset 56 + movq %rbx,(%rsp) + .cfi_rel_offset %rbx, 0 + movq %rbp,8(%rsp) + .cfi_rel_offset %rbp, 8 + movq %r12,16(%rsp) + .cfi_rel_offset %r12, 16 + movq %r13,24(%rsp) + .cfi_rel_offset %r13, 24 + movq %r14,32(%rsp) + .cfi_rel_offset %r14, 32 + movq %r15,40(%rsp) + .cfi_rel_offset %r15, 40 + movq %r9,48(%rsp) + + /* Setup parameter for __foo_internal. */ + /* selfpc is the return address on the stack. */ + movq 56(%rsp),%rsi + /* Get frompc via the frame pointer. */ + movq 8(%rbp),%rdi + call __foo_internal + /* Pop the saved registers. Please note that `foo' has no + return value. */ + movq 48(%rsp),%r9 + + movq 40(%rsp),%r15 + .cfi_restore %r15 + movq 32(%rsp),%r14 + .cfi_restore %r14 + movq 24(%rsp),%r13 + .cfi_restore %r13 + movq 16(%rsp),%r12 + .cfi_restore %r12 + movq 8(%rsp),%rbp + .cfi_restore %rbp + movq (%rsp),%rbx + .cfi_restore %rbx + addq $56,%rsp + .cfi_adjust_cfa_offset -56 + ret + .cfi_endproc + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.d b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.d new file mode 100644 index 00000000000..8b968cfc3f3 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.d @@ -0,0 +1,42 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: Synthesize CFI for indirect mem op to stack 2 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+002c 0+001c FDE cie=00000000 pc=0+0000..0+0026 + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_advance_loc: 3 to 0+0004 + DW_CFA_def_cfa_register: r6 \(rbp\) + DW_CFA_advance_loc: 8 to 0+000c + DW_CFA_offset: r3 \(rbx\) at cfa-32 + DW_CFA_advance_loc: 4 to 0+0010 + DW_CFA_offset: r12 \(r12\) at cfa-24 + DW_CFA_advance_loc: 9 to 0+0019 + DW_CFA_restore: r3 \(rbx\) + DW_CFA_advance_loc: 4 to 0+001d + DW_CFA_restore: r12 \(r12\) + DW_CFA_advance_loc: 7 to 0+0024 + DW_CFA_def_cfa_register: r7 \(rsp\) + DW_CFA_advance_loc: 1 to 0+0025 + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.l new file mode 100644 index 00000000000..b170125896d --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.s new file mode 100644 index 00000000000..208d53b1539 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.s @@ -0,0 +1,38 @@ +# Testcase for movq instructions + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + movq %rsp, %rbp + .cfi_def_cfa_register %rbp + + subq $16,%rsp + +# store rbx at %rsp; rsp = rbp - 16; + movq %rbx, -16(%rbp) + .cfi_rel_offset %rbx, -16 +# store r12 at %rsp + 8; rsp = rbp -16; + movq %r12, -8(%rbp) + .cfi_rel_offset %r12, -8 + + call bar + + movq -16(%rbp), %rbx + .cfi_restore %rbx + movq -8(%rbp), %r12 + .cfi_restore %r12 + + addq $16,%rsp + + mov %rbp, %rsp + .cfi_def_cfa_register %rsp + pop %rbp + .cfi_restore %rbp + .cfi_def_cfa_offset 8 + ret + .cfi_endproc + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.d b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.d new file mode 100644 index 00000000000..e473581ec37 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.d @@ -0,0 +1,42 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: Synthesize CFI for indirect mem op to stack 3 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+002c 0+001c FDE cie=00000000 pc=0+0000..0+0028 + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_advance_loc: 3 to 0+0004 + DW_CFA_def_cfa_register: r6 \(rbp\) + DW_CFA_advance_loc: 8 to 0+000c + DW_CFA_offset: r3 \(rbx\) at cfa-32 + DW_CFA_advance_loc: 5 to 0+0011 + DW_CFA_offset: r12 \(r12\) at cfa-24 + DW_CFA_advance_loc: 9 to 0+001a + DW_CFA_restore: r3 \(rbx\) + DW_CFA_advance_loc: 5 to 0+001f + DW_CFA_restore: r12 \(r12\) + DW_CFA_advance_loc: 7 to 0+0026 + DW_CFA_def_cfa_register: r7 \(rsp\) + DW_CFA_advance_loc: 1 to 0+0027 + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.l b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.l new file mode 100644 index 00000000000..b170125896d --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.s b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.s new file mode 100644 index 00000000000..d745a966db2 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.s @@ -0,0 +1,38 @@ +# Testcase for movq instructions + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + movq %rsp, %rbp + .cfi_def_cfa_register %rbp + + subq $16,%rsp + +# store rbx at %rsp; rsp = rbp - 16; rsp = CFA - 32 + movq %rbx, (%rsp) + .cfi_rel_offset %rbx, -16 +# store r12 at %rsp + 8; rsp = CFA - 32 + movq %r12, 8(%rsp) + .cfi_rel_offset %r12, -8 + + call bar + + movq (%rsp), %rbx + .cfi_restore %rbx + movq 8(%rsp), %r12 + .cfi_restore %r12 + + addq $16,%rsp + + mov %rbp, %rsp + .cfi_def_cfa_register %rsp + pop %rbp + .cfi_restore %rbp + .cfi_def_cfa_offset 8 + ret + .cfi_endproc + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-4.d b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-4.d new file mode 100644 index 00000000000..73f5c3159c1 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-4.d @@ -0,0 +1,64 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: Synthesize CFI for indirect mem op to stack 3 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +00000018 0+004c 0000001c FDE cie=00000000 pc=0+0000..0+003d + DW_CFA_advance_loc: 2 to 0+0002 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r15 \(r15\) at cfa-16 + DW_CFA_advance_loc: 2 to 0+0004 + DW_CFA_def_cfa_offset: 24 + DW_CFA_offset: r14 \(r14\) at cfa-24 + DW_CFA_advance_loc: 5 to 0+0009 + DW_CFA_def_cfa_offset: 32 + DW_CFA_offset: r13 \(r13\) at cfa-32 + DW_CFA_advance_loc: 5 to 0+000e + DW_CFA_def_cfa_offset: 40 + DW_CFA_offset: r12 \(r12\) at cfa-40 + DW_CFA_advance_loc: 4 to 0+0012 + DW_CFA_def_cfa_offset: 48 + DW_CFA_offset: r6 \(rbp\) at cfa-48 + DW_CFA_advance_loc: 4 to 0+0016 + DW_CFA_def_cfa_offset: 56 + DW_CFA_offset: r3 \(rbx\) at cfa-56 + DW_CFA_advance_loc: 7 to 0+001d + DW_CFA_def_cfa_offset: 96 + DW_CFA_advance_loc: 21 to 0+0032 + DW_CFA_def_cfa_offset: 56 + DW_CFA_advance_loc: 1 to 0+0033 + DW_CFA_restore: r3 \(rbx\) + DW_CFA_def_cfa_offset: 48 + DW_CFA_advance_loc: 1 to 0+0034 + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 40 + DW_CFA_advance_loc: 2 to 0+0036 + DW_CFA_restore: r12 \(r12\) + DW_CFA_def_cfa_offset: 32 + DW_CFA_advance_loc: 2 to 0+0038 + DW_CFA_restore: r13 \(r13\) + DW_CFA_def_cfa_offset: 24 + DW_CFA_advance_loc: 2 to 0+003a + DW_CFA_restore: r14 \(r14\) + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 2 to 0+003c + DW_CFA_restore: r15 \(r15\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-4.l b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-4.l new file mode 100644 index 00000000000..0400e526b53 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-4.l @@ -0,0 +1,3 @@ +.*Assembler messages: +.*7: Warning: --scfi=all ignores most user-specified CFI directives +.*41: Warning: SCFI: asymetrical register restore diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-4.s b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-4.s new file mode 100644 index 00000000000..6f328a1e62d --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-4.s @@ -0,0 +1,68 @@ +# Testcase for save/unsave of callee-saved registers +# Must be run -W as there is an expected warning as +# noted below + .type foo, @function +foo: +.LFB118: + .cfi_startproc + pushq %r15 + .cfi_def_cfa_offset 16 + .cfi_offset %r15, -16 + pushq %r14 + .cfi_def_cfa_offset 24 + .cfi_offset %r14, -24 + movl %r8d, %r14d + pushq %r13 + .cfi_def_cfa_offset 32 + .cfi_offset %r13, -32 + movq %rdi, %r13 + pushq %r12 + .cfi_def_cfa_offset 40 + .cfi_offset %r12, -40 + movq %rsi, %r12 + pushq %rbp + .cfi_def_cfa_offset 48 + .cfi_offset %rbp, -48 + movq %rcx, %rbp + pushq %rbx + .cfi_def_cfa_offset 56 + .cfi_offset %rbx, -56 + movq %rdx, %rbx + subq $40, %rsp + .cfi_def_cfa_offset 96 + testb $1, 37(%rdx) + je .L2 +.L3: +# The following is not a restore of r15: rbp has been used as +# scratch register already. The SCFI machinery must know that +# REG_FP is not traceable. +# A warning here is expected: +# 41: Warning: SCFI: asymetrical register restore + movq 32(%rbp), %r15 + cmpq $0, 64(%r15) + je .L2 +.L2: + addq $40, %rsp + .cfi_def_cfa_offset 56 + popq %rbx + .cfi_restore %rbx + .cfi_def_cfa_offset 48 + popq %rbp + .cfi_restore %rbp + .cfi_def_cfa_offset 40 + popq %r12 + .cfi_restore %r12 + .cfi_def_cfa_offset 32 + popq %r13 + .cfi_restore %r13 + .cfi_def_cfa_offset 24 + popq %r14 + .cfi_restore %r14 + .cfi_def_cfa_offset 16 + popq %r15 + .cfi_restore %r15 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE118: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-5.s b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-5.s new file mode 100644 index 00000000000..4b631d80ae7 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-5.s @@ -0,0 +1,35 @@ +# An example of static stack allocation by hand + .type foo, @function +foo: + .cfi_startproc + /* Allocate space for 7 registers. */ + subq $56,%rsp + .cfi_adjust_cfa_offset 56 + movq %rsp, %rax + movq %rbx,(%rax) + .cfi_rel_offset %rbx, 0 + movq %rbp,8(%rax) + .cfi_rel_offset %rbp, 8 + movq %r12,16(%rax) + .cfi_rel_offset %r12, 16 + + /* Setup parameter for __foo_internal. */ + /* selfpc is the return address on the stack. */ + movq 56(%rsp),%rsi + /* Get frompc via the frame pointer. */ + movq 8(%rbp),%rdi + call __foo_internal + /* Pop the saved registers. Please note that `foo' has no + return value. */ + + movq 16(%rax),%r12 + .cfi_restore %r12 + movq 8(%rax),%rbp + .cfi_restore %rbp + movq (%rsp),%rbx + .cfi_restore %rbx + addq $56,%rsp + .cfi_adjust_cfa_offset -56 + ret + .cfi_endproc + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-lea-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-lea-1.d new file mode 100644 index 00000000000..47b2a5a6f9b --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-lea-1.d @@ -0,0 +1,38 @@ +#as: --scfi -W -O2 +#as: -O2 +#objdump: -Wf +#name: Synthesize CFI for various lea instructions (-O2) +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0024 0+001c FDE cie=00000000 pc=0+0000..0+0029 + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_advance_loc: 3 to 0+0004 + DW_CFA_def_cfa_register: r6 \(rbp\) + DW_CFA_advance_loc: 2 to 0+0006 + DW_CFA_offset: r13 \(r13\) at cfa-24 + DW_CFA_advance_loc: 33 to 0+0027 + DW_CFA_restore: r13 \(r13\) + DW_CFA_advance_loc: 1 to 0+0028 + DW_CFA_def_cfa_register: r7 \(rsp\) + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-lea-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-lea-1.l new file mode 100644 index 00000000000..62fd140fae8 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-lea-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*8: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-lea-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-lea-1.s new file mode 100644 index 00000000000..48e3262363c --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-lea-1.s @@ -0,0 +1,39 @@ +## Testcase with a variety of lea. +## This test is run with -O2 by default to check +## SCFI in wake of certain target optimizations. + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 +# This lea gets transformed to mov %rsp, %rbp when -O2. +# The SCFI machinery must see it as such. + lea (%rsp), %rbp + .cfi_def_cfa_register %rbp + push %r13 + .cfi_offset %r13, -24 + subq $8, %rsp + testl %eax, %eax + jle .L2 +.L3: + movq %rsp, %r12 + lea -0x2(%r13),%rax + lea 0x8(%r12,%rdx,4),%r8 + movq %r12, %rsp + jne .L3 +.L2: + leaq -8(%rbp), %rsp + xorl %eax, %eax + popq %r13 + .cfi_restore %r13 + popq %rbp + .cfi_def_cfa_register %rsp + .cfi_restore %rbp + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-leave-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-leave-1.d new file mode 100644 index 00000000000..749358c9cc1 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-leave-1.d @@ -0,0 +1,37 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: Synthesize CFI for leave insn +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0024 0+001c FDE cie=0+0000 pc=0+0000..0+000a + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_advance_loc: 3 to 0+0004 + DW_CFA_def_cfa_register: r6 \(rbp\) + DW_CFA_advance_loc: 1 to 0+0005 + DW_CFA_offset: r3 \(rbx\) at cfa-24 + DW_CFA_advance_loc: 3 to 0+0008 + DW_CFA_restore: r3 \(rbx\) + DW_CFA_advance_loc: 1 to 0+0009 + DW_CFA_def_cfa_register: r7 \(rsp\) + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-leave-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-leave-1.l new file mode 100644 index 00000000000..b170125896d --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-leave-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-leave-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-leave-1.s new file mode 100644 index 00000000000..53c037fffc0 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-leave-1.s @@ -0,0 +1,25 @@ +# Testcase for leave insn + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + movq %rsp, %rbp + .cfi_def_cfa_register %rbp + push %rbx + .cfi_offset %rbx, -24 + push %rdi + pop %rdi + pop %rbx + .cfi_restore %rbx + leave + .cfi_def_cfa_register %rsp + .cfi_restore %rbp + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.d new file mode 100644 index 00000000000..e7a9c5018c0 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.d @@ -0,0 +1,36 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: Synthesize CFI for pushq insns +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0024 0+001c FDE cie=0+0000 pc=0+0000..0+000f + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 3 to 0+0004 + DW_CFA_def_cfa_offset: 24 + DW_CFA_advance_loc: 5 to 0+0009 + DW_CFA_def_cfa_offset: 28 + DW_CFA_advance_loc: 2 to 0+000b + DW_CFA_def_cfa_offset: 36 + DW_CFA_advance_loc: 2 to 0+0000d + DW_CFA_def_cfa_offset: 44 + DW_CFA_advance_loc: 1 to 0+0000e + DW_CFA_def_cfa_offset: 52 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.l new file mode 100644 index 00000000000..083c09902f5 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*7: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.s new file mode 100644 index 00000000000..65180c9f6a0 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.s @@ -0,0 +1,23 @@ +## Testcase with a variety of pushq. +## all push insns valid in 64-bit mode must be processed for SCFI. + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rax + .cfi_def_cfa_offset 16 + pushq 16(%rax) + .cfi_def_cfa_offset 24 + push $1048576 + .cfi_def_cfa_offset 28 + pushq %fs + .cfi_def_cfa_offset 36 + pushq %gs + .cfi_def_cfa_offset 44 + pushf + .cfi_def_cfa_offset 52 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-1.d new file mode 100644 index 00000000000..1fd0af4d8ae --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-1.d @@ -0,0 +1,43 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI with pushsection 1 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +00000018 0+0010 0000001c FDE cie=00000000 pc=0+0000..0+0005 + DW_CFA_advance_loc: 4 to 0+0004 + DW_CFA_def_cfa_offset: 48 + +0000002c 0+0028 00000030 FDE cie=00000000 pc=0+0000..0+0014 + DW_CFA_advance_loc: 2 to 0+0002 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r12 \(r12\) at cfa-16 + DW_CFA_advance_loc: 2 to 0+0004 + DW_CFA_def_cfa_offset: 24 + DW_CFA_offset: r13 \(r13\) at cfa-24 + DW_CFA_advance_loc: 4 to 0+0008 + DW_CFA_def_cfa_offset: 32 + DW_CFA_advance_loc: 7 to 0+000f + DW_CFA_def_cfa_offset: 24 + DW_CFA_advance_loc: 2 to 0+0011 + DW_CFA_restore: r13 \(r13\) + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 2 to 0+0013 + DW_CFA_restore: r12 \(r12\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-1.l new file mode 100644 index 00000000000..083c09902f5 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*7: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-1.s new file mode 100644 index 00000000000..d6d9f1cf508 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-1.s @@ -0,0 +1,40 @@ +# Testcase for pushsection directive and SCFI. +# The .pushsection directive must cause creation of a new FDE. + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset %r12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset %r13, -24 + subq $8, %rsp + .cfi_def_cfa_offset 32 + mov %rax, %rbx + .pushsection .text2 +# It's the .type directive here that enforces SCFI generation +# for the code block that follows + .type foo2, @function +foo2: + .cfi_startproc + subq $40, %rsp + .cfi_def_cfa_offset 48 + ret + .cfi_endproc + .size foo2, .-foo2 + .popsection + addq $8, %rsp + .cfi_def_cfa_offset 24 + popq %r13 + .cfi_restore %r13 + .cfi_def_cfa_offset 16 + popq %r12 + .cfi_restore %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-2.d b/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-2.d new file mode 100644 index 00000000000..a2eef299563 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-2.d @@ -0,0 +1,40 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: Synthesize CFI for demarcated code blocks 2 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +00000018 0+002c 0000001c FDE cie=00000000 pc=0+0000..0+0014 + DW_CFA_advance_loc: 2 to 0+0002 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r12 \(r12\) at cfa-16 + DW_CFA_advance_loc: 2 to 0+0004 + DW_CFA_def_cfa_offset: 24 + DW_CFA_offset: r13 \(r13\) at cfa-24 + DW_CFA_advance_loc: 4 to 0+0008 + DW_CFA_def_cfa_offset: 32 + DW_CFA_advance_loc: 7 to 0+000f + DW_CFA_def_cfa_offset: 24 + DW_CFA_advance_loc: 2 to 0+0011 + DW_CFA_restore: r13 \(r13\) + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 2 to 0+0013 + DW_CFA_restore: r12 \(r12\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-2.l new file mode 100644 index 00000000000..b170125896d --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-2.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-2.s new file mode 100644 index 00000000000..29779646ccd --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-2.s @@ -0,0 +1,41 @@ +# Testcase for pushsection directive and SCFI. + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset %r12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset %r13, -24 + subq $8, %rsp + .cfi_def_cfa_offset 32 + mov %rax, %rbx +# The .pushsection directive creates a new code block, +# which must not contribute ginsn to the existing one. + .pushsection .text2 +# For CFI to be synthesized for this block, the user should have +# demarcated the beginning with a .type name, @function. +# Note that, the test when run without --scfi will, however, +# generate the DWARF FDE if the CFI annotations exist. Hence, +# comment them out for now. +# .cfi_startproc + subq $40, %rsp +# .cfi_def_cfa_offset 48 + ret +# .cfi_endproc + .popsection + addq $8, %rsp + .cfi_def_cfa_offset 24 + popq %r13 + .cfi_restore %r13 + .cfi_def_cfa_offset 16 + popq %r12 + .cfi_restore %r12 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.d new file mode 100644 index 00000000000..1bb4ba61835 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.d @@ -0,0 +1,32 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: Synthesize CFI for self-aligning func +#... +Contents of the .eh_frame section: + +0+0000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+001c 0000001c FDE cie=00000000 pc=0+0000..0+002f + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_advance_loc: 3 to 0+0004 + DW_CFA_def_cfa_register: r6 \(rbp\) + DW_CFA_advance_loc: 42 to 0+002e + DW_CFA_def_cfa_register: r7 \(rsp\) + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.l new file mode 100644 index 00000000000..083c09902f5 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*7: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.s new file mode 100644 index 00000000000..963987777bf --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.s @@ -0,0 +1,36 @@ +# If it is known that the caller of self_aligning_foo may have had +# the stack pointer unaligned to 16-bytes boundary, such self-aligning +# functions may be used by asm programmers. + .globl self_aligning_foo + .type self_aligning_foo, @function +self_aligning_foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + movq %rsp, %rbp + .cfi_def_cfa_register %rbp +# The following 'and' op aligns the stack pointer. +# At the same time, it causes REG_SP to become non-traceable +# for SCFI purposes. But no warning is issued as no further stack +# size tracking is needed for SCFI purposes. + andq $-16, %rsp + subq $32, %rsp + movl %edi, 12(%rsp) + movl %esi, 8(%rsp) + movl $0, %eax + call vector_using_function + movaps %xmm0, 16(%rsp) + movl 12(%rsp), %edx + movl 8(%rsp), %eax + addl %edx, %eax + leave +# GCC typically generates a '.cfi_def_cfa 7, 8' for leave +# insn. The SCFI however, will generate the following: + .cfi_def_cfa_register %rsp + .cfi_restore %rbp + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size self_aligning_foo, .-self_aligning_foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-simple-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-simple-1.d new file mode 100644 index 00000000000..47878fb90e4 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-simple-1.d @@ -0,0 +1,27 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: Synthesize CFI simple test 1 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0014 0+001c FDE cie=0+0000 pc=0+0000..0+0002 + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_nop + DW_CFA_nop + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-simple-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-simple-1.l new file mode 100644 index 00000000000..083c09902f5 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-simple-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*7: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-simple-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-simple-1.s new file mode 100644 index 00000000000..8153a848d5e --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-simple-1.s @@ -0,0 +1,15 @@ +# Simple test +# A wierd function, but SCFI machinery does not complain yet. + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo + diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-simple-2.d b/gas/testsuite/gas/scfi/x86_64/scfi-simple-2.d new file mode 100644 index 00000000000..58d6b3d8a27 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-simple-2.d @@ -0,0 +1,31 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: Synthesize CFI simple test 2 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0001c 0+0001c FDE cie=0+0000 pc=0+0000..0+0003 + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_advance_loc: 1 to 0+0002 + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-simple-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-simple-2.l new file mode 100644 index 00000000000..518dc148f21 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-simple-2.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*5: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-simple-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-simple-2.s new file mode 100644 index 00000000000..7055fc10b23 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-simple-2.s @@ -0,0 +1,16 @@ + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + popq %rbp + .cfi_restore 6 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo + diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-sub-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-sub-1.d new file mode 100644 index 00000000000..9b327369f29 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-sub-1.d @@ -0,0 +1,26 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: Synthesize CFI for sub insn 1 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0014 0+001c FDE cie=0+0000 pc=0+0000..0+0008 + DW_CFA_advance_loc: 7 to 0+0007 + DW_CFA_def_cfa_offset: 120016 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-sub-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-sub-1.l new file mode 100644 index 00000000000..b170125896d --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-sub-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-sub-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-sub-1.s new file mode 100644 index 00000000000..befd4177be8 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-sub-1.s @@ -0,0 +1,12 @@ +# Testcase for sub instruction. + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + subq $120008, %rsp + .cfi_def_cfa_offset 120016 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-sub-2.d b/gas/testsuite/gas/scfi/x86_64/scfi-sub-2.d new file mode 100644 index 00000000000..a47d9f36826 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-sub-2.d @@ -0,0 +1,32 @@ +#as: --scfi -W +#as: +#objdump: -Wf +#name: Synthesize CFI for sub insn 2 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+001c 0+001c FDE cie=0+0000 pc=0+0000..0+001d + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_advance_loc: 3 to 0+0004 + DW_CFA_def_cfa_register: r6 \(rbp\) + DW_CFA_advance_loc: 24 to 0+001c + DW_CFA_def_cfa_register: r7 \(rsp\) + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-sub-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-sub-2.l new file mode 100644 index 00000000000..b170125896d --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-sub-2.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-sub-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-sub-2.s new file mode 100644 index 00000000000..b7edbf7acc9 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-sub-2.s @@ -0,0 +1,29 @@ +# Testcase for sub reg, reg instruction. + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + movq %rsp, %rbp + .cfi_def_cfa_register %rbp + subq %rax, %rsp +# SCFI: Stack-pointer manipulation after switching +# to RBP based tracking is OK. + addq %rax, %rsp +# Other kind of sub instructions should not error out in the +# x86_64 -> ginsn translator + subq (%r12), %rax + subq $1,(%rdi) + subq %rax, 40(%r12) + subl %edx, -32(%rsp) + leave + .cfi_def_cfa_register %rsp + .cfi_restore %rbp + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-1.l new file mode 100644 index 00000000000..c856c08c2ae --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-1.l @@ -0,0 +1,2 @@ +Assembler messages: +Fatal error: Synthesizing CFI is not supported for this ABI diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-1.s new file mode 100644 index 00000000000..d914dc1de28 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-1.s @@ -0,0 +1,9 @@ +# Testcase run with --m32 (Not supported). + .text + .globl foo + .type foo, @function +foo: + pushq %rbp + ret +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-2.l new file mode 100644 index 00000000000..98a7ac67ec0 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-2.l @@ -0,0 +1,3 @@ +.*Assembler messages: +.*8: Error: SCFI: unsupported stack manipulation pattern +.*13: Error: SCFI: forward pass failed for func 'foo' diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-2.s new file mode 100644 index 00000000000..1f4dd771688 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-2.s @@ -0,0 +1,13 @@ + .text + .globl foo + .type foo, @function +foo: + addq %rdx, %rax +# Stack manipulation without switching to RBP +# based tracking is not supported for SCFI. + addq %rax, %rsp + push %rdi + leave + ret +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-3.l b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-3.l new file mode 100644 index 00000000000..98a7ac67ec0 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-3.l @@ -0,0 +1,3 @@ +.*Assembler messages: +.*8: Error: SCFI: unsupported stack manipulation pattern +.*13: Error: SCFI: forward pass failed for func 'foo' diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-3.s b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-3.s new file mode 100644 index 00000000000..3d1c1a6a51e --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-3.s @@ -0,0 +1,13 @@ + .text + .globl foo + .type foo, @function +foo: + addq %rdx, %rax +# Stack manipulation without switching to RBP +# based tracking is not supported for SCFI. + movq %rax, %rsp + push %rdi + leave + ret +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-4.l b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-4.l new file mode 100644 index 00000000000..ab62eed1165 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-4.l @@ -0,0 +1,4 @@ +.*Assembler messages: +.*4: Warning: --scfi=all ignores most user-specified CFI directives +.*14: Error: SCFI: unsupported stack manipulation pattern +.*22: Error: SCFI: forward pass failed for func 'foo' diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-4.s b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-4.s new file mode 100644 index 00000000000..95d9e70febb --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-4.s @@ -0,0 +1,22 @@ + .type foo, @function +foo: +.LFB16: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + movq %rsp, %rbp +# The following stack manipulation is OK to do, as CFA tracking +# REG_FP based. + movq %rax, %rsp +# But...not quite, if there is a follow up usage of stack +# like a register save of a callee-saved register. + push %rbx + mov %rbp, %rsp + popq %rbp + .cfi_def_cfa %rsp, 8 + .cfi_restore %rbp + ret + .cfi_endproc +.LFE16: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-1.l new file mode 100644 index 00000000000..af4e2e770bd --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-1.l @@ -0,0 +1,3 @@ +.*Assembler messages: +.*50: Warning: --scfi=all ignores most user-specified CFI directives +.*52: Warning: Untraceable control flow for func 'foo'; Skipping SCFI diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-1.s new file mode 100644 index 00000000000..56a5ce9d623 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-1.s @@ -0,0 +1,52 @@ +# Testcase with an indirect jump +# Indirect jumps, when present, make the list of ginsn an invalid +# candidate for CFG creation. Hence, no SCFI can be generated either. +# +# The testcase is rather long to showcase a simple concept. The reason of +# such a long testcase is to discuss if it is important to deal with these +# patterns. It may be possible to deal with this, if we allow some special +# directives for helping the assembler with the indirect jump (jump table). + .text + .globl foo + .type foo, @function +foo: + pushq %rbp + movq %rsp, %rbp + movl %edi, -4(%rbp) + cmpl $5, -4(%rbp) + ja .L2 + movl -4(%rbp), %eax + movq .L4(,%rax,8), %rax + jmp *%rax +.L4: + .quad .L9 + .quad .L8 + .quad .L7 + .quad .L6 + .quad .L5 + .quad .L3 +.L9: + movl $43, %eax + jmp .L1 +.L8: + movl $42, %eax + jmp .L1 +.L7: + movl $45, %eax + jmp .L1 +.L6: + movl $47, %eax + jmp .L1 +.L5: + movl $37, %eax + jmp .L1 +.L3: + movl $63, %eax + jmp .L1 +.L2: +.L1: + popq %rbp + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-2.l new file mode 100644 index 00000000000..79ff30454b4 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-2.l @@ -0,0 +1,4 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores most user-specified CFI directives +.*9: Error: SCFI: jmp insn with non-zero addend to sym not supported +.*9: Error: SCFI: unhandled op 0xeb may cause incorrect CFI diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-2.s new file mode 100644 index 00000000000..516bda28d62 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-2.s @@ -0,0 +1,14 @@ +# Testcase with unsupported jmp instructions + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc +# The non-zero addend makes control flow tracking not impossible, but +# difficult. SCFI for such functions is not attempted. + jmp RangeLimit+1; +RangeLimit: + nop + ret + .cfi_endproc + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-drap-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-drap-1.l new file mode 100644 index 00000000000..23191057bc5 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-drap-1.l @@ -0,0 +1,4 @@ +.*Assembler messages: +.*16: Warning: --scfi=all ignores most user-specified CFI directives +.*19: Error: SCFI: unsupported stack manipulation pattern +.*75: Error: SCFI: forward pass failed for func 'drap_foo' diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-drap-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-drap-1.s new file mode 100644 index 00000000000..3809e9054c0 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-drap-1.s @@ -0,0 +1,75 @@ +# Testcase with Dynamically Realigned Argument Pointer (DRAP) +# register usage. +# +# There are two reasons why this cannot be supported with the current +# SCFI machinery +# 1. Not allowed: REG_CFA is r10 based for the few insns after +# 'leaq 8(%rsp), %r10'. +# 2. Untraceable stack size after 'andq $-16, %rsp' +# Both of these shortcomings may be worked out. FIXME DISCUSS Keep the rather +# long testcase until then. + .text + .globl drap_foo + .type drap_foo, @function +drap_foo: +.LFB0: + .cfi_startproc + leaq 8(%rsp), %r10 + .cfi_def_cfa %r10, 0 + andq $-16, %rsp + pushq -8(%r10) + .cfi_def_cfa %rsp, 8 + pushq %rbp + .cfi_offset %rbp, -16 + movq %rsp, %rbp + .cfi_def_cfa_register %rbp + pushq %r15 + pushq %r14 + pushq %r13 + pushq %r12 + pushq %r10 + .cfi_offset %r15, -24 + .cfi_offset %r14, -32 + .cfi_offset %r13, -40 + .cfi_offset %r12, -48 + pushq %rbx + .cfi_offset %rbx, -64 + subq $32, %rsp + movq $0, (%rdx) + cmpq $0, (%rdi) + movq $0, -56(%rbp) + je .L21 + movq %rdi, %rbx + movq %rsi, %rdi + movq %rsi, %r12 + call func2@PLT + movq (%rbx), %rdi + leaq -56(%rbp), %rdx + movslq %eax, %rsi + call func1@PLT + testl %eax, %eax + je .L21 + movq -56(%rbp), %r13 +.L21: + addq $32, %rsp + xorl %eax, %eax + popq %rbx + .cfi_restore %rbx3 + popq %r10 + popq %r12 + .cfi_restore %r12 + popq %r13 + .cfi_restore %r13 + popq %r14 + .cfi_restore %r14 + popq %r15 + .cfi_restore %r15 + popq %rbp + .cfi_restore %rbp + .cfi_def_cfa_register %rsp + .cfi_def_cfa_offset 8 + leaq -8(%r10), %rsp + ret + .cfi_endproc +.LFE0: + .size drap_foo, .-drap_foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-insn-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-insn-1.l new file mode 100644 index 00000000000..a81fa4b4b90 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-insn-1.l @@ -0,0 +1,5 @@ +.*Assembler messages: +.*6: Error: SCFI: unhandled op 0x8f may cause incorrect CFI +.*7: Error: SCFI: unhandled op 0x8f may cause incorrect CFI +.*8: Error: SCFI: unhandled op 0xff may cause incorrect CFI +.*9: Error: SCFI: unhandled op 0xff may cause incorrect CFI diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-insn-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-insn-1.s new file mode 100644 index 00000000000..fa51b2f9202 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-insn-1.s @@ -0,0 +1,12 @@ +# Certain APX instructions are not supported currently + .text + .globl foo + .type foo, @function +foo: + pop2p %r12, %rax + pop2 %r12, %rax + push2 %r12, %rax + push2p %rax, %r17 + ret +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp b/gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp new file mode 100644 index 00000000000..57366fb5c20 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp @@ -0,0 +1,113 @@ +# Copyright (C) 2022-2023 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 +} + +# common tests +if { ([istarget "x86_64-*-*"]) } then { + + global ASFLAGS + set old_ASFLAGS "$ASFLAGS" + + run_list_test "ginsn-dw2-regnum-1" "--scfi -ali" + run_list_test "ginsn-add-1" "--scfi -ali" + run_list_test "ginsn-pop-1" "--scfi -ali" + run_list_test "ginsn-push-1" "--scfi -ali" + + run_dump_test "scfi-cfi-label-1" + run_list_test "scfi-cfi-label-1" "--scfi --warn" + run_dump_test "scfi-cfi-sections-1" + run_list_test "scfi-cfi-sections-1" "--scfi --warn" + + run_list_test "scfi-diag-1" "--scfi" + run_list_test "scfi-fp-diag-2" "--scfi" + run_list_test "scfi-diag-2" "--scfi" + + run_list_test "scfi-unsupported-1" "--32 --scfi" + run_list_test "scfi-unsupported-1" "--x32 --scfi" + run_list_test "scfi-unsupported-insn-1" "--scfi" + run_list_test "scfi-unsupported-2" "--scfi" + run_list_test "scfi-unsupported-3" "--scfi" + run_list_test "scfi-unsupported-4" "--scfi" + run_list_test "scfi-unsupported-drap-1" "--scfi" + run_list_test "scfi-unsupported-cfg-1" "--scfi" + run_list_test "scfi-unsupported-cfg-2" "--scfi" + + run_dump_test "scfi-add-1" + run_list_test "scfi-add-1" "--scfi --warn" + run_dump_test "scfi-add-2" + run_list_test "scfi-add-2" "--scfi --warn" + run_dump_test "scfi-cfg-1" + run_list_test "scfi-cfg-1" "--scfi --warn" + run_dump_test "scfi-cfg-2" + run_list_test "scfi-cfg-2" "--scfi --warn" + run_dump_test "scfi-asm-marker-1" + run_list_test "scfi-asm-marker-1" "--scfi --warn" + run_dump_test "scfi-asm-marker-2" + run_list_test "scfi-asm-marker-2" "--scfi --warn" + run_dump_test "scfi-asm-marker-3" + run_list_test "scfi-asm-marker-3" "--scfi --warn" + run_dump_test "scfi-pushsection-1" + run_list_test "scfi-pushsection-1" "--scfi --warn" + run_dump_test "scfi-pushsection-2" + run_list_test "scfi-pushsection-2" "--scfi --warn" + + run_dump_test "scfi-cofi-1" + run_list_test "scfi-cofi-1" "--scfi --warn" + run_dump_test "scfi-sub-1" + run_list_test "scfi-sub-1" "--scfi --warn" + run_dump_test "scfi-sub-2" + run_list_test "scfi-sub-2" "--scfi --warn" + run_dump_test "scfi-simple-1" + run_list_test "scfi-simple-1" "--scfi --warn" + run_dump_test "scfi-simple-2" + run_list_test "scfi-simple-2" "--scfi --warn" + run_dump_test "scfi-pushq-1" + run_list_test "scfi-pushq-1" "--scfi --warn" + run_dump_test "scfi-lea-1" + run_list_test "scfi-lea-1" "--scfi --warn" + run_dump_test "scfi-enter-1" + run_list_test "scfi-enter-1" "--scfi --warn" + run_dump_test "scfi-leave-1" + run_list_test "scfi-leave-1" "--scfi --warn" + run_dump_test "scfi-bp-sp-1" + run_list_test "scfi-bp-sp-1" "--scfi --warn" + run_dump_test "scfi-bp-sp-2" + run_list_test "scfi-bp-sp-2" "--scfi --warn" + run_dump_test "scfi-callee-saved-1" + run_list_test "scfi-callee-saved-1" "--scfi --warn" + run_dump_test "scfi-callee-saved-2" + run_list_test "scfi-callee-saved-2" "--scfi --warn" + run_dump_test "scfi-callee-saved-3" + run_list_test "scfi-callee-saved-3" "--scfi --warn" + run_dump_test "scfi-callee-saved-4" + run_list_test "scfi-callee-saved-4" "--scfi --warn" + run_dump_test "scfi-dyn-stack-1" + run_list_test "scfi-dyn-stack-1" "--scfi --warn" + run_dump_test "scfi-indirect-mov-1" + run_list_test "scfi-indirect-mov-1" "--scfi --warn" + run_dump_test "scfi-indirect-mov-2" + run_list_test "scfi-indirect-mov-2" "--scfi --warn" + run_dump_test "scfi-indirect-mov-3" + run_list_test "scfi-indirect-mov-3" "--scfi --warn" + run_dump_test "scfi-indirect-mov-4" + run_list_test "scfi-indirect-mov-4" "--scfi --warn" + run_dump_test "scfi-selfalign-func-1" + run_list_test "scfi-selfalign-func-1" "--scfi --warn" +} + From patchwork Wed Jan 3 07:15:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 83210 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BAC6C3857831 for ; Wed, 3 Jan 2024 07:20:07 +0000 (GMT) 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 3D31B385800D for ; Wed, 3 Jan 2024 07:16:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3D31B385800D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3D31B385800D Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266166; cv=pass; b=CjJJIDP3cXWvdNjJ+klgGFIkJlrowOA44tilQRgODOCZXiZTjM54+at+wTIsjfv4j74/qAU5Jh8BD6HtF4o2fz/roguH3WEo4EO4m/Cd2Ds10Ekcu7PI0z7sckjCuG0V0AGRnGQXjUIwLmPBRNc3el7dP2rgWSdFRIvTtZBKhow= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266166; c=relaxed/simple; bh=U179F9IUrG6YXncX3o1OsW3jnCowr4fiEbVu0jCS01k=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=B8mRIKavqpk0CLq4TSGzP5NQMCoV41/5ZyEuc+oVkDUc5JlUXyIIRYw5C8rNqDTSu/yNN5KgMcUEZt9bj3LEevR2OBX7R/p+W4HtiVjeNZa1sYvxAXsKPXZi62ApIO43feGF32Gv+etc0T9vMesE2faguL1AVIdtKV/1e2kQYOo= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4030iF8g023748 for ; Wed, 3 Jan 2024 07:16:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=NsLF4rheU+2AceRZXGNnU11epUXA/juyC2fbmtxsSmI=; b=HBT7ugoEZwoNN9D8jwSxUX0zBrb9Lji2od+zzlVzvvN7jcUA1RzNuohLD5rS4W7VEwTT IXvsPvlFeAcPfsGqbhZ0AUFKQUdZCAVfFQtfDI/BKd/yqouDnnZPGg8qelxLgNHpp9bo o+9hsefN9LSSwuEyIZTahnRXXlA8MqGh5aVJK8KgPsH2PasuIGmeIchvKV1CbpoBYjOk hg7+CA/V+xZUmnbQpmCM/VQrnACVwopMMgtfEAzYe2TWyXMM9ROSf+Yxecf5HelvSVWl frN6FqmgjnxXKWykq/nEFngBl0BzOsJ4hMCh+1KoZmKssTxeFDDLORgPwxX8oMd3HnKs 5g== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3va9t24fh6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:16:03 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 4036FSoF001837 for ; Wed, 3 Jan 2024 07:16:03 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3va9n8pe41-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:16:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=didAq9QE5Hr5bjjCI8Q7vojQQJZ/sxHCU1xBZ2gfedxWfM54LwE1KNObXnOZcdoAbmi+zcc1ZiYvDZXigxxpwNAwktCTLgafy+lYKmhWPc0NErFwCU71oLwv8l5XV0D3PBvmeuDGSCMP8FtvwF9Mggo/c4xycVn5rWAMcbI12yOxG8bzwm2EoQLhZxjjJhQh9bKUoX8hO8Kh4//GV0H5AvPr3pJNxfm5Gr4pirQ2+tjVKcb8YQ7ANbjODHZokc+icyUSnZmbU26SY29d22s/8uOpzLscd6IfHjfxsUHeVLA4E2EzDlDokmMjr09Mc85CwMPDVAC3HlX/73vQ/M03tQ== 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=NsLF4rheU+2AceRZXGNnU11epUXA/juyC2fbmtxsSmI=; b=msmPN9LQHQFZiAMMp16fT3V+xMeFVQMmQquul+irJXWn5Z21JoPCS26TwrlGJt0Qxmg4amy/vkOy5AKpN2ECZGdW/UBjVbeLQ1/R2jU6JI+d0ieOtxvRgEJucoD5TfaYfkr3rgHSxs5tQbFdIY/r6f9c5PxQykqDDYRrnNkWfnNDNVUi1qEFVCwYNTa9gTtyhhuX5QRBIPzHW/lD3oiLZdvGsgtDodna62ZVIRrtf4xrxlWMspcfJb369+R6Cn7PSvKtR7sb3yUdvI9gwlHlGcko7TO5R9zgU1Tu9bIdYQjDp2/uXMJCr319/bR1CNlU8FW5taeoEV9JNtbzKvUb1g== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NsLF4rheU+2AceRZXGNnU11epUXA/juyC2fbmtxsSmI=; b=yVl6ixN2/UyKKF5LOKt7kTN3N08MeOD756K1PrlJEClisyabDFMENxuXD4JOz9+0aRfMuVIorfHn2DUk7MX5YBimXHH6gNwF8zRYJUgLPxQFYixPM4K5ltZrBOLVhNQU+ricMdgZqzeti+bzqev/XiKpvGjZ1yHE7C3sHhSug3o= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by CY8PR10MB6777.namprd10.prod.outlook.com (2603:10b6:930:98::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.25; Wed, 3 Jan 2024 07:16:01 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fde7:fb92:8ea1:a5ac%4]) with mapi id 15.20.7159.013; Wed, 3 Jan 2024 07:16:01 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH,V4 14/14] gas/NEWS: announce the new SCFI command line option Date: Tue, 2 Jan 2024 23:15:26 -0800 Message-ID: <20240103071526.3846985-15-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240103071526.3846985-1-indu.bhagat@oracle.com> References: <20240103071526.3846985-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR03CA0219.namprd03.prod.outlook.com (2603:10b6:303:b9::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_|CY8PR10MB6777:EE_ X-MS-Office365-Filtering-Correlation-Id: 3081f6d9-06eb-4764-846c-08dc0c2bd705 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XGjCJDIpxI4TgVvkX/EB8+CMg3o3GeiPSwG6yGz1VTE0Z0vVav7gcv8xJFjpJ+WF+HWXhuXohpYZf3CKNGZhMpTHRgvl6ZtOVXnd2sn8h8lNGWfcxNGI/pgmg2vf5BCfOuKNwE7Yw/yDyvCVLevP8nyW7YmplEBpuhL0aqe5D01TkcGDTvX9LXntSz7Qc0xwAs2SzJTREoTpP6GPgLPX0XiydJYbNHjwdWiG39obJG/WfAy2H4tcEt5nx1++b7piN9txt9odrG8WQvEBb5rB+P4Buw+j41+m15bf7NJhndE4AhfJ6x6LQz0AGWaqxt6LJ9/EmH2no5diNkj//+e0kOdcyRFtQpV4HLrGNdrZ0fwgGQyZDyKYFWktoh6Xr7wrnub1lxzpH1aiTaDtc8SPtEB4JHsDQSVktp/HkVqunvdkOAhVond9VGS8z/w5U3idQwIg3KkIzWMIZM80U688Xbbxet0NJPaNxIIup5Thb7ZH/My+SP1VdC7ZoSoW03bsBUo1Gvq8Z9HQnowKduYARw6N0o8VkD4BUA+EW98P/Z+lK0Yrq1m7iMWKk9XbEsMZ 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:(13230031)(366004)(346002)(396003)(136003)(39860400002)(376002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(38100700002)(36756003)(86362001)(107886003)(1076003)(2616005)(6506007)(6512007)(6666004)(4326008)(478600001)(6486002)(8936002)(8676002)(316002)(66476007)(66556008)(66946007)(6916009)(41300700001)(2906002)(44832011)(4744005)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oTWsdXaen8YU7RbRS9aJBoVRkZ6AdOrZ5CJpfIXTdcaHtySQB7CxWRFoPpeEajVZIbrAUznWgPvpnXMFETh95HUFVjTi8mq3yHpCKD/zr2AKkgELhR+VjxGd6dIpMP/wIEOTn+kRUIfC5SlAd+dNc8JeiVYC3mqdySAvbgoEgnApI90uacOTJ0RVKSbCkCcmWAPdagpEi6zNddBRRYIN5iaCldvhYVvrWgMUTo6qMIMtnUPBCHefKOPE4hO0tnKNYijc3p7o3+w2DTYIJNWtELdZan6pvBFDsnxHP1zIbsmMjDXqYrgHHOBExEh/h5g4TBi81vF2aHnDuM2BC308jWoT+kXlWjNiMcz1O6ysHohzBWy7lvk48bx765yQtc3LUsaRM5R9aa1maASGytB9xBiYSqaO9e+H+zpGADl1H2EsNtJceB57u2cvjTeEuvth2R4aqW5S8Hfr/uPrwVaUe7+oB5zwpSwTBvyfEydJENIyV70Fb44UDin7Dh7KEXr6J+s0deX/Gh1wdNWEd2lAGvUCh2oErEs5YNDrJTaVUjAah+tOwpuAkY+Vh+uRFs0K2tTBxSEbEnmIP7hI7lqhncZFxRd+CS5JY1EA5VhFgVCxJcd+qKKDPWS5TVfmM+BEaiBpUqDk0qE7ECiPvoY2+Tof7DbzZIbPhjcTfa/3+QOt6jSLqLpdhEuy3tVvqLN/e3GXJZY6xmMbIyD+dFWIr9LAWPsnWc+DXDBmbuBsQGh9ayy/MQZfC7sXMx8z+RKku7jHxnXhb9R0zMHA97BCuhwHHdEDiH7jt6H05He9UQ461qjOrSxZMAuu2YJREuOvSrFXTQDGnS7mVvR8iWgit+sS1bxb4XkEBE+ug7Ytqm3NAYqtAwzZ8OhHtweeiuKga/csb/EyWR44VII0kC5pynDICyA6BXDGZxBADjBdGd4Sc3bzLlnYzlcOAZ88neRgq0mGZwvpnFQTyqMd9t+WAji80qd1Oo1TJljEM6Msx4iQr2u71udSASxXadbzhySb2OCJLxClzTiQtHovACMmYhokhAN44tje1G8YacoBJhkqGW0/q3BSpS7uSzmFzGEUbS0yGhAPINTjl2I0xkl6fvRx5AdIiEP5imJIuimM9EfuVoLCMNpvSei5H15SvPNGkckQVJk3BB9jacbkwe62I+3hF1IsFkOtpFIijwK9ooAeG8kScWnZC7RsaPiZ0aY8+kuFhQCsDoUKvhEiN6fZssgjoNfDm8lYu2KnYBOL/TC+6N/nXlMfgUz+a+XaqK0mcktrxiCNPrLDuQc1wVYsyS0s1qiARg+nBbZS4I2EdX6imCb7wxMcN10A2BRnoHR+BhOGy5clB7bpjdK/tNCq2KAn1zc+BYz2KrUrE7BgWyrcTJu7zfbwaiEYAR3yeBnL/oPWovdGLme40Ze+0QxpnAOfIdJmNds3aksA3DGcGX4ZEsTHSIKRams72dP/qlSozhF1Wj/T4TyT9bZYURrEhIk3JcsrBdl/d+KFQBtnlmAiW6546Rl5LuM7q7mxq0DpOzA3Zpw+31OJlnLkuvGtttT7ggRsIBid+GyqQs5JkgZ1UAaB+M9UkvVrVjyBU5QHuR2zOlGoy6LWspJIOH5FY4vKrYezNwEGM8qRinKxjKM= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: eNj9qh+FaFgEyiPZ+2nr+wPSGAcjzhMZ+r4DLbIA6PFpuon6iSEaod8tnWOZYbL29Nf8vUy2IVLkWlVxz6vdrfyK4eUlDr9e/xbCIku58aFWBgtYki+aDnxNgE8YkQZnxKw/Psw/QhgKfWhl+6xOxsr4iQ/3GUv634dCf2xoBrCrPMzqXAKNrRG5ky8BReqNW2jepyGJonF6jPE+cwVOogDvTEl6xjcU3NJcx0cRl4neixBElTwLHp0g5Jgsih77kv8UEEnVy771btkc0lRJiQ9t+vUF/Df+jNCO4LC9tvlpGRTHoOT4nnR1Te1P2P8Sb9Of4loHS8WyoTXfX2jBuVBy9apSIlOTa8AdbfFCxUBlSNlpiJdB5KXRDseHjIv/7l3O5HFhsKeQa1g1fyBitltA+AVFuOCm1PQWtNmc3C+i1RpdugxGD0bSRS9uMwm2RfIA/VOx9tuBckTi1J7ik222fiMT2jJvYiY+rreFarrIoq4u8/0XyzSXtlEr42bIPSq4m1BddoI7NscvbWAHafrhXnWwtxMgswySDUzVT29EnTHd7EEHj/r8DytfL/F5wyZpORD8BlLQMVVtSQdl3aFhF/LXkocN0T1aJJDQokM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3081f6d9-06eb-4764-846c-08dc0c2bd705 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2024 07:16:01.1217 (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: pV5fQzBwDp0Ch4q6rwj90k4qL86GcAhaJUHdjYjPyumRrkhbH+VQ+7dCK7JL4WJ40xOh8l6biABjJKAYsFwFWQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB6777 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-03_02,2024-01-02_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 bulkscore=0 phishscore=0 suspectscore=0 spamscore=0 adultscore=0 mlxlogscore=950 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401030059 X-Proofpoint-GUID: qI5HiriHH96vM4OPe3KDTEAV_sfFq_Pn X-Proofpoint-ORIG-GUID: qI5HiriHH96vM4OPe3KDTEAV_sfFq_Pn 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.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+patchwork=sourceware.org@sourceware.org [No changes since V2] --- gas/NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gas/NEWS b/gas/NEWS index cf0020c75ae..e69ecfe049e 100644 --- a/gas/NEWS +++ b/gas/NEWS @@ -1,4 +1,6 @@ -*- text -*- +* New command line option --scfi[=all,none] to synthesize CFI for hand-written + asm. * Initial support for Intel APX: 32 GPRs, NDD, PUSH2/POP2 and PUSHP/POPP.