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


Groups > linux.kernel > #1535033

Re: [PATCH v3 10/30] perf clang: Add builtin clang support ant test case

From Arnaldo Carvalho de Melo <acme@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH v3 10/30] perf clang: Add builtin clang support ant test case
Date 2016-12-02 16:50 +0100
Message-ID <sJYg1-5Hd-13@gated-at.bofh.it> (permalink)
References <sHFhv-3nx-5@gated-at.bofh.it> <sHFrb-3qJ-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Em Sat, Nov 26, 2016 at 07:03:34AM +0000, Wang Nan escreveu:
> Add basic clang support in clang.cpp and test__clang() testcase. The
> first testcase checks if builtin clang is able to generate LLVM IR.
> 
> tests/clang.c is a proxy. Real testcase resides in
> utils/c++/clang-test.cpp in c++ and exports C interface to perf test
> subsystem.
> 
> Test result:
> 
>    $ perf test -v clang
>    51: Test builtin clang support                               :
>    51.1: Test builtin clang compile C source to IR              :
>    --- start ---
>    test child forked, pid 13215
>    test child finished with 0
>    ---- end ----
>    Test builtin clang support subtest 0: Ok

While testing this I noticed that the perf binary got huge, can't this
be done in some other way, i.e. using dynamic library?

[root@jouet ~]# size /tmp/perf
   text	   data	    bss	    dec	    hex	filename
75333688	1421584	23962176	100717448	600d388 /tmp/perf
[root@jouet ~]#

I've built it with this:

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

the resulting binary:

[acme@jouet linux]$ 
[acme@jouet linux]$ ls -la ~/bin/perf
-rwxr-xr-x. 2 acme acme 131689136 Dec  2 12:31 /home/acme/bin/perf
[acme@jouet linux]$ ls -lah ~/bin/perf
-rwxr-xr-x. 2 acme acme 126M Dec  2 12:31 /home/acme/bin/perf
[acme@jouet linux]$

Huge, after stripping it:

[acme@jouet linux]$ ls -la /tmp/perf
-rwxr-xr-x. 1 root root 76759056 Dec  2 12:33 /tmp/perf
[acme@jouet linux]$ ls -lah /tmp/perf
-rwxr-xr-x. 1 root root 74M Dec  2 12:33 /tmp/perf
[acme@jouet linux]$

Still huge :-\

Ok, this needs explicitely enabling, but then, for distros, if we want
this feature to be enabled...

I think we should try to help distributions to ship a basic perf binary
in a base package that doesn't brings many libraries, like was done for
the gtk UI, and also we should start providing RPM specfiles and debian
(and others, hopefully contributed by other people with interest in
other distros), to help in getting a sane package split, i.e. want
llvm/bpf? install the 'perf-ebpf' rpm/deb/whatever package and incur in
these costs.

But being a n00b on llvm/clang libraries, etc, my question goes back to:
can we have this using a libllvm.so or libclang.so dynamic libraries?

See this, out of hand :-\ Tell me I'm doing something wrong :-)

[acme@jouet linux]$ cat /etc/fedora-release 
Fedora release 25 (Twenty Five)
[acme@jouet linux]$ rpm -qa | egrep llvm\|clang
llvm-libs-3.8.0-1.fc25.x86_64
[acme@jouet linux]$

[acme@jouet linux]$ nm ~/bin/perf | grep -i clang | wc -l
204757

[acme@jouet linux]$ nm ~/bin/perf | grep -i llvm | wc -l
234036

