From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70089.outbound.protection.outlook.com [40.107.7.89]) by sourceware.org (Postfix) with ESMTPS id 4B2B2385AE52 for ; Tue, 5 Jul 2022 13:58:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4B2B2385AE52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=UA9OCK2hMk29Yv7q8ykLfhtkP3I0jY3PoYSJJZmD6nQCoFYyq8j7n4bYdwAhL2TlurPZgVIoErUrpqliAhx0n/a/AApRwajzUJDDBRkBCaF6MfP8OBg3CDBg5EJfYNzMMunKb5qofpwclQN4SZcfnDksbyNi92oZV/M02WQxEYDotV1G1U8NBRfQyHQ2GgB3EGA3Ehf9cfTSjYCTkbBxg9ptiytO51lokmvkWBd0lObPO+BN0Fxon9av7emdxIBTYy/lHsHTdxTI5pm2h2og++B9fnCKG+EtYhLv2p6eH/CvFL/anXQQpd05q3okIBYNU2S4jJ6/X427+ovMFCX7eQ== ARC-Message-Signature: i=2; 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=Xua9rxYU4e468o/O7J9/FBkgJyYTsekkImmcaXWtlqw=; b=N7fVccgsq4oxBuWutYxduPgMgFeDxG4yZmYuWiemEWLct9BAWLfXfMntiv3AQ8I8pF89jnJLkgJWbz7Frw+fe+ryfQKfpB8BuHz2Gbu9samLaxuVfRTK5NUxSrZDtLD7C9O+HqIM9PaRBIuZ7qe/ULCeaeA4/tONDMutZlBGodpfHemOwuM5kd/7mKicEwcVQyUrRgZsvyouw7F0inEMNVRcPbDzXyn4HV+6dW9Zn6HPkJXTxqZp51YSHnvLOlqsUO9l/Fuc0RmHCFxiXE0VAJYfWtuxY5SHZlYUf7ZJWxfAPxAAE2VwMprfxIguBqfh/pA0e1+QJMV24ECxz/n5Tw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1, 1, smtp.mailfrom=arm.com] dmarc=[1, 1, header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Xua9rxYU4e468o/O7J9/FBkgJyYTsekkImmcaXWtlqw=; b=U/8spxr38Ss3+6EcM7f6WQQfD/ssZ5XY9tyoFcHTDgAzontKH3VSoLDAEdiaI1F3A1KNVF2qKOu491/EVsK/MDKyPcNwWlHYBDdfTrQS95o1574bTOoAqHrb1dq7iHTeYUJ7gUmk/q0uG6WXzcpptltB5czV9I9yAgt5FZZddpo= Received: from DB8PR06CA0049.eurprd06.prod.outlook.com (2603:10a6:10:120::23) by PA4PR08MB7571.eurprd08.prod.outlook.com (2603:10a6:102:270::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.21; Tue, 5 Jul 2022 13:58:44 +0000 Received: from DBAEUR03FT026.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:120:cafe::4e) by DB8PR06CA0049.outlook.office365.com (2603:10a6:10:120::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.14 via Frontend Transport; Tue, 5 Jul 2022 13:58:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;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; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT026.mail.protection.outlook.com (100.127.142.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.14 via Frontend Transport; Tue, 5 Jul 2022 13:58:44 +0000 Received: ("Tessian outbound 3c5325c30453:v121"); Tue, 05 Jul 2022 13:58:44 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 3ea631d5aa242d97 X-CR-MTA-TID: 64aa7808 Received: from 5ae322580735.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 88E80B87-D490-4E3D-97FD-A65A311C6E00.1; Tue, 05 Jul 2022 13:58:37 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5ae322580735.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 05 Jul 2022 13:58:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c5PU6DXRkGfSq4L5fk7clS6EbsnTDdnkZPMIQS6wNAzq10+0NqxmzpQ1ISaGVyj14fSUeNtVvrMLTsW2fQ8QlOszXWlR2L6mFWzFZakcbW9fa/1TEhZOxpSPRmdvQ0Yk8rTTPV86J/vswUZk7O6ZCfgVbLGI1BK7h0wk7W9uxBiVgkEzxEPWK2M/bAxT7xkCqHCQridQ9OasM4Y4RG4SnSDKu0tB013LMxrfNdr+8l9/ofK4v8lW4tT3THSxM1XFMPKxbmPAm87DdEsy3YUc+/sg8/5YwLdqnpWt5yUoGmVCyR8MKFWCjA73j0MJSlwfzk9XlyRv1L204iHWXSqhYg== 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=Xua9rxYU4e468o/O7J9/FBkgJyYTsekkImmcaXWtlqw=; b=MtbLm4Xju2vFWzVuRQvX683Ad6hB6p02AxZp0/bdnrfdd2egUfrMgiss0g2Aqh03ifW1QpaG9/2/UGTCSytAX8Gmk4FhYNQvqvZ5ezfAHxEeTkJ+eousb1mna5bRxGQxVPQszcdT7yiXSyvIA9rJIZDoysXWkFk5M0tL8rxhGxzNVzv9Zq72yYkHOVF6nGyA7DJOlOhFivQG2Ackl+PrnS2KBOq6YuTSl5SjFuI8yvWwZAv8SYhPF4iw0hk46pLqqCY/oTDJgPOEgtJv5shGHtmzM84hxukGK5gIsxd9Tbl+rDzrPMpejNSJxATS4JDo8qh3p4DrYJZM+7ymeQCOsA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Xua9rxYU4e468o/O7J9/FBkgJyYTsekkImmcaXWtlqw=; b=U/8spxr38Ss3+6EcM7f6WQQfD/ssZ5XY9tyoFcHTDgAzontKH3VSoLDAEdiaI1F3A1KNVF2qKOu491/EVsK/MDKyPcNwWlHYBDdfTrQS95o1574bTOoAqHrb1dq7iHTeYUJ7gUmk/q0uG6WXzcpptltB5czV9I9yAgt5FZZddpo= Received: from AM6PR10CA0032.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:89::45) by AM8PR08MB5777.eurprd08.prod.outlook.com (2603:10a6:20b:1c5::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.15; Tue, 5 Jul 2022 13:58:34 +0000 Received: from VE1EUR03FT009.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:89:cafe::b8) by AM6PR10CA0032.outlook.office365.com (2603:10a6:209:89::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.15 via Frontend Transport; Tue, 5 Jul 2022 13:58:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT009.mail.protection.outlook.com (10.152.18.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5395.14 via Frontend Transport; Tue, 5 Jul 2022 13:58:33 +0000 Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2507.9; Tue, 5 Jul 2022 13:58:25 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.9; Tue, 5 Jul 2022 13:58:24 +0000 Received: from e125768.cambridge.arm.com (10.2.78.50) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.9 via Frontend Transport; Tue, 5 Jul 2022 13:58:24 +0000 From: Victor Do Nascimento To: Subject: [PATCH 5/8] newlib: libc: memcpy M-profile PACBTI-enablement Date: Tue, 5 Jul 2022 14:58:15 +0100 Message-ID: <20220705135818.50088-6-victor.donascimento@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220705135818.50088-1-victor.donascimento@arm.com> References: <20220705135818.50088-1-victor.donascimento@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 320d604c-a7b6-4e62-2085-08da5e8e7999 X-MS-TrafficTypeDiagnostic: AM8PR08MB5777:EE_|DBAEUR03FT026:EE_|PA4PR08MB7571:EE_ x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: nF6lfYI4b+Sjnsw+esB3ig7p53hvXrzh2VKHJwffkZZYlU3BmMVO6dGLJ5gj6JST7uML/zCckNN15J1ZNQkfP9vOpHZaTaO7oDD/o1g9NOuRHzxNzM6RrOPV0pAyAg/9HhhKZhx8BPIc0RY88ZbPHezt7ECX34+1OYRE2PIgDjebwkgojXF0wBRcCrMMH5D90VIwSuTElENJpETYuRZlFDnhTtEURRiHtzk5bDJdlwxgQT4pddNy5Ac3dKv5+HrNXVAtwQIoerj+9RFSeQQ/kUhC/MrsfPKO2zlS8Oze3XcXla0LKxcKOW1CIGlZOB49eMzcYlBKFJmLXTfqfwn/UsBvB8FSZ/UMFmWVj/zUTOwMxGYkBFS6zoAMwfDhGfRYMD84VEasprAsAZcdEO3GV2vM7u9BEI9T6IabEaXzPyivYqBn37MxLmViSNDeS0Y2xuQVFZTMK+vCf8HxF1nazobvJlwyhTarZkFd+02kdZNAlErAsVaal/iDJfSuFU7G3pISE6Q0N1m0VNrPg9UbH2EdGd2jCCQBtELseInkYx8Ft2EeCpF088+W5+TfW17XNJYA7OtELMCDCsMKXuhkehI+R07WyoonbLRozMvU1aM7B95Np8qW0Y2dbDj9Cy/rHcsrlPHnjk93M/N7c6E28lv9tvw2UXYDZcHceibePdLeCVTcEiIjwLf0PLAQkwlvw+t0qT2ZjNLOS4nAAmcy5kXCdlTQAmbYRWJrp0duqMiR7G7GDI9q+aD6kcDCAGUdyVmebQAm0Lx2L1jN147q98KcTYf/4wUzGbzLKnaH/yOpponGtvn095QLtn8o8kcfVvjD3SR+4Ok45jdNHQ6CWVnBqK7N67WsvXak3rNG/h8= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230016)(4636009)(376002)(136003)(346002)(39860400002)(396003)(40470700004)(46966006)(36840700001)(36860700001)(86362001)(81166007)(82740400003)(356005)(40460700003)(70586007)(70206006)(8676002)(6916009)(316002)(40480700001)(2906002)(4326008)(8936002)(5660300002)(2616005)(1076003)(186003)(83380400001)(426003)(336012)(47076005)(478600001)(82310400005)(26005)(7696005)(36756003)(6666004)(41300700001)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB5777 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT026.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: e319d624-5883-49ca-fe64-08da5e8e735d X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ok2FZTxO81fdqr8jIWZ02WGSMMA8b7PexN7wx/AqOffXEdjWu3UYJR/Q/btmuoACKrUA4lw+FGp4Vc6+r04NHUsHxv/h8kbHmEXLImgEG5iaPqCB8A8SYsn4HUNdbO0X/KCspJ3V2ME7TboHvFSrbQHYHG8jBZE3iXYFEOrjWz08Lnv8QLBCg8W/QxqV7tzLvw4txEcsR2S0ZYvvI5S4xp9trKwC0ljhzn7QDU376XebuBGLI+5VtD/8gAfq9hxd3afipl4mRB2A8TKIEMyOrvpiofEuBts8Mtqb2u93iIV9SRO+5MJRTB62xcLj85oIu01Zi69USbg08yK3rTS7UIXnirOL0sjWubUzZ3/2v6zlefO2NCIqZiF/Qct+It7xMIvs/6v7/Qagr+9of5sXfKt+jmBcLZGCnCsG6LRneCt5ZNa6GfIgv6iMhqpI5Ei5ARaWhDUyBXvrBfI865JF6jNfKEein2hqeAacm1n73Yn3ZMpeI2gI4CbYWu40rDswuPCvXQV4GZeBgevLnEQOfKQx7SmeBgbA7piPe+oGOsmnWkXazy8SxjNgsiGsQ0/QgTlYxTzAFidr8YC/+z3a8EGJG8t7S9YPT8J5FTW8ZhH0cvbqTX+YArLhMznlVt/MKb4rufMORFCEJY7U7+alNc9fZh4+8QMlyeqpsgIKlR2xSq/hOI8WeblGcVSfV+5CUSDXu26q69O/z8LoUxREtPsGysTnomJGUTtQA6zTeL63mdw4q71UImlGPTPKpmRj8H3qREzaFZydN4WY/7sFQVFzE4LpfTsEIoOOc6ClBQhtwR5tyRASOGQJzkYXXr5t 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:(13230016)(4636009)(396003)(136003)(376002)(39860400002)(346002)(46966006)(40470700004)(36840700001)(83380400001)(47076005)(7696005)(36756003)(6666004)(426003)(336012)(478600001)(26005)(186003)(1076003)(2616005)(41300700001)(2906002)(86362001)(6916009)(82740400003)(4326008)(81166007)(36860700001)(40460700003)(316002)(70206006)(70586007)(8676002)(40480700001)(5660300002)(82310400005)(8936002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2022 13:58:44.4791 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 320d604c-a7b6-4e62-2085-08da5e8e7999 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: DBAEUR03FT026.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB7571 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY 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: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jul 2022 13:58:50 -0000 Add function prologue/epilogue to conditionally add BTI landing pads and/or PAC code generation & authentication instructions depending on compilation flags. --- newlib/libc/machine/arm/memcpy-armv7m.S | 73 ++++++++++++++++++++++--- 1 file changed, 65 insertions(+), 8 deletions(-) diff --git a/newlib/libc/machine/arm/memcpy-armv7m.S b/newlib/libc/machine/arm/memcpy-armv7m.S index c8bff36f6..cdcca7c9e 100644 --- a/newlib/libc/machine/arm/memcpy-armv7m.S +++ b/newlib/libc/machine/arm/memcpy-armv7m.S @@ -46,6 +46,8 @@ __OPT_BIG_BLOCK_SIZE: Size of big block in words. Default to 64. __OPT_MID_BLOCK_SIZE: Size of big block in words. Default to 16. */ +#include "pacbti.h" + #ifndef __OPT_BIG_BLOCK_SIZE #define __OPT_BIG_BLOCK_SIZE (4 * 16) #endif @@ -85,6 +87,8 @@ .global memcpy .thumb .thumb_func + .fnstart + .cfi_startproc .type memcpy, %function memcpy: @ r0: dst @@ -93,10 +97,30 @@ memcpy: #ifdef __ARM_FEATURE_UNALIGNED /* In case of UNALIGNED access supported, ip is not used in function body. */ + pacbti_prologue mov ip, r0 #else +#if __ARM_FEATURE_PAC_DEFAULT +#if __ARM_FEATURE_BTI_DEFAULT + pacbti ip, lr, sp +#else + pac ip, lr, sp +#endif /* __ARM_FEATURE_BTI_DEFAULT */ + push {r0, ip} + .save {r0, ra_auth_code} + .cfi_def_cfa_offset 8 + .cfi_offset 0, -8 + .cfi_offset 143, -4 +#else +#if __ARM_FEATURE_BTI_DEFAULT + bti +#endif /* __ARM_FEATURE_BTI_DEFAULT */ push {r0} -#endif + .save {r0} + .cfi_adjust_cfa_offset 4 + .cfi_offset 0, -4 +#endif /* __ARM_FEATURE_PAC_DEFAULT */ +#endif /* __ARM_FEATURE_UNALIGNED */ orr r3, r1, r0 ands r3, r3, #3 bne .Lmisaligned_copy @@ -135,13 +159,13 @@ memcpy: ldr r3, [r1], #4 str r3, [r0], #4 END_UNROLL -#else /* __ARM_ARCH_7M__ */ +#else ldr r3, [r1, \offset] str r3, [r0, \offset] END_UNROLL adds r0, __OPT_MID_BLOCK_SIZE adds r1, __OPT_MID_BLOCK_SIZE -#endif +#endif /* __ARM_ARCH_7M__ */ subs r2, __OPT_MID_BLOCK_SIZE bhs .Lmid_block_loop @@ -180,10 +204,21 @@ memcpy: .Ldone: #ifdef __ARM_FEATURE_UNALIGNED mov r0, ip + pacbti_epilogue +#else +#if __ARM_FEATURE_PAC_DEFAULT + pop {r0, ra_auth_code} + .cfi_restore 0 + .cfi_restore 143 + .cfi_def_cfa_offset 0 + aut ip, lr, sp #else pop {r0} -#endif - bx lr + .cfi_restore 0 + .cfi_def_cfa_offset 0 +#endif /* __ARM_FEATURE_PAC_DEFAULT */ + bx lr +#endif /* __ARM_FEATURE_UNALIGNED */ .align 2 .Lmisaligned_copy: @@ -247,6 +282,15 @@ memcpy: /* dst is aligned, but src isn't. Misaligned copy. */ push {r4, r5} + .save {r4, r5} + .cfi_adjust_cfa_offset 8 +#ifdef __ARM_FEATURE_PAC_DEFAULT /* we pushed just the pac code */ + .cfi_offset 4, -12 + .cfi_offset 5, -8 +#else /* we haven't pushed anything to stack */ + .cfi_offset 4, -8 + .cfi_offset 5, -4 +#endif /* __ARM_FEATURE_PAC_DEFAULT */ subs r2, #4 /* Backward r1 by misaligned bytes, to make r1 aligned. @@ -299,6 +343,7 @@ memcpy: adds r2, #4 subs r1, ip pop {r4, r5} + .cfi_adjust_cfa_offset -8 #endif /* __ARM_FEATURE_UNALIGNED */ @@ -321,9 +366,21 @@ memcpy: #ifdef __ARM_FEATURE_UNALIGNED mov r0, ip + pacbti_epilogue +#else +#if __ARM_FEATURE_PAC_DEFAULT + pop {r0, ra_auth_code} + .cfi_restore 0 + .cfi_restore 143 + .cfi_def_cfa_offset 0 + aut ip, lr, sp #else pop {r0} -#endif - bx lr - + .cfi_restore 0 + .cfi_def_cfa_offset 0 +#endif /* __ARM_FEATURE_PAC_DEFAULT */ + bx lr +#endif /* __ARM_FEATURE_UNALIGNED */ + .cfi_endproc + .fnend .size memcpy, .-memcpy -- 2.36.1