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 D0BAF3858006 for ; Wed, 3 Jan 2024 07:15:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D0BAF3858006 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 D0BAF3858006 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=1704266153; cv=pass; b=KUXoz4P6a9tlqNr6KrF/Pf6tld0wesweGpXfdLcj5nOWYLqg6+ts3mXATx7vTgIVbc1jyaw5/XKAGIDSP9X/yiIaSLQvEs1Y5p+tfkDM7raitehyWmjefWQiKhSyuIVQaRCZCG1MOOW/+6CNY+B7vXM/rkjTYA7z8ayn98OhyBs= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704266153; c=relaxed/simple; bh=/T3Y5HMlCZF45fVKtBvP/w/0wimTBNz/37tdoJ8gUoQ=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=JbHJawlD9illjSL+jH/LGpMCUh6zv56WEh3nPzzz+1vr2W1RvtobPwWrlAbAlXPrSPOqsfGiCZ4m0Qv074D08WkNBu/ZrPYRBRKu+65HYlhe+X5cb6wlC00UIjBcFeGbUrat9eeUhnFasaXzOm4vHWeHltfQd/OFN/WcOWq7+xI= 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 4030i14a012290 for ; Wed, 3 Jan 2024 07:15:50 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=N9rATEDwiW7PLmo7lK0Iw09UwP8rbsmIZdZEKf53Cxo=; b=dokgJREjWrwMhaQx1Yi3K3laHnmfXUWdvbNHrcu144/MB9rxyw8brDRfjD9a3CtVRJzI qdcfSGyNe77K8sj5n/Zm5VbIuRfmgQCsp5b3++BrLq1xdAVAVtzs6ILkpikEcwAFf2a1 Is3fLcPRQRS4gcelaQiMNf2C8xTtvj2oJ6p0fuxVfhmJfjpXEC+VprxAHbaIXr7iULuN kFb77gYpKBtoQA3uUbooVmL6BpWv7UIxiuLg6hme/vIK8URVMeFq0pTDOzN6lrD0XD3w iCzRl0vWtRHzvBuLNq281TxqFrOk0DMbp71+wlPOND4Ouz59HSwXt10B2mEvHdnrsDxy OQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vab8d4ec6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:15:50 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 4035pVuW035913 for ; Wed, 3 Jan 2024 07:15:49 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2041.outbound.protection.outlook.com [104.47.57.41]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3va9n8xdsn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 03 Jan 2024 07:15:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kj0sL4uIcXnA6jHqfo+3v6OS04tf8Y6yxmDEbgZcxEVNvDlLr9LWaYgp9deMDx3jIckK9ofPMNHxBTHVVER+isb0kvtOgaRygvPKm8z/ur6HHy4TwE/ZCiwIFNxafSPlM2I8S1Hi2EDiNxKBcRTGXAKNvKX4Yme+OkTbghEEj1t+JyuhLOQG+iOGUP6cBhXgheedrWFdHSM3p+owf/QFYYupzfM61UALWizwJxMtfGyUrzTeVlxuqJuoS0TJV3SS4xmrGcACB0wTxNNIug82Jx3TWg8/XC9lvATkpEb2j86bvobhLp6PLAFzSs3GvcI2EJSDRRlH3FiEBx2AALYdcw== 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=N9rATEDwiW7PLmo7lK0Iw09UwP8rbsmIZdZEKf53Cxo=; b=GSpXwOk4jZN9NxTbDoMmDpPplBnLCTDexf9yVUilYGDl2pGCHQgAFU5KRvcd00ecAE3I4fDbWZRU0gezl89UO7A6yJDPX0XwaC7wdKK+J/IvXfk2xhQHZJiM+nIcnjIJBqNRyvsSjlybNOfGNXyjevXq5v+Px4wxrR/tm7tSiGFeQKUxtpQJjwXZQ/bZYkH3fFZdGptQY94qTxQP1y1h6l9WcZIbIMIk4QmEnNIemUtu/47d5THxSeNIjvlIIrC8mYByHbeRrnx7VUT4k5DCt5eroh73UWbZK+TarBCl82QfVCoFcPY+kNQWdO/nrUs8OFg6BqZr5Mz56cGAt8l9Rw== 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=N9rATEDwiW7PLmo7lK0Iw09UwP8rbsmIZdZEKf53Cxo=; b=KYMVK7QK/ebkohh/FQGspwpqBMGlYu76YHow0XMS/81i1zr0/rokJqUUepCu8/N1oEvOMhMDtU0gadt34SlBoWuQyRWp94O9C0iwk1mfBULd7l391fCR1Ls+c9c3UxdbMIozsJCWrs77sEiAmS60Me4nopjzt60+LeelPCMRyLQ= 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:47 +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:47 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH,V4 07/14] gas: add new command line option --scfi[=all,none] Date: Tue, 2 Jan 2024 23:15:19 -0800 Message-ID: <20240103071526.3846985-8-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: MW4PR04CA0230.namprd04.prod.outlook.com (2603:10b6:303:87::25) 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: dd5a211b-7851-425f-4c80-08dc0c2bcecc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /Sz+vowybpp3mYR8MIPqMOoc4Av0d1cLRJMEeLWOuh8ERhO04EtmURXh9POhSvczvHvh5QOTxgC8VLrumA2vyfdNhYHM1LbDWly6PpEsXR+0r0ef64nBT8VmeoHOBNtvweEcFrm/mKif6pnVjnSwbiWS2U0HqbU/am0XrFpX5sh/hNbh7hpCbhmw7s0XcsS6S2/aeOVoBjbL53wzHA6jE01gH825gsyvkIsAK+5UZ2/HIkcAdv52s4PoQJIBohGC9z/mFvIuJe8Ra8AfboWptsK8S20GZuHR9g2fW+aGZqcsMhn2mq5Nn0AsZuxG73hGk3aKYgcH/perchN0NIAo0VE5CsY6s4tzV+nTiJW7wTvvny/UF2LYnP67ZI+F5M7dqfld2pv/N8lQ4KRIIElSZL7f5TjR74Ryrv/epH+6kvcZoMCCHKj6bPT5nbiEfjXd1dmsWto+fsVGw90kDIT5pSfFbmKEy69rDTAQy3ar9iTYl1eCWUK8hEU6DRm1DKXH1xXwDhT7ra/CNWnXSbIlFiPkZAzZla/FJerFgQrJZXDPxzK0be1jG70hoejuGBbOigvW2zPlaal+vMcmLQMcVzYZIy1s/vFWPGJIQraBsgtDLaEPvY2wYz87BQOKya25 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)(66899024)(66476007)(83380400001)(66556008)(66946007)(6916009)(41300700001)(2906002)(44832011)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?lqGHoLO0hce/CGQqIgYqh10N3daKBQ6j6IWWPzZn7F16vPZ4yvrAiy6eMt4x?= =?us-ascii?Q?lQoKJNu53dgA+ykZzwiSx3bDd5u7oGkiBPj1PvDvmy1KqAJAo4p7ykliHGxz?= =?us-ascii?Q?SwBz+mhbAnBcTBniymOwhVjL30uTFJmcCdllzE1bIVqdwOrEc030nRj3kXA3?= =?us-ascii?Q?aPEcFXMAPIual56535pWMFYkO3kYNKWudoAnbE05NwHqolBlcCWcE1ohNK7/?= =?us-ascii?Q?vj/Tkd54hrKMFIQFvjm4Ckff5NnIqXVpCl5/aMIjE47YCFhh1LFR7rAqyb1I?= =?us-ascii?Q?JAVls2OzmFc/Btw91+4N78DyHUIHpxdfP9cXRgl9VV/58K7QWHSlBJSX2cel?= =?us-ascii?Q?f1f5Q13wracqAKhJAbta6PjX/Fz7HpIl2gAOzawsT1K57Y0Gshlz+lhH5jDZ?= =?us-ascii?Q?GXbjHmyLsdrYzgWxkKQbFXnLjHk6FB6+Fs18zqDKol3wZFIzmtb/MWB9z+lT?= =?us-ascii?Q?2ZjzNGuMBy9Rr6tz9H9kkUtalxtIAw1VhsZunp23MRWwXQqCt9C0dQGhUN5n?= =?us-ascii?Q?ENlD0daLI/8upcuyY/QYw+ZhbB9c1MyD6SRXtxkOIVqtIjw0wZ6XsNTaDLQL?= =?us-ascii?Q?86C2DYgptrsxXTSuWw4PEalEsd9Rfvr/CCPIUMYJiaNpt4B4CXLLMvJjb8c6?= =?us-ascii?Q?j/v1EApZeUKPmWfwQ3158vNENDTon4EGUo9/vqlBqbtmJjR6WQhQxSfpmbHK?= =?us-ascii?Q?V1dSjbFkbddTF4rvtrvcfStgg8XA6eWNFSSliMqSjpVZRHtRYeglPgUTMjv0?= =?us-ascii?Q?59ACuLhuPcpRGQif2woAiJVsaK1Yh5oMlm5yWUf8j/F5xb/xjHBaxAqpUQNF?= =?us-ascii?Q?qwNGSydpI5ZjdT1zu538iAVh4lurpdMIkXOBobBKpEkIlNvMKdu+plyeZr/c?= =?us-ascii?Q?yHJw82Nvsia3gc5OLrSIPNxhaVvOEqGALGZ95EclgQneMg0WrlJTXlrxPMjd?= =?us-ascii?Q?txM4Jk4VS9VwpaVhP2v1/kDon91yRvL3wd35DfGHLDiRFXWt8DTtdgFP8mV9?= =?us-ascii?Q?R7qcJIjLt3XxCNtpasizDvlJKaWKcHyOKqZt8a3D2tD7tPo4SQ0me4d/DwEk?= =?us-ascii?Q?C33ZIxEXEbAvhynJAIRT95FofnCo38DTIiPZWcnHFXIUCb5oE9QF+munHy9Y?= =?us-ascii?Q?CrnSGqdXIOneodKwoEdtNxTJT9HeP0qz49Tnu7xju3mIyUZtXEwiQiWgvcdu?= =?us-ascii?Q?udBzYwYjDp1Umx+UDu3u0dbshTqNomGBAdy1sQa6/iXLx3yjBv7vFd++KkQK?= =?us-ascii?Q?FrSuWFcCZKTe6JQ+FF0tr5QOAysgD9X7JKNJpWML2YpC5Szp65/j0vIKEDp+?= =?us-ascii?Q?WHL/JoZVAaqh0fbM+DrNB6hiOnmLo1HMPiqyM/88fk0xvKC8qNnoN5pIifQp?= =?us-ascii?Q?E2E7OeYjEoygvVrsz9IKut3StFzbrR3f0lngSlfyck1GUL2YysKqB/ljAIOH?= =?us-ascii?Q?3blH4jF72I0b/JDoxosGCR84Tvv4uJIsXBlbMNT7Vdq5A03RFVHiX2ZTsG5G?= =?us-ascii?Q?qHRdXmmORcMypgW2RnqGJTaKCe7BeBSeF8U4jS9zCLdC9l7olYbNGrkWo5hc?= =?us-ascii?Q?v74znLO/GWtbmzA7AnJgvkYySFipZnZJpj0HHkFp75lNE51ZXeC1xdBLgJEG?= =?us-ascii?Q?l+ERuzxJ40WYwZDLWpatiw8=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: xpy0Td08Mzr0lcxpQxYe4liT8t8NVbks/V5+KFbjgNJklNkXbo3YUj1g+/04KqtwZ/Jj+Z4rl6SkTh8gq6cL+PXY6GJnqRL6N38pXMqeW+0EqGY7oPwj6YdquNf13BowUfIe78rFHBwsuDb2LcNh9OFztLPv0dztCXIgMAJY2faiYTnuvrh79Iow352trSsA1REzHVaIpSt8S2pJldhVvp4m1WqYQtSO2oIGjGKkBeTS1GBZIxCtiGZCo5Jg6vTEDzofWeebRzEpjTo1ey67QGEBU3v+RVhCWhYW3J80MRZZPOXBodLAfwzJ4zc2Oniz/QYnV05JLBAjoX2tVGtshQk9xFQGA2csvNKCcMcTogqZAca+XDXlZWLGnliyzkDtB87d6kw5PVMYE1nO9cgszqAPGLG0khhbsmOOxWnS/r7sCO6LlWVHZATTHmFRB9Ep+7VCnF3fWXhFP5CE5pXcE2c79AQJDJBfjkB58bIOPrRb3HG4NqLHrcC2QJfHx9yS4Tg6MbYwxq/HLW3p0wJ+u8sSYK+SuCmUF0PQQo+KHFwWClvYWhdGFeKwBzwTdNkl48VRHDS0TgHwGzgNAgQj1JZ90ZG+ZkHeEWvuzzbLMA0= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: dd5a211b-7851-425f-4c80-08dc0c2bcecc 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:47.3771 (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: +2VhSEmG9znSTBhqI0jgOmeyeXKdpuvE0OjswOVSAtUc9BP0Rszhatgg209JQ1tN/MNV4201BKVHtVsSGGhnwA== 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 phishscore=0 suspectscore=0 bulkscore=0 spamscore=0 adultscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401030059 X-Proofpoint-GUID: DF2g5PXsWKL-_SinCmNWaCPJRh4ZoeNS X-Proofpoint-ORIG-GUID: DF2g5PXsWKL-_SinCmNWaCPJRh4ZoeNS 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: [Changes from V3 to V4] - Code restructuring so that --scfi=[all,none] is available for ELF targets only [End of changes from V3 to V4] [No changes from V2] When the command line option --scfi (default is --scfi=all) is passed to the GNU assembler, it will synthesize DWARF call frame information (CFI) for the input assembly. The option --scfi=all will also ignore many of the existing .cfi_* directives, if already contained in the provided input file. Only the following CFI directives will not be ignored: - .cfi_sections, - .cfi_label, - .cfi_signal_frame To use SCFI, a target will need to: - define TARGET_USE_SCFI and TARGET_USE_GINSN, and other necessary definitions, - provide means to help GAS understand the target specific instruction semantics by creating ginsns. The --scfi=[all,none] may see more options added in future. For example, --scfi=inline, for dealing with inline asm may be added in the future. In this option, the GNU assembler will consume (and not ignore) the compiler generated CFI for the code surrounding the inline asm. Also document the option. gas/ * as.c (show_usage): Add support for --scfi. (parse_args): Likewise. * as.h (enum synth_cfi_type): Define new type. * doc/as.texi: Document the new option. --- gas/as.c | 24 ++++++++++++++++++++++-- gas/as.h | 8 ++++++++ gas/doc/as.texi | 12 ++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/gas/as.c b/gas/as.c index 6839c841588..953b9bc0b99 100644 --- a/gas/as.c +++ b/gas/as.c @@ -321,6 +321,11 @@ Options:\n\ generate GNU Build notes if none are present in the input\n")); fprintf (stream, _("\ --gsframe generate SFrame stack trace information\n")); +# if defined (TARGET_USE_SCFI) && defined (TARGET_USE_GINSN) + fprintf (stream, _("\ + --scfi=[all,none] (default: all)\n\ + Synthesize DWARF CFI for hand-written asm\n")); +# endif #endif /* OBJ_ELF */ fprintf (stream, _("\ @@ -511,7 +516,8 @@ parse_args (int * pargc, char *** pargv) OPTION_NOCOMPRESS_DEBUG, OPTION_NO_PAD_SECTIONS, OPTION_MULTIBYTE_HANDLING, /* = STD_BASE + 40 */ - OPTION_SFRAME + OPTION_SFRAME, + OPTION_SCFI /* When you add options here, check that they do not collide with OPTION_MD_BASE. See as.h. */ }; @@ -543,7 +549,10 @@ parse_args (int * pargc, char *** pargv) ,{"sectname-subst", no_argument, NULL, OPTION_SECTNAME_SUBST} ,{"generate-missing-build-notes", required_argument, NULL, OPTION_ELF_BUILD_NOTES} ,{"gsframe", no_argument, NULL, OPTION_SFRAME} -#endif +# if defined (TARGET_USE_SCFI) && defined (TARGET_USE_GINSN) + ,{"scfi", optional_argument, NULL, OPTION_SCFI} +# endif +#endif /* OBJ_ELF || OBJ_MAYBE_ELF. */ ,{"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL} ,{"gdwarf-2", no_argument, NULL, OPTION_GDWARF_2} ,{"gdwarf-3", no_argument, NULL, OPTION_GDWARF_3} @@ -982,6 +991,17 @@ This program has absolutely no warranty.\n")); flag_execstack = 0; break; +# if defined (TARGET_USE_SCFI) && defined (TARGET_USE_GINSN) + case OPTION_SCFI: + if (!optarg || strcasecmp (optarg, "all") == 0) + flag_synth_cfi = SYNTH_CFI_ALL; + else if (strcasecmp (optarg, "none") == 0) + flag_synth_cfi = SYNTH_CFI_NONE; + else + as_fatal (_("Invalid --scfi= option: `%s'"), optarg); + break; +# endif + case OPTION_SIZE_CHECK: if (strcasecmp (optarg, "error") == 0) flag_allow_nonconst_size = false; diff --git a/gas/as.h b/gas/as.h index 46dd0d0776d..378653e2200 100644 --- a/gas/as.h +++ b/gas/as.h @@ -324,6 +324,14 @@ COMMON int flag_fatal_warnings; /* --fatal-warnings */ are detected. */ COMMON unsigned char flag_always_generate_output; /* -Z */ +enum synth_cfi_type +{ + SYNTH_CFI_NONE = 0, + SYNTH_CFI_ALL, +}; + +COMMON enum synth_cfi_type flag_synth_cfi; + /* This is true if the assembler should output time and space usage. */ COMMON unsigned char flag_print_statistics; diff --git a/gas/doc/as.texi b/gas/doc/as.texi index 52571d95dd2..cfc1078c36b 100644 --- a/gas/doc/as.texi +++ b/gas/doc/as.texi @@ -255,6 +255,7 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}. [@b{--multibyte-handling=[allow|warn|warn-sym-only]}] [@b{--no-pad-sections}] [@b{-o} @var{objfile}] [@b{-R}] + [@b{--scfi=[all,none]}] [@b{--sectname-subst}] [@b{--size-check=[error|warning]}] [@b{--statistics}] @@ -932,6 +933,17 @@ Ignored. Supported for compatibility with tools that apss the same option to both the assembler and the linker. @ifset ELF +@item --scfi=none +@itemx --scfi=all +These options control whether the assembler should synthesize CFI for +hand-written input. If the input already contains some synthesizable CFI +directives, the assembler ignores them and emits a warning. Note that +@code{--scfi=all} is not intended to be used for compiler-generated code, +including inline assembly. + +The input asm must begin with the @code{.type} directive, and should ideally be +closed off using a @code{.size} directive. + @item --sectname-subst Honor substitution sequences in section names. @ifclear man -- 2.41.0