From patchwork Mon Oct 30 16:51:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 159813 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2354493vqb; Mon, 30 Oct 2023 09:52:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGDDy+1Yykqczv76FsmCNYq5wpor1ZHfmMHjp6EE7OyBR21uk2xIj0RadQbK7tPRRwKUZBz X-Received: by 2002:a05:6830:16cf:b0:6b9:6419:1cde with SMTP id l15-20020a05683016cf00b006b964191cdemr10767247otr.22.1698684734291; Mon, 30 Oct 2023 09:52:14 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1698684734; cv=pass; d=google.com; s=arc-20160816; b=tBu6PmoHCdMYc0esLk9otseFBQwpGXLxTMdJ7RDEOsyIm31p0sCLJRmWmaKjaHkpr2 6MHskybPhew2YMMdCPcAx8G5MnZ8gv4vSTYOzm/3lKEugj87+fCwiiuVOWUsPo43aJKh H2rRfa22a+NIpt4GPKf/bS9Sai61KzB+UJT8OBjo7BFTImkzrD+PGos6+MRGt44j/46z MpnGZmlLbeKL0JLHDqM6Sz77/KSW5PypDI3a93zo6bn1aABAu8S9owM5jDnTNUu91zEc 5B+aigMFlm3eaZInQh7Z6mLYxj8LyTWCPe/c+Fo3YYxG1EToemsL8N2REhPCWxwsPkQf U6wQ== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version :content-transfer-encoding:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-signature:arc-filter :dmarc-filter:delivered-to; bh=bOzzEGM2FgbDvqeC805a2tXZkflN9MFlu+bb237Ur0w=; fh=Oh0rwXgL2pcS1FQHr6E1Hal1K7kVHmZXDthN47bNt4Q=; b=W7zWoCaXbj7PWZQs5p1rdo7PTKx6//IImhkp6W+QsN5PCVm6Mc66HqO/fT2O5bzaI+ oWp7wgF3owvuEfLOnxtfhZauFPO1LWNG8PP5LBXiHqAzOHp20GwpvhOml+kEAk/TfRjB 2030sS66Hg98vdnDvAbO5oKPr3MYiE/YrBB9cNmGx5aFqMVRsiBeH6n36H/0JRhN1yPK tiGG7FFdgQOFP98bfu7MkS7qrn6fEWtdfwM4pkNgDsdvkq+rJD4qlr17tVyTgS9n0FRF uA70yeARUKDaRPtCoA8WsEfSZakSy9luYskzkKcACA/Mj8v0MmVdof7yAga1ofZmk/6o f/fA== ARC-Authentication-Results: i=3; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=gqf5ACa8; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Rss2FAAv; arc=pass (i=2); 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id h19-20020a05622a171300b0041976f260b0si5928668qtk.119.2023.10.30.09.52.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 09:52:14 -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=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=gqf5ACa8; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Rss2FAAv; arc=pass (i=2); 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=pass (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 311D2385C420 for ; Mon, 30 Oct 2023 16:52:10 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 3A9033858D20 for ; Mon, 30 Oct 2023 16:51:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3A9033858D20 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 3A9033858D20 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=1698684715; cv=pass; b=PFCVLRQDApHulpRQ6rjl4XCqQ4Jld/R+VTI4TCFdFKA6CMA37LEv5P2owm/vfAXmrVx7FuvMKqr508N7mKPg9V9BtYU5EHc/cl3MExTNl8GUTphT07rsramycm7g+DJbHav0P4727NOJ1TAwR2nTL4+pWz/wJAUPHILevAOjQ20= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1698684715; c=relaxed/simple; bh=DcupvmyYV9nt+Jcu9nYrB1QcjYayratVrN7dlaRAXU8=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=a/fex7zTTVdvNFlB4R+5nqjVryPUiw+CPc7xxcdfUW63gthdELCrvx/W30OTM6FQIAzOVD1Db7nMg0NaKeJtWBEDUszFWMbsJtoqzWGpRFGdN2Klt4bWicgMllilemLYTXMBzelZ+/3FXANtwGxQMm5LEpqiNRICN++3PrI/fOM= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39UChxPM021209 for ; Mon, 30 Oct 2023 16:51:52 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=bOzzEGM2FgbDvqeC805a2tXZkflN9MFlu+bb237Ur0w=; b=gqf5ACa8BmxLuYEPR5TS4y+1V1b2T0PKg3GbNwOBEiGiblrR3Z42Fvhqgf5CJ0LE89Sz UNpPaDf6h16rRYIcdkqPZdYNzAbkJTCv1Rdtr23FhS+8bKA388VHhbCOOLc9yJLeW/Im D1RZoGyoN38hxaIv4h9QoHNYr7M649Qs5qQ0UEjc3FYpHjEjDIr5r2ymloTKlVkWEN9w 6q6Js/YDfbt+EpaNBf49mHAACzQU9rS+qDyak5w90cPou+q0VPN0Gn2w9pAPWOxaQpEU wEuImplFh7RfNJIXs9VEUQ0pp2ifXh8ZJOL/I2c4pPj0BrJ2jV0ZWsDuLWQeaIgHJ6X7 eQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3u0t6b36na-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 30 Oct 2023 16:51: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 39UFaebE022465 for ; Mon, 30 Oct 2023 16:51:50 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3u0rr4hgtq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 30 Oct 2023 16:51:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dCch24dB3686yKbsatnm1DI8ozZ4OwP578SFZwMHwXWNWxTqNulSr9vN8g4PnfpD0zkTMBlWMhwc//8ZLcFRLqmmKp2x8z9NwIPeaAjGYKL+udxOzjy0zoPXgQkneU/VAd3a2OhN+3SzxHCeSRjgLerC+YK1ZQhBp3IATGszJ1m652FoUJKlEBofRSrNR2FHaL+T7578cvCC4NctxzBgsQyZ3sAG2JK4iXr1l+DnivvkNVYnfQEM/Unocg42oTG0GCEqMZQwWqei7cIqpw2WaanfnFBGGQXPjucfvjOFbr5LnafwgplJkLTjdj9VPjESx5OhO+3BJx4rR7GujOijIA== 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=bOzzEGM2FgbDvqeC805a2tXZkflN9MFlu+bb237Ur0w=; b=mk946qBkSgIRBo7f1XHOwRpla0QVVbmg8e5LIQmUnJGFeLCfbfwDPMOvJi6kjAbUAAhYWPN1nRjb8lc2XI9bfl8Eug+nrt5YoVG4pOApPrMLN8oMAR7wYMroaWPPQ9mjbt2s+4qoSdgbq/us+A195HMqZV84fDuqzVxMfjOs0myDp/FfTw5euAbQtj4wiNsi/KJpoiByB3sxZ7nBLoVIVZvqJ6+bzzpPZmFN0ChPr1QKYxryW7QYv/VVCsVrD9tIfXMIhpZG4KTCiDtqT4RlPTRbBHZr9cdxK5SWbgfB0lytIH5yzdB9TiXBhlVC87heoYWVnI95yOKa0YCjAzmZbg== 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=bOzzEGM2FgbDvqeC805a2tXZkflN9MFlu+bb237Ur0w=; b=Rss2FAAvVmeEmTu4J1ZrEE4LiAaKM4egn8GUlJYmtB4c5o3TCBkHrSipKqrGtV41YiqEKTm9J18o4rvn43fccvltV2iFsFK7itKj2nsKCDZUQUFdGVOBn/fcID8DRqoyC3AWH6HRR4F78+hLyl1Bvsc8QolsXwtxEp1/FRE7w3s= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by IA0PR10MB6818.namprd10.prod.outlook.com (2603:10b6:208:439::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.19; Mon, 30 Oct 2023 16:51:49 +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; Mon, 30 Oct 2023 16:51:49 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH, V2 01/10] gas: dw2gencfi: minor rejig for cfi_sections_set and all_cfi_sections Date: Mon, 30 Oct 2023 09:51:28 -0700 Message-ID: <20231030165137.2570939-2-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231030165137.2570939-1-indu.bhagat@oracle.com> References: <20231030165137.2570939-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW2PR16CA0036.namprd16.prod.outlook.com (2603:10b6:907::49) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|IA0PR10MB6818:EE_ X-MS-Office365-Filtering-Correlation-Id: e00b02fe-23c7-42a0-19de-08dbd968823f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Whx5FCz6rKZo6jBEdEOY9ytEZaz2OxT4EPC7hRv9GUXFwzqfmTZ1wa1lLQ6MaGPI47El3ldpNS90KsfFtGcC/a9u3UYIU40Ue54otvvq0bI6oGfPnEDbqecUaYFIEgn3Esn+9ArS/uL78g80j+Sibvaq1ZXZanzSAP3piRKNzIRlTjYoTDecqPqJiBBGAQJvmrQTKHAsms4Udejeslb983ClIvTcsGBUqP94v0ljO5Gh34QacNOPagqyyaD5iwTBcbWDIDpKa+1ZNqS10LNbPLM7d++X+mn6gKe4GP9Up1c3xzTWGKAxpOPWbU4ivDousDDyUwHWWlrCQYC2tfGkqRDUybgSplrzqVNZcFUCxBk4cntryHyxydEktCsX4GSvgzpnAUJchiqgay+RWDu+fMSKuFXj507Bz307DexhWKvHOyYMLa3x++JnIBIbXq+ooVZNbiyw3CdVZ1w74isLylIr+zxf4lge+Cbx1WGBAc851UmaHDnN+hyEyGHP177MrzQ2xBbqKzHQUek4g5TMVnwnYQlZqNAgVCEj3Wa0HmoukD0v+/RYJywyueJGiNBA 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)(346002)(396003)(136003)(366004)(376002)(39860400002)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(83380400001)(8676002)(4326008)(8936002)(38100700002)(86362001)(2906002)(36756003)(44832011)(41300700001)(6512007)(6666004)(5660300002)(478600001)(6486002)(2616005)(316002)(6916009)(1076003)(66476007)(107886003)(66556008)(66946007)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: is+VlnRIMpvQt8gV2xzJf168M7GWAlh3lIQRDqINGtjUzPzn/Pt3ycR3ifYihhiAoyJiZ+PGdTh6OsEisMH7BCz/d7twjPXteniHLYg8cbWWxr9lmaDH4eArxH5dGE7dBzZPNOhJ/xlNViRi+7SN0xkjQDLrhlg7qC2QaucLsn6DSuF8IZrvV5ArR5/MnI7ySNV1mcNjuPVh5vJEWbh/Cn2kaOcT2huaQjqMhYeLAY8CJxY45ddHSUjMqdjePZAr0ATo2pipoSPvaONKyJwaKSVt/W3bDIKwgDHBvoY1gujBn6hXU94+wSXKsTskcr468y00MCZQZbSXxt86UjikvGmYXV4GVLqmDnG9DvjXozhJ21BgM+xU4bioCFdzHT7JwqWK/t/wD7S6tCEIYlk23VjIHgvmUcMSiAw89PV6vPn81DyEJDLK+CQb3cS/BHgq/DL06Nn7h0iU0ijile0fPD4+mCzbo2cuRP0M+Kbvv2T+dC3BkJUCxBL6YUlee3rZH3azS0C5nmY87tKGvaiPvmwmvUf2Zaic87al1KGfQMmZgx0tI4xRNb8MEVdQ9ndxNEkdsOQ2D0EkcAhH5JxeOna/d/OWaEbyxC3gaJMB3mpKV/B62gRKwFe2xksE/p+dDZ3hkOUrParYZR4F2mRoi6Up3oBqplloGHFIAgA2A1XPKkgZwJlrOTZ3w57/fg4xhoTVO/m3mGgmBFaltjaJ9ndZ440SeAZ9qChgUQBqjufWDkAnmmhpFlyWVHi4YDltNgT6pBMdxHdtxfpkM8pZAx/UxjumVq+9iv3+SSyO/BE/nzsvD7quAZaFhhNbCvcSqGvOEExUxYEOpzsTXtF3j1sJwqcM9M0QkkqRNs+073vOGeht+HvkUPdtWba6LsIa4TMo04vj/qIBsrzf6B0m1vbRGX4rHBz7LOziFpDOg3gnuxRWdG0JzHFuo/epzP4dJp9cdSTd6fcMZLwxxpqhkc2LjVe8A824+rfIGifpBGOzLgbIwNbBKByavl28poV481ziYJkCftaY1lti7FLF1zgIMinq659ZdXR2txkgVC6j5wBFzWLnhLiyRjVAO7A86JnC7cr5FhmUYE9d1QkLo835M06xjuAzXtZBOwuddYfjvOXpztsxxy3Z1SYcL9cQNTcsoZWAb1BKtOm899UnzYrVVCseASpi6afegYX2FtjETBZo/c5Do/aq/T581AzqE7I5cHZovTqL1Y+lBFtmxLFC2eghq19j+hlkp5vrGX+68u0RjdD53KPIPYhXBWtlFw7mZR3+LoOsjjX2QzC9V9EGA3oGEQL/5vcP4vh5TxqswvLkSlt2Vc7aRluqKQsb2FRKd7Pe9duhGDF2gtiJr3GfsJGUhogfA6J5pu5KGVX4bjpyIAIRUVIY3EpidqwIrW/M1J31hotrrkQjuAagV6bh1owo70/TcRrZR/9wMtWZbbFBOeqJ2L/ok/zV1zijIQ5VS2IyceCARACaVhgFJ+5g0NSc0OOQj64HHxMXpDpXPhdE9FfCcKoo5337NvRCL4prc8IwYgrplXrmAULw2MObEEFL4WT1P8JRXgdCjd5xqRjCMxFU8yo1d9z6AEhsoQlD83T4RcYG3P3p4MAZacoY1Ybn23Pu6vBlIHJ5PQY= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: HuRB+JyVOYGX3UUhOkJJVd1Ip559U9wBsHVVd1OYA3fF8i3H4zZvGL14DMebBsc6xEBHn/OTQxVmpgNdAuxGm8kPuvkjjD3V/PlkgLkBZ3AnUinpiacQ0CzGvWroVeFghgkodKKMhnpQenYqpIreV3mspoGC6kGd1YjnTRvFt6xmMWPBJ320KwETpFfg3wc7qphSS9OhyvHAinYDnlNaVzkwKH3tH0L0KoFWEZhvnA9CAcUBN62cRfNgUvZZvLzQ7I7rP2HNd47+cmKO9ihtBq4rSzCnQ6bcPchdU3Cp23eCZpvogPS2+9M7ZZ/1XQXGFTkbjhLT6KtuhNNnexDHGzm3/RWp2+eozgoFRThJsjXONC1HMLhAJrOEOcypcLHy8/0Z8pZtqgw6WuumrGdjXXlNiIvyjFekVLiqwqpQ0uorWcAiMvZ9GrEvOlZ+Tkp+jIZiZ5GUuUAkZPOmF4PWSHuKjWMPj4Ybv+O/GUcSpzeL2HEBcpOkkZoRWYZQXqBu4aQWIFbhdjcgAjYX9IKYWPze2t9zF7j4VJrjwNAX7fwnwlna8+L8lbJO06V9e6D3hPb1FlgJ83I8T8l01k3jYbWh1d5Bye6Xty+Ndk5FRK984VCQSobBznhEJ2mgV3V6LPe8p4FGIzsX8JK/tbsBRCeAogUp/fyG6d+f1NZS9wYNJukM40fg4gAATH3dFCvYYEoCMHK9LBqtBSbr4EKhWrE1x2O2hyIlAdphNH8x6m3GJMrTYvfra4QxmlnQraeBHMIgsbZLnh18rmmQT4lngg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e00b02fe-23c7-42a0-19de-08dbd968823f X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2023 16:51:49.0286 (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: 5//AtTzsB/n6HLZLFRM0MHz7MKms0L+qWf75yVYoUDHIvCX4bcOY20dYH7Mg5aT2hKAzUkgrvU5epKwgrLigeA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR10MB6818 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-30_10,2023-10-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 adultscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310240000 definitions=main-2310300131 X-Proofpoint-GUID: dWlNjvAjxOt1gUMdpONKfiW4BCtBy0l- X-Proofpoint-ORIG-GUID: dWlNjvAjxOt1gUMdpONKfiW4BCtBy0l- 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: 1781200043954859988 X-GMAIL-MSGID: 1781200043954859988 [No changes from the RFC patch set] - cfi_sections_set is best set to true in cfi_dot_startproc (). Setting it to true again in other APIs (dot_cfi_endproc, dot_cfi_fde_data, and cfi_finish) is unnecessary. - move setting the global var all_cfi_sections into cfi_set_sections (). gas/ * dw2gencfi.c (cfi_set_sections): Set cfi_sections_set and cfi_sections here. (dot_cfi_startproc): Remove unnecessarily setting cfi_set_sections to true. (dot_cfi_endproc): Likewise. (dot_cfi_fde_data): Likewise. (cfi_finish): Likewise. --- gas/dw2gencfi.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c index f57479457c4..cbfee0a0169 100644 --- a/gas/dw2gencfi.c +++ b/gas/dw2gencfi.c @@ -492,6 +492,7 @@ cfi_set_return_column (unsigned regno) void cfi_set_sections (void) { + all_cfi_sections |= cfi_sections; frchain_now->frch_cfi_data->cur_fde_data->sections = all_cfi_sections; cfi_sections_set = true; } @@ -1309,9 +1310,8 @@ dot_cfi_startproc (int ignored ATTRIBUTE_UNUSED) } demand_empty_rest_of_line (); - cfi_sections_set = true; - all_cfi_sections |= cfi_sections; cfi_set_sections (); + frchain_now->frch_cfi_data->cur_cfa_offset = 0; if (!simple) tc_cfi_frame_initial_instructions (); @@ -1336,7 +1336,6 @@ dot_cfi_endproc (int ignored ATTRIBUTE_UNUSED) demand_empty_rest_of_line (); - cfi_sections_set = true; if ((cfi_sections & CFI_EMIT_target) != 0) tc_cfi_endproc (last_fde); } @@ -1418,7 +1417,6 @@ dot_cfi_fde_data (int ignored ATTRIBUTE_UNUSED) last_fde = frchain_now->frch_cfi_data->cur_fde_data; - cfi_sections_set = true; if ((cfi_sections & CFI_EMIT_target) != 0 || (cfi_sections & CFI_EMIT_eh_frame_compact) != 0) { @@ -2315,7 +2313,6 @@ cfi_finish (void) if (all_fde_data == 0) return; - cfi_sections_set = true; if ((all_cfi_sections & CFI_EMIT_eh_frame) != 0 || (all_cfi_sections & CFI_EMIT_eh_frame_compact) != 0) { @@ -2502,7 +2499,6 @@ cfi_finish (void) flag_traditional_format = save_flag_traditional_format; } - cfi_sections_set = true; /* Generate SFrame section if the user specifies: - the command line option to gas, or - .sframe in the .cfi_sections directive. */ @@ -2524,7 +2520,6 @@ cfi_finish (void) as_bad (_(".sframe not supported for target")); } - cfi_sections_set = true; if ((all_cfi_sections & CFI_EMIT_debug_frame) != 0) { int alignment = ffs (DWARF2_ADDR_SIZE (stdoutput)) - 1; From patchwork Mon Oct 30 16:51:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 159811 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2354422vqb; Mon, 30 Oct 2023 09:52:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFoq/k+dy28tO7v/QMb5qVjnz+uhw6xNVIxfrCa/xhrSA87ZzqzKbYYSTeqD87fOxMcZTxX X-Received: by 2002:ac8:5a47:0:b0:418:bd5:f674 with SMTP id o7-20020ac85a47000000b004180bd5f674mr13272478qta.23.1698684725943; Mon, 30 Oct 2023 09:52:05 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1698684725; cv=pass; d=google.com; s=arc-20160816; b=MgWHM5edzNIUq9L7UWnsR3VD/jgHC+BXz9fO0IqHj/O+1hJ95agRD0VW/lsiQfCsH3 Rmjqr82B0pynHYUfq87Fn7IUdsgl8Exueqvb8LTWSB6eNtdfuzL54Xhdo9UuVD/OLeIX Kndhzc3gMR1oJkMwiCPMkZOy7AQ0gBYHFG6hcqoBM+UgPJVJEFFCEMb2LtXXMbDorRMw fHKV61PeJU/lZhVfAuhlOu5Mp64LCzW0+LyU1l/aAyp+XHUUSeqtU/QsrDwUuaK2Jtzy mXYMWCpRVzfuSBeO9MzpfQNawYDe58SFYwIe3iQ8KUiOY0sMAlLfOu+ORCN0dVKccBi1 /WlQ== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version :content-transfer-encoding:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-signature:arc-filter :dmarc-filter:delivered-to; bh=N5AfjI96c65RU4D0irxbM2NU1bBhTENP4CfXqU3YGq0=; fh=Oh0rwXgL2pcS1FQHr6E1Hal1K7kVHmZXDthN47bNt4Q=; b=AL0J7u0ctKJVAV0ehBRcnSDVoSStDirE/fUApLA2nd02Ad9UEl2rmpyzbIqnf48pOP DThqb5Mmm+3PaCbwqH86xQgQMOXg/xrqq5zClKjQKdbJkanO6mDCQXKdBy64eTVif5YW 4EnOX9cxU4kMNh3rqzffffsGlT2yAbx0F5G2omCt+8XQgBAYwqT1qbxVC+4vtsMP3FJg KEqg+wVs/Nw/vvm7Sj39FyhfPWcGMYoinystc098oEiH1Q2DVgllW226iOp389hd2+uG XLs2CSDqikZJGQ3pjbwfxHFUepi8g9EKzdCgXvGA52pH8aFUxWWPn3fRE6cgFUx+ArrB /tsQ== ARC-Authentication-Results: i=3; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=dISP2EkL; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=wMeFF+Qb; arc=pass (i=2); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id g20-20020ac87d14000000b00419621a79d9si5893594qtb.667.2023.10.30.09.52.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 09:52:05 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=dISP2EkL; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=wMeFF+Qb; arc=pass (i=2); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (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 918783857722 for ; Mon, 30 Oct 2023 16:52:05 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 227A83857806 for ; Mon, 30 Oct 2023 16:51:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 227A83857806 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 227A83857806 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=1698684720; cv=pass; b=sRA3XRfQ0fSFDYU1fa+maDh8lLW2rffFO7yZJFnp8qaoAFEWcyoFSqu4/2RlEUCZ+r5HE5UXzQ5/dgEiLIzWlUCOxc4k8SkYUCMvUzZIQCjnoafw8OtPSWmpJtA0Xvq9lft/hoL/mc4EFa3gTOz7cnrB007jn/QMwJ+gQ2mkfkE= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1698684720; c=relaxed/simple; bh=n3S3mLigIm8jn6/wNL/JtKLau0ht/CTNVmOkwPBoqks=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=OojJiMf6dpTM5Ionsd9bdrwd12xwga32sYii222mFwsb9DHwJ7vTisBY25aDfjOwQfEiOL64H69K+ZScVN2quO05CVIHjDjwz3MXR3DPfbcH1jj5aZyB1dwTYjuuz4hDq/vBVbfKcIXj5AL4fGQazmjsF8jzm891Us6JUjCIwjA= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39UChxPN021209 for ; Mon, 30 Oct 2023 16:51:58 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=N5AfjI96c65RU4D0irxbM2NU1bBhTENP4CfXqU3YGq0=; b=dISP2EkLUULNxZnEJv2kuAERbF8AM00S1d0kyysermMFJFmmah3xk1jubc34gpsnZPgE hxG5uxiHa43uMS4rPaTJ7iKtkGbOuVbG+K7P7S7h0XYlBJqRKxS4LZGji+/I/f8qJScN HSakJdN4ZhrNGyq0Hc7biyqk306VUL3Hzsta2uZLZ8OWbBaT/0pLgRKyN1vvWMri6lcE tVMvC+CeijAT9kMK8uymF2/WuXvWv/OyoPZEsnWZd5B73nYNKMiGTzboS49e2pegF2MD rTm4SbnR1IA6yam6CrOCvaOID2/DcEgazrP6y72ACNRRRojf7Gf2+buZcVmMAb4a+VLt pA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3u0t6b36nm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 30 Oct 2023 16:51:58 +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 39UFcIr4020069 for ; Mon, 30 Oct 2023 16:51:57 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3u0rr4k7q0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 30 Oct 2023 16:51:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Np8MwLUquAzhWp3vEVgcxM/gpA2K+y4TAzkALfAp1OPloYK3aD9WDbtuWOKvOyFtCDqTC64jch/zxAnAjrvvY3uqMsrCMZmmCzJz2OAVHwm3LgXnatspL3u0O/DsZ73jyC0DRsVm3GMoEAkildrHl89MF/jiTbqv3JPd1ynWNw0kqKsgmLXTdZjpY6ZUULmnjQcrvghw5Lre9ofwbdWgfVIahaHeVdXET7OEJcip8OOm4eyVVo0U3cFwDU52gjCpTZASXGJtQVEmerfIXHEg2WdGGLDNj8rJxn+44t5/JEqjnF2ZeoMUmWUtmObhYewSep2Jc0mAi8Y9h3cvL6BWcw== 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=N5AfjI96c65RU4D0irxbM2NU1bBhTENP4CfXqU3YGq0=; b=FqeYU/Ke9NOQMfKHPjE6VD9cheTMKCmTPB7arQ7IMWTfCOgC0CWDHKobzPaBINseAjBcOZbY1cVQcF8i54lPNDhb3VkeOJdZSjTVA0Me9bk/hWaR1rQKQr9YmjWq2xMEEKjZQ0Q7iyoYaPgFGtkrnSJTCpaAzjo3594PiwSw0suQa233iWXxhhCeflkQQXCqgrJYJrgV7Viv85ow+u4ky5fwXAr5kP67RVbi8nYG+nwX5y9OGM6hksbpQ8eq9YRugqJbta0/tUnA+2Uhp6F2PoIRB1Vp87PbluRqUsS/Z+j6FzNXGCT26D8EpP3pFTN7mj+CumBdDJswI5PWQ7P0vA== 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=N5AfjI96c65RU4D0irxbM2NU1bBhTENP4CfXqU3YGq0=; b=wMeFF+QbpHpO200kKyPfeVPN/mWnO09bQaALmyz+Y3K0oFzZf8mFtLhlkVCC6l8/Mnog+F6NuVmoWnrDh4NjKR220Opc5fviXiIyzu76i3we0QGrUv9R2Z4teERYSFm34pPE56wvXeVKU78K9nukgUiWBoxu97Bt9LLn7T8hf9E= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by IA0PR10MB6818.namprd10.prod.outlook.com (2603:10b6:208:439::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.19; Mon, 30 Oct 2023 16:51: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; Mon, 30 Oct 2023 16:51:55 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH, V2 02/10] gas: dw2gencfi: use all_cfi_sections instead of cfi_sections Date: Mon, 30 Oct 2023 09:51:29 -0700 Message-ID: <20231030165137.2570939-3-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231030165137.2570939-1-indu.bhagat@oracle.com> References: <20231030165137.2570939-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MWH0EPF00056D08.namprd21.prod.outlook.com (2603:10b6:30f:fff2:0:1:0:8) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|IA0PR10MB6818:EE_ X-MS-Office365-Filtering-Correlation-Id: 92472565-1b35-42a5-7bf7-08dbd968856e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: C/FXkutm9BUo2Xj3XlHXBBh87DxbqvMrtUehziKxE0+ZJNrqhElpuukZJS36Eh0Pb+kLMvO1YM4iKU51OAtm5qrjF/Vrh7dctkEvzMW7O+xvKMCRcylYYGiSsBkP+n53+bLE2ijXL7gYhCVEmFzux8c0n8dET4zRCegHTHsijHaTfsoIlfy9RTvu7BSeE84XHCPj3mcEBaPh/eXAuWvaoUsFabTP9WAJArmMcxXl2habQ8cP6Y0iYc/zU3TKqTZcn1kW3JTmbHdx439iosY4QtRQZqUbm68fPGR4Yf8wcE9a8LB+wpFGj+CF51Zs+mijDanQfdovYKWvmfrtqpGieeicjST8tHncGAox3xQe+krWiFPj9jOnNhrGpF4Iwa9lBS2MHcp8BCpdLs0L7aGsb2xqPW+xOwppPPJiGZQpmhfgN5IvBv5JWxSLlNP0FITX7NNgfMiyBKWcK86S6s+K9+dbg5HTeTx8FxCwEj3plLdYuKVolMw3mjmjrChdkyIn3DuyXtyxRaZH/vRBNuNqxq91vGwh4Xt1XmjjvmC7eYpREOcDcfL3FaBcFcUz8EeN 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)(346002)(396003)(136003)(366004)(376002)(39860400002)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(83380400001)(8676002)(4326008)(8936002)(38100700002)(86362001)(2906002)(36756003)(44832011)(41300700001)(6512007)(6666004)(5660300002)(478600001)(6486002)(2616005)(316002)(6916009)(1076003)(66476007)(107886003)(66556008)(66946007)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dxh5zcF2xIKrhPUO0SQGuQquFBr9/6KJ3cSeAHsWKNIi6hUBLlmZ458wx/w5Dei5n/HK0iyFVQ9Q4HnnV4IfgsYnbF48w8moAsRUdOlP9jfscht9N23rMac8hJFPxMAprfET57iKgHYxuRQfLyjVsJwkH0EYq0v1i+Ty6xOUy6/oJhiCV+be6YIHSQgoMXHEjSyYAM/KU9rH6AgsOY5zrH7kytjssWF8s8oDEGXi17nsXLtUicXoAdMWHUc5DSHgc2DpCCGvDEaPYXTbdq4LjVK1qi8GZScU7p8/NpBQEupHcUOc9JCYFt81t4idm7LRTlDLmxSEURj/g0QU7Qm8NNr1mWyYv/jK4YU3otxD8Iy5/mH2iP2uaEVtjLQzqugtEFSaqhsmfCnrHYLkBaX3LaMMm3J/YnM9j3E1vfKLV+P35lVRCPhIRejbWvtJ8+5o8TwtOiwuwgdvVCg1ugeqKMl22keC/8AjDrGbQPOoMlzCjadbKZpbHA6rIC8Mndp6DCGXlpPbrB6lxI27XwtCKHS5h1UU6CtrlXWMvVaHwdMXmhBI4whXZPsMCq+37FIKruz5Mlyo2CKtgLQeBoaQs1iG6/lXEqu1yxWy6TjbCIU18lvly9Ej3RF93AoRXkhurf+oemLt7i0CiCZE7z4DNxFpykPoCl5SOkW5+WNvdVT+OkNjJsxhByiXZRrzQIoGVdfD/q9Rlh1Dc/Q9l9bQ1gx1aD+cWB3Kmff00YfqrqSc504fQS+byGcejF1D2wwglNMjfMHzejcUOw7N/Cinfsvp8w+RXmkhwgD0yiHXRHQnAnITljY86ZSzmmgysXOyVRw65qRUSoG2P5EtNgj9cSsVQU8G7x4p0XX9inA59wY8St/BFVdArutz4BST8TdRhiBwzy0Lh1EZbi6EQq3ymLXdnkG95CT6SpOXgJJUIhhUvrvGTG7iVOk4wTcDuQairagtOsCdJcgrWihVqvuzG+OrN0CxgkbniZvKXQ5Yrtaodask3lYDlSvLUXT/d+fiswj+6Yrz8Bp7uBmXJySDze0D9pG8OWfC6xUsmfUuDkMqBUPCL5glZHKPiQktBjHazmawcK5KBZFs9Er11GeNqoqzPWQPLCQK/e0uT61Y4Z+S8dGl3pdercvdQtHe9iEMBAE3RnkQTUqFINUBulzRj64z7li212U2y6RkAiL+utlxEC9lhtE7A5/nTw73a1Ai6ZCRz/6rCgltT8ywo+RijzxY0p66MJg75il57QwO2zF7dRbTgIItAdeDtwOkdJiEKUcIoZ6NyRGOh2RP4mx1R7wHU92Y0cH1SaASdUxsvXDBHuubiN/fgd6+5s0Pn8oP+uh6QrIa8Lzazk+lwgPGUsV2IWYmKu/51XeRvA3ti1S9Cvnj9zsAFxqaUE5TRmLKnOjdxMLAvw5WvDiO/3/1fm08y9jV42kaI58qxY5aRA3LjPXA6fjpYKWIXpzzpEybafuzqVROfMMAhQ+sqFOH35sBJuV/R6RcIhdlEBXkL2fe/OA54vS8FqNexRQS3+feEoNdOCRP0+MrVDi8c58Vlga5B2g1i2ym1yWtcewpqPa6pJxiKruDVtD/XeieLZ8EWlj8i4xLCsaUqcEgV4lacEf0i3srmAe2S5ma1AsNo8I= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: GNigtrItq9gKrtqPBoI2k7RxVFRO+9gJJcTYmeZmCGPHtbCuUIK4Wr7p0vLEitKIpoaTxVVb4GDppgJrAADeOnEl76bkZMXvt62NNvWcvkITClo5O/Ir7Pbv7IMDnOiF55Up8WdBW/462zUuNKndN7QMI9yYYswfiPWISeNvKhtTblgBi0KzzJCGG2cR7ZES2AEUqIf0uIzMHiF4iu+KT65rjKNqM7F39OEUk9lq0yQc/wAteFphiCgY0rNTvZTdLxJ2hDJf9vt3Gu3VS8IXNUAJgNbjewz96NQ1nK9A1X+Wn+TprAcfgfJ+y6vg6zwtFCw/o72HKnCyujmAqmeV3GJKbWCWvf2ZEJSM2F8KO9p0kN7jcYv2faKQ58c+HkNYW40aVH63Z2D70qKf8r6GBQWHW1pFraZ+rJiMasDE/vEcB1//fzgAuxhCPHAfubCPsi7cofFM8doeF800YpCS8W1S64Kmr80FOuheQESTi8GVjKDEcuVdnyx+UKjyEPJLAWAljEovRHALu86/z/P7PeuRg/nOxyv9wHRBLm80zIu87oynFUbjACO8oAsx8baKRwFsGo2foJsDfAQQA1jveFkK1l69KVl3K61Ms2iXKo9MGIF0ZvrSpDAIXEObS/aSIH1Dtq59xbfsrDBadBAsBWEzZAoiaQGbLYmILQWcCmCxqlBHirjLc0JVQtXdZNIqGR06+ul8bTz7qE6U9Vp8WYglUSy6GOqSz6DyETckTKakKMKgMgvVEPOPNTsxLPTYR6AAtMuTp48cmxVCWG7T5g== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 92472565-1b35-42a5-7bf7-08dbd968856e X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2023 16:51:55.0120 (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: F2nDhDdEcbWWHmn2uLVybn/sFWNylvk7WLmlKXV3OxKpUk5zsw9Cbj/0DsQ5zWgvFtZQbdEKGiqSQoJB96IFUQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR10MB6818 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-30_10,2023-10-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 spamscore=0 phishscore=0 adultscore=0 mlxlogscore=949 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310240000 definitions=main-2310300131 X-Proofpoint-GUID: mIe-nxJmskP0IbZMPDmV_wKYPTt-sYKs X-Proofpoint-ORIG-GUID: mIe-nxJmskP0IbZMPDmV_wKYPTt-sYKs 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: 1781200035403681975 X-GMAIL-MSGID: 1781200035403681975 [No changes from RFC patch set] The code in dw2gencfi.c was checking variable cfi_sections and all_cfi_sections seemingly randomly. Accessing all_cfi_sections seems to the correct variable to access. The data in cfi_sections has already been propagated to all_cfi_sections once cfi_dot_startproc () has been called. gas/ * dw2gencfi.c (dot_cfi_startproc): Use all_cfi_sections instead. (dot_cfi_endproc): Likewise. (dot_cfi_fde_data): Likewise. --- gas/dw2gencfi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c index cbfee0a0169..5fcfb373935 100644 --- a/gas/dw2gencfi.c +++ b/gas/dw2gencfi.c @@ -1316,7 +1316,7 @@ dot_cfi_startproc (int ignored ATTRIBUTE_UNUSED) if (!simple) tc_cfi_frame_initial_instructions (); - if ((cfi_sections & CFI_EMIT_target) != 0) + if ((all_cfi_sections & CFI_EMIT_target) != 0) tc_cfi_startproc (); } @@ -1336,7 +1336,7 @@ dot_cfi_endproc (int ignored ATTRIBUTE_UNUSED) demand_empty_rest_of_line (); - if ((cfi_sections & CFI_EMIT_target) != 0) + if ((all_cfi_sections & CFI_EMIT_target) != 0) tc_cfi_endproc (last_fde); } @@ -1417,8 +1417,8 @@ dot_cfi_fde_data (int ignored ATTRIBUTE_UNUSED) last_fde = frchain_now->frch_cfi_data->cur_fde_data; - if ((cfi_sections & CFI_EMIT_target) != 0 - || (cfi_sections & CFI_EMIT_eh_frame_compact) != 0) + if ((all_cfi_sections & CFI_EMIT_target) != 0 + || (all_cfi_sections & CFI_EMIT_eh_frame_compact) != 0) { struct cfi_escape_data *head, **tail, *e; int num_ops = 0; From patchwork Mon Oct 30 16:51:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 159812 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2354495vqb; Mon, 30 Oct 2023 09:52:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEWmWql5KUiQWDMR8vTAgh0oQXhizZp7NuG36ewLuT3ffa/Wcfefctr1R8eR8Jm1W2Fsgn2 X-Received: by 2002:a05:622a:199f:b0:419:8ec7:cfc6 with SMTP id u31-20020a05622a199f00b004198ec7cfc6mr13004356qtc.12.1698684734589; Mon, 30 Oct 2023 09:52:14 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1698684734; cv=pass; d=google.com; s=arc-20160816; b=fG4apTvWvYBIMRP/VfbdsG+Pa10Z4hAe3n6C0zW3bxNm0+8TtS6DGZiGNfyyKw0Ea1 9pnXHyezpuEbVPV/EEEmBr3K/qNiadXmj62xliSoKg4ExLUD+A53FjGzJNAoDSO61vhs EKkGYwGSoApx4kAqR8tuyFaxYVint69ZY1TzrgGtKB/yAr1G2fHoWjqWpajIVoTJyMco qxVoMhSE9vquWcevxzfBHDbZAY+Tdlv3HpTU9gbLJG+T5fJbN/EvDRDHHO4Xu7oMLLEu OMR8PecLWpLkxy9Ch7ub33tP5nanteCRBPMLykZN0uSy7rEErct8008JbDqmQ5OCqLIG FZNw== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version :content-transfer-encoding:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-signature:arc-filter :dmarc-filter:delivered-to; bh=0WcfVWS9SamCyF/291mtXaHfqSKYnh6F+uKw7Y+Lux8=; fh=Oh0rwXgL2pcS1FQHr6E1Hal1K7kVHmZXDthN47bNt4Q=; b=XMlYq+bNqf1LyLoVtXDvB0dRhObtdMCdg+ucfOZpHC9JfXm8RoIc71vm5Bv2HaTk6Q jilabSR9rqKo7QIp4N7PfIlerNVEsW85etIPkB2c9EY/479kBY/bApHQfxfV1trkirYF R9TtGiVvFx+M5TKNLCEv4OFSj+fy5EX7TjcGOWmUg+Mk6WKowNUe+BpnUZKX8IezYLrH zYFTe2iFtnSaeDuLrCHVBGE3hT4Up233ke4PbKVCPiEnS3Gueh3hTURHDPg+minSyX+l +n+9WXuEy4iuU3GBRgvzYK7x5x7o6+DiN+gw3/el+yVuwidduTQm8VXw/x03NgqXNzNS BWLQ== ARC-Authentication-Results: i=3; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=qfHC1bG7; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=PEg+aFPU; arc=pass (i=2); 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id r13-20020a05622a034d00b0040f2b1cde26si5952151qtw.590.2023.10.30.09.52.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 09:52:14 -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=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=qfHC1bG7; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=PEg+aFPU; arc=pass (i=2); 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=pass (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 4E99E3857C5A for ; Mon, 30 Oct 2023 16:52:10 +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 1DFC7385734F for ; Mon, 30 Oct 2023 16:52:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1DFC7385734F 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 1DFC7385734F 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=1698684725; cv=pass; b=Z8+D6ONzyHe+vwhNSruWmxFGYZdcPf3cHSMu10WiY3rYHEeNKHr5d6SkXwIuwXDE2T8BAo4/a1Z5oBJLZO5oKfcYFbZKjHdvvL1MDJYfiVsAiGSLKUWYxd/I3b2JJRkMJhsao04MrzUAloeMeJrYrdNtik5iGyvksdn0MKuPWT4= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1698684725; c=relaxed/simple; bh=ZoN8w4bhZi193pN3BpPshsSlizfnjJfeKfXeSORg59k=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=TRFRnPa3bV/qEYhoQxEOhZztGB6G5yl0/vLjD+YqbyMLA09JWHuUH17rWc8aRyMG7INHs71VXp0WIVwj7CUTL29qko6z1zpOQwby2xduQKm843MERqoNQAuIoKMrpEJAxJObkmeNDRoQ3hhKiR++LormS9EHPb2V0r+uTHqpoaI= 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 39UEKXj6013289 for ; Mon, 30 Oct 2023 16:52:03 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=0WcfVWS9SamCyF/291mtXaHfqSKYnh6F+uKw7Y+Lux8=; b=qfHC1bG7Omrq7NEqBl40NCvzn4DZDqOD/YzBr55JATNGR3MJcgDamb8BFDmXgTkYxlK3 401269qFUKhXWzBZlkHoBljImPdefJT8M5FuTGw5dE/kNlyHJ53/ue/+jpXsYe3JT2y6 fERh/9nbPGYXoojZ8uKi3aPmCz1rqnPFwkAz1VcHRWZzNk65b0X5/+I3Dl5cTX6GS+Fb 5pX2YBXxQ0PcmY6itveawPnedVyc/JvQqGbZncVbUFdx0F3PA18oLnBq2zJMiozr4wFS YfsznHRrhqH9tPVKwizx31RFluRb8A8RBhLNFQDHWZPF23I/H8RYcogroY9T69XO4XOm lw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3u0tbdk5xc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 30 Oct 2023 16:52:03 +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 39UFdIuo009146 for ; Mon, 30 Oct 2023 16:52:02 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3u14x4d9w7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 30 Oct 2023 16:52:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yl7YJBhOLoq4rkyfrnby5/0+X2KvuE0v72J4JvbeeoNQ3gMAhEab3bNFKmk8ngy0YKOCoezs179RpPhO9zLa10t/L8O8ll/doOyLUVuJj5Sx6IMmDPuij4xApCNHVE/ncl72IJ4tRYz0mALu8q0MJFUnXGTxPAqvQYrAqcvHutFAwqZkApvv/ctSkvEgagynTztvuNsI38DMz4dKxp6XH7hUcGbz3TsJjEwh5CHS9sbwRWVQfs3MftXMlEptLf3i3ddyi99c36gIsqS7RZcrOwl2ywUpkOINomwfZjt4zg1/BvKj0ovrx8mjeRsjcrbbqAVLD7ta/MjOf1XVQMK0iw== 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=0WcfVWS9SamCyF/291mtXaHfqSKYnh6F+uKw7Y+Lux8=; b=Yc+ES1xuX5JFjs7/71jJVMHxtklHgmqT3GF61sA8Rea2OuVDAgaxDnWALoyE7kkEtWjwgKra+t+8xfikxKV2OR5qcnWDPzzaKlAWuT3rfsIi1qlnqnVLE/O4FJlh7iH+6aDWo3nY7VsRHOVYZHR7ha+uKa6z0rMiKcKQmbpYlbz+v4KUUfJw39wHlbuhSktc8ZwfYkn1LTg0ub2gmyOiHUqmVksa+Z0odqdHedPF42fF8WZfHJ8YwjcE2wsj9Kb69coNxaDYxWcFz3iulTZaz8x8JBxMYealq6WZcUltBI+c41u8/D6ixyXB3pOqt6ASfMgWUT+wWjBE+yIJ3f91gg== 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=0WcfVWS9SamCyF/291mtXaHfqSKYnh6F+uKw7Y+Lux8=; b=PEg+aFPUTeRaofbZGdBxdpjEV56Nd2JW0zdvTRRClViHBog7nynlJsVMQIzDHA4DAHFRViF5CmYpn7rgQTqab8o+9vXg3Gnf3Meg320VLguN70t4TpH6I6DmMXJ0vtbEq4kjJrTK5taFeMXruzeUF1J16kfJQBkYelKl4f96HVc= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by IA0PR10MB6818.namprd10.prod.outlook.com (2603:10b6:208:439::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.19; Mon, 30 Oct 2023 16:52:00 +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; Mon, 30 Oct 2023 16:52:00 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH, V2 03/10] gas: dw2gencfi: expose a new cfi_set_last_fde API Date: Mon, 30 Oct 2023 09:51:30 -0700 Message-ID: <20231030165137.2570939-4-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231030165137.2570939-1-indu.bhagat@oracle.com> References: <20231030165137.2570939-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4P220CA0014.NAMP220.PROD.OUTLOOK.COM (2603:10b6:303:115::19) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|IA0PR10MB6818:EE_ X-MS-Office365-Filtering-Correlation-Id: 65025b20-550f-4496-a172-08dbd96888c1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gCsM3YaTVcaabREDu5u19f2wAfwPqyZMoXW9UcR5ogp9CzxQzHnNH+UnLRBjPiZ2IBP4YcnUeoT+hKorT62ySHcSu5kf9PeLATELd1iyaww7BPPRhzl9EzXqWzb2lMPGWshw3Qpisb8jHytuPhmeALPgKHvyN3YXrKt6ybQUB9o+HAdSYSHicUsLQ3tuKf5wHio2UFpW7nd/I/dIxS0Kw79F3NVOWEVuFDKt/sXAR4wfv/l2GMy68B80xIH/Dib3l82vOxe8yMPxrcRMcy54RRi2v5G6HePoVF3iSYmqgQGKDBB8Ay8vmvEkLehrVAemjXDpXh1/wX9bOpyIcnnXiSypHGgtrN8lAKrR7ETyqqEOm7tX+v2zRZkR8lkFrZvTbtXOloOevPi6lVJn03qiDgNd1xvqqhs72MNxEKRcaqqJEeNLSqIFM/1qGMzf93lsIAxMMO38P1eyvCZlBQrgbpJerk9m0dP5ve1xQw79+5RkiJth8R4/w8gq2D8GCnkNLVVerKgZUw89w37J7kArGUD2U6s7XkVsJfXgBiIvwNq7Dz/o2k2Tk5enw3jFgSIp 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)(346002)(396003)(136003)(366004)(376002)(39860400002)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(83380400001)(8676002)(4326008)(8936002)(38100700002)(86362001)(2906002)(36756003)(44832011)(41300700001)(6512007)(6666004)(5660300002)(478600001)(6486002)(2616005)(316002)(6916009)(1076003)(66476007)(107886003)(66556008)(66946007)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RQNitpLC9WwwwsCF+wOSIuTF13bXT+9HXvID56FUwseZmupkQu9LLiwJiDF+Cs3jQgAz/amj+st+et+E2lFThoZgvwE3+qABxx+i58iZfST8eyrPq+AEmoyJXBoTFE4m6yoi1vmIZwy4UR1wkKDE/8Ri7l8Q9I5VOOXiTGANONxRaUkrGI0FAg7EiExh/euSFBHVAzrUjnsMBIYNqcwXzjN8wuy8ECPD0E5kYJYXVSHMKtGPiuHgyKRUaVYrt91JZ7nyaTBV3jbG3kHUO+qMIwO7ld6ikRJsOWpIy8De/CGnnNxg/Mp66B2XA22q6BpKnaWCEB09njP9qvATGbKN7Hc3C/6mD5eODNVAZnmbkQh/XnG3iv3CfPFtrzUhrgy36bIp/rCoWvDvu7LjcAnVuxUCsauwc0IqYolaQBj62ByX9upt8uxw8yVKH6zYIjEdNcGgrDACy14FBhH9GhHGNiZniGZnHzx/hzAnEtZGDMnm26kssAfKvyECmf/KxpXkCnsyjVOqVAvWSNFJJ8qPgrJF2wKeExuFFuw5/87vXbvlu3ZQs7LhUFCLEZMLqwXJPH9bzoyhdh+zbK2tiO+UTwHsCvYWrL8C/GmmVNUuUIyqit/6/JFBdLQOfRA46KdEJpZHDxU+yPFcKOLjCCeTX5ppZ6LqNfYtIORJoil8lP5u7vfcEPu/aVKuy6BMC+xyIKxkaHuiELVK/XJf1lUokG5R4V3kJwQ4G8gyR0vy3g9a7KxeHR9oKLIdhha1nj9qhLhm3Tw5Ba0BbHsb2hnfAy8BgkTqmI6DuIY6IkErGvrJ5x819sSi8RRMjZje5d9+nvf//elI2++FFc9o5WHdXe335Ll0gqT51UnWuvM09LjxRrezm5VG0oV18zioBjUNcfLkkzvokfxlOwpW38AkVLI0LS/ABu57hapQLzT1QE9XaROhGrHmDYfqaoSTdK2UycWb/0KZoV81dlHcivWC6Dy/Blw1vLkl/Lg4ywN2drVosVPaUA3x6fz8BQVm8zWlbqFKoz9BgX+qZTzI3F9OUnuteCZHLXuCl5QMUp63WMxoUerrJpr6IyCiI7Txc7MSrCrZ8EDjyp/Tdxs8tNDKjEvkpJLejszcGS4B6pvmDZnqShHuW2jDulU8eMhTa3r1a6sh2nFmWrP4P+LsdOlN1leeISXJTZv9IpCsGT724p0OPO+pzbgcvmUXkL52slpCSPSbuuuJUXaHhlVIZ11/JZld5yeEVIb4B5diilIz4eNxzRzAOuCoAtV2uzpvuoe1LUmz1H5CT6fky+aG4n/P8onLmFRE7JyM9tNrDK4naqX/LEFwn2IPDbLTY8kE5nmOFYBZsdQNdd6TMLNaklNgdGJI1seVA7aRgoftgpHCQuVJmkWIC8BLVFM90tsR+CXlIIwCHr0CUWc0a27ruNYxLp6QxWgOklBR9MKEsETDWU4Hcbof+gYZjqJn7oaV3TYY4y4xdyy82hsHytLsxDjXKmwjtA1lcgnHGB1v9jg8UVdOuj/mcKGlqtJN2yAHCpHklSYX6KizDFVhMsVsJwRY7ss6SExJ88PS6/CWrnEy9Hg0xhiHFUzTIZU31f40XFudMeKSgBk5Kxki5HglIVphOHut2sLh3YOkcL1b7D+paUs= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: HJY46v87wbuLLc4IAYi2qt2p1w8qpsiMifZpbuAO1bMX6kk7BWrG0HEVF3czNol55nxLpm5jmggqzr1Gq25juIelyt2biFl7d0wR/wNHfxODOcN5BbpYZahtfZDNhewDCwzSPX4TL7QM6uRtt3hgJ9xi/drlvDCcC+KgcP3+uTvWpPzuQnaSsaz0SRPmueEt5W1pwhMyvEVqP5lp6592n1/SitTTYOuhjVltJJBUnPGnC2tMDRxblZFZwiEsyKVHWHtkvlOp+aGV7Arsr9/pVIcAJuxmYy2jy61y3n4PteFNGxCfXHY+kuN/EojbeP8dQ98DX2wAfy9V+ZeVxjYjf/GPSHPaSLdgAEFMOXVSrZJqZIm5UY+EDBURvyjfp/y9Tm1Vy/Fg6h00Wx3ralpklV7L7uKw/l22b+gvPrtVsLLBStKh8OdwFTvCqO2IHh/uQ7dmJXqmyawTUq489vBADkFaHyk8fM8dYRP4hHN2tWkM8wU6MiQ3HPqNKUwDVTZZytcgRqUqQ3fUwPJAANwJbLchaimL0dZ1+6Us+BheKCnFVtEsYI4io6NYqP3dI7FzghoLtTqHKEE7HQfdDv6wEPspGv3rDFRWD787k0xiA3tBM8ReEg5E9OL0Syrthz4ZCOPN5TnEmLINzAqyNj0oKOZVLoEdYSgus4YXj8pNyAq2VjsnUPTgkodXkYLb71bG75bqeFYGmuoMwyN6k0MUGEz5oCTQMSxO/6mZN9jvbk12LP4tNHK3y9C6qYw0+j/Q+pEYQjoEalFuxJ8IIuWGkA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 65025b20-550f-4496-a172-08dbd96888c1 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2023 16:51:59.9531 (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: b3DcPw1SSYQObUbdICgGPYFC6C3ubQ/SqsfYc5IyVafQiaaeyvI2zNQmZyto4TuaDbA7OtJUOppuV7JfbJHJrQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR10MB6818 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-30_10,2023-10-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 mlxscore=0 suspectscore=0 mlxlogscore=995 bulkscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310240000 definitions=main-2310300131 X-Proofpoint-GUID: S8kwiLOtaCwzjzxcK7jbHlUu2klS4Vh1 X-Proofpoint-ORIG-GUID: S8kwiLOtaCwzjzxcK7jbHlUu2klS4Vh1 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: 1781200044350218802 X-GMAIL-MSGID: 1781200044350218802 [No changes from the RFC patch set] gas/ * dw2gencfi.c (cfi_set_last_fde): New definition. (dot_cfi_endproc): Use it. (dot_cfi_fde_data): Likewise. (dot_cfi_inline_lsda): Likewise. * dw2gencfi.h (struct fde_entry): New declaration. (cfi_set_last_fde): Likewise. --- gas/dw2gencfi.c | 13 ++++++++++--- gas/dw2gencfi.h | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c index 5fcfb373935..a69854ddc0c 100644 --- a/gas/dw2gencfi.c +++ b/gas/dw2gencfi.c @@ -481,6 +481,13 @@ cfi_end_fde (symbolS *label) frchain_now->frch_cfi_data = NULL; } +/* Set the last FDE .*/ +void +cfi_set_last_fde (struct fde_entry *fde) +{ + last_fde = fde; +} + /* Set the return column for the current FDE. */ void @@ -1330,7 +1337,7 @@ dot_cfi_endproc (int ignored ATTRIBUTE_UNUSED) return; } - last_fde = frchain_now->frch_cfi_data->cur_fde_data; + cfi_set_last_fde (frchain_now->frch_cfi_data->cur_fde_data); cfi_end_fde (symbol_temp_new_now ()); @@ -1415,7 +1422,7 @@ dot_cfi_fde_data (int ignored ATTRIBUTE_UNUSED) return; } - last_fde = frchain_now->frch_cfi_data->cur_fde_data; + cfi_set_last_fde (frchain_now->frch_cfi_data->cur_fde_data); if ((all_cfi_sections & CFI_EMIT_target) != 0 || (all_cfi_sections & CFI_EMIT_eh_frame_compact) != 0) @@ -1568,7 +1575,7 @@ dot_cfi_inline_lsda (int ignored ATTRIBUTE_UNUSED) if (last_fde->eh_header_type == EH_COMPACT_HAS_LSDA) output_compact_unwind_data (last_fde, align); - last_fde = NULL; + cfi_set_last_fde (NULL); return; } diff --git a/gas/dw2gencfi.h b/gas/dw2gencfi.h index 962fdcaed17..aa8693df342 100644 --- a/gas/dw2gencfi.h +++ b/gas/dw2gencfi.h @@ -25,6 +25,7 @@ #include "dwarf2.h" struct symbol; +struct fde_entry; extern const pseudo_typeS cfi_pseudo_table[]; @@ -35,6 +36,7 @@ extern void cfi_finish (void); /* Entry points for backends to add unwind information. */ extern void cfi_new_fde (struct symbol *); extern void cfi_end_fde (struct symbol *); +extern void cfi_set_last_fde (struct fde_entry *fde); extern void cfi_set_return_column (unsigned); extern void cfi_set_sections (void); extern void cfi_add_advance_loc (struct symbol *); From patchwork Mon Oct 30 16:51:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 159816 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2355146vqb; Mon, 30 Oct 2023 09:53:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IELdT4koafB0NANOH1ckiWWOqMdhdriVczgQIBieEXAMztN6OwQL71ptzNI2Z+4SKuWVvtJ X-Received: by 2002:ac8:5c09:0:b0:41e:204b:f953 with SMTP id i9-20020ac85c09000000b0041e204bf953mr12537423qti.64.1698684809476; Mon, 30 Oct 2023 09:53:29 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1698684809; cv=pass; d=google.com; s=arc-20160816; b=n5TYw1//Jgya9gJBS6AzpjNCRPlv60hR31y9TJbI0Y3cJRoezXoNX8FRpzaqTftD4i 4IPEhmSseVLkv412psi8K6Z/k3wBcg8OJ1BeXvMAkYKvai274w397JOY1JD1EDNqGxnN PDuQUfc+UmYormiSzQ4naRPD+r7Hs8vanIeQnH3DQx5rLpYeKreJ8mEdSXDhQTA7Xf7t 6FezKx5JIMwh7uZcytw5Y1PiX/8GcdjIIn6gCIFwYNmL0vbi/TYFDnkY8mFYYRImctGY xbHUGgUH9xNh52YWRZh751RPGbgMqqKFJGm80i782EdZ/qB0rwB0VxhAFSGkg/9ppeIu wQAg== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version :content-transfer-encoding:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-signature:arc-filter :dmarc-filter:delivered-to; bh=TYYJ9arC1i5yqjmXU9/5uMQGetpCXonfaRf6x4SmcA0=; fh=Oh0rwXgL2pcS1FQHr6E1Hal1K7kVHmZXDthN47bNt4Q=; b=ya+2mU6A0yFNqmcFa7mQTeN88Ag9FpDTvnAlkbK2IJHQ46Ea0Wv1CP4PZ8oebZw+ry vHqvDEHqW0WKwhpj6GZEFfKxYN7jIgjC6qFEBa4RPeHDz0cINlTRneguBGl2z9x53rHA 5sBIGOd8Tk6CU89v3dvfvYKUZahXu+V91Ws3Q96k2dBmMRUpPJ8nUt4wuoIUiBDdV0gB 7YtPL5REL/WLtNnE9S4NR0x6apUxnpurj1x7PsdOJbZxMxmT2ovpP3yHF/avk92rDF/1 NaatCzKp9PV3hVyb6z5fWlNj4lHJ7dc51kSwpH7hbm5MVJkgdS7BG1DgTN5vKjxEx/bG qVaw== ARC-Authentication-Results: i=3; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=e+uL7HsT; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="OAEdUqP/"; arc=pass (i=2); 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id s19-20020a05622a179300b004035dadf9f5si6043750qtk.700.2023.10.30.09.53.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 09:53:29 -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=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=e+uL7HsT; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="OAEdUqP/"; arc=pass (i=2); 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=pass (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 4EDD33831E2E for ; Mon, 30 Oct 2023 16:52:48 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 8FCDB385B53C for ; Mon, 30 Oct 2023 16:52:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8FCDB385B53C 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 8FCDB385B53C 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=1698684730; cv=pass; b=C/SjyFHdYzIo82cc9t4VfKhetJiMdSiV2+IilfzRvn+oJlSBa5eh989sh+dp41HuBQC1xRKtykxs05Pk47dOjPnW0l4X8yhbQr/9oYCvERpbBJIkaG8xrrK84RlSH6OfPJTUlLQO7YN4elaxh+uul3FJl2CfMNuhB6lrKAWehgE= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1698684730; c=relaxed/simple; bh=6K8JKVuX+SCZI9ms5V3fXQQfH/pS04uq30XbKnLcaX8=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=ci+w9ovSJy2ChECG9ZV1MDNgWmHq1bkS3piZwrEAb7RiaRA4Dz9IyFClJa4CK8kMM17CVY23EVQd6+sGSIK8tUb52ciBO4SIlY89TujlB+zF3OuRNrw/eV7LpHtThgj7OE5Ff9QXHJSlmVaAczNuBCxecRQU57CpKg9WRmHNkaU= 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 39UDkwrU002791 for ; Mon, 30 Oct 2023 16:52:08 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=TYYJ9arC1i5yqjmXU9/5uMQGetpCXonfaRf6x4SmcA0=; b=e+uL7HsTKV3c4IWcaR7Wbk4+wMbCbxHHnO5jBWWGEBORxbG6TuB413bQqRgMscVSzrzr CG6wnqzf2e80apxpV+01zEaMEX+CKmgbNCz7VaDtaVmx+RUWvOQlfmyQShsUYv/EeLUw vL3QOmn3poY6HPm5zYcnBnPEJOwHSwGWyetsI733VcW3G9p5xs5PYGzwT2KC0qAvipct 9t1FlYDAPTOyJsigbJXjE9pgVFSdDygLabitGL6gRMk5kzGVfqWXTsrSHwQPU5vk4J31 CtVAHHwQUcwbkc3Yne7y2AqshOntWM3RqmCJQ+ahUVkvmY0zOHlOJi99v8/9mKueYQ+g TQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3u0tuub685-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 30 Oct 2023 16:52:08 +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 39UFZqCt020137 for ; Mon, 30 Oct 2023 16:52:07 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3u0rr4k802-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 30 Oct 2023 16:52:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gGwj+szQhW2xmssTlNC2BbutRZGbtk2MhCIX8qX/O0dFYJp6N9yNMBdHn3pUdCKeXgnW6SkDfY+uEXLgDxdSo/O1Zksc4GgPwWafbkZE0PT45uoNZg43V9vzm3kFXeD+YB2TXPxz5SQCr6eJnQEOthZfWX6aBuk5VMTV7nVXhbVUW97lbiVqpAPBCFydmUTtFiBqb8UyskQcCAVizpKiZ3MaXJ2HS7bK3KS+MB48+2vjlCXnu1hlwVHi6e7zmRRfOyptspzd8nI760frmmQjkljTaQPkEJuj1OGtxC3rM2IYDU08Wb/U/1lin+wHmZA/8bQnB9bW6+qtgQhsQh89Tw== 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=TYYJ9arC1i5yqjmXU9/5uMQGetpCXonfaRf6x4SmcA0=; b=Q/HNxNYujcPVLzH0MsWO+v/cUol77mJ2a5UYYAxgb/HANgMOB1YX6Dsnx8G9i2mhZvW1ltempapIIMUYSLAlbfyQFMHxDKTass6F98TuF0DykuqsYMjSr0R1fGBmQkMlxm1C//bE1pb0GyUlJP99au3V/sTRQpjh3MazIkj0BEYVUOz8WQjhGcOfsq7yZg9sjgbsa+4j+3ygVLp88/pcH98A+s87hSIuzIWBx9AQRk0UkhhUo0NR1Y+fqhLnaUK1/TQUqBrDeB0jiGzBqRBJ/+xti4kEaPCXBclP5Ae05IDt9tkCFlW532YwPL5d4XhDbWip4+geBXT6zl9XZHETRw== 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=TYYJ9arC1i5yqjmXU9/5uMQGetpCXonfaRf6x4SmcA0=; b=OAEdUqP/YsACLXmPDDAljsQ0EQKjN6tFr4dbLFawzoeMVaQCzU7DuWB3CwGudUxd+kmhq13eYhEz99S/HNrfxPlmi2Qx6feaR6jB5uxUHRz/qw/QJR3sH6KbHS1Wf5hjlro9AJzK6CddK1nSPdrNawHV4cad93RBiT61jzPnlOA= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by IA0PR10MB6818.namprd10.prod.outlook.com (2603:10b6:208:439::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.19; Mon, 30 Oct 2023 16:52:05 +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; Mon, 30 Oct 2023 16:52:05 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH, V2 04/10] gas: dw2gencfi: move some tc_* defines to the header file Date: Mon, 30 Oct 2023 09:51:31 -0700 Message-ID: <20231030165137.2570939-5-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231030165137.2570939-1-indu.bhagat@oracle.com> References: <20231030165137.2570939-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR03CA0114.namprd03.prod.outlook.com (2603:10b6:303:b7::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_|IA0PR10MB6818:EE_ X-MS-Office365-Filtering-Correlation-Id: 465a6bcf-2bc4-42e3-cb37-08dbd9688bb7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AbCsLidNYmzBmbOq33qosgN2L/AYACQfyvZfw6SfaguOn1y2HVCIQW3I0tCxXM1ErWJ39fj0afVcTkBHo1fOUMPxrzDxvVQm7dlET5l5Dflk9T+FxU+3on3JMLBNTzg3DQBBZku92Zu5hnRm6zC5jQnt1SfVFjF/DirnQ+3iOZ4V0lE5F2djuqS1JDWqYbjhUrVoGnOnKQvRV0U63pYlpj6c3XtcwSnJCk++T3kJe5Nk9zZB+13mbnPP7K+OXZmWi/Yzf4++/PvoLr1dyfdjqoNHRH0HeFDO6rzQAojhllGegqcDWP8/ivNVKPplsTZbtW5+XMR0GBjHK1tE7flmWOxKglbUDzfUEmhAikihnMRW4Qzd7J3nval2Te/4a2Z3AyJuVqNEqk5bXO8RXIdThPrq+EkEzRxKgLsHm3X8VU4gc9l8at/XhBVEPOXMnLASH8KquDnNJRkRnT8btLdn9idE8AOcfu0CyMFo3IRyIS9IpO2p/s8I/ap3G7DyBzDtVtoK2Jt8R7wz19ew027V3FRJE1UzhDxQPvav/HiyZQTq0vCp6t6VgHjVWiHAfnqD 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)(346002)(396003)(136003)(366004)(376002)(39860400002)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(83380400001)(8676002)(4326008)(8936002)(38100700002)(86362001)(2906002)(36756003)(44832011)(41300700001)(6512007)(6666004)(5660300002)(478600001)(6486002)(2616005)(316002)(6916009)(1076003)(66476007)(107886003)(66556008)(66946007)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WaxyREc4oeNOHDhEn6NhlKENbk/WI0BFy6wwRX29nkHxzGXL1hajeIZG7IRmZrIIH5aEkfbzlt9zN0bAAe1/8gviXkkn2/toaqyFw8jwVzobSNbjjZhB3QSfiSWXVJxlR89RrZaWIEcUVYMn/k28x2ZYEgXnJ90/JhxdnWENEMwu+jtZztiOnm9NauJM/XQPwlH9xZyh6ayKY/YnDRusJMIFjGoTE9XU+MrKarwGVy+A3pUyE6RvolZ9m6Gv9vSdVs3HmR8LUccZRiRq3emTUgL50FJGbnMqip/5bSSXJGhlIOd1oz04oIN4lOxaOFAXoA7Qg8QecamnXJbi08HUSpp/NyZS3Gl+0sTWqSdvbVIqynnDHiGgpNTKlCUOze6tAhlc7mqCqtxGEgwIPT5t8wGXjP/4oGYVaDGwUz1ebNTx7REN+d/UtzYuI+p3JEc8LRD/vPXFSLlSrjG6xb/RDG2jP4836G7yZny01nH2jq5lX2V/0Ln9KEDA9OWqFZvWLflv+tAeGjalTM1PfIwRj5IHX4PW0/IuNvriv6JT/jcVPvPQldAPwufwWGTzolCqAvTC4hYsrF/qlb1TpF3KaSu2tuwNeBOwL6lbzqe2xGSGFkdD+Q7p93Ry2QfMFNHeLroJWhPTex/vyhLB1+sjNyT/kVep+VXZBvspNumaEWN7tbJo9cF5yGFXDVH6ohosguYyL+8ZCxLoQocUIr+emvx9Mbrzlcy67ib6d/DYqhPsSryfrrSBE4sJOqBLA2qHPM7zz2VRGodmZsLWIax8PkVHPJm2jffRbe9TTY1y7DKQgngS2a81C6cJqeSSxDERx4I060HQozfC9bFnzCDBUJ1uEL+nNxpqY5VyvnWuKIyr1gapPkFUWvZ+RybIz5oWq/pv4Ed2J7jbh33UU5JiZZiUhHid7ecSimHud+Oe3N2xQGkEyS+TqpY7lzqwk79TCQHfHORJkf8doVN6Qa6PXp3Is5MJaGyBTH656Nt/rwaB3O4aYRXt3xraeN62hp25JVaqFncAPXxeAulBa1XbalijF3od9bZLC+N3KtnfsWyTuUEH6e0xQW81d7Q5pqIWXoshz9F3Tab6EI9kc2hpp8dmNc079Wn3k+rmXhtLcf6J+Ej15jCcKyvkrjSbFrSl1t35ysZGmOkebchnbs4MB/fE3+/jmyVWQFy2csSvDgPukbeuaGmIow2UNsTsQNo5kENWu6klp/ESNemNBBoa41EsmyIf68oaaJFV8valr8skM5A0PACk7oBGXqyGAavmjfkQkYFnHIdNcQ4HqXw/Etaj00y8MQ9u9tTmocbUQPPmlCxXUS8F0VhUizGUuqdEmYXNXxI45ZGYYB+tX7SF/sD737ed2myL9OeydAp3Vym5s71t/b200AI5dwOSBNqrPEkhGhweJZCYekO228jU7ENI7+et9PuSxvO0NwQvjZorQQcMjNq+WNHblXp9B7CA0ShyNMvbhkS75ihyu5BBi+0XbI3K/CWeJTf4aUQ79aPaeiDiMuOdUnLktLchviUlaX82VTknP3iiZgbwFQSVjDf9EK2XRmc6OHMcH34vyz2onx5YVDStHWejM07/gvfB4l7nIiwQwXtNrV95FSRfp6QGUypeteCrxs9J8UP6lvM= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: RvmhYVTj11qp+1T/PF5f5fM/TzDG85Drk3/XOVDUqoTjPoD/zRWEfwKqGZ0rzFYvxFnGbZFpZ+MPgD8xmb5LH3sIydeoHoeMKfYysIx7LQsAiY5wxXnJcXp8dBl75SSXY0AYP/JCF0b7AjOVn1H7foNFu8QyV9UXAM6PSste4DTYBG94C4MxA3UlKGZqLkrbznBFNZhhP9GFo6ZY6TJA631aFZErMAb3kSw1fjqHtVz+L3q8E9rBeQdgAxMBFgGex51/QLXQUfu+sIaAzhnm8P7EG8lIaWKIP4SZbOYkJNldICyt0DCZNZgTga73OSFo9SGxecKw/M8gInG2cxeGcDg/87EEbtOmHep5cQn7JNvI0h0Q7BOg06GR7yWxBrphBz/jImGQW+3i7/68PtBx1sFaLmokqqv2SrLO49m7KL/0+KAX9ulAYlm5ARpIj4fHShXrTWNnZjJySxN4yrQFykRMgZFSbdXcSug/mYvlzFAcEZT0KkUYXoi3v4FDuyQiIYG6g3gbBV0W0xCTeJabkf4UjdoTYeH3nRTq9y4lKyCZHY2It916ijgoOvw4bDXZ57jqXsmx8jMTu54a1F9AxfJEtCVyamRmIUyPZf3wOfSuJxyn8PZGlcsASNHcwsQg0KULA8Zb7UNranMNrWgR3ALACW34pcJMmWwuTzDhYSp9i1HGk/WPOWw9DPR0UU+BMCiWKFFUQ5wOR5+3+2uvXG25e+EMT6xj+pwONxtof1Est05AN1BizHs6lsyE7tQ/f35YIZsvS6jryI2NBUczAA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 465a6bcf-2bc4-42e3-cb37-08dbd9688bb7 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2023 16:52:04.9093 (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: haA+zUD7DFmWLFop/skk6urVH0M99TGKon0aW+baHDFWLdFOEj5kbLct+XWF+F+vEwm8n15HT1FDO/Kj9m9BFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR10MB6818 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-30_10,2023-10-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 spamscore=0 phishscore=0 adultscore=0 mlxlogscore=965 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310240000 definitions=main-2310300131 X-Proofpoint-GUID: iuZ4dyaeM4juix46F1BEQJmAhzbhOySm X-Proofpoint-ORIG-GUID: iuZ4dyaeM4juix46F1BEQJmAhzbhOySm 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: 1781200122741044042 X-GMAIL-MSGID: 1781200122741044042 [No changes from the RFC patch set] Move the following three defines to the header file, so the SCFI machinery can use them: - tc_cfi_frame_initial_instructions - tc_cfi_startproc - tc_cfi_endproc Although, the symthesized CFI cannot be emitted when CFI_EMIT_target is set, but in future, we may want to allow synthesized CFI to be emitted to all outputs currently supported by GAS for DWARF CFI. gas/ * dw2gencfi.c: Move from ... * dw2gencfi.h: ... to here. --- gas/dw2gencfi.c | 12 ------------ gas/dw2gencfi.h | 12 ++++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c index a69854ddc0c..cdef8d09978 100644 --- a/gas/dw2gencfi.c +++ b/gas/dw2gencfi.c @@ -64,18 +64,6 @@ #define EH_FRAME_ALIGNMENT (bfd_get_arch_size (stdoutput) == 64 ? 3 : 2) #endif -#ifndef tc_cfi_frame_initial_instructions -#define tc_cfi_frame_initial_instructions() ((void)0) -#endif - -#ifndef tc_cfi_startproc -# define tc_cfi_startproc() ((void)0) -#endif - -#ifndef tc_cfi_endproc -# define tc_cfi_endproc(fde) ((void) (fde)) -#endif - #define EH_FRAME_LINKONCE (SUPPORT_FRAME_LINKONCE || compact_eh \ || TARGET_MULTIPLE_EH_FRAME_SECTIONS) diff --git a/gas/dw2gencfi.h b/gas/dw2gencfi.h index aa8693df342..f574826456a 100644 --- a/gas/dw2gencfi.h +++ b/gas/dw2gencfi.h @@ -29,6 +29,18 @@ struct fde_entry; extern const pseudo_typeS cfi_pseudo_table[]; +#ifndef tc_cfi_frame_initial_instructions +#define tc_cfi_frame_initial_instructions() ((void)0) +#endif + +#ifndef tc_cfi_startproc +# define tc_cfi_startproc() ((void)0) +#endif + +#ifndef tc_cfi_endproc +# define tc_cfi_endproc(fde) ((void) (fde)) +#endif + /* cfi_finish() is called at the end of file. It will complain if the last CFI wasn't properly closed by .cfi_endproc. */ extern void cfi_finish (void); From patchwork Mon Oct 30 16:51:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 159817 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2355409vqb; Mon, 30 Oct 2023 09:54:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEN4PgptiFJ9zLx/JyaJ1iDBzWxRXoqx5HXSuRWLk/IsjY6xBcuv+hgsgGy5i2b5FDeXz+B X-Received: by 2002:a1f:724c:0:b0:49d:d3dd:fa40 with SMTP id n73-20020a1f724c000000b0049dd3ddfa40mr6779566vkc.5.1698684843239; Mon, 30 Oct 2023 09:54:03 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1698684843; cv=pass; d=google.com; s=arc-20160816; b=bhE5Zs1Du/2/lE2YhPGEFPulgZGic3hCzOPSP0rg2odznF6hS3gErQnY2lot/I2MlG 4c7YHhHfjuacvbxCrlPbDwDpYybIFia8kMoq4c2ozCIk/+Iwqv0mHmfJDctXVPjh0tz0 i8nM+mqpqdrkwAe6jdg6/tWa2gJQ+m7oV6pddIv+4fP1Y5CxVf/InkcbzHnIdPlVgtsx jm088QrKWp3YzZlL69Tg7/aRC02Zv3VM2gv+HEZF8wkTfQ3vi0g4K8ed03ZpOqEaTsjE VkaG3B4Q2ko26W6645M5WMubqnaHu5dyW4Z0bKhM2edu4pAb6YykDflOxGCAAGLFZlmW Q56g== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version :content-transfer-encoding:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-signature:arc-filter :dmarc-filter:delivered-to; bh=7mZ9ErbQKjSwwmMtWNlbO4VVvKQPgSBoZyispW+ZSNc=; fh=Oh0rwXgL2pcS1FQHr6E1Hal1K7kVHmZXDthN47bNt4Q=; b=DaO7+SM5b6AONnBK4L05TH/awBPdrJOaBMJreZ4Q17XoUuljM84fJCyoqPwE0E3fLM jEoEVmqQoWCq7pREHgSiiamBZr0IYat888oMG6KPJSvCNC/yWTog+quAvSVcVben9t1V l6+bO9752GAt3pHCp7VGUFVoCEeXpOclmETsTRMvfFEBh7FAMK/RyqVNuG1RMWRODhLA rkcJYWEoJr307q3rDnnK0lwSgaQs3+tLLbCGDmZhLJD1JLcAzIn1p1gl48B0rV1JZlpk 39N0nKkxIOSRGsl2Uhmfu6yBu8iwdVartHiFz5kPNUrcWMzTMclKr0IU88rXPuqdTDzp IX+Q== ARC-Authentication-Results: i=3; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=13C26EwM; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Ihexx7VD; arc=pass (i=2); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id v4-20020a0ced44000000b0066d6b153797si4005562qvq.233.2023.10.30.09.54.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 09:54:03 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=13C26EwM; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Ihexx7VD; arc=pass (i=2); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (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 552253857838 for ; Mon, 30 Oct 2023 16:53:04 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 2318E385DC1D for ; Mon, 30 Oct 2023 16:52:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2318E385DC1D 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 2318E385DC1D 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=1698684738; cv=pass; b=Wb+bPm9amOZZIOK9OXttTsQ1N6+QI+j9WZNYFzvBRtvkESxwm8+eVGCtYkt/1FrD1Knc+4vg1T0eQvnzTXIzs3aikBDuq2/aibP99cXrs7FJhIJ4dX7OmuaMWXzUS7+k5dxOqLlcZrgR/VMnOME9DLIFbzwfDB0WLlcRcVq4zW0= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1698684738; c=relaxed/simple; bh=qkG/h+Cauulym9ZGk8pfaZsacBWvXJcpo0/umZ7B/Yg=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=n81U8kKmQA5i2OSetT836arXAXyniiIHQiUvdgR0jRqqiE4zoJtXNKJfzN9YUhKhb/yD8L5xGbYgJwm8KfNorAKwNrOLQhU5jQSuXhE8UsqAvm+6LkaaJzAKctnz8vh62RDgdZ+C0SJ42wO+Gb6lxmwu5j2dHOfq5pRz3h+MRo4= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39UDD2fa010854 for ; Mon, 30 Oct 2023 16:52:15 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=7mZ9ErbQKjSwwmMtWNlbO4VVvKQPgSBoZyispW+ZSNc=; b=13C26EwMkLfHHbpm259OMaeyTtWgoi2i4cIkY7ZQ/TubNz46yyQZxuk0eEP5kF1vjeIC 95FOX62V6IS/is3B+rNZQnkie8GCJ/BSejXZ5uqRvkSBbZSSwb82vK8Qspmc2rwIlhAa wA6x+pLDq3NScyfJfzv3oY53B6romTKh6LJPCF/JpYCp/puWf1B0U9XXdGzd+X09EU+s RllBlihaDbQm12bAfCIChZ55D6lhTC3uroLUUFUOkOcThUM11BGQPnEMk7lAaHJtXKMY gy2xn4iLx2+EdZ73WyLjLG+eqo+yT6IgwPXAliyYLFsm1/KsBTgFrzSQ9LPCCfsK0xoH 5Q== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3u0s7bu8w6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 30 Oct 2023 16:52:14 +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 39UFhWJa009234 for ; Mon, 30 Oct 2023 16:52:14 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3u14x4da4m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 30 Oct 2023 16:52:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fjvh7ayT+N6cLkYl2nMbd5qcVNIeVg52Ngo53K5zTUtNUmSpIoqhOZONSLEUaFQwA/ViLWQmWvSvDWcbZ63/GZnrSUppr9/Foi3fpcThNDADs7nsAwwlEQYtCE+JS3Xlx6l0OSQsSdvtcTLeVdHQXzYtPcOnab+ODnp9AJr3A9kyF8uJ5Wo0am3XcaZjvyj5i31zUxlcqgwK2Qhxg7mWiJknCvnChY30xZpOmHsmrOEUi0bZqL1j9i9ErjvJ0und/2TqjjwhdzqqctZ0/LERIcudUb5M/jb7QSQkF3RWZVABEvxk2lJpujzzZs7mAvrN2Pk2P+isz0ZUrfbYSTl28A== 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=7mZ9ErbQKjSwwmMtWNlbO4VVvKQPgSBoZyispW+ZSNc=; b=db+BtB4a3jRdmR5kOPDCDG4H3gIc1w9rVYLfkl04N094oXZc1aFeYpO80bx7GmTcybeIqOeqY2y+lmu6fZjUbCwrUvpMXgUH8t6lbsGSLSmSHCEqlM5iOpkCHtvMD0bPg0hAi2ymuRsEoEn35TisxrI3AOQg5HdDwLhRhMvxi/sWCtVWR2zmhx5kAGbCa3QBUpSKXGUtYwPe49bTnniUKdHQ8BVS4d8kVDcSe7V4cFj4zRqKVff/KNst/jbWjvkOTPSzMfmAS/oEuFQ0xLxP1Bk2wrKrfi+ehNx5+oBlInlT+KUpb/UMWSDIb1B7pSlrh/79DBCELr8GsWMA4eVYoQ== 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=7mZ9ErbQKjSwwmMtWNlbO4VVvKQPgSBoZyispW+ZSNc=; b=Ihexx7VDO8Q7nQTN+ufTf/WKxrzLTs47aH+Xa2ajE/HAU7X6QaEF6QdW/Z7y9+wKIUXEl6sY5kW49xVa4psTJuxwjDFMiTpzoY/18mfcEdSqTxLZU+vya65lmSOPYTKC3kxJ93YoLn8L5StgEhq5DPI8bx+EREVQHwecmnZeDWk= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by IA0PR10MB6818.namprd10.prod.outlook.com (2603:10b6:208:439::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.19; Mon, 30 Oct 2023 16:52:11 +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; Mon, 30 Oct 2023 16:52:10 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH, V2 05/10] gas: add new command line option --scfi[=all,none] Date: Mon, 30 Oct 2023 09:51:32 -0700 Message-ID: <20231030165137.2570939-6-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231030165137.2570939-1-indu.bhagat@oracle.com> References: <20231030165137.2570939-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR03CA0160.namprd03.prod.outlook.com (2603:10b6:303:8d::15) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|IA0PR10MB6818:EE_ X-MS-Office365-Filtering-Correlation-Id: 8612f4b2-ce98-4427-7d0f-08dbd9688ed6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wq1VIPgLGmEmwFXpjE7u0NaXrSuU/XIt6GDCQRoHvy0FdARb4EcdfvdjawUC2yP44w4QqpvUVlp0J/rcIkG37a7b2mImtTHtzKIbip11W61fT6Dswy052KdoBArKwHwsiYNrJK+kiwrRjW2BrDCssGoL2h9VRd2Qq42EHRPy8N9IZSgeGadtl3KmRynoZZKYl1XR9W/BOR6KZXWq/nANxzw/zpsE6mnffL0YgUuYP3AvSOIzR47woY2mIGdb+W6qgZb5VGxBYjdXAPv1NZrAU/OOHw+EWu2NMbphkY4beA1+jMhgNDDYtY3E56fdz1j/H528EIvzlytRrQIdGMIOifKwigYHxOFL8RhpBdzQOe0xGUB1D/MMhp3RjZxH0QnfGfLohuidkGF1e7tkhJfMcFmXOUf/u2V3y2PWUBlFFc0j8VVuRGwzmJOttQh2bboPxLyNI+/QMa8X5Sp/snTdMEXu7w9/X2Mb0HGR6ewuCni4BV6Kca9xaKNeMQqfwxav6t8JEC/2CbMP2+gPQnJ/KVrzgeOwrbvR8gVABfpjTJzZjidYDkcQmXhMna4EzMW/DbtFPaCFur8cjBEgW/n8jLcJ1kgcGpk/iX64E/W/0iJFVuKRavW+MT0gdE1e3PyS 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)(346002)(396003)(136003)(366004)(376002)(39860400002)(230273577357003)(230922051799003)(230173577357003)(451199024)(186009)(1800799009)(64100799003)(83380400001)(8676002)(4326008)(8936002)(66899024)(38100700002)(86362001)(2906002)(36756003)(44832011)(41300700001)(6512007)(6666004)(5660300002)(478600001)(6486002)(2616005)(316002)(6916009)(1076003)(66476007)(107886003)(66556008)(66946007)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: D2RV/APUlas4Khg9DGy4BtLy2r59/JJI2vOFvMRVbmzqAf3B7zCUdLlz3cpffYQtTm+WqBgPZqV6HC0PzqQxptJrVnjpQjhXPhyo/Qnp7MovjVtztuWPLryywqt0ch4BURUw0Tbm1nwssBHo3sUjxjQh3K0u1sfE4gkE1xCvOIFiVs5b5+tBbO2DC1aj/pHL3NxjIKwg1wqe7Kmrk7yH4pTLFoHiBHJ5FyJ5KI7d/pyKeqYJ3SoiiCdWp6VSNILj/rWWCIWmqYA1nuUACzv2cmr2gWDWKxLpsuQCtKJQhxh9VngO2ibTfByMyFsnLQwfZkVPSrNU7XefGSiRzpuxSRMEBTfFLL9/7D3UXxYhX11D7bvrwxbwriFL3SXTaC6E7qADy3dnBQ6een3MLaB+z5tR+6GlABYsBwO/mdZFLxiZy6ghB5QekyNM6yRdwa7dT5auJCe3HAFMImh9qmuG4a2KSCLsmmFi4XbsJrjNzXhUzNNLKLKrOgDEbv7qdAXRchX7+OqSqRXZR+MTOlbfiUIbgIiXOVGwvkcZ8SuTbu1KyrJbHX5jiNLKvEO78Jvt1A2Ib3TPHT+7hSdLZB6EJRFgUwx1T5BQ9CFX3ZbxRCH9mgISE07Rx1/JxT5rPPQWEr7aX0qLYOezYvkSu3G27Be/tPdnbMmcEwYRdULc8t7o34F/R/U7O9thlFZqgPhL4ueBD+tPqeJcLfwScexK+0U6fBgGjsSAX7q4I95FZvzTi8zZs8WEUITNUU83ftASupGYCKMP+Bt0A8WMx0tqSrEbX1cWK8l6aG9Q9LYhQvp3ZUxzD/vNP4waZeQuKiRvidn/iMtBtbGaieeRdCGvQ3umfwV/7b+2rUYqDYpFJtH83WeXzV2Cd0Y75zCoFV+09FX3tTBSp4jwW2qtnK4ikUAs3lhuy5aAZyn29NlAOLIAOIr7GGTtFqzjPLbxS3OIk/XpMz5B1zV6ynTNz7vHNRDEMqSfll/46sH9FEaquk6tyiDm1ZA5eYsMzhTi095IZgsrOEh3m6jWw/6+uoEMf41TT2UbuPUqRYpZ8jAEZ0Ov5IjR1P8Skyz8fP/ae1ykDdffRsxmX3QL+rqeL5ipXTIh95ZET2psGjHjSQlh+F7GHqgxibj7K9uRTYnjp0Jv85Hvs76NAmNAIkX9uLr9aR2dXY08Vhk2hgUQNFy2WW9URYc1UieZ//3hg/dihE+qdPyX4KXaHvXw4YIix4vhgWUgGjQ7BVa1QGOFMTDojCMhZwfin7yM1ztCkzAb0FdrQgvrMCvjkFawjehkLq7ofyp9R+Zk8u71sdH4tnBZO6wXiSbg0iXryJlOubRQDI9uFFzpEAkOqdQxm/SJswGrwIkVN4K2mUy5NyOJKCvNfpwellfPdEs7qzTytp5zlMFNqMI045z3IeBioS9tuOdzUTGJksYA3S9xfrnA7ihW3WncdZDFos6XceeiG5x9J83kDm8ctjhdBttIbigh7cjGlIry96ScSWULDo3XIgAb+TA9kFqMVxxTL6fK7YxHSEbGXb8g0dIo1xxTgC3xdYZRLWrDsZdrk5s3WhVkVmhJqGjjcG9uxmC2ox/VFyw7a3wfqWqrySJdKo79MZTNAAuYAgEJ0xO1pkd2PPQqA7uTwLw= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: qmn3iUh05tmH9xnwMKH9j7fw/jMujEuyVPPKpcmh6Jp8WmtKQiGLyc7BMNWGz7PTYP/Qo7SIKH1szpf4W8jKTz6KReNZMfpHrW+PT0aW1gGOgkxXymE4emR9UIetyICJRmiKzqyzTQB1rSQS5C5QHdlx/Gz2lYbu8gC8QwFjJpbDf5dhy079StN8bZTpEeEdhCeSqHdIU9PTerI4gPuGSx3fUac5DU92EwZMKZOHo1IPEWz4eLdVedAGwhCf1ns5t9aoqcPGulJN5eSQkEzOOiygi8IVgUGS9hu9xvYIvD4EEItfmmDL5bLNJpRCosNpY97cEf/v6OaOp7p2T5V4OAK+bOslMFuZG8N0QLLr3QwNLBSyhJh7kPxYBsLk95khU7hiBYcxwfWxgXRusM9lCMZVMmCB/Ycxgu0mmAOCetHt4tEt3CSnk64nmJZfAFW+MkRjRgV6oARE5m5iwt+zDgDwVcSQErEsfDnumnd7AoGfHLfbfks1z9yV+2Rmcri/lu99BOMQr0nQG6uZ6O0r1I1/ALI7c1VIl2eFx+OQYM1X9HwDzGL0P6MDBd9y+pf3g15yOGSSIfVY9clUP8WNv3B1/daDWs80KUSxsBAIsG0cMPuHKCBvJq6EX4raFckRKgJDoAzOK1XQ4hM+fQF1UJCrCdw6o3EK7gK4mTdNGbgDgNbbLBjWr066hJ8imnl4dv7/uWE+yg5xKp8T9qRUaXgSL1+o4gmOjznCJumZzF28H3x6gx/DfDnKveYtGFbO2DBwH7N0+AvJRFTh7niOJA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8612f4b2-ce98-4427-7d0f-08dbd9688ed6 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2023 16:52:10.2033 (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: 3TA2uu3kDaFdjaStPAfeumoZaH+fAt/FUqjOll3cPqkEePgi3aPxFqYXueMmsToGKGOWIBpVtkLnziLmWsTD3w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR10MB6818 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-30_10,2023-10-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 mlxscore=0 suspectscore=0 mlxlogscore=775 bulkscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310240000 definitions=main-2310300131 X-Proofpoint-GUID: iqLhO6S_ABI4nfV9LeTCsuSAsfkK7uVP X-Proofpoint-ORIG-GUID: iqLhO6S_ABI4nfV9LeTCsuSAsfkK7uVP 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: 1781200158239250611 X-GMAIL-MSGID: 1781200158239250611 [Changes from the RFC patch set] - Update documentation to make it clearer. - Guard the --scfi option processing behind both TARGET_USE_GINSN and TARGET_USE_GINSN. [End of changes] 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 | 22 +++++++++++++++++++++- gas/as.h | 8 ++++++++ gas/doc/as.texi | 12 ++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/gas/as.c b/gas/as.c index 6839c841588..97b0ed38fb6 100644 --- a/gas/as.c +++ b/gas/as.c @@ -372,6 +372,11 @@ Options:\n\ -R fold data section into text section\n")); fprintf (stream, _("\ --reduce-memory-overheads ignored\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 fprintf (stream, _("\ --statistics print various measured statistics from execution\n")); 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. */ }; @@ -586,6 +592,9 @@ parse_args (int * pargc, char *** pargv) ,{"no-pad-sections", no_argument, NULL, OPTION_NO_PAD_SECTIONS} ,{"no-warn", no_argument, NULL, 'W'} ,{"reduce-memory-overheads", no_argument, NULL, OPTION_REDUCE_MEMORY_OVERHEADS} +#if defined (TARGET_USE_SCFI) && defined (TARGET_USE_GINSN) + ,{"scfi", no_argument, NULL, OPTION_SCFI} +#endif ,{"statistics", no_argument, NULL, OPTION_STATISTICS} ,{"strip-local-absolute", no_argument, NULL, OPTION_STRIP_LOCAL_ABSOLUTE} ,{"version", no_argument, NULL, OPTION_VERSION} @@ -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 From patchwork Mon Oct 30 16:51:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 159819 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2355848vqb; Mon, 30 Oct 2023 09:54:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEBKF8nH4vr0gYN1udeukL9/lF9xoHqa5iU9D7xSGPPnj5X666cu35TIsHXLOqNC0jShbsw X-Received: by 2002:a05:622a:1820:b0:417:a74f:69b6 with SMTP id t32-20020a05622a182000b00417a74f69b6mr13914529qtc.65.1698684895891; Mon, 30 Oct 2023 09:54:55 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1698684895; cv=pass; d=google.com; s=arc-20160816; b=KPaYeS5iMO8BDHKDTCamvISWqSalVyUNLZB8yxdW6Pk0lhsv/47Gokgio9LbJcRseD B7ez+vlogRRl8ugojrZMs/6G3vuFo/im/MqPihNmX5/4bb0U+e/8dJjJ8AQN0FJeo8cy QgdEavlZ9Zjot744EtyYX3GpJ8Yo7kZrGUDbtaWlqUNZdAZNh+uOMir5EcYO4ZcQNVlB tZWddfXMmHr+XWAk0PKW/le7qiikYMTyu1tBWVvpytb/jtHYHo4/237BUpxxAsiP6AwA Cn7g5krfgIVxkAP0Vxb9p7cAtZI4Dlt0lz8o3LR5x9UUwhy4E9raSUzV1pCw9JEgw9dL Fn0w== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version :content-transfer-encoding:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-signature:arc-filter :dmarc-filter:delivered-to; bh=K6iNWKXonYrpztVbcbGWG6RJW3fm/TbaM33zT4nTUGk=; fh=Oh0rwXgL2pcS1FQHr6E1Hal1K7kVHmZXDthN47bNt4Q=; b=NAcM3qZEuYHt8KCcsV9NTGeZX0dQ24DZXeNfwo2PY1JUL0PakdwoItbfZkC7mlScl3 wfQATHFEUkaaBR7xuPgKZsiEMi/Q3e5oImgFc48FVFZimt2NcFf0IY0W0KgXEGdBpboU 8Re4NxklmV4lRMytjmHodv6dxYhknmibAymvKFKeQ+99CvawiJOSoD3kxXJyy+msDmGq Z1p95FbNZovqorSWBVj7Ms6pWpsN1Xs+c/jhP8Z5j0n9nXPqD0dS2xWVDOypqeBt95Fi s8qXCZQvxeXcJADwZApQwK0+d60phgQKA/l6MkrenQKEOXCdyS2UiEC2oMOHbiqDQreN 8qPQ== ARC-Authentication-Results: i=3; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=vNbI54J0; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=XfMmEjDw; arc=pass (i=2); 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id fc25-20020a05622a489900b0041e57fc815csi4513109qtb.400.2023.10.30.09.54.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 09:54:55 -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=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=vNbI54J0; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=XfMmEjDw; arc=pass (i=2); 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=pass (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 A8EAD38323FA for ; Mon, 30 Oct 2023 16:53:41 +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 89F653830B5D for ; Mon, 30 Oct 2023 16:52:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 89F653830B5D 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 89F653830B5D 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=1698684780; cv=pass; b=HYfwIXLEoRoZGHaF5aLZwRpoXYgeH295MwgYBHcNzUpxoWbEzJbtqrcxLlCpsdrFIlGJQLjvhrzoTHZ3PA6a/sD2c75F1I69ONGiT94LYFef5disSQM+VeYHsrXpcD3TQfFlZvKRxWSr1J6Pu3IirnABYBlDns9eBI+t7ugovuc= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1698684780; c=relaxed/simple; bh=U1hmIvsPKHogq0hBCNQCmb36WRAjkO7zGwshSmSDrV8=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=Pufbb1DMwzstfvVCwnLigHxlF/cjrwQfjBLioUiXBIcDlXWaEGOHULZlIMqKrqIY40LGCyYiAw++OL7HSEKlilpYShAz0bACw3LBpba8Uobbqlocf3Bb+xFS0AnzBLZBM2476mvWHfnxZ3fg0LFRfj3zwAodZUPG/Ky9aNvMa3s= 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 39UDMSue013347 for ; Mon, 30 Oct 2023 16:52:57 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=K6iNWKXonYrpztVbcbGWG6RJW3fm/TbaM33zT4nTUGk=; b=vNbI54J0j4dOisRL5x0Qzrt8jOcjoOUI+tenB+eAkRe0IPGMxQaEiXrGoQcj4TRGCehS EabxC8EI1QT/GEA3m1IWvhoMULxUArtQzOLkdEs2hGXrgUF/n1LDlWlFFEob+MsWm/V5 +lB/MTaqPIHqqFSvY4c+FvoCa85FAeB++3DUpfLIw54WIpbcyqBDy0oBA7p2RGJjRHkl h7JvIypZvKPtytyu39pm8sQBNlpRbdXsFsPOat+ymBE+SY2y9Aedz3w08jVNfEjjOEY6 yxREW8Lq6i0IM5Y+rgJRTU6gewt8dQ/d8ZxxGf7ASqgEFaeyiN/m1m0Txx0GASmvQ0DX QA== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3u0s33ubt7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 30 Oct 2023 16:52:56 +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 39UFckJX009186 for ; Mon, 30 Oct 2023 16:52:18 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3u14x4da72-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 30 Oct 2023 16:52:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X7Mb9/qK4eT0985UODC7TwgLzM/AElnF14SqlYbZq3r0+dEOiTmhIMLIhwM/CrBL1KMvPI3tZjOt7TaXWOTumCCpHfW72P0I2GPwIUVP9EMsNc89cBHNRfVhKZAHXUWoaJHGyMTm9tdnpnrRgAs+WjxvVOicUdE+J2FwLIh2W98OvEgami9ZT8DYBEg2T+kUdy24E+OPf4Vr8jtGGBYEMqeXAeRFhWnzB8N7CldGmk+q761NBG0trTv5amnT5d8AtHzQBVA43V01oaIVi1fhLqJWBYvyBhq+7hEdxpkqqFOlsBZUxNT+IJ/h1mMT5qg8xwNQzTwSfMcKlmafvXzp0g== 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=K6iNWKXonYrpztVbcbGWG6RJW3fm/TbaM33zT4nTUGk=; b=DluCI3ci3t5sD0wX8/XMjnzMIqrciE8X9GIVO0phd0P4WNtbdbFODMrjHrSj7bOn2lbfEhd9H8FoZtIhm4c0UZ961jK8CRMSpfAHmivENYAIh6a1v+kQgd4ToOawT25XVdHO7R8sw4ucyizi2fdk1bEwO5hXodX30N3xIXCf7cmbV4hXg8MvQhZMvDzO7neAzd10s4Zb+Z2iczmbGcT9UFTHRRrsv58oMJ8sVe/sy5XjnXJ7xTZoD1xmTjko+rxnY6WfOhmGkCVjcCz+M2Id9we1LZ8LaBKoCnxn3TI4xrfRuJn9AGBFFz7vRQeHHrBAvXRz+0jcakU9TCOJZ4Z/zQ== 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=K6iNWKXonYrpztVbcbGWG6RJW3fm/TbaM33zT4nTUGk=; b=XfMmEjDwq8l9ykXcxxz1XOLpa2v20lDmAqNqtQHzHCs/myRHFQkOscAAGzl2BRoSKkOrw1bnhr3Ay09SRGTnVJzW+4TJ+SmkljZ1vsOd6Ey/qOCsaV7d0GGREoZQuNyMKLMmZrWuyYMXgozLHzaXejj6uyXterCDyDtvhNZWUZQ= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by DM4PR10MB6253.namprd10.prod.outlook.com (2603:10b6:8:b7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Mon, 30 Oct 2023 16:52:15 +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; Mon, 30 Oct 2023 16:52:15 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH, V2 06/10] gas: scfidw2gen: new functionality to prepapre for SCFI Date: Mon, 30 Oct 2023 09:51:33 -0700 Message-ID: <20231030165137.2570939-7-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231030165137.2570939-1-indu.bhagat@oracle.com> References: <20231030165137.2570939-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MWH0EPF00056D08.namprd21.prod.outlook.com (2603:10b6:30f:fff2:0:1:0:8) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|DM4PR10MB6253:EE_ X-MS-Office365-Filtering-Correlation-Id: f4fbc391-0ace-4b2e-6bc0-08dbd96891d1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3oyi5ltNJnIHDwYmip97brJhJ3LdKxkXhAjWxm1Gprvm+CmMpscg2ETYS2OflNGud18xfEVGSqeXKuq4dJ1yTw7GKl5tH6HwgGJuxzvhAPH78XVLgF/hs/ZYJyrb0JFwsury46waedS3RlaG0aDYpKf2vvp/V2u4x9fcDXjW285KuuO06Ozuv2reZVNhowtF7f2Ki06GLBpj5OrSX4zF1P2X8kLjEFAf7lC7FoiQJN1NehL9pMp6hzhOfwF3W2EP8+zikRsVVHTrldl0zGp6iUCiZufenYUMVTnuqUAFrMQmjt62u/hxllt025AcFhyqyvzE4PWz9GNFlZMH38iymsBj6YSJISN+km9VqyZmGGlGlSXgjGMMK8Gxo0wrM1P+Gs3ZiWRY0ToyXxC/b+j91WR5qAz1k8c/OzOMNG7G9b7BQ/KzsdcYDbhPBLI18SkPwKi0dfxUnW9nAUiDjY3Fq9PKAwQQPuKLWux8ysBjA9pt239tTC3e9qWdlMggpXnAaxjIeXbZKCy2rED6r3j/kcgh6/adiaCwPEnl5NNWWiyZiR99StHAf4KL3cpd4gCsNJGKQINVL2e7hBlnbTx3eSXxFWt917DJ4hmArza+88qpagFCdpbKSnJr2KJ5PFAmdRFOdC1ZBAKPTlkx8r4nbA== 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)(346002)(376002)(39860400002)(396003)(366004)(136003)(230273577357003)(230173577357003)(230922051799003)(1800799009)(186009)(64100799003)(451199024)(6666004)(36756003)(2616005)(6512007)(6506007)(66556008)(316002)(6486002)(66476007)(478600001)(66946007)(107886003)(1076003)(83380400001)(38100700002)(86362001)(8936002)(41300700001)(2906002)(4326008)(8676002)(6916009)(30864003)(44832011)(5660300002)(2004002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rPBl3JmkmyMBtz6jg2Q8ZDW45fGIC3ybd12X51mr97TH5Z0iH0Wmb0g1baoK/xGDnms2aG7JedEBq3Pd55k8SQ2HKlMnk+hpI/B2GRJMwEYGY4O3ufCjJsz+4UgG82LePqPjtjTx67MdwwjcBWe31zut/b9FB+izBPNrgiCzZFSB0uJ9cQuf5Fkp3BCKyklV/Iqx0pApqhB4aOBNSwNaKUyf6WomgbkFlXVYLTG/wBhGvfCg+zX7gzJJN4dhxhELc4IzBbsd/3IiW6dbL7YkX00PaHnWqHDwPwoBj+C5rxdQZmZtSRI50rtJ2uZaPKYxP49C56F8482P5N1fOaHErwjJcenYQcRKOUU3Vz1D67gK2DCPAFrVgRS0uJL9tHeuXdrIPd4wrxPqjZkl3Jaohd1EVwVXJuHN33zt7dfr3SQZNp623NErZKQWlMvgnL1bsy8ADA3dAPOdCWAP12ch1UMInfZn74xFyrHNTWHCjzIpaKtkbVs3fPNdZ8cz4TAhBP0FWfUUwQ/c48Uk/eLAt7LHi7qgZ5AmK4Ic//zZawBxO4FpruKhkcFND1LnpaBzvLQTNpDtwOZKKPTGBjeedpjZMD7HtnPHWsa7ac2asqwUAQmOkkqW1fhiIGXqP5+5ozgvw8Xn4kimRmbCN4lbYq+mXORDNBsBfzcQFslcqO22xOAvP6+2Z0gnXzSSfQfNDEUDSMi0FUP1W7HEcIZZM0z2yd42D6ePeahRlWGsyBeKIrozyFd7q2nbLiLa7kTmApiNWzKhaJMvYW+sCE0coFgZ06k9q+1BEJTX4BH5slfACBeDtZ33boUMZIoRRrrE0cntQa8h1AgFMXkzJGaiWrGwG57uttDE/Lt6M0lkqsMMpjLLpC3OYIxL1N8Lf9jSeG2Njo401H1TfA4sjehhv9qzytpApHp5CmWvi3vOa4HY85W1CmBznHufI21Gy5IzQv7OXalcH/uRnAF0+PqgP5QU9L0vxqWQ2k9YyG2GqxPbPHM7LJLDael4+Iw8No9womquhPvigKyUmrk2aDP8YsZPjs0KFjyb3WUUNq2kruZLfbMvNklxZGXjiYndDmZAAvgvblermPtJKmQ/UkF9d9SkzgxnZP9djH6tkpsiJuCWERe1ompnZv97gfpIaHsBAPt/MDJtjMw4p1lbT5PB//C3Tdn+G8dlpZK4CGgJSuSp2kdxJQ2ixG88MGOWED9YG7Tr3K9INItpKvbFjVhwbl9A15bxhvpTi+x1SslT7+hksaw7H/sgDS274BdH1DPEv/Xdaz1KC1jJCEO97Rc2R0fak68l/+5Tk/W8gvTVtuvKxa82AhofNgiGjamDV7o5YGKRGd8jGIdGgs/gYtPo5RGvwS0/tb9XHuo+kyeZXO4E0NR4FVqC/Y7A972LWfaXiP1DWBDIimAHJsASa8SgA8hI3En26V8k1q1NSkfyLD+VfALHBKORBQ1Id6ckE63F0wlHKDZ6HpmRqdTjIluoQfEOMLGUCK/S3iwyfc1k0ZXeVAxdWiVDj25m3p4IyeNITCLNxb68qZPhIWlGeK6WaJBn7iLbB+r6HUor9L7TZRIVZizPebASkBsjtI1y/iP3WQLvnTPxnqr3B0tUYQwIr92FQ3M6j7ybPgsynV1XbWI= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: CP3uz+pvD+CXeY4RSi/mudMeMVcI9QKG9LaL0PnXmLhFAK4pT25qdyjo2IPwHqmYPWoBhFKAf7Ja/DZ+0FPcBeUAoiLOaumW65kWDS1VpYvNLejwKcrR04gj/GkxbLtqmV9LfR7lGUFqlXWdGgK3NGoAy59aLoJdwjkQJpPo69uh6eGw9ZQ3UG3/YRHgB7M3WUqMuBWyEK8ewfyGPJHnKUX73it0Drnvskub2xGInIgeXtxh8GbCQdvSHCA1mFi/uW+lFbLd/5Uk0jJ+GxWescENzaBuMmQ4F6HxTxOh2lkyZedlAez/979lJukz07Btx9ruIMlN9xxzCFaUpisFIRvwGXRtGVSu3YAKMt8XKZNEyasIMl8XRiSTuTG0rg09tIzvWTBsgG7pEg+AgqOEWR0aRtuT+3GzWhGpqBo4U+TUJEOnvtzv5sVDXu8fuBxO4XRojJKWQqhGrWqHgPakWRUaKlbxKWOhDimsRxwSBXLinFXKdo6fFXM/98CNJV2Fdgvel5PsUIfVAyeJQDnDUvax5KC83kN27kex5mEXTZyV2IX7ME4Gnh5PBfRH33a6aye+Sk1jiv/q2b9z5pm7EgZzeUaxqYroSwDdl07iq456uoZpTsxlGmH+eLLCH9KYCiOGZB1fcJW/iNsPNMU8ICahBwxv/yRFQDidwM/F1MePIqSw0r9z4CIY58q6UZIjktt9V6EmR54FU0PlNZSagOnVMiAayTTHQ7YnitzlSM6DaJgEPkdBAaXND2hvSSiqXmNUIKuUmD6p7Up5b3mvsg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f4fbc391-0ace-4b2e-6bc0-08dbd96891d1 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2023 16:52:15.1118 (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: Wxofnxb4+i1O/WxgFpS1B11Am2yB7xWFaq8RH6/MvpStYle1vpwGQkUqRgQ4+MshYuJOGUcnc2tLdXHcb/DV2Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6253 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-30_10,2023-10-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310240000 definitions=main-2310300131 X-Proofpoint-GUID: xBmoQjBIx0orrP-AxZqV35W2n_zf-OO7 X-Proofpoint-ORIG-GUID: xBmoQjBIx0orrP-AxZqV35W2n_zf-OO7 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: 1781200213598371993 X-GMAIL-MSGID: 1781200213598371993 [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, will 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 | 17 ++- gas/scfidw2gen.c | 305 +++++++++++++++++++++++++++++++++++++++++++++++ gas/scfidw2gen.h | 37 ++++++ 5 files changed, 365 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..188699a882f --- /dev/null +++ b/gas/scfidw2gen.c @@ -0,0 +1,305 @@ +/* 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 "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) +{ + /* 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 (); + } +} + +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 + From patchwork Mon Oct 30 16:51: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: 159820 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2356114vqb; Mon, 30 Oct 2023 09:55:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHnO5E8ZFTnFThrB3kgdUIsRPyZzIYb/qUgqC7pLjTpj7K7KahdyCmnTVIPf+PKS+TBQipm X-Received: by 2002:a05:620a:c45:b0:778:b0f5:d4e7 with SMTP id u5-20020a05620a0c4500b00778b0f5d4e7mr11977491qki.46.1698684930018; Mon, 30 Oct 2023 09:55:30 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1698684930; cv=pass; d=google.com; s=arc-20160816; b=U6ArVFV2MS6YYWXC+CRrE2B29U63KMWjF0v2e2ixTBhb9EG1xaRkvQsKkwijT/14kr /mfuB+IJK1JGM1PnEuvyxu5LyjzjXUTBq3NL2Ij0iqDl19RTVB3pKDiu4mG0DxFKaLg7 C/iK1P8UeBN/0LjdXCtsu0mLAf4Ac8Ie/+ZfOOwEboeYvnCzTOa3dQ3aW81l46IW5JHv TcA1NX6kn1+FL6Sp3h/QvpGIupHA0fkc+uadUwHyscQQgJn11ykp33ueTDy3Q1yNpcdQ 5qngZwCuPL8f10XLwBUFjgnREAyT6Wb1VpTMhIIq6ksMRMpFjHo4Qe+yLkvdB+/c0NeL kqcA== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version :content-transfer-encoding:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-signature:arc-filter :dmarc-filter:delivered-to; bh=JWD3QKq3dwm/UQUtzMZ1LsAlyAVGsIS7H5txh4C4KUQ=; fh=Oh0rwXgL2pcS1FQHr6E1Hal1K7kVHmZXDthN47bNt4Q=; b=sRsDFz2MkwSIy08VJKvqZ606Fjyd8Ok4lltS1ss4jzS9E4Kv1U5IYfC47qCDe3uJuw xMCHL/zHIDDujBmR1U0/EioJJO1ZYy5IllWII4Qa9MQgFzzMqe3Neoher2i/gM6wXUEY US8srVVHDo//3PtlMi/2f2UFX/WqExDKINAA+3nYo2XB9WSBv47Jc1v8zfGd8fNt442Z /hkT4MO6esQ8jrppI87HyduzmGele9SFJBM/bFlZnkEQYzkVg/P8OJ99/9XO1MBb3Ibt WWMnT7tXgjvPF9+VQjW+m8xvyYtBwa9S9WSSD1MTHTThZvnu96ruFWGkAQu3C4rwqIhg ZRtw== ARC-Authentication-Results: i=3; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=Ouz+28Cc; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Qs8FqEiO; arc=pass (i=2); 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id r12-20020a05620a298c00b0076cb047fa2fsi5970372qkp.619.2023.10.30.09.55.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 09:55:29 -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=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=Ouz+28Cc; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Qs8FqEiO; arc=pass (i=2); 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=pass (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 36450385353B for ; Mon, 30 Oct 2023 16:54:26 +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 C0033387546A for ; Mon, 30 Oct 2023 16:52:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C0033387546A 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 C0033387546A 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=1698684776; cv=pass; b=r3q4UXb0G6SHt/DluD8wuoEKvNQ7l219DlYjoNiK2QzO871ck2hyXezbojrZm55TalbtlIYpQqlRIPAKhKzQTJ6VfhEOIn3JE2lo09AZ4mcYrXsLOsR6l+ckeJ6l6WegkySmoZoiLDQJNO8GCKPr+xPQSekERwQlcDM6xutQ0CQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1698684776; c=relaxed/simple; bh=tQUyxiYLOrifKzjCt0UYZK8eXjW66Xm46RYrIu5LvyM=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=ROeXI+EFV6rEMRoWbdyN/yvxtwiJ7XjtN12egCVeBOLfUhj/PUFPwSEixUgjD0gD7o2KNDEAHG/UiPKRA9XHZYiEQe6KSzhx7nGMuEFZJoTu7/W72OhQ2McMvPrgYwOmF1iFy1SvTYz2OlfOSw+H7qJN2Mu6UCBzrtSaTg+b5Ew= 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 39UE2WpK013692 for ; Mon, 30 Oct 2023 16:52: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-03-30; bh=JWD3QKq3dwm/UQUtzMZ1LsAlyAVGsIS7H5txh4C4KUQ=; b=Ouz+28CchdII9fWLOn60WNAqT5ikqnR61w+/ULVgqTNwKM10cM4/wlx9bpGW+3ABaIua 0Z/aWouUGEojsBZAMLl//n6tANQwCeJJw7NB2NqsyN1XZnFqCSbAk368hoUFdRWP17ot l8FRVHWYQcpvDncf021+SeM+cR38Xz9FLY7cHyUGNOVcWH+PMbn376depn60sZM0guxE oxCH33KKBQEGmXERty/HXXAoc7NUoydjPmXc24ARzIksvb2IUKUv63TE5vxMTWbNYUX9 SJ8LqH+kF1snuKG9cXkQAkks9KhpjJ3Il/UnR/l44paMw4XK+iYhirlZdD9LBVck1uZX Gg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3u0tbdk5y4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 30 Oct 2023 16:52:29 +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 39UFYW8B020060 for ; Mon, 30 Oct 2023 16:52:27 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3u0rr4k8c6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 30 Oct 2023 16:52:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hV415tmKY8v5bDzXTTxV87NlGuHrewqyhPqtW+oOzyCAFLFyaCXoa4/7davrVQ7ddIGPVLWfNDT6qQa8qVLoRY4LQPBhi3dmJ5xJDBHi9zzze1ZNaKC2P1YDPi9J72/beyCx9hzH6RTKuxeeVapvohQP9kq2F8E67puVMBPa4qfeJL7Q/+rTFB1neOs6vDwsrXr7BL1lNjBuitxCILH2zEiXHb4YOc6v4l8L4bSR+jrMyjGUu/ztMO/gUG0dXtWL0JaBg2BRO1iBFkRrHpnx7Dbif5kXQm6LQ8RTad+Zg9LmS4MJUbx1lHWWg7cQ9sxvkwE3NDdi5+6V3wwk4frt0g== 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=JWD3QKq3dwm/UQUtzMZ1LsAlyAVGsIS7H5txh4C4KUQ=; b=VLtqsWHfR68HGJe3SBERfVmNFR1+Al3Ga5xsBQ9Tu9Z7aE7Ci/0NWlNLpqZsQ0gEDGJEC3DJlWajAsTD4pm2P+44U1ue/AoabEGZSJ9liECsc5WsGJF0/tHUS+P4GKalekW+C8ph0ZCCdejHkkl40r8U4ljLXfBd1F723g+ZEZgRRWCK8F8mmqXGVfjxQNRs4qkQJ2xUH1bV8qG5abbT695UwwaYQAf9kYW5SMRfuD8yxsqRAQ7fFBhjQZvv+2s0JCVTOjIcfn4yfWw8XQmNZSxlGHVgZw+NpkV+YSWwJGHglMPl0hXlNncXRS+lt2MkjoFmbb4QOg+W0mE2IX+c+A== 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=JWD3QKq3dwm/UQUtzMZ1LsAlyAVGsIS7H5txh4C4KUQ=; b=Qs8FqEiOkl9iyOoyP5A8hK8v2QDSVEcG+yG55wnNrmNM/I52//zzZ7S7z4gMXfXUNQfNHoSL4lgqAkmWs9z9ne/9hlhtS0+QnOYVuKMjMonlV505J9CBcYyvArlEeCnsBl1cuMACELt95Md6NHnjqc/jQw7u2uWRdFR17ZTMo60= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by DM4PR10MB6253.namprd10.prod.outlook.com (2603:10b6:8:b7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Mon, 30 Oct 2023 16:52:20 +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; Mon, 30 Oct 2023 16:52:20 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH, V2 07/10] gas: synthesize CFI for hand-written asm Date: Mon, 30 Oct 2023 09:51:34 -0700 Message-ID: <20231030165137.2570939-8-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231030165137.2570939-1-indu.bhagat@oracle.com> References: <20231030165137.2570939-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR03CA0297.namprd03.prod.outlook.com (2603:10b6:303:b5::32) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|DM4PR10MB6253:EE_ X-MS-Office365-Filtering-Correlation-Id: bdcac84a-9b8e-4617-d553-08dbd9689465 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Uns/y0+yCkKn8qhzpUIZq8EEwT9HD9tG+6Zqi0Hx3w6gmJ8rcYDzfJBFSy+j++NR7voIGGenBR5SKhqsUq1q0wyE6t4gl+7qypPeqVrlXh3tk10j2y+8a9YOXvvurnv3LpvDP+EcOBeRjHBtR4Rey0OllWW1hC2odWbPf1eCq97OqutduhwTx3o7wKmfTU+zojwfE0rlC1UkfJSgHYfhTCx+zWzhMB+jZpehcTGAYXisM6jMDT2DFykIaCLwH2jYXWZvtso2aV+sBG0j8v1+g8v2ZfSgErj7RswsnQys/faqY2fP912yFEngxXosQu9TmxE8lXRwUzxuIQ/bIy4lBZCtG5vvfAbXAjjfIcTDbSPJHc8zfu8Yzis/BmDJQj0T3VUvcc7UJjvIWSptNso+y0/WKSgtsBrbtBeuwUlmK6QDa7nIrqzH4IE9WRoui2G2Aj8WOrvN67odDMMOkGmh/G9UhH7swmno9ipij/VKgrsxlNReD1vDR/Wwad/87BI0LujidlQC7VN4ig+B6o5f61TXHZMROw4dSazH1y04mqTLX3LuojFh1PvgcgLU2o4/pJ6rFERiU/5S6ci3koRSRwHkZ1Mnrad+ck5s0Xcd/CPkhBbCAr1qvpsTf7hAkJ4ugfOmvYOmEzwnCkW/+JLgXg== 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)(346002)(376002)(39860400002)(396003)(366004)(136003)(230273577357003)(230173577357003)(230922051799003)(1800799009)(186009)(64100799003)(451199024)(6666004)(36756003)(2616005)(6512007)(6506007)(66556008)(316002)(6486002)(66476007)(478600001)(66946007)(107886003)(1076003)(83380400001)(38100700002)(86362001)(8936002)(41300700001)(2906002)(4326008)(8676002)(6916009)(30864003)(66899024)(44832011)(5660300002)(2004002)(579004)(559001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lcXDri8L+1zEsypjUoHQXQ+A6fs+0r3eTN5XJpEcPC5TdsM8T4HjCGEMoXeHYXOgdwfS2pTTlGns3BEZnxjAw1JMuyHk0FoWJ9dxzVfflURZARR8vC9msv9H2v0YAwMTNDnecNrCVuenXx1t72I04suLlDuU5lU4vYMuW2yE6mK8yg0/KJWsuuTCinbzVnFaX2gSMm4WwnQeENl8nrXIe4MOszYdJjBAUm54rRzLzM0xIn69TiwbuoACb3ACcvKjMOWl7ZUukUUhFXONz3IVRBLRNqV8GhuRHGv2O0On/x8upetzoZj1OsZW8q9kgrUilmH6aOHkYcc9EQkRhJAmuWJZtsgqLgTNu4jkiDEAKO7JLPH1BUnFTwCK6AYa8Ws2omVCOePKsFfdbjUm7UDsx3q1wKoriejlBVWjr42mzX34JDctQR/LK1TltXdahId4jrLBOCLEqIWrEvabagtHPwUoRBDoU6mZ6YprLaQDJfrGdQzsO06D7I2MIAUkAiNhK9OQu9Q9tzPByqWSEdbkiu+Tb4QaInhPfErx0j+B4BHTIRDGspKE4E0oISTLdy00t01cFLGyvI0cuEfmzN0vDJfAmTgEGOtEQIDWS5IxKu2qaT4M5vThcDrtX2GqbfbReiZ0ExNe6rE1VcNWA7IPJZMIBN2HrEIGPgw5Tm/zAQTJNPOzH2rAnzGojjIbiHTInNU4chSp9uf7NXkN4YKJszzyEeL6/laZi0w1MGn/DYmPKGH6IfTIAO6ArPGcZIJtYcsqFY1NgNtdAsEaSdFJapoC3ZSTxtczLxW04RM3ekNLBAtSf6YSATHL0EmIW3/zlzvkrLsM7j2ow1wSyp1teLGFmJMQUMnQEU/DyIVD8bRmYxcTo2naL7NAMZY15qaD16MmnA9ggXD1EDasOIZ36cYm+L5G9wuAUOYH4vIjjXHsqZI+xYqa5Vlx0hmPoKcQPC4sq7QS7cyT/xbTdPCzelvG3A1v3+QfYK4GtdeBAZRBqXmi6QuCXiRsCurQMb6Dac3d7p/rCU122GxAi3L6dTRG75GI94gJL0T19UQO9DqlWLBl3BkfGp0w9bHfjpeVtjifYDw5Td76InLHcM0KhySERaZGTnSPmu7QBwlttWljE3a1wddZ0u9A8gWc65DNBiDyh+kI3x4Z7ZrNqcwYMajG6blO89FXe5Frudm5ngt68hmM0USTBtZSfF46wHgEPHQcpvgvPIpENsRO0xpcr+Uw/+25K7FlCEMOfwjieVBYhl1MJYTVoXzVSUs+2hTQgjVipwCmdCcRKBeP+1XSVYNu4emR59c3VccL9FfDN0fl+EXNQnrrGLF4ynuXDRu+/xVin1Fu7vxOj13QCW55BhCLKSwOpvZW60wJzzNorZ1h7TswUsm1vVXAJpLYoYEGHu21Xo9pNu8JERwyoqKMwUvXPx/4KColjCU4JPJbuBKa9ML7zYc6NBrP/NdZjtNIdX920p1ua5M1d8zgMIUTGawqIDOGN6v+XLLri9Mp64eH69c9+gEXBkNtPdg1gmYTJOkBZ/EJG8gn5rAm/YjqpfPfm7ZW47ud86UWs6qqyo8VbnR6T1U89stZ6WHiyme5nJCPwFIWa5D2PDQ8YH/UikSlfRZrzSAbXsxSPoPCjis= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 7DwsKqQsbxatDQX8jnSzkxwOHYCQ+Uv/Ptfkxhxajx7JTBltBtEmeeAm1ZRT7lQAqrJtnIfLevGlctqCYFPUEqueQnX3lvvrQTPgaqcxpUT9ODW/WyxZ0ixA2LrTuBJyMFymb7/mdlqoQ/tPDAv5AIvp39U1+9DS6DN+938l6wxoxOnKw88wuLyfjZeK23QEJTljSJCz5X8EaWGiMbEnA015KDtYCs7/oL3qljJnhsnrhm5JBAmgPeumBsy61jX1QJ6/PMA6YOykYayra/LdvywAXWQpUEnckA/Jrp+/Jn8tCNw8y7EDYGbSDMtswsgjdO3AmbX42BekrzIMhiPp7SNdT4IMBmLGrC9Xy/qtx/b5AMouxDcI3VBaFaHigHbdpt37L0txunBkesU61RBuaxgZk2oLajSJgr8tPEmuYcrLBnXTMYQJPd9ovYIWs8go6AdVmmHaSYz5IkS5KNNfsgB81JCvEE13iZHdrNC9EzCSvfsn2fwteweHlM6V32SziZsY8FbsS33VJo7vDxVrKwXde/R44HSOoU6IQpdjS+TLChCbXhPxnYR8PgpeyvYiII15B9IbDbneTP8Quf0zbyXYO0PETR7N4QwOdwXfhPnGOnrXmvUU5chaMh7s6dok9DnnlePM4Fpm9VabMYbnmXR8bfFW38J6uSeWiyuEutdYwtnyKYLB8WitZ+YwpggRBQFdifnc1azm6shQ25hgwzyIXf4hSDn11F+Y9snNLLL/FC24OOtfYeT1SPwBLCau3CArk/+VQsmKSit7tCf21Q== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: bdcac84a-9b8e-4617-d553-08dbd9689465 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2023 16:52:20.0362 (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: 0lnCT72owXqriF+Dq6a5MrMTXSdmAvyXbfrrpshtH2DKZwHJH155hFITBp4yi48zW4p/X1tEuRQSzSd4kbpcsQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6253 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-30_10,2023-10-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 spamscore=0 phishscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310240000 definitions=main-2310300131 X-Proofpoint-GUID: tn0OLafaGcRaIPj5I73Pr44xXTbmEDM_ X-Proofpoint-ORIG-GUID: tn0OLafaGcRaIPj5I73Pr44xXTbmEDM_ 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: 1781200249074706417 X-GMAIL-MSGID: 1781200249074706417 [Changes from the RFC patch set] - Fixed few more unhandled cases in the x86 creation of ginsn. - Added skeleton functionality to print ginsn in the listing output of GAS. The sub-option chosen is "i": $ as --help -a[sub-option...] turn on listings Sub-options [default hls]: ... d omit debugging directives ... i include ginsn and synthesized CFI info Documentation for ginsn is still pending. - Other bugfixes in the SCFI machinery. [End of changes] This patch adds support in GAS to create generic GAS instructions (a.k.a., the ginsn) for the x86 backend (AMD64 ABI only at this time). Using this ginsn infrastructure, GAS can then synthesize CFI for hand-written asm for x86_64. A ginsn is a target-independent representation of the machine instructions. One machine instruction may need one or more ginsn. This patch also adds skeleton support for printing ginsn in the listing output for debugging purposes. Since the current use-case of ginsn is to synthesize CFI, the x86 target generates ginsns necessary for the following machine instructions only: - All change of flow instructions, including all conditional and unconditional branches, call and return from functions. - All register saves and unsaves to the stack. - All instructions affecting the two registers that could potentially be used as the base register for CFA tracking. For SCFI, the base register for CFA tracking is limited to REG_SP and REG_FP only for now. The representation of ginsn is kept simple: - GAS instruction has GINSN_NUM_SRC_OPNDS (defined to be 2 at this time) number of source operands and one destination operand at this time. - GAS instruction uses DWARF register numbers in its representation and does not track register size. - GAS instructions carry location information (file name and line number). - GAS instructions are ID's with a natural number in order of their addtion to the list. This can be used as a proxy for the static program order of the corresponding machine instructions. Note that, GAS instruction (ginsn) format does not support GINSN_TYPE_PUSH and GINSN_TYPE_POP. Some architectures, like aarch64, do not have push and pop instructions, but rather STP/LDP/STR/LDR etc. instructions. Further these instructions have a variety of addressing modes, like offset, pre-indexing and post-indexing etc. Among other things, one of differences in these addressing modes is _when_ the addr register is updated with the result of the address calculation: before or after the memory operation. To best support such needs, the generic instructions like GINSN_TYPE_LOAD, GINSN_TYPE_STORE together with GINSN_TYPE_ADD, and GINSN_TYPE_SUB may be used. For load and store to stack, the addressing mode with src / dst type of GINSN_SRC_TYPE_INDIRECT / GINSN_DST_TYPE_INDIRECT respectively and the register of REG_SP is expected. The functionality provided in ginsn.c and scfi.c is compiled in when a target defines TARGET_USE_SCFI and TARGET_USE_GINSN. This can be revisited later when there are other use-cases of creating ginsn's in GAS, apart from the current use-case of synthesizing CFI for hand-written asm. Support is added only for AMD64 ABI at this time. If the user specifies, --scfi --32, GAS issues an error: "Fatal error: Synthesizing CFI is not supported for this ABI" For synthesizing (DWARF) CFI, the SCFI machinery requires the programmer to adhere to some pre-requisites for their asm: - Hand-written asm block must begin with a .type foo, @function It is highly recommended to, additionally, also ensure that: - Hand-written asm block ends with a .size foo, .-foo The SCFI machinery encodes some rules which align with the standard calling convention specified by the ABI. Apart from the rules, the SCFI machinery employs some heuristics. For example: - The base register for CFA tracking may be either REG_SP or REG_FP. - If the base register for CFA tracking is REG_SP, the precise amount of stack usage (and hence, the value of REG_SP) must be known at all times. - If using dynamic stack allocation, the function must switch to FP-based CFA. This means using instructions like the following (in AMD64) in prologue: pushq %rbp movq %rsp, %rbp and analogous instructions in epilogue. - Save and Restore of callee-saved registers must be symmetrical. However, the SCFI machinery at this time only warns if any such asymmetry is seen. These heuristics / rules are architecture-independent and are meant to employed for all architectures/ABIs using SCFI in the future. gas/ * Makefile.am: Add new files. * Makefile.in: Regenerated. * as.c (defined): Handle documentation and listing option for ginsns and SCFI. * config/obj-elf.c (obj_elf_size): Invoke ginsn_data_end. (obj_elf_type): Invoke ginsn_data_begin. * config/tc-i386.c (ginsn_new): New functionality to generate ginsns. (x86_scfi_callee_saved_p): New function. (ginsn_dw2_regnum): Likewise. (ginsn_set_where): Likewise. (x86_ginsn_alu): Likewise. (x86_ginsn_move): Likewise. (x86_ginsn_lea): Likewise. (x86_ginsn_jump): Likewise. (x86_ginsn_jump_cond): Likewise. (md_assemble): Invoke ginsn_new. (s_insn): Likewise. (i386_target_format): Add hard error for usage of --scfi with non AMD64 ABIs. * config/tc-i386.h (TARGET_USE_GINSN): New definition. (TARGET_USE_SCFI): Likewise. (SCFI_NUM_REGS): Likewise. (REG_FP): Likewise. (REG_SP): Likewise. (SCFI_INIT_CFA_OFFSET): Likewise. (SCFI_CALLEE_SAVED_REG_P): Likewise. (x86_scfi_callee_saved_p): Likewise. * gas/listing.h (LISTING_GINSN_SCFI): New define for ginsn and SCFI. * gas/read.c (read_a_source_file): Close SCFI processing at end of file read. * gas/scfidw2gen.c (scfi_process_cfi_label): Add implementation. (scfi_process_cfi_signal_frame): Likewise. * subsegs.h (struct frch_ginsn_data): New forward declaration. (struct frchain): New member for ginsn data. * gas/subsegs.c (subseg_set_rest): Initialize the new member. * symbols.c (colon): Invoke ginsn_frob_label to convey user-defined labels to ginsn infrastructure. * ginsn.c: New file. * ginsn.h: New file. * scfi.c: New file. * scfi.h: New file. --- gas/Makefile.am | 4 + gas/Makefile.in | 19 +- gas/as.c | 5 + gas/config/obj-elf.c | 16 + gas/config/tc-i386.c | 735 ++++++++++++++++++++++++- gas/config/tc-i386.h | 21 + gas/ginsn.c | 1225 ++++++++++++++++++++++++++++++++++++++++++ gas/ginsn.h | 392 ++++++++++++++ gas/listing.h | 1 + gas/read.c | 4 + gas/scfi.c | 1222 +++++++++++++++++++++++++++++++++++++++++ gas/scfi.h | 38 ++ gas/scfidw2gen.c | 28 +- gas/subsegs.c | 1 + gas/subsegs.h | 2 + gas/symbols.c | 3 + 16 files changed, 3705 insertions(+), 11 deletions(-) create mode 100644 gas/ginsn.c create mode 100644 gas/ginsn.h create mode 100644 gas/scfi.c create mode 100644 gas/scfi.h diff --git a/gas/Makefile.am b/gas/Makefile.am index e174305ca62..b477d74cb53 100644 --- a/gas/Makefile.am +++ b/gas/Makefile.am @@ -82,6 +82,7 @@ GAS_CFILES = \ flonum-mult.c \ frags.c \ gen-sframe.c \ + ginsn.c \ hash.c \ input-file.c \ input-scrub.c \ @@ -94,6 +95,7 @@ GAS_CFILES = \ remap.c \ sb.c \ scfidw2gen.c \ + scfi.c \ sframe-opt.c \ stabs.c \ subsegs.c \ @@ -119,6 +121,7 @@ HFILES = \ flonum.h \ frags.h \ gen-sframe.h \ + ginsn.h \ hash.h \ input-file.h \ itbl-lex.h \ @@ -130,6 +133,7 @@ HFILES = \ read.h \ sb.h \ scfidw2gen.h \ + scfi.h \ subsegs.h \ symbols.h \ tc.h \ diff --git a/gas/Makefile.in b/gas/Makefile.in index 87428bc46b8..99edb365a00 100644 --- a/gas/Makefile.in +++ b/gas/Makefile.in @@ -167,12 +167,13 @@ am__objects_1 = app.$(OBJEXT) as.$(OBJEXT) atof-generic.$(OBJEXT) \ ecoff.$(OBJEXT) ehopt.$(OBJEXT) expr.$(OBJEXT) \ flonum-copy.$(OBJEXT) flonum-konst.$(OBJEXT) \ flonum-mult.$(OBJEXT) frags.$(OBJEXT) gen-sframe.$(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) scfidw2gen.$(OBJEXT) \ - sframe-opt.$(OBJEXT) stabs.$(OBJEXT) subsegs.$(OBJEXT) \ - symbols.$(OBJEXT) write.$(OBJEXT) + ginsn.$(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) \ + scfidw2gen.$(OBJEXT) scfi.$(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) @@ -570,6 +571,7 @@ GAS_CFILES = \ flonum-mult.c \ frags.c \ gen-sframe.c \ + ginsn.c \ hash.c \ input-file.c \ input-scrub.c \ @@ -582,6 +584,7 @@ GAS_CFILES = \ remap.c \ sb.c \ scfidw2gen.c \ + scfi.c \ sframe-opt.c \ stabs.c \ subsegs.c \ @@ -606,6 +609,7 @@ HFILES = \ flonum.h \ frags.h \ gen-sframe.h \ + ginsn.h \ hash.h \ input-file.h \ itbl-lex.h \ @@ -617,6 +621,7 @@ HFILES = \ read.h \ sb.h \ scfidw2gen.h \ + scfi.h \ subsegs.h \ symbols.h \ tc.h \ @@ -1325,6 +1330,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flonum-mult.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frags.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen-sframe.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ginsn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/input-file.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/input-scrub.Po@am__quote@ @@ -1339,6 +1345,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)/scfi.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@ diff --git a/gas/as.c b/gas/as.c index 97b0ed38fb6..9f962fd5816 100644 --- a/gas/as.c +++ b/gas/as.c @@ -45,6 +45,7 @@ #include "codeview.h" #include "bfdver.h" #include "write.h" +#include "ginsn.h" #ifdef HAVE_ITBL_CPU #include "itbl-ops.h" @@ -245,6 +246,7 @@ Options:\n\ d omit debugging directives\n\ g include general info\n\ h include high-level source\n\ + i include ginsn and synthesized CFI info\n\ l include assembly\n\ m include macro expansions\n\ n omit forms processing\n\ @@ -1089,6 +1091,9 @@ This program has absolutely no warranty.\n")); case 'h': listing |= LISTING_HLL; break; + case 'i': + listing |= LISTING_GINSN_SCFI; + break; case 'l': listing |= LISTING_LISTING; break; diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index eaf2d6a2f29..4da007cbb38 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -24,6 +24,7 @@ #include "subsegs.h" #include "obstack.h" #include "dwarf2dbg.h" +#include "ginsn.h" #ifndef ECOFF_DEBUGGING #define ECOFF_DEBUGGING 0 @@ -2302,6 +2303,13 @@ obj_elf_size (int ignore ATTRIBUTE_UNUSED) symbol_get_obj (sym)->size = XNEW (expressionS); *symbol_get_obj (sym)->size = exp; } + + /* If the symbol in the directive matches the current function being + processed, indicate end of the current stream of ginsns. */ + if (flag_synth_cfi + && S_IS_FUNCTION (sym) && sym == ginsn_data_func_symbol ()) + ginsn_data_end (symbol_temp_new_now ()); + demand_empty_rest_of_line (); } @@ -2490,6 +2498,14 @@ obj_elf_type (int ignore ATTRIBUTE_UNUSED) elfsym->symbol.flags &= ~mask; } + if (S_IS_FUNCTION (sym) && flag_synth_cfi) + { + /* Wrap up processing the previous block of ginsns first. */ + if (frchain_now->frch_ginsn_data) + ginsn_data_end (symbol_temp_new_now ()); + ginsn_data_begin (sym); + } + demand_empty_rest_of_line (); } diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 57ae6c522a7..0276aa9f48b 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -30,6 +30,7 @@ #include "subsegs.h" #include "dwarf2dbg.h" #include "dw2gencfi.h" +#include "scfi.h" #include "gen-sframe.h" #include "sframe.h" #include "elf/x86-64.h" @@ -193,8 +194,11 @@ static unsigned int x86_isa_1_used; static unsigned int x86_feature_2_used; /* Generate x86 used ISA and feature properties. */ static unsigned int x86_used_note = DEFAULT_X86_USED_NOTE; + #endif +static ginsnS *ginsn_new (symbolS *sym, enum ginsn_gen_mode gmode); + static const char *default_arch = DEFAULT_ARCH; /* parse_register() returns this when a register alias cannot be used. */ @@ -5116,6 +5120,716 @@ static INLINE bool may_need_pass2 (const insn_template *t) && t->base_opcode == 0x63); } +bool +x86_scfi_callee_saved_p (uint32_t dw2reg_num) +{ + if (dw2reg_num == 3 /* rbx. */ + || dw2reg_num == REG_FP /* rbp. */ + || dw2reg_num == REG_SP /* rsp. */ + || (dw2reg_num >= 12 && dw2reg_num <= 15) /* r12 - r15. */) + return true; + + return false; +} + +static uint32_t +ginsn_dw2_regnum (const reg_entry *ireg) +{ + /* PS: Note the data type here as int32_t, because of Dw2Inval (-1). */ + int32_t dwarf_reg = Dw2Inval; + const reg_entry *temp; + + if (ireg->dw2_regnum[0] == Dw2Inval && ireg->dw2_regnum[1] == Dw2Inval) + return dwarf_reg; + + dwarf_reg = ireg->dw2_regnum[flag_code >> 1]; + if (dwarf_reg == Dw2Inval) + { + temp = ireg + 16; + dwarf_reg = ginsn_dw2_regnum (temp); + } + + if (dwarf_reg == Dw2Inval) + gas_assert (1); /* Needs to be addressed. */ + + return (uint32_t) dwarf_reg; +} + +static void +ginsn_set_where (ginsnS* ginsn) +{ + const char *file; + unsigned int line; + file = as_where (&line); + ginsn_set_file_line (ginsn, file, line); +} + +static ginsnS * +x86_ginsn_alu (i386_insn insn, symbolS *insn_end_sym) +{ + offsetT src_imm; + uint32_t dw2_regnum; + enum ginsn_src_type src_type; + enum ginsn_dst_type dst_type; + ginsnS *ginsn = NULL; + + /* FIXME - create ginsn for REG_SP target only ? */ + /* Map for insn.tm.extension_opcode + 000 ADD 100 AND + 001 OR 101 SUB + 010 ADC 110 XOR + 011 SBB 111 CMP */ + + /* add/sub imm, %reg. + and imm, %reg only at this time for SCFI. */ + if (!(insn.tm.extension_opcode == 0 + || insn.tm.extension_opcode == 4 + || insn.tm.extension_opcode == 5)) + return ginsn; + + /* TBD_GINSN_REPRESENTATION_LIMIT: There is no representation for when a + symbol is used as an operand, like so: + addq $simd_cmp_op+8, %rdx + Skip generating any ginsn for this. */ + if (insn.imm_operands == 1 + && insn.op[0].imms->X_op == O_symbol) + return ginsn; + + gas_assert (insn.imm_operands == 1 + && insn.op[0].imms->X_op == O_constant); + src_imm = insn.op[0].imms->X_add_number; + /* The second operand may be a register or indirect access. */ + if (insn.mem_operands == 1 && insn.base_reg) + { + dw2_regnum = ginsn_dw2_regnum (insn.base_reg); + src_type = GINSN_SRC_INDIRECT; + dst_type = GINSN_DST_INDIRECT; + } + else if (insn.mem_operands == 1 && insn.index_reg) + { + dw2_regnum = ginsn_dw2_regnum (insn.index_reg); + src_type = GINSN_SRC_INDIRECT; + dst_type = GINSN_DST_INDIRECT; + } + else + { + gas_assert (insn.reg_operands == 1); + dw2_regnum = ginsn_dw2_regnum (insn.op[1].regs); + src_type = GINSN_SRC_REG; + dst_type = GINSN_DST_REG; + } + + /* For ginsn, keep the imm as second src operand. */ + if (insn.tm.extension_opcode == 5) + ginsn = ginsn_new_sub (insn_end_sym, true, + src_type, dw2_regnum, 0, + GINSN_SRC_IMM, 0, src_imm, + dst_type, dw2_regnum, 0); + else if (insn.tm.extension_opcode == 4) + ginsn = ginsn_new_and (insn_end_sym, true, + src_type, dw2_regnum, 0, + GINSN_SRC_IMM, 0, src_imm, + dst_type, dw2_regnum, 0); + else if (insn.tm.extension_opcode == 0) + ginsn = ginsn_new_add (insn_end_sym, true, + src_type, dw2_regnum, 0, + GINSN_SRC_IMM, 0, src_imm, + dst_type, dw2_regnum, 0); + + ginsn_set_where (ginsn); + + return ginsn; +} + +static ginsnS * +x86_ginsn_move (i386_insn insn, symbolS *insn_end_sym) +{ + ginsnS *ginsn; + uint16_t opcode; + uint32_t dst_reg; + uint32_t src_reg; + offsetT dst_disp; + offsetT src_disp; + const reg_entry *dst = NULL; + const reg_entry *src = NULL; + enum ginsn_dst_type dst_type; + enum ginsn_src_type src_type; + + opcode = insn.tm.base_opcode; + src_type = GINSN_SRC_REG; + src_disp = dst_disp = 0; + dst_type = GINSN_DST_REG; + + if (opcode == 0x8b) + { + /* mov disp(%reg), %reg. */ + if (insn.mem_operands && insn.base_reg) + { + src = insn.base_reg; + if (insn.disp_operands == 1) + src_disp = insn.op[0].disps->X_add_number; + src_type = GINSN_SRC_INDIRECT; + } + else + src = insn.op[0].regs; + + dst = insn.op[1].regs; + } + else if (opcode == 0x89 || opcode == 0x88) + { + /* mov %reg, disp(%reg). */ + src = insn.op[0].regs; + if (insn.mem_operands && insn.base_reg) + { + dst = insn.base_reg; + if (insn.disp_operands == 1) + dst_disp = insn.op[1].disps->X_add_number; + dst_type = GINSN_DST_INDIRECT; + } + else + dst = insn.op[1].regs; + } + + src_reg = ginsn_dw2_regnum (src); + dst_reg = ginsn_dw2_regnum (dst); + + ginsn = ginsn_new_mov (insn_end_sym, true, + src_type, src_reg, src_disp, + dst_type, dst_reg, dst_disp); + ginsn_set_where (ginsn); + + return ginsn; +} + +static ginsnS * +x86_ginsn_lea (i386_insn insn, symbolS *insn_end_sym) +{ + offsetT src_disp = 0; + ginsnS *ginsn = NULL; + uint32_t base_reg; + uint32_t index_reg; + offsetT index_scale; + uint32_t dst_reg; + + if (!insn.index_reg && !insn.base_reg) + { + /* lea symbol, %rN. */ + dst_reg = ginsn_dw2_regnum (insn.op[1].regs); + /* FIXME - Skip encoding information about the symbol. + This is TBD_GINSN_INFO_LOSS, but it is fine if the mode is + GINSN_GEN_SCFI. */ + ginsn = ginsn_new_mov (insn_end_sym, false, + GINSN_SRC_IMM, 0xf /* arbitrary const. */, 0, + GINSN_DST_REG, dst_reg, 0); + } + else if (insn.base_reg && !insn.index_reg) + { + /* lea -0x2(%base),%dst. */ + base_reg = ginsn_dw2_regnum (insn.base_reg); + dst_reg = ginsn_dw2_regnum (insn.op[1].regs); + + if (insn.disp_operands) + src_disp = insn.op[0].disps->X_add_number; + + if (src_disp) + /* Generate an ADD ginsn. */ + ginsn = ginsn_new_add (insn_end_sym, true, + GINSN_SRC_REG, base_reg, 0, + GINSN_SRC_IMM, 0, src_disp, + GINSN_DST_REG, dst_reg, 0); + else + /* Generate a MOV ginsn. */ + ginsn = ginsn_new_mov (insn_end_sym, true, + GINSN_SRC_REG, base_reg, 0, + GINSN_DST_REG, dst_reg, 0); + } + else if (!insn.base_reg && insn.index_reg) + { + /* lea (,%index,imm), %dst. */ + /* FIXME - Skip encoding an explicit multiply operation, instead use + GINSN_TYPE_OTHER. This is TBD_GINSN_INFO_LOSS, but it is fine if + the mode is GINSN_GEN_SCFI. */ + index_scale = insn.log2_scale_factor; + index_reg = ginsn_dw2_regnum (insn.index_reg); + dst_reg = ginsn_dw2_regnum (insn.op[1].regs); + ginsn = ginsn_new_other (insn_end_sym, true, + GINSN_SRC_REG, index_reg, + GINSN_SRC_IMM, index_scale, + GINSN_DST_REG, dst_reg); + } + else + { + /* lea disp(%base,%index,imm) %dst. */ + /* FIXME - Skip encoding information about the disp and imm for index + reg. This is TBD_GINSN_INFO_LOSS, but it is fine if the mode is + GINSN_GEN_SCFI. */ + base_reg = ginsn_dw2_regnum (insn.base_reg); + index_reg = ginsn_dw2_regnum (insn.index_reg); + dst_reg = ginsn_dw2_regnum (insn.op[1].regs); + /* Generate an ADD ginsn. */ + ginsn = ginsn_new_add (insn_end_sym, true, + GINSN_SRC_REG, base_reg, 0, + GINSN_SRC_REG, index_reg, 0, + GINSN_DST_REG, dst_reg, 0); + } + + ginsn_set_where (ginsn); + + return ginsn; +} + +static ginsnS * +x86_ginsn_jump (i386_insn insn, symbolS *insn_end_sym) +{ + ginsnS *ginsn = NULL; + symbolS *src_symbol; + + gas_assert (insn.disp_operands == 1); + + if (insn.op[0].disps->X_op == O_symbol) + { + src_symbol = insn.op[0].disps->X_add_symbol; + /* The jump target is expected to be a symbol with 0 addend. + Assert for now to see if this assumption is true. */ + gas_assert (insn.op[0].disps->X_add_number == 0); + ginsn = ginsn_new_jump (insn_end_sym, true, + GINSN_SRC_SYMBOL, 0, src_symbol); + + ginsn_set_where (ginsn); + } + + return ginsn; +} + +static ginsnS * +x86_ginsn_jump_cond (i386_insn insn, symbolS *insn_end_sym) +{ + ginsnS *ginsn = NULL; + symbolS *src_symbol; + + /* TBD_GINSN_GEN_NOT_SCFI: Ignore move to or from xmm reg for mode. */ + if (i.tm.opcode_space == SPACE_0F) + return ginsn; + + gas_assert (insn.disp_operands == 1); + + if (insn.op[0].disps->X_op == O_symbol) + { + src_symbol = insn.op[0].disps->X_add_symbol; + /* The jump target is expected to be a symbol with 0 addend. + Assert for now to see if this assumption is true. */ + gas_assert (insn.op[0].disps->X_add_number == 0); + ginsn = ginsn_new_jump_cond (insn_end_sym, true, + GINSN_SRC_SYMBOL, 0, src_symbol); + ginsn_set_where (ginsn); + } + else + /* Catch them for now so we know what we are dealing with. */ + gas_assert (0); + + return ginsn; +} + +/* Generate one or more GAS instructions for the current machine dependent + instruction. + + Returns the head of linked list of ginsn(s) added, if success; + Returns NULL if failure. */ + +static ginsnS * +ginsn_new (symbolS *insn_end_sym, enum ginsn_gen_mode gmode) +{ + uint16_t opcode; + uint32_t dw2_regnum; + uint32_t src2_dw2_regnum; + int32_t gdisp = 0; + ginsnS *ginsn = NULL; + ginsnS *ginsn_next = NULL; + ginsnS *ginsn_last = NULL; + + /* FIXME - Need a way to check whether the decoding is sane. The specific + checks around i.tm.opcode_space were added as issues were seen. Likely + insufficient. */ + + /* Currently supports generation of selected ginsns, sufficient for + the use-case of SCFI only. To remove this condition will require + work on this target-specific process of creation of ginsns. Some + of such places are tagged with TBD_GINSN_GEN_NOT_SCFI to serve as + examples. */ + if (gmode != GINSN_GEN_SCFI) + return ginsn; + + opcode = i.tm.base_opcode; + + switch (opcode) + { + case 0x1: + /* add reg, reg. */ + dw2_regnum = ginsn_dw2_regnum (i.op[0].regs); + + if (i.reg_operands == 2) + { + src2_dw2_regnum = ginsn_dw2_regnum (i.op[1].regs); + ginsn = ginsn_new_add (insn_end_sym, true, + GINSN_SRC_REG, dw2_regnum, 0, + GINSN_SRC_REG, src2_dw2_regnum, 0, + GINSN_DST_REG, src2_dw2_regnum, 0); + ginsn_set_where (ginsn); + } + else if (i.mem_operands && i.base_reg) + { + src2_dw2_regnum = ginsn_dw2_regnum (i.base_reg); + if (i.disp_operands == 1) + gdisp = i.op[1].disps->X_add_number; + + ginsn = ginsn_new_add (insn_end_sym, true, + GINSN_SRC_REG, dw2_regnum, 0, + GINSN_SRC_INDIRECT, src2_dw2_regnum, gdisp, + GINSN_DST_INDIRECT, src2_dw2_regnum, gdisp); + ginsn_set_where (ginsn); + } + else + /* Catch them for now so we know what we are dealing with. */ + gas_assert (0); + + break; + case 0x29: + /* If opcode_space == SPACE_0F, this is a movaps insn. Skip it + for GINSN_GEN_SCFI. */ + if (i.tm.opcode_space == SPACE_0F) + break; + + /* sub reg, reg. */ + dw2_regnum = ginsn_dw2_regnum (i.op[0].regs); + + if (i.reg_operands == 2) + { + src2_dw2_regnum = ginsn_dw2_regnum (i.op[1].regs); + ginsn = ginsn_new_sub (insn_end_sym, true, + GINSN_SRC_REG, dw2_regnum, 0, + GINSN_SRC_REG, src2_dw2_regnum, 0, + GINSN_DST_REG, src2_dw2_regnum, 0); + ginsn_set_where (ginsn); + } + else if (i.mem_operands && i.base_reg) + { + src2_dw2_regnum = ginsn_dw2_regnum (i.base_reg); + if (i.disp_operands == 1) + gdisp = i.op[1].disps->X_add_number; + + ginsn = ginsn_new_sub (insn_end_sym, true, + GINSN_SRC_REG, dw2_regnum, 0, + GINSN_SRC_INDIRECT, src2_dw2_regnum, gdisp, + GINSN_DST_INDIRECT, src2_dw2_regnum, gdisp); + ginsn_set_where (ginsn); + } + else + /* Catch them for now so we know what we are dealing with. */ + gas_assert (0); + + break; + case 0xa0: + case 0xa8: + /* If opcode_space != SPACE_0F, this is a test insn. Skip it + for GINSN_GEN_SCFI. */ + if (i.tm.opcode_space != SPACE_0F) + break; + + dw2_regnum = ginsn_dw2_regnum (i.op[0].regs); + /* push fs / push gs. */ + ginsn = ginsn_new_sub (insn_end_sym, false, + GINSN_SRC_REG, REG_SP, 0, + GINSN_SRC_IMM, 0, 8, + GINSN_DST_REG, REG_SP, 0); + ginsn_set_where (ginsn); + + ginsn_next = ginsn_new_store (insn_end_sym, false, + GINSN_SRC_REG, dw2_regnum, + GINSN_DST_INDIRECT, REG_SP, 0); + ginsn_set_where (ginsn_next); + + gas_assert (!ginsn_link_next (ginsn, ginsn_next)); + break; + case 0xa1: + case 0xa9: + /* If opcode_space != SPACE_0F, this is test insn. Skip it + for GINSN_GEN_SCFI. */ + if (i.tm.opcode_space != SPACE_0F) + break; + + dw2_regnum = ginsn_dw2_regnum (i.op[0].regs); + /* pop fs / pop gs. */ + ginsn = ginsn_new_load (insn_end_sym, false, + GINSN_SRC_INDIRECT, REG_SP, 0, + GINSN_DST_REG, dw2_regnum); + ginsn_set_where (ginsn); + + ginsn_next = ginsn_new_add (insn_end_sym, false, + GINSN_SRC_REG, REG_SP, 0, + GINSN_SRC_IMM, 0, 8, + GINSN_DST_REG, REG_SP, 0); + ginsn_set_where (ginsn_next); + + gas_assert (!ginsn_link_next (ginsn, ginsn_next)); + break; + case 0x50 ... 0x57: + /* push reg. */ + dw2_regnum = ginsn_dw2_regnum (i.op[0].regs); + ginsn = ginsn_new_sub (insn_end_sym, false, + GINSN_SRC_REG, REG_SP, 0, + GINSN_SRC_IMM, 0, 8, + GINSN_DST_REG, REG_SP, 0); + ginsn_set_where (ginsn); + + ginsn_next = ginsn_new_store (insn_end_sym, false, + GINSN_SRC_REG, dw2_regnum, + GINSN_DST_INDIRECT, REG_SP, 0); + ginsn_set_where (ginsn_next); + + gas_assert (!ginsn_link_next (ginsn, ginsn_next)); + break; + case 0x58 ... 0x5f: + if (i.tm.opcode_space != SPACE_BASE) + break; + /* pop reg. */ + dw2_regnum = ginsn_dw2_regnum (i.op[0].regs); + ginsn = ginsn_new_load (insn_end_sym, false, + GINSN_SRC_INDIRECT, REG_SP, 0, + GINSN_DST_REG, dw2_regnum); + ginsn_set_where (ginsn); + + ginsn_next = ginsn_new_add (insn_end_sym, false, + GINSN_SRC_REG, REG_SP, 0, + GINSN_SRC_IMM, 0, 8, + GINSN_DST_REG, REG_SP, 0); + ginsn_set_where (ginsn_next); + + gas_assert (!ginsn_link_next (ginsn, ginsn_next)); + break; + case 0x68: + case 0x6a: + /* push imm. */ + /* Skip getting the value of imm from machine instruction + because for ginsn generation this is not important. */ + ginsn = ginsn_new_sub (insn_end_sym, false, + GINSN_SRC_REG, REG_SP, 0, + GINSN_SRC_IMM, 0, 8, + GINSN_DST_REG, REG_SP, 0); + ginsn_set_where (ginsn); + + ginsn_next = ginsn_new_store (insn_end_sym, false, + GINSN_SRC_IMM, 0, + GINSN_DST_INDIRECT, REG_SP, 0); + ginsn_set_where (ginsn_next); + + gas_assert (!ginsn_link_next (ginsn, ginsn_next)); + break; + case 0x70 ... 0x7f: + ginsn = x86_ginsn_jump_cond (i, insn_end_sym); + break; + case 0x81: + case 0x83: + ginsn = x86_ginsn_alu (i, insn_end_sym); + break; + case 0x8b: + /* Move r/m64 to r64. */ + case 0x88: + case 0x89: + /* mov reg, reg/mem. */ + ginsn = x86_ginsn_move (i, insn_end_sym); + break; + case 0x8d: + /* lea disp(%src), %dst */ + ginsn = x86_ginsn_lea (i, insn_end_sym); + break; + case 0x8f: + /* pop to mem. */ + gas_assert (i.base_reg); + dw2_regnum = ginsn_dw2_regnum (i.base_reg); + ginsn = ginsn_new_load (insn_end_sym, false, + GINSN_SRC_INDIRECT, REG_SP, 0, + GINSN_DST_INDIRECT, dw2_regnum); + ginsn_set_where (ginsn); + + ginsn_next = ginsn_new_add (insn_end_sym, false, + GINSN_SRC_REG, REG_SP, 0, + GINSN_SRC_IMM, 0, 8, + GINSN_DST_REG, REG_SP, 0); + ginsn_set_where (ginsn_next); + + gas_assert (!ginsn_link_next (ginsn, ginsn_next)); + break; + case 0x9c: + /* pushf / pushfd / pushfq. + Tracking EFLAGS register by number is not necessary. */ + ginsn = ginsn_new_sub (insn_end_sym, false, + GINSN_SRC_REG, REG_SP, 0, + GINSN_SRC_IMM, 0, 8, + GINSN_DST_REG, REG_SP, 0); + ginsn_set_where (ginsn); + + ginsn_next = ginsn_new_store (insn_end_sym, false, + GINSN_SRC_IMM, 0, + GINSN_DST_INDIRECT, REG_SP, 0); + ginsn_set_where (ginsn_next); + + gas_assert (!ginsn_link_next (ginsn, ginsn_next)); + + break; + case 0xff: + /* push from mem. */ + if (i.tm.extension_opcode == 6) + { + ginsn = ginsn_new_sub (insn_end_sym, false, + GINSN_SRC_REG, REG_SP, 0, + GINSN_SRC_IMM, 0, 8, + GINSN_DST_REG, REG_SP, 0); + ginsn_set_where (ginsn); + + /* These instructions have no imm, only indirect access. */ + gas_assert (i.base_reg); + dw2_regnum = ginsn_dw2_regnum (i.base_reg); + ginsn_next = ginsn_new_store (insn_end_sym, false, + GINSN_SRC_INDIRECT, dw2_regnum, + GINSN_DST_INDIRECT, REG_SP, 0); + ginsn_set_where (ginsn_next); + + gas_assert (!ginsn_link_next (ginsn, ginsn_next)); + } + else if (i.tm.extension_opcode == 4) + { + /* jmp r/m. E.g., notrack jmp *%rax. */ + if (i.reg_operands) + { + dw2_regnum = ginsn_dw2_regnum (i.op[0].regs); + ginsn = ginsn_new_jump (insn_end_sym, true, + GINSN_SRC_REG, dw2_regnum, NULL); + ginsn_set_where (ginsn); + } + else if (i.mem_operands && i.index_reg) + { + /* jmp *0x0(,%rax,8). */ + dw2_regnum = ginsn_dw2_regnum (i.index_reg); + ginsn = ginsn_new_jump (insn_end_sym, true, + GINSN_SRC_REG, dw2_regnum, NULL); + ginsn_set_where (ginsn); + } + else if (i.mem_operands && i.base_reg) + { + dw2_regnum = ginsn_dw2_regnum (i.base_reg); + ginsn = ginsn_new_jump (insn_end_sym, true, + GINSN_SRC_REG, dw2_regnum, NULL); + ginsn_set_where (ginsn); + } + else + /* Catch them for now so we know what we are dealing with. */ + gas_assert (0); + } + else if (i.tm.extension_opcode == 2) + { + /* 0xFF /2 (call). */ + if (i.reg_operands) + { + dw2_regnum = ginsn_dw2_regnum (i.op[0].regs); + ginsn = ginsn_new_call (insn_end_sym, true, + GINSN_SRC_REG, dw2_regnum, NULL); + ginsn_set_where (ginsn); + } + else if (i.mem_operands && i.base_reg) + { + dw2_regnum = ginsn_dw2_regnum (i.base_reg); + ginsn = ginsn_new_call (insn_end_sym, true, + GINSN_SRC_REG, dw2_regnum, NULL); + ginsn_set_where (ginsn); + } + else + /* Catch them for now so we know what we are dealing with. */ + gas_assert (0); + } + else + /* Catch them for now so we know what we are dealing with. */ + gas_assert (0); + break; + case 0xc2: + case 0xc3: + /* Near ret. */ + ginsn = ginsn_new_return (insn_end_sym, true); + ginsn_set_where (ginsn); + break; + case 0xc9: + /* The 'leave' instruction copies the contents of the RBP register + into the RSP register to release all stack space allocated to the + procedure. */ + ginsn = ginsn_new_mov (insn_end_sym, false, + GINSN_SRC_REG, REG_FP, 0, + GINSN_DST_REG, REG_SP, 0); + ginsn_set_where (ginsn); + + /* Then it restores the old value of the RBP register from the stack. */ + ginsn_next = ginsn_new_load (insn_end_sym, false, + GINSN_SRC_INDIRECT, REG_SP, 0, + GINSN_DST_REG, REG_FP); + ginsn_set_where (ginsn_next); + + gas_assert (!ginsn_link_next (ginsn, ginsn_next)); + ginsn_last = ginsn_new_add (insn_end_sym, false, + GINSN_SRC_REG, REG_SP, 0, + GINSN_SRC_IMM, 0, 8, + GINSN_DST_REG, REG_SP, 0); + ginsn_set_where (ginsn_next); + + gas_assert (!ginsn_link_next (ginsn_next, ginsn_last)); + break; + case 0xe8: + /* PS: SCFI machinery does not care about which func is being + called. OK to skip that info. */ + ginsn = ginsn_new_call (insn_end_sym, true, + GINSN_SRC_SYMBOL, 0, NULL); + ginsn_set_where (ginsn); + break; + case 0xe9: + case 0xeb: + /* If opcode_space == SPACE_0F, this is a psubw por insn. Skip it + for GINSN_GEN_SCFI. */ + if (i.tm.opcode_space == SPACE_0F) + break; + + /* Unconditional jmp. */ + ginsn = x86_ginsn_jump (i, insn_end_sym); + ginsn_set_where (ginsn); + break; + /* Fall Through. */ + default: + /* TBD_GINSN_GEN_NOT_SCFI: Keep a warning, for now, to find out about + possibly missed instructions affecting REG_SP or REG_FP. These + checks may not be completely exhaustive as they do not involve + index / base reg. */ + if (i.op[0].regs) + { + dw2_regnum = ginsn_dw2_regnum (i.op[0].regs); + if (dw2_regnum == REG_SP || dw2_regnum == REG_FP) + as_warn_where (last_insn.file, last_insn.line, + _("SCFI: unhandled op 0x%x may cause incorrect CFI"), + i.tm.base_opcode); + } + if (i.op[1].regs) + { + dw2_regnum = ginsn_dw2_regnum (i.op[1].regs); + if (dw2_regnum == REG_SP || dw2_regnum == REG_FP) + as_warn_where (last_insn.file, last_insn.line, + _("SCFI: unhandled op 0x%x may cause incorrect CFI"), + i.tm.base_opcode); + } + /* Keep an eye on other instructions affecting control flow. */ + gas_assert (!i.tm.opcode_modifier.jump); + /* TBD_GINSN_GEN_NOT_SCFI: Skip all other opcodes uninteresting for + GINSN_GEN_SCFI mode. */ + break; + } + + return ginsn; +} + /* This is the guts of the machine-dependent assembler. LINE points to a machine dependent instruction. This function is supposed to emit the frags/bytes it assembles to. */ @@ -5128,6 +5842,7 @@ md_assemble (char *line) const char *end, *pass1_mnem = NULL; enum i386_error pass1_err = 0; const insn_template *t; + ginsnS *ginsn; /* Initialize globals. */ current_templates = NULL; @@ -5659,6 +6374,13 @@ md_assemble (char *line) /* We are ready to output the insn. */ output_insn (); + /* At this time, SCFI is enabled only for AMD64 ABI. */ + if (flag_synth_cfi && x86_elf_abi == X86_64_ABI) + { + ginsn = ginsn_new (symbol_temp_new_now (), frch_ginsn_gen_mode ()); + frch_ginsn_data_append (ginsn); + } + insert_lfence_after (); last_insn.seg = now_seg; @@ -10904,6 +11626,7 @@ s_insn (int dummy ATTRIBUTE_UNUSED) valueT val; bool vex = false, xop = false, evex = false; static const templates tt = { &i.tm, &i.tm + 1 }; + ginsnS *ginsn; init_globals (); @@ -11658,7 +12381,14 @@ s_insn (int dummy ATTRIBUTE_UNUSED) output_insn (); - done: + /* At this time, SCFI is enabled only for AMD64 ABI. */ + if (flag_synth_cfi && x86_elf_abi == X86_64_ABI) + { + ginsn = ginsn_new (symbol_temp_new_now (), frch_ginsn_gen_mode ()); + frch_ginsn_data_append (ginsn); + } + +done: *saved_ilp = saved_char; input_line_pointer = line; @@ -15293,6 +16023,9 @@ i386_target_format (void) else as_fatal (_("unknown architecture")); + if (flag_synth_cfi && x86_elf_abi != X86_64_ABI) + as_fatal (_("Synthesizing CFI is not supported for this ABI")); + if (cpu_flags_all_zero (&cpu_arch_isa_flags)) cpu_arch_isa_flags = cpu_arch[flag_code == CODE_64BIT].enable; diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h index a3d463d961f..f63ad1694a9 100644 --- a/gas/config/tc-i386.h +++ b/gas/config/tc-i386.h @@ -373,6 +373,27 @@ extern int i386_elf_section_type (const char *, size_t); extern void i386_solaris_fix_up_eh_frame (segT); #endif +#define TARGET_USE_GINSN 1 +/* Allow GAS to synthesize DWARF CFI for hand-written asm. + PS: TARGET_USE_CFIPOP is a pre-condition. */ +#define TARGET_USE_SCFI 1 +/* Identify the maximum DWARF register number of all the registers being + tracked for SCFI. This is the last DWARF register number of the set + of SP, BP, and all callee-saved registers. For AMD64, this means + R15 (15). Use SCFI_CALLEE_SAVED_REG_P to identify which registers + are callee-saved from this set. */ +#define SCFI_NUM_REGS 15 +/* Identify the DWARF register number of the frame-pointer register. */ +#define REG_FP 6 +/* Identify the DWARF register number of the stack-pointer register. */ +#define REG_SP 7 +/* Some ABIs, like AMD64, use stack for call instruction. For such an ABI, + identify the initial (CFA) offset from RSP at the entry of function. */ +#define SCFI_INIT_CFA_OFFSET 8 + +#define SCFI_CALLEE_SAVED_REG_P(dw2reg) x86_scfi_callee_saved_p (dw2reg) +extern bool x86_scfi_callee_saved_p (uint32_t dw2reg_num); + /* Support for SHF_X86_64_LARGE */ extern bfd_vma x86_64_section_letter (int, const char **); #define md_elf_section_letter(LETTER, PTR_MSG) x86_64_section_letter (LETTER, PTR_MSG) diff --git a/gas/ginsn.c b/gas/ginsn.c new file mode 100644 index 00000000000..1d2b6c858b5 --- /dev/null +++ b/gas/ginsn.c @@ -0,0 +1,1225 @@ +/* ginsn.h - GAS instruction representation. + 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 "subsegs.h" +#include "ginsn.h" +#include "scfi.h" + +#ifdef TARGET_USE_GINSN + +const char *const ginsn_type_names[] = +{ +#define _GINSN_TYPE_ITEM(NAME, STR) STR, + _GINSN_TYPES +#undef _GINSN_TYPE_ITEM +}; + +const char *const ginsn_src_type_names[] = +{ +#define _GINSN_SRC_TYPE_ITEM(NAME, STR) STR, + _GINSN_SRC_TYPES +#undef _GINSN_SRC_TYPE_ITEM +}; +const char *const ginsn_dst_type_names[] = +{ +#define _GINSN_DST_TYPE_ITEM(NAME, STR) STR, + _GINSN_DST_TYPES +#undef _GINSN_DST_TYPE_ITEM +}; + +static +ginsnS *ginsn_alloc (void) +{ + ginsnS *ginsn = XCNEW (ginsnS); + return ginsn; +} + +static ginsnS* +ginsn_init (enum ginsn_type type, symbolS *sym, bool real_p) +{ + ginsnS *ginsn = ginsn_alloc (); + ginsn->type = type; + ginsn->sym = sym; + if (real_p) + ginsn->flags |= GINSN_F_INSN_REAL; + return ginsn; +} + +static void +ginsn_cleanup (ginsnS **ginsnp) +{ + ginsnS *ginsn; + + if (!ginsnp || !*ginsnp) + return; + + ginsn = *ginsnp; + if (ginsn->scfi_ops) + { + scfi_ops_cleanup (ginsn->scfi_ops); + ginsn->scfi_ops = NULL; + } + + free (ginsn); + ginsn = NULL; +} + +static void +ginsn_set_src (struct ginsn_src *src, enum ginsn_src_type type, uint32_t reg, + int32_t immdisp) +{ + if (!src) + return; + + src->type = type; + /* Even when the use-case is SCFI, the value of reg may be > SCFI_NUM_REGS. + E.g., in AMD64, push fs etc. */ + src->reg = reg; + + if (type == GINSN_SRC_IMM || type == GINSN_SRC_INDIRECT) + src->immdisp = immdisp; +} + +static void +ginsn_set_dst (struct ginsn_dst *dst, enum ginsn_dst_type type, uint32_t reg, + int32_t disp) +{ + if (!dst) + return; + + dst->type = type; + dst->reg = reg; + + if (type == GINSN_DST_INDIRECT) + dst->disp = disp; +} + +struct ginsn_src * +ginsn_get_src1 (ginsnS *ginsn) +{ + return &ginsn->src[0]; +} + +struct ginsn_src * +ginsn_get_src2 (ginsnS *ginsn) +{ + return &ginsn->src[1]; +} + +struct ginsn_dst * +ginsn_get_dst (ginsnS *ginsn) +{ + return &ginsn->dst; +} + +uint32_t +ginsn_get_src_reg (struct ginsn_src *src) +{ + return src->reg; +} + +enum ginsn_src_type +ginsn_get_src_type (struct ginsn_src *src) +{ + return src->type; +} + +uint32_t +ginsn_get_src_disp (struct ginsn_src *src) +{ + return src->immdisp; +} + +uint32_t +ginsn_get_src_imm (struct ginsn_src *src) +{ + return src->immdisp; +} + +uint32_t +ginsn_get_dst_reg (struct ginsn_dst *dst) +{ + return dst->reg; +} + +enum ginsn_dst_type +ginsn_get_dst_type (struct ginsn_dst *dst) +{ + return dst->type; +} + +int32_t +ginsn_get_dst_disp (struct ginsn_dst *dst) +{ + return (int32_t) dst->disp; +} + +void +label_ginsn_map_insert (symbolS *label, ginsnS *ginsn) +{ + const char *name = S_GET_NAME (label); + str_hash_insert (frchain_now->frch_ginsn_data->label_ginsn_map, + name, ginsn, 0 /* noreplace. */); +} + +ginsnS * +label_ginsn_map_find (symbolS *label) +{ + const char *name = S_GET_NAME (label); + ginsnS *ginsn + = (ginsnS *) str_hash_find (frchain_now->frch_ginsn_data->label_ginsn_map, + name); + return ginsn; +} + +ginsnS * +ginsn_new_phantom (symbolS *sym) +{ + ginsnS *ginsn = ginsn_alloc (); + ginsn->type = GINSN_TYPE_PHANTOM; + ginsn->sym = sym; + /* By default, GINSN_F_INSN_REAL is not set in ginsn->flags. */ + return ginsn; +} + +ginsnS * +ginsn_new_symbol (symbolS *sym, bool func_begin_p) +{ + ginsnS *ginsn = ginsn_alloc (); + ginsn->type = GINSN_TYPE_SYMBOL; + ginsn->sym = sym; + if (func_begin_p) + ginsn->flags |= GINSN_F_FUNC_MARKER; + return ginsn; +} + +ginsnS * +ginsn_new_symbol_func_begin (symbolS *sym) +{ + return ginsn_new_symbol (sym, true); +} + +ginsnS * +ginsn_new_symbol_func_end (symbolS *sym) +{ + return ginsn_new_symbol (sym, false); +} + +ginsnS * +ginsn_new_symbol_user_label (symbolS *sym) +{ + ginsnS *ginsn = ginsn_new_symbol (sym, false); + ginsn->flags |= GINSN_F_USER_LABEL; + return ginsn; +} + +ginsnS * +ginsn_new_add (symbolS *sym, bool real_p, + enum ginsn_src_type src1_type, uint32_t src1_val, int32_t src1_disp, + enum ginsn_src_type src2_type, uint32_t src2_val, int32_t src2_disp, + enum ginsn_dst_type dst_type, uint32_t dst_reg, int32_t dst_disp) +{ + ginsnS *ginsn = ginsn_init (GINSN_TYPE_ADD, sym, real_p); + /* src info. */ + ginsn_set_src (&ginsn->src[0], src1_type, src1_val, src1_disp); + ginsn_set_src (&ginsn->src[1], src2_type, src2_val, src2_disp); + /* dst info. */ + ginsn_set_dst (&ginsn->dst, dst_type, dst_reg, dst_disp); + + return ginsn; +} + +ginsnS * +ginsn_new_and (symbolS *sym, bool real_p, + enum ginsn_src_type src1_type, uint32_t src1_val, int32_t src1_disp, + enum ginsn_src_type src2_type, uint32_t src2_val, int32_t src2_disp, + enum ginsn_dst_type dst_type, uint32_t dst_reg, int32_t dst_disp) +{ + ginsnS *ginsn = ginsn_init (GINSN_TYPE_AND, sym, real_p); + /* src info. */ + ginsn_set_src (&ginsn->src[0], src1_type, src1_val, src1_disp); + ginsn_set_src (&ginsn->src[1], src2_type, src2_val, src2_disp); + ginsn_set_dst (&ginsn->dst, dst_type, dst_reg, dst_disp); + + return ginsn; +} + +ginsnS * +ginsn_new_call (symbolS *sym, bool real_p, + enum ginsn_src_type src_type, uint32_t src_val, + symbolS *src_text_sym) + +{ + ginsnS *ginsn = ginsn_init (GINSN_TYPE_CALL, sym, real_p); + /* src info. */ + ginsn_set_src (&ginsn->src[0], src_type, src_val, 0); + + if (src_type == GINSN_SRC_SYMBOL) + ginsn->src[0].sym = src_text_sym; + + return ginsn; +} + +ginsnS * +ginsn_new_jump (symbolS *sym, bool real_p, + enum ginsn_src_type src_type, uint32_t src_val, + symbolS *src_ginsn_sym) +{ + ginsnS *ginsn = ginsn_init (GINSN_TYPE_JUMP, sym, real_p); + /* src info. */ + ginsn_set_src (&ginsn->src[0], src_type, src_val, 0); + + if (src_type == GINSN_SRC_SYMBOL) + ginsn->src[0].sym = src_ginsn_sym; + + return ginsn; +} + +ginsnS * +ginsn_new_jump_cond (symbolS *sym, bool real_p, + enum ginsn_src_type src_type, uint32_t src_val, + symbolS *src_ginsn_sym) +{ + ginsnS *ginsn = ginsn_init (GINSN_TYPE_JUMP_COND, sym, real_p); + /* src info. */ + ginsn_set_src (&ginsn->src[0], src_type, src_val, 0); + + if (src_type == GINSN_SRC_SYMBOL) + ginsn->src[0].sym = src_ginsn_sym; + + return ginsn; +} + +ginsnS * +ginsn_new_mov (symbolS *sym, bool real_p, + enum ginsn_src_type src_type, uint32_t src_reg, int32_t src_disp, + enum ginsn_dst_type dst_type, uint32_t dst_reg, int32_t dst_disp) +{ + ginsnS *ginsn = ginsn_init (GINSN_TYPE_MOV, sym, real_p); + /* src info. */ + ginsn_set_src (&ginsn->src[0], src_type, src_reg, src_disp); + /* dst info. */ + ginsn_set_dst (&ginsn->dst, dst_type, dst_reg, dst_disp); + + return ginsn; +} + +ginsnS * +ginsn_new_store (symbolS *sym, bool real_p, + enum ginsn_src_type src_type, uint32_t src_reg, + enum ginsn_dst_type dst_type, uint32_t dst_reg, int32_t dst_disp) +{ + ginsnS *ginsn = ginsn_init (GINSN_TYPE_STORE, sym, real_p); + /* src info. */ + ginsn_set_src (&ginsn->src[0], src_type, src_reg, 0); + /* dst info. */ + gas_assert (dst_type == GINSN_DST_INDIRECT); + ginsn_set_dst (&ginsn->dst, dst_type, dst_reg, dst_disp); + + return ginsn; +} + +ginsnS * +ginsn_new_load (symbolS *sym, bool real_p, + enum ginsn_src_type src_type, uint32_t src_reg, int32_t src_disp, + enum ginsn_dst_type dst_type, uint32_t dst_reg) +{ + ginsnS *ginsn = ginsn_init (GINSN_TYPE_LOAD, sym, real_p); + /* src info. */ + gas_assert (src_type == GINSN_SRC_INDIRECT); + ginsn_set_src (&ginsn->src[0], src_type, src_reg, src_disp); + /* dst info. */ + ginsn_set_dst (&ginsn->dst, dst_type, dst_reg, 0); + + return ginsn; +} + +ginsnS * +ginsn_new_sub (symbolS *sym, bool real_p, + enum ginsn_src_type src1_type, uint32_t src1_val, int32_t src1_disp, + enum ginsn_src_type src2_type, uint32_t src2_val, int32_t src2_disp, + enum ginsn_dst_type dst_type, uint32_t dst_reg, int32_t dst_disp) +{ + ginsnS *ginsn = ginsn_init (GINSN_TYPE_SUB, sym, real_p); + /* src info. */ + ginsn_set_src (&ginsn->src[0], src1_type, src1_val, src1_disp); + ginsn_set_src (&ginsn->src[1], src2_type, src2_val, src2_disp); + /* dst info. */ + ginsn_set_dst (&ginsn->dst, dst_type, dst_reg, dst_disp); + + return ginsn; +} + +/* PS: Note this API does not identify the displacement values of + src1/src2/dst. At this time, it is unnecessary for correctness to support + the additional argument. */ + +ginsnS * +ginsn_new_other (symbolS *sym, bool real_p, + enum ginsn_src_type src1_type, uint32_t src1_val, + enum ginsn_src_type src2_type, uint32_t src2_val, + enum ginsn_dst_type dst_type, uint32_t dst_reg) +{ + ginsnS *ginsn = ginsn_init (GINSN_TYPE_OTHER, sym, real_p); + /* src info. */ + ginsn_set_src (&ginsn->src[0], src1_type, src1_val, src1_val); + /* GINSN_SRC_INDIRECT src2_type is not expected. */ + gas_assert (src2_type != GINSN_SRC_INDIRECT); + ginsn_set_src (&ginsn->src[1], src2_type, src2_val, src2_val); + /* dst info. */ + ginsn_set_dst (&ginsn->dst, dst_type, dst_reg, 0); + + return ginsn; +} + +ginsnS * +ginsn_new_return (symbolS *sym, bool real_p) +{ + ginsnS *ginsn = ginsn_init (GINSN_TYPE_RETURN, sym, real_p); + return ginsn; +} + +void +ginsn_set_file_line (ginsnS *ginsn, const char *file, unsigned int line) +{ + if (!ginsn) + return; + + ginsn->file = file; + ginsn->line = line; +} + +int +ginsn_link_next (ginsnS *ginsn, ginsnS *next) +{ + int ret = 0; + + /* Avoid data corruption by limiting the scope of the API. */ + if (!ginsn || ginsn->next) + return 1; + + ginsn->next = next; + + return ret; +} + +bool +ginsn_track_reg_p (uint32_t dw2reg, enum ginsn_gen_mode gmode) +{ + bool track_p = false; + + if (gmode == GINSN_GEN_SCFI && dw2reg <= SCFI_NUM_REGS) + { + /* FIXME - rename this to tc_ ? */ + track_p |= SCFI_CALLEE_SAVED_REG_P (dw2reg); + track_p |= (dw2reg == REG_FP); + track_p |= (dw2reg == REG_SP); + } + + return track_p; +} + +static bool +ginsn_indirect_jump_p (ginsnS *ginsn) +{ + bool ret_p = false; + if (!ginsn) + return ret_p; + + ret_p = (ginsn->type == GINSN_TYPE_JUMP + && ginsn->src[0].type == GINSN_SRC_REG); + return ret_p; +} + +static bool +ginsn_direct_local_jump_p (ginsnS *ginsn) +{ + bool ret_p = false; + if (!ginsn) + return ret_p; + + ret_p |= (ginsn->type == GINSN_TYPE_JUMP + && ginsn->src[0].type == GINSN_SRC_SYMBOL + && S_IS_LOCAL (ginsn->src[0].sym)); + return ret_p; +} + +static char* +ginsn_src_print (struct ginsn_src *src) +{ + size_t len = 39; + char *src_str = XNEWVEC (char, len); + + memset (src_str, 0, len); + + if (src->type == GINSN_SRC_REG) + { + char *buf = XNEWVEC (char, 32); + sprintf (buf, "%%r%d, ", ginsn_get_src_reg (src)); + strcat (src_str, buf); + } + else if (src->type == GINSN_SRC_IMM) + { + char *buf = XNEWVEC (char, 32); + sprintf (buf, "%d, ", ginsn_get_src_imm (src)); + strcat (src_str, buf); + } + else if (src->type == GINSN_SRC_INDIRECT) + { + char *buf = XNEWVEC (char, 32); + sprintf (buf, "[%%r%d+%d], ", ginsn_get_src_reg (src), + ginsn_get_src_disp (src)); + strcat (src_str, buf); + } + + return src_str; +} + +static char* +ginsn_dst_print (struct ginsn_dst *dst) +{ + size_t len = GINSN_LISTING_OPND_LEN; + char *dst_str = XNEWVEC (char, len); + + memset (dst_str, 0, len); + + if (dst->type == GINSN_DST_REG) + { + char *buf = XNEWVEC (char, 32); + sprintf (buf, "%%r%d", ginsn_get_dst_reg (dst)); + strcat (dst_str, buf); + } + else if (dst->type == GINSN_DST_INDIRECT) + { + char *buf = XNEWVEC (char, 32); + sprintf (buf, "[%%r%d+%d]", ginsn_get_dst_reg (dst), + ginsn_get_dst_disp (dst)); + strcat (dst_str, buf); + } + + gas_assert (strlen (dst_str) < GINSN_LISTING_OPND_LEN); + + return dst_str; +} + +static const char* +ginsn_type_sym_begin_end_print (ginsnS *ginsn) +{ + int id = 0; + const char *ginsn_sym_strs[] + = { "", "FUNC_BEGIN", "FUNC_END" }; + + if (GINSN_F_FUNC_BEGIN_P (ginsn)) + id = 1; + else if (GINSN_F_FUNC_END_P (ginsn)) + id = 2; + + return ginsn_sym_strs[id]; +} + +static char* +ginsn_print (ginsnS *ginsn) +{ + struct ginsn_src *src; + struct ginsn_dst *dst; + size_t len = GINSN_LISTING_LEN; + char *ginsn_str = XNEWVEC (char, len); + + memset (ginsn_str, 0, len); + + strcpy (ginsn_str, "ginsn: "); + + strcat (ginsn_str, ginsn_type_names[ginsn->type]); + strcat (ginsn_str, " "); + + /* For some ginsn types, no further information is printed for now. */ + if (ginsn->type == GINSN_TYPE_CALL + || ginsn->type == GINSN_TYPE_RETURN + || ginsn->type == GINSN_TYPE_OTHER) + goto end; + else if (ginsn->type == GINSN_TYPE_SYMBOL) + { + if (GINSN_F_USER_LABEL_P (ginsn)) + strncat (ginsn_str, S_GET_NAME (ginsn->sym), len - 10); + else + strcat (ginsn_str, ginsn_type_sym_begin_end_print (ginsn)); + goto end; + } + + /* src 1. */ + src = ginsn_get_src1 (ginsn); + strcat (ginsn_str, ginsn_src_print (src)); + + /* src 2. */ + src = ginsn_get_src2 (ginsn); + strcat (ginsn_str, ginsn_src_print (src)); + + /* dst. */ + dst = ginsn_get_dst (ginsn); + strcat (ginsn_str, ginsn_dst_print (dst)); + +end: + gas_assert (strlen (ginsn_str) < GINSN_LISTING_LEN); + return ginsn_str; +} + +static void +gbb_cleanup (gbbS **bbp) +{ + gbbS *bb = NULL; + + if (!bbp && !*bbp) + return; + + bb = *bbp; + + if (bb->entry_state) + { + free (bb->entry_state); + bb->entry_state = NULL; + } + if (bb->exit_state) + { + free (bb->exit_state); + bb->exit_state = NULL; + } + free (bb); + *bbp = NULL; +} + +static void +bb_add_edge (gbbS* from_bb, gbbS *to_bb) +{ + gedgeS *tmpedge = NULL; + gedgeS *gedge; + bool exists = false; + + if (!from_bb || !to_bb) + return; + + /* Create a new edge object. */ + gedge = XCNEW (gedgeS); + gedge->dst_bb = to_bb; + gedge->next = NULL; + gedge->visited = false; + + /* Add it in. */ + if (from_bb->out_gedges == NULL) + { + from_bb->out_gedges = gedge; + from_bb->num_out_gedges++; + } + else + { + /* Get the tail of the list. */ + tmpedge = from_bb->out_gedges; + while (tmpedge) + { + /* Do not add duplicate edges. Duplicated edges will cause unwanted + failures in the forward and backward passes for SCFI. */ + if (tmpedge->dst_bb == to_bb) + { + exists = true; + break; + } + if (tmpedge->next) + tmpedge = tmpedge->next; + else + break; + } + + if (!exists) + { + tmpedge->next = gedge; + from_bb->num_out_gedges++; + } + else + free (gedge); + } +} + +static void +cfg_add_bb (gcfgS *gcfg, gbbS *gbb) +{ + gbbS *last_bb = NULL; + + if (!gcfg->root_bb) + gcfg->root_bb = gbb; + else + { + last_bb = gcfg->root_bb; + while (last_bb->next) + last_bb = last_bb->next; + + last_bb->next = gbb; + } + gcfg->num_gbbs++; + + gbb->id = gcfg->num_gbbs; +} + +static gbbS* +add_bb_at_ginsn (symbolS *func, gcfgS *gcfg, ginsnS *ginsn, gbbS *prev_bb, + int *errp); + +static gbbS* +find_bb (gcfgS *gcfg, ginsnS *ginsn) +{ + gbbS *found_bb = NULL; + gbbS *gbb = NULL; + + if (!ginsn) + return found_bb; + + if (ginsn->visited) + { + cfg_for_each_bb (gcfg, gbb) + { + if (gbb->first_ginsn == ginsn) + { + found_bb = gbb; + break; + } + } + /* Must be found if ginsn is visited. */ + gas_assert (found_bb); + } + + return found_bb; +} + +static gbbS* +find_or_make_bb (symbolS *func, gcfgS *gcfg, ginsnS *ginsn, gbbS *prev_bb, + int *errp) +{ + gbbS *found_bb = NULL; + + found_bb = find_bb (gcfg, ginsn); + if (found_bb) + return found_bb; + + return add_bb_at_ginsn (func, gcfg, ginsn, prev_bb, errp); +} + +/* Add the basic block starting at GINSN to the given GCFG. + Also adds an edge from the PREV_BB to the newly added basic block. + + This is a recursive function which returns the root of the added + basic blocks. */ + +static gbbS* +add_bb_at_ginsn (symbolS *func, gcfgS *gcfg, ginsnS *ginsn, gbbS *prev_bb, + int *errp) +{ + gbbS *current_bb = NULL; + ginsnS *target_ginsn = NULL; + symbolS *taken_label; + + while (ginsn) + { + /* Skip these as they may be right after a GINSN_TYPE_RETURN. + For GINSN_TYPE_RETURN, we have already considered that as + end of bb, and a logical exit from function. */ + if (GINSN_F_FUNC_END_P (ginsn)) + { + ginsn = ginsn->next; + continue; + } + + if (ginsn->visited) + { + /* If the ginsn has been visited earlier, the bb must exist by now + in the cfg. */ + prev_bb = current_bb; + current_bb = find_bb (gcfg, ginsn); + gas_assert (current_bb); + /* Add edge from the prev_bb. */ + if (prev_bb) + bb_add_edge (prev_bb, current_bb); + break; + } + else if (current_bb && GINSN_F_USER_LABEL_P (ginsn)) + { + /* Create new bb starting at this label ginsn. */ + prev_bb = current_bb; + find_or_make_bb (func, gcfg, ginsn, prev_bb, errp); + break; + } + + if (current_bb == NULL) + { + /* Create a new bb. */ + current_bb = XCNEW (gbbS); + cfg_add_bb (gcfg, current_bb); + /* Add edge for the Not Taken, or Fall-through path. */ + if (prev_bb) + bb_add_edge (prev_bb, current_bb); + } + + if (current_bb->first_ginsn == NULL) + current_bb->first_ginsn = ginsn; + + ginsn->visited = true; + current_bb->num_ginsns++; + current_bb->last_ginsn = ginsn; + + /* Note that BB is _not_ split on ginsn of type GINSN_TYPE_CALL. */ + if (ginsn->type == GINSN_TYPE_JUMP + || ginsn->type == GINSN_TYPE_JUMP_COND + || ginsn->type == GINSN_TYPE_RETURN) + { + /* Indirect Jumps or direct jumps to symbols non-local to the + function must not be seen here. The caller must have already + checked for that. */ + gas_assert (!ginsn_indirect_jump_p (ginsn)); + if (ginsn->type == GINSN_TYPE_JUMP) + gas_assert (ginsn_direct_local_jump_p (ginsn)); + + /* Direct Jumps. May include conditional or unconditional change of + flow. What is important for CFG creation is that the target be + local to function. */ + if (ginsn->type == GINSN_TYPE_JUMP_COND + || ginsn_direct_local_jump_p (ginsn)) + { + gas_assert (ginsn->src[0].type == GINSN_SRC_SYMBOL); + taken_label = ginsn->src[0].sym; + gas_assert (taken_label && S_IS_LOCAL (taken_label)); + + /* Preserve the prev_bb to be the dominator bb as we are + going to follow the taken path of the conditional branch + soon. */ + prev_bb = current_bb; + + /* Follow the target on the taken path. */ + target_ginsn = label_ginsn_map_find (taken_label); + /* Add the bb for the target of the taken branch. */ + if (target_ginsn) + find_or_make_bb (func, gcfg, target_ginsn, prev_bb, errp); + else + { + *errp = GCFG_JLABEL_NOT_PRESENT; + as_warn_where (ginsn->file, ginsn->line, + _("missing label '%s' in func '%s' may result in imprecise cfg"), + S_GET_NAME (taken_label), S_GET_NAME (func)); + } + /* Add the bb for the fall through path. */ + find_or_make_bb (func, gcfg, ginsn->next, prev_bb, errp); + } + else if (ginsn->type == GINSN_TYPE_RETURN) + { + /* We'll come back to the ginsns following GINSN_TYPE_RETURN + from another path if they are indeed reachable code. */ + break; + } + + /* Current BB has been processed. */ + current_bb = NULL; + } + ginsn = ginsn->next; + } + + return current_bb; +} + +static int +gbbs_compare (const void *v1, const void *v2) +{ + const gbbS *bb1 = *(const gbbS **) v1; + const gbbS *bb2 = *(const gbbS **) v2; + + if (bb1->first_ginsn->id < bb2->first_ginsn->id) + return -1; + else if (bb1->first_ginsn->id > bb2->first_ginsn->id) + return 1; + else if (bb1->first_ginsn->id == bb2->first_ginsn->id) + return 0; + + return 0; +} + +/* Traverse the list of ginsns for the function and warn if some + ginsns are not visited. + + FIXME - this code assumes the caller has already performed a pass over + ginsns such that the reachable ginsns are already marked. Revisit this - we + should ideally make this pass self-sufficient. */ + +static int +ginsn_pass_warn_unreachable_code (symbolS *func, gcfgS *gcfg ATTRIBUTE_UNUSED, + ginsnS *root_ginsn) +{ + ginsnS *ginsn; + bool unreach_p = false; + + if (!gcfg || !func || !root_ginsn) + return 0; + + ginsn = root_ginsn; + + while (ginsn) + { + /* Some ginsns of type GINSN_TYPE_SYMBOL remain unvisited. Some + may even be excluded from the CFG as they are not reachable, given + their function, e.g., user labels after return machine insn. */ + if (!ginsn->visited + && !GINSN_F_FUNC_END_P (ginsn) + && !GINSN_F_USER_LABEL_P (ginsn)) + { + unreach_p = true; + break; + } + ginsn = ginsn->next; + } + + if (unreach_p) + as_warn_where (ginsn->file, ginsn->line, + _("GINSN: found unreachable code in func '%s'"), + S_GET_NAME (func)); + + return unreach_p; +} + +void +gcfg_get_bbs_in_prog_order (gcfgS *gcfg, gbbS **prog_order_bbs) +{ + int i = 0; + gbbS *gbb; + + if (!prog_order_bbs) + return; + + cfg_for_each_bb (gcfg, gbb) + { + gas_assert (i < gcfg->num_gbbs); + prog_order_bbs[i++] = gbb; + } + + qsort (prog_order_bbs, gcfg->num_gbbs, sizeof (gbbS *), gbbs_compare); +} + +/* Build the control flow graph for the ginsns of the function. + + It is important that the target adds an appropriate ginsn: + - GINSN_TYPE_JUMP, + - GINSN_TYPE_JUMP_COND, + - GINSN_TYPE_CALL, + - GINSN_TYPE_RET + at the associated points in the function. The correctness of the CFG + depends on the accuracy of these 'change of flow instructions'. */ + +gcfgS * +gcfg_build (symbolS *func, int *errp) +{ + gcfgS *gcfg; + ginsnS *first_ginsn; + + gcfg = XCNEW (gcfgS); + first_ginsn = frchain_now->frch_ginsn_data->gins_rootP; + add_bb_at_ginsn (func, gcfg, first_ginsn, NULL /* prev_bb. */, errp); + + return gcfg; +} + +void +gcfg_cleanup (gcfgS **gcfgp) +{ + gcfgS *cfg; + gbbS *bb, *next_bb; + gedgeS *edge, *next_edge; + + if (!gcfgp || !*gcfgp) + return; + + cfg = *gcfgp; + bb = gcfg_get_rootbb (cfg); + + while (bb) + { + next_bb = bb->next; + + /* Cleanup all the edges. */ + edge = bb->out_gedges; + while (edge) + { + next_edge = edge->next; + free (edge); + edge = next_edge; + } + + gbb_cleanup (&bb); + bb = next_bb; + } + + free (cfg); + *gcfgp = NULL; +} + +gbbS * +gcfg_get_rootbb (gcfgS *gcfg) +{ + gbbS *rootbb = NULL; + + if (!gcfg || !gcfg->num_gbbs) + return NULL; + + rootbb = gcfg->root_bb; + + return rootbb; +} + +void +frch_ginsn_data_init (symbolS *func, symbolS *start_addr, + enum ginsn_gen_mode gmode) +{ + /* FIXME - error out if prev object is not free'd ? */ + frchain_now->frch_ginsn_data = XCNEW (struct frch_ginsn_data); + + frchain_now->frch_ginsn_data->mode = gmode; + /* Annotate with the current function symbol. */ + frchain_now->frch_ginsn_data->func = func; + /* Create a new start address symbol now. */ + frchain_now->frch_ginsn_data->start_addr = start_addr; + /* Assume the set of ginsn are apt for CFG creation, by default. */ + frchain_now->frch_ginsn_data->gcfg_apt_p = true; + + frchain_now->frch_ginsn_data->label_ginsn_map = str_htab_create (); +} + +void +frch_ginsn_data_cleanup (void) +{ + ginsnS *ginsn = NULL; + ginsnS *next_ginsn = NULL; + + ginsn = frchain_now->frch_ginsn_data->gins_rootP; + while (ginsn) + { + next_ginsn = ginsn->next; + ginsn_cleanup (&ginsn); + ginsn = next_ginsn; + } + + if (frchain_now->frch_ginsn_data->label_ginsn_map) + htab_delete (frchain_now->frch_ginsn_data->label_ginsn_map); + + free (frchain_now->frch_ginsn_data); + frchain_now->frch_ginsn_data = NULL; +} + +/* Append GINSN to the list of ginsns for the current function being + assembled. */ + +int +frch_ginsn_data_append (ginsnS *ginsn) +{ + ginsnS *last = NULL; + ginsnS *temp = NULL; + uint64_t id = 0; + + if (!ginsn) + return 1; + + if (frchain_now->frch_ginsn_data->gins_lastP) + id = frchain_now->frch_ginsn_data->gins_lastP->id; + + /* Do the necessary preprocessing on the set of input GINSNs: + - Update each ginsn with its ID. + While you iterate, also keep gcfg_apt_p updated by checking whether any + ginsn is inappropriate for GCFG creation. */ + temp = ginsn; + while (temp) + { + temp->id = ++id; + + if (ginsn_indirect_jump_p (temp) + || (ginsn->type == GINSN_TYPE_JUMP + && !ginsn_direct_local_jump_p (temp))) + frchain_now->frch_ginsn_data->gcfg_apt_p = false; + + if (listing & LISTING_GINSN_SCFI) + listing_newline (ginsn_print (temp)); + + /* The input GINSN may be a linked list of multiple ginsns chained + together. Find the last ginsn in the input chain of ginsns. */ + last = temp; + + temp = temp->next; + } + + /* Link in the ginsn to the tail. */ + if (!frchain_now->frch_ginsn_data->gins_rootP) + frchain_now->frch_ginsn_data->gins_rootP = ginsn; + else + ginsn_link_next (frchain_now->frch_ginsn_data->gins_lastP, ginsn); + + frchain_now->frch_ginsn_data->gins_lastP = last; + + return 0; +} + +enum ginsn_gen_mode +frch_ginsn_gen_mode (void) +{ + enum ginsn_gen_mode gmode = GINSN_GEN_NONE; + + if (frchain_now->frch_ginsn_data) + gmode = frchain_now->frch_ginsn_data->mode; + + return gmode; +} + +int +ginsn_data_begin (symbolS *func) +{ + ginsnS *ginsn; + + /* The previous block of asm must have been processed by now. */ + if (frchain_now->frch_ginsn_data) + as_bad (_("GINSN process for prev func not done")); + + /* FIXME - hard code the mode to GINSN_GEN_SCFI. + This can be changed later when other passes on ginsns are formalised. */ + frch_ginsn_data_init (func, symbol_temp_new_now (), GINSN_GEN_SCFI); + + /* Create and insert ginsn with function begin marker. */ + ginsn = ginsn_new_symbol_func_begin (func); + frch_ginsn_data_append (ginsn); + + return 0; +} + +int +ginsn_data_end (symbolS *label) +{ + ginsnS *ginsn; + gbbS *root_bb; + gcfgS *gcfg = NULL; + symbolS *func; + int err = 0; + + if (!frchain_now->frch_ginsn_data) + return err; + + /* Insert Function end marker. */ + ginsn = ginsn_new_symbol_func_end (label); + frch_ginsn_data_append (ginsn); + + func = frchain_now->frch_ginsn_data->func; + + /* Build the cfg of ginsn(s) of the function. */ + if (!frchain_now->frch_ginsn_data->gcfg_apt_p) + { + as_warn (_("Untraceable control flow for func '%s'; Skipping SCFI"), + S_GET_NAME (func)); + goto end; + } + + gcfg = gcfg_build (func, &err); + + root_bb = gcfg_get_rootbb (gcfg); + if (!root_bb) + { + as_bad (_("Bad cfg of ginsn of func '%s'"), S_GET_NAME (func)); + goto end; + } + + /* Synthesize DWARF CFI and emit it. */ + err = scfi_synthesize_dw2cfi (func, gcfg, root_bb); + if (err) + goto end; + scfi_emit_dw2cfi (func); + + /* Other passes, e.g., warn for unreachable code can be enabled too. */ + ginsn = frchain_now->frch_ginsn_data->gins_rootP; + ginsn_pass_warn_unreachable_code (func, gcfg, ginsn); + +end: + if (gcfg) + gcfg_cleanup (&gcfg); + frch_ginsn_data_cleanup (); + return err; +} + +/* Add GINSN_TYPE_SYMBOL type ginsn for user-defined labels. These may be + branch targets, and hence are necessary for control flow graph. */ + +void +ginsn_frob_label (symbolS *label) +{ + ginsnS *label_ginsn; + const char *file; + unsigned int line; + + if (frchain_now->frch_ginsn_data) + { + /* PS: Note how we keep the actual LABEL symbol as ginsn->sym. + Take care to avoid inadvertent updates or cleanups of symbols. */ + label_ginsn = ginsn_new_symbol_user_label (label); + /* Keep the location updated. */ + file = as_where (&line); + ginsn_set_file_line (label_ginsn, file, line); + + frch_ginsn_data_append (label_ginsn); + + label_ginsn_map_insert (label, label_ginsn); + } +} + +symbolS * +ginsn_data_func_symbol (void) +{ + symbolS *func = NULL; + + if (frchain_now->frch_ginsn_data) + func = frchain_now->frch_ginsn_data->func; + + return func; +} + +#else + +int +ginsn_data_begin (symbolS *func ATTRIBUTE_UNUSED) +{ + as_bad (_("ginsn unsupported for target")); + return 1; +} + +int +ginsn_data_end (symbolS *label ATTRIBUTE_UNUSED) +{ + as_bad (_("ginsn unsupported for target")); + return 1; +} + +void +ginsn_frob_label (symbolS *sym ATTRIBUTE_UNUSED) +{ + return; +} + +symbolS * +ginsn_data_func_symbol (void) +{ + return NULL; +} + +#endif /* TARGET_USE_GINSN. */ diff --git a/gas/ginsn.h b/gas/ginsn.h new file mode 100644 index 00000000000..c930b5b2ff3 --- /dev/null +++ b/gas/ginsn.h @@ -0,0 +1,392 @@ +/* ginsn.h - GAS instruction representation. + 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 GINSN_H +#define GINSN_H + +#include "as.h" + +/* Maximum number of source operands of a ginsn. */ +#define GINSN_NUM_SRC_OPNDS 2 + +/* A ginsn in printed in the following format: + "ginsn: OPCD SRC1, SRC2, DST" + "<-5-> <--------125------->" + where each of SRC1, SRC2, and DST are in the form: + "%rNN," (up to 5 chars) + "imm," (up to int32_t+1 chars) + "[%rNN+-imm]," (up to int32_t+9 chars) + Hence a max of 19 chars. */ + +#define GINSN_LISTING_OPND_LEN 40 +#define GINSN_LISTING_LEN 156 + +enum ginsn_gen_mode +{ + GINSN_GEN_NONE, + /* Generate ginsns for program validation passes. */ + GINSN_GEN_FVAL, + /* Generate ginsns for synthesizing DWARF CFI. */ + GINSN_GEN_SCFI, +}; + +/* ginsn types. + + GINSN_TYPE_PHANTOM are phantom ginsns. They are used where there is no real + machine instruction counterpart, but a ginsn is needed only to carry + information to GAS. For example, to carry an SCFI Op. + + Note that, ginsns do not have a push / pop instructions. + Instead, following are used: + type=GINSN_TYPE_LOAD, src=GINSN_SRC_INDIRECT, REG_SP: Load from stack. + type=GINSN_TYPE_STORE, dst=GINSN_DST_INDIRECT, REG_SP: Store to stack. +*/ + +#define _GINSN_TYPES \ + _GINSN_TYPE_ITEM (GINSN_TYPE_SYMBOL, "SYM") \ + _GINSN_TYPE_ITEM (GINSN_TYPE_PHANTOM, "PHANTOM") \ + _GINSN_TYPE_ITEM (GINSN_TYPE_ADD, "ADD") \ + _GINSN_TYPE_ITEM (GINSN_TYPE_AND, "AND") \ + _GINSN_TYPE_ITEM (GINSN_TYPE_CALL, "CALL") \ + _GINSN_TYPE_ITEM (GINSN_TYPE_JUMP, "JMP") \ + _GINSN_TYPE_ITEM (GINSN_TYPE_JUMP_COND, "JCC") \ + _GINSN_TYPE_ITEM (GINSN_TYPE_MOV, "MOV") \ + _GINSN_TYPE_ITEM (GINSN_TYPE_LOAD, "LOAD") \ + _GINSN_TYPE_ITEM (GINSN_TYPE_STORE, "STORE") \ + _GINSN_TYPE_ITEM (GINSN_TYPE_RETURN, "RET") \ + _GINSN_TYPE_ITEM (GINSN_TYPE_SUB, "SUB") \ + _GINSN_TYPE_ITEM (GINSN_TYPE_OTHER, "OTH") + +enum ginsn_type +{ +#define _GINSN_TYPE_ITEM(NAME, STR) NAME, + _GINSN_TYPES +#undef _GINSN_TYPE_ITEM +}; + +#define _GINSN_SRC_TYPES \ + _GINSN_SRC_TYPE_ITEM (GINSN_SRC_UNKNOWN, "UNK") \ + _GINSN_SRC_TYPE_ITEM (GINSN_SRC_REG, "REG") \ + _GINSN_SRC_TYPE_ITEM (GINSN_SRC_IMM, "IMM") \ + _GINSN_SRC_TYPE_ITEM (GINSN_SRC_INDIRECT, "IND") \ + _GINSN_SRC_TYPE_ITEM (GINSN_SRC_SYMBOL, "SYM") + +enum ginsn_src_type +{ +#define _GINSN_SRC_TYPE_ITEM(NAME, STR) NAME, + _GINSN_SRC_TYPES +#undef _GINSN_SRC_TYPE_ITEM +}; + +/* GAS instruction source operand representation. */ + +struct ginsn_src +{ + enum ginsn_src_type type; + /* DWARF register number. */ + uint32_t reg; + /* 32-bit immediate or disp for indirect memory access. */ + int32_t immdisp; + /* Src symbol. May be needed for some control flow instructions. */ + symbolS *sym; +}; + +#define _GINSN_DST_TYPES \ + _GINSN_DST_TYPE_ITEM (GINSN_DST_UNKNOWN, "UNK") \ + _GINSN_DST_TYPE_ITEM (GINSN_DST_REG, "REG") \ + _GINSN_DST_TYPE_ITEM (GINSN_DST_INDIRECT, "IND") + +enum ginsn_dst_type +{ +#define _GINSN_DST_TYPE_ITEM(NAME, STR) NAME, + _GINSN_DST_TYPES +#undef _GINSN_DST_TYPE_ITEM +}; + +/* GAS instruction destination operand representation. */ + +struct ginsn_dst +{ + enum ginsn_dst_type type; + /* DWARF register number. */ + uint32_t reg; + /* 32-bit disp for indirect memory access. */ + int32_t disp; +}; + +/* Various flags for additional information per GAS instruction. */ + +/* Function begin or end symbol. */ +#define GINSN_F_FUNC_MARKER 0x1 +/* Identify real or implicit GAS insn. + Some targets employ CISC-like instructions. Multiple ginsn's may be used + for a single machine instruction in some ISAs. For some optimizations, + there is need to identify whether a ginsn, e.g., GINSN_TYPE_ADD or + GINSN_TYPE_SUB is a result of an user-specified instruction or not. */ +#define GINSN_F_INSN_REAL 0x2 +/* Identify if the GAS insn of type GINSN_TYPE_SYMBOL is due to a user-defined + label. Each user-defined labels in a function will cause addition of a new + ginsn. This simplifies control flow graph creation. + See htab_t label_ginsn_map usage. */ +#define GINSN_F_USER_LABEL 0x4 +/* Max bit position for flags (uint32_t). */ +#define GINSN_F_MAX 0x20 + +#define GINSN_F_FUNC_BEGIN_P(ginsn) \ + ((ginsn != NULL) \ + && (ginsn->type == GINSN_TYPE_SYMBOL) \ + && (ginsn->flags & GINSN_F_FUNC_MARKER)) + +/* PS: For ginsn associated with a user-defined symbol location, + GINSN_F_FUNC_MARKER is unset, but GINSN_F_USER_LABEL is set. */ +#define GINSN_F_FUNC_END_P(ginsn) \ + ((ginsn != NULL) \ + && (ginsn->type == GINSN_TYPE_SYMBOL) \ + && !(ginsn->flags & GINSN_F_FUNC_MARKER) \ + && !(ginsn->flags & GINSN_F_USER_LABEL)) + +#define GINSN_F_INSN_REAL_P(ginsn) \ + ((ginsn != NULL) \ + && (ginsn->flags & GINSN_F_INSN_REAL)) + +#define GINSN_F_USER_LABEL_P(ginsn) \ + ((ginsn != NULL) \ + && (ginsn->type == GINSN_TYPE_SYMBOL) \ + && !(ginsn->flags & GINSN_F_FUNC_MARKER) \ + && (ginsn->flags & GINSN_F_USER_LABEL)) + +typedef struct ginsn ginsnS; +typedef struct scfi_op scfi_opS; +typedef struct scfi_state scfi_stateS; + +/* GAS generic instruction. + + Generic instructions are used by GAS to abstract out the binary machine + instructions. In other words, ginsn is a target/ABI independent internal + representation for GAS. Note that, depending on the target, there may be + more than one ginsn per binary machine instruction. + + ginsns can be used by GAS to perform validations, or even generate + additional information like, sythesizing DWARF CFI for hand-written asm. */ + +struct ginsn +{ + enum ginsn_type type; + /* GAS instructions are simple instructions with GINSN_NUM_SRC_OPNDS number + of source operands and one destination operand at this time. */ + struct ginsn_src src[GINSN_NUM_SRC_OPNDS]; + struct ginsn_dst dst; + /* Additional information per instruction. */ + uint32_t flags; + /* Symbol. For ginsn of type other than GINSN_TYPE_SYMBOL, this identifies + the end of the corresponding machine instruction in the .text segment. + These symbols are created anew by the targets and are not used elsewhere + in GAS. The only exception is some ginsns of type GINSN_TYPE_SYMBOL, when + generated for the user-defined labels. See ginsn_frob_label. */ + symbolS *sym; + /* Identifier (linearly increasing natural number) for each ginsn. Used as + a proxy for program order of ginsns. */ + uint64_t id; + /* Location information for user-interfacing messaging. Only ginsns with + GINSN_F_FUNC_BEGIN_P and GINSN_F_FUNC_END_P may present themselves with no + file or line information. */ + const char *file; + unsigned int line; + + /* Information needed for synthesizing CFI. */ + scfi_opS **scfi_ops; + uint32_t num_scfi_ops; + + /* Flag to keep track of visited instructions for CFG creation. */ + bool visited; + + ginsnS *next; /* A linked list. */ +}; + +struct ginsn_src *ginsn_get_src1 (ginsnS *ginsn); +struct ginsn_src *ginsn_get_src2 (ginsnS *ginsn); +struct ginsn_dst *ginsn_get_dst (ginsnS *ginsn); + +uint32_t ginsn_get_src_reg (struct ginsn_src *src); +enum ginsn_src_type ginsn_get_src_type (struct ginsn_src *src); +uint32_t ginsn_get_src_disp (struct ginsn_src *src); +uint32_t ginsn_get_src_imm (struct ginsn_src *src); + +uint32_t ginsn_get_dst_reg (struct ginsn_dst *dst); +enum ginsn_dst_type ginsn_get_dst_type (struct ginsn_dst *dst); +int32_t ginsn_get_dst_disp (struct ginsn_dst *dst); + +/* Data object for book-keeping information related to GAS generic + instructions. */ +struct frch_ginsn_data +{ + /* Mode for GINSN creation. */ + enum ginsn_gen_mode mode; + /* Head of the list of ginsns. */ + ginsnS *gins_rootP; + /* Tail of the list of ginsns. */ + ginsnS *gins_lastP; + /* Function symbol. */ + symbolS *func; + /* Start address of the function. */ + symbolS *start_addr; + /* User-defined label to ginsn mapping. */ + htab_t label_ginsn_map; + /* Is the list of ginsn apt for creating CFG. */ + bool gcfg_apt_p; +}; + +int ginsn_data_begin (symbolS *func); +int ginsn_data_end (symbolS *label); +symbolS *ginsn_data_func_symbol (void); +void ginsn_frob_label (symbolS *sym); + +void frch_ginsn_data_init (symbolS *func, symbolS *start_addr, + enum ginsn_gen_mode gmode); +void frch_ginsn_data_cleanup (void); +int frch_ginsn_data_append (ginsnS *ginsn); +enum ginsn_gen_mode frch_ginsn_gen_mode (void); + +void label_ginsn_map_insert (symbolS *label, ginsnS *ginsn); +ginsnS *label_ginsn_map_find (symbolS *label); + +ginsnS *ginsn_new_symbol_func_begin (symbolS *sym); +ginsnS *ginsn_new_symbol_func_end (symbolS *sym); +ginsnS *ginsn_new_symbol_user_label (symbolS *sym); + +ginsnS* ginsn_new_phantom (symbolS *sym); +ginsnS *ginsn_new_symbol (symbolS *sym, bool real_p); +ginsnS *ginsn_new_add (symbolS *sym, bool real_p, + enum ginsn_src_type src1_type, uint32_t src1_val, int32_t src1_disp, + enum ginsn_src_type src2_type, uint32_t src2_val, int32_t src2_disp, + enum ginsn_dst_type dst_type, uint32_t dst_reg, int32_t dst_disp); +ginsnS *ginsn_new_and (symbolS *sym, bool real_p, + enum ginsn_src_type src1_type, uint32_t src1_val, int32_t src1_disp, + enum ginsn_src_type src2_type, uint32_t src2_val, int32_t src2_disp, + enum ginsn_dst_type dst_type, uint32_t dst_reg, int32_t dst_disp); +ginsnS *ginsn_new_call (symbolS *sym, bool real_p, + enum ginsn_src_type src_type, uint32_t src_val, + symbolS *src_text_sym); +ginsnS *ginsn_new_jump (symbolS *sym, bool real_p, + enum ginsn_src_type src_type, uint32_t src_val, + symbolS *src_ginsn_sym); +ginsnS *ginsn_new_jump_cond (symbolS *sym, bool real_p, + enum ginsn_src_type src_type, uint32_t src_val, + symbolS *src_ginsn_sym); +ginsnS *ginsn_new_mov (symbolS *sym, bool real_p, + enum ginsn_src_type src_type, uint32_t src_reg, int32_t src_disp, + enum ginsn_dst_type dst_type, uint32_t dst_reg, int32_t dst_disp); +ginsnS *ginsn_new_store (symbolS *sym, bool real_p, + enum ginsn_src_type src_type, uint32_t src_reg, + enum ginsn_dst_type dst_type, uint32_t dst_reg, int32_t dst_disp); +ginsnS *ginsn_new_load (symbolS *sym, bool real_p, + enum ginsn_src_type src_type, uint32_t src_reg, int32_t src_disp, + enum ginsn_dst_type dst_type, uint32_t dst_reg); +ginsnS *ginsn_new_sub (symbolS *sym, bool real_p, + enum ginsn_src_type src1_type, uint32_t src1_val, int32_t src1_disp, + enum ginsn_src_type src2_type, uint32_t src2_val, int32_t src2_disp, + enum ginsn_dst_type dst_type, uint32_t dst_reg, int32_t dst_disp); +ginsnS *ginsn_new_other (symbolS *sym, bool real_p, + enum ginsn_src_type src1_type, uint32_t src1_val, + enum ginsn_src_type src2_type, uint32_t src2_val, + enum ginsn_dst_type dst_type, uint32_t dst_reg); +ginsnS *ginsn_new_return (symbolS *sym, bool real_p); + +void ginsn_set_file_line (ginsnS *ginsn, const char *file, unsigned int line); + +bool ginsn_track_reg_p (uint32_t dw2reg, enum ginsn_gen_mode); + +int ginsn_link_next (ginsnS *ginsn, ginsnS *next); + +enum gcfg_err_code +{ + GCFG_OK = 0, + GCFG_JLABEL_NOT_PRESENT = 1, /* Warning-level code. */ +}; + +typedef struct gbb gbbS; +typedef struct gedge gedgeS; + +/* GBB - Basic block of generic GAS instructions. */ + +struct gbb +{ + ginsnS *first_ginsn; + ginsnS *last_ginsn; + int64_t num_ginsns; + + /* Identifier (linearly increasing natural number) for each gbb. Added for + debugging purpose only. */ + int64_t id; + + bool visited; + + int32_t num_out_gedges; + gedgeS *out_gedges; + + /* FIXME - keep a separate map or add like this. */ + /* SCFI state at the entry of basic block. */ + scfi_stateS *entry_state; + /* SCFI state at the exit of basic block. */ + scfi_stateS *exit_state; + /* A linked list. In order of addition. */ + gbbS *next; +}; + +struct gedge +{ + gbbS *dst_bb; + /* A linked list. In order of addition. */ + gedgeS *next; + bool visited; +}; + +/* Control flow graph of generic GAS instructions. */ + +struct gcfg +{ + int64_t num_gbbs; + gbbS *root_bb; +}; + +typedef struct gcfg gcfgS; + +#define bb_for_each_insn(bb, ginsn) \ + for (ginsn = bb->first_ginsn; ginsn; \ + ginsn = (ginsn != bb->last_ginsn) ? ginsn->next : NULL) + +#define bb_for_each_edge(bb, edge) \ + for (edge = (edge == NULL) ? bb->out_gedges : edge; edge; edge = edge->next) + +#define cfg_for_each_bb(cfg, bb) \ + for (bb = cfg->root_bb; bb; bb = bb->next) + +#define bb_get_first_ginsn(bb) \ + (bb->first_ginsn) + +#define bb_get_last_ginsn(bb) \ + (bb->last_ginsn) + +gcfgS *gcfg_build (symbolS *func, int *errp); +void gcfg_cleanup (gcfgS **gcfg); +gbbS *gcfg_get_rootbb (gcfgS *gcfg); +void gcfg_get_bbs_in_prog_order (gcfgS *gcfg, gbbS **prog_order_bbs); + +#endif /* GINSN_H. */ diff --git a/gas/listing.h b/gas/listing.h index a2cc1f51958..ff89f2219dd 100644 --- a/gas/listing.h +++ b/gas/listing.h @@ -29,6 +29,7 @@ #define LISTING_NOCOND 32 #define LISTING_MACEXP 64 #define LISTING_GENERAL 128 +#define LISTING_GINSN_SCFI 256 #define LISTING_DEFAULT (LISTING_LISTING | LISTING_HLL | LISTING_SYMBOLS) diff --git a/gas/read.c b/gas/read.c index 9068072493a..8ffc3d35ce1 100644 --- a/gas/read.c +++ b/gas/read.c @@ -42,6 +42,7 @@ #include "codeview.h" #include "wchar.h" #include "filenames.h" +#include "ginsn.h" #include @@ -1382,6 +1383,9 @@ read_a_source_file (const char *name) } #endif + if (flag_synth_cfi) + ginsn_data_end (symbol_temp_new_now ()); + #ifdef md_cleanup md_cleanup (); #endif diff --git a/gas/scfi.c b/gas/scfi.c new file mode 100644 index 00000000000..ca02ebe42ae --- /dev/null +++ b/gas/scfi.c @@ -0,0 +1,1222 @@ +/* scfi.c - Support for synthesizing DWARF CFI for hand-written asm. + 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 "scfi.h" +#include "subsegs.h" +#include "scfidw2gen.h" +#include "dw2gencfi.h" + +# if defined (TARGET_USE_SCFI) && defined (TARGET_USE_GINSN) + +/* Beyond the target defined number of registers to be tracked (SCFI_NUM_REGS), + keep the next register ID, in sequence, for REG_CFA. */ +#define REG_CFA (SCFI_NUM_REGS+1) +/* Define the total number of registers being tracked. Used as index into an + array of cfi_reglocS. */ +#define MAX_NUM_SCFI_REGS (REG_CFA+1) + +enum cfi_reglocstate +{ + CFI_UNDEFINED, + CFI_IN_REG, + CFI_ON_STACK +}; + +/* Location at which CFI register is saved. + + A CFI register (callee-saved registers, RA/LR) are always an offset from + the CFA. REG_CFA itself, however, may have REG_SP or REG_FP as base + register. Hence, keep the base reg ID and offset per tracked register. */ + +struct cfi_regloc +{ + /* Base reg ID (DWARF register number). */ + uint32_t base; + /* Location as offset from the CFA. */ + int32_t offset; + /* Current state of the CFI register. */ + enum cfi_reglocstate state; +}; + +typedef struct cfi_regloc cfi_reglocS; + +struct scfi_op_data +{ + const char *name; +}; + +typedef struct scfi_op_data scfi_op_dataS; + +/* SCFI operation. + + An SCFI operation represents a single atomic change to the SCFI state. + This can also be understood as an abstraction for what eventually gets + emitted as a DWARF CFI operation. */ + +struct scfi_op +{ + /* An SCFI op updates the state of either the CFA or other tracked + (callee-saved, REG_SP etc) registers. 'reg' is in the DWARF register + number space and must be strictly less than MAX_NUM_SCFI_REGS. */ + uint32_t reg; + /* Location of the reg. */ + cfi_reglocS loc; + /* DWARF CFI opcode. */ + uint32_t dw2cfi_op; + /* Some SCFI ops, e.g., for CFI_label, may need to carry additional data. */ + scfi_op_dataS *op_data; + /* A linked list. */ + struct scfi_op *next; +}; + +/* SCFI State - accumulated unwind information at a PC. + + SCFI state is the accumulated unwind information encompassing: + - REG_SP, REG_FP, + - RA, and + - all callee-saved registers. + + Note that SCFI_NUM_REGS is target/ABI dependent and is provided by the + backends. The backend must also identify the REG_SP, and REG_FP + registers. */ + +struct scfi_state +{ + cfi_reglocS regs[MAX_NUM_SCFI_REGS]; + cfi_reglocS scratch[MAX_NUM_SCFI_REGS]; + /* Current stack size. */ + int32_t stack_size; + /* Whether the stack size is known. + Stack size may become untraceable depending on the specific stack + manipulation machine instruction, e.g., rsp = rsp op reg instruction + makes the stack size untraceable. */ + bool traceable_p; +}; + +/* Initialize a new SCFI op. */ + +static scfi_opS * +init_scfi_op (void) +{ + scfi_opS *op = XCNEW (scfi_opS); + + return op; +} + +void +scfi_ops_cleanup (scfi_opS **head) +{ + scfi_opS *op; + scfi_opS *next; + + if (!head || !*head) + return; + + op = *head; + next = op->next; + + while (op) + { + free (op); + op = next; + next = op ? op->next : NULL; + } +} + +/* Compare two SCFI states. */ + +static int +cmp_scfi_state (scfi_stateS *state1, scfi_stateS *state2) +{ + int ret; + + if (!state1 || !state2) + ret = 1; + + /* Skip comparing the scratch[] value of registers. The user visible + unwind information is derived from the regs[] from the SCFI state. */ + ret = memcmp (state1->regs, state2->regs, + sizeof (cfi_reglocS) * MAX_NUM_SCFI_REGS); + ret |= state1->stack_size != state2->stack_size; + ret |= state1->traceable_p != state2->traceable_p; + + return ret; +} + +#if 0 +static void +scfi_state_update_reg (scfi_stateS *state, uint32_t dst, uint32_t base, + int32_t offset) +{ + if (dst >= MAX_NUM_SCFI_REGS) + return; + + state->regs[dst].base = base; + state->regs[dst].offset = offset; +} +#endif + +/* Update the SCFI state of REG as available on execution stack at OFFSET + from REG_CFA (BASE). + + Note that BASE must be REG_CFA, because any other base (REG_SP, REG_FP) + is by definition transitory in the function. */ + +static void +scfi_state_save_reg (scfi_stateS *state, uint32_t reg, uint32_t base, + int32_t offset) +{ + if (reg >= MAX_NUM_SCFI_REGS) + return; + + gas_assert (base == REG_CFA); + + state->regs[reg].base = base; + state->regs[reg].offset = offset; + state->regs[reg].state = CFI_ON_STACK; +} + +static void +scfi_state_restore_reg (scfi_stateS *state, uint32_t reg) +{ + if (reg >= MAX_NUM_SCFI_REGS) + return; + + /* Sanity check. See Rule 4. */ + gas_assert (state->regs[reg].state == CFI_ON_STACK); + gas_assert (state->regs[reg].base == REG_CFA); + + state->regs[reg].base = reg; + state->regs[reg].offset = 0; + /* PS: the register may still be on stack much after the restore, but the + SCFI state keeps the state as 'in register'. */ + state->regs[reg].state = CFI_IN_REG; +} + +/* Identify if the given GAS instruction GINSN saves a register + (of interest) on stack. */ + +static bool +ginsn_scfi_save_reg_p (ginsnS *ginsn, scfi_stateS *state) +{ + bool save_reg_p = false; + struct ginsn_src *src; + struct ginsn_dst *dst; + + src = ginsn_get_src1 (ginsn); + dst = ginsn_get_dst (ginsn); + + /* The first save to stack of callee-saved register is deemed as + register save. */ + if (!ginsn_track_reg_p (ginsn_get_src_reg (src), GINSN_GEN_SCFI) + || state->regs[ginsn_get_src_reg (src)].state == CFI_ON_STACK) + return save_reg_p; + + /* A register save insn may be an indirect mov. */ + if (ginsn->type == GINSN_TYPE_MOV + && ginsn_get_dst_type (dst) == GINSN_DST_INDIRECT + && (ginsn_get_dst_reg (dst) == REG_SP + || (ginsn_get_dst_reg (dst) == REG_FP + && state->regs[REG_CFA].base == REG_FP))) + save_reg_p = true; + /* or an explicit store to stack. */ + else if (ginsn->type == GINSN_TYPE_STORE + && ginsn_get_dst_type (dst) == GINSN_DST_INDIRECT + && ginsn_get_dst_reg (dst) == REG_SP) + save_reg_p = true; + + return save_reg_p; +} + +/* Identify if the given GAS instruction GINSN restores a register + (of interest) on stack. */ + +static bool +ginsn_scfi_restore_reg_p (ginsnS *ginsn, scfi_stateS *state) +{ + bool restore_reg_p = false; + struct ginsn_dst *dst; + struct ginsn_src *src1; + + dst = ginsn_get_dst (ginsn); + src1 = ginsn_get_src1 (ginsn); + + if (!ginsn_track_reg_p (ginsn_get_dst_reg (dst), GINSN_GEN_SCFI)) + return restore_reg_p; + + /* A register restore insn may be an indirect mov. */ + if (ginsn->type == GINSN_TYPE_MOV + && ginsn_get_src_type (src1) == GINSN_SRC_INDIRECT + && (ginsn_get_src_reg (src1) == REG_SP + || (ginsn_get_src_reg (src1) == REG_FP + && state->regs[REG_CFA].base == REG_FP))) + restore_reg_p = true; + /* or an explicit load from stack. */ + else if (ginsn->type == GINSN_TYPE_LOAD + && ginsn_get_src_type (src1) == GINSN_SRC_INDIRECT + && ginsn_get_src_reg (src1) == REG_SP) + restore_reg_p = true; + + return restore_reg_p; +} + +/* Append the SCFI operation OP to the list of SCFI operations in the + given GINSN. */ + +static int +ginsn_append_scfi_op (ginsnS *ginsn, scfi_opS *op) +{ + scfi_opS *sop; + + if (!ginsn || !op) + return 1; + + if (!ginsn->scfi_ops) + { + ginsn->scfi_ops = XCNEW (scfi_opS *); + *ginsn->scfi_ops = op; + } + else + { + /* Add to tail. Most ginsns have a single SCFI operation, + so this traversal for every insertion is acceptable for now. */ + sop = *ginsn->scfi_ops; + while (sop->next) + sop = sop->next; + + sop->next = op; + } + ginsn->num_scfi_ops++; + + return 0; +} + +static void +scfi_op_add_def_cfa_reg (scfi_stateS *state, ginsnS *ginsn, uint32_t reg) +{ + scfi_opS *op = NULL; + + state->regs[REG_CFA].base = reg; + + op = init_scfi_op (); + + op->dw2cfi_op = DW_CFA_def_cfa_register; + op->reg = REG_CFA; + op->loc = state->regs[REG_CFA]; + + ginsn_append_scfi_op (ginsn, op); +} + +static void +scfi_op_add_cfa_offset_inc (scfi_stateS *state, ginsnS *ginsn, int32_t num) +{ + scfi_opS *op = NULL; + + state->regs[REG_CFA].offset -= num; + + op = init_scfi_op (); + + op->dw2cfi_op = DW_CFA_def_cfa_offset; + op->reg = REG_CFA; + op->loc = state->regs[REG_CFA]; + + ginsn_append_scfi_op (ginsn, op); +} + +static void +scfi_op_add_cfa_offset_dec (scfi_stateS *state, ginsnS *ginsn, int32_t num) +{ + scfi_opS *op = NULL; + + state->regs[REG_CFA].offset += num; + + op = init_scfi_op (); + + op->dw2cfi_op = DW_CFA_def_cfa_offset; + op->reg = REG_CFA; + op->loc = state->regs[REG_CFA]; + + ginsn_append_scfi_op (ginsn, op); +} + +static void +scfi_op_add_def_cfa (scfi_stateS *state, ginsnS *ginsn, uint32_t reg, + int32_t num) +{ + scfi_opS *op = NULL; + + state->regs[REG_CFA].base = reg; + state->regs[REG_CFA].offset = num; + + op = init_scfi_op (); + + op->dw2cfi_op = DW_CFA_def_cfa; + op->reg = REG_CFA; + op->loc = state->regs[REG_CFA]; + + ginsn_append_scfi_op (ginsn, op); +} + +static void +scfi_op_add_cfi_offset (scfi_stateS *state, ginsnS *ginsn, uint32_t reg) +{ + scfi_opS *op = NULL; + + op = init_scfi_op (); + + op->dw2cfi_op = DW_CFA_offset; + op->reg = reg; + op->loc = state->regs[reg]; + + ginsn_append_scfi_op (ginsn, op); +} + +static void +scfi_op_add_cfa_restore (ginsnS *ginsn, uint32_t reg) +{ + scfi_opS *op = NULL; + + op = init_scfi_op (); + + op->dw2cfi_op = DW_CFA_restore; + op->reg = reg; + op->loc.base = -1; /* FIXME invalidate. */ + op->loc.offset = 0; + + ginsn_append_scfi_op (ginsn, op); +} + +static void +scfi_op_add_cfi_remember_state (ginsnS *ginsn) +{ + scfi_opS *op = NULL; + + op = init_scfi_op (); + + op->dw2cfi_op = DW_CFA_remember_state; + + ginsn_append_scfi_op (ginsn, op); +} + +static void +scfi_op_add_cfi_restore_state (ginsnS *ginsn) +{ + scfi_opS *op = NULL; + + op = init_scfi_op (); + + op->dw2cfi_op = DW_CFA_restore_state; + + /* FIXME - add to the beginning of the scfi_ops. */ + ginsn_append_scfi_op (ginsn, op); +} + +void +scfi_op_add_cfi_label (ginsnS *ginsn, const char *name) +{ + scfi_opS *op = NULL; + + op = init_scfi_op (); + op->dw2cfi_op = CFI_label; + op->op_data = XCNEW (scfi_op_dataS); + op->op_data->name = name; + + ginsn_append_scfi_op (ginsn, op); +} + +void +scfi_op_add_signal_frame (ginsnS *ginsn) +{ + scfi_opS *op = NULL; + + op = init_scfi_op (); + op->dw2cfi_op = CFI_signal_frame; + + ginsn_append_scfi_op (ginsn, op); +} + +static int +verify_heuristic_traceable_reg_fp (ginsnS *ginsn, scfi_stateS *state) +{ + /* The function uses this variable to issue error to user right away. */ + int fp_traceable_p = 0; + struct ginsn_dst *dst; + struct ginsn_src *src1; + struct ginsn_src *src2; + + src1 = ginsn_get_src1 (ginsn); + src2 = ginsn_get_src2 (ginsn); + dst = ginsn_get_dst (ginsn); + + /* Stack manipulation can be done in a variety of ways. A program may + allocate stack statically or may perform dynamic stack allocation in + the prologue. + + The SCFI machinery in GAS is based on some heuristics: + + - Rule 3 If the base register for CFA tracking is REG_FP, the program + must not clobber REG_FP, unless it is for switch to REG_SP based CFA + tracking (via say, a pop %rbp in X86). */ + + /* Check all applicable instructions with dest REG_FP, when the CFA base + register is REG_FP. */ + if (state->regs[REG_CFA].base == REG_FP && ginsn_get_dst_reg (dst) == REG_FP) + { + /* Excuse the add/sub with imm usage: They are OK. */ + if ((ginsn->type == GINSN_TYPE_ADD || ginsn->type == GINSN_TYPE_SUB) + && ginsn_get_src_reg (src1) == REG_FP + && ginsn_get_src_type (src2) == GINSN_SRC_IMM) + fp_traceable_p = 0; + /* REG_FP restore is OK too. */ + else if (ginsn->type == GINSN_TYPE_LOAD) + fp_traceable_p = 0; + /* mov's to memory with REG_FP base do not make REG_FP untraceable. */ + else if (ginsn_get_dst_type (dst) == GINSN_DST_INDIRECT + && (ginsn->type == GINSN_TYPE_MOV + || ginsn->type == GINSN_TYPE_STORE)) + fp_traceable_p = 0; + /* Manipulations of the values possibly on stack are OK too. */ + else if ((ginsn->type == GINSN_TYPE_ADD || ginsn->type == GINSN_TYPE_SUB + || ginsn->type == GINSN_TYPE_AND) + && ginsn_get_dst_type (dst) == GINSN_DST_INDIRECT) + fp_traceable_p = 0; + /* All other ginsns with REG_FP as destination make REG_FP not + traceable. */ + else + fp_traceable_p = 1; + } + + if (fp_traceable_p) + as_bad_where (ginsn->file, ginsn->line, + _("SCFI: usage of REG_FP as scratch not supported")); + + return fp_traceable_p; +} + +static int +verify_heuristic_traceable_stack_manipulation (ginsnS *ginsn, + scfi_stateS *state) +{ + /* The function uses this variable to issue error to user right away. */ + int sp_untraceable_p = 0; + bool possibly_untraceable = false; + struct ginsn_dst *dst; + struct ginsn_src *src1; + struct ginsn_src *src2; + + src1 = ginsn_get_src1 (ginsn); + src2 = ginsn_get_src2 (ginsn); + dst = ginsn_get_dst (ginsn); + + /* Stack manipulation can be done in a variety of ways. A program may + allocate stack statically in prologue or may need to do dynamic stack + allocation. + + The SCFI machinery in GAS is based on some heuristics: + + - Rule 1 The base register for CFA tracking may be either REG_SP or + REG_FP. + + - Rule 2 If the base register for CFA tracking is REG_SP, the precise + amount of stack usage (and hence, the value of rsp) must be known at + all times. */ + + if (ginsn->type == GINSN_TYPE_MOV + && ginsn_get_dst_type (dst) == GINSN_DST_REG + && ginsn_get_dst_reg (dst) == REG_SP + && ginsn_get_src_type (src1) == GINSN_SRC_REG + /* Exclude mov %rbp, %rsp from this check. */ + && ginsn_get_src_reg (src1) != REG_FP) + { + /* mov %reg, %rsp. */ + /* A previous mov %rsp, %reg must have been seen earlier for this to be + an OK for stack manipulation. */ + if (state->scratch[ginsn_get_src_reg (src1)].base != REG_CFA + || state->scratch[ginsn_get_src_reg (src1)].state != CFI_IN_REG) + { + possibly_untraceable = true; + } + } + /* Check add/sub/and insn usage when CFA base register is REG_SP. + Any stack size manipulation, including stack realignment is not allowed + if CFA base register is REG_SP. */ + else if (ginsn_get_dst_type (dst) == GINSN_DST_REG + && ginsn_get_dst_reg (dst) == REG_SP + && (((ginsn->type == GINSN_TYPE_ADD || ginsn->type == GINSN_TYPE_SUB) + && ginsn_get_src_type (src2) != GINSN_SRC_IMM) + || ginsn->type == GINSN_TYPE_AND)) + possibly_untraceable = true; + /* If a register save operation is seen when REG_SP is untraceable, + CFI cannot be synthesized for register saves, hence bail out. */ + else if (ginsn_scfi_save_reg_p (ginsn, state) && !state->traceable_p) + { + sp_untraceable_p = 1; + /* If, however, the register save is an REG_FP-based, indirect mov + like: mov reg, disp(%rbp) and CFA base register is REG_BP, + untraceable REG_SP is not a problem. */ + if (ginsn->type == GINSN_TYPE_MOV + && ginsn_get_dst_type (dst) == GINSN_DST_INDIRECT + && (ginsn_get_dst_reg (dst) == REG_FP + && state->regs[REG_CFA].base == REG_FP)) + sp_untraceable_p = 0; + } + else if (ginsn_scfi_restore_reg_p (ginsn, state) && !state->traceable_p) + { + if (ginsn->type == GINSN_TYPE_MOV + && ginsn_get_dst_type (dst) == GINSN_DST_INDIRECT + && (ginsn_get_src_reg (src1) == REG_SP + || (ginsn_get_src_reg (src1) == REG_FP + && state->regs[REG_CFA].base != REG_FP))) + sp_untraceable_p = 1; + } + + if (possibly_untraceable) + { + /* See Rule 2. For SP-based CFA, this makes CFA tracking not possible. + Propagate now to caller. */ + if (state->regs[REG_CFA].base == REG_SP) + sp_untraceable_p = 1; + else if (state->traceable_p) + { + /* An extension of Rule 2. + For FP-based CFA, this may be a problem *if* certain specific + changes to the SCFI state are seen beyond this point, e.g., + register save / restore from stack. */ + gas_assert (state->regs[REG_CFA].base == REG_FP); + /* Simply make a note in the SCFI state object for now and + continue. Indicate an error when register save / restore + for callee-saved registers is seen. */ + sp_untraceable_p = 0; + state->traceable_p = false; + } + } + + if (sp_untraceable_p) + as_bad_where (ginsn->file, ginsn->line, + _("SCFI: unsupported stack manipulation pattern")); + + return sp_untraceable_p; +} + +static int +verify_heuristic_symmetrical_restore_reg (scfi_stateS *state, ginsnS* ginsn) +{ + int sym_restore = true; + int32_t expected_offset = 0; + struct ginsn_src *src1; + struct ginsn_dst *dst; + uint32_t reg; + + /* Rule 4: Save and Restore of callee-saved registers must be symmetrical. + It is expected that value of the saved register is restored correctly. + E.g., + push reg1 + push reg2 + ... + body of func which uses reg1 , reg2 as scratch, + and may be even spills them to stack. + ... + pop reg2 + pop reg1 + It is difficult to verify the Rule 4 in all cases. For the SCFI machinery, + it is difficult to separate prologue-epilogue from the body of the function + + Hence, the SCFI machinery at this time, should only warn on an asymetrical + restore. */ + src1 = ginsn_get_src1 (ginsn); + dst = ginsn_get_dst (ginsn); + reg = ginsn_get_dst_reg (dst); + + /* For non callee-saved registers, calling the API is meaningless. */ + if (!ginsn_track_reg_p (ginsn_get_dst_reg (dst), GINSN_GEN_SCFI)) + return sym_restore; + + /* The register must have been saved on stack, for sure. */ + gas_assert (state->regs[reg].state == CFI_ON_STACK); + gas_assert (state->regs[reg].base == REG_CFA); + + if ((ginsn->type == GINSN_TYPE_MOV + || ginsn->type == GINSN_TYPE_LOAD) + && ginsn_get_src_type (src1) == GINSN_SRC_INDIRECT + && (ginsn_get_src_reg (src1) == REG_SP + || (ginsn_get_src_reg (src1) == REG_FP + && state->regs[REG_CFA].base == REG_FP))) + { + /* mov disp(%rsp), reg. */ + /* mov disp(%rbp), reg. */ + expected_offset = (((ginsn_get_src_reg (src1) == REG_SP) + ? -state->stack_size + : state->regs[REG_FP].offset) + + ginsn_get_src_disp (src1)); + } + + sym_restore = (expected_offset == state->regs[reg].offset); + + return sym_restore; +} + +/* Perform symbolic execution of the GINSN and update its list of scfi_ops. + scfi_ops are later used to directly generate the DWARF CFI directives. + Also update the SCFI state object STATE for the caller. */ + +static int +gen_scfi_ops (ginsnS *ginsn, scfi_stateS *state) +{ + int ret = 0; + int32_t offset; + struct ginsn_src *src1; + struct ginsn_src *src2; + struct ginsn_dst *dst; + + if (!ginsn || !state) + ret = 1; + + /* For the first ginsn (of type GINSN_TYPE_SYMBOL) in the gbb, generate + the SCFI op with DW_CFA_def_cfa. Note that the register and offset are + target-specific. */ + if (GINSN_F_FUNC_BEGIN_P (ginsn)) + { + scfi_op_add_def_cfa (state, ginsn, REG_SP, SCFI_INIT_CFA_OFFSET); + state->stack_size += SCFI_INIT_CFA_OFFSET; + return ret; + } + + src1 = ginsn_get_src1 (ginsn); + src2 = ginsn_get_src2 (ginsn); + dst = ginsn_get_dst (ginsn); + + ret = verify_heuristic_traceable_stack_manipulation (ginsn, state); + if (ret) + return ret; + + ret = verify_heuristic_traceable_reg_fp (ginsn, state); + if (ret) + return ret; + + switch (ginsn->dst.type) + { + case GINSN_DST_REG: + switch (ginsn->type) + { + case GINSN_TYPE_MOV: + if (ginsn_get_src_type (src1) == GINSN_SRC_REG + && ginsn_get_src_reg (src1) == REG_SP + && ginsn_get_dst_reg (dst) == REG_FP + && state->regs[REG_CFA].base == REG_SP + /* That REG_FP has just been saved on stack previously. This + check guards against the case that there is stack usage + between the two insns: + pushq %rbp + ...stack usage + mov %rsp, %rbp + Do not switch CFA tracking in this case. */ + && state->regs[REG_FP].offset == -state->stack_size) + { + /* mov %rsp, %rbp. */ + scfi_op_add_def_cfa_reg (state, ginsn, ginsn_get_dst_reg (dst)); + } + else if (ginsn_get_src_type (src1) == GINSN_SRC_REG + && ginsn_get_src_reg (src1) == REG_FP + && ginsn_get_dst_reg (dst) == REG_SP + && state->regs[REG_CFA].base == REG_FP) + { + /* mov %rbp, %rsp. */ + state->stack_size = -state->regs[REG_FP].offset; + scfi_op_add_def_cfa_reg (state, ginsn, ginsn_get_dst_reg (dst)); + state->traceable_p = true; + } + else if (ginsn_get_src_type (src1) == GINSN_SRC_INDIRECT + && (ginsn_get_src_reg (src1) == REG_SP + || ginsn_get_src_reg (src1) == REG_FP) + && ginsn_track_reg_p (ginsn_get_dst_reg (dst), GINSN_GEN_SCFI)) + { + /* mov disp(%rsp), reg. */ + /* mov disp(%rbp), reg. */ + if (verify_heuristic_symmetrical_restore_reg (state, ginsn)) + { + scfi_state_restore_reg (state, ginsn_get_dst_reg (dst)); + scfi_op_add_cfa_restore (ginsn, ginsn_get_dst_reg (dst)); + } + else + as_warn_where (ginsn->file, ginsn->line, + _("SCFI: asymetrical register restore")); + } + else if (ginsn_get_src_type (src1) == GINSN_SRC_REG + && ginsn_get_dst_type (dst) == GINSN_DST_REG + && ginsn_get_src_reg (src1) == REG_SP) + { + /* mov %rsp, %reg. */ + /* The value of rsp is taken directly from state->stack_size. + IMP: The workflow in gen_scfi_ops must keep it updated. + PS: Not taking the value from state->scratch[REG_SP] is + intentional. */ + state->scratch[ginsn_get_dst_reg (dst)].base = REG_CFA; + state->scratch[ginsn_get_dst_reg (dst)].offset = -state->stack_size; + state->scratch[ginsn_get_dst_reg (dst)].state = CFI_IN_REG; + } + else if (ginsn_get_src_type (src1) == GINSN_SRC_REG + && ginsn_get_dst_type (dst) == GINSN_DST_REG + && ginsn_get_dst_reg (dst) == REG_SP) + { + /* mov %reg, %rsp. */ + /* Keep the value of REG_SP updated. */ + if (state->scratch[ginsn_get_src_reg (src1)].state == CFI_IN_REG) + { + state->stack_size = -state->scratch[ginsn_get_src_reg (src1)].offset; + state->traceable_p = true; + } +# if 0 + scfi_state_update_reg (state, ginsn_get_dst_reg (dst), + state->scratch[ginsn_get_src_reg (src1)].base, + state->scratch[ginsn_get_src_reg (src1)].offset); +#endif + + } + break; + case GINSN_TYPE_SUB: + if (ginsn_get_src_reg (src1) == REG_SP + && ginsn_get_dst_reg (dst) == REG_SP) + { + /* Stack inc/dec offset, when generated due to stack push and pop is + target-specific. Use the value encoded in the ginsn. */ + state->stack_size += ginsn_get_src_imm (src2); + if (state->regs[REG_CFA].base == REG_SP) + { + /* push reg. */ + scfi_op_add_cfa_offset_dec (state, ginsn, ginsn_get_src_imm (src2)); + } + } + break; + case GINSN_TYPE_ADD: + if (ginsn_get_src_reg (src1) == REG_SP + && ginsn_get_dst_reg (dst) == REG_SP) + { + /* Stack inc/dec offset is target-specific. Use the value + encoded in the ginsn. */ + state->stack_size -= ginsn_get_src_imm (src2); + /* pop %reg affects CFA offset only if CFA is currently + stack-pointer based. */ + if (state->regs[REG_CFA].base == REG_SP) + { + scfi_op_add_cfa_offset_inc (state, ginsn, ginsn_get_src_imm (src2)); + } + } + else if (ginsn_get_src_reg (src1) == REG_FP + && ginsn_get_dst_reg (dst) == REG_SP + && state->regs[REG_CFA].base == REG_FP) + { + /* FIXME - what is this for ? */ + state->stack_size = 0 - (state->regs[REG_FP].offset + ginsn_get_src_imm (src2)); + } + break; + case GINSN_TYPE_LOAD: + /* If this is a load from stack. */ + if (ginsn_get_src_type (src1) == GINSN_SRC_INDIRECT + && (ginsn_get_src_reg (src1) == REG_SP + || (ginsn_get_src_reg (src1) == REG_FP + && state->regs[REG_CFA].base == REG_FP))) + { + /* pop %rbp when CFA tracking is REG_FP based. */ + if (ginsn_get_dst_reg (dst) == REG_FP + && state->regs[REG_CFA].base == REG_FP) + { + scfi_op_add_def_cfa_reg (state, ginsn, REG_SP); + } + if (ginsn_track_reg_p (ginsn_get_dst_reg (dst), GINSN_GEN_SCFI)) + { + if (verify_heuristic_symmetrical_restore_reg (state, ginsn)) + { + scfi_state_restore_reg (state, ginsn_get_dst_reg (dst)); + scfi_op_add_cfa_restore (ginsn, ginsn_get_dst_reg (dst)); + } + else + as_warn_where (ginsn->file, ginsn->line, + _("SCFI: asymetrical register restore")); + } + } + break; + default: + break; + } + break; + + case GINSN_DST_INDIRECT: + /* Some operations with an indirect access to memory (or even to stack) + may still be uninteresting for SCFI purpose (e.g, addl %edx, -32(%rsp) + in x86). In case of x86_64, these can neither be a register + save / unsave, nor can alter the stack size. + PS: This condition may need to be revisited for other arches. */ + if (ginsn->type == GINSN_TYPE_ADD || ginsn->type == GINSN_TYPE_SUB + || ginsn->type == GINSN_TYPE_AND) + break; + + gas_assert (ginsn->type == GINSN_TYPE_MOV + || ginsn->type == GINSN_TYPE_STORE); + /* mov reg, disp(%rbp) */ + /* mov reg, disp(%rsp) */ + if (ginsn_scfi_save_reg_p (ginsn, state)) + { + if (ginsn_get_dst_reg (dst) == REG_SP) + { + /* mov reg, disp(%rsp) */ + offset = 0 - state->stack_size + ginsn_get_dst_disp (dst); + scfi_state_save_reg (state, ginsn_get_src_reg (src1), REG_CFA, offset); + scfi_op_add_cfi_offset (state, ginsn, ginsn_get_src_reg (src1)); + } + else if (ginsn_get_dst_reg (dst) == REG_FP) + { + gas_assert (state->regs[REG_CFA].base == REG_FP); + /* mov reg, disp(%rbp) */ + offset = 0 - state->regs[REG_CFA].offset + ginsn_get_dst_disp (dst); + scfi_state_save_reg (state, ginsn_get_src_reg (src1), REG_CFA, offset); + scfi_op_add_cfi_offset (state, ginsn, ginsn_get_src_reg (src1)); + } + } + break; + + default: + /* Skip GINSN_DST_UNKNOWN and GINSN_DST_MEM as they are uninteresting + currently for SCFI. */ + break; + } + + return ret; +} + +/* Recursively perform forward flow of the (unwind information) SCFI state + starting at basic block GBB. + + The forward flow process propagates the SCFI state at exit of a basic block + to the successor basic block. + + Returns error code, if any. */ + +static int +forward_flow_scfi_state (gcfgS *gcfg, gbbS *gbb, scfi_stateS *state) +{ + ginsnS *ginsn; + gbbS *prev_bb; + gedgeS *gedge = NULL; + int ret = 0; + + if (gbb->visited) + { + /* Check that the SCFI state is the same as previous. */ + ret = cmp_scfi_state (state, gbb->entry_state); + if (ret) + as_bad (_("SCFI: Bad CFI propagation perhaps")); + return ret; + } + + gbb->visited = true; + + gbb->entry_state = XCNEW (scfi_stateS); + memcpy (gbb->entry_state, state, sizeof (scfi_stateS)); + + /* Perform symbolic execution of each ginsn in the gbb and update the + scfi_ops list of each ginsn (and also update the STATE object). */ + bb_for_each_insn(gbb, ginsn) + { + ret = gen_scfi_ops (ginsn, state); + if (ret) + goto fail; + } + + gbb->exit_state = XCNEW (scfi_stateS); + memcpy (gbb->exit_state, state, sizeof (scfi_stateS)); + + /* Forward flow the SCFI state. Currently, we process the next basic block + in DFS order. But any forward traversal order should be fine. */ + prev_bb = gbb; + if (gbb->num_out_gedges) + { + bb_for_each_edge(gbb, gedge) + { + gbb = gedge->dst_bb; + if (gbb->visited) + { + ret = cmp_scfi_state (gbb->entry_state, state); + if (ret) + goto fail; + } + + if (!gedge->visited) + { + gedge->visited = true; + + /* Entry SCFI state for the destination bb of the edge is the + same as the exit SCFI state of the source bb of the edge. */ + memcpy (state, prev_bb->exit_state, sizeof (scfi_stateS)); + ret = forward_flow_scfi_state (gcfg, gbb, state); + if (ret) + goto fail; + } + } + } + + return 0; + +fail: + + if (gedge) + gedge->visited = true; + return 1; +} + +static int +backward_flow_scfi_state (symbolS *func ATTRIBUTE_UNUSED, gcfgS *gcfg) +{ + gbbS **prog_order_bbs; + gbbS **restore_bbs; + gbbS *current_bb; + gbbS *prev_bb; + gbbS *dst_bb; + ginsnS *ginsn; + gedgeS *gedge = NULL; + + int ret = 0; + int i, j; + + /* Basic blocks in reverse program order. */ + prog_order_bbs = XCNEWVEC (gbbS *, gcfg->num_gbbs); + /* Basic blocks for which CFI remember op needs to be generated. */ + restore_bbs = XCNEWVEC (gbbS *, gcfg->num_gbbs); + + gcfg_get_bbs_in_prog_order (gcfg, prog_order_bbs); + + i = gcfg->num_gbbs - 1; + /* Traverse in reverse program order. */ + while (i > 0) + { + current_bb = prog_order_bbs[i]; + prev_bb = prog_order_bbs[i-1]; + if (cmp_scfi_state (prev_bb->exit_state, current_bb->entry_state)) + { + /* Candidate for .cfi_restore_state found. */ + ginsn = bb_get_first_ginsn (current_bb); + scfi_op_add_cfi_restore_state (ginsn); + /* Memorize current_bb now to find location for its remember state + later. */ + restore_bbs[i] = current_bb; + } + else + { + bb_for_each_edge (current_bb, gedge) + { + dst_bb = gedge->dst_bb; + for (j = 0; j < gcfg->num_gbbs; j++) + if (restore_bbs[j] == dst_bb) + { + ginsn = bb_get_last_ginsn (current_bb); + scfi_op_add_cfi_remember_state (ginsn); + /* Remove the memorised restore_bb from the list. */ + restore_bbs[j] = NULL; + break; + } + } + } + i--; + } + + /* All .cfi_restore_state pseudo-ops must have a corresponding + .cfi_remember_state by now. */ + for (j = 0; j < gcfg->num_gbbs; j++) + if (restore_bbs[j] != NULL) + { + ret = 1; + break; + } + + free (restore_bbs); + free (prog_order_bbs); + + return ret; +} + +/* Synthesize DWARF CFI for a function. */ + +int +scfi_synthesize_dw2cfi (symbolS *func, gcfgS *gcfg, gbbS *root_bb) +{ + int ret; + scfi_stateS *init_state; + + init_state = XCNEW (scfi_stateS); + init_state->traceable_p = true; + + /* Traverse the input GCFG and perform forward flow of information. + Update the scfi_op(s) per ginsn. */ + ret = forward_flow_scfi_state (gcfg, root_bb, init_state); + if (ret) + { + as_warn (_("SCFI: forward pass failed for func '%s'"), S_GET_NAME (func)); + goto end; + } + + ret = backward_flow_scfi_state (func, gcfg); + if (ret) + { + as_warn (_("SCFI: backward pass failed for func '%s'"), S_GET_NAME (func)); + goto end; + } + +end: + free (init_state); + return ret; +} + +static int +handle_scfi_dot_cfi (ginsnS *ginsn) +{ + scfi_opS *op; + + /* Nothing to do. */ + if (!ginsn->scfi_ops) + return 0; + + op = *ginsn->scfi_ops; + if (!op) + goto bad; + + while (op) + { + switch (op->dw2cfi_op) + { + case DW_CFA_def_cfa_register: + scfi_dot_cfi (DW_CFA_def_cfa_register, op->loc.base, 0, 0, NULL, + ginsn->sym); + break; + case DW_CFA_def_cfa_offset: + scfi_dot_cfi (DW_CFA_def_cfa_offset, op->loc.base, 0, + op->loc.offset, NULL, ginsn->sym); + break; + case DW_CFA_def_cfa: + scfi_dot_cfi (DW_CFA_def_cfa, op->loc.base, 0, op->loc.offset, + NULL, ginsn->sym); + break; + case DW_CFA_offset: + scfi_dot_cfi (DW_CFA_offset, op->reg, 0, op->loc.offset, NULL, + ginsn->sym); + break; + case DW_CFA_restore: + scfi_dot_cfi (DW_CFA_restore, op->reg, 0, 0, NULL, ginsn->sym); + break; + case DW_CFA_remember_state: + scfi_dot_cfi (DW_CFA_remember_state, 0, 0, 0, NULL, ginsn->sym); + break; + case DW_CFA_restore_state: + scfi_dot_cfi (DW_CFA_restore_state, 0, 0, 0, NULL, ginsn->sym); + break; + case CFI_label: + scfi_dot_cfi (CFI_label, 0, 0, 0, op->op_data->name, ginsn->sym); + break; + case CFI_signal_frame: + scfi_dot_cfi (CFI_signal_frame, 0, 0, 0, NULL, ginsn->sym); + break; + default: + goto bad; + break; + } + op = op->next; + } + + return 0; +bad: + as_bad (_("SCFI: Invalid DWARF CFI opcode data")); + return 1; +} + +/* Emit Synthesized DWARF CFI. */ + +int +scfi_emit_dw2cfi (symbolS *func) +{ + struct frch_ginsn_data *frch_gdata; + ginsnS* ginsn = NULL; + + frch_gdata = frchain_now->frch_ginsn_data; + ginsn = frch_gdata->gins_rootP; + + while (ginsn) + { + switch (ginsn->type) + { + case GINSN_TYPE_SYMBOL: + /* .cfi_startproc and .cfi_endproc pseudo-ops. */ + if (GINSN_F_FUNC_BEGIN_P (ginsn)) + { + scfi_dot_cfi_startproc (frch_gdata->start_addr); + break; + } + else if (GINSN_F_FUNC_END_P (ginsn)) + { + scfi_dot_cfi_endproc (ginsn->sym); + break; + } + /* Fall through. */ + case GINSN_TYPE_ADD: + case GINSN_TYPE_AND: + case GINSN_TYPE_CALL: + case GINSN_TYPE_JUMP: + case GINSN_TYPE_JUMP_COND: + case GINSN_TYPE_MOV: + case GINSN_TYPE_LOAD: + case GINSN_TYPE_PHANTOM: + case GINSN_TYPE_STORE: + case GINSN_TYPE_SUB: + case GINSN_TYPE_OTHER: + case GINSN_TYPE_RETURN: + + /* For all other SCFI ops, invoke the handler. */ + if (ginsn->scfi_ops) + handle_scfi_dot_cfi (ginsn); + break; + + default: + /* No other GINSN_TYPE_* expected. */ + as_bad (_("SCFI: bad ginsn for func '%s'"), + S_GET_NAME (func)); + break; + } + ginsn = ginsn->next; + } + return 0; +} + +#else + +int +scfi_emit_dw2cfi (symbolS *func ATTRIBUTE_UNUSED) +{ + as_bad (_("SCFI: unsupported for target")); + return 1; +} + +int +scfi_synthesize_dw2cfi (symbolS *func ATTRIBUTE_UNUSED, + gcfgS *gcfg ATTRIBUTE_UNUSED, + gbbS *root_bb ATTRIBUTE_UNUSED) +{ + as_bad (_("SCFI: unsupported for target")); + return 1; +} + +#endif /* defined (TARGET_USE_SCFI) && defined (TARGET_USE_GINSN). */ diff --git a/gas/scfi.h b/gas/scfi.h new file mode 100644 index 00000000000..3eb1bf9ddd7 --- /dev/null +++ b/gas/scfi.h @@ -0,0 +1,38 @@ +/* scfi.h - Support for synthesizing CFI for asm. + 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 SCFI_H +#define SCFI_H + +#include "as.h" +#include "ginsn.h" + +void scfi_ops_cleanup (scfi_opS **head); + +/* Some SCFI ops are added externally when parsing the assembler input. + Two examples are CFI_label, and CFI_signal_frame. */ +void scfi_op_add_cfi_label (ginsnS *ginsn, const char *name); +void scfi_op_add_signal_frame (ginsnS *ginsn); + +int scfi_emit_dw2cfi (symbolS *func); + +int scfi_synthesize_dw2cfi (symbolS *func, gcfgS *gcfg, gbbS *root_bb); + +#endif /* SCFI_H. */ diff --git a/gas/scfidw2gen.c b/gas/scfidw2gen.c index 188699a882f..613ef919a1e 100644 --- a/gas/scfidw2gen.c +++ b/gas/scfidw2gen.c @@ -19,6 +19,8 @@ 02110-1301, USA. */ #include "as.h" +#include "ginsn.h" +#include "scfi.h" #include "dw2gencfi.h" #include "subsegs.h" #include "scfidw2gen.h" @@ -87,15 +89,33 @@ dot_scfi_sections (int ignored ATTRIBUTE_UNUSED) static void scfi_process_cfi_label (void) { - /* To be implemented. */ - return; + 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) { - /* To be implemented. */ - return; + ginsnS *ginsn; + + ginsn = ginsn_new_phantom (symbol_temp_new_now ()); + frch_ginsn_data_append (ginsn); + + scfi_op_add_signal_frame (ginsn); } static void diff --git a/gas/subsegs.c b/gas/subsegs.c index ae42b4e76d9..6b9834c8566 100644 --- a/gas/subsegs.c +++ b/gas/subsegs.c @@ -131,6 +131,7 @@ subseg_set_rest (segT seg, subsegT subseg) newP->frch_frag_now = frag_alloc (&newP->frch_obstack); newP->frch_frag_now->fr_type = rs_fill; newP->frch_cfi_data = NULL; + newP->frch_ginsn_data = NULL; newP->frch_root = newP->frch_last = newP->frch_frag_now; diff --git a/gas/subsegs.h b/gas/subsegs.h index ace0657bdfb..c90c5622465 100644 --- a/gas/subsegs.h +++ b/gas/subsegs.h @@ -40,6 +40,7 @@ #include "obstack.h" struct frch_cfi_data; +struct frch_ginsn_data; struct frchain /* control building of a frag chain */ { /* FRCH = FRagment CHain control */ @@ -52,6 +53,7 @@ struct frchain /* control building of a frag chain */ struct obstack frch_obstack; /* for objects in this frag chain */ fragS *frch_frag_now; /* frag_now for this subsegment */ struct frch_cfi_data *frch_cfi_data; + struct frch_ginsn_data *frch_ginsn_data; }; typedef struct frchain frchainS; diff --git a/gas/symbols.c b/gas/symbols.c index 45e46ed39b7..b595ffad104 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -25,6 +25,7 @@ #include "obstack.h" /* For "symbols.h" */ #include "subsegs.h" #include "write.h" +#include "scfi.h" #include #ifndef CHAR_BIT @@ -709,6 +710,8 @@ colon (/* Just seen "x:" - rattle symbols & frags. */ #ifdef obj_frob_label obj_frob_label (symbolP); #endif + if (flag_synth_cfi) + ginsn_frob_label (symbolP); return symbolP; } From patchwork Mon Oct 30 16:51:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 159814 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2354851vqb; Mon, 30 Oct 2023 09:52:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEZE/ho5DjvnBnkL3mbFIXjTHXpJCqOjjF2vNaAaRxzpkEikypRDbijI3LDlwEFb1IU/CAz X-Received: by 2002:a05:620a:2907:b0:774:2dc0:649b with SMTP id m7-20020a05620a290700b007742dc0649bmr260125qkp.18.1698684778453; Mon, 30 Oct 2023 09:52:58 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1698684778; cv=pass; d=google.com; s=arc-20160816; b=JtaHGwIuxdGpK3UeygcZI+H2KJC4PfMZ06JY6xmpliLBncWXjxSXGGtyG86Fv63Acc Z0O7GXF6egWITJ7c3mLsl+ZWQyw9SzeQYZFFqaYucmYrAZBIhwCJZYYNFCGBn0VYTDSV N1wIacZ8wvEmRjGkFL2A1J5GqYesMYmfNuv/9cWr5lZZi46esor41LLxmhWdzVnpk4BN mi8A9wStaHcFXBECMykN8XICHiF7oe4v7vu2wn57EpFp3VJu5QUrTTdj0At7ZTjbL5UH Hftp39yzXhlLEM5rldLZjJs/ncCk0+l3ng2+TOa67axxNOPUKLdnsH+F1jtM4atYAyD1 g+sw== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version :content-transfer-encoding:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-signature:arc-filter :dmarc-filter:delivered-to; bh=iyPs7cGx+3yC2qlXbpOIPaubESDAQoZuk0aATXrEGjg=; fh=Oh0rwXgL2pcS1FQHr6E1Hal1K7kVHmZXDthN47bNt4Q=; b=xOPjRl5mW39ozV2wb5dmYgBzgbAncJLaeIG8WI0VC7MY7CbAsUFdIm4D7iPi3UIf6r q7tfj7wgUVw/3iNohu7NYLfpv9oaFXjDbk478mli3PnXt5pnb+ehWU8myIb1R0UVfqNk Rfb37/Aerz4r5Kme3Wbm+hnP5fI+AXPN6u+Z4a4OmoD5phofc5ljUrNSNY4BZ3C4DUZ1 lYUDuUPDiiYDFuK5SRAk1JOLkWKxYccb66t1UobauH+6CmnptU0GpivC6g0z/EytxlZi BEEHrtoUoMiFcm1L9sq9uRpTDhT6mZpZ+loDUWMfDbQ3YoEZskZDkHdZgIUCiW8GZJjC E+sA== ARC-Authentication-Results: i=3; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=FTDVGa8S; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=svh5QU7G; arc=pass (i=2); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id h11-20020a37c44b000000b0076dbbc2aaf9si5910393qkm.179.2023.10.30.09.52.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 09:52:58 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=FTDVGa8S; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=svh5QU7G; arc=pass (i=2); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (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 4E244386180F for ; Mon, 30 Oct 2023 16:52:36 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 3621F385C6DA for ; Mon, 30 Oct 2023 16:52:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3621F385C6DA 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 3621F385C6DA 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=1698684751; cv=pass; b=CMociPP8EyCxiciISC5EY8l2EGJ4jAEdGl2QDmeiM11JlhTiw/T/4Ww9yncyDMWYBJsvZz5MsgJehFsSzXiNHhfbbaVmEGcsy1JL+26qPA0oEx6G+lN2tfvL822wTe2Spg/1OGuVzq+c+yTc6j1QrW3x557McLXck5r1agKbsVY= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1698684751; c=relaxed/simple; bh=WHyEYsmF23t3UY2IYpBAqn2XCW9Xb12FixPw7Fv4Kes=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=ajBghRbgNK2sZPzkCy60iWJb2fhMiCJcteLDezyI9aa0NzhOG4Dc48k1oYc76kSH3lCfGAud5Ve90+UxiBKzG5GbGpcNVWla4F0dzB3vzAAkepBO/XsCV0Brob29mqeWMaIhgE9b1shovzc52SrjBf7G9sbP+2ttUz0kngOzHWc= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39UDh09B012062 for ; Mon, 30 Oct 2023 16:52:28 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=iyPs7cGx+3yC2qlXbpOIPaubESDAQoZuk0aATXrEGjg=; b=FTDVGa8SYHb4ht2aODU8vXMOu8/LS0+/o0ewDL14FoclALo+YtPFUiBZ0lrRv+9Va/YX GPv24skQaP+DMmSdCsd/9hmDptHit8J5+7q/r23yzgUc9WKXzcoejSt2Y2EEibqCy+3w OfGqhjMHgEN3K3zqCV5ytSCPz/voFR1RN6sfmcjK25YO9nuVnRD52Q08v3sv98QTMt72 6GmmTaoYSlOSWRxXuEnJ15Y2SVM08qXOGZCPm85xnY8Ay46aBjZissLz6WMJ87ENhUWr w35bZ08YbvQMdrqJypyWJU3ds6wT7v6/37I97eYkBteglYkqObhKhDU9sSIZX+8qQPlu IQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3u0s7bu8wk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 30 Oct 2023 16:52:28 +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 39UFYW8D020060 for ; Mon, 30 Oct 2023 16:52:27 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3u0rr4k8c6-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 30 Oct 2023 16:52:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kAdWIUvbLa3E72mF7Zvo1qJGddg91nVzN1jlTS+dplCai7bHcbwc/7u6RKzIEjCVYejG31FGxNcFdcyCKDnGKY4jaOhg7AXf+a3bF0e9tnu3z23MjT8quFACiy5n5yRjdQ5MBmD3Q+hOKthlHRaGgh6KQuLu68NTcat6yltEkXTB9+9fVXqOP7gZb9+YE9lc/AvbAyln9aNZB1K3afwSxgicrvq8t+HRKi6Y8+HyRjUP8aAp7YibkjVJ5MYGMFM6POPE8dBf2/zeSZ+73yoge2uK6LuhkjhIDvstNNmVE0BItYESasvyvoO3x8BssNcqm9PreR7F5XQAAyilAyVSqw== 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=iyPs7cGx+3yC2qlXbpOIPaubESDAQoZuk0aATXrEGjg=; b=IeJzu2zOuprYFjgKuUfaC5WgYhDhl56iNqd2gz9ZCKnqRz7kiETotOA2sGUYPrSAl1V5h9IzbZO3fgAM4D6GYZqu4PPCjF9YUmVbqBQo13LSZUQ2X//rJYPsePVLWtwjASXWKZ/V/pz9T/BBpSepEPI1V0apECTIi3hEwc8iah+er3pLL7X/7TmxjkVTWc93h379RSfnipOkXlazR5ByyHpG2Brfq0BuxpSqLXHuW4ySC2JSXJTlhLjGkNud9OrezPZlVDw1kn4CQx20sBG4skYAMMT5Of1rkvogt9m2a+H9IK8nGqEPBxtqb0t+8Ui742n1uaZFCOyxRQhP1uyflA== 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=iyPs7cGx+3yC2qlXbpOIPaubESDAQoZuk0aATXrEGjg=; b=svh5QU7Gyy7vcAHLzFWOvo22iuWtH2FuppygM10rU0c0f0excf3RA7s7YFnOROkHt3wRDFHG6gE2txL/9xAbw8+R33yNhMgcvZ2xAZSyCaU5zMhBTKjmLnxSzIbSeqJH5jvekOjSDxUndKCvPtEGU3jcmjEY0hZ/DHE8cN9CTmI= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by DM4PR10MB6253.namprd10.prod.outlook.com (2603:10b6:8:b7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Mon, 30 Oct 2023 16:52:24 +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; Mon, 30 Oct 2023 16:52:24 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH, V2 08/10] gas: doc: update documentation for the new listing option Date: Mon, 30 Oct 2023 09:51:35 -0700 Message-ID: <20231030165137.2570939-9-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231030165137.2570939-1-indu.bhagat@oracle.com> References: <20231030165137.2570939-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR03CA0175.namprd03.prod.outlook.com (2603:10b6:303:8d::30) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|DM4PR10MB6253:EE_ X-MS-Office365-Filtering-Correlation-Id: 973f27eb-f9f5-413c-8709-08dbd9689784 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pC5iOc4RbKJnLk8a/90tftadIZtqoyHJVPvAoMxZSndehS6IgJw7r5L2V/01iwm9VUkEG+JLkuZzRpAyDPywqv9E4x17RIuvibVvJP2Il2k9BscA/P5dC3Ge8x75Dn+SkJjXA7bc1JUVdED8pYItlQoKw44TrTCkKTMTLAwA29Qrha2Tu8hxl9rPenIxQA7d9uZ66oqW77SjPVgfwVsCylFaYDBGzXB/i++cFH/tRWjS+M5xnU491VNkutRhFDSuSVjR7Lduo20uUMwwSY9nt4Z1cP2SKXhGgvndN2cb/fqhuw6LQNkNFpGQeKFf47BaqtaTRA9rtkZeovNWbZiPWBPwqEZ3iTZaCeBQYkXiIEWSJVV7pnpqchaTqvQ+Q/CKfAQBOAbW+zGACJEKzWD5U9nTWmGrH82UTSWUUCUty9XjHNsFW/HcJ3zn+NzE2kklPMNrG7fETD7pB3LxJX2fetTNx101vRE+qVm3xZ/uetutXM1Ct7ahkZDiq5ww6CMYlgyEj6Ra2O6qBq4Te5zV6Tg5L5f43Bb/2cKJY50dU0uf6QM3UxMv0HKe7Ak9HYiO 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)(346002)(376002)(39860400002)(396003)(366004)(136003)(230922051799003)(1800799009)(186009)(64100799003)(451199024)(6666004)(36756003)(2616005)(6512007)(6506007)(66556008)(316002)(6486002)(66476007)(478600001)(66946007)(107886003)(1076003)(83380400001)(38100700002)(86362001)(8936002)(41300700001)(2906002)(4326008)(8676002)(6916009)(44832011)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CR6QBbCHhVruTzHbMKp6BW/2dS5LOJfo8RF9cG8nV1LXMipwQMDwsqCHCovPUqi8b3673E+6ZxcROLJ4bJED67L33dg7xEFnvnSlmKsv7r/dm30kJY0uiKNn8yp2GlBz2/OvWjCcvDZWf5pT2xh50wWclqrqDpKfL5TFkX6kyOG3LD5IkICh1CCAGTxDOogxLCNr5NOAWRNeFzF8FZBp/tfRdsxzuXpC/AmypvphqWIVY8Qo4/PRvqtdqSr75NvHXPl6U8G/uaSY6z0azZTB3eFnGJLYdGKdM8OXfp6/eiqcFX6GWTKfz4i4Ny89nxg7p4oqJJhlC2F1ivxBzvFF3vs7sgoY8vyZmeAIaS9foB8PXjSnrU8lZ/OP/lCMiG0h7MMTgawupJSpVQr/yofgbP6DoUFXTrXSdU9w+EsW/uc9yuVITTDQ06vgI7X+Gh+6KGag9mggbFDIZTbS2AYysM3DEbQ6eVUUjzL9AHNdEyYanrcHPNMXliVz9ERGdJ3XMy+N0XE6NwrYSh//TxNZ0G4pgmAp9zrShc+2uoNc7C311FM4HKZFPIU4sovHkWl/fhsd9IiRW6dI4/GYdvtY6uL8jCABrKuIL18yn0Yid+V9KvhNe9NmxTH9EhljF05e/YUkq3iwWILWeIINocFMto/q6OlG8GwVOhbAF154wVJCR2ZFzm0Aet3doO3P42F0UFkxUeSl+A0S484lXLQnI++9LH+XYjXljqFRWaw8hSN2q0nG98XdqPQlCKB5EWwkQWtqBrAtPKFcsMUxcNtwB0kFvwehj/2Wc1bYVUw3MEHwOVAw92b+kEKTeRdJy5sS58k7bFUHjmzwkGKyDvljj+oVkmz2UJDkqzOuqcHLjvVxDdF46yBvued+CXLuZNf2EiF6qjWOnnIdMkHC5k9MTKlh2xF4X4Py5dI7k666eIYH4dJ0YXzdD95O2TMN2HsxI1H7OH10qdFu+lB3/vsGejt9hEvACBUwmhGEeXgN1zqek3BEoiJLoagvtgWWqzYWWuaC538KCghpCCQ2wphgi8UM0FYrb99usMAMX3w/PUv1EtoG4UOdmb29UZ7lWLl6xIz60q0A/cHgbxid9LCFyK6xXU0Qfi9fdyZzbw5ySplDVnNpNrmZOzjWzEu+uzaKoqeUONnys5M2zNC5OVwAwk7sgYuMW3aLamH47LsoNyaRk/7egTGCS5IU93Is+LwluDuSsbkil62NeGpjdTXN1cnFI+zelqx/BiKwSo7y33OwGVWy/zrjx5/xIrv94cvaiv1xnCYlvgrIxtFMdqE1nP8HedemGXobQ2OUzJ4PNA44AfJKHCN7hheuwixrYnEje4YNC0TWHqhMxGbhhWb1oxLJ/jxxwH3qpyL/rCGULSYkBUAanG/y43ejsjnLnV2AZzQtU6QtwDc0q+jxlRJcxhFUIylRLMlBAlt+sMWznY9g5PmDznFyo/ut+pOkAQvhWkF5WC+Yeo+nw/mBGodzsNIRwPeezgNXLWhUUnbVzoZmJZBViyizyBEmZMz/Z7l3xABiDT9zu26l6LfseH6HiGFnYNDbv3/ML0T1uA3qr0sJr77E/Bd33zTSjRJjc7DWvmUvwBPIxpRkkNX0+UeGU6fXijY9Fx5erMGuXM2LO30= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: y8NclUcHUH91+uQwl8Q4e8eS4312xqw076FOaU1l07ysS9GRoVHDG+0lMGms+IlhwgGjePHxkuapqcS0MC4jnQDXGZD/1tsbY2L1hOpu0wS7+O1QQeB3w5yqLck/I+0q8Lsw5k9HJW+lYOWLUvR0OUHmpGgLxweLMXXh1/pVRD4H46ZbHB4+8fekTVdg7LIAiUu4yfBh3IGaEQLvsC+8R4JWgv30B7J2C5ihF5cIMzsmHi1P4FnLj2e8mSixSDhGoYM370002846gfICQulti6uH/Rc7fc9L85mjLz5OG5SxPln8zrqPP4EgBvrix6zCICLAFWIKHFL/V1ITZCj5kUeSOLvzJ/9n+eQgqAsr0w3ZGVOHKxlbhHvmJgRTcyu0zMjfW5GZViyNxxnRv9xrBjfhx2VFjJeIFqwMHpmD8pw0J8tiUjKHpnn+bvg4gRl/fPZP61BewHXgiRThMx+X/nkXIU9rfxiGXIZ4CttftjVb6qhTf4C27sRcG+gBiS0ySPVM6F4AEMg5ixS+N4rYgowHgFbAA9TH4e4XHImH69uB+/s25ekSaXi29AHtupGHCj6C8BjF/qG89hsWgMl1li2keOXmT2O7ih7uk3vQpssN5CYtyJhtf5vZuYvpjktC88zXeX9aUvMiRloah/s7DvkCb4SpkLQbx03zBL23iYrtAbahoq/TtApLOcEYHpDl5pA7qg0H+ZkokSNcJIWUvXcRuh3a+eL1aJCRBgIxFcwCm+SfUp5tYGKEd0t/OPTSss8HeOvGcLgxMa/dAYdtlA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 973f27eb-f9f5-413c-8709-08dbd9689784 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2023 16:52:24.7149 (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: pZ9osxtbtTLQjIRvsQdea0mntySCVsEQxPx/jcT1GG3KvJbj9oTOJQ5LvydmgKT9UCgLg0kWODL477CCbX3zOA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6253 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-30_10,2023-10-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 spamscore=0 phishscore=0 adultscore=0 mlxlogscore=830 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310240000 definitions=main-2310300131 X-Proofpoint-GUID: JPx-RXy4FaHEpCpiVwMINcTEqajoJpNI X-Proofpoint-ORIG-GUID: JPx-RXy4FaHEpCpiVwMINcTEqajoJpNI 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: 1781200090079788098 X-GMAIL-MSGID: 1781200090079788098 [New patch in the current patch set] Add a new listing option, -i, to emit ginsn in the listing output. We may also emit other SCFI information if necessary in the future. ginsn are most useful when seen alongside the assembly instructions. Hence, they are emitted when the user includes the assembly instructions in the listing output, i.e., "-ali=FILE". gas/doc/: * as.texi: Add documentation for the new listing option, -i. --- gas/doc/as.texi | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/gas/doc/as.texi b/gas/doc/as.texi index cfc1078c36b..6e0fa618712 100644 --- a/gas/doc/as.texi +++ b/gas/doc/as.texi @@ -226,7 +226,7 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}. @c to be limited to one line for the header. @smallexample @c man begin SYNOPSIS -@value{AS} [@b{-a}[@b{cdghlns}][=@var{file}]] +@value{AS} [@b{-a}[@b{cdghilns}][=@var{file}]] [@b{--alternate}] [@b{--compress-debug-sections}] [@b{--nocompress-debug-sections}] [@b{-D}] @@ -673,7 +673,7 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}. @table @gcctabopt @include at-file.texi -@item -a[cdghlmns] +@item -a[cdghilmns] Turn on listings, in any of a variety of ways: @table @gcctabopt @@ -692,6 +692,9 @@ include high-level source @item -al include assembly +@item -ali +include assembly with ginsn + @item -am include macro expansions @@ -2415,7 +2418,7 @@ assembler.) @c man end @menu -* a:: -a[cdghlns] enable listings +* a:: -a[cdghilns] enable listings * alternate:: --alternate enable alternate macro syntax * D:: -D for compatibility and debugging * f:: -f to work faster @@ -2442,7 +2445,7 @@ assembler.) @end menu @node a -@section Enable Listings: @option{-a[cdghlns]} +@section Enable Listings: @option{-a[cdghilns]} @kindex -a @kindex -ac @@ -2450,6 +2453,7 @@ assembler.) @kindex -ag @kindex -ah @kindex -al +@kindex -ali @kindex -an @kindex -as @cindex listings, enabling @@ -2459,7 +2463,9 @@ These options enable listing output from the assembler. By itself, @samp{-a} requests high-level, assembly, and symbols listing. You can use other letters to select specific options for the list: @samp{-ah} requests a high-level language listing, -@samp{-al} requests an output-program assembly listing, and +@samp{-al} requests an output-program assembly listing, +@samp{-ali} requests an output-program assembly listing along with the +associated ginsn, and @samp{-as} requests a symbol table listing. High-level listings require that a compiler debugging option like @samp{-g} be used, and that assembly listings (@samp{-al}) be requested From patchwork Mon Oct 30 16:51:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 159818 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2355610vqb; Mon, 30 Oct 2023 09:54:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGWaqqWWqFYAABUdbUeYi6oRFcNDRa8VXLh10/OSpQIv0WCe7Ip3IQsRhfP/PiOQtGQ40yg X-Received: by 2002:a05:622a:1188:b0:417:9c63:391c with SMTP id m8-20020a05622a118800b004179c63391cmr13443562qtk.52.1698684869405; Mon, 30 Oct 2023 09:54:29 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1698684869; cv=pass; d=google.com; s=arc-20160816; b=PK1JQOlg17Ye+/4uqIzk8i95OZxPn8VunGCLnUmoTKbv26ImkfiwYtSOiFyx9yStV8 3z+Y4+Gico5Vz7Csc9TBdoXGZY6FuIoig/gugbu+jJjZUoD/MlhwTQJ3SIc/y3Z8sdnb j/Mkm6zO1CNbD+DKdMTGqQAHqHCIcj+MtLjPyxvw6HEidPq/1gewAmW0Nhr1pTNjBGVG VkIws8s7+Rq8KYOUE5f1NP46BQw9OoORkflFpUiaVAUA9EBAwY7iqWv/DW3AcNZqE+1o IPqPEmM1OGfBNv81FLavEya90DdDAx3nVbqONYgIpee1/eVZ7sGZnoBW/hCGdUfFx1r3 y++Q== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version :content-transfer-encoding:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-signature:arc-filter :dmarc-filter:delivered-to; bh=etdB93Tkx20lz/TJQM9KN2slUNYgsOFE1ZB45/YwPqU=; fh=Oh0rwXgL2pcS1FQHr6E1Hal1K7kVHmZXDthN47bNt4Q=; b=mJXLCqGhLQDzvHTZE+i+hFv54xExfVSn7Ei4bdexixKv7Rvs3Mp9MX3QTwPI7Ybzni zlz1HOvdPucF8bpG2ZIqswANIoxrWC1F5myUu28rTzmFtAdP4Zw/M1IoRh6GY+a777yo cFY+9MwNzA0yzxwvGrm71LyytBb2oh4BfdSen7FuisQmKi4M5k9HC+5ZoBS+Qw7phYip vA+KSaSqzw5bhFC29Y65f62sW/9Yfuk52ZAR8gC5EhSHEI7P4zrSgNjfsv9G/FqocsEc 0KE1Za3bR+uzY3Gk0phBu5xquQvjUX42mKELBayYTM0C5DMMKnahJSo5Vdle6hCBY4cd XF+A== ARC-Authentication-Results: i=3; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=iNgU95d1; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=PkAaEsVt; arc=pass (i=2); 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id m17-20020a05622a119100b0041817f7086dsi5829464qtk.556.2023.10.30.09.54.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 09:54:29 -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=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=iNgU95d1; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=PkAaEsVt; arc=pass (i=2); 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=pass (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 4EA923830B54 for ; Mon, 30 Oct 2023 16:53:20 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 733AC387543C for ; Mon, 30 Oct 2023 16:52:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 733AC387543C 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 733AC387543C 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=1698684768; cv=pass; b=dTI8Qemt19f5/9y3ljQffOKuTunbF71H/cKO3Yj7tcZu9m2nvge11/4r4W9ysFMA3Z67QwRdy9TzfrhE3HHns5Ej9d5OYt+spsGGfJRGZdHVHCKeK1JVymwDfvmeuWBGVFFzyP52+3rAmt6oVe09Swr6ZSJUT7czakG+JvfKDvs= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1698684768; c=relaxed/simple; bh=BqxrNAPBWr7x2WXpmYCGNHiKLwZfy40ot8Xa0QRg/MQ=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=KRf7FPFi0W0AhUKENXA7ixX54ZIww5mX2I2XztaiAFqHvmN3X8TElkB1WKvz45JFDIRzOiUR8UX/dQzwusB0BOGHCNgUAf8jv2DQg5tnnjtUmBAdIb7zA91M3gWwsAHX/5IDeqs+f+467rGh+A1zyMg3y2t0iUpGcjKIMXIxm/s= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39UDVU5k012612 for ; Mon, 30 Oct 2023 16:52:41 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=etdB93Tkx20lz/TJQM9KN2slUNYgsOFE1ZB45/YwPqU=; b=iNgU95d1f2TCnhMhnPGfFBKmtm8xcAu+Qm7FrIMdanXNGmh5Ukryf9fZSYeZDypi072b 5HDPiGytdOq031RDAvFfoOPvhmOD1HmHcOIfuE+iKRDdDyhbBmk+/cxreFRUT7Lq7WSz W2JUjzbnaAS+ueYMFnpcMFWoI4FgfClJymcpeE/3iUSgcAp9SfZz/4noM9aXy6fb+70v WqyEI8aHTqSl5OeTk8jNLRCfLb80HUeWFXm9seyf7Qo4Ean1TyWCsQAMaHi3XWx7nL9U ylEMWQ0ykHzQZk99BFN8CVuSLJdSmicpRjnq7BqdYYrgUpLagluvv8pri1lvP/lfcwMd xA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3u0s7bu8x3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 30 Oct 2023 16:52:40 +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 39UFXTC9022584 for ; Mon, 30 Oct 2023 16:52:39 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3u0rr4hhs9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 30 Oct 2023 16:52:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mu7qTrc9HjTtB4PHmd73nazsLaThq8wmbzu48Ame0iOtK00B+KxCeQ8yriK3iF7Z6UTcF9l4HdPc39lUZm/bdwFXRTTsuHnbG7NUEnR3kywROxwRMSBj7Snesp7VjdQ5BhZ6aTEkDVSIdz9XBb6TyA67FX9CBW4YP2zRfoQSnj3tcPOc0w7OdLXLjjfulUwXV4hspq+6qlkDGRkaUnqlG/YnewQepEaS4CAK6gfEP3p+QF6KCzjcsJMmifm1r7Bznp0XOaTKkOIE/z8nn7fYgzexaslgr4B4EQT7BE3d7LX88mDWOXsPWzP/2YPw/pdXWE32fLzaDDnZA9Cnyi8fAQ== 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=etdB93Tkx20lz/TJQM9KN2slUNYgsOFE1ZB45/YwPqU=; b=GYW6zUTxLhTsCWzVQFJW0fYlGwxKFoJ/z9Q7jqFmKOPvZGMhBBsVJWlYZ40SZUL1qtNYmnNyC8YJK7/YVm0aENYvWaUMAXkgLt8IFSOqGBZX0ejXjlSAeW6q1PD1nY4Cp79b2OVq5Gp+ifObxD/s08cUlz+E3plcef1dKjMDDRpUIflfBOJwDXcKQYx7Hza09+HElFcur3YrLLJJDgufTb7tXTPJg1ayI/Oz9mABuA4LrNhc35PSAwjILdz4hwTw1bUYjJyJCmSKicoMtiTX1QJfwviKfyZ0aMxjbe5nILgAbWO/dZNthEq6w0UlacA45P41s+Q02DnbUwL3Is1t2A== 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=etdB93Tkx20lz/TJQM9KN2slUNYgsOFE1ZB45/YwPqU=; b=PkAaEsVt+WJQCpC+kO6NhbiIihAyKihNnPdjHkPT2IB/Pz2jkKrysegpWr/RwPWjbhqpy5XYoTfQRPnGOPGD5e9S3j8Ho/V51cMnxmjzCRERmXPO1SmYHP3RvKw8WWYGynG8YY+0joO2Jh9KCh4YrlSZbTT3SoyjTLckGEbLnys= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by DM4PR10MB6253.namprd10.prod.outlook.com (2603:10b6:8:b7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Mon, 30 Oct 2023 16:52:30 +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; Mon, 30 Oct 2023 16:52:30 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH, V2 09/10] gas: testsuite: add a x86_64 testsuite for SCFI Date: Mon, 30 Oct 2023 09:51:36 -0700 Message-ID: <20231030165137.2570939-10-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231030165137.2570939-1-indu.bhagat@oracle.com> References: <20231030165137.2570939-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR03CA0082.namprd03.prod.outlook.com (2603:10b6:303:b6::27) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|DM4PR10MB6253:EE_ X-MS-Office365-Filtering-Correlation-Id: 72c71205-6f0d-43d4-6457-08dbd9689a4d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: b3nxPJNTkRAlvH3L8PQLEpeQ6C6mCKtG4pKxn+8lBbGrSEWJ/oyK6edOaTqBijvRiftm0zGRsZDZjoDpENxnCZKOI4AIU/5bKVxHw/Je1a7aV3OTk4w8ClhPre+1ej1rLv9uFxSwYwKr4/iS6JWK6e7BmphfYigrwFYRprmuhNEWcOFq1JJDNKQKa2bZEacphpfUw4xRaQSVvQfWymb+Q/bT6T2uQU3soXok8Wsa6lXNEDzEt28tsIQqGfk2FB3/LRQnGBxEf0OSn6BsVMMygkdakgWt1UWoQLcCMF8igN3fI/4+y6/HjaLajrzh0qy5W+PLYzm4Xx93ojn0/e6ltc/txYV+KTPlfHGbIJFOESEDiARwQTZS0HMO2Pl0J1H2EFZwoqqlAPrKAwNg4aPovhgLLY1FRZDBCpX/tqwrdnR0UCSpuA+YgN9AzKR/Sh5Zw9u1uVVKDTPCeCZRINGkalOvIVv/iU5F7uOZwjBwSSwRP6pPvzVpV4JOxP6WkrsajsWxndsQE2MDnmyyToijqncUge92sP4rnvpKsw9hjv4dW8tMmrZ4utiV41qA4VCXV5OrdYr19tS/hxWZKOSE33BCVB8EzEu5x3ebm8L0wYnrptnNLMWfLxrReeAuKseqGmupf00K7JDV96w0qc4w3w== 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)(346002)(376002)(39860400002)(396003)(366004)(136003)(230273577357003)(230173577357003)(230922051799003)(1800799009)(186009)(64100799003)(451199024)(36756003)(2616005)(6512007)(6506007)(66556008)(316002)(6486002)(66476007)(478600001)(66946007)(107886003)(1076003)(83380400001)(38100700002)(86362001)(8936002)(41300700001)(2906002)(4326008)(8676002)(6916009)(30864003)(66899024)(44832011)(5660300002)(2004002)(579004)(559001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8mumUkMh2j29tUWrKmEDzOiQs3npKVBgWCw31grE/ae3MsrYnKM4rpzN2mCPt3KY+TlAGLoJ2kpiqbICih05qk2TUYgfGbYZE6BN33S/9/qOd3CG8FZzAasEcSEUamD/zLQGv/WyQNck1vs34mmiUWyJ7AakWHHP7FCvRnqXHyn2jwO00vQtueDtrAOVkXBPmQU/x5qiFb7IuCJtzTHXxwpFEYycUq/3V568wmsT89M895lDpFA49v+q/vytgBgB0g9y8JeXwXtL8jIhUHymtXipeL8d5UDG0+M6AW7e6SIug1ZRmaKe4PVdnjVnk4olOtzGeSP1WyvRePEuvo+HxelgjD8QJN8juCdjwHZ2SZ4edZMLym9xQlL1kch/hRJNoUcGvnYpAQs5pVdgDrEohbeNv2125ArfxREry4GmoyZxBkjPEtelhf7/5eapEIf5nGfOoAvysGdJRWqKygkzdMJGU/k0Ywq6nQhQV0xqe0gvilmH2+K14YqHfCIvHjd084W5TYtHeda9cPpdBqlVMUyytGSmHQW2gG/nxpRjG8yE4vURfAQ3CixYG7fa+qoB/8KyrcHwXDVmgg83206oCAjZPwclNeZ+kbkHqAAgY7VLCHB5C84o4wC5j4HC4AHlQuy8nKfw0An8QMad5DKOgytFr7uou66JplaGAYa/VAK2ItEXT3HZO6wKq7y04CGj2hlT0zBpTt2CkXofousYj44i5Crs87wfODlDhdA+0Ck+4I7fsiaX3+TAqY9xB0bmo/8D2mMvbzX21gM8inTXKq4XDDg/iKxquBJOJvO5a/YVqu4t4VGCIiwMXR0n7heIf/WrKeeC4OY8JjXg3MWEMH0b6DDAzheCawfpcvkk997Eyp5gH8++QWVTdwa1UxUWIEERSj9dNcSI1BNiFS+srCE3Qy7Mz8mF8xojn9g+vfdSfTBY2fH6iZFx1rP3G4cGwg/WNKljsJxV0iN1BSDyuTmAX9WNolllWizs/h/eZ2M89E82F4Pb98AwFPHQLgkYP81fF95p3K1uZENuw5EY+Rxqw3YQKfJ4TIrLf/5AMOFYJReIlyK3KXkJ2cTOaoStH5LWggcfRm8XiMgq2Ip7Ago+PDEqWoXnHq8zrKv63FDDOvJ7pXscCdvoRNtRHpVZxUQz28ms4hAsUNfwWeAgyNn//gfrKGfLX1qdfBM5Zk9diqPoMXcuVeV+dTRtPJf91R7XGkiA5q73GzNm8FFPrNmmrAXSmsxJhGA8xVLDbACHI+4cING0bPOIac2y1BR5HDS62BBSPKF0DuGw8vif8HSYLjrmlkfDl8dZKBjxwqsHJ+ilLy32Pp+PA58IbQhGMVz9T/0ImUD4bg1IzdEY3ZNOuG0vKd63gN8Vm8s5Nls46GaglgFZWb7oJCCwGDuJHHC59gfMYvrB4kOUu4mGRqavGdSAZ9+uk/haUEzI4DI2yL+7cHE/nb7nLZIjrYVGicP23hbEeWN9mfy40hE5mv6C+okwD0piw444XNvf/KU02ygK2hMU2WsNfyKdbSuAi3+1ZQ8+1TOTzoI9BOHfR2ZioOrX3et0QKyPEJ7+opNkbDarhQ02RsZJ7fTlhbokTw12n02F/lncSzJDEgVEhBLDPuxavF56Tp+XjsU3XYU= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: xtPOOQOGGaKdh1a8A0KA/XNoZY1arqbEvLCuD8tljwfRO8czMOAjeGcBWx9DrtvgiFnZbOtDhrACm2PNhgoJ2U8HWgWvXxSapNSePFJsSM01CZZjU425lbLT2kirEn0RksFEhH2Ks56alAHfwOommiF3WUEjwTkyBxE55a3C4fYZlfQEx+k/RRfcYK0yGJOYgFavXBzUmM8FtD1RPb86B1YDqyM7hZ/pB6NQPRkeuDTj4voAV/HW8E0Da7tXUp+2ctBSvVPvFU97oRlQjxD85sGZv5bfSm2NGYkXL4mnwky0ApT7ADtbhmy1OSRt/pvqxu7VvKv+CPQYqa4enzcfEXtynS0TGiyZFeyXGDSo6peynjlZ9JEyoI1lBHbIm9plccE4AyMZv+6xVSFVjpIxnmQ+CRvqieappwbeAsk9Fy8qIRunqrj4JhJaKs5Um72/4BuZ6KlJkEHdKoZlHcxFkN8ascAlOlLjkOnZcgqxc7iAJ4jVz7e+Pm2YY3Bz1Zh15bmBKRdIa6c63SEgJomT6lz2X1c1RlQ5F5DnFbAY4Y/4yZS33j7WYxTmKrHPmbxnYKNxjUpmSiHVJtC3QpIjSvsnhj8oBgnPBrQQZrmCwpf/qUImNPtg/AFWEXxL+ixBVicWgchNMpb7My+a0327MHYhtI8dD6L/7KZlBwz/5xxvOsYxvB2kSoMQ7cybGUA1x1WHllO/4gjMDs1DZajLig4TOuU25YrChCNUW2HZ9vLixjcUJPYHxFNB8Mz2VNCUH1gJPOLqV3BkKfbQ6ivkUw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 72c71205-6f0d-43d4-6457-08dbd9689a4d X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2023 16:52:29.9613 (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: AE92hjLWi1gAKcLTDdAgXrXnsB5Y8y8D9cD5BoItUrhtKLR15QtbN/uh1bu6urYxQPqnx+uGnX3dgVD0UeYQhg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6253 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-30_10,2023-10-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 adultscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310240000 definitions=main-2310300131 X-Proofpoint-GUID: vJExs7RyQezAqdfB1HRoZ377MKw7-aaA X-Proofpoint-ORIG-GUID: vJExs7RyQezAqdfB1HRoZ377MKw7-aaA 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: 1781200185768972244 X-GMAIL-MSGID: 1781200185768972244 [Changes from the RFC patch set] - New testcases based on the fixes in the previous patches - New testcase for not ignoring .cfi_label - New testcases scfi-asm-marker-* which test for some patterns of .type and .size attributes in the input asm for --scfi=all. - Recall that all assembler testcases here include the .cfi_* directives corresponding to the asm. GAS now issues a warning if --scfi is invoked with input assembly which includes .cfi_* directives: "Warning: --scfi=all ignores some user-specified CFI directives" - But the SCFI algorithm in GAS issues other SCFI specific warnings too. Hence, many of the tests are run twice, like so: + run_dump_test "scfi-add-1", which runs the test with a -W and checks the objdump output of the .eh_frame (or sometimes .sframe) section. + run_list_test "scfi-add-1" "--scfi --warn", which runs the test with warnings enabled, and explicitly checks all warning messages per test. [End of changes] The testsuite for SCFI contains target-specific tests. As all the tests are executed with --scfi command line option, the CFI annotations in the test .s files are skipped altogether by the GAS for processing. The CFI directives in the assembly files are added with the intention to aid maintainence only: CFI annotations in .s files help convey the expected EH Frame / SFrame data in a format-oblivious way. Some testcases are used to highlight those asm constructs that the SCFI machinery in GAS currently does not support: - Only AMD64 ABI is supported for now. Using --m32 with --scfi results in hard error. See scfi-unsupported-1.s. - Untraceable stack-pointer manipulation in function epilougue and prologue. See scfi-unsupported-2.s. - Using Dynamically Realigned Arguement Pointer (DRAP) register to realign the stack. For SCFI, the CFA must be only REG_SP or REG_FP based. See scfi-unsupported-drap-1.s Some testcases are used to highlight some diagnostics that the SCFI machinery in GAS currently issues, with an intent to help user correct inadvertent errors in their hand-written asm. An error is issued in a situation where GAS is not sure it will be able to synthesize valid CFI. - (#1) "Warning: SCFI: Asymetrical register restore" - (#2) "Error: SCFI: usage of REG_FP as scratch not supported" - (#3) "Error: SCFI: unsupported stack manipulation pattern" In case of (#2) and (#3), SCFI generation is skipped for the respective function. Above is a subset of the warnings/errors implemented in the code. gas/testsuite/: * gas/scfi/README: New test. * gas/scfi/x86_64/scfi-add-1.d: New test. * gas/scfi/x86_64/scfi-add-1.l: New test. * gas/scfi/x86_64/scfi-add-1.s: New test. * gas/scfi/x86_64/scfi-add-2.d: New test. * gas/scfi/x86_64/scfi-add-2.l: New test. * gas/scfi/x86_64/scfi-add-2.s: New test. * gas/scfi/x86_64/scfi-asm-marker-1.d: New test. * gas/scfi/x86_64/scfi-asm-marker-1.l: New test. * gas/scfi/x86_64/scfi-asm-marker-1.s: New test. * gas/scfi/x86_64/scfi-asm-marker-2.d: New test. * gas/scfi/x86_64/scfi-asm-marker-2.l: New test. * gas/scfi/x86_64/scfi-asm-marker-2.s: New test. * gas/scfi/x86_64/scfi-asm-marker-3.d: New test. * gas/scfi/x86_64/scfi-asm-marker-3.l: New test. * gas/scfi/x86_64/scfi-asm-marker-3.s: New test. * gas/scfi/x86_64/scfi-bp-sp-1.d: New test. * gas/scfi/x86_64/scfi-bp-sp-1.l: New test. * gas/scfi/x86_64/scfi-bp-sp-1.s: New test. * gas/scfi/x86_64/scfi-bp-sp-2.d: New test. * gas/scfi/x86_64/scfi-bp-sp-2.l: New test. * gas/scfi/x86_64/scfi-bp-sp-2.s: New test. * gas/scfi/x86_64/scfi-callee-saved-1.d: New test. * gas/scfi/x86_64/scfi-callee-saved-1.l: New test. * gas/scfi/x86_64/scfi-callee-saved-1.s: New test. * gas/scfi/x86_64/scfi-callee-saved-2.d: New test. * gas/scfi/x86_64/scfi-callee-saved-2.l: New test. * gas/scfi/x86_64/scfi-callee-saved-2.s: New test. * gas/scfi/x86_64/scfi-callee-saved-3.d: New test. * gas/scfi/x86_64/scfi-callee-saved-3.l: New test. * gas/scfi/x86_64/scfi-callee-saved-3.s: New test. * gas/scfi/x86_64/scfi-callee-saved-4.d: New test. * gas/scfi/x86_64/scfi-callee-saved-4.l: New test. * gas/scfi/x86_64/scfi-callee-saved-4.s: New test. * gas/scfi/x86_64/scfi-cfg-1.d: New test. * gas/scfi/x86_64/scfi-cfg-1.l: New test. * gas/scfi/x86_64/scfi-cfg-1.s: New test. * gas/scfi/x86_64/scfi-cfg-2.d: New test. * gas/scfi/x86_64/scfi-cfg-2.l: New test. * gas/scfi/x86_64/scfi-cfg-2.s: New test. * gas/scfi/x86_64/scfi-cfi-label-1.d: New test. * gas/scfi/x86_64/scfi-cfi-label-1.l: New test. * gas/scfi/x86_64/scfi-cfi-label-1.s: New test. * gas/scfi/x86_64/scfi-cofi-1.d: New test. * gas/scfi/x86_64/scfi-cofi-1.l: New test. * gas/scfi/x86_64/scfi-cofi-1.s: New test. * gas/scfi/x86_64/scfi-diag-1.l: New test. * gas/scfi/x86_64/scfi-diag-1.s: New test. * gas/scfi/x86_64/scfi-diag-2.l: New test. * gas/scfi/x86_64/scfi-diag-2.s: New test. * gas/scfi/x86_64/scfi-dyn-stack-1.d: New test. * gas/scfi/x86_64/scfi-dyn-stack-1.l: New test. * gas/scfi/x86_64/scfi-dyn-stack-1.s: New test. * gas/scfi/x86_64/scfi-fp-diag-2.l: New test. * gas/scfi/x86_64/scfi-fp-diag-2.s: New test. * gas/scfi/x86_64/scfi-ignore-1.d: New test. * gas/scfi/x86_64/scfi-ignore-1.l: New test. * gas/scfi/x86_64/scfi-ignore-1.s: New test. * gas/scfi/x86_64/scfi-indirect-mov-1.d: New test. * gas/scfi/x86_64/scfi-indirect-mov-1.l: New test. * gas/scfi/x86_64/scfi-indirect-mov-1.s: New test. * gas/scfi/x86_64/scfi-indirect-mov-2.d: New test. * gas/scfi/x86_64/scfi-indirect-mov-2.l: New test. * gas/scfi/x86_64/scfi-indirect-mov-2.s: New test. * gas/scfi/x86_64/scfi-indirect-mov-3.d: New test. * gas/scfi/x86_64/scfi-indirect-mov-3.l: New test. * gas/scfi/x86_64/scfi-indirect-mov-3.s: New test. * gas/scfi/x86_64/scfi-indirect-mov-4.d: New test. * gas/scfi/x86_64/scfi-indirect-mov-4.l: New test. * gas/scfi/x86_64/scfi-indirect-mov-4.s: New test. * gas/scfi/x86_64/scfi-lea-1.d: New test. * gas/scfi/x86_64/scfi-lea-1.l: New test. * gas/scfi/x86_64/scfi-lea-1.s: New test. * gas/scfi/x86_64/scfi-leave-1.d: New test. * gas/scfi/x86_64/scfi-leave-1.l: New test. * gas/scfi/x86_64/scfi-leave-1.s: New test. * gas/scfi/x86_64/scfi-pushq-1.d: New test. * gas/scfi/x86_64/scfi-pushq-1.l: New test. * gas/scfi/x86_64/scfi-pushq-1.s: New test. * gas/scfi/x86_64/scfi-pushsection-1.d: New test. * gas/scfi/x86_64/scfi-pushsection-1.l: New test. * gas/scfi/x86_64/scfi-pushsection-1.s: New test. * gas/scfi/x86_64/scfi-pushsection-2.d: New test. * gas/scfi/x86_64/scfi-pushsection-2.l: New test. * gas/scfi/x86_64/scfi-pushsection-2.s: New test. * gas/scfi/x86_64/scfi-selfalign-func-1.d: New test. * gas/scfi/x86_64/scfi-selfalign-func-1.l: New test. * gas/scfi/x86_64/scfi-selfalign-func-1.s: New test. * gas/scfi/x86_64/scfi-simple-1.d: New test. * gas/scfi/x86_64/scfi-simple-1.l: New test. * gas/scfi/x86_64/scfi-simple-1.s: New test. * gas/scfi/x86_64/scfi-simple-2.d: New test. * gas/scfi/x86_64/scfi-simple-2.l: New test. * gas/scfi/x86_64/scfi-simple-2.s: New test. * gas/scfi/x86_64/scfi-sub-1.d: New test. * gas/scfi/x86_64/scfi-sub-1.l: New test. * gas/scfi/x86_64/scfi-sub-1.s: New test. * gas/scfi/x86_64/scfi-sub-2.d: New test. * gas/scfi/x86_64/scfi-sub-2.l: New test. * gas/scfi/x86_64/scfi-sub-2.s: New test. * gas/scfi/x86_64/scfi-unsupported-1.l: New test. * gas/scfi/x86_64/scfi-unsupported-1.s: New test. * gas/scfi/x86_64/scfi-unsupported-2.l: New test. * gas/scfi/x86_64/scfi-unsupported-2.s: New test. * gas/scfi/x86_64/scfi-unsupported-3.l: New test. * gas/scfi/x86_64/scfi-unsupported-3.s: New test. * gas/scfi/x86_64/scfi-unsupported-4.l: New test. * gas/scfi/x86_64/scfi-unsupported-4.s: New test. * gas/scfi/x86_64/scfi-unsupported-cfg-1.l: New test. * gas/scfi/x86_64/scfi-unsupported-cfg-1.s: New test. * gas/scfi/x86_64/scfi-unsupported-drap-1.l: New test. * gas/scfi/x86_64/scfi-unsupported-drap-1.s: New test. * gas/scfi/x86_64/scfi-x86-64.exp: New test. --- gas/testsuite/gas/scfi/README | 17 +++ gas/testsuite/gas/scfi/x86_64/scfi-add-1.d | 25 +++++ gas/testsuite/gas/scfi/x86_64/scfi-add-1.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-add-1.s | 13 +++ gas/testsuite/gas/scfi/x86_64/scfi-add-2.d | 36 ++++++ gas/testsuite/gas/scfi/x86_64/scfi-add-2.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-add-2.s | 48 ++++++++ .../gas/scfi/x86_64/scfi-asm-marker-1.d | 28 +++++ .../gas/scfi/x86_64/scfi-asm-marker-1.l | 3 + .../gas/scfi/x86_64/scfi-asm-marker-1.s | 27 +++++ .../gas/scfi/x86_64/scfi-asm-marker-2.d | 24 ++++ .../gas/scfi/x86_64/scfi-asm-marker-2.l | 3 + .../gas/scfi/x86_64/scfi-asm-marker-2.s | 11 ++ .../gas/scfi/x86_64/scfi-asm-marker-3.d | 31 ++++++ .../gas/scfi/x86_64/scfi-asm-marker-3.l | 2 + .../gas/scfi/x86_64/scfi-asm-marker-3.s | 38 +++++++ gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.d | 31 ++++++ gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.s | 22 ++++ gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.d | 57 ++++++++++ gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.s | 49 +++++++++ .../gas/scfi/x86_64/scfi-callee-saved-1.d | 40 +++++++ .../gas/scfi/x86_64/scfi-callee-saved-1.l | 2 + .../gas/scfi/x86_64/scfi-callee-saved-1.s | 26 +++++ .../gas/scfi/x86_64/scfi-callee-saved-2.d | 41 +++++++ .../gas/scfi/x86_64/scfi-callee-saved-2.l | 2 + .../gas/scfi/x86_64/scfi-callee-saved-2.s | 42 +++++++ .../gas/scfi/x86_64/scfi-callee-saved-3.d | 42 +++++++ .../gas/scfi/x86_64/scfi-callee-saved-3.l | 3 + .../gas/scfi/x86_64/scfi-callee-saved-3.s | 40 +++++++ .../gas/scfi/x86_64/scfi-callee-saved-4.d | 40 +++++++ .../gas/scfi/x86_64/scfi-callee-saved-4.l | 3 + .../gas/scfi/x86_64/scfi-callee-saved-4.s | 55 ++++++++++ gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.d | 36 ++++++ gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.s | 47 ++++++++ gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.d | 28 +++++ gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.s | 21 ++++ .../gas/scfi/x86_64/scfi-cfi-label-1.d | 37 +++++++ .../gas/scfi/x86_64/scfi-cfi-label-1.l | 2 + .../gas/scfi/x86_64/scfi-cfi-label-1.s | 19 ++++ gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.d | 5 + gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.l | 3 + gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.s | 23 ++++ gas/testsuite/gas/scfi/x86_64/scfi-diag-1.l | 4 + gas/testsuite/gas/scfi/x86_64/scfi-diag-1.s | 23 ++++ gas/testsuite/gas/scfi/x86_64/scfi-diag-2.l | 4 + gas/testsuite/gas/scfi/x86_64/scfi-diag-2.s | 28 +++++ .../gas/scfi/x86_64/scfi-dyn-stack-1.d | 23 ++++ .../gas/scfi/x86_64/scfi-dyn-stack-1.l | 2 + .../gas/scfi/x86_64/scfi-dyn-stack-1.s | 50 +++++++++ .../gas/scfi/x86_64/scfi-fp-diag-2.l | 3 + .../gas/scfi/x86_64/scfi-fp-diag-2.s | 55 ++++++++++ gas/testsuite/gas/scfi/x86_64/scfi-ignore-1.d | 26 +++++ gas/testsuite/gas/scfi/x86_64/scfi-ignore-1.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-ignore-1.s | 13 +++ .../gas/scfi/x86_64/scfi-indirect-mov-1.d | 51 +++++++++ .../gas/scfi/x86_64/scfi-indirect-mov-1.l | 2 + .../gas/scfi/x86_64/scfi-indirect-mov-1.s | 48 ++++++++ .../gas/scfi/x86_64/scfi-indirect-mov-2.d | 41 +++++++ .../gas/scfi/x86_64/scfi-indirect-mov-2.l | 2 + .../gas/scfi/x86_64/scfi-indirect-mov-2.s | 38 +++++++ .../gas/scfi/x86_64/scfi-indirect-mov-3.d | 41 +++++++ .../gas/scfi/x86_64/scfi-indirect-mov-3.l | 2 + .../gas/scfi/x86_64/scfi-indirect-mov-3.s | 38 +++++++ .../gas/scfi/x86_64/scfi-indirect-mov-4.d | 63 +++++++++++ .../gas/scfi/x86_64/scfi-indirect-mov-4.l | 3 + .../gas/scfi/x86_64/scfi-indirect-mov-4.s | 68 ++++++++++++ gas/testsuite/gas/scfi/x86_64/scfi-lea-1.d | 37 +++++++ gas/testsuite/gas/scfi/x86_64/scfi-lea-1.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-lea-1.s | 40 +++++++ gas/testsuite/gas/scfi/x86_64/scfi-leave-1.d | 36 ++++++ gas/testsuite/gas/scfi/x86_64/scfi-leave-1.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-leave-1.s | 26 +++++ gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.d | 35 ++++++ gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.s | 24 ++++ .../gas/scfi/x86_64/scfi-pushsection-1.d | 43 ++++++++ .../gas/scfi/x86_64/scfi-pushsection-1.l | 2 + .../gas/scfi/x86_64/scfi-pushsection-1.s | 40 +++++++ .../gas/scfi/x86_64/scfi-pushsection-2.d | 39 +++++++ .../gas/scfi/x86_64/scfi-pushsection-2.l | 2 + .../gas/scfi/x86_64/scfi-pushsection-2.s | 38 +++++++ .../gas/scfi/x86_64/scfi-selfalign-func-1.d | 31 ++++++ .../gas/scfi/x86_64/scfi-selfalign-func-1.l | 2 + .../gas/scfi/x86_64/scfi-selfalign-func-1.s | 36 ++++++ gas/testsuite/gas/scfi/x86_64/scfi-simple-1.d | 26 +++++ gas/testsuite/gas/scfi/x86_64/scfi-simple-1.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-simple-1.s | 15 +++ gas/testsuite/gas/scfi/x86_64/scfi-simple-2.d | 30 +++++ gas/testsuite/gas/scfi/x86_64/scfi-simple-2.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-simple-2.s | 16 +++ gas/testsuite/gas/scfi/x86_64/scfi-sub-1.d | 25 +++++ gas/testsuite/gas/scfi/x86_64/scfi-sub-1.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-sub-1.s | 12 ++ gas/testsuite/gas/scfi/x86_64/scfi-sub-2.d | 31 ++++++ gas/testsuite/gas/scfi/x86_64/scfi-sub-2.l | 2 + gas/testsuite/gas/scfi/x86_64/scfi-sub-2.s | 29 +++++ .../gas/scfi/x86_64/scfi-unsupported-1.l | 2 + .../gas/scfi/x86_64/scfi-unsupported-1.s | 10 ++ .../gas/scfi/x86_64/scfi-unsupported-2.l | 3 + .../gas/scfi/x86_64/scfi-unsupported-2.s | 14 +++ .../gas/scfi/x86_64/scfi-unsupported-3.l | 3 + .../gas/scfi/x86_64/scfi-unsupported-3.s | 14 +++ .../gas/scfi/x86_64/scfi-unsupported-4.l | 4 + .../gas/scfi/x86_64/scfi-unsupported-4.s | 23 ++++ .../gas/scfi/x86_64/scfi-unsupported-cfg-1.l | 3 + .../gas/scfi/x86_64/scfi-unsupported-cfg-1.s | 53 +++++++++ .../gas/scfi/x86_64/scfi-unsupported-drap-1.l | 4 + .../gas/scfi/x86_64/scfi-unsupported-drap-1.s | 75 +++++++++++++ gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp | 103 ++++++++++++++++++ 113 files changed, 2604 insertions(+) create mode 100644 gas/testsuite/gas/scfi/README create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-add-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-add-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-add-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-add-2.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-add-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-add-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-2.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-3.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-3.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-3.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfi-label-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfi-label-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cfi-label-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-diag-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-diag-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-diag-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-diag-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-fp-diag-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-fp-diag-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-ignore-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-ignore-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-ignore-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-4.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-4.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-4.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-lea-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-lea-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-lea-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-leave-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-leave-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-leave-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-pushsection-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-pushsection-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-pushsection-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-pushsection-2.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-pushsection-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-pushsection-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-simple-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-simple-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-simple-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-simple-2.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-simple-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-simple-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-sub-1.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-sub-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-sub-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-sub-2.d create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-sub-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-sub-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-2.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-2.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-3.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-3.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-4.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-4.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-drap-1.l create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-unsupported-drap-1.s create mode 100644 gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp diff --git a/gas/testsuite/gas/scfi/README b/gas/testsuite/gas/scfi/README new file mode 100644 index 00000000000..75dcebb602d --- /dev/null +++ b/gas/testsuite/gas/scfi/README @@ -0,0 +1,17 @@ +Notes on the SCFI testsuite in GAS: + +* At this time, SCFI machinery is only supported for x86_64. + +* When adding more tests, please keep CFI annotations updated in the .s files. + Recall that user-specified, synthesizable CFI annotations are ignored by the + GAS when --scfi (=all) is in effect. Adding CFI annocations, irrespectively, + makes the testcases clearer in terms of understanding the expected unwind + data. + +* Note that GAS issues a warning: + "Warning: --scfi=all ignores some user-specified CFI directive" + when it encounters CFI directives in the input assembly and --scfi (=all) is + active. To bypass the noise from this warning, while keeping the testcases + useful/understandable, most tests are run twice. E.g., + - run_dump_test "scfi-cfi-add-1" // ignores warnings + - run_list_test "scfi-cfi-add-1" "--scfi --warn" // tests warnings diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-add-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-add-1.d new file mode 100644 index 00000000000..d224990641a --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-add-1.d @@ -0,0 +1,25 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI for add insn 1 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0014 0+001c FDE cie=0+0000 pc=0+0000..0+0005 + DW_CFA_advance_loc: 4 to 0+0004 + DW_CFA_def_cfa_offset: 0 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-add-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-add-1.l new file mode 100644 index 00000000000..0e094077edd --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-add-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-add-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-add-1.s new file mode 100644 index 00000000000..99002c5e34e --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-add-1.s @@ -0,0 +1,13 @@ +# Testcase for add instruction. + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + addq $8, %rsp + .cfi_def_cfa_offset 0 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo + diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-add-2.d b/gas/testsuite/gas/scfi/x86_64/scfi-add-2.d new file mode 100644 index 00000000000..4b378caa117 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-add-2.d @@ -0,0 +1,36 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI for add insn 2 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0024 0+001c FDE cie=0+0000 pc=0+0000..0+002c + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_advance_loc: 3 to 0+0004 + DW_CFA_def_cfa_register: r6 \(rbp\) + DW_CFA_advance_loc: 2 to 0+0006 + DW_CFA_offset: r12 \(r12\) at cfa-24 + DW_CFA_advance_loc: 36 to 0+002a + DW_CFA_restore: r12 \(r12\) + DW_CFA_advance_loc: 1 to 0+002b + DW_CFA_def_cfa_register: r7 \(rsp\) + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-add-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-add-2.l new file mode 100644 index 00000000000..147ffcb6bda --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-add-2.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*14: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-add-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-add-2.s new file mode 100644 index 00000000000..6ea0fefc7b5 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-add-2.s @@ -0,0 +1,48 @@ + .section .rodata + .type simd_cmp_op, @object + .size simd_cmp_op, 8 +simd_cmp_op: + .long 2 + .zero 4 + +# Testcase for add instruction. +# add reg, reg instruction + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + movq %rsp, %rbp + .cfi_def_cfa_register 6 + pushq %r12 + .cfi_offset 12, -24 + mov %rsp, %r12 +# Stack manipulation is permitted if the base register for +# tracking CFA has been changed to FP. + addq %rdx, %rsp + addq %rsp, %rax +# Some add instructions may access the stack indirectly. Such +# accesses do not make REG_FP untraceable. + addl %eax, -84(%rbp) +# Other kind of add instructions should not error out in the +# x86_64 -> ginsn translator + addq $simd_cmp_op+8, %rdx + addl %edx, -32(%rsp) + addl $1, fb_low_counter(,%rbx,4) + mov %r12, %rsp +# Popping a callee-saved register. +# RSP must be traceable. + pop %r12 + .cfi_restore 12 + leave + .cfi_def_cfa_register 7 + .cfi_restore 6 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo + diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-1.d new file mode 100644 index 00000000000..9103e9f1881 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-1.d @@ -0,0 +1,28 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI for demarcated code blocks 1 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +00000018 0+0010 0000001c FDE cie=00000000 pc=0+0000..0+000f + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + +0000002c 0+0010 00000030 FDE cie=00000000 pc=0+0000..0+0006 + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-1.l new file mode 100644 index 00000000000..f6a884c238f --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-1.l @@ -0,0 +1,3 @@ +.*Assembler messages: +.*8: Warning: --scfi=all ignores some user-specified CFI directives +.*10: Warning: missing label '.L3' in func 'foo' may result in imprecise cfg diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-1.s new file mode 100644 index 00000000000..88d78795643 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-1.s @@ -0,0 +1,27 @@ +# Testcase where a user may define hot and cold areas of function +# Note how the .type, and .size directives may be placed differently +# than a regular function. + + .globl foo + .type foo, @function +foo: + .cfi_startproc + testl %edi, %edi + je .L3 + movl b(%rip), %eax + ret + .cfi_endproc + .section .text.unlikely + .cfi_startproc + .type foo.cold, @function +foo.cold: +.L3: + pushq %rax + .cfi_def_cfa_offset 16 + call abort + .cfi_endproc +.LFE11: + .text + .size foo, .-foo + .section .text.unlikely + .size foo.cold, .-foo.cold diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-2.d b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-2.d new file mode 100644 index 00000000000..3e5a4f05ea4 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-2.d @@ -0,0 +1,24 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI for demarcated code blocks 2 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +00000018 0+0014 0000001c FDE cie=00000000 pc=0+0000..0+000f + DW_CFA_nop + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-2.l new file mode 100644 index 00000000000..6688ea8b5d8 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-2.l @@ -0,0 +1,3 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores some user-specified CFI directives +.*8: Warning: missing label '.L3' in func 'foo' may result in imprecise cfg diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-2.s new file mode 100644 index 00000000000..9bcfe8d2e0a --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-2.s @@ -0,0 +1,11 @@ +# A programmer may not bother to set the size of the +# function symbols via an explicit .size directive. + .globl foo + .type foo, @function +foo: + .cfi_startproc + testl %edi, %edi + je .L3 + movl b(%rip), %eax + ret + .cfi_endproc diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-3.d b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-3.d new file mode 100644 index 00000000000..3c1fcb2c85c --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-3.d @@ -0,0 +1,31 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI for demarcated code blocks 3 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +00000018 0+001c 0000001c FDE cie=00000000 pc=0+0000..0+0035 + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_advance_loc: 3 to 0+0004 + DW_CFA_def_cfa_register: r6 \(rbp\) + DW_CFA_advance_loc: 48 to 0+0034 + DW_CFA_def_cfa_register: r7 \(rsp\) + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-3.l b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-3.l new file mode 100644 index 00000000000..bcf4bacf823 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-3.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*9: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-3.s b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-3.s new file mode 100644 index 00000000000..6a2b8e1ac14 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-asm-marker-3.s @@ -0,0 +1,38 @@ +# Testcase where the input may have interleaved sections, +# possibly even text and data. + .globl main + .type main, @function +main: +.LFB1: +# .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + movq %rsp, %rbp + .cfi_def_cfa_register 6 + subq $16, %rsp + movl $17, %esi + movl $5, %edi + call add + .section .rodata + .align 16 + .type __test_obj.0, @object + .size __test_obj.0, 24 +__test_obj.0: + .string "test_elf_objs_in_rodata" +.LC0: + .string "the result is = %d\n" + .text + movl %eax, -4(%rbp) + movl -4(%rbp), %eax + movl %eax, %esi + movl $.LC0, %edi + movl $0, %eax + call printf + movl $0, %eax + leave + .cfi_def_cfa_register 7 + .cfi_restore 6 + .cfi_def_cfa_offset 8 + ret +# .cfi_endproc diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.d new file mode 100644 index 00000000000..373895c7caf --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.d @@ -0,0 +1,31 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI for SP/FP based CFA switching 1 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+001c 0+001c FDE cie=0+0000 pc=0+0000..0+000c + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_advance_loc: 3 to 0+0004 + DW_CFA_def_cfa_register: r6 \(rbp\) + DW_CFA_advance_loc: 6 to 0+000a + DW_CFA_def_cfa_register: r7 \(rsp\) + DW_CFA_advance_loc: 1 to 0+000b + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 8 + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.l new file mode 100644 index 00000000000..0e094077edd --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.s new file mode 100644 index 00000000000..c9b949fdf8f --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-1.s @@ -0,0 +1,22 @@ +# Testcase for switching between sp/fp based CFA. + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + movq %rsp, %rbp + .cfi_def_cfa_register 6 + addq %rax, %rdi + mov %rbp, %rsp + .cfi_def_cfa_register 7 + pop %rbp + .cfi_restore 6 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo + diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.d b/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.d new file mode 100644 index 00000000000..3f167c3ef1a --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.d @@ -0,0 +1,57 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI for SP/FP based CFA switching 2 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0044 0000001c FDE cie=00000000 pc=0+0000..0+0021 + DW_CFA_advance_loc: 2 to 0+0002 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r14 \(r14\) at cfa-16 + DW_CFA_advance_loc: 2 to 0+0004 + DW_CFA_def_cfa_offset: 24 + DW_CFA_offset: r13 \(r13\) at cfa-24 + DW_CFA_advance_loc: 2 to 0+0006 + DW_CFA_def_cfa_offset: 32 + DW_CFA_offset: r12 \(r12\) at cfa-32 + DW_CFA_advance_loc: 1 to 0+0007 + DW_CFA_def_cfa_offset: 40 + DW_CFA_offset: r6 \(rbp\) at cfa-40 + DW_CFA_advance_loc: 1 to 0+0008 + DW_CFA_def_cfa_offset: 48 + DW_CFA_offset: r3 \(rbx\) at cfa-48 + DW_CFA_advance_loc: 7 to 0+000f + DW_CFA_def_cfa_offset: 80 + DW_CFA_advance_loc: 9 to 0+0018 + DW_CFA_def_cfa_offset: 48 + DW_CFA_advance_loc: 1 to 0+0019 + DW_CFA_restore: r3 \(rbx\) + DW_CFA_def_cfa_offset: 40 + DW_CFA_advance_loc: 1 to 0+001a + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 32 + DW_CFA_advance_loc: 2 to 0+001c + DW_CFA_restore: r12 \(r12\) + DW_CFA_def_cfa_offset: 24 + DW_CFA_advance_loc: 2 to 0+001e + DW_CFA_restore: r13 \(r13\) + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 2 to 0+0020 + DW_CFA_restore: r14 \(r14\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.l new file mode 100644 index 00000000000..0e094077edd --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.s new file mode 100644 index 00000000000..f17c5c8dfc4 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-bp-sp-2.s @@ -0,0 +1,49 @@ +# Testcase for switching between sp/fp based CFA. + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %r14 + .cfi_def_cfa_offset 16 + .cfi_offset 14, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + pushq %r12 + .cfi_def_cfa_offset 32 + .cfi_offset 12, -32 + pushq %rbp + .cfi_def_cfa_offset 40 + .cfi_offset 6, -40 + pushq %rbx + .cfi_def_cfa_offset 48 + .cfi_offset 3, -48 + movq %rdi, %rbx + subq $32, %rsp + .cfi_def_cfa_offset 80 +# This mov does not switch CFA tracking to REG_FP, because there has already +# been stack usage between here and the push %rbp + movq %rsp, %rbp + xorl %eax, %eax + addq $32, %rsp + .cfi_def_cfa_offset 48 + popq %rbx + .cfi_restore 3 + .cfi_def_cfa_offset 40 + popq %rbp + .cfi_restore 6 + .cfi_def_cfa_offset 32 + popq %r12 + .cfi_restore 12 + .cfi_def_cfa_offset 24 + popq %r13 + .cfi_restore 13 + .cfi_def_cfa_offset 16 + popq %r14 + .cfi_restore 14 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc + .size foo, .-foo + diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.d new file mode 100644 index 00000000000..feb93d28d7a --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.d @@ -0,0 +1,40 @@ +#as: --scfi +#objdump: -Wf +#name: SCFI for callee-saved registers 1 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0002c 0+0001c FDE cie=0+0000 pc=0+0000..0+0007 + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 1 to 0+0002 + DW_CFA_def_cfa_offset: 24 + DW_CFA_offset: r3 \(rbx\) at cfa-24 + DW_CFA_advance_loc: 1 to 0+0003 + DW_CFA_def_cfa_offset: 32 + DW_CFA_offset: r6 \(rbp\) at cfa-32 + DW_CFA_advance_loc: 1 to 0+0004 + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 24 + DW_CFA_advance_loc: 1 to 0+0005 + DW_CFA_restore: r3 \(rbx\) + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 1 to 0+0006 + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.l new file mode 100644 index 00000000000..2762adba5b1 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*8: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.s new file mode 100644 index 00000000000..db3a2690bf3 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-1.s @@ -0,0 +1,26 @@ + .text + .globl foo + .type foo, @function +foo: +# .cfi_startproc + pushq %rax + .cfi_def_cfa_offset 16 + push %rbx + .cfi_def_cfa_offset 24 + .cfi_offset 3, -24 + pushq %rbp + .cfi_def_cfa_offset 32 + .cfi_offset 6, -32 + popq %rbp + .cfi_def_cfa_offset 24 + .cfi_restore 6 + popq %rbx + .cfi_def_cfa_offset 16 + .cfi_restore 3 + popq %rax + .cfi_def_cfa_offset 8 + ret +# .cfi_endproc +.LFE0: + .size foo, .-foo + diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.d b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.d new file mode 100644 index 00000000000..57a99b04557 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.d @@ -0,0 +1,41 @@ +#as: --scfi -W +#objdump: -Wf +#name: SCFI for callee-saved registers 2 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +00000018 0+002c 0000001c FDE cie=00000000 pc=0+0000..0+0017 + DW_CFA_advance_loc: 2 to 0+0002 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r12 \(r12\) at cfa-16 + DW_CFA_advance_loc: 2 to 0+0004 + DW_CFA_def_cfa_offset: 24 + DW_CFA_offset: r13 \(r13\) at cfa-24 + DW_CFA_advance_loc: 9 to 0+000d + DW_CFA_def_cfa_offset: 32 + DW_CFA_advance_loc: 1 to 0+000e + DW_CFA_def_cfa_offset: 40 + DW_CFA_advance_loc: 4 to 0+0012 + DW_CFA_def_cfa_offset: 24 + DW_CFA_advance_loc: 2 to 0+0014 + DW_CFA_restore: r13 \(r13\) + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 2 to 0+0016 + DW_CFA_restore: r12 \(r12\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.l new file mode 100644 index 00000000000..bcf4bacf823 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*9: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.s new file mode 100644 index 00000000000..7b10a2c1c6b --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-2.s @@ -0,0 +1,42 @@ +# Testcase for save reg ops for callee-saved registers +# These latter two pushq's of callee-saved regs must NOT generate +# .cfi_offset. + + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 +# The function may use callee-saved registers for its use, and may even +# chose to spill them to stack if necessary. + addq %rax, %r13 + subq $8, %r13 +# These two pushq's of callee-saved regs must NOT generate +# .cfi_offset. + pushq %r13 + .cfi_def_cfa_offset 32 + pushq %rax + .cfi_def_cfa_offset 40 +# Adjust the REG_SP to get rid of local stack usage. + addq $16, %rsp + .cfi_def_cfa_offset 24 +# The SCFI machinery keeps track of where the callee-saved registers +# are on the stack. It generates a restore operation if the stack +# offsets match. + popq %r13 + .cfi_restore 13 + .cfi_def_cfa_offset 16 + popq %r12 + .cfi_restore 12 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo + diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.d b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.d new file mode 100644 index 00000000000..73eb147a539 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.d @@ -0,0 +1,42 @@ +#as: --scfi -W +#objdump: -Wf +#name: SCFI for callee-saved registers 3 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +00000018 0+002c 0000001c FDE cie=00000000 pc=0+0000..0+0016 + DW_CFA_advance_loc: 2 to 0+0002 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r12 \(r12\) at cfa-16 + DW_CFA_advance_loc: 2 to 0+0004 + DW_CFA_def_cfa_offset: 24 + DW_CFA_offset: r13 \(r13\) at cfa-24 + DW_CFA_advance_loc: 9 to 0+000d + DW_CFA_def_cfa_offset: 32 + DW_CFA_advance_loc: 1 to 0+000e + DW_CFA_def_cfa_offset: 40 + DW_CFA_advance_loc: 1 to 0+000f + DW_CFA_def_cfa_offset: 32 + DW_CFA_advance_loc: 2 to 0+0011 + DW_CFA_def_cfa_offset: 24 + DW_CFA_advance_loc: 2 to 0+0013 + DW_CFA_restore: r13 \(r13\) + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 2 to 0+0015 + DW_CFA_restore: r12 \(r12\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.l b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.l new file mode 100644 index 00000000000..2930658dc2d --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.l @@ -0,0 +1,3 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores some user-specified CFI directives +.*25: Warning: SCFI: asymetrical register restore diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.s b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.s new file mode 100644 index 00000000000..a2bb53017f1 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-3.s @@ -0,0 +1,40 @@ +# Testcase for save reg ops for callee-saved registers + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 +# The program may use callee-saved registers for its use, and may even +# chose to spill them to stack if necessary. + addq %rax, %r13 + subq $8, %r13 +# These two pushq's of callee-saved regs must NOT generate +# .cfi_offset. + pushq %r13 + .cfi_def_cfa_offset 32 + pushq %rax + .cfi_def_cfa_offset 40 + popq %rax + .cfi_def_cfa_offset 32 + popq %r13 + .cfi_def_cfa_offset 24 +# The SCFI machinery keeps track of where the callee-saved registers +# are on the stack. It generates a restore operation if the stack +# offsets match. + popq %r13 + .cfi_restore 13 + .cfi_def_cfa_offset 16 + popq %r12 + .cfi_restore 12 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo + diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.d b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.d new file mode 100644 index 00000000000..d6543fa8f6c --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.d @@ -0,0 +1,40 @@ +#as: -W --scfi +#objdump: -Wf +#name: SCFI for callee-saved registers 4 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +00000018 0+002c 0000001c FDE cie=00000000 pc=0+0000..0+005e + DW_CFA_advance_loc: 5 to 0+0005 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_advance_loc: 3 to 0+0008 + DW_CFA_def_cfa_register: r6 \(rbp\) + DW_CFA_advance_loc: 2 to 0+000a + DW_CFA_offset: r12 \(r12\) at cfa-24 + DW_CFA_advance_loc: 1 to 0+000b + DW_CFA_offset: r3 \(rbx\) at cfa-32 + DW_CFA_advance_loc1: 79 to 0+005a + DW_CFA_restore: r3 \(rbx\) + DW_CFA_advance_loc: 2 to 0+005c + DW_CFA_restore: r12 \(r12\) + DW_CFA_advance_loc: 1 to 0+005d + DW_CFA_def_cfa_register: r7 \(rsp\) + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.l b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.l new file mode 100644 index 00000000000..58b417460e5 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.l @@ -0,0 +1,3 @@ +.*Assembler messages: +.*4: Warning: --scfi=all ignores some user-specified CFI directives +.*24: Warning: SCFI: asymetrical register restore diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.s b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.s new file mode 100644 index 00000000000..be29a3ccfa8 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-callee-saved-4.s @@ -0,0 +1,55 @@ + .type byte_insert_op1, @function +byte_insert_op1: +.LFB10: + .cfi_startproc + endbr64 + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + movq %rsp, %rbp + .cfi_def_cfa_register 6 + pushq %r12 + .cfi_offset 12, -24 + pushq %rbx + .cfi_offset 3, -32 + subq $24, %rsp + movl %edi, -20(%rbp) + movq %rsi, -32(%rbp) + movl %edx, -24(%rbp) + movq %rcx, -40(%rbp) +# The program may use callee-saved registers for its use, and may even +# chose to read them from stack if necessary. The following use should +# not be treated as reg restore for SCFI purposes (because rbx has been +# saved to -16(%rbp). + movq -40(%rbp), %rbx + movq -40(%rbp), %rax + leaq 3(%rax), %r12 + jmp .L563 +.L564: + subq $1, %rbx + subq $1, %r12 + movzbl (%rbx), %eax + movb %al, (%r12) +.L563: + cmpq -32(%rbp), %rbx + jne .L564 + movl -24(%rbp), %edx + movq -32(%rbp), %rcx + movl -20(%rbp), %eax + movq %rcx, %rsi + movl %eax, %edi + call byte_store_op1 + nop + addq $24, %rsp + popq %rbx + .cfi_restore 3 + popq %r12 + .cfi_restore 12 + popq %rbp + .cfi_def_cfa_register 7 + .cfi_restore 6 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE10: + .size byte_insert_op1, .-byte_insert_op1 diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.d new file mode 100644 index 00000000000..aa14af48613 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.d @@ -0,0 +1,36 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI in presence of control flow 1 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0024 0000001c FDE cie=00000000 pc=0+0000..0+003a + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r3 \(rbx\) at cfa-16 + DW_CFA_advance_loc: 37 to 0+0026 + DW_CFA_remember_state + DW_CFA_advance_loc: 1 to 0+0027 + DW_CFA_restore: r3 \(rbx\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_advance_loc: 1 to 0+0028 + DW_CFA_restore_state + DW_CFA_advance_loc: 9 to 0+0031 + DW_CFA_restore: r3 \(rbx\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.l new file mode 100644 index 00000000000..653937edbf9 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*15: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.s new file mode 100644 index 00000000000..9e72ed0ed2b --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cfg-1.s @@ -0,0 +1,47 @@ +# Testcase with one dominator bb and two exit bbs +# Something like for: return ferror (f) || fclose (f) != 0; + .text + .section .rodata.str1.1,"aMS",@progbits,1 +.LC0: + .string "w" +.LC1: + .string "conftest.out" + .section .text.startup,"ax",@progbits + .p2align 4 + .globl main + .type main, @function +main: +.LFB11: + .cfi_startproc + pushq %rbx + .cfi_def_cfa_offset 16 + .cfi_offset 3, -16 + movl $.LC0, %esi + movl $.LC1, %edi + call fopen + movq %rax, %rdi + movq %rax, %rbx + call ferror + movl %eax, %edx + movl $1, %eax + testl %edx, %edx + je .L7 + .cfi_remember_state + popq %rbx + .cfi_restore 3 + .cfi_def_cfa_offset 8 + ret +.L7: + .cfi_restore_state + movq %rbx, %rdi + call fclose + popq %rbx + .cfi_restore 3 + .cfi_def_cfa_offset 8 + testl %eax, %eax + setne %al + movzbl %al, %eax + ret + .cfi_endproc +.LFE11: + .size main, .-main diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.d b/gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.d new file mode 100644 index 00000000000..736c26386e7 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.d @@ -0,0 +1,28 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI in presence of control flow 2 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0001c 0+001c FDE cie=00000000 pc=0000000000000000..0000000000000016 + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_advance_loc: 3 to 0+0004 + DW_CFA_def_cfa_register: r6 \(rbp\) + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.l new file mode 100644 index 00000000000..2762adba5b1 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*8: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.s new file mode 100644 index 00000000000..adf1df08bc4 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cfg-2.s @@ -0,0 +1,21 @@ +# Testcase for CFG creation of ginsns +# This testcase has no return instruction at the end. + .text + .globl main + .type main, @function +main: +.LFB7: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + movq %rsp, %rbp + .cfi_def_cfa_register 6 + call foo + shrl $31, %eax + movzbl %al, %eax + movl %eax, %edi + call exit + .cfi_endproc +.LFE7: + .size main, .-main diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cfi-label-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-cfi-label-1.d new file mode 100644 index 00000000000..6e11583a534 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cfi-label-1.d @@ -0,0 +1,37 @@ +#as: --scfi -W +#objdump: -tWf +#name: SCFI no ignore .cfi_label +#... +.*\.o: file format elf.* + +SYMBOL TABLE: +0+0000 l d \.text 0+0000 \.text +0+002b l \.eh_frame 0+0000 cfi2 +0+0000 g F \.text 0+0008 foo +0+002a g \.eh_frame 0+0000 cfi1 + + +Contents of the .eh_frame section: + + +00000000 0+0014 00000000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: 1b + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +00000018 0+0014 0000001c FDE cie=00000000 pc=0+0000..0+0008 + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_advance_loc: 1 to 0+0002 + DW_CFA_advance_loc: 1 to 0+0003 + DW_CFA_advance_loc: 4 to 0+0007 + DW_CFA_def_cfa_offset: 0 + DW_CFA_nop + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cfi-label-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-cfi-label-1.l new file mode 100644 index 00000000000..0e094077edd --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cfi-label-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cfi-label-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-cfi-label-1.s new file mode 100644 index 00000000000..845696d4749 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cfi-label-1.s @@ -0,0 +1,19 @@ +# Testcase for .cfi_label directives + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + nop + .globl cfi1 + .cfi_label cfi1 + nop + .cfi_label cfi2 + nop + .cfi_label .Lcfi3 + addq $8, %rsp + .cfi_def_cfa_offset 0 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.d new file mode 100644 index 00000000000..af4fa429339 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.d @@ -0,0 +1,5 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI for add insn + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.l new file mode 100644 index 00000000000..fd57194cedf --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.l @@ -0,0 +1,3 @@ +.*Assembler messages: +.*12: Warning: --scfi=all ignores some user-specified CFI directives +.*22: Warning: Untraceable control flow for func 'foo'; Skipping SCFI diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.s new file mode 100644 index 00000000000..fa03b5ef5e4 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-cofi-1.s @@ -0,0 +1,23 @@ +# Testcase with a variety of "change of flow instructions" +# +# Must be run with -W so it remains warning free. +# +# This test does not have much going on wrt synthesis of CFI; +# it just aims to ensure x8_64 -> ginsn decoding must behave +# gracefully for these "change of flow instructions" + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + addq %rdx, %rax + notrack jmp *%rax + call *%r8 + jmp *48(%rdi) + jo .L179 +.L179: + ret + .cfi_endproc +.LFE0: + .size foo, .-foo + diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-diag-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-diag-1.l new file mode 100644 index 00000000000..ecc6b82ce97 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-diag-1.l @@ -0,0 +1,4 @@ +.*Assembler messages: +.*7: Warning: --scfi=all ignores some user-specified CFI directives +.*14: Error: SCFI: usage of REG_FP as scratch not supported +.*22: Warning: SCFI: forward pass failed for func 'foo' diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-diag-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-diag-1.s new file mode 100644 index 00000000000..c09ec0da1c4 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-diag-1.s @@ -0,0 +1,23 @@ +# Testcase for REG_FP based CFA +# and using REG_FP as scratch. + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + movq %rsp, %rbp + .cfi_def_cfa_register 6 +# The following add causes REG_FP to become untraceable + addq %rax, %rbp + .cfi_def_cfa_register 7 + pop %rbp + .cfi_restore 6 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo + diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-diag-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-diag-2.l new file mode 100644 index 00000000000..d3adbeca35a --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-diag-2.l @@ -0,0 +1,4 @@ +.*Assembler messages: +.*5: Warning: --scfi=all ignores some user-specified CFI directives +.*21: Warning: SCFI: asymetrical register restore +.*22: Warning: SCFI: asymetrical register restore diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-diag-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-diag-2.s new file mode 100644 index 00000000000..f58915d0a72 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-diag-2.s @@ -0,0 +1,28 @@ +# Testcase for a diagnostic around assymetrical restore +.type foo, @function +foo: +.LFB10: + .cfi_startproc + endbr64 + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + movq %rsp, %rbp + .cfi_def_cfa_register 6 + pushq %r12 + pushq %rbx + subq $24, %rsp + .cfi_offset 12, -24 + .cfi_offset 3, -32 + addq $24, %rsp +# Note that the order of r12 and rbx restore does not match +# order of the corresponding save(s). +# The SCFI machinery warns the user. + popq %r12 + popq %rbx + popq %rbp + .cfi_def_cfa 7, 8 + ret + .cfi_endproc +.LFE10: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.d new file mode 100644 index 00000000000..935deace54f --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.d @@ -0,0 +1,23 @@ +#as: --scfi --gsframe -W +#objdump: --sframe +#name: SCFI for dynamic alloc stack +#... + +Contents of the SFrame section .sframe: + Header : + + Version: SFRAME_VERSION_2 + Flags: NONE + Num FDEs: 1 + Num FREs: 4 + + Function Index : + + func idx \[0\]: pc = 0x0, size = 87 bytes + STARTPC + CFA + FP + RA + 0+0000 + sp\+8 + u + u + 0+0001 + sp\+16 + c-16 + u + 0+0004 + fp\+16 + c-16 + u + 0+0056 + sp\+8 + u + u + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.l new file mode 100644 index 00000000000..ce97dd14432 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*5: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.s new file mode 100644 index 00000000000..12f1cd78994 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.s @@ -0,0 +1,50 @@ + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + movq %rsp, %rbp + .cfi_def_cfa_register 6 + pushq %r13 + pushq %r12 + pushq %rbx + subq $8, %rsp + .cfi_offset 13, -24 + .cfi_offset 12, -32 + .cfi_offset 3, -40 + call read_user + testl %eax, %eax + jle .L2 + cltq + xorl %ebx, %ebx + leaq 0(,%rax,4), %r13 + .p2align 4,,10 + .p2align 3 +.L3: + leaq 15(%rbx), %rax + movq %rsp, %r12 + addq $4, %rbx + andq $-16, %rax + subq %rax, %rsp + movq %rsp, %rdi + call foo + movq %r12, %rsp + cmpq %r13, %rbx + jne .L3 +.L2: + leaq -24(%rbp), %rsp + xorl %eax, %eax + popq %rbx + popq %r12 + popq %r13 + popq %rbp + .cfi_restore 6 + .cfi_def_cfa_register 7 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-fp-diag-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-fp-diag-2.l new file mode 100644 index 00000000000..734666af914 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-fp-diag-2.l @@ -0,0 +1,3 @@ +.*Assembler messages: +.*7: Warning: --scfi=all ignores some user-specified CFI directives +.*28: Warning: SCFI: asymetrical register restore diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-fp-diag-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-fp-diag-2.s new file mode 100644 index 00000000000..fd46fe3f65c --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-fp-diag-2.s @@ -0,0 +1,55 @@ +# Testcase for a diagnostic around assymetrical restore +# Testcase inspired by byte_insert_op1 in libiberty +# False positive for the diagnostic +.type foo, @function +foo: +.LFB10: + .cfi_startproc + endbr64 + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + movq %rsp, %rbp + .cfi_def_cfa_register 6 + pushq %r12 + pushq %rbx + subq $24, %rsp + .cfi_offset 12, -24 + .cfi_offset 3, -32 + movl %edi, -20(%rbp) + movq %rsi, -32(%rbp) + movl %edx, -24(%rbp) + movq %rcx, -40(%rbp) +# The assembler cannot differentiate that the following +# mov to %rbx is not a true restore operation, but simply +# %rbx register usage as a scratch reg of some sort. +# The assembler merely warns of a possible assymetric restore operation +# In this case, its noise for the user unfortunately. + movq -40(%rbp), %rbx + movq -40(%rbp), %rax + leaq 3(%rax), %r12 + jmp .L563 +.L564: + subq $1, %rbx + subq $1, %r12 + movzbl (%rbx), %eax + movb %al, (%r12) +.L563: + cmpq -32(%rbp), %rbx + jne .L564 + movl -24(%rbp), %edx + movq -32(%rbp), %rcx + movl -20(%rbp), %eax + movq %rcx, %rsi + movl %eax, %edi + call byte_store_op1 + nop + addq $24, %rsp + popq %rbx + popq %r12 + popq %rbp + .cfi_def_cfa 7, 8 + ret + .cfi_endproc +.LFE10: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-ignore-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-ignore-1.d new file mode 100644 index 00000000000..1cf5919add6 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-ignore-1.d @@ -0,0 +1,26 @@ +#as: --scfi -W +#objdump: -Wf +#name: Ignore user specified CFI directives +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0014 0+001c FDE cie=0+0000 pc=0+0000..0+0002 + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_nop + DW_CFA_nop + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-ignore-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-ignore-1.l new file mode 100644 index 00000000000..ce97dd14432 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-ignore-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*5: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-ignore-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-ignore-1.s new file mode 100644 index 00000000000..68b731c58ba --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-ignore-1.s @@ -0,0 +1,13 @@ + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo + diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.d new file mode 100644 index 00000000000..4f4436506f6 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.d @@ -0,0 +1,51 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI for indirect mem op to stack 1 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0034 0+001c FDE cie=00000000 pc=0+0000..0+005b + DW_CFA_advance_loc: 4 to 0+0004 + DW_CFA_def_cfa_offset: 64 + DW_CFA_advance_loc: 4 to 0+0008 + DW_CFA_offset: r3 \(rbx\) at cfa-64 + DW_CFA_advance_loc: 5 to 0+000d + DW_CFA_offset: r6 \(rbp\) at cfa-56 + DW_CFA_advance_loc: 5 to 0+0012 + DW_CFA_offset: r12 \(r12\) at cfa-48 + DW_CFA_advance_loc: 5 to 0+0017 + DW_CFA_offset: r13 \(r13\) at cfa-40 + DW_CFA_advance_loc: 5 to 0+001c + DW_CFA_offset: r14 \(r14\) at cfa-32 + DW_CFA_advance_loc: 5 to 0+0021 + DW_CFA_offset: r15 \(r15\) at cfa-24 + DW_CFA_advance_loc: 29 to 0+003e + DW_CFA_restore: r15 \(r15\) + DW_CFA_advance_loc: 5 to 0+0043 + DW_CFA_restore: r14 \(r14\) + DW_CFA_advance_loc: 5 to 0+0048 + DW_CFA_restore: r13 \(r13\) + DW_CFA_advance_loc: 5 to 0+004d + DW_CFA_restore: r12 \(r12\) + DW_CFA_advance_loc: 5 to 0+0052 + DW_CFA_restore: r6 \(rbp\) + DW_CFA_advance_loc: 4 to 0+0056 + DW_CFA_restore: r3 \(rbx\) + DW_CFA_advance_loc: 4 to 0+005a + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.l new file mode 100644 index 00000000000..229fb4e7035 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*4: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.s new file mode 100644 index 00000000000..e3b5ab30ff1 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-1.s @@ -0,0 +1,48 @@ +# An example of static stack allocation by hand + .type foo, @function +foo: + .cfi_startproc + /* Allocate space for 7 registers. */ + subq $56,%rsp + .cfi_adjust_cfa_offset 56 + movq %rbx,(%rsp) + .cfi_rel_offset 3, 0 + movq %rbp,8(%rsp) + .cfi_rel_offset 6, 8 + movq %r12,16(%rsp) + .cfi_rel_offset 12, 16 + movq %r13,24(%rsp) + .cfi_rel_offset 13, 24 + movq %r14,32(%rsp) + .cfi_rel_offset 14, 32 + movq %r15,40(%rsp) + .cfi_rel_offset 15, 40 + movq %r9,48(%rsp) + + /* Setup parameter for __foo_internal. */ + /* selfpc is the return address on the stack. */ + movq 56(%rsp),%rsi + /* Get frompc via the frame pointer. */ + movq 8(%rbp),%rdi + call __foo_internal + /* Pop the saved registers. Please note that `foo' has no + return value. */ + movq 48(%rsp),%r9 + + movq 40(%rsp),%r15 + .cfi_restore 15 + movq 32(%rsp),%r14 + .cfi_restore 14 + movq 24(%rsp),%r13 + .cfi_restore 13 + movq 16(%rsp),%r12 + .cfi_restore 12 + movq 8(%rsp),%rbp + .cfi_restore 6 + movq (%rsp),%rbx + .cfi_restore 3 + addq $56,%rsp + .cfi_adjust_cfa_offset -56 + ret + .cfi_endproc + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.d b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.d new file mode 100644 index 00000000000..3caa66547f6 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.d @@ -0,0 +1,41 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI for indirect mem op to stack 2 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+002c 0+001c FDE cie=00000000 pc=0+0000..0+0026 + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_advance_loc: 3 to 0+0004 + DW_CFA_def_cfa_register: r6 \(rbp\) + DW_CFA_advance_loc: 8 to 0+000c + DW_CFA_offset: r3 \(rbx\) at cfa-32 + DW_CFA_advance_loc: 4 to 0+0010 + DW_CFA_offset: r12 \(r12\) at cfa-24 + DW_CFA_advance_loc: 9 to 0+0019 + DW_CFA_restore: r3 \(rbx\) + DW_CFA_advance_loc: 4 to 0+001d + DW_CFA_restore: r12 \(r12\) + DW_CFA_advance_loc: 7 to 0+0024 + DW_CFA_def_cfa_register: r7 \(rsp\) + DW_CFA_advance_loc: 1 to 0+0025 + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.l new file mode 100644 index 00000000000..0e094077edd --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.s new file mode 100644 index 00000000000..bed2050241c --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-2.s @@ -0,0 +1,38 @@ +# Testcase for movq instructions + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + movq %rsp, %rbp + .cfi_def_cfa_register 6 + + subq $16,%rsp + +# store rbx at %rsp; rsp = rbp - 16; + movq %rbx, -16(%rbp) + .cfi_rel_offset 3, -16 +# store r12 at %rsp + 8; rsp = rbp -16; + movq %r12, -8(%rbp) + .cfi_rel_offset 12, -8 + + call bar + + movq -16(%rbp), %rbx + .cfi_restore 3 + movq -8(%rbp), %r12 + .cfi_restore 12 + + addq $16,%rsp + + mov %rbp, %rsp + .cfi_def_cfa_register 7 + pop %rbp + .cfi_restore 6 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.d b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.d new file mode 100644 index 00000000000..8070e220b7a --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.d @@ -0,0 +1,41 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI for indirect mem op to stack 3 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+002c 0+001c FDE cie=00000000 pc=0+0000..0+0028 + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_advance_loc: 3 to 0+0004 + DW_CFA_def_cfa_register: r6 \(rbp\) + DW_CFA_advance_loc: 8 to 0+000c + DW_CFA_offset: r3 \(rbx\) at cfa-32 + DW_CFA_advance_loc: 5 to 0+0011 + DW_CFA_offset: r12 \(r12\) at cfa-24 + DW_CFA_advance_loc: 9 to 0+001a + DW_CFA_restore: r3 \(rbx\) + DW_CFA_advance_loc: 5 to 0+001f + DW_CFA_restore: r12 \(r12\) + DW_CFA_advance_loc: 7 to 0+0026 + DW_CFA_def_cfa_register: r7 \(rsp\) + DW_CFA_advance_loc: 1 to 0+0027 + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.l b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.l new file mode 100644 index 00000000000..0e094077edd --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.s b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.s new file mode 100644 index 00000000000..0eb90bc34e3 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-3.s @@ -0,0 +1,38 @@ +# Testcase for movq instructions + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + movq %rsp, %rbp + .cfi_def_cfa_register 6 + + subq $16,%rsp + +# store rbx at %rsp; rsp = rbp - 16; rsp = CFA - 32 + movq %rbx, (%rsp) + .cfi_rel_offset 3, -16 +# store r12 at %rsp + 8; rsp = CFA - 32 + movq %r12, 8(%rsp) + .cfi_rel_offset 12, -8 + + call bar + + movq (%rsp), %rbx + .cfi_restore 3 + movq 8(%rsp), %r12 + .cfi_restore 12 + + addq $16,%rsp + + mov %rbp, %rsp + .cfi_def_cfa_register 7 + pop %rbp + .cfi_restore 6 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-4.d b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-4.d new file mode 100644 index 00000000000..dbb16d7d05e --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-4.d @@ -0,0 +1,63 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI for indirect mem op to stack 3 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +00000018 0+004c 0000001c FDE cie=00000000 pc=0+0000..0+003d + DW_CFA_advance_loc: 2 to 0+0002 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r15 \(r15\) at cfa-16 + DW_CFA_advance_loc: 2 to 0+0004 + DW_CFA_def_cfa_offset: 24 + DW_CFA_offset: r14 \(r14\) at cfa-24 + DW_CFA_advance_loc: 5 to 0+0009 + DW_CFA_def_cfa_offset: 32 + DW_CFA_offset: r13 \(r13\) at cfa-32 + DW_CFA_advance_loc: 5 to 0+000e + DW_CFA_def_cfa_offset: 40 + DW_CFA_offset: r12 \(r12\) at cfa-40 + DW_CFA_advance_loc: 4 to 0+0012 + DW_CFA_def_cfa_offset: 48 + DW_CFA_offset: r6 \(rbp\) at cfa-48 + DW_CFA_advance_loc: 4 to 0+0016 + DW_CFA_def_cfa_offset: 56 + DW_CFA_offset: r3 \(rbx\) at cfa-56 + DW_CFA_advance_loc: 7 to 0+001d + DW_CFA_def_cfa_offset: 96 + DW_CFA_advance_loc: 21 to 0+0032 + DW_CFA_def_cfa_offset: 56 + DW_CFA_advance_loc: 1 to 0+0033 + DW_CFA_restore: r3 \(rbx\) + DW_CFA_def_cfa_offset: 48 + DW_CFA_advance_loc: 1 to 0+0034 + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 40 + DW_CFA_advance_loc: 2 to 0+0036 + DW_CFA_restore: r12 \(r12\) + DW_CFA_def_cfa_offset: 32 + DW_CFA_advance_loc: 2 to 0+0038 + DW_CFA_restore: r13 \(r13\) + DW_CFA_def_cfa_offset: 24 + DW_CFA_advance_loc: 2 to 0+003a + DW_CFA_restore: r14 \(r14\) + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 2 to 0+003c + DW_CFA_restore: r15 \(r15\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-4.l b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-4.l new file mode 100644 index 00000000000..1793f4b4799 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-4.l @@ -0,0 +1,3 @@ +.*Assembler messages: +.*7: Warning: --scfi=all ignores some user-specified CFI directives +.*41: Warning: SCFI: asymetrical register restore diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-4.s b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-4.s new file mode 100644 index 00000000000..ae0c0fde16c --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-indirect-mov-4.s @@ -0,0 +1,68 @@ +# Testcase for save/unsave of callee-saved registers +# Must be run -W as there is an expected warning as +# noted below + .type foo, @function +foo: +.LFB118: + .cfi_startproc + pushq %r15 + .cfi_def_cfa_offset 16 + .cfi_offset 15, -16 + pushq %r14 + .cfi_def_cfa_offset 24 + .cfi_offset 14, -24 + movl %r8d, %r14d + pushq %r13 + .cfi_def_cfa_offset 32 + .cfi_offset 13, -32 + movq %rdi, %r13 + pushq %r12 + .cfi_def_cfa_offset 40 + .cfi_offset 12, -40 + movq %rsi, %r12 + pushq %rbp + .cfi_def_cfa_offset 48 + .cfi_offset 6, -48 + movq %rcx, %rbp + pushq %rbx + .cfi_def_cfa_offset 56 + .cfi_offset 3, -56 + movq %rdx, %rbx + subq $40, %rsp + .cfi_def_cfa_offset 96 + testb $1, 37(%rdx) + je .L2 +.L3: +# The following is not a restore of r15: rbp has been used as +# scratch register already. The SCFI machinery must know that +# REG_FP is not traceable. +# A warning here is expected: +# 41: Warning: SCFI: asymetrical register restore + movq 32(%rbp), %r15 + cmpq $0, 64(%r15) + je .L2 +.L2: + addq $40, %rsp + .cfi_def_cfa_offset 56 + popq %rbx + .cfi_restore 3 + .cfi_def_cfa_offset 48 + popq %rbp + .cfi_restore 6 + .cfi_def_cfa_offset 40 + popq %r12 + .cfi_restore 12 + .cfi_def_cfa_offset 32 + popq %r13 + .cfi_restore 13 + .cfi_def_cfa_offset 24 + popq %r14 + .cfi_restore 14 + .cfi_def_cfa_offset 16 + popq %r15 + .cfi_restore 15 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE118: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-lea-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-lea-1.d new file mode 100644 index 00000000000..d2fa442df63 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-lea-1.d @@ -0,0 +1,37 @@ +#as: --scfi -W -O2 +#objdump: -Wf +#name: Synthesize CFI for various lea instructions (-O2) +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0024 0+001c FDE cie=00000000 pc=0+0000..0+0029 + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_advance_loc: 3 to 0+0004 + DW_CFA_def_cfa_register: r6 \(rbp\) + DW_CFA_advance_loc: 2 to 0+0006 + DW_CFA_offset: r13 \(r13\) at cfa-24 + DW_CFA_advance_loc: 33 to 0+0027 + DW_CFA_restore: r13 \(r13\) + DW_CFA_advance_loc: 1 to 0+0028 + DW_CFA_def_cfa_register: r7 \(rsp\) + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-lea-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-lea-1.l new file mode 100644 index 00000000000..2762adba5b1 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-lea-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*8: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-lea-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-lea-1.s new file mode 100644 index 00000000000..8fb8fe794d6 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-lea-1.s @@ -0,0 +1,40 @@ +## Testcase with a variety of lea. +## This test is run with -O2 by default to check +## SCFI in wake of certain target optimizations. + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 +# This lea gets transformed to mov %rsp, %rbp when -O2. +# The SCFI machinery must see it as such. + lea (%rsp), %rbp + .cfi_def_cfa_register 6 + push %r13 + .cfi_offset 13, -24 + subq $8, %rsp + testl %eax, %eax + jle .L2 +.L3: + movq %rsp, %r12 + lea -0x2(%r13),%rax + lea 0x8(%r12,%rdx,4),%r8 + movq %r12, %rsp + jne .L3 +.L2: + leaq -8(%rbp), %rsp + xorl %eax, %eax + popq %r13 + .cfi_restore 13 + popq %rbp + .cfi_def_cfa_register 7 + .cfi_restore 6 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo + diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-leave-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-leave-1.d new file mode 100644 index 00000000000..0d9e5943a30 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-leave-1.d @@ -0,0 +1,36 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI for leave insn +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0024 0+001c FDE cie=0+0000 pc=0+0000..0+000a + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_advance_loc: 3 to 0+0004 + DW_CFA_def_cfa_register: r6 \(rbp\) + DW_CFA_advance_loc: 1 to 0+0005 + DW_CFA_offset: r3 \(rbx\) at cfa-24 + DW_CFA_advance_loc: 3 to 0+0008 + DW_CFA_restore: r3 \(rbx\) + DW_CFA_advance_loc: 1 to 0+0009 + DW_CFA_def_cfa_register: r7 \(rsp\) + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-leave-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-leave-1.l new file mode 100644 index 00000000000..0e094077edd --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-leave-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-leave-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-leave-1.s new file mode 100644 index 00000000000..0466ab15708 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-leave-1.s @@ -0,0 +1,26 @@ +# Testcase for leave insn + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + movq %rsp, %rbp + .cfi_def_cfa_register 6 + push %rbx + .cfi_offset 3, -24 + push %rdi + pop %rdi + pop %rbx + .cfi_restore 3 + leave + .cfi_def_cfa_register 7 + .cfi_restore 6 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo + diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.d new file mode 100644 index 00000000000..e37d4a93917 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.d @@ -0,0 +1,35 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI for pushq insns +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0024 0+001c FDE cie=0+0000 pc=0+0000..0+000c + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 3 to 0+0004 + DW_CFA_def_cfa_offset: 24 + DW_CFA_advance_loc: 2 to 0+0006 + DW_CFA_def_cfa_offset: 32 + DW_CFA_advance_loc: 2 to 0+0008 + DW_CFA_def_cfa_offset: 40 + DW_CFA_advance_loc: 2 to 0+0000a + DW_CFA_def_cfa_offset: 48 + DW_CFA_advance_loc: 1 to 0+0000b + DW_CFA_def_cfa_offset: 56 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.l new file mode 100644 index 00000000000..bba199d24b9 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*7: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.s new file mode 100644 index 00000000000..b896a295b56 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-pushq-1.s @@ -0,0 +1,24 @@ +## Testcase with a variety of pushq. +## all push insns valid in 64-bit mode must be processed for SCFI. + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rax + .cfi_def_cfa_offset 16 + pushq 16(%rax) + .cfi_def_cfa_offset 24 + pushq $36 + .cfi_def_cfa_offset 32 + pushq %fs + .cfi_def_cfa_offset 40 + pushq %gs + .cfi_def_cfa_offset 48 + pushf + .cfi_def_cfa_offset 56 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo + diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-1.d new file mode 100644 index 00000000000..1fd0af4d8ae --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-1.d @@ -0,0 +1,43 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI with pushsection 1 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +00000018 0+0010 0000001c FDE cie=00000000 pc=0+0000..0+0005 + DW_CFA_advance_loc: 4 to 0+0004 + DW_CFA_def_cfa_offset: 48 + +0000002c 0+0028 00000030 FDE cie=00000000 pc=0+0000..0+0014 + DW_CFA_advance_loc: 2 to 0+0002 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r12 \(r12\) at cfa-16 + DW_CFA_advance_loc: 2 to 0+0004 + DW_CFA_def_cfa_offset: 24 + DW_CFA_offset: r13 \(r13\) at cfa-24 + DW_CFA_advance_loc: 4 to 0+0008 + DW_CFA_def_cfa_offset: 32 + DW_CFA_advance_loc: 7 to 0+000f + DW_CFA_def_cfa_offset: 24 + DW_CFA_advance_loc: 2 to 0+0011 + DW_CFA_restore: r13 \(r13\) + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 2 to 0+0013 + DW_CFA_restore: r12 \(r12\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-1.l new file mode 100644 index 00000000000..bba199d24b9 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*7: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-1.s new file mode 100644 index 00000000000..4bee003e6f5 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-1.s @@ -0,0 +1,40 @@ +# Testcase for pushsection directive and SCFI. +# The .pushsection directive must cause creation of a new FDE. + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + subq $8, %rsp + .cfi_def_cfa_offset 32 + mov %rax, %rbx + .pushsection .text2 +# It's the .type directive here that enforces SCFI generation +# for the code block that follows + .type foo2, @function +foo2: + .cfi_startproc + subq $40, %rsp + .cfi_def_cfa_offset 48 + ret + .cfi_endproc + .size foo2, .-foo2 + .popsection + addq $8, %rsp + .cfi_def_cfa_offset 24 + popq %r13 + .cfi_restore 13 + .cfi_def_cfa_offset 16 + popq %r12 + .cfi_restore 12 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-2.d b/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-2.d new file mode 100644 index 00000000000..3e6ebc15aa3 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-2.d @@ -0,0 +1,39 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI for demarcated code blocks 2 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +00000018 0+002c 0000001c FDE cie=00000000 pc=0+0000..0+0014 + DW_CFA_advance_loc: 2 to 0+0002 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r12 \(r12\) at cfa-16 + DW_CFA_advance_loc: 2 to 0+0004 + DW_CFA_def_cfa_offset: 24 + DW_CFA_offset: r13 \(r13\) at cfa-24 + DW_CFA_advance_loc: 4 to 0+0008 + DW_CFA_def_cfa_offset: 32 + DW_CFA_advance_loc: 7 to 0+000f + DW_CFA_def_cfa_offset: 24 + DW_CFA_advance_loc: 2 to 0+0011 + DW_CFA_restore: r13 \(r13\) + DW_CFA_def_cfa_offset: 16 + DW_CFA_advance_loc: 2 to 0+0013 + DW_CFA_restore: r12 \(r12\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-2.l new file mode 100644 index 00000000000..0e094077edd --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-2.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-2.s new file mode 100644 index 00000000000..e7b6dbc2526 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-pushsection-2.s @@ -0,0 +1,38 @@ +# Testcase for pushsection directive and SCFI. + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %r12 + .cfi_def_cfa_offset 16 + .cfi_offset 12, -16 + pushq %r13 + .cfi_def_cfa_offset 24 + .cfi_offset 13, -24 + subq $8, %rsp + .cfi_def_cfa_offset 32 + mov %rax, %rbx +# The .pushsection directive creates a new code block, +# which must not contribute ginsn to the existing one. + .pushsection .text2 +# For CFI to be synthesized for this block, the user should have +# demarcated the beginning with a .type name, @function + .cfi_startproc + subq $40, %rsp + .cfi_def_cfa_offset 48 + ret + .cfi_endproc + .popsection + addq $8, %rsp + .cfi_def_cfa_offset 24 + popq %r13 + .cfi_restore 13 + .cfi_def_cfa_offset 16 + popq %r12 + .cfi_restore 12 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.d new file mode 100644 index 00000000000..c05c0314c0f --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.d @@ -0,0 +1,31 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI for self-aligning func +#... +Contents of the .eh_frame section: + +0+0000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+001c 0000001c FDE cie=00000000 pc=0+0000..0+002f + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_advance_loc: 3 to 0+0004 + DW_CFA_def_cfa_register: r6 \(rbp\) + DW_CFA_advance_loc: 42 to 0+002e + DW_CFA_def_cfa_register: r7 \(rsp\) + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.l new file mode 100644 index 00000000000..bba199d24b9 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*7: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.s new file mode 100644 index 00000000000..51a40b5940b --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-selfalign-func-1.s @@ -0,0 +1,36 @@ +# If it is known that the caller of self_aligning_foo may have had +# the stack pointer unaligned to 16-bytes boundary, such self-aligning +# functions may be used by asm programmers. + .globl self_aligning_foo + .type self_aligning_foo, @function +self_aligning_foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + movq %rsp, %rbp + .cfi_def_cfa_register 6 +# The following 'and' op aligns the stack pointer. +# At the same time, it causes REG_SP to become non-traceable +# for SCFI purposes. But no warning is issued as no further stack +# size tracking is needed for SCFI purposes. + andq $-16, %rsp + subq $32, %rsp + movl %edi, 12(%rsp) + movl %esi, 8(%rsp) + movl $0, %eax + call vector_using_function + movaps %xmm0, 16(%rsp) + movl 12(%rsp), %edx + movl 8(%rsp), %eax + addl %edx, %eax + leave +# GCC typically generates a '.cfi_def_cfa 7, 8' for leave +# insn. The SCFI however, will generate the following: + .cfi_def_cfa_register 7 + .cfi_restore 6 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size self_aligning_foo, .-self_aligning_foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-simple-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-simple-1.d new file mode 100644 index 00000000000..849833cb5c8 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-simple-1.d @@ -0,0 +1,26 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI simple test 1 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0014 0+001c FDE cie=0+0000 pc=0+0000..0+0002 + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_nop + DW_CFA_nop + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-simple-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-simple-1.l new file mode 100644 index 00000000000..bba199d24b9 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-simple-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*7: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-simple-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-simple-1.s new file mode 100644 index 00000000000..f36b553cbff --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-simple-1.s @@ -0,0 +1,15 @@ +# Simple test +# A wierd function, but SCFI machinery does not complain yet. + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo + diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-simple-2.d b/gas/testsuite/gas/scfi/x86_64/scfi-simple-2.d new file mode 100644 index 00000000000..2fa5e565f8b --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-simple-2.d @@ -0,0 +1,30 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI simple test 2 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0001c 0+0001c FDE cie=0+0000 pc=0+0000..0+0003 + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_advance_loc: 1 to 0+0002 + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-simple-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-simple-2.l new file mode 100644 index 00000000000..ce97dd14432 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-simple-2.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*5: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-simple-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-simple-2.s new file mode 100644 index 00000000000..e778cef517b --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-simple-2.s @@ -0,0 +1,16 @@ + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + popq %rbp + .cfi_restore 6 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo + diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-sub-1.d b/gas/testsuite/gas/scfi/x86_64/scfi-sub-1.d new file mode 100644 index 00000000000..80fb5bfb210 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-sub-1.d @@ -0,0 +1,25 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI for sub insn 1 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+0014 0+001c FDE cie=0+0000 pc=0+0000..0+0008 + DW_CFA_advance_loc: 7 to 0+0007 + DW_CFA_def_cfa_offset: 120016 + DW_CFA_nop +#... + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-sub-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-sub-1.l new file mode 100644 index 00000000000..0e094077edd --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-sub-1.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-sub-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-sub-1.s new file mode 100644 index 00000000000..741a0abf69f --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-sub-1.s @@ -0,0 +1,12 @@ +# Testcase for sub instruction. + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + subq $120008, %rsp + .cfi_def_cfa_offset 120016 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-sub-2.d b/gas/testsuite/gas/scfi/x86_64/scfi-sub-2.d new file mode 100644 index 00000000000..3fb232f1e1b --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-sub-2.d @@ -0,0 +1,31 @@ +#as: --scfi -W +#objdump: -Wf +#name: Synthesize CFI for sub insn 2 +#... +Contents of the .eh_frame section: + +00000000 0+0014 0+0000 CIE + Version: 1 + Augmentation: "zR" + Code alignment factor: 1 + Data alignment factor: -8 + Return address column: 16 + Augmentation data: [01][abc] + DW_CFA_def_cfa: r7 \(rsp\) ofs 8 + DW_CFA_offset: r16 \(rip\) at cfa-8 + DW_CFA_nop + DW_CFA_nop + +0+0018 0+001c 0+001c FDE cie=0+0000 pc=0+0000..0+001d + DW_CFA_advance_loc: 1 to 0+0001 + DW_CFA_def_cfa_offset: 16 + DW_CFA_offset: r6 \(rbp\) at cfa-16 + DW_CFA_advance_loc: 3 to 0+0004 + DW_CFA_def_cfa_register: r6 \(rbp\) + DW_CFA_advance_loc: 24 to 0+001c + DW_CFA_def_cfa_register: r7 \(rsp\) + DW_CFA_restore: r6 \(rbp\) + DW_CFA_def_cfa_offset: 8 + DW_CFA_nop + +#pass diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-sub-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-sub-2.l new file mode 100644 index 00000000000..0e094077edd --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-sub-2.l @@ -0,0 +1,2 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores some user-specified CFI directives diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-sub-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-sub-2.s new file mode 100644 index 00000000000..2435c4d5c1a --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-sub-2.s @@ -0,0 +1,29 @@ +# Testcase for sub reg, reg instruction. + .text + .globl foo + .type foo, @function +foo: + .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + movq %rsp, %rbp + .cfi_def_cfa_register 6 + subq %rax, %rsp +# SCFI: Stack-pointer manipulation after switching +# to RBP based tracking is OK. + addq %rax, %rsp +# Other kind of sub instructions should not error out in the +# x86_64 -> ginsn translator + subq (%r12), %rax + subq $1,(%rdi) + subq %rax, 40(%r12) + subl %edx, -32(%rsp) + leave + .cfi_def_cfa_register 7 + .cfi_restore 6 + .cfi_def_cfa_offset 8 + ret + .cfi_endproc +.LFE0: + .size foo, .-foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-1.l new file mode 100644 index 00000000000..c856c08c2ae --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-1.l @@ -0,0 +1,2 @@ +Assembler messages: +Fatal error: Synthesizing CFI is not supported for this ABI diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-1.s new file mode 100644 index 00000000000..87d2a4971a1 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-1.s @@ -0,0 +1,10 @@ +# Testcase run with --m32 (Not supported). + .text + .globl foo + .type foo, @function +foo: + pushq %rbp + ret +.LFE0: + .size foo, .-foo + diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-2.l b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-2.l new file mode 100644 index 00000000000..69c71fb9d7e --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-2.l @@ -0,0 +1,3 @@ +.*Assembler messages: +.*8: Error: SCFI: unsupported stack manipulation pattern +.*13: Warning: SCFI: forward pass failed for func 'foo' diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-2.s b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-2.s new file mode 100644 index 00000000000..22e9d88ea58 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-2.s @@ -0,0 +1,14 @@ + .text + .globl foo + .type foo, @function +foo: + addq %rdx, %rax +# Stack manipulation without switching to RBP +# based tracking is not supported for SCFI. + addq %rax, %rsp + push %rdi + leave + ret +.LFE0: + .size foo, .-foo + diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-3.l b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-3.l new file mode 100644 index 00000000000..69c71fb9d7e --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-3.l @@ -0,0 +1,3 @@ +.*Assembler messages: +.*8: Error: SCFI: unsupported stack manipulation pattern +.*13: Warning: SCFI: forward pass failed for func 'foo' diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-3.s b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-3.s new file mode 100644 index 00000000000..c515171f2b5 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-3.s @@ -0,0 +1,14 @@ + .text + .globl foo + .type foo, @function +foo: + addq %rdx, %rax +# Stack manipulation without switching to RBP +# based tracking is not supported for SCFI. + movq %rax, %rsp + push %rdi + leave + ret +.LFE0: + .size foo, .-foo + diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-4.l b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-4.l new file mode 100644 index 00000000000..c30d2057ddb --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-4.l @@ -0,0 +1,4 @@ +.*Assembler messages: +.*6: Warning: --scfi=all ignores some user-specified CFI directives +.*14: Error: SCFI: unsupported stack manipulation pattern +.*22: Warning: SCFI: forward pass failed for func 'foo' diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-4.s b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-4.s new file mode 100644 index 00000000000..51ff92b7e50 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-4.s @@ -0,0 +1,23 @@ + .type foo, @function +foo: +.LFB16: +# .cfi_startproc + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset 6, -16 + movq %rsp, %rbp +# The following stack manipulation is OK to do, as CFA tracking +# REG_FP based. + movq %rax, %rsp +# But...not quite, if there is a follow up usage of stack +# like a register save of a callee-saved register. + push %rbx + mov %rbp, %rsp + popq %rbp + .cfi_def_cfa 7, 8 + .cfi_restore 6 + ret +# .cfi_endproc +.LFE16: + .size foo, .-foo + diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-1.l new file mode 100644 index 00000000000..ac0d49388d6 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-1.l @@ -0,0 +1,3 @@ +.*Assembler messages: +.*50: Warning: --scfi=all ignores some user-specified CFI directives +.*52: Warning: Untraceable control flow for func 'foo'; Skipping SCFI diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-1.s new file mode 100644 index 00000000000..7d241f880d7 --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-cfg-1.s @@ -0,0 +1,53 @@ +# Testcase with an indirect jump +# Indirect jumps, when present, make the list of ginsn an invalid +# candidate for CFG creation. Hence, no SCFI can be generated either. +# +# The testcase is rather long to showcase a simple concept. The reason of +# such a long testcase is to discuss if it is important to deal with these +# patterns. It may be possible to deal with this, if we allow some special +# directives for helping the assembler with the indirect jump (jump table). + .text + .globl foo + .type foo, @function +foo: + pushq %rbp + movq %rsp, %rbp + movl %edi, -4(%rbp) + cmpl $5, -4(%rbp) + ja .L2 + movl -4(%rbp), %eax + movq .L4(,%rax,8), %rax + jmp *%rax +.L4: + .quad .L9 + .quad .L8 + .quad .L7 + .quad .L6 + .quad .L5 + .quad .L3 +.L9: + movl $43, %eax + jmp .L1 +.L8: + movl $42, %eax + jmp .L1 +.L7: + movl $45, %eax + jmp .L1 +.L6: + movl $47, %eax + jmp .L1 +.L5: + movl $37, %eax + jmp .L1 +.L3: + movl $63, %eax + jmp .L1 +.L2: +.L1: + popq %rbp + ret + .cfi_endproc +.LFE0: + .size foo, .-foo + diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-drap-1.l b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-drap-1.l new file mode 100644 index 00000000000..c4e48ced26e --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-drap-1.l @@ -0,0 +1,4 @@ +.*Assembler messages: +.*16: Warning: --scfi=all ignores some user-specified CFI directives +.*19: Error: SCFI: unsupported stack manipulation pattern +.*75: Warning: SCFI: forward pass failed for func 'drap_foo' diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-drap-1.s b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-drap-1.s new file mode 100644 index 00000000000..c23828b8f9b --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-unsupported-drap-1.s @@ -0,0 +1,75 @@ +# Testcase with Dynamically Realigned Argument Pointer (DRAP) +# register usage. +# +# There are two reasons why this cannot be supported with the current +# SCFI machinery +# 1. Not allowed: REG_CFA is r10 based for the few insns after +# 'leaq 8(%rsp), %r10'. +# 2. Untraceable stack size after 'andq $-16, %rsp' +# Both of these shortcomings may be worked out. FIXME DISCUSS Keep the rather +# long testcase until then. + .text + .globl drap_foo + .type drap_foo, @function +drap_foo: +.LFB0: + .cfi_startproc + leaq 8(%rsp), %r10 + .cfi_def_cfa 10, 0 + andq $-16, %rsp + pushq -8(%r10) + .cfi_def_cfa 7, 8 + pushq %rbp + .cfi_offset 6, -16 + movq %rsp, %rbp + .cfi_def_cfa_register 6 + pushq %r15 + pushq %r14 + pushq %r13 + pushq %r12 + pushq %r10 + .cfi_offset 15, -24 + .cfi_offset 14, -32 + .cfi_offset 13, -40 + .cfi_offset 12, -48 + pushq %rbx + .cfi_offset 3, -64 + subq $32, %rsp + movq $0, (%rdx) + cmpq $0, (%rdi) + movq $0, -56(%rbp) + je .L21 + movq %rdi, %rbx + movq %rsi, %rdi + movq %rsi, %r12 + call func2@PLT + movq (%rbx), %rdi + leaq -56(%rbp), %rdx + movslq %eax, %rsi + call func1@PLT + testl %eax, %eax + je .L21 + movq -56(%rbp), %r13 +.L21: + addq $32, %rsp + xorl %eax, %eax + popq %rbx + .cfi_restore 3 + popq %r10 + popq %r12 + .cfi_restore 12 + popq %r13 + .cfi_restore 13 + popq %r14 + .cfi_restore 14 + popq %r15 + .cfi_restore 15 + popq %rbp + .cfi_restore 6 + .cfi_def_cfa_register 7 + .cfi_def_cfa_offset 8 + leaq -8(%r10), %rsp + ret + .cfi_endproc +.LFE0: + .size drap_foo, .-drap_foo diff --git a/gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp b/gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp new file mode 100644 index 00000000000..ff8f163f18e --- /dev/null +++ b/gas/testsuite/gas/scfi/x86_64/scfi-x86-64.exp @@ -0,0 +1,103 @@ +# Copyright (C) 2022-2023 Free Software Foundation, Inc. + +# This program 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 of the License, or +# (at your option) any later version. +# +# This program 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 this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + +if { ![is_elf_format] } then { + return +} + +# common tests +if { ([istarget "x86_64-*-*"]) } then { + + global ASFLAGS + set old_ASFLAGS "$ASFLAGS" + + run_dump_test "scfi-cfi-label-1" + run_list_test "scfi-cfi-label-1" "--scfi --warn" + + run_list_test "scfi-diag-1" "--scfi" + run_list_test "scfi-fp-diag-2" "--scfi" + run_list_test "scfi-diag-2" "--scfi" + + run_list_test "scfi-unsupported-1" "--32 --scfi" + run_list_test "scfi-unsupported-2" "--scfi" + run_list_test "scfi-unsupported-3" "--scfi" + run_list_test "scfi-unsupported-4" "--scfi" + run_list_test "scfi-unsupported-drap-1" "--scfi" + run_list_test "scfi-unsupported-cfg-1" "--scfi" + + run_dump_test "scfi-add-1" + run_list_test "scfi-add-1" "--scfi --warn" + run_dump_test "scfi-add-2" + run_list_test "scfi-add-2" "--scfi --warn" + run_dump_test "scfi-cfg-1" + run_list_test "scfi-cfg-1" "--scfi --warn" + run_dump_test "scfi-cfg-2" + run_list_test "scfi-cfg-2" "--scfi --warn" + run_dump_test "scfi-asm-marker-1" + run_list_test "scfi-asm-marker-1" "--scfi --warn" + run_dump_test "scfi-asm-marker-2" + run_list_test "scfi-asm-marker-2" "--scfi --warn" + run_dump_test "scfi-asm-marker-3" + run_list_test "scfi-asm-marker-3" "--scfi --warn" + run_dump_test "scfi-pushsection-1" + run_list_test "scfi-pushsection-1" "--scfi --warn" + run_dump_test "scfi-pushsection-2" + run_list_test "scfi-pushsection-2" "--scfi --warn" + + run_dump_test "scfi-cofi-1" + run_list_test "scfi-cofi-1" "--scfi --warn" + run_dump_test "scfi-sub-1" + run_list_test "scfi-sub-1" "--scfi --warn" + run_dump_test "scfi-sub-2" + run_list_test "scfi-sub-2" "--scfi --warn" + run_dump_test "scfi-ignore-1" + run_list_test "scfi-ignore-1" "--scfi --warn" + run_dump_test "scfi-simple-1" + run_list_test "scfi-simple-1" "--scfi --warn" + run_dump_test "scfi-simple-2" + run_list_test "scfi-simple-2" "--scfi --warn" + run_dump_test "scfi-pushq-1" + run_list_test "scfi-pushq-1" "--scfi --warn" + run_dump_test "scfi-lea-1" + run_list_test "scfi-lea-1" "--scfi --warn" + run_dump_test "scfi-leave-1" + run_list_test "scfi-leave-1" "--scfi --warn" + run_dump_test "scfi-bp-sp-1" + run_list_test "scfi-bp-sp-1" "--scfi --warn" + run_dump_test "scfi-bp-sp-2" + run_list_test "scfi-bp-sp-2" "--scfi --warn" + run_dump_test "scfi-cfg-1" + run_list_test "scfi-cfg-1" "--scfi --warn" + run_dump_test "scfi-callee-saved-2" + run_list_test "scfi-callee-saved-2" "--scfi --warn" + run_dump_test "scfi-callee-saved-3" + run_list_test "scfi-callee-saved-3" "--scfi --warn" + run_dump_test "scfi-callee-saved-4" + run_list_test "scfi-callee-saved-4" "--scfi --warn" + run_dump_test "scfi-dyn-stack-1" + run_list_test "scfi-dyn-stack-1" "--scfi --warn" + run_dump_test "scfi-indirect-mov-1" + run_list_test "scfi-indirect-mov-1" "--scfi --warn" + run_dump_test "scfi-indirect-mov-2" + run_list_test "scfi-indirect-mov-2" "--scfi --warn" + run_dump_test "scfi-indirect-mov-3" + run_list_test "scfi-indirect-mov-3" "--scfi --warn" + run_dump_test "scfi-indirect-mov-4" + run_list_test "scfi-indirect-mov-4" "--scfi --warn" + run_dump_test "scfi-selfalign-func-1" + run_list_test "scfi-selfalign-func-1" "--scfi --warn" +} + From patchwork Mon Oct 30 16:51:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 159815 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2355080vqb; Mon, 30 Oct 2023 09:53:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHosNpOv+hEdW4waJEbrhA3ckdS56EO2wdrJuzTANZax7nDtO4wq/mEA2mj+HEEQM4PzYYF X-Received: by 2002:a05:620a:24c7:b0:778:ba13:a69d with SMTP id m7-20020a05620a24c700b00778ba13a69dmr297518qkn.17.1698684803672; Mon, 30 Oct 2023 09:53:23 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1698684803; cv=pass; d=google.com; s=arc-20160816; b=IFzA42Mc8E44wKpMCu8SR54m3cRk1CSzXH6IHR/rkuMdMoAMJVLbv8gEh73GrUwnNX lyJ6n1Z16KxdYng+LWzLJqw5Uf4yloSBDR52h81WDoZwMRVIn9hGyYVjd+SPtFY6b4zy bGoEVYmfHhEz6aRvWa4qoR0bRtMnosngW52MB7FeTvGLhdgU2DP+876/HriDL7yBgJwa o7jtzGD4bO5jMLNIUY0650HMRveqkNu2/5/LP9RnBMSUXUak5i98M0jDRmCGMkGEwcRH rKRv706EZwYqvMyT1hsq5Eb9FEodzEY9Xt7pCR0rB1bbLmraSz76owD2yNvtPnZAu8E3 G4vg== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version :content-transfer-encoding:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-signature:arc-filter :dmarc-filter:delivered-to; bh=R+YUYUdlU/1gi/4AVaIsFG3+WQoKbLmmz9g5DoDviuw=; fh=Oh0rwXgL2pcS1FQHr6E1Hal1K7kVHmZXDthN47bNt4Q=; b=SzUXjckMo14jNDZiK6a6Ypere7lGRz+Wk5RFk+/vWPllJuKBUIIdXMoU2Sz8Ov4+pT AFRlS43w6KA7eGbYR+Hjz5SIU3CZ95+WKVVXGtm/vi/WRCBCMgoHv7rNqpEyzpUfMUbg GwCkKieRYeRcZDrZWpGjQqWr0wSFZ/YCMAhgrVQQFkD8Fv8ANrfBK8iho7ZfkDHLeqVC hPoQmPsyCC7NPbIa1e4o0VLgiglClguE1NFvgSGoZK91Qrk/c7WaN9y8oWlMQuvMS9U8 XU+PESQOQu0KRhU1oov0oZFjgtJ9l7KH7qUe6JZn3OB93Zr21s4rT5F8tJeS3ceofae4 2rgQ== ARC-Authentication-Results: i=3; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=yFGjt7My; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ZiGt+247; arc=pass (i=2); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id j2-20020a37c242000000b0076db4dfa8a9si5787759qkm.44.2023.10.30.09.53.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 09:53:23 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=yFGjt7My; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ZiGt+247; arc=pass (i=2); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (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 604DE3861820 for ; Mon, 30 Oct 2023 16:52:45 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 70D563875DD1 for ; Mon, 30 Oct 2023 16:52:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 70D563875DD1 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 70D563875DD1 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=1698684760; cv=pass; b=uZ7JKSN+fMzlh+AkxFDSzvxccaKGA0D6Yu3uBUcNZDwBILCZ/BNq1vw7ISSCMvgqPh8L+1+VOceri5ZUzmZdtOtH5Tz4owiOt7TADBXo6Yk15s28f/GjDHhbKZxK2S1jVJxi02AKuOtJxxJBx30WmB21/iVRDa/YsIxrTcESeKs= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1698684760; c=relaxed/simple; bh=MCddttGoQMzVX7rFe58jkBRen84V8vXStNKt/ZeNZH0=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=Y7QRNyjVxCg+g0tRL4RNMU2STvt/4yuri+zH4XZUqbPJNlFnmADKIM2Z+Z2S2R9XQ9reVYRam6UV8PcRKDq5DBd0nXVLu2FLP05E9dJvSh0IJw8s+77M/0R0oao97WRsCAJoTHqAHogPuSIVVQTh0T8UnZRbrHyeCU8jc/Xysm8= 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 39UDLTvl002743 for ; Mon, 30 Oct 2023 16:52:38 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=R+YUYUdlU/1gi/4AVaIsFG3+WQoKbLmmz9g5DoDviuw=; b=yFGjt7MyIX7Kmcfli37AJ4LBu0JEq15D9GJX+Bj5m1u6tl4//2/dfrvPkm2VAfX1n+xP isR83vBjUTA/IvUT40N7jEisgVaxG8mfcErxD7szf32544jWyT6Rb1IyBKDnIATgHJqs 1rFe3B1l08xdw7UvYfE9bBFINjDmW9lH5MbKo0bvVQ2TjbYqGjCPjOZAJ3TTf9GfyyxX EG5O7e91qQ10vyIB9CiLNHn9dbdOLJ084EFUx3n/MGD/SQWH/YMSglcC4xpFT4wIKnH8 Wb4gzHXK9SFdfaY/6UOnX/NUwYKVe1d2QoZ3Pda7nWTkfSy/bUY3sPzximji27fQftcR 4Q== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3u0tuub698-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 30 Oct 2023 16:52:38 +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 39UFaJIU022770 for ; Mon, 30 Oct 2023 16:52:36 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3u0rr4hhqj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 30 Oct 2023 16:52:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JaBShKMM1qra/Nwo20jjBbU05MNKd8DWjhvDJrB5F364QW/Y09VQhP/11vzrB2Q6UZK/0Tae06ZSjJ76aM/HlfwT2xGc2D++hEh6DOb6cT7K7PqpX4pc5W/RkmE7WCnCTqeaLhX90F5VnjiwsRt7p90n4bD8htAdNva3p7X+TBxu+HYgEDvel9c6PPM/kGWJHg1nMHGpWfj7vQNUJG7QRB3QWvxpkfLafRh1W+AF6G1F3lTqwzdzGoaBTbBoM/K2ca+JjblTy0M+8A90U3hdEZy0dFNB+5OsNztJShceVyg1uh3zzqDk80dhtd6BF3+4yn72w3UmHiI6HKvCC9/Jtw== 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=R+YUYUdlU/1gi/4AVaIsFG3+WQoKbLmmz9g5DoDviuw=; b=m1YvIAQiWt0F4ACYC74/4tmoCXCHWiwPuZL1h4WLZ89ucLdIS65G/84ZgQdIcIQmzL4Hs0GapLkKbJG/LJvTjsJjJPNQ2mOygNI/qw5clw3jgtPP0/MOLpELH3LbwkpbNme7nh4uu3agTJuXsIWZCqdkhQD+JvvuDKvh/gB6dZJthjaZUYJ81sa3h9tl6K0VYvOiHgqTTlqsUApfROoIZFO7mqHgXflBgW0pDiIpkXuZNWOJ5tHDrjUi0R5jprYcuXJKfb/BOBGDtgYfxjRbros229wCOsN1ROUyGjHVK9L6nXkgOHEyu8SC1KieB2gF5CbHmSwsinje6iUV10aN7A== 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=R+YUYUdlU/1gi/4AVaIsFG3+WQoKbLmmz9g5DoDviuw=; b=ZiGt+247gQCotEIjdUZdk8yqgWr8gVND47uKDOzWEIVby7U6PunsKxDkfWlz5C/NWTjgpeBO1B5Iy5wdQeRjy9LuT6J+EEpwt6Xf7rw9nDIL3ft0OD/1Y7vyMsjMHoBoqq/FU8QhA8PyiVezPbCXdzKdEI2ue5m9IY1RFO1ZQng= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by DM4PR10MB6253.namprd10.prod.outlook.com (2603:10b6:8:b7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Mon, 30 Oct 2023 16:52:35 +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; Mon, 30 Oct 2023 16:52:35 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH, V2 10/10] gas/NEWS: announce the new command line option Date: Mon, 30 Oct 2023 09:51:37 -0700 Message-ID: <20231030165137.2570939-11-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231030165137.2570939-1-indu.bhagat@oracle.com> References: <20231030165137.2570939-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR02CA0012.namprd02.prod.outlook.com (2603:10b6:303:16d::35) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|DM4PR10MB6253:EE_ X-MS-Office365-Filtering-Correlation-Id: 7d4c819c-699b-42f8-7403-08dbd9689dcb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qG7tGRjfJeHUO6cHukzwdTsxhchjvbsD8bj77e12EO45bHTEVysTclwS0F2j1ggO+gMr1RCuGR/VahwV24yD8GkOm9FhtQBbVUoj6llSOGzavC3xaeag4w0yw+8Q6397Ey+gnKzibYyQ/u6VD2EcxLKEx2GIgCPVeBsOc7CoGVG0c9KKw1ruj0LqeK9twcXhoRjDddjSPuo7cxjSn9Tm+/VMx724tJ5EPSfeHcqvDyH/yc4S9D3KXpuuET5qw7NUOeRWkpGYi4gTilIv+c8eJB0GUl25qaC0Yt6ydc6rK8H+jcOD4IEXqd6NIEEi2akxndwlC4jfITQrt1PIYQSKIie7MYn5JoktB2kFlbsZbJxK+HGgpQHDWpHGutToomjV4STMeCeOAVz41jJKJ5/M1IBA+OFD5WKsa3jx6QB0ZyTZBzVPAM17SWg6VWfrZFtCMiAWaWnNVkw+CblS/7nkoNBZWeBqm4otesxlmBzmRn0ficN8ayT1LGxFuDLXufub8B2ASWbwxMsf0wVwf4HUygHrCAFc4qVpJ4RsDzUJl0zx229oEvVPMzodtL4RFkUV 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)(346002)(376002)(39860400002)(396003)(366004)(136003)(230922051799003)(1800799009)(186009)(64100799003)(451199024)(36756003)(2616005)(6512007)(6506007)(66556008)(316002)(6486002)(66476007)(478600001)(66946007)(107886003)(1076003)(38100700002)(86362001)(8936002)(41300700001)(2906002)(4326008)(8676002)(4744005)(6916009)(44832011)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QvvGU6w0SOcUBynt2D5hz4V4hdqZ9z2WwzsGw8Iv7xm9eh+UP5cIRLfDGr7yRi6Lz8fjRKztc26U4wmBMtFqWCJDb4V/MUxPLnF/gGSkl4dFF9WQnmUp7EkeFk6l5vPAcQmnRARMmTjz8diNmtvFXSEQZldOyRCP3GNL8FIsficxYrnNjWIIXcqlD4M1UHIo5YBLTFfT+ZfQ5Qs9/ZhzdzJ0l3dcwvNdkMzBVOroKkHmGgfkLsfyMDU2cGAvaoCra0uF4rCfc/i+iBfTol/OiT6TKZDF9YrTCH8/I5RtshbOzAB/4vJNrc7+h+ArkouaAFXR/Hjf/aK0Bo0o7odVOEVNUMsmOUsJZHycYs0CcNaAl6Vav5XxQ3KQRgWoLsbTb1sv4UTpQKzl3hW97J6zNOjMpLxWW3vbEUs1OdCh+7KBUMHf4qVBnh1UGWmNT/9w97KNuqwc32Gc8qqdbgShZS7cum+Rnry9djb/jrTQsT846DkGDO+mCG5vQyU0dBozPDQuya7JeY7ZlHFU04P3yaveM9sU4aYLpvCgep+eE/+E96c6lOA9jDqKMRN6Y8oOICyh2sDQaWixFAWJUZVoKin9kmBmvDL039Xq/IpVeLmI/EtBK1k0sMBJ8ykEXnvpiYXIZeeCuheolcmeCVHvNuaFRW+xxIsMvKJvMLDFFkgayKh//Aky/0xBrZQ9n5ihjMVrMWQh27VHwOwnl6yHvzkKAu+1daaGBy+Vf7AnuJqNCgnC45WDyLogPIqJMynT6B5kuWoT5zOgKKXeEYW3leG44gqpXfTCuWe1i1NErYje4WRqN0uAG7vYdWCUjDihOVupWJZENB/a+OKDto7uTRiYvTXxZ/y8KSNW4ECbPKpJaitd28Ujfc5UzwVaqAAKIkTw+Sup6WwPLxwKvp9VvDV52jL1pn7mxlKYyU0I6ZH75NchEc6DZoQWpYRINAUhPcPjNxJ8JAQjcfMRN6Wg32jce3aduCLEqOsPUbYba9GYx0oKGpnRK4JdD/ANpjJ8stfhvxZKszbTrFRK0GA0ihq1v3N2RoUKOlmjpbc12ICG/qexzl6QJMbgyW94a9dSn8cNSpqx40JvAZY4fMp/SKBw1SnuSUrzDK9S00EeDKKUCFKJxHdWl2Qpxg5muewRG4ranodaU9OYbe4nV5Hh+0VcOz51Mlmw0yVu3Tsxr5DKY5d7KQgmjgUzxOvdQtnrzpcDER85BA6/9/tl6ZQX7VFnH1bRNu3GXyI8o5atNy567eY1zLthavZcxKRwA7h2NQHhoYMu2o04mUNfEOosbX8gtn/ql24Q6J2TY0yce5upo7U4dGVjFB8sJCA8nhGHQQoI/iDVzSCx33JLw6nfMSjr9ae/SKH2wG7e/Dr+uL10RY3lUD95xNqAMLUm2Udg0szMchp3eeYgLFdaP0XnfW5l/w19JzqpM9HIuitPPYL7sla8Pa5T0TklxwNVxUOHSWC93gTcc9vzusnBqGbgzmJIPZXQZAr+1GZQFlQ54S5dGsgBFJkcXAEMN/bX+t4Pj+KQytRAnPQYveJykVN4K/SXdwmBUx6e/TzYAno11qPEhAKlJ+Vb81lxjwaiJaUMEPqHnVmHxw9jLAF2YwxBnFMHnrryrTqYTC4L4fu1boI= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: AiDmOTRBO24b5cyomvVjIQ0NO+a7SuhLlYl5ioPFaDEkZv8L8QP+UlZOFMxfJV/lWKQESxlHqlwZKZrlK7gK2h6JPwqrpGHE8YPAw4QxcZVrBCm7Dbt8Y58IwHWiZTeFFjMa355qPjW2XvXYdxA0MW58IoGXmCVYJi1OlzqJjZVtVUITJ8V8Na+Ex3+r6mTvovrU3nHtUfXwn4ry0jiQ5mspjqncDa5j2ptL7Ge4wdKlMzu5VcDlEp5Fhox6DlbgzL/ghfPeOoCw5C+F3/lTg6y9M8ZPLf8o1yHQVXrF9Z4gTQ8PhrJwfPBu7JMq5DnXdMbmGFkTx7+Fe4K6Qj0hqj30zBCcRwwl6Ccv53Z3n3+a+WMX+Ud+3WuGKHYivCwewl1fh7MR3/58wMl7L4VTy8eA6QOBpQ40CujDKyrzvdH3+PNgZslfaS7niz9OdIOIG/h9S5Bh50DpGWwAnHoXEnM2YuwxomNgkNvwRYEJtal8CgAepp3jWUe5vy6euCE6haisiPSepg6jxe7W8JZUT3LGrhVV/PA/N5CxamW99MrQzsjlwpouRVvotBUhixtaRPgrQlhAEZp7Z20BV4WMT2AJDsQ+dtfIy659smCgcco3q48RtoVjrr7yNO/QysvnXoOp6O81mjDEWRJtp2+p2W/YvqCUBUFKAKiDvpWPOBgdTRmbFZ5oHsc7n4uFAZHnYC9WeY3crbRAaJ9DNSTl63ObZ1Uyzb8dfWkg6QEq/RyWuLHJfcCNiYufW1+dclzMnD9MFTcWfrlSPotoVyiaQA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d4c819c-699b-42f8-7403-08dbd9689dcb X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2023 16:52:35.2002 (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: Aknrl/j9ONRBWlWfg9zsgyd6IMmd2EivpWumFx9ijThVeCAexol0Bb6MK8DmnJICqZiA8UQ5ZqhUPBJaYjjiRA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6253 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-30_10,2023-10-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 malwarescore=0 mlxscore=0 mlxlogscore=905 adultscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310240000 definitions=main-2310300131 X-Proofpoint-GUID: y4_s3i_wtDVzerz3gxJPqcn0YLVuoKH1 X-Proofpoint-ORIG-GUID: y4_s3i_wtDVzerz3gxJPqcn0YLVuoKH1 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: 1781200116726443227 X-GMAIL-MSGID: 1781200116726443227 [New patch in the current patch set] --- gas/NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gas/NEWS b/gas/NEWS index 71a1269b893..eddec7fa2c2 100644 --- a/gas/NEWS +++ b/gas/NEWS @@ -1,4 +1,6 @@ -*- text -*- +* New command line option --scfi[=all,none] to synthesize CFI for hand-written + asm. * Add support for Intel AVX10.1.