summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--0000_README12
-rw-r--r--2950_libsubcmd-silence-compiler-warning.patch54
-rw-r--r--2951_libbpf-Prevent-compiler-warnings-errors.patch69
-rw-r--r--2952_resolve-btfids-Fix-compiler-warnings.patch73
4 files changed, 208 insertions, 0 deletions
diff --git a/0000_README b/0000_README
index c413d129..f75b6477 100644
--- a/0000_README
+++ b/0000_README
@@ -327,6 +327,18 @@ Patch: 2932_gcc14-objtool-Fix-calloc-call-for-new-Walloc-size.patch
From: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Desc: objtool: Fix calloc call for new -Walloc-size
+Patch: 2950_libsubcmd-silence-compiler-warning.patch
+From: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=7a4ffec9fd54ea27395e24dff726dbf58e2fe06b
+Desc: libsubcmd: Silence compiler warning
+
+Patch: 2951_libbpf-Prevent-compiler-warnings-errors.patch
+From: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=7f4ec77f3fee41dd6a41f03a40703889e6e8f7b2
+Desc: libbpf: Prevent compiler warnings/errors
+
+Patch: 2952_resolve-btfids-Fix-compiler-warnings.patch
+From: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=2c3d022abe6c3165109393b75a127b06c2c70063
+Desc: resolve_btfids: Fix compiler warnings
+
Patch: 2990_libbpf-v2-workaround-Wmaybe-uninitialized-false-pos.patch
From: https://lore.kernel.org/bpf/3ebbe7a4e93a5ddc3a26e2e11d329801d7c8de6b.1723217044.git.sam@gentoo.org/
Desc: libbpf: workaround -Wmaybe-uninitialized false positive
diff --git a/2950_libsubcmd-silence-compiler-warning.patch b/2950_libsubcmd-silence-compiler-warning.patch
new file mode 100644
index 00000000..7dbe59b0
--- /dev/null
+++ b/2950_libsubcmd-silence-compiler-warning.patch
@@ -0,0 +1,54 @@
+From 7a4ffec9fd54ea27395e24dff726dbf58e2fe06b Mon Sep 17 00:00:00 2001
+From: Eder Zulian <ezulian@redhat.com>
+Date: Tue, 22 Oct 2024 19:23:29 +0200
+Subject: libsubcmd: Silence compiler warning
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Initialize the pointer 'o' in options__order to NULL to prevent a
+compiler warning/error which is observed when compiling with the '-Og'
+option, but is not emitted by the compiler with the current default
+compilation options.
+
+For example, when compiling libsubcmd with
+
+ $ make "EXTRA_CFLAGS=-Og" -C tools/lib/subcmd/ clean all
+
+Clang version 17.0.6 and GCC 13.3.1 fail to compile parse-options.c due
+to following error:
+
+ parse-options.c: In function ‘options__order’:
+ parse-options.c:832:9: error: ‘o’ may be used uninitialized [-Werror=maybe-uninitialized]
+ 832 | memcpy(&ordered[nr_opts], o, sizeof(*o));
+ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ parse-options.c:810:30: note: ‘o’ was declared here
+ 810 | const struct option *o, *p = opts;
+ | ^
+ cc1: all warnings being treated as errors
+
+Signed-off-by: Eder Zulian <ezulian@redhat.com>
+Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
+Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Acked-by: Jiri Olsa <jolsa@kernel.org>
+Link: https://lore.kernel.org/bpf/20241022172329.3871958-4-ezulian@redhat.com
+---
+ tools/lib/subcmd/parse-options.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tools/lib/subcmd/parse-options.c b/tools/lib/subcmd/parse-options.c
+index eb896d30545b63..555d617c1f502a 100644
+--- a/tools/lib/subcmd/parse-options.c
++++ b/tools/lib/subcmd/parse-options.c
+@@ -807,7 +807,7 @@ static int option__cmp(const void *va, const void *vb)
+ static struct option *options__order(const struct option *opts)
+ {
+ int nr_opts = 0, nr_group = 0, nr_parent = 0, len;
+- const struct option *o, *p = opts;
++ const struct option *o = NULL, *p = opts;
+ struct option *opt, *ordered = NULL, *group;
+
+ /* flatten the options that have parents */
+--
+cgit 1.2.3-korg
+
diff --git a/2951_libbpf-Prevent-compiler-warnings-errors.patch b/2951_libbpf-Prevent-compiler-warnings-errors.patch
new file mode 100644
index 00000000..67e150ca
--- /dev/null
+++ b/2951_libbpf-Prevent-compiler-warnings-errors.patch
@@ -0,0 +1,69 @@
+From 7f4ec77f3fee41dd6a41f03a40703889e6e8f7b2 Mon Sep 17 00:00:00 2001
+From: Eder Zulian <ezulian@redhat.com>
+Date: Tue, 22 Oct 2024 19:23:28 +0200
+Subject: libbpf: Prevent compiler warnings/errors
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Initialize 'new_off' and 'pad_bits' to 0 and 'pad_type' to NULL in
+btf_dump_emit_bit_padding to prevent compiler warnings/errors which are
+observed when compiling with 'EXTRA_CFLAGS=-g -Og' options, but do not
+happen when compiling with current default options.
+
+For example, when compiling libbpf with
+
+ $ make "EXTRA_CFLAGS=-g -Og" -C tools/lib/bpf/ clean all
+
+Clang version 17.0.6 and GCC 13.3.1 fail to compile btf_dump.c due to
+following errors:
+
+ btf_dump.c: In function ‘btf_dump_emit_bit_padding’:
+ btf_dump.c:903:42: error: ‘new_off’ may be used uninitialized [-Werror=maybe-uninitialized]
+ 903 | if (new_off > cur_off && new_off <= next_off) {
+ | ~~~~~~~~^~~~~~~~~~~
+ btf_dump.c:870:13: note: ‘new_off’ was declared here
+ 870 | int new_off, pad_bits, bits, i;
+ | ^~~~~~~
+ btf_dump.c:917:25: error: ‘pad_type’ may be used uninitialized [-Werror=maybe-uninitialized]
+ 917 | btf_dump_printf(d, "\n%s%s: %d;", pfx(lvl), pad_type,
+ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ 918 | in_bitfield ? new_off - cur_off : 0);
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ btf_dump.c:871:21: note: ‘pad_type’ was declared here
+ 871 | const char *pad_type;
+ | ^~~~~~~~
+ btf_dump.c:930:20: error: ‘pad_bits’ may be used uninitialized [-Werror=maybe-uninitialized]
+ 930 | if (bits == pad_bits) {
+ | ^
+ btf_dump.c:870:22: note: ‘pad_bits’ was declared here
+ 870 | int new_off, pad_bits, bits, i;
+ | ^~~~~~~~
+ cc1: all warnings being treated as errors
+
+Signed-off-by: Eder Zulian <ezulian@redhat.com>
+Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
+Acked-by: Jiri Olsa <jolsa@kernel.org>
+Link: https://lore.kernel.org/bpf/20241022172329.3871958-3-ezulian@redhat.com
+---
+ tools/lib/bpf/btf_dump.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c
+index 8440c2c5ad3ede..468392f9882d2f 100644
+--- a/tools/lib/bpf/btf_dump.c
++++ b/tools/lib/bpf/btf_dump.c
+@@ -867,8 +867,8 @@ static void btf_dump_emit_bit_padding(const struct btf_dump *d,
+ } pads[] = {
+ {"long", d->ptr_sz * 8}, {"int", 32}, {"short", 16}, {"char", 8}
+ };
+- int new_off, pad_bits, bits, i;
+- const char *pad_type;
++ int new_off = 0, pad_bits = 0, bits, i;
++ const char *pad_type = NULL;
+
+ if (cur_off >= next_off)
+ return; /* no gap */
+--
+cgit 1.2.3-korg
+
diff --git a/2952_resolve-btfids-Fix-compiler-warnings.patch b/2952_resolve-btfids-Fix-compiler-warnings.patch
new file mode 100644
index 00000000..eaf9dd23
--- /dev/null
+++ b/2952_resolve-btfids-Fix-compiler-warnings.patch
@@ -0,0 +1,73 @@
+From 2c3d022abe6c3165109393b75a127b06c2c70063 Mon Sep 17 00:00:00 2001
+From: Eder Zulian <ezulian@redhat.com>
+Date: Tue, 22 Oct 2024 19:23:27 +0200
+Subject: resolve_btfids: Fix compiler warnings
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Initialize 'set' and 'set8' pointers to NULL in sets_patch to prevent
+possible compiler warnings which are issued for various optimization
+levels, but do not happen when compiling with current default
+compilation options.
+
+For example, when compiling resolve_btfids with
+
+ $ make "HOSTCFLAGS=-O2 -Wall" -C tools/bpf/resolve_btfids/ clean all
+
+Clang version 17.0.6 and GCC 13.3.1 issue following
+-Wmaybe-uninitialized warnings for variables 'set8' and 'set':
+
+ In function ‘sets_patch’,
+ inlined from ‘symbols_patch’ at main.c:748:6,
+ inlined from ‘main’ at main.c:823:6:
+ main.c:163:9: warning: ‘set8’ may be used uninitialized [-Wmaybe-uninitialized]
+ 163 | eprintf(1, verbose, pr_fmt(fmt), ##__VA_ARGS__)
+ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ main.c:729:17: note: in expansion of macro ‘pr_debug’
+ 729 | pr_debug("sorting addr %5lu: cnt %6d [%s]\n",
+ | ^~~~~~~~
+ main.c: In function ‘main’:
+ main.c:682:37: note: ‘set8’ was declared here
+ 682 | struct btf_id_set8 *set8;
+ | ^~~~
+ In function ‘sets_patch’,
+ inlined from ‘symbols_patch’ at main.c:748:6,
+ inlined from ‘main’ at main.c:823:6:
+ main.c:163:9: warning: ‘set’ may be used uninitialized [-Wmaybe-uninitialized]
+ 163 | eprintf(1, verbose, pr_fmt(fmt), ##__VA_ARGS__)
+ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ main.c:729:17: note: in expansion of macro ‘pr_debug’
+ 729 | pr_debug("sorting addr %5lu: cnt %6d [%s]\n",
+ | ^~~~~~~~
+ main.c: In function ‘main’:
+ main.c:683:36: note: ‘set’ was declared here
+ 683 | struct btf_id_set *set;
+ | ^~~
+
+Signed-off-by: Eder Zulian <ezulian@redhat.com>
+Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
+Acked-by: Jiri Olsa <jolsa@kernel.org>
+Link: https://lore.kernel.org/bpf/20241022172329.3871958-2-ezulian@redhat.com
+---
+ tools/bpf/resolve_btfids/main.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c
+index d54aaa0619df95..bd9f960bce3d5b 100644
+--- a/tools/bpf/resolve_btfids/main.c
++++ b/tools/bpf/resolve_btfids/main.c
+@@ -679,8 +679,8 @@ static int sets_patch(struct object *obj)
+
+ next = rb_first(&obj->sets);
+ while (next) {
+- struct btf_id_set8 *set8;
+- struct btf_id_set *set;
++ struct btf_id_set8 *set8 = NULL;
++ struct btf_id_set *set = NULL;
+ unsigned long addr, off;
+ struct btf_id *id;
+
+--
+cgit 1.2.3-korg
+