linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] perf build: Support llvm and clang support compiled in
@ 2023-07-13 11:19 Thomas Richter
  2023-07-13 23:49 ` Ian Rogers
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Richter @ 2023-07-13 11:19 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme, irogers, wangnan0, jolsa
  Cc: svens, gor, sumanthk, hca, Thomas Richter

Perf build suports llvm and clang support compiled in.
Test case 56 builtin clang support provides a test case
which is always skipped.

Link perf with the latest llvm and clang libraries and
enable this test case.

Use 'make LIBCLANGLLVM=1' to include this support.

V2: Add Library patch before -lclang-cpp

Output before:
 # ./perf test 56
 56: builtin clang support                  :
 56.1: builtin clang compile C source to IR : Skip (not compiled in)
 56.2: builtin clang compile C source to ELF object: \
	 				Skip (not compiled in)

Output after:
 # ./perf test 56
 56: builtin clang support                          :
 56.1: builtin clang compile C source to IR         : Ok
 56.2: builtin clang compile C source to ELF object : Ok
 #

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/Makefile.config | 2 +-
 tools/perf/Makefile.perf   | 5 +----
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 0609c19caabd..a90af438261c 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -325,7 +325,7 @@ CORE_CFLAGS += -Wall
 CORE_CFLAGS += -Wextra
 CORE_CFLAGS += -std=gnu11
 
-CXXFLAGS += -std=gnu++14 -fno-exceptions -fno-rtti
+CXXFLAGS += -std=gnu++17 -fno-exceptions -fno-rtti
 CXXFLAGS += -Wall
 CXXFLAGS += -fno-omit-frame-pointer
 CXXFLAGS += -ggdb3
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 097316ef38e6..158a0733fc9d 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -426,10 +426,7 @@ EXTLIBS := $(call filter-out,$(EXCLUDE_EXTLIBS),$(EXTLIBS))
 LIBS = -Wl,--whole-archive $(PERFLIBS) $(EXTRA_PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
 
 ifeq ($(USE_CLANG), 1)
-  CLANGLIBS_LIST = AST Basic CodeGen Driver Frontend Lex Tooling Edit Sema Analysis Parse Serialization
-  CLANGLIBS_NOEXT_LIST = $(foreach l,$(CLANGLIBS_LIST),$(shell $(LLVM_CONFIG) --libdir)/libclang$(l))
-  LIBCLANG = $(foreach l,$(CLANGLIBS_NOEXT_LIST),$(wildcard $(l).a $(l).so))
-  LIBS += -Wl,--start-group $(LIBCLANG) -Wl,--end-group
+  LIBS += -L$(shell $(LLVM_CONFIG) --libdir) -lclang-cpp
 endif
 
 ifeq ($(USE_LLVM), 1)
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] perf build: Support llvm and clang support compiled in
  2023-07-13 11:19 [PATCH v2] perf build: Support llvm and clang support compiled in Thomas Richter
@ 2023-07-13 23:49 ` Ian Rogers
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Rogers @ 2023-07-13 23:49 UTC (permalink / raw)
  To: Thomas Richter
  Cc: linux-kernel, linux-perf-users, acme, wangnan0, jolsa, svens, gor,
	sumanthk, hca

On Thu, Jul 13, 2023 at 4:19 AM Thomas Richter <tmricht@linux.ibm.com> wrote:
>
> Perf build suports llvm and clang support compiled in.
> Test case 56 builtin clang support provides a test case
> which is always skipped.
>
> Link perf with the latest llvm and clang libraries and
> enable this test case.
>
> Use 'make LIBCLANGLLVM=1' to include this support.
>
> V2: Add Library patch before -lclang-cpp
>
> Output before:
>  # ./perf test 56
>  56: builtin clang support                  :
>  56.1: builtin clang compile C source to IR : Skip (not compiled in)
>  56.2: builtin clang compile C source to ELF object: \
>                                         Skip (not compiled in)
>
> Output after:
>  # ./perf test 56
>  56: builtin clang support                          :
>  56.1: builtin clang compile C source to IR         : Ok
>  56.2: builtin clang compile C source to ELF object : Ok
>  #
>
> Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
> Cc: Wang Nan <wangnan0@huawei.com>
> Cc: Jiri Olsa <jolsa@kernel.org>

Build tested with LLVM 14 and 15 using:
BUILD_BPF_SKEL=1 LIBCLANGLLVM=1 LLVM_CONFIG=llvm-config-14
BUILD_BPF_SKEL=1 LIBCLANGLLVM=1 LLVM_CONFIG=llvm-config-15

Tested-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

> ---
>  tools/perf/Makefile.config | 2 +-
>  tools/perf/Makefile.perf   | 5 +----
>  2 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 0609c19caabd..a90af438261c 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -325,7 +325,7 @@ CORE_CFLAGS += -Wall
>  CORE_CFLAGS += -Wextra
>  CORE_CFLAGS += -std=gnu11
>
> -CXXFLAGS += -std=gnu++14 -fno-exceptions -fno-rtti
> +CXXFLAGS += -std=gnu++17 -fno-exceptions -fno-rtti
>  CXXFLAGS += -Wall
>  CXXFLAGS += -fno-omit-frame-pointer
>  CXXFLAGS += -ggdb3
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 097316ef38e6..158a0733fc9d 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -426,10 +426,7 @@ EXTLIBS := $(call filter-out,$(EXCLUDE_EXTLIBS),$(EXTLIBS))
>  LIBS = -Wl,--whole-archive $(PERFLIBS) $(EXTRA_PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
>
>  ifeq ($(USE_CLANG), 1)
> -  CLANGLIBS_LIST = AST Basic CodeGen Driver Frontend Lex Tooling Edit Sema Analysis Parse Serialization
> -  CLANGLIBS_NOEXT_LIST = $(foreach l,$(CLANGLIBS_LIST),$(shell $(LLVM_CONFIG) --libdir)/libclang$(l))
> -  LIBCLANG = $(foreach l,$(CLANGLIBS_NOEXT_LIST),$(wildcard $(l).a $(l).so))
> -  LIBS += -Wl,--start-group $(LIBCLANG) -Wl,--end-group
> +  LIBS += -L$(shell $(LLVM_CONFIG) --libdir) -lclang-cpp
>  endif
>
>  ifeq ($(USE_LLVM), 1)
> --
> 2.41.0
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-13 23:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-13 11:19 [PATCH v2] perf build: Support llvm and clang support compiled in Thomas Richter
2023-07-13 23:49 ` Ian Rogers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).