Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4117923pxb; Tue, 17 Nov 2020 11:44:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJyt5S2ZCxK0TNA2G/2PxmrtT1euzPz7uswzGNmkWxxn3lIzSk/ne54sHwTMSeOLL2hy02ob X-Received: by 2002:a17:906:3c17:: with SMTP id h23mr21376828ejg.374.1605642251167; Tue, 17 Nov 2020 11:44:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605642251; cv=none; d=google.com; s=arc-20160816; b=oT+jGmKL4be6Dnqpmr04K0apsLpHLNtwUXooMQKOufl5tzCrtHH73BOuS6hjaqhOlH 1YRq3igOShVuLX2O26hUYiFOGhckOQk/d+j+gyl8G9wUKZvCpHgbNJ/vtLT/9kyoiMyW kJ5TY9wK+ZrBvC9WNxvrnvi/552xiBZm+P4z1Qus7/yxOm+PsazdjHL5QUmmdAKjJOJk vysrG8eVW/DejjSLdq0cT73KWEBoTXE3uwhMhlHy3Q1yWExtC+E6PvqC6/J5Hs3uIuUl EFjsoyjHgonzHw0pmg0YQ1ouSTWxI0Pl1TwqOOCapB5Vs8tuHTCYlKTeLrro/ZUfGTj3 HZIQ== 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=3Ha3Pf7m43xGsOqdVk/c2fh9M5AzkQhemcyhlHdZ12E=; b=sqY/P23a1NFONf2Q1fovToyCBZSAyXwelFmCnI3voeDNj16E/EPosOD/fhpe0pGrDV lGcnO5/XNasmZPpcbjt+GRQd9OoPl4uV44c6obg1u7gtAbZXLxegQVGIkLIfykK7vJUr RNE4UrWszH0dTehrrNjiszhWhSdz0OV6xzcv4M+Vow9lFPdfcps+Wty2Eou177t8b96x oVFI1DlYkh2+UGzB5PyHMd/ShJw9uFqZU5yJ0QZ27S/Ko/nVOlW2UUNjqIlhIK3iC56F BTZ/1PqH/6Kwwvu/v59sUr4dE8qj8gzAitD9VhNQEDPx+AT320pipwt11BKygKRAwulM 7IEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=dRx9LRqt; 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 cz6si17253795edb.139.2020.11.17.11.43.47; Tue, 17 Nov 2020 11:44:11 -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=dRx9LRqt; 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 S1730287AbgKQTl3 (ORCPT + 99 others); Tue, 17 Nov 2020 14:41:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729594AbgKQTl1 (ORCPT ); Tue, 17 Nov 2020 14:41:27 -0500 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89F8DC0617A6 for ; Tue, 17 Nov 2020 11:41:27 -0800 (PST) Received: by mail-pl1-x643.google.com with SMTP id d3so10823962plo.4 for ; Tue, 17 Nov 2020 11:41:27 -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=3Ha3Pf7m43xGsOqdVk/c2fh9M5AzkQhemcyhlHdZ12E=; b=dRx9LRqtNTIEGpbdDyf15y725bNfdo/TKBV27AztcI9HXmR3EvdD0CAGZSMmvl6Dfy 70FVnIF1ExZyAqsmYE5/5N3a3+ExBgngbr7ZbSeVOEYOHg5W3/mxPh7gjYu7zV7gnFLw HbbVR856G85VrUeI22aF75L9XnbkWBI7l+RpMGNgJuGvegZulJGCQe9+XRorN47pNKBr 9UvQwR0KP9gRyKk3i8s5FonExGNLRDhAbnDFv9EhWFqphul4JiipLpwjnR0BrJcMfMnv ZXthiqEgvHVcoqJnoS/DVun0sodQvm6v0yBPkWaf2q431cbMTJQYIx+7+EfTFvOl9IG0 VhGw== 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=3Ha3Pf7m43xGsOqdVk/c2fh9M5AzkQhemcyhlHdZ12E=; b=T9j6gNQEoEW1/vTyxvxjf/doXYVFybZ9hXEShJWr6RIjlYLQcRDAHK39i52VCzY9Y4 8ruBO5Mm3+6G+3DJZCpxjIjjKBfiWnRx23PqGU50SlvUYtOAqU/SBPIMQI1RRqVXzkZK VvOnmqbQgPEUbriaWp3flCqEn3ACPMD1vmUg3XLbOBCgJ2cALc3GmcD83KhOX7Rn3ORI ah5t+U+Z4UOJI4RvJAnnXcdQXwiarbrz7iqdi2rcuMXV/IqZTuVEj15Vnu7LSD8oBT8O 8CatNvUerE5e6GjUGjZhLJYYADmwqMADsEUQPvbG9lB7YJcT2Gt2U4M9vJKDUAbDVIAx 53lw== X-Gm-Message-State: AOAM532ntaMT33OZ7J8PMyVIJ/85ucYvMjr873WZ+8T9B09cYp331o+q XLLAQmkt/XNeKSkjuDNyOf8FLo7+I9Bx+co40oHdew== X-Received: by 2002:a17:902:221:b029:d8:f938:b112 with SMTP id 30-20020a1709020221b02900d8f938b112mr1006063plc.10.1605642086810; Tue, 17 Nov 2020 11:41:26 -0800 (PST) MIME-Version: 1.0 References: <20201113195553.1487659-1-natechancellor@gmail.com> <20201113195553.1487659-2-natechancellor@gmail.com> In-Reply-To: <20201113195553.1487659-2-natechancellor@gmail.com> From: Nick Desaulniers Date: Tue, 17 Nov 2020 11:41:15 -0800 Message-ID: Subject: Re: [PATCH 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 Fri, Nov 13, 2020 at 11:56 AM 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. > > Reported-by: Arvind Sankar > Reported-by: kernelci.org bot > Reported-by: Mark Brown > Link: https://github.com/ClangBuiltLinux/linux/issues/1187 > Link: https://github.com/ClangBuiltLinux/linux/issues/1193 > Signed-off-by: Nathan Chancellor > --- > MAINTAINERS | 1 + > init/Kconfig | 6 +++++- > scripts/lld-version.sh | 20 ++++++++++++++++++++ > 3 files changed, 26 insertions(+), 1 deletion(-) > create mode 100755 scripts/lld-version.sh > > diff --git a/MAINTAINERS b/MAINTAINERS > index 3da6d8c154e4..4b83d3591ec7 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 a270716562de..40c9ca60ac1d 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 > @@ -1349,7 +1353,7 @@ config LD_DEAD_CODE_DATA_ELIMINATION > own risk. > > config LD_ORPHAN_WARN > - def_bool ARCH_WANT_LD_ORPHAN_WARN && $(ld-option,--orphan-handling=warn) > + def_bool ARCH_WANT_LD_ORPHAN_WARN && $(ld-option,--orphan-handling=warn) && (!LD_IS_LLD || LLD_VERSION >= 110000) > > config SYSCTL > bool > diff --git a/scripts/lld-version.sh b/scripts/lld-version.sh > new file mode 100755 > index 000000000000..cc779f412e39 > --- /dev/null > +++ b/scripts/lld-version.sh > @@ -0,0 +1,20 @@ > +#!/bin/sh > +# SPDX-License-Identifier: GPL-2.0 > +# > +# ld.lld-version ld.lld-command ^ it looks like this format was copied from scripts/gcc-version, but it's kind of curious/cryptic to me for a comment about usage. Is it necessary? A comment in the form: # Usage: ./scripts/lld-version.sh ld.lld Would be clearer to me. > +# > +# Print the linker version of `ld.lld-command' in a 5 or 6-digit form > +# such as `100001' for ld.lld 10.0.1 etc. > + > +linker="$*" > + > +if ! ( $linker --version | grep -q LLD ); then > + echo 0 > + exit 1 > +fi > + > +VERSION=$($linker --version | cut -d ' ' -f 2) This is going to invoke the linker potentially twice if it's LLD. Would it be nicer to capture the output of `$linker --version`, check which linker it is, then slice that up via `cut` to get the version? This version is fine to me, but if you're going to send a v2, that might be a nice slight cleanup. Otherwise, Reviewed-by: Nick Desaulniers Tested-by: Nick Desaulniers (Please drop those tags if you modify this for v2 and I'll rereview/retest). > +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