diff options
author | 2017-09-26 09:20:52 +0200 | |
---|---|---|
committer | 2017-09-26 14:35:33 +0100 | |
commit | 4bed302b143c4d869f83fcc34b0c1ad1dd143c2d (patch) | |
tree | 189cda273d074d11f461d9788c1962b7620b5595 | |
parent | 9b1d684d72f5a7d9b231cadbcaed4de7b0d73b21 (diff) | |
download | meta-gplv2-4bed302b143c4d869f83fcc34b0c1ad1dd143c2d.tar.gz meta-gplv2-4bed302b143c4d869f83fcc34b0c1ad1dd143c2d.tar.bz2 meta-gplv2-4bed302b143c4d869f83fcc34b0c1ad1dd143c2d.zip |
elfutils: Make it build with GCC 7 and compile time hardening enabled
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
3 files changed, 77 insertions, 0 deletions
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@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@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@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@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" |