From patchwork Fri Nov 3 13:15:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 161300 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp1023750vqu; Fri, 3 Nov 2023 06:17:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGgnt94aVsVcug08Hoyod1FFDH4YvBNaDkZrYdgZ/0HLJYPeqr5E20GQ2qXX4wp3HOjEHNQ X-Received: by 2002:a05:6102:30b5:b0:452:6d82:56e3 with SMTP id y21-20020a05610230b500b004526d8256e3mr1274246vsd.6.1699017424595; Fri, 03 Nov 2023 06:17:04 -0700 (PDT) Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id cd34-20020a05610241a200b0045b64006152si210460vsb.316.2023.11.03.06.17.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 06:17:04 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=YmyFD7s4; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=YmyFD7s4; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 92875385C6F9 for ; Fri, 3 Nov 2023 13:16:38 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2082.outbound.protection.outlook.com [40.107.8.82]) by sourceware.org (Postfix) with ESMTPS id 4EAE23858C00 for ; Fri, 3 Nov 2023 13:15:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4EAE23858C00 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-Filter: OpenARC Filter v1.0.0 sourceware.org 4EAE23858C00 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.8.82 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1699017350; cv=pass; b=eSg8YePM3V07gJbGrQ4kh0VBdDE8/ckTlKKsXmWREAMWb8RMS0tULOxs3vEeaJInlycRgs2vfbOrFfSYHibbpnkF308cV+WHvB0ack8J5aKW2TLo69BNMy3mYWI70awY26e5pY90HM3mir52B0Y9CEesC6ktpbULPHXGLB4Ke94= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1699017350; c=relaxed/simple; bh=tdgWrjgotN837Gndd7dcNO9sl+6ZufLeSdKj4Lo0pIQ=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=A9Y6Ktd2HbA7rDAkEkXQ+ydmg/GXElO+A2lXQbI14xXlZ+EVeOFfVjzZE/vYJgweUbKnOja4Lpt0WgkcWij8NG94LzOofSyIIVhooV49kdUkDeoRYo9+9+bt5hCeWpU2mdacLL9OaN0WSjvEsu6AG13pssUxpcLfJd2qeDYqlm0= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=GVrIUKb+WfmrnineubE2jQRmcRqSMYfWPLH6ikgkXTDTdeSxE9H4ATzVZvCq0YJ9mcSI4rDx3yvOkihRhcpLVD+4PE4EZNmKhnKOpEbGyeHF3DrQeQNaDBSHnjJ0oC72FAU/aGH9ZrGdc1t8diRZMQ+XK1B7Gti/2Nn8LlaFlLawUE5sQUESRwIvLfE68AvF8MH5oLONu44DJoMRQdaOvpbBBM9EIYBJH6tJgMOovmuIzT17kfS/GvWPMAwnuPy5OzSwCUfbhskSONNLVO4sMT5PY5V6X5pC1GA8br0xm75UD94WE02eSLigCaRWVDvUJmz1OiiTSyx93GA+WyR0gA== 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=5JjZl4PwQzazI/JBo6FXhb5hck+jQTb4psWpo7OCtx4=; b=OEI4cyr2zGXmBYH5YJuNQq1xUMhHB+tF0InE2c9ORAEBgJPt6EBmjPLtIvXHPiKaEBJq362C2qU0+/MevZY0sHhSGZxcRtdxcD7SORY70M7kNvCrtyF+qZqPvMAriIbVqJmrTPQnU7YC1nXYNOB3PHSLBqD59WwbYms57oYwDt4tgUh/gWgZCRRzzkwmz1lELpajP7QWiIwir6kAGLFk2Zwo0kyqDB/sqYhByAMoXAse+lrr0tg7YmWyvcfiWebd+mUd+A87S6DvoMdKN3y+xi0XUkp6FsJxa1XMqVUbT/NAvNygQZ/oii4pV1OG+wFkf7v3w06utiUsCyKGtYA5tg== 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=5JjZl4PwQzazI/JBo6FXhb5hck+jQTb4psWpo7OCtx4=; b=YmyFD7s4T3OAgRM6EWkn/lTmJWJaqbrRJQpoUk2S73rnxO7t2jQVxEURxorHLGlVdj+7mtuLlaxx+W0AbMBGSaAEH773RvfttJsKx6e2lx5/by4tM2SZz2TH90ppIzkFubXy0QrM/Bqzv2F2KPYGKVhXwD33ONAfturUhpEZ73c= Received: from AM7PR03CA0009.eurprd03.prod.outlook.com (2603:10a6:20b:130::19) by DU0PR08MB7518.eurprd08.prod.outlook.com (2603:10a6:10:312::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.20; Fri, 3 Nov 2023 13:15:43 +0000 Received: from AMS1EPF00000043.eurprd04.prod.outlook.com (2603:10a6:20b:130:cafe::f8) by AM7PR03CA0009.outlook.office365.com (2603:10a6:20b:130::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.21 via Frontend Transport; Fri, 3 Nov 2023 13:15:43 +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 AMS1EPF00000043.mail.protection.outlook.com (10.167.16.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.19 via Frontend Transport; Fri, 3 Nov 2023 13:15:43 +0000 Received: ("Tessian outbound 5d213238733f:v228"); Fri, 03 Nov 2023 13:15:43 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 19e33c0185d13228 X-CR-MTA-TID: 64aa7808 Received: from 04e3580d0aba.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id FA7FC1E7-402E-4049-9FE1-6D508BE70BE7.1; Fri, 03 Nov 2023 13:15:36 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 04e3580d0aba.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 03 Nov 2023 13:15:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y107Jdtn/uTv2nTUKj1vRvx7tXYp9ePHd9IYM9N2nwmosB5SnIK7Zzamb0vQnXe1ZuG6ZRbjzlB88Tv2OQbPjEEbm9n4CIfWPs4Cdo905zQodYxqBvi/dA67tBrqLbXrOBFkdhtQAip+p7RP4ISIf1xnrF1dTCtt94oWu2aufycJILbJzzR4l3y4l1WnVQMvYkM5LjPPKRayc5qLE81SDHxYoRIgpIGKAz2O7f3RSSDcfEd5BNtKAJVJQTxhJYS3Ape1X4ho7Np6eQKZeH7QgdMvLrmWTKclRYmvagHV7lrmNuDqg/QmifOcgRYDHkNSndnNGHjmdLldjqJgS7WkxA== 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=5JjZl4PwQzazI/JBo6FXhb5hck+jQTb4psWpo7OCtx4=; b=IUXHjFCnYPDhmmaDyz05rW4K6JkghcbsF7YpK6VUqfE3s8gMx9zB5U9FcbJnRs7qGxmt3/TXAhJgT9znf+h9edJbrpfvMh/xGXrYV2I8AsAbDOU3gzDg/RPhLHB6I/YJUjZuGanb0XDBdZ67UsSaAXcTvBYtjXgzdaNRribtGYhSc6i4gMqoc7pU5Ro3x36Nbs51hPreirj9kzLtWktnVfg94j9p3FpK3S9bYrHolHMXWlkxNr9Qn2caQKZAE/NUl6eR604AGImXcEtfbENKwPei6Bw/cNkxSJjFFeL1I/MxUvnkUuOOn8JSqgwCF84ANmA8wjZaJokJKzf2eE6Thw== 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 (0) 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=5JjZl4PwQzazI/JBo6FXhb5hck+jQTb4psWpo7OCtx4=; b=YmyFD7s4T3OAgRM6EWkn/lTmJWJaqbrRJQpoUk2S73rnxO7t2jQVxEURxorHLGlVdj+7mtuLlaxx+W0AbMBGSaAEH773RvfttJsKx6e2lx5/by4tM2SZz2TH90ppIzkFubXy0QrM/Bqzv2F2KPYGKVhXwD33ONAfturUhpEZ73c= Received: from DB8PR09CA0026.eurprd09.prod.outlook.com (2603:10a6:10:a0::39) by DB9PR08MB8652.eurprd08.prod.outlook.com (2603:10a6:10:3d0::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.21; Fri, 3 Nov 2023 13:15:33 +0000 Received: from DU2PEPF0001E9C2.eurprd03.prod.outlook.com (2603:10a6:10:a0:cafe::96) by DB8PR09CA0026.outlook.office365.com (2603:10a6:10:a0::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.22 via Frontend Transport; Fri, 3 Nov 2023 13:15:33 +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 DU2PEPF0001E9C2.mail.protection.outlook.com (10.167.8.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6954.19 via Frontend Transport; Fri, 3 Nov 2023 13:15:33 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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.32; Fri, 3 Nov 2023 13:15:33 +0000 Received: from armchair.cambridge.arm.com (10.2.80.71) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.32 via Frontend Transport; Fri, 3 Nov 2023 13:15:32 +0000 From: Szabolcs Nagy To: Subject: [PATCH 1/5] bfd: aarch64: Fix BTI stub optimization PR30957 Date: Fri, 3 Nov 2023 13:15:32 +0000 Message-ID: <8789cd1a77dfb39f2e8f722f6c737119e8cc9ae2.1699016830.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DU2PEPF0001E9C2:EE_|DB9PR08MB8652:EE_|AMS1EPF00000043:EE_|DU0PR08MB7518:EE_ X-MS-Office365-Filtering-Correlation-Id: ef495bc4-e99b-49af-3139-08dbdc6efc00 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: KtDoz2RLIVr8XUcnPUgJLXynWaSCM5pM4g4hlPdcj83/mRG6YC21BpXzZgE5BdRHysYgqDH/inFO/nURDTKBuhE3SoGgrOr0EPWolBOmivbsH89iAuKYnPI6g/ewyjmT5H0JglAMVxPJdEcNyj6fHp8o4soTxgdw2rasx5/2+XTonBw4OyhiPOpGhM3V+0djS4ooMTPOfsE1RBdKXQHUlRIbZKt2rTWf1HQnM1fHE7Uw0V9eFYGKBitZ1J9yuhUsW0/48AAmBTeYO0pTS0lqAEWghmMLhqwZrGDI3+xw0s/XGP/mLFpEHOV2mX58SZ3jNU8V0stz7eolzgI+IPnolrPe+wM77736aJH0faffVMZg3+fz+WyuyzNCeznEruIWP6vPH7ieXAEWKdFxWojleT+p/2BcYha6iRUvSOSvnl1EnxPwfOuhDaGvzD/mCMSuCAV7krqZCwa9fK+WqnRIMaEwsJFH1QE31Sgw3efkoqf9XDYdjWpqZ5i/XQ0NDgTY+qNIW/e0xXmrP82hPUhr58xvylAWYpt2+PpBgSWEHW+UD5tyYhkGsPZYwNcGcn6qwEelCeu9KJQPj1ht+0kNPYMWCavyg7iX3foGba2T1B1erIpbb6Ym8XAr7vGvmpM9bvPFfZVqz+RmUpXL4ax079CDZ5UJ1tVOHAI3D+S8k4e5yeYYaixVnWjKNVB+obWTGq4HdVgQjOSSUBGeK694+GuMqko42H2tEjv9tjJyhX9/6WNdIT7jWYYU4xgYc7jzo1VVNL8aU1IwC5xDhVGWlw== 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:(13230031)(4636009)(396003)(136003)(346002)(376002)(39860400002)(230922051799003)(82310400011)(1800799009)(64100799003)(451199024)(186009)(36840700001)(40470700004)(46966006)(40460700003)(426003)(336012)(26005)(2616005)(7696005)(478600001)(47076005)(36860700001)(83380400001)(8936002)(5660300002)(2906002)(44832011)(41300700001)(70586007)(8676002)(6916009)(316002)(70206006)(81166007)(356005)(82740400003)(86362001)(36756003)(40480700001)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB8652 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS1EPF00000043.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: a1541738-ebf6-449f-6605-08dbdc6ef5fc X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pg3eASgrYoGaE0UPh2Ds12TCV0G4jmZaiBCCUPD+zt+m2qr+vTVi4tv4iywokyILcydOdmn3ywU3A0y6dWojCyS+l5w399yEvsS6Sj3sNNnweD0e28gHn0MsfEYtXXPIwm9dLf4vlUr57Bpu/JPtVa5t4PN5EFiNQ5jku7q3isMsUEkUssYJbZatWGPc88Gfk9datnvFxcSzphRSgON2kTzvNcyHxP3Y/5ucR0VZ3FWGGWsZjhhpp9zniAGcL34iLPk3juu5p9dB/tBoFvyE+QIH6Jdqv9bsLNNZaz0aG0OiTaxpBhOWTvqqYyk8aYHElgFE5cYinTNhYU6nj6kbUS0O+2ZQ4dz6jiCiWqHAykycsLRJVCWcKxVseNv29SsSFc92JKSLDLnYBMXc0QbUyesmCyWBQjajiKe3URTA4cgOiwAfzB+WVNGyRI0cdqf36R8RHWT6bW00Z7dNYairFNphMgRGtKjalyAbQUfYA5iMW3Im60TuvVchjL3OAffm3ddl5xVGa5z+0r+tkuUJO0iVWJ3K2U/URJgpfUViSVFre1KxhVGLOwT2FnIGeB8Ed4Ne5ZXMnxNvknFkRyCgQ7QRGKKnl1xkooetfmTGuA5HkLlsUgXnHJrdnTAEZQemPg5wkcdUQAH1qBigUpx/IYZhrOaCM5suVqDtc6MZta4SZc0A6s8khsSJJbyVrjlZjf6p1k8x5v6uQB7qbnUlvkUMA177RVuHYtOS4ANlwMwBY5UxDthOMttF0IZV6wVB 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:(13230031)(4636009)(39860400002)(396003)(376002)(136003)(346002)(230922051799003)(451199024)(64100799003)(1800799009)(82310400011)(186009)(40470700004)(36840700001)(46966006)(40460700003)(316002)(336012)(2616005)(426003)(7696005)(36860700001)(83380400001)(2906002)(44832011)(47076005)(8676002)(41300700001)(8936002)(5660300002)(478600001)(26005)(70586007)(70206006)(6916009)(82740400003)(86362001)(81166007)(36756003)(40480700001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2023 13:15:43.4972 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ef495bc4-e99b-49af-3139-08dbdc6efc00 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: AMS1EPF00000043.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB7518 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, KAM_NUMSUBJECT, 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: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781548895238228065 X-GMAIL-MSGID: 1781548895238228065 The instruction was looked up in the wrong input file (file of branch source instead of branch target) when optimizing away BTI stubs in commit 5834f36d93cabf1a8bcc7dd7654141aed3d296bc bfd: aarch64: Optimize BTI stubs PR30076 This can cause adding BTI stubs when they are not necessary or removing them when they are (the latter is a correctness issue but it is very unlikely in practice). Fixes bug 30957. --- bfd/elfnn-aarch64.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 4592bd6da27..a0dd17faa7e 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -3675,8 +3675,7 @@ group_sections (struct elf_aarch64_link_hash_table *htab, /* True if the inserted stub does not break BTI compatibility. */ static bool -aarch64_bti_stub_p (bfd *input_bfd, - struct elf_aarch64_stub_hash_entry *stub_entry) +aarch64_bti_stub_p (struct elf_aarch64_stub_hash_entry *stub_entry) { /* Stubs without indirect branch are BTI compatible. */ if (stub_entry->stub_type != aarch64_stub_adrp_branch @@ -3690,7 +3689,7 @@ aarch64_bti_stub_p (bfd *input_bfd, file_ptr off = stub_entry->target_value; bfd_size_type count = sizeof (loc); - if (!bfd_get_section_contents (input_bfd, section, loc, off, count)) + if (!bfd_get_section_contents (section->owner, section, loc, off, count)) return false; uint32_t insn = bfd_getl32 (loc); @@ -4637,7 +4636,7 @@ _bfd_aarch64_add_call_stub_entries (bool *stub_changed, bfd *output_bfd, /* A stub with indirect jump may break BTI compatibility, so insert another stub with direct jump near the target then. */ - if (need_bti && !aarch64_bti_stub_p (input_bfd, stub_entry)) + if (need_bti && !aarch64_bti_stub_p (stub_entry)) { stub_entry->double_stub = true; htab->has_double_stub = true; From patchwork Fri Nov 3 13:15:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 161294 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp1022822vqu; Fri, 3 Nov 2023 06:16:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHXz/bEKvvOy2KVWpTZyIXtuNH/wEAvtAFAKr16LiQsmm2SX61AYl9VvYebc1rivPC7Cyhv X-Received: by 2002:a05:622a:1a14:b0:41c:bfc5:dc6a with SMTP id f20-20020a05622a1a1400b0041cbfc5dc6amr4083867qtb.11.1699017373470; Fri, 03 Nov 2023 06:16:13 -0700 (PDT) Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id m13-20020a05622a054d00b003f4ecb4085bsi1477856qtx.289.2023.11.03.06.16.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 06:16:13 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=tUh8rcst; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=tUh8rcst; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BBEB5385B53E for ; Fri, 3 Nov 2023 13:16:10 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2059.outbound.protection.outlook.com [40.107.105.59]) by sourceware.org (Postfix) with ESMTPS id A9AC03858428 for ; Fri, 3 Nov 2023 13:15:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A9AC03858428 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-Filter: OpenARC Filter v1.0.0 sourceware.org A9AC03858428 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.105.59 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1699017365; cv=pass; b=i+X1oy/HnRlbJ/HFg8PbtXb9hUs9ul+kTdKo7GHSh/L2qEuIibG082dVlRLEdxNi5Vu3gNHEFcQpcDf8fPBCI3CLTgQSalmoZ25zVROSwvmRyaMMVcJPwvksd4sWDORPNAYwvPG2P/eauRQXFVoxcmbkZfU+0a5MRkIAhWVNyfQ= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1699017365; c=relaxed/simple; bh=72lETeW/BQpD+ZMHUgrK4A60yhYD0IWw7aDtCTkW7mk=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=t1b5Ny2aofoVx2IZjRWaw1WpVaTFSrMuBJlWIImHHWxM88s0rQ4XPB2kmSEuu2O50vjxRgoM8EjL8kBVn7LYR/OhpqZZF8zx0S6XbhtqxavWu6iUXLPeScjK9xtwUDFQall5k78Os4C8483hy2sKTVlgs7leKDJKfalPKxnKx8U= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=ao08l8CidpdZ6XBDfaMjAh46AX61K0HAEqEsnhFVIEz4pB83sQrkTbHv9DeHdRyCxM4jaYVik9u0wEa0PbLf5rBgsSLoK3yY/vYf1B4jFSXxGBnGbNfz04N1nqa1NLJyX3eqTm/us1Ic8aPOwALVTO00SxNCNLV6YMZLzFOF9bSsSyyfNpMLqmLi9ZUqfJ1JOtdvkSzs0wynrpQ4L/7SNGX+ieKNXxnfWyYaI5lUZVlygzRpei9FjMwb0EniwAbtGKZ3bh72GyMH6eME3LSngI0T0dA0ttCsu69Fx6Qpl0MgxH0iZNxcmxGY2xdH26BTXijE3yk2BuIN3csDSCMiCA== 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=vaF1mZLBmThr3UaqnDaYLAEUNZ6Vq5Gwmo/6jolsVpY=; b=fYm3q84WEqVtko0EQggB1Xg99rrqIbrRpgAhPCJSgmXKArx1gMdOlJkx7o+LDTbipiARgQT1wQCeaOTMalOrkZiFAVBWiyfU46P+fsSmcrsCEWtcES+2anEH52YaCCjOIEjxd5SJNLNeJwQztm9URgYL7Q7jbTGMx5FeSeqYUzao1VSgqXWumsNkcLO9AdixmeX6AnhwtufWCoxTOokT7+oZ75KU9xRi4iumOZ31oZ2gBAU52hd6LI8rld57Ga4OABK+6aD0t7NhtGCBG3LOJxJv+V22+CFBFjwLaX201QSaiWRHHfPZL6Sk6/BlEYF5fZ9ZbtlNdd9QEQp4NIhXjA== 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=vaF1mZLBmThr3UaqnDaYLAEUNZ6Vq5Gwmo/6jolsVpY=; b=tUh8rcstWoyXKpWMGnL/zZJh6Kbdx8ETL1LvmSGdB3t0sOjrKqGxYcLHx14xDzRupYb/4cghQ+U7NpKnesNUokHGj+0VrcXZQF19eeA0hjBN555rrYhfWgA5aPES+O1DRI2WWGeKrZO6ZzuPifUDt+HBUYlHme1+CSVyB3TpnHg= Received: from AS8P189CA0041.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:458::9) by PAWPR08MB9613.eurprd08.prod.outlook.com (2603:10a6:102:2e4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.21; Fri, 3 Nov 2023 13:15:51 +0000 Received: from AMS0EPF00000196.eurprd05.prod.outlook.com (2603:10a6:20b:458:cafe::d2) by AS8P189CA0041.outlook.office365.com (2603:10a6:20b:458::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.21 via Frontend Transport; Fri, 3 Nov 2023 13:15: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 AMS0EPF00000196.mail.protection.outlook.com (10.167.16.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.19 via Frontend Transport; Fri, 3 Nov 2023 13:15:50 +0000 Received: ("Tessian outbound 7671e7ddc218:v228"); Fri, 03 Nov 2023 13:15:50 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 66eaf3998d15f71c X-CR-MTA-TID: 64aa7808 Received: from b04f9c68425d.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 73A61CD1-5233-4AD4-B88B-7876217EE039.1; Fri, 03 Nov 2023 13:15:42 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b04f9c68425d.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 03 Nov 2023 13:15:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k0ULZqTabQvHTIAx5+9UJQTpgW11wpuF16YHXlMRrz5Z/gJlUwaSgvffilevdlYi4R9sviBt3zWm7ZgR/GMlDyhuNtGmmhd7kmC0DnbvvQVnYD9EQiDHaWw43sAWXKYIyyuQ5Wbn8aLD12+OoDc4ynE8iOuRauWeTGs0FTjrIdXp5Tq+ZjVo0OD2t637YsJvOkwpX61Z1ZJEAilVkqbVUIZZw8gIIRfyYY+GGQ+xWQMnQkCRc1i5cTusRdDNeZ2clQ5W1+1xlsk75HP5StoyVDEzT3UsG9Hv1cQfKA3AfSwPKvpK0iinTE/n4RElJSpzbRnqO/FxDb56q1LuiK7MkA== 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=vaF1mZLBmThr3UaqnDaYLAEUNZ6Vq5Gwmo/6jolsVpY=; b=BgbGwTmXni3rxjNTSXJxIPzfjC13QFloLR+dv9BD2IAW1MQkqniXHJhP1fHKTFmk0zKJ/SuQS8nqiD3jo7yy1cWS+LPHD8QO6dcv/hQ37NKEwayLZ+IuPlz8jh2gvEmHoHpsx0hsHMvAGOwODJZeno5qzIZhBOI4n5+KUYTK2rS6uakAyEuItRAE0QoYVlve52N0KhJsSgcIuA7Ik6Bxri0cHbbhTc1RoGVrJFS6/o0SXOs8Fjj3pd9mpI0KWw1FCJi5+PpE7Bp6cgYwsorZYGog1q2vFHkpYzh4LVJRUdpfPEPV69a8gNdIwQcBeWnH6cnT9e8+J09mOuQGtmyyeA== 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 (0) 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=vaF1mZLBmThr3UaqnDaYLAEUNZ6Vq5Gwmo/6jolsVpY=; b=tUh8rcstWoyXKpWMGnL/zZJh6Kbdx8ETL1LvmSGdB3t0sOjrKqGxYcLHx14xDzRupYb/4cghQ+U7NpKnesNUokHGj+0VrcXZQF19eeA0hjBN555rrYhfWgA5aPES+O1DRI2WWGeKrZO6ZzuPifUDt+HBUYlHme1+CSVyB3TpnHg= Received: from DB8PR09CA0030.eurprd09.prod.outlook.com (2603:10a6:10:a0::43) by AS8PR08MB6726.eurprd08.prod.outlook.com (2603:10a6:20b:39a::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.21; Fri, 3 Nov 2023 13:15:39 +0000 Received: from DU2PEPF0001E9C2.eurprd03.prod.outlook.com (2603:10a6:10:a0:cafe::f) by DB8PR09CA0030.outlook.office365.com (2603:10a6:10:a0::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.22 via Frontend Transport; Fri, 3 Nov 2023 13:15:39 +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 DU2PEPF0001E9C2.mail.protection.outlook.com (10.167.8.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6954.19 via Frontend Transport; Fri, 3 Nov 2023 13:15:39 +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.32; Fri, 3 Nov 2023 13:15:39 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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.32; Fri, 3 Nov 2023 13:15:39 +0000 Received: from armchair.cambridge.arm.com (10.2.80.71) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.32 via Frontend Transport; Fri, 3 Nov 2023 13:15:39 +0000 From: Szabolcs Nagy To: Subject: [PATCH 2/5] bfd: aarch64: Fix broken BTI stub PR30930 Date: Fri, 3 Nov 2023 13:15:38 +0000 Message-ID: <8a36dd5ca319bd4d0fe2425bddcf4868c3426a96.1699016830.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DU2PEPF0001E9C2:EE_|AS8PR08MB6726:EE_|AMS0EPF00000196:EE_|PAWPR08MB9613:EE_ X-MS-Office365-Filtering-Correlation-Id: e2417159-32e1-4599-4fe3-08dbdc6f0060 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: UEALdW4A/lnssrM52EZahn5GhUN7mh9oLqql11E37gZbSNNJwOMYBwtIBAA+v8YG4GN1YqS4atQTcqWVE5B31KcXBhGXKFGLeRzkrhzhdjXP+5mNrghzaFv0hQf+eVb4aTog2e5yy1z0am7ZEogWjW2MAbJT/ox1RVZClvhHWAjBIZSbHxDw1FE9XuBclqGFGUiaWcyxCWmZxng9QVqwsPNT9JemnCVtYEAKr939Me17smqr33LVyb6MgWuEuON1jkzFZ6v1O68T9b92wYm4ptlJlZIa0qjkM3EGTe2tvduYl8UloR8MtpaiUKONFRYp9eV4PLAggUILa0+nX7ZL8gZif6teAnefl+/6vrQ4vUe35guQ+nbOkRDGErCoO1M81hPCT0FHdgtJwD2LOmD0HB4YWxIB90yBW6BVnRDGOpNgkI6/VlTg5JWP+z2TAD6ZI2lake+p+TJUbTL8vLgnwNUVTpG8ip2tFG7DYcfApp1bNxTlfDYAB5nktzjS+2bvUvPkrFD+UXwg4XCTVbt1WGDIifky/KKqBo2zhN5Hg4umdfubdxxCBfwjUb9kQ4bKgVLDr0Qi+DTRlxhRUgUuUUqUOG+XgQqw0tCtSvvWGYGpgiAM4Tr2JBqm5Os/lO/u5NSGOpuQMgdW1fky7fa4PREleX3WsOH6IvmEPzt1k/3I1Yvq26HHLZW60v7eWyb5Ox1Lr9jSsubqfyMigLHH5APMrPckbKXGwhFZyVFzcZt7uFTFYEvv0RkYN8/C3suSnGrp+WD91Xa8QCGfS/Zhrw== 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:(13230031)(4636009)(376002)(346002)(136003)(396003)(39860400002)(230922051799003)(451199024)(64100799003)(186009)(1800799009)(82310400011)(40470700004)(46966006)(36840700001)(7696005)(40460700003)(40480700001)(26005)(336012)(426003)(82740400003)(83380400001)(86362001)(81166007)(356005)(2616005)(36756003)(47076005)(36860700001)(8936002)(70586007)(41300700001)(316002)(6916009)(44832011)(70206006)(5660300002)(8676002)(478600001)(2906002)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6726 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS0EPF00000196.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 7755b5c3-fd7e-49d6-7624-08dbdc6ef9b8 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +OggETco7lm7rEoCpuerqer3syf3TciHqnQVZkPkoj8lGwCnz5OdUdiznSICetSyxjC6YXq7T4IAp3p9i0DHK8FkJ55c/VX5W7FioH3vlQvjJ67sBT1wGnpOxg6KmdQorFY8QA4TzOTZxPglQP4woAO79zyn5xNQ+BPIuKOB4fcUkPRRoOsAy8cY/voocH2lEuvkQ62+4oM+2j43/MdXiv6f874Npjx2SaeHsBYsPNRuJavbosS+FYi6b5vh1WRZUp2KdEF+f6nfswhHFOgMd5m3T3n/rv6JPaRvPH/9kdOAHbwDVM33oGTZgqo1RAbUAeANOcBBbefgXHksWavPWklAOp4WM7y1P1B4LPQmizidg6joD7T/Hn+r7UflldTMKQzYACV5v8au8UaoOmUwHV+yCDvGzbfLLGxbpZ4PuIykmiRRgIWQqeoQscxJHkqcjKtmdbPJcb013wDxLWN81N73oXmU/QmhAkHiTewjC9pdQPRxLGVllIIMcEJDuTEFQV8BtUm/AR17ITewck3+GbbzBFdPZ54Y35a6onQNKnlRA0DpdWbcUYuFKWz/Jr45IUV/7kLL0SSj7T5P4HyhliBSFXKPpybatVFvOKyf6G2uKsYt5gPDk9JsphgOddwT8gTFWgu4WRrmPJH0+hpyhP88HWsul5BpJe5vz8xiJ5pkR1m/B5/D5tPynjNnx2dJRMzMdrKT02tY6icEjzQ5h+jKA78sGB49vM+GU9LZ0wtUpyDA2BB0X9qFuAew5scb 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:(13230031)(4636009)(396003)(39860400002)(346002)(136003)(376002)(230922051799003)(451199024)(82310400011)(1800799009)(186009)(64100799003)(46966006)(40470700004)(36840700001)(40480700001)(26005)(2616005)(40460700003)(86362001)(36756003)(81166007)(82740400003)(2906002)(83380400001)(336012)(426003)(5660300002)(7696005)(478600001)(47076005)(36860700001)(8676002)(8936002)(316002)(70206006)(70586007)(6916009)(41300700001)(44832011); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2023 13:15:50.8380 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e2417159-32e1-4599-4fe3-08dbdc6f0060 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: AMS0EPF00000196.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR08MB9613 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, KAM_NUMSUBJECT, 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: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781548841209738741 X-GMAIL-MSGID: 1781548841209738741 Input sections are grouped together that can use the same stub area (within reach) and these groups have a stable id. Stubs have a name generated from the stub group id and target symbol. When a relocation requires a stub with a name that already exists, the stub is reused instead of adding a new one. For an indirect branch stub another BTI stub may be inserted near the target to provide a BTI landing pad. The BTI stub can end up with the same stub group id and thus the same name as the indirect stub. This happens if the target symbol is within reach of the indirect branch stub. Then, due to the name collision, only a single stub was emmitted which branched to itself causing an infinite loop at runtime. A possible solution is to just name the BTI stubs differently, but since in the problematic case the indirect and BTI stub are in the same stub area, a better solution is to emit a single stub with a direct branch. The stub is still needed since the caller cannot reach the target directly and we also want a BTI landing pad in the stub in case other indirect stubs target the same symbol and thus need a BTI stub. In short we convert an indirect branch stub into a BTI stub when the target is within reach and has no BTI. It is a hassle to change the symbol of the stub so a BTI stub may end up with *_veneer instead of *_bti_veneer after the conversion, but this should not matter much. (Refactoring some of _bfd_aarch64_add_call_stub_entries would be useful but too much for this bug fix patch.) The same conversion to direct branch could be done even if the target did not need a BTI. The stub groups are fixed in the current logic so linking can fail if too many stubs are inserted and the section layout is changed too much, but this only happens in extreme cases that can be reasonably ignored. Because of this the target cannot go out of reach during stub insertion so the optimization is valid, but not implemented by this patch for the non-BTI case. Fixes bug 30930. --- bfd/elfnn-aarch64.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index a0dd17faa7e..798643ade7c 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -4638,9 +4638,22 @@ _bfd_aarch64_add_call_stub_entries (bool *stub_changed, bfd *output_bfd, insert another stub with direct jump near the target then. */ if (need_bti && !aarch64_bti_stub_p (stub_entry)) { + id_sec_bti = htab->stub_group[sym_sec->id].link_sec; + + /* If the stub with indirect jump and the BTI stub are in + the same stub group: change the indirect jump stub into + a BTI stub since a direct branch can reach the target. + The BTI landing pad is still needed in case another + stub indirectly jumps to it. */ + if (id_sec_bti == id_sec) + { + stub_entry->stub_type = aarch64_stub_bti_direct_branch; + goto skip_double_stub; + } + stub_entry->double_stub = true; htab->has_double_stub = true; - id_sec_bti = htab->stub_group[sym_sec->id].link_sec; + stub_name_bti = elfNN_aarch64_stub_name (id_sec_bti, sym_sec, hash, irela); if (!stub_name_bti) @@ -4687,7 +4700,7 @@ _bfd_aarch64_add_call_stub_entries (bool *stub_changed, bfd *output_bfd, stub_entry->h = NULL; stub_entry->st_type = STT_FUNC; } - +skip_double_stub: *stub_changed = true; } From patchwork Fri Nov 3 13:15:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 161293 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp1022806vqu; Fri, 3 Nov 2023 06:16:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGtDG/Y4mFI5P0xxBDdjPRCb2dvmImtUdNvniP7IM4JHt5vbyIG4QreML1+jSCMHwNZQsew X-Received: by 2002:a05:6870:2116:b0:1e9:c315:9d66 with SMTP id f22-20020a056870211600b001e9c3159d66mr24642478oae.40.1699017372480; Fri, 03 Nov 2023 06:16:12 -0700 (PDT) Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id h8-20020ab03348000000b007ba2f723240si196129uap.201.2023.11.03.06.16.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 06:16:12 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=J5YceQnP; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=J5YceQnP; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1713C385700D for ; Fri, 3 Nov 2023 13:16:10 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2047.outbound.protection.outlook.com [40.107.8.47]) by sourceware.org (Postfix) with ESMTPS id B44643857C66 for ; Fri, 3 Nov 2023 13:16:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B44643857C66 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-Filter: OpenARC Filter v1.0.0 sourceware.org B44643857C66 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.8.47 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1699017365; cv=pass; b=mO/ZrJqEyeZCvhDKXNmiKutoarvijuaVcpTAX8dhHPUccV/01vKmXXYuI6xb2yZ41NJTTdMMeUf8nH+QRS/tXpgmQZSJTWTxKatet6CQnZFQS7T8Z01VQHHQo3uiFNvfSC1bC7uyA8G474SgUCvBqYuDy0aS2caz27Eo49tj2jA= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1699017365; c=relaxed/simple; bh=SnXdbw75YJIVAFjr2v/0T0rB79NWoIPu3w+QOESJIl4=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=MNlqDJXLEu8wK5Ih2rWDfpyl7rSvTF+zOc4vEnkV5AJl0ZURh1KtdRC7b8hx5tS4gqrhG80vaEk3Pt0Q0fcYF2B7cWl1wRxNfZA3B3zkxz96gkLaTiYjETklGwJPBlKZEdFWCPiL0wDFFuI82J+pmTZZrlHP/ODnTv3z9exY2SE= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=BclBFOcWA4eVXTa+LtLJQWsUuEHt6hBzwla4eS0MXme670AewwvJjyn1eH0uZfv2DV/ihrKuHxn83UtofFhpOxx7uS27pTHHwvFRz01DBva+0aaA4rJIo+1/1OFz2FCuGjLDRFpWdR4yzKF7DE1CfRgirl1YOUTcKqA6BWowBnMmXiIb+PUDQVaRz3E/LhmrqIpzTeJeyCZ8ZP8J7WN9YUb8N7fGOgHK7St0xz02B1PWh1dg3/OSSQ0LM4PoWiNs7zaIAVf42YVUsM4nTOrlmJtr+A+coqP2nS0Q1jODTY2pIM0PJYTDRAqF7qwnaDAhMK1b79Al16v3BpuALrfUaA== 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=td8gZhFx8b5jQKw2ZDHEwMydDG6h0B+Zu9gRQLw44kg=; b=lcw1UxdEe/m8RFsP+NBo1xuMTTceLovsO4DhxqR8QT6aDFtG4sX+tw7FOEuxHmVjf2l6wLymLtA6LEMXNcDhULOPJZ2ZM+NflEbc7q+XUx+8wIG+CShlMRO5zUwFcLe0Aj6CAeyk47cmq8S3Mo5XlvR5636Tee2V4+9SMo/Ll0MGgKskldmcMd8Yi4RqVE0B2/UgxvBGPdQ9xdiHgXcAx5w1tA+rVv2HRga5C4Gx/YEFhAb/o9N9K1M9qfdiCrnWbBFCbzFY5c3Y1e4FQ8+peGHSZXb03H1918Ool0wJ0LgqwzxIXbf1I9Godn+Ly23gWV6yraGOTR6sX/WnnSv/Xw== 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=td8gZhFx8b5jQKw2ZDHEwMydDG6h0B+Zu9gRQLw44kg=; b=J5YceQnPKHwERihzk/9riFFURXdy2LW5al87EEo3nX/OaXSAvAmupgbo5cREjBj2brHHeVbQqdTdjtMNXIW7hkI4zYKXmywsZQX3J1FHaWK+GRPufIsIdLQWR4A+anLoiCXmV2QCc+1zPoZctgMtI10VGLh7b8izF45DObUby0g= Received: from AM0P190CA0015.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::25) by AM9PR08MB5956.eurprd08.prod.outlook.com (2603:10a6:20b:2d4::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.21; Fri, 3 Nov 2023 13:15:58 +0000 Received: from AM4PEPF00027A68.eurprd04.prod.outlook.com (2603:10a6:208:190:cafe::aa) by AM0P190CA0015.outlook.office365.com (2603:10a6:208:190::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.19 via Frontend Transport; Fri, 3 Nov 2023 13:15:58 +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 AM4PEPF00027A68.mail.protection.outlook.com (10.167.16.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.19 via Frontend Transport; Fri, 3 Nov 2023 13:15:57 +0000 Received: ("Tessian outbound 7671e7ddc218:v228"); Fri, 03 Nov 2023 13:15:56 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: bb91955b21dc1e85 X-CR-MTA-TID: 64aa7808 Received: from 97b6d7132f77.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 6D9A44C7-711F-44CB-80A4-151B2A353282.1; Fri, 03 Nov 2023 13:15:49 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 97b6d7132f77.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 03 Nov 2023 13:15:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IY+MoxzomQqs+S3wr3uFMSwzjWC4ai4k/gQV1/wZD9U7r6nm55nSOb1bx9/ozqwu5vyMoYkJDlP2NVwyiexfbXMlii2uzdV790N1t1boFZXIVPXfSt030YP/HJrkvWtTnS0Jc4EGHawtk2xyySrxBlMpOPr3A+kwcx7k8bAezM470Du8c5mzKK+SV4HK67qy4mZQlx9mA6CJH6QmH//rgwiDGr9UNz6yv7iYY5Nqyjhs8ozH6xgYw14NQu7GykiwxOVeW3f2OFZWeK4dg2HlcIFOCOibV3mWi9V46gHDWNkzoeOKozs2oZGzXtIRzc1tjy4JkCGfr/1Uvqq+nh78fQ== 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=td8gZhFx8b5jQKw2ZDHEwMydDG6h0B+Zu9gRQLw44kg=; b=JTKsoWRy7LM1w2WSf11bUBNoxYW922558/N3cAE3xJt6GHPQS+7jNCGp98OzBcCSOz/YNe8iyFfdwurj6V+50AbV7DA2RkXn7Rew2sVq2JBAoaKyMRorkXBXAWeoMJ+gBLRpYBmXW8kVcd54407Qa5HaXI1Lle2ddvgLbIxCj/So3oIRZRUTrUrcVm2q1QIib1mXK5vp8sb7V3QTeAVOdao3f9xpYbXmIO4yRhOC4KDQ3D4BAyhs9bXDGtpOsLvMMxMPugLOh/WKMPgNAnkxomV3JxrIQRLKuTT1uUEpq/pPMTWnRFv7K3JEQQV7LuCRPYbGY+feT3mAptTvuaejPQ== 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 (0) 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=td8gZhFx8b5jQKw2ZDHEwMydDG6h0B+Zu9gRQLw44kg=; b=J5YceQnPKHwERihzk/9riFFURXdy2LW5al87EEo3nX/OaXSAvAmupgbo5cREjBj2brHHeVbQqdTdjtMNXIW7hkI4zYKXmywsZQX3J1FHaWK+GRPufIsIdLQWR4A+anLoiCXmV2QCc+1zPoZctgMtI10VGLh7b8izF45DObUby0g= Received: from DU2PR04CA0249.eurprd04.prod.outlook.com (2603:10a6:10:28e::14) by AS2PR08MB8502.eurprd08.prod.outlook.com (2603:10a6:20b:55d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.20; Fri, 3 Nov 2023 13:15:45 +0000 Received: from DU2PEPF0001E9C5.eurprd03.prod.outlook.com (2603:10a6:10:28e:cafe::54) by DU2PR04CA0249.outlook.office365.com (2603:10a6:10:28e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.21 via Frontend Transport; Fri, 3 Nov 2023 13:15:45 +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 DU2PEPF0001E9C5.mail.protection.outlook.com (10.167.8.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6954.19 via Frontend Transport; Fri, 3 Nov 2023 13:15:45 +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.32; Fri, 3 Nov 2023 13:15:45 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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.32; Fri, 3 Nov 2023 13:15:45 +0000 Received: from armchair.cambridge.arm.com (10.2.80.71) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.32 via Frontend Transport; Fri, 3 Nov 2023 13:15:45 +0000 From: Szabolcs Nagy To: Subject: [PATCH 3/5] bfd: aarch64: Fix leaks in case of BTI stub reuse Date: Fri, 3 Nov 2023 13:15:44 +0000 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DU2PEPF0001E9C5:EE_|AS2PR08MB8502:EE_|AM4PEPF00027A68:EE_|AM9PR08MB5956:EE_ X-MS-Office365-Filtering-Correlation-Id: 656d0bdc-d89c-4393-0a65-08dbdc6f040e 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: T68YmnhOdAzsFY6IS/DiKJ/4iqhajNLposQURfLT3htAslyIwftyfDXTn2eimWbk8Zy+9S3RM6xuJf5ix468hvzpkP4nFDJkS2UAGNRu6AKo02cb/j82kfRyNmk1e11it6dVAuxQd4FQkx+WudU/Zz9xj2sfJT/yYcOZk4BOOQZlYzm+uTCtYvncKMi2jreBfayqzcNf8TzB4cBn90riroG+pQxsFZ1UbAZRNa3sLoDdkbx8B1AuhuWtGwq1o/qpqN9CVr7uCgEAwmhkad0CSOqt4ucWwom3ddT7crwSX2/ZajfVWcyMXgWHxGq+yQ88UX6ZeF/cKbwhsCut32IwaVSMdx7ZWv1CbV3qFccJCdhS7mUQtYVfmuOlK9dPtkh0qKQ320iGL7MoImDonw1+uP2K6Q3BDAm04OVTcu+FBXlobHlFjz4LFZdympizjKOzbMl74jLQsnlglyHHpP9/LGOZpYzbLj/PMGZ0mRvic6jgy914u46y8ySqLz85FyUBwsoyFZXGp8ZIvCbESQaAbQZc8Oz+s8R1+3oaLXJpz6zYYJQxTafemqGz+AGALaX4DsJzoeDlFqvf4im9oqkRKT8tSLmjj8vINyzrdX0C8tJNj1vxD8j3CsHOXwuYu026bFcCXDHyb3lmt0NI41ertlvji3HsOWSVQp5SVz3A77FMqwpciAlFehyzx4v2oYFnjoCeNUUPdTgWhsJvxLIRP48RRpTMJVe4ROjv/6KSn9kM5cmhywV7zbTZf1ios5o8NRUbR1l/Dtx3A4I13o+8Dg== 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:(13230031)(4636009)(39860400002)(136003)(346002)(396003)(376002)(230922051799003)(1800799009)(64100799003)(186009)(451199024)(82310400011)(46966006)(36840700001)(40470700004)(8936002)(426003)(8676002)(316002)(5660300002)(70206006)(70586007)(6916009)(336012)(2906002)(40480700001)(44832011)(41300700001)(478600001)(40460700003)(7696005)(26005)(36860700001)(2616005)(47076005)(36756003)(83380400001)(82740400003)(356005)(86362001)(81166007)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB8502 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM4PEPF00027A68.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 77508e00-3352-459a-2d1f-08dbdc6efd5d X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i5UjRqNEWIwuQeh4f7oBgjEM/JYPUJn6VGSkkbXHj5e0bgiAgNjBjM5Pk9KeOSkaDzViwnH/Qq1M11DJJzT5NhnTsgOno0/zllPlBS74Id+6qdUXNLXIiBoIC15HpX2R2JQY3ovziNzz0fIo9qRo5Pnvfhzl68HXwiysJTuuhxWCrBzyd4MLxPKgOYUHCrRk0bpB0D8m4Usm1qan++dCw6+9yff64zznjN9RDsq/ye7o2bEU+H4vRmdTonceDyTedZIGu6d/teeMrRS/VeAf/Umxhg0T9VygtYK6Sycj8/OIiiVVU0sadHcjH4YJNd/FgvX9doClS7PudMlo/48C3TIp4GmIuZWDzzibjWFhz06bhtTzA97hIWeHFA5dJqeR1hlVrSqDhoGLGtMpp0XhekKYfw1byWbPV8F7wMEdxhtBLbJMWndUOVQcMlRrPPeI49cVUcX1SIUH7azDJSUR9VM03uOpZb7AzfVje+rvO4+SkLgQO5b+4vbsTZn+MFbdCotBzUwBhcj4UWw/MLbqiTG72UnGYeaqCCPWqrRAbKsVuLnepZbRUZpDkYOcHZBNEYOtWsNniZPzY196OUWAWCmtybF6IkNc2/A8aunKGs9POTYfu/HbMzKt5Cri2AHnfAxmDEcudR4+vg/DLIkBGqn6lS4ujg8+fdxgwMzlk/NGo2EP8h6wtkYmkfOPp3FK2wHHK60TOaeAS3oNslX7FgU7inqg0AHhGv1m8ZtjWbDpkyEAX4ZW1j5sCamwbXbR 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:(13230031)(4636009)(39860400002)(376002)(136003)(396003)(346002)(230922051799003)(64100799003)(1800799009)(82310400011)(186009)(451199024)(40470700004)(36840700001)(46966006)(7696005)(36860700001)(478600001)(6916009)(316002)(82740400003)(26005)(2616005)(70586007)(70206006)(426003)(336012)(8676002)(2906002)(8936002)(41300700001)(86362001)(44832011)(5660300002)(47076005)(36756003)(81166007)(83380400001)(40480700001)(40460700003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2023 13:15:57.0097 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 656d0bdc-d89c-4393-0a65-08dbdc6f040e 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: AM4PEPF00027A68.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB5956 X-Spam-Status: No, score=-11.5 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: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781548840394216919 X-GMAIL-MSGID: 1781548840394216919 BTI stub parameters were recomputed even if those were already set up. This is unnecessary work and leaks the symbol name that is allocated for the stub. --- bfd/elfnn-aarch64.c | 56 ++++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 798643ade7c..3adece30250 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -4665,33 +4665,41 @@ _bfd_aarch64_add_call_stub_entries (bool *stub_changed, bfd *output_bfd, stub_entry_bti = aarch64_stub_hash_lookup (&htab->stub_hash_table, stub_name_bti, false, false); - if (stub_entry_bti == NULL) - stub_entry_bti = - _bfd_aarch64_add_stub_entry_in_group (stub_name_bti, - sym_sec, htab); - if (stub_entry_bti == NULL) + if (stub_entry_bti != NULL) + BFD_ASSERT (stub_entry_bti->stub_type + == aarch64_stub_bti_direct_branch); + else { - free (stub_name); - free (stub_name_bti); - goto error_ret_free_internal; - } - - stub_entry_bti->target_value = sym_value + irela->r_addend; - stub_entry_bti->target_section = sym_sec; - stub_entry_bti->stub_type = aarch64_stub_bti_direct_branch; - stub_entry_bti->h = hash; - stub_entry_bti->st_type = st_type; + stub_entry_bti = + _bfd_aarch64_add_stub_entry_in_group (stub_name_bti, + sym_sec, htab); + if (stub_entry_bti == NULL) + { + free (stub_name); + free (stub_name_bti); + goto error_ret_free_internal; + } - len = sizeof (BTI_STUB_ENTRY_NAME) + strlen (sym_name); - stub_entry_bti->output_name = bfd_alloc (htab->stub_bfd, len); - if (stub_entry_bti->output_name == NULL) - { - free (stub_name); - free (stub_name_bti); - goto error_ret_free_internal; + stub_entry_bti->target_value = + sym_value + irela->r_addend; + stub_entry_bti->target_section = sym_sec; + stub_entry_bti->stub_type = + aarch64_stub_bti_direct_branch; + stub_entry_bti->h = hash; + stub_entry_bti->st_type = st_type; + + len = sizeof (BTI_STUB_ENTRY_NAME) + strlen (sym_name); + stub_entry_bti->output_name = bfd_alloc (htab->stub_bfd, + len); + if (stub_entry_bti->output_name == NULL) + { + free (stub_name); + free (stub_name_bti); + goto error_ret_free_internal; + } + snprintf (stub_entry_bti->output_name, len, + BTI_STUB_ENTRY_NAME, sym_name); } - snprintf (stub_entry_bti->output_name, len, - BTI_STUB_ENTRY_NAME, sym_name); /* Update the indirect call stub to target the BTI stub. */ stub_entry->target_value = 0; From patchwork Fri Nov 3 13:15:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 161295 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp1022911vqu; Fri, 3 Nov 2023 06:16:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEC723+1hQa/NyQec0F+GgL/WEIyRc8NDbvfhQSLMStSZEwTbgUsHMfgQvHXVLhchlWWFAL X-Received: by 2002:a05:620a:51d2:b0:767:e993:5702 with SMTP id cx18-20020a05620a51d200b00767e9935702mr20062965qkb.35.1699017380302; Fri, 03 Nov 2023 06:16:20 -0700 (PDT) Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id m18-20020a05620a291200b0077a02a27b8fsi1555901qkp.354.2023.11.03.06.16.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 06:16:20 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=DpgeWwAM; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=DpgeWwAM; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1FAA2385697D for ; Fri, 3 Nov 2023 13:16:15 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2058.outbound.protection.outlook.com [40.107.6.58]) by sourceware.org (Postfix) with ESMTPS id 1083A385770A for ; Fri, 3 Nov 2023 13:16:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1083A385770A 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-Filter: OpenARC Filter v1.0.0 sourceware.org 1083A385770A Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.6.58 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1699017366; cv=pass; b=H6jnyUOr2OPPJDDrWYn9qEhxAX3UFQ/UFRVoYaZAqZyS9tLuMp6DfjRPuXkiDlY7dsWhCEiYjFfk9DZaYVcu5RK581shIDD05lyHrfm1WQIkL0HV5mfWvGWkfDjRCQh2yQT2SBBJIREoKKDrSFkuo3xB72nCCcThTyKhg2t4WsU= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1699017366; c=relaxed/simple; bh=TqHTso9Po9RTFGMviMW5GXp5MfSPTZWGQGCLYH4FCgM=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=j1+A49oyHahKcFYQx4FT94W2WmdYoz1EvRjvCkGBNmEKqm2TBY3olEFnA+Wyd7IFc+raiIc900yQk2zPytSdgkHEOXatVAscxWp9m6sEnfuObE4u7GAxvuTdhwZYk8yWDrPo3FkoW3oSN65kcODx8qHtx2eB2aWbzWuZBQ5LgyE= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=nGs2raF1DzwV3ko5ufwQW4rCd8UjSY7USNNJTIJ8ijsSxjiaCwORcWvPwV2TN+OVxIjdohgYqKvDpiOl332OMEcvkX5zjgjVIT4diZhpr11QOSoXsWsAllw5h4eKmrY1BuYIkS61iGvLnIHuAA+5KA/kIBFogsvD39131zyKqDXsWXyCcrCLGWjehplTyyctyZKHLPBCUzVcOq6yKypj47YBj8DsQ+jtqYG0r7wj1eDl6CvpnRvUeqtwlZrff+UQlpupAE1bqECd30jCVfeVGTKwEixgqgz5aTxV5dQjLeVAEEEiiZakVnHhiR9icQDfBN4ow/y2s2R00NS6UsGoLg== 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=t9uX247KXXyBZPiOdFmU51wCR+urD4pU5I26eexcf/E=; b=llwTvbqwZ/WE/i6j0NzgidGXKhNzjeEC3PS4Q+/GS03M5T+n/kD7mFUoUU6lu1USJTXeDzmvsJfxzD98YCU9Q1QvLQKCx3vNNODJLM0HT1kAfJvXZuzcj5TQxv9N0ZhLNrMLyUizUX/WOxd8z0/awjPn1qgb68vis0zDoTk4VV+vsHlhKMJfnHWqlaj4jAer4b+ulhsNz+ME2ucukb96LbDgS9zi4E5bm6xljd85/z8mQOHMAaR5QZDzC2AfiywSK9LKW3XWLqOzQVtofT0qiY99JGgsYiAtYVYZ4HNC6FxwReqXuRfzyWbLDbjbwT8JYFZgDtwepY9AOomttcXyVA== 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=t9uX247KXXyBZPiOdFmU51wCR+urD4pU5I26eexcf/E=; b=DpgeWwAM3lcUxP5mDWGG6qgTHIKXmHgP8v+JMLOBREKwSQplK6dfmbSZyJKcJ7tezLuYmpZb8Uoy9NoZtgAPgO3/KiTu8iQQxGbB0p+leZZtlWgRaI2HBII6rnwsr0huZpCEmyYSuQLL2P5QX/YfeBbJAV19HlNE7q8eKpyWJUU= Received: from AS9P250CA0018.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:532::21) by AS8PR08MB6008.eurprd08.prod.outlook.com (2603:10a6:20b:29d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.21; Fri, 3 Nov 2023 13:16:02 +0000 Received: from AMS0EPF00000198.eurprd05.prod.outlook.com (2603:10a6:20b:532:cafe::95) by AS9P250CA0018.outlook.office365.com (2603:10a6:20b:532::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.21 via Frontend Transport; Fri, 3 Nov 2023 13:16:02 +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 AMS0EPF00000198.mail.protection.outlook.com (10.167.16.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.19 via Frontend Transport; Fri, 3 Nov 2023 13:16:02 +0000 Received: ("Tessian outbound e243565b0037:v228"); Fri, 03 Nov 2023 13:16:01 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 4f4845eca05564de X-CR-MTA-TID: 64aa7808 Received: from 24b9de0efca5.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 68C3EC06-DAD2-4604-94ED-C83262CFCD83.1; Fri, 03 Nov 2023 13:15:55 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 24b9de0efca5.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 03 Nov 2023 13:15:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QWOGDcFi0bdUuwpbZwtdqcjWcEm+IooaApISwpulBEbXGZG+z5zM92d/iJwDdiKw3SJAgRI0IfxnoF6N1qMyHr09tXOg8BaU1kZxN9mCFGzCtH+LDf6QCcSvu7nOvbeTKiaGGRs6Xj1QfO3a7ZtGtuP9CuIGHo8LlSfrNPy8mO+D11j20/l5kO8IJzVzeZz93XThQSMtTSowHi2PZ2usl4VCVT7rX//0wQfjGBMwVu162oiHUVKiSP0T329F0exEz/R82PkQEag0IsVcWhpdhOdTPnWePndeu6dZtBijpXCdZgrMzBLAJf+K4zSVVyX4KxaTIKQ1OYD46mhmWgGLRg== 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=t9uX247KXXyBZPiOdFmU51wCR+urD4pU5I26eexcf/E=; b=h3E5hxL0NcVCQ5y+U4+oda+2oG+z95pw8R+mrLiVWwRCC492QmDnF+oS4R9wdZDRumgwR0v38IcJJuXc6INcLLhbPBngbamn6tlikLpXQ+KCSMXiXRaFaYtMecE0sF9dldPm1vMM9tbzFwUyouaBXQCRwJBVHrKG3g3UQhL5S7cUOEgW5PMvjvcurXzpadePW/EVBzEw041tnyQPsCAV+MzGuypfT7NPY4BmZ9IMLF7i64Iao840BgkLH5gyzyd+0UEWBhEAPzpV0Qp02JQy/lcvZj4IHlKMYgDVq65+829gn0tcFAdgYGclY626XgO6PY0iPv2oMX7waQBHj4nuKg== 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 (0) 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=t9uX247KXXyBZPiOdFmU51wCR+urD4pU5I26eexcf/E=; b=DpgeWwAM3lcUxP5mDWGG6qgTHIKXmHgP8v+JMLOBREKwSQplK6dfmbSZyJKcJ7tezLuYmpZb8Uoy9NoZtgAPgO3/KiTu8iQQxGbB0p+leZZtlWgRaI2HBII6rnwsr0huZpCEmyYSuQLL2P5QX/YfeBbJAV19HlNE7q8eKpyWJUU= Received: from DB8PR06CA0060.eurprd06.prod.outlook.com (2603:10a6:10:120::34) by AM8PR08MB6595.eurprd08.prod.outlook.com (2603:10a6:20b:365::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.21; Fri, 3 Nov 2023 13:15:52 +0000 Received: from DU2PEPF0001E9C6.eurprd03.prod.outlook.com (2603:10a6:10:120:cafe::a6) by DB8PR06CA0060.outlook.office365.com (2603:10a6:10:120::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.22 via Frontend Transport; Fri, 3 Nov 2023 13:15:52 +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 DU2PEPF0001E9C6.mail.protection.outlook.com (10.167.8.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6954.19 via Frontend Transport; Fri, 3 Nov 2023 13:15:52 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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.32; Fri, 3 Nov 2023 13:15:51 +0000 Received: from armchair.cambridge.arm.com (10.2.80.71) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.32 via Frontend Transport; Fri, 3 Nov 2023 13:15:51 +0000 From: Szabolcs Nagy To: Subject: [PATCH 4/5] bfd: aarch64: Avoid BTI stub for a PLT that has BTI Date: Fri, 3 Nov 2023 13:15:50 +0000 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DU2PEPF0001E9C6:EE_|AM8PR08MB6595:EE_|AMS0EPF00000198:EE_|AS8PR08MB6008:EE_ X-MS-Office365-Filtering-Correlation-Id: da05a163-fb6a-4351-3978-08dbdc6f0735 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: VlVrYqfONLVQCtcrUojWK70afJfsw+y9getVnnYlLCthh/m1oiCC009nYlZFXawtnSAK/L2gL1V8EdxrrOC/xMPO9ABP8BeDOzBKEUn+PCTmxiidwrkJ45On7qX64KAs1BMmJGw1BMJZmz7N6VsoZhhR7+5oh5dEUZdES3V12LGPwA2s1vbxMKGh+t/CPh5OAAgkxk8UceYfIT4T3S+ZMbD/b6+4KbNDLzPBbl1MtQspunV9E01Cd+JfIoFDRzH3BekFLa69TVWM63J3fXu4fczcO0Q2A7aqpqOr5Aceul2ww0nGRM8P7nzrPOH/b2rEA1WK5X4sNVf7zI9GUun/MLNt8rJzvYiT9Co0hMwwIahFaZneebRZ1tnLvjujR5xxIre5TBUHkrKUl+cQdSy2OszOR7vKjPNRfgayvhJBQOmUVLL1OG/BFvryRtJiAzkpicgVSxnMN999IAFFMh5tbEqHq3JTC+nxOa19JPAESK8utmYY+GUQpUvf5Zr+Dvg8C/AbtGzLw0/Ov48Z+T1c6RyGY1yQskUQOvQPbcx2nKtSRdC7EiF/+Gs8EwhLXoKIjpKWkEpnNjvmHRDHFuIu537qs2tH3Ri80A9fmcRzO+iwYEtTJ8UwJHnVBwjD2bNaO86Ok17peDpWHibgRlkYb80/nUlqmly8RGiscnIU7m9xPJlJw2/kMuy4Z0vLIoABlBMA7E6OT87xnyftK4Xh0Kf8uZTkTdK6L6LiAFDc+xelgeCkGlz+RZddZ/MXBHuKx4HQIaRVfb9UaaD5fK5ntQ== 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:(13230031)(4636009)(396003)(376002)(346002)(39860400002)(136003)(230922051799003)(64100799003)(451199024)(1800799009)(82310400011)(186009)(46966006)(40470700004)(36840700001)(2616005)(40460700003)(40480700001)(26005)(6916009)(36860700001)(336012)(7696005)(83380400001)(2906002)(47076005)(478600001)(426003)(5660300002)(70586007)(70206006)(44832011)(41300700001)(8936002)(316002)(8676002)(356005)(82740400003)(86362001)(81166007)(36756003)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB6595 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS0EPF00000198.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: ad9bd043-a1f1-4a1e-2897-08dbdc6f0185 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zPfZGtD+GuJ32ULGJdHlvgG0X64ZRvVcv6YUDvL4xew9mGiwsWvNzzh0edvZNLlLaOjTB2uC5J6wd5l//6eDlO95rHN2Sf/RHZDm5COQHYmhI4wWra42jobUgGzIxvPGmlrhd56ArDvKoeMRzc4TFqsQYvNz1z7Pnk3f4kkETsNkJVz1rJs+seLwzVqtlAwHnu6y3n/ux94/0HNa3DxVt6JFww//L/EhUUt25E+Isabxwn4ZbS9Aoj2VBr3DsxcSveVql6D7j1B0LnmO82wkRYeH8epuKt3ffLzbGfuXzvAY/bQmH7BJNya6SiXShtsdOamwOSXD4n1YvLf2gsOaYqQ85NPiAbuo7FVmIIw4NhAMBwztO2UAi5/xnxfKTonb0NX+Zb3fqJDhAJT2MtIidoJ2dk0yf4effpoum7laWwc6BSgOFFocOB1yDM1Ym/lFjcWKaUMVUKwMqayT175hw4H3Cpd09ljr8ZEYA6gustPvKHAIQoWEFDDk6lPh/mPBSUzQ0Ev6iK8XPVsBUiPIpGh9rCzcpYQyipTp3rMjobAzDemOxYPpbfbB3nkDNEtnI8T0+ROt2KvRh4Phr1FRIbkhEO7mwqQiKelSGU46hLf8jMYv2JPelzv79hsZTpXMlXJNKbtHO5TXUrtUXSzUm7v4pwaCtt3cLwRIlbmpbnJOPejybi12Dd0ehFfDdRH7C1qMWOWRNdRS4ZkgHz9eBEgTiivl1pp3OXVAiUqEzGKy26IpUY1LXi1IumzS6V9M 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:(13230031)(4636009)(39860400002)(396003)(136003)(346002)(376002)(230922051799003)(451199024)(1800799009)(64100799003)(186009)(82310400011)(36840700001)(46966006)(40470700004)(40480700001)(40460700003)(26005)(2616005)(478600001)(36860700001)(7696005)(47076005)(336012)(426003)(2906002)(83380400001)(41300700001)(44832011)(70206006)(5660300002)(70586007)(8676002)(316002)(8936002)(6916009)(82740400003)(81166007)(86362001)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2023 13:16:02.2841 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: da05a163-fb6a-4351-3978-08dbdc6f0735 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: AMS0EPF00000198.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6008 X-Spam-Status: No, score=-11.5 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: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781548848511304684 X-GMAIL-MSGID: 1781548848511304684 We decide to emit BTI stubs based on the instruction at the target location. But PLT code is generated later than the stubs so we always read 0 which is not a valid BTI. Fix the logic to special case the PLT section: this is code the linker generates so we know when it will have BTI. This avoids BTI stubs in large executables where the PLTs have them already. An alternative is to never emit BTI stubs for PLTs, instead use BTI in the PLT if a library gets too big, however that may be more tricky given the ordering of PLT sizing and stub insertion. Related to bug 30957. --- bfd/elfnn-aarch64.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 3adece30250..4faf642b422 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -3675,7 +3675,8 @@ group_sections (struct elf_aarch64_link_hash_table *htab, /* True if the inserted stub does not break BTI compatibility. */ static bool -aarch64_bti_stub_p (struct elf_aarch64_stub_hash_entry *stub_entry) +aarch64_bti_stub_p (struct bfd_link_info *info, + struct elf_aarch64_stub_hash_entry *stub_entry) { /* Stubs without indirect branch are BTI compatible. */ if (stub_entry->stub_type != aarch64_stub_adrp_branch @@ -3684,12 +3685,22 @@ aarch64_bti_stub_p (struct elf_aarch64_stub_hash_entry *stub_entry) /* Return true if the target instruction is compatible with BR x16. */ + struct elf_aarch64_link_hash_table *globals = elf_aarch64_hash_table (info); asection *section = stub_entry->target_section; bfd_byte loc[4]; file_ptr off = stub_entry->target_value; bfd_size_type count = sizeof (loc); - if (!bfd_get_section_contents (section->owner, section, loc, off, count)) + /* PLT code is not generated yet, so treat it specially. + Note: Checking elf_aarch64_obj_tdata.plt_type & PLT_BTI is not + enough because it only implies BTI in the PLT0 and tlsdesc PLT + entries. Normal PLT entries don't have BTI in a shared library + (because such PLT is normally not called indirectly and adding + the BTI when a stub targets a PLT would change the PLT layout + and it's too late for that here). */ + if (section == globals->root.splt) + memcpy (loc, globals->plt_entry, count); + else if (!bfd_get_section_contents (section->owner, section, loc, off, count)) return false; uint32_t insn = bfd_getl32 (loc); @@ -4636,7 +4647,7 @@ _bfd_aarch64_add_call_stub_entries (bool *stub_changed, bfd *output_bfd, /* A stub with indirect jump may break BTI compatibility, so insert another stub with direct jump near the target then. */ - if (need_bti && !aarch64_bti_stub_p (stub_entry)) + if (need_bti && !aarch64_bti_stub_p (info, stub_entry)) { id_sec_bti = htab->stub_group[sym_sec->id].link_sec; From patchwork Fri Nov 3 13:15:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 161303 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp1046452vqu; Fri, 3 Nov 2023 06:52:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHCyyFx1UcO+ENbgnYKX9/g8FgUnNs+uMZMvyEEuUqZ5terUfAFgACa3wm6Y1xpirgZvgOS X-Received: by 2002:a05:6214:1cc5:b0:658:2220:d833 with SMTP id g5-20020a0562141cc500b006582220d833mr25023330qvd.0.1699019548714; Fri, 03 Nov 2023 06:52:28 -0700 (PDT) Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id e12-20020ad450cc000000b0066cfda15c48si1425035qvq.474.2023.11.03.06.52.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 06:52:28 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=NqrJCutT; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=NqrJCutT; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 899433858425 for ; Fri, 3 Nov 2023 13:52:27 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2076.outbound.protection.outlook.com [40.107.6.76]) by sourceware.org (Postfix) with ESMTPS id 4B1293858C50 for ; Fri, 3 Nov 2023 13:52:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4B1293858C50 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-Filter: OpenARC Filter v1.0.0 sourceware.org 4B1293858C50 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.6.76 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1699019540; cv=pass; b=uLRm4M0KqITI9kRGBkhANB+sqWHvYAf0K+ucoJPa05xj+Vq2c0mfOrV5hoiy5jpW+bGGYsVKAxRaa3EqGt63d07loFSL5KTYZcwQKOlI1mXOm9XnBs47tNmzC7JKvXQ7O5BZD/a5rvcnnMJiNoFs/iUwp7thXj9tclzKe/4YemA= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1699019540; c=relaxed/simple; bh=PB+qmqoxkslW/y3m9osa4TubXw6c+gkWOenI8J3MWWY=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=kyvtPCh4TunXXPoSvcrCyEoidVsQNyYtTHYA1sRK6vi6nGBjJCuq5QrqaGdD/bv0WDhfHR+j62qaRcWsXnDgjOIX8Bl7dgnrvHNXzSpRKjLZcytGHLqNeBneJ3uezdCPQ9k6ZGsshcQbQgWS07ujsvb0CJx7NBS2VjTCekYl6iA= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=CswcnINcgQEwmH3t8nFxtEt+swyj2sg8LBjWuiYLYVBb/DLxqH6NG3iN6+OgbjdJmVtTXyOMtO05UNg8PSgMxVOHL/ww3Ij1b9hDp4Dt6DbfvgggkQGqLIlv8kfjrvGDpEBmXfTQA5DpchpMmvRxrJ+PdG6R7HbM1zwBZnKHKlUYdyp4Chs9mnDmiu194Zdws/wQ2bbX3rJCjh3WkuDo780glqg92VktzQdwAWcjucRSzjlhfQtxobPD/Ce13h2NjcPcopbcPlJvvV1F9vZ42yCcCsbCh39etdkImTX9NL6flM9M42Ohjm247N8RWSx7C40sz3zq7U18vVfce9ns3g== 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=3AqEx0Fxl0OJ4+YvY1MFPN3kznMoURc3OcIY8tuGf98=; b=ZUybRS7nkeEinSs0W7hSGzaOQAQVrTXoOnnUBDbiMV45DnBnRJHTO+FljWT7nRJC3Ynj2PpGMCukt/JB9jQxeAinzC3oJ4ZOsPN/l5ufWrgqmue9bQuCoyftw5NWZEKQ6glNpQOZEypODNiy1gIpjX7Fbike2Cch7bBLsyZUOWykNKJtPlkIDOn/ma29MGhD0bWTFYHl2tLTHhBgNwGnFJbCqgXNGogmyuMV9qEswKbB5GIWaadAIOvkarRU+gsC96031YRiglXHKs+TH+/GxgV06n0Tkn54NpUhaOVXaWb2eB7SZEW1eCrWtEnjwDFoUoU5HMufIst5cXqrhzIGBA== 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=3AqEx0Fxl0OJ4+YvY1MFPN3kznMoURc3OcIY8tuGf98=; b=NqrJCutTHGU7WmURmZgC1WP3+aOZTdmvSH5h8leH+1r/9YCZkgxnG5Cm1mHfksXkEtqcVQcUtM8UGu3M3zmYaCzynz8VRpN0IAF3VTwJeNQ6ZbhAvks+4tmWH9RpnNv1YsF152jMOAaiWssGsYvCnqMQCl6et85skg4eU4AwqVQ= Received: from AS8P189CA0047.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:458::27) by DB9PR08MB7844.eurprd08.prod.outlook.com (2603:10a6:10:39f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.21; Fri, 3 Nov 2023 13:52:07 +0000 Received: from AM4PEPF00027A6C.eurprd04.prod.outlook.com (2603:10a6:20b:458:cafe::bd) by AS8P189CA0047.outlook.office365.com (2603:10a6:20b:458::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.22 via Frontend Transport; Fri, 3 Nov 2023 13:52:07 +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 AM4PEPF00027A6C.mail.protection.outlook.com (10.167.16.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.19 via Frontend Transport; Fri, 3 Nov 2023 13:52:07 +0000 Received: ("Tessian outbound 8289ea11ec17:v228"); Fri, 03 Nov 2023 13:52:06 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 1084e87ff2ac7b63 X-CR-MTA-TID: 64aa7808 Received: from 6509518b4fa6.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 878355D3-D527-4DF7-87DF-574F602A8DC3.1; Fri, 03 Nov 2023 13:16:02 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 6509518b4fa6.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 03 Nov 2023 13:16:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a4HB1SwHfYWsXQ2j1kZngKKjhx4jrQV/4GNNzMg/vmoh+hyKWNgXgWV92zNYFJROQ0mNcM30kIOWCiP2LJlQm/G968Cr/2Q0LNHKe8qsg8fX540EC7iuXpYi8WFUULSRHiJakfYfCHz8Z2IJsFcLRJhtSWRVwSvF5WOiOJzA56lM9cyplrO25cEKYsS4ssXh+vLp8ifJE0Vhcy0Meu5y+LmHiI3yZlQmzTxgotOnilQrcnrvTpYNlXOOQUU/jIpzv4uQ39i8dIfsnZdPYf78rxp6X6Ws6ZZZ/yf7Y0uYqUidX+vhNBzpTx3/N30qq6tbGcKHyaaEP2zxI4LSAHczng== 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=3AqEx0Fxl0OJ4+YvY1MFPN3kznMoURc3OcIY8tuGf98=; b=CaZvBVZzkJE7Zev+NGISra1Jhb6vFfpWVWQBUn7DR7YT+ZmX6Xuz4CCPo5WUEfXsrud1oY/oPu0TAq1418NxPCxWdPRbF+b+DJJZXoMSRFiuldhfWrCBLc9SbvtkGx9UwIIu6XQn4uWs4Sh3HvWEHn+ssPJWxEX7CHmwydS/xpivRpPbLckwpaPoe2405/9IV63gP50Z6/oGyyj7YvgdFJNXOwzi0D7UZE3tE7DFcYI56uxmWj91BwfFKOL30/Z2/pAPCTACgwyJzsEkojZoJ0y1TIzFvhMQSedFSmTlksO7yW46OymWQi+sZOLA0MNdIAxQEHF2B8frQ9zWEJ33Fg== 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 (0) 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=3AqEx0Fxl0OJ4+YvY1MFPN3kznMoURc3OcIY8tuGf98=; b=NqrJCutTHGU7WmURmZgC1WP3+aOZTdmvSH5h8leH+1r/9YCZkgxnG5Cm1mHfksXkEtqcVQcUtM8UGu3M3zmYaCzynz8VRpN0IAF3VTwJeNQ6ZbhAvks+4tmWH9RpnNv1YsF152jMOAaiWssGsYvCnqMQCl6et85skg4eU4AwqVQ= Received: from DB8PR09CA0008.eurprd09.prod.outlook.com (2603:10a6:10:a0::21) by AS8PR08MB9930.eurprd08.prod.outlook.com (2603:10a6:20b:564::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.21; Fri, 3 Nov 2023 13:15:58 +0000 Received: from DU2PEPF0001E9C2.eurprd03.prod.outlook.com (2603:10a6:10:a0:cafe::7a) by DB8PR09CA0008.outlook.office365.com (2603:10a6:10:a0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.21 via Frontend Transport; Fri, 3 Nov 2023 13:15:58 +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 DU2PEPF0001E9C2.mail.protection.outlook.com (10.167.8.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6954.19 via Frontend Transport; Fri, 3 Nov 2023 13:15:58 +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.32; Fri, 3 Nov 2023 13:15:57 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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.32; Fri, 3 Nov 2023 13:15:57 +0000 Received: from armchair.cambridge.arm.com (10.2.80.71) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.32 via Frontend Transport; Fri, 3 Nov 2023 13:15:57 +0000 From: Szabolcs Nagy To: Subject: [PATCH 5/5] ld: aarch64: Add BTI stub insertion test PR30930 Date: Fri, 3 Nov 2023 13:15:56 +0000 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DU2PEPF0001E9C2:EE_|AS8PR08MB9930:EE_|AM4PEPF00027A6C:EE_|DB9PR08MB7844:EE_ X-MS-Office365-Filtering-Correlation-Id: e246f9ca-e47a-49f4-6658-08dbdc74117d 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: BzfQU/9QqJl++/rvTwJ+icGgjDhcSn7ItlKzuUB6HKMK9quwe5WJDqv/ZSvslEFvO3mzXAWYuDfYQ9a1pwVgCYLAADYn5IDqeaink6R6A79I8VWEdlDO/oD1JLdy3InjKq/91Vm6RujSUZm67p+Fe/VEvnUlVdjIoo7eUHhLHb2DQIe8EhgAy8mbV4Bju5p8bCggdaUjdcnILGrzmpYVzSg4O82S31//wbaDlzqxpR3g5n9DnMr65qk0WiodJW1U7xfj8oHo1F+gwddgqOpP0OX0si6zedYKjp8kMj3t2Rp/08QOn+wm0BeglUClAlamZFLdzLpF1xmUbY6ngz1P9w813MwRmE/J9SUJzkSP+uEerC61CyrA6fudBe1mBdWsVyH3IezSRmQeIag25x5BCCxJ0bRaD/K/2M17CXf0HK/7yhx44NCMJX0E3hqcEQgisEO8NfOuWSc0ahO+DTdS9AFO0rPivfSFJGYEh0tZ9fm0l5Rh40wwtTIg1YA3Qy4xVqHta16yOvWn1VjccAE03Vny/Qz45WfVOYxdoauRhxOXvMsvZIU1XLv4P+kUhgnK7JBCXF+kVnBxVL3qfDD7im0jM126gGDIykeRbVbCz62H/HSiw14qZBIpvH5ZYNZYwefS67obLuA8onncOHhkC9epRHu7FxJisxiyO7gB3KyeO6zCUF1+uKnJhSWGeGWskH9c4PGAmABoA6JqRcZYRdsZ8PQLQCROij2EM/GUp8d+fFidA8hbTrq/pWhQo3oNa7fgk41uZc2OSZhHFMsahQ== 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:(13230031)(4636009)(396003)(136003)(39860400002)(376002)(346002)(230922051799003)(451199024)(82310400011)(186009)(1800799009)(64100799003)(46966006)(36840700001)(40470700004)(40480700001)(478600001)(2906002)(40460700003)(36756003)(86362001)(70586007)(70206006)(5660300002)(47076005)(2616005)(41300700001)(26005)(44832011)(36860700001)(8936002)(336012)(8676002)(82740400003)(426003)(7696005)(6916009)(316002)(356005)(81166007)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB9930 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM4PEPF00027A6C.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 9dc20c53-e798-4807-f6f0-08dbdc6f04bc X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KucqYVDjQaBWs6OI1s/0AYqKK1dnbwlfIFHVEMaatbYE5pfusNYcdbSPStLQOwxtiNfnscHHRCbSj2xKs7hG3T0RkC/J6AyR4WHJSKDbm7m8RPi1K1ARuvDLqB7UwhMOl0ayl79jvwJ9xDS3QhXgENskrWGhJ/4kcMiutxeVPmFm+DwPZH74alW57JwML+mUQfLY9GnhnwbeMqFgqB3HQX76ikjT+j/tidEcLKKR698izBvJwGmbdyn89Ztxhs4COjWCH0x33UGAmYZssnH+S9sBeQ+pg1NIVABcBy0kM6mR/GezvD/4Y5EcjsPrqSTGsu8MTeqaPPgSZIqKZqjrblsIhhb+MWbFbFfmDp3s1yLFLQB+L8zrvxyOssEHs46ZDWxrrARM+zDmCj21BECndjDZXyRM25tnng8YauRKyCDEup6w7WHUGVVE01HpzHzOiHYLKeMTytBZjk2+bx5hSuMnN4n53JGMHxcNtURq2T7WrE9CrRrElWoTgfG0dgsg6fB7f7D/xjoZvvIyC+k3dgm2TlyWADZDr68DmXnS17nNvEmrrMR5I1hKPHuJ8t5Bdh4X3ws6jvhlUpkxghDvsRW2DwYbGeKhBWMFKcYs4dsnuKEpe+lgwpeZ1JYc1L8jXlmgy3Z1ZUsY+S2CmO4TPMCiZ4i0YGAgzpds0uLcS+xvJGK/GXZUXaAzLEZJ2Qo1negAsb5T/0qn5mY2A7vLqE9fcc06+fjZtRx0R6wQstN7VNGwuBrWHgYy0uv8InlT 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:(13230031)(4636009)(39860400002)(136003)(376002)(346002)(396003)(230922051799003)(1800799009)(451199024)(64100799003)(82310400011)(186009)(40470700004)(36840700001)(46966006)(40460700003)(40480700001)(2616005)(26005)(478600001)(7696005)(36860700001)(47076005)(2906002)(426003)(8676002)(336012)(5660300002)(70206006)(41300700001)(44832011)(70586007)(316002)(6916009)(8936002)(81166007)(82740400003)(86362001)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2023 13:52:07.0023 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e246f9ca-e47a-49f4-6658-08dbdc74117d 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: AM4PEPF00027A6C.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB7844 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, KAM_NUMSUBJECT, 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: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781551122550814984 X-GMAIL-MSGID: 1781551122550814984 The test creates a large shared library and covers a number of BTI stub insertion cases. --- ld/testsuite/ld-aarch64/aarch64-elf.exp | 1 + ld/testsuite/ld-aarch64/bti-far-3.d | 87 +++++++++++++++++++++++++ ld/testsuite/ld-aarch64/bti-far-3.ld | 12 ++++ ld/testsuite/ld-aarch64/bti-far-3a.s | 23 +++++++ ld/testsuite/ld-aarch64/bti-far-3b.s | 25 +++++++ ld/testsuite/ld-aarch64/bti-far-3c.s | 24 +++++++ 6 files changed, 172 insertions(+) create mode 100644 ld/testsuite/ld-aarch64/bti-far-3.d create mode 100644 ld/testsuite/ld-aarch64/bti-far-3.ld create mode 100644 ld/testsuite/ld-aarch64/bti-far-3a.s create mode 100644 ld/testsuite/ld-aarch64/bti-far-3b.s create mode 100644 ld/testsuite/ld-aarch64/bti-far-3c.s diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp index b025fcbd567..fa5ac3a2cdd 100644 --- a/ld/testsuite/ld-aarch64/aarch64-elf.exp +++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp @@ -466,6 +466,7 @@ run_dump_test "undef-tls" run_dump_test "bti-far-1" run_dump_test "bti-far-2" run_dump_test "bti-far-opt" +run_dump_test "bti-far-3" if { ![skip_sframe_tests] } { run_dump_test "sframe-simple-1" diff --git a/ld/testsuite/ld-aarch64/bti-far-3.d b/ld/testsuite/ld-aarch64/bti-far-3.d new file mode 100644 index 00000000000..4c076985a0e --- /dev/null +++ b/ld/testsuite/ld-aarch64/bti-far-3.d @@ -0,0 +1,87 @@ +#name: Check linker stubs with indirect calls handle BTI (exe). +#source: bti-far-3a.s +#source: bti-far-3b.s +#source: bti-far-3c.s +#as: -mabi=lp64 +#ld: -shared -T bti-far-3.ld +#objdump: -dr + +[^:]*: *file format elf64-.*aarch64 + + +Disassembly of section \.plt: + +0000000000020000 <\.plt>: + 20000: d503245f bti c + 20004: a9bf7bf0 stp x16, x30, \[sp, #-16\]! + 20008: 900fff10 adrp x16, 20000000 <_GLOBAL_OFFSET_TABLE_> + 2000c: f9400e11 ldr x17, \[x16, #24\] + 20010: 91006210 add x16, x16, #0x18 + 20014: d61f0220 br x17 + 20018: d503201f nop + 2001c: d503201f nop + +0000000000020020 : + 20020: 900fff10 adrp x16, 20000000 <_GLOBAL_OFFSET_TABLE_> + 20024: f9401211 ldr x17, \[x16, #32\] + 20028: 91008210 add x16, x16, #0x20 + 2002c: d61f0220 br x17 + 20030: 14000004 b 20040 <__extern_func_bti_veneer\+0x8> + 20034: d503201f nop + +0000000000020038 <__extern_func_bti_veneer>: + 20038: d503245f bti c + 2003c: 17fffff9 b 20020 + +Disassembly of section \.text: + +0000000000030000 : + 30000: 15c00004 b 7030010 <__b_func_veneer> + 30004: 17ffc007 b 20020 + \.\.\. + 7030008: 1400000a b 7030030 <__a_func_bti_veneer\+0x8> + 703000c: d503201f nop + +0000000007030010 <__b_func_veneer>: + 7030010: 90040010 adrp x16, f030000 + 7030014: 9101e210 add x16, x16, #0x78 + 7030018: d61f0200 br x16 + \.\.\. + +0000000007030028 <__a_func_bti_veneer>: + 7030028: d503245f bti c + 703002c: 163ffff5 b 30000 + \.\.\. + +0000000008030030 : + 8030030: 15c00004 b f030040 <__c_func_veneer> + 8030034: 15c00005 b f030048 <__a_func_veneer> + \.\.\. + f030038: 14000012 b f030080 <__b_func_bti_veneer\+0x8> + f03003c: d503201f nop + +000000000f030040 <__c_func_veneer>: + f030040: d503245f bti c + f030044: 1440000f b 10030080 + +000000000f030048 <__a_func_veneer>: + f030048: 90fc0010 adrp x16, 7030000 + f03004c: 9100a210 add x16, x16, #0x28 + f030050: d61f0200 br x16 + \.\.\. + +000000000f030060 <__extern_func_veneer>: + f030060: 90f87f90 adrp x16, 20000 <\.plt> + f030064: 9100e210 add x16, x16, #0x38 + f030068: d61f0200 br x16 + \.\.\. + +000000000f030078 <__b_func_bti_veneer>: + f030078: d503245f bti c + f03007c: 163fffed b 8030030 + \.\.\. + +0000000010030080 : + 10030080: 17bffff2 b f030048 <__a_func_veneer> + 10030084: 17bffffd b f030078 <__b_func_bti_veneer> + 10030088: 17bffff6 b f030060 <__extern_func_veneer> diff --git a/ld/testsuite/ld-aarch64/bti-far-3.ld b/ld/testsuite/ld-aarch64/bti-far-3.ld new file mode 100644 index 00000000000..3265c55b8cc --- /dev/null +++ b/ld/testsuite/ld-aarch64/bti-far-3.ld @@ -0,0 +1,12 @@ +OUTPUT_ARCH(aarch64) +SECTIONS +{ + . = 0x00010000; + .rela.plt : { *(.rela.plt) *(.rela.iplt) } + . = 0x00020000; + .plt : { *(.plt) *(.iplt) } + . = 0x00030000; + .text : { *(.text) } + . = 0x20000000; + .got : { *(.got) *(.got.plt) } +} diff --git a/ld/testsuite/ld-aarch64/bti-far-3a.s b/ld/testsuite/ld-aarch64/bti-far-3a.s new file mode 100644 index 00000000000..ed53545fed7 --- /dev/null +++ b/ld/testsuite/ld-aarch64/bti-far-3a.s @@ -0,0 +1,23 @@ + .text + .hidden a_func + .hidden b_func + .hidden c_func + + .global a_func + .type a_func, %function +a_func: + b b_func + b extern_func + +.zero 0x07000000 + + .section .note.gnu.property,"a" + .align 3 + .word 4 + .word 16 + .word 5 + .string "GNU" + .word 3221225472 + .word 4 + .word 1 + .align 3 diff --git a/ld/testsuite/ld-aarch64/bti-far-3b.s b/ld/testsuite/ld-aarch64/bti-far-3b.s new file mode 100644 index 00000000000..1f3be3d15cf --- /dev/null +++ b/ld/testsuite/ld-aarch64/bti-far-3b.s @@ -0,0 +1,25 @@ + .text + .hidden a_func + .hidden b_func + .hidden c_func + +.zero 0x01000000 + + .global b_func + .type b_func, %function +b_func: + b c_func + b a_func + +.zero 0x07000000 + + .section .note.gnu.property,"a" + .align 3 + .word 4 + .word 16 + .word 5 + .string "GNU" + .word 3221225472 + .word 4 + .word 1 + .align 3 diff --git a/ld/testsuite/ld-aarch64/bti-far-3c.s b/ld/testsuite/ld-aarch64/bti-far-3c.s new file mode 100644 index 00000000000..8e2361fd771 --- /dev/null +++ b/ld/testsuite/ld-aarch64/bti-far-3c.s @@ -0,0 +1,24 @@ + .text + .hidden a_func + .hidden b_func + .hidden c_func + +.zero 0x01000000 + + .global c_func + .type c_func, %function +c_func: + b a_func + b b_func + b extern_func + + .section .note.gnu.property,"a" + .align 3 + .word 4 + .word 16 + .word 5 + .string "GNU" + .word 3221225472 + .word 4 + .word 1 + .align 3