summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/elfutils
diff options
context:
space:
mode:
authorTim Orling <timothy.t.orling@linux.intel.com>2016-07-14 18:49:34 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-27 08:33:37 +0100
commit7db217e7acb3e92b9f1582948903501668496d29 (patch)
treeee9f3286a298c7375ca7a86db45961bc944508a9 /meta/recipes-devtools/elfutils
parent553ffcb94114f0e22990c407f9a077808bb09202 (diff)
downloadpoky-7db217e7acb3e92b9f1582948903501668496d29.tar.gz
elfutils: Fix build for gcc-6
Backport patch from upstream. [YOCTO #9897] (Fedora-24) (From OE-Core rev: 619eff37f41dacbc35ea480559ce393cc3f2c17b) Signed-off-by: Tim Orling <timothy.t.orling@linux.intel.com> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/elfutils')
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.164/libebl-Fix-missing-brackets-around-if-statement-body.patch419
-rw-r--r--meta/recipes-devtools/elfutils/elfutils_0.164.bb1
2 files changed, 420 insertions, 0 deletions
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.164/libebl-Fix-missing-brackets-around-if-statement-body.patch b/meta/recipes-devtools/elfutils/elfutils-0.164/libebl-Fix-missing-brackets-around-if-statement-body.patch
new file mode 100644
index 0000000000..8399133d79
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.164/libebl-Fix-missing-brackets-around-if-statement-body.patch
@@ -0,0 +1,419 @@
1The upstream patch libebl/Changelog does not apply cleanly.
2Modify the patch to skip that change only.
3
4Upstream-Status: Backport
5
6Signed-off-by: Tim Orling <timothy.t.orling@linux.intel.com>
7
8From c5da7c9e08c2bdb6dba8e115dcc09ed51a07f0e4 Mon Sep 17 00:00:00 2001
9From: Mark Wielaard <mjw@redhat.com>
10Date: Sat, 9 Jan 2016 22:09:48 +0100
11Subject: libebl: Fix missing brackets around if statement body.
12MIME-Version: 1.0
13Content-Type: text/plain; charset=UTF-8
14Content-Transfer-Encoding: 8bit
15
16GCC6 [will have] a nice new warning that showed a real bug:
17
18elfutils/libebl/eblobjnote.c: In function ‘ebl_object_note’:
19elfutils/libebl/eblobjnote.c:135:5: error: statement is indented as if it were guarded by... [-Werror=misleading-indentation]
20 switch (type)
21 ^~~~~~
22
23elfutils/libebl/eblobjnote.c:45:3: note: ...this ‘if’ clause, but it is not
24 if (! ebl->object_note (name, type, descsz, desc))
25 ^~
26
27And indeed, it should have been under the if, but wasn't because of missing
28brackets. Added brackets (and reindent).
29
30Signed-off-by: Mark Wielaard <mjw@redhat.com>
31---
32 libebl/eblobjnote.c | 362 ++++++++++++++++++++++++++--------------------------
33 2 files changed, 187 insertions(+), 180 deletions(-)
34
35diff --git a/libebl/eblobjnote.c b/libebl/eblobjnote.c
36index fa1eb93..f80a1a5 100644
37--- a/libebl/eblobjnote.c
38+++ b/libebl/eblobjnote.c
39@@ -1,5 +1,5 @@
40 /* Print contents of object file note.
41- Copyright (C) 2002, 2007, 2009, 2011, 2015 Red Hat, Inc.
42+ Copyright (C) 2002, 2007, 2009, 2011, 2015, 2016 Red Hat, Inc.
43 This file is part of elfutils.
44 Written by Ulrich Drepper <drepper@redhat.com>, 2002.
45
46@@ -43,189 +43,191 @@ ebl_object_note (Ebl *ebl, const char *name, uint32_t type,
47 uint32_t descsz, const char *desc)
48 {
49 if (! ebl->object_note (name, type, descsz, desc))
50- /* The machine specific function did not know this type. */
51+ {
52+ /* The machine specific function did not know this type. */
53
54- if (strcmp ("stapsdt", name) == 0)
55- {
56- if (type != 3)
57- {
58- printf (gettext ("unknown SDT version %u\n"), type);
59- return;
60- }
61-
62- /* Descriptor starts with three addresses, pc, base ref and
63- semaphore. Then three zero terminated strings provider,
64- name and arguments. */
65-
66- union
67+ if (strcmp ("stapsdt", name) == 0)
68 {
69- Elf64_Addr a64[3];
70- Elf32_Addr a32[3];
71- } addrs;
72+ if (type != 3)
73+ {
74+ printf (gettext ("unknown SDT version %u\n"), type);
75+ return;
76+ }
77
78- size_t addrs_size = gelf_fsize (ebl->elf, ELF_T_ADDR, 3, EV_CURRENT);
79- if (descsz < addrs_size + 3)
80- {
81- invalid_sdt:
82- printf (gettext ("invalid SDT probe descriptor\n"));
83- return;
84- }
85+ /* Descriptor starts with three addresses, pc, base ref and
86+ semaphore. Then three zero terminated strings provider,
87+ name and arguments. */
88
89- Elf_Data src =
90+ union
91 {
92- .d_type = ELF_T_ADDR, .d_version = EV_CURRENT,
93- .d_buf = (void *) desc, .d_size = addrs_size
94- };
95-
96- Elf_Data dst =
97- {
98- .d_type = ELF_T_ADDR, .d_version = EV_CURRENT,
99- .d_buf = &addrs, .d_size = addrs_size
100- };
101-
102- if (gelf_xlatetom (ebl->elf, &dst, &src,
103- elf_getident (ebl->elf, NULL)[EI_DATA]) == NULL)
104- {
105- printf ("%s\n", elf_errmsg (-1));
106- return;
107- }
108-
109- const char *provider = desc + addrs_size;
110- const char *pname = memchr (provider, '\0', desc + descsz - provider);
111- if (pname == NULL)
112- goto invalid_sdt;
113-
114- ++pname;
115- const char *args = memchr (pname, '\0', desc + descsz - pname);
116- if (args == NULL ||
117- memchr (++args, '\0', desc + descsz - pname) != desc + descsz - 1)
118- goto invalid_sdt;
119-
120- GElf_Addr pc;
121- GElf_Addr base;
122- GElf_Addr sem;
123- if (gelf_getclass (ebl->elf) == ELFCLASS32)
124- {
125- pc = addrs.a32[0];
126- base = addrs.a32[1];
127- sem = addrs.a32[2];
128- }
129- else
130- {
131- pc = addrs.a64[0];
132- base = addrs.a64[1];
133- sem = addrs.a64[2];
134- }
135-
136- printf (gettext (" PC: "));
137- printf ("%#" PRIx64 ",", pc);
138- printf (gettext (" Base: "));
139- printf ("%#" PRIx64 ",", base);
140- printf (gettext (" Semaphore: "));
141- printf ("%#" PRIx64 "\n", sem);
142- printf (gettext (" Provider: "));
143- printf ("%s,", provider);
144- printf (gettext (" Name: "));
145- printf ("%s,", pname);
146- printf (gettext (" Args: "));
147- printf ("'%s'\n", args);
148- return;
149- }
150-
151- switch (type)
152- {
153- case NT_GNU_BUILD_ID:
154- if (strcmp (name, "GNU") == 0 && descsz > 0)
155- {
156- printf (gettext (" Build ID: "));
157- uint_fast32_t i;
158- for (i = 0; i < descsz - 1; ++i)
159- printf ("%02" PRIx8, (uint8_t) desc[i]);
160- printf ("%02" PRIx8 "\n", (uint8_t) desc[i]);
161- }
162- break;
163-
164- case NT_GNU_GOLD_VERSION:
165- if (strcmp (name, "GNU") == 0 && descsz > 0)
166- /* A non-null terminated version string. */
167- printf (gettext (" Linker version: %.*s\n"),
168- (int) descsz, desc);
169- break;
170-
171- case NT_GNU_ABI_TAG:
172- if (strcmp (name, "GNU") == 0 && descsz >= 8 && descsz % 4 == 0)
173- {
174- Elf_Data in =
175- {
176- .d_version = EV_CURRENT,
177- .d_type = ELF_T_WORD,
178- .d_size = descsz,
179- .d_buf = (void *) desc
180- };
181- /* Normally NT_GNU_ABI_TAG is just 4 words (16 bytes). If it
182- is much (4*) larger dynamically allocate memory to convert. */
183+ Elf64_Addr a64[3];
184+ Elf32_Addr a32[3];
185+ } addrs;
186+
187+ size_t addrs_size = gelf_fsize (ebl->elf, ELF_T_ADDR, 3, EV_CURRENT);
188+ if (descsz < addrs_size + 3)
189+ {
190+ invalid_sdt:
191+ printf (gettext ("invalid SDT probe descriptor\n"));
192+ return;
193+ }
194+
195+ Elf_Data src =
196+ {
197+ .d_type = ELF_T_ADDR, .d_version = EV_CURRENT,
198+ .d_buf = (void *) desc, .d_size = addrs_size
199+ };
200+
201+ Elf_Data dst =
202+ {
203+ .d_type = ELF_T_ADDR, .d_version = EV_CURRENT,
204+ .d_buf = &addrs, .d_size = addrs_size
205+ };
206+
207+ if (gelf_xlatetom (ebl->elf, &dst, &src,
208+ elf_getident (ebl->elf, NULL)[EI_DATA]) == NULL)
209+ {
210+ printf ("%s\n", elf_errmsg (-1));
211+ return;
212+ }
213+
214+ const char *provider = desc + addrs_size;
215+ const char *pname = memchr (provider, '\0', desc + descsz - provider);
216+ if (pname == NULL)
217+ goto invalid_sdt;
218+
219+ ++pname;
220+ const char *args = memchr (pname, '\0', desc + descsz - pname);
221+ if (args == NULL ||
222+ memchr (++args, '\0', desc + descsz - pname) != desc + descsz - 1)
223+ goto invalid_sdt;
224+
225+ GElf_Addr pc;
226+ GElf_Addr base;
227+ GElf_Addr sem;
228+ if (gelf_getclass (ebl->elf) == ELFCLASS32)
229+ {
230+ pc = addrs.a32[0];
231+ base = addrs.a32[1];
232+ sem = addrs.a32[2];
233+ }
234+ else
235+ {
236+ pc = addrs.a64[0];
237+ base = addrs.a64[1];
238+ sem = addrs.a64[2];
239+ }
240+
241+ printf (gettext (" PC: "));
242+ printf ("%#" PRIx64 ",", pc);
243+ printf (gettext (" Base: "));
244+ printf ("%#" PRIx64 ",", base);
245+ printf (gettext (" Semaphore: "));
246+ printf ("%#" PRIx64 "\n", sem);
247+ printf (gettext (" Provider: "));
248+ printf ("%s,", provider);
249+ printf (gettext (" Name: "));
250+ printf ("%s,", pname);
251+ printf (gettext (" Args: "));
252+ printf ("'%s'\n", args);
253+ return;
254+ }
255+
256+ switch (type)
257+ {
258+ case NT_GNU_BUILD_ID:
259+ if (strcmp (name, "GNU") == 0 && descsz > 0)
260+ {
261+ printf (gettext (" Build ID: "));
262+ uint_fast32_t i;
263+ for (i = 0; i < descsz - 1; ++i)
264+ printf ("%02" PRIx8, (uint8_t) desc[i]);
265+ printf ("%02" PRIx8 "\n", (uint8_t) desc[i]);
266+ }
267+ break;
268+
269+ case NT_GNU_GOLD_VERSION:
270+ if (strcmp (name, "GNU") == 0 && descsz > 0)
271+ /* A non-null terminated version string. */
272+ printf (gettext (" Linker version: %.*s\n"),
273+ (int) descsz, desc);
274+ break;
275+
276+ case NT_GNU_ABI_TAG:
277+ if (strcmp (name, "GNU") == 0 && descsz >= 8 && descsz % 4 == 0)
278+ {
279+ Elf_Data in =
280+ {
281+ .d_version = EV_CURRENT,
282+ .d_type = ELF_T_WORD,
283+ .d_size = descsz,
284+ .d_buf = (void *) desc
285+ };
286+ /* Normally NT_GNU_ABI_TAG is just 4 words (16 bytes). If it
287+ is much (4*) larger dynamically allocate memory to convert. */
288 #define FIXED_TAG_BYTES 16
289- uint32_t sbuf[FIXED_TAG_BYTES];
290- uint32_t *buf;
291- if (unlikely (descsz / 4 > FIXED_TAG_BYTES))
292- {
293- buf = malloc (descsz);
294- if (unlikely (buf == NULL))
295- return;
296- }
297- else
298- buf = sbuf;
299- Elf_Data out =
300- {
301- .d_version = EV_CURRENT,
302- .d_type = ELF_T_WORD,
303- .d_size = descsz,
304- .d_buf = buf
305- };
306-
307- if (elf32_xlatetom (&out, &in, ebl->data) != NULL)
308- {
309- const char *os;
310- switch (buf[0])
311- {
312- case ELF_NOTE_OS_LINUX:
313- os = "Linux";
314- break;
315-
316- case ELF_NOTE_OS_GNU:
317- os = "GNU";
318- break;
319-
320- case ELF_NOTE_OS_SOLARIS2:
321- os = "Solaris";
322- break;
323-
324- case ELF_NOTE_OS_FREEBSD:
325- os = "FreeBSD";
326- break;
327-
328- default:
329- os = "???";
330- break;
331- }
332-
333- printf (gettext (" OS: %s, ABI: "), os);
334- for (size_t cnt = 1; cnt < descsz / 4; ++cnt)
335- {
336- if (cnt > 1)
337- putchar_unlocked ('.');
338- printf ("%" PRIu32, buf[cnt]);
339- }
340- putchar_unlocked ('\n');
341- }
342- if (descsz / 4 > FIXED_TAG_BYTES)
343- free (buf);
344- break;
345- }
346- /* FALLTHROUGH */
347-
348- default:
349- /* Unknown type. */
350- break;
351- }
352+ uint32_t sbuf[FIXED_TAG_BYTES];
353+ uint32_t *buf;
354+ if (unlikely (descsz / 4 > FIXED_TAG_BYTES))
355+ {
356+ buf = malloc (descsz);
357+ if (unlikely (buf == NULL))
358+ return;
359+ }
360+ else
361+ buf = sbuf;
362+ Elf_Data out =
363+ {
364+ .d_version = EV_CURRENT,
365+ .d_type = ELF_T_WORD,
366+ .d_size = descsz,
367+ .d_buf = buf
368+ };
369+
370+ if (elf32_xlatetom (&out, &in, ebl->data) != NULL)
371+ {
372+ const char *os;
373+ switch (buf[0])
374+ {
375+ case ELF_NOTE_OS_LINUX:
376+ os = "Linux";
377+ break;
378+
379+ case ELF_NOTE_OS_GNU:
380+ os = "GNU";
381+ break;
382+
383+ case ELF_NOTE_OS_SOLARIS2:
384+ os = "Solaris";
385+ break;
386+
387+ case ELF_NOTE_OS_FREEBSD:
388+ os = "FreeBSD";
389+ break;
390+
391+ default:
392+ os = "???";
393+ break;
394+ }
395+
396+ printf (gettext (" OS: %s, ABI: "), os);
397+ for (size_t cnt = 1; cnt < descsz / 4; ++cnt)
398+ {
399+ if (cnt > 1)
400+ putchar_unlocked ('.');
401+ printf ("%" PRIu32, buf[cnt]);
402+ }
403+ putchar_unlocked ('\n');
404+ }
405+ if (descsz / 4 > FIXED_TAG_BYTES)
406+ free (buf);
407+ break;
408+ }
409+ /* FALLTHROUGH */
410+
411+ default:
412+ /* Unknown type. */
413+ break;
414+ }
415+ }
416 }
417--
418cgit v0.12
419
diff --git a/meta/recipes-devtools/elfutils/elfutils_0.164.bb b/meta/recipes-devtools/elfutils/elfutils_0.164.bb
index 4964c05078..2b23025ada 100644
--- a/meta/recipes-devtools/elfutils/elfutils_0.164.bb
+++ b/meta/recipes-devtools/elfutils/elfutils_0.164.bb
@@ -20,6 +20,7 @@ SRC_URI += "\
20 file://0001-fix-a-stack-usage-warning.patch \ 20 file://0001-fix-a-stack-usage-warning.patch \
21 file://aarch64_uio.patch \ 21 file://aarch64_uio.patch \
22 file://shadow.patch \ 22 file://shadow.patch \
23 file://libebl-Fix-missing-brackets-around-if-statement-body.patch \
23" 24"
24 25
25# pick the patch from debian 26# pick the patch from debian