summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2017-04-25 16:01:11 -0700
committerRoss Burton <ross.burton@intel.com>2017-04-26 10:31:27 +0100
commitb0cdb6ffa9dd814865a0510115935ba2ced5827f (patch)
treeb235c56fcf9dda9e5ff391cbe7462987fe77fca5
parentfc0e3eae0f0669e6780ed69680cd065a77baca24 (diff)
downloadmeta-gplv2-b0cdb6ffa9dd814865a0510115935ba2ced5827f.tar.gz
elfutils: Fix build with gcc7
Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
-rw-r--r--recipes-devtools/elfutils/elfutils-0.148/0001-Fix-fallthrough-warnings.patch237
-rw-r--r--recipes-devtools/elfutils/elfutils-0.148/0002-Fix-printf-overflow-warnings.patch57
-rw-r--r--recipes-devtools/elfutils/elfutils_0.148.bb2
3 files changed, 296 insertions, 0 deletions
diff --git a/recipes-devtools/elfutils/elfutils-0.148/0001-Fix-fallthrough-warnings.patch b/recipes-devtools/elfutils/elfutils-0.148/0001-Fix-fallthrough-warnings.patch
new file mode 100644
index 0000000..810c4a7
--- /dev/null
+++ b/recipes-devtools/elfutils/elfutils-0.148/0001-Fix-fallthrough-warnings.patch
@@ -0,0 +1,237 @@
1From d70d92889c4a8b0781207343a73b1dc4eccdffd3 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 25 Apr 2017 15:50:55 -0700
4Subject: [PATCH 1/2] Fix fallthrough warnings
5
6Upstream-Status: Pending
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 backends/i386_regs.c | 1 +
11 backends/i386_retval.c | 1 +
12 backends/linux-core-note.c | 4 ++--
13 backends/mips_retval.c | 2 +-
14 backends/parisc_retval.c | 2 +-
15 backends/ppc_regs.c | 2 +-
16 backends/x86_64_regs.c | 1 +
17 libcpu/i386_disasm.c | 2 +-
18 libdw/cfi.c | 3 +++
19 libdw/encoded-value.h | 1 +
20 libdwfl/dwfl_report_elf.c | 1 +
21 src/addr2line.c | 1 +
22 src/elflint.c | 4 +++-
23 src/objdump.c | 2 +-
24 14 files changed, 19 insertions(+), 8 deletions(-)
25
26diff --git a/backends/i386_regs.c b/backends/i386_regs.c
27index 5cf0d81..11b0bcb 100644
28--- a/backends/i386_regs.c
29+++ b/backends/i386_regs.c
30@@ -89,6 +89,7 @@ i386_register_info (Ebl *ebl __attribute__ ((unused)),
31 case 5:
32 case 8:
33 *type = DW_ATE_address;
34+ /* fallthru */
35 case 0 ... 3:
36 case 6 ... 7:
37 name[0] = 'e';
38diff --git a/backends/i386_retval.c b/backends/i386_retval.c
39index c3bab10..ffbf901 100644
40--- a/backends/i386_retval.c
41+++ b/backends/i386_retval.c
42@@ -137,6 +137,7 @@ i386_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
43
44 /* Else fall through. */
45 }
46+ /* fallthru */
47
48 case DW_TAG_structure_type:
49 case DW_TAG_class_type:
50diff --git a/backends/linux-core-note.c b/backends/linux-core-note.c
51index 9d01219..a6cd5ab 100644
52--- a/backends/linux-core-note.c
53+++ b/backends/linux-core-note.c
54@@ -194,8 +194,8 @@ EBLHOOK(core_note) (nhdr, name, regs_offset, nregloc, reglocs, nitems, items)
55 case sizeof "CORE":
56 if (memcmp (name, "CORE", nhdr->n_namesz) == 0)
57 break;
58- /* Buggy old Linux kernels didn't terminate "LINUX".
59- Fall through. */
60+ /* Buggy old Linux kernels didn't terminate "LINUX". */
61+ /* fallthru */
62
63 case sizeof "LINUX":
64 if (memcmp (name, "LINUX", nhdr->n_namesz) == 0)
65diff --git a/backends/mips_retval.c b/backends/mips_retval.c
66index 33f12a7..b25b1b7 100644
67--- a/backends/mips_retval.c
68+++ b/backends/mips_retval.c
69@@ -300,7 +300,7 @@ mips_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
70
71 /* Else fall through. Shouldn't happen though (at least with gcc) */
72 }
73-
74+ /* fallthrough */
75 case DW_TAG_structure_type:
76 case DW_TAG_class_type:
77 case DW_TAG_union_type:
78diff --git a/backends/parisc_retval.c b/backends/parisc_retval.c
79index 592a702..7aa5b17 100644
80--- a/backends/parisc_retval.c
81+++ b/backends/parisc_retval.c
82@@ -167,7 +167,7 @@ parisc_return_value_location_ (Dwarf_Die *functypedie, const Dwarf_Op **locp, in
83
84 /* Else fall through. */
85 }
86-
87+ /* fallthru */
88 case DW_TAG_structure_type:
89 case DW_TAG_class_type:
90 case DW_TAG_union_type:
91diff --git a/backends/ppc_regs.c b/backends/ppc_regs.c
92index 637c25d..8277c54 100644
93--- a/backends/ppc_regs.c
94+++ b/backends/ppc_regs.c
95@@ -137,7 +137,7 @@ ppc_register_info (Ebl *ebl __attribute__ ((unused)),
96 case 100:
97 if (*bits == 32)
98 return stpcpy (name, "mq") + 1 - name;
99-
100+ /* fallthru */
101 case 102 ... 107:
102 name[0] = 's';
103 name[1] = 'p';
104diff --git a/backends/x86_64_regs.c b/backends/x86_64_regs.c
105index 8eb0d33..e941cf3 100644
106--- a/backends/x86_64_regs.c
107+++ b/backends/x86_64_regs.c
108@@ -84,6 +84,7 @@ x86_64_register_info (Ebl *ebl __attribute__ ((unused)),
109
110 case 6 ... 7:
111 *type = DW_ATE_address;
112+ /* fallthru */
113 case 0 ... 5:
114 name[0] = 'r';
115 name[1] = baseregs[regno][0];
116diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c
117index 0eabe0a..84b85d0 100644
118--- a/libcpu/i386_disasm.c
119+++ b/libcpu/i386_disasm.c
120@@ -788,7 +788,7 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr,
121 ++param_start;
122 break;
123 }
124-
125+ /* fallthru */
126 default:
127 assert (! "INVALID not handled");
128 abort ();
129diff --git a/libdw/cfi.c b/libdw/cfi.c
130index aeb48e6..38b3050 100644
131--- a/libdw/cfi.c
132+++ b/libdw/cfi.c
133@@ -143,6 +143,7 @@ execute_cfi (Dwarf_CFI *cache,
134
135 case DW_CFA_advance_loc1:
136 operand = *program++;
137+ /* fallthru */
138 case DW_CFA_advance_loc + 0 ... DW_CFA_advance_loc + CFI_PRIMARY_MAX:
139 advance_loc:
140 loc += operand * cie->code_alignment_factor;
141@@ -227,6 +228,7 @@ execute_cfi (Dwarf_CFI *cache,
142
143 case DW_CFA_offset_extended:
144 get_uleb128 (operand, program);
145+ cfi_assert (program < end);
146 case DW_CFA_offset + 0 ... DW_CFA_offset + CFI_PRIMARY_MAX:
147 get_uleb128 (offset, program);
148 offset *= cie->data_alignment_factor;
149@@ -290,6 +292,7 @@ execute_cfi (Dwarf_CFI *cache,
150
151 case DW_CFA_restore_extended:
152 get_uleb128 (operand, program);
153+ /* fallthru */
154 case DW_CFA_restore + 0 ... DW_CFA_restore + CFI_PRIMARY_MAX:
155
156 if (unlikely (abi_cfi) && likely (opcode == DW_CFA_restore))
157diff --git a/libdw/encoded-value.h b/libdw/encoded-value.h
158index e118a1c..17190c8 100644
159--- a/libdw/encoded-value.h
160+++ b/libdw/encoded-value.h
161@@ -82,6 +82,7 @@ encoded_value_size (const Elf_Data *data, const unsigned char e_ident[],
162 if (*end++ & 0x80u)
163 return end - p;
164 }
165+ return 0;
166
167 default:
168 abort ();
169diff --git a/libdwfl/dwfl_report_elf.c b/libdwfl/dwfl_report_elf.c
170index 062a647..8a30816 100644
171--- a/libdwfl/dwfl_report_elf.c
172+++ b/libdwfl/dwfl_report_elf.c
173@@ -185,6 +185,7 @@ __libdwfl_report_elf (Dwfl *dwfl, const char *name, const char *file_name,
174 case ET_CORE:
175 /* An assigned base address is meaningless for these. */
176 base = 0;
177+ /* fallthru */
178
179 case ET_DYN:
180 default:;
181diff --git a/src/addr2line.c b/src/addr2line.c
182index 48f017b..4a2cc5b 100644
183--- a/src/addr2line.c
184+++ b/src/addr2line.c
185@@ -457,6 +457,7 @@ handle_address (const char *string, Dwfl *dwfl)
186 case 1:
187 addr = 0;
188 j = i;
189+ /* fallthru */
190 case 2:
191 if (string[j] != '\0')
192 break;
193diff --git a/src/elflint.c b/src/elflint.c
194index a25af97..3d75391 100644
195--- a/src/elflint.c
196+++ b/src/elflint.c
197@@ -218,6 +218,7 @@ parse_opt (int key, char *arg __attribute__ ((unused)),
198
199 case 'd':
200 is_debuginfo = true;
201+ break;
202
203 case ARGP_gnuld:
204 gnuld = true;
205@@ -3735,6 +3736,7 @@ section [%2zu] '%s': merge flag set but entry size is zero\n"),
206 case SHT_NOBITS:
207 if (is_debuginfo)
208 break;
209+ /* fallthru */
210 default:
211 ERROR (gettext ("\
212 section [%2zu] '%s' has unexpected type %d for an executable section\n"),
213@@ -4036,7 +4038,7 @@ section [%2d] '%s': unknown core file note type %" PRIu32
214 if (nhdr.n_namesz == sizeof "Linux"
215 && !memcmp (data->d_buf + name_offset, "Linux", sizeof "Linux"))
216 break;
217-
218+ /* fallthru */
219 default:
220 if (shndx == 0)
221 ERROR (gettext ("\
222diff --git a/src/objdump.c b/src/objdump.c
223index 1234c79..8c39a5b 100644
224--- a/src/objdump.c
225+++ b/src/objdump.c
226@@ -238,7 +238,7 @@ parse_opt (int key, char *arg,
227 program_invocation_short_name);
228 exit (EXIT_FAILURE);
229 }
230-
231+ /* fallthru */
232 default:
233 return ARGP_ERR_UNKNOWN;
234 }
235--
2362.12.2
237
diff --git a/recipes-devtools/elfutils/elfutils-0.148/0002-Fix-printf-overflow-warnings.patch b/recipes-devtools/elfutils/elfutils-0.148/0002-Fix-printf-overflow-warnings.patch
new file mode 100644
index 0000000..bc89f04
--- /dev/null
+++ b/recipes-devtools/elfutils/elfutils-0.148/0002-Fix-printf-overflow-warnings.patch
@@ -0,0 +1,57 @@
1From 471f7e4e72feea16f06d806c47b05719c3d77d8f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 25 Apr 2017 15:57:33 -0700
4Subject: [PATCH 2/2] Fix printf overflow warnings
5
6Fixes
7
8../../elfutils-0.148/src/ar.c:865:49: error: '__builtin___snprintf_chk' output truncated before the last format character [-Werror=format-truncation=]
9 snprintf (tmpbuf, sizeof (tmpbuf), "/%-*ld",
10 ^
11In file included from /mnt/a/build/tmp-glibc/work/cortexa7hf-neon-vfpv4-oe-linux-gnueabi/elfutils/0.148-r11/recipe-sysroot/usr/include/stdio.h:889:0,
12 from /mnt/a/build/tmp-glibc/work/cortexa7hf-neon-vfpv4-oe-linux-gnueabi/elfutils/0.148-r11/recipe-sysroot/usr/include/argp.h:23,
13 from ../../elfutils-0.148/src/ar.c:30:
14/mnt/a/build/tmp-glibc/work/cortexa7hf-neon-vfpv4-oe-linux-gnueabi/elfutils/0.148-r11/recipe-sysroot/usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output 18 b
15ytes into a destination of size 17
16
17Upstream-Status: Pending
18
19Signed-off-by: Khem Raj <raj.khem@gmail.com>
20---
21 src/ar.c | 6 +++---
22 1 file changed, 3 insertions(+), 3 deletions(-)
23
24diff --git a/src/ar.c b/src/ar.c
25index 8e2abbe..0bf5051 100644
26--- a/src/ar.c
27+++ b/src/ar.c
28@@ -853,7 +853,7 @@ write_member (struct armem *memb, off_t *startp, off_t *lenp, Elf *elf,
29 off_t end_off, int newfd)
30 {
31 struct ar_hdr arhdr;
32- char tmpbuf[sizeof (arhdr.ar_name) + 1];
33+ char tmpbuf[sizeof (arhdr.ar_name) + 2];
34
35 bool changed_header = memb->long_name_off != -1;
36 if (changed_header)
37@@ -1454,7 +1454,7 @@ do_oper_insert (int oper, const char *arfname, char **argv, int argc,
38
39 /* Create the header. */
40 struct ar_hdr arhdr;
41- char tmpbuf[sizeof (arhdr.ar_name) + 1];
42+ char tmpbuf[sizeof (arhdr.ar_name) + 2];
43 if (all->long_name_off == -1)
44 {
45 size_t namelen = strlen (all->name);
46@@ -1464,7 +1464,7 @@ do_oper_insert (int oper, const char *arfname, char **argv, int argc,
47 }
48 else
49 {
50- snprintf (tmpbuf, sizeof (arhdr.ar_name) + 1, "/%-*ld",
51+ snprintf (tmpbuf, sizeof (tmpbuf), "/%-*ld",
52 (int) sizeof (arhdr.ar_name), all->long_name_off);
53 memcpy (arhdr.ar_name, tmpbuf, sizeof (arhdr.ar_name));
54 }
55--
562.12.2
57
diff --git a/recipes-devtools/elfutils/elfutils_0.148.bb b/recipes-devtools/elfutils/elfutils_0.148.bb
index 6080c17..29d109a 100644
--- a/recipes-devtools/elfutils/elfutils_0.148.bb
+++ b/recipes-devtools/elfutils/elfutils_0.148.bb
@@ -35,6 +35,8 @@ SRC_URI += "\
35 file://elf_begin.c-CVE-2014-9447-fix.patch \ 35 file://elf_begin.c-CVE-2014-9447-fix.patch \
36 file://fix-build-gcc-4.8.patch \ 36 file://fix-build-gcc-4.8.patch \
37 file://gcc6.patch \ 37 file://gcc6.patch \
38 file://0001-Fix-fallthrough-warnings.patch \
39 file://0002-Fix-printf-overflow-warnings.patch \
38" 40"
39# Only apply when building uclibc based target recipe 41# Only apply when building uclibc based target recipe
40SRC_URI_append_libc-uclibc = " file://uclibc-support-for-elfutils-0.148.patch" 42SRC_URI_append_libc-uclibc = " file://uclibc-support-for-elfutils-0.148.patch"