public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf clang: Fix header include for LLVM >= 14
@ 2022-04-16  7:45 Guilherme Amadio
  2022-04-16 19:56 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 5+ messages in thread
From: Guilherme Amadio @ 2022-04-16  7:45 UTC (permalink / raw)
  To: acme; +Cc: linux-kernel

The header TargetRegistry.h has moved in LLVM/clang 14.

Signed-off-by: Guilherme Amadio <amadio@gentoo.org>
---
 tools/perf/util/c++/clang.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/perf/util/c++/clang.cpp b/tools/perf/util/c++/clang.cpp
index df7b18fb6b6e..1aad7d6d34aa 100644
--- a/tools/perf/util/c++/clang.cpp
+++ b/tools/perf/util/c++/clang.cpp
@@ -20,7 +20,11 @@
 #include "llvm/Option/Option.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/ManagedStatic.h"
+#if CLANG_VERSION_MAJOR >= 14
+#include "llvm/MC/TargetRegistry.h"
+#else
 #include "llvm/Support/TargetRegistry.h"
+#endif
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetOptions.h"
--
2.35.2


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

* Re: [PATCH] perf clang: Fix header include for LLVM >= 14
  2022-04-16  7:45 [PATCH] perf clang: Fix header include for LLVM >= 14 Guilherme Amadio
@ 2022-04-16 19:56 ` Arnaldo Carvalho de Melo
  2022-04-16 19:58   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-04-16 19:56 UTC (permalink / raw)
  To: Guilherme Amadio
  Cc: Jiri Olsa, Namhyung Kim, Adrian Hunter, Nathan Chancellor,
	Nick Desaulniers, Sedat Dilek, linux-kernel

Em Sat, Apr 16, 2022 at 09:45:55AM +0200, Guilherme Amadio escreveu:
> The header TargetRegistry.h has moved in LLVM/clang 14.
> 
> Signed-off-by: Guilherme Amadio <amadio@gentoo.org>

Applied and ammended the commit log message with some extra info
about the problem, this is the end result:

perf clang: Fix header include for LLVM >= 14

The header TargetRegistry.h has moved in LLVM/clang 14.

Committer notes:

The problem as noticed when building in ubuntu:20.04 with this command
line:

  $ make LIBCLANGLLVM=1 -C tools/perf O=/tmp/build/perf

  /usr/bin/ld: /usr/lib/llvm-10/lib/libclangCodeGen.a(BackendUtil.cpp.o): in function `(anonymous namespace)::EmitAssemblyHelper::EmitAssemblyWithNewPassManager(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >)':
  (.text._ZN12_GLOBAL__N_118EmitAssemblyHelper30EmitAssemblyWithNewPassManagerEN5clang13BackendActionESt10unique_ptrIN4llvm17raw_pwrite_streamESt14default_deleteIS5_EE+0x1f15): undefined reference to `getPollyPluginInfo()'
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  make[2]: *** [Makefile.perf:677: /tmp/build/perf/perf] Error 1
  make[1]: *** [Makefile.perf:240: sub-make] Error 2
  make: *** [Makefile:70: all] Error 2

Fixed after applying this patch.

Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Guilherme Amadio <amadio@gentoo.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Link: https://twitter.com/GuilhermeAmadio/status/1514970524232921088
Link: http://lore.kernel.org/lkml/Ylp0M/VYgHOxtcnF@gentoo.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

But then the container build just finished and the problem is still
there :-\

+ make ARCH= CROSS_COMPILE= EXTRA_CFLAGS= LIBCLANGLLVM=1 -C tools/perf O=/tmp/build/perf CC=clang
<SNIP>
  LD      /tmp/build/perf/perf-in.o
  LINK    /tmp/build/perf/perf
/usr/bin/ld: /usr/lib/llvm-10/lib/libclangCodeGen.a(BackendUtil.cpp.o): in function `(anonymous namespace)::EmitAssemblyHelper::EmitAssemblyWithNewPassManager(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >)':
(.text._ZN12_GLOBAL__N_118EmitAssemblyHelper30EmitAssemblyWithNewPassManagerEN5clang13BackendActionESt10unique_ptrIN4llvm17raw_pwrite_streamESt14default_deleteIS5_EE+0x1f15): undefined reference to `getPollyPluginInfo()'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [Makefile.perf:677: /tmp/build/perf/perf] Error 1
make[1]: *** [Makefile.perf:240: sub-make] Error 2
make: *** [Makefile:70: all] Error 2
make: Leaving directory '/git/perf-5.18.0-rc2/tools/perf'
+ exit 1
[perfbuilder@five ~]$
[perfbuilder@five ~]$

And that part : /usr/bin/ld: /usr/lib/llvm-10/lib/libclangCodeGen.a
seems to imply its llvm 10 that is installed, lemme check:

[perfbuilder@five ~]$ dsh ubuntu:20.04
$ bash
perfbuilder@7cfe87e48135:/$ dpkg -l | grep llvm
ii  libllvm10:amd64                    1:10.0.0-4ubuntu1                 amd64        Modular compiler and toolchain technologies, runtime library
ii  libllvm12:amd64                    1:12.0.0-3ubuntu1~20.04.5         amd64        Modular compiler and toolchain technologies, runtime library
ii  llvm                               1:10.0-50~exp1                    amd64        Low-Level Virtual Machine (LLVM)
ii  llvm-10                            1:10.0.0-4ubuntu1                 amd64        Modular compiler and toolchain technologies
ii  llvm-10-dev                        1:10.0.0-4ubuntu1                 amd64        Modular compiler and toolchain technologies, libraries and headers
ii  llvm-10-runtime                    1:10.0.0-4ubuntu1                 amd64        Modular compiler and toolchain technologies, IR interpreter
ii  llvm-10-tools                      1:10.0.0-4ubuntu1                 amd64        Modular compiler and toolchain technologies, tools
ii  llvm-dev                           1:10.0-50~exp1                    amd64        Low-Level Virtual Machine (LLVM), libraries and headers
ii  llvm-runtime                       1:10.0-50~exp1                    amd64        Low-Level Virtual Machine (LLVM), bytecode interpreter
perfbuilder@7cfe87e48135:/$ dpkg -l | grep clang
ii  clang                              1:10.0-50~exp1                    amd64        C, C++ and Objective-C compiler (LLVM based)
ii  clang-10                           1:10.0.0-4ubuntu1                 amd64        C, C++ and Objective-C compiler
ii  libclang-10-dev                    1:10.0.0-4ubuntu1                 amd64        Clang library - Development package
ii  libclang-common-10-dev             1:10.0.0-4ubuntu1                 amd64        Clang library - Common development package
ii  libclang-cpp10                     1:10.0.0-4ubuntu1                 amd64        C++ interface to the Clang library
ii  libclang-dev                       1:10.0-50~exp1                    amd64        clang library - Development package
ii  libclang1-10                       1:10.0.0-4ubuntu1                 amd64        C interface to the Clang library
perfbuilder@7cfe87e48135:/$

Yeah, so I'll try making it test >= 10, lets see...

- Arnaldo

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

* Re: [PATCH] perf clang: Fix header include for LLVM >= 14
  2022-04-16 19:56 ` Arnaldo Carvalho de Melo
