From patchwork Mon Jun 14 10:34:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinath Parvathaneni X-Patchwork-Id: 1491627 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=2620:52:3:1:0:246e:9693:128c; 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=SaAzNsKW; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 4G3Sc16vkcz9sWw for ; Mon, 14 Jun 2021 20:38:57 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C16063954411 for ; Mon, 14 Jun 2021 10:38:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C16063954411 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1623667134; bh=R0cIrPkvEm08T2qKf/CPcT9/EBOmHVHh2p9Q5UCwH3M=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=SaAzNsKWCJo1zaBaeUwB+RZd3ALvZJDInBmkE33yvfq/QGJkmviEqgVun1YYGQ+JD oPy+FYKjOKO7UMUkXadTejMHqNXOe8vRGR2vaSciS0AIJ3vO81VdNX11irSs4qF3xP OXwUKLc078VL3oRpKmjCtPfA8QWIeQEfuVJfGKEQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2058.outbound.protection.outlook.com [40.107.21.58]) by sourceware.org (Postfix) with ESMTPS id 29A173893C5E for ; Mon, 14 Jun 2021 10:37:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 29A173893C5E Received: from AM6PR08CA0002.eurprd08.prod.outlook.com (2603:10a6:20b:b2::14) by AM6PR08MB4248.eurprd08.prod.outlook.com (2603:10a6:20b:b5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21; Mon, 14 Jun 2021 10:37:32 +0000 Received: from AM5EUR03FT024.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:b2:cafe::42) by AM6PR08CA0002.outlook.office365.com (2603:10a6:20b:b2::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.20 via Frontend Transport; Mon, 14 Jun 2021 10:37:32 +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 AM5EUR03FT024.mail.protection.outlook.com (10.152.16.175) 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:31 +0000 Received: ("Tessian outbound bf434e582664:v93"); Mon, 14 Jun 2021 10:37:31 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 331b33c0976d27ca X-CR-MTA-TID: 64aa7808 Received: from 791266526e8e.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 3F4304C1-9D54-48AE-B119-C86E12FAD59D.1; Mon, 14 Jun 2021 10:37:20 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 791266526e8e.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 14 Jun 2021 10:37:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xj3wGivZkKSun5pp81cjPBSnaAhrhDvlFZ0ynbSkALetXm3a1KudHEAv0EXn2pvssteyBUbEmzHJ/ccC33IO3mkYLeJn+wMdYxl8PZT/nplAC+a2NMU0NNk5hI5bWewpv/TJfvCRtRgf/gxkYkB/zYmrZ8LN3Iv9Nd//YHVnFooU57wEE5WuEVArNMu3IbbWik/RUuNu7mC1C/oBwGIaiV07N9ATrGpyJzjGFrDwT4ky2B0ZMJuHOe/aLxAtv0U8KwWI9jz5wYkU7SiMW1Fv00EU2xx7SU83KhQSeyfZ78EkBTPg6hiOxVpxmG7Z5fweFZS4mMl/TZGu26JLg6nJEw== 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=R0cIrPkvEm08T2qKf/CPcT9/EBOmHVHh2p9Q5UCwH3M=; b=V5p1I80b++p5OGWzqakCqXTVWGHXDz2Ns5vu5zpqKBJSI3UVh6MnT2BjasIP5ZetsdZn/Xs75nRTpWDOAZXUqOQ7/gHU3qTb7LyiZQydeS7KrgocEUwrAFL4xTleYX88VVoDrk1hANQHkOaS0w9Ep5Zn7UEUZn99UuEmVwOE0Lr9SCF5JNctjWMox9v7XLIF3rLdQZbl2dN4gifsJ5axcId/bf7rCYe1kdyvtrQKFyTR96xcSiaCnBU+aqHdXHN1kL9vjjJQFCSoXHPfLNsPVupc3G9dK7wSGze1a/4aohwrkc4nmTDhvva513od4tWG4ljTmiBF2pkZisXb7m/UJg== 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:17 +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:17 +0000 Date: Mon, 14 Jun 2021 11:34:35 +0100 To: gcc-patches@gcc.gnu.org Subject: [GCC-10 backport][PATCH] arm: Fix the mve multilib for the broken cmse support (pr99939). X-Originating-IP: [217.140.106.52] X-ClientProxiedBy: LO4P123CA0082.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:190::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 LO4P123CA0082.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:190::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:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f21a1d50-299d-4440-0666-08d92f206a40 X-MS-TrafficTypeDiagnostic: VI1PR08MB5486:|AM6PR08MB4248: 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: T5Rqg3Ws8ZrXN7++vUixPy5XPWImWZAfiXoWGwVXJ7goVQhPDoYRj5hkJ8rUyK8aSA8c73k2xn8RnrsjPs1bGL/2U1e6MZWrSdQXNsOmT0fuvzWf6XyzEnY/omp+h6ZJlzT8MOdDPekJ8KTgyBoGVwVOfVU3+JR3GpQDpW2Axrl3uFoKwRFtHJKJaiNmFppvmLa+4xyDQti4f3vFgqPPAtXqlEnfV2JIC/NxI+rK1EABI3crdKvqLjCJ5+Xk2F9V4QmBIFuICHzCsnWQM/eSmPtSi14ozP8tNdfjdvh5lQRnYU4E16qZcsPjZkXdshxcAgAWB3kFDaLP7N1Q4CeIrDC3ZVY1Sg9tFyBMrdoZ+Zgeu2rvO5scQn+mdQzS5y0zXlRT8/kzM2KrMUHPLRs87Zmo8EEg+s7Y6RSKeQj33joY0WE2ktbadWWtgPR0mIIplbIVo48Muazir9cgevnBJon6prgU0qOQumNrZ2jiqnsqEi9eQaobhS2TB7r/Jgs5jlaQOJt0PR+dd2lGXQgeZL5nS4nIyF4B/0iH2Blc0lg0J4P2OGK6R/rwtgBSbfun0QxcgxoPhlelExel0kedosPBofQJf1t5ePjwGuIgbmV6Lh74yXWx7X95zBbEVXzQR1/W6LxFWwyc+lcHRbmVChN99d4PTAh9XModxDFQpEc= 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: oiQ5s5Ipn35qpqc3Wd2Eg85xN54Ly3BzNXl0uGIN+myEiKV9FM07hk+4Q4vp3qnC+mNMKw3EwQ2a4ZTW6g44E+bQivM8q107eLFbPKJAEUMOI3w/4yhSQzgyKc4n/dZRgufFhHQbnlCS0EA+Tz5D4TA+GosfzRXMTdLtXNJQ/V1kwn9pzPqaecubmbBdXcVtBFE26X4EQwqJsZduZRMkm4Hmv6QIbiWS0LQffe9u37WZj/144DhTA4V7tdcnkhHSEI2oLeek7nEh7xgRilg4bs7VjKdw6WSqnxRKCmxOKMGcjzR/vLZ80dDPNNZgWbyOkZijTM+20ZUPxg3PpWaRVA9/fQ3HnEwAAngrMNDTLhQa6P+YS1P8GE6xBMyF/uKmro8DWxoi26gHDOQKbonL6iv3dGd25NxgvME10Yb6snV+yg35y5oytpTG+ZSPD2B2U0hRuApEaY3rxSmVH3s+u6Oy2J+EdwmI4uNib0DN/I1Mlb9aHvsvkfQRafwQNkIsVKQPYJP/09tB+fSUUjqrSB3KVvZNjHpI06f75eEgti3x8UxTm5mJfzI83toDeG+5Cm9TjvLkIFai0iiB1zQnHO9tbz/95aMp3G+Fq2Rst+Prk0KPQYMntOd0jqOd8hOF/5ZoJHBDc8FIyIY9pvDYWoFj5DF50/cpjBjwFvEYSGZx4QKFbVa6AC87Su6SlWmTjVxFEo6Yye0OiGwPqYpp2G9r8TMLANlZ+KqQPNqYLM2LX/6vFp+y/4mcmUveS8urwmoLgYl8NlUslu+8ZFMWgO+Uq05sG0VZnQ1j02UmTqBLV0RPUhWbnOEvKLeZw18O0BnHSpPnhmmUfqtigTPuEVqM59ZoOpEFzk6ulEBRC1f6y3a/wNafFK8ck2cYqUhFgLyKn5xV7U08zBRe8oUH2KpiX/sDjpCaY1MKhUlD1ORyvaw/zDqnjhtRaefhlRt5AhSQpyBHeHrYf428fP6zhyr1IVMdBCwQq+v5YQV+PgHN3fYXP/PqtMJTC1Rbnmhr6qcgJ3KlK3fIWAuabIy1rJnZg9adC2IDcN4FnoI62HsI74ArKd7AWolZeg1c0CY37uChhZBiDkJOQrFF8qknaET2r2Y0nAucvi0Lg55pud7bVZ08K/95sfNOXJqQoY5rcy6Bf3mftYMRVX/zygQMeK9Xvjj+n4pYlWI9phaMtmCLLNpH1bCIoFOON+HZUNPGkcPN7asV6uhfm02zE6NWTfgwkQEqRPb61ggIbR1LHm960Ab1DBpSdDfKGznbBrVOvq93Ilsw5KhG3IB/ZFLVANx1R0Wd7Kn04G/6Qe9EJ6mhd1JgBRRJZnPz5IZ9ySzG 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: AM5EUR03FT024.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 4cae770c-ccb9-4a17-d47f-08d92f206158 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pBRNk9ZWIvKZZ/7GfaZoJtEVHBu9zgWZoQqSUsdIgb5tA0Ssa42H4zk/e0vwZMN6oRmZAeyb9x6DhI6+Uh+2l4XrxMzvPhWsXp0eM6668/RF6DNNbamAOS0CrZjZB7+t8Ggy+fHnT//msnWDbkuMqCq4FOj+USk9zCAbGhA5nTI9DPwo6wl1BPivUs2WroDLOw01okeb054dQdwxU4Ud1b3bx4cWmv8X0pZ1dxF3FoILwIauZIcRBjEGiSttAtvHtS71qDOuE8DzqKg8FbHLm/IHDL/c8qmQrLcC2hiwHFrSLq1NNoalE+ibmxnwHqEn4CNurwt51Leli1jWbuol65gJnBCorTM+YP70rhotPZdEo0kT57/pi5LAyn18dAVMXEZAced1Mjw+kCOInjhV8ZT8K43SypE1UuKjR3abN8zSuMmJCqY3WnFb1FOclihW7xvIB8bgMzT1LE6OyzaLFUBzrfVqpLphoLfMz0NNX7/Ix0qh8JjC7wuwz9eQ8YsdGGzZd7tUt2D810+xoSdL54fwyGLWeHs/YYiJSwOXjhga/C5meTyB3jarZGp+ExsKeTHAgyysVrq499F2wOgg4TCSMYmvS2xDwDPz5PI/Nsbi2i8H0N6hNwbPh2ALmwxYLTqNgzdDExFIMQV1H/sYRP5Q5lTFqRBPFFXRmjYWIEM= 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)(346002)(39860400002)(136003)(396003)(376002)(36840700001)(46966006)(235185007)(33964004)(6916009)(81166007)(316002)(478600001)(26005)(86362001)(6512007)(6486002)(9686003)(2906002)(70586007)(44832011)(70206006)(66616009)(47076005)(52536014)(82310400003)(5660300002)(82740400003)(33656002)(956004)(16526019)(186003)(356005)(8676002)(6666004)(4326008)(8936002)(336012)(36860700001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2021 10:37:31.6916 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f21a1d50-299d-4440-0666-08d92f206a40 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: AM5EUR03FT024.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4248 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-10 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 5ba28692d6b8a919939404d0f0d97d490df472e9..b1954b8714d6badc7311992847492c8c123799e0 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 5ba28692d6b8a919939404d0f0d97d490df472e9..b1954b8714d6badc7311992847492c8c123799e0 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