[yocto] [meta-gplv2][PATCH] elfutils: Make it build with GCC 7 and compile time hardening enabled

Peter Kjellerstedt peter.kjellerstedt at axis.com
Tue Sep 26 00:20:52 PDT 2017


Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt at axis.com>
---
 .../0001-Make-it-compile-with-GCC-7.patch          | 43 ++++++++++++++++++++++
 ...ld-with-GCC-7-and-compile-time-hardening-.patch | 32 ++++++++++++++++
 recipes-devtools/elfutils/elfutils_0.148.bb        |  2 +
 3 files changed, 77 insertions(+)
 create mode 100644 recipes-devtools/elfutils/elfutils-0.148/0001-Make-it-compile-with-GCC-7.patch
 create mode 100644 recipes-devtools/elfutils/elfutils-0.148/0002-Make-it-build-with-GCC-7-and-compile-time-hardening-.patch

diff --git a/recipes-devtools/elfutils/elfutils-0.148/0001-Make-it-compile-with-GCC-7.patch b/recipes-devtools/elfutils/elfutils-0.148/0001-Make-it-compile-with-GCC-7.patch
new file mode 100644
index 0000000..a43508f
--- /dev/null
+++ b/recipes-devtools/elfutils/elfutils-0.148/0001-Make-it-compile-with-GCC-7.patch
@@ -0,0 +1,43 @@
+From 9529f012a1cfdae36aedeab8ccd790c875ae7f73 Mon Sep 17 00:00:00 2001
+From: Peter Kjellerstedt <pkj at axis.com>
+Date: Sat, 16 Sep 2017 15:09:23 +0200
+Subject: [PATCH 1/2] Make it compile with GCC 7
+
+This avoids the following errors:
+
+  src/readelf.c: In function 'register_info':
+  src/readelf.c:4481:30: warning: 'sizeof' on array function parameter
+  'name' will return size of 'char *' [-Wsizeof-array-argument]
+         snprintf (name, sizeof name, "reg%u", loc->regno);
+                                ^~~~
+  src/readelf.c:4472:14: note: declared here
+           char name[REGNAMESZ], int *bits, int *type)
+                ^~~~
+  rc/readelf.c:4481:30: warning: argument to 'sizeof' in 'snprintf' call
+  is the same expression as the destination; did you mean to provide an
+  explicit length? [-Wsizeof-pointer-memaccess]
+         snprintf (name, sizeof name, "reg%u", loc->regno);
+                                ^~~~
+
+Upstream-Status: Inappropriate [legacy version]
+Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt at axis.com>
+---
+ src/readelf.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/readelf.c b/src/readelf.c
+index bf622a6..ba0607b 100644
+--- a/src/readelf.c
++++ b/src/readelf.c
+@@ -4478,7 +4478,7 @@ register_info (Ebl *ebl, unsigned int regno, const Ebl_Register_Location *loc,
+ 				 bits ?: &ignore, type ?: &ignore);
+   if (n <= 0)
+     {
+-      snprintf (name, sizeof name, "reg%u", loc->regno);
++      snprintf (name, REGNAMESZ, "reg%u", loc->regno);
+       if (bits != NULL)
+ 	*bits = loc->bits;
+       if (type != NULL)
+-- 
+2.12.0
+
diff --git a/recipes-devtools/elfutils/elfutils-0.148/0002-Make-it-build-with-GCC-7-and-compile-time-hardening-.patch b/recipes-devtools/elfutils/elfutils-0.148/0002-Make-it-build-with-GCC-7-and-compile-time-hardening-.patch
new file mode 100644
index 0000000..68d14b6
--- /dev/null
+++ b/recipes-devtools/elfutils/elfutils-0.148/0002-Make-it-build-with-GCC-7-and-compile-time-hardening-.patch
@@ -0,0 +1,32 @@
+From 5dcd8e331af448e3adcb9ed15a38762a912a8267 Mon Sep 17 00:00:00 2001
+From: Peter Kjellerstedt <pkj at axis.com>
+Date: Sat, 16 Sep 2017 15:12:37 +0200
+Subject: [PATCH 2/2] Make it build with GCC 7 and compile time hardening
+ enabled
+
+This avoids the following error:
+
+cc1: error: -Wformat-security ignored without -Wformat [-Werror=format-security]
+
+Upstream-Status: Inappropriate [legacy version]
+Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt at axis.com>
+---
+ config/eu.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/config/eu.am b/config/eu.am
+index 8066d7f..7de66b0 100644
+--- a/config/eu.am
++++ b/config/eu.am
+@@ -33,7 +33,7 @@ INCLUDES = -I. -I$(srcdir) -I$(top_srcdir)/lib -I..
+ AM_CFLAGS = -std=gnu99 -Wall -Wshadow \
+ 	    $(if $($(*F)_no_Werror),,-Werror) \
+ 	    $(if $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) \
+-	    $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) \
++	    $(if $($(*F)_no_Wformat),-Wno-format -Wno-format-security,-Wformat=2) \
+ 	    $($(*F)_CFLAGS)
+ 
+ if MUDFLAP
+-- 
+2.12.0
+
diff --git a/recipes-devtools/elfutils/elfutils_0.148.bb b/recipes-devtools/elfutils/elfutils_0.148.bb
index 29d109a..892a523 100644
--- a/recipes-devtools/elfutils/elfutils_0.148.bb
+++ b/recipes-devtools/elfutils/elfutils_0.148.bb
@@ -37,6 +37,8 @@ SRC_URI += "\
         file://gcc6.patch \
         file://0001-Fix-fallthrough-warnings.patch \
         file://0002-Fix-printf-overflow-warnings.patch \
+        file://0001-Make-it-compile-with-GCC-7.patch \
+        file://0002-Make-it-build-with-GCC-7-and-compile-time-hardening-.patch \
 "
 # Only apply when building uclibc based target recipe
 SRC_URI_append_libc-uclibc = " file://uclibc-support-for-elfutils-0.148.patch"
-- 
2.12.0




More information about the yocto mailing list