@ 2022-04-16 19:58   ` Arnaldo Carvalho de Melo
  2022-04-16 20:00     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-04-16 19:58 UTC (permalink / raw)
  To: Guilherme Amadio
  Cc: Jiri Olsa, Namhyung Kim, Adrian Hunter, Nathan Chancellor,
	Nick Desaulniers, Sedat Dilek, linux-kernel

Em Sat, Apr 16, 2022 at 04:56:24PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Sat, Apr 16, 2022 at 09:45:55AM +0200, Guilherme Amadio escreveu:
> > The header TargetRegistry.h has moved in LLVM/clang 14.

> And that part : /usr/bin/ld: /usr/lib/llvm-10/lib/libclangCodeGen.a
> seems to imply its llvm 10 that is installed, lemme check:
> 
> [perfbuilder@five ~]$ dsh ubuntu:20.04
> $ bash
> perfbuilder@7cfe87e48135:/$ dpkg -l | grep llvm
> ii  libllvm10:amd64                    1:10.0.0-4ubuntu1                 amd64        Modular compiler and toolchain technologies, runtime library
> ii  libllvm12:amd64                    1:12.0.0-3ubuntu1~20.04.5         amd64        Modular compiler and toolchain technologies, runtime library
> ii  llvm                               1:10.0-50~exp1                    amd64        Low-Level Virtual Machine (LLVM)
> ii  llvm-10                            1:10.0.0-4ubuntu1                 amd64        Modular compiler and toolchain technologies
> ii  llvm-10-dev                        1:10.0.0-4ubuntu1                 amd64        Modular compiler and toolchain technologies, libraries and headers
> ii  llvm-10-runtime                    1:10.0.0-4ubuntu1                 amd64        Modular compiler and toolchain technologies, IR interpreter
> ii  llvm-10-tools                      1:10.0.0-4ubuntu1                 amd64        Modular compiler and toolchain technologies, tools
> ii  llvm-dev                           1:10.0-50~exp1                    amd64        Low-Level Virtual Machine (LLVM), libraries and headers
> ii  llvm-runtime                       1:10.0-50~exp1                    amd64        Low-Level Virtual Machine (LLVM), bytecode interpreter
> perfbuilder@7cfe87e48135:/$ dpkg -l | grep clang
> ii  clang                              1:10.0-50~exp1                    amd64        C, C++ and Objective-C compiler (LLVM based)
> ii  clang-10                           1:10.0.0-4ubuntu1                 amd64        C, C++ and Objective-C compiler
> ii  libclang-10-dev                    1:10.0.0-4ubuntu1                 amd64        Clang library - Development package
> ii  libclang-common-10-dev             1:10.0.0-4ubuntu1                 amd64        Clang library - Common development package
> ii  libclang-cpp10                     1:10.0.0-4ubuntu1                 amd64        C++ interface to the Clang library
> ii  libclang-dev                       1:10.0-50~exp1                    amd64        clang library - Development package
> ii  libclang1-10                       1:10.0.0-4ubuntu1                 amd64        C interface to the Clang library
> perfbuilder@7cfe87e48135:/$
> 
> Yeah, so I'll try making it test >= 10, lets see...

perfbuilder@7cfe87e48135:/$ find /usr -name TargetRegistry.h
/usr/include/llvm-10/llvm/Support/TargetRegistry.h
perfbuilder@7cfe87e48135:/$

It hasn't moved :-\

- Arnaldo

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

* Re: [PATCH] perf clang: Fix header include for LLVM >= 14
  2022-04-16 19:58   ` Arnaldo Carvalho de Melo
