Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1722867
| From | tip-bot for David Carrillo-Cisneros <tipbot@zytor.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [tip:perf/core] perf tools: Robustify detection of clang binary |
| Date | 2017-08-29 23:30 +0200 |
| Message-ID | <ujWf8-7TR-27@gated-at.bofh.it> (permalink) |
| References | <uj0E9-4Hq-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Commit-ID: 3866058ef15b6ae6f4ff48e088428b46bcc43fa1
Gitweb: http://git.kernel.org/tip/3866058ef15b6ae6f4ff48e088428b46bcc43fa1
Author: David Carrillo-Cisneros <davidcc@google.com>
AuthorDate: Sun, 27 Aug 2017 00:54:40 -0700
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 28 Aug 2017 16:44:46 -0300
perf tools: Robustify detection of clang binary
Prior to this patch, make scripts tested for CLANG with ifeq ($(CC),
clang), failing to detect CLANG binaries with different names. Fix it by
testing for the existence of __clang__ macro in the list of compiler
defined macros.
Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Paul Turner <pjt@google.com>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/20170827075442.108534-5-davidcc@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/api/Makefile | 2 +-
tools/lib/subcmd/Makefile | 2 +-
tools/perf/Makefile.config | 4 ++--
tools/perf/util/intel-pt-decoder/Build | 2 +-
tools/scripts/Makefile.include | 4 +++-
5 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile
index 2538675..4563ba7 100644
--- a/tools/lib/api/Makefile
+++ b/tools/lib/api/Makefile
@@ -19,7 +19,7 @@ LIBFILE = $(OUTPUT)libapi.a
CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC
-ifeq ($(CC), clang)
+ifeq ($(CC_NO_CLANG), 0)
CFLAGS += -O3
else
CFLAGS += -O6
diff --git a/tools/lib/subcmd/Makefile b/tools/lib/subcmd/Makefile
index 3d1c3b5..7e9f03c 100644
--- a/tools/lib/subcmd/Makefile
+++ b/tools/lib/subcmd/Makefile
@@ -21,7 +21,7 @@ LIBFILE = $(OUTPUT)libsubcmd.a
CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC
-ifeq ($(CC), clang)
+ifeq ($(CC_NO_CLANG), 0)
CFLAGS += -O3
else
CFLAGS += -O6
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 6a64c6b..63f534a 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -148,7 +148,7 @@ ifndef DEBUG
endif
ifeq ($(DEBUG),0)
-ifeq ($(CC), clang)
+ifeq ($(CC_NO_CLANG), 0)
CFLAGS += -O3
else
CFLAGS += -O6
@@ -184,7 +184,7 @@ ifdef PYTHON_CONFIG
PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
- ifeq ($(CC), clang)
+ ifeq ($(CC_NO_CLANG), 1)
PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS))
endif
FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
diff --git a/tools/perf/util/intel-pt-decoder/Build b/tools/perf/util/intel-pt-decoder/Build
index 7aca5d6..10e0814 100644
--- a/tools/perf/util/intel-pt-decoder/Build
+++ b/tools/perf/util/intel-pt-decoder/Build
@@ -25,6 +25,6 @@ $(OUTPUT)util/intel-pt-decoder/intel-pt-insn-decoder.o: util/intel-pt-decoder/in
CFLAGS_intel-pt-insn-decoder.o += -I$(OUTPUT)util/intel-pt-decoder
-ifneq ($(CC), clang)
+ifeq ($(CC_NO_CLANG), 1)
CFLAGS_intel-pt-insn-decoder.o += -Wno-override-init
endif
diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
index ccad8ce..1e8b611 100644
--- a/tools/scripts/Makefile.include
+++ b/tools/scripts/Makefile.include
@@ -39,7 +39,9 @@ EXTRA_WARNINGS += -Wundef
EXTRA_WARNINGS += -Wwrite-strings
EXTRA_WARNINGS += -Wformat
-ifneq ($(CC), clang)
+CC_NO_CLANG := $(shell $(CC) -dM -E -x c /dev/null | grep -Fq "__clang__"; echo $$?)
+
+ifeq ($(CC_NO_CLANG), 1)
EXTRA_WARNINGS += -Wstrict-aliasing=3
endif
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/6] perf tools: Minor build fixes David Carrillo-Cisneros <davidcc@google.com> - 2017-08-27 10:00 +0200
[PATCH 4/6] perf tools: Robustify detection of clang binary David Carrillo-Cisneros <davidcc@google.com> - 2017-08-27 10:00 +0200
[tip:perf/core] perf tools: Robustify detection of clang binary tip-bot for David Carrillo-Cisneros <tipbot@zytor.com> - 2017-08-29 23:30 +0200
[PATCH 3/6] tools lib: Allow external definition of CC, AR and LD David Carrillo-Cisneros <davidcc@google.com> - 2017-08-27 10:00 +0200
[tip:perf/core] tools lib: Allow external definition of CC, AR and LD tip-bot for David Carrillo-Cisneros <tipbot@zytor.com> - 2017-08-29 23:30 +0200
[PATCH 2/6] perf tools: Allow external definition of flex and bison binary names David Carrillo-Cisneros <davidcc@google.com> - 2017-08-27 10:00 +0200
[tip:perf/core] perf tools: Allow external definition of flex and bison binary names tip-bot for David Carrillo-Cisneros <tipbot@zytor.com> - 2017-08-29 23:30 +0200
[PATCH 1/6] tools build tests: Don't hardcode gcc name David Carrillo-Cisneros <davidcc@google.com> - 2017-08-27 10:00 +0200
[tip:perf/core] tools build tests: Don't hardcode gcc name tip-bot for David Carrillo-Cisneros <tipbot@zytor.com> - 2017-08-29 23:30 +0200
[PATCH 5/6] perf tools: Remove BUG_ON char[] to bool implicit conversions David Carrillo-Cisneros <davidcc@google.com> - 2017-08-27 10:00 +0200
Re: [PATCH 5/6] perf tools: Remove BUG_ON char[] to bool implicit conversions Jiri Olsa <jolsa@redhat.com> - 2017-08-28 11:40 +0200
[PATCH] perf tools: Remove BUG_ON char[] to bool implicit conversions David Carrillo-Cisneros <davidcc@google.com> - 2017-08-28 20:40 +0200
Re: [PATCH 0/6] perf tools: Minor build fixes Jiri Olsa <jolsa@redhat.com> - 2017-08-28 11:40 +0200
Re: [PATCH 0/6] perf tools: Minor build fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-08-28 16:20 +0200
Re: [PATCH 0/6] perf tools: Minor build fixes David Carrillo-Cisneros <davidcc@google.com> - 2017-08-28 20:40 +0200
csiph-web