From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2085.outbound.protection.outlook.com [40.107.20.85]) by sourceware.org (Postfix) with ESMTPS id A58FB3853563 for ; Tue, 5 Jul 2022 13:58:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A58FB3853563 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=PtFHRrVE81fosQidWjN5JLAqyvFeGXYOOFn0VCrBUcYzmZt1UmrPVG5IuFerd0mVFU1+MQ4MkkU7pkYIxZqlfqHA4zF841pPqSh5DJcADf1anOrljlL6KwoaRecu18S7UPQ8N+rIugwuyLKRZKDZpnDn5sEdEb5BZ0asLYFobJ617M2S8N5S0iALdx/U3nbffZ8V7/HEn2wF9V0umt0S0n3vcSy7AAS57+Xgjq1+dJQnT6fetICT3omsk+w/afMaXFSTGskEs0hNYuf0q+Cj/W+WGHRRpCZ2Hk7ddczMqUM0rVmZiFEu5RITGUtkZyAghNKdGEjiYIsWXmbEe3awjA== 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=oDU6X3NN/OyDCZgJEVaqJh9qbXVFpSEN67k48O4c7ns=; b=AADjf61yBZI1YqgfjmwSfdIStgVs2/TikLomRcQm8gdvR6HkOCLqpapCX7/lWU9t8HiClb1od24hHjFxN7Jaz+lUJJvI8cVomN2rbGC3uwHFnez4be0MDEuD4J3Xe4L6HSwhD1WoCajjDlacYbHejGW7+XGfi7nk5FzAjTsyft+kCSdLI6BR8mWYnqnGO+AiPI4EITMP+gVNgZ/jZq9CtOY4q6gsjSj3kCdSSRxzQQbEgWMWlZJtzlqabjJl26ih9hUebjl9fihK91i9Ghlm2oMJ6+/y/3QL+eZIMyIZrjE6BsRNjOnoRdohEiSFxnWk938Zwc5IVGTMXrfaPcI5IQ== 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=oDU6X3NN/OyDCZgJEVaqJh9qbXVFpSEN67k48O4c7ns=; b=BRMw5wRiyR4Cn91odiVRgIJ2Inv903R4XdIcmqZzi808HxlSo0g2Dqp+bfUmHYokPOvQeUC7EbMP8aSScERuAyhqpf+gu0QCLLpDMHbtfJRbUZPDihglbC6kJSjU0Bukyz7PzXrTyQ59FE5LW/Hl3rtvmGi8NgKYAVJTdyLNhao= Received: from FR3P281CA0016.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1d::21) by DB6PR0802MB2518.eurprd08.prod.outlook.com (2603:10a6:4:94::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.18; Tue, 5 Jul 2022 13:58:52 +0000 Received: from VE1EUR03FT004.eop-EUR03.prod.protection.outlook.com (2603:10a6:d10:1d:cafe::5c) by FR3P281CA0016.outlook.office365.com (2603:10a6:d10:1d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.14 via Frontend Transport; Tue, 5 Jul 2022 13:58:51 +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 VE1EUR03FT004.mail.protection.outlook.com (10.152.18.106) 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:51 +0000 Received: ("Tessian outbound 3c5325c30453:v121"); Tue, 05 Jul 2022 13:58:50 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 0a67415c31cc61cd X-CR-MTA-TID: 64aa7808 Received: from 61120b810373.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 0287FC1D-1A70-4D35-900D-6FECCBBC547A.1; Tue, 05 Jul 2022 13:58:43 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 61120b810373.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 05 Jul 2022 13:58:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oFofXTy1FExCIO5TfR3lmxKPWLfKA8IX90clDw0j8ZOJeoodcWuMRvxxJ4nn7nWmdzfZgEO33hAhTztOH3xyQQe2DrwWj6+82gaZc3uuXc3XDofD2Glp/RQqFaEJJIfMXiabCey5Gz95y64Xc4SUMe/Tzk2899SyuaSCMXATpsntHYFeTRIz//e0dNByRHTNW4Jbjsbv7nS6iVpYkMFQXafCXX8LiEf7rGgwZKW8RVy0uVEANrF0mdGe/B3HktjYAdE1g2FMkk4hsIp4ix3kZ/YgdNHp/GkoSgS22heuFGifUlqoo5xgEYc4hcfpRwWP+cmnJBM/zJfkFOono2rtHQ== 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=oDU6X3NN/OyDCZgJEVaqJh9qbXVFpSEN67k48O4c7ns=; b=fVtvYmvDhUb5J63hukxhXTRAp2LgfqW4/z6NoKh5lD8vLWpfQpqJBlKeschQVpXd/SLD0HFt9hzMVkqonaDORSi1T4fF4vBRL5PVWFD50qWXnlK/MoKTqzd2Q3vQ24vX9dNQVmvf7/bHVtt2vG7Q8knVheJQHLSKEXRid4vYkfGLKRt8m9OQ8cADGjKzFHatOSvHlo8Av7mjZTigC+wdqk+eBRWT81gqv15prg3fcVjjsbppaV4VTrmAN8YMWWkMg9YFk5vP3uyje/FfGxESvOOPQpxzBCC2rucFmo7BWSu52f6oF2T5iNp4ljDriy6Grivz0n4JFYLlpbf0r32uIA== 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=oDU6X3NN/OyDCZgJEVaqJh9qbXVFpSEN67k48O4c7ns=; b=BRMw5wRiyR4Cn91odiVRgIJ2Inv903R4XdIcmqZzi808HxlSo0g2Dqp+bfUmHYokPOvQeUC7EbMP8aSScERuAyhqpf+gu0QCLLpDMHbtfJRbUZPDihglbC6kJSjU0Bukyz7PzXrTyQ59FE5LW/Hl3rtvmGi8NgKYAVJTdyLNhao= Received: from AM6P194CA0059.EURP194.PROD.OUTLOOK.COM (2603:10a6:209:84::36) by AM0PR08MB3412.eurprd08.prod.outlook.com (2603:10a6:208:dc::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.18; Tue, 5 Jul 2022 13:58:35 +0000 Received: from VE1EUR03FT032.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:84:cafe::79) by AM6P194CA0059.outlook.office365.com (2603:10a6:209:84::36) 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:35 +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 VE1EUR03FT032.mail.protection.outlook.com (10.152.18.121) 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:34 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.9; Tue, 5 Jul 2022 13:58:25 +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:25 +0000 From: Victor Do Nascimento To: Subject: [PATCH 8/8] newlib: libc: aeabi_memset M-profile PACBTI-enablement Date: Tue, 5 Jul 2022 14:58:18 +0100 Message-ID: <20220705135818.50088-9-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: 6a0aa766-c086-43a7-ed20-08da5e8e7daa X-MS-TrafficTypeDiagnostic: AM0PR08MB3412:EE_|VE1EUR03FT004:EE_|DB6PR0802MB2518: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: TvTRxT9UGrxX84CuPTm+BN9FGnIR/fkb6UGaI0aHRYN3kJJlHFNmXBQIhx/pplxIBVSjasCzg06oXje1y6RciYW7hWJZ5xfSmsMzQGOYcntobzGfNOWXRxwxJ5SxOE6GmPSBDHB4lEjQQZcoCwqr+mu4jLl6vouqrmCQZnkXfVuLaorSg/7QwI2N2Wbcb+sAHOmsr5iYZnYvo68xgu8MPZU1C+tjdXnj3EdczmAS8np/+V+2MAYlFp0P35r85pglVmy9z08L9S8gFEARVTXy8rKvRL/Zki6lsXE9gz2/GSYrtEYVE6GlPbXM3biw0W7HPdX18YUosGKxIZiXwtYqBxHkxmL+h4ioP31BmD9lUwoJ/lgTu6rGqQdWepRcnM7n3nXgOVGfR6DrmodR77YMBY/MeqIycexOf8gQYMVXNrxQKQKttbCjYpqDC8FDpV7KjK9xIn29V1Id6Q5Gch9DllYEnFhhpNYDzScZoWcLdkiCcs/RQTZLapQ4jNjynh7ERDiUMo4L4pqh22zUES+huWq6nCqYmywm6nbS+HlEK5UKI2e82M9ed2YdvYzXm7Dz6GqyHoOKTbgse4hwLAKAJiNFVFdvxxfijRWkTgO9ubEPd6HEJyp0W4ZX/89qYiqJ2SiG7XC99rE0GDmHHER94Snj5iQVim2dHSYqqntwwrtL5j9albSYF4vTveuODnxfXMc23YlAlKKQOOwdZ1XrjSwO8LpQZ36r1D9CGRxT0mXYf2zj5ujewMmLT4U15PUiAd8a1XWR+UesK4glnqre17+WURFtwkHf4mMu+R68BNJaJaUeY4DTVvSf0ltUzRXCOUsh1y3DLgn6MC9cO85EhMG7zgdyiii7jpe87pEkdfo= 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)(346002)(396003)(376002)(39860400002)(136003)(46966006)(36840700001)(40470700004)(356005)(86362001)(8936002)(70586007)(5660300002)(2616005)(6666004)(7696005)(478600001)(26005)(2906002)(82310400005)(82740400003)(4326008)(186003)(41300700001)(83380400001)(1076003)(36860700001)(40460700003)(426003)(47076005)(336012)(40480700001)(316002)(6916009)(8676002)(36756003)(81166007)(70206006)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3412 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT004.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: e7c5e32c-9a5a-4e6d-6a7c-08da5e8e73f5 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZumTZYCMWCB16J6X4sG+WFGDw4gUUdiR1HKzGVr7rbT3cMsWPfhMmRUZ/aO0jh8AyN1eGUv30zalWGP14xBN56dNkX157DRg4CnakPZedYNkQV94iYvThP13ZIJ4CuZnP/5YDWQY6lWndSFNeei/okIELlm+aicf0Ngo3E/SUTp4S4mJw6odn8bFMdJVnmCFseGPcUUNacqAcvvpV/Ar8STWgsjENbKw9L4IjM0hGK6DZDAOM06MCaOkHqNf9zU4qj5MPvEjzA+H64u6DSQ0/7sdu2e/3Cg5cuqsCktD5MLtYChfZnuA+T1LXZRMFA4KM7dDhZo3GoFw2humvD1DyazoP3RnYlhhovCriWz7yofxOcycuttkLXX+7ztBXMg2UIciZGeLXOnUtGZEhI7Hfg6zY1N15HzXFuGpfj/MGBIihzU2gLL4Tj/obpHFCz7UjECrLNLZvd46dpXK0TwWo641kDqRSipOiEg+cQ5P6GDFDO2+3j7NRjUUf5TUggQye6V7YmnLjwJxxDnPBhmcmmFnC+/PM9YvYMeiY3TfiyDWH3TWPDBi6ybuNdxh+CQR3GrvLjAeIDxE3w/OifqFo+xe1jrUCdfExssBX62GN/xRMtwStCwlm4uC3aKNBUu8/hZa2K6eNiS/4yNG1rqyrLsy6XEmGuBTDuQuuom4UyVRU3bLN1aF9/1LAcFvsjdSjAy5dqYJowLhy/SS6Vlu52KW/onm0vwz7naEuheeXGJbrPahfuyXfvKjnHrGC76OQYcnJ2k91/v3dfW5dECAk4XAFIJ6PeqTZ0x/y0y1eFd4YxdSEbx28r52tohAWh/z 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)(346002)(136003)(396003)(39860400002)(376002)(36840700001)(46966006)(40470700004)(47076005)(6916009)(336012)(40460700003)(26005)(426003)(82310400005)(186003)(36756003)(316002)(83380400001)(1076003)(86362001)(2616005)(5660300002)(70586007)(2906002)(81166007)(40480700001)(36860700001)(7696005)(478600001)(8936002)(8676002)(6666004)(4326008)(41300700001)(70206006)(82740400003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2022 13:58:51.1973 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6a0aa766-c086-43a7-ed20-08da5e8e7daa 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: VE1EUR03FT004.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2518 X-Spam-Status: No, score=-13.1 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:56 -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/aeabi_memset-thumb2.S | 45 ++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/newlib/libc/machine/arm/aeabi_memset-thumb2.S b/newlib/libc/machine/arm/aeabi_memset-thumb2.S index eaca1d8d7..a22d4314a 100644 --- a/newlib/libc/machine/arm/aeabi_memset-thumb2.S +++ b/newlib/libc/machine/arm/aeabi_memset-thumb2.S @@ -26,14 +26,42 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "pacbti.h" + .thumb .syntax unified .global __aeabi_memset .type __aeabi_memset, %function + .fnstart + .cfi_startproc ASM_ALIAS __aeabi_memset4 __aeabi_memset ASM_ALIAS __aeabi_memset8 __aeabi_memset __aeabi_memset: +#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 {r4, r5, r6, ip} + .save {r4, r5, r6, ra_auth_code} + .cfi_def_cfa_offset 16 + .cfi_offset 4, -16 + .cfi_offset 5, -12 + .cfi_offset 6, -8 + .cfi_offset 143, -4 +#else +#if __ARM_FEATURE_BTI_DEFAULT + bti +#endif /* __ARM_FEATURE_BTI_DEFAULT */ push {r4, r5, r6} + .save {r4, r5, r6} + .cfi_def_cfa_offset 12 + .cfi_offset 4, -12 + .cfi_offset 5, -8 + .cfi_offset 6, -4 +#endif /* __ARM_FEATURE_PAC_DEFAULT */ + lsls r4, r0, #30 beq 10f subs r4, r1, #1 @@ -98,10 +126,25 @@ __aeabi_memset: cmp r3, r4 bne 8b 9: +#if __ARM_FEATURE_PAC_DEFAULT + pop {r4, r5, r6, ip} + .cfi_restore 143 + .cfi_restore 6 + .cfi_restore 5 + .cfi_restore 4 + .cfi_def_cfa_offset 0 + aut ip, lr, sp +#else pop {r4, r5, r6} - bx lr + .cfi_restore 6 + .cfi_restore 5 + .cfi_restore 4 + .cfi_def_cfa_offset 0 +#endif /* __ARM_FEATURE_PAC_DEFAULT */ 10: mov r4, r1 mov r3, r0 b 3b + .cfi_endproc + .fnend .size __aeabi_memset, . - __aeabi_memset -- 2.36.1