From aaf4c4f3d09ac3897205417eb15e19d54e0c0d05 Mon Sep 17 00:00:00 2001 From: Joshua Lock Date: Thu, 6 Apr 2017 14:23:13 +0100 Subject: elfutils: fix building elfutils-native with GCC7 Backport a fix from upstream for a -Wformat-truncation=2 warning and implement a simple fix for a -Wimplicit-fallthrough warning. Signed-off-by: Joshua Lock Signed-off-by: Richard Purdie --- .../elfutils-0.168/Fix_one_GCC7_warning.patch | 44 ++++++++++++++++++++++ .../elfutils/elfutils-0.168/fallthrough.patch | 36 ++++++++++++++++++ meta/recipes-devtools/elfutils/elfutils_0.168.bb | 3 ++ 3 files changed, 83 insertions(+) create mode 100644 meta/recipes-devtools/elfutils/elfutils-0.168/Fix_one_GCC7_warning.patch create mode 100644 meta/recipes-devtools/elfutils/elfutils-0.168/fallthrough.patch (limited to 'meta/recipes-devtools') diff --git a/meta/recipes-devtools/elfutils/elfutils-0.168/Fix_one_GCC7_warning.patch b/meta/recipes-devtools/elfutils/elfutils-0.168/Fix_one_GCC7_warning.patch new file mode 100644 index 0000000000..d88f4ebd0c --- /dev/null +++ b/meta/recipes-devtools/elfutils/elfutils-0.168/Fix_one_GCC7_warning.patch @@ -0,0 +1,44 @@ +From 93c51144c3f664d4e9709da75a1d0fa00ea0fe95 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Sun, 12 Feb 2017 21:51:34 +0100 +Subject: [PATCH] libasm: Fix one GCC7 -Wformat-truncation=2 warning. + +Make sure that if we have really lots of labels the tempsym doesn't get +truncated because it is too small to hold the whole name. + +This doesn't enable -Wformat-truncation=2 or fix other "issues" pointed +out by enabling this warning because there are currently some issues +with it. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79448 + +Signed-off-by: Mark Wielaard + +Upstream-Status: Backport (https://sourceware.org/git/?p=elfutils.git;a=commit;h=93c51144c3f664d4e9709da75a1d0fa00ea0fe95) +Signed-off-by: Joshua Lock + +--- + libasm/ChangeLog | 6 +++++- + libasm/asm_newsym.c | 6 ++++-- + 2 files changed, 9 insertions(+), 3 deletions(-) + +Index: elfutils-0.168/libasm/asm_newsym.c +=================================================================== +--- elfutils-0.168.orig/libasm/asm_newsym.c ++++ elfutils-0.168/libasm/asm_newsym.c +@@ -1,5 +1,5 @@ + /* Define new symbol for current position in given section. +- Copyright (C) 2002, 2005, 2016 Red Hat, Inc. ++ Copyright (C) 2002, 2005, 2016, 2017 Red Hat, Inc. + This file is part of elfutils. + Written by Ulrich Drepper , 2002. + +@@ -44,7 +44,9 @@ AsmSym_t * + asm_newsym (AsmScn_t *asmscn, const char *name, GElf_Xword size, + int type, int binding) + { +-#define TEMPSYMLEN 10 ++/* We don't really expect labels with many digits, but in theory it could ++ be 10 digits (plus ".L" and a zero terminator). */ ++#define TEMPSYMLEN 13 + char tempsym[TEMPSYMLEN]; + AsmSym_t *result; + diff --git a/meta/recipes-devtools/elfutils/elfutils-0.168/fallthrough.patch b/meta/recipes-devtools/elfutils/elfutils-0.168/fallthrough.patch new file mode 100644 index 0000000000..b2623f9d2e --- /dev/null +++ b/meta/recipes-devtools/elfutils/elfutils-0.168/fallthrough.patch @@ -0,0 +1,36 @@ +GCC7 adds -Wimplicit-fallthrough to warn when a switch case falls through, +however this causes warnings (which are promoted to errors) with the elfutils +patches from Debian for mips and parisc, which use fallthrough's by design. + +Explicitly mark the intentional fallthrough switch cases with a comment to +disable the warnings where the fallthrough behaviour is desired. + +Upstream-Status: Pending [debian] +Signed-off-by: Joshua Lock + +Index: elfutils-0.168/backends/parisc_retval.c +=================================================================== +--- elfutils-0.168.orig/backends/parisc_retval.c ++++ elfutils-0.168/backends/parisc_retval.c +@@ -166,7 +166,7 @@ parisc_return_value_location_ (Dwarf_Die + return nloc_intregpair; + + /* Else fall through. */ +- } ++ } // fallthrough + + case DW_TAG_structure_type: + case DW_TAG_class_type: +Index: elfutils-0.168/backends/mips_retval.c +=================================================================== +--- elfutils-0.168.orig/backends/mips_retval.c ++++ elfutils-0.168/backends/mips_retval.c +@@ -387,7 +387,7 @@ mips_return_value_location (Dwarf_Die *f + else + return nloc_intregpair; + } +- } ++ } // fallthrough + + /* Fallthrough to handle large types */ + diff --git a/meta/recipes-devtools/elfutils/elfutils_0.168.bb b/meta/recipes-devtools/elfutils/elfutils_0.168.bb index 9557933faa..3b8f2a3147 100644 --- a/meta/recipes-devtools/elfutils/elfutils_0.168.bb +++ b/meta/recipes-devtools/elfutils/elfutils_0.168.bb @@ -17,6 +17,7 @@ SRC_URI += "\ file://0001-remove-the-unneed-checking.patch \ file://0001-fix-a-stack-usage-warning.patch \ file://aarch64_uio.patch \ + file://Fix_one_GCC7_warning.patch \ file://shadow.patch \ " @@ -35,6 +36,8 @@ SRC_URI += "\ file://debian/hurd_path.patch \ file://debian/ignore_strmerge.diff \ " +# Fix the patches from Debian with GCC7 +SRC_URI += "file://fallthrough.patch" SRC_URI_append_libc-musl = " file://0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch " # The buildsystem wants to generate 2 .h files from source using a binary it just built, -- cgit 1.2.3-korg