From patchwork Mon Jun 14 10:34:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinath Parvathaneni X-Patchwork-Id: 1491626 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=uLXzGr4r; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G3SZr3Nzwz9sW6 for ; Mon, 14 Jun 2021 20:37:55 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A39C03953D14 for ; Mon, 14 Jun 2021 10:37:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A39C03953D14 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1623667072; bh=4O75R4wAU53jjnQJCVTZ7Tilx3+uZn+bQlTMFL3yjCQ=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=uLXzGr4rsJO6qAS/LAs68jsoY2ReYYe1ovtn2jobIIi4FLgehxqdlAOvNU7Z353+n DsK4E8RSxNresNs/188CONaZky4X1yQFRbcf0c6icEdIhvC16G50j4tTjIw9Tv9QyT RY3e3iDmk16g03Rhq5X98QshwydjQj8QcI7c1RAc= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80070.outbound.protection.outlook.com [40.107.8.70]) by sourceware.org (Postfix) with ESMTPS id 99715385802D for ; Mon, 14 Jun 2021 10:37:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 99715385802D Received: from AS8P251CA0026.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:2f2::17) by AM8PR08MB6417.eurprd08.prod.outlook.com (2603:10a6:20b:362::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.23; Mon, 14 Jun 2021 10:37:27 +0000 Received: from AM5EUR03FT043.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:2f2:cafe::27) by AS8P251CA0026.outlook.office365.com (2603:10a6:20b:2f2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend Transport; Mon, 14 Jun 2021 10:37:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; gcc.gnu.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;gcc.gnu.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT043.mail.protection.outlook.com (10.152.17.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend Transport; Mon, 14 Jun 2021 10:37:27 +0000 Received: ("Tessian outbound 6d1d235c0b46:v93"); Mon, 14 Jun 2021 10:37:26 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: e961a85c7edf66ce X-CR-MTA-TID: 64aa7808 Received: from b04c17a749b4.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 80EFCED7-1AE3-4BB6-B821-905A06AAD1C1.1; Mon, 14 Jun 2021 10:37:17 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b04c17a749b4.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 14 Jun 2021 10:37:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LeOBuvUg9QZYmjn1J2/193uCDRWNJPabUrqw8WAwNuOPhY7vPqaoKlUajzUAWKxsVBn/6F10eWJx7UslsDbhXMsmc7OelfJEOrMzg8zVbgb88EhXAw9e6YFUqkI+O75hLJ5A5rDZLqBtMznzk+T51frdZwBHDoDHPUva08A5owfwuPbZXD3sZ7ioKkI5lXIxA1EKo7VBrNfeCcwKCNf07uDpaEJYzAWk5KnEyMp4loVuelSWQq4+MhXR0XaetGjg8J2va2PQ5sWrD9JA2n+a1N2LijfkmFqjThPkiiRuRe+jt7iK92UBQsDltk34gHR5aDwuuq+OGX/bpdxEfKLjxg== 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-SenderADCheck; bh=4O75R4wAU53jjnQJCVTZ7Tilx3+uZn+bQlTMFL3yjCQ=; b=TDVkwUMBmvfBnQV+0gQ5Vxd0iWcGfAPeY81tyCvWMzBHX5FU3QKE8llGWNF/KnvzcsjYGtb1ag/kCedq0HSX/6wFMf/ZSOPSGpzeAZHj3/KER4rAEOWBJSXZMjoL9c/N2JoBDkii7Q2DK+28pM4wNFNU5Z5OhPZmTI3R3tNgVwhvYoPbLnaVDH6yPKT24blKhfjRFQlg3Jhkc2z4WIHK0ktea52yf/su8CvX4ckI/2XZB1TmBX5wsOvujy6RFmMFGdQo6so8f2z3YKhI7NP4/IRJAd6M1QY6ddSUxhe6K8HotDkecCjpWfI62DFV0V0Ew6kx8QiYL/strIkRQqgUUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: gcc.gnu.org; dkim=none (message not signed) header.d=none;gcc.gnu.org; dmarc=none action=none header.from=arm.com; Received: from VI1PR0802MB2368.eurprd08.prod.outlook.com (2603:10a6:800:9d::10) by VI1PR08MB5486.eurprd08.prod.outlook.com (2603:10a6:803:13b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.23; Mon, 14 Jun 2021 10:37:13 +0000 Received: from VI1PR0802MB2368.eurprd08.prod.outlook.com ([fe80::44e5:2f6b:2aa1:ff11]) by VI1PR0802MB2368.eurprd08.prod.outlook.com ([fe80::44e5:2f6b:2aa1:ff11%11]) with mapi id 15.20.4195.030; Mon, 14 Jun 2021 10:37:12 +0000 Date: Mon, 14 Jun 2021 11:34:34 +0100 To: gcc-patches@gcc.gnu.org Subject: [GCC-11 backport][PATCH] arm: Fix the mve multilib for the broken cmse support (pr99939). X-Originating-IP: [217.140.106.52] X-ClientProxiedBy: LO2P265CA0123.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9f::15) To VI1PR0802MB2368.eurprd08.prod.outlook.com (2603:10a6:800:9d::10) Message-ID: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from e120703-lin.cambridge.arm.com (217.140.106.52) by LO2P265CA0123.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend Transport; Mon, 14 Jun 2021 10:37:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6dea3461-4844-4010-4e50-08d92f2067a4 X-MS-TrafficTypeDiagnostic: VI1PR08MB5486:|AM8PR08MB6417: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:1850;OLM:1850; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: je6FLbM5St15hG1eRoeWA1aCmnoKDI40j+RouKA9bicDtuSkuA26R3q/swwqm2UG6VCoMGNAKA9UDaHMDeQKjxPviEeZUtnYiiMqcLlIB07YWH1c9t924z71Yl4YWWjCmh3EGqLaoZSZQxYwPY7JKW3ET9oKvo4LoF5WEEH0Z5Cdb+shg62iEVoRLMkOxfXClC2zydPGlRehaMAdhBXZ9lM7+Kl8Qu3BoF5B1aL1sjVA1f0+/ZQmk4DtkUfZs/s4bv5yH8fyhWBU4ig3FzGFJZ+8U9LygAth3yrTBglERfivv4Sts8MTKIdX8CI64KAlUZTAf4qGCsK22Rc6rtC5K1Nmyc+0DwM2oQ7jlDyaRVatkUxLbiSk+HCAsdzzCGWAcTIzgsQv/ApsKaLG9rvu1WNXa6yz+mvNEa2tnjdFP6BwWQgnjkBengRdNNwPFrc1O+33jlxWUuC5zkctQ95KpGZeE7i31OUBR3l7HWKip//XYJvCEAvLmA+jdRK60bc7PXRQx5yHB/7CCqohKg8QbLZDJZJtdjTi9H1wtYkVrSjOQLSXrm0KonRJ0OGsgHxUPES+9l76QZzTZpZvzzaRs4EQaYpFYIydEVY/OFTIVYuDjGwpxU0uIr3RYezsHEwNwZGywlFrtuCMgmUI7T3yKHUFwhJlCKihTPl+skhRb00= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR0802MB2368.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(346002)(39860400002)(376002)(366004)(396003)(38350700002)(6512007)(86362001)(44832011)(5660300002)(9686003)(33964004)(316002)(4326008)(52116002)(956004)(8936002)(6486002)(478600001)(38100700002)(2906002)(186003)(16526019)(66946007)(235185007)(66556008)(66616009)(66476007)(6666004)(52536014)(8676002)(6916009)(33656002)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ep0jWA4RKVSCckHtVBnyKrKOP4IXnVgIQMcrtDLyfXh6LIn2VAKprdmRWqza4eHSZQGF67fmR0acxP252itL8aXxYG/abmGONWpqywiN07V0cAfophasfrFV51hKRwXw0g7eDbSWTVjGyPyiCm2i3j/l+HRIVnNiQd4S83joU2Vd6tojZvq0SsZV7rANu4Z1LMI6fejBva9XePSJsNf4b+FDdW81oZTO/Vjzbi7BB3qlJLydTk5nv3I/wDYPCc1Gw5fmwUKCYMYAGWbVgbArHTmB2FS8zB5IMQJJ52/xTojQF4zzJnmui2T5XJuZr3w0XSE1ruJC22GIz/KkZPHW95Y6OX+5rSyb3As265EDpfMJu6sEn0mkUl2/lM/An03N+czarC+Zw4dVB+jDOB1rb9cbOTEJ2P6C+6VEYQL0N16vu4/BMInG3k0RAvlB07KU1ezjnEdQ/qYM9yCCKY5D2CPXFB6eAkz6blIVAnLv1TYQtWhaSDDbuiLpca7CHSLAczbR6Ro5yiJQ4YHq6gFK35IKpJ5e84SUEacPag6wF2ARtWNyIkB6c3m1znEfGWzDw1WZ83D8yyvyueFns5ibapH4m9aUSbc9z57cJSfQy9rZxMh6ZlJRfDOPK+LabpifK5EGJHg8JIfNCwDqUFeapL+A6X544Y5AAdvv03Wjo2nJGLYqq4JKCJDR0SVTsMlvJKg3O8WZa+K8ZZn7sjBdaW8q9ShYaM+a5HMrIUughtNEQML/3d6lT18XcFyPBK7oApOloXzoMhIssIPpmi8iF5aG5mYmrA9DVVOm74Tzhzw3Gy6vEioZCX5bc6zbsWVpSDTm+qCbOdNPx4xYt4niEkUESy3ceol9gWBUR0jqWgT5ko/UUQHb/E915EmBCNFPkA8svyeLbTHLcUeSn/rDGj0AyKJE6x/334ugSCTGd0XvBROXH9yZjNPorpTEOepRlYSyJKpiUKFHEqcf3tc2p7dkjBJFb7KIWm3EsLqvx0qPftUsJ+xc2l87LnF2KHGHFkWKw9bFt5P1CEdGh+s3oZuhUGtv2oBQds5Rkmz3/5Q5yQTIETG2j88Nc6nktGXUlPKrPtejWv7t9srg2/48hE+BC86eKzVndjc7lyugvzsCx4xG9KmGTWDHELgS/LMHo2Ln3EOCjf3JhoxgGnOFaw3/G4y5bdmwwxyiQOMf7LuNCKXq9lJsriDAc3iQ8Ha8bVA3I1jUj/V9QNWT4Vd9Fzl/gN7/edHi6XB7KHxvg+OTrGf+dKlrYNSNAYazwQlypGE6Jzj8I03jP2d8+bRRwlvC5TQTFr3hHa183iFlFIUakVi5QCHNWDPXmDLS2zw4 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB5486 Original-Authentication-Results: gcc.gnu.org; dkim=none (message not signed) header.d=none;gcc.gnu.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT043.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: fc21d089-148d-4d60-039e-08d92f205e27 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hb0gkjWKM4CWJ0RJyQPAs0/xFyHcUjenfwlnsu94TGsp9kQwm/j0yirhzFe9uthr6jXJWIJx/OiCJ7vC+SKYsmTyKjszjtiv2VlpN5yq122KJoGi+981ToPhKoPJs5hY3Ktrekkye/tkApmeqBiYzKMoPvMtN8/rsWYSLYQiVOiswxJ+86IdBpTBv7EarF5M2SbFPoGx/cRKqczDmEMJqSs1TUqa3d8GCrfsy0l6yGSsNSSNrT/AGHYkKozVRoV/3CHy3XHtoQEVZQzgoLnISGQ2c24O3dEbd0m1I1gcjgHPOjwLvSV3rj1JiVTVaztsbf0dtM7AnAFsH9N5ti7QwUB/zplafDYVd57e0et6LQQ9f/4pxEXpWp0MkEjyxpNzI/iu7MYHzh1BaFVRAsIXed97CJxRQ78wd4bNwZXP8rJnr6zhyfpWSN6kgSfAtHl/gpgG7vHd9iWNt7nTkAgCSDQzsCCgPxt6DKOTubm4hzrwSW8h4H5V85cYIEAPzAa2zhAo9Jd/gPg92jq6PrcL9bhuEO+cMgLLqOVyIpGSmD7IwPHdpHBPPZfNmXIKUftRZDoGfLlDtsOmzbBTdI5j9dwgdlDB1ONj78k+aftuH+E+htgPuwl20iNi/1xut96JrQsn2qJNJXZuQVrmCd7fFv8C+V9bfutZM1taLf9Qiyw= X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(376002)(346002)(136003)(39860400002)(396003)(36840700001)(46966006)(235185007)(9686003)(6512007)(33656002)(6486002)(82310400003)(26005)(356005)(2906002)(6666004)(16526019)(336012)(186003)(316002)(956004)(52536014)(478600001)(86362001)(4326008)(5660300002)(70586007)(44832011)(66616009)(81166007)(36860700001)(6916009)(8676002)(33964004)(82740400003)(70206006)(8936002)(47076005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2021 10:37:27.3156 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6dea3461-4844-4010-4e50-08d92f2067a4 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT043.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB6417 X-Spam-Status: No, score=-14.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_LOTSOFHASH, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Srinath Parvathaneni via Gcc-patches From: Srinath Parvathaneni Reply-To: Srinath Parvathaneni Cc: Richard.Earnshaw@arm.com Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi, The current CMSE support in the multilib build for "-march=armv8.1-m.main+mve -mfloat-abi=hard -mfpu=auto" is broken as specified in PR99939 and this patch fixes the issue. Regression tested on arm-none-eabi and found no regressions. This patch have cleanly applied, ok for the GCC-11 branch? Regards, Srinath. gcc/testsuite/ChangeLog: 2021-06-11 Srinath Parvathaneni PR target/99939 * gcc.target/arm/cmse/cmse-18.c: Add separate scan-assembler directives check for target is v8.1-m.main+mve or not before comparing the assembly output. * gcc.target/arm/cmse/cmse-20.c: New test. libgcc/ChangeLog: 2021-06-11 Srinath Parvathaneni PR target/99939 * config/arm/cmse_nonsecure_call.S: Add __ARM_FEATURE_MVE macro. * config/arm/t-arm: To link cmse.o and cmse_nonsecure_call.o on passing -mcmse option. (cherry picked from commit c5ed0148347beea1bd34795de146adddd2454c36) ############### Attachment also inlined for ease of reply ############### diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse-18.c b/gcc/testsuite/gcc.target/arm/cmse/cmse-18.c index e1ff09257b7900982f49117d4cfc16f3bd79d76c..db7d975a90ea4b3333d1810aea03949ec1e8837e 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/cmse-18.c +++ b/gcc/testsuite/gcc.target/arm/cmse/cmse-18.c @@ -8,4 +8,5 @@ void bar(f func, int a) func(a); } -/* { dg-final { scan-rtl-dump "call unspec\\\[\\\[r4:SI\\\]\\\]" "final" } } */ +/* { dg-final { scan-rtl-dump "call unspec\\\[\\\[r4:SI\\\]\\\]" "final" { target { ! arm_v8_1m_mve_ok } } } } */ +/* { dg-final { scan-rtl-dump "call unspec\\\[\\\[r\[0-7\]:SI\\\]\\\]" "final" { target { arm_v8_1m_mve_ok } } } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse-20.c b/gcc/testsuite/gcc.target/arm/cmse/cmse-20.c new file mode 100644 index 0000000000000000000000000000000000000000..08e89bff6378f1f96950fc40f3ab3946bd433773 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/cmse/cmse-20.c @@ -0,0 +1,28 @@ +/* This test is executed only if the execution engine supports CMSE instructions. */ +/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=0x00400000" } */ + +#include +#include +#include + +void __attribute__((cmse_nonsecure_entry)) +secure_fun (int a, int *p) +{ + void *b = cmse_check_address_range ((void *)p, a, 1); + + if (b == NULL) + __builtin_abort (); + printf("%d", *((int *)b)); +} + +int +main (void) +{ + int *ptr; + int size = 1; + ptr = (int *) calloc (1, sizeof(int *)); + *ptr = 1315852292; + secure_fun (size, ptr); + free (ptr); + return 0; +} diff --git a/libgcc/config/arm/cmse_nonsecure_call.S b/libgcc/config/arm/cmse_nonsecure_call.S index 146f3ed52e9c7e915e5dbd9b70624ec3bd7cd5b5..00830ade98ea650c328c709d5d308fbc96f7f21c 100644 --- a/libgcc/config/arm/cmse_nonsecure_call.S +++ b/libgcc/config/arm/cmse_nonsecure_call.S @@ -25,7 +25,7 @@ .syntax unified #ifdef __ARM_PCS_VFP -# if __ARM_FP & 0x8 +# if (__ARM_FP & 0x8) || (__ARM_FEATURE_MVE & 1) .fpu fpv5-d16 # else .fpu fpv4-sp-d16 @@ -59,7 +59,7 @@ vmov s24, s25, r5, r5 vmov s26, s27, r5, r5 vmov s28, s29, r5, r5 vmov s30, s31, r5, r5 -#elif __ARM_FP & 0x08 +#elif (__ARM_FP & 0x8) || (__ARM_FEATURE_MVE & 1) vmov.f64 d9, d8 vmov.f64 d10, d8 vmov.f64 d11, d8 diff --git a/libgcc/config/arm/t-arm b/libgcc/config/arm/t-arm index 3625a2590beec4e4e0e0881be9ad284c595c7190..c1553d4e5d80751b13dc2e9c9e36d5ebe82e5f8c 100644 --- a/libgcc/config/arm/t-arm +++ b/libgcc/config/arm/t-arm @@ -3,18 +3,17 @@ LIB1ASMFUNCS = _thumb1_case_sqi _thumb1_case_uqi _thumb1_case_shi \ _thumb1_case_uhi _thumb1_case_si _speculation_barrier HAVE_CMSE:=$(findstring __ARM_FEATURE_CMSE,$(shell $(gcc_compile_bare) -dM -E - /dev/null 2>/dev/null; echo $$?),0) CMSE_OPTS:=-mcmse endif ifdef HAVE_CMSE -ifndef HAVE_V81M + libgcc-objects += cmse.o cmse_nonsecure_call.o cmse.o: $(srcdir)/config/arm/cmse.c $(gcc_compile) -c $(CMSE_OPTS) $< + cmse_nonsecure_call.o: $(srcdir)/config/arm/cmse_nonsecure_call.S $(gcc_compile) -c $< endif -endif diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse-18.c b/gcc/testsuite/gcc.target/arm/cmse/cmse-18.c index e1ff09257b7900982f49117d4cfc16f3bd79d76c..db7d975a90ea4b3333d1810aea03949ec1e8837e 100644 --- a/gcc/testsuite/gcc.target/arm/cmse/cmse-18.c +++ b/gcc/testsuite/gcc.target/arm/cmse/cmse-18.c @@ -8,4 +8,5 @@ void bar(f func, int a) func(a); } -/* { dg-final { scan-rtl-dump "call unspec\\\[\\\[r4:SI\\\]\\\]" "final" } } */ +/* { dg-final { scan-rtl-dump "call unspec\\\[\\\[r4:SI\\\]\\\]" "final" { target { ! arm_v8_1m_mve_ok } } } } */ +/* { dg-final { scan-rtl-dump "call unspec\\\[\\\[r\[0-7\]:SI\\\]\\\]" "final" { target { arm_v8_1m_mve_ok } } } } */ diff --git a/gcc/testsuite/gcc.target/arm/cmse/cmse-20.c b/gcc/testsuite/gcc.target/arm/cmse/cmse-20.c new file mode 100644 index 0000000000000000000000000000000000000000..08e89bff6378f1f96950fc40f3ab3946bd433773 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/cmse/cmse-20.c @@ -0,0 +1,28 @@ +/* This test is executed only if the execution engine supports CMSE instructions. */ +/* { dg-options "--save-temps -mcmse -Wl,--section-start,.gnu.sgstubs=0x00400000" } */ + +#include +#include +#include + +void __attribute__((cmse_nonsecure_entry)) +secure_fun (int a, int *p) +{ + void *b = cmse_check_address_range ((void *)p, a, 1); + + if (b == NULL) + __builtin_abort (); + printf("%d", *((int *)b)); +} + +int +main (void) +{ + int *ptr; + int size = 1; + ptr = (int *) calloc (1, sizeof(int *)); + *ptr = 1315852292; + secure_fun (size, ptr); + free (ptr); + return 0; +} diff --git a/libgcc/config/arm/cmse_nonsecure_call.S b/libgcc/config/arm/cmse_nonsecure_call.S index 146f3ed52e9c7e915e5dbd9b70624ec3bd7cd5b5..00830ade98ea650c328c709d5d308fbc96f7f21c 100644 --- a/libgcc/config/arm/cmse_nonsecure_call.S +++ b/libgcc/config/arm/cmse_nonsecure_call.S @@ -25,7 +25,7 @@ .syntax unified #ifdef __ARM_PCS_VFP -# if __ARM_FP & 0x8 +# if (__ARM_FP & 0x8) || (__ARM_FEATURE_MVE & 1) .fpu fpv5-d16 # else .fpu fpv4-sp-d16 @@ -59,7 +59,7 @@ vmov s24, s25, r5, r5 vmov s26, s27, r5, r5 vmov s28, s29, r5, r5 vmov s30, s31, r5, r5 -#elif __ARM_FP & 0x08 +#elif (__ARM_FP & 0x8) || (__ARM_FEATURE_MVE & 1) vmov.f64 d9, d8 vmov.f64 d10, d8 vmov.f64 d11, d8 diff --git a/libgcc/config/arm/t-arm b/libgcc/config/arm/t-arm index 3625a2590beec4e4e0e0881be9ad284c595c7190..c1553d4e5d80751b13dc2e9c9e36d5ebe82e5f8c 100644 --- a/libgcc/config/arm/t-arm +++ b/libgcc/config/arm/t-arm @@ -3,18 +3,17 @@ LIB1ASMFUNCS = _thumb1_case_sqi _thumb1_case_uqi _thumb1_case_shi \ _thumb1_case_uhi _thumb1_case_si _speculation_barrier HAVE_CMSE:=$(findstring __ARM_FEATURE_CMSE,$(shell $(gcc_compile_bare) -dM -E - /dev/null 2>/dev/null; echo $$?),0) CMSE_OPTS:=-mcmse endif ifdef HAVE_CMSE -ifndef HAVE_V81M + libgcc-objects += cmse.o cmse_nonsecure_call.o cmse.o: $(srcdir)/config/arm/cmse.c $(gcc_compile) -c $(CMSE_OPTS) $< + cmse_nonsecure_call.o: $(srcdir)/config/arm/cmse_nonsecure_call.S $(gcc_compile) -c $< endif -endif