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 16DF9385AC19 for ; Mon, 11 Dec 2023 06:05:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 16DF9385AC19 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 16DF9385AC19 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=1702274718; cv=pass; b=OrCm/80lE+66RJSNiE9omB5r9PNFf2y6LE0Ffmczveex2S38W49ypNr51/igN2sEv6QEs8zVgr2IOwgnyfyW6/PrpYG9S3e8Gqpp0Ch4+bBS2yciHkpWT2zT17RBocEErzkNzuYnq052B5OR7eGHDO7ZaIcgddHrPmJy3Ew9C9M= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1702274718; c=relaxed/simple; bh=7YYzIti8xXCTWD0251scLgbutPjY5Db7I8CqfviP9LU=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=cLIma6neReUn0qAuEeutsHZ9oJejKVxcmB1h+MSfIwO8/fjiSy4LgaJVofrSjlcQ4EdXWjeFQUpoa/+t13Tnqr/z8Q72rRsjlt1DAl+9izWUpk84waiPVtUpKqBw4ggMkvoASlnGU2SBJfC9UR6v1BBfttmaw8ECF1TwBJA7o1c= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3BB5WYb0019231 for ; Mon, 11 Dec 2023 06:05:14 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=cAdMBT9V/LE8zapS2ZELMDKCJo4cYtkmdK97ev1Lqn0=; b=Kn36qcweJwxl64gMmM+0vo4xwLHDOfivvbFcsBf2wS6Dl1TSSNJbq4SnZ0JdFZsXZLAL 0qqBETyaIIGK35cv45deCb5wa9PD7PugnPulnSEOhPbDorNx9UTLcPV5ScWRuphONWqF asFuToXQsIAlwJg4onbvF+KdH2ApIhphpX8Vkb19tcbQwFa8q9K6zgOGZZH2HmIIgf/L KU3lnoTcwBbz48w/Fk8G3px90CmWlaIvm2j8uqSiymatIC7fn6eCVZm8WoaLubD1Cald OH+Gc2qUKHLnuYcZKCkWtx3EVpHL/01gVtZEUManXtks5wVMyY3bBT0jJvO5rHE2WDm5 nQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3uveu225dw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 11 Dec 2023 06:05:13 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3BB3uPvp010690 for ; Mon, 11 Dec 2023 06:05:13 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3uvep4e7e1-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 11 Dec 2023 06:05:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AHONvyE7rBuHyQnYBGkYkyQ89JGvd9sOa9XvRsAFQDS5xeh90kCVRcg/ELA4usqUqgUtyQuFAekHlNE0DzKI9PYU5gXRUqGBf+rCoK2H2W0NPlXCWtKPeNyJH55YeZ4d5N/E+oCzpMEDCzvswVdhIt9j8eEUunbaYX1ZqtPFZzqxkIVTLZYr+o4/EILxQvPBJukEQOp7fmZzJJWjTGMswqFo9lgvWCZFy9YISfSpjs8ukk2j1Xosc/PeO+t+2paG/HJhWI4PMTb0zwqjDRNaUSfqMV2bOrsc/B0f4qYVLeWGnaqee5a4Mw1gAiR9//N0LTgmtTtUMiZhZhr/d9DXcw== 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=cAdMBT9V/LE8zapS2ZELMDKCJo4cYtkmdK97ev1Lqn0=; b=MfN8vh1oCYxIcJ1iQev9wnIrGlyq16COzVI3fiwtzxDtSnEs9j38unLgA8QyfzIWC4wRymzelmtDwMQBuxZRiS85NkImG69hLXO6ZgXW6RFw/Is1z0pA44CLR6MhadLkq+lC2UzEvM0t3qm5SD00qpg4QrVjuK6CJr18cij0PXG2Gi99egm9uqVnL3INruAEXIXcnSNK2S9JIN7Tpp88ogTrllwfVaIYbSSDEuT9EeUJ297BtSA/JCa3RoS9ya9dv8e6mZ/kNswDCiPHxQQZv/wwx5M0XlvSpAvGyquPaPNO3LNRNY6A5JSDg4EQjph3eSdfrzRY6vNL6/i6/VkziQ== 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=cAdMBT9V/LE8zapS2ZELMDKCJo4cYtkmdK97ev1Lqn0=; b=uhBmK3Uzes0XnlW5c3vK7iCSs07t5VhjhEri1TwGm1kLG3GJ5EGe/mXn2dOkB0HB+kvQuzuPDv/7seC5a0ieNry8N+BBKygbR/LyhdgWLN1or0MgEgeJ/aUkyw8A9rzaUtK4BC2XtfiV60Opjr/uNFBnhJMPthnv2DpLiEVUIhQ= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by CO1PR10MB4610.namprd10.prod.outlook.com (2603:10b6:303:93::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 06:05:08 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::88e2:4a2e:3111:e04]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::88e2:4a2e:3111:e04%7]) with mapi id 15.20.7068.031; Mon, 11 Dec 2023 06:05:08 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH,V3 08/13] gas: scfidw2gen: new functionality to prepare for SCFI Date: Sun, 10 Dec 2023 22:03:54 -0800 Message-ID: <20231211060359.3561062-9-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231211060359.3561062-1-indu.bhagat@oracle.com> References: <20231211060359.3561062-1-indu.bhagat@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MW4PR04CA0171.namprd04.prod.outlook.com (2603:10b6:303:85::26) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|CO1PR10MB4610:EE_ X-MS-Office365-Filtering-Correlation-Id: 459f6bca-a878-42fa-d927-08dbfa0f20aa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Cc+EKGUQf2909vIMEFmegPFrAro1udGhMjVGkvSUTuFqyGXEKAXb3sGNtwMytws3E9xG6AEAZqvnwYWNvKM+Q2bUDgL7rSS5+05ASMHDymauTNfKST1jvM0Ys5ZSpSRkhRNjU1pqO+twhtFH729gE4Tft6QtbKWmDb3lwddaa+akOHoQnKEUgzPoE1EP/xqEkjPFl8svhIsi0Xy+JSrXjcv5RkkAqVfPJ8knKgKTMHX+HsN4TkIa+0MoKxplCRb1qeauqBcBqP0zQKdlr3AYIC4vjkiGjlzXPL7D0sZrdRObK+J3JNxi9Y266rQilW+jNliXmpJ7PYcXoneT0BU5jeWxt6vzkLO8xTRJ3clZ84wYa11bc+ee5bpzxNWZUQfX12Ekre42FDqyefMd+lpC9O6QPWDtAmwEtYHJOW5aS0LdPJjZDKfIJFPY1DG/BMuU9pOlqgVEKywVKCTxpGkjQvsCOnCaKi/chMN4XuscJB/OoMOuTdaaWIMUs2cBHUsThMlTDmM1C1f9SH38QkCe63ENJpZwbmOmOj/YWYKA4lK9IeKkZbPYiKbnxURk45gVffyTlg05Yg7Or+tAIf9FjHNZn4Myi/QxIB/XeaacTwbmmSZSnlN0cbjHaUDjX4nfhLZgUI2UPvbQMk25RGEdNQ== 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)(366004)(136003)(346002)(39860400002)(376002)(230273577357003)(230922051799003)(230173577357003)(64100799003)(451199024)(1800799012)(186009)(41300700001)(38100700002)(30864003)(2906002)(5660300002)(44832011)(316002)(4326008)(8676002)(8936002)(6916009)(66946007)(66476007)(66556008)(2616005)(86362001)(36756003)(83380400001)(6486002)(6666004)(478600001)(1076003)(107886003)(6512007)(6506007)(2004002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?yFFAlgVCIfn83R1+1zpIhKFbDmZSqLeJrXD2fnLqDM+VvZOkJ7TJP4W46Q0Y?= =?us-ascii?Q?KsjvhnjjoguZP59i1SDqgmYMSwYzY1a4637VuzzvRQAizwnyXWsjFO21CXq1?= =?us-ascii?Q?6wZ93rdX6wlwBdOIBoh+uYPLmWpa0yLvM0Vn/bHNUrrDhpD+0iDE7vY7OCcu?= =?us-ascii?Q?XrTpYPhn+i3SIaJHzDOe7Nl87Q9fdTak3Z1aGBkc+W7vOLla+TJc5xxkWQS0?= =?us-ascii?Q?6fOVq/Tfhih7ONjisHnNvf7jpM8ixySy/Hj47S+eiNVt992p73N+qdpXupk9?= =?us-ascii?Q?Xw38UwSHNOfc2o0D/ZY7yi9LIJBpuJAbm90mSh0Y+km0Wjs7O202QUv+m4Ig?= =?us-ascii?Q?Rr1EYxguknQo3exx7V1YZnNDApLUyoxYNwa771p0gk4jgutErAj7+ThWDyUv?= =?us-ascii?Q?I3wFa5sx/JBkL2cEYl7w8Sl8bq6dakiVgFHXwctqcZHTDawjprW97kv4wtG8?= =?us-ascii?Q?ZFV5IGteuM2zBkT/xaCSF/N35qbUFBNvVVDtN2vS9J/Qgao/MYp2YMy7fJkZ?= =?us-ascii?Q?nFTVJriuik51x4uXiXrgddxOc7HvMtSpi1mTy1LA1ODu015aYaOPFN5gbJ1u?= =?us-ascii?Q?YcTg79w5y8RIuVT8HrTN13JYM7VO7Ys1lFcfoXKC0ZX7Yeenhov710ofURNm?= =?us-ascii?Q?HhoY74OtoeK7QafE8F+voVoB7x+BZJjGH2GQodaK806le7Q8mgrKdPdbneWS?= =?us-ascii?Q?R7Dgfijj/ZYJFxLqX5VndmTyyvCmYfyDDQOyhhUg4SlpgiPy1B765tlm6bLk?= =?us-ascii?Q?19e/6R2ACselgwVlP5QqIrmqgzTM0eV6nCZzH+1OLxDTV7hLBrdcp7yZjMUz?= =?us-ascii?Q?YBb5VDq48eCClW54R+Li24w3CV1/2pClRDWnawM0p4F48jmwpg/x8t6gS6FX?= =?us-ascii?Q?vVQxySx5r/mwWXBYXTIapzTenredQRVSC41pyxP9I2SGSW5Md9jPaCWepvjR?= =?us-ascii?Q?6Uja5A0bUPjiNzPakPDofE2iK/E+hTBq/7WrwbBAlqfboxmTU/o8q+8E+UIo?= =?us-ascii?Q?BrLAxYgXRRSt9+WkGbiNII6uLOzWCN+V9ZV3oWStQxCrR8dtVf0NGBb//O5c?= =?us-ascii?Q?xbCQwOvV0HEfEUqN1CNTTqdlWnX6ImYlpj3sFVo/O2Muex9ldWN5y7MEJ80l?= =?us-ascii?Q?jaPpS55mwyL/KENeRZcOGepbVi1NYv3MnIZglOUb2q9JD842CSFYR1CeFHXl?= =?us-ascii?Q?NVH6/Eh8tTG9ulWR2TSF/aRuPca0jMrhRWuIVMBViNpSXBQlPzEe5IOS5b+I?= =?us-ascii?Q?VBbThOijNf9PKSZ8a5Zt3EYd1PAEIvMHrfpljjIYgUiRrqhYQcZdir55BFG2?= =?us-ascii?Q?/GwnBoLowqgC+HUoLt5PVbWVZL0fVupOavTE6k9mZ68i/Av95f17TLC4lcwG?= =?us-ascii?Q?jedbK/bEOD2PUDs3Y1EpjY/wxDGpBSrspKYn+caPOb7ZQB26moRHRHLV2D2Y?= =?us-ascii?Q?QEX4bci+CkSIlikUUwvqsm4nPvpgP0zSfbO1mA66yxGsXv+x8mhOcGkam8ks?= =?us-ascii?Q?qkmlH365kVOdYtXuteB1gou7T5f7qIY4kZPrYx/vy74kqw+eY4+151QNqA+B?= =?us-ascii?Q?n43Ykt78VCi9kJG95XCbwN4j6JLMg9upfqVXX6ksun099mlsrU1glJ12FmfY?= =?us-ascii?Q?gcUkbiAzdFdt/hGxOnqx1qo=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: R7vmykh7lTdQcNoOuk4OvqtAQx6qCm/kG2YfMkr448hPPJoNucoDa6A59YTWsO0KgHe7vcGil95w+db1fwpYBICPSbam+5r0L8UppB+PiTtwgbeG9mFB5Tbnf14XuTDkJNEYY/risEVxetip/1CXuYG81AMTdU6mFDiMkSfzRwsddqPZFeNe8Z8m6swJBqAhWIEPlgu182cAcwhVdzq/eOWgV9Ng78CwDzmDnTHCWSOniNXQ4UuEb8eZZp0QscrhIdMv4b9eb3R8nxsDEuPCnbSHYhijmN8GIHuJzGHOEGcYQ6lY8Ww8KZ9rxR38KWlZ9RYRqswYdDQTF4LT/dX4VqlLHCseeeEpgdUrgOkjAyTZVLQe0oIA4mXicPqahj+HBjHsHTaHs9SZX3vDguCt40wudIujwfi3Gxp3wefcVdmZbOkYNPP8SZRkmJuTMPXEMjHk44WYUFZ+VKvp8Gc0ySIKioNaoeGYMAGzAer8dzgutrsLBzvbVtGnwGVgOYtAUeQbtyj+Etr7OZvU1dgun8oY3Q5zT7//UatWO4lwqkL+kD5jQWjv9t3SSgwqBd0UaX1XOqqikro/B6GNm3TjxDE1PmpdypM8H5vLAzQ1xmTGSVRO4kjCIYaku87t1gSIC+/ytMMnNaMshKODrvqq6QWSMpXVDZN3I+2/r/sel/qTuj1g/vtWneCsFd8EbXNY4XCG3OKTdD5OmmuR2pd7kjXQYSiA/OuKF11A9S5pMubWZObB0Ri9nWLqjWWnWOo7BRVmjdB00F0qhDS1alWOEA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 459f6bca-a878-42fa-d927-08dbfa0f20aa X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 06:05:08.3553 (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: e6TnVEvr2xtu9kM0NztSGYRdWv+3nN99xEVBMDR+598Hh805LD1icp43NFMOEmjj3SZT0v90YcsiS1pVIb16kg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4610 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=2023-12-10_16,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 phishscore=0 suspectscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2312110049 X-Proofpoint-ORIG-GUID: ehdfNCu3LrGyZJpUkOCcXOc44oAeGdnE X-Proofpoint-GUID: ehdfNCu3LrGyZJpUkOCcXOc44oAeGdnE X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: [Changes from V2] - 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] 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: scfidw2gen : address review comments gas: read.c: address review comments --- 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