All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: <xen-devel@lists.xenproject.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>, Wei Liu <wl@xen.org>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Jan Beulich <jbeulich@suse.com>,
	Anthony PERARD <anthony.perard@citrix.com>
Subject: [Xen-devel] [XEN PATCH 5/8] xen: Import cc-ifversion from Kbuild
Date: Thu, 12 Dec 2019 18:27:37 +0000	[thread overview]
Message-ID: <20191212182740.2190199-6-anthony.perard@citrix.com> (raw)
In-Reply-To: <20191212182740.2190199-1-anthony.perard@citrix.com>

This is in preparation of importing Kbuild to build Xen. We won't be
able to include Config.mk so we will need a replacement for the macro
`cc-ifversion'.

This patch imports parts of "scripts/Kbuild.include" from Linux v5.4,
the macro cc-ifversion. It makes use of CONFIG_GCC_VERSION that
Kconfig now provides.

Since they are no other use of Xen's `cc-ifversion' macro, we can
remove it.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 Config.mk                    | 5 -----
 xen/Rules.mk                 | 1 +
 xen/common/coverage/Makefile | 8 ++++----
 xen/scripts/Kbuild.include   | 7 +++++++
 4 files changed, 12 insertions(+), 9 deletions(-)
 create mode 100644 xen/scripts/Kbuild.include

diff --git a/Config.mk b/Config.mk
index 35d66e5e121a..65649d6122d1 100644
--- a/Config.mk
+++ b/Config.mk
@@ -121,11 +121,6 @@ define cc-ver-check-closure
     endif
 endef
 
-# cc-ifversion: Check compiler version and take branch accordingly
-# Usage $(call cc-ifversion,lt,0x040700,string_if_y,string_if_n)
-cc-ifversion = $(shell [ $(call cc-ver,$(CC),$(1),$(2)) = "y" ] \
-				&& echo $(3) || echo $(4))
-
 # Require GCC v4.1+
 check-$(gcc) = $(call cc-ver-check,CC,0x040100,"Xen requires at least gcc-4.1")
 $(eval $(check-y))
diff --git a/xen/Rules.mk b/xen/Rules.mk
index 5aba841b0a95..d053dbd26526 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -2,6 +2,7 @@
 -include $(BASEDIR)/include/config/auto.conf
 
 include $(XEN_ROOT)/Config.mk
+include $(BASEDIR)/scripts/Kbuild.include
 
 
 ifneq ($(origin crash_debug),undefined)
diff --git a/xen/common/coverage/Makefile b/xen/common/coverage/Makefile
index 46c78d1086d6..b509e51f960b 100644
--- a/xen/common/coverage/Makefile
+++ b/xen/common/coverage/Makefile
@@ -1,10 +1,10 @@
 obj-y += coverage.o
 ifneq ($(clang),y)
 obj-y += gcov_base.o gcov.o
-obj-y += $(call cc-ifversion,lt,0x040700, \
-		gcc_3_4.o, $(call cc-ifversion,lt,0x040900, \
-		gcc_4_7.o, $(call cc-ifversion,lt,0x050000, \
-		gcc_4_9.o, $(call cc-ifversion,lt,0x070000, \
+obj-y += $(call cc-ifversion,-lt,0407, \
+		gcc_3_4.o, $(call cc-ifversion,-lt,0409, \
+		gcc_4_7.o, $(call cc-ifversion,-lt,0500, \
+		gcc_4_9.o, $(call cc-ifversion,-lt,0700, \
 		gcc_5.o, gcc_7.o))))
 else
 obj-y += llvm.o
diff --git a/xen/scripts/Kbuild.include b/xen/scripts/Kbuild.include
new file mode 100644
index 000000000000..a5c462fd9777
--- /dev/null
+++ b/xen/scripts/Kbuild.include
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0
+####
+# kbuild: Generic definitions
+
+# cc-ifversion
+# Usage:  EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
+cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || echo $(4))
-- 
Anthony PERARD


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2019-12-12 18:28 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-12 18:27 [Xen-devel] [XEN PATCH 0/8] xen: Kconfig update with few extra Anthony PERARD
2019-12-12 18:27 ` [Xen-devel] [XEN PATCH 1/8] Config.mk: Remove unused setvar_dir macro Anthony PERARD
2019-12-12 18:30   ` Andrew Cooper
2019-12-13 14:51     ` Anthony PERARD
2019-12-12 18:27 ` [Xen-devel] [XEN PATCH 2/8] Config.mk: Remove stray comment Anthony PERARD
2019-12-12 18:32   ` Andrew Cooper
2019-12-13 15:16     ` Anthony PERARD
2019-12-12 18:27 ` [Xen-devel] [XEN PATCH 3/8] xen: Update Kconfig to Linux v5.4 Anthony PERARD
2019-12-12 18:45   ` Andrew Cooper
2019-12-13 15:31     ` Anthony PERARD
2019-12-13 11:05   ` Jan Beulich
2019-12-13 15:49     ` Anthony PERARD
2019-12-13 16:59       ` Jan Beulich
2019-12-13 19:17         ` Andrew Cooper
2019-12-16 10:16           ` Jan Beulich
2019-12-16 14:01             ` Anthony PERARD
2019-12-16 15:55               ` Jan Beulich
2019-12-16 16:34                 ` Anthony PERARD
2019-12-12 18:27 ` [Xen-devel] [XEN PATCH 4/8] xen: Have Kconfig check $(CC)'s version Anthony PERARD
2019-12-12 18:56   ` Andrew Cooper
2019-12-13 16:08     ` Anthony PERARD
2019-12-12 18:27 ` Anthony PERARD [this message]
2019-12-12 18:56   ` [Xen-devel] [XEN PATCH 5/8] xen: Import cc-ifversion from Kbuild Andrew Cooper
2019-12-12 18:27 ` [Xen-devel] [XEN PATCH 6/8] xen: Move CONFIG_INDIRECT_THUNK to Kconfig Anthony PERARD
2019-12-12 18:58   ` Andrew Cooper
2019-12-13 11:13   ` Jan Beulich
2019-12-13 12:18     ` Anthony PERARD
2019-12-13 12:27       ` Jan Beulich
2020-02-18 16:43       ` Jan Beulich
2020-02-18 17:13         ` Anthony PERARD
2020-02-19  7:55           ` Jan Beulich
2019-12-12 18:27 ` [Xen-devel] [XEN PATCH 7/8] xen: Use $(CONFIG_CC_IS_CLANG) instead of $(clang) in Makefile Anthony PERARD
2019-12-12 19:00   ` Andrew Cooper
2019-12-13 14:37     ` Anthony PERARD
2019-12-12 18:27 ` [Xen-devel] [XEN PATCH 8/8] xen: Move GCC_HAS_VISIBILITY_ATTRIBUTE to Kconfig and common Anthony PERARD
2019-12-12 19:04   ` Andrew Cooper
2019-12-13 11:27     ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191212182740.2190199-6-anthony.perard@citrix.com \
    --to=anthony.perard@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=konrad.wilk@oracle.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.