diff options
authorBruce Ashfield <bruce.ashfield@gmail.com>2019-03-08 08:46:10 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-03-09 14:41:20 +0000
commit3a23e094c4189af878e467f1636aea63955e250d (patch)
parent4b1f421ab5c7e5a3ee7bad5744149d331c6e0511 (diff)
perf: synchronize unistd.h between libc-headers and perf source
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>
1 files changed, 4 insertions, 0 deletions
diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb
index 9120766858..5acdcfb9f0 100644
--- a/meta/recipes-kernel/perf/perf.bb
+++ b/meta/recipes-kernel/perf/perf.bb
@@ -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}"
+ # 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() {