From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70040.outbound.protection.outlook.com [40.107.7.40]) by sourceware.org (Postfix) with ESMTPS id 4F0823857C5D for ; Fri, 22 Jul 2022 15:09:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4F0823857C5D ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=RodV5IEjgRpJlCU30HhuCEahGgNUyDugPsCC+B5M0SX4bB6v/bAuBbObkWdIl+yIQ7xiIJ7QyEH+veWo93BNXrsVpev4F4iPzhrdHG62AKSWiiHMqae5zzCb25KdU8L6SHxrVZ2bILoSTht3KJTtLC4GDldIqA1H1+yx54wxHwlhKgdG08AugS/nnrw4ahX/mf3TfhvLV2LPAHiu9aUJvAaR8M3ETBGqCzs9z8yJccLyduoj4nFHRoDMWgO/k14Vu5TEYzeNcmWga6QCuHzdW4WnLq7SMxJdA6ai9Oa5jzMYzFjxfz+210I3S52nke6g0nKUblSCi3tN2suEzTf1jQ== 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=/zNyt6yThLHHHIX4svZkQDWcDAy+bYoXCLUisPYgtFE=; b=dAHg9KCXJxzDASAfu69Qo2bYCyClhtmRWl/AVwVhttq8yuF1bBTMqRxZrb8/MmLYQ8jSHn9CVf3iu/WS6XnZUc+++c3SarJzqVyvFIqfncPntzZVLAgwJEzvtxEabRrgG4VNYJDGKCuygs9qudsH9xaj1uj+TOYclUfsqcQMLwOO8m8A7lPUpoUE7gnUom6VvWPLvzHFQfywy6H8NaRMCNr8N/vgXnlddCy0w7vLove4X8ztPaeqn4+LWVVwtTE9omnCKX/NL8fARP9Di8IQXQYrvD4u+Defrq8XQU2xMqOkE1Uy/YOiWURaXEXl60CouXgujMPqKs0r+wE2aZuPcA== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.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]) Received: from DB3PR06CA0027.eurprd06.prod.outlook.com (2603:10a6:8:1::40) by DB8PR08MB4044.eurprd08.prod.outlook.com (2603:10a6:10:a9::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.20; Fri, 22 Jul 2022 15:09:26 +0000 Received: from DBAEUR03FT022.eop-EUR03.prod.protection.outlook.com (2603:10a6:8:1:cafe::d2) by DB3PR06CA0027.outlook.office365.com (2603:10a6:8:1::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.19 via Frontend Transport; Fri, 22 Jul 2022 15:09:26 +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 DBAEUR03FT022.mail.protection.outlook.com (100.127.142.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.17 via Frontend Transport; Fri, 22 Jul 2022 15:09:25 +0000 Received: ("Tessian outbound fa99bf31ee7d:v123"); Fri, 22 Jul 2022 15:09:25 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 59f456ecb54bd5da X-CR-MTA-TID: 64aa7808 Received: from 3a62f12dddff.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A93CFD53-2FE3-4C72-9AD2-6533BDAFD196.1; Fri, 22 Jul 2022 15:09:19 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 3a62f12dddff.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 22 Jul 2022 15:09:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MNJb1MGK/b7OvvoF5Pgcw8gaZlUDNbYTqkv4NB0XF/rdBBNyNnTSOz/2AB26cdN0Kt4N9xyXwFfThHW8lHGsE0dKwdLsF9ssUotOosJlBA7dpGA2KSpidWthS2SQRuQxRnFBLdc8d8DElUYqsK8UH3Zun4QIvyAhOKpGJFFVNITwuKAByaVO4ya9px4BawK31jyXdRrdSrh7XoUtxM/v7JFqOb2W2EA9g5jqHZBvoYIWCODwd7spi0Qm6bM6w3CXLqb1lvbxFXGiElRy5rpmkJAvPzhhX4cwAbCrAck1OvKRk2xnSY7jgmzlQ4s0jwqWSCahbm/h/vqpNPJ7yk0wwQ== 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=/zNyt6yThLHHHIX4svZkQDWcDAy+bYoXCLUisPYgtFE=; b=aAaEVgsdtv/jwJ0bpvddAPd1hj6ww0Hqoh0DQIebkQd35Ba/JpAhXoPTZTwi+hLwKfged7dsqSNQWmvAlnRe3RrEMAO//mNSRxdwkzNIzW7ius79x4C8DtKw8tIHIOTeRQK5JuSyoG1sI3LWFRwDvQ7GpZotMs7fcrcsOk/F7SGxpseCuFjNNqc0/vS8G+3fCklel46zBkaxsFa0LZ7y2Hgc3qrRSsm0jz7otmm1d/oAf2NCWAmFFADqqLDXzhADeK0UzFvWBwh5VoMZJQSEsXnyC7FTIT6pxxs/4o2C5THZs0mF8Uy1Y0ZJtV3l+A0vIlqufwhXmIU1UZQSGMUdag== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=gcc.gnu.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 Received: from AS9P194CA0024.EURP194.PROD.OUTLOOK.COM (2603:10a6:20b:46d::29) by VI1PR0802MB2288.eurprd08.prod.outlook.com (2603:10a6:800:a6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.19; Fri, 22 Jul 2022 15:09:16 +0000 Received: from VE1EUR03FT061.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:46d:cafe::5f) by AS9P194CA0024.outlook.office365.com (2603:10a6:20b:46d::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.19 via Frontend Transport; Fri, 22 Jul 2022 15:09:16 +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 VE1EUR03FT061.mail.protection.outlook.com (10.152.19.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5458.17 via Frontend Transport; Fri, 22 Jul 2022 15:09:16 +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; Fri, 22 Jul 2022 15:09:10 +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; Fri, 22 Jul 2022 15:09:09 +0000 Received: from e124257 (10.34.105.24) 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.9 via Frontend Transport; Fri, 22 Jul 2022 15:09:09 +0000 From: Andrea Corallo To: Richard Earnshaw CC: Richard Earnshaw , nd , "Andrea Corallo via Gcc-patches" Subject: Re: [PATCH 9/12 V2] arm: Make libgcc bti compatible References: <6c251f00-6b73-110c-d2b3-5e115ed6912b@foss.arm.com> Date: Fri, 22 Jul 2022 17:09:09 +0200 In-Reply-To: (Richard Earnshaw's message of "Thu, 21 Jul 2022 12:41:06 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: a7d4570f-e352-44d6-de55-08da6bf42ac5 X-MS-TrafficTypeDiagnostic: VI1PR0802MB2288:EE_|DBAEUR03FT022:EE_|DB8PR08MB4044: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: pV3iojYASCBMFHaJrIHqpAR7ujJdk2UZSTpmBUjXjJlydq5AaD1wrjFND5BvX02pmVINrmP6lFhMi66rK/VQy7CgMfc4QUS2XBX9aRNjCV2AxFmd/quEPaI1LuoY6LcwzsybBNJ3OJGc4Agbb3K+BvO2V6CqmbgyR+LY7loPZiBNGDzfVRPcTk6ZVoaY4RJbT6PCpSkgYGgAGvTYuSQLEcGrwQ5upjHhdrfVwC0GuuG+LkonybFZAYaUb6noAuvjtEQObQIk56Fea6DtBChktXxjH9SarDLzg56l+WMCg2qiiGeloyBd0zix+kUWmCaaMzPRIk95To/M6lpwrqgj5qJh+eHbaVQfLQUF9QOpR099Uk7c0Zfr00N1T8Tm06FfzdlSSM31FkddWXNJIx3x8IUcZGQ3B690Lz4aQTg/X1452ZZ+M9VG+2e98v6YGLZB3Utp3we8xlgA9WNWKpcBgApKzE5vBw6yRm+fejQf0O996G6pS1sAp3ySiGm4+rOlO0z1RfFwHTnfrR9WiSc1Xjrz6MHL3CJT88f2B5HNUQ40lyCTvoiFv2z6v+7fC/oZ411GyB0tbeosL65z5MEw2irhYguUX7//dTqSKTupBoBjADTySoeLwBjt6PuwJRAMbaOJS3VqtFMWeAsJDZ9XAlfjy3ZylHhR9Ur91Q5wC51BdnDJWl4rMrbmxNaIGA429+An932hCu4ekFVl4wQJr84jp0AfpPGtKrjJKmuopDu8bqplgye0vw2sWqnn/Yz70KqVf0IKyBZMdHVWLvqodcz2yMWqUCZc91hlJJ/OhX5i3kb/2NPLbdBLuT9+mHfDdpn/NAUjqWVsuR+5JNtYyw== 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)(136003)(39860400002)(396003)(376002)(346002)(46966006)(36840700001)(40470700004)(6862004)(478600001)(316002)(86362001)(36860700001)(8936002)(36756003)(5660300002)(44832011)(70206006)(70586007)(8676002)(41300700001)(47076005)(26005)(53546011)(2616005)(40480700001)(81166007)(336012)(426003)(4326008)(83380400001)(356005)(82740400003)(40460700003)(2906002)(54906003)(82310400005)(186003)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2288 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT022.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 6f0495bf-bcc6-40de-a2f1-08da6bf424f3 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rBkLb2ajpbRj1Il9V32hGg4ds1vPUpUOb6HQSKT9iO8qGWOzaofA8qTgNGCI/BDLphqSFf22Mb/YdF/POxUn2tOyewWPf3QIV7pliB6z4P7e1m/fS2Lqt99rktDmHgDRkFU5wk+ASTwGkVPlKpAOTR9a/hCGpw/1PIpPHHniRmKUydTqb/DGg/PG4L2T+OfGMmN3p80bvL0mdViSUL2NQJk/zq1Yt8j1DXiis8HE11hZvOv6BEthBiLSq5gMLChc7CccYd3ZSBkru0rqQdf12leO3P/rSWUGpDQO6NOVzvkjqqTrbEU2jMgLYHvN4MAOpWoUNVGEvQgl56ehw6uoeIFkEUb+KtXextVYlgX7G0YK+vdyP3NflegyTFaUrJblqyA4zYSRswIsSejWftFv8rG1LuabKWSzSmmjyfvJ4N9YigRVrDqHQnBYfKA8tXOLQlf4yXalsBw36AjwzUSe/oo2XO9TRIidXP2A5T9yY21GOmkRNniY4YQ+QE5s1WE4S/dKJ9X0G+G+3Zc+MQpOQ7Ql1irwUN9s/cqh3JloEACElmM1Rpdkd/1KMLtASsJ93X0jPwlgBotQsODqyHuAgT/ARediKasKV4n5ziWPrw2r8l9I1J/r9KfKT1ExuSQorg4+a1VvtC8iPVKbfHMD9AUo/SWvBwxVfFPBOdZRuGtDgMjSXW1noXjJ1eVUwcTrH0IbQCanE82Z7A9BIkce3sqCUk/Gt2O1S8XnOrFTqFuoE4r3isMcI+XdGBHv/C+qx0T7N2xb9IaQFFpmroJMrj/kyTnJzdKzhjqItfx1SxNvC0IEmCZkQzwgthVxibF6 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)(376002)(346002)(136003)(39860400002)(396003)(40470700004)(46966006)(36840700001)(70206006)(4326008)(40480700001)(81166007)(8676002)(6862004)(8936002)(47076005)(36756003)(82740400003)(40460700003)(53546011)(70586007)(54906003)(2906002)(36860700001)(478600001)(26005)(186003)(316002)(2616005)(44832011)(336012)(82310400005)(83380400001)(86362001)(41300700001)(5660300002)(426003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2022 15:09:25.9993 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a7d4570f-e352-44d6-de55-08da6bf42ac5 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: DBAEUR03FT022.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4044 X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-List-Received-Date: Fri, 22 Jul 2022 15:09:34 -0000 Richard Earnshaw writes: > On 21/07/2022 10:17, Andrea Corallo via Gcc-patches wrote: >> Richard Earnshaw writes: >> >>> On 28/04/2022 10:48, Andrea Corallo via Gcc-patches wrote: >>>> This change add bti instructions at the beginning of arm specific >>>> libgcc hand written assembly routines. >>>> 2022-03-31 Andrea Corallo >>>> * libgcc/config/arm/crti.S (FUNC_START): Add bti instruction >>>> if >>>> necessary. >>>> * libgcc/config/arm/lib1funcs.S (THUMB_FUNC_START, FUNC_START): >>>> Likewise. >>>> >>> >>> +#if defined(__ARM_FEATURE_BTI) >>> >>> Wouldn't it be better to use __ARM_FEATURE_BTI_DEFAULT? That way we >>> only get BTI instructions in multilib variants that have asked for >>> BTI. >>> >>> R. >> Hi Richard, >> good point, yes I think so. >> Please find attached the updated patch. >> BR >> Andrea >> > > I've been pondering this patch. The way it is implemented would put a > BTI instruction at the start of every assembler routine in libgcc. > But the vast majority of functions in libgcc cannot have their address > taken, so a BTI isn't needed (BTI is only needed when an indirect jump > could be used). So I wonder if we really need to do this so > aggressively? > > Perhaps a better approach would be to define a macro (eg MAYBEBTI) > which expands a BTI if the compilation requires it and nothing > otherwise), and then manually insert that in any functions that really > need this (if any). I guess the main downside of this approach would be the maintanace burden, we'll have to remember forever that every time an asm function is called by function pointer we have to add the bti landing pad manually, otherwise this will be broken when pacbti enabled. WDYT? If we want to go this way I'll start reworking the patch in this direction (tho this might not be trivial). BR Andrea