@ 2022-04-16 20:00     ` Arnaldo Carvalho de Melo
  2022-04-16 20:05       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-04-16 20:00 UTC (permalink / raw)
  To: Guilherme Amadio
  Cc: Jiri Olsa, Namhyung Kim, Adrian Hunter, Nathan Chancellor,
	Nick Desaulniers, Sedat Dilek, linux-kernel

Em Sat, Apr 16, 2022 at 04:58:22PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Sat, Apr 16, 2022 at 04:56:24PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Sat, Apr 16, 2022 at 09:45:55AM +0200, Guilherme Amadio escreveu:
> > > The header TargetRegistry.h has moved in LLVM/clang 14.
> 
> > And that part : /usr/bin/ld: /usr/lib/llvm-10/lib/libclangCodeGen.a
> > seems to imply its llvm 10 that is installed, lemme check:
> > 
> > [perfbuilder@five ~]$ dsh ubuntu:20.04
> > $ bash
> > perfbuilder@7cfe87e48135:/$ dpkg -l | grep llvm
> > ii  libllvm10:amd64                    1:10.0.0-4ubuntu1                 amd64        Modular compiler and toolchain technologies, runtime library
> > ii  libllvm12:amd64                    1:12.0.0-3ubuntu1~20.04.5         amd64        Modular compiler and toolchain technologies, runtime library
> > ii  llvm                               1:10.0-50~exp1                    amd64        Low-Level Virtual Machine (LLVM)
> > ii  llvm-10                            1:10.0.0-4ubuntu1                 amd64        Modular compiler and toolchain technologies
> > ii  llvm-10-dev                        1:10.0.0-4ubuntu1                 amd64        Modular compiler and toolchain technologies, libraries and headers
> > ii  llvm-10-runtime                    1:10.0.0-4ubuntu1                 amd64        Modular compiler and toolchain technologies, IR interpreter
> > ii  llvm-10-tools                      1:10.0.0-4ubuntu1                 amd64        Modular compiler and toolchain technologies, tools
> > ii  llvm-dev                           1:10.0-50~exp1                    amd64        Low-Level Virtual Machine (LLVM), libraries and headers
> > ii  llvm-runtime                       1:10.0-50~exp1                    amd64        Low-Level Virtual Machine (LLVM), bytecode interpreter
> > perfbuilder@7cfe87e48135:/$ dpkg -l | grep clang
> > ii  clang                              1:10.0-50~exp1                    amd64        C, C++ and Objective-C compiler (LLVM based)
> > ii  clang-10                           1:10.0.0-4ubuntu1                 amd64        C, C++ and Objective-C compiler
> > ii  libclang-10-dev                    1:10.0.0-4ubuntu1                 amd64        Clang library - Development package
> > ii  libclang-common-10-dev             1:10.0.0-4ubuntu1                 amd64        Clang library - Common development package
> > ii  libclang-cpp10                     1:10.0.0-4ubuntu1                 amd64        C++ interface to the Clang library
> > ii  libclang-dev                       1:10.0-50~exp1                    amd64        clang library - Development package
> > ii  libclang1-10                       1:10.0.0-4ubuntu1                 amd64        C interface to the Clang library
> > perfbuilder@7cfe87e48135:/$
> > 
> > Yeah, so I'll try making it test >= 10, lets see...
> 
> perfbuilder@7cfe87e48135:/$ find /usr -name TargetRegistry.h
> /usr/include/llvm-10/llvm/Support/TargetRegistry.h
> perfbuilder@7cfe87e48135:/$
> 

Sorry, your fix is for the ubuntu 22.04 problem, not the 20.04 one,
retesting...

- Arnaldo

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

* Re: [PATCH] perf clang: Fix header include for LLVM >= 14
  2022-04-16 20:00     ` Arnaldo Carvalho de Melo
