systemtap/bpf-translate.cxx-fix-build-against-upcoming-gcc14.patch
Tony Jones 54d088036b Accepting request 1164226 from home:jones_tony:branches:devel:tools
- Fix runtime issues with v6.8 kernel (bsc#1222249)
    New patch: get-shm_flag-defines-from-the-appropriate-include-file-for-linux-6.8-kernel.patch
    New patch: pr31373-deal-with-the-removal-of-strlcpy-from-linux-6.8.patch
- Fix gcc14 build errors (bsc#1221706)
    New patch: bpf-translate.cxx-fix-build-against-upcoming-gcc14.patch
    New patch: pr31288-build-with-gcc14-cont.patch
    New patch: pr31288-build-with-gcc14.patch
    New patch: staprun-fix-build-against-upcoming-gcc14.patch
    New patch: stapvirt.c-more-gcc-14-werror-calloc-transposed-args-compatibility.patch

OBS-URL: https://build.opensuse.org/request/show/1164226
OBS-URL: https://build.opensuse.org/package/show/devel:tools/systemtap?expand=0&rev=148
2024-04-02 19:00:34 +00:00

36 lines
1.6 KiB
Diff

From: Sergei Trofimovich <slyich@gmail.com>
Date: Fri Dec 22 19:42:38 2023 +0000
Subject: bpf-translate.cxx: fix build against upcoming `gcc-14`
Git-commit: d42139cf9cd26d0c0363fcfe007716baeb8de517
References: bsc#1221706
Signed-off-by: Tony Jones <tonyj@suse.de>
bpf-translate.cxx: fix build against upcoming `gcc-14` (`-Werror=calloc-transposed-args`)
`gcc-14` added a new `-Wcalloc-transposed-args` warning recently. It
detected minor infelicity in `calloc()` API usage in `systemtap`:
bpf-translate.cxx: In function 'bpf::BPF_Section* bpf::output_probe(BPF_Output&, program&, const std::string&, unsigned int)':
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]
5044 | bpf_insn *buf = (bpf_insn*) calloc (sizeof(bpf_insn), ninsns);
| ^~~~~~~~~~~~~~~~
bpf-translate.cxx:5044:39: note: earlier argument should specify number of elements, later size of each element
diff --git a/bpf-translate.cxx b/bpf-translate.cxx
index 1a9302463..aa8ef65ce 100644
--- a/bpf-translate.cxx
+++ b/bpf-translate.cxx
@@ -5041,9 +5041,9 @@ output_probe(BPF_Output &eo, program &prog,
}
}
- bpf_insn *buf = (bpf_insn*) calloc (sizeof(bpf_insn), ninsns);
+ bpf_insn *buf = (bpf_insn*) calloc (ninsns, sizeof(bpf_insn));
assert (buf);
- Elf64_Rel *rel = (Elf64_Rel*) calloc (sizeof(Elf64_Rel), nreloc);
+ Elf64_Rel *rel = (Elf64_Rel*) calloc (nreloc, sizeof(Elf64_Rel));
assert (rel);
unsigned i = 0, r = 0;