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: 467396 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.2 required=3.0 tests=BAYES_00,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 BFE58C2B9F4 for ; Fri, 25 Jun 2021 07:57:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A44466141C for ; Fri, 25 Jun 2021 07:57:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229772AbhFYH7r (ORCPT ); Fri, 25 Jun 2021 03:59:47 -0400 Received: from mail-bn8nam12on2049.outbound.protection.outlook.com ([40.107.237.49]:41825 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229454AbhFYH7q (ORCPT ); Fri, 25 Jun 2021 03:59:46 -0400 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 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.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: 466824 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp1203656jao; Fri, 25 Jun 2021 00:57:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzR2EHQMvwjtakG+SC4mdvN8q2xD0e+ldWRHeLFYRhLSl4hvzuCliWait5JskeG8fPKtTtA X-Received: by 2002:a17:907:3f03:: with SMTP id hq3mr9177508ejc.436.1624607841235; Fri, 25 Jun 2021 00:57:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1624607841; cv=pass; d=google.com; s=arc-20160816; b=rsOmww+/bwOvoo1Ae1ZDeM8gUqVChijO6b4MSK/knkrcgH/HODaMwwgNeoEHbIj7U2 DF8R943npSBDMtasVfGNqLC8CLbJAwGriRm2YGayy6x9dTSALMTGV3PV2cZjRdetAiN4 muN8JDVfR8kOxqAMMpgqNrAplmJRQyH9v8iZ7whioo9cXyLjxPK2AjIxpxmDSAtnZTvG abGy6C5bn47WETIsu+V871FEswNT3rzGcjEMxXyyEaNoJmaGKo4aP6i/nhkEJ94pufHk XhkmqxCMxnkgl9ze9SiokYwFvSffL3bDsIu4IXCe8onj2kaOnlVgptYmGo5f6jmPujTW EGMg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=ntAtTCMcbHSjuDHVGPGm1FRLN0bmiJDw3df60Y/3c3o=; b=P3gQooY8JzT+kPxDll56DFC9vJMt0j3YFJTqgFVgdc45Nu90mLr5CpSsYmK8XDlfLH BjpNIiBQgPZIvuKLk2539JspuNq0ZI0b6zRW4IwSD1CiwEr9f9j6b2o3Q69y5BLSIvPD 2B6VRgi9Bcz429x0Hu0ovMueNL36wBA/FVWRXmw4n3lFTLuXtdgLZcYnKEj0cZKBTk77 2XKInZ/Cx5UQkhb5JM2VlHUHCZfzRD8Oz5QeG8HQtcigHqKGOKKNGio481yckKuj9zUI 3MCtd97952gb+H87LSdF3Xx8Q9I1jAqrHw1t7VcFvuPe1NFgH4Y1h7eI5ILqm8VFttZh rNVA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector2-Synaptics-onmicrosoft-com header.b=VOxLsZlx; arc=pass (i=1 spf=pass spfdomain=synaptics.com dkim=pass dkdomain=synaptics.com dmarc=pass fromdomain=synaptics.com); spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synaptics.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dq7si3753932ejc.675.2021.06.25.00.57.20; Fri, 25 Jun 2021 00:57:21 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector2-Synaptics-onmicrosoft-com header.b=VOxLsZlx; arc=pass (i=1 spf=pass spfdomain=synaptics.com dkim=pass dkdomain=synaptics.com dmarc=pass fromdomain=synaptics.com); spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synaptics.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229474AbhFYH7k (ORCPT + 12 others); Fri, 25 Jun 2021 03:59:40 -0400 Received: from mail-bn8nam12on2089.outbound.protection.outlook.com ([40.107.237.89]:63905 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229454AbhFYH7j (ORCPT ); Fri, 25 Jun 2021 03:59:39 -0400 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= 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/QBPWoEWMvN?= =?utf-8?q?NDpOYpGNUC8aBFxKB+Ns0I2zZEjmPEDwwGTyaaBAKG4/Y2OzsKX5k3RG?= =?utf-8?q?Xg4BdMrPuwk9EjTBioh/WQevuHwFsRKUMlye7NmWi8qWzbIJVYIyoeQT?= =?utf-8?q?P1jpqb5uqZCHVs7fcKfYUnCN5zYVWrdEt/urBCAGV/uB8/azPsZF1p/w?= =?utf-8?q?OGc9Gea53YIA7QxqXk40fs5049OywNby0Un1UN8pTLHzxPY6Km1OltrT?= =?utf-8?q?yBxyrv9aeaJeEl/V9ggGj3fYvOrOPoUY/7FHjaLQ2wiHX2HDzziqk8oD?= =?utf-8?q?nYiivf46QCDfgxz0w4V68+1N0GgHLc+qK+nDd5OEjkLBBQHkZlLFSd02?= =?utf-8?q?KchBYY7ANAGPP0JOwgDqUhNFnuUoAJbIDLi409MdrYetTX9LnWPxezkF?= =?utf-8?q?oZwQR02gXesZdnbvpNysysRPKdBSCmemmrQAIguMuu6EPpGLGeOCKYVu?= =?utf-8?q?E6sIdYpb2ngvMhO/bVFb1mw9buPR9lBHWOIFInzrAkmRRbSmymf+fwzC?= =?utf-8?q?iW4VRIycKQhrdfAkq94Q6PykG0+k1++OAiVvr6uZi38LNw4LK77Pw7GF?= =?utf-8?q?i1e+La7qs1/VLC4x48nxE1pEEib8w3X+thGs97CPr7OftQQvWnwIkG3Q?= =?utf-8?q?r5oXngBOHwCwdI4K6m/BOm+k77bef57zeP83fYSTed084y3zNCdkMEbw?= =?utf-8?q?taRCYS45C/GysOFoe7mglmv39JDEZgjuSCwPfachZumPipQbdJeKf9xD?= =?utf-8?q?iopAsMx7DzCsT8z9IJeTcx0FN0yHJYkfFDOVER5tD7ctK/9PaFI1n2j5?= =?utf-8?q?46/OuWSq03jpxmwYu8XkfkwHmTuOAzTgBUhJPL1T7knh1PloXJM6umbV?= =?utf-8?q?qfLR9bDad0rMBo1gxwQPTrrMx7ZXTLEMnO8N1+7VxcTq5rB/e5WuVf/y?= =?utf-8?q?e7LWk8deLS3poOrZ74X07tx+Un2dM764K0TKo0PSkqpJSrLKK/Ow1VVa?= =?utf-8?q?J0ND1tiICIZ5NwFAqzNNxisRPE6L0DVv+m4pz0O3GuDUTMRnDt+xZVk/?= =?utf-8?q?gWMKfeXzy4gYmYpibNE2p+B5R3N8f1J77S/aZVHIbXFVoYzse13I932T?= =?utf-8?q?2IAgqTn59qe1FTbSgt2Vw1fa9JfUfgQrAgqQCMjS/5AbCRMprwleW26U?= =?utf-8?q?4kZ5PaCFfqOAKos5uMfqQECA+aB5qGV7LtgeI5oNpW+5hw/teQhhnMC0?= =?utf-8?q?Zsm18tDftmddPWYYXahcPRr4ouiFiUcd8iFAuTBqAkcjldv7uEwx6TvZ?= =?utf-8?q?0N9vVRV6UJ2ydBiJseiITfPYncIuLtAiaYxj03+U7ptV3iKZir+Vl1rz?= =?utf-8?q?lzyIJwWMzHss+KXCQNZ8tHs3lBojzTJ?= 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 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.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(-) -- 2.32.0 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)