diff mbox series

perf tools: Add proper header file for symbols

Message ID 20190208223543.31836-1-mathieu.poirier@linaro.org
State New
Headers show
Series perf tools: Add proper header file for symbols | expand

Commit Message

Mathieu Poirier Feb. 8, 2019, 10:35 p.m. UTC
After 'commit e22c1c751140 ("perf thread: Don't include symbol.h,
symbol_conf.h is enough")'

Compilation of the perf tools is broken when using the functionality
provided by the openCSD library:

[...]

...                       timerfd: [ on  ]
...                  sched_getcpu: [ on  ]
...                           sdt: [ OFF ]
...                         setns: [ on  ]
...                    libopencsd: [ on  ]

[...]

  CC       util/arm-spe.o
  CC       util/arm-spe-pkt-decoder.o
  CC       util/s390-cpumsf.o
  CC       util/cs-etm.o
  CC       util/parse-branch-options.o
util/cs-etm.c: In function ‘cs_etm__mem_access’:
util/cs-etm.c:297:24: error: storage size of ‘al’ isn’t known
  struct  addr_location al;

And rightly so since file cs-etm.c doesn't include symbol.h, something
that is rectified in this patch.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
 tools/perf/util/cs-etm.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Arnaldo Carvalho de Melo Feb. 11, 2019, 11:46 a.m. UTC | #1
Em Fri, Feb 08, 2019 at 03:35:43PM -0700, Mathieu Poirier escreveu:
> After 'commit e22c1c751140 ("perf thread: Don't include symbol.h,
> symbol_conf.h is enough")'
> 
> Compilation of the perf tools is broken when using the functionality
> provided by the openCSD library:
> 
> [...]
> 
> ...                       timerfd: [ on  ]
> ...                  sched_getcpu: [ on  ]
> ...                           sdt: [ OFF ]
> ...                         setns: [ on  ]
> ...                    libopencsd: [ on  ]
> 
> [...]
> 
>   CC       util/arm-spe.o
>   CC       util/arm-spe-pkt-decoder.o
>   CC       util/s390-cpumsf.o
>   CC       util/cs-etm.o
>   CC       util/parse-branch-options.o
> util/cs-etm.c: In function ‘cs_etm__mem_access’:
> util/cs-etm.c:297:24: error: storage size of ‘al’ isn’t known
>   struct  addr_location al;
> 
> And rightly so since file cs-etm.c doesn't include symbol.h, something
> that is rectified in this patch.

Thanks, I'll make sure the openCSD library is present in one of my
containers doing arm64 cross builds so that this gets caught in the
future.

- Arnaldo
 
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> ---
>  tools/perf/util/cs-etm.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
> index 8b3f882d6e2f..0b11d653cfbe 100644
> --- a/tools/perf/util/cs-etm.c
> +++ b/tools/perf/util/cs-etm.c
> @@ -25,6 +25,7 @@
>  #include "machine.h"
>  #include "map.h"
>  #include "perf.h"
> +#include "symbol.h"
>  #include "thread.h"
>  #include "thread_map.h"
>  #include "thread-stack.h"
> -- 
> 2.17.1
Arnaldo Carvalho de Melo Feb. 11, 2019, 2:22 p.m. UTC | #2
Em Mon, Feb 11, 2019 at 08:46:03AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Fri, Feb 08, 2019 at 03:35:43PM -0700, Mathieu Poirier escreveu:
> > After 'commit e22c1c751140 ("perf thread: Don't include symbol.h,
> > symbol_conf.h is enough")'
> > 
> > Compilation of the perf tools is broken when using the functionality
> > provided by the openCSD library:
> > 
> > [...]
> > 
> > ...                       timerfd: [ on  ]
> > ...                  sched_getcpu: [ on  ]
> > ...                           sdt: [ OFF ]
> > ...                         setns: [ on  ]
> > ...                    libopencsd: [ on  ]
> > 
> > [...]
> > 
> >   CC       util/arm-spe.o
> >   CC       util/arm-spe-pkt-decoder.o
> >   CC       util/s390-cpumsf.o
> >   CC       util/cs-etm.o
> >   CC       util/parse-branch-options.o
> > util/cs-etm.c: In function ‘cs_etm__mem_access’:
> > util/cs-etm.c:297:24: error: storage size of ‘al’ isn’t known
> >   struct  addr_location al;
> > 
> > And rightly so since file cs-etm.c doesn't include symbol.h, something
> > that is rectified in this patch.
> 
> Thanks, I'll make sure the openCSD library is present in one of my
> containers doing arm64 cross builds so that this gets caught in the
> future.

