]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
elfutils: fix build with gcc-15
authorMartin Jansa <martin.jansa@gmail.com>
Thu, 21 Aug 2025 22:43:05 +0000 (00:43 +0200)
committerSteve Sakoman <steve@sakoman.com>
Tue, 26 Aug 2025 20:10:34 +0000 (13:10 -0700)
Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
meta/recipes-devtools/elfutils/elfutils_0.191.bb
meta/recipes-devtools/elfutils/files/0007-Fix-build-with-gcc-15.patch [new file with mode: 0644]

index bab3d94d12e42520ccd013b852c8848c30517510..fcb91e41aa5efdc7d75218f2072230c8600b2949 100644 (file)
@@ -27,6 +27,7 @@ SRC_URI = "https://sourceware.org/elfutils/ftp/${PV}/${BP}.tar.bz2 \
            file://CVE-2025-1365.patch \
            file://CVE-2025-1372.patch \
            file://CVE-2025-1371.patch \
+           file://0007-Fix-build-with-gcc-15.patch \
            "
 SRC_URI:append:libc-musl = " \
            file://0003-musl-utils.patch \
diff --git a/meta/recipes-devtools/elfutils/files/0007-Fix-build-with-gcc-15.patch b/meta/recipes-devtools/elfutils/files/0007-Fix-build-with-gcc-15.patch
new file mode 100644 (file)
index 0000000..8f5c7e4
--- /dev/null
@@ -0,0 +1,72 @@
+From 7508696d107ca01b65ce8273c881462a8658f90f Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyich@gmail.com>
+Date: Wed, 17 Jul 2024 23:03:34 +0100
+Subject: [PATCH] backends: allocate enough stace for null terminator
+
+`gcc-15` added a new warning in https://gcc.gnu.org/PR115185:
+
+    i386_regs.c:88:11: error: initializer-string for array of 'char' is too long [-Werror=unterminated-string-initialization]
+       88 |           "ax", "cx", "dx", "bx", "sp", "bp", "si", "di", "ip"
+          |           ^~~~
+
+`elfutils` does not need to store '\0'. We could either initialize the
+arrays with individual bytes or allocate extra byte for null.
+
+This change initializes the array bytewise.
+
+       * backends/i386_regs.c (i386_register_info): Initialize the
+       array bytewise to fix gcc-15 warning.
+       * backends/x86_64_regs.c (x86_64_register_info): Ditto.
+
+Signed-off-by: Sergei Trofimovich <slyich@gmail.com>
+Upstream-Status: Backport [https://sourceware.org/git/?p=elfutils.git;a=commit;h=7508696d107ca01b65ce8273c881462a8658f90f]
+Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
+---
+ backends/i386_regs.c   | 10 +++++++++-
+ backends/x86_64_regs.c |  9 ++++++++-
+ 2 files changed, 17 insertions(+), 2 deletions(-)
+
+diff --git a/backends/i386_regs.c b/backends/i386_regs.c
+index 7ec93bb9..ead55ef7 100644
+--- a/backends/i386_regs.c
++++ b/backends/i386_regs.c
+@@ -85,7 +85,15 @@ i386_register_info (Ebl *ebl __attribute__ ((unused)),
+     {
+       static const char baseregs[][2] =
+       {
+-        "ax", "cx", "dx", "bx", "sp", "bp", "si", "di", "ip"
++        {'a', 'x'},
++        {'c', 'x'},
++        {'d', 'x'},
++        {'b', 'x'},
++        {'s', 'p'},
++        {'b', 'p'},
++        {'s', 'i'},
++        {'d', 'i'},
++        {'i', 'p'},
+       };
+     case 4:
+diff --git a/backends/x86_64_regs.c b/backends/x86_64_regs.c
+index ef987daf..dab8f27f 100644
+--- a/backends/x86_64_regs.c
++++ b/backends/x86_64_regs.c
+@@ -82,7 +82,14 @@ x86_64_register_info (Ebl *ebl __attribute__ ((unused)),
+     {
+       static const char baseregs[][2] =
+       {
+-        "ax", "dx", "cx", "bx", "si", "di", "bp", "sp"
++        {'a', 'x'},
++        {'d', 'x'},
++        {'c', 'x'},
++        {'b', 'x'},
++        {'s', 'i'},
++        {'d', 'i'},
++        {'b', 'p'},
++        {'s', 'p'},
+       };
+     case 6 ... 7:
+-- 
+2.43.7
+