public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* perf tools: LIBCLANGLLVM=1 build broken with llvm 7/clang 6
@ 2018-06-16 12:26 Arnaldo Carvalho de Melo
  2018-06-16 17:20 ` Yonghong Song
  0 siblings, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-06-16 12:26 UTC (permalink / raw)
  To: Wang Nan, Yonghong Song
  Cc: Jiri Olsa, Linux Kernel Mailing List, Alexei Starovoitov,
	Martin KaFai Lau, Daniel Borkmann

Hi Wang, Yogong,

	While reviewing the BTF patches for pahole, I updated llvm/clang
to HEAD and then building perf with clang embedded I noticed this, will
investigate, posting here to document the regression, maybe this is
something you came across in other scenario:

 $ make LIBCLANGLLVM=1 -C tools/perf/
 <SNIP>
  CC       /tmp/tmp.t53Qo38zci/tests/kmod-path.o
util/c++/clang.cpp: In function ‘std::unique_ptr<llvm::SmallVectorImpl<char> > perf::getBPFObjectFromModule(llvm::Module*)’:
util/c++/clang.cpp:150:43: error: no matching function for call to ‘llvm::TargetMachine::addPassesToEmitFile(llvm::legacy::PassManager&, llvm::raw_svector_ostream&, llvm::TargetMachine::CodeGenFileType)’
             TargetMachine::CGFT_ObjectFile)) {
                                           ^
In file included from util/c++/clang.cpp:25:0:
/usr/local/include/llvm/Target/TargetMachine.h:254:16: note: candidate: virtual bool llvm::TargetMachine::addPassesToEmitFile(llvm::legacy::PassManagerBase&, llvm::raw_pwrite_stream&, llvm::raw_pwrite_stream*, llvm::TargetMachine::CodeGenFileType, bool, llvm::MachineModuleInfo*)
   virtual bool addPassesToEmitFile(PassManagerBase &, raw_pwrite_stream &,
                ^~~~~~~~~~~~~~~~~~~
/usr/local/include/llvm/Target/TargetMachine.h:254:16: note:   candidate expects 6 arguments, 3 provided
mv: cannot stat '/tmp/tmp.t53Qo38zci/util/c++/.clang.o.tmp': No such file or directory
make[7]: *** [/home/acme/git/perf/tools/build/Makefile.build:101: /tmp/tmp.t53Qo38zci/util/c++/clang.o] Error 1
make[6]: *** [/home/acme/git/perf/tools/build/Makefile.build:139: c++] Error 2
make[5]: *** [/home/acme/git/perf/tools/build/Makefile.build:139: util] Error 2
make[5]: *** Waiting for unfinished jobs....
  CC       /tmp/tmp.t53Qo38zci/tests/thread-map.o

- Arnaldo

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

* Re: perf tools: LIBCLANGLLVM=1 build broken with llvm 7/clang 6
  2018-06-16 12:26 perf tools: LIBCLANGLLVM=1 build broken with llvm 7/clang 6 Arnaldo Carvalho de Melo
@ 2018-06-16 17:20 ` Yonghong Song
  2018-06-18 14:31   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 5+ messages in thread
From: Yonghong Song @ 2018-06-16 17:20 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Wang Nan
  Cc: Jiri Olsa, Linux Kernel Mailing List, Alexei Starovoitov,
	Martin KaFai Lau, Daniel Borkmann