So, without your patch:
    17.52 ubuntu:19.04-x-arm64          : FAIL gcc (Ubuntu 8.2.0-19ubuntu1) 8.2.0
  CC       /tmp/build/perf/util/parse-branch-options.o
util/cs-etm.c: In function 'cs_etm__mem_access':
util/cs-etm.c:326:24: error: storage size of 'al' isn't known
  struct  addr_location al;
                        ^~
util/cs-etm.c:326:24: error: unused variable 'al' [-Werror=unused-variable]
util/cs-etm.c: In function 'cs_etm__alloc_queue':
util/cs-etm.c:384:22: error: invalid application of 'sizeof' to incomplete type 'struct branch_stack'
   size_t sz = sizeof(struct branch_stack);
                      ^~~~~~
util/cs-etm.c:387:16: error: invalid application of 'sizeof' to incomplete type 'struct branch_entry'
         sizeof(struct branch_entry);
                ^~~~~~
util/cs-etm.c: In function 'cs_etm__copy_last_branch_rb':
util/cs-etm.c:541:8: error: dereferencing pointer to incomplete type 'struct branch_stack'
  bs_dst->nr = bs_src->nr;
        ^~
util/cs-etm.c:557:16: error: invalid application of 'sizeof' to incomplete type 'struct branch_entry'
         sizeof(struct branch_entry) * nr);
                ^~~~~~
util/cs-etm.c:569:17: error: invalid application of 'sizeof' to incomplete type 'struct branch_entry'
          sizeof(struct branch_entry) * etmq->last_branch_pos);
                 ^~~~~~
util/cs-etm.c: In function 'cs_etm__update_last_branch_rb':
util/cs-etm.c:646:4: error: dereferencing pointer to incomplete type 'struct branch_entry'
  be->from = cs_etm__last_executed_instr(etmq->prev_packet);
    ^~
  CC       /tmp/build/perf/util/dump-insn.o
util/cs-etm.c: In function 'cs_etm__synth_branch_sample':
util/cs-etm.c:792:23: error: field 'entries' has incomplete type
   struct branch_entry entries;
                       ^~~~~~~
util/cs-etm.c:820:5: error: field name not in record or union initializer
     .from = sample.ip,
     ^
util/cs-etm.c:820:5: note: (near initialization for '(anonymous).entries')
util/cs-etm.c:821:5: error: field name not in record or union initializer
     .to = sample.addr,
     ^
util/cs-etm.c:821:5: note: (near initialization for '(anonymous).entries')
cc1: all warnings being treated as errors
mv: cannot stat '/tmp/build/perf/util/.cs-etm.o.tmp': No such file or directory
make[4]: *** [/git/linux/tools/build/Makefile.build:97: /tmp/build/perf/util/cs-etm.o] Error 1


----------------------------------------------------

After your patch:

[root@quaco x-arm64]# time dm ubuntu:19.04-x-arm64
   1    44.59 ubuntu:19.04-x-arm64          : Ok   gcc (Ubuntu 8.2.0-19ubuntu1) 8.2.0

further output below, but now I have this in this ubuntu 19.04 arm64
cross build container:

[root@quaco x-arm64]# egrep -B2 -A2 'CSD|CROSS' Dockerfile
ENV ARCH arm64
ENV TARGET aarch64-linux-gnu
ENV CROSS_COMPILE=${TARGET}-
RUN apt-get -y update && \
    apt-get -y install make gcc-${TARGET} g++-${TARGET} flex bison git && \
--
    export PATH=$INSTALLDIR/bin:$PATH && \
    export TARGETMACH=${TARGET} && \
    export CROSS=${TARGET}- && \
    export CC=${CROSS}gcc && \
    export LD=${CROSS}ld && \
    export AS=${CROSS}as && \
    wget -q http://zlib.net/zlib-${ZLIB_VER}.tar.gz && \
    wget -q https://fedorahosted.org/releases/e/l/elfutils/${ELFUTILS_VER}/elfutils-${ELFUTILS_VER}.tar.bz2 && \
--
    cd .. && \
    rm -rf elfutils-${ELFUTILS_VER} && \
    git clone https://github.com/Linaro/OpenCSD.git && \
    make -C OpenCSD/decoder/build/linux/ CROSS_COMPILE=${CROSS} install && \
    rm -rf OpenCSD && \
    apt-get -y remove wget bzip2 && \
    apt-get -y clean && \
    rm -rf /usr/share/doc /usr/share/gtk-doc /usr/share/locale /usr/share/man && \
    unset TARGET INSTALLDIR TARGETMACH CROSS CC LD AS
