Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp765643pxb; Thu, 19 Nov 2020 13:16:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJykDptwyyzD01Zxxg1xjwFGXhFLgtnKygOB/cvQEpGtE+m/3kgTx7+SPBJ0mXgfVEN7UaJH X-Received: by 2002:a50:f613:: with SMTP id c19mr14460781edn.188.1605820594721; Thu, 19 Nov 2020 13:16:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605820594; cv=none; d=google.com; s=arc-20160816; b=Cb3AooK22LBxhFQIYXdowdDQYvgqnWRqq0Dx5oqfHsFjWfWXLws8h8SjgP7cw+wlA/ ky2USrvp2Sxkz/dk+WWyPEs2wnOYkpjr1wA2Jq7Kz1tQ8T42xcvmhIfwI7NiiQlqTx4e D9UWp0o7djLIp0ilnZw5MVz9FHNLONvws5jZ9DjG3ihjimgpS4LFYd2kAKV4fB3p0enF 9tRgHHQZbHTc7AfArOG2FsBqXCJq2bX+IP6lowH34sv6ID1DGz/mvWga36WR6RXmO2C9 2V+3+oCBIT5KM1Y7l4d910p/lvOj7G+fTC2R46PET1T8rcuY09gwpqd/t5zhILaLBvbZ h1Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=v4GZ/jYkXszE1mls+kEMDdrPEPVfJzO/2ICpEIaBNDQ=; b=OwKMEU2byR2W+uu8S+wXMaY86V+WDCF96MAu5loi+z0mlgL5KbPCSDn59K9UdcXx/L eNrZ0D64pJ26LEwDaHdFMVsvgMIv4GwAKzn1lPzex7+70NFOH2DdfOuObnofeOBddGiV zCOYdqkuABpQX4u2y18o6h/oY/3xnUc6eaC+RBL5IyHxsYjohPnPhIc8wugLEfiK8VGC 9xtSLMvtr0EwsUNMQ94EksSknDowknzvg8wN60bk4NUn66aGysC+0s5uJXjdT5hWfBvV uh0l2m93hpdiobKdtpr6AB6FJzBE4RSWqnlkOFuZn5dvMNYephocE8XZmF66gNQ+nyVf aztA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=VX9vMNKu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l14si570643edq.543.2020.11.19.13.16.11; Thu, 19 Nov 2020 13:16:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=@google.com header.s=20161025 header.b=VX9vMNKu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726765AbgKSVNk (ORCPT + 99 others); Thu, 19 Nov 2020 16:13:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726551AbgKSVNk (ORCPT ); Thu, 19 Nov 2020 16:13:40 -0500 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14C58C0613CF for ; Thu, 19 Nov 2020 13:13:40 -0800 (PST) Received: by mail-pg1-x544.google.com with SMTP id q28so5388274pgk.1 for ; Thu, 19 Nov 2020 13:13:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=v4GZ/jYkXszE1mls+kEMDdrPEPVfJzO/2ICpEIaBNDQ=; b=VX9vMNKumxYjb1MaiOgA8BYXWmZVJDiTW6P01b9rG1rPFKPOjSfowk4zaRH1rXRNir BtNu2L/lhkEgxsDBVm5+hwahoKlcdKx8DSfHEvvF9koYNFXSPx+TqpjXadTh2ckpyrEn LPRrqR2nTFG9fkBNgO6K7sSMsjq9j5w7XVC/YqMh/5mCy4tlsbZt8u5jaaCN7inZBCZ3 KqCnmRWetMpK1EIMWJnCEmxwayXO5SCYdsiunWSlbvt5gCFY4m7Mqnk47VBIHFU1IKw2 se5KST+MC+lt9D5LyUhQiwfEntRz78UomESsMPm9dc/J0TdU7KKuOC0d0zDuJvAGm00a Yt3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=v4GZ/jYkXszE1mls+kEMDdrPEPVfJzO/2ICpEIaBNDQ=; b=h4sFHhOyDno2MeacSS/V4dDOvg/SN5eZIm8K0qFLLw5kmhVrSjObf3/ViNKTcirGc1 YGKYa6LyJAbxpCaTRhqeUL6in2OcJXJBUKMMEet3Z4DIBXTptv0Qw7xaYA98C02EuzoP t+RdKQ9BbE20xgKYNGG4XX4ONiGZZUUEwmXA9BTuUsb/lmiURkk/a6EOfxbGKPXyYucW bNY4wpa+gPYr915R/1/r9wvDFfJ58p9tKlHsGTrE9YdfctRXgDJYcOU5ay+z2Ce2ekfW ENeYpFWHtQUwlj7v/lQbSaAd4juERHZnA+W+8aHqjKhtyj/qiHEUvV4bDuiSZzCWQJCI XiYw== X-Gm-Message-State: AOAM531S54Gg4AjblWYcXyMZtmXwJxBaqIhBiV9A2ZHPb7zUDpWV+SKZ tkmMzfJ3Jph986bwz7u7WFnHcppASJw2vuk3TXBN3A== X-Received: by 2002:a65:4485:: with SMTP id l5mr14014104pgq.10.1605820419400; Thu, 19 Nov 2020 13:13:39 -0800 (PST) MIME-Version: 1.0 References: <20201113195553.1487659-1-natechancellor@gmail.com> <20201119204656.3261686-2-natechancellor@gmail.com> In-Reply-To: <20201119204656.3261686-2-natechancellor@gmail.com> From: Nick Desaulniers Date: Thu, 19 Nov 2020 13:13:27 -0800 Message-ID: Subject: Re: [PATCH v2 2/2] kbuild: Disable CONFIG_LD_ORPHAN_WARN for ld.lld 10.0.1 To: Nathan Chancellor Cc: Masahiro Yamada , Michal Marek , Kees Cook , Russell King , Catalin Marinas , Will Deacon , Michael Ellerman , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Arvind Sankar , LKML , Linux Kbuild mailing list , Linux ARM , linuxppc-dev , clang-built-linux , "kernelci . org bot" , Mark Brown Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 19, 2020 at 12:57 PM Nathan Chancellor wrote: > > ld.lld 10.0.1 spews a bunch of various warnings about .rela sections, > along with a few others. Newer versions of ld.lld do not have these > warnings. As a result, do not add '--orphan-handling=warn' to > LDFLAGS_vmlinux if ld.lld's version is not new enough. > > Link: https://github.com/ClangBuiltLinux/linux/issues/1187 > Link: https://github.com/ClangBuiltLinux/linux/issues/1193 > Reported-by: Arvind Sankar > Reported-by: kernelci.org bot > Reported-by: Mark Brown > Reviewed-by: Kees Cook > Signed-off-by: Nathan Chancellor Thanks for the additions in v2. Reviewed-by: Nick Desaulniers > --- > > v1 -> v2: > > * Add condition as a depends on line (Kees Cook) > > * Capture output of "$* --version" to avoid invoking linker twice (Nick > Desaulniers) > > * Improve documentation of script in comments (Nick Desaulniers) > > * Pick up review tag from Kees > > MAINTAINERS | 1 + > init/Kconfig | 5 +++++ > scripts/lld-version.sh | 20 ++++++++++++++++++++ > 3 files changed, 26 insertions(+) > create mode 100755 scripts/lld-version.sh > > diff --git a/MAINTAINERS b/MAINTAINERS > index e451dcce054f..e6f74f130ae1 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -4284,6 +4284,7 @@ B: https://github.com/ClangBuiltLinux/linux/issues > C: irc://chat.freenode.net/clangbuiltlinux > F: Documentation/kbuild/llvm.rst > F: scripts/clang-tools/ > +F: scripts/lld-version.sh > K: \b(?i:clang|llvm)\b > > CLEANCACHE API > diff --git a/init/Kconfig b/init/Kconfig > index 92c58b45abb8..b9037d6c5ab3 100644 > --- a/init/Kconfig > +++ b/init/Kconfig > @@ -47,6 +47,10 @@ config CLANG_VERSION > int > default $(shell,$(srctree)/scripts/clang-version.sh $(CC)) > > +config LLD_VERSION > + int > + default $(shell,$(srctree)/scripts/lld-version.sh $(LD)) > + > config CC_CAN_LINK > bool > default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(m64-flag)) if 64BIT > @@ -1351,6 +1355,7 @@ config LD_DEAD_CODE_DATA_ELIMINATION > config LD_ORPHAN_WARN > def_bool y > depends on ARCH_WANT_LD_ORPHAN_WARN > + depends on !LD_IS_LLD || LLD_VERSION >= 110000 > depends on $(ld-option,--orphan-handling=warn) > > config SYSCTL > diff --git a/scripts/lld-version.sh b/scripts/lld-version.sh > new file mode 100755 > index 000000000000..d70edb4d8a4f > --- /dev/null > +++ b/scripts/lld-version.sh > @@ -0,0 +1,20 @@ > +#!/bin/sh > +# SPDX-License-Identifier: GPL-2.0 > +# > +# Usage: $ ./scripts/lld-version.sh ld.lld > +# > +# Print the linker version of `ld.lld' in a 5 or 6-digit form > +# such as `100001' for ld.lld 10.0.1 etc. > + > +linker_string="$($* --version)" > + > +if ! ( echo $linker_string | grep -q LLD ); then > + echo 0 > + exit 1 > +fi > + > +VERSION=$(echo $linker_string | cut -d ' ' -f 2) > +MAJOR=$(echo $VERSION | cut -d . -f 1) > +MINOR=$(echo $VERSION | cut -d . -f 2) > +PATCHLEVEL=$(echo $VERSION | cut -d . -f 3) > +printf "%d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL > -- > 2.29.2 > -- Thanks, ~Nick Desaulniers