* [PATCH] elfutils: Fix build with gcc trunk
@ 2024-01-26 7:21 Khem Raj
0 siblings, 0 replies; only message in thread
From: Khem Raj @ 2024-01-26 7:21 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
Fixes a build issue seen with latest gcc trunk.
Fixes
| ../../elfutils-0.189/tests/elfstrmerge.c: In function 'main':
| ../../elfutils-0.189/tests/elfstrmerge.c:450:32: error: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
| 450 | newscnbufs = calloc (sizeof (void *), newshnums);
| | ^~~~
| ../../elfutils-0.189/tests/elfstrmerge.c:450:32: note: earlier argument should specify number of elements, later size of each element
| cc1: all warnings being treated as errors
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
.../elfutils/elfutils_0.189.bb | 1 +
...against-upcoming-gcc-14-Werror-callo.patch | 39 +++++++++++++++++++
2 files changed, 40 insertions(+)
create mode 100644 meta/recipes-devtools/elfutils/files/0001-tests-fix-build-against-upcoming-gcc-14-Werror-callo.patch
diff --git a/meta/recipes-devtools/elfutils/elfutils_0.189.bb b/meta/recipes-devtools/elfutils/elfutils_0.189.bb
index e9b432e4e99..076ba473580 100644
--- a/meta/recipes-devtools/elfutils/elfutils_0.189.bb
+++ b/meta/recipes-devtools/elfutils/elfutils_0.189.bb
@@ -22,6 +22,7 @@ SRC_URI = "https://sourceware.org/elfutils/ftp/${PV}/${BP}.tar.bz2 \
file://ptest.patch \
file://0001-tests-Makefile.am-compile-test_nlist-with-standard-C.patch \
file://0001-Add-helper-function-for-basename.patch \
+ file://0001-tests-fix-build-against-upcoming-gcc-14-Werror-callo.patch \
"
SRC_URI:append:libc-musl = " \
file://0003-musl-utils.patch \
diff --git a/meta/recipes-devtools/elfutils/files/0001-tests-fix-build-against-upcoming-gcc-14-Werror-callo.patch b/meta/recipes-devtools/elfutils/files/0001-tests-fix-build-against-upcoming-gcc-14-Werror-callo.patch
new file mode 100644
index 00000000000..5e0c7e97664
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/0001-tests-fix-build-against-upcoming-gcc-14-Werror-callo.patch
@@ -0,0 +1,39 @@
+From 901c6a8c78c3c4eee244b9d5298cbd7b9aa713d1 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyich@gmail.com>
+Date: Thu, 21 Dec 2023 09:23:30 +0000
+Subject: [PATCH] tests: 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 `elfutils`:
+
+ elfstrmerge.c: In function 'main':
+ elfstrmerge.c:450:32: error:
+ 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
+ 450 | newscnbufs = calloc (sizeof (void *), newshnums);
+ | ^~~~
+ elfstrmerge.c:450:32: note: earlier argument should specify number of elements, later size of each element
+
+Upstream-Status: Backport [https://sourceware.org/git/?p=elfutils.git;a=commit;h=ae580d48278b9924da7503886b37be34378e1b04]
+Signed-off-by: Sergei Trofimovich <slyich@gmail.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ tests/elfstrmerge.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tests/elfstrmerge.c b/tests/elfstrmerge.c
+index 56350bb..4eb58bb 100644
+--- a/tests/elfstrmerge.c
++++ b/tests/elfstrmerge.c
+@@ -447,7 +447,7 @@ main (int argc, char **argv)
+ }
+
+ newshnums = shdrnum - 1;
+- newscnbufs = calloc (sizeof (void *), newshnums);
++ newscnbufs = calloc (newshnums, sizeof (void *));
+ if (newscnbufs == NULL)
+ fail_errno ("Couldn't allocate memory for new section buffers", NULL);
+
+--
+2.43.0
+
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-01-26 7:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-26 7:21 [PATCH] elfutils: Fix build with gcc trunk Khem Raj
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox