From patchwork Fri Nov 13 19:55:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 11904519 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=-17.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,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 BEF3AC55ABD for ; Fri, 13 Nov 2020 19:56:44 +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 509B12076B for ; Fri, 13 Nov 2020 19:56:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="VWXMIOpx"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Rz7bo515" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 509B12076B 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=pQuXC8Yc3OrORxXb9PJ4f86u/5m00AMH9hJ5vyy+sg8=; b=VWXMIOpxXpvEWbdiiwjN+Rmwj 3fZBYY6WmZr44lNZ5CoxM1G927wQ7O2HRDQJ+GdeMiV/jYLFXB1FL9+jirClGOcgYmJKDQnaw+KTR qhgJxHdAnpoITWRzKUqkLL6Wl5R1HVUhNBwibQKImPEBs2Sf5nXLxUD6xTI7KNso9PHkgfD6X9ny+ Wfo1orrp4m7JyR0YBifceSzO42Yc4HTlHuPQUd3DUgJOWnICbJsUUHFDjjOZXfxJH+DAp2RZSWQuj WmdxICwPg9fxSae4LLJed+OEjxw9d7/fUQAL/QAkGkx9EjWUtUNSfO8eWz6A/Wujnr2nMDqlQK0C9 dc8FOrrQg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdfBD-0002aT-34; Fri, 13 Nov 2020 19:56:19 +0000 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdfB5-0002XJ-27 for linux-arm-kernel@lists.infradead.org; Fri, 13 Nov 2020 19:56:12 +0000 Received: by mail-qk1-x741.google.com with SMTP id n132so9977141qke.1 for ; Fri, 13 Nov 2020 11:56:10 -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=BuSBR3W0Up+xs4RMbJtfRRlgixduLeoiJlhk7xnEIR0=; b=Rz7bo5155yveyQ9ZrU3UXRmgFVAlpmKkI/wTgDabwLcf/AW274xZWtGwKaoFUHCuWV AlUe5BkWT/spMfkjOhGCLbH/P6zUhfVdE0Ya0L1jSSCP5uofyayDsp4lUMXVQtrOM4iq ymSNPlt7IqY/MlDkIJMQo1VjmPcK94pRwWf4QkNu+vVjHunZEg9cnxjY4plQCq/MKl+H cCHXsuMrxAVYpHLpMIehHAJKLLkv6OrYRA/SZyIZR3JxxDw5jpL2lTKg1vC3GAVhk/rE /vPKiSV5CAXK/3t0WeX1/3ZNsY/Ul5dLS8lV0uol/Cj+UtRt/Zk4sIh6yididMuf64Ba GLBg== 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=BuSBR3W0Up+xs4RMbJtfRRlgixduLeoiJlhk7xnEIR0=; b=rtB9PbJYOrmLoYwFq1Q4B5+oBOOal3hn6oWoPlVPGWgDCza7mV0bxazqqbbhj7E4WA Sx58u0BAvpPtuTv4Y6sGfhuTah5zAC0KFdzbcuTlE/NvNj4MlGC+m6U0Fw2PxQb53KNi IYA35WgGMMR4SqF/BbH/ME4+9KoAszcQATYc/7b90eizuB74N4xu7FAGoc67AhWknKoT fYLevFGXRXEHLDu8AfqTdqMLMG0ZCcH/1Tlp4w9loSBs9PCBE+UhpJ+9U6Iips3PWNr7 RgLVxKAUQqjJDBKeg14rnUPexpiPpWU6gLnbAm7kbboaU7JpwjbZqhsVprhhqj1f1Frc PZSA== X-Gm-Message-State: AOAM5317gGz6qddy6zZdfYn9GrI9iiaAg+cOMm+rO96Pt8X/Lds87XY6 H8nHNfBoNckuoA1WGqGhbko= X-Google-Smtp-Source: ABdhPJzdFZIQVJ1DipALLbMQzdXhQ7LqTzyxp6paaFlRduPmNj6wrsGfChmfjhdHmK67f9IFeZWQKQ== X-Received: by 2002:ae9:dec5:: with SMTP id s188mr3767153qkf.250.1605297369148; Fri, 13 Nov 2020 11:56:09 -0800 (PST) Received: from localhost.localdomain ([2604:1380:45f1:1d00::1]) by smtp.gmail.com with ESMTPSA id z26sm6977757qki.40.2020.11.13.11.56.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Nov 2020 11:56:08 -0800 (PST) From: Nathan Chancellor To: Masahiro Yamada , Michal Marek , Kees Cook Subject: [PATCH 2/2] kbuild: Disable CONFIG_LD_ORPHAN_WARN for ld.lld 10.0.1 Date: Fri, 13 Nov 2020 12:55:53 -0700 Message-Id: <20201113195553.1487659-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-20201113_145611_180462_E770F35E X-CRM114-Status: GOOD ( 16.93 ) 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. 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 Reviewed-by: Nick Desaulniers Tested-by: Nick Desaulniers Reviewed-by: Kees Cook 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 | 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 +# +# 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) +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