From patchwork Fri Jun 25 07:48:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 12343973 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90DF2C2B9F4 for ; Fri, 25 Jun 2021 08:20:59 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 61FD36141C for ; Fri, 25 Jun 2021 08:20:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 61FD36141C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=synaptics.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gjPiXEawWlsRhX/z4OFXjcev/7KGH6rt3LwlPX2UHx4=; b=bInWyeVo11hjRa yVvOD6Y4HQbJhlkTJyVy9taUXBNikIN545zIkOcWWyePgnSTd37QeyOaA/a9iJrZfkun3FHfXFLIY X1XIkknZpYFr1oY3Lwp6CNzLLEt01o15v6iwk19a+tWjbiMCjvIHGZfqZqld8ZJuSrkyW8TQBLr35 /OMrle5K8fiBiQOxbLie31TQFo36uEWACD0mUxrAiJxoSqnQtwJPWICtoG/FU/AZnYGC10I2Aci0s ioOTu4VHrKIRkSVhRSBH2/EfovplWY6byIlPz/ClJQnCDRffhKe+3emYFsu0wjGlOUEyAi6BsPirb zoCVEUapOz+mCk/BZkwg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwh2f-000Gfy-Bo; Fri, 25 Jun 2021 08:18:28 +0000 Received: from mail-bn8nam12on2080.outbound.protection.outlook.com ([40.107.237.80] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwgiN-000AUg-E1 for linux-arm-kernel@lists.infradead.org; Fri, 25 Jun 2021 07:57:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=flvy7FDreesEZSxtG0dP5lfbzpaHVQk0F6YeljljebNNgTvlUjNI8c+DlqX2wJ6BLODJ5bNkX1HulaQQB9kDQWd5AmgmQmmQ+0GqDcI8zJrfhLoriPSq0cxbY1UHZ0Hgk9MuLw1dLdGM3lCKsSZAJDniD9xyr1TqMLofvCLjNGayJl//fX+r3/KVYEuUVYD2tIxqOGwnihiAa+BSfCgWVUI0QRUDUslSjARuhrvSHi/mrezVMWqpVKVF9V88I9uhPwadgGZoNzFroEToeQJHq2Z9lEbgPYNoB1oyBf0U+cW/qCQ3EtCXfi8q77h0oAE0aFUhrKJBAZ+sWN/auphSDg== 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-SenderADCheck; bh=/F32mO0WG8EoKDH09o/w5GJ0EjS3ELQuvArvH7EIm0s=; b=NZ1dPT09ZI974+18rRzDZ6rdxf2Ova54fQvi1h3KJRq/TozF45oRGRN3OtZo+BXB8XuAMlMLEu5a7pe0Nlqoj3eWqq7+Q1RgJrvIeC2PcJK9R65UTxR3PKFU+UDtzt8QEoPUpZecGZFW/sO+HMYRDtNFAMvm5zN2C6jpIb4tJrHEEOVIAn68iieCaUp3BFNoLBiBCURyL3Y0/6RQyHvwxo3lfeDY5fcifDCyPUyj68E25kWX52YA3FxJDVUbSXniW3dqYbT4U6oxvcZAICl+Kn+YgGnPraEafGwxjcap8HITHvClXL4Pr/EsLFDGea8+XYcAU35gkDF+iCHuwKKenA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synaptics.com; dmarc=pass action=none header.from=synaptics.com; dkim=pass header.d=synaptics.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector2-Synaptics-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/F32mO0WG8EoKDH09o/w5GJ0EjS3ELQuvArvH7EIm0s=; b=euE2631MZV6/0tBrt1Cy4Nmfo2qS9yB4+9GO2gsBRNEu9VQHKVSJw+KxzVCElfiF83c8Ha+q/JN8cPLW6Fvz3kClWc9UzTZDzcYIsHEPEx8ZNjqBNE2/lfExWHlGHJarE6YFs/4H9F+/Cuf8Xh+61Qkvmgc5uGOLd9+2UQQAWag= Authentication-Results: google.com; dkim=none (message not signed) header.d=none;google.com; dmarc=none action=none header.from=synaptics.com; Received: from BN9PR03MB6058.namprd03.prod.outlook.com (2603:10b6:408:137::15) by BN9PR03MB6137.namprd03.prod.outlook.com (2603:10b6:408:11a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.20; Fri, 25 Jun 2021 07:57:25 +0000 Received: from BN9PR03MB6058.namprd03.prod.outlook.com ([fe80::502a:5487:b3ee:f61c]) by BN9PR03MB6058.namprd03.prod.outlook.com ([fe80::502a:5487:b3ee:f61c%3]) with mapi id 15.20.4264.023; Fri, 25 Jun 2021 07:57:25 +0000 Date: Fri, 25 Jun 2021 15:48:35 +0800 From: Jisheng Zhang To: Nick Desaulniers , stable@vger.kernel.org, Greg Kroah-Hartman , Nathan Chancellor , Ard Biesheuvel , Sami Tolvanen , Masahiro Yamada , Sedat Dilek , Thomas Bogendoerfer Cc: Catalin Marinas , Will Deacon , Alan Modra , =?utf-8?b?RsSBbmctcnXDrCBTw7JuZw==?= , Quentin Perret , linux-arm-kernel@lists.infradead.org Subject: [PATCH stable-v5.4 v2 1/2] kbuild: add CONFIG_LD_IS_LLD Message-ID: <20210625154836.382536b1@xhacker.debian> In-Reply-To: <20210625154737.3d64a434@xhacker.debian> References: <20210625154737.3d64a434@xhacker.debian> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) X-Originating-IP: [192.147.44.204] X-ClientProxiedBy: BYAPR06CA0033.namprd06.prod.outlook.com (2603:10b6:a03:d4::46) To BN9PR03MB6058.namprd03.prod.outlook.com (2603:10b6:408:137::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from xhacker.debian (192.147.44.204) by BYAPR06CA0033.namprd06.prod.outlook.com (2603:10b6:a03:d4::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.19 via Frontend Transport; Fri, 25 Jun 2021 07:57:20 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7f00a81d-6b37-4189-a703-08d937aeded9 X-MS-TrafficTypeDiagnostic: BN9PR03MB6137: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:118; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ithze1DRX7HpvwTv1ZqYH+AUMg79xSLCMS50T0XNb+APfwqhiHa/YmeC2AYX/KAhDgprbA555xIKuMXS3ZhDdk4OBk44Ig7l1QJyv1rPEcr4IbcXUZksGipuTpyNhuvL2XCF4dTu76dQTC++3WDu8TwsLCoLR7/5ZCjGAyliI7fO1Tx3XdVEBa2oy5g3XLsFSmotMZVb55XPnA5Yq/00eUZYODgrSK49LunMJhCsgdMeGZgF4LSY/BLbCB8x2thPQIMS2i93x4Lg1fTIHNCBxsa4sKIQ7dHAvmAf77EUIEhp/Ir0QdR4awy3xU3w1xdsLgb+VBP2CrjN8MbgecGeyEjp9JfkGiARPEPyvojOVP8J40qROkiq6QmJhMjOBsfZ9twY03MJVUIyMW+BNiYCVT8QFxmPfM0agVZkVsXWD/f1NGCtKm0vOgEOddtQ6UAyN9GgT0U48Y8r6bkAX1hHpusB7F5apiizE6npY2USQwHyaxRP1fw2ky4HesVMTDYqXubyS2Sp8nUIm6hLCy88I2oXad3Ptbqot8V8QDMwzs7x3ywKxDgFBGP8gDKuTGwcHtZw+uAt41nFQmd7Mi8T8gxk559clPVH196G9DhIhRDg6FnfBkrzSovEJeV11urAwLrZU6tuPL8vSKmS1atvaPjzp8UQghniXDRH47lxxKiV/NQzTE/kA2OEVgQv3IPbqpXPUOeom6c8Vhf/Jim2Ug== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN9PR03MB6058.namprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(346002)(136003)(366004)(396003)(39850400004)(376002)(52116002)(2906002)(186003)(66946007)(316002)(6666004)(66476007)(8936002)(66556008)(7696005)(26005)(478600001)(55016002)(5660300002)(16526019)(9686003)(110136005)(7416002)(1076003)(54906003)(86362001)(6506007)(8676002)(38350700002)(38100700002)(956004)(4326008)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jBxgSsDahX9cMBluyUGUgonoioPdV+WLtkxILQ+3jXv6Nu1YJA1FF6zUK+BbNH5rfq44YLS1poTTeOsqZsKeWMd8ivr2RLk+3wA9vOo627oPSG4UKqFa6RxhvctkzpXRP5HsEcEWqx/MdH2tD2mntwD3cHzx28Vecg4mv/iKhoLxsDTMAR5eYLuxmB+T/Qyf+FNgJutXH8ulKiErdJS2WBtZnOX/96V2bE8Qpm2qGHD1mij+xqa7pjdGphclPVx2OfvhtrFQiY2elIwXpX+h2ObjlegZ2sO7TR1Tx81R2NojvXHs8TF6F84IP8ngExCQSITmHhclVKYIVl9/2IwMJNRtdNoftTL3wu+O5P9OTSZ7uSi0x+hxvfnnQWKEBhyo0i8oyXIfEckpy7wjyo7P8+OpPu/Cu5NZ5jEgCg5VEZoll3pSMo6wUZtXZkMiUWiRsbZEOS52nNgolxwQMXsI2sKCzprKDmXY1ezcmzJqGmr7Ng4erNdf+JXW+kY4U4/F0cpuK6RrZR7a08Gd4Tw9jjNhK7SX5CpV3HlAGsdA3UAAjik5GzS3MnOPJ03gKYt4Ke5b0scByrcbinhxSqtW7Lmy+oOIDMEuMVXbHHrUuux2OFJvrTrD5ll+eJugLDGWnFPmkT/55tJ8t+mCz6Hn9il6cMuFjWiFAiWH2sLpWOBbRE2VIO6C6jeUcB3X+lt9dGj0a71D03DdYzvzyES26hHvV2NseLgQDNrdMPjK8krDNN/W784i3iMI3mLtJPfAlLzEUZbUPDMgfXzFC4lYF1Co2jRixOUeRaYW+UXlzQ7hnENAPtSBYgCS0IwxKHc5x9QqPKoFvtEiKvNVCm1P2dg5idbv3FMXA4YExdyIP79CzUFJrXKZfR8ufPWtrimbPKhqrBujHwv+ZUoLFS9GOTfSOkJstSKWMGYV0oo5H8YnPY+u5nPwrQoG/6nc13NnujZ3M9xA0XHg0e7p53gdgy+5lb79PM56btGq/5H5w9aPb4kHvkkzYzdIxNzKkt299HK+WRTuhmKfD295O9XHDsegyAQ2KiWd2v8TjaSuO58VN0YzOmXe3lVLPE7Pw2/ihpngsVU/NxmkqqWTYqK6kEcPA0lRpPMJNrmCY6GdIUzLyGWLh5eRiC/iooJIQNHquNqPs+IbExsqE8pnumg9pWyd7Ak4OPyWQYnNcN/uMrDZ0jLg9yI7Hx9OnnSOrlVjUJOidNcGMPVz8yXKnAmFzcv1fuV3K69IVP41GlycJIM2eUnqn4dJUtOcIjiGAejTGnaRaT4suT+hnkTLaPzVt67ytJZsTSn2GozqVhgwnmfZ0pAC1osgndRKhLwfE8vE X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f00a81d-6b37-4189-a703-08d937aeded9 X-MS-Exchange-CrossTenant-AuthSource: BN9PR03MB6058.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2021 07:57:25.3424 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: B5/GZO3BfS9GrFJl55pN0kiPh5YnTCakNndYg9cKWCNzSXcAcHwjh776x8XBGrki2dTj0USAl3eODJMmowEdrg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR03MB6137 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210625_005727_558577_B2C584D1 X-CRM114-Status: UNSURE ( 8.79 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Sami Tolvanen commit b744b43f79cc758127042e71f9ad7b1afda30f84 upstream. Similarly to the CC_IS_CLANG config, add LD_IS_LLD to avoid GNU ld specific logic such as ld-version or ld-ifversion and gain the ability to select potential features that depend on the linker at configuration time such as LTO. Signed-off-by: Sami Tolvanen Acked-by: Masahiro Yamada [nc: Reword commit message] Signed-off-by: Nathan Chancellor Tested-by: Sedat Dilek Reviewed-by: Sedat Dilek Signed-off-by: Thomas Bogendoerfer --- init/Kconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init/Kconfig b/init/Kconfig index 4f9fd78e2200..f23e90d9935f 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -20,6 +20,9 @@ config GCC_VERSION config CC_IS_CLANG def_bool $(success,$(CC) --version | head -n 1 | grep -q clang) +config LD_IS_LLD + def_bool $(success,$(LD) -v | head -n 1 | grep -q LLD) + config CLANG_VERSION int default $(shell,$(srctree)/scripts/clang-version.sh $(CC)) From patchwork Fri Jun 25 07:50:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 12343971 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB085C2B9F4 for ; Fri, 25 Jun 2021 08:20:19 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 851656141C for ; Fri, 25 Jun 2021 08:20:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 851656141C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=synaptics.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FGwlitEC/d4l8hNsLx6WiGHWFRdO0yk9GlXrH/TyswM=; b=ql4azOSd9BuVuW VDPo39RavUXdEg73Cm5MguSZE0CsbYWu5JCDnm9TNn1ZGmW2RzMzxn9Tkt2g6i9zTSKptu0W4j1zP m1bmHIWSw5rFM+P514uuLY/z//Gu+Ll+YOUkgM7WXSO3qTJia2x+5By22oSDyuglOx4WmEUZYQAYm v/+1jD1dXsFgGG9NzskjdxhofKdC/9w+vHn0nZlwJ89ueXery90KHE1hRpg4gbiFjlm51WG7xnIql e7/G0HywnkflndhiXUHPtnGqAz4gwAKkuQF1pc93f09Ex//nBS2AJsWWk4PGHON/LcVBp9q/9tmSm ZsGfjLEwXnaSQ85GkuWA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwh1i-000GPi-5H; Fri, 25 Jun 2021 08:17:28 +0000 Received: from mail-bn8nam12on2074.outbound.protection.outlook.com ([40.107.237.74] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwgiI-000ASO-B4 for linux-arm-kernel@lists.infradead.org; Fri, 25 Jun 2021 07:57:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OgeOMtT2or774+unO0zvKKs+YU0d6wonFbqPZsE7AFfSBtUrJoTdlK6lU/+DXlJXQDRQaZzoEo91qM9WBSKeF69mhMLxi0Jk7Lh/ft1oNqaInSO/ticAgzYvXktryFZZcH+qv1xsHgpONeBcq7zOtT1fZHwWRgAwy0YtMQQyfIDGWxu0WytHMfI1sILuSW0jNo/h7QDBv0TUxSP9dX2xnVUCVHcmUw+V0kdSMJg4ddKm/950P5PsUd5Bl/4NCzP0beZLj3v5kPpmdMAMFYzUcI4gKe8ZRZVCWBxuNBquIlEvvVmUr/i0U3hS4LLDbdIW6QGdPv3NrqLAVKhdmId4AA== 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-SenderADCheck; bh=ntAtTCMcbHSjuDHVGPGm1FRLN0bmiJDw3df60Y/3c3o=; b=iRg/NoWOwWjjjc4h96e680DZH7H0iU9lI5b/g805M02nIWsc/91QaYJSPR2VyHTi5MBxfKSMe5AbWgYx/tcwAicZ5CQgShcQ6vqMQ5X+aL9fiBPO4+1QnkLpezwM33zwIG1+9Y9mwTIaFYI6cd5L5VECbBuEQY7v5ZuFzi2IToGE7kZsyj410mSJZmWcGZXZPmMBjLga+1mVKyLeIcxoxTQdpcAT5Ho0zsVt9EfO1YKVq2JRQ62wDDQl/NhZLzsBChxGVL/qP7vPU3YCuxSXu4VyUTryMGT1CixM5V0qMqxQg7xbsK7QQsjwGCOyGULV0ofvuSCxvEmBDXdBsT0Bcw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synaptics.com; dmarc=pass action=none header.from=synaptics.com; dkim=pass header.d=synaptics.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector2-Synaptics-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ntAtTCMcbHSjuDHVGPGm1FRLN0bmiJDw3df60Y/3c3o=; b=VOxLsZlxllY75Miftz8l9LqXMwOxCqwGszT2/qvkJDCetb+TsEhMb3pofuGUPdZ0+nW2naLp0M41ooI1QPEARWfU68d7xJelLZXoBs7CCgajVnDO1UmQoScdoMc83ywQa/mCGtm2+U4c+LHRWiPj39fzZhUKD/eTxERU/oUb8/s= Authentication-Results: google.com; dkim=none (message not signed) header.d=none;google.com; dmarc=none action=none header.from=synaptics.com; Received: from BN9PR03MB6058.namprd03.prod.outlook.com (2603:10b6:408:137::15) by BN9PR03MB6137.namprd03.prod.outlook.com (2603:10b6:408:11a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.20; Fri, 25 Jun 2021 07:57:17 +0000 Received: from BN9PR03MB6058.namprd03.prod.outlook.com ([fe80::502a:5487:b3ee:f61c]) by BN9PR03MB6058.namprd03.prod.outlook.com ([fe80::502a:5487:b3ee:f61c%3]) with mapi id 15.20.4264.023; Fri, 25 Jun 2021 07:57:17 +0000 Date: Fri, 25 Jun 2021 15:50:12 +0800 From: Jisheng Zhang To: Nick Desaulniers , stable@vger.kernel.org, Greg Kroah-Hartman , Nathan Chancellor , Ard Biesheuvel , Sami Tolvanen , Masahiro Yamada , Sedat Dilek , Thomas Bogendoerfer Cc: Catalin Marinas , Will Deacon , Alan Modra , =?utf-8?b?RsSBbmctcnXDrCBTw7JuZw==?= , Quentin Perret , linux-arm-kernel@lists.infradead.org Subject: [PATCH stable-v5.4 v2 2/2] arm64: link with -z norelro for LLD or aarch64-elf Message-ID: <20210625155012.4aec8450@xhacker.debian> In-Reply-To: <20210625154737.3d64a434@xhacker.debian> References: <20210625154737.3d64a434@xhacker.debian> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) X-Originating-IP: [192.147.44.204] X-ClientProxiedBy: BYAPR06CA0033.namprd06.prod.outlook.com (2603:10b6:a03:d4::46) To BN9PR03MB6058.namprd03.prod.outlook.com (2603:10b6:408:137::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from xhacker.debian (192.147.44.204) by BYAPR06CA0033.namprd06.prod.outlook.com (2603:10b6:a03:d4::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.19 via Frontend Transport; Fri, 25 Jun 2021 07:57:12 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 14318e6b-7165-4199-c414-08d937aeda0c X-MS-TrafficTypeDiagnostic: BN9PR03MB6137: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1923; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4IV2hppgoe4nxQaMeQnnFa7NB9eZC8lq7K3BWtHf/49sQQQTsA6nBqFkajLC19zPI1GEtEFVNvziGPJBeL7vuPU052hxGuif+Rm/nhNnZRme5J6t4iU9M+WxxB+TZRSit9mpSAx/G5ABIOPBvYOHVxCK3uoluV+/BWWj8rq8ua4Zl6G5KAXEVrj98hijiT5GKyi/nPMm8o1eGd3nYGTvBM0kd/bFNZD5+r6Yq4xFyNl7p1iVAtlNRp6yorJha8zTOZ95niEfYxjkSrL20YNhDTQY+l+eOs6JsPsRISRTiNlpljmd582bJedES8rCtPWlUL2Bu+pPOA8m697kPPDUMH71bHmn1Nt49Kb/w0Wy1BFPX8GxlvAuzKwdRHkfPzLnkuBX3//ui/n97QMk9VVNkme+XxUNejHLS9hqWNGqjR3CCwab95Aq3K8Om0DSsh+GWfK7JNWsgMY5FSQArTNsdiEWVL6zVY9HLJLPPnfIaF0Zm8HrwL4p5MPNNEbpSl2wzysqFcFqaxdY+Vkm10nW7Lc/n9my0Iq4i2BnZlfO4wgJeFf302TpSDHwgQErNYvZZYpjjjuYw9J5NzrSfxNrUI3F9u9Axgh6tpQphtwjQi3fnL3ME+6yP6034CVZ3+Os7PlObW3kZLNbUqv9wEWlRayj5mm/cgrpXUay3P9s1HlxGMkwAFmc/QjpyAXAh1ZAhmOmoORa5I7CkDZoYzgrKCu9bXaO8+Yi/y1kGkWzQVpMqil5WAGVEEyTlQ9S/1EqxXYdn+dmS32UOS03zKaaHJUeSerVVORuZgThZiwMKV+RIO5ZmphyeG2wJCwr9mS6Qvl7NJjd2RTVuVeNyiIqFg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN9PR03MB6058.namprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(346002)(136003)(366004)(396003)(39850400004)(376002)(52116002)(2906002)(186003)(66946007)(316002)(66476007)(8936002)(66556008)(7696005)(26005)(478600001)(55016002)(5660300002)(966005)(16526019)(66574015)(9686003)(110136005)(7416002)(1076003)(54906003)(86362001)(6506007)(8676002)(38350700002)(38100700002)(956004)(4326008)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?O0m7ptXkaEA14l/QBPWoEWMvNNDp?= =?utf-8?q?OYpGNUC8aBFxKB+Ns0I2zZEjmPEDwwGTyaaBAKG4/Y2OzsKX5k3RGXg4BdMrPuwk9?= =?utf-8?q?EjTBioh/WQevuHwFsRKUMlye7NmWi8qWzbIJVYIyoeQTP1jpqb5uqZCHVs7fcKfYU?= =?utf-8?q?nCN5zYVWrdEt/urBCAGV/uB8/azPsZF1p/wOGc9Gea53YIA7QxqXk40fs5049OywN?= =?utf-8?q?by0Un1UN8pTLHzxPY6Km1OltrTyBxyrv9aeaJeEl/V9ggGj3fYvOrOPoUY/7FHjaL?= =?utf-8?q?Q2wiHX2HDzziqk8oDnYiivf46QCDfgxz0w4V68+1N0GgHLc+qK+nDd5OEjkLBBQHk?= =?utf-8?q?ZlLFSd02KchBYY7ANAGPP0JOwgDqUhNFnuUoAJbIDLi409MdrYetTX9LnWPxezkFo?= =?utf-8?q?ZwQR02gXesZdnbvpNysysRPKdBSCmemmrQAIguMuu6EPpGLGeOCKYVuE6sIdYpb2n?= =?utf-8?q?gvMhO/bVFb1mw9buPR9lBHWOIFInzrAkmRRbSmymf+fwzCiW4VRIycKQhrdfAkq94?= =?utf-8?q?Q6PykG0+k1++OAiVvr6uZi38LNw4LK77Pw7GFi1e+La7qs1/VLC4x48nxE1pEEib8?= =?utf-8?q?w3X+thGs97CPr7OftQQvWnwIkG3Qr5oXngBOHwCwdI4K6m/BOm+k77bef57zeP83f?= =?utf-8?q?YSTed084y3zNCdkMEbwtaRCYS45C/GysOFoe7mglmv39JDEZgjuSCwPfachZumPip?= =?utf-8?q?QbdJeKf9xDiopAsMx7DzCsT8z9IJeTcx0FN0yHJYkfFDOVER5tD7ctK/9PaFI1n2j?= =?utf-8?q?546/OuWSq03jpxmwYu8XkfkwHmTuOAzTgBUhJPL1T7knh1PloXJM6umbVqfLR9bDa?= =?utf-8?q?d0rMBo1gxwQPTrrMx7ZXTLEMnO8N1+7VxcTq5rB/e5WuVf/ye7LWk8deLS3poOrZ7?= =?utf-8?q?4X07tx+Un2dM764K0TKo0PSkqpJSrLKK/Ow1VVaJ0ND1tiICIZ5NwFAqzNNxisRPE?= =?utf-8?q?6L0DVv+m4pz0O3GuDUTMRnDt+xZVk/gWMKfeXzy4gYmYpibNE2p+B5R3N8f1J77S/?= =?utf-8?q?aZVHIbXFVoYzse13I932T2IAgqTn59qe1FTbSgt2Vw1fa9JfUfgQrAgqQCMjS/5Ab?= =?utf-8?q?CRMprwleW26U4kZ5PaCFfqOAKos5uMfqQECA+aB5qGV7LtgeI5oNpW+5hw/teQhhn?= =?utf-8?q?MC0Zsm18tDftmddPWYYXahcPRr4ouiFiUcd8iFAuTBqAkcjldv7uEwx6TvZ0N9vVR?= =?utf-8?q?V6UJ2ydBiJseiITfPYncIuLtAiaYxj03+U7ptV3iKZir+Vl1rzlzyIJwWMzHss+KX?= =?utf-8?q?CQNZ8tHs3lBojzTJ?= X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: 14318e6b-7165-4199-c414-08d937aeda0c X-MS-Exchange-CrossTenant-AuthSource: BN9PR03MB6058.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2021 07:57:17.3564 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: a6mkC3YbMYqKDtHJMwrS7s2vECuequtvWIK1c2lqqXUHECjjdW4p+zaAEu4V890BGtlktBsV7acKOQkuFvxxdw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR03MB6137 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210625_005722_490422_5FB008AC X-CRM114-Status: GOOD ( 11.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Nick Desaulniers commit 311bea3cb9ee20ef150ca76fc60a592bf6b159f5 upstream. With GNU binutils 2.35+, linking with BFD produces warnings for vmlinux: aarch64-linux-gnu-ld: warning: -z norelro ignored BFD can produce this warning when the target emulation mode does not support RELRO program headers, and -z relro or -z norelro is passed. Alan Modra clarifies: The default linker emulation for an aarch64-linux ld.bfd is -maarch64linux, the default for an aarch64-elf linker is -maarch64elf. They are not equivalent. If you choose -maarch64elf you get an emulation that doesn't support -z relro. The ARCH=arm64 kernel prefers -maarch64elf, but may fall back to -maarch64linux based on the toolchain configuration. LLD will always create RELRO program header regardless of target emulation. To avoid the above warning when linking with BFD, pass -z norelro only when linking with LLD or with -maarch64linux. Fixes: 3b92fa7485eb ("arm64: link with -z norelro regardless of CONFIG_RELOCATABLE") Fixes: 3bbd3db86470 ("arm64: relocatable: fix inconsistencies in linker script and options") Cc: # 5.0.x- Reported-by: kernelci.org bot Reported-by: Quentin Perret Signed-off-by: Nick Desaulniers Reviewed-by: Nathan Chancellor Acked-by: Ard Biesheuvel Cc: Alan Modra Cc: Fāng-ruì Sòng Link: https://lore.kernel.org/r/20201218002432.788499-1-ndesaulniers@google.com Signed-off-by: Catalin Marinas --- arch/arm64/Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index cd8f3cdabfd0..d227cf87c48f 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile @@ -10,7 +10,7 @@ # # Copyright (C) 1995-2001 by Russell King -LDFLAGS_vmlinux :=--no-undefined -X -z norelro +LDFLAGS_vmlinux :=--no-undefined -X CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET) GZFLAGS :=-9 @@ -82,17 +82,21 @@ CHECKFLAGS += -D__AARCH64EB__ AS += -EB # Prefer the baremetal ELF build target, but not all toolchains include # it so fall back to the standard linux version if needed. -KBUILD_LDFLAGS += -EB $(call ld-option, -maarch64elfb, -maarch64linuxb) +KBUILD_LDFLAGS += -EB $(call ld-option, -maarch64elfb, -maarch64linuxb -z norelro) UTS_MACHINE := aarch64_be else KBUILD_CPPFLAGS += -mlittle-endian CHECKFLAGS += -D__AARCH64EL__ AS += -EL # Same as above, prefer ELF but fall back to linux target if needed. -KBUILD_LDFLAGS += -EL $(call ld-option, -maarch64elf, -maarch64linux) +KBUILD_LDFLAGS += -EL $(call ld-option, -maarch64elf, -maarch64linux -z norelro) UTS_MACHINE := aarch64 endif +ifeq ($(CONFIG_LD_IS_LLD), y) +KBUILD_LDFLAGS += -z norelro +endif + CHECKFLAGS += -D__aarch64__ ifeq ($(CONFIG_ARM64_MODULE_PLTS),y)