From patchwork Thu Oct 26 19:13:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 158643 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp110746vqb; Thu, 26 Oct 2023 12:14:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGmreGu7Czgu2LKndAOnhmS9vtrnY7ySrapEn6V0fmVqd86IUpde237j6945STh40Tjsh/0 X-Received: by 2002:a05:6214:e61:b0:66d:19d6:2eb5 with SMTP id jz1-20020a0562140e6100b0066d19d62eb5mr542378qvb.7.1698347662873; Thu, 26 Oct 2023 12:14:22 -0700 (PDT) Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id da7-20020a05621408c700b0066d113e536fsi48694qvb.300.2023.10.26.12.14.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 12:14:22 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=fail header.i=@oracle.com header.s=corp-2023-03-30 header.b=Rv3oxgH6; dkim=fail header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Bur7vQ26; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8B5B7385E82B for ; Thu, 26 Oct 2023 19:14:11 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 595C1385DC28 for ; Thu, 26 Oct 2023 19:13:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 595C1385DC28 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 595C1385DC28 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=1698347641; cv=pass; b=aoN/k00QEZXvZ1ZxINwelvAeQl+FhvU21/8lKj8gKQ18UWzzfa7RtENdCqKa089QMn9Y3pfW8WoOjCOXwCYASNC0bjgOjwFdwI+fu3DISGbYIgzODnTx70kJq4SXZGqM29M1iaGAdRJvRuYhLzsdlRVsoTNATDlEz4joSM6U7y4= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1698347641; c=relaxed/simple; bh=QVlvjSl8JootNG2XRpmjPEiz9glgKb3octiwRgWzq3U=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=cip0ipubLJZrjNDyDXzPcif4ssaegYCyaiOSG/g8Cg53nInGTaPfJUIxCWLu35sGURune3K0D59iZe4dFqrPbHCr7qBgY/jPnwWnqtVKRUjWnbEmykP0pGLJu9IVtnvBkRBsuhXrynAyutOTuSK4+CPSc/KQ5ryafeQKvoj0yeg= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39QIuolY029631 for ; Thu, 26 Oct 2023 19:13:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=ktT5dAZP8eIkOeafykSjVDcMajzBiOu5D/S8g9t0S7U=; b=Rv3oxgH6pxXZVshkfLdojh7uHIzCLox0a79HlX44SrFmSrW1KWUXmTGGknnMmwDm08BQ LRxHyG5Z8Cd7CUC3XwxbELgiVhwTmOdAJ9uoFiKXfWae/9XZZcfjf/9e6J1ug/30iwa+ KWt8iYePtCAcVme3jvOVLzkXGN+3tBFnCGES0IYTa+w3i8HJ4KA1AubKHSoMUNDtuAdi 3Q6H2hYX856bMUs1qxdhKSAV8FqVbP4miBXsZLbd4DhinfobFUUxNdT3+waXy9TwcG4i uXzumcS75KVNaCBefe8g/0RP8bw1bZqFZ+ranO1xsbFBMOV5Rz/KqOarG5xJoduhrVdB Kw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3tywuc819x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 26 Oct 2023 19:13:58 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 39QInfZi038788 for ; Thu, 26 Oct 2023 19:13:57 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3tywqs0wkp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 26 Oct 2023 19:13:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WwrSQairPnlJrK6/chr2WK5fxzWnt7Bi2T4er2KuZm2gGyNsZLWK5iPgtHwA9vf9myRTx5EEb9O+u+sMItUzmgggs8uNJBWPTj9THUVxSotwguzNgFI8HC/j4QLRF5oUXTHbiq4Sh66JDFCzVJYCnjbZ4DtDZhdJodpOX1WdscqRSbOkJFJZBgqR4DB1pbhN45FvqoElrid5OXasBjmWpV1zlRuWK7oOEVFmizAOXHolKz3dDIZ0pxJYHeSEon2GhPL0O4FLeGkOSezkLisx8k2F7Z+Ekff4q5NClYotbacP4QBfwu71iR059ZhWFcz/W6hVUlo3e8P0PFPvie1iCQ== 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=ktT5dAZP8eIkOeafykSjVDcMajzBiOu5D/S8g9t0S7U=; b=UgzTmeiuGqnpeabszni9zWAgDh9L003QCdEdoPMcJc5Eidd7kSYcp7iUwAQPly6pTtfIQHjOn4p+FM+ycJ123oe+Q45OTrprGOh6EDwTpWCMaEDRPItmDAupWBFG+OHcMK4+idXth6U3VijuwollnZRxVCtyZX8jUrO+rFRbNtrMBwCNIVSFRaOM0EFNoC8krGH2nNwFb2//mTYfNNOI/j7T+y0siV4EGfev4H8YdFl9ewjFGCaVo9SoXua6JOUgZ5phkpMErxo6dSVQ26DoOiwEaxtzYAPbJV8dfogSndzlbtkFSKZ+hOO4kP6ss/9uTZaToMH+aryt1H2bMglNQQ== 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=ktT5dAZP8eIkOeafykSjVDcMajzBiOu5D/S8g9t0S7U=; b=Bur7vQ26QTsKRzXCTOm6nQ8h940KG7kHB031rm4MpaLm/iqYoyWimiqC2RqhR4YydTrRw+fMREum7yqoOcllF6MMa1wkBQMFX/ElvhvLoHUL1wu7ep+/pMpaGk7Xnn5ix1mZ91K85LVCeadMTPu6YlkL6gCsLgpt9Z+OJTw75iY= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by CYYPR10MB7606.namprd10.prod.outlook.com (2603:10b6:930:c4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Thu, 26 Oct 2023 19:13:55 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::7f02:c28d:9802:20fd]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::7f02:c28d:9802:20fd%3]) with mapi id 15.20.6933.019; Thu, 26 Oct 2023 19:13:55 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH, V1 6/9] gas: scfidw2gen: new functionality to prepapre for SCFI Date: Thu, 26 Oct 2023 12:13:34 -0700 Message-ID: <20231026191337.3872149-7-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231026191337.3872149-1-indu.bhagat@oracle.com> References: <20231026191337.3872149-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4P223CA0024.NAMP223.PROD.OUTLOOK.COM (2603:10b6:303:80::29) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|CYYPR10MB7606:EE_ X-MS-Office365-Filtering-Correlation-Id: 30661501-1cf1-482e-85e3-08dbd657b309 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tlSTiKzL93yT8Plv8CZcImi9pfu50Z+EKOAgnU1Ac+/jQ9yM1SV9qhWLi0T5Gzy1Q22a19yUZYZMALjXITCKJiJDrPrc/LLMmQgdlYlzBmFGT37WB7h78Uo3cKxyUwYQE4in/3PMcUm8ii2bqnnTcCsTKKvjyq4yHsA4hGAV9rPkzrklbtaNmH80pvprZX3yRqrOoiNSrEGgAfVO+MobQUx24EZKqeVfJmEPgZxq8n4/j43JN79NcpBUZqnumv2P8bZ60zvRAcrh9phqdeVmjdPbC/3Lx+gm1BiXHDU8oX/BBH2VkDeZgiPRqDNLdTgx/Cz4SRf0QtXQZTURvO5wyVUEkaubfk8UuWGzvE7sz4wQlxwkY3Sda7Lilmr0r9roF8pemMRx3l0+K7go6r5MY6tvQQo4WnhPemahm8bvLsyxPRyQPO4BNIcPTxox7YT/powphx9NlXXccltwoqVM3+NJy9gfioZX+sEnmNhSnuM3yx2b/nfyjN38PSRytk4a65RMVTFizXrxT85uNPqsZTGrVpeI0EoNsditE4W9kvFpnuOxvfQc/gtLiFKQxtt+dt17YRWhmiZgQTY82QcTeUVmeKGwAOB1QI9ejOfftFsJnN/yE6ZtqOb53XTAjfAUwA3cB+Q4ZY1YLtgbg/77dwpnWOP41OAjbDw5eNI/IxJ3mZshjuZEGJT2gh2AYmw+WVM/z4gnMyV3Yqz1coyoWw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2158.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(39860400002)(366004)(346002)(376002)(136003)(230273577357003)(230173577357003)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(478600001)(6486002)(38100700002)(66476007)(316002)(66556008)(41300700001)(66946007)(1076003)(6512007)(6506007)(2616005)(6666004)(30864003)(107886003)(8676002)(86362001)(4326008)(2906002)(8936002)(44832011)(5660300002)(83380400001)(6916009)(36756003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4hbjGTfldQ731bvbtTDmwvJn92Eyrz297DAygm2j96zNoDFTKrvR0vv62M6+MJQez80az0v3oEOVM1dRBNJa8je8gFWQt8q5qFZJ73hCWhGKoziF4SJCr9AfEggnn4t0HQZ/iK4G8zdQqqjJjCpambe3vmdB9skXpmrs6izTWR5pOlArT1Cjsi1xIDMwzb0liebosUcfqPY4chkwTBhRkfCVKBFm+7Dlet35jA60rG6sFzQKU0ByWQDOuFZeS0dKXKOBWdnH6NyA0FUyZVTikOxvYdZmRJ0G3dK7rtxFHKvrMKq04/4A5ns8ZL/SHkvJo5LVQVcVJnFUUaz+cOQByw41XT8qm6M8PJeMSMOb3G/EKSh6R2kwELTtW4nmAtbv4qTduAtU+mNVIXKSfDMtqfHbKr6qIFmRf5o+87f9esC1wCZ2Q4KdRQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 30661501-1cf1-482e-85e3-08dbd657b309 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2023 19:13:55.8700 (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: YqkqfVWIieFlIWObhBx1k3VpVCkg3UdS01oNt3AMQV+4R+7+2z2dDj4APA/XcEuF9lOozKBy+ZoW2ye/3xtzqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR10MB7606 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-26_18,2023-10-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=999 suspectscore=0 malwarescore=0 adultscore=0 phishscore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310240000 definitions=main-2310260167 X-Proofpoint-ORIG-GUID: ewtkaQvzEXRwL1vRQugxJW2_v185-0z5 X-Proofpoint-GUID: ewtkaQvzEXRwL1vRQugxJW2_v185-0z5 X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780846598969514424 X-GMAIL-MSGID: 1780846598969514424 [Changes from the RFC patch set] - scfidw2gen.c now defines its own set of handlers. For many of those CFI directives, we simply warn ("Warning: --scfi=all ignores some user-specified CFI directives") and return. - The above-mentioned warning is issued only once per file. - The advantage of adding new set of handlers in scfidwgen.c is that dw2gencfi now does not need to add a condition for each handler to simply return if --scfi is in effect (the latter was the approach in the RFC patch set.) [End of changes] 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. The following CFI directives, however, are not ignored: - .cfi_sections (To be handled). - .cfi_label - .cfi_signal_frame 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 | 17 ++- gas/scfidw2gen.c | 325 +++++++++++++++++++++++++++++++++++++++++++++++ gas/scfidw2gen.h | 37 ++++++ 5 files changed, 385 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 fae3a47c144..87428bc46b8 100644 --- a/gas/Makefile.in +++ b/gas/Makefile.in @@ -170,9 +170,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) @@ -581,6 +581,7 @@ GAS_CFILES = \ read.c \ remap.c \ sb.c \ + scfidw2gen.c \ sframe-opt.c \ stabs.c \ subsegs.c \ @@ -615,6 +616,7 @@ HFILES = \ output-file.h \ read.h \ sb.h \ + scfidw2gen.h \ subsegs.h \ symbols.h \ tc.h \ @@ -1337,6 +1339,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 826156db3fe..9068072493a 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,16 @@ pobegin (void) pop_insert (potable); /* Now CFI ones. */ - pop_table_name = "cfi"; - cfi_pop_insert (); + if (flag_synth_cfi) + { + pop_table_name = "scfi"; + scfi_pop_insert (); + } + else + { + 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..613ef919a1e --- /dev/null +++ b/gas/scfidw2gen.c @@ -0,0 +1,325 @@ +/* scfidw2gen.c - Support for emission of synthesized Dwarf2 CFI. + Copyright (C) 2003-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 "ginsn.h" +#include "scfi.h" +#include "dw2gencfi.h" +#include "subsegs.h" +#include "scfidw2gen.h" + +#if defined (TARGET_USE_SCFI) && defined (TARGET_USE_GINSN) + +static int scfi_ignore_warn_once = 0; + +static void dot_scfi_sections (int); +static void dot_scfi_ignore (int); +static void dot_scfi (int); + +const pseudo_typeS scfi_pseudo_table[] = + { + { "cfi_sections", dot_scfi_sections, 0 }, /* 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_signal_frame", dot_scfi, CFI_signal_frame }, /* No ignore. */ + { "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_label", dot_scfi, CFI_label }, /* No ignore. */ + { "cfi_val_offset", dot_scfi_ignore, 0 }, + { NULL, NULL, 0 } + }; + +static void +dot_scfi_ignore (int ignored ATTRIBUTE_UNUSED) +{ + gas_assert (flag_synth_cfi); + + if (scfi_ignore_warn_once == 0) + { + as_warn (_("--scfi=all ignores some user-specified CFI directives")); + scfi_ignore_warn_once = 1; + } + ignore_rest_of_line (); +} + +static void +dot_scfi_sections (int ignored ATTRIBUTE_UNUSED) +{ + /* To be implemented. */ + return; +} + +static void +scfi_process_cfi_label (void) +{ + char *name; + ginsnS *ginsn; + + name = read_symbol_name (); + if (name == NULL) + return; + + /* Add a new ginsn. */ + ginsn = ginsn_new_phantom (symbol_temp_new_now ()); + frch_ginsn_data_append (ginsn); + + scfi_op_add_cfi_label (ginsn, name); + /* TODO. */ + // free (name); + + demand_empty_rest_of_line (); +} + +static void +scfi_process_cfi_signal_frame (void) +{ + ginsnS *ginsn; + + ginsn = ginsn_new_phantom (symbol_temp_new_now ()); + frch_ginsn_data_append (ginsn); + + scfi_op_add_signal_frame (ginsn); +} + +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 (); + } +} + +void +scfi_dot_cfi_startproc (symbolS *start_sym) +{ + if (frchain_now->frch_cfi_data != NULL) + { + as_bad (_("previous CFI entry not closed (missing .cfi_endproc)")); + return; + } + + cfi_new_fde (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 (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 (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, 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 (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 (); + } +} + +#else + +static void +dot_scfi_dummy (int ignored ATTRIBUTE_UNUSED) +{ + as_bad (_("SCFI is not supported for this target")); + ignore_rest_of_line (); +} + +const pseudo_typeS scfi_pseudo_table[] = + { + { "cfi_sections", dot_scfi_dummy, 0 }, + { "cfi_startproc", dot_scfi_dummy, 0 }, + { "cfi_endproc", dot_scfi_dummy, 0 }, + { "cfi_fde_data", dot_scfi_dummy, 0 }, + { "cfi_def_cfa", dot_scfi_dummy, 0 }, + { "cfi_def_cfa_register", dot_scfi_dummy, 0 }, + { "cfi_def_cfa_offset", dot_scfi_dummy, 0 }, + { "cfi_adjust_cfa_offset", dot_scfi_dummy, 0 }, + { "cfi_offset", dot_scfi_dummy, 0 }, + { "cfi_rel_offset", dot_scfi_dummy, 0 }, + { "cfi_register", dot_scfi_dummy, 0 }, + { "cfi_return_column", dot_scfi_dummy, 0 }, + { "cfi_restore", dot_scfi_dummy, 0 }, + { "cfi_undefined", dot_scfi_dummy, 0 }, + { "cfi_same_value", dot_scfi_dummy, 0 }, + { "cfi_remember_state", dot_scfi_dummy, 0 }, + { "cfi_restore_state", dot_scfi_dummy, 0 }, + { "cfi_window_save", dot_scfi_dummy, 0 }, + { "cfi_negate_ra_state", dot_scfi_dummy, 0 }, + { "cfi_escape", dot_scfi_dummy, 0 }, + { "cfi_signal_frame", dot_scfi_dummy, 0 }, + { "cfi_personality", dot_scfi_dummy, 0 }, + { "cfi_personality_id", dot_scfi_dummy, 0 }, + { "cfi_lsda", dot_scfi_dummy, 0 }, + { "cfi_val_encoded_addr", dot_scfi_dummy, 0 }, + { "cfi_inline_lsda", dot_scfi_dummy, 0 }, + { "cfi_label", dot_scfi_dummy, 0 }, + { "cfi_val_offset", dot_scfi_dummy, 0 }, + { NULL, NULL, 0 } + }; + +#endif diff --git a/gas/scfidw2gen.h b/gas/scfidw2gen.h new file mode 100644 index 00000000000..c3d6f80b3db --- /dev/null +++ b/gas/scfidw2gen.h @@ -0,0 +1,37 @@ +/* scfidw2gen.h - Support for emitting synthesized Dwarf2 CFI. + Copyright (C) 2003-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 int all_cfi_sections; + +extern const pseudo_typeS scfi_pseudo_table[]; + +void scfi_dot_cfi_startproc (symbolS *start_sym); +void scfi_dot_cfi_endproc (symbolS *end_sym); +void scfi_dot_cfi (int arg, unsigned reg1, unsigned reg2, offsetT offset, + const char *name, symbolS *advloc); + +#endif +