summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2024-02-01 17:32:21 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-02-03 22:08:26 +0000
commite41515b5f97d4c1fefcf70524ab70796dfc0e8ba (patch)
tree17d44003bb212b2d0ab7c004ec9ef73dfe132cb7
parenta7ed494c4a0a86b0d5daeae93ffdb2cf5caaf093 (diff)
downloadpoky-e41515b5f97d4c1fefcf70524ab70796dfc0e8ba.tar.gz
systemtap: Backport GCC-14 related calloc fixes
(From OE-Core rev: 06ad41e0097902d46ad5affd99b1c716dbb27d71) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/0001-bpf-translate.cxx-fix-build-against-upcoming-gcc-14-.patch40
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/0001-staprun-fix-build-against-upcoming-gcc-14-Werror-cal.patch36
-rw-r--r--meta/recipes-kernel/systemtap/systemtap_git.inc2
3 files changed, 78 insertions, 0 deletions
diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-bpf-translate.cxx-fix-build-against-upcoming-gcc-14-.patch b/meta/recipes-kernel/systemtap/systemtap/0001-bpf-translate.cxx-fix-build-against-upcoming-gcc-14-.patch
new file mode 100644
index 0000000000..e3d94d9312
--- /dev/null
+++ b/meta/recipes-kernel/systemtap/systemtap/0001-bpf-translate.cxx-fix-build-against-upcoming-gcc-14-.patch
@@ -0,0 +1,40 @@
1From d42139cf9cd26d0c0363fcfe007716baeb8de517 Mon Sep 17 00:00:00 2001
2From: Sergei Trofimovich <slyich@gmail.com>
3Date: Fri, 22 Dec 2023 19:42:38 +0000
4Subject: [PATCH] bpf-translate.cxx: fix build against upcoming `gcc-14`
5 (`-Werror=calloc-transposed-args`)
6
7`gcc-14` added a new `-Wcalloc-transposed-args` warning recently. It
8detected minor infelicity in `calloc()` API usage in `systemtap`:
9
10 bpf-translate.cxx: In function 'bpf::BPF_Section* bpf::output_probe(BPF_Output&, program&, const std::string&, unsigned int)':
11 bpf-translate.cxx:5044:39: error: 'void* calloc(size_t, size_t)' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
12 5044 | bpf_insn *buf = (bpf_insn*) calloc (sizeof(bpf_insn), ninsns);
13 | ^~~~~~~~~~~~~~~~
14 bpf-translate.cxx:5044:39: note: earlier argument should specify number of elements, later size of each element
15
16Upstream-Status: Backport [https://sourceware.org/git/?p=systemtap.git;a=commit;h=d42139cf9cd26d0c0363fcfe007716baeb8de517]
17Signed-off-by: Khem Raj <raj.khem@gmail.com>
18---
19 bpf-translate.cxx | 4 ++--
20 1 file changed, 2 insertions(+), 2 deletions(-)
21
22diff --git a/bpf-translate.cxx b/bpf-translate.cxx
23index 1a9302463..aa8ef65ce 100644
24--- a/bpf-translate.cxx
25+++ b/bpf-translate.cxx
26@@ -5041,9 +5041,9 @@ output_probe(BPF_Output &eo, program &prog,
27 }
28 }
29
30- bpf_insn *buf = (bpf_insn*) calloc (sizeof(bpf_insn), ninsns);
31+ bpf_insn *buf = (bpf_insn*) calloc (ninsns, sizeof(bpf_insn));
32 assert (buf);
33- Elf64_Rel *rel = (Elf64_Rel*) calloc (sizeof(Elf64_Rel), nreloc);
34+ Elf64_Rel *rel = (Elf64_Rel*) calloc (nreloc, sizeof(Elf64_Rel));
35 assert (rel);
36
37 unsigned i = 0, r = 0;
38--
392.43.0
40
diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-staprun-fix-build-against-upcoming-gcc-14-Werror-cal.patch b/meta/recipes-kernel/systemtap/systemtap/0001-staprun-fix-build-against-upcoming-gcc-14-Werror-cal.patch
new file mode 100644
index 0000000000..22578fb3f6
--- /dev/null
+++ b/meta/recipes-kernel/systemtap/systemtap/0001-staprun-fix-build-against-upcoming-gcc-14-Werror-cal.patch
@@ -0,0 +1,36 @@
1From 52596f023652114642faba5726c99488529029ce Mon Sep 17 00:00:00 2001
2From: Sergei Trofimovich <slyich@gmail.com>
3Date: Thu, 21 Dec 2023 10:00:06 +0000
4Subject: [PATCH] staprun: fix build against upcoming `gcc-14`
5 (`-Werror=calloc-transposed-args`)
6
7`gcc-14` added a new `-Wcalloc-transposed-args` warning recently. It
8detected minor infelicity in `calloc()` API usage in `systemtap`:
9
10 staprun.c: In function 'main':
11 staprun.c:550:50: error: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
12 550 | char ** new_argv = calloc(sizeof(char *),argc+2);
13 | ^~~~
14
15Upstream-Status: Backport [https://sourceware.org/git/?p=systemtap.git;a=commit;h=52596f023652114642faba5726c99488529029ce]
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17---
18 staprun/staprun.c | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
20
21diff --git a/staprun/staprun.c b/staprun/staprun.c
22index 8437f3af6..d1b0b221b 100644
23--- a/staprun/staprun.c
24+++ b/staprun/staprun.c
25@@ -547,7 +547,7 @@ int main(int argc, char **argv)
26 us to extend argv[], with all the C fun that entails. */
27 #ifdef HAVE_OPENAT
28 if (relay_basedir_fd >= 0) {
29- char ** new_argv = calloc(sizeof(char *),argc+2);
30+ char ** new_argv = calloc(argc+2, sizeof(char *));
31 const int new_Foption_size = 10; /* -FNNNNN */
32 char * new_Foption = malloc(new_Foption_size);
33 int i;
34--
352.43.0
36
diff --git a/meta/recipes-kernel/systemtap/systemtap_git.inc b/meta/recipes-kernel/systemtap/systemtap_git.inc
index bebfa7f777..c574bcb2ba 100644
--- a/meta/recipes-kernel/systemtap/systemtap_git.inc
+++ b/meta/recipes-kernel/systemtap/systemtap_git.inc
@@ -10,6 +10,8 @@ SRC_URI = "git://sourceware.org/git/systemtap.git;branch=master;protocol=https \
10 file://0001-Makefile.am-remove-runtime-linux-uprobes-and-runtime.patch \ 10 file://0001-Makefile.am-remove-runtime-linux-uprobes-and-runtime.patch \
11 file://0001-prerelease-datestamp-fixes.patch \ 11 file://0001-prerelease-datestamp-fixes.patch \
12 file://0001-configure.ac-fix-broken-libdebuginfod-library-auto-d.patch \ 12 file://0001-configure.ac-fix-broken-libdebuginfod-library-auto-d.patch \
13 file://0001-bpf-translate.cxx-fix-build-against-upcoming-gcc-14-.patch \
14 file://0001-staprun-fix-build-against-upcoming-gcc-14-Werror-cal.patch \
13 " 15 "
14 16
15COMPATIBLE_HOST = '(x86_64|i.86|powerpc|arm|aarch64|microblazeel|mips|riscv64).*-linux' 17COMPATIBLE_HOST = '(x86_64|i.86|powerpc|arm|aarch64|microblazeel|mips|riscv64).*-linux'