On 6/16/18 5:26 AM, Arnaldo Carvalho de Melo wrote:
> Hi Wang, Yogong,
> 
> 	While reviewing the BTF patches for pahole, I updated llvm/clang
> to HEAD and then building perf with clang embedded I noticed this, will
> investigate, posting here to document the regression, maybe this is
> something you came across in other scenario:
> 
>   $ make LIBCLANGLLVM=1 -C tools/perf/
>   <SNIP>
>    CC       /tmp/tmp.t53Qo38zci/tests/kmod-path.o
> util/c++/clang.cpp: In function ‘std::unique_ptr<llvm::SmallVectorImpl<char> > perf::getBPFObjectFromModule(llvm::Module*)’:
> util/c++/clang.cpp:150:43: error: no matching function for call to ‘llvm::TargetMachine::addPassesToEmitFile(llvm::legacy::PassManager&, llvm::raw_svector_ostream&, llvm::TargetMachine::CodeGenFileType)’
>               TargetMachine::CGFT_ObjectFile)) {
>                                             ^
> In file included from util/c++/clang.cpp:25:0:
> /usr/local/include/llvm/Target/TargetMachine.h:254:16: note: candidate: virtual bool llvm::TargetMachine::addPassesToEmitFile(llvm::legacy::PassManagerBase&, llvm::raw_pwrite_stream&, llvm::raw_pwrite_stream*, llvm::TargetMachine::CodeGenFileType, bool, llvm::MachineModuleInfo*)
>     virtual bool addPassesToEmitFile(PassManagerBase &, raw_pwrite_stream &,
>                  ^~~~~~~~~~~~~~~~~~~
> /usr/local/include/llvm/Target/TargetMachine.h:254:16: note:   candidate expects 6 arguments, 3 provided
> mv: cannot stat '/tmp/tmp.t53Qo38zci/util/c++/.clang.o.tmp': No such file or directory
> make[7]: *** [/home/acme/git/perf/tools/build/Makefile.build:101: /tmp/tmp.t53Qo38zci/util/c++/clang.o] Error 1
> make[6]: *** [/home/acme/git/perf/tools/build/Makefile.build:139: c++] Error 2
> make[5]: *** [/home/acme/git/perf/tools/build/Makefile.build:139: util] Error 2
> make[5]: *** Waiting for unfinished jobs....
>    CC       /tmp/tmp.t53Qo38zci/tests/thread-map.o

There is an interface change in llvm 7.0 (trunk) for function 
llvm::TargetMachine::addPassesToEmitFile. The following patch
should fix the problem.

-bash-4.2$ git diff
diff --git a/tools/perf/util/c++/clang.cpp b/tools/perf/util/c++/clang.cpp
index bf31cea..11dee58 100644
--- a/tools/perf/util/c++/clang.cpp
+++ b/tools/perf/util/c++/clang.cpp
@@ -146,8 +146,15 @@ getBPFObjectFromModule(llvm::Module *Module)
         raw_svector_ostream ostream(*Buffer);

         legacy::PassManager PM;
-       if (TargetMachine->addPassesToEmitFile(PM, ostream,
- 
TargetMachine::CGFT_ObjectFile)) {
+       bool NotAdded;
+#if CLANG_VERSION_MAJOR < 7
+       NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream,
+ 
TargetMachine::CGFT_ObjectFile);
+#else
+       NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream, nullptr,
+ 
TargetMachine::CGFT_ObjectFile);
+#endif
+       if (!NotAdded) {
                 llvm::errs() << "TargetMachine can't emit a file of 
this type\n";
                 return 
std::unique_ptr<llvm::SmallVectorImpl<char>>(nullptr);;
         }
-bash-4.2$

Will submit a formal patch soon.

> 
> - Arnaldo
> 

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

* Re: perf tools: LIBCLANGLLVM=1 build broken with llvm 7/clang 6
  2018-06-16 17:20 ` Yonghong Song
@ 2018-06-18 14:31   ` Arnaldo Carvalho de Melo
  2018-06-18 15:10     ` Yonghong Song
  0 siblings, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-06-18 14:31 UTC (permalink / raw)
  To: Yonghong Song
  Cc: Wang Nan, Jiri Olsa, Linux Kernel Mailing List,
	Alexei Starovoitov, Martin KaFai Lau, Daniel Borkmann

Em Sat, Jun 16, 2018 at 10:20:21AM -0700, Yonghong Song escreveu:
> 
> 
> On 6/16/18 5:26 AM, Arnaldo Carvalho de Melo wrote:
> > Hi Wang, Yogong,
> > 
> > 	While reviewing the BTF patches for pahole, I updated llvm/clang
> > to HEAD and then building perf with clang embedded I noticed this, will
> > investigate, posting here to document the regression, maybe this is
> > something you came across in other scenario:
> > 
> >   $ make LIBCLANGLLVM=1 -C tools/perf/
> >   <SNIP>
> >    CC       /tmp/tmp.t53Qo38zci/tests/kmod-path.o
> > util/c++/clang.cpp: In function ‘std::unique_ptr<llvm::SmallVectorImpl<char> > perf::getBPFObjectFromModule(llvm::Module*)’:
> > util/c++/clang.cpp:150:43: error: no matching function for call to ‘llvm::TargetMachine::addPassesToEmitFile(llvm::legacy::PassManager&, llvm::raw_svector_ostream&, llvm::TargetMachine::CodeGenFileType)’
> >               TargetMachine::CGFT_ObjectFile)) {
> >                                             ^
> > In file included from util/c++/clang.cpp:25:0:
> > /usr/local/include/llvm/Target/TargetMachine.h:254:16: note: candidate: virtual bool llvm::TargetMachine::addPassesToEmitFile(llvm::legacy::PassManagerBase&, llvm::raw_pwrite_stream&, llvm::raw_pwrite_stream*, llvm::TargetMachine::CodeGenFileType, bool, llvm::MachineModuleInfo*)
> >     virtual bool addPassesToEmitFile(PassManagerBase &, raw_pwrite_stream &,
> >                  ^~~~~~~~~~~~~~~~~~~
> > /usr/local/include/llvm/Target/TargetMachine.h:254:16: note:   candidate expects 6 arguments, 3 provided
> > mv: cannot stat '/tmp/tmp.t53Qo38zci/util/c++/.clang.o.tmp': No such file or directory
> > make[7]: *** [/home/acme/git/perf/tools/build/Makefile.build:101: /tmp/tmp.t53Qo38zci/util/c++/clang.o] Error 1
> > make[6]: *** [/home/acme/git/perf/tools/build/Makefile.build:139: c++] Error 2
> > make[5]: *** [/home/acme/git/perf/tools/build/Makefile.build:139: util] Error 2
> > make[5]: *** Waiting for unfinished jobs....
> >    CC       /tmp/tmp.t53Qo38zci/tests/thread-map.o
> 
> There is an interface change in llvm 7.0 (trunk) for function
> llvm::TargetMachine::addPassesToEmitFile. The following patch
> should fix the problem.

Please submit it, I just tested and the the build finishes Ok.

- Arnaldo
 
> -bash-4.2$ git diff
> diff --git a/tools/perf/util/c++/clang.cpp b/tools/perf/util/c++/clang.cpp
> index bf31cea..11dee58 100644
> --- a/tools/perf/util/c++/clang.cpp
> +++ b/tools/perf/util/c++/clang.cpp
> @@ -146,8 +146,15 @@ getBPFObjectFromModule(llvm::Module *Module)
>         raw_svector_ostream ostream(*Buffer);
> 
>         legacy::PassManager PM;
> -       if (TargetMachine->addPassesToEmitFile(PM, ostream,
> - TargetMachine::CGFT_ObjectFile)) {
> +       bool NotAdded;
> +#if CLANG_VERSION_MAJOR < 7
> +       NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream,
> + TargetMachine::CGFT_ObjectFile);
> +#else
> +       NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream, nullptr,
> + TargetMachine::CGFT_ObjectFile);
> +#endif
> +       if (!NotAdded) {
>                 llvm::errs() << "TargetMachine can't emit a file of this
> type\n";
>                 return
> std::unique_ptr<llvm::SmallVectorImpl<char>>(nullptr);;
>         }
> -bash-4.2$
> 
> Will submit a formal patch soon.
> 
> > 
> > - Arnaldo
> > 

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

* Re: perf tools: LIBCLANGLLVM=1 build broken with llvm 7/clang 6
  2018-06-18 14:31   ` Arnaldo Carvalho de Melo
@ 2018-06-18 15:10     ` Yonghong Song
  2018-06-18 15:37       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 5+ messages in thread
From: Yonghong Song @ 2018-06-18 15:10 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Wang Nan, Jiri Olsa, Linux Kernel Mailing List,
	Alexei Starovoitov, Martin KaFai Lau, Daniel Borkmann



On 6/18/18 7:31 AM, Arnaldo Carvalho de Melo wrote:
> Em Sat, Jun 16, 2018 at 10:20:21AM -0700, Yonghong Song escreveu:
>>
>>
>> On 6/16/18 5:26 AM, Arnaldo Carvalho de Melo wrote:
>>> Hi Wang, Yogong,
>>>
>>> 	While reviewing the BTF patches for pahole, I updated llvm/clang
>>> to HEAD and then building perf with clang embedded I noticed this, will
>>> investigate, posting here to document the regression, maybe this is
>>> something you came across in other scenario:
>>>
>>>    $ make LIBCLANGLLVM=1 -C tools/perf/
>>>    <SNIP>
>>>     CC       /tmp/tmp.t53Qo38zci/tests/kmod-path.o
>>> util/c++/clang.cpp: In function ‘std::unique_ptr<llvm::SmallVectorImpl<char> > perf::getBPFObjectFromModule(llvm::Module*)’:
>>> util/c++/clang.cpp:150:43: error: no matching function for call to ‘llvm::TargetMachine::addPassesToEmitFile(llvm::legacy::PassManager&, llvm::raw_svector_ostream&, llvm::TargetMachine::CodeGenFileType)’
>>>                TargetMachine::CGFT_ObjectFile)) {
>>>                                              ^
>>> In file included from util/c++/clang.cpp:25:0:
>>> /usr/local/include/llvm/Target/TargetMachine.h:254:16: note: candidate: virtual bool llvm::TargetMachine::addPassesToEmitFile(llvm::legacy::PassManagerBase&, llvm::raw_pwrite_stream&, llvm::raw_pwrite_stream*, llvm::TargetMachine::CodeGenFileType, bool, llvm::MachineModuleInfo*)
>>>      virtual bool addPassesToEmitFile(PassManagerBase &, raw_pwrite_stream &,
>>>                   ^~~~~~~~~~~~~~~~~~~
>>> /usr/local/include/llvm/Target/TargetMachine.h:254:16: note:   candidate expects 6 arguments, 3 provided
>>> mv: cannot stat '/tmp/tmp.t53Qo38zci/util/c++/.clang.o.tmp': No such file or directory
>>> make[7]: *** [/home/acme/git/perf/tools/build/Makefile.build:101: /tmp/tmp.t53Qo38zci/util/c++/clang.o] Error 1
>>> make[6]: *** [/home/acme/git/perf/tools/build/Makefile.build:139: c++] Error 2
>>> make[5]: *** [/home/acme/git/perf/tools/build/Makefile.build:139: util] Error 2
>>> make[5]: *** Waiting for unfinished jobs....
>>>     CC       /tmp/tmp.t53Qo38zci/tests/thread-map.o
>>
>> There is an interface change in llvm 7.0 (trunk) for function
>> llvm::TargetMachine::addPassesToEmitFile. The following patch
>> should fix the problem.
> 
> Please submit it, I just tested and the the build finishes Ok.

The formal patch is here:
https://lkml.org/lkml/2018/6/16/92

> 
> - Arnaldo
>   
>> -bash-4.2$ git diff
>> diff --git a/tools/perf/util/c++/clang.cpp b/tools/perf/util/c++/clang.cpp
>> index bf31cea..11dee58 100644
>> --- a/tools/perf/util/c++/clang.cpp
>> +++ b/tools/perf/util/c++/clang.cpp
>> @@ -146,8 +146,15 @@ getBPFObjectFromModule(llvm::Module *Module)
>>          raw_svector_ostream ostream(*Buffer);
>>
>>          legacy::PassManager PM;
>> -       if (TargetMachine->addPassesToEmitFile(PM, ostream,
>> - TargetMachine::CGFT_ObjectFile)) {
>> +       bool NotAdded;
>> +#if CLANG_VERSION_MAJOR < 7
>> +       NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream,
>> + TargetMachine::CGFT_ObjectFile);
>> +#else
>> +       NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream, nullptr,
>> + TargetMachine::CGFT_ObjectFile);
>> +#endif
>> +       if (!NotAdded) {
>>                  llvm::errs() << "TargetMachine can't emit a file of this
>> type\n";
>>                  return
>> std::unique_ptr<llvm::SmallVectorImpl<char>>(nullptr);;
>>          }
>> -bash-4.2$
>>
>> Will submit a formal patch soon.
>>
>>>
>>> - Arnaldo
>>>

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

* Re: perf tools: LIBCLANGLLVM=1 build broken with llvm 7/clang 6
  2018-06-18 15:10     ` Yonghong Song
@ 2018-06-18 15:37       ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-06-18 15:37 UTC (permalink / raw)
  To: Yonghong Song
  Cc: Wang Nan, Jiri Olsa, Linux Kernel Mailing List,
	Alexei Starovoitov, Martin KaFai Lau, Daniel Borkmann

Em Mon, Jun 18, 2018 at 08:10:27AM -0700, Yonghong Song escreveu:
> On 6/18/18 7:31 AM, Arnaldo Carvalho de Melo wrote:
> > Em Sat, Jun 16, 2018 at 10:20:21AM -0700, Yonghong Song escreveu:
> > > There is an interface change in llvm 7.0 (trunk) for function
> > > llvm::TargetMachine::addPassesToEmitFile. The following patch
> > > should fix the problem.
> > 
> > Please submit it, I just tested and the the build finishes Ok.
> 
> The formal patch is here:
> https://lkml.org/lkml/2018/6/16/92

Thanks, hadn't noticed, applied,

- Arnaldo

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

end of thread, other threads:[~2018-06-18 15:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-16 12:26 perf tools: LIBCLANGLLVM=1 build broken with llvm 7/clang 6 Arnaldo Carvalho de Melo
2018-06-16 17:20 ` Yonghong Song
2018-06-18 14:31   ` Arnaldo Carvalho de Melo
2018-06-18 15:10     ` Yonghong Song
2018-06-18 15:37       ` 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