From patchwork Thu Nov 19 20:46:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 11918947 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=-18.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,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,USER_AGENT_GIT 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 5BA15C388F9 for ; Thu, 19 Nov 2020 20:58:26 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 DDA0820679 for ; Thu, 19 Nov 2020 20:58:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ybyrlEyh"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="uDFEv2oS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DDA0820679 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lj3ohjhEQqHWm34Wfj6FEQ3t+yZfaJfAwfiynMg6NIY=; b=ybyrlEyh6Ux2spCrG1oWwKYar 5U0ICpAFfMsxpk612hmR4lsUqidTK89dgB5Rx1r/1jCowsyuPzFOWzKmygKEA2Lvf7IXj+BTBfNEa siuJqkQkjMBgZWv2OO/3HG5Hq7gdTfOLm6hw5lZa0SRznMnKf5dTKIvUdZuzj3MMiuyizJAGLOz4N iflhIIOBTRbbfqgCvNOM//uc6BSrNylK7Jz4HBxCXfO6Hl8gddUtMIhKP40KW5zgcUg7qvuzgpBEq civboacGuwaGP0EfAhLGgLfm/T8XYaDVvxEHB7yQboLOgiK2off4B9oMXe+lkDrazqoh+f3it+yC0 2ufjK+O7g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfqzP-0008JG-CU; Thu, 19 Nov 2020 20:57:11 +0000 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfqzH-0008Go-5s for linux-arm-kernel@lists.infradead.org; Thu, 19 Nov 2020 20:57:04 +0000 Received: by mail-qk1-x743.google.com with SMTP id 11so6872090qkd.5 for ; Thu, 19 Nov 2020 12:57:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=moOxL8imdBPuCB1TVd3+9oe+UH2t4tfUVnJemRAZuA4=; b=uDFEv2oScZscfpUCpr67JL0lOgnOI2BRUTpuJW+ttBg6ndIPmOtvf/Eo2k8Zmv2ugf oDnMkWwJWkaUbEV6jTqWFv7pohpcppcktwsiY/wY4BTaJyx4RxBlz3EH+T3Lq6L1Sgr3 tzMaPbwyM/aKUan7BooGbju0FVUuFOUqqiUToeSJx5O8HCA7LhirNm30a3XnmDRg/22W 5Y3s6e5hgbOwZVEs2apioEy3pFEo8SahFW9IRvT4xr9kAxqBj1RU1MJHL1FcRM8e474A eGxEK0OzM5WkEL/VHKL9sFQVM8vVJnhmFOmj3kETGLstLEhDF6RipfyWwJOgPBFe+pHD WxGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=moOxL8imdBPuCB1TVd3+9oe+UH2t4tfUVnJemRAZuA4=; b=CQmwYGrDVQXaj4bBDSKl3+MtbnDIdt01MvV+f+mZIYQRhYt2eH6d6YYCF1hsliHcZ+ eu3d8vHPwDTOY64kdLdHu1+J+cHSrpkYFPO8FpDgh1c7DDsGD1yZ3xxngceEIUjK/z7u mrwVjbGewfbiKzYacPi/8Ok0D+PiqBeKPAQIzM5HblN8IvzEa9S5wQc3aiyebM+jxpwj haIrIz+SXoTfbIK6PxmGKeX6x1GURrgk8CCo0uNt44Ly86/w7Ki6MNDfgp/0Xzeexjna l0mZZY1HfnSYWXjQh3AxZlrTaJIcf+93gCmmsuIkUnzXy7GhQnR6uzXAkXQ8HCeGnn6/ ER/w== X-Gm-Message-State: AOAM533SDV60qzsrPrOUBBGf16/i0NfELPIy1vdBAVfjmsncyKn5Uk66 SExsa1AJVAC92lL/NB2SM4A= X-Google-Smtp-Source: ABdhPJykpdxUp+qOeObH8VdNp8zHwtu+fKXhT5aKLKVjsWBWyNKin9ChMzRWd+T5YA1Zo00LWaPkwg== X-Received: by 2002:a37:6688:: with SMTP id a130mr12248572qkc.163.1605819421641; Thu, 19 Nov 2020 12:57:01 -0800 (PST) Received: from localhost.localdomain ([2604:1380:45f1:1d00::1]) by smtp.gmail.com with ESMTPSA id 82sm714348qke.76.2020.11.19.12.57.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2020 12:57:00 -0800 (PST) From: Nathan Chancellor To: Masahiro Yamada , Michal Marek , Kees Cook Subject: [PATCH v2 2/2] kbuild: Disable CONFIG_LD_ORPHAN_WARN for ld.lld 10.0.1 Date: Thu, 19 Nov 2020 13:46:58 -0700 Message-Id: <20201119204656.3261686-2-natechancellor@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201113195553.1487659-1-natechancellor@gmail.com> References: <20201113195553.1487659-1-natechancellor@gmail.com> MIME-Version: 1.0 X-Patchwork-Bot: notify X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201119_155703_317588_CC492531 X-CRM114-Status: GOOD ( 18.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, "kernelci . org bot" , linux-kbuild@vger.kernel.org, Catalin Marinas , Mark Brown , x86@kernel.org, Nick Desaulniers , Russell King , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Arvind Sankar , Ingo Molnar , Borislav Petkov , Michael Ellerman , Thomas Gleixner , Will Deacon , Nathan Chancellor , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 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