From mboxrd@z Thu Jan 1 00:00:00 1970 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=-28.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 B23FCC64E7B for ; Tue, 17 Nov 2020 19:41:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6441522210 for ; Tue, 17 Nov 2020 19:41:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="dRx9LRqt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730390AbgKQTl3 (ORCPT ); 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-Google-Smtp-Source: ABdhPJwDity6T8yzzbWGKSDq/bdE3JNe9KWacLBcdOoRoKbH+pmtyjSTnlkogXOyLkkn+mwymDhBgdSpMrc0Vv23Rik= 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