Skip to contentSkip to conversation

elfutils: ignore format-truncation and stringop-overflow issues to fix build with gcc-11

PATCH In review Martin Jansa 2 participants 2 messages May 3, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 elfutils: ignore format-truncation and stringop-overflow issues to fix build with gcc-11

* works around:
http://errors.yoctoproject.org/Errors/Details/580076/
elfutils-0.148/src/ar.c:1088:56: error: '%-*ld' directive output may be truncated writing between 6 and 10 bytes into a region of size 7 [-Werror=format-truncation=]
1088 | snprintf (tmpbuf, sizeof (tmpbuf), ofmt ? "%-*lo" : "%-*ld", bufsize, val);
| ^~~~~
elfutils-0.148/src/ar.c:1088:55: note: directive argument in the range [0, 4294967295]
1088 | snprintf (tmpbuf, sizeof (tmpbuf), ofmt ? "%-*lo" : "%-*ld", bufsize, val);
| ^~~~~~~

http://errors.yoctoproject.org/Errors/Details/580078/
elfutils-0.148/tests/addrcfi.c:90:16: error: 'dwarf_frame_register' accessing 96 bytes in a region of size 64 [-Werror=stringop-overflow=]

     90 |   int result = dwarf_frame_register (stuff->frame, regno, ops_mem, &ops, &nops);
        |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 recipes-devtools/elfutils/elfutils_0.148.bb | 8 ++++++++
 1 file changed, 8 insertions(+)
recipes-devtools/elfutils/elfutils_0.148.bb +8 -0
index 1f07a28..654a715 100644
@@ -61,6 +61,14 @@ inherit autotools gettext
 # but 0.175 has different license, so to be safe don't backport the fix, just ignore the issue
 CFLAGS += "-Wno-error=missing-attributes"
 
+# There is a fix in 0.171 version (commit b10d7eb74064c5906f031cd17c0f82041c6a4ca1)
+# but 0.171 has different license, so to be safe don't backport the fix, just ignore the issue
+CFLAGS += "-Wno-error=format-truncation="
+
+# There is a fix in 0.182 version (commit 5621fe5443da23112170235dd5cac161e5c75e65)
+# but 0.182 has different license, so to be safe don't backport the fix, just ignore the issue
+CFLAGS += "-Wno-error=stringop-overflow="
+
 EXTRA_OECONF = "--program-prefix=eu- --without-lzma"
 EXTRA_OECONF_append_class-native = " --without-bzlib"
 EXTRA_OECONF_append_libc-uclibc = " --enable-uclibc"
Signature · 1 line
2.30.2
#1 lore raw
Quoted 14 lines · Martin Jansa

* works around:

   http://errors.yoctoproject.org/Errors/Details/580076/
   elfutils-0.148/src/ar.c:1088:56: error: '%-*ld' directive output may be truncated writing between 6 and 10 bytes into a region of size 7 [-Werror=format-truncation=]
    1088 |   snprintf (tmpbuf, sizeof (tmpbuf), ofmt ? "%-*lo" : "%-*ld", bufsize, val);
         |                                                        ^~~~~
   elfutils-0.148/src/ar.c:1088:55: note: directive argument in the range [0, 4294967295]
    1088 |   snprintf (tmpbuf, sizeof (tmpbuf), ofmt ? "%-*lo" : "%-*ld", bufsize, val);
         |                                                       ^~~~~~~

   http://errors.yoctoproject.org/Errors/Details/580078/
   elfutils-0.148/tests/addrcfi.c:90:16: error: 'dwarf_frame_register' accessing 96 bytes in a region of size 64 [-Werror=stringop-overflow=]
      90 |   int result = dwarf_frame_register (stuff->frame, regno, ops_mem, &ops, &nops);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

looks ok. Thanks for fixing it

Quoted 29 lines
---
  recipes-devtools/elfutils/elfutils_0.148.bb | 8 ++++++++
  1 file changed, 8 insertions(+)
recipes-devtools/elfutils/elfutils_0.148.bb +8 -0
index 1f07a28..654a715 100644
@@ -61,6 +61,14 @@ inherit autotools gettext
  # but 0.175 has different license, so to be safe don't backport the fix, just ignore the issue
  CFLAGS += "-Wno-error=missing-attributes"
 
+# There is a fix in 0.171 version (commit b10d7eb74064c5906f031cd17c0f82041c6a4ca1)
+# but 0.171 has different license, so to be safe don't backport the fix, just ignore the issue
+CFLAGS += "-Wno-error=format-truncation="
+
+# There is a fix in 0.182 version (commit 5621fe5443da23112170235dd5cac161e5c75e65)
+# but 0.182 has different license, so to be safe don't backport the fix, just ignore the issue
+CFLAGS += "-Wno-error=stringop-overflow="
+
  EXTRA_OECONF = "--program-prefix=eu- --without-lzma"
  EXTRA_OECONF_append_class-native = " --without-bzlib"
  EXTRA_OECONF_append_libc-uclibc = " --enable-uclibc"