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 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> Content-Transfer-Encoding: 8bit Content-Type: text/plain 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: =?us-ascii?Q?8yFBv/gBr91G0ZgZ42dMvWuW5K1LQPw0dXnk63S0KeX93nhgnAw8HAKVukNU?= =?us-ascii?Q?uXgPEe3P4sGdvZvdoW6gZIlzh7xPS8M1NWDqBngvc8O4JJVH7GV/pdt+jrYC?= =?us-ascii?Q?66SKBoghIked2KBqDBNu61Tw7usWJ54hqOu13xNAUpmhewOWr6rT+6aLkkMe?= =?us-ascii?Q?ti4Tex5uCVMk8i9Ofl2iLodHLcFJjg7tLIZa2+rTgNgNcQM5bD5wAWGdtGSW?= =?us-ascii?Q?D0GndOAm0kPGMF4hD9d84mnGQPyaXEh6qjQG2kdhHOyJFBCXzlnVjKP0We4A?= =?us-ascii?Q?kY/PPdhtA9F8Lq9zmLtY4NkuCIMx+/5uQD7NNYfNXbneSa9Ma9MSSUZn0/gO?= =?us-ascii?Q?nfreqxYkU4lvHLbETE4Zzoq3in8pKAw0k39DOPGEk7Um6lmpJsZfToUT8KVl?= =?us-ascii?Q?IJWVTBTzT13nAkPDUb/VzXY1W0pnoyXso+J3+xS1q0LXcbR9bt7Jf4OfGvjj?= =?us-ascii?Q?WT5jpA+EDd2mDJ8kxIep9A6tEpj7Ek9lQeT+K2OZtl70k6j5uIchi9Ck9IyM?= =?us-ascii?Q?syztxMg4fI6AQJWstK61Fqiy1y4x2ex1z8WEyliyF6aMhuLC1wrCE4QNPOKW?= =?us-ascii?Q?43u2zkuR5Hj/5/X8J3fZ/pCrzZx5eJCTRBwAi/Cmx6NLiixJNzBtWAkQn9sk?= =?us-ascii?Q?SEXN+KNNqleQGCKHM7UYt9dhoZdoJ0qyLfKDrUAut7vdhOnhaskeUg9xomim?= =?us-ascii?Q?Pq067bRvNV6waocFOsRogtd8uiVMlwg8Z2ufUshH0xJ5VZbJneQ9MSrCYo+4?= =?us-ascii?Q?sZMz81UbCba7IhRpud1wUGbE+yRiibIoqmAhsyf2Sn71XifS9KPTsHjtBKS5?= =?us-ascii?Q?U69/3vuVKQX79WzhcoW9cqJxr0FhkOGRrXa1mw16AHNVB49kI5AzlEoXJODR?= =?us-ascii?Q?oEnYxf7FO2WnYQqa2kBf5Ihk2jLB+ZZYYX1RO0EjR+vGyJAs4pDZx44aZnPO?= =?us-ascii?Q?SKsaSxRf1C4wKOwGbEyBluZ8XLRJD061FuYy8h/lbziMOs6Lv66yw/8ESQsc?= =?us-ascii?Q?hnBMxGn0cf0uyl0qs4dLPzz7I38nYPoctrUJoQH2hVyMdnJ4K0MJHEgQ4cug?= =?us-ascii?Q?1+HNdTv6tX0cuYQoZ5EyIU0E7r9DQqy8+hDcGLlH5wDcHBfojdwtjv4Y1wVq?= =?us-ascii?Q?iFO6ywCZCe8q8ofUMRHCEaQvHMSZPOymT27UgOkXzOawM3rYLG80Ald4MDV6?= =?us-ascii?Q?isaDCfpYvnQyaHc2mz+j8XorxTsfyZ5DLHiw+xG9tkDYcmA3ahoFDIdA2FYR?= =?us-ascii?Q?fLF4gr811+S0EbMScPTdl1xGpM8KbZfB99WgUsJAOacg8eMgwnn6ptGlSRey?= =?us-ascii?Q?xZH5kteGyuWrnDmgsb03itBUygHTXGyWQ9G90Qy0bdGoQnRtxRDQ7jLrPoVd?= =?us-ascii?Q?jZRQq/oeR8oS5/q3er8YLJJoqjAFREaix6rdb+MNMtGGDAhJhV/mGHV0owHL?= =?us-ascii?Q?jTZhK/nh3ct/a6lTq5tLu8dLMuXmCpdi5BxClJqwDfCl8E+8nyYZXPCvh1lK?= =?us-ascii?Q?UT/+T9ssE4T79Vc303EP7mbKWWIUMkdOZ4uc/GpgsaZQaPM1kJ6ZM9WPjB2j?= =?us-ascii?Q?a6UxMwNSkWwGfsdUbM/AWf/IqT6BPL9N6NIF6Zve3iYdfRg0mVe6bbdZRbHI?= =?us-ascii?Q?WjjTUPUlnhC0HAlRfCjDwRM=3D?= 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 List-Id: [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 + -- 2.41.0