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>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [Xen-devel] [XEN PATCH 7/8] xen: Use $(CONFIG_CC_IS_CLANG) instead of $(clang) in Makefile
Date: Thu, 12 Dec 2019 18:27:39 +0000	[thread overview]
Message-ID: <20191212182740.2190199-8-anthony.perard@citrix.com> (raw)
In-Reply-To: <20191212182740.2190199-1-anthony.perard@citrix.com>

Kconfig can check if $(CC) is clang or not, if it is
CONFIG_CC_IS_CLANG will be set.

With that patch, the hypervisor can be built using clang by running
`make CC=clang CXX=clang++` without needed to provide an extra clang
parameter.

`make clang=y` still works as Config.mk will set CC and CXX.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/Rules.mk                 | 8 ++++----
 xen/arch/x86/Rules.mk        | 2 +-
 xen/common/coverage/Makefile | 2 +-
 xen/include/Makefile         | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index d053dbd26526..fcdafd029342 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -64,7 +64,7 @@ CFLAGS += -pipe -D__XEN__ -include $(BASEDIR)/include/xen/config.h
 CFLAGS-$(CONFIG_DEBUG_INFO) += -g
 CFLAGS += '-D__OBJECT_FILE__="$@"'
 
-ifneq ($(clang),y)
+ifneq ($(CONFIG_CC_IS_CLANG),y)
 # Clang doesn't understand this command line argument, and doesn't appear to
 # have an suitable alternative.  The resulting compiled binary does function,
 # but has an excessively large symbol table.
@@ -126,7 +126,7 @@ subdir-all := $(subdir-y) $(subdir-n)
 $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += -DINIT_SECTIONS_ONLY
 
 ifeq ($(CONFIG_COVERAGE),y)
-ifeq ($(clang),y)
+ifeq ($(CONFIG_CC_IS_CLANG),y)
     COV_FLAGS := -fprofile-instr-generate -fcoverage-mapping
 else
     COV_FLAGS := -fprofile-arcs -ftest-coverage
@@ -143,7 +143,7 @@ endif
 
 ifeq ($(CONFIG_LTO),y)
 CFLAGS += -flto
-LDFLAGS-$(clang) += -plugin LLVMgold.so
+LDFLAGS-$(CONFIG_CC_IS_CLANG) += -plugin LLVMgold.so
 # Would like to handle all object files as bitcode, but objects made from
 # pure asm are in a different format and have to be collected separately.
 # Mirror the directory tree, collecting them as built_in_bin.o.
@@ -197,7 +197,7 @@ SRCPATH := $(patsubst $(BASEDIR)/%,%,$(CURDIR))
 %.o: %.c Makefile
 ifeq ($(CONFIG_ENFORCE_UNIQUE_SYMBOLS),y)
 	$(CC) $(CFLAGS) -c $< -o $(@D)/.$(@F).tmp
-ifeq ($(clang),y)
+ifeq ($(CONFIG_CC_IS_CLANG),y)
 	$(OBJCOPY) --redefine-sym $<=$(SRCPATH)/$< $(@D)/.$(@F).tmp $@
 else
 	$(OBJCOPY) --redefine-sym $(<F)=$(SRCPATH)/$< $(@D)/.$(@F).tmp $@
diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk
index a2c257fb95b2..b98e14e28c5a 100644
--- a/xen/arch/x86/Rules.mk
+++ b/xen/arch/x86/Rules.mk
@@ -12,7 +12,7 @@ CFLAGS += '-D__OBJECT_LABEL__=$(subst /,$$,$(subst -,_,$(subst $(BASEDIR)/,,$(CU
 # Prevent floating-point variables from creeping into Xen.
 CFLAGS += -msoft-float
 
-ifeq ($(clang),y)
+ifeq ($(CONFIG_CC_IS_CLANG),y)
 # Note: Any test which adds -no-integrated-as will cause subsequent tests to
 # succeed, and not trigger further additions.
 #
diff --git a/xen/common/coverage/Makefile b/xen/common/coverage/Makefile
index b509e51f960b..63f98c71d6b5 100644
--- a/xen/common/coverage/Makefile
+++ b/xen/common/coverage/Makefile
@@ -1,5 +1,5 @@
 obj-y += coverage.o
-ifneq ($(clang),y)
+ifneq ($(CONFIG_CC_IS_CLANG),y)
 obj-y += gcov_base.o gcov.o
 obj-y += $(call cc-ifversion,-lt,0407, \
 		gcc_3_4.o, $(call cc-ifversion,-lt,0409, \
diff --git a/xen/include/Makefile b/xen/include/Makefile
index c3e0283d347f..fde0ca013121 100644
--- a/xen/include/Makefile
+++ b/xen/include/Makefile
@@ -36,7 +36,7 @@ cppflags-y                := -include public/xen-compat.h -DXEN_GENERATING_COMPA
 cppflags-$(CONFIG_X86)    += -m32
 
 # 8-byte types are 4-byte aligned on x86_32 ...
-ifeq ($(clang),y)
+ifeq ($(CONFIG_CC_IS_CLANG),y)
 prefix-$(CONFIG_X86)      := \#pragma pack(push, 4)
 suffix-$(CONFIG_X86)      := \#pragma pack(pop)
 else
-- 
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 ` [Xen-devel] [XEN PATCH 5/8] xen: Import cc-ifversion from Kbuild Anthony PERARD
2019-12-12 18:56   ` 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 ` Anthony PERARD [this message]
2019-12-12 19:00   ` [Xen-devel] [XEN PATCH 7/8] xen: Use $(CONFIG_CC_IS_CLANG) instead of $(clang) in Makefile 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-8-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=roger.pau@citrix.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.