]> code.ossystems Code Review - openembedded-core.git/commitdiff
perf: synchronize unistd.h between libc-headers and perf source
authorBruce Ashfield <bruce.ashfield@gmail.com>
Fri, 8 Mar 2019 13:46:10 +0000 (08:46 -0500)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 9 Mar 2019 14:41:20 +0000 (14:41 +0000)
During the build for some architectures, perf generates a program
which executes on the host to dump the syscall table.

The generation of that program uses the cross compiler + sysroot
to expand unistd.h. As such, we are getting the contents of that
file from linux-libc-headers.

The compilation of that generated program uses the host compiler
and a restricted include path to the perf source code. In the
perf source there is a captured unistd.h, as such it will be used
when compiling the host executable. The perf source code is copied
from the kernel version that is being built .. so we have a
mismatch between the generation and the compilation of the host
program.

Normally this mismatch is fine, but if the libc-headers are
newer than the kernel, we'll have syscalls (and their syscall
numbers) that are not defined in the perf source code. This
leads to a compiler error and a cascading failure of the perf
build due to a missing generated file.

To fix this, we can copy unistd.h from the recipe-sysroot
into the perf source code and they will always be in sync.

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-kernel/perf/perf.bb

index 91207668581d285af238efc1466d7088ade8dd15..5acdcfb9f0407febb45544aab6a3b3a342faeb15 100644 (file)
@@ -235,6 +235,10 @@ do_configure_prepend () {
     for s in `find ${S}/tools/perf/scripts/python/ -name '*.py'`; do
         sed -i 's,/usr/bin/python2,/usr/bin/env python,' "${s}"
     done
+
+    # unistd.h can be out of sync between libc-headers and the captured version in the perf source
+    # so we copy it from the sysroot unistd.h to the perf unistd.h
+    cp ${STAGING_INCDIR}/asm-generic/unistd.h ${S}/tools/include/uapi/asm-generic/unistd.h
 }
 
 python do_package_prepend() {