diff options
| author | hongxu <hongxu.jia@eng.windriver.com> | 2025-09-23 20:58:57 +0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-09-24 11:06:42 +0100 |
| commit | 4f99a9eb031020c10b2a10b431ab8be6d75a534e (patch) | |
| tree | 136df2bc0b6d4bbc7690f23e274713cdcb074e77 | |
| parent | 07019704ccc24ce8526d5ebc8fa5b4203d082ead (diff) | |
| download | poky-4f99a9eb031020c10b2a10b431ab8be6d75a534e.tar.gz | |
perf: fix reproducibility issue occasionally
Due to commit [1] applied in kernel v6.16 (such as qemux86-64),
perl has reproducibility issue occasionally.
Perf's build process generates two copies of its internal headers,
one at tools/lib/perf/include/internal and one at libperf/include/internal
with files like core.h. Although the files are identical, the binaries including
them would see them at different paths and have different debuginfo data. [2]
The reason is the order of include dir `tools/lib/perf/include' and
`libperf/include' is not stable, such as
$ x86_64-poky-linux-gcc ... \
-Ipath-to/tmp/work/qemux86_64-poky-linux/perf/1.0/sources/perf-1.0/tools/lib/perf/include \
-Ipath-to/tmp/work/qemux86_64-poky-linux/perf/1.0/sources/perf-1.0/libperf/include \
-c -o path-to/tmp/work/qemux86_64-poky-linux/perf/1.0/sources/perf-1.0/libperf/core.o core.c
$ recipe-sysroot-native/usr/bin/dwarfsrcfiles sources/perf-1.0/libperf/core.o
/usr/src/debug/perf/1.0/tools/lib/perf/core.c
...
/usr/src/debug/perf/1.0/tools/lib/perf/include/perf/core.h
/usr/src/debug/perf/1.0/tools/lib/perf/include/internal/lib.h
...
$ x86_64-poky-linux-gcc ... \
-Ipath-to/tmp/work/qemux86_64-poky-linux/perf/1.0/sources/perf-1.0/libperf/include \
-Ipath-to/tmp/work/qemux86_64-poky-linux/perf/1.0/sources/perf-1.0/tools/lib/perf/include \
-c -o path-to/tmp/work/qemux86_64-poky-linux/perf/1.0/sources/perf-1.0/libperf/core.o core.c
$ recipe-sysroot-native/usr/bin/dwarfsrcfiles sources/perf-1.0/libperf/core.o
/usr/src/debug/perf/1.0/tools/lib/perf/core.c
...
/usr/src/debug/perf/1.0/libperf/include/perf/core.h
/usr/src/debug/perf/1.0/libperf/include/internal/lib.h
...
This commit explicitly sets the order of these two include dirs
in EXTRA_CFLAGS.
This commit has no regression for kernel v6.6 (such as genericx86-64)
Also enable verbose for compile to trace the detail of build
[1] https://github.com/torvalds/linux/commit/f5b07010c13c77541e8ade167d05bef3b8a63739
[2] https://git.openembedded.org/openembedded-core/commit/?id=0a886fcacaab0fbce1306c0f99d482f940a8f705
(From OE-Core rev: e18d697e92b55e57124e80234369d46575226386)
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/recipes-kernel/perf/perf.bb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb index e1915207ee..3b9e52fdb8 100644 --- a/meta/recipes-kernel/perf/perf.bb +++ b/meta/recipes-kernel/perf/perf.bb | |||
| @@ -105,7 +105,7 @@ EXTRA_OEMAKE = '\ | |||
| 105 | LDSHARED="${CC} -shared" \ | 105 | LDSHARED="${CC} -shared" \ |
| 106 | AR="${AR}" \ | 106 | AR="${AR}" \ |
| 107 | LD="${LD}" \ | 107 | LD="${LD}" \ |
| 108 | EXTRA_CFLAGS="-ldw -I${S}" \ | 108 | EXTRA_CFLAGS="-ldw -I${S} -I${S}/libperf/include -I${S}/tools/lib/perf/include" \ |
| 109 | YFLAGS='-y --file-prefix-map=${WORKDIR}=${TARGET_DBGSRC_DIR}' \ | 109 | YFLAGS='-y --file-prefix-map=${WORKDIR}=${TARGET_DBGSRC_DIR}' \ |
| 110 | EXTRA_LDFLAGS="${PERF_EXTRA_LDFLAGS}" \ | 110 | EXTRA_LDFLAGS="${PERF_EXTRA_LDFLAGS}" \ |
| 111 | perfexecdir=${libexecdir} \ | 111 | perfexecdir=${libexecdir} \ |
| @@ -174,8 +174,8 @@ do_compile() { | |||
| 174 | # There are two copies of internal headers such as: | 174 | # There are two copies of internal headers such as: |
| 175 | # libperf/include/internal/xyarray.h and tools/lib/perf/include/internal/xyarray.h | 175 | # libperf/include/internal/xyarray.h and tools/lib/perf/include/internal/xyarray.h |
| 176 | # For reproducibile binaries, we need to find one copy, hence force libperf to be created first | 176 | # For reproducibile binaries, we need to find one copy, hence force libperf to be created first |
| 177 | oe_runmake ${B}/libperf/libperf.a | 177 | oe_runmake ${B}/libperf/libperf.a V=1 |
| 178 | oe_runmake all | 178 | oe_runmake all V=1 |
| 179 | } | 179 | } |
| 180 | 180 | ||
| 181 | do_install() { | 181 | do_install() { |
