From nobody Tue Feb 10 02:49:11 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1576580407; cv=none; d=zohomail.com; s=zohoarc; b=Wlao7pNbWEEXXGPMqVhYgVVVZVKr1cDF4npOuzYDTXgMlHMhYtGs8UKh4QYcc0z7irCH7oNhGU2lWK73F/ZvdS2cAr82VxpKzrF7QMmQWzcmcVItWIYG/lVpXnuyCtWRVf65CpbmE1WapTD8Jv1BOsz5JfX9rGM981jXZQWnpQU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576580407; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+po+ZZgbylAO7f0WzyV2FNBnN5Eyg+test2V1DCZPbo=; b=hI2t44nJY0f2avxIaRWnWVm7/awAWBhYr+hLrARN8GBzToad2kvyry+HxxqWfQepc6J9zF5n1SqXElBMP1Z/zOM46DmoqL1G8GdbixXspsixq3/wQHTJXpPIeRSmGXudBjrfV+6ZWXlwci18CPflZjWT2POnZdFjD55IqKeEDkY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 157658040747035.37321924139201; Tue, 17 Dec 2019 03:00:07 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ihAZI-00086m-Uc; Tue, 17 Dec 2019 10:59:08 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ihAZH-00086h-GS for xen-devel@lists.xenproject.org; Tue, 17 Dec 2019 10:59:07 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 3e27e0aa-20bc-11ea-8e9d-12813bfff9fa; Tue, 17 Dec 2019 10:59:06 +0000 (UTC) X-Inumbo-ID: 3e27e0aa-20bc-11ea-8e9d-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1576580346; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yUm/2bZSlveXpXlz+YiY8oG5Y26wdJFehLf0nNerXIM=; b=CCKduMpSqnqJRnPflYabUhkOosUIF0lFNVjPkBYk3f3vhRGZcQjtSl59 OO5xlz5nt1hR70v4sFsooFBcyDKu3w2qMLjLfHbUZkIH0pq8Ittn1TBAK XAoofOqSek0zkiHOZaLTrNqPGjobSaix86C3dRQfN2uyC8QiITqu0EBuf E=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=anthony.perard@citrix.com; spf=Pass smtp.mailfrom=anthony.perard@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of anthony.perard@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of anthony.perard@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: oF2jceJrBjJkGPJ7+vZZFlXAnzG3QQjsTvQWv11jcTR9dqgZ1eLEODbSpBoa9EECcojdUfJ52g PbkQSpslDfL7XyFlb6JkI8F12abgiY/8ucGR+LwxSkEm4vb7/WTIQ1mJ+wap7CU2GR7Pacyytg bv9nvAESokfzNAivfBXjwQ8kHdbvNtP0Y21mTagsU5WUkDzO7Fb/bHI4H4yL5CiAV6IBxXnu3Z 6gbhVLTbn306DXemrKXMjqB+pCp4Ir+en4qZg00I4zQrcE66mXaBtBBEM/s9nroAPOyILlGDPT Egw= X-SBRS: 2.7 X-MesageID: 10211654 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,325,1571716800"; d="scan'208";a="10211654" From: Anthony PERARD To: Date: Tue, 17 Dec 2019 10:58:57 +0000 Message-ID: <20191217105901.68158-3-anthony.perard@citrix.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191217105901.68158-1-anthony.perard@citrix.com> References: <20191217105901.68158-1-anthony.perard@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [XEN PATCH v2 2/6] xen: Have Kconfig check $(CC)'s version X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Julien Grall , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Jan Beulich , Anthony PERARD Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This import several files from Linux v5.3 - scripts/Kconfig.include - scripts/clang-version.sh - scripts/gcc-version.sh and several config values from from Linux's init/Kconfig file. Files are copied into scripts/ directory because that's were the files are found in Linux tree, and also because we are going to import more of Kbuild from Linux which is located in scripts/. CONFIG_GCC_VERSION and CONFIG_CC_IS_CLANG are going to be use in follow-up patches. Signed-off-by: Anthony PERARD Acked-by: Andrew Cooper --- Notes: v2: - move the export CC* earlier in xen/Makefile, and add CXX to the list. xen/Kconfig | 17 ++++++++++++++++ xen/Makefile | 2 ++ xen/scripts/Kconfig.include | 39 ++++++++++++++++++++++++++++++++++++ xen/scripts/clang-version.sh | 19 ++++++++++++++++++ xen/scripts/gcc-version.sh | 20 ++++++++++++++++++ 5 files changed, 97 insertions(+) create mode 100644 xen/scripts/Kconfig.include create mode 100755 xen/scripts/clang-version.sh create mode 100755 xen/scripts/gcc-version.sh diff --git a/xen/Kconfig b/xen/Kconfig index 01067326b4e7..9f6512d65b08 100644 --- a/xen/Kconfig +++ b/xen/Kconfig @@ -4,9 +4,26 @@ # mainmenu "Xen/$(SRCARCH) $(XEN_FULLVERSION) Configuration" =20 +source "scripts/Kconfig.include" + config BROKEN bool =20 +config CC_IS_GCC + def_bool $(success,$(CC) --version | head -n 1 | grep -q gcc) + +config GCC_VERSION + int + default $(shell,$(BASEDIR)/scripts/gcc-version.sh $(CC)) if CC_IS_GCC + default 0 + +config CC_IS_CLANG + def_bool $(success,$(CC) --version | head -n 1 | grep -q clang) + +config CLANG_VERSION + int + default $(shell,$(BASEDIR)/scripts/clang-version.sh $(CC)) + source "arch/$(SRCARCH)/Kconfig" =20 config DEFCONFIG_LIST diff --git a/xen/Makefile b/xen/Makefile index efbe9605e52b..c326fee5880e 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -18,6 +18,8 @@ export XEN_CONFIG_EXPERT ?=3D n PYTHON_INTERPRETER :=3D $(word 1,$(shell which python3 python python2 2>/d= ev/null) python) export PYTHON ?=3D $(PYTHON_INTERPRETER) =20 +export CC CXX LD + export BASEDIR :=3D $(CURDIR) export XEN_ROOT :=3D $(BASEDIR)/.. =20 diff --git a/xen/scripts/Kconfig.include b/xen/scripts/Kconfig.include new file mode 100644 index 000000000000..8221095ca34b --- /dev/null +++ b/xen/scripts/Kconfig.include @@ -0,0 +1,39 @@ +# SPDX-License-Identifier: GPL-2.0-only +# Kconfig helper macros + +# Convenient variables +comma :=3D , +quote :=3D " +squote :=3D ' +empty :=3D +space :=3D $(empty) $(empty) +dollar :=3D $ +right_paren :=3D ) +left_paren :=3D ( + +# $(if-success,,,) +# Return if exits with 0, otherwise. +if-success =3D $(shell,{ $(1); } >/dev/null 2>&1 && echo "$(2)" || echo "$= (3)") + +# $(success,) +# Return y if exits with 0, n otherwise +success =3D $(if-success,$(1),y,n) + +# $(failure,) +# Return n if exits with 0, y otherwise +failure =3D $(if-success,$(1),n,y) + +# $(cc-option,) +# Return y if the compiler supports , n otherwise +cc-option =3D $(success,$(CC) -Werror $(CLANG_FLAGS) $(1) -E -x c /dev/nul= l -o /dev/null) + +# $(ld-option,) +# Return y if the linker supports , n otherwise +ld-option =3D $(success,$(LD) -v $(1)) + +# check if $(CC) and $(LD) exist +$(error-if,$(failure,command -v $(CC)),compiler '$(CC)' not found) +$(error-if,$(failure,command -v $(LD)),linker '$(LD)' not found) + +# gcc version including patch level +gcc-version :=3D $(shell,$(BASEDIR)/scripts/gcc-version.sh $(CC)) diff --git a/xen/scripts/clang-version.sh b/xen/scripts/clang-version.sh new file mode 100755 index 000000000000..6fabf0695761 --- /dev/null +++ b/xen/scripts/clang-version.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# +# clang-version clang-command +# +# Print the compiler version of `clang-command' in a 5 or 6-digit form +# such as `50001' for clang-5.0.1 etc. + +compiler=3D"$*" + +if ! ( $compiler --version | grep -q clang) ; then + echo 0 + exit 1 +fi + +MAJOR=3D$(echo __clang_major__ | $compiler -E -x c - | tail -n 1) +MINOR=3D$(echo __clang_minor__ | $compiler -E -x c - | tail -n 1) +PATCHLEVEL=3D$(echo __clang_patchlevel__ | $compiler -E -x c - | tail -n 1) +printf "%d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL diff --git a/xen/scripts/gcc-version.sh b/xen/scripts/gcc-version.sh new file mode 100755 index 000000000000..ae353432539b --- /dev/null +++ b/xen/scripts/gcc-version.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# +# gcc-version gcc-command +# +# Print the gcc version of `gcc-command' in a 5 or 6-digit form +# such as `29503' for gcc-2.95.3, `30301' for gcc-3.3.1, etc. + +compiler=3D"$*" + +if [ ${#compiler} -eq 0 ]; then + echo "Error: No compiler specified." >&2 + printf "Usage:\n\t$0 \n" >&2 + exit 1 +fi + +MAJOR=3D$(echo __GNUC__ | $compiler -E -x c - | tail -n 1) +MINOR=3D$(echo __GNUC_MINOR__ | $compiler -E -x c - | tail -n 1) +PATCHLEVEL=3D$(echo __GNUC_PATCHLEVEL__ | $compiler -E -x c - | tail -n 1) +printf "%d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL --=20 Anthony PERARD _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel