Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1720785 > unrolled thread

[PATCH 0/6] perf tools: Minor build fixes

Started byDavid Carrillo-Cisneros <davidcc@google.com>
First post2017-08-27 10:00 +0200
Last post2017-08-28 20:40 +0200
Articles 15 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [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

#1720785 — [PATCH 0/6] perf tools: Minor build fixes

FromDavid Carrillo-Cisneros <davidcc@google.com>
Date2017-08-27 10:00 +0200
Subject[PATCH 0/6] perf tools: Minor build fixes
Message-ID<uj0E9-4Hq-3@gated-at.bofh.it>
Collection of minor fixes to compile with LLVM and
non-standard tool names.

David Carrillo-Cisneros (6):
  tools build tests: Don't hardcode gcc name
  perf tools: Allow external definition of flex and bison binary names
  tools lib: Allow external definition of CC, AR and LD
  perf tools: Robustify detection of clang binary
  perf tools: Remove BUG_ON char[] to bool implicit conversions
  perf tools: Pass full path of FEATURES_DUMP

 tools/build/tests/ex/Makefile          |  2 +-
 tools/include/linux/kernel.h           |  2 ++
 tools/lib/api/Makefile                 |  8 ++++----
 tools/lib/subcmd/Makefile              |  2 +-
 tools/perf/Makefile.config             |  4 ++--
 tools/perf/Makefile.perf               |  6 +++---
 tools/perf/builtin-lock.c              | 15 ++++++++++-----
 tools/perf/util/intel-pt-decoder/Build |  2 +-
 tools/scripts/Makefile.include         |  4 +++-
 9 files changed, 27 insertions(+), 18 deletions(-)

-- 
2.14.1.342.g6490525c54-goog

[toc] | [next] | [standalone]


#1720786 — [PATCH 4/6] perf tools: Robustify detection of clang binary

FromDavid Carrillo-Cisneros <davidcc@google.com>
Date2017-08-27 10:00 +0200
Subject[PATCH 4/6] perf tools: Robustify detection of clang binary
Message-ID<uj0E9-4Hq-5@gated-at.bofh.it>
In reply to#1720785
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>
---
 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 2538675731c7..4563ba7ede6f 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 3d1c3b5b5150..7e9f03c97e4c 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 6a64c6bbd9a5..63f534a0902f 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 7aca5d6d7e1f..10e0814bb8d2 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 ccad8ce925e4..1e8b6116ba3c 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
 
-- 
2.14.1.342.g6490525c54-goog

[toc] | [prev] | [next] | [standalone]


#1722867 — [tip:perf/core] perf tools: Robustify detection of clang binary

Fromtip-bot for David Carrillo-Cisneros <tipbot@zytor.com>
Date2017-08-29 23:30 +0200
Subject[tip:perf/core] perf tools: Robustify detection of clang binary
Message-ID<ujWf8-7TR-27@gated-at.bofh.it>
In reply to#1720786
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
 

[toc] | [prev] | [next] | [standalone]


#1720787 — [PATCH 3/6] tools lib: Allow external definition of CC, AR and LD

FromDavid Carrillo-Cisneros <davidcc@google.com>
Date2017-08-27 10:00 +0200
Subject[PATCH 3/6] tools lib: Allow external definition of CC, AR and LD
Message-ID<uj0E9-4Hq-7@gated-at.bofh.it>
In reply to#1720785
Use already defined values for CC, AR and LD when available.

Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
---
 tools/lib/api/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile
index eb6e0b36bfc1..2538675731c7 100644
--- a/tools/lib/api/Makefile
+++ b/tools/lib/api/Makefile
@@ -8,9 +8,9 @@ srctree := $(patsubst %/,%,$(dir $(srctree)))
 #$(info Determined 'srctree' to be $(srctree))
 endif
 
-CC = $(CROSS_COMPILE)gcc
-AR = $(CROSS_COMPILE)ar
-LD = $(CROSS_COMPILE)ld
+CC ?= $(CROSS_COMPILE)gcc
+AR ?= $(CROSS_COMPILE)ar
+LD ?= $(CROSS_COMPILE)ld
 
 MAKEFLAGS += --no-print-directory
 
-- 
2.14.1.342.g6490525c54-goog

[toc] | [prev] | [next] | [standalone]


#1722878 — [tip:perf/core] tools lib: Allow external definition of CC, AR and LD

Fromtip-bot for David Carrillo-Cisneros <tipbot@zytor.com>
Date2017-08-29 23:30 +0200
Subject[tip:perf/core] tools lib: Allow external definition of CC, AR and LD
Message-ID<ujWf9-7TR-51@gated-at.bofh.it>
In reply to#1720787
Commit-ID:  12024aacb0170779cd0b976b06d2e9b1767cf142
Gitweb:     http://git.kernel.org/tip/12024aacb0170779cd0b976b06d2e9b1767cf142
Author:     David Carrillo-Cisneros <davidcc@google.com>
AuthorDate: Sun, 27 Aug 2017 00:54:39 -0700
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 28 Aug 2017 16:44:45 -0300

tools lib: Allow external definition of CC, AR and LD

Use already defined values for CC, AR and LD when available.

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-4-davidcc@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/api/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile
index eb6e0b3..2538675 100644
--- a/tools/lib/api/Makefile
+++ b/tools/lib/api/Makefile
@@ -8,9 +8,9 @@ srctree := $(patsubst %/,%,$(dir $(srctree)))
 #$(info Determined 'srctree' to be $(srctree))
 endif
 
-CC = $(CROSS_COMPILE)gcc
-AR = $(CROSS_COMPILE)ar
-LD = $(CROSS_COMPILE)ld
+CC ?= $(CROSS_COMPILE)gcc
+AR ?= $(CROSS_COMPILE)ar
+LD ?= $(CROSS_COMPILE)ld
 
 MAKEFLAGS += --no-print-directory
 

[toc] | [prev] | [next] | [standalone]


#1720788 — [PATCH 2/6] perf tools: Allow external definition of flex and bison binary names

FromDavid Carrillo-Cisneros <davidcc@google.com>
Date2017-08-27 10:00 +0200
Subject[PATCH 2/6] perf tools: Allow external definition of flex and bison binary names
Message-ID<uj0Ea-4Hq-17@gated-at.bofh.it>
In reply to#1720785
Allow user to define flex and bison binary names by passing
FLEX and BISON variables.

Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
---
 tools/perf/Makefile.perf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index a700a079a218..58924eb0f40b 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -164,8 +164,8 @@ LN      = ln -f
 MKDIR   = mkdir
 FIND    = find
 INSTALL = install
-FLEX    = flex
-BISON   = bison
+FLEX    ?= flex
+BISON   ?= bison
 STRIP   = strip
 AWK     = awk
 
-- 
2.14.1.342.g6490525c54-goog

[toc] | [prev] | [next] | [standalone]


#1722859 — [tip:perf/core] perf tools: Allow external definition of flex and bison binary names

Fromtip-bot for David Carrillo-Cisneros <tipbot@zytor.com>
Date2017-08-29 23:30 +0200
Subject[tip:perf/core] perf tools: Allow external definition of flex and bison binary names
Message-ID<ujWf7-7TR-3@gated-at.bofh.it>
In reply to#1720788
Commit-ID:  39a59f1e3ea541035637432db39158a461f29146
Gitweb:     http://git.kernel.org/tip/39a59f1e3ea541035637432db39158a461f29146
Author:     David Carrillo-Cisneros <davidcc@google.com>
AuthorDate: Sun, 27 Aug 2017 00:54:38 -0700
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 28 Aug 2017 16:44:45 -0300

perf tools: Allow external definition of flex and bison binary names

Allow user to define flex and bison binary names by passing FLEX and
BISON variables.

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-3-davidcc@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile.perf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index a700a07..58924eb 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -164,8 +164,8 @@ LN      = ln -f
 MKDIR   = mkdir
 FIND    = find
 INSTALL = install
-FLEX    = flex
-BISON   = bison
+FLEX    ?= flex
+BISON   ?= bison
 STRIP   = strip
 AWK     = awk
 

[toc] | [prev] | [next] | [standalone]


#1720789 — [PATCH 1/6] tools build tests: Don't hardcode gcc name

FromDavid Carrillo-Cisneros <davidcc@google.com>
Date2017-08-27 10:00 +0200
Subject[PATCH 1/6] tools build tests: Don't hardcode gcc name
Message-ID<uj0E9-4Hq-13@gated-at.bofh.it>
In reply to#1720785
Use $(CC) instead of harcoded gcc binary name.

Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
---
 tools/build/tests/ex/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/build/tests/ex/Makefile b/tools/build/tests/ex/Makefile
index c50d5782ad5a..027d6c8a58a7 100644
--- a/tools/build/tests/ex/Makefile
+++ b/tools/build/tests/ex/Makefile
@@ -8,7 +8,7 @@ ex:
 include $(srctree)/tools/build/Makefile.include
 
 ex: ex-in.o libex-in.o
-	gcc -o $@ $^
+	$(CC) -o $@ $^
 
 ex.%: fixdep FORCE
 	make -f $(srctree)/tools/build/Makefile.build dir=. $@
-- 
2.14.1.342.g6490525c54-goog

[toc] | [prev] | [next] | [standalone]


#1722866 — [tip:perf/core] tools build tests: Don't hardcode gcc name

Fromtip-bot for David Carrillo-Cisneros <tipbot@zytor.com>
Date2017-08-29 23:30 +0200
Subject[tip:perf/core] tools build tests: Don't hardcode gcc name
Message-ID<ujWf8-7TR-21@gated-at.bofh.it>
In reply to#1720789
Commit-ID:  ba5d1a48aab56a2677113d071b5b1446877b9a1a
Gitweb:     http://git.kernel.org/tip/ba5d1a48aab56a2677113d071b5b1446877b9a1a
Author:     David Carrillo-Cisneros <davidcc@google.com>
AuthorDate: Sun, 27 Aug 2017 00:54:37 -0700
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 28 Aug 2017 16:44:44 -0300

tools build tests: Don't hardcode gcc name

Use $(CC) instead of harcoded gcc binary name.

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-2-davidcc@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/build/tests/ex/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/build/tests/ex/Makefile b/tools/build/tests/ex/Makefile
index c50d578..027d6c8 100644
--- a/tools/build/tests/ex/Makefile
+++ b/tools/build/tests/ex/Makefile
@@ -8,7 +8,7 @@ ex:
 include $(srctree)/tools/build/Makefile.include
 
 ex: ex-in.o libex-in.o
-	gcc -o $@ $^
+	$(CC) -o $@ $^
 
 ex.%: fixdep FORCE
 	make -f $(srctree)/tools/build/Makefile.build dir=. $@

[toc] | [prev] | [next] | [standalone]


#1720790 — [PATCH 5/6] perf tools: Remove BUG_ON char[] to bool implicit conversions

FromDavid Carrillo-Cisneros <davidcc@google.com>
Date2017-08-27 10:00 +0200
Subject[PATCH 5/6] perf tools: Remove BUG_ON char[] to bool implicit conversions
Message-ID<uj0Ea-4Hq-15@gated-at.bofh.it>
In reply to#1720785
When compiling with LLVM, errors like this are shown:

  builtin-lock.c:46:10: error: implicit conversion turns string literal into bool: 'const char [39]' to 'bool'

Due to error message implicit conversion into bool. Fix it by defining a
BUG macro without a boolean argument and use it instead.

Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
---
 tools/include/linux/kernel.h |  2 ++
 tools/perf/builtin-lock.c    | 15 ++++++++++-----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/tools/include/linux/kernel.h b/tools/include/linux/kernel.h
index 77d2e94ca5df..0951c96205c4 100644
--- a/tools/include/linux/kernel.h
+++ b/tools/include/linux/kernel.h
@@ -70,6 +70,8 @@
 #endif
 #endif
 
+#define BUG() abort()
+
 #if __BYTE_ORDER == __BIG_ENDIAN
 #define cpu_to_le16 bswap_16
 #define cpu_to_le32 bswap_32
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index ff98652484a7..7d1e42cccc89 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -152,7 +152,8 @@ static void thread_stat_insert(struct thread_stat *new)
 		else if (new->tid > p->tid)
 			rb = &(*rb)->rb_right;
 		else
-			BUG_ON("inserting invalid thread_stat\n");
+			pr_err("inserting invalid thread_stat\n");
+			BUG();
 	}
 
 	rb_link_node(&new->rb, parent, rb);
@@ -457,7 +458,8 @@ static int report_lock_acquire_event(struct perf_evsel *evsel,
 		free(seq);
 		goto end;
 	default:
-		BUG_ON("Unknown state of lock sequence found!\n");
+		pr_err("Unknown state of lock sequence found!\n");
+		BUG();
 		break;
 	}
 
@@ -518,7 +520,8 @@ static int report_lock_acquired_event(struct perf_evsel *evsel,
 		free(seq);
 		goto end;
 	default:
-		BUG_ON("Unknown state of lock sequence found!\n");
+		pr_err("Unknown state of lock sequence found!\n");
+		BUG();
 		break;
 	}
 
@@ -573,7 +576,8 @@ static int report_lock_contended_event(struct perf_evsel *evsel,
 		free(seq);
 		goto end;
 	default:
-		BUG_ON("Unknown state of lock sequence found!\n");
+		pr_err("Unknown state of lock sequence found!\n");
+		BUG();
 		break;
 	}
 
@@ -632,7 +636,8 @@ static int report_lock_release_event(struct perf_evsel *evsel,
 		bad_hist[BROKEN_RELEASE]++;
 		goto free_seq;
 	default:
-		BUG_ON("Unknown state of lock sequence found!\n");
+		pr_err("Unknown state of lock sequence found!\n");
+		BUG();
 		break;
 	}
 
-- 
2.14.1.342.g6490525c54-goog

[toc] | [prev] | [next] | [standalone]


#1721439 — Re: [PATCH 5/6] perf tools: Remove BUG_ON char[] to bool implicit conversions

FromJiri Olsa <jolsa@redhat.com>
Date2017-08-28 11:40 +0200
SubjectRe: [PATCH 5/6] perf tools: Remove BUG_ON char[] to bool implicit conversions
Message-ID<ujoGu-3Tj-29@gated-at.bofh.it>
In reply to#1720790
On Sun, Aug 27, 2017 at 12:54:41AM -0700, David Carrillo-Cisneros wrote:
> When compiling with LLVM, errors like this are shown:
> 
>   builtin-lock.c:46:10: error: implicit conversion turns string literal into bool: 'const char [39]' to 'bool'
> 
> Due to error message implicit conversion into bool. Fix it by defining a
> BUG macro without a boolean argument and use it instead.
> 
> Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
> ---
>  tools/include/linux/kernel.h |  2 ++
>  tools/perf/builtin-lock.c    | 15 ++++++++++-----
>  2 files changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/include/linux/kernel.h b/tools/include/linux/kernel.h
> index 77d2e94ca5df..0951c96205c4 100644
> --- a/tools/include/linux/kernel.h
> +++ b/tools/include/linux/kernel.h
> @@ -70,6 +70,8 @@
>  #endif
>  #endif
>  
> +#define BUG() abort()

we have some of those in tools/include/asm/bug.h

some might suit you, I think we wanted to omit BUG calls completely

jirka

[toc] | [prev] | [next] | [standalone]


#1721897 — [PATCH] perf tools: Remove BUG_ON char[] to bool implicit conversions

FromDavid Carrillo-Cisneros <davidcc@google.com>
Date2017-08-28 20:40 +0200
Subject[PATCH] perf tools: Remove BUG_ON char[] to bool implicit conversions
Message-ID<ujx74-zb-19@gated-at.bofh.it>
In reply to#1721439
When compiling with LLVM, errors like this are shown:

  builtin-lock.c:46:10: error: implicit conversion turns string literal into bool: 'const char [39]' to 'bool'

due to error message implicit conversion into bool. Fix it printing
the error message and returning an error when possible.

Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
---
 tools/perf/builtin-lock.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index ff98652484a7..55d3997ce194 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -3,6 +3,7 @@
 #include "builtin.h"
 #include "perf.h"
 
+#include "asm/bug.h"
 #include "util/evlist.h"
 #include "util/evsel.h"
 #include "util/util.h"
@@ -147,12 +148,11 @@ static void thread_stat_insert(struct thread_stat *new)
 		p = container_of(*rb, struct thread_stat, rb);
 		parent = *rb;
 
+		WARN(new->tid == p->tid, "inserting invalid thread_stat\n");
 		if (new->tid < p->tid)
 			rb = &(*rb)->rb_left;
-		else if (new->tid > p->tid)
-			rb = &(*rb)->rb_right;
 		else
-			BUG_ON("inserting invalid thread_stat\n");
+			rb = &(*rb)->rb_right;
 	}
 
 	rb_link_node(&new->rb, parent, rb);
@@ -457,8 +457,8 @@ static int report_lock_acquire_event(struct perf_evsel *evsel,
 		free(seq);
 		goto end;
 	default:
-		BUG_ON("Unknown state of lock sequence found!\n");
-		break;
+		pr_err("Unknown state of lock sequence found!\n");
+		return -1;
 	}
 
 	ls->nr_acquire++;
@@ -518,8 +518,8 @@ static int report_lock_acquired_event(struct perf_evsel *evsel,
 		free(seq);
 		goto end;
 	default:
-		BUG_ON("Unknown state of lock sequence found!\n");
-		break;
+		pr_err("Unknown state of lock sequence found!\n");
+		return -1;
 	}
 
 	seq->state = SEQ_STATE_ACQUIRED;
@@ -573,8 +573,8 @@ static int report_lock_contended_event(struct perf_evsel *evsel,
 		free(seq);
 		goto end;
 	default:
-		BUG_ON("Unknown state of lock sequence found!\n");
-		break;
+		pr_err("Unknown state of lock sequence found!\n");
+		return -1;
 	}
 
 	seq->state = SEQ_STATE_CONTENDED;
@@ -632,8 +632,8 @@ static int report_lock_release_event(struct perf_evsel *evsel,
 		bad_hist[BROKEN_RELEASE]++;
 		goto free_seq;
 	default:
-		BUG_ON("Unknown state of lock sequence found!\n");
-		break;
+		pr_err("Unknown state of lock sequence found!\n");
+		return -1;
 	}
 
 	ls->nr_release++;
-- 
2.14.1.342.g6490525c54-goog

[toc] | [prev] | [next] | [standalone]


#1721440

FromJiri Olsa <jolsa@redhat.com>
Date2017-08-28 11:40 +0200
Message-ID<ujoGu-3Tj-37@gated-at.bofh.it>
In reply to#1720785
On Sun, Aug 27, 2017 at 12:54:36AM -0700, David Carrillo-Cisneros wrote:
> Collection of minor fixes to compile with LLVM and
> non-standard tool names.
> 
> David Carrillo-Cisneros (6):
>   tools build tests: Don't hardcode gcc name
>   perf tools: Allow external definition of flex and bison binary names
>   tools lib: Allow external definition of CC, AR and LD
>   perf tools: Robustify detection of clang binary
>   perf tools: Remove BUG_ON char[] to bool implicit conversions
>   perf tools: Pass full path of FEATURES_DUMP

apart from comment for 5/6 I'm ok with this

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

[toc] | [prev] | [next] | [standalone]


#1721654

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2017-08-28 16:20 +0200
Message-ID<ujt3t-6CP-27@gated-at.bofh.it>
In reply to#1721440
Em Mon, Aug 28, 2017 at 11:34:21AM +0200, Jiri Olsa escreveu:
> On Sun, Aug 27, 2017 at 12:54:36AM -0700, David Carrillo-Cisneros wrote:
> > Collection of minor fixes to compile with LLVM and
> > non-standard tool names.
> > 
> > David Carrillo-Cisneros (6):
> >   tools build tests: Don't hardcode gcc name
> >   perf tools: Allow external definition of flex and bison binary names
> >   tools lib: Allow external definition of CC, AR and LD
> >   perf tools: Robustify detection of clang binary
> >   perf tools: Remove BUG_ON char[] to bool implicit conversions
> >   perf tools: Pass full path of FEATURES_DUMP
> 
> apart from comment for 5/6 I'm ok with this
> 
> Acked-by: Jiri Olsa <jolsa@kernel.org>

Thanks, applied all that Jiri acked, agree with him that BUG should be
avoided, and also that we should use existing facilities when available,
and when there aren't, try to replicate as best as we can similar
facilities existing in the kernel source code.

- Arnaldo

[toc] | [prev] | [next] | [standalone]


#1721896

FromDavid Carrillo-Cisneros <davidcc@google.com>
Date2017-08-28 20:40 +0200
Message-ID<ujx74-zb-17@gated-at.bofh.it>
In reply to#1721654
On Mon, Aug 28, 2017 at 7:16 AM, Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
> Em Mon, Aug 28, 2017 at 11:34:21AM +0200, Jiri Olsa escreveu:
>> On Sun, Aug 27, 2017 at 12:54:36AM -0700, David Carrillo-Cisneros wrote:
>> > Collection of minor fixes to compile with LLVM and
>> > non-standard tool names.
>> >
>> > David Carrillo-Cisneros (6):
>> >   tools build tests: Don't hardcode gcc name
>> >   perf tools: Allow external definition of flex and bison binary names
>> >   tools lib: Allow external definition of CC, AR and LD
>> >   perf tools: Robustify detection of clang binary
>> >   perf tools: Remove BUG_ON char[] to bool implicit conversions
>> >   perf tools: Pass full path of FEATURES_DUMP
>>
>> apart from comment for 5/6 I'm ok with this
>>
>> Acked-by: Jiri Olsa <jolsa@kernel.org>
>
> Thanks, applied all that Jiri acked, agree with him that BUG should be
> avoided, and also that we should use existing facilities when available,
> and when there aren't, try to replicate as best as we can similar
> facilities existing in the kernel source code.

Thank you for applying them. I sent a new version of the one commented by Jiri.

David

>
> - Arnaldo

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web