From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2042.outbound.protection.outlook.com [40.107.14.42]) by sourceware.org (Postfix) with ESMTPS id EDDFD3858D1E for ; Wed, 21 Dec 2022 11:21:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EDDFD3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=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=B0uWb2DQ5G2vfiXA5WLW3JLX4mpHB+x6OOfL3NWjKtY=; b=wNMVC2YSCZUde0Jt7VGRMif3a2Nzt07nDDISDlCyOp3Zp9pJn/mYORNWUYhQdued5trgMk+VElGsJkawzspHyG7v4UYyy9SwU0c4VMCJNh3h0pRCiY9nknd7YgHF0NVqqYcL8tWoapQQB/+MXYoLGVhzg98jY0Al2gjeHet1HeM= Received: from FR3P281CA0110.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a3::7) by GV1PR08MB8156.eurprd08.prod.outlook.com (2603:10a6:150:90::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.6; Wed, 21 Dec 2022 11:21:32 +0000 Received: from VI1EUR03FT016.eop-EUR03.prod.protection.outlook.com (2603:10a6:d10:a3:cafe::92) by FR3P281CA0110.outlook.office365.com (2603:10a6:d10:a3::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.10 via Frontend Transport; Wed, 21 Dec 2022 11:21:32 +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 VI1EUR03FT016.mail.protection.outlook.com (100.127.144.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.6 via Frontend Transport; Wed, 21 Dec 2022 11:21:31 +0000 Received: ("Tessian outbound 6e565e48ed4a:v132"); Wed, 21 Dec 2022 11:21:31 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: d16c9deaa3750da9 X-CR-MTA-TID: 64aa7808 Received: from 9f134c04d68e.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 018A6307-1F74-4A63-A26E-54666FFDB1C6.1; Wed, 21 Dec 2022 11:21:24 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9f134c04d68e.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 21 Dec 2022 11:21:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fbSSX62JnEh6GorWCuuO01pnGWZQYI9/nS2QrXAAtRSf8Vt8UT7YsHUR+DIj/C/RU9NWxM0+j/2iSBY4nBgPCSMv8hdlUyn0ebrt0bBOFy3exIl+LWi7Nc0fsy/p3XjcKnyT2RCyZjlCVAc3Oy3YHDJhfzZypuaNJenBQSls6TJGkm5ROkDcSr+WaUS5EcCs6TTwQBxidjtVQ8jrL80AR0QFfLtVGAskKqy/xrpsVjA0NCmU8r8cOTiK5VKyNspRcvpwfu/75D+Kpv1uJJDky4MrUirAEvF4UfqkfG7vys78WWECSQo4WyG4Hks573EQ4CR+Ay5SEs75E19667VWqg== 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=B0uWb2DQ5G2vfiXA5WLW3JLX4mpHB+x6OOfL3NWjKtY=; b=iWHMBHwhOQQi6vqrLP15OOh51c1dKneDptJcsN3ClMMhrg6kdnyJUmnkSkc9AnUuvipPPbjaxxFoeBF2QyWj4xncehOk0k/QV15mMqfAFvqJ2HKFzdAPWCRzhNLyDxHu2SBgdACEB3lOdz/7l5TAKx8tSdkc3PE5RNqWscQqkQYRXXM6gCCw6YaiKhZq7xYx1m2xqCheuh9CftLgpep/fmZMganFPEphpGkqRoFwJKtTk7YZfACkerwtt0W1CZ4t0fFYTaMLQmtT4nOp22fLBaqSIJgF1AQ/ouYjiXeOBJjKNp0eR/QaUOsPxG7d0LpGm9oars8u5mVdduubErEArg== 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=B0uWb2DQ5G2vfiXA5WLW3JLX4mpHB+x6OOfL3NWjKtY=; b=wNMVC2YSCZUde0Jt7VGRMif3a2Nzt07nDDISDlCyOp3Zp9pJn/mYORNWUYhQdued5trgMk+VElGsJkawzspHyG7v4UYyy9SwU0c4VMCJNh3h0pRCiY9nknd7YgHF0NVqqYcL8tWoapQQB/+MXYoLGVhzg98jY0Al2gjeHet1HeM= Received: from DB6PR0601CA0001.eurprd06.prod.outlook.com (2603:10a6:4:7b::11) by AS2PR08MB9524.eurprd08.prod.outlook.com (2603:10a6:20b:60c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.6; Wed, 21 Dec 2022 11:21:23 +0000 Received: from DBAEUR03FT055.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:7b:cafe::df) by DB6PR0601CA0001.outlook.office365.com (2603:10a6:4:7b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.21 via Frontend Transport; Wed, 21 Dec 2022 11:21:23 +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 DBAEUR03FT055.mail.protection.outlook.com (100.127.142.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.10 via Frontend Transport; Wed, 21 Dec 2022 11:21:23 +0000 Received: from AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Wed, 21 Dec 2022 11:21:23 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Wed, 21 Dec 2022 11:21:22 +0000 Received: from e125768 (10.2.78.50) by mail.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.16 via Frontend Transport; Wed, 21 Dec 2022 11:21:22 +0000 From: "Victor L. Do Nascimento" To: CC: Richard Earnshaw Subject: [PATCH v5 2/8] newlib: libc: strcmp M-profile PACBTI-enablement In-Reply-To: (Victor Do Nascimento's message of "Wed, 21 Dec 2022 11:03:41 +0000") References: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Date: Wed, 21 Dec 2022 11:21:22 +0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DBAEUR03FT055:EE_|AS2PR08MB9524:EE_|VI1EUR03FT016:EE_|GV1PR08MB8156:EE_ X-MS-Office365-Filtering-Correlation-Id: cf1d58af-2f96-43ae-436b-08dae3458311 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: 7nFZt2tgax9CvXFVFZQ5Qwk510W3RcZRRgqFR1r1Dgkata3MrcSgUm7sOTGUJVpEHoTFI4+cAlikaPoMXEBPoyrv0tJc4GYbgiOu93P/CVnbPawW/Fp4J3zY7GzhOliy9YzMupOg4APyvEoW27oR9SiB1uPT5B5vr+BgEpQ/1aLdaZOvRtZXd+LK8HWVL//u/8M+n1dLNA/2lYQHfyZmzmCWHKWj8wMpA0bZYqci6446XzAXBYt7gsmDw4xV+DZ9DU7hmeJOGwnFKxE2Qo1/O2mMBRMP5Bk0HA71XrwObRY4aN28sfVKkjGZqe+sKUx+LBTpHYUG6+hetJVxFX+jZQIcoIn5uM6h5XcYGVJxCKLToYxYl0QGB6I08rMflZzy8MumqEJopju/tJQOwQ+XgnM/PdcGOhEv44dFbVfvw4phn97FEmGy4I75mu//uikCkfWsnaiTkgBZk+42jUyV2vzVu78WVFQ7RAeEIi5P86XlOBCDz2AJoWOpJz8gGCoxbbduJW/n8tPee4eeAgMvrfajI8m7/CGgjizY3mV3y9SQRVNODl8FRsH3qsHQ9TYK4jCK90coSNQPuUGVCvx7nufF2lZBzTAcgN3oAOfpNkAIiS0OvX/2CAJPjXB7iZinVAb2/cunL8ThqzJsnyPZSCgTAty5IjZNqCBTH13sHAX4XwHi1lDONiQcPSv+ZabOOC6LDHqPFNPlx9uwxfDV8gNkvWOztJKG9P4obDJv8j4= 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:(13230022)(4636009)(39860400002)(136003)(376002)(346002)(396003)(451199015)(46966006)(36840700001)(70586007)(2616005)(70206006)(426003)(336012)(47076005)(4326008)(8676002)(2906002)(8936002)(6916009)(36860700001)(36756003)(26005)(186003)(82310400005)(316002)(478600001)(40480700001)(82740400003)(86362001)(81166007)(41300700001)(356005)(83380400001)(5660300002)(40753002)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB9524 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VI1EUR03FT016.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: e2b8b6dc-9a4a-4029-76df-08dae3457e2d X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zRVyi9KeJnmdiSMxEPOFTZRm1oL2ps7kbRu37kIbGxCv4+pfiqLXg39jZpIjSD9Vtx/O+WOthssfx56ZCFOgd8+uz5TCcGijPz+yBkNyEnCZWS0a568JYGqFUhXJ20j6ZKYoI1WWKXSvAt9xkEfrQgmcxcTkVUPYs+IQEAWA3aI2Ne4E9q5R2JQTm8X3+E5WuSYQXw/V0xS0RjshaNJ+IBsDlr0aDCEb3y8X7jEt/T+Th69x48sEIsX84qd8giho/MQoYtqmFxtH/NezX04LtT/2wpbGWAwdQ2jNBmqZ5eKoqUeat0UClkobBa+9PXjiK0IvAIwR3d+e6RlF2g+OZjF0E3hEKjieBxVeWxq8jhns5cGZ0zKsC8YUhk07gXF0EFauos2SC3nwiT5b11D3/cliu6GLdY/6gSLPnhMZf6gkjKqv+iIRPeRT8G+yeyEA2btZKhZqD8IoCAa8Iu2Vix6721fHVvtV07b61y3aLvfV6oPoKHHPzKjuyoEYZmG+n0JtUragjyc5i/DUBoMNjUPgDVsOUFsKsRodz/gYkNN3acFo4KDAmRZAmiUUVf4/BNJngvVtGMwV94VEtNr+NtwIiY44TN/P55UZqWDZVE2dAcMZ9oYea+kB59GTbF/oaPCiOzcIearb+xgkDFcqo3n0xbOzUwYzHKpvek7dzh+YNAdHZp0xwIxdGc/mO9cp96IDJBx65xVVQyAr4FteqURT56dMRT9EjeK6j7E65yI= 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:(13230022)(4636009)(346002)(136003)(39860400002)(376002)(396003)(451199015)(46966006)(40470700004)(36840700001)(8676002)(4326008)(70586007)(5660300002)(70206006)(8936002)(41300700001)(6916009)(316002)(36756003)(2906002)(40460700003)(478600001)(86362001)(186003)(26005)(2616005)(426003)(47076005)(336012)(81166007)(40480700001)(83380400001)(82310400005)(36860700001)(82740400003)(40753002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2022 11:21:31.6448 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cf1d58af-2f96-43ae-436b-08dae3458311 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: VI1EUR03FT016.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR08MB8156 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,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 List-Id: Add function prologue/epilogue to conditionally add BTI landing pads and/or PAC code generation & authentication instructions depending on compilation flags. This patch enables PACBTI for all relevant variants of strcmp: * Newlib for armv8.1-m.main+pacbti * Newlib for armv8.1-m.main+pacbti+mve * Newlib-nano --- newlib/libc/machine/arm/strcmp-arm-tiny.S | 8 +++- newlib/libc/machine/arm/strcmp-armv7.S | 57 ++++++++++++++--------- newlib/libc/machine/arm/strcmp-armv7m.S | 26 +++++++---- 3 files changed, 60 insertions(+), 31 deletions(-) diff --git a/newlib/libc/machine/arm/strcmp-arm-tiny.S b/newlib/libc/machine/arm/strcmp-arm-tiny.S index 607a41daf..0bd2a2e6e 100644 --- a/newlib/libc/machine/arm/strcmp-arm-tiny.S +++ b/newlib/libc/machine/arm/strcmp-arm-tiny.S @@ -29,10 +29,14 @@ /* Tiny version of strcmp in ARM state. Used only when optimizing for size. Also supports Thumb-2. */ +#include "arm_asm.h" + .syntax unified def_fn strcmp + .fnstart .cfi_sections .debug_frame .cfi_startproc + prologue 1: ldrb r2, [r0], #1 ldrb r3, [r1], #1 @@ -42,6 +46,8 @@ def_fn strcmp beq 1b 2: subs r0, r2, r3 - bx lr + epilogue .cfi_endproc + .cantunwind + .fnend .size strcmp, . - strcmp diff --git a/newlib/libc/machine/arm/strcmp-armv7.S b/newlib/libc/machine/arm/strcmp-armv7.S index 2f93bfb73..7cafca151 100644 --- a/newlib/libc/machine/arm/strcmp-armv7.S +++ b/newlib/libc/machine/arm/strcmp-armv7.S @@ -45,6 +45,8 @@ .thumb .syntax unified +#include "arm_asm.h" + /* Parameters and result. */ #define src1 r0 #define src2 r1 @@ -91,8 +93,9 @@ ldrd r4, r5, [sp], #16 .cfi_restore 4 .cfi_restore 5 + .cfi_adjust_cfa_offset -16 sub result, result, r1, lsr #24 - bx lr + epilogue push_ip=HAVE_PAC_LEAF #else /* To use the big-endian trick we'd have to reverse all three words. that's slower than this approach. */ @@ -112,22 +115,21 @@ ldrd r4, r5, [sp], #16 .cfi_restore 4 .cfi_restore 5 + .cfi_adjust_cfa_offset -16 sub result, result, r1 - bx lr + epilogue push_ip=HAVE_PAC_LEAF #endif .endm + .text .p2align 5 -.Lstrcmp_start_addr: -#ifndef STRCMP_NO_PRECHECK -.Lfastpath_exit: - sub r0, r2, r3 - bx lr - nop -#endif def_fn strcmp + .fnstart + .cfi_sections .debug_frame + .cfi_startproc + prologue push_ip=HAVE_PAC_LEAF #ifndef STRCMP_NO_PRECHECK ldrb r2, [src1] ldrb r3, [src2] @@ -136,16 +138,14 @@ def_fn strcmp cmpcs r2, r3 bne .Lfastpath_exit #endif - .cfi_sections .debug_frame - .cfi_startproc strd r4, r5, [sp, #-16]! - .cfi_def_cfa_offset 16 - .cfi_offset 4, -16 - .cfi_offset 5, -12 + .cfi_adjust_cfa_offset 16 + .cfi_rel_offset 4, 0 + .cfi_rel_offset 5, 4 orr tmp1, src1, src2 strd r6, r7, [sp, #8] - .cfi_offset 6, -8 - .cfi_offset 7, -4 + .cfi_rel_offset 6, 8 + .cfi_rel_offset 7, 12 mvn const_m1, #0 lsl r2, tmp1, #29 cbz r2, .Lloop_aligned8 @@ -270,7 +270,6 @@ def_fn strcmp ldr data1, [src1], #4 beq .Laligned_m2 bcs .Laligned_m1 - #ifdef STRCMP_NO_PRECHECK ldrb data2, [src2, #1] uxtb tmp1, data1, ror #BYTE1_OFFSET @@ -314,10 +313,19 @@ def_fn strcmp mov result, tmp1 ldr r4, [sp], #16 .cfi_restore 4 - bx lr + .cfi_adjust_cfa_offset -16 + epilogue push_ip=HAVE_PAC_LEAF #ifndef STRCMP_NO_PRECHECK +.Lfastpath_exit: + .cfi_restore_state + .cfi_remember_state + sub r0, r2, r3 + epilogue push_ip=HAVE_PAC_LEAF + .Laligned_m1: + .cfi_restore_state + .cfi_remember_state add src2, src2, #4 #endif .Lsrc1_aligned: @@ -364,8 +372,9 @@ def_fn strcmp /* R6/7 Not used in this sequence. */ .cfi_restore 6 .cfi_restore 7 + .cfi_adjust_cfa_offset -16 neg result, result - bx lr + epilogue push_ip=HAVE_PAC_LEAF 6: .cfi_restore_state @@ -441,7 +450,8 @@ def_fn strcmp /* R6/7 not used in this sequence. */ .cfi_restore 6 .cfi_restore 7 - bx lr + .cfi_adjust_cfa_offset -16 + epilogue push_ip=HAVE_PAC_LEAF .Lstrcmp_tail: .cfi_restore_state @@ -463,7 +473,10 @@ def_fn strcmp /* R6/7 not used in this sequence. */ .cfi_restore 6 .cfi_restore 7 + .cfi_adjust_cfa_offset -16 sub result, result, data2, lsr #24 - bx lr + epilogue push_ip=HAVE_PAC_LEAF .cfi_endproc - .size strcmp, . - .Lstrcmp_start_addr + .cantunwind + .fnend + .size strcmp, . - strcmp diff --git a/newlib/libc/machine/arm/strcmp-armv7m.S b/newlib/libc/machine/arm/strcmp-armv7m.S index cdb4912df..825b6e77f 100644 --- a/newlib/libc/machine/arm/strcmp-armv7m.S +++ b/newlib/libc/machine/arm/strcmp-armv7m.S @@ -29,6 +29,8 @@ /* Very similar to the generic code, but uses Thumb2 as implemented in ARMv7-M. */ +#include "arm_asm.h" + /* Parameters and result. */ #define src1 r0 #define src2 r1 @@ -44,8 +46,10 @@ .thumb .syntax unified def_fn strcmp + .fnstart .cfi_sections .debug_frame .cfi_startproc + prologue push_ip=HAVE_PAC_LEAF eor tmp1, src1, src2 tst tmp1, #3 /* Strings not at same byte offset from a word boundary. */ @@ -82,6 +86,7 @@ def_fn strcmp ldreq data2, [src2], #4 beq 4b 2: + .cfi_remember_state /* There's a zero or a different byte in the word */ S2HI result, data1, #24 S2LO data1, data1, #8 @@ -106,7 +111,7 @@ def_fn strcmp lsrs result, result, #24 subs result, result, data2 #endif - bx lr + epilogue push_ip=HAVE_PAC_LEAF #if 0 @@ -205,8 +210,10 @@ def_fn strcmp /* First of all, compare bytes until src1(sp1) is word-aligned. */ .Lstrcmp_unaligned: + .cfi_restore_state tst src1, #3 beq 2f + .cfi_remember_state ldrb data1, [src1], #1 ldrb data2, [src2], #1 cmp data1, #1 @@ -214,12 +221,13 @@ def_fn strcmp cmpcs data1, data2 beq .Lstrcmp_unaligned sub result, data1, data2 - bx lr + epilogue push_ip=HAVE_PAC_LEAF 2: + .cfi_restore_state stmfd sp!, {r5} - .cfi_def_cfa_offset 4 - .cfi_offset 5, -4 + .cfi_adjust_cfa_offset 4 + .cfi_rel_offset 5, 0 ldr data1, [src1], #4 and tmp2, src2, #3 @@ -355,8 +363,8 @@ def_fn strcmp .cfi_remember_state ldmfd sp!, {r5} .cfi_restore 5 - .cfi_def_cfa_offset 0 - bx lr + .cfi_adjust_cfa_offset -4 + epilogue push_ip=HAVE_PAC_LEAF .Lstrcmp_tail: .cfi_restore_state @@ -372,7 +380,9 @@ def_fn strcmp sub result, r2, result ldmfd sp!, {r5} .cfi_restore 5 - .cfi_def_cfa_offset 0 - bx lr + .cfi_adjust_cfa_offset -4 + epilogue push_ip=HAVE_PAC_LEAF .cfi_endproc + .cantunwind + .fnend .size strcmp, . - strcmp -- 2.36.1