From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 036C0384AB53 for ; Thu, 11 Apr 2024 07:44:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 036C0384AB53 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine 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 036C0384AB53 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=1712821481; cv=pass; b=kuXnLaXx4ASoODOT6nQXwLWV18wVavXBy/BZGGACOuAWhGMZmG3X4a1ihjN9HqySNpXpkLT1xTzZctSBzHourJqhCUVCWI949dXjRIgTqYpKA30ww63HK01yW3licObyc5yStEhHCK1A9gJvoeyiyppsBAnVTtzmRFUaKCPcliQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1712821481; c=relaxed/simple; bh=TUt6or1JjPrORD/7zodcGkNkm6qtn3M+riJ4/5unAco=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=MNW5R8HOXzKuaot7rOt34SkWBDwCjnVHEUyJjTwP/WaQ4Hk1D9jUjDkLQs6D3U5AGtdaV5PgiR9Ul3h74FOiVKd6gVUmTeNV4FeNyPsZZqyP1IkcrcRj6LrHkLesi8XmLpMYEkeI2x7ngoEq16r/tVrbFUhfSjxNi79FCNoBRlg= 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 43B7ThNS007635 for ; Thu, 11 Apr 2024 07:44:34 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=mMf4jmYdaJGoNqPXPa4JmGkceyrSuU+Le3K0MUKLUQk=; b=QkXG7saeMYLTokifRshp+6jKFqtiYjow7wdH7hl4PrFG81ZhNyQcKjfeSZ6ZjGpdVlSR +ICExKB9L4RuVFeRcq0kx2nk1OMJHOuxE+19SG2W5pFrJzL6l+IsMs3QIPMeeb6b+z0O u9eDaOCrFJ5EAy96A+pdiVmHh+iW922DpG8sXNmR4hdyjfwAfVzgJVwJZO/d8N396q4I Yq1oJrzU7jfj3uCgv+lTK3/wQOpBy941/5BmwGKhckEX01t3U+U7oDBd0aRJHaOoPrVE G7epGRqQs7RIGyAP0OoRa2LW24gPBvu9P34fhGZ+rId4+MdB7hq1piT5SYcrSNrxO5JE Rg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xaw6491m6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 11 Apr 2024 07:44:33 +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 43B5MIJ8032343 for ; Thu, 11 Apr 2024 07:44:33 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3xavu9sxct-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 11 Apr 2024 07:44:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OV4SyXT7COBzd1h9KwDYv3PR3iIqG2mJ3igLFlw6Pl92g9FyKpPcqrlPaA9xJsOEcOrHySlBhnBBbbRtLGyMTKJrkHAEZKQvppAO47WuP+gk63w3lYXu/fEkq3YhnJFGubHLxdhBfJUo0ZjWaMXfElTZaiQcvY6gw93g3rD4hXrUVcB6jFHJCvzXwOhuaMbm8NLTTSAQPDOfidOzVj9BQ0aqAbVAsL8ZWpgX/0fbfHeQvuto4ijvN0FZ0px2xelOXT/gUV7SyqfF9mwWbEkhwNMWx/NZs+m4hIab7dyss97439Q3XUUnZuLRw8EMUJpIeX2arxpEfTL2iMIbSMAtpg== 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=mMf4jmYdaJGoNqPXPa4JmGkceyrSuU+Le3K0MUKLUQk=; b=BIxrb1aaRLwY2j8Xt68Zei937erm72JpGTMfHcuVzmZjKO2RMX9ZIMZtVOMbgQjK3+HcbECAFpbkVtVdwm9LYtnD1rdb/GYLMwLAnEERJ6Fmr6+Z1ili/akkioCh87oCuNl6Q4KbNUQQqqf42WH9i+s+HIDVYRup2gZZdlmzHO8Kgb51/GBV2nyLYiK+1UldmA/IOSaKodeUgd7D16EXP99HYS/w8xi1+CqatTopYx1HkK7Nbvdd9OMSv0YurOTcJC296ZqkLX5LMVvOxBGKDQgQHN0dl5TquGPR6C2uZfHCMV0LwmuCtiIM8x7/EBRqdv/Pt1A0fnWZN1TUl+nhVg== 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=mMf4jmYdaJGoNqPXPa4JmGkceyrSuU+Le3K0MUKLUQk=; b=RwRi8Nhdsnl3IsgSRM+CD/YtyA2i+qkVNs3g1R6Mkw6UBspyd8f6WUpk1n6oq2wLmgFaJNhlKqilmNTi3P4woIyVWD+wQ5I5RpM3KA//Y+LiO8qxmXa1ftRey8kH2J4SRGSyngYbTvNLCiyVuGYPMfmcMoGuubDKFmSNQWmFMWk= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by IA0PR10MB6723.namprd10.prod.outlook.com (2603:10b6:208:43f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Thu, 11 Apr 2024 07:44:30 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::6ae9:dd4d:17bc:4f2]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::6ae9:dd4d:17bc:4f2%7]) with mapi id 15.20.7409.053; Thu, 11 Apr 2024 07:44:30 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH 2/2] gas: aarch64: testsuite: add new tests for SCFI Date: Thu, 11 Apr 2024 00:44:07 -0700 Message-ID: <20240411074407.1429624-3-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240411074407.1429624-1-indu.bhagat@oracle.com> References: <20240411074407.1429624-1-indu.bhagat@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MW4PR03CA0195.namprd03.prod.outlook.com (2603:10b6:303:b8::20) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|IA0PR10MB6723:EE_ X-MS-Office365-Filtering-Correlation-Id: c80982dc-93f8-4f0e-c8c2-08dc59fb386b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KU1+wo67oj20zCulJcQTT490vJLrl5XolMlKVGpl1Myb1837U7xy+wTI+HmHx3bTSZ7xuM2HQY3CeFpskuyv1THzl6fdn5gSrGj3JsO0m/B29U+aIR9dDUC6NgU1PTPj8EOmEMxwgOqRdIF3fhVWcB+du2zU2xadyM1RyaML4/Pa12JAPxx201FVIKGVnJxiqe7izX9fLFip1m2o9Z+Ualu+bkQhugdw4qUsvF/sQfUs1F5dqTSIx6GOF9bHVjnmyzjN0q2hREtnDXQINwZUm4U2XVLU/dbcryrwCs8og7RltEJjyKcJJZKm/OtGdriS5rvUDTPWk6HD0jPh/qQnZxZmeC+HVRwoNYhDrXyMeYXc8iuyjtZpH1ClKW6ASII8Nie1iOVygyHloqkgoGQlVredOLsQv9HCnsyx7HZrwsGQn0ak/yRKAu1WQNUX2JubwzTIaOlUHUOdYduRYz556ppTF6vLvhd8vg8BXsK81ipA8g7xQwSPSw2pVDTHqw9rV5lpG8rk8SjuJMkcNXCA6DgJ8boWOLpgEhZK8eYM8ACF1ziBUclq/mSscDITELMkUlpqKe5Tbj2Cpetf8sI1OuLi8s+a1MudbU6qSYN8fgQYidNW9mRYmZtcbDNuwHsB7vpo6GVdBNlep7ovPjaSMxkWlo5KkPsDI7eBOa7RHzI= 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)(366007)(1800799015)(376005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?0VZQ3TIl2jRsCcI9d7dw8lcQamvCE+q8TN8Xhij9xrTB8anxY7Duc0fLpzmf?= =?us-ascii?Q?mz2b0MMT7Vu7Km9h6oF8iGiTSin3dfkvAR1CgSRkR68BmU0rBCIZVQlrHJPJ?= =?us-ascii?Q?NuVCwnQ9CbHszpEvFeTSsWPYpOUtfCrFfR/xabQFF1GeituFO8qIU9XGiC17?= =?us-ascii?Q?Zbi4976GLDwvWJOWdBbykILzHTWtDtjFsZczi8RMkJB6I8OcU7oR1LGcfQeQ?= =?us-ascii?Q?rcP/1dihue+yI7xIM4nHEUOR1DlAdEeEkbKLPmPBjdafPPkKNNt+cqVFPxte?= =?us-ascii?Q?0zSCteuK6GOU4mdFsxPRuVVg1MpB/nPy4cTqjiIPZozwRHwtsFwh90q9fr4h?= =?us-ascii?Q?e8//IwxSVPNCWADdU/heT9mn+tsiCRUHdK0CbgEwWEf7A9mtP13wD9I8JEYM?= =?us-ascii?Q?GLGHJSxn+vUmODnDOoyxCoLx75fx9C13ZWNesRYj2L94sNaT7agsPJdqOCJl?= =?us-ascii?Q?EIaKLbMY7U4ysajpa9OI6fO/B9QSY3+YlgTLRsCi/UVh9PmPorC8J0lKMLsk?= =?us-ascii?Q?DiWMRwsdgve9p5mE9Zn1LRcRshPlbkPhVmGZ3Er+MrpoaMBVJhTQffdlpU9e?= =?us-ascii?Q?0XEBWnINtc9gEJunPv28qMMQyH3jjnVpCdkc5xXbW0cZVeQdqYCtwmMvcypQ?= =?us-ascii?Q?4kk91eWaWJo0sI9HuCORFtobWbjXWaqvCa856oYOQlcdkRqTRSKsIeBQDOtD?= =?us-ascii?Q?lZgI7BhJXaCM0/mjTp6Tgw1dLYlCscq0PVsqdz43Y9Q5D8+Q8pmmkF+xfRkM?= =?us-ascii?Q?NdmUvqw1fcbdydFGoaUqPE9IqFpUt/s6E5GnReno6m+pHvkAsEh1TWnwZ2L6?= =?us-ascii?Q?nwIL6CoqWPQsuRtxIRAJ8pV0XJDzVFNLbmpOJXiOxdUQbjyU1G7ExqqGf6jU?= =?us-ascii?Q?LYG2+5F7q/tQOcyboYd03M4siphCFbBZVMUaSQwSvpcUe5y9185G8JJDHxM7?= =?us-ascii?Q?dm/l9c2uz0cNGcVm8FGkP0G5KMVdzj5QvUBFoQKPRZmLvvlZbkVgxIamuZux?= =?us-ascii?Q?BjNfoqfulEl/ZZr5+RzLLG/aPny7NQsUa54ukv5ipJRvdc+V3udoslDDCVuM?= =?us-ascii?Q?ud4vNHJK9e3uJW6zz9AFxbrjTUjchvBszzDpRgQpISHSGTNsA4t3OhIl+FRi?= =?us-ascii?Q?WOufDcAbpTWlD+kObqtbCojzJpMdhK67uc6fPa2ZB3mg7DpRmJGCP0TePTYx?= =?us-ascii?Q?UGfQAm5DKHH6J+wb9/5vJWFYjGgsgktK6DIy6dZA+jEh6xsWr6tH13sL0kxy?= =?us-ascii?Q?d6q+CjP8XqnIki5A7/JYTICuSATU8JQHnw3aI0YIznBDwwAxCoqI9y0y+foN?= =?us-ascii?Q?njJjEWZIZnl0PeF+f0izLvEyp62UfqkrhRloA3WmDFg2ANGHu+Ee6/nr1W3E?= =?us-ascii?Q?2V1uJ2xjXGdKb3R9BzLCb4qPMZY+mFkCFj7ANNGMFIr+WDCXd+NsiWmx4FM8?= =?us-ascii?Q?O+YUfjEnS3SC0PH+NdKSVpYcfTT8YGrBL5y2gcWtSrmbuTT2YS4MEa4UHT6r?= =?us-ascii?Q?9cSiy4NGbzp11wAxPk4+xOL755C0+dqGQO9JQHU33kG75Nk6jSS/wwXfGFBN?= =?us-ascii?Q?91Pjx/yJF4y0kZiQt0+M9T+oNu9cBRWyPSYbvEtLgQq0w8NE98b9CGt3D0VI?= =?us-ascii?Q?UdWmun31ss4pyggOE4DGryI=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: tWvZVSP7EW0drBxyLz3fN3hMrOSDy5IXBBiiYckJpPWq5WI31gHd/H8i4sSY7gpUvuMO8WNXgivkqWRKEWY89wU4QweAtqhnnj4jpgMCsi2di9moabqPLlJv1V3TaTj+wxguHV88EP5TYafMY8dZF4Khvkri2snRqEmnwywOegY+CQcH27UrX8dOgJPFKBw2rayaIEEzlMHC3kNMy+gVguuHYjoIu7eRwtizCyYCpEOZpg2acA3yWCSbwTi64TbFh8+0wRlpVyoLAGkI7W3/Q55RUyG4mekjZZLcPYpTZot+OsnzzetukTYk5rBT8JlGXQYTdfVInLF74Tlops1UKpLNSIk8Hcvnv8eXZpUECCPsIz7wQE0Dn2Po9sSsfD0V2FNoqhedt4yUSQyanv0lJDBxi0Pul/4jF7yiFqpiybbfJsqyVgyKigHuxkyg4pQVaaJhft56Jjj5oF6Zefq2/tSHCPkl7pfO8+cYdqMdLHNlj/PYgRLnsrPWP+rWncqFpjQ0J1dYWXC/Grq0Cj3YfwAPCzZiSLDft2HnbHXqgIbzRRAyrPL91mUQey6LEJ6qDYJ4qCQWD1akUuGrmzPQnUrUaA3WveEfUSgHxINzvJ0= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c80982dc-93f8-4f0e-c8c2-08dc59fb386b X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2024 07:44:29.9883 (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: /ugqX2Zx6PnSpJbShtx/W/sUSuvYMUMqW18lkgzI6nQepr6zvxXiJCM4z489hbWYQyEQuzoHev6U5I0EXOa/pQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR10MB6723 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-11_02,2024-04-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404110054 X-Proofpoint-GUID: OD5hKRfqxjW36ICms1tugZAXnl4b2mOH X-Proofpoint-ORIG-GUID: OD5hKRfqxjW36ICms1tugZAXnl4b2mOH X-Spam-Status: No, score=-12.0 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_H4,RCVD_IN_MSPIKE_WL,SCC_10_SHORT_WORD_LINES,SCC_5_SHORT_WORD_LINES,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Similar to the x86_64 testcases, some .s files contain the corresponding CFI directives. This helps in validating the synthesized CFI by running those tests with and without the --scfi=experimental command line option. GAS issues some diagnostics, enabled by default, with --scfi=experimental. The diagnostics have been added with an intent to help user correct inadvertent errors in their hand-written asm. An error is issued when GAS finds that input asm is not amenable to accurate CFI synthesis. The existing scfi-diag-*.s tests in the gas/testsuite/gas/scfi/x86_64 directory test some SCFI diagnostics already: - (#1) "Warning: SCFI: Asymetrical register restore" - (#2) "Error: SCFI: usage of REG_FP as scratch not supported" - (#3) "Error: SCFI: unsupported stack manipulation pattern" - (#4) "Error: untraceable control flow for func 'XXX'" In the newly added aarch64 testsuite, further tests for additional diagnostics have been added: - scfi-diag-1.s in this patch highlights an aarch64-specific diagnostic: (#5) "Warning: SCFI: ignored probable save/restore op with reg offset" Additionally, some testcases are added to showcase the (currently) unsupported patterns, e.g., scfi-unsupported-1.s mov x16, 4384 sub sp, sp, x16 gas/testsuite/: * gas/scfi/README: Update comment to include aarch64. * gas/scfi/aarch64/scfi-aarch64.exp: New file. * gas/scfi/aarch64/ginsn-cofi-1.l: New test. * gas/scfi/aarch64/ginsn-cofi-1.s: New test. * gas/scfi/aarch64/ginsn-ldst-1.l: New test. * gas/scfi/aarch64/ginsn-ldst-1.s: New test. * gas/scfi/aarch64/scfi-cb-1.d: New test. * gas/scfi/aarch64/scfi-cb-1.l: New test. * gas/scfi/aarch64/scfi-cb-1.s: New test. * gas/scfi/aarch64/scfi-cfg-1.d: New test. * gas/scfi/aarch64/scfi-cfg-1.l: New test. * gas/scfi/aarch64/scfi-cfg-1.s: New test. * gas/scfi/aarch64/scfi-cfg-2.d: New test. * gas/scfi/aarch64/scfi-cfg-2.l: New test. * gas/scfi/aarch64/scfi-cfg-2.s: New test. * gas/scfi/aarch64/scfi-cfg-3.d: New test. * gas/scfi/aarch64/scfi-cfg-3.l: New test. * gas/scfi/aarch64/scfi-cfg-3.s: New test. * gas/scfi/aarch64/scfi-cond-br-1.d: New test. * gas/scfi/aarch64/scfi-cond-br-1.l: New test. * gas/scfi/aarch64/scfi-cond-br-1.s: New test. * gas/scfi/aarch64/scfi-diag-1.l: New test. * gas/scfi/aarch64/scfi-diag-1.s: New test. * gas/scfi/aarch64/scfi-diag-2.l: New test. * gas/scfi/aarch64/scfi-diag-2.s: New test. * gas/scfi/aarch64/scfi-ldrp-1.d: New test. * gas/scfi/aarch64/scfi-ldrp-1.l: New test. * gas/scfi/aarch64/scfi-ldrp-1.s: New test. * gas/scfi/aarch64/scfi-ldrp-2.d: New test. * gas/scfi/aarch64/scfi-ldrp-2.l: New test. * gas/scfi/aarch64/scfi-ldrp-2.s: New test. * gas/scfi/aarch64/scfi-strp-1.d: New test. * gas/scfi/aarch64/scfi-strp-1.l: New test. * gas/scfi/aarch64/scfi-strp-1.s: New test. * gas/scfi/aarch64/scfi-strp-2.d: New test. * gas/scfi/aarch64/scfi-strp-2.l: New test. * gas/scfi/aarch64/scfi-strp-2.s: New test. --- gas/testsuite/gas/scfi/README | 2 +- gas/testsuite/gas/scfi/aarch64/ginsn-cofi-1.l | 30 ++++++++++ gas/testsuite/gas/scfi/aarch64/ginsn-cofi-1.s | 16 +++++ gas/testsuite/gas/scfi/aarch64/ginsn-ldst-1.l | 40 +++++++++++++ gas/testsuite/gas/scfi/aarch64/ginsn-ldst-1.s | 21 +++++++ gas/testsuite/gas/scfi/aarch64/ginsn-misc-1.l | 32 ++++++++++ gas/testsuite/gas/scfi/aarch64/ginsn-misc-1.s | 15 +++++ .../gas/scfi/aarch64/scfi-aarch64.exp | 60 +++++++++++++++++++ gas/testsuite/gas/scfi/aarch64/scfi-cb-1.d | 20 +++++++ gas/testsuite/gas/scfi/aarch64/scfi-cb-1.l | 2 + gas/testsuite/gas/scfi/aarch64/scfi-cb-1.s | 14 +++++ gas/testsuite/gas/scfi/aarch64/scfi-cfg-1.d | 31 ++++++++++ gas/testsuite/gas/scfi/aarch64/scfi-cfg-1.l | 2 + gas/testsuite/gas/scfi/aarch64/scfi-cfg-1.s | 46 ++++++++++++++ gas/testsuite/gas/scfi/aarch64/scfi-cfg-2.d | 40 +++++++++++++ gas/testsuite/gas/scfi/aarch64/scfi-cfg-2.l | 2 + gas/testsuite/gas/scfi/aarch64/scfi-cfg-2.s | 42 +++++++++++++ gas/testsuite/gas/scfi/aarch64/scfi-cfg-3.d | 32 ++++++++++ gas/testsuite/gas/scfi/aarch64/scfi-cfg-3.l | 2 + gas/testsuite/gas/scfi/aarch64/scfi-cfg-3.s | 34 +++++++++++ .../gas/scfi/aarch64/scfi-cond-br-1.d | 20 +++++++ .../gas/scfi/aarch64/scfi-cond-br-1.l | 2 + .../gas/scfi/aarch64/scfi-cond-br-1.s | 13 ++++ gas/testsuite/gas/scfi/aarch64/scfi-diag-1.l | 2 + gas/testsuite/gas/scfi/aarch64/scfi-diag-1.s | 6 ++ gas/testsuite/gas/scfi/aarch64/scfi-diag-2.l | 3 + gas/testsuite/gas/scfi/aarch64/scfi-diag-2.s | 25 ++++++++ gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.d | 59 ++++++++++++++++++ gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.l | 2 + gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.s | 52 ++++++++++++++++ gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.d | 33 ++++++++++ gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.l | 2 + gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.s | 26 ++++++++ gas/testsuite/gas/scfi/aarch64/scfi-strp-1.d | 39 ++++++++++++ gas/testsuite/gas/scfi/aarch64/scfi-strp-1.l | 2 + gas/testsuite/gas/scfi/aarch64/scfi-strp-1.s | 37 ++++++++++++ gas/testsuite/gas/scfi/aarch64/scfi-strp-2.d | 35 +++++++++++ gas/testsuite/gas/scfi/aarch64/scfi-strp-2.l | 2 + gas/testsuite/gas/scfi/aarch64/scfi-strp-2.s | 30 ++++++++++ .../gas/scfi/aarch64/scfi-unsupported-1.l | 4 ++ .../gas/scfi/aarch64/scfi-unsupported-1.s | 31 ++++++++++ 41 files changed, 907 insertions(+), 1 deletion(-) create mode 100644 gas/testsuite/gas/scfi/aarch64/ginsn-cofi-1.l create mode 100644 gas/testsuite/gas/scfi/aarch64/ginsn-cofi-1.s create mode 100644 gas/testsuite/gas/scfi/aarch64/ginsn-ldst-1.l create mode 100644 gas/testsuite/gas/scfi/aarch64/ginsn-ldst-1.s create mode 100644 gas/testsuite/gas/scfi/aarch64/ginsn-misc-1.l create mode 100644 gas/testsuite/gas/scfi/aarch64/ginsn-misc-1.s create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-aarch64.exp create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-cb-1.d create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-cb-1.l create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-cb-1.s create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-cfg-1.d create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-cfg-1.l create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-cfg-1.s create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-cfg-2.d create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-cfg-2.l create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-cfg-2.s create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-cfg-3.d create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-cfg-3.l create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-cfg-3.s create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.d create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.l create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.s create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-diag-1.l create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-diag-1.s create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-diag-2.l create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-diag-2.s create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.d create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.l create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.s create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.d create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.l create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.s create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-strp-1.d create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-strp-1.l create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-strp-1.s create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-strp-2.d create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-strp-2.l create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-strp-2.s create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-unsupported-1.l create mode 100644 gas/testsuite/gas/scfi/aarch64/scfi-unsupported-1.s diff --git a/gas/testsuite/gas/scfi/README b/gas/testsuite/gas/scfi/README index 91191634769..44b09177e84 100644 --- a/gas/testsuite/gas/scfi/README +++ b/gas/testsuite/gas/scfi/README @@ -1,6 +1,6 @@ Notes on the SCFI testsuite in GAS: -* At this time, SCFI machinery is only supported for x86_64. +* At this time, SCFI machinery is only supported for x86_64 and aarch64. * When adding more tests, please keep CFI annotations updated in the .s files. Ideally the test should be run with and without --scfi (as is done currently diff --git a/gas/testsuite/gas/scfi/aarch64/ginsn-cofi-1.l b/gas/testsuite/gas/scfi/aarch64/ginsn-cofi-1.l new file mode 100644 index 00000000000..d05e19d059d --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/ginsn-cofi-1.l @@ -0,0 +1,30 @@ +.*: Assembler messages: +.*:16: Error: untraceable control flow for func 'foo' + +AARCH64 GAS .* + + 1 # Testcase for a variety of change of flow instructions + 2 # Because some of these are indirect branches, SCFI will bail out + 3 # with an error. This test merely checks that the ginsn creation + 4 # process can handle these insns gracefully. + 5 .text + 6 .align 2 + 7 .global foo + 8 .type foo, %function + 8 ginsn: SYM FUNC_BEGIN + 9 foo: + 9 ginsn: SYM foo + 10 \?\?\?\? 00000094 bl dump_bt + 10 ginsn: CALL + 11 \?\?\?\? 02000014 b .L3 + 11 ginsn: JMP + 12 \?\?\?\? 20021FD6 br x17 + 12 ginsn: JMP %r17, + 13 .L3: + 13 ginsn: SYM .L3 + 14 \?\?\?\? 60003FD6 blr x3 + 14 ginsn: CALL + 15 \?\?\?\? C0035FD6 ret + 15 ginsn: RET + 16 .size foo, .-foo + 16 ginsn: SYM FUNC_END diff --git a/gas/testsuite/gas/scfi/aarch64/ginsn-cofi-1.s b/gas/testsuite/gas/scfi/aarch64/ginsn-cofi-1.s new file mode 100644 index 00000000000..bbcbe4e02a4 --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/ginsn-cofi-1.s @@ -0,0 +1,16 @@ +# Testcase for a variety of change of flow instructions +# Because some of these are indirect branches, SCFI will bail out +# with an error. This test merely checks that the ginsn creation +# process can handle these insns gracefully. + .text + .align 2 + .global foo + .type foo, %function +foo: + bl dump_bt + b .L3 + br x17 +.L3: + blr x3 + ret + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/aarch64/ginsn-ldst-1.l b/gas/testsuite/gas/scfi/aarch64/ginsn-ldst-1.l new file mode 100644 index 00000000000..56c03e5436a --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/ginsn-ldst-1.l @@ -0,0 +1,40 @@ +AARCH64 GAS .* + + 1 # Testcase for a variety of ld st instructions + 2 .text + 3 .align 2 + 4 .global foo + 5 .type foo, %function + 5 ginsn: SYM FUNC_BEGIN + 6 foo: + 6 ginsn: SYM foo + 7 # ldstpair_indexed + 8 0000 FFFF8629 stp wzr, wzr, \[sp, 52\]! + 8 ginsn: ADD %r31, 52, %r31 + 8 ginsn: STORE %r1, \[%r31\+0\] + 8 ginsn: STORE %r1, \[%r31\+4\] + 9 0004 E00782A9 stp x0, x1, \[sp, 32\]! + 9 ginsn: ADD %r31, 32, %r31 + 9 ginsn: STORE %r0, \[%r31\+0\] + 9 ginsn: STORE %r1, \[%r31\+8\] + 10 0008 E827BC6D stp d8, d9, \[sp, -64\]! + 10 ginsn: ADD %r31, -64, %r31 + 11 # Following is skipped from ginsn generation + 12 000c E00702AD stp q0, q1, \[sp, 64\] + 13 # ldstpair_off + 14 0010 FFFF0629 stp wzr, wzr, \[sp, 52\] + 14 ginsn: STORE %r1, \[%r31\+52\] + 14 ginsn: STORE %r1, \[%r31\+56\] + 15 0014 1F7840AD ldp q31, q30, \[x0\] + 16 0018 E827C46C ldp d8, d9, \[sp\], 64 + 16 ginsn: ADD %r31, 64, %r31 + 17 # ldst_imm9 + 18 001c E7FF4F38 ldrb w7, \[sp, 255\]! + 18 ginsn: ADD %r31, 255, %r31 + 18 ginsn: LOAD \[%r31\+0\], %r7 + 19 0020 FDCFC23C ldr q29, \[sp, 44\]! + 19 ginsn: ADD %r31, 44, %r31 + 20 0024 C0035FD6 ret + 20 ginsn: RET + 21 .size foo, .-foo + 21 ginsn: SYM FUNC_END diff --git a/gas/testsuite/gas/scfi/aarch64/ginsn-ldst-1.s b/gas/testsuite/gas/scfi/aarch64/ginsn-ldst-1.s new file mode 100644 index 00000000000..99813608dbc --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/ginsn-ldst-1.s @@ -0,0 +1,21 @@ +# Testcase for a variety of ld st instructions + .text + .align 2 + .global foo + .type foo, %function +foo: +# ldstpair_indexed + stp wzr, wzr, [sp, 52]! + stp x0, x1, [sp, 32]! + stp d8, d9, [sp, -64]! +# Following is skipped from ginsn generation + stp q0, q1, [sp, 64] +# ldstpair_off + stp wzr, wzr, [sp, 52] + ldp q31, q30, [x0] + ldp d8, d9, [sp], 64 +# ldst_imm9 + ldrb w7, [sp, 255]! + ldr q29, [sp, 44]! + ret + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/aarch64/ginsn-misc-1.l b/gas/testsuite/gas/scfi/aarch64/ginsn-misc-1.l new file mode 100644 index 00000000000..3eec1b753df --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/ginsn-misc-1.l @@ -0,0 +1,32 @@ +.*: Assembler messages: +.*:9: Error: SCFI: unsupported stack manipulation pattern +.*:15: Error: SCFI: forward pass failed for func 'foo' + +AARCH64 GAS .* + + + 1 # Testcase for a variety of misc instructions + 2 # Ensure graceful handling, irrespective of ginsn generation + 3 symbol: + 4 \?\?\?\? 7700 .string "w" + 5 + 6 .type foo, %function + 6 ginsn: SYM FUNC_BEGIN + 7 foo: + 7 ginsn: SYM foo + 8 \?\?\?\? 00001024 mov x16, 4384 + 8 82D2 + 8 ginsn: MOV 4384, %r16 + 9 \?\?\?\? FF63308B add sp, sp, x16 + 9 ginsn: ADD %r31, %r16, %r31 + 10 \?\?\?\? 00000090 adrp x0, symbol + 11 \?\?\?\? 1F000091 add sp, x0, :lo12:symbol + 11 ginsn: OTH 0, 0, %r31 + 12 \?\?\?\? FF0F00D1 sub sp, sp, 3 + 12 ginsn: SUB %r31, 3, %r31 + 13 \?\?\?\? FF0F0091 add sp, sp, 3 + 13 ginsn: ADD %r31, 3, %r31 + 14 \?\?\?\? C0035FD6 ret + 14 ginsn: RET + 15 .size foo,.-foo + 15 ginsn: SYM FUNC_END diff --git a/gas/testsuite/gas/scfi/aarch64/ginsn-misc-1.s b/gas/testsuite/gas/scfi/aarch64/ginsn-misc-1.s new file mode 100644 index 00000000000..2e454ddf5e0 --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/ginsn-misc-1.s @@ -0,0 +1,15 @@ +# Testcase for a variety of misc instructions +# Ensure graceful handling, irrespective of ginsn generation +symbol: + .string "w" + + .type foo, %function +foo: + mov x16, 4384 + add sp, sp, x16 + adrp x0, symbol + add sp, x0, :lo12:symbol + sub sp, sp, 3 + add sp, sp, 3 + ret + .size foo,.-foo diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-aarch64.exp b/gas/testsuite/gas/scfi/aarch64/scfi-aarch64.exp new file mode 100644 index 00000000000..64bf44fef82 --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-aarch64.exp @@ -0,0 +1,60 @@ +# 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 "aarch64-*-*"]) } then { + + global ASFLAGS + set old_ASFLAGS "$ASFLAGS" + + run_list_test "ginsn-cofi-1" "--scfi=experimental -ali --warn" + run_list_test "ginsn-ldst-1" "--scfi=experimental -ali --warn" + run_list_test "ginsn-misc-1" "--scfi=experimental -ali --warn" + + run_list_test "scfi-diag-1" "--scfi=experimental" + run_list_test "scfi-diag-2" "--scfi=experimental" + + run_list_test "scfi-unsupported-1" "--scfi=experimental" + + run_dump_test "scfi-ldrp-1" + run_list_test "scfi-ldrp-1" "--scfi=experimental --warn" + run_dump_test "scfi-ldrp-2" + run_list_test "scfi-ldrp-2" "--scfi=experimental --warn" + + run_dump_test "scfi-strp-1" + run_list_test "scfi-strp-1" "--scfi=experimental --warn" + run_dump_test "scfi-strp-2" + run_list_test "scfi-strp-2" "--scfi=experimental --warn" + + run_dump_test "scfi-cb-1" + run_list_test "scfi-cb-1" "--scfi=experimental --warn" + run_dump_test "scfi-cond-br-1" + run_list_test "scfi-cond-br-1" "--scfi=experimental --warn" + + run_dump_test "scfi-cfg-1" + run_list_test "scfi-cfg-1" "--scfi=experimental --warn" + + run_dump_test "scfi-cfg-2" + run_list_test "scfi-cfg-2" "--scfi=experimental --warn" + + run_dump_test "scfi-cfg-3" + run_list_test "scfi-cfg-3" "--scfi=experimental --warn" + +} diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-cb-1.d b/gas/testsuite/gas/scfi/aarch64/scfi-cb-1.d new file mode 100644 index 00000000000..87583c58b3f --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-cb-1.d @@ -0,0 +1,20 @@ +#as: --scfi=experimental -W +#objdump: -Wf +#name: Synthesize CFI for comp branch 1 +#... +Contents of the .eh_frame section: + + +0+0000 0+0010 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 4 + Data alignment factor: -8 + Return address column: 30 + Augmentation data: 1b + DW_CFA_def_cfa: r31 \(sp\) ofs 0 + +0+0014 0+0010 00000018 FDE cie=00000000 pc=0+0000..0+0014 + DW_CFA_nop + +#pass diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-cb-1.l b/gas/testsuite/gas/scfi/aarch64/scfi-cb-1.l new file mode 100644 index 00000000000..abca835a642 --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-cb-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*5: Warning: SCFI ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-cb-1.s b/gas/testsuite/gas/scfi/aarch64/scfi-cb-1.s new file mode 100644 index 00000000000..1fa7de7639a --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-cb-1.s @@ -0,0 +1,14 @@ + .text + .global foo + .type foo, %function +foo: + .cfi_startproc +.L7: + add w4, w3, w1 + cbnz w4, .L7 + cbz w4, .L10 + tbnz w0, #31, .L7 +.L10: + ret + .cfi_endproc + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-cfg-1.d b/gas/testsuite/gas/scfi/aarch64/scfi-cfg-1.d new file mode 100644 index 00000000000..9dca6efaad7 --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-cfg-1.d @@ -0,0 +1,31 @@ +#as: --scfi=experimental -W +#objdump: -Wf +#name: Synthesize CFI for cfg 1 +#... +Contents of the .eh_frame section: + + +0+0000 0+0010 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 4 + Data alignment factor: -8 + Return address column: 30 + Augmentation data: 1b + DW_CFA_def_cfa: r31 \(sp\) ofs 0 + +0+0014 0+0020 0+0018 FDE cie=00000000 pc=0+0000..0+0068 + DW_CFA_advance_loc: 4 to 0+0004 + DW_CFA_def_cfa_offset: 48 + DW_CFA_offset: r29 \(x29\) at cfa-48 + DW_CFA_offset: r30 \(x30\) at cfa-40 + DW_CFA_advance_loc: 4 to 0+0008 + DW_CFA_def_cfa_register: r29 \(x29\) + DW_CFA_advance_loc: 92 to 0+0064 + DW_CFA_def_cfa_register: r31 \(sp\) + DW_CFA_restore: r29 \(x29\) + DW_CFA_restore: r30 \(x30\) + DW_CFA_def_cfa_offset: 0 + DW_CFA_nop + +#pass diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-cfg-1.l b/gas/testsuite/gas/scfi/aarch64/scfi-cfg-1.l new file mode 100644 index 00000000000..bcf3095a9bb --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-cfg-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*6: Warning: SCFI ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-cfg-1.s b/gas/testsuite/gas/scfi/aarch64/scfi-cfg-1.s new file mode 100644 index 00000000000..6925a8f7e38 --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-cfg-1.s @@ -0,0 +1,46 @@ +# Testcase for forward flow of SCFI information +# and CFG creation as well. This testcase has two backward edges +# (one of which is a loop) and one exit path. + .type foo, %function +foo: + .cfi_startproc + stp x29, x30, [sp, -48]! + .cfi_def_cfa_offset 48 + .cfi_offset 29, -48 + .cfi_offset 30, -40 + mov x29, sp + .cfi_def_cfa_register 29 + str x0, [sp, 24] + adrp x0, :got:xyz + str x0, [sp, 40] + b .L7 +.L10: + ldr x0, [sp, 40] + ldr x0, [x0] + mov x1, x0 + ldr x0, [sp, 24] + bl strcmp + cmp w0, 0 + bne .L8 + ldr x0, [sp, 40] + ldr w0, [x0, 8] + b .L9 +.L8: + ldr x0, [sp, 40] + add x0, x0, 24 + str x0, [sp, 40] +.L7: + ldr x0, [sp, 40] + ldr w0, [x0, 8] + cmp w0, 0 + bne .L10 + mov w0, 0 +.L9: + ldp x29, x30, [sp], 48 + .cfi_def_cfa_register 31 + .cfi_restore 30 + .cfi_restore 29 + .cfi_def_cfa_offset 0 + ret + .cfi_endproc + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-cfg-2.d b/gas/testsuite/gas/scfi/aarch64/scfi-cfg-2.d new file mode 100644 index 00000000000..af21fc14b4c --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-cfg-2.d @@ -0,0 +1,40 @@ +#as: --scfi=experimental -W +#objdump: -Wf +#name: Synthesize CFI for cfg 2 +#... +Contents of the .eh_frame section: + + +0+0000 0+0010 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 4 + Data alignment factor: -8 + Return address column: 30 + Augmentation data: 1b + DW_CFA_def_cfa: r31 \(sp\) ofs 0 + +0+0014 0+[0-9a-f]+ 0+0018 FDE cie=00000000 pc=0+0000..0+0028 + DW_CFA_advance_loc: 4 to 0+0004 + DW_CFA_def_cfa_offset: 48 + DW_CFA_offset: r29 \(x29\) at cfa-48 + DW_CFA_offset: r30 \(x30\) at cfa-40 + DW_CFA_advance_loc: 4 to 0+0008 + DW_CFA_def_cfa_register: r29 \(x29\) + DW_CFA_advance_loc: 8 to 0+0010 + DW_CFA_remember_state + DW_CFA_advance_loc: 8 to 0+0018 + DW_CFA_def_cfa_register: r31 \(sp\) + DW_CFA_restore: r29 \(x29\) + DW_CFA_restore: r30 \(x30\) + DW_CFA_def_cfa_offset: 0 + DW_CFA_advance_loc: 4 to 0+001c + DW_CFA_restore_state + DW_CFA_advance_loc: 8 to 0+0024 + DW_CFA_def_cfa_register: r31 \(sp\) + DW_CFA_restore: r29 \(x29\) + DW_CFA_restore: r30 \(x30\) + DW_CFA_def_cfa_offset: 0 + DW_CFA_nop + +#pass diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-cfg-2.l b/gas/testsuite/gas/scfi/aarch64/scfi-cfg-2.l new file mode 100644 index 00000000000..e9bde339b1e --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-cfg-2.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*13: Warning: SCFI ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-cfg-2.s b/gas/testsuite/gas/scfi/aarch64/scfi-cfg-2.s new file mode 100644 index 00000000000..eef82b4ad24 --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-cfg-2.s @@ -0,0 +1,42 @@ +# Testcase for backward flow of SCFI state. +# The cfg has two exit paths, with epilogue duplicated in +# the two. +# +# SCFI must synthesize the remember_state / restore_state pair. +# Note how SCFI does not necessary generate the least number of +# CFI directives (.cfi_remember_state can possibly be clubbed +# together with other immediately following CFI directives). +# This is not a correctness issue, however. + .global foo + .type foo, %function +foo: + .cfi_startproc + stp x29, x30, [sp, -48]! + .cfi_def_cfa_offset 48 + .cfi_offset 29, -48 + .cfi_offset 30, -40 + mov x29, sp + .cfi_def_cfa_register 29 + cmp w4, w19 + bge .L1 + +.L2: + .cfi_remember_state + bl bar + ldp x29, x30, [sp], 48 + .cfi_def_cfa_register 31 + .cfi_restore 29 + .cfi_restore 30 + .cfi_def_cfa_offset 0 + ret +.L1: + .cfi_restore_state + cbz w3, .L2 + ldp x29, x30, [sp], 48 + .cfi_def_cfa_register 31 + .cfi_restore 29 + .cfi_restore 30 + .cfi_def_cfa_offset 0 + ret + .cfi_endproc + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-cfg-3.d b/gas/testsuite/gas/scfi/aarch64/scfi-cfg-3.d new file mode 100644 index 00000000000..4d17ee4a475 --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-cfg-3.d @@ -0,0 +1,32 @@ +#as: --scfi=experimental -W +#objdump: -Wf +#name: Synthesize CFI for cfg 3 +#... +Contents of the .eh_frame section: + + +0+0000 0+0010 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 4 + Data alignment factor: -8 + Return address column: 30 + Augmentation data: 1b + DW_CFA_def_cfa: r31 \(sp\) ofs 0 + +0+0014 0+0020 0+0018 FDE cie=00000000 pc=0+0000..0+002c + DW_CFA_advance_loc: 4 to 0+0004 + DW_CFA_def_cfa_offset: 32 + DW_CFA_offset: r29 \(x29\) at cfa-32 + DW_CFA_offset: r30 \(x30\) at cfa-24 + DW_CFA_advance_loc: 4 to 0+0008 + DW_CFA_def_cfa_register: r29 \(x29\) + DW_CFA_advance_loc: 32 to 0+0028 + DW_CFA_def_cfa_register: r31 \(sp\) + DW_CFA_restore: r29 \(x29\) + DW_CFA_restore: r30 \(x30\) + DW_CFA_def_cfa_offset: 0 + DW_CFA_nop + DW_CFA_nop + +#pass diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-cfg-3.l b/gas/testsuite/gas/scfi/aarch64/scfi-cfg-3.l new file mode 100644 index 00000000000..23ca73422b5 --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-cfg-3.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*9: Warning: SCFI ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-cfg-3.s b/gas/testsuite/gas/scfi/aarch64/scfi-cfg-3.s new file mode 100644 index 00000000000..2782e11f6d3 --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-cfg-3.s @@ -0,0 +1,34 @@ +# Testcase for cfg creation. +# There is at least one bb here with a single GINSN_TYPE_SYMBOL instruction +# for a user-defined label. This ginsn is visited in the fallthrough path of +# another bb. + .text + .global main + .type main, %function +main: + .cfi_startproc + stp x29, x30, [sp, -32]! + .cfi_def_cfa_offset 32 + .cfi_offset 29, -32 + .cfi_offset 30, -24 + mov x29, sp + .cfi_def_cfa_register 29 + cmp w0, 0 + bne .L2 +# ldr x0, [sp, 24] +# bl fclose + cmp w0, 0 + beq .L3 +.L2: + mov w0, 1 + b .L5 +.L3: + mov w0, 0 +.L5: + ldp x29, x30, [sp], 32 + .cfi_def_cfa_register 31 + .cfi_restore 29 + .cfi_restore 30 + .cfi_def_cfa_offset 0 + ret + .cfi_endproc diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.d b/gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.d new file mode 100644 index 00000000000..dc656c78038 --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.d @@ -0,0 +1,20 @@ +#as: --scfi=experimental -W +#objdump: -Wf +#name: Synthesize CFI for conditional br 1 +#... +Contents of the .eh_frame section: + + +0+0000 0+0010 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 4 + Data alignment factor: -8 + Return address column: 30 + Augmentation data: 1b + DW_CFA_def_cfa: r31 \(sp\) ofs 0 + +0+0014 0+0010 00000018 FDE cie=00000000 pc=0+0000..0+0010 + DW_CFA_nop + +#pass diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.l b/gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.l new file mode 100644 index 00000000000..bcf3095a9bb --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*6: Warning: SCFI ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.s b/gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.s new file mode 100644 index 00000000000..03c330df04a --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-cond-br-1.s @@ -0,0 +1,13 @@ + .text + .align 2 + .global foo + .type foo, %function +foo: + .cfi_startproc + bge .L10 + ble .L10 + bne .L10 +.L10: + ret + .cfi_endproc + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-diag-1.l b/gas/testsuite/gas/scfi/aarch64/scfi-diag-1.l new file mode 100644 index 00000000000..5a8e36923a7 --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-diag-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*5: Warning: SCFI: ignored probable save/restore op with reg offset diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-diag-1.s b/gas/testsuite/gas/scfi/aarch64/scfi-diag-1.s new file mode 100644 index 00000000000..a6eac51998e --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-diag-1.s @@ -0,0 +1,6 @@ + .text + .globl foo + .type foo, @function +foo: + str x19, [sp, x1] + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-diag-2.l b/gas/testsuite/gas/scfi/aarch64/scfi-diag-2.l new file mode 100644 index 00000000000..03a5f4fb908 --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-diag-2.l @@ -0,0 +1,3 @@ +.*Assembler messages: +.*7: Warning: SCFI ignores most user-specified CFI directives +.*16: Warning: GINSN: found unreachable code in func 'foo' diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-diag-2.s b/gas/testsuite/gas/scfi/aarch64/scfi-diag-2.s new file mode 100644 index 00000000000..7464fa9efee --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-diag-2.s @@ -0,0 +1,25 @@ +# Testcase that triggers a diagnostic for unreachable code for +# the block of code after label .L2. This also serves as a testcase +# for cfg creation, as the said code block should not have been +# included in the CFG (and hence the warning). + .type foo, %function +foo: + .cfi_startproc + ldr w1, [x0] + cmp w1, 8 + stp x19, x20, [sp, 16] + .cfi_offset 19, 16 + .cfi_offset 20, 24 + b .L1 +.L2: + mov w0, w1 + ret +.L1: + mov w0, w1 + ldp x19, x20, [sp, 16] + .cfi_restore 19 + .cfi_restore 20 + .cfi_def_cfa_offset 0 + ret + .cfi_endproc + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.d b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.d new file mode 100644 index 00000000000..ce8fab5813a --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.d @@ -0,0 +1,59 @@ +#as: --scfi=experimental -W +#objdump: -Wf +#name: Synthesize CFI for ldp ldr instructions +#... +Contents of the .eh_frame section: + +00000000 0+0010 00000000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 4 + Data alignment factor: -8 + Return address column: 30 + Augmentation data: 1b + DW_CFA_def_cfa: r31 \(sp\) ofs 0 + +00000014 0+0048 00000018 FDE cie=00000000 pc=0+0000..0+0040 + DW_CFA_advance_loc: 4 to 0+0004 + DW_CFA_def_cfa_offset: 128 + DW_CFA_offset: r29 \(x29\) at cfa-128 + DW_CFA_offset: r30 \(x30\) at cfa-120 + DW_CFA_advance_loc: 4 to 0+0008 + DW_CFA_def_cfa_register: r29 \(x29\) + DW_CFA_advance_loc: 4 to 0+000c + DW_CFA_offset: r19 \(x19\) at cfa-112 + DW_CFA_offset: r20 \(x20\) at cfa-104 + DW_CFA_advance_loc: 4 to 0+0010 + DW_CFA_offset: r21 \(x21\) at cfa-96 + DW_CFA_offset: r22 \(x22\) at cfa-88 + DW_CFA_advance_loc: 4 to 0+0014 + DW_CFA_offset: r23 \(x23\) at cfa-80 + DW_CFA_offset: r24 \(x24\) at cfa-72 + DW_CFA_advance_loc: 4 to 0+0018 + DW_CFA_offset: r25 \(x25\) at cfa-64 + DW_CFA_offset: r26 \(x26\) at cfa-56 + DW_CFA_advance_loc: 4 to 0+001c + DW_CFA_offset: r27 \(x27\) at cfa-48 + DW_CFA_advance_loc: 8 to 0+0024 + DW_CFA_def_cfa_register: r31 \(sp\) + DW_CFA_advance_loc: 4 to 0+0028 + DW_CFA_restore: r19 \(x19\) + DW_CFA_restore: r20 \(x20\) + DW_CFA_advance_loc: 4 to 0+002c + DW_CFA_restore: r21 \(x21\) + DW_CFA_restore: r22 \(x22\) + DW_CFA_advance_loc: 4 to 0+0030 + DW_CFA_restore: r23 \(x23\) + DW_CFA_restore: r24 \(x24\) + DW_CFA_advance_loc: 4 to 0+0034 + DW_CFA_restore: r25 \(x25\) + DW_CFA_restore: r26 \(x26\) + DW_CFA_advance_loc: 4 to 0+0038 + DW_CFA_restore: r27 \(x27\) + DW_CFA_advance_loc: 4 to 0+003c + DW_CFA_restore: r29 \(x29\) + DW_CFA_restore: r30 \(x30\) + DW_CFA_def_cfa_offset: 0 + DW_CFA_nop + +#pass diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.l b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.l new file mode 100644 index 00000000000..5ff6048bef0 --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*8: Warning: SCFI ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.s b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.s new file mode 100644 index 00000000000..4226d71b3b3 --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-1.s @@ -0,0 +1,52 @@ +# Testcase for various ldp / ldr instructions. +# This test also serves for checking callee-saved regs. + .text + .align 2 + .global foo + .type foo, %function +foo: + .cfi_startproc + stp x29, x30, [sp, -128]! + .cfi_def_cfa_offset 128 + .cfi_offset 29, -128 + .cfi_offset 30, -120 + mov x29, sp + .cfi_def_cfa_register 29 + stp x19, x20, [sp, 16] + .cfi_offset 19, -112 + .cfi_offset 20, -104 + stp x21, x22, [sp, 32] + .cfi_offset 21, -96 + .cfi_offset 22, -88 + stp x23, x24, [sp, 48] + .cfi_offset 23, -80 + .cfi_offset 24, -72 + stp x25, x26, [sp, 64] + .cfi_offset 25, -64 + .cfi_offset 26, -56 + str x27, [sp, 80] + .cfi_offset 27, -48 + mov w0, 0 + mov sp, x29 + .cfi_def_cfa_register 31 + ldp x19, x20, [sp, 16] + .cfi_restore 19 + .cfi_restore 20 + ldp x21, x22, [sp, 32] + .cfi_restore 21 + .cfi_restore 22 + ldp x23, x24, [sp, 48] + .cfi_restore 23 + .cfi_restore 24 + ldp x25, x26, [sp, 64] + .cfi_restore 25 + .cfi_restore 26 + ldr x27, [sp, 80] + .cfi_restore 27 + ldp x29, x30, [sp], 128 + .cfi_restore 29 + .cfi_restore 30 + .cfi_def_cfa_offset 0 + ret + .cfi_endproc + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.d b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.d new file mode 100644 index 00000000000..2a0fdb60e0e --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.d @@ -0,0 +1,33 @@ +#as: --scfi=experimental -W +#objdump: -Wf +#name: Synthesize CFI for ldr insns 2 +#... +Contents of the .eh_frame section: + +00000000 0+0010 00000000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 4 + Data alignment factor: -8 + Return address column: 30 + Augmentation data: 1b + DW_CFA_def_cfa: r31 \(sp\) ofs 0 + +00000014 0+[0-9a-f]+ 00000018 FDE cie=00000000 pc=0+0000..0+0018 + DW_CFA_advance_loc: 4 to 0+0004 + DW_CFA_def_cfa_offset: 128 + DW_CFA_offset: r29 \(x29\) at cfa-128 + DW_CFA_offset: r30 \(x30\) at cfa-120 + DW_CFA_advance_loc: 4 to 0+0008 + DW_CFA_def_cfa_register: r29 \(x29\) + DW_CFA_advance_loc: 4 to 0+000c + DW_CFA_def_cfa_register: r31 \(sp\) + DW_CFA_advance_loc: 4 to 0+0010 + DW_CFA_restore: r29 \(x29\) + DW_CFA_def_cfa_offset: 120 + DW_CFA_advance_loc: 4 to 0+0014 + DW_CFA_restore: r30 \(x30\) + DW_CFA_def_cfa_offset: 0 + DW_CFA_nop + +#pass diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.l b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.l new file mode 100644 index 00000000000..6ec24387b8c --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*7: Warning: SCFI ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.s b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.s new file mode 100644 index 00000000000..ac4ad6836ed --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-ldrp-2.s @@ -0,0 +1,26 @@ +# Testcase for various ldp / ldr instructions + .text + .align 2 + .global foo + .type foo, %function +foo: + .cfi_startproc + stp x29, x30, [sp, -128]! + .cfi_def_cfa_offset 128 + .cfi_offset 29, -128 + .cfi_offset 30, -120 + mov x29, sp + .cfi_def_cfa_register 29 + mov sp, x29 + .cfi_def_cfa_register 31 +# Post-indexed ldr + ldr x29, [sp], 8 + .cfi_restore 29 + .cfi_def_cfa_offset 120 +# Post-indexed ldr + ldr x30, [sp], 120 + .cfi_restore 30 + .cfi_def_cfa_offset 0 + ret + .cfi_endproc + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-strp-1.d b/gas/testsuite/gas/scfi/aarch64/scfi-strp-1.d new file mode 100644 index 00000000000..cebd254aa00 --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-strp-1.d @@ -0,0 +1,39 @@ +#as: --scfi=experimental -W +#objdump: -Wf +#name: Synthesize CFI for str stp insns 1 +#... +Contents of the .eh_frame section: + +00000000 0+0010 00000000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 4 + Data alignment factor: -8 + Return address column: 30 + Augmentation data: 1b + DW_CFA_def_cfa: r31 \(sp\) ofs 0 + +00000014 0+0030 00000018 FDE cie=00000000 pc=0+0000..0+002c + DW_CFA_advance_loc: 4 to 0+0004 + DW_CFA_def_cfa_offset: 128 + DW_CFA_offset: r29 \(x29\) at cfa-128 + DW_CFA_offset: r30 \(x30\) at cfa-120 + DW_CFA_advance_loc: 4 to 0+0008 + DW_CFA_def_cfa_register: r29 \(x29\) + DW_CFA_advance_loc: 4 to 0+000c + DW_CFA_offset: r19 \(x19\) at cfa-112 + DW_CFA_offset: r20 \(x20\) at cfa-104 + DW_CFA_advance_loc: 4 to 0+0010 + DW_CFA_offset: r21 \(x21\) at cfa-96 + DW_CFA_offset: r22 \(x22\) at cfa-88 + DW_CFA_advance_loc: 4 to 0+0014 + DW_CFA_offset: r23 \(x23\) at cfa-80 + DW_CFA_offset: r24 \(x24\) at cfa-72 + DW_CFA_advance_loc: 4 to 0+0018 + DW_CFA_offset: r25 \(x25\) at cfa-64 + DW_CFA_offset: r26 \(x26\) at cfa-56 + DW_CFA_advance_loc: 4 to 0+001c + DW_CFA_offset: r27 \(x27\) at cfa-48 + DW_CFA_nop + +#pass diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-strp-1.l b/gas/testsuite/gas/scfi/aarch64/scfi-strp-1.l new file mode 100644 index 00000000000..bcf3095a9bb --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-strp-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*6: Warning: SCFI ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-strp-1.s b/gas/testsuite/gas/scfi/aarch64/scfi-strp-1.s new file mode 100644 index 00000000000..932ca4ad705 --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-strp-1.s @@ -0,0 +1,37 @@ +## Testcase with a variety of str/stp instructions + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc +# Pre-indexed addressing is like offset addressing, except that +# the base pointer is updated as a result of the instruction. + stp x29, x30, [sp, -128]! + .cfi_def_cfa_offset 128 + .cfi_offset 29, -128 + .cfi_offset 30, -120 + mov x29, sp + .cfi_def_cfa_register 29 +# Offset addressing mode is when ann offset can be applied optionally to the +# base address. + stp x19, x20, [sp, 16] + .cfi_offset 19, -112 + .cfi_offset 20, -104 + stp x21, x22, [sp, 32] + .cfi_offset 21, -96 + .cfi_offset 22, -88 + stp x23, x24, [sp, 48] + .cfi_offset 23, -80 + .cfi_offset 24, -72 + stp x25, x26, [sp, 64] + .cfi_offset 25, -64 + .cfi_offset 26, -56 + str x27, [sp, 80] + .cfi_offset 27, -48 +# Stores non callee-saved register on stack. + str w0, [x29, 124] + str wzr, [x29, 120] + str w0, [x29, 120] + ret + .cfi_endproc + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-strp-2.d b/gas/testsuite/gas/scfi/aarch64/scfi-strp-2.d new file mode 100644 index 00000000000..d69ba0dfa5a --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-strp-2.d @@ -0,0 +1,35 @@ +#as: --scfi=experimental -W +#objdump: -Wf +#name: Synthesize CFI for str insns 2 +#... +Contents of the .eh_frame section: + +00000000 0+0010 00000000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 4 + Data alignment factor: -8 + Return address column: 30 + Augmentation data: 1b + DW_CFA_def_cfa: r31 \(sp\) ofs 0 + +00000014 0+0028 00000018 FDE cie=00000000 pc=0+0000..0+001c + DW_CFA_advance_loc: 4 to 0+0004 + DW_CFA_def_cfa_offset: 128 + DW_CFA_offset: r29 \(x29\) at cfa-128 + DW_CFA_offset: r30 \(x30\) at cfa-120 + DW_CFA_advance_loc: 4 to 0+0008 + DW_CFA_def_cfa_register: r29 \(x29\) + DW_CFA_advance_loc: 4 to 0+000c + DW_CFA_offset: r27 \(x27\) at cfa-128 + DW_CFA_advance_loc: 4 to 0+0010 + DW_CFA_def_cfa_register: r31 \(sp\) + DW_CFA_advance_loc: 4 to 0+0014 + DW_CFA_restore: r29 \(x29\) + DW_CFA_def_cfa_offset: 120 + DW_CFA_advance_loc: 4 to 0+0018 + DW_CFA_restore: r30 \(x30\) + DW_CFA_def_cfa_offset: 0 + DW_CFA_nop + +#pass diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-strp-2.l b/gas/testsuite/gas/scfi/aarch64/scfi-strp-2.l new file mode 100644 index 00000000000..6ec24387b8c --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-strp-2.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*7: Warning: SCFI ignores most user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-strp-2.s b/gas/testsuite/gas/scfi/aarch64/scfi-strp-2.s new file mode 100644 index 00000000000..1792697dffa --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-strp-2.s @@ -0,0 +1,30 @@ +# Testcase for a variety of stp/str including a post-indexed store + .text + .align 2 + .global foo + .type foo, %function +foo: + .cfi_startproc + stp x29, x30, [sp, -128]! + .cfi_def_cfa_offset 128 + .cfi_offset 29, -128 + .cfi_offset 30, -120 + mov x29, sp + .cfi_def_cfa_register 29 +# post-indexed store, a stack corrupting one which over-writes +# x29! Only for testing purposes for now +# This does not generate a .cfi_def_cfa_offset 208 because +# CFA is REG_FP based + str x27, [sp], 80 + .cfi_offset 27, -128 + mov sp, x29 + .cfi_def_cfa_register 31 + ldr x29, [sp], 8 + .cfi_restore 29 + .cfi_def_cfa_offset 120 + ldr x30, [sp], 120 + .cfi_restore 30 + .cfi_def_cfa_offset 0 + ret + .cfi_endproc + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-unsupported-1.l b/gas/testsuite/gas/scfi/aarch64/scfi-unsupported-1.l new file mode 100644 index 00000000000..de3ed86250b --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-unsupported-1.l @@ -0,0 +1,4 @@ +.*Assembler messages: +.*7: Warning: SCFI ignores most user-specified CFI directives +.*9: Error: SCFI: unsupported stack manipulation pattern +.*31: Error: SCFI: forward pass failed for func 'foo' diff --git a/gas/testsuite/gas/scfi/aarch64/scfi-unsupported-1.s b/gas/testsuite/gas/scfi/aarch64/scfi-unsupported-1.s new file mode 100644 index 00000000000..296aad890bf --- /dev/null +++ b/gas/testsuite/gas/scfi/aarch64/scfi-unsupported-1.s @@ -0,0 +1,31 @@ +# Testcase where immediate used for stack allocation is a wide +# one. Since SCFI does not currently have any data-flow +# capabilities, this is currently not supported. + .global foo + .type foo, %function +foo: + .cfi_startproc + mov x16, 4384 + sub sp, sp, x16 + .cfi_def_cfa_offset 4384 + stp x29, x30, [sp] + .cfi_offset 29, -4384 + .cfi_offset 30, -4376 + mov x29, sp + str x0, [sp, 24] + str x1, [sp, 16] + add x0, sp, 4096 + add x0, x0, 112 + bl bar +.L1: + str xzr, [sp, 4376] +.L2: + ldp x29, x30, [sp] + mov x16, 4384 + add sp, sp, x16 + .cfi_restore 29 + .cfi_restore 30 + .cfi_def_cfa_offset 0 + ret + .cfi_endproc + .size foo, .-foo -- 2.43.0