RUN mkdir -m 777 -p /git /tmp/build/perf /tmp/build/objtool /tmp/build/linux && \
    groupadd -r perfbuilder && \
[root@quaco x-arm64]#


[root@quaco x-arm64]# grep -B3 -A3 cs-etm /tmp/dm.log/ubuntu\:19.04-x-arm64 
  LINK     /tmp/build/perf/plugin_hrtimer.so
  CC       /tmp/build/perf/arch/arm64/util/../../arm/util/auxtrace.o
  LINK     /tmp/build/perf/plugin_kmem.so
  CC       /tmp/build/perf/arch/arm64/util/../../arm/util/cs-etm.o
  LINK     /tmp/build/perf/plugin_kvm.so
  CC       /tmp/build/perf/libbpf_errno.o
  LINK     /tmp/build/perf/plugin_mac80211.so
--
  MKDIR    /tmp/build/perf/util/intel-pt-decoder/
  GEN      /tmp/build/perf/util/intel-pt-decoder/inat-tables.c
  CC       /tmp/build/perf/util/intel-pt-decoder/intel-pt-log.o
  MKDIR    /tmp/build/perf/util/cs-etm-decoder/
  CC       /tmp/build/perf/util/cs-etm-decoder/cs-etm-decoder.o
  CC       /tmp/build/perf/tests/hists_output.o
  CC       /tmp/build/perf/util/intel-pt-decoder/intel-pt-decoder.o
  CC       /tmp/build/perf/tests/hists_cumulate.o
  CC       /tmp/build/perf/util/intel-pt-decoder/intel-pt-insn-decoder.o
  CC       /tmp/build/perf/tests/python-use.o
  LD       /tmp/build/perf/util/cs-etm-decoder/libperf-in.o
  MKDIR    /tmp/build/perf/util/scripting-engines/
  LD       /tmp/build/perf/util/scripting-engines/libperf-in.o
  CC       /tmp/build/perf/tests/bp_signal.o
--
  CC       /tmp/build/perf/util/s390-cpumsf.o
  CC       /tmp/build/perf/tests/code-reading.o
  CC       /tmp/build/perf/tests/sample-parsing.o
  CC       /tmp/build/perf/util/cs-etm.o
  CC       /tmp/build/perf/tests/parse-no-sample-id-all.o
  CC       /tmp/build/perf/util/parse-branch-options.o
  CC       /tmp/build/perf/tests/kmod-path.o
--
  CC       /tmp/build/perf/trace/beauty/statx.o
  CC       /tmp/build/perf/arch/arm64/util/../../arm/util/auxtrace.o
  CC       /tmp/build/perf/ui/util.o
  CC       /tmp/build/perf/arch/arm64/util/../../arm/util/cs-etm.o
  CC       /tmp/build/perf/ui/hist.o
  CC       /tmp/build/perf/ui/stdio/hist.o
  LD       /tmp/build/perf/trace/beauty/libperf-in.o
--
  CC       /tmp/build/perf/util/thread-stack.o
  CC       /tmp/build/perf/util/auxtrace.o
  CC       /tmp/build/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.o
  CC       /tmp/build/perf/util/cs-etm-decoder/cs-etm-decoder.o
  CC       /tmp/build/perf/util/intel-pt.o
  CC       /tmp/build/perf/util/intel-bts.o
  CC       /tmp/build/perf/tests/python-use.o
  CC       /tmp/build/perf/util/intel-pt-decoder/intel-pt-log.o
  CC       /tmp/build/perf/tests/bp_signal.o
  LD       /tmp/build/perf/util/cs-etm-decoder/libperf-in.o
  CC       /tmp/build/perf/util/arm-spe.o
  CC       /tmp/build/perf/util/intel-pt-decoder/intel-pt-decoder.o
  CC       /tmp/build/perf/tests/bp_signal_overflow.o
--
  CC       /tmp/build/perf/tests/bp_account.o
  CC       /tmp/build/perf/tests/wp.o
  CC       /tmp/build/perf/util/s390-cpumsf.o
  CC       /tmp/build/perf/util/cs-etm.o
  CC       /tmp/build/perf/util/parse-branch-options.o
  CC       /tmp/build/perf/tests/task-exit.o
  CC       /tmp/build/perf/tests/sw-clock.o
[root@quaco x-arm64]#
diff mbox series

Patch

diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index 8b3f882d6e2f..0b11d653cfbe 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -25,6 +25,7 @@ 
 #include "machine.h"
 #include "map.h"
 #include "perf.h"
+#include "symbol.h"
 #include "thread.h"
 #include "thread_map.h"
 #include "thread-stack.h"