@ 2022-04-16 20:05       ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-04-16 20:05 UTC (permalink / raw)
  To: Guilherme Amadio
  Cc: Jiri Olsa, Namhyung Kim, Adrian Hunter, Nathan Chancellor,
	Nick Desaulniers, Sedat Dilek, linux-kernel

Em Sat, Apr 16, 2022 at 05:00:40PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Sat, Apr 16, 2022 at 04:58:22PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Sat, Apr 16, 2022 at 04:56:24PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > Em Sat, Apr 16, 2022 at 09:45:55AM +0200, Guilherme Amadio escreveu:
> > > > The header TargetRegistry.h has moved in LLVM/clang 14.
> > 
> > > And that part : /usr/bin/ld: /usr/lib/llvm-10/lib/libclangCodeGen.a
> > > seems to imply its llvm 10 that is installed, lemme check:
> > > 
> > > [perfbuilder@five ~]$ dsh ubuntu:20.04
> > > $ bash
> > > perfbuilder@7cfe87e48135:/$ dpkg -l | grep llvm
> > > ii  libllvm10:amd64                    1:10.0.0-4ubuntu1                 amd64        Modular compiler and toolchain technologies, runtime library
> > > ii  libllvm12:amd64                    1:12.0.0-3ubuntu1~20.04.5         amd64        Modular compiler and toolchain technologies, runtime library
> > > ii  llvm                               1:10.0-50~exp1                    amd64        Low-Level Virtual Machine (LLVM)
> > > ii  llvm-10                            1:10.0.0-4ubuntu1                 amd64        Modular compiler and toolchain technologies
> > > ii  llvm-10-dev                        1:10.0.0-4ubuntu1                 amd64        Modular compiler and toolchain technologies, libraries and headers
> > > ii  llvm-10-runtime                    1:10.0.0-4ubuntu1                 amd64        Modular compiler and toolchain technologies, IR interpreter
> > > ii  llvm-10-tools                      1:10.0.0-4ubuntu1                 amd64        Modular compiler and toolchain technologies, tools
> > > ii  llvm-dev                           1:10.0-50~exp1                    amd64        Low-Level Virtual Machine (LLVM), libraries and headers
> > > ii  llvm-runtime                       1:10.0-50~exp1                    amd64        Low-Level Virtual Machine (LLVM), bytecode interpreter
> > > perfbuilder@7cfe87e48135:/$ dpkg -l | grep clang
> > > ii  clang                              1:10.0-50~exp1                    amd64        C, C++ and Objective-C compiler (LLVM based)
> > > ii  clang-10                           1:10.0.0-4ubuntu1                 amd64        C, C++ and Objective-C compiler
> > > ii  libclang-10-dev                    1:10.0.0-4ubuntu1                 amd64        Clang library - Development package
> > > ii  libclang-common-10-dev             1:10.0.0-4ubuntu1                 amd64        Clang library - Common development package
> > > ii  libclang-cpp10                     1:10.0.0-4ubuntu1                 amd64        C++ interface to the Clang library
> > > ii  libclang-dev                       1:10.0-50~exp1                    amd64        clang library - Development package
> > > ii  libclang1-10                       1:10.0.0-4ubuntu1                 amd64        C interface to the Clang library
> > > perfbuilder@7cfe87e48135:/$
> > > 
> > > Yeah, so I'll try making it test >= 10, lets see...
> > 
> > perfbuilder@7cfe87e48135:/$ find /usr -name TargetRegistry.h
> > /usr/include/llvm-10/llvm/Support/TargetRegistry.h
> > perfbuilder@7cfe87e48135:/$
> > 
> 
> Sorry, your fix is for the ubuntu 22.04 problem, not the 20.04 one,
> retesting...

Thanks, applied, the bug is fixed on ubuntu 22.04.

- Arnaldo

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

end of thread, other threads:[~2022-04-16 20:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-16  7:45 [PATCH] perf clang: Fix header include for LLVM >= 14 Guilherme Amadio
2022-04-16 19:56 ` Arnaldo Carvalho de Melo
2022-04-16 19:58   ` Arnaldo Carvalho de Melo
2022-04-16 20:00     ` Arnaldo Carvalho de Melo
2022-04-16 20:05       ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox