diff options
author | Dengke Du <dengke.du@windriver.com> | 2019-04-04 17:02:33 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-04-12 09:29:06 +0100 |
commit | a9ab5627774b65e713259062b983b65fa693004a (patch) | |
tree | 05ac127b69f5b0d782a3f1f98daeeeba9c5db4cc /meta/recipes-kernel | |
parent | 1576ce540baff83c0d9eb40f3cdb0166b254e1a8 (diff) | |
download | poky-a9ab5627774b65e713259062b983b65fa693004a.tar.gz |
perf: workaround the error cased by maybe-uninitialized warning
When enable DEBUG_BUILD, the perf build failed by the following error:
libbpf.c:727:36: error: 'data' may be used uninitialized in this function [-Werror=maybe-uninitialized]
This is ok until Khem commit a patch in oe-core:
16643b03227466e2c80a24c2d079fe36e89553c1
This commit import "-Og" option to "DEBUG_OPTIMIZATION", result in this error.
Actually, the warning was misinformation. We explore the code in libbpf.c:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/lib/bpf/libbpf.c#n640
--------------------------------------------------------------------------
if (scn)
data = elf_getdata(scn, NULL);
if (!scn || !data) {
pr_warning("failed to get Elf_Data from map section %d\n",
obj->efile.maps_shndx);
return -EINVAL;
}
......
using data...
......
--------------------------------------------------------------------------
If the 'scn' was not null, the data will be initialized. if the data was null,
the function will return -EINVAL, so the data must be not null, but compiler
can't see it in 'if' code block, so treat it as 'maybe-uninitialized'.
(From OE-Core rev: 0eb4048bc5865579327f5a88086e3e3241b012cb)
Signed-off-by: Dengke Du <dengke.du@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-kernel')
-rw-r--r-- | meta/recipes-kernel/perf/perf.bb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb index 5acdcfb9f0..546076f84b 100644 --- a/meta/recipes-kernel/perf/perf.bb +++ b/meta/recipes-kernel/perf/perf.bb | |||
@@ -271,3 +271,4 @@ FILES_${PN}-perl = "${libexecdir}/perf-core/scripts/perl" | |||
271 | 271 | ||
272 | 272 | ||
273 | INHIBIT_PACKAGE_DEBUG_SPLIT="1" | 273 | INHIBIT_PACKAGE_DEBUG_SPLIT="1" |
274 | DEBUG_OPTIMIZATION_append = " -Wno-error=maybe-uninitialized" | ||