From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id DFCD33858D32 for ; Mon, 15 Jan 2024 12:08:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DFCD33858D32 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 DFCD33858D32 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=1705320509; cv=pass; b=xVid4TKGC1ZF/kZGdG8W9jn6aWjzl9SWC/uGhqRSVq8ZZC5if8jMBrAnEbtT8mVDy1ByvfRsPCE5JzEPd1/gVQKEC962MO3yFe0eaN+Tt4o0HtrWjzJQeamuJUydq19ySumMYs2h84eMApFsAp6zLPpRn1wKuBK5f6WzgmVeXPk= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1705320509; c=relaxed/simple; bh=TmUWmEtg7uTD1sIujZP4hB4e4Cabsa8NdAywffSKlcM=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=TSQekS820SQrZnFh8pTzoh7ewbTP8mKqzkZy1wupOJ1YXEP491JcYmpq7C6IdJJvKnzbBdJ49MTYUZkvie2FT6NjolJ2fLxhTJVdp1gk1meKRIo6jDJ8JWSxN/bNAnkzAB+lBKisMlD8iwJDjbwdKgsU6DfTgm0KqxpnlyQ6t3Q= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 40F9EQYI017635 for ; Mon, 15 Jan 2024 12:08:22 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=Opv4Ish4Aai44v/MU1gQkytieuvMt4T1uytEn30wRRE=; b=Rz8cmw0dn3mbzrDHNPFRB3sAlftflDiHCQyS/mTVYOs+IhxGizbyfd8CZBWYLZ1hauR9 BeNIGRjkSnC5DNWBF7vWkmihfnJxYvLeqhJiwSYN1bzh0D0PNThmnFivUCBlQaIb9J0Y raX5S/8EVSB2jyohhHuK1N/AyQCxrfD7r8O/bDWpuriXeJtZ3Q/mwHwYndGfxudchQiP CyFiHEERcr7Ylgt4+SA3cnsuCXeYvWl4CAN9kOKeHdzyBBb99hY4EligWG8AUkIZM9DS 4dJUVwR2qmzQInXMJzd7IxDVHx5ijTdkspCb5pCo0cMVtgcB9dfrNQShjOdR3iijRt9e QQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vkk2u2781-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 15 Jan 2024 12:08:21 +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 40FASbWC023375 for ; Mon, 15 Jan 2024 12:08:20 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3vkgy5x294-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 15 Jan 2024 12:08:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fPbvj4TU/cu91BV+K3fwhZBxNo0Sfa3u2HulXdWeb4YLbcDdSoC+YJNYdhxvRNuICfaOOFUqgMXQeOrBnsphRGsVAWwjhwaYA8w8b8kgVvRr87rVnzbD7aFposTwT4uOufT0x5amchoOBp8ybAyLUL9HGNH1I4KRCWlEznAChXEqWX/AxWrvl0THNjZ1luCVC3oiydZ6dYMJ2njFNNK1/q+SkQFldDubG83ttWZNWgBcZKuwKgz69yYuj8axcjgHx0KVFklDh2VgD+ci+wU5XCBYiSlWIQh1NsX1jpZcNyM0Hv4TeDlgIsoyVwXB9KpaKpb4oAvKvcJmCTaItEggNg== 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=Opv4Ish4Aai44v/MU1gQkytieuvMt4T1uytEn30wRRE=; b=laLYxUn43tVQRhgcNDT4Ro1pQRu88fPYCkLI5MhtD9CZP4ealWbNeziw4I65R8xvyj5bTKtr8Bd+Y0R6EsmidXuZL5MyFR8UpHdasllOQQglHnPO8Jw8MvfhhZNMc+I7Z8Bw2ObG6+zijyKoY5ivGdRs887uzrFHpW6S6cFUrS1jC7zZv3rWKf63w7G2WXVVDt51rOh9kvZnDAHD+iAyidJX+fEPWHkeA/UYkFQV6kL8VzGanSYZt45oUm21BkZzCpj7oiF8RhjirsZnRioxu1nialeUlkU3I0RkcOcBX0cf7Bdi5OSRHL1eB4vdK7qdLRZfUO6l+ciENyLpR5M1Yw== 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=Opv4Ish4Aai44v/MU1gQkytieuvMt4T1uytEn30wRRE=; b=H7p8DfcdYIB2g8s37QJmLTblQjvJgYK+RfCUKLHVvRkMGwQ05kMbb/lL06CkCNBfviCrTyKj/ddNBPzzZtWDTTDxTsqkHUK71cNweIQPE58Q/20IS6OUIKscKA9OXPWZQctUxwB2QQa2OZA2kUX2kKakW926lQ4Ih3ZWLgmPOqk= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by SA3PR10MB7094.namprd10.prod.outlook.com (2603:10b6:806:31b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.23; Mon, 15 Jan 2024 12:08:17 +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.7181.026; Mon, 15 Jan 2024 12:08:17 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [COMMITTED 08/15] gas: scfidw2gen: new functionality to prepare for SCFI Date: Mon, 15 Jan 2024 04:07:22 -0800 Message-ID: <20240115120729.29771-9-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240115120729.29771-1-indu.bhagat@oracle.com> References: <20240115120729.29771-1-indu.bhagat@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MW4PR04CA0316.namprd04.prod.outlook.com (2603:10b6:303:82::21) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|SA3PR10MB7094:EE_ X-MS-Office365-Filtering-Correlation-Id: e0521a71-8d72-42af-081f-08dc15c2a828 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cI6rtfPDd03WJmofqpDsdbvDBoUU8IL3U9Q0L+eEjfrLYT0NLVaf3m8hW7HQuXOIdUiHlN/8LY/5eGT0at1CK8aIBC0gp4e5qEkvYPrNKAfFRg4OVLbjJFf2dnQJ1oLt+9GoMkjK2rVscaOKT1SOtkcsBYG2JRVgVEzEhMIyEosooml0XP4uiC5NZ6cV2wMcSLciz/PYATXTeKW3f0/FcYp9g8MkhXogU4snvmIXmaMDJdKnmvp9pGYeyrnqB8B41VTtsrtm5ZqVofLevEJRKuhS2C1DevgTbeuEXRZ/aKJ3vyLeu+z0NJl4+awRrdaXCiWpx7RZMBAY0e2ZSVvu6VtajqhsNs0QJamlgOtXAcICIw/i2Gg4hY2GhhXdbLv2yWFuYO+CWvTHHrQXqsCDm+5NGk7HVE/fujdFUvBFeOM3Bi1qX6Mim5T+crpiY2v5VzcXGVQxcWfWPohynEcprgIy504TBGrmqKY3cwocGEoZ0VtsZAtk9Qgn/cnsMdZ8fkJ/GzKXn/kuR3DKUFkWwFVZ2RR1/VaRlg3M5tP5buTJNXRGLGIXkGbR7gH6km4BSMRpItE3NWnF/dgCnvxTP9nOK1iz5120Qc1SHp/Z5NHXSDrOKRnVOedjBC8TVLoOOInEA96rijncVOUD2jLo+Q== 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)(376002)(366004)(39860400002)(136003)(396003)(346002)(230922051799003)(230173577357003)(230273577357003)(1800799012)(186009)(451199024)(64100799003)(8936002)(5660300002)(44832011)(2906002)(6512007)(38100700002)(316002)(4326008)(8676002)(86362001)(30864003)(66556008)(66476007)(66946007)(6916009)(6506007)(478600001)(6486002)(6666004)(36756003)(1076003)(2616005)(83380400001)(41300700001)(107886003)(2004002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?4FjR1Xb6oD3V0AHhxiLsFo0NMkY4ayKODo/MB6a/R8j6CRkvwY1CRYPPf/Qw?= =?us-ascii?Q?3CeGuRB49jMi9fa593y4e/J/mPCH3xNsmGOfG7tsKixhMaSE8xpRBM5t3v/R?= =?us-ascii?Q?JIzOvYSaWd1rg+IfvtFNsDGf3V7NHMc6UfLUb6+TiRJhK6SV7CDffmx8kj55?= =?us-ascii?Q?HfsahICP3FBBs1XMMdd1DpVeE8bVGmax42Ht7dNRtrFYGXFnFZCMtJVb+br8?= =?us-ascii?Q?l5RqtMWnKb3FZqHWvvxE9LG/fqFdVksSh4EIYDOhpKFVHybUKO8RAEThC821?= =?us-ascii?Q?Wa7a1zbYoFy1lWOaNCvw/KTqMBV7VUs4BoG0MFUkHVmuYSbLriLi3pKmr3uH?= =?us-ascii?Q?sHmg8JwH+dyLXcF0gPRdxQXPWng4gbl62C1uZGovrzibaXbFOYz37iyh4HSY?= =?us-ascii?Q?Q+GZnYh8P8OOcZ58McoxJtzA543bwOEm0NIYhIwBXcqcc0pEMvV2EM8QXfaE?= =?us-ascii?Q?deGtHkk8icBqIMXrJdOay6xQoxZXZls7g1D3XME6lgVQdmXapg7CMOthBgZQ?= =?us-ascii?Q?t8Ud4T1uC38PkbmTh8d9s0VA3tLeMYjaE1zKwEBWOCipviQpcroSPH5bY9Yb?= =?us-ascii?Q?m0N2Ij9hA1hq7WmUGwJ71HBGs1F2pqlKpcj21cUJtIjVAQxFZBYbQ4giokTA?= =?us-ascii?Q?14KqIl2BKDMBTPZqhtpIB0/8Xw13t8errrCooy19a69cVWYsUG6G0KdHtCVg?= =?us-ascii?Q?lvVAATNlATZT3JiJiGN67ZBxKxYixQpdzsFjQDcSgZlCN+S6/xrJ14/QRUaw?= =?us-ascii?Q?D+iECZkTwqeaL2T5Af8+vwP4FwCDbmSjcIorvavSBwbMovsuqohxhJ7BN4Bo?= =?us-ascii?Q?cZAfMASEK1/gvXzbB3XnvRnyx7z9HYOcp5BLFVyXQLrFPHdT0osAsBho+VNz?= =?us-ascii?Q?NcyD8ayuBVG6ggZNksH/SsxzF15RzduUZdob1GmN/C5cMr3DOJYlf3qkTFr0?= =?us-ascii?Q?3DbCi2VznMtzlg7OdY3VBU29kmdG0gzj7R9auJPeZ9FpNBq7dxRL7RzKAlh7?= =?us-ascii?Q?VKn/KVjKZ/F9DePOIMygmq0ge/5KwOdMbvSAw56XAXEWLiaqtuzkMVzkpFnI?= =?us-ascii?Q?sEUjUYs1Sd5gc+msxeNXziYvRIv+LhV1PxUfq/2LrhRJ5keCPe5Mn1wBOXyt?= =?us-ascii?Q?YA+NaDRrNe9z9S+freSTitlQLtFaGZPDhLjzKWWvgyxXTDwFRzVN7vuH7Pj3?= =?us-ascii?Q?sMT4Ix2vw7RnY3wMTxth1/LRvWdk7A6WfSMJL4ZwYYceHNSWcK9cMBmxYjgL?= =?us-ascii?Q?zOFXdSXyVeAm0p1ZzJ1icBrxE7nEjuSRmgea6mH2ocsqc6ba669gpvcXSHXq?= =?us-ascii?Q?YEQ8sk2ILJ81hx8D2xBLK9QW6RqUV6NcV9LybVIm+wea0meSlUmeLZkg7qDQ?= =?us-ascii?Q?DlwNLH9+ebwGA+fpzQmNxLqT2fh/PynW2Fi7R5rykeZpvyWjO6QySaiwDoGP?= =?us-ascii?Q?J5yozcwEN0yO2SlctKYbaIOsy0NhlMvajXE56XIiItsjV/cmiI64qxWx5ZE0?= =?us-ascii?Q?Bf8JjrjxmMR60ReCpJ4PLC38RKt3sjFt5TSkSTndkSUM4fPMuijxn0H+Uvbk?= =?us-ascii?Q?JPLm25SPDqUWL2TCGt54eCWsFJjgczrr+tq4BZODDkckQtywuYsYcjpdsEJr?= =?us-ascii?Q?B75+f0LXf+TOnl+6at0OpeU=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 94jgzRRXWxxPfdk+jaeaa78nEN+J+cT4ZOmVz+kwqFlecIoyAY3j27K0VGdtHzyPz073e5Otol7R/WDGBxnTzQtSqR3DBKxKphG9+gkcVRIOrk6QOMn/ep1D89cMG3p4aiGkoa4vTYkEIOlNuoymY7aP7UhnPEX6sNhuzOdAcD1HqcN22/I1xKbAmgB+mFMS+I3LV9hLadINUAm1qTElwZgFh1xBqaCG4otVfMyrf7eWciNPkgb4sb6+231oEpCaTm9nGFDwA7ict0GTxfrtop42TdP07CjlZBXeJkjL6Gsu19K58X0Rw6mV6DWSdXcwkuUZFBekMnFb4TkxDS8XoBL9GdUq7pt6SRXrXRUSU/KELmjTJmH78s3XzoaQExIYH29BHGjP1ohULZiYVPiegaWdV1T/GcYXJzJJo77meKubiIChmdxqdg++iIMVBLrapumoJScdQNAtzfeVWigmQrdPXQscSCwDcYrNZ9Plfgp5KUyU/iqLd/I9Wzijzh8xGSH/14w/viOmRvDPKH+kOr7iIjWhXWCFb7qjNiPt92N/h5nHxxylxtCsZnzm/oaPaJtRZB2oTdNlCjR93KsJM446EAvtiq+qJmTEL8HhKqI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e0521a71-8d72-42af-081f-08dc15c2a828 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jan 2024 12:08:17.0432 (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: KW2K23hPJcZqoBVUSTU7+GOrXbz0+8ecuGcGA1J9n2YKTD7BKMi4r9cZPgrqz8ymC3NzwHkL0vyY93q21McJPw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR10MB7094 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-15_06,2024-01-15_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 suspectscore=0 phishscore=0 spamscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401150087 X-Proofpoint-ORIG-GUID: vwLUl2lFg6K2ANPJzll1u9QhPUo4QA5Q X-Proofpoint-GUID: vwLUl2lFg6K2ANPJzll1u9QhPUo4QA5Q 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_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: 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 is in effect. A warning ("Warning: SCFI 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 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 77c92d4d8ed..2848fac47b0 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 7aee1e1d460..7d4fbfc055c 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 753c92d2f1a..2aa5ce2facb 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..1b3fb158e20 --- /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 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