summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/elfutils/elfutils-0.166
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/elfutils/elfutils-0.166')
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.166/0001-Ignore-differences-between-mips-machine-identifiers.patch34
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.166/0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch1163
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.166/0001-elf_getarsym-Silence-Werror-maybe-uninitialized-fals.patch35
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.166/0001-fix-a-stack-usage-warning.patch28
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.166/0001-remove-the-unneed-checking.patch38
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.166/0002-Add-support-for-mips64-abis-in-mips_retval.c.patch168
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.166/0003-Add-mips-n64-relocation-format-hack.patch226
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.166/aarch64_uio.patch47
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.166/arm_backend.diff600
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.166/elfcmp-fix-self-comparision.patch41
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.166/fixheadercheck.patch23
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.166/hppa_backend.diff799
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.166/kfreebsd_path.patch15
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.166/m68k_backend.diff492
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.166/mips_backend.diff711
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.166/mips_readelf_w.patch22
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.166/shadow.patch23
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.166/testsuite-ignore-elflint.diff39
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.166/uclibc-support.patch128
19 files changed, 4632 insertions, 0 deletions
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.166/0001-Ignore-differences-between-mips-machine-identifiers.patch b/meta/recipes-devtools/elfutils/elfutils-0.166/0001-Ignore-differences-between-mips-machine-identifiers.patch
new file mode 100644
index 0000000000..3f110f98fc
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.166/0001-Ignore-differences-between-mips-machine-identifiers.patch
@@ -0,0 +1,34 @@
1From 77cb4a53c270d5854d3af24f19547bc3de825233 Mon Sep 17 00:00:00 2001
2From: James Cowgill <james410@cowgill.org.uk>
3Date: Mon, 5 Jan 2015 15:16:58 +0000
4Subject: [PATCH 1/3] Ignore differences between mips machine identifiers
5
6Little endian binaries actually use EM_MIPS so you can't tell the endianness
7from the elf machine id. Also, the EM_MIPS_RS3_LE machine is dead anyway (the
8kernel will not load binaries containing it).
9
10Signed-off-by: James Cowgill <james410@cowgill.org.uk>
11---
12 backends/mips_init.c | 6 +-----
13 1 file changed, 1 insertion(+), 5 deletions(-)
14
15diff --git a/backends/mips_init.c b/backends/mips_init.c
16index 7429a89..d10e940 100644
17--- a/backends/mips_init.c
18+++ b/backends/mips_init.c
19@@ -46,11 +46,7 @@ mips_init (elf, machine, eh, ehlen)
20 return NULL;
21
22 /* We handle it. */
23- if (machine == EM_MIPS)
24- eh->name = "MIPS R3000 big-endian";
25- else if (machine == EM_MIPS_RS3_LE)
26- eh->name = "MIPS R3000 little-endian";
27-
28+ eh->name = "MIPS";
29 mips_init_reloc (eh);
30 HOOK (eh, reloc_simple_type);
31 HOOK (eh, return_value_location);
32--
332.1.4
34
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.166/0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch b/meta/recipes-devtools/elfutils/elfutils-0.166/0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch
new file mode 100644
index 0000000000..38b31f6a8d
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.166/0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch
@@ -0,0 +1,1163 @@
1From 4b0fe80b3951f044c1c1b14d1d7f5f0b8ab67507 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 31 Dec 2015 06:35:34 +0000
4Subject: [PATCH] build: Provide alternatives for glibc assumptions helps
5 compiling it on musl
6
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9Upstream-Status: Pending
10
11 Makefile.am | 2 +-
12 lib/color.c | 2 +-
13 lib/crc32_file.c | 4 +++-
14 lib/fixedsizehash.h | 4 ++--
15 lib/system.h | 11 +++++++++++
16 lib/xmalloc.c | 2 +-
17 libasm/asm_end.c | 2 +-
18 libasm/asm_newscn.c | 2 +-
19 libcpu/i386_gendis.c | 2 +-
20 libcpu/i386_lex.c | 2 +-
21 libcpu/i386_parse.c | 2 +-
22 libdw/Makefile.am | 2 +-
23 libdw/libdw_alloc.c | 3 ++-
24 libdwfl/Makefile.am | 2 ++
25 libdwfl/dwfl_build_id_find_elf.c | 3 ++-
26 libdwfl/dwfl_error.c | 4 +++-
27 libdwfl/dwfl_module_getdwarf.c | 1 +
28 libdwfl/find-debuginfo.c | 2 +-
29 libdwfl/libdwfl_crc32_file.c | 10 ++++++++++
30 libdwfl/linux-kernel-modules.c | 1 +
31 libebl/eblopenbackend.c | 2 +-
32 libebl/eblwstrtab.c | 2 +-
33 libelf/elf.h | 9 ++++++---
34 libelf/libelf.h | 1 +
35 libelf/libelfP.h | 1 +
36 src/addr2line.c | 2 +-
37 src/ar.c | 2 +-
38 src/arlib.c | 2 +-
39 src/arlib2.c | 2 +-
40 src/elfcmp.c | 2 +-
41 src/elflint.c | 2 +-
42 src/findtextrel.c | 2 +-
43 src/i386_ld.c | 2 +-
44 src/ld.c | 2 +-
45 src/ldgeneric.c | 2 +-
46 src/ldlex.c | 2 +-
47 src/ldscript.c | 2 +-
48 src/nm.c | 2 +-
49 src/objdump.c | 2 +-
50 src/ranlib.c | 2 +-
51 src/readelf.c | 2 +-
52 src/size.c | 2 +-
53 src/stack.c | 2 +-
54 src/strings.c | 2 +-
55 src/strip.c | 2 +-
56 src/unstrip.c | 2 +-
57 tests/addrscopes.c | 2 +-
58 tests/allregs.c | 2 +-
59 tests/backtrace-data.c | 2 +-
60 tests/backtrace-dwarf.c | 2 +-
61 tests/backtrace.c | 2 +-
62 tests/buildid.c | 2 +-
63 tests/debugaltlink.c | 2 +-
64 tests/debuglink.c | 2 +-
65 tests/deleted.c | 2 +-
66 tests/dwfl-addr-sect.c | 2 +-
67 tests/dwfl-bug-addr-overflow.c | 2 +-
68 tests/dwfl-bug-fd-leak.c | 2 +-
69 tests/dwfl-bug-getmodules.c | 2 +-
70 tests/dwfl-report-elf-align.c | 2 +-
71 tests/dwfllines.c | 2 +-
72 tests/dwflmodtest.c | 2 +-
73 tests/dwflsyms.c | 2 +-
74 tests/early-offscn.c | 2 +-
75 tests/ecp.c | 2 +-
76 tests/find-prologues.c | 2 +-
77 tests/funcretval.c | 2 +-
78 tests/funcscopes.c | 2 +-
79 tests/getsrc_die.c | 2 +-
80 tests/line2addr.c | 2 +-
81 tests/low_high_pc.c | 2 +-
82 tests/md5-sha1-test.c | 2 +-
83 tests/rdwrmmap.c | 2 +-
84 tests/saridx.c | 2 +-
85 tests/sectiondump.c | 2 +-
86 tests/varlocs.c | 2 +-
87 tests/vdsosyms.c | 2 +-
88 77 files changed, 109 insertions(+), 73 deletions(-)
89
90Index: elfutils-0.166/Makefile.am
91===================================================================
92--- elfutils-0.166.orig/Makefile.am
93+++ elfutils-0.166/Makefile.am
94@@ -28,7 +28,7 @@ pkginclude_HEADERS = version.h
95
96 # Add doc back when we have some real content.
97 SUBDIRS = config m4 lib libelf libebl libdwelf libdwfl libdw libcpu libasm \
98- backends src po tests
99+ backends po tests
100
101 EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
102 COPYING COPYING-GPLV2 COPYING-LGPLV3
103Index: elfutils-0.166/lib/color.c
104===================================================================
105--- elfutils-0.166.orig/lib/color.c
106+++ elfutils-0.166/lib/color.c
107@@ -32,7 +32,7 @@
108 #endif
109
110 #include <argp.h>
111-#include <error.h>
112+#include <err.h>
113 #include <libintl.h>
114 #include <stdlib.h>
115 #include <string.h>
116Index: elfutils-0.166/lib/crc32_file.c
117===================================================================
118--- elfutils-0.166.orig/lib/crc32_file.c
119+++ elfutils-0.166/lib/crc32_file.c
120@@ -30,12 +30,14 @@
121 # include <config.h>
122 #endif
123
124-#include "system.h"
125 #include <errno.h>
126 #include <unistd.h>
127+#include <stdint.h>
128 #include <sys/stat.h>
129 #include <sys/mman.h>
130
131+#include "system.h"
132+
133 int
134 crc32_file (int fd, uint32_t *resp)
135 {
136Index: elfutils-0.166/lib/fixedsizehash.h
137===================================================================
138--- elfutils-0.166.orig/lib/fixedsizehash.h
139+++ elfutils-0.166/lib/fixedsizehash.h
140@@ -30,12 +30,12 @@
141 #include <errno.h>
142 #include <stdlib.h>
143 #include <string.h>
144-#include <sys/cdefs.h>
145 #include <sys/param.h>
146
147 #include <system.h>
148
149-#define CONCAT(t1,t2) __CONCAT (t1,t2)
150+#define CONCAT1(x,y) x##y
151+#define CONCAT(x,y) CONCAT1(x,y)
152
153 /* Before including this file the following macros must be defined:
154
155Index: elfutils-0.166/lib/system.h
156===================================================================
157--- elfutils-0.166.orig/lib/system.h
158+++ elfutils-0.166/lib/system.h
159@@ -49,6 +49,16 @@
160 #else
161 # error "Unknown byte order"
162 #endif
163+#ifndef TEMP_FAILURE_RETRY
164+#define TEMP_FAILURE_RETRY(expression) \
165+ (__extension__ \
166+ ({ long int __result; \
167+ do __result = (long int) (expression); \
168+ while (__result == -1L && errno == EINTR); \
169+ __result; }))
170+#endif
171+
172+#define error(status, errno, ...) err(status, __VA_ARGS__)
173
174 extern void *xmalloc (size_t) __attribute__ ((__malloc__));
175 extern void *xcalloc (size_t, size_t) __attribute__ ((__malloc__));
176Index: elfutils-0.166/lib/xmalloc.c
177===================================================================
178--- elfutils-0.166.orig/lib/xmalloc.c
179+++ elfutils-0.166/lib/xmalloc.c
180@@ -30,7 +30,7 @@
181 # include <config.h>
182 #endif
183
184-#include <error.h>
185+#include <err.h>
186 #include <libintl.h>
187 #include <stddef.h>
188 #include <stdlib.h>
189Index: elfutils-0.166/libasm/asm_end.c
190===================================================================
191--- elfutils-0.166.orig/libasm/asm_end.c
192+++ elfutils-0.166/libasm/asm_end.c
193@@ -32,7 +32,7 @@
194 #endif
195
196 #include <assert.h>
197-#include <error.h>
198+#include <err.h>
199 #include <libintl.h>
200 #include <stdio.h>
201 #include <stdlib.h>
202Index: elfutils-0.166/libasm/asm_newscn.c
203===================================================================
204--- elfutils-0.166.orig/libasm/asm_newscn.c
205+++ elfutils-0.166/libasm/asm_newscn.c
206@@ -32,7 +32,7 @@
207 #endif
208
209 #include <assert.h>
210-#include <error.h>
211+#include <err.h>
212 #include <libintl.h>
213 #include <stdlib.h>
214 #include <string.h>
215Index: elfutils-0.166/libcpu/i386_gendis.c
216===================================================================
217--- elfutils-0.166.orig/libcpu/i386_gendis.c
218+++ elfutils-0.166/libcpu/i386_gendis.c
219@@ -31,7 +31,7 @@
220 # include <config.h>
221 #endif
222
223-#include <error.h>
224+#include <err.h>
225 #include <errno.h>
226 #include <stdio.h>
227 #include <stdlib.h>
228Index: elfutils-0.166/libcpu/i386_lex.c
229===================================================================
230--- elfutils-0.166.orig/libcpu/i386_lex.c
231+++ elfutils-0.166/libcpu/i386_lex.c
232@@ -578,7 +578,7 @@ char *i386_text;
233 #endif
234
235 #include <ctype.h>
236-#include <error.h>
237+#include <err.h>
238 #include <libintl.h>
239
240 #include <system.h>
241Index: elfutils-0.166/libcpu/i386_parse.c
242===================================================================
243--- elfutils-0.166.orig/libcpu/i386_parse.c
244+++ elfutils-0.166/libcpu/i386_parse.c
245@@ -107,7 +107,7 @@
246 #include <assert.h>
247 #include <ctype.h>
248 #include <errno.h>
249-#include <error.h>
250+#include <err.h>
251 #include <inttypes.h>
252 #include <libintl.h>
253 #include <math.h>
254Index: elfutils-0.166/libdw/Makefile.am
255===================================================================
256--- elfutils-0.166.orig/libdw/Makefile.am
257+++ elfutils-0.166/libdw/Makefile.am
258@@ -117,7 +117,7 @@ libdw.so$(EXEEXT): $(srcdir)/libdw.map l
259 -Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
260 -Wl,--version-script,$<,--no-undefined \
261 -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
262- -ldl -lz $(argp_LDADD) $(zip_LIBS) $(libdw_so_LDLIBS)
263+ -ldl -lz $(argp_LDADD) $(zip_LIBS) $(libdw_so_LDLIBS) -lfts -largp
264 @$(textrel_check)
265 $(AM_V_at)ln -fs $@ $@.$(VERSION)
266
267Index: elfutils-0.166/libdw/libdw_alloc.c
268===================================================================
269--- elfutils-0.166.orig/libdw/libdw_alloc.c
270+++ elfutils-0.166/libdw/libdw_alloc.c
271@@ -31,11 +31,12 @@
272 # include <config.h>
273 #endif
274
275-#include <error.h>
276+#include <err.h>
277 #include <errno.h>
278 #include <stdlib.h>
279 #include <sys/param.h>
280 #include "libdwP.h"
281+#include "system.h"
282
283
284 void *
285Index: elfutils-0.166/libdwfl/Makefile.am
286===================================================================
287--- elfutils-0.166.orig/libdwfl/Makefile.am
288+++ elfutils-0.166/libdwfl/Makefile.am
289@@ -84,6 +84,8 @@ libelf = ../libelf/libelf.so
290 libebl = ../libebl/libebl.a
291 libeu = ../lib/libeu.a
292
293+LDADD = -lfts
294+
295 libdwfl_pic_a_SOURCES =
296 am_libdwfl_pic_a_OBJECTS = $(libdwfl_a_SOURCES:.c=.os)
297
298Index: elfutils-0.166/libdwfl/dwfl_build_id_find_elf.c
299===================================================================
300--- elfutils-0.166.orig/libdwfl/dwfl_build_id_find_elf.c
301+++ elfutils-0.166/libdwfl/dwfl_build_id_find_elf.c
302@@ -27,6 +27,7 @@
303 not, see <http://www.gnu.org/licenses/>. */
304
305 #include "libdwflP.h"
306+#include "system.h"
307 #include <inttypes.h>
308 #include <fcntl.h>
309 #include <unistd.h>
310@@ -94,7 +95,7 @@ __libdwfl_open_by_build_id (Dwfl_Module
311 {
312 if (*file_name != NULL)
313 free (*file_name);
314- *file_name = canonicalize_file_name (name);
315+ *file_name = realpath (name, NULL);
316 if (*file_name == NULL)
317 {
318 *file_name = name;
319Index: elfutils-0.166/libdwfl/dwfl_error.c
320===================================================================
321--- elfutils-0.166.orig/libdwfl/dwfl_error.c
322+++ elfutils-0.166/libdwfl/dwfl_error.c
323@@ -140,6 +140,7 @@ __libdwfl_seterrno (Dwfl_Error error)
324 const char *
325 dwfl_errmsg (int error)
326 {
327+ static __thread char s[64] = "";
328 if (error == 0 || error == -1)
329 {
330 int last_error = global_error;
331@@ -154,7 +155,8 @@ dwfl_errmsg (int error)
332 switch (error &~ 0xffff)
333 {
334 case OTHER_ERROR (ERRNO):
335- return strerror_r (error & 0xffff, "bad", 0);
336+ strerror_r (error & 0xffff, s, sizeof(s));
337+ return s;
338 case OTHER_ERROR (LIBELF):
339 return elf_errmsg (error & 0xffff);
340 case OTHER_ERROR (LIBDW):
341Index: elfutils-0.166/libdwfl/dwfl_module_getdwarf.c
342===================================================================
343--- elfutils-0.166.orig/libdwfl/dwfl_module_getdwarf.c
344+++ elfutils-0.166/libdwfl/dwfl_module_getdwarf.c
345@@ -31,6 +31,7 @@
346 #include <fcntl.h>
347 #include <string.h>
348 #include <unistd.h>
349+#include "system.h"
350 #include "../libdw/libdwP.h" /* DWARF_E_* values are here. */
351 #include "../libelf/libelfP.h"
352
353Index: elfutils-0.166/libdwfl/find-debuginfo.c
354===================================================================
355--- elfutils-0.166.orig/libdwfl/find-debuginfo.c
356+++ elfutils-0.166/libdwfl/find-debuginfo.c
357@@ -385,7 +385,7 @@ dwfl_standard_find_debuginfo (Dwfl_Modul
358 /* If FILE_NAME is a symlink, the debug file might be associated
359 with the symlink target name instead. */
360
361- char *canon = canonicalize_file_name (file_name);
362+ char *canon = realpath (file_name, NULL);
363 if (canon != NULL && strcmp (file_name, canon))
364 fd = find_debuginfo_in_path (mod, canon,
365 debuglink_file, debuglink_crc,
366Index: elfutils-0.166/libdwfl/libdwfl_crc32_file.c
367===================================================================
368--- elfutils-0.166.orig/libdwfl/libdwfl_crc32_file.c
369+++ elfutils-0.166/libdwfl/libdwfl_crc32_file.c
370@@ -31,6 +31,16 @@
371
372 #define crc32_file attribute_hidden __libdwfl_crc32_file
373 #define crc32 __libdwfl_crc32
374+
375+#ifndef TEMP_FAILURE_RETRY
376+#define TEMP_FAILURE_RETRY(expression) \
377+ (__extension__ \
378+ ({ long int __result; \
379+ do __result = (long int) (expression); \
380+ while (__result == -1L && errno == EINTR); \
381+ __result; }))
382+#endif
383+
384 #define LIB_SYSTEM_H 1
385 #include <libdwflP.h>
386 #include "../lib/crc32_file.c"
387Index: elfutils-0.166/libdwfl/linux-kernel-modules.c
388===================================================================
389--- elfutils-0.166.orig/libdwfl/linux-kernel-modules.c
390+++ elfutils-0.166/libdwfl/linux-kernel-modules.c
391@@ -34,6 +34,7 @@
392 #include <config.h>
393
394 #include "libdwflP.h"
395+#include "system.h"
396 #include <inttypes.h>
397 #include <errno.h>
398 #include <stdio.h>
399Index: elfutils-0.166/libebl/eblopenbackend.c
400===================================================================
401--- elfutils-0.166.orig/libebl/eblopenbackend.c
402+++ elfutils-0.166/libebl/eblopenbackend.c
403@@ -32,7 +32,7 @@
404
405 #include <assert.h>
406 #include <dlfcn.h>
407-#include <error.h>
408+#include <err.h>
409 #include <libelfP.h>
410 #include <dwarf.h>
411 #include <stdlib.h>
412Index: elfutils-0.166/libebl/eblwstrtab.c
413===================================================================
414--- elfutils-0.166.orig/libebl/eblwstrtab.c
415+++ elfutils-0.166/libebl/eblwstrtab.c
416@@ -305,7 +305,7 @@ copystrings (struct Ebl_WStrent *nodep,
417
418 /* Process the current node. */
419 nodep->offset = *offsetp;
420- *freep = wmempcpy (*freep, nodep->string, nodep->len);
421+ *freep = wmemcpy (*freep, nodep->string, nodep->len) + nodep->len;
422 *offsetp += nodep->len * sizeof (wchar_t);
423
424 for (subs = nodep->next; subs != NULL; subs = subs->next)
425Index: elfutils-0.166/libelf/elf.h
426===================================================================
427--- elfutils-0.166.orig/libelf/elf.h
428+++ elfutils-0.166/libelf/elf.h
429@@ -21,7 +21,9 @@
430
431 #include <features.h>
432
433-__BEGIN_DECLS
434+#ifdef __cplusplus
435+extern "C" {
436+#endif
437
438 /* Standard ELF types. */
439
440@@ -3591,7 +3593,8 @@ enum
441
442 #define R_TILEGX_NUM 130
443
444-
445-__END_DECLS
446+#ifdef __cplusplus
447+}
448+#endif
449
450 #endif /* elf.h */
451Index: elfutils-0.166/libelf/libelf.h
452===================================================================
453--- elfutils-0.166.orig/libelf/libelf.h
454+++ elfutils-0.166/libelf/libelf.h
455@@ -29,6 +29,7 @@
456 #ifndef _LIBELF_H
457 #define _LIBELF_H 1
458
459+#include <fcntl.h>
460 #include <stdint.h>
461 #include <sys/types.h>
462
463Index: elfutils-0.166/libelf/libelfP.h
464===================================================================
465--- elfutils-0.166.orig/libelf/libelfP.h
466+++ elfutils-0.166/libelf/libelfP.h
467@@ -36,6 +36,7 @@
468
469 #include <ar.h>
470 #include <gelf.h>
471+#include <libelf.h>
472
473 #include <errno.h>
474 #include <stdbool.h>
475Index: elfutils-0.166/src/addr2line.c
476===================================================================
477--- elfutils-0.166.orig/src/addr2line.c
478+++ elfutils-0.166/src/addr2line.c
479@@ -23,7 +23,7 @@
480 #include <argp.h>
481 #include <assert.h>
482 #include <errno.h>
483-#include <error.h>
484+#include <err.h>
485 #include <fcntl.h>
486 #include <inttypes.h>
487 #include <libdwfl.h>
488Index: elfutils-0.166/src/ar.c
489===================================================================
490--- elfutils-0.166.orig/src/ar.c
491+++ elfutils-0.166/src/ar.c
492@@ -22,7 +22,7 @@
493
494 #include <argp.h>
495 #include <assert.h>
496-#include <error.h>
497+#include <err.h>
498 #include <fcntl.h>
499 #include <gelf.h>
500 #include <libintl.h>
501Index: elfutils-0.166/src/arlib.c
502===================================================================
503--- elfutils-0.166.orig/src/arlib.c
504+++ elfutils-0.166/src/arlib.c
505@@ -21,7 +21,7 @@
506 #endif
507
508 #include <assert.h>
509-#include <error.h>
510+#include <err.h>
511 #include <gelf.h>
512 #include <libintl.h>
513 #include <stdio.h>
514Index: elfutils-0.166/src/arlib2.c
515===================================================================
516--- elfutils-0.166.orig/src/arlib2.c
517+++ elfutils-0.166/src/arlib2.c
518@@ -20,7 +20,7 @@
519 # include <config.h>
520 #endif
521
522-#include <error.h>
523+#include <err.h>
524 #include <libintl.h>
525 #include <limits.h>
526 #include <string.h>
527Index: elfutils-0.166/src/elfcmp.c
528===================================================================
529--- elfutils-0.166.orig/src/elfcmp.c
530+++ elfutils-0.166/src/elfcmp.c
531@@ -23,7 +23,7 @@
532 #include <argp.h>
533 #include <assert.h>
534 #include <errno.h>
535-#include <error.h>
536+#include <err.h>
537 #include <fcntl.h>
538 #include <locale.h>
539 #include <libintl.h>
540Index: elfutils-0.166/src/elflint.c
541===================================================================
542--- elfutils-0.166.orig/src/elflint.c
543+++ elfutils-0.166/src/elflint.c
544@@ -24,7 +24,7 @@
545 #include <assert.h>
546 #include <byteswap.h>
547 #include <endian.h>
548-#include <error.h>
549+#include <err.h>
550 #include <fcntl.h>
551 #include <gelf.h>
552 #include <inttypes.h>
553Index: elfutils-0.166/src/findtextrel.c
554===================================================================
555--- elfutils-0.166.orig/src/findtextrel.c
556+++ elfutils-0.166/src/findtextrel.c
557@@ -23,7 +23,7 @@
558 #include <argp.h>
559 #include <assert.h>
560 #include <errno.h>
561-#include <error.h>
562+#include <err.h>
563 #include <fcntl.h>
564 #include <gelf.h>
565 #include <libdw.h>
566Index: elfutils-0.166/src/i386_ld.c
567===================================================================
568--- elfutils-0.166.orig/src/i386_ld.c
569+++ elfutils-0.166/src/i386_ld.c
570@@ -20,7 +20,7 @@
571 #endif
572
573 #include <assert.h>
574-#include <error.h>
575+#include <err.h>
576 #include <libintl.h>
577 #include <stdlib.h>
578 #include <string.h>
579Index: elfutils-0.166/src/ld.c
580===================================================================
581--- elfutils-0.166.orig/src/ld.c
582+++ elfutils-0.166/src/ld.c
583@@ -21,7 +21,7 @@
584
585 #include <argp.h>
586 #include <assert.h>
587-#include <error.h>
588+#include <err.h>
589 #include <fcntl.h>
590 #include <libelf.h>
591 #include <libintl.h>
592Index: elfutils-0.166/src/ldgeneric.c
593===================================================================
594--- elfutils-0.166.orig/src/ldgeneric.c
595+++ elfutils-0.166/src/ldgeneric.c
596@@ -23,7 +23,7 @@
597 #include <ctype.h>
598 #include <dlfcn.h>
599 #include <errno.h>
600-#include <error.h>
601+#include <err.h>
602 #include <fcntl.h>
603 #include <fnmatch.h>
604 #include <gelf.h>
605Index: elfutils-0.166/src/ldlex.c
606===================================================================
607--- elfutils-0.166.orig/src/ldlex.c
608+++ elfutils-0.166/src/ldlex.c
609@@ -1106,7 +1106,7 @@ char *ldtext;
610 #include <assert.h>
611 #include <ctype.h>
612 #include <elf.h>
613-#include <error.h>
614+#include <err.h>
615 #include <inttypes.h>
616 #include <libintl.h>
617 #include <stdbool.h>
618Index: elfutils-0.166/src/ldscript.c
619===================================================================
620--- elfutils-0.166.orig/src/ldscript.c
621+++ elfutils-0.166/src/ldscript.c
622@@ -95,7 +95,7 @@
623 #endif
624
625 #include <assert.h>
626-#include <error.h>
627+#include <err.h>
628 #include <libintl.h>
629 #include <stdbool.h>
630 #include <stdint.h>
631Index: elfutils-0.166/src/nm.c
632===================================================================
633--- elfutils-0.166.orig/src/nm.c
634+++ elfutils-0.166/src/nm.c
635@@ -26,7 +26,7 @@
636 #include <ctype.h>
637 #include <dwarf.h>
638 #include <errno.h>
639-#include <error.h>
640+#include <err.h>
641 #include <fcntl.h>
642 #include <gelf.h>
643 #include <inttypes.h>
644Index: elfutils-0.166/src/objdump.c
645===================================================================
646--- elfutils-0.166.orig/src/objdump.c
647+++ elfutils-0.166/src/objdump.c
648@@ -21,7 +21,7 @@
649 #endif
650
651 #include <argp.h>
652-#include <error.h>
653+#include <err.h>
654 #include <fcntl.h>
655 #include <inttypes.h>
656 #include <libintl.h>
657Index: elfutils-0.166/src/ranlib.c
658===================================================================
659--- elfutils-0.166.orig/src/ranlib.c
660+++ elfutils-0.166/src/ranlib.c
661@@ -24,7 +24,7 @@
662 #include <argp.h>
663 #include <assert.h>
664 #include <errno.h>
665-#include <error.h>
666+#include <err.h>
667 #include <fcntl.h>
668 #include <gelf.h>
669 #include <libintl.h>
670Index: elfutils-0.166/src/readelf.c
671===================================================================
672--- elfutils-0.166.orig/src/readelf.c
673+++ elfutils-0.166/src/readelf.c
674@@ -25,7 +25,7 @@
675 #include <ctype.h>
676 #include <dwarf.h>
677 #include <errno.h>
678-#include <error.h>
679+#include <err.h>
680 #include <fcntl.h>
681 #include <gelf.h>
682 #include <inttypes.h>
683Index: elfutils-0.166/src/size.c
684===================================================================
685--- elfutils-0.166.orig/src/size.c
686+++ elfutils-0.166/src/size.c
687@@ -21,7 +21,7 @@
688 #endif
689
690 #include <argp.h>
691-#include <error.h>
692+#include <err.h>
693 #include <fcntl.h>
694 #include <gelf.h>
695 #include <inttypes.h>
696Index: elfutils-0.166/src/stack.c
697===================================================================
698--- elfutils-0.166.orig/src/stack.c
699+++ elfutils-0.166/src/stack.c
700@@ -18,7 +18,7 @@
701 #include <config.h>
702 #include <assert.h>
703 #include <argp.h>
704-#include <error.h>
705+#include <err.h>
706 #include <stdlib.h>
707 #include <inttypes.h>
708 #include <stdio.h>
709Index: elfutils-0.166/src/strings.c
710===================================================================
711--- elfutils-0.166.orig/src/strings.c
712+++ elfutils-0.166/src/strings.c
713@@ -25,7 +25,7 @@
714 #include <ctype.h>
715 #include <endian.h>
716 #include <errno.h>
717-#include <error.h>
718+#include <err.h>
719 #include <fcntl.h>
720 #include <gelf.h>
721 #include <inttypes.h>
722Index: elfutils-0.166/src/strip.c
723===================================================================
724--- elfutils-0.166.orig/src/strip.c
725+++ elfutils-0.166/src/strip.c
726@@ -24,7 +24,7 @@
727 #include <assert.h>
728 #include <byteswap.h>
729 #include <endian.h>
730-#include <error.h>
731+#include <err.h>
732 #include <fcntl.h>
733 #include <gelf.h>
734 #include <libelf.h>
735Index: elfutils-0.166/src/unstrip.c
736===================================================================
737--- elfutils-0.166.orig/src/unstrip.c
738+++ elfutils-0.166/src/unstrip.c
739@@ -31,7 +31,7 @@
740 #include <argp.h>
741 #include <assert.h>
742 #include <errno.h>
743-#include <error.h>
744+#include <err.h>
745 #include <fcntl.h>
746 #include <fnmatch.h>
747 #include <libintl.h>
748Index: elfutils-0.166/tests/addrscopes.c
749===================================================================
750--- elfutils-0.166.orig/tests/addrscopes.c
751+++ elfutils-0.166/tests/addrscopes.c
752@@ -25,7 +25,7 @@
753 #include <stdio_ext.h>
754 #include <locale.h>
755 #include <stdlib.h>
756-#include <error.h>
757+#include <err.h>
758 #include <string.h>
759
760
761Index: elfutils-0.166/tests/allregs.c
762===================================================================
763--- elfutils-0.166.orig/tests/allregs.c
764+++ elfutils-0.166/tests/allregs.c
765@@ -21,7 +21,7 @@
766 #include <stdio.h>
767 #include <stdlib.h>
768 #include <string.h>
769-#include <error.h>
770+#include <err.h>
771 #include <locale.h>
772 #include <argp.h>
773 #include <assert.h>
774Index: elfutils-0.166/tests/backtrace-data.c
775===================================================================
776--- elfutils-0.166.orig/tests/backtrace-data.c
777+++ elfutils-0.166/tests/backtrace-data.c
778@@ -27,7 +27,7 @@
779 #include <dirent.h>
780 #include <stdlib.h>
781 #include <errno.h>
782-#include <error.h>
783+#include <err.h>
784 #include <unistd.h>
785 #include <dwarf.h>
786 #if defined(__x86_64__) && defined(__linux__)
787Index: elfutils-0.166/tests/backtrace-dwarf.c
788===================================================================
789--- elfutils-0.166.orig/tests/backtrace-dwarf.c
790+++ elfutils-0.166/tests/backtrace-dwarf.c
791@@ -22,7 +22,7 @@
792 #include <stdio_ext.h>
793 #include <locale.h>
794 #include <errno.h>
795-#include <error.h>
796+#include <err.h>
797 #include <unistd.h>
798 #include <sys/ptrace.h>
799 #include <sys/types.h>
800Index: elfutils-0.166/tests/backtrace.c
801===================================================================
802--- elfutils-0.166.orig/tests/backtrace.c
803+++ elfutils-0.166/tests/backtrace.c
804@@ -24,7 +24,7 @@
805 #include <dirent.h>
806 #include <stdlib.h>
807 #include <errno.h>
808-#include <error.h>
809+#include <err.h>
810 #include <unistd.h>
811 #include <dwarf.h>
812 #ifdef __linux__
813Index: elfutils-0.166/tests/buildid.c
814===================================================================
815--- elfutils-0.166.orig/tests/buildid.c
816+++ elfutils-0.166/tests/buildid.c
817@@ -23,7 +23,7 @@
818 #include ELFUTILS_HEADER(elf)
819 #include ELFUTILS_HEADER(dwelf)
820 #include <stdio.h>
821-#include <error.h>
822+#include <err.h>
823 #include <string.h>
824 #include <stdlib.h>
825 #include <sys/types.h>
826Index: elfutils-0.166/tests/debugaltlink.c
827===================================================================
828--- elfutils-0.166.orig/tests/debugaltlink.c
829+++ elfutils-0.166/tests/debugaltlink.c
830@@ -23,7 +23,7 @@
831 #include ELFUTILS_HEADER(dw)
832 #include ELFUTILS_HEADER(dwelf)
833 #include <stdio.h>
834-#include <error.h>
835+#include <err.h>
836 #include <string.h>
837 #include <stdlib.h>
838 #include <sys/types.h>
839Index: elfutils-0.166/tests/debuglink.c
840===================================================================
841--- elfutils-0.166.orig/tests/debuglink.c
842+++ elfutils-0.166/tests/debuglink.c
843@@ -21,7 +21,7 @@
844 #include <errno.h>
845 #include ELFUTILS_HEADER(dwelf)
846 #include <stdio.h>
847-#include <error.h>
848+#include <err.h>
849 #include <string.h>
850 #include <stdlib.h>
851 #include <sys/types.h>
852Index: elfutils-0.166/tests/deleted.c
853===================================================================
854--- elfutils-0.166.orig/tests/deleted.c
855+++ elfutils-0.166/tests/deleted.c
856@@ -21,7 +21,7 @@
857 #include <unistd.h>
858 #include <assert.h>
859 #include <stdio.h>
860-#include <error.h>
861+#include <err.h>
862 #include <errno.h>
863 #ifdef __linux__
864 #include <sys/prctl.h>
865Index: elfutils-0.166/tests/dwfl-addr-sect.c
866===================================================================
867--- elfutils-0.166.orig/tests/dwfl-addr-sect.c
868+++ elfutils-0.166/tests/dwfl-addr-sect.c
869@@ -23,7 +23,7 @@
870 #include <stdio_ext.h>
871 #include <stdlib.h>
872 #include <string.h>
873-#include <error.h>
874+#include <err.h>
875 #include <locale.h>
876 #include <argp.h>
877 #include ELFUTILS_HEADER(dwfl)
878Index: elfutils-0.166/tests/dwfl-bug-addr-overflow.c
879===================================================================
880--- elfutils-0.166.orig/tests/dwfl-bug-addr-overflow.c
881+++ elfutils-0.166/tests/dwfl-bug-addr-overflow.c
882@@ -20,7 +20,7 @@
883 #include <inttypes.h>
884 #include <stdio.h>
885 #include <stdio_ext.h>
886-#include <error.h>
887+#include <err.h>
888 #include <locale.h>
889 #include ELFUTILS_HEADER(dwfl)
890
891Index: elfutils-0.166/tests/dwfl-bug-fd-leak.c
892===================================================================
893--- elfutils-0.166.orig/tests/dwfl-bug-fd-leak.c
894+++ elfutils-0.166/tests/dwfl-bug-fd-leak.c
895@@ -24,7 +24,7 @@
896 #include <dirent.h>
897 #include <stdlib.h>
898 #include <errno.h>
899-#include <error.h>
900+#include <err.h>
901 #include <unistd.h>
902 #include <dwarf.h>
903
904Index: elfutils-0.166/tests/dwfl-bug-getmodules.c
905===================================================================
906--- elfutils-0.166.orig/tests/dwfl-bug-getmodules.c
907+++ elfutils-0.166/tests/dwfl-bug-getmodules.c
908@@ -18,7 +18,7 @@
909 #include <config.h>
910 #include ELFUTILS_HEADER(dwfl)
911
912-#include <error.h>
913+#include <err.h>
914
915 static const Dwfl_Callbacks callbacks =
916 {
917Index: elfutils-0.166/tests/dwfl-report-elf-align.c
918===================================================================
919--- elfutils-0.166.orig/tests/dwfl-report-elf-align.c
920+++ elfutils-0.166/tests/dwfl-report-elf-align.c
921@@ -20,7 +20,7 @@
922 #include <inttypes.h>
923 #include <stdio.h>
924 #include <stdio_ext.h>
925-#include <error.h>
926+#include <err.h>
927 #include <locale.h>
928 #include <string.h>
929 #include <stdlib.h>
930Index: elfutils-0.166/tests/dwfllines.c
931===================================================================
932--- elfutils-0.166.orig/tests/dwfllines.c
933+++ elfutils-0.166/tests/dwfllines.c
934@@ -27,7 +27,7 @@
935 #include <stdio.h>
936 #include <stdlib.h>
937 #include <string.h>
938-#include <error.h>
939+#include <err.h>
940
941 int
942 main (int argc, char *argv[])
943Index: elfutils-0.166/tests/dwflmodtest.c
944===================================================================
945--- elfutils-0.166.orig/tests/dwflmodtest.c
946+++ elfutils-0.166/tests/dwflmodtest.c
947@@ -23,7 +23,7 @@
948 #include <stdio_ext.h>
949 #include <stdlib.h>
950 #include <string.h>
951-#include <error.h>
952+#include <err.h>
953 #include <locale.h>
954 #include <argp.h>
955 #include ELFUTILS_HEADER(dwfl)
956Index: elfutils-0.166/tests/dwflsyms.c
957===================================================================
958--- elfutils-0.166.orig/tests/dwflsyms.c
959+++ elfutils-0.166/tests/dwflsyms.c
960@@ -25,7 +25,7 @@
961 #include <stdio.h>
962 #include <stdio_ext.h>
963 #include <stdlib.h>
964-#include <error.h>
965+#include <err.h>
966 #include <string.h>
967
968 static const char *
969Index: elfutils-0.166/tests/early-offscn.c
970===================================================================
971--- elfutils-0.166.orig/tests/early-offscn.c
972+++ elfutils-0.166/tests/early-offscn.c
973@@ -19,7 +19,7 @@
974 #endif
975
976 #include <errno.h>
977-#include <error.h>
978+#include <err.h>
979 #include <fcntl.h>
980 #include <gelf.h>
981 #include <stdio.h>
982Index: elfutils-0.166/tests/ecp.c
983===================================================================
984--- elfutils-0.166.orig/tests/ecp.c
985+++ elfutils-0.166/tests/ecp.c
986@@ -20,7 +20,7 @@
987 #endif
988
989 #include <errno.h>
990-#include <error.h>
991+#include <err.h>
992 #include <fcntl.h>
993 #include <gelf.h>
994 #include <stdlib.h>
995Index: elfutils-0.166/tests/find-prologues.c
996===================================================================
997--- elfutils-0.166.orig/tests/find-prologues.c
998+++ elfutils-0.166/tests/find-prologues.c
999@@ -25,7 +25,7 @@
1000 #include <stdio_ext.h>
1001 #include <locale.h>
1002 #include <stdlib.h>
1003-#include <error.h>
1004+#include <err.h>
1005 #include <string.h>
1006 #include <fnmatch.h>
1007
1008Index: elfutils-0.166/tests/funcretval.c
1009===================================================================
1010--- elfutils-0.166.orig/tests/funcretval.c
1011+++ elfutils-0.166/tests/funcretval.c
1012@@ -25,7 +25,7 @@
1013 #include <stdio_ext.h>
1014 #include <locale.h>
1015 #include <stdlib.h>
1016-#include <error.h>
1017+#include <err.h>
1018 #include <string.h>
1019 #include <fnmatch.h>
1020
1021Index: elfutils-0.166/tests/funcscopes.c
1022===================================================================
1023--- elfutils-0.166.orig/tests/funcscopes.c
1024+++ elfutils-0.166/tests/funcscopes.c
1025@@ -25,7 +25,7 @@
1026 #include <stdio_ext.h>
1027 #include <locale.h>
1028 #include <stdlib.h>
1029-#include <error.h>
1030+#include <err.h>
1031 #include <string.h>
1032 #include <fnmatch.h>
1033
1034Index: elfutils-0.166/tests/getsrc_die.c
1035===================================================================
1036--- elfutils-0.166.orig/tests/getsrc_die.c
1037+++ elfutils-0.166/tests/getsrc_die.c
1038@@ -19,7 +19,7 @@
1039 #endif
1040
1041 #include <errno.h>
1042-#include <error.h>
1043+#include <err.h>
1044 #include <fcntl.h>
1045 #include <inttypes.h>
1046 #include <libelf.h>
1047Index: elfutils-0.166/tests/line2addr.c
1048===================================================================
1049--- elfutils-0.166.orig/tests/line2addr.c
1050+++ elfutils-0.166/tests/line2addr.c
1051@@ -26,7 +26,7 @@
1052 #include <locale.h>
1053 #include <stdlib.h>
1054 #include <string.h>
1055-#include <error.h>
1056+#include <err.h>
1057
1058
1059 static void
1060Index: elfutils-0.166/tests/low_high_pc.c
1061===================================================================
1062--- elfutils-0.166.orig/tests/low_high_pc.c
1063+++ elfutils-0.166/tests/low_high_pc.c
1064@@ -25,7 +25,7 @@
1065 #include <stdio_ext.h>
1066 #include <locale.h>
1067 #include <stdlib.h>
1068-#include <error.h>
1069+#include <err.h>
1070 #include <string.h>
1071 #include <fnmatch.h>
1072
1073Index: elfutils-0.166/tests/md5-sha1-test.c
1074===================================================================
1075--- elfutils-0.166.orig/tests/md5-sha1-test.c
1076+++ elfutils-0.166/tests/md5-sha1-test.c
1077@@ -19,7 +19,7 @@
1078 #endif
1079
1080 #include <string.h>
1081-#include <error.h>
1082+#include <err.h>
1083
1084 #include "md5.h"
1085 #include "sha1.h"
1086Index: elfutils-0.166/tests/rdwrmmap.c
1087===================================================================
1088--- elfutils-0.166.orig/tests/rdwrmmap.c
1089+++ elfutils-0.166/tests/rdwrmmap.c
1090@@ -19,7 +19,7 @@
1091 #endif
1092
1093 #include <errno.h>
1094-#include <error.h>
1095+#include <err.h>
1096 #include <stdio.h>
1097 #include <fcntl.h>
1098 #include <unistd.h>
1099Index: elfutils-0.166/tests/saridx.c
1100===================================================================
1101--- elfutils-0.166.orig/tests/saridx.c
1102+++ elfutils-0.166/tests/saridx.c
1103@@ -17,7 +17,7 @@
1104
1105 #include <config.h>
1106
1107-#include <error.h>
1108+#include <err.h>
1109 #include <fcntl.h>
1110 #include <gelf.h>
1111 #include <stdio.h>
1112Index: elfutils-0.166/tests/sectiondump.c
1113===================================================================
1114--- elfutils-0.166.orig/tests/sectiondump.c
1115+++ elfutils-0.166/tests/sectiondump.c
1116@@ -18,7 +18,7 @@
1117 #include <config.h>
1118
1119 #include <errno.h>
1120-#include <error.h>
1121+#include <err.h>
1122 #include <fcntl.h>
1123 #include <gelf.h>
1124 #include <inttypes.h>
1125Index: elfutils-0.166/tests/varlocs.c
1126===================================================================
1127--- elfutils-0.166.orig/tests/varlocs.c
1128+++ elfutils-0.166/tests/varlocs.c
1129@@ -25,7 +25,7 @@
1130 #include <dwarf.h>
1131 #include <stdio.h>
1132 #include <stdlib.h>
1133-#include <error.h>
1134+#include <err.h>
1135 #include <string.h>
1136 #include <sys/types.h>
1137 #include <sys/stat.h>
1138Index: elfutils-0.166/tests/vdsosyms.c
1139===================================================================
1140--- elfutils-0.166.orig/tests/vdsosyms.c
1141+++ elfutils-0.166/tests/vdsosyms.c
1142@@ -18,7 +18,7 @@
1143 #include <config.h>
1144 #include <assert.h>
1145 #include <errno.h>
1146-#include <error.h>
1147+#include <err.h>
1148 #include <inttypes.h>
1149 #include <stdio.h>
1150 #include <string.h>
1151Index: elfutils-0.166/libelf/elf_getarsym.c
1152===================================================================
1153--- elfutils-0.166.orig/libelf/elf_getarsym.c
1154+++ elfutils-0.166/libelf/elf_getarsym.c
1155@@ -302,7 +302,7 @@ elf_getarsym (Elf *elf, size_t *ptr)
1156 arsym[cnt].as_off = (*u32)[cnt];
1157
1158 arsym[cnt].as_hash = _dl_elf_hash (str_data);
1159- str_data = rawmemchr (str_data, '\0') + 1;
1160+ str_data = memchr (str_data, '\0', SIZE_MAX) + 1;
1161 }
1162
1163 /* At the end a special entry. */
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.166/0001-elf_getarsym-Silence-Werror-maybe-uninitialized-fals.patch b/meta/recipes-devtools/elfutils/elfutils-0.166/0001-elf_getarsym-Silence-Werror-maybe-uninitialized-fals.patch
new file mode 100644
index 0000000000..3754c1c361
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.166/0001-elf_getarsym-Silence-Werror-maybe-uninitialized-fals.patch
@@ -0,0 +1,35 @@
1From 668accf322fd7185e273bfd50b84320e71d9de5a Mon Sep 17 00:00:00 2001
2From: Martin Jansa <Martin.Jansa@gmail.com>
3Date: Fri, 10 Apr 2015 00:29:18 +0200
4Subject: [PATCH] elf_getarsym: Silence -Werror=maybe-uninitialized false
5 positive
6
7Upstream-Status: Pending
8Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
9---
10 libelf/elf_getarsym.c | 9 +++++++--
11 1 file changed, 7 insertions(+), 2 deletions(-)
12
13diff --git a/libelf/elf_getarsym.c b/libelf/elf_getarsym.c
14index d0bb28a..08954d2 100644
15--- a/libelf/elf_getarsym.c
16+++ b/libelf/elf_getarsym.c
17@@ -165,8 +165,13 @@ elf_getarsym (elf, ptr)
18 int w = index64_p ? 8 : 4;
19
20 /* We have an archive. The first word in there is the number of
21- entries in the table. */
22- uint64_t n;
23+ entries in the table.
24+ Set to SIZE_MAX just to silence -Werror=maybe-uninitialized
25+ elf_getarsym.c:290:9: error: 'n' may be used uninitialized in this function
26+ The read_number_entries function doesn't initialize n only when returning
27+ -1 which in turn ensures to jump over usage of this uninitialized variable.
28+ */
29+ uint64_t n = SIZE_MAX;
30 size_t off = elf->start_offset + SARMAG + sizeof (struct ar_hdr);
31 if (read_number_entries (&n, elf, &off, index64_p) < 0)
32 {
33--
342.3.5
35
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.166/0001-fix-a-stack-usage-warning.patch b/meta/recipes-devtools/elfutils/elfutils-0.166/0001-fix-a-stack-usage-warning.patch
new file mode 100644
index 0000000000..6923bf7053
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.166/0001-fix-a-stack-usage-warning.patch
@@ -0,0 +1,28 @@
1[PATCH] fix a stack-usage warning
2
3Upstream-Status: Pending
4
5not use a variable to as a array size, otherwise the warning to error that
6stack usage might be unbounded [-Werror=stack-usage=] will happen
7
8Signed-off-by: Roy Li <rongqing.li@windriver.com>
9---
10 backends/ppc_initreg.c | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/backends/ppc_initreg.c b/backends/ppc_initreg.c
14index 64f5379..52dde3e 100644
15--- a/backends/ppc_initreg.c
16+++ b/backends/ppc_initreg.c
17@@ -93,7 +93,7 @@ ppc_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
18 return false;
19 }
20 const size_t gprs = sizeof (user_regs.r.gpr) / sizeof (*user_regs.r.gpr);
21- Dwarf_Word dwarf_regs[gprs];
22+ Dwarf_Word dwarf_regs[sizeof (user_regs.r.gpr) / sizeof (*user_regs.r.gpr)];
23 for (unsigned gpr = 0; gpr < gprs; gpr++)
24 dwarf_regs[gpr] = user_regs.r.gpr[gpr];
25 if (! setfunc (0, gprs, dwarf_regs, arg))
26--
271.9.1
28
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.166/0001-remove-the-unneed-checking.patch b/meta/recipes-devtools/elfutils/elfutils-0.166/0001-remove-the-unneed-checking.patch
new file mode 100644
index 0000000000..5be92d705a
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.166/0001-remove-the-unneed-checking.patch
@@ -0,0 +1,38 @@
1Disable the test to convert euc-jp
2
3Remove the test "Test against HP-UX 11.11 bug:
4No converter from EUC-JP to UTF-8 is provided"
5since we don't support HP-UX and if the euc-jp is not
6installed on the host, the dependence will be built without
7iconv support and will cause guild-native building fail.
8
9Upstream-Status: Inappropriate [OE specific]
10
11Signed-off-by: Roy Li <rongqing.li@windriver.com>
12---
13 m4/iconv.m4 | 2 ++
14 1 file changed, 2 insertions(+)
15
16diff --git a/m4/iconv.m4 b/m4/iconv.m4
17index a503646..299f1eb 100644
18--- a/m4/iconv.m4
19+++ b/m4/iconv.m4
20@@ -159,6 +159,7 @@ int main ()
21 }
22 }
23 #endif
24+#if 0
25 /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
26 provided. */
27 if (/* Try standardized names. */
28@@ -170,6 +171,7 @@ int main ()
29 /* Try HP-UX names. */
30 && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
31 result |= 16;
32+#endif
33 return result;
34 }]])],
35 [am_cv_func_iconv_works=yes],
36--
372.0.1
38
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.166/0002-Add-support-for-mips64-abis-in-mips_retval.c.patch b/meta/recipes-devtools/elfutils/elfutils-0.166/0002-Add-support-for-mips64-abis-in-mips_retval.c.patch
new file mode 100644
index 0000000000..72125c9ff0
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.166/0002-Add-support-for-mips64-abis-in-mips_retval.c.patch
@@ -0,0 +1,168 @@
1From fdaab18a65ed2529656baa64cb6169f34d7e507b Mon Sep 17 00:00:00 2001
2From: James Cowgill <james410@cowgill.org.uk>
3Date: Mon, 5 Jan 2015 15:17:01 +0000
4Subject: [PATCH 2/3] Add support for mips64 abis in mips_retval.c
5
6Signed-off-by: James Cowgill <james410@cowgill.org.uk>
7---
8 backends/mips_retval.c | 104 ++++++++++++++++++++++++++++++++++++++++++++-----
9 1 file changed, 94 insertions(+), 10 deletions(-)
10
11diff --git a/backends/mips_retval.c b/backends/mips_retval.c
12index 33f12a7..d5c6ef0 100644
13--- a/backends/mips_retval.c
14+++ b/backends/mips_retval.c
15@@ -91,6 +91,8 @@ enum mips_abi find_mips_abi(Elf *elf)
16 default:
17 if ((elf_flags & EF_MIPS_ABI2))
18 return MIPS_ABI_N32;
19+ else if ((ehdr->e_ident[EI_CLASS] == ELFCLASS64))
20+ return MIPS_ABI_N64;
21 }
22
23 /* GCC creates a pseudo-section whose name describes the ABI. */
24@@ -195,6 +197,57 @@ static const Dwarf_Op loc_aggregate[] =
25 };
26 #define nloc_aggregate 1
27
28+/* Test if a struct member is a float */
29+static int is_float_child(Dwarf_Die *childdie)
30+{
31+ /* Test if this is actually a struct member */
32+ if (dwarf_tag(childdie) != DW_TAG_member)
33+ return 0;
34+
35+ /* Get type of member */
36+ Dwarf_Attribute attr_mem;
37+ Dwarf_Die child_type_mem;
38+ Dwarf_Die *child_typedie =
39+ dwarf_formref_die(dwarf_attr_integrate(childdie,
40+ DW_AT_type,
41+ &attr_mem), &child_type_mem);
42+
43+ if (dwarf_tag(child_typedie) != DW_TAG_base_type)
44+ return 0;
45+
46+ /* Get base subtype */
47+ Dwarf_Word encoding;
48+ if (dwarf_formudata (dwarf_attr_integrate (child_typedie,
49+ DW_AT_encoding,
50+ &attr_mem), &encoding) != 0)
51+ return 0;
52+
53+ return encoding == DW_ATE_float;
54+}
55+
56+/* Returns the number of fpregs which can be returned in the given struct */
57+static int get_struct_fpregs(Dwarf_Die *structtypedie)
58+{
59+ Dwarf_Die child_mem;
60+ int fpregs = 0;
61+
62+ /* Get first structure member */
63+ if (dwarf_child(structtypedie, &child_mem) != 0)
64+ return 0;
65+
66+ do
67+ {
68+ /* Ensure this register is a float */
69+ if (!is_float_child(&child_mem))
70+ return 0;
71+
72+ fpregs++;
73+ }
74+ while (dwarf_siblingof (&child_mem, &child_mem) == 0);
75+
76+ return fpregs;
77+}
78+
79 int
80 mips_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
81 {
82@@ -240,6 +293,7 @@ mips_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
83 tag = dwarf_tag (typedie);
84 }
85
86+ Dwarf_Word size;
87 switch (tag)
88 {
89 case -1:
90@@ -258,8 +312,6 @@ mips_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
91 case DW_TAG_enumeration_type:
92 case DW_TAG_pointer_type:
93 case DW_TAG_ptr_to_member_type:
94- {
95- Dwarf_Word size;
96 if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
97 &attr_mem), &size) != 0)
98 {
99@@ -289,7 +341,7 @@ mips_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
100 if (size <= 4*regsize && abi == MIPS_ABI_O32)
101 return nloc_fpregquad;
102
103- goto aggregate;
104+ goto large;
105 }
106 }
107 *locp = ABI_LOC(loc_intreg, regsize);
108@@ -298,18 +350,50 @@ mips_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
109 if (size <= 2*regsize)
110 return nloc_intregpair;
111
112- /* Else fall through. Shouldn't happen though (at least with gcc) */
113- }
114+ /* Else pass in memory. Shouldn't happen though (at least with gcc) */
115+ goto large;
116
117 case DW_TAG_structure_type:
118 case DW_TAG_class_type:
119 case DW_TAG_union_type:
120- case DW_TAG_array_type:
121- aggregate:
122- /* XXX TODO: Can't handle structure return with other ABI's yet :-/ */
123- if ((abi != MIPS_ABI_O32) && (abi != MIPS_ABI_O64))
124- return -2;
125+ /* Handle special cases for structures <= 128 bytes in newer ABIs */
126+ if (abi == MIPS_ABI_EABI32 || abi == MIPS_ABI_EABI64 ||
127+ abi == MIPS_ABI_N32 || abi == MIPS_ABI_N64)
128+ {
129+ if (dwarf_aggregate_size (typedie, &size) == 0 && size <= 16)
130+ {
131+ /*
132+ * Special case in N64 / N32 -
133+ * structures containing only floats are returned in fp regs.
134+ * Everything else is returned in integer regs.
135+ */
136+ if (tag != DW_TAG_union_type &&
137+ (abi == MIPS_ABI_N32 || abi == MIPS_ABI_N64))
138+ {
139+ int num_fpregs = get_struct_fpregs(typedie);
140+ if (num_fpregs == 1 || num_fpregs == 2)
141+ {
142+ *locp = loc_fpreg;
143+ if (num_fpregs == 1)
144+ return nloc_fpreg;
145+ else
146+ return nloc_fpregpair;
147+ }
148+ }
149+
150+ *locp = loc_intreg;
151+ if (size <= 8)
152+ return nloc_intreg;
153+ else
154+ return nloc_intregpair;
155+ }
156+ }
157+
158+ /* Fallthrough to handle large types */
159
160+ case DW_TAG_array_type:
161+ large:
162+ /* Return large structures in memory */
163 *locp = loc_aggregate;
164 return nloc_aggregate;
165 }
166--
1672.1.4
168
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.166/0003-Add-mips-n64-relocation-format-hack.patch b/meta/recipes-devtools/elfutils/elfutils-0.166/0003-Add-mips-n64-relocation-format-hack.patch
new file mode 100644
index 0000000000..14b7985ce8
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.166/0003-Add-mips-n64-relocation-format-hack.patch
@@ -0,0 +1,226 @@
1From 59d4b8c48e5040af7e02b34eb26ea602ec82a38e Mon Sep 17 00:00:00 2001
2From: James Cowgill <james410@cowgill.org.uk>
3Date: Mon, 5 Jan 2015 15:17:02 +0000
4Subject: [PATCH 3/3] Add mips n64 relocation format hack
5
6MIPSEL N64 ELF files use a slightly different format for storing relocation
7entries which is incompatible with the normal R_SYM / R_INFO macros.
8To workaround this, we rearrange the bytes in the relocation's r_info field
9when reading and writing the relocations.
10
11This patch also ensures that strip.c sets the correct value of e_machine
12before manipulating relocations so that these changes take effect.
13
14Signed-off-by: James Cowgill <james410@cowgill.org.uk>
15---
16 libelf/gelf_getrel.c | 25 +++++++++++++++++++++++--
17 libelf/gelf_getrela.c | 25 +++++++++++++++++++++++--
18 libelf/gelf_update_rel.c | 20 +++++++++++++++++++-
19 libelf/gelf_update_rela.c | 20 +++++++++++++++++++-
20 src/strip.c | 17 +++++++++++++++++
21 5 files changed, 101 insertions(+), 6 deletions(-)
22
23Index: elfutils-0.164/libelf/gelf_getrel.c
24===================================================================
25--- elfutils-0.164.orig/libelf/gelf_getrel.c
26+++ elfutils-0.164/libelf/gelf_getrel.c
27@@ -36,6 +36,7 @@
28
29 #include "libelfP.h"
30
31+#define EF_MIPS_ABI 0x0000F000
32
33 GElf_Rel *
34 gelf_getrel (Elf_Data *data, int ndx, GElf_Rel *dst)
35@@ -89,8 +90,28 @@ gelf_getrel (Elf_Data *data, int ndx, GE
36 result = NULL;
37 }
38 else
39- result = memcpy (dst, &((Elf64_Rel *) data_scn->d.d_buf)[ndx],
40- sizeof (Elf64_Rel));
41+ {
42+ GElf_Ehdr hdr;
43+ result = memcpy (dst, &((Elf64_Rel *) data_scn->d.d_buf)[ndx],
44+ sizeof (Elf64_Rel));
45+
46+ if (gelf_getehdr(scn->elf, &hdr) != NULL &&
47+ hdr.e_ident[EI_DATA] == ELFDATA2LSB &&
48+ hdr.e_machine == EM_MIPS &&
49+ (hdr.e_flags & EF_MIPS_ABI) == 0)
50+ {
51+ /*
52+ * The relocation format is mangled on MIPSEL N64
53+ * We'll adjust it so at least R_SYM will work on it
54+ */
55+ GElf_Xword r_info = dst->r_info;
56+ dst->r_info = (r_info << 32) |
57+ ((r_info >> 8) & 0xFF000000) |
58+ ((r_info >> 24) & 0x00FF0000) |
59+ ((r_info >> 40) & 0x0000FF00) |
60+ ((r_info >> 56) & 0x000000FF);
61+ }
62+ }
63 }
64
65 rwlock_unlock (scn->elf->lock);
66Index: elfutils-0.164/libelf/gelf_getrela.c
67===================================================================
68--- elfutils-0.164.orig/libelf/gelf_getrela.c
69+++ elfutils-0.164/libelf/gelf_getrela.c
70@@ -36,6 +36,7 @@
71
72 #include "libelfP.h"
73
74+#define EF_MIPS_ABI 0x0000F000
75
76 GElf_Rela *
77 gelf_getrela (Elf_Data *data, int ndx, GElf_Rela *dst)
78@@ -90,8 +91,28 @@ gelf_getrela (Elf_Data *data, int ndx, G
79 result = NULL;
80 }
81 else
82- result = memcpy (dst, &((Elf64_Rela *) data_scn->d.d_buf)[ndx],
83- sizeof (Elf64_Rela));
84+ {
85+ GElf_Ehdr hdr;
86+ result = memcpy (dst, &((Elf64_Rela *) data_scn->d.d_buf)[ndx],
87+ sizeof (Elf64_Rela));
88+
89+ if (gelf_getehdr(scn->elf, &hdr) != NULL &&
90+ hdr.e_ident[EI_DATA] == ELFDATA2LSB &&
91+ hdr.e_machine == EM_MIPS &&
92+ (hdr.e_flags & EF_MIPS_ABI) == 0)
93+ {
94+ /*
95+ * The relocation format is mangled on MIPSEL N64
96+ * We'll adjust it so at least R_SYM will work on it
97+ */
98+ GElf_Xword r_info = dst->r_info;
99+ dst->r_info = (r_info << 32) |
100+ ((r_info >> 8) & 0xFF000000) |
101+ ((r_info >> 24) & 0x00FF0000) |
102+ ((r_info >> 40) & 0x0000FF00) |
103+ ((r_info >> 56) & 0x000000FF);
104+ }
105+ }
106 }
107
108 rwlock_unlock (scn->elf->lock);
109Index: elfutils-0.164/libelf/gelf_update_rel.c
110===================================================================
111--- elfutils-0.164.orig/libelf/gelf_update_rel.c
112+++ elfutils-0.164/libelf/gelf_update_rel.c
113@@ -36,6 +36,7 @@
114
115 #include "libelfP.h"
116
117+#define EF_MIPS_ABI 0x0000F000
118
119 int
120 gelf_update_rel (Elf_Data *dst, int ndx, GElf_Rel *src)
121@@ -86,6 +87,9 @@ gelf_update_rel (Elf_Data *dst, int ndx,
122 }
123 else
124 {
125+ GElf_Ehdr hdr;
126+ GElf_Rel value = *src;
127+
128 /* Check whether we have to resize the data buffer. */
129 if (INVALID_NDX (ndx, Elf64_Rel, &data_scn->d))
130 {
131@@ -93,7 +97,21 @@ gelf_update_rel (Elf_Data *dst, int ndx,
132 goto out;
133 }
134
135- ((Elf64_Rel *) data_scn->d.d_buf)[ndx] = *src;
136+ if (gelf_getehdr(scn->elf, &hdr) != NULL &&
137+ hdr.e_ident[EI_DATA] == ELFDATA2LSB &&
138+ hdr.e_machine == EM_MIPS &&
139+ (hdr.e_flags & EF_MIPS_ABI) == 0)
140+ {
141+ /* Undo the MIPSEL N64 hack from gelf_getrel */
142+ GElf_Xword r_info = value.r_info;
143+ value.r_info = (r_info >> 32) |
144+ ((r_info << 8) & 0x000000FF00000000) |
145+ ((r_info << 24) & 0x0000FF0000000000) |
146+ ((r_info << 40) & 0x00FF000000000000) |
147+ ((r_info << 56) & 0xFF00000000000000);
148+ }
149+
150+ ((Elf64_Rel *) data_scn->d.d_buf)[ndx] = value;
151 }
152
153 result = 1;
154Index: elfutils-0.164/libelf/gelf_update_rela.c
155===================================================================
156--- elfutils-0.164.orig/libelf/gelf_update_rela.c
157+++ elfutils-0.164/libelf/gelf_update_rela.c
158@@ -36,6 +36,7 @@
159
160 #include "libelfP.h"
161
162+#define EF_MIPS_ABI 0x0000F000
163
164 int
165 gelf_update_rela (Elf_Data *dst, int ndx, GElf_Rela *src)
166@@ -89,6 +90,9 @@ gelf_update_rela (Elf_Data *dst, int ndx
167 }
168 else
169 {
170+ GElf_Ehdr hdr;
171+ GElf_Rela value = *src;
172+
173 /* Check whether we have to resize the data buffer. */
174 if (INVALID_NDX (ndx, Elf64_Rela, &data_scn->d))
175 {
176@@ -96,7 +100,21 @@ gelf_update_rela (Elf_Data *dst, int ndx
177 goto out;
178 }
179
180- ((Elf64_Rela *) data_scn->d.d_buf)[ndx] = *src;
181+ if (gelf_getehdr(scn->elf, &hdr) != NULL &&
182+ hdr.e_ident[EI_DATA] == ELFDATA2LSB &&
183+ hdr.e_machine == EM_MIPS &&
184+ (hdr.e_flags & EF_MIPS_ABI) == 0)
185+ {
186+ /* Undo the MIPSEL N64 hack from gelf_getrel */
187+ GElf_Xword r_info = value.r_info;
188+ value.r_info = (r_info >> 32) |
189+ ((r_info << 8) & 0x000000FF00000000) |
190+ ((r_info << 24) & 0x0000FF0000000000) |
191+ ((r_info << 40) & 0x00FF000000000000) |
192+ ((r_info << 56) & 0xFF00000000000000);
193+ }
194+
195+ ((Elf64_Rela *) data_scn->d.d_buf)[ndx] = value;
196 }
197
198 result = 1;
199Index: elfutils-0.164/src/strip.c
200===================================================================
201--- elfutils-0.164.orig/src/strip.c
202+++ elfutils-0.164/src/strip.c
203@@ -546,6 +546,23 @@ handle_elf (int fd, Elf *elf, const char
204 goto fail;
205 }
206
207+ /* Copy identity part of the ELF header now */
208+ newehdr = gelf_getehdr (newelf, &newehdr_mem);
209+ if (newehdr == NULL)
210+ INTERNAL_ERROR (fname);
211+
212+ memcpy (newehdr->e_ident, ehdr->e_ident, EI_NIDENT);
213+ newehdr->e_type = ehdr->e_type;
214+ newehdr->e_machine = ehdr->e_machine;
215+ newehdr->e_version = ehdr->e_version;
216+
217+ if (gelf_update_ehdr (newelf, newehdr) == 0)
218+ {
219+ error (0, 0, gettext ("%s: error while creating ELF header: %s"),
220+ fname, elf_errmsg (-1));
221+ return 1;
222+ }
223+
224 /* Copy over the old program header if needed. */
225 if (ehdr->e_type != ET_REL)
226 for (cnt = 0; cnt < phnum; ++cnt)
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.166/aarch64_uio.patch b/meta/recipes-devtools/elfutils/elfutils-0.166/aarch64_uio.patch
new file mode 100644
index 0000000000..38dc57befc
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.166/aarch64_uio.patch
@@ -0,0 +1,47 @@
1Fix build on aarch64/musl
2
3Errors
4
5invalid operands to binary & (have 'long double' and 'unsigned int')
6
7error: redefinition
8 of 'struct iovec'
9 struct iovec { void *iov_base; size_t iov_len; };
10 ^
11Upstream-Status: Pending
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13Index: elfutils-0.163/backends/aarch64_initreg.c
14===================================================================
15--- elfutils-0.163.orig/backends/aarch64_initreg.c
16+++ elfutils-0.163/backends/aarch64_initreg.c
17@@ -33,7 +33,7 @@
18 #include "system.h"
19 #include <assert.h>
20 #ifdef __aarch64__
21-# include <linux/uio.h>
22+# include <sys/uio.h>
23 # include <sys/user.h>
24 # include <sys/ptrace.h>
25 /* Deal with old glibc defining user_pt_regs instead of user_regs_struct. */
26@@ -82,7 +82,7 @@ aarch64_set_initial_registers_tid (pid_t
27
28 Dwarf_Word dwarf_fregs[32];
29 for (int r = 0; r < 32; r++)
30- dwarf_fregs[r] = fregs.vregs[r] & 0xFFFFFFFF;
31+ dwarf_fregs[r] = (unsigned int)fregs.vregs[r] & 0xFFFFFFFF;
32
33 if (! setfunc (64, 32, dwarf_fregs, arg))
34 return false;
35Index: elfutils-0.163/backends/arm_initreg.c
36===================================================================
37--- elfutils-0.163.orig/backends/arm_initreg.c
38+++ elfutils-0.163/backends/arm_initreg.c
39@@ -37,7 +37,7 @@
40 #endif
41
42 #ifdef __aarch64__
43-# include <linux/uio.h>
44+# include <sys/uio.h>
45 # include <sys/user.h>
46 # include <sys/ptrace.h>
47 /* Deal with old glibc defining user_pt_regs instead of user_regs_struct. */
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.166/arm_backend.diff b/meta/recipes-devtools/elfutils/elfutils-0.166/arm_backend.diff
new file mode 100644
index 0000000000..9d47f95f26
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.166/arm_backend.diff
@@ -0,0 +1,600 @@
1Index: elfutils-0.164/backends/arm_init.c
2===================================================================
3--- elfutils-0.164.orig/backends/arm_init.c
4+++ elfutils-0.164/backends/arm_init.c
5@@ -35,20 +35,31 @@
6 #define RELOC_PREFIX R_ARM_
7 #include "libebl_CPU.h"
8
9+#include "libebl_arm.h"
10+
11 /* This defines the common reloc hooks based on arm_reloc.def. */
12 #include "common-reloc.c"
13
14
15 const char *
16-arm_init (Elf *elf __attribute__ ((unused)),
17+arm_init (Elf *elf,
18 GElf_Half machine __attribute__ ((unused)),
19 Ebl *eh,
20 size_t ehlen)
21 {
22+ int soft_float = 0;
23+
24 /* Check whether the Elf_BH object has a sufficent size. */
25 if (ehlen < sizeof (Ebl))
26 return NULL;
27
28+ if (elf) {
29+ GElf_Ehdr ehdr_mem;
30+ GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem);
31+ if (ehdr && (ehdr->e_flags & EF_ARM_SOFT_FLOAT))
32+ soft_float = 1;
33+ }
34+
35 /* We handle it. */
36 eh->name = "ARM";
37 arm_init_reloc (eh);
38@@ -60,7 +71,10 @@ arm_init (Elf *elf __attribute__ ((unuse
39 HOOK (eh, core_note);
40 HOOK (eh, auxv_info);
41 HOOK (eh, check_object_attribute);
42- HOOK (eh, return_value_location);
43+ if (soft_float)
44+ eh->return_value_location = arm_return_value_location_soft;
45+ else
46+ eh->return_value_location = arm_return_value_location_hard;
47 HOOK (eh, abi_cfi);
48 HOOK (eh, check_reloc_target_type);
49 HOOK (eh, symbol_type_name);
50Index: elfutils-0.164/backends/arm_regs.c
51===================================================================
52--- elfutils-0.164.orig/backends/arm_regs.c
53+++ elfutils-0.164/backends/arm_regs.c
54@@ -31,6 +31,7 @@
55 #endif
56
57 #include <string.h>
58+#include <stdio.h>
59 #include <dwarf.h>
60
61 #define BACKEND arm_
62@@ -76,6 +77,9 @@ arm_register_info (Ebl *ebl __attribute_
63 break;
64
65 case 16 + 0 ... 16 + 7:
66+ /* AADWARF says that there are no registers in that range,
67+ * but gcc maps FPA registers here
68+ */
69 regno += 96 - 16;
70 /* Fall through. */
71 case 96 + 0 ... 96 + 7:
72@@ -87,11 +91,139 @@ arm_register_info (Ebl *ebl __attribute_
73 namelen = 2;
74 break;
75
76+ case 64 + 0 ... 64 + 9:
77+ *setname = "VFP";
78+ *bits = 32;
79+ *type = DW_ATE_float;
80+ name[0] = 's';
81+ name[1] = regno - 64 + '0';
82+ namelen = 2;
83+ break;
84+
85+ case 64 + 10 ... 64 + 31:
86+ *setname = "VFP";
87+ *bits = 32;
88+ *type = DW_ATE_float;
89+ name[0] = 's';
90+ name[1] = (regno - 64) / 10 + '0';
91+ name[2] = (regno - 64) % 10 + '0';
92+ namelen = 3;
93+ break;
94+
95+ case 104 + 0 ... 104 + 7:
96+ /* XXX TODO:
97+ * This can be either intel wireless MMX general purpose/control
98+ * registers or xscale accumulator, which have different usage.
99+ * We only have the intel wireless MMX here now.
100+ * The name needs to be changed for the xscale accumulator too. */
101+ *setname = "MMX";
102+ *type = DW_ATE_unsigned;
103+ *bits = 32;
104+ memcpy(name, "wcgr", 4);
105+ name[4] = regno - 104 + '0';
106+ namelen = 5;
107+ break;
108+
109+ case 112 + 0 ... 112 + 9:
110+ *setname = "MMX";
111+ *type = DW_ATE_unsigned;
112+ *bits = 64;
113+ name[0] = 'w';
114+ name[1] = 'r';
115+ name[2] = regno - 112 + '0';
116+ namelen = 3;
117+ break;
118+
119+ case 112 + 10 ... 112 + 15:
120+ *setname = "MMX";
121+ *type = DW_ATE_unsigned;
122+ *bits = 64;
123+ name[0] = 'w';
124+ name[1] = 'r';
125+ name[2] = '1';
126+ name[3] = regno - 112 - 10 + '0';
127+ namelen = 4;
128+ break;
129+
130 case 128:
131+ *setname = "state";
132 *type = DW_ATE_unsigned;
133 return stpcpy (name, "spsr") + 1 - name;
134
135+ case 129:
136+ *setname = "state";
137+ *type = DW_ATE_unsigned;
138+ return stpcpy(name, "spsr_fiq") + 1 - name;
139+
140+ case 130:
141+ *setname = "state";
142+ *type = DW_ATE_unsigned;
143+ return stpcpy(name, "spsr_irq") + 1 - name;
144+
145+ case 131:
146+ *setname = "state";
147+ *type = DW_ATE_unsigned;
148+ return stpcpy(name, "spsr_abt") + 1 - name;
149+
150+ case 132:
151+ *setname = "state";
152+ *type = DW_ATE_unsigned;
153+ return stpcpy(name, "spsr_und") + 1 - name;
154+
155+ case 133:
156+ *setname = "state";
157+ *type = DW_ATE_unsigned;
158+ return stpcpy(name, "spsr_svc") + 1 - name;
159+
160+ case 144 ... 150:
161+ *setname = "integer";
162+ *type = DW_ATE_signed;
163+ *bits = 32;
164+ return sprintf(name, "r%d_usr", regno - 144 + 8) + 1;
165+
166+ case 151 ... 157:
167+ *setname = "integer";
168+ *type = DW_ATE_signed;
169+ *bits = 32;
170+ return sprintf(name, "r%d_fiq", regno - 151 + 8) + 1;
171+
172+ case 158 ... 159:
173+ *setname = "integer";
174+ *type = DW_ATE_signed;
175+ *bits = 32;
176+ return sprintf(name, "r%d_irq", regno - 158 + 13) + 1;
177+
178+ case 160 ... 161:
179+ *setname = "integer";
180+ *type = DW_ATE_signed;
181+ *bits = 32;
182+ return sprintf(name, "r%d_abt", regno - 160 + 13) + 1;
183+
184+ case 162 ... 163:
185+ *setname = "integer";
186+ *type = DW_ATE_signed;
187+ *bits = 32;
188+ return sprintf(name, "r%d_und", regno - 162 + 13) + 1;
189+
190+ case 164 ... 165:
191+ *setname = "integer";
192+ *type = DW_ATE_signed;
193+ *bits = 32;
194+ return sprintf(name, "r%d_svc", regno - 164 + 13) + 1;
195+
196+ case 192 ... 199:
197+ *setname = "MMX";
198+ *bits = 32;
199+ *type = DW_ATE_unsigned;
200+ name[0] = 'w';
201+ name[1] = 'c';
202+ name[2] = regno - 192 + '0';
203+ namelen = 3;
204+ break;
205+
206 case 256 + 0 ... 256 + 9:
207+ /* XXX TODO: Neon also uses those registers and can contain
208+ * both float and integers */
209 *setname = "VFP";
210 *type = DW_ATE_float;
211 *bits = 64;
212Index: elfutils-0.164/backends/arm_retval.c
213===================================================================
214--- elfutils-0.164.orig/backends/arm_retval.c
215+++ elfutils-0.164/backends/arm_retval.c
216@@ -48,6 +48,13 @@ static const Dwarf_Op loc_intreg[] =
217 #define nloc_intreg 1
218 #define nloc_intregs(n) (2 * (n))
219
220+/* f1 */ /* XXX TODO: f0 can also have number 96 if program was compiled with -mabi=aapcs */
221+static const Dwarf_Op loc_fpreg[] =
222+ {
223+ { .atom = DW_OP_reg16 },
224+ };
225+#define nloc_fpreg 1
226+
227 /* The return value is a structure and is actually stored in stack space
228 passed in a hidden argument by the caller. But, the compiler
229 helpfully returns the address of that space in r0. */
230@@ -58,8 +65,9 @@ static const Dwarf_Op loc_aggregate[] =
231 #define nloc_aggregate 1
232
233
234-int
235-arm_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
236+static int
237+arm_return_value_location_ (Dwarf_Die *functypedie, const Dwarf_Op **locp,
238+ int soft_float)
239 {
240 /* Start with the function's type, and get the DW_AT_type attribute,
241 which is the type of the return value. */
242@@ -98,6 +106,21 @@ arm_return_value_location (Dwarf_Die *fu
243 else
244 return -1;
245 }
246+ if (tag == DW_TAG_base_type)
247+ {
248+ Dwarf_Word encoding;
249+ if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding,
250+ &attr_mem), &encoding) != 0)
251+ return -1;
252+
253+ if ((encoding == DW_ATE_float) && !soft_float)
254+ {
255+ *locp = loc_fpreg;
256+ if (size <= 8)
257+ return nloc_fpreg;
258+ goto aggregate;
259+ }
260+ }
261 if (size <= 16)
262 {
263 intreg:
264@@ -106,6 +129,7 @@ arm_return_value_location (Dwarf_Die *fu
265 }
266
267 aggregate:
268+ /* XXX TODO sometimes aggregates are returned in r0 (-mabi=aapcs) */
269 *locp = loc_aggregate;
270 return nloc_aggregate;
271 }
272@@ -125,3 +149,18 @@ arm_return_value_location (Dwarf_Die *fu
273 DWARF and might be valid. */
274 return -2;
275 }
276+
277+/* return location for -mabi=apcs-gnu -msoft-float */
278+int
279+arm_return_value_location_soft (Dwarf_Die *functypedie, const Dwarf_Op **locp)
280+{
281+ return arm_return_value_location_ (functypedie, locp, 1);
282+}
283+
284+/* return location for -mabi=apcs-gnu -mhard-float (current default) */
285+int
286+arm_return_value_location_hard (Dwarf_Die *functypedie, const Dwarf_Op **locp)
287+{
288+ return arm_return_value_location_ (functypedie, locp, 0);
289+}
290+
291Index: elfutils-0.164/libelf/elf.h
292===================================================================
293--- elfutils-0.164.orig/libelf/elf.h
294+++ elfutils-0.164/libelf/elf.h
295@@ -2450,6 +2450,9 @@ enum
296 #define EF_ARM_EABI_VER4 0x04000000
297 #define EF_ARM_EABI_VER5 0x05000000
298
299+/* EI_OSABI values */
300+#define ELFOSABI_ARM_AEABI 64 /* Contains symbol versioning. */
301+
302 /* Additional symbol types for Thumb. */
303 #define STT_ARM_TFUNC STT_LOPROC /* A Thumb function. */
304 #define STT_ARM_16BIT STT_HIPROC /* A Thumb label. */
305@@ -2467,12 +2470,19 @@ enum
306
307 /* Processor specific values for the Phdr p_type field. */
308 #define PT_ARM_EXIDX (PT_LOPROC + 1) /* ARM unwind segment. */
309+#define PT_ARM_UNWIND PT_ARM_EXIDX
310
311 /* Processor specific values for the Shdr sh_type field. */
312 #define SHT_ARM_EXIDX (SHT_LOPROC + 1) /* ARM unwind section. */
313 #define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2) /* Preemption details. */
314 #define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3) /* ARM attributes section. */
315
316+/* Processor specific values for the Dyn d_tag field. */
317+#define DT_ARM_RESERVED1 (DT_LOPROC + 0)
318+#define DT_ARM_SYMTABSZ (DT_LOPROC + 1)
319+#define DT_ARM_PREEMTMAB (DT_LOPROC + 2)
320+#define DT_ARM_RESERVED2 (DT_LOPROC + 3)
321+#define DT_ARM_NUM 4
322
323 /* AArch64 relocs. */
324
325@@ -2765,6 +2775,7 @@ enum
326 TLS block (LDR, STR). */
327 #define R_ARM_TLS_IE12GP 111 /* 12 bit GOT entry relative
328 to GOT origin (LDR). */
329+/* 112 - 127 private range */
330 #define R_ARM_ME_TOO 128 /* Obsolete. */
331 #define R_ARM_THM_TLS_DESCSEQ 129
332 #define R_ARM_THM_TLS_DESCSEQ16 129
333Index: elfutils-0.164/backends/libebl_arm.h
334===================================================================
335--- /dev/null
336+++ elfutils-0.164/backends/libebl_arm.h
337@@ -0,0 +1,9 @@
338+#ifndef _LIBEBL_ARM_H
339+#define _LIBEBL_ARM_H 1
340+
341+#include <libdw.h>
342+
343+extern int arm_return_value_location_soft(Dwarf_Die *, const Dwarf_Op **locp);
344+extern int arm_return_value_location_hard(Dwarf_Die *, const Dwarf_Op **locp);
345+
346+#endif
347Index: elfutils-0.164/tests/run-allregs.sh
348===================================================================
349--- elfutils-0.164.orig/tests/run-allregs.sh
350+++ elfutils-0.164/tests/run-allregs.sh
351@@ -2672,7 +2672,28 @@ integer registers:
352 13: sp (sp), address 32 bits
353 14: lr (lr), address 32 bits
354 15: pc (pc), address 32 bits
355- 128: spsr (spsr), unsigned 32 bits
356+ 144: r8_usr (r8_usr), signed 32 bits
357+ 145: r9_usr (r9_usr), signed 32 bits
358+ 146: r10_usr (r10_usr), signed 32 bits
359+ 147: r11_usr (r11_usr), signed 32 bits
360+ 148: r12_usr (r12_usr), signed 32 bits
361+ 149: r13_usr (r13_usr), signed 32 bits
362+ 150: r14_usr (r14_usr), signed 32 bits
363+ 151: r8_fiq (r8_fiq), signed 32 bits
364+ 152: r9_fiq (r9_fiq), signed 32 bits
365+ 153: r10_fiq (r10_fiq), signed 32 bits
366+ 154: r11_fiq (r11_fiq), signed 32 bits
367+ 155: r12_fiq (r12_fiq), signed 32 bits
368+ 156: r13_fiq (r13_fiq), signed 32 bits
369+ 157: r14_fiq (r14_fiq), signed 32 bits
370+ 158: r13_irq (r13_irq), signed 32 bits
371+ 159: r14_irq (r14_irq), signed 32 bits
372+ 160: r13_abt (r13_abt), signed 32 bits
373+ 161: r14_abt (r14_abt), signed 32 bits
374+ 162: r13_und (r13_und), signed 32 bits
375+ 163: r14_und (r14_und), signed 32 bits
376+ 164: r13_svc (r13_svc), signed 32 bits
377+ 165: r14_svc (r14_svc), signed 32 bits
378 FPA registers:
379 16: f0 (f0), float 96 bits
380 17: f1 (f1), float 96 bits
381@@ -2690,7 +2711,72 @@ FPA registers:
382 101: f5 (f5), float 96 bits
383 102: f6 (f6), float 96 bits
384 103: f7 (f7), float 96 bits
385+MMX registers:
386+ 104: wcgr0 (wcgr0), unsigned 32 bits
387+ 105: wcgr1 (wcgr1), unsigned 32 bits
388+ 106: wcgr2 (wcgr2), unsigned 32 bits
389+ 107: wcgr3 (wcgr3), unsigned 32 bits
390+ 108: wcgr4 (wcgr4), unsigned 32 bits
391+ 109: wcgr5 (wcgr5), unsigned 32 bits
392+ 110: wcgr6 (wcgr6), unsigned 32 bits
393+ 111: wcgr7 (wcgr7), unsigned 32 bits
394+ 112: wr0 (wr0), unsigned 64 bits
395+ 113: wr1 (wr1), unsigned 64 bits
396+ 114: wr2 (wr2), unsigned 64 bits
397+ 115: wr3 (wr3), unsigned 64 bits
398+ 116: wr4 (wr4), unsigned 64 bits
399+ 117: wr5 (wr5), unsigned 64 bits
400+ 118: wr6 (wr6), unsigned 64 bits
401+ 119: wr7 (wr7), unsigned 64 bits
402+ 120: wr8 (wr8), unsigned 64 bits
403+ 121: wr9 (wr9), unsigned 64 bits
404+ 122: wr10 (wr10), unsigned 64 bits
405+ 123: wr11 (wr11), unsigned 64 bits
406+ 124: wr12 (wr12), unsigned 64 bits
407+ 125: wr13 (wr13), unsigned 64 bits
408+ 126: wr14 (wr14), unsigned 64 bits
409+ 127: wr15 (wr15), unsigned 64 bits
410+ 192: wc0 (wc0), unsigned 32 bits
411+ 193: wc1 (wc1), unsigned 32 bits
412+ 194: wc2 (wc2), unsigned 32 bits
413+ 195: wc3 (wc3), unsigned 32 bits
414+ 196: wc4 (wc4), unsigned 32 bits
415+ 197: wc5 (wc5), unsigned 32 bits
416+ 198: wc6 (wc6), unsigned 32 bits
417+ 199: wc7 (wc7), unsigned 32 bits
418 VFP registers:
419+ 64: s0 (s0), float 32 bits
420+ 65: s1 (s1), float 32 bits
421+ 66: s2 (s2), float 32 bits
422+ 67: s3 (s3), float 32 bits
423+ 68: s4 (s4), float 32 bits
424+ 69: s5 (s5), float 32 bits
425+ 70: s6 (s6), float 32 bits
426+ 71: s7 (s7), float 32 bits
427+ 72: s8 (s8), float 32 bits
428+ 73: s9 (s9), float 32 bits
429+ 74: s10 (s10), float 32 bits
430+ 75: s11 (s11), float 32 bits
431+ 76: s12 (s12), float 32 bits
432+ 77: s13 (s13), float 32 bits
433+ 78: s14 (s14), float 32 bits
434+ 79: s15 (s15), float 32 bits
435+ 80: s16 (s16), float 32 bits
436+ 81: s17 (s17), float 32 bits
437+ 82: s18 (s18), float 32 bits
438+ 83: s19 (s19), float 32 bits
439+ 84: s20 (s20), float 32 bits
440+ 85: s21 (s21), float 32 bits
441+ 86: s22 (s22), float 32 bits
442+ 87: s23 (s23), float 32 bits
443+ 88: s24 (s24), float 32 bits
444+ 89: s25 (s25), float 32 bits
445+ 90: s26 (s26), float 32 bits
446+ 91: s27 (s27), float 32 bits
447+ 92: s28 (s28), float 32 bits
448+ 93: s29 (s29), float 32 bits
449+ 94: s30 (s30), float 32 bits
450+ 95: s31 (s31), float 32 bits
451 256: d0 (d0), float 64 bits
452 257: d1 (d1), float 64 bits
453 258: d2 (d2), float 64 bits
454@@ -2723,6 +2809,13 @@ VFP registers:
455 285: d29 (d29), float 64 bits
456 286: d30 (d30), float 64 bits
457 287: d31 (d31), float 64 bits
458+state registers:
459+ 128: spsr (spsr), unsigned 32 bits
460+ 129: spsr_fiq (spsr_fiq), unsigned 32 bits
461+ 130: spsr_irq (spsr_irq), unsigned 32 bits
462+ 131: spsr_abt (spsr_abt), unsigned 32 bits
463+ 132: spsr_und (spsr_und), unsigned 32 bits
464+ 133: spsr_svc (spsr_svc), unsigned 32 bits
465 EOF
466
467 # See run-readelf-mixed-corenote.sh for instructions to regenerate
468Index: elfutils-0.164/tests/run-readelf-mixed-corenote.sh
469===================================================================
470--- elfutils-0.164.orig/tests/run-readelf-mixed-corenote.sh
471+++ elfutils-0.164/tests/run-readelf-mixed-corenote.sh
472@@ -31,12 +31,11 @@ Note segment of 892 bytes at offset 0x27
473 pid: 11087, ppid: 11063, pgrp: 11087, sid: 11063
474 utime: 0.000000, stime: 0.010000, cutime: 0.000000, cstime: 0.000000
475 orig_r0: -1, fpvalid: 1
476- r0: 1 r1: -1091672508 r2: -1091672500
477- r3: 0 r4: 0 r5: 0
478- r6: 33728 r7: 0 r8: 0
479- r9: 0 r10: -1225703496 r11: -1091672844
480- r12: 0 sp: 0xbeee64f4 lr: 0xb6dc3f48
481- pc: 0x00008500 spsr: 0x60000010
482+ r0: 1 r1: -1091672508 r2: -1091672500 r3: 0
483+ r4: 0 r5: 0 r6: 33728 r7: 0
484+ r8: 0 r9: 0 r10: -1225703496 r11: -1091672844
485+ r12: 0 sp: 0xbeee64f4 lr: 0xb6dc3f48 pc: 0x00008500
486+ spsr: 0x60000010
487 CORE 124 PRPSINFO
488 state: 0, sname: R, zomb: 0, nice: 0, flag: 0x00400500
489 uid: 0, gid: 0, pid: 11087, ppid: 11063, pgrp: 11087, sid: 11063
490Index: elfutils-0.164/tests/run-addrcfi.sh
491===================================================================
492--- elfutils-0.164.orig/tests/run-addrcfi.sh
493+++ elfutils-0.164/tests/run-addrcfi.sh
494@@ -3554,6 +3554,38 @@ dwarf_cfi_addrframe (.eh_frame): no matc
495 FPA reg21 (f5): undefined
496 FPA reg22 (f6): undefined
497 FPA reg23 (f7): undefined
498+ VFP reg64 (s0): undefined
499+ VFP reg65 (s1): undefined
500+ VFP reg66 (s2): undefined
501+ VFP reg67 (s3): undefined
502+ VFP reg68 (s4): undefined
503+ VFP reg69 (s5): undefined
504+ VFP reg70 (s6): undefined
505+ VFP reg71 (s7): undefined
506+ VFP reg72 (s8): undefined
507+ VFP reg73 (s9): undefined
508+ VFP reg74 (s10): undefined
509+ VFP reg75 (s11): undefined
510+ VFP reg76 (s12): undefined
511+ VFP reg77 (s13): undefined
512+ VFP reg78 (s14): undefined
513+ VFP reg79 (s15): undefined
514+ VFP reg80 (s16): undefined
515+ VFP reg81 (s17): undefined
516+ VFP reg82 (s18): undefined
517+ VFP reg83 (s19): undefined
518+ VFP reg84 (s20): undefined
519+ VFP reg85 (s21): undefined
520+ VFP reg86 (s22): undefined
521+ VFP reg87 (s23): undefined
522+ VFP reg88 (s24): undefined
523+ VFP reg89 (s25): undefined
524+ VFP reg90 (s26): undefined
525+ VFP reg91 (s27): undefined
526+ VFP reg92 (s28): undefined
527+ VFP reg93 (s29): undefined
528+ VFP reg94 (s30): undefined
529+ VFP reg95 (s31): undefined
530 FPA reg96 (f0): undefined
531 FPA reg97 (f1): undefined
532 FPA reg98 (f2): undefined
533@@ -3562,7 +3594,66 @@ dwarf_cfi_addrframe (.eh_frame): no matc
534 FPA reg101 (f5): undefined
535 FPA reg102 (f6): undefined
536 FPA reg103 (f7): undefined
537- integer reg128 (spsr): undefined
538+ MMX reg104 (wcgr0): undefined
539+ MMX reg105 (wcgr1): undefined
540+ MMX reg106 (wcgr2): undefined
541+ MMX reg107 (wcgr3): undefined
542+ MMX reg108 (wcgr4): undefined
543+ MMX reg109 (wcgr5): undefined
544+ MMX reg110 (wcgr6): undefined
545+ MMX reg111 (wcgr7): undefined
546+ MMX reg112 (wr0): undefined
547+ MMX reg113 (wr1): undefined
548+ MMX reg114 (wr2): undefined
549+ MMX reg115 (wr3): undefined
550+ MMX reg116 (wr4): undefined
551+ MMX reg117 (wr5): undefined
552+ MMX reg118 (wr6): undefined
553+ MMX reg119 (wr7): undefined
554+ MMX reg120 (wr8): undefined
555+ MMX reg121 (wr9): undefined
556+ MMX reg122 (wr10): undefined
557+ MMX reg123 (wr11): undefined
558+ MMX reg124 (wr12): undefined
559+ MMX reg125 (wr13): undefined
560+ MMX reg126 (wr14): undefined
561+ MMX reg127 (wr15): undefined
562+ state reg128 (spsr): undefined
563+ state reg129 (spsr_fiq): undefined
564+ state reg130 (spsr_irq): undefined
565+ state reg131 (spsr_abt): undefined
566+ state reg132 (spsr_und): undefined
567+ state reg133 (spsr_svc): undefined
568+ integer reg144 (r8_usr): undefined
569+ integer reg145 (r9_usr): undefined
570+ integer reg146 (r10_usr): undefined
571+ integer reg147 (r11_usr): undefined
572+ integer reg148 (r12_usr): undefined
573+ integer reg149 (r13_usr): undefined
574+ integer reg150 (r14_usr): undefined
575+ integer reg151 (r8_fiq): undefined
576+ integer reg152 (r9_fiq): undefined
577+ integer reg153 (r10_fiq): undefined
578+ integer reg154 (r11_fiq): undefined
579+ integer reg155 (r12_fiq): undefined
580+ integer reg156 (r13_fiq): undefined
581+ integer reg157 (r14_fiq): undefined
582+ integer reg158 (r13_irq): undefined
583+ integer reg159 (r14_irq): undefined
584+ integer reg160 (r13_abt): undefined
585+ integer reg161 (r14_abt): undefined
586+ integer reg162 (r13_und): undefined
587+ integer reg163 (r14_und): undefined
588+ integer reg164 (r13_svc): undefined
589+ integer reg165 (r14_svc): undefined
590+ MMX reg192 (wc0): undefined
591+ MMX reg193 (wc1): undefined
592+ MMX reg194 (wc2): undefined
593+ MMX reg195 (wc3): undefined
594+ MMX reg196 (wc4): undefined
595+ MMX reg197 (wc5): undefined
596+ MMX reg198 (wc6): undefined
597+ MMX reg199 (wc7): undefined
598 VFP reg256 (d0): undefined
599 VFP reg257 (d1): undefined
600 VFP reg258 (d2): undefined
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.166/elfcmp-fix-self-comparision.patch b/meta/recipes-devtools/elfutils/elfutils-0.166/elfcmp-fix-self-comparision.patch
new file mode 100644
index 0000000000..6c150bb54c
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.166/elfcmp-fix-self-comparision.patch
@@ -0,0 +1,41 @@
1From 836a16fe5b5bab4a3afe2c991c104652775ce3a3 Mon Sep 17 00:00:00 2001
2From: David Abdurachmanov <davidlt@cern.ch>
3Date: Mon, 11 Apr 2016 16:00:57 +0200
4Subject: elfcmp: fix self-comparison error with GCC 6
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Noticed with Fedora 24 Alpha, gcc (GCC) 6.0.0 20160406
10(Red Hat 6.0.0-0.20).
11
12elfcmp.c: In function ‘main’:
13elfcmp.c:364:199: error: self-comparison always evaluates
14to false [-Werror=tautological-compare]
15 if (unlikely (name1 == NULL || name2 == NULL
16
17Signed-off-by: David Abdurachmanov <davidlt@cern.ch>
18---
19
20Upstream-Status: Backport
21
22 src/ChangeLog | 4 ++++
23 src/elfcmp.c | 2 +-
24 2 files changed, 5 insertions(+), 1 deletion(-)
25
26diff --git a/src/elfcmp.c b/src/elfcmp.c
27index 852b92f..7b5d39c 100644
28--- a/src/elfcmp.c
29+++ b/src/elfcmp.c
30@@ -368,7 +368,7 @@ main (int argc, char *argv[])
31 && sym1->st_shndx != SHN_UNDEF)
32 || sym1->st_info != sym2->st_info
33 || sym1->st_other != sym2->st_other
34- || sym1->st_shndx != sym1->st_shndx))
35+ || sym1->st_shndx != sym2->st_shndx))
36 {
37 // XXX Do we want to allow reordered symbol tables?
38 symtab_mismatch:
39--
40cgit v0.12
41
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.166/fixheadercheck.patch b/meta/recipes-devtools/elfutils/elfutils-0.166/fixheadercheck.patch
new file mode 100644
index 0000000000..5de3b24c85
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.166/fixheadercheck.patch
@@ -0,0 +1,23 @@
1For some binaries we can get a invalid section alignment, for example if
2sh_align = 1 and sh_addralign is 0. In the case of a zero size section like
3".note.GNU-stack", this is irrelavent as far as I can tell and we shouldn't
4error in this case.
5
6RP 2014/6/11
7
8Upstream-Status: Pending
9
10diff --git a/libelf/elf32_updatenull.c b/libelf/elf32_updatenull.c
11--- a/libelf/elf32_updatenull.c
12+++ b/libelf/elf32_updatenull.c
13@@ -339,8 +339,8 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum)
14 we test for the alignment of the section being large
15 enough for the largest alignment required by a data
16 block. */
17- if (unlikely (! powerof2 (shdr->sh_addralign))
18- || unlikely ((shdr->sh_addralign ?: 1) < sh_align))
19+ if (shdr->sh_size && (unlikely (! powerof2 (shdr->sh_addralign))
20+ || unlikely ((shdr->sh_addralign ?: 1) < sh_align)))
21 {
22 __libelf_seterrno (ELF_E_INVALID_ALIGN);
23 return -1;
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.166/hppa_backend.diff b/meta/recipes-devtools/elfutils/elfutils-0.166/hppa_backend.diff
new file mode 100644
index 0000000000..45456715a3
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.166/hppa_backend.diff
@@ -0,0 +1,799 @@
1Index: elfutils-0.164/backends/parisc_init.c
2===================================================================
3--- /dev/null
4+++ elfutils-0.164/backends/parisc_init.c
5@@ -0,0 +1,73 @@
6+/* Initialization of PA-RISC specific backend library.
7+ Copyright (C) 2002, 2005, 2006 Red Hat, Inc.
8+ This file is part of Red Hat elfutils.
9+ Written by Ulrich Drepper <drepper@redhat.com>, 2002.
10+
11+ Red Hat elfutils is free software; you can redistribute it and/or modify
12+ it under the terms of the GNU General Public License as published by the
13+ Free Software Foundation; version 2 of the License.
14+
15+ Red Hat elfutils is distributed in the hope that it will be useful, but
16+ WITHOUT ANY WARRANTY; without even the implied warranty of
17+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18+ General Public License for more details.
19+
20+ You should have received a copy of the GNU General Public License along
21+ with Red Hat elfutils; if not, write to the Free Software Foundation,
22+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
23+
24+ Red Hat elfutils is an included package of the Open Invention Network.
25+ An included package of the Open Invention Network is a package for which
26+ Open Invention Network licensees cross-license their patents. No patent
27+ license is granted, either expressly or impliedly, by designation as an
28+ included package. Should you wish to participate in the Open Invention
29+ Network licensing program, please visit www.openinventionnetwork.com
30+ <http://www.openinventionnetwork.com>. */
31+
32+#ifdef HAVE_CONFIG_H
33+# include <config.h>
34+#endif
35+
36+#define BACKEND parisc_
37+#define RELOC_PREFIX R_PARISC_
38+#include "libebl_CPU.h"
39+#include "libebl_parisc.h"
40+
41+/* This defines the common reloc hooks based on parisc_reloc.def. */
42+#include "common-reloc.c"
43+
44+
45+const char *
46+parisc_init (Elf *elf __attribute__ ((unused)),
47+ GElf_Half machine __attribute__ ((unused)),
48+ Ebl *eh,
49+ size_t ehlen)
50+{
51+ int pa64 = 0;
52+
53+ /* Check whether the Elf_BH object has a sufficent size. */
54+ if (ehlen < sizeof (Ebl))
55+ return NULL;
56+
57+ if (elf) {
58+ GElf_Ehdr ehdr_mem;
59+ GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem);
60+ if (ehdr && (ehdr->e_flags & EF_PARISC_WIDE))
61+ pa64 = 1;
62+ }
63+ /* We handle it. */
64+ eh->name = "PA-RISC";
65+ parisc_init_reloc (eh);
66+ HOOK (eh, reloc_simple_type);
67+ HOOK (eh, machine_flag_check);
68+ HOOK (eh, symbol_type_name);
69+ HOOK (eh, segment_type_name);
70+ HOOK (eh, section_type_name);
71+ HOOK (eh, register_info);
72+ if (pa64)
73+ eh->return_value_location = parisc_return_value_location_64;
74+ else
75+ eh->return_value_location = parisc_return_value_location_32;
76+
77+ return MODVERSION;
78+}
79Index: elfutils-0.164/backends/parisc_regs.c
80===================================================================
81--- /dev/null
82+++ elfutils-0.164/backends/parisc_regs.c
83@@ -0,0 +1,159 @@
84+/* Register names and numbers for PA-RISC DWARF.
85+ Copyright (C) 2005, 2006 Red Hat, Inc.
86+ This file is part of Red Hat elfutils.
87+
88+ Red Hat elfutils is free software; you can redistribute it and/or modify
89+ it under the terms of the GNU General Public License as published by the
90+ Free Software Foundation; version 2 of the License.
91+
92+ Red Hat elfutils is distributed in the hope that it will be useful, but
93+ WITHOUT ANY WARRANTY; without even the implied warranty of
94+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
95+ General Public License for more details.
96+
97+ You should have received a copy of the GNU General Public License along
98+ with Red Hat elfutils; if not, write to the Free Software Foundation,
99+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
100+
101+ Red Hat elfutils is an included package of the Open Invention Network.
102+ An included package of the Open Invention Network is a package for which
103+ Open Invention Network licensees cross-license their patents. No patent
104+ license is granted, either expressly or impliedly, by designation as an
105+ included package. Should you wish to participate in the Open Invention
106+ Network licensing program, please visit www.openinventionnetwork.com
107+ <http://www.openinventionnetwork.com>. */
108+
109+#ifdef HAVE_CONFIG_H
110+# include <config.h>
111+#endif
112+
113+#include <string.h>
114+#include <dwarf.h>
115+
116+#define BACKEND parisc_
117+#include "libebl_CPU.h"
118+
119+ssize_t
120+parisc_register_info (Ebl *ebl, int regno, char *name, size_t namelen,
121+ const char **prefix, const char **setname,
122+ int *bits, int *type)
123+{
124+ int pa64 = 0;
125+
126+ if (ebl->elf) {
127+ GElf_Ehdr ehdr_mem;
128+ GElf_Ehdr *ehdr = gelf_getehdr (ebl->elf, &ehdr_mem);
129+ if (ehdr->e_flags & EF_PARISC_WIDE)
130+ pa64 = 1;
131+ }
132+
133+ int nregs = pa64 ? 127 : 128;
134+
135+ if (name == NULL)
136+ return nregs;
137+
138+ if (regno < 0 || regno >= nregs || namelen < 6)
139+ return -1;
140+
141+ *prefix = "%";
142+
143+ if (regno < 32)
144+ {
145+ *setname = "integer";
146+ *type = DW_ATE_signed;
147+ if (pa64)
148+ {
149+ *bits = 64;
150+ }
151+ else
152+ {
153+ *bits = 32;
154+ }
155+ }
156+ else if (regno == 32)
157+ {
158+ *setname = "special";
159+ if (pa64)
160+ {
161+ *bits = 6;
162+ }
163+ else
164+ {
165+ *bits = 5;
166+ }
167+ *type = DW_ATE_unsigned;
168+ }
169+ else
170+ {
171+ *setname = "FPU";
172+ *type = DW_ATE_float;
173+ if (pa64)
174+ {
175+ *bits = 64;
176+ }
177+ else
178+ {
179+ *bits = 32;
180+ }
181+ }
182+
183+ if (regno < 33) {
184+ switch (regno)
185+ {
186+ case 0 ... 9:
187+ name[0] = 'r';
188+ name[1] = regno + '0';
189+ namelen = 2;
190+ break;
191+ case 10 ... 31:
192+ name[0] = 'r';
193+ name[1] = regno / 10 + '0';
194+ name[2] = regno % 10 + '0';
195+ namelen = 3;
196+ break;
197+ case 32:
198+ *prefix = NULL;
199+ name[0] = 'S';
200+ name[1] = 'A';
201+ name[2] = 'R';
202+ namelen = 3;
203+ break;
204+ }
205+ }
206+ else {
207+ if (pa64 && ((regno - 72) % 2)) {
208+ *setname = NULL;
209+ return 0;
210+ }
211+
212+ switch (regno)
213+ {
214+ case 72 + 0 ... 72 + 11:
215+ name[0] = 'f';
216+ name[1] = 'r';
217+ name[2] = (regno + 8 - 72) / 2 + '0';
218+ namelen = 3;
219+ if ((regno + 8 - 72) % 2) {
220+ name[3] = 'R';
221+ namelen++;
222+ }
223+ break;
224+ case 72 + 12 ... 72 + 55:
225+ name[0] = 'f';
226+ name[1] = 'r';
227+ name[2] = (regno + 8 - 72) / 2 / 10 + '0';
228+ name[3] = (regno + 8 - 72) / 2 % 10 + '0';
229+ namelen = 4;
230+ if ((regno + 8 - 72) % 2) {
231+ name[4] = 'R';
232+ namelen++;
233+ }
234+ break;
235+ default:
236+ *setname = NULL;
237+ return 0;
238+ }
239+ }
240+ name[namelen++] = '\0';
241+ return namelen;
242+}
243Index: elfutils-0.164/backends/parisc_reloc.def
244===================================================================
245--- /dev/null
246+++ elfutils-0.164/backends/parisc_reloc.def
247@@ -0,0 +1,128 @@
248+/* List the relocation types for PA-RISC. -*- C -*-
249+ Copyright (C) 2005 Red Hat, Inc.
250+ This file is part of Red Hat elfutils.
251+
252+ Red Hat elfutils is free software; you can redistribute it and/or modify
253+ it under the terms of the GNU General Public License as published by the
254+ Free Software Foundation; version 2 of the License.
255+
256+ Red Hat elfutils is distributed in the hope that it will be useful, but
257+ WITHOUT ANY WARRANTY; without even the implied warranty of
258+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
259+ General Public License for more details.
260+
261+ You should have received a copy of the GNU General Public License along
262+ with Red Hat elfutils; if not, write to the Free Software Foundation,
263+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
264+
265+ Red Hat elfutils is an included package of the Open Invention Network.
266+ An included package of the Open Invention Network is a package for which
267+ Open Invention Network licensees cross-license their patents. No patent
268+ license is granted, either expressly or impliedly, by designation as an
269+ included package. Should you wish to participate in the Open Invention
270+ Network licensing program, please visit www.openinventionnetwork.com
271+ <http://www.openinventionnetwork.com>. */
272+
273+/* NAME, REL|EXEC|DYN */
274+
275+RELOC_TYPE (NONE, EXEC|DYN)
276+RELOC_TYPE (DIR32, REL|EXEC|DYN)
277+RELOC_TYPE (DIR21L, REL|EXEC|DYN)
278+RELOC_TYPE (DIR17R, REL)
279+RELOC_TYPE (DIR17F, REL)
280+RELOC_TYPE (DIR14R, REL|DYN)
281+RELOC_TYPE (PCREL32, REL)
282+RELOC_TYPE (PCREL21L, REL)
283+RELOC_TYPE (PCREL17R, REL)
284+RELOC_TYPE (PCREL17F, REL)
285+RELOC_TYPE (PCREL14R, REL|EXEC)
286+RELOC_TYPE (DPREL21L, REL)
287+RELOC_TYPE (DPREL14WR, REL)
288+RELOC_TYPE (DPREL14DR, REL)
289+RELOC_TYPE (DPREL14R, REL)
290+RELOC_TYPE (GPREL21L, 0)
291+RELOC_TYPE (GPREL14R, 0)
292+RELOC_TYPE (LTOFF21L, REL)
293+RELOC_TYPE (LTOFF14R, REL)
294+RELOC_TYPE (DLTIND14F, 0)
295+RELOC_TYPE (SETBASE, 0)
296+RELOC_TYPE (SECREL32, REL)
297+RELOC_TYPE (BASEREL21L, 0)
298+RELOC_TYPE (BASEREL17R, 0)
299+RELOC_TYPE (BASEREL14R, 0)
300+RELOC_TYPE (SEGBASE, 0)
301+RELOC_TYPE (SEGREL32, REL)
302+RELOC_TYPE (PLTOFF21L, 0)
303+RELOC_TYPE (PLTOFF14R, 0)
304+RELOC_TYPE (PLTOFF14F, 0)
305+RELOC_TYPE (LTOFF_FPTR32, 0)
306+RELOC_TYPE (LTOFF_FPTR21L, 0)
307+RELOC_TYPE (LTOFF_FPTR14R, 0)
308+RELOC_TYPE (FPTR64, 0)
309+RELOC_TYPE (PLABEL32, REL|DYN)
310+RELOC_TYPE (PCREL64, 0)
311+RELOC_TYPE (PCREL22C, 0)
312+RELOC_TYPE (PCREL22F, 0)
313+RELOC_TYPE (PCREL14WR, 0)
314+RELOC_TYPE (PCREL14DR, 0)
315+RELOC_TYPE (PCREL16F, 0)
316+RELOC_TYPE (PCREL16WF, 0)
317+RELOC_TYPE (PCREL16DF, 0)
318+RELOC_TYPE (DIR64, REL|DYN)
319+RELOC_TYPE (DIR14WR, REL)
320+RELOC_TYPE (DIR14DR, REL)
321+RELOC_TYPE (DIR16F, REL)
322+RELOC_TYPE (DIR16WF, REL)
323+RELOC_TYPE (DIR16DF, REL)
324+RELOC_TYPE (GPREL64, 0)
325+RELOC_TYPE (GPREL14WR, 0)
326+RELOC_TYPE (GPREL14DR, 0)
327+RELOC_TYPE (GPREL16F, 0)
328+RELOC_TYPE (GPREL16WF, 0)
329+RELOC_TYPE (GPREL16DF, 0)
330+RELOC_TYPE (LTOFF64, 0)
331+RELOC_TYPE (LTOFF14WR, 0)
332+RELOC_TYPE (LTOFF14DR, 0)
333+RELOC_TYPE (LTOFF16F, 0)
334+RELOC_TYPE (LTOFF16WF, 0)
335+RELOC_TYPE (LTOFF16DF, 0)
336+RELOC_TYPE (SECREL64, 0)
337+RELOC_TYPE (BASEREL14WR, 0)
338+RELOC_TYPE (BASEREL14DR, 0)
339+RELOC_TYPE (SEGREL64, 0)
340+RELOC_TYPE (PLTOFF14WR, 0)
341+RELOC_TYPE (PLTOFF14DR, 0)
342+RELOC_TYPE (PLTOFF16F, 0)
343+RELOC_TYPE (PLTOFF16WF, 0)
344+RELOC_TYPE (PLTOFF16DF, 0)
345+RELOC_TYPE (LTOFF_FPTR64, 0)
346+RELOC_TYPE (LTOFF_FPTR14WR, 0)
347+RELOC_TYPE (LTOFF_FPTR14DR, 0)
348+RELOC_TYPE (LTOFF_FPTR16F, 0)
349+RELOC_TYPE (LTOFF_FPTR16WF, 0)
350+RELOC_TYPE (LTOFF_FPTR16DF, 0)
351+RELOC_TYPE (COPY, EXEC)
352+RELOC_TYPE (IPLT, EXEC|DYN)
353+RELOC_TYPE (EPLT, 0)
354+RELOC_TYPE (TPREL32, DYN)
355+RELOC_TYPE (TPREL21L, 0)
356+RELOC_TYPE (TPREL14R, 0)
357+RELOC_TYPE (LTOFF_TP21L, 0)
358+RELOC_TYPE (LTOFF_TP14R, 0)
359+RELOC_TYPE (LTOFF_TP14F, 0)
360+RELOC_TYPE (TPREL64, 0)
361+RELOC_TYPE (TPREL14WR, 0)
362+RELOC_TYPE (TPREL14DR, 0)
363+RELOC_TYPE (TPREL16F, 0)
364+RELOC_TYPE (TPREL16WF, 0)
365+RELOC_TYPE (TPREL16DF, 0)
366+RELOC_TYPE (LTOFF_TP64, 0)
367+RELOC_TYPE (LTOFF_TP14WR, 0)
368+RELOC_TYPE (LTOFF_TP14DR, 0)
369+RELOC_TYPE (LTOFF_TP16F, 0)
370+RELOC_TYPE (LTOFF_TP16WF, 0)
371+RELOC_TYPE (LTOFF_TP16DF, 0)
372+RELOC_TYPE (TLS_DTPMOD32, DYN)
373+RELOC_TYPE (TLS_DTPMOD64, DYN)
374+
375+#define NO_RELATIVE_RELOC 1
376Index: elfutils-0.164/backends/parisc_retval.c
377===================================================================
378--- /dev/null
379+++ elfutils-0.164/backends/parisc_retval.c
380@@ -0,0 +1,213 @@
381+/* Function return value location for Linux/PA-RISC ABI.
382+ Copyright (C) 2005 Red Hat, Inc.
383+ This file is part of Red Hat elfutils.
384+
385+ Red Hat elfutils is free software; you can redistribute it and/or modify
386+ it under the terms of the GNU General Public License as published by the
387+ Free Software Foundation; version 2 of the License.
388+
389+ Red Hat elfutils is distributed in the hope that it will be useful, but
390+ WITHOUT ANY WARRANTY; without even the implied warranty of
391+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
392+ General Public License for more details.
393+
394+ You should have received a copy of the GNU General Public License along
395+ with Red Hat elfutils; if not, write to the Free Software Foundation,
396+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
397+
398+ Red Hat elfutils is an included package of the Open Invention Network.
399+ An included package of the Open Invention Network is a package for which
400+ Open Invention Network licensees cross-license their patents. No patent
401+ license is granted, either expressly or impliedly, by designation as an
402+ included package. Should you wish to participate in the Open Invention
403+ Network licensing program, please visit www.openinventionnetwork.com
404+ <http://www.openinventionnetwork.com>. */
405+
406+#ifdef HAVE_CONFIG_H
407+# include <config.h>
408+#endif
409+
410+#include <assert.h>
411+#include <dwarf.h>
412+
413+#define BACKEND parisc_
414+#include "libebl_CPU.h"
415+#include "libebl_parisc.h"
416+
417+/* %r28, or pair %r28, %r29. */
418+static const Dwarf_Op loc_intreg32[] =
419+ {
420+ { .atom = DW_OP_reg28 }, { .atom = DW_OP_piece, .number = 4 },
421+ { .atom = DW_OP_reg29 }, { .atom = DW_OP_piece, .number = 4 },
422+ };
423+
424+static const Dwarf_Op loc_intreg[] =
425+ {
426+ { .atom = DW_OP_reg28 }, { .atom = DW_OP_piece, .number = 8 },
427+ { .atom = DW_OP_reg29 }, { .atom = DW_OP_piece, .number = 8 },
428+ };
429+#define nloc_intreg 1
430+#define nloc_intregpair 4
431+
432+/* %fr4L, or pair %fr4L, %fr4R on pa-32 */
433+static const Dwarf_Op loc_fpreg32[] =
434+ {
435+ { .atom = DW_OP_regx, .number = 72 }, { .atom = DW_OP_piece, .number = 4 },
436+ { .atom = DW_OP_regx, .number = 73 }, { .atom = DW_OP_piece, .number = 4 },
437+ };
438+#define nloc_fpreg32 2
439+#define nloc_fpregpair32 4
440+
441+/* $fr4 */
442+static const Dwarf_Op loc_fpreg[] =
443+ {
444+ { .atom = DW_OP_regx, .number = 72 },
445+ };
446+#define nloc_fpreg 1
447+
448+#if 0
449+/* The return value is a structure and is actually stored in stack space
450+ passed in a hidden argument by the caller. Address of the location is stored
451+ in %r28 before function call, but it may be changed by function. */
452+static const Dwarf_Op loc_aggregate[] =
453+ {
454+ { .atom = DW_OP_breg28 },
455+ };
456+#define nloc_aggregate 1
457+#endif
458+
459+static int
460+parisc_return_value_location_ (Dwarf_Die *functypedie, const Dwarf_Op **locp, int pa64)
461+{
462+ Dwarf_Word regsize = pa64 ? 8 : 4;
463+
464+ /* Start with the function's type, and get the DW_AT_type attribute,
465+ which is the type of the return value. */
466+
467+ Dwarf_Attribute attr_mem;
468+ Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, &attr_mem);
469+ if (attr == NULL)
470+ /* The function has no return value, like a `void' function in C. */
471+ return 0;
472+
473+ Dwarf_Die die_mem;
474+ Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem);
475+ int tag = dwarf_tag (typedie);
476+
477+ /* Follow typedefs and qualifiers to get to the actual type. */
478+ while (tag == DW_TAG_typedef
479+ || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type
480+ || tag == DW_TAG_restrict_type)
481+ {
482+ attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
483+ typedie = dwarf_formref_die (attr, &die_mem);
484+ tag = dwarf_tag (typedie);
485+ }
486+
487+ switch (tag)
488+ {
489+ case -1:
490+ return -1;
491+
492+ case DW_TAG_subrange_type:
493+ if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size))
494+ {
495+ attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
496+ typedie = dwarf_formref_die (attr, &die_mem);
497+ tag = dwarf_tag (typedie);
498+ }
499+ /* Fall through. */
500+
501+ case DW_TAG_base_type:
502+ case DW_TAG_enumeration_type:
503+ case DW_TAG_pointer_type:
504+ case DW_TAG_ptr_to_member_type:
505+ {
506+ Dwarf_Word size;
507+ if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
508+ &attr_mem), &size) != 0)
509+ {
510+ if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
511+ size = 4;
512+ else
513+ return -1;
514+ }
515+ if (tag == DW_TAG_base_type)
516+ {
517+ Dwarf_Word encoding;
518+ if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding,
519+ &attr_mem), &encoding) != 0)
520+ return -1;
521+
522+ if (encoding == DW_ATE_float)
523+ {
524+ if (pa64) {
525+ *locp = loc_fpreg;
526+ if (size <= 8)
527+ return nloc_fpreg;
528+ }
529+ else {
530+ *locp = loc_fpreg32;
531+ if (size <= 4)
532+ return nloc_fpreg32;
533+ else if (size <= 8)
534+ return nloc_fpregpair32;
535+ }
536+ goto aggregate;
537+ }
538+ }
539+ if (pa64)
540+ *locp = loc_intreg;
541+ else
542+ *locp = loc_intreg32;
543+ if (size <= regsize)
544+ return nloc_intreg;
545+ if (size <= 2 * regsize)
546+ return nloc_intregpair;
547+
548+ /* Else fall through. */
549+ }
550+
551+ case DW_TAG_structure_type:
552+ case DW_TAG_class_type:
553+ case DW_TAG_union_type:
554+ case DW_TAG_array_type:
555+ aggregate: {
556+ Dwarf_Word size;
557+ if (dwarf_aggregate_size (typedie, &size) != 0)
558+ return -1;
559+ if (pa64)
560+ *locp = loc_intreg;
561+ else
562+ *locp = loc_intreg32;
563+ if (size <= regsize)
564+ return nloc_intreg;
565+ if (size <= 2 * regsize)
566+ return nloc_intregpair;
567+#if 0
568+ /* there should be some way to know this location... But I do not see it. */
569+ *locp = loc_aggregate;
570+ return nloc_aggregate;
571+#endif
572+ /* fall through. */
573+ }
574+ }
575+
576+ /* XXX We don't have a good way to return specific errors from ebl calls.
577+ This value means we do not understand the type, but it is well-formed
578+ DWARF and might be valid. */
579+ return -2;
580+}
581+
582+int
583+parisc_return_value_location_32 (Dwarf_Die *functypedie, const Dwarf_Op **locp)
584+{
585+ return parisc_return_value_location_ (functypedie, locp, 0);
586+}
587+
588+int
589+parisc_return_value_location_64 (Dwarf_Die *functypedie, const Dwarf_Op **locp)
590+{
591+ return parisc_return_value_location_ (functypedie, locp, 1);
592+}
593+
594Index: elfutils-0.164/backends/parisc_symbol.c
595===================================================================
596--- /dev/null
597+++ elfutils-0.164/backends/parisc_symbol.c
598@@ -0,0 +1,112 @@
599+/* PA-RISC specific symbolic name handling.
600+ Copyright (C) 2002, 2005 Red Hat, Inc.
601+ This file is part of Red Hat elfutils.
602+ Written by Ulrich Drepper <drepper@redhat.com>, 2002.
603+
604+ Red Hat elfutils is free software; you can redistribute it and/or modify
605+ it under the terms of the GNU General Public License as published by the
606+ Free Software Foundation; version 2 of the License.
607+
608+ Red Hat elfutils is distributed in the hope that it will be useful, but
609+ WITHOUT ANY WARRANTY; without even the implied warranty of
610+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
611+ General Public License for more details.
612+
613+ You should have received a copy of the GNU General Public License along
614+ with Red Hat elfutils; if not, write to the Free Software Foundation,
615+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
616+
617+ Red Hat elfutils is an included package of the Open Invention Network.
618+ An included package of the Open Invention Network is a package for which
619+ Open Invention Network licensees cross-license their patents. No patent
620+ license is granted, either expressly or impliedly, by designation as an
621+ included package. Should you wish to participate in the Open Invention
622+ Network licensing program, please visit www.openinventionnetwork.com
623+ <http://www.openinventionnetwork.com>. */
624+
625+#ifdef HAVE_CONFIG_H
626+# include <config.h>
627+#endif
628+
629+#include <elf.h>
630+#include <stddef.h>
631+
632+#define BACKEND parisc_
633+#include "libebl_CPU.h"
634+
635+const char *
636+parisc_segment_type_name (int segment, char *buf __attribute__ ((unused)),
637+ size_t len __attribute__ ((unused)))
638+{
639+ switch (segment)
640+ {
641+ case PT_PARISC_ARCHEXT:
642+ return "PARISC_ARCHEXT";
643+ case PT_PARISC_UNWIND:
644+ return "PARISC_UNWIND";
645+ default:
646+ break;
647+ }
648+ return NULL;
649+}
650+
651+/* Return symbolic representation of symbol type. */
652+const char *
653+parisc_symbol_type_name(int symbol, char *buf __attribute__ ((unused)),
654+ size_t len __attribute__ ((unused)))
655+{
656+ if (symbol == STT_PARISC_MILLICODE)
657+ return "PARISC_MILLI";
658+ return NULL;
659+}
660+
661+/* Return symbolic representation of section type. */
662+const char *
663+parisc_section_type_name (int type,
664+ char *buf __attribute__ ((unused)),
665+ size_t len __attribute__ ((unused)))
666+{
667+ switch (type)
668+ {
669+ case SHT_PARISC_EXT:
670+ return "PARISC_EXT";
671+ case SHT_PARISC_UNWIND:
672+ return "PARISC_UNWIND";
673+ case SHT_PARISC_DOC:
674+ return "PARISC_DOC";
675+ }
676+
677+ return NULL;
678+}
679+
680+/* Check whether machine flags are valid. */
681+bool
682+parisc_machine_flag_check (GElf_Word flags)
683+{
684+ if (flags &~ (EF_PARISC_TRAPNIL | EF_PARISC_EXT | EF_PARISC_LSB |
685+ EF_PARISC_WIDE | EF_PARISC_NO_KABP |
686+ EF_PARISC_LAZYSWAP | EF_PARISC_ARCH))
687+ return 0;
688+
689+ GElf_Word arch = flags & EF_PARISC_ARCH;
690+
691+ return ((arch == EFA_PARISC_1_0) || (arch == EFA_PARISC_1_1) ||
692+ (arch == EFA_PARISC_2_0));
693+}
694+
695+/* Check for the simple reloc types. */
696+Elf_Type
697+parisc_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
698+{
699+ switch (type)
700+ {
701+ case R_PARISC_DIR64:
702+ case R_PARISC_SECREL64:
703+ return ELF_T_XWORD;
704+ case R_PARISC_DIR32:
705+ case R_PARISC_SECREL32:
706+ return ELF_T_WORD;
707+ default:
708+ return ELF_T_NUM;
709+ }
710+}
711Index: elfutils-0.164/backends/libebl_parisc.h
712===================================================================
713--- /dev/null
714+++ elfutils-0.164/backends/libebl_parisc.h
715@@ -0,0 +1,9 @@
716+#ifndef _LIBEBL_HPPA_H
717+#define _LIBEBL_HPPA_H 1
718+
719+#include <libdw.h>
720+
721+extern int parisc_return_value_location_32(Dwarf_Die *, const Dwarf_Op **locp);
722+extern int parisc_return_value_location_64(Dwarf_Die *, const Dwarf_Op **locp);
723+
724+#endif
725Index: elfutils-0.164/backends/Makefile.am
726===================================================================
727--- elfutils-0.164.orig/backends/Makefile.am
728+++ elfutils-0.164/backends/Makefile.am
729@@ -33,11 +33,12 @@ AM_CPPFLAGS += -I$(top_srcdir)/libebl -I
730
731
732 modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \
733- tilegx
734+ tilegx parisc
735 libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a \
736 libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a \
737 libebl_aarch64_pic.a libebl_sparc_pic.a libebl_ppc_pic.a \
738- libebl_ppc64_pic.a libebl_s390_pic.a libebl_tilegx_pic.a
739+ libebl_ppc64_pic.a libebl_s390_pic.a libebl_tilegx_pic.a \
740+ libebl_parisc_pic.a
741 noinst_LIBRARIES = $(libebl_pic)
742 noinst_DATA = $(libebl_pic:_pic.a=.so)
743
744@@ -111,6 +112,9 @@ tilegx_SRCS = tilegx_init.c tilegx_symbo
745 libebl_tilegx_pic_a_SOURCES = $(tilegx_SRCS)
746 am_libebl_tilegx_pic_a_OBJECTS = $(tilegx_SRCS:.c=.os)
747
748+parisc_SRCS = parisc_init.c parisc_symbol.c parisc_regs.c parisc_retval.c
749+libebl_parisc_pic_a_SOURCES = $(parisc_SRCS)
750+am_libebl_parisc_pic_a_OBJECTS = $(parisc_SRCS:.c=.os)
751
752 libebl_%.so libebl_%.map: libebl_%_pic.a $(libelf) $(libdw)
753 @rm -f $(@:.so=.map)
754Index: elfutils-0.164/libelf/elf.h
755===================================================================
756--- elfutils-0.164.orig/libelf/elf.h
757+++ elfutils-0.164/libelf/elf.h
758@@ -1912,16 +1912,24 @@ enum
759 #define R_PARISC_PCREL17F 12 /* 17 bits of rel. address. */
760 #define R_PARISC_PCREL14R 14 /* Right 14 bits of rel. address. */
761 #define R_PARISC_DPREL21L 18 /* Left 21 bits of rel. address. */
762+#define R_PARISC_DPREL14WR 19
763+#define R_PARISC_DPREL14DR 20
764 #define R_PARISC_DPREL14R 22 /* Right 14 bits of rel. address. */
765 #define R_PARISC_GPREL21L 26 /* GP-relative, left 21 bits. */
766 #define R_PARISC_GPREL14R 30 /* GP-relative, right 14 bits. */
767 #define R_PARISC_LTOFF21L 34 /* LT-relative, left 21 bits. */
768 #define R_PARISC_LTOFF14R 38 /* LT-relative, right 14 bits. */
769+#define R_PARISC_DLTIND14F 39
770+#define R_PARISC_SETBASE 40
771 #define R_PARISC_SECREL32 41 /* 32 bits section rel. address. */
772+#define R_PARISC_BASEREL21L 42
773+#define R_PARISC_BASEREL17R 43
774+#define R_PARISC_BASEREL14R 46
775 #define R_PARISC_SEGBASE 48 /* No relocation, set segment base. */
776 #define R_PARISC_SEGREL32 49 /* 32 bits segment rel. address. */
777 #define R_PARISC_PLTOFF21L 50 /* PLT rel. address, left 21 bits. */
778 #define R_PARISC_PLTOFF14R 54 /* PLT rel. address, right 14 bits. */
779+#define R_PARISC_PLTOFF14F 55
780 #define R_PARISC_LTOFF_FPTR32 57 /* 32 bits LT-rel. function pointer. */
781 #define R_PARISC_LTOFF_FPTR21L 58 /* LT-rel. fct ptr, left 21 bits. */
782 #define R_PARISC_LTOFF_FPTR14R 62 /* LT-rel. fct ptr, right 14 bits. */
783@@ -1930,6 +1938,7 @@ enum
784 #define R_PARISC_PLABEL21L 66 /* Left 21 bits of fdesc address. */
785 #define R_PARISC_PLABEL14R 70 /* Right 14 bits of fdesc address. */
786 #define R_PARISC_PCREL64 72 /* 64 bits PC-rel. address. */
787+#define R_PARISC_PCREL22C 73
788 #define R_PARISC_PCREL22F 74 /* 22 bits PC-rel. address. */
789 #define R_PARISC_PCREL14WR 75 /* PC-rel. address, right 14 bits. */
790 #define R_PARISC_PCREL14DR 76 /* PC rel. address, right 14 bits. */
791@@ -1955,6 +1964,8 @@ enum
792 #define R_PARISC_LTOFF16WF 102 /* 16 bits LT-rel. address. */
793 #define R_PARISC_LTOFF16DF 103 /* 16 bits LT-rel. address. */
794 #define R_PARISC_SECREL64 104 /* 64 bits section rel. address. */
795+#define R_PARISC_BASEREL14WR 107
796+#define R_PARISC_BASEREL14DR 108
797 #define R_PARISC_SEGREL64 112 /* 64 bits segment rel. address. */
798 #define R_PARISC_PLTOFF14WR 115 /* PLT-rel. address, right 14 bits. */
799 #define R_PARISC_PLTOFF14DR 116 /* PLT-rel. address, right 14 bits. */
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.166/kfreebsd_path.patch b/meta/recipes-devtools/elfutils/elfutils-0.166/kfreebsd_path.patch
new file mode 100644
index 0000000000..ba454ee77c
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.166/kfreebsd_path.patch
@@ -0,0 +1,15 @@
1--- elfutils/tests/run-native-test.sh.orig
2+++ elfutils/tests/run-native-test.sh
3@@ -78,6 +78,12 @@
4 test $native -eq 0 || testrun "$@" -p $native > /dev/null
5 }
6
7+# On the Debian buildds, GNU/kFreeBSD linprocfs /proc/$PID/maps does
8+# not give absolute paths due to sbuild's bind mounts (bug #570805)
9+# therefore the next two test programs are expected to fail with
10+# "cannot attach to process: Function not implemented".
11+[ "$(uname)" = "GNU/kFreeBSD" ] && exit 77
12+
13 native_test ${abs_builddir}/allregs
14 native_test ${abs_builddir}/funcretval
15
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.166/m68k_backend.diff b/meta/recipes-devtools/elfutils/elfutils-0.166/m68k_backend.diff
new file mode 100644
index 0000000000..d73855b601
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.166/m68k_backend.diff
@@ -0,0 +1,492 @@
1From: Kurt Roeckx <kurt@roeckx.be>
2From: Thorsten Glaser <tg@mirbsd.de>
3Subject: m68k support
4
5Written by Kurt Roeckx, except for the retval support which was written
6by Thorsten Glaser
7
8
9Index: elfutils-0.164/backends/m68k_init.c
10===================================================================
11--- /dev/null
12+++ elfutils-0.164/backends/m68k_init.c
13@@ -0,0 +1,49 @@
14+/* Initialization of m68k specific backend library.
15+ Copyright (C) 2007 Kurt Roeckx <kurt@roeckx.be>
16+
17+ This software is free software; you can redistribute it and/or modify
18+ it under the terms of the GNU General Public License as published by the
19+ Free Software Foundation; version 2 of the License.
20+
21+ This softare is distributed in the hope that it will be useful, but
22+ WITHOUT ANY WARRANTY; without even the implied warranty of
23+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24+ General Public License for more details.
25+
26+ You should have received a copy of the GNU General Public License along
27+ with this software; if not, write to the Free Software Foundation,
28+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
29+
30+*/
31+
32+#ifdef HAVE_CONFIG_H
33+# include <config.h>
34+#endif
35+
36+#define BACKEND m68k_
37+#define RELOC_PREFIX R_68K_
38+#include "libebl_CPU.h"
39+
40+/* This defines the common reloc hooks based on m68k_reloc.def. */
41+#include "common-reloc.c"
42+
43+
44+const char *
45+m68k_init (Elf *elf __attribute__ ((unused)),
46+ GElf_Half machine __attribute__ ((unused)),
47+ Ebl *eh,
48+ size_t ehlen)
49+{
50+ /* Check whether the Elf_BH object has a sufficent size. */
51+ if (ehlen < sizeof (Ebl))
52+ return NULL;
53+
54+ /* We handle it. */
55+ eh->name = "m68k";
56+ m68k_init_reloc (eh);
57+ HOOK (eh, reloc_simple_type);
58+ HOOK (eh, return_value_location);
59+ HOOK (eh, register_info);
60+
61+ return MODVERSION;
62+}
63Index: elfutils-0.164/backends/m68k_regs.c
64===================================================================
65--- /dev/null
66+++ elfutils-0.164/backends/m68k_regs.c
67@@ -0,0 +1,106 @@
68+/* Register names and numbers for m68k DWARF.
69+ Copyright (C) 2007 Kurt Roeckx <kurt@roeckx.be>
70+
71+ This software is free software; you can redistribute it and/or modify
72+ it under the terms of the GNU General Public License as published by the
73+ Free Software Foundation; version 2 of the License.
74+
75+ This software is distributed in the hope that it will be useful, but
76+ WITHOUT ANY WARRANTY; without even the implied warranty of
77+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
78+ General Public License for more details.
79+
80+ You should have received a copy of the GNU General Public License along
81+ with this software; if not, write to the Free Software Foundation,
82+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
83+
84+ */
85+
86+#ifdef HAVE_CONFIG_H
87+# include <config.h>
88+#endif
89+
90+#include <string.h>
91+#include <dwarf.h>
92+
93+#define BACKEND m68k_
94+#include "libebl_CPU.h"
95+
96+ssize_t
97+m68k_register_info (Ebl *ebl __attribute__ ((unused)),
98+ int regno, char *name, size_t namelen,
99+ const char **prefix, const char **setname,
100+ int *bits, int *type)
101+{
102+ if (name == NULL)
103+ return 25;
104+
105+ if (regno < 0 || regno > 24 || namelen < 5)
106+ return -1;
107+
108+ *prefix = "%";
109+ *bits = 32;
110+ *type = (regno < 8 ? DW_ATE_signed
111+ : regno < 16 ? DW_ATE_address : DW_ATE_float);
112+
113+ if (regno < 8)
114+ {
115+ *setname = "integer";
116+ }
117+ else if (regno < 16)
118+ {
119+ *setname = "address";
120+ }
121+ else if (regno < 24)
122+ {
123+ *setname = "FPU";
124+ }
125+ else
126+ {
127+ *setname = "address";
128+ *type = DW_ATE_address;
129+ }
130+
131+ switch (regno)
132+ {
133+ case 0 ... 7:
134+ name[0] = 'd';
135+ name[1] = regno + '0';
136+ namelen = 2;
137+ break;
138+
139+ case 8 ... 13:
140+ name[0] = 'a';
141+ name[1] = regno - 8 + '0';
142+ namelen = 2;
143+ break;
144+
145+ case 14:
146+ name[0] = 'f';
147+ name[1] = 'p';
148+ namelen = 2;
149+ break;
150+
151+ case 15:
152+ name[0] = 's';
153+ name[1] = 'p';
154+ namelen = 2;
155+ break;
156+
157+ case 16 ... 23:
158+ name[0] = 'f';
159+ name[1] = 'p';
160+ name[2] = regno - 16 + '0';
161+ namelen = 3;
162+ break;
163+
164+ case 24:
165+ name[0] = 'p';
166+ name[1] = 'c';
167+ namelen = 2;
168+ }
169+
170+ name[namelen++] = '\0';
171+ return namelen;
172+}
173+
174Index: elfutils-0.164/backends/m68k_reloc.def
175===================================================================
176--- /dev/null
177+++ elfutils-0.164/backends/m68k_reloc.def
178@@ -0,0 +1,45 @@
179+/* List the relocation types for m68k. -*- C -*-
180+ Copyright (C) 2007 Kurt Roeckx <kurt@roeckx.be>
181+
182+ This software is free software; you can redistribute it and/or modify
183+ it under the terms of the GNU General Public License as published by the
184+ Free Software Foundation; version 2 of the License.
185+
186+ This software is distributed in the hope that it will be useful, but
187+ WITHOUT ANY WARRANTY; without even the implied warranty of
188+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
189+ General Public License for more details.
190+
191+ You should have received a copy of the GNU General Public License along
192+ with this software; if not, write to the Free Software Foundation,
193+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
194+*/
195+
196+/* NAME, REL|EXEC|DYN */
197+
198+RELOC_TYPE (NONE, 0)
199+RELOC_TYPE (32, REL|EXEC|DYN)
200+RELOC_TYPE (16, REL)
201+RELOC_TYPE (8, REL)
202+RELOC_TYPE (PC32, REL|EXEC|DYN)
203+RELOC_TYPE (PC16, REL)
204+RELOC_TYPE (PC8, REL)
205+RELOC_TYPE (GOT32, REL)
206+RELOC_TYPE (GOT16, REL)
207+RELOC_TYPE (GOT8, REL)
208+RELOC_TYPE (GOT32O, REL)
209+RELOC_TYPE (GOT16O, REL)
210+RELOC_TYPE (GOT8O, REL)
211+RELOC_TYPE (PLT32, REL)
212+RELOC_TYPE (PLT16, REL)
213+RELOC_TYPE (PLT8, REL)
214+RELOC_TYPE (PLT32O, REL)
215+RELOC_TYPE (PLT16O, REL)
216+RELOC_TYPE (PLT8O, REL)
217+RELOC_TYPE (COPY, EXEC)
218+RELOC_TYPE (GLOB_DAT, EXEC|DYN)
219+RELOC_TYPE (JMP_SLOT, EXEC|DYN)
220+RELOC_TYPE (RELATIVE, EXEC|DYN)
221+RELOC_TYPE (GNU_VTINHERIT, REL)
222+RELOC_TYPE (GNU_VTENTRY, REL)
223+
224Index: elfutils-0.164/libelf/elf.h
225===================================================================
226--- elfutils-0.164.orig/libelf/elf.h
227+++ elfutils-0.164/libelf/elf.h
228@@ -1158,6 +1158,9 @@ typedef struct
229 #define R_68K_GLOB_DAT 20 /* Create GOT entry */
230 #define R_68K_JMP_SLOT 21 /* Create PLT entry */
231 #define R_68K_RELATIVE 22 /* Adjust by program base */
232+/* The next 2 are GNU extensions to enable C++ vtable garbage collection. */
233+#define R_68K_GNU_VTINHERIT 23
234+#define R_68K_GNU_VTENTRY 24
235 #define R_68K_TLS_GD32 25 /* 32 bit GOT offset for GD */
236 #define R_68K_TLS_GD16 26 /* 16 bit GOT offset for GD */
237 #define R_68K_TLS_GD8 27 /* 8 bit GOT offset for GD */
238Index: elfutils-0.164/backends/Makefile.am
239===================================================================
240--- elfutils-0.164.orig/backends/Makefile.am
241+++ elfutils-0.164/backends/Makefile.am
242@@ -33,12 +33,12 @@ AM_CPPFLAGS += -I$(top_srcdir)/libebl -I
243
244
245 modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \
246- tilegx parisc mips
247+ tilegx parisc mips m68k
248 libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a \
249 libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a \
250 libebl_aarch64_pic.a libebl_sparc_pic.a libebl_ppc_pic.a \
251 libebl_ppc64_pic.a libebl_s390_pic.a libebl_tilegx_pic.a \
252- libebl_parisc_pic.a libebl_mips_pic.a
253+ libebl_parisc_pic.a libebl_mips_pic.a libebl_m68k_pic.a
254 noinst_LIBRARIES = $(libebl_pic)
255 noinst_DATA = $(libebl_pic:_pic.a=.so)
256
257@@ -120,6 +120,10 @@ mips_SRCS = mips_init.c mips_symbol.c mi
258 libebl_mips_pic_a_SOURCES = $(mips_SRCS)
259 am_libebl_mips_pic_a_OBJECTS = $(mips_SRCS:.c=.os)
260
261+m68k_SRCS = m68k_init.c m68k_symbol.c m68k_regs.c m68k_retval.c
262+libebl_m68k_pic_a_SOURCES = $(m68k_SRCS)
263+am_libebl_m68k_pic_a_OBJECTS = $(m68k_SRCS:.c=.os)
264+
265 libebl_%.so libebl_%.map: libebl_%_pic.a $(libelf) $(libdw)
266 @rm -f $(@:.so=.map)
267 $(AM_V_at)echo 'ELFUTILS_$(PACKAGE_VERSION) { global: $*_init; local: *; };' \
268Index: elfutils-0.164/backends/m68k_symbol.c
269===================================================================
270--- /dev/null
271+++ elfutils-0.164/backends/m68k_symbol.c
272@@ -0,0 +1,43 @@
273+/* m68k specific symbolic name handling.
274+ Copyright (C) 2007 Kurt Roeckx <kurt@roeckx.be>
275+
276+ This software is free software; you can redistribute it and/or modify
277+ it under the terms of the GNU General Public License as published by the
278+ Free Software Foundation; version 2 of the License.
279+
280+ This software distributed in the hope that it will be useful, but
281+ WITHOUT ANY WARRANTY; without even the implied warranty of
282+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
283+ General Public License for more details.
284+
285+ You should have received a copy of the GNU General Public License along
286+ with this software; if not, write to the Free Software Foundation,
287+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
288+*/
289+
290+#ifdef HAVE_CONFIG_H
291+# include <config.h>
292+#endif
293+
294+#include <elf.h>
295+#include <stddef.h>
296+
297+#define BACKEND m68k_
298+#include "libebl_CPU.h"
299+
300+/* Check for the simple reloc types. */
301+Elf_Type
302+m68k_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
303+{
304+ switch (type)
305+ {
306+ case R_68K_32:
307+ return ELF_T_SWORD;
308+ case R_68K_16:
309+ return ELF_T_HALF;
310+ case R_68K_8:
311+ return ELF_T_BYTE;
312+ default:
313+ return ELF_T_NUM;
314+ }
315+}
316Index: elfutils-0.164/backends/m68k_retval.c
317===================================================================
318--- /dev/null
319+++ elfutils-0.164/backends/m68k_retval.c
320@@ -0,0 +1,172 @@
321+/* Function return value location for Linux/m68k ABI.
322+ Copyright (C) 2005-2010 Red Hat, Inc.
323+ Copyright (c) 2011 Thorsten Glaser, Debian.
324+ This file is part of Red Hat elfutils.
325+
326+ Red Hat elfutils is free software; you can redistribute it and/or modify
327+ it under the terms of the GNU General Public License as published by the
328+ Free Software Foundation; version 2 of the License.
329+
330+ Red Hat elfutils is distributed in the hope that it will be useful, but
331+ WITHOUT ANY WARRANTY; without even the implied warranty of
332+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
333+ General Public License for more details.
334+
335+ You should have received a copy of the GNU General Public License along
336+ with Red Hat elfutils; if not, write to the Free Software Foundation,
337+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
338+
339+ Red Hat elfutils is an included package of the Open Invention Network.
340+ An included package of the Open Invention Network is a package for which
341+ Open Invention Network licensees cross-license their patents. No patent
342+ license is granted, either expressly or impliedly, by designation as an
343+ included package. Should you wish to participate in the Open Invention
344+ Network licensing program, please visit www.openinventionnetwork.com
345+ <http://www.openinventionnetwork.com>. */
346+
347+#ifdef HAVE_CONFIG_H
348+# include <config.h>
349+#endif
350+
351+#include <assert.h>
352+#include <dwarf.h>
353+
354+#define BACKEND m68k_
355+#include "libebl_CPU.h"
356+
357+
358+/* %d0, or pair %d0, %d1, or %a0 */
359+static const Dwarf_Op loc_intreg[] =
360+ {
361+ { .atom = DW_OP_reg0 }, { .atom = DW_OP_piece, .number = 4 },
362+ { .atom = DW_OP_reg1 }, { .atom = DW_OP_piece, .number = 4 },
363+ };
364+static const Dwarf_Op loc_ptrreg[] =
365+ {
366+ { .atom = DW_OP_reg8 },
367+ };
368+#define nloc_intreg 1
369+#define nloc_intregpair 4
370+#define nloc_ptrreg 1
371+
372+/* %f0 */
373+static const Dwarf_Op loc_fpreg[] =
374+ {
375+ { .atom = DW_OP_reg16 }
376+ };
377+#define nloc_fpreg 1
378+
379+/* Structures are a bit more complicated - small structures are returned
380+ in %d0 / %d1 (-freg-struct-return which is enabled by default), large
381+ structures use %a1 (in constrast to the SYSV psABI which says %a0) as
382+ reentrant storage space indicator. */
383+static const Dwarf_Op loc_aggregate[] =
384+ {
385+ { .atom = DW_OP_breg9, .number = 0 }
386+ };
387+#define nloc_aggregate 1
388+
389+int
390+m68k_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
391+{
392+ Dwarf_Word size;
393+
394+ /* Start with the function's type, and get the DW_AT_type attribute,
395+ which is the type of the return value. */
396+
397+ Dwarf_Attribute attr_mem;
398+ Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type,
399+ &attr_mem);
400+ if (attr == NULL)
401+ /* The function has no return value, like a `void' function in C. */
402+ return 0;
403+
404+ Dwarf_Die die_mem;
405+ Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem);
406+ int tag = dwarf_tag (typedie);
407+
408+ /* Follow typedefs and qualifiers to get to the actual type. */
409+ while (tag == DW_TAG_typedef
410+ || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type
411+ || tag == DW_TAG_restrict_type)
412+ {
413+ attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
414+ typedie = dwarf_formref_die (attr, &die_mem);
415+ tag = dwarf_tag (typedie);
416+ }
417+
418+ switch (tag)
419+ {
420+ case -1:
421+ return -1;
422+
423+ case DW_TAG_subrange_type:
424+ if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size))
425+ {
426+ attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
427+ typedie = dwarf_formref_die (attr, &die_mem);
428+ tag = dwarf_tag (typedie);
429+ }
430+ /* Fall through. */
431+
432+ case DW_TAG_base_type:
433+ case DW_TAG_enumeration_type:
434+ case DW_TAG_pointer_type:
435+ case DW_TAG_ptr_to_member_type:
436+ if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
437+ &attr_mem), &size) != 0)
438+ {
439+ if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
440+ size = 4;
441+ else
442+ return -1;
443+ }
444+ if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
445+ {
446+ *locp = loc_ptrreg;
447+ return nloc_ptrreg;
448+ }
449+ if (tag == DW_TAG_base_type)
450+ {
451+ Dwarf_Word encoding;
452+ if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding,
453+ &attr_mem),
454+ &encoding) != 0)
455+ return -1;
456+ if (encoding == DW_ATE_float)
457+ {
458+ /* XXX really 10? */
459+ if (size > 10)
460+ return -2;
461+ *locp = loc_fpreg;
462+ return nloc_fpreg;
463+ }
464+ }
465+ if (size <= 8)
466+ {
467+ intreg:
468+ /* XXX check endianness of dword pair, int64 vs aggregate */
469+ *locp = loc_intreg;
470+ return size <= 4 ? nloc_intreg : nloc_intregpair;
471+ }
472+
473+ aggregate:
474+ *locp = loc_aggregate;
475+ return nloc_aggregate;
476+
477+ case DW_TAG_structure_type:
478+ case DW_TAG_class_type:
479+ case DW_TAG_union_type:
480+ case DW_TAG_array_type:
481+ if (dwarf_aggregate_size (typedie, &size) == 0
482+ && size > 0 && size <= 8)
483+ /* not accurate for a struct whose only member is a float */
484+ goto intreg;
485+ goto aggregate;
486+ }
487+
488+ /* XXX We don't have a good way to return specific errors from ebl calls.
489+ This value means we do not understand the type, but it is well-formed
490+ DWARF and might be valid. */
491+ return -2;
492+}
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.166/mips_backend.diff b/meta/recipes-devtools/elfutils/elfutils-0.166/mips_backend.diff
new file mode 100644
index 0000000000..de1237be09
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.166/mips_backend.diff
@@ -0,0 +1,711 @@
1Index: elfutils-0.164/backends/mips_init.c
2===================================================================
3--- /dev/null
4+++ elfutils-0.164/backends/mips_init.c
5@@ -0,0 +1,59 @@
6+/* Initialization of mips specific backend library.
7+ Copyright (C) 2006 Red Hat, Inc.
8+ This file is part of Red Hat elfutils.
9+
10+ Red Hat elfutils is free software; you can redistribute it and/or modify
11+ it under the terms of the GNU General Public License as published by the
12+ Free Software Foundation; version 2 of the License.
13+
14+ Red Hat elfutils is distributed in the hope that it will be useful, but
15+ WITHOUT ANY WARRANTY; without even the implied warranty of
16+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17+ General Public License for more details.
18+
19+ You should have received a copy of the GNU General Public License along
20+ with Red Hat elfutils; if not, write to the Free Software Foundation,
21+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
22+
23+ Red Hat elfutils is an included package of the Open Invention Network.
24+ An included package of the Open Invention Network is a package for which
25+ Open Invention Network licensees cross-license their patents. No patent
26+ license is granted, either expressly or impliedly, by designation as an
27+ included package. Should you wish to participate in the Open Invention
28+ Network licensing program, please visit www.openinventionnetwork.com
29+ <http://www.openinventionnetwork.com>. */
30+
31+#ifdef HAVE_CONFIG_H
32+# include <config.h>
33+#endif
34+
35+#define BACKEND mips_
36+#define RELOC_PREFIX R_MIPS_
37+#include "libebl_CPU.h"
38+
39+/* This defines the common reloc hooks based on mips_reloc.def. */
40+#include "common-reloc.c"
41+
42+const char *
43+mips_init (Elf *elf __attribute__ ((unused)),
44+ GElf_Half machine __attribute__ ((unused)),
45+ Ebl *eh,
46+ size_t ehlen)
47+{
48+ /* Check whether the Elf_BH object has a sufficent size. */
49+ if (ehlen < sizeof (Ebl))
50+ return NULL;
51+
52+ /* We handle it. */
53+ if (machine == EM_MIPS)
54+ eh->name = "MIPS R3000 big-endian";
55+ else if (machine == EM_MIPS_RS3_LE)
56+ eh->name = "MIPS R3000 little-endian";
57+
58+ mips_init_reloc (eh);
59+ HOOK (eh, reloc_simple_type);
60+ HOOK (eh, return_value_location);
61+ HOOK (eh, register_info);
62+
63+ return MODVERSION;
64+}
65Index: elfutils-0.164/backends/mips_regs.c
66===================================================================
67--- /dev/null
68+++ elfutils-0.164/backends/mips_regs.c
69@@ -0,0 +1,104 @@
70+/* Register names and numbers for MIPS DWARF.
71+ Copyright (C) 2006 Red Hat, Inc.
72+ This file is part of Red Hat elfutils.
73+
74+ Red Hat elfutils is free software; you can redistribute it and/or modify
75+ it under the terms of the GNU General Public License as published by the
76+ Free Software Foundation; version 2 of the License.
77+
78+ Red Hat elfutils is distributed in the hope that it will be useful, but
79+ WITHOUT ANY WARRANTY; without even the implied warranty of
80+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
81+ General Public License for more details.
82+
83+ You should have received a copy of the GNU General Public License along
84+ with Red Hat elfutils; if not, write to the Free Software Foundation,
85+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
86+
87+ Red Hat elfutils is an included package of the Open Invention Network.
88+ An included package of the Open Invention Network is a package for which
89+ Open Invention Network licensees cross-license their patents. No patent
90+ license is granted, either expressly or impliedly, by designation as an
91+ included package. Should you wish to participate in the Open Invention
92+ Network licensing program, please visit www.openinventionnetwork.com
93+ <http://www.openinventionnetwork.com>. */
94+
95+#ifdef HAVE_CONFIG_H
96+# include <config.h>
97+#endif
98+
99+#include <string.h>
100+#include <dwarf.h>
101+
102+#define BACKEND mips_
103+#include "libebl_CPU.h"
104+
105+ssize_t
106+mips_register_info (Ebl *ebl __attribute__((unused)),
107+ int regno, char *name, size_t namelen,
108+ const char **prefix, const char **setname,
109+ int *bits, int *type)
110+{
111+ if (name == NULL)
112+ return 66;
113+
114+ if (regno < 0 || regno > 65 || namelen < 4)
115+ return -1;
116+
117+ *prefix = "$";
118+
119+ if (regno < 32)
120+ {
121+ *setname = "integer";
122+ *type = DW_ATE_signed;
123+ *bits = 32;
124+ if (regno < 32 + 10)
125+ {
126+ name[0] = regno + '0';
127+ namelen = 1;
128+ }
129+ else
130+ {
131+ name[0] = (regno / 10) + '0';
132+ name[1] = (regno % 10) + '0';
133+ namelen = 2;
134+ }
135+ }
136+ else if (regno < 64)
137+ {
138+ *setname = "FPU";
139+ *type = DW_ATE_float;
140+ *bits = 32;
141+ name[0] = 'f';
142+ if (regno < 32 + 10)
143+ {
144+ name[1] = (regno - 32) + '0';
145+ namelen = 2;
146+ }
147+ else
148+ {
149+ name[1] = (regno - 32) / 10 + '0';
150+ name[2] = (regno - 32) % 10 + '0';
151+ namelen = 3;
152+ }
153+ }
154+ else if (regno == 64)
155+ {
156+ *type = DW_ATE_signed;
157+ *bits = 32;
158+ name[0] = 'h';
159+ name[1] = 'i';
160+ namelen = 2;
161+ }
162+ else
163+ {
164+ *type = DW_ATE_signed;
165+ *bits = 32;
166+ name[0] = 'l';
167+ name[1] = 'o';
168+ namelen = 2;
169+ }
170+
171+ name[namelen++] = '\0';
172+ return namelen;
173+}
174Index: elfutils-0.164/backends/mips_reloc.def
175===================================================================
176--- /dev/null
177+++ elfutils-0.164/backends/mips_reloc.def
178@@ -0,0 +1,79 @@
179+/* List the relocation types for mips. -*- C -*-
180+ Copyright (C) 2006 Red Hat, Inc.
181+ This file is part of Red Hat elfutils.
182+
183+ Red Hat elfutils is free software; you can redistribute it and/or modify
184+ it under the terms of the GNU General Public License as published by the
185+ Free Software Foundation; version 2 of the License.
186+
187+ Red Hat elfutils is distributed in the hope that it will be useful, but
188+ WITHOUT ANY WARRANTY; without even the implied warranty of
189+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
190+ General Public License for more details.
191+
192+ You should have received a copy of the GNU General Public License along
193+ with Red Hat elfutils; if not, write to the Free Software Foundation,
194+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
195+
196+ Red Hat elfutils is an included package of the Open Invention Network.
197+ An included package of the Open Invention Network is a package for which
198+ Open Invention Network licensees cross-license their patents. No patent
199+ license is granted, either expressly or impliedly, by designation as an
200+ included package. Should you wish to participate in the Open Invention
201+ Network licensing program, please visit www.openinventionnetwork.com
202+ <http://www.openinventionnetwork.com>. */
203+
204+/* NAME, REL|EXEC|DYN */
205+
206+RELOC_TYPE (NONE, 0)
207+RELOC_TYPE (16, 0)
208+RELOC_TYPE (32, 0)
209+RELOC_TYPE (REL32, 0)
210+RELOC_TYPE (26, 0)
211+RELOC_TYPE (HI16, 0)
212+RELOC_TYPE (LO16, 0)
213+RELOC_TYPE (GPREL16, 0)
214+RELOC_TYPE (LITERAL, 0)
215+RELOC_TYPE (GOT16, 0)
216+RELOC_TYPE (PC16, 0)
217+RELOC_TYPE (CALL16, 0)
218+RELOC_TYPE (GPREL32, 0)
219+
220+RELOC_TYPE (SHIFT5, 0)
221+RELOC_TYPE (SHIFT6, 0)
222+RELOC_TYPE (64, 0)
223+RELOC_TYPE (GOT_DISP, 0)
224+RELOC_TYPE (GOT_PAGE, 0)
225+RELOC_TYPE (GOT_OFST, 0)
226+RELOC_TYPE (GOT_HI16, 0)
227+RELOC_TYPE (GOT_LO16, 0)
228+RELOC_TYPE (SUB, 0)
229+RELOC_TYPE (INSERT_A, 0)
230+RELOC_TYPE (INSERT_B, 0)
231+RELOC_TYPE (DELETE, 0)
232+RELOC_TYPE (HIGHER, 0)
233+RELOC_TYPE (HIGHEST, 0)
234+RELOC_TYPE (CALL_HI16, 0)
235+RELOC_TYPE (CALL_LO16, 0)
236+RELOC_TYPE (SCN_DISP, 0)
237+RELOC_TYPE (REL16, 0)
238+RELOC_TYPE (ADD_IMMEDIATE, 0)
239+RELOC_TYPE (PJUMP, 0)
240+RELOC_TYPE (RELGOT, 0)
241+RELOC_TYPE (JALR, 0)
242+RELOC_TYPE (TLS_DTPMOD32, 0)
243+RELOC_TYPE (TLS_DTPREL32, 0)
244+RELOC_TYPE (TLS_DTPMOD64, 0)
245+RELOC_TYPE (TLS_DTPREL64, 0)
246+RELOC_TYPE (TLS_GD, 0)
247+RELOC_TYPE (TLS_LDM, 0)
248+RELOC_TYPE (TLS_DTPREL_HI16, 0)
249+RELOC_TYPE (TLS_DTPREL_LO16, 0)
250+RELOC_TYPE (TLS_GOTTPREL, 0)
251+RELOC_TYPE (TLS_TPREL32, 0)
252+RELOC_TYPE (TLS_TPREL64, 0)
253+RELOC_TYPE (TLS_TPREL_HI16, 0)
254+RELOC_TYPE (TLS_TPREL_LO16, 0)
255+
256+#define NO_COPY_RELOC 1
257+#define NO_RELATIVE_RELOC 1
258Index: elfutils-0.164/backends/mips_retval.c
259===================================================================
260--- /dev/null
261+++ elfutils-0.164/backends/mips_retval.c
262@@ -0,0 +1,321 @@
263+/* Function return value location for Linux/mips ABI.
264+ Copyright (C) 2005 Red Hat, Inc.
265+ This file is part of Red Hat elfutils.
266+
267+ Red Hat elfutils is free software; you can redistribute it and/or modify
268+ it under the terms of the GNU General Public License as published by the
269+ Free Software Foundation; version 2 of the License.
270+
271+ Red Hat elfutils is distributed in the hope that it will be useful, but
272+ WITHOUT ANY WARRANTY; without even the implied warranty of
273+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
274+ General Public License for more details.
275+
276+ You should have received a copy of the GNU General Public License along
277+ with Red Hat elfutils; if not, write to the Free Software Foundation,
278+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
279+
280+ Red Hat elfutils is an included package of the Open Invention Network.
281+ An included package of the Open Invention Network is a package for which
282+ Open Invention Network licensees cross-license their patents. No patent
283+ license is granted, either expressly or impliedly, by designation as an
284+ included package. Should you wish to participate in the Open Invention
285+ Network licensing program, please visit www.openinventionnetwork.com
286+ <http://www.openinventionnetwork.com>. */
287+
288+#ifdef HAVE_CONFIG_H
289+# include <config.h>
290+#endif
291+
292+#include <string.h>
293+#include <assert.h>
294+#include <dwarf.h>
295+#include <elf.h>
296+
297+#include "../libebl/libeblP.h"
298+#include "../libdw/libdwP.h"
299+
300+#define BACKEND mips_
301+#include "libebl_CPU.h"
302+
303+/* The ABI of the file. Also see EF_MIPS_ABI2 above. */
304+#define EF_MIPS_ABI 0x0000F000
305+
306+/* The original o32 abi. */
307+#define E_MIPS_ABI_O32 0x00001000
308+
309+/* O32 extended to work on 64 bit architectures */
310+#define E_MIPS_ABI_O64 0x00002000
311+
312+/* EABI in 32 bit mode */
313+#define E_MIPS_ABI_EABI32 0x00003000
314+
315+/* EABI in 64 bit mode */
316+#define E_MIPS_ABI_EABI64 0x00004000
317+
318+/* All the possible MIPS ABIs. */
319+enum mips_abi
320+ {
321+ MIPS_ABI_UNKNOWN = 0,
322+ MIPS_ABI_N32,
323+ MIPS_ABI_O32,
324+ MIPS_ABI_N64,
325+ MIPS_ABI_O64,
326+ MIPS_ABI_EABI32,
327+ MIPS_ABI_EABI64,
328+ MIPS_ABI_LAST
329+ };
330+
331+/* Find the mips ABI of the current file */
332+enum mips_abi find_mips_abi(Elf *elf)
333+{
334+ GElf_Ehdr ehdr_mem;
335+ GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem);
336+
337+ if (ehdr == NULL)
338+ return MIPS_ABI_LAST;
339+
340+ GElf_Word elf_flags = ehdr->e_flags;
341+
342+ /* Check elf_flags to see if it specifies the ABI being used. */
343+ switch ((elf_flags & EF_MIPS_ABI))
344+ {
345+ case E_MIPS_ABI_O32:
346+ return MIPS_ABI_O32;
347+ case E_MIPS_ABI_O64:
348+ return MIPS_ABI_O64;
349+ case E_MIPS_ABI_EABI32:
350+ return MIPS_ABI_EABI32;
351+ case E_MIPS_ABI_EABI64:
352+ return MIPS_ABI_EABI64;
353+ default:
354+ if ((elf_flags & EF_MIPS_ABI2))
355+ return MIPS_ABI_N32;
356+ }
357+
358+ /* GCC creates a pseudo-section whose name describes the ABI. */
359+ size_t shstrndx;
360+ if (elf_getshdrstrndx (elf, &shstrndx) < 0)
361+ return MIPS_ABI_LAST;
362+
363+ const char *name;
364+ Elf_Scn *scn = NULL;
365+ while ((scn = elf_nextscn (elf, scn)) != NULL)
366+ {
367+ GElf_Shdr shdr_mem;
368+ GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
369+ if (shdr == NULL)
370+ return MIPS_ABI_LAST;
371+
372+ name = elf_strptr (elf, shstrndx, shdr->sh_name) ?: "";
373+ if (strncmp (name, ".mdebug.", 8) != 0)
374+ continue;
375+
376+ if (strcmp (name, ".mdebug.abi32") == 0)
377+ return MIPS_ABI_O32;
378+ else if (strcmp (name, ".mdebug.abiN32") == 0)
379+ return MIPS_ABI_N32;
380+ else if (strcmp (name, ".mdebug.abi64") == 0)
381+ return MIPS_ABI_N64;
382+ else if (strcmp (name, ".mdebug.abiO64") == 0)
383+ return MIPS_ABI_O64;
384+ else if (strcmp (name, ".mdebug.eabi32") == 0)
385+ return MIPS_ABI_EABI32;
386+ else if (strcmp (name, ".mdebug.eabi64") == 0)
387+ return MIPS_ABI_EABI64;
388+ else
389+ return MIPS_ABI_UNKNOWN;
390+ }
391+
392+ return MIPS_ABI_UNKNOWN;
393+}
394+
395+unsigned int
396+mips_abi_regsize (enum mips_abi abi)
397+{
398+ switch (abi)
399+ {
400+ case MIPS_ABI_EABI32:
401+ case MIPS_ABI_O32:
402+ return 4;
403+ case MIPS_ABI_N32:
404+ case MIPS_ABI_N64:
405+ case MIPS_ABI_O64:
406+ case MIPS_ABI_EABI64:
407+ return 8;
408+ case MIPS_ABI_UNKNOWN:
409+ case MIPS_ABI_LAST:
410+ default:
411+ return 0;
412+ }
413+}
414+
415+
416+/* $v0 or pair $v0, $v1 */
417+static const Dwarf_Op loc_intreg_o32[] =
418+ {
419+ { .atom = DW_OP_reg2 }, { .atom = DW_OP_piece, .number = 4 },
420+ { .atom = DW_OP_reg3 }, { .atom = DW_OP_piece, .number = 4 },
421+ };
422+
423+static const Dwarf_Op loc_intreg[] =
424+ {
425+ { .atom = DW_OP_reg2 }, { .atom = DW_OP_piece, .number = 8 },
426+ { .atom = DW_OP_reg3 }, { .atom = DW_OP_piece, .number = 8 },
427+ };
428+#define nloc_intreg 1
429+#define nloc_intregpair 4
430+
431+/* $f0 (float), or pair $f0, $f1 (double).
432+ * f2/f3 are used for COMPLEX (= 2 doubles) returns in Fortran */
433+static const Dwarf_Op loc_fpreg_o32[] =
434+ {
435+ { .atom = DW_OP_regx, .number = 32 }, { .atom = DW_OP_piece, .number = 4 },
436+ { .atom = DW_OP_regx, .number = 33 }, { .atom = DW_OP_piece, .number = 4 },
437+ { .atom = DW_OP_regx, .number = 34 }, { .atom = DW_OP_piece, .number = 4 },
438+ { .atom = DW_OP_regx, .number = 35 }, { .atom = DW_OP_piece, .number = 4 },
439+ };
440+
441+/* $f0, or pair $f0, $f2. */
442+static const Dwarf_Op loc_fpreg[] =
443+ {
444+ { .atom = DW_OP_regx, .number = 32 }, { .atom = DW_OP_piece, .number = 8 },
445+ { .atom = DW_OP_regx, .number = 34 }, { .atom = DW_OP_piece, .number = 8 },
446+ };
447+#define nloc_fpreg 1
448+#define nloc_fpregpair 4
449+#define nloc_fpregquad 8
450+
451+/* The return value is a structure and is actually stored in stack space
452+ passed in a hidden argument by the caller. But, the compiler
453+ helpfully returns the address of that space in $v0. */
454+static const Dwarf_Op loc_aggregate[] =
455+ {
456+ { .atom = DW_OP_breg2, .number = 0 }
457+ };
458+#define nloc_aggregate 1
459+
460+int
461+mips_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
462+{
463+ /* First find the ABI used by the elf object */
464+ enum mips_abi abi = find_mips_abi(functypedie->cu->dbg->elf);
465+
466+ /* Something went seriously wrong while trying to figure out the ABI */
467+ if (abi == MIPS_ABI_LAST)
468+ return -1;
469+
470+ /* We couldn't identify the ABI, but the file seems valid */
471+ if (abi == MIPS_ABI_UNKNOWN)
472+ return -2;
473+
474+ /* Can't handle EABI variants */
475+ if ((abi == MIPS_ABI_EABI32) || (abi == MIPS_ABI_EABI64))
476+ return -2;
477+
478+ unsigned int regsize = mips_abi_regsize (abi);
479+ if (!regsize)
480+ return -2;
481+
482+ /* Start with the function's type, and get the DW_AT_type attribute,
483+ which is the type of the return value. */
484+
485+ Dwarf_Attribute attr_mem;
486+ Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, &attr_mem);
487+ if (attr == NULL)
488+ /* The function has no return value, like a `void' function in C. */
489+ return 0;
490+
491+ Dwarf_Die die_mem;
492+ Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem);
493+ int tag = dwarf_tag (typedie);
494+
495+ /* Follow typedefs and qualifiers to get to the actual type. */
496+ while (tag == DW_TAG_typedef
497+ || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type
498+ || tag == DW_TAG_restrict_type)
499+ {
500+ attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
501+ typedie = dwarf_formref_die (attr, &die_mem);
502+ tag = dwarf_tag (typedie);
503+ }
504+
505+ switch (tag)
506+ {
507+ case -1:
508+ return -1;
509+
510+ case DW_TAG_subrange_type:
511+ if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size))
512+ {
513+ attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem);
514+ typedie = dwarf_formref_die (attr, &die_mem);
515+ tag = dwarf_tag (typedie);
516+ }
517+ /* Fall through. */
518+
519+ case DW_TAG_base_type:
520+ case DW_TAG_enumeration_type:
521+ case DW_TAG_pointer_type:
522+ case DW_TAG_ptr_to_member_type:
523+ {
524+ Dwarf_Word size;
525+ if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size,
526+ &attr_mem), &size) != 0)
527+ {
528+ if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
529+ size = regsize;
530+ else
531+ return -1;
532+ }
533+ if (tag == DW_TAG_base_type)
534+ {
535+ Dwarf_Word encoding;
536+ if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding,
537+ &attr_mem), &encoding) != 0)
538+ return -1;
539+
540+#define ABI_LOC(loc, regsize) ((regsize) == 4 ? (loc ## _o32) : (loc))
541+
542+ if (encoding == DW_ATE_float)
543+ {
544+ *locp = ABI_LOC(loc_fpreg, regsize);
545+ if (size <= regsize)
546+ return nloc_fpreg;
547+
548+ if (size <= 2*regsize)
549+ return nloc_fpregpair;
550+
551+ if (size <= 4*regsize && abi == MIPS_ABI_O32)
552+ return nloc_fpregquad;
553+
554+ goto aggregate;
555+ }
556+ }
557+ *locp = ABI_LOC(loc_intreg, regsize);
558+ if (size <= regsize)
559+ return nloc_intreg;
560+ if (size <= 2*regsize)
561+ return nloc_intregpair;
562+
563+ /* Else fall through. Shouldn't happen though (at least with gcc) */
564+ }
565+
566+ case DW_TAG_structure_type:
567+ case DW_TAG_class_type:
568+ case DW_TAG_union_type:
569+ case DW_TAG_array_type:
570+ aggregate:
571+ /* XXX TODO: Can't handle structure return with other ABI's yet :-/ */
572+ if ((abi != MIPS_ABI_O32) && (abi != MIPS_ABI_O64))
573+ return -2;
574+
575+ *locp = loc_aggregate;
576+ return nloc_aggregate;
577+ }
578+
579+ /* XXX We don't have a good way to return specific errors from ebl calls.
580+ This value means we do not understand the type, but it is well-formed
581+ DWARF and might be valid. */
582+ return -2;
583+}
584Index: elfutils-0.164/backends/mips_symbol.c
585===================================================================
586--- /dev/null
587+++ elfutils-0.164/backends/mips_symbol.c
588@@ -0,0 +1,52 @@
589+/* MIPS specific symbolic name handling.
590+ Copyright (C) 2002, 2003, 2005 Red Hat, Inc.
591+ This file is part of Red Hat elfutils.
592+ Written by Jakub Jelinek <jakub@redhat.com>, 2002.
593+
594+ Red Hat elfutils is free software; you can redistribute it and/or modify
595+ it under the terms of the GNU General Public License as published by the
596+ Free Software Foundation; version 2 of the License.
597+
598+ Red Hat elfutils is distributed in the hope that it will be useful, but
599+ WITHOUT ANY WARRANTY; without even the implied warranty of
600+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
601+ General Public License for more details.
602+
603+ You should have received a copy of the GNU General Public License along
604+ with Red Hat elfutils; if not, write to the Free Software Foundation,
605+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
606+
607+ Red Hat elfutils is an included package of the Open Invention Network.
608+ An included package of the Open Invention Network is a package for which
609+ Open Invention Network licensees cross-license their patents. No patent
610+ license is granted, either expressly or impliedly, by designation as an
611+ included package. Should you wish to participate in the Open Invention
612+ Network licensing program, please visit www.openinventionnetwork.com
613+ <http://www.openinventionnetwork.com>. */
614+
615+#ifdef HAVE_CONFIG_H
616+# include <config.h>
617+#endif
618+
619+#include <elf.h>
620+#include <stddef.h>
621+
622+#define BACKEND mips_
623+#include "libebl_CPU.h"
624+
625+/* Check for the simple reloc types. */
626+Elf_Type
627+mips_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
628+{
629+ switch (type)
630+ {
631+ case R_MIPS_16:
632+ return ELF_T_HALF;
633+ case R_MIPS_32:
634+ return ELF_T_WORD;
635+ case R_MIPS_64:
636+ return ELF_T_XWORD;
637+ default:
638+ return ELF_T_NUM;
639+ }
640+}
641Index: elfutils-0.164/libebl/eblopenbackend.c
642===================================================================
643--- elfutils-0.164.orig/libebl/eblopenbackend.c
644+++ elfutils-0.164/libebl/eblopenbackend.c
645@@ -71,6 +71,8 @@ static const struct
646 { "sparc", "elf_sparc", "sparc", 5, EM_SPARC, 0, 0 },
647 { "sparc", "elf_sparcv8plus", "sparc", 5, EM_SPARC32PLUS, 0, 0 },
648 { "s390", "ebl_s390", "s390", 4, EM_S390, 0, 0 },
649+ { "mips", "elf_mips", "mips", 4, EM_MIPS, 0, 0 },
650+ { "mips", "elf_mipsel", "mipsel", 4, EM_MIPS_RS3_LE, 0, 0 },
651
652 { "m32", "elf_m32", "m32", 3, EM_M32, 0, 0 },
653 { "m68k", "elf_m68k", "m68k", 4, EM_68K, 0, 0 },
654Index: elfutils-0.164/backends/common-reloc.c
655===================================================================
656--- elfutils-0.164.orig/backends/common-reloc.c
657+++ elfutils-0.164/backends/common-reloc.c
658@@ -125,11 +125,13 @@ EBLHOOK(reloc_valid_use) (Elf *elf, int
659 }
660
661
662+#ifndef NO_COPY_RELOC
663 bool
664 EBLHOOK(copy_reloc_p) (int reloc)
665 {
666 return reloc == R_TYPE (COPY);
667 }
668+#endif
669
670 bool
671 EBLHOOK(none_reloc_p) (int reloc)
672@@ -151,7 +153,9 @@ EBLHOOK(init_reloc) (Ebl *ebl)
673 ebl->reloc_type_name = EBLHOOK(reloc_type_name);
674 ebl->reloc_type_check = EBLHOOK(reloc_type_check);
675 ebl->reloc_valid_use = EBLHOOK(reloc_valid_use);
676+#ifndef NO_COPY_RELOC
677 ebl->copy_reloc_p = EBLHOOK(copy_reloc_p);
678+#endif
679 ebl->none_reloc_p = EBLHOOK(none_reloc_p);
680 #ifndef NO_RELATIVE_RELOC
681 ebl->relative_reloc_p = EBLHOOK(relative_reloc_p);
682Index: elfutils-0.164/backends/Makefile.am
683===================================================================
684--- elfutils-0.164.orig/backends/Makefile.am
685+++ elfutils-0.164/backends/Makefile.am
686@@ -33,12 +33,12 @@ AM_CPPFLAGS += -I$(top_srcdir)/libebl -I
687
688
689 modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \
690- tilegx parisc
691+ tilegx parisc mips
692 libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a \
693 libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a \
694 libebl_aarch64_pic.a libebl_sparc_pic.a libebl_ppc_pic.a \
695 libebl_ppc64_pic.a libebl_s390_pic.a libebl_tilegx_pic.a \
696- libebl_parisc_pic.a
697+ libebl_parisc_pic.a libebl_mips_pic.a
698 noinst_LIBRARIES = $(libebl_pic)
699 noinst_DATA = $(libebl_pic:_pic.a=.so)
700
701@@ -116,6 +116,10 @@ parisc_SRCS = parisc_init.c parisc_symbo
702 libebl_parisc_pic_a_SOURCES = $(parisc_SRCS)
703 am_libebl_parisc_pic_a_OBJECTS = $(parisc_SRCS:.c=.os)
704
705+mips_SRCS = mips_init.c mips_symbol.c mips_regs.c mips_retval.c
706+libebl_mips_pic_a_SOURCES = $(mips_SRCS)
707+am_libebl_mips_pic_a_OBJECTS = $(mips_SRCS:.c=.os)
708+
709 libebl_%.so libebl_%.map: libebl_%_pic.a $(libelf) $(libdw)
710 @rm -f $(@:.so=.map)
711 $(AM_V_at)echo 'ELFUTILS_$(PACKAGE_VERSION) { global: $*_init; local: *; };' \
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.166/mips_readelf_w.patch b/meta/recipes-devtools/elfutils/elfutils-0.166/mips_readelf_w.patch
new file mode 100644
index 0000000000..930d6f664e
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.166/mips_readelf_w.patch
@@ -0,0 +1,22 @@
1From: Kurt Roeckx <kurt@roeckx.be>
2Subject: Make readelf -w output debug information on mips
3Bug-Debian: http://bugs.debian.org/662041
4Forwarded: not-needed
5
6Upstreams wants a change where this is handled by a hook that needs
7to be filled in by the backend for the arch.
8
9Index: elfutils-0.164/src/readelf.c
10===================================================================
11--- elfutils-0.164.orig/src/readelf.c
12+++ elfutils-0.164/src/readelf.c
13@@ -8218,7 +8218,8 @@ print_debug (Dwfl_Module *dwflmod, Ebl *
14 GElf_Shdr shdr_mem;
15 GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
16
17- if (shdr != NULL && shdr->sh_type == SHT_PROGBITS)
18+ if (shdr != NULL && (
19+ (shdr->sh_type == SHT_PROGBITS) || (shdr->sh_type == SHT_MIPS_DWARF)))
20 {
21 static const struct
22 {
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.166/shadow.patch b/meta/recipes-devtools/elfutils/elfutils-0.166/shadow.patch
new file mode 100644
index 0000000000..d31961f94f
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.166/shadow.patch
@@ -0,0 +1,23 @@
1Fix control path where we have str as uninitialized string
2
3| /home/ubuntu/work/oe/openembedded-core/build/tmp-musl/work/i586-oe-linux-musl/elfutils/0.164-r0/elfutils-0.164/libcpu/i386_disasm.c: In function 'i386_disasm':
4| /home/ubuntu/work/oe/openembedded-core/build/tmp-musl/work/i586-oe-linux-musl/elfutils/0.164-r0/elfutils-0.164/libcpu/i386_disasm.c:310:5: error: 'str' may be used uninitialized in this function [-Werror=maybe-uninitialized]
5| memcpy (buf + bufcnt, _str, _len); \
6| ^
7| /home/ubuntu/work/oe/openembedded-core/build/tmp-musl/work/i586-oe-linux-musl/elfutils/0.164-r0/elfutils-0.164/libcpu/i386_disasm.c:709:17: note: 'str' was declared here
8| const char *str;
9
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11Upstream-Status: Pending
12Index: elfutils-0.164/libcpu/i386_disasm.c
13===================================================================
14--- elfutils-0.164.orig/libcpu/i386_disasm.c
15+++ elfutils-0.164/libcpu/i386_disasm.c
16@@ -821,6 +821,7 @@ i386_disasm (const uint8_t **startp, con
17 }
18
19 default:
20+ str = "";
21 assert (! "INVALID not handled");
22 }
23 }
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.166/testsuite-ignore-elflint.diff b/meta/recipes-devtools/elfutils/elfutils-0.166/testsuite-ignore-elflint.diff
new file mode 100644
index 0000000000..eae5796de3
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.166/testsuite-ignore-elflint.diff
@@ -0,0 +1,39 @@
1On many architectures this test fails because binaries/libs produced by
2binutils don't pass elflint. However elfutils shouldn't FTBFS because of this.
3
4So we run the tests on all archs to see what breaks, but if it breaks we ignore
5the result (exitcode 77 means: this test was skipped).
6
7Index: elfutils-0.156/tests/run-elflint-self.sh
8===================================================================
9--- elfutils-0.156.orig/tests/run-elflint-self.sh 2013-07-28 14:35:36.000000000 +0200
10+++ elfutils-0.156/tests/run-elflint-self.sh 2013-07-28 14:36:10.000000000 +0200
11@@ -18,4 +18,4 @@
12
13 . $srcdir/test-subr.sh
14
15-testrun_on_self ${abs_top_builddir}/src/elflint --quiet --gnu-ld
16+testrun_on_self_skip ${abs_top_builddir}/src/elflint --quiet --gnu-ld
17Index: elfutils-0.156/tests/test-subr.sh
18===================================================================
19--- elfutils-0.156.orig/tests/test-subr.sh 2013-07-28 14:35:36.000000000 +0200
20+++ elfutils-0.156/tests/test-subr.sh 2013-07-28 14:35:36.000000000 +0200
21@@ -149,3 +149,18 @@
22 # Only exit if something failed
23 if test $exit_status != 0; then exit $exit_status; fi
24 }
25+
26+# Same as testrun_on_self(), but skip on failure.
27+testrun_on_self_skip()
28+{
29+ exit_status=0
30+
31+ for file in $self_test_files; do
32+ testrun $* $file \
33+ || { echo "*** failure in $* $file"; exit_status=77; }
34+ done
35+
36+ # Only exit if something failed
37+ if test $exit_status != 0; then exit $exit_status; fi
38+}
39+
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.166/uclibc-support.patch b/meta/recipes-devtools/elfutils/elfutils-0.166/uclibc-support.patch
new file mode 100644
index 0000000000..62999985cc
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.166/uclibc-support.patch
@@ -0,0 +1,128 @@
1From 3daec2dd11a04955f95e8f65a48820103d84dbec Mon Sep 17 00:00:00 2001
2From: Junling Zheng <zhengjunling@huawei.com>
3Date: Thu, 9 Apr 2015 12:12:49 +0000
4Subject: [PATCH] uclibc support for elfutils 0.161
5
6on uclibc systems libintl and libuargp are separate from libc.
7so they need to be specified on commandline when we use proxy-libintl
8then libintl is a static archive so it should be listed last since
9elfutils does not respect disable-nls we need to link in libintl
10
11We add a new option --enable-uclibc which will be used to control
12the uclibc specific configurations during build.
13
14Upstream-Status: Inappropriate [uclibc specific]
15
16Signed-off-by: Khem Raj <raj.khem>
17Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
18[Junling Zheng:
19 - adjust context
20]
21---
22 configure.ac | 8 ++++++++
23 libcpu/Makefile.am | 4 ++++
24 libdw/Makefile.am | 7 ++++++-
25 libelf/Makefile.am | 5 +++++
26 4 files changed, 23 insertions(+), 1 deletion(-)
27
28Index: elfutils-0.166/configure.ac
29===================================================================
30--- elfutils-0.166.orig/configure.ac
31+++ elfutils-0.166/configure.ac
32@@ -79,6 +79,14 @@ AS_IF([test "$use_locks" = yes],
33
34 AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.])
35
36+AC_ARG_ENABLE([uclibc],
37+AS_HELP_STRING([--enable-uclibc], [Use uclibc for system libraries]),
38+use_uclibc=yes, use_uclibc=no)
39+AM_CONDITIONAL(USE_UCLIBC, test "$use_uclibc" = yes)
40+AS_IF([test "$use_uclibc" = yes], [AC_DEFINE(USE_UCLIBC)])
41+
42+AH_TEMPLATE([USE_UCLIBC], [Defined if uclibc libraries are used.])
43+
44 AC_PROG_CC
45 AC_PROG_RANLIB
46 AC_PROG_YACC
47@@ -347,18 +355,13 @@ AC_LINK_IFELSE(
48 )
49
50 dnl If our libc doesn't provide argp, then test for libargp
51-if test "$libc_has_argp" = "false" ; then
52- AC_MSG_WARN("libc does not have argp")
53- AC_CHECK_LIB([argp], [argp_parse], [have_argp="true"], [have_argp="false"])
54-
55- if test "$have_argp" = "false"; then
56- AC_MSG_ERROR("no libargp found")
57- else
58- argp_LDADD="-largp"
59- fi
60-else
61- argp_LDADD=""
62-fi
63+AS_IF([test "x$libc_has_argp" = "xfalse"],
64+ [AC_MSG_WARN("libc does not have argp")
65+ AC_CHECK_LIB([argp], [argp_parse], [have_argp="true" argp_LDADD="-largp"], [have_argp="false"])], [argp_LDADD=""])
66+
67+AS_IF([test "x$libc_has_argp" = "xfalse" -a "x$have_argp" = "xfalse"],
68+ AC_CHECK_LIB([uargp], [argp_parse], [have_uargp="true" argp_LDADD="-luargp"], [have_uargp="false"])], [argp_LDADD=""])
69+
70 AC_SUBST([argp_LDADD])
71
72 dnl The directories with content.
73Index: elfutils-0.166/libcpu/Makefile.am
74===================================================================
75--- elfutils-0.166.orig/libcpu/Makefile.am
76+++ elfutils-0.166/libcpu/Makefile.am
77@@ -80,6 +80,10 @@ i386_parse_CFLAGS = -DNMNES="`wc -l < i3
78 i386_lex.o: i386_parse.h
79 i386_gendis_LDADD = $(libeu) -lm
80
81+if USE_UCLIBC
82+i386_gendis_LDADD += -lintl
83+endif
84+
85 i386_parse.h: i386_parse.c ;
86
87 EXTRA_DIST = defs/i386
88Index: elfutils-0.166/libdw/Makefile.am
89===================================================================
90--- elfutils-0.166.orig/libdw/Makefile.am
91+++ elfutils-0.166/libdw/Makefile.am
92@@ -102,6 +102,11 @@ endif
93 libdw_pic_a_SOURCES =
94 am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
95
96+libdw_so_LDLIBS =
97+if USE_UCLIBC
98+libdw_so_LDLIBS += -lintl
99+endif
100+
101 libdw_so_SOURCES =
102 libdw.so$(EXEEXT): $(srcdir)/libdw.map libdw_pic.a ../libdwelf/libdwelf_pic.a \
103 ../libdwfl/libdwfl_pic.a ../libebl/libebl.a \
104@@ -112,7 +117,7 @@ libdw.so$(EXEEXT): $(srcdir)/libdw.map l
105 -Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
106 -Wl,--version-script,$<,--no-undefined \
107 -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
108- -ldl -lz $(argp_LDADD) $(zip_LIBS)
109+ -ldl -lz $(argp_LDADD) $(zip_LIBS) $(libdw_so_LDLIBS)
110 @$(textrel_check)
111 $(AM_V_at)ln -fs $@ $@.$(VERSION)
112
113Index: elfutils-0.166/libelf/Makefile.am
114===================================================================
115--- elfutils-0.166.orig/libelf/Makefile.am
116+++ elfutils-0.166/libelf/Makefile.am
117@@ -96,6 +96,11 @@ libelf_pic_a_SOURCES =
118 am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os)
119
120 libelf_so_LDLIBS = -lz
121+
122+if USE_UCLIBC
123+libelf_so_LDLIBS += -lintl
124+endif
125+
126 if USE_LOCKS
127 libelf_so_LDLIBS += -lpthread
128 endif