[acme@jouet linux]$ nm ~/bin/perf | grep -i clang | tail
00000000011741ba t
_ZZZN5clang7CodeGen15CodeGenFunction20EmitOMPTaskDirectiveERKNS_16OMPTaskDirectiveEENKUlRS1_E_clES5_ENKUlvE_clEv
0000000001169fee t
_ZZZN5clang7CodeGen15CodeGenFunction25EmitOMPFirstprivateClauseERKNS_22OMPExecutableDirectiveERNS1_15OMPPrivateScopeEENKUlvE_clEvENKUlNS0_7AddressES8_E_clES8_S8_
00000000038b83e0 r
_ZZZN5clang9ASTReader24FindExternalLexicalDeclsEPKNS_11DeclContextEN4llvm12function_refIFbNS_4Decl4KindEEEERNS4_15SmallVectorImplIPS6_EEENKUlPNS_13serialization10ModuleFileENS4_8ArrayRefINS4_7support6detail31packed_endian_specific_integralIjLNSI_10endiannessE2ELm1EEEEEE_clESG_SN_E19__PRETTY_FUNCTION__
0000000003934140 r
_ZZZN5clang9ASTWriter12WriteASTCoreERNS_4SemaEN4llvm9StringRefERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPNS_6ModuleEENKUljbE0_clEjbE19__PRETTY_FUNCTION__
00000000039319e0 r
_ZZZN5clang9ASTWriter12WriteASTCoreERNS_4SemaEN4llvm9StringRefERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPNS_6ModuleEENKUlPNS_4DeclENS_13serialization17PredefinedDeclIDsEE_clESG_SI_E19__PRETTY_FUNCTION__
000000000393b700 r
_ZZZN5clang9ASTWriter17GetOrCreateTypeIDENS_8QualTypeEENKUlS1_E_clES1_E19__PRETTY_FUNCTION__
000000000393b880 r
_ZZZNK5clang9ASTWriter9getTypeIDENS_8QualTypeEENKUlS1_E_clES1_E19__PRETTY_FUNCTION__
0000000002176480 t
_ZZZZN12_GLOBAL__N_19ASTDumper11dumpLookupsEPKN5clang11DeclContextEbENKUlvE_clEvENKUlvE_clEvENKUlvE_clEv
000000000144ef0a t
_ZZZZN5clang7CodeGen15CGOpenMPRuntime13emitReductionERNS0_15CodeGenFunctionENS_14SourceLocationEN4llvm8ArrayRefIPKNS_4ExprEEESA_SA_SA_bbENKUlS3_S9_S9_S9_E1_clES3_S9_S9_S9_ENKUlNS0_6RValueEE_clESC_ENKUlvE_clEv
000000000217640c t
_ZZZZZN12_GLOBAL__N_19ASTDumper11dumpLookupsEPKN5clang11DeclContextEbENKUlvE_clEvENKUlvE_clEvENKUlvE_clEvENKUlPNS1_4DeclEE_clES9_
[acme@jouet linux]$

Thanks,

- Arnaldo

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 10/30] perf clang: Add builtin clang support ant test case Wang Nan <wangnan0@huawei.com> - 2016-11-26 08:20 +0100
  Re: [PATCH v3 10/30] perf clang: Add builtin clang support ant test  case Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2016-11-26 18:20 +0100
    Re: [PATCH v3 10/30] perf clang: Add builtin clang support ant test  case "Wangnan (F)" <wangnan0@huawei.com> - 2016-11-28 08:50 +0100
  Re: [PATCH v3 10/30] perf clang: Add builtin clang support ant test  case Arnaldo Carvalho de Melo <acme@redhat.com> - 2016-12-02 16:50 +0100
    Re: [PATCH v3 10/30] perf clang: Add builtin clang support ant test  case "Wangnan (F)" <wangnan0@huawei.com> - 2016-12-05 03:40 +0100
      Re: [PATCH v3 10/30] perf clang: Add builtin clang support ant test  case "Wangnan (F)" <wangnan0@huawei.com> - 2016-12-05 05:50 +0100
    Re: [PATCH v3 10/30] perf clang: Add builtin clang support ant test  case Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2016-12-05 18:00 +0100
      Re: [PATCH v3 10/30] perf clang: Add builtin clang support ant test  case Arnaldo Carvalho de Melo <acme@redhat.com> - 2016-12-05 22:10 +0100
        Re: [PATCH v3 10/30] perf clang: Add builtin clang support ant test  case Arnaldo Carvalho de Melo <acme@redhat.com> - 2016-12-05 22:50 +0100
          Re: [PATCH v3 10/30] perf clang: Add builtin clang support ant test  case "Wangnan (F)" <wangnan0@huawei.com> - 2016-12-06 03:20 +0100
            Re: [PATCH v3 10/30] perf clang: Add builtin clang support ant test  case Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-12-06 14:50 +0100
      Re: [PATCH v3 10/30] perf clang: Add builtin clang support ant test  case Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-12-06 20:30 +0100
        Re: [PATCH v3 10/30] perf clang: Add builtin clang support ant test  case Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-12-06 22:10 +0100
  [tip:perf/core] perf clang: Add builtin clang support ant test case tip-bot for Wang Nan <tipbot@zytor.com> - 2016-12-06 09:30 +0100

csiph-web