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=-15.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 283A4C2D0E4 for ; Wed, 18 Nov 2020 03:14:54 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 3B52E2071E for ; Wed, 18 Nov 2020 03:14:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="o34wWzdF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B52E2071E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4CbSbY6XqzzDqfL for ; Wed, 18 Nov 2020 14:14:49 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::743; helo=mail-qk1-x743.google.com; envelope-from=natechancellor@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=o34wWzdF; dkim-atps=neutral Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4CbSY92qyTzDqcx for ; Wed, 18 Nov 2020 14:12:43 +1100 (AEDT) Received: by mail-qk1-x743.google.com with SMTP id 199so475136qkg.9 for ; Tue, 17 Nov 2020 19:12:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=fXDEaamCc9cNe2G88QdF1xReSrB2zl6AsnQsnXkLyag=; b=o34wWzdFzmcx7vctOlyVIm1v/vOD52euxvC5/0IRwXvWpPsX0HtVO/9j9aWaLYpvk9 897ozEq9m0Bs/UoxUTQ/ZIGRmjQZ0WSOTFG/+eURnM3N8O93IiqHc8xh0m8DTbPirtMA OaZcKmrPSdpROFajH7KTUuExrkwpOSIH7PL6PHDNU8Bj90WykAg5GbXW0Q8JCuDeDxUI ZLP7pnWHERDGyMYc2sDH9rAWwHUElv4cN0parrlHQYFN3G5gmq9AqO//4d7IWazCRlz0 x3Hi2YRP2C9ONd2/4scTDMrfKhNQcp1+5zafHC16hN//uOW7/G3SGoQcuntAOA+M7GC/ 5fNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=fXDEaamCc9cNe2G88QdF1xReSrB2zl6AsnQsnXkLyag=; b=e7gEw5ue3covxxovKNGXJcq9z1C2QyP0xng09MIvGaCOuZVBGVHcSFo9w/ZDMNU2eB q+s6yV5qIE1mFLR0+ryEuK+ZlazDFy9qU+rTFP4Rssp0I2Qg5bSevP8kcPOMaJDpOzds VDOaXkjsJTzl4iRTjN9xPHe88ZShDy181xLEH8nb3wHlXf2u0BLw92u6NIMrRyamxc3t j70cyAxBmC5oMLjH3zLfpNdL7JIIAKB+mt7X9Ej+wT0n1OQuheSInir+gKecZ7pYPuoO TBk/FrE9TGgM9att4JFZzjAe4x/uec+8s/6390oS/iFuTYQQbJM3GUIr39oxS0QVzicf fsjg== X-Gm-Message-State: AOAM532317AKIPCnHnAftizEwPi4Has22Jwq+1v7wib4nHISeFvTP9FM HtORPTFpjGhVwrtpqOObZRI= X-Google-Smtp-Source: ABdhPJylfE4BKVnK/nYhBplDrg1IDIsJMBfSGYffTkTaRtdFtRK0synkHeRjnafx4SzFZO5PcgGuGA== X-Received: by 2002:a37:4a8e:: with SMTP id x136mr2917466qka.434.1605669160339; Tue, 17 Nov 2020 19:12:40 -0800 (PST) Received: from ubuntu-m3-large-x86 ([2604:1380:45f1:1d00::1]) by smtp.gmail.com with ESMTPSA id a6sm1877666qkg.136.2020.11.17.19.12.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 19:12:39 -0800 (PST) Date: Tue, 17 Nov 2020 20:12:37 -0700 From: Nathan Chancellor To: Nick Desaulniers Subject: Re: [PATCH 2/2] kbuild: Disable CONFIG_LD_ORPHAN_WARN for ld.lld 10.0.1 Message-ID: <20201118031237.GA1001457@ubuntu-m3-large-x86> References: <20201113195553.1487659-1-natechancellor@gmail.com> <20201113195553.1487659-2-natechancellor@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michal Marek , Kees Cook , "kernelci . org bot" , Linux Kbuild mailing list , Mark Brown , Catalin Marinas , Masahiro Yamada , "maintainer:X86 ARCHITECTURE \(32-BIT AND 64-BIT\)" , Russell King , LKML , linuxppc-dev , Arvind Sankar , Ingo Molnar , Borislav Petkov , clang-built-linux , Thomas Gleixner , Will Deacon , Linux ARM Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Tue, Nov 17, 2020 at 11:41:15AM -0800, Nick Desaulniers wrote: > 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). Below is the impending v2 if you wanted to give it an early test, I plan to send it along formally Thursday morning with all of the addressed feedback so far. Cheers, Nathan ====================================================================== >From 1ef9b12daf2b19ed6687423483d5bb1f5cf82e13 Mon Sep 17 00:00:00 2001 From: Nathan Chancellor Date: Tue, 17 Nov 2020 20:11:26 -0700 Subject: [PATCH] kbuild: Disable CONFIG_LD_ORPHAN_WARN for ld.lld 10.0.1 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 --- MAINTAINERS | 1 + init/Kconfig | 9 ++++++++- scripts/lld-version.sh | 20 ++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) 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 a270716562de..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 @@ -1349,7 +1353,10 @@ 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 